Cleanup that was missed during the last sweep. (#14)
This commit is contained in:
parent
5cf37da625
commit
01d0fb75b8
9 changed files with 93 additions and 111 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -4024,12 +4020,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 +4121,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 +4208,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 : "")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,10 +80,6 @@ namespace Server
|
|||
AppendCompilerOption(ref sb, "/d:NEWTIMERS");
|
||||
#endif
|
||||
|
||||
#if NEWPARENT
|
||||
AppendCompilerOption(ref sb, "/d:NEWPARENT");
|
||||
#endif
|
||||
|
||||
return sb?.ToString();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue