Merges bug fixes and cleanup with master (#17)
This commit is contained in:
parent
39dfe86e10
commit
55136d8842
33 changed files with 157 additions and 234 deletions
|
|
@ -142,7 +142,7 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
|
||||
public void InvalidateContainers( object parent )
|
||||
public void InvalidateContainers(IEntity parent)
|
||||
{
|
||||
if ( parent is Container c )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public Mobile Thrower{ get; private set; }
|
||||
|
||||
private Mobile FindOwner(object parent)
|
||||
private Mobile FindOwner(IEntity parent)
|
||||
{
|
||||
if (parent is Item item)
|
||||
return item.RootParent as Mobile;
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ namespace Server.Engines.ConPVP
|
|||
MoveToWorld(m_TeamInfo.Origin, m_TeamInfo.Game.Facet);
|
||||
}
|
||||
|
||||
private Mobile FindOwner(object parent)
|
||||
private Mobile FindOwner(IEntity parent)
|
||||
{
|
||||
if (parent is Item item)
|
||||
return item.RootParent as Mobile;
|
||||
|
|
@ -1199,4 +1199,4 @@ namespace Server.Engines.ConPVP
|
|||
m_FinishTimer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ namespace Server.Factions
|
|||
return false;
|
||||
}
|
||||
|
||||
private Mobile FindOwner(object parent)
|
||||
private Mobile FindOwner(IEntity parent)
|
||||
{
|
||||
if (parent is Item item)
|
||||
return item.RootParent as Mobile;
|
||||
|
|
@ -453,4 +453,4 @@ namespace Server.Factions
|
|||
base.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,33 +19,31 @@ namespace Server.Engines.Quests.Necro
|
|||
if (m.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
bool sendMessage = m.Player;
|
||||
Mobile mob = m;
|
||||
|
||||
if (m is BaseCreature)
|
||||
m = ((BaseCreature)m).ControlMaster;
|
||||
if (m is BaseCreature creature)
|
||||
mob = creature.ControlMaster;
|
||||
|
||||
if (m is PlayerMobile pm)
|
||||
if (!(mob is PlayerMobile pm))
|
||||
return false;
|
||||
|
||||
QuestSystem qs = pm.Quest;
|
||||
|
||||
if (qs is DarkTidesQuest)
|
||||
{
|
||||
QuestSystem qs = pm.Quest;
|
||||
QuestObjective obj = qs.FindObjective<SpeakCavePasswordObjective>();
|
||||
|
||||
if (qs is DarkTidesQuest)
|
||||
if (obj?.Completed == true)
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective<SpeakCavePasswordObjective>();
|
||||
m.SendLocalizedMessage(
|
||||
1060648); // With Horus' permission, you are able to pass through the barrier.
|
||||
|
||||
if (obj != null && obj.Completed)
|
||||
{
|
||||
if (sendMessage)
|
||||
m.SendLocalizedMessage(
|
||||
1060648); // With Horus' permission, you are able to pass through the barrier.
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (sendMessage)
|
||||
m.SendLocalizedMessage(1060649, "",
|
||||
0x66D); // Without the permission of the guardian Horus, the magic of the barrier prevents your passage.
|
||||
m.SendLocalizedMessage(1060649, "",
|
||||
0x66D); // Without the permission of the guardian Horus, the magic of the barrier prevents your passage.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -64,4 +62,4 @@ namespace Server.Engines.Quests.Necro
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,7 @@ namespace Server.RemoteAdmin
|
|||
public static void Configure()
|
||||
{
|
||||
PacketHandlers.Register(0xF1, 0, false, OnReceive);
|
||||
|
||||
#if !MONO
|
||||
Core.MultiConsoleOut.Add(new EventTextWriter(OnConsoleChar, OnConsoleLine, OnConsoleString));
|
||||
#endif
|
||||
Timer.DelayCall(TimeSpan.FromMinutes(2.5), TimeSpan.FromMinutes(2.5), CleanUp);
|
||||
}
|
||||
|
||||
|
|
@ -279,4 +276,4 @@ namespace Server.RemoteAdmin
|
|||
m_OnLine?.Invoke(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,9 +234,7 @@ namespace Server.Gumps
|
|||
public object FindHouseName(BaseHouse house)
|
||||
{
|
||||
int multiID = house.ItemID;
|
||||
HousePlacementEntry[] entries;
|
||||
|
||||
entries = HousePlacementEntry.ClassicHouses;
|
||||
HousePlacementEntry[] entries = HousePlacementEntry.ClassicHouses;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
if (entries[i].MultiID == multiID)
|
||||
|
|
@ -288,4 +286,4 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ namespace Server.Items
|
|||
if (board.IsChildOf(from.Backpack))
|
||||
return true;
|
||||
|
||||
object root = board.RootParent;
|
||||
IEntity root = board.RootParent;
|
||||
|
||||
if (root is Mobile && root != from)
|
||||
return false;
|
||||
|
|
@ -122,9 +122,7 @@ namespace Server.Items
|
|||
if (board.Deleted || board.Map != from.Map || !from.InRange(board.GetWorldLocation(), 1))
|
||||
return false;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt(board);
|
||||
|
||||
return house != null && house.IsOwner(from);
|
||||
return BaseHouse.FindHouseAt(board)?.IsOwner(from) == true;
|
||||
}
|
||||
|
||||
public class DefaultEntry : ContextMenuEntry
|
||||
|
|
@ -146,4 +144,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,12 +174,7 @@ namespace Server.Items
|
|||
if (!Movable || Protected || !from.InRange(GetWorldLocation(), 2))
|
||||
return false;
|
||||
|
||||
object root = RootParent;
|
||||
|
||||
if (root is Mobile && root != from)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return !(RootParent is Mobile && RootParent != from);
|
||||
}
|
||||
|
||||
public void ConvertToWorld(int x, int y, out int worldX, out int worldY)
|
||||
|
|
@ -381,4 +376,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,11 +83,7 @@ namespace Server.Items
|
|||
list.Add(1060738, worth); // value: ~1_val~
|
||||
}
|
||||
|
||||
#if NEWPARENT
|
||||
public override void OnAdded(IEntity parent)
|
||||
#else
|
||||
public override void OnAdded(object parent)
|
||||
#endif
|
||||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
|
|
@ -98,7 +94,8 @@ namespace Server.Items
|
|||
|
||||
Container root = parent as Container;
|
||||
|
||||
while (root?.Parent is Container) root = (Container)root.Parent;
|
||||
while (root?.Parent is Container container)
|
||||
root = container;
|
||||
|
||||
parent = root ?? parent;
|
||||
|
||||
|
|
@ -247,4 +244,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,11 +44,7 @@ namespace Server.Items
|
|||
UpdateTotal(this, TotalType.Gold, newValue - oldValue);
|
||||
}
|
||||
|
||||
#if NEWPARENT
|
||||
public override void OnAdded(IEntity parent)
|
||||
#else
|
||||
public override void OnAdded(object parent)
|
||||
#endif
|
||||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
|
|
@ -59,7 +55,8 @@ namespace Server.Items
|
|||
|
||||
Container root = parent as Container;
|
||||
|
||||
while (root?.Parent is Container) root = (Container)root.Parent;
|
||||
while (root?.Parent is Container container)
|
||||
root = container;
|
||||
|
||||
parent = root ?? parent;
|
||||
|
||||
|
|
@ -127,4 +124,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace Server.Items
|
|||
}
|
||||
else if (targeted is Item item)
|
||||
{
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
|
||||
if (root != null && root != from || item.Parent == from)
|
||||
{
|
||||
|
|
@ -61,10 +61,7 @@ namespace Server.Items
|
|||
}
|
||||
else if (item.Movable)
|
||||
{
|
||||
if (item.Amount > 1)
|
||||
message = "You place one item on the scale. ";
|
||||
else
|
||||
message = "You place that item on the scale. ";
|
||||
message = item.Amount > 1 ? "You place one item on the scale. " : "You place that item on the scale. ";
|
||||
|
||||
double weight = item.Weight;
|
||||
|
||||
|
|
|
|||
|
|
@ -96,11 +96,13 @@ namespace Server.Items
|
|||
if (m_Kit.Deleted)
|
||||
return;
|
||||
|
||||
if (!(targeted is Corpse) && !(targeted is BigFish))
|
||||
Corpse corpse = targeted as Corpse;
|
||||
|
||||
if (!(corpse != null || targeted is BigFish))
|
||||
{
|
||||
from.SendLocalizedMessage(1042600); // That is not a corpse!
|
||||
}
|
||||
else if (targeted is Corpse corpse && corpse.VisitedByTaxidermist)
|
||||
else if (corpse?.VisitedByTaxidermist == true)
|
||||
{
|
||||
from.SendLocalizedMessage(1042596); // That corpse seems to have been visited by a taxidermist already.
|
||||
}
|
||||
|
|
@ -114,48 +116,46 @@ namespace Server.Items
|
|||
}
|
||||
else
|
||||
{
|
||||
object obj = targeted;
|
||||
object obj = corpse?.Owner ?? targeted;
|
||||
|
||||
if (obj is Corpse)
|
||||
obj = ((Corpse)obj).Owner;
|
||||
foreach (TrophyInfo t in m_Table)
|
||||
{
|
||||
if (t.CreatureType != obj.GetType())
|
||||
continue;
|
||||
|
||||
if (obj != null)
|
||||
for (int i = 0; i < m_Table.Length; i++)
|
||||
if (m_Table[i].CreatureType == obj.GetType())
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if (pack?.ConsumeTotal(typeof(Board), 10) == true)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1042278); // You review the corpse and find it worthy of a trophy.
|
||||
from.SendLocalizedMessage(1042602); // You use your kit up making the trophy.
|
||||
|
||||
Mobile hunter = null;
|
||||
int weight = 0;
|
||||
|
||||
if (targeted is BigFish fish)
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
hunter = fish.Fisher;
|
||||
weight = (int)fish.Weight;
|
||||
|
||||
if (pack != null && pack.ConsumeTotal(typeof(Board), 10))
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1042278); // You review the corpse and find it worthy of a trophy.
|
||||
from.SendLocalizedMessage(1042602); // You use your kit up making the trophy.
|
||||
|
||||
Mobile hunter = null;
|
||||
int weight = 0;
|
||||
|
||||
if (targeted is BigFish fish)
|
||||
{
|
||||
hunter = fish.Fisher;
|
||||
weight = (int)fish.Weight;
|
||||
|
||||
fish.Consume();
|
||||
}
|
||||
|
||||
|
||||
from.AddToBackpack(new TrophyDeed(m_Table[i], hunter, weight));
|
||||
|
||||
if (targeted is Corpse corpse1)
|
||||
corpse1.VisitedByTaxidermist = true;
|
||||
|
||||
m_Kit.Delete();
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1042598); // You do not have enough boards.
|
||||
return;
|
||||
fish.Consume();
|
||||
}
|
||||
|
||||
|
||||
from.AddToBackpack(new TrophyDeed(t, hunter, weight));
|
||||
|
||||
if (corpse != null)
|
||||
corpse.VisitedByTaxidermist = true;
|
||||
|
||||
m_Kit.Delete();
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1042598); // You do not have enough boards.
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1042599); // That does not look like something you want hanging on a wall.
|
||||
}
|
||||
}
|
||||
|
|
@ -539,4 +539,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,17 +45,13 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public virtual object FindParent(Mobile from)
|
||||
public virtual IEntity FindParent(Mobile from)
|
||||
{
|
||||
Mobile m = HeldBy;
|
||||
if (HeldBy?.Holding == this)
|
||||
return HeldBy;
|
||||
|
||||
if (m != null && m.Holding == this)
|
||||
return m;
|
||||
|
||||
object obj = RootParent;
|
||||
|
||||
if (obj != null)
|
||||
return obj;
|
||||
if (RootParent != null)
|
||||
return RootParent;
|
||||
|
||||
if (Map == Map.Internal)
|
||||
return from;
|
||||
|
|
@ -74,7 +70,7 @@ namespace Server.Items
|
|||
ThrowTarget targ = from.Target as ThrowTarget;
|
||||
Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.
|
||||
|
||||
if (targ != null && targ.Potion == this)
|
||||
if (targ?.Potion == this)
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
|
@ -107,7 +103,7 @@ namespace Server.Items
|
|||
if (Deleted)
|
||||
return;
|
||||
|
||||
object parent = FindParent(from);
|
||||
IEntity parent = FindParent(from);
|
||||
|
||||
if (timer == 0)
|
||||
{
|
||||
|
|
@ -272,4 +268,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,15 +47,12 @@ namespace Server.Items
|
|||
|
||||
public bool Validate()
|
||||
{
|
||||
object root = RootParent;
|
||||
if (!(RootParent is Mobile mobile) || mobile.AccessLevel >= AccessLevel)
|
||||
return true;
|
||||
|
||||
if (root is Mobile mobile && mobile.AccessLevel < AccessLevel)
|
||||
{
|
||||
Delete();
|
||||
return false;
|
||||
}
|
||||
Delete();
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
@ -83,4 +80,4 @@ namespace Server.Items
|
|||
return from.AccessLevel >= AccessLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,9 +66,7 @@ namespace Server.Misc
|
|||
}
|
||||
else if (item.Layer == Layer.Hair || item.Layer == Layer.FacialHair)
|
||||
{
|
||||
object rootParent = item.RootParent;
|
||||
|
||||
if (rootParent is Mobile rootMobile)
|
||||
if (item.RootParent is Mobile rootMobile)
|
||||
{
|
||||
if (item.Parent != rootMobile && rootMobile.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
|
|
@ -164,4 +162,4 @@ namespace Server.Misc
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ namespace Server.Mobiles
|
|||
Mobile m = e.Mobile;
|
||||
Mobile lastKiller = m.LastKiller;
|
||||
|
||||
if (lastKiller is BaseCreature)
|
||||
lastKiller = ((BaseCreature)lastKiller).GetMaster();
|
||||
if (lastKiller is BaseCreature creature)
|
||||
lastKiller = creature.GetMaster();
|
||||
|
||||
if (IsInsideKhaldun(m) && IsInsideKhaldun(lastKiller) && lastKiller.Player && !m_Set.Contains(lastKiller))
|
||||
foreach (AggressorInfo ai in m.Aggressors)
|
||||
|
|
|
|||
|
|
@ -722,8 +722,8 @@ namespace Server.Multis
|
|||
|
||||
if (!item.Deleted)
|
||||
{
|
||||
if (item is StrongBox)
|
||||
item = ((StrongBox)item).ConvertToStandardContainer();
|
||||
if (item is StrongBox box)
|
||||
item = box.ConvertToStandardContainer();
|
||||
|
||||
item.IsLockedDown = false;
|
||||
item.IsSecure = false;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
Item stolen = null;
|
||||
|
||||
object root = toSteal.RootParent;
|
||||
IEntity root = toSteal.RootParent;
|
||||
Mobile mobRoot = root as Mobile;
|
||||
|
||||
StealableArtifactsSpawner.StealableInstance si = null;
|
||||
|
|
@ -215,7 +215,7 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
m_Thief.SendLocalizedMessage(502710); // You can't steal that!
|
||||
}
|
||||
else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root))
|
||||
else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(mobRoot))
|
||||
{
|
||||
m_Thief.SendLocalizedMessage(502710); // You can't steal that!
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
m_Thief.SendLocalizedMessage(502710); // You can't steal that!
|
||||
}
|
||||
else if (mobRoot != null && !m_Thief.CanBeHarmful((Mobile)root))
|
||||
else if (mobRoot != null && !m_Thief.CanBeHarmful(mobRoot))
|
||||
{
|
||||
}
|
||||
else if (root is Corpse)
|
||||
|
|
@ -332,7 +332,7 @@ namespace Server.SkillHandlers
|
|||
from.RevealingAction();
|
||||
|
||||
Item stolen = null;
|
||||
object root = null;
|
||||
IEntity root = null;
|
||||
bool caught = false;
|
||||
|
||||
if (target is Item item)
|
||||
|
|
@ -356,7 +356,7 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
m_Thief.SendLocalizedMessage(502710); // You can't steal that!
|
||||
}
|
||||
|
||||
|
||||
Mobile mobRoot = root as Mobile;
|
||||
|
||||
if (stolen != null)
|
||||
|
|
@ -395,7 +395,7 @@ namespace Server.SkillHandlers
|
|||
if (mobRoot?.Player == true && m_Thief is PlayerMobile pm &&
|
||||
IsInnocentTo(pm, mobRoot) && !IsInGuild(mobRoot))
|
||||
{
|
||||
pm.PermaFlags.Add((Mobile)root);
|
||||
pm.PermaFlags.Add(mobRoot);
|
||||
pm.Delta(MobileDelta.Noto);
|
||||
}
|
||||
}
|
||||
|
|
@ -484,4 +484,4 @@ namespace Server.SkillHandlers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ namespace Server.Spells
|
|||
return true;
|
||||
}
|
||||
|
||||
public virtual bool OnCasterUsingObject(object o)
|
||||
public virtual bool OnCasterUsingObject(IEntity entity)
|
||||
{
|
||||
if (State == SpellState.Sequencing)
|
||||
Disturb(DisturbType.UseRequest);
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ namespace Server.Spells.Third
|
|||
{
|
||||
SpellHelper.Turn(Caster, item);
|
||||
|
||||
object root = item.RootParent;
|
||||
|
||||
if (!item.IsAccessibleTo(Caster))
|
||||
{
|
||||
item.OnDoubleClickNotAccessible(Caster);
|
||||
|
|
@ -51,7 +49,7 @@ namespace Server.Spells.Third
|
|||
else if (!item.CheckItemUse(Caster, item))
|
||||
{
|
||||
}
|
||||
else if (root is Mobile && root != Caster)
|
||||
else if (item.RootParent is Mobile && item.RootParent != Caster)
|
||||
{
|
||||
item.OnSnoop(Caster);
|
||||
}
|
||||
|
|
@ -104,4 +102,4 @@ namespace Server
|
|||
{
|
||||
void OnTelekinesis(Mobile from);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,29 +219,29 @@ namespace Server.Commands
|
|||
|
||||
if (entry != null)
|
||||
{
|
||||
if (@from.AccessLevel >= entry.AccessLevel)
|
||||
if (from.AccessLevel >= entry.AccessLevel)
|
||||
{
|
||||
if (entry.Handler != null)
|
||||
{
|
||||
CommandEventArgs e = new CommandEventArgs(@from, command, argString, args);
|
||||
CommandEventArgs e = new CommandEventArgs(from, command, argString, args);
|
||||
entry.Handler(e);
|
||||
EventSink.InvokeCommand(e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (@from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
return false;
|
||||
|
||||
@from.SendMessage("You do not have access to that command.");
|
||||
from.SendMessage("You do not have access to that command.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (@from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
return false;
|
||||
|
||||
@from.SendMessage("That is not a valid command.");
|
||||
from.SendMessage("That is not a valid command.");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Server
|
|||
void OnConnectionChanged();
|
||||
bool OnCasterMoving(Direction d);
|
||||
bool OnCasterEquipping(Item item);
|
||||
bool OnCasterUsingObject(object o);
|
||||
bool OnCasterUsingObject(IEntity entity);
|
||||
bool OnCastInTown(Region r);
|
||||
}
|
||||
|
||||
|
|
@ -111,4 +111,4 @@ namespace Server
|
|||
void OnBeforeSpawn(Point3D location, Map map);
|
||||
void OnAfterSpawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1134,10 +1134,8 @@ namespace Server
|
|||
{
|
||||
IEntity p = m_Parent;
|
||||
|
||||
while (p is Item)
|
||||
while (p is Item item)
|
||||
{
|
||||
Item item = (Item)p;
|
||||
|
||||
if (item.m_Parent == null) break;
|
||||
|
||||
p = item.m_Parent;
|
||||
|
|
@ -3349,13 +3347,11 @@ namespace Server
|
|||
{
|
||||
IEntity p = m_Parent;
|
||||
|
||||
while (p is Item)
|
||||
while (p is Item item)
|
||||
{
|
||||
if (p is T)
|
||||
if (item is T)
|
||||
return true;
|
||||
|
||||
Item item = (Item)p;
|
||||
|
||||
if (item.m_Parent == null) break;
|
||||
|
||||
p = item.m_Parent;
|
||||
|
|
@ -3685,15 +3681,13 @@ namespace Server
|
|||
target.Map == null)
|
||||
return false;
|
||||
|
||||
object root = target.RootParent;
|
||||
|
||||
if (from.AccessLevel < AccessLevel.GameMaster && !from.InRange(target.GetWorldLocation(), 2))
|
||||
return false;
|
||||
if (!from.CanSee(target) || !from.InLOS(target))
|
||||
return false;
|
||||
if (!target.IsAccessibleTo(from))
|
||||
return false;
|
||||
if (root is Mobile mobile && !mobile.CheckNonlocalDrop(from, this, target))
|
||||
if (target.RootParent is Mobile mobile && !mobile.CheckNonlocalDrop(from, this, target))
|
||||
return false;
|
||||
if (!from.OnDroppedItemToItem(this, target, p))
|
||||
return false;
|
||||
|
|
@ -4024,12 +4018,12 @@ namespace Server
|
|||
{
|
||||
object p = this;
|
||||
|
||||
while (p is Item)
|
||||
while (p is Item item)
|
||||
{
|
||||
if (p is SecureTradeContainer container)
|
||||
if (item is SecureTradeContainer container)
|
||||
return container;
|
||||
|
||||
p = ((Item)p).m_Parent;
|
||||
p = item.m_Parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -4125,10 +4119,8 @@ namespace Server
|
|||
if (p == o)
|
||||
return true;
|
||||
|
||||
while (p is Item)
|
||||
while (p is Item item)
|
||||
{
|
||||
Item item = (Item)p;
|
||||
|
||||
if (item.m_Parent == null)
|
||||
break;
|
||||
|
||||
|
|
@ -4214,22 +4206,22 @@ namespace Server
|
|||
|
||||
NetState ns = from.NetState;
|
||||
|
||||
if (ns != null)
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
if (Name == null)
|
||||
{
|
||||
if (Name == null)
|
||||
{
|
||||
if (m_Amount <= 1)
|
||||
ns.Send(new MessageLocalized(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "", ""));
|
||||
else
|
||||
ns.Send(new MessageLocalizedAffix(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "",
|
||||
AffixType.Append,
|
||||
$" : {m_Amount}", ""));
|
||||
}
|
||||
if (m_Amount <= 1)
|
||||
ns.Send(new MessageLocalized(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "", ""));
|
||||
else
|
||||
{
|
||||
ns.Send(new UnicodeMessage(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "",
|
||||
Name + (m_Amount > 1 ? " : " + m_Amount : "")));
|
||||
}
|
||||
ns.Send(new MessageLocalizedAffix(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "",
|
||||
AffixType.Append,
|
||||
$" : {m_Amount}", ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
ns.Send(new UnicodeMessage(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "",
|
||||
Name + (m_Amount > 1 ? " : " + m_Amount : "")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4296,11 +4288,6 @@ namespace Server
|
|||
Delete();
|
||||
}
|
||||
|
||||
public virtual bool CheckBlessed(object obj)
|
||||
{
|
||||
return CheckBlessed(obj as Mobile);
|
||||
}
|
||||
|
||||
public virtual bool CheckBlessed(Mobile m)
|
||||
{
|
||||
if (m_LootType == LootType.Blessed || Mobile.InsuranceEnabled && Insured)
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
object parent = Parent;
|
||||
IEntity parent = Parent;
|
||||
|
||||
while (parent != null)
|
||||
{
|
||||
|
|
@ -627,15 +627,9 @@ namespace Server.Items
|
|||
|
||||
public virtual bool CheckContentDisplay(Mobile from)
|
||||
{
|
||||
if (DisplaysContent)
|
||||
{
|
||||
object root = RootParent;
|
||||
|
||||
if (root == null || root is Item || root == from || from.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return DisplaysContent && RootParent == null ||
|
||||
RootParent is Item || RootParent == from ||
|
||||
from.AccessLevel > AccessLevel.Player;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
|
|||
|
|
@ -4667,7 +4667,7 @@ namespace Server
|
|||
if (m_Spell != null && !m_Spell.OnCasterUsingObject(item))
|
||||
return;
|
||||
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
bool okay = false;
|
||||
|
||||
if (!Utility.InUpdateRange(this, item.GetWorldLocation()))
|
||||
|
|
@ -4789,7 +4789,7 @@ namespace Server
|
|||
}
|
||||
else
|
||||
{
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
|
||||
if (root is Mobile mobile && !mobile.CheckNonlocalLift(from, item))
|
||||
{
|
||||
|
|
@ -4964,7 +4964,7 @@ namespace Server
|
|||
if (DragEffects && !item.Deleted)
|
||||
{
|
||||
Map map = m_Map;
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
|
||||
if (map != null && (root == null || root is Item))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,12 +51,11 @@ namespace Server
|
|||
{
|
||||
public unsafe void Read(IntPtr ptr, void* buffer, int length)
|
||||
{
|
||||
//UnsafeNativeMethods._lread( ptr, buffer, length );
|
||||
uint lpNumberOfBytesRead = 0;
|
||||
UnsafeNativeMethods.ReadFile(ptr, buffer, (uint)length, ref lpNumberOfBytesRead, null);
|
||||
}
|
||||
|
||||
internal class UnsafeNativeMethods
|
||||
internal static class UnsafeNativeMethods
|
||||
{
|
||||
/*[DllImport("kernel32")]
|
||||
internal unsafe static extern int _lread(IntPtr hFile, void* lpBuffer, int wBytes);*/
|
||||
|
|
@ -74,10 +73,10 @@ namespace Server
|
|||
UnsafeNativeMethods.read(ptr, buffer, length);
|
||||
}
|
||||
|
||||
internal class UnsafeNativeMethods
|
||||
internal static class UnsafeNativeMethods
|
||||
{
|
||||
[DllImport("libc")]
|
||||
internal static extern unsafe int read(IntPtr ptr, void* buffer, int length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,11 @@ namespace Server
|
|||
{
|
||||
FileOptions options = FileOptions.SequentialScan;
|
||||
|
||||
if (Concurrency > 0) options |= FileOptions.Asynchronous;
|
||||
if (Concurrency > 0)
|
||||
options |= FileOptions.Asynchronous;
|
||||
|
||||
#if MONO
|
||||
return new FileStream( path, mode, access, share, bufferSize, options );
|
||||
return new FileStream( path, mode, access, share, BufferSize, options );
|
||||
#else
|
||||
if (Unbuffered)
|
||||
options |= NoBuffering;
|
||||
|
|
@ -109,4 +110,4 @@ namespace Server
|
|||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,10 +79,8 @@ namespace Server
|
|||
)
|
||||
);
|
||||
|
||||
#if !MONO
|
||||
PerformanceCounterCategory.Create(PerformanceCategoryName, PerformanceCategoryDesc,
|
||||
PerformanceCounterCategoryType.SingleInstance, counters);
|
||||
#endif
|
||||
}
|
||||
|
||||
numberOfWorldSaves = new PerformanceCounter(PerformanceCategoryName, "Save - Count", false);
|
||||
|
|
@ -137,4 +135,4 @@ namespace Server
|
|||
writtenBytesPerSecond.IncrementBy(numberOfBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,6 @@ namespace Server
|
|||
AppendCompilerOption(ref sb, "/d:NEWTIMERS");
|
||||
#endif
|
||||
|
||||
#if NEWPARENT
|
||||
AppendCompilerOption(ref sb, "/d:NEWPARENT");
|
||||
#endif
|
||||
|
||||
return sb?.ToString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,9 +165,7 @@ namespace Server.Targeting
|
|||
return;
|
||||
}
|
||||
|
||||
object root = item.RootParent;
|
||||
|
||||
if (!AllowNonlocal && root is Mobile && root != from && from.AccessLevel == AccessLevel.Player)
|
||||
if (!AllowNonlocal && item.RootParent is Mobile && item.RootParent != from && from.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
OnNonlocalTarget(from, item);
|
||||
OnTargetFinish(from);
|
||||
|
|
@ -290,4 +288,4 @@ namespace Server.Targeting
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -388,11 +388,7 @@ namespace Server
|
|||
|
||||
fixed (StaticTile* pTiles = staTiles)
|
||||
{
|
||||
#if !MONO
|
||||
NativeReader.Read(DataStream.SafeFileHandle.DangerousGetHandle(), pTiles, length);
|
||||
#else
|
||||
NativeReader.Read( m_Statics.Handle, pTiles, length );
|
||||
#endif
|
||||
if (m_Lists == null)
|
||||
{
|
||||
m_Lists = new TileList[8][];
|
||||
|
|
@ -463,11 +459,7 @@ namespace Server
|
|||
|
||||
fixed (LandTile* pTiles = tiles)
|
||||
{
|
||||
#if !MONO
|
||||
NativeReader.Read(MapStream.SafeFileHandle.DangerousGetHandle(), pTiles, 192);
|
||||
#else
|
||||
NativeReader.Read( m_Map.Handle, pTiles, 192 );
|
||||
#endif
|
||||
}
|
||||
|
||||
return tiles;
|
||||
|
|
@ -718,9 +710,9 @@ namespace Server
|
|||
|
||||
if (y == null)
|
||||
return -1;
|
||||
|
||||
|
||||
return x.m_Offset.CompareTo(y.m_Offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,11 +95,7 @@ namespace Server
|
|||
|
||||
fixed (LandTile* pTiles = tiles)
|
||||
{
|
||||
#if !MONO
|
||||
NativeReader.Read(fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192);
|
||||
#else
|
||||
NativeReader.Read( fsData.Handle, pTiles, 192 );
|
||||
#endif
|
||||
}
|
||||
|
||||
matrix.SetLandBlock(x, y, tiles);
|
||||
|
|
@ -163,11 +159,7 @@ namespace Server
|
|||
|
||||
fixed (StaticTile* pTiles = staTiles)
|
||||
{
|
||||
#if !MONO
|
||||
NativeReader.Read(fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length);
|
||||
#else
|
||||
NativeReader.Read( fsData.Handle, pTiles, length );
|
||||
#endif
|
||||
StaticTile* pCur = pTiles, pEnd = pTiles + tileCount;
|
||||
|
||||
while (pCur < pEnd)
|
||||
|
|
@ -199,4 +191,4 @@ namespace Server
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue