fix: Cleans up some comments and spell code (#1120)

This commit is contained in:
Kamron Batman 2022-07-16 19:45:41 -07:00 • committed by GitHub
parent 56c97ca84a
commit fa3515f930
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 338 additions and 469 deletions

View file

@ -3058,16 +3058,21 @@ namespace Server
public virtual void UpdateResistances() public virtual void UpdateResistances()
{ {
Resistances ??= new[] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue };
var delta = false; var delta = false;
for (var i = 0; i < Resistances.Length; ++i) if (Resistances == null)
{ {
if (Resistances[i] != int.MinValue) Resistances = new[] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue };
}
else
{
for (var i = 0; i < Resistances.Length; ++i)
{ {
Resistances[i] = int.MinValue; if (Resistances[i] != int.MinValue)
delta = true; {
Resistances[i] = int.MinValue;
delta = true;
}
} }
} }
@ -3079,11 +3084,9 @@ namespace Server
public virtual int GetResistance(ResistanceType type) public virtual int GetResistance(ResistanceType type)
{ {
Resistances ??= new[] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue };
var v = (int)type; var v = (int)type;
if (v < 0 || v >= Resistances.Length) if (Resistances == null || Resistances.Length == 0 || v < 0 || v >= Resistances.Length)
{ {
return 0; return 0;
} }

View file

@ -134,16 +134,12 @@ namespace Server.Engines.ConPVP
return false; return false;
} }
string title = null; string title = move switch
if (move is NinjaMove)
{ {
title = "Bushido"; NinjaMove => "Bushido",
} SamuraiMove => "Ninjitsu",
else if (move is SamuraiMove) _ => null
{ };
title = "Ninjitsu";
}
if (title == null || name == null || Ruleset.GetOption(title, name)) if (title == null || name == null || Ruleset.GetOption(title, name))
{ {

View file

@ -124,11 +124,8 @@ namespace Server.Factions
if (remaining.TotalDays >= 1) if (remaining.TotalDays >= 1)
{ {
from.SendLocalizedMessage( // Your term of service will come to an end in ~1_DAYS~ days.
1042743, from.SendLocalizedMessage(1042743, remaining.TotalDays.ToString("N0"));
remaining.TotalDays
.ToString("N0")
); // Your term of service will come to an end in ~1_DAYS~ days.
} }
else if (remaining.TotalHours >= 1) else if (remaining.TotalHours >= 1)
{ {

View file

@ -1708,7 +1708,7 @@ namespace Server.Engines.MLQuests.Definitions
"acid elementals", "acid elementals",
new QuestArea(1074806, "The Palace of Paroxysmus") new QuestArea(1074806, "The Palace of Paroxysmus")
) )
); // The Palace of Paroxysmus );
Rewards.Add(ItemReward.LargeBagOfTreasure); Rewards.Add(ItemReward.LargeBagOfTreasure);
} }
@ -1734,7 +1734,7 @@ namespace Server.Engines.MLQuests.Definitions
"plague spawns", "plague spawns",
new QuestArea(1074806, "The Palace of Paroxysmus") new QuestArea(1074806, "The Palace of Paroxysmus")
) )
); // The Palace of Paroxysmus );
Objectives.Add( Objectives.Add(
new KillObjective( new KillObjective(
3, 3,
@ -1742,7 +1742,7 @@ namespace Server.Engines.MLQuests.Definitions
"plague beasts", "plague beasts",
new QuestArea(1074806, "The Palace of Paroxysmus") new QuestArea(1074806, "The Palace of Paroxysmus")
) )
); // The Palace of Paroxysmus );
Objectives.Add( Objectives.Add(
new KillObjective( new KillObjective(
1, 1,
@ -1750,7 +1750,7 @@ namespace Server.Engines.MLQuests.Definitions
"plague beast lord", "plague beast lord",
new QuestArea(1074806, "The Palace of Paroxysmus") new QuestArea(1074806, "The Palace of Paroxysmus")
) )
); // The Palace of Paroxysmus );
Rewards.Add(ItemReward.LargeBagOfTreasure); Rewards.Add(ItemReward.LargeBagOfTreasure);
} }
@ -3072,14 +3072,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm) public override void Shout(PlayerMobile pm)
{ {
MLQuestSystem.Tell( // Hey, could you help me out with something?
this, // Come here, I have work for you.
pm, MLQuestSystem.Tell(this, pm, Utility.RandomBool() ? 1074209 : 1074184);
Utility.RandomList(
1074209, // Hey, could you help me out with something?
1074184
)
); // Come here, I have work for you.
} }
public override void Serialize(IGenericWriter writer) public override void Serialize(IGenericWriter writer)
@ -3332,14 +3327,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm) public override void Shout(PlayerMobile pm)
{ {
MLQuestSystem.Tell( // Come here, I have a task.
this, // Hey, could you help me out with something?
pm, MLQuestSystem.Tell(this, pm, Utility.RandomBool() ? 1074209 : 1074186);
Utility.RandomList(
1074186, // Come here, I have a task.
1074209
)
); // Hey, could you help me out with something?
} }
public override void Serialize(IGenericWriter writer) public override void Serialize(IGenericWriter writer)
@ -3588,14 +3578,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm) public override void Shout(PlayerMobile pm)
{ {
MLQuestSystem.Tell( // Hey, could you help me out with something?
this, // Want a job?
pm, MLQuestSystem.Tell(this, pm, Utility.RandomBool() ? 1074209 : 1074187);
Utility.RandomList(
1074187, // Want a job?
1074209
)
); // Hey, could you help me out with something?
} }
public override void Serialize(IGenericWriter writer) public override void Serialize(IGenericWriter writer)
@ -3653,14 +3638,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm) public override void Shout(PlayerMobile pm)
{ {
MLQuestSystem.Tell( // Hey you! Want to help me out?
this, // Want a job?
pm, MLQuestSystem.Tell(this, pm, Utility.RandomBool() ? 1074185 : 1074187);
Utility.RandomList(
1074187, // Want a job?
1074185
)
); // Hey you! Want to help me out?
} }
public override void Serialize(IGenericWriter writer) public override void Serialize(IGenericWriter writer)

View file

@ -27,11 +27,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.Player.SendLocalizedMessage( // You have gained the boon of Maul! Your understanding of the seasons grows.
1074940, // You are one step closer to claiming your elven heritage.
"", instance.Player.SendLocalizedMessage(1074940, "", 0x2A);
0x2A
); // You have gained the boon of Maul! Your understanding of the seasons grows. You are one step closer to claiming your elven heritage.
instance.ClaimRewards(); // skip gump instance.ClaimRewards(); // skip gump
} }
} }
@ -58,11 +56,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.Player.SendLocalizedMessage( // You have gained the boon of Strongroot! You have been approved by one whose roots touch the bones of Sosaria.
1074941, // You are one step closer to claiming your elven heritage.
"", instance.Player.SendLocalizedMessage(1074941, "", 0x2A);
0x2A
); // You have gained the boon of Strongroot! You have been approved by one whose roots touch the bones of Sosaria. You are one step closer to claiming your elven heritage.
instance.ClaimRewards(); // skip gump instance.ClaimRewards(); // skip gump
} }
} }
@ -89,11 +85,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.Player.SendLocalizedMessage( // You have gained the boon of Enigma! You are wise enough to know how little you know.
1074945, // You are one step closer to claiming your elven heritage.
"", instance.Player.SendLocalizedMessage(1074945, "", 0x2A);
0x2A
); // You have gained the boon of Enigma! You are wise enough to know how little you know. You are one step closer to claiming your elven heritage.
instance.ClaimRewards(); // skip gump instance.ClaimRewards(); // skip gump
} }
@ -125,7 +119,7 @@ namespace Server.Engines.MLQuests.Definitions
Objectives.Add( Objectives.Add(
new EscortObjective(new QuestArea(1074779, "Bravehorn's drinking pool")) new EscortObjective(new QuestArea(1074779, "Bravehorn's drinking pool"))
); // Bravehorn's drinking pool );
Rewards.Add(new DummyReward(1072806)); // The boon of Bravehorn. Rewards.Add(new DummyReward(1072806)); // The boon of Bravehorn.
} }
@ -134,11 +128,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.Player.SendLocalizedMessage( // You have gained the boon of Bravehorn!
1074942, // You have glimpsed the nobility of those that sacrifice themselves for their people.
"", // You are one step closer to claiming your elven heritage.
0x2A instance.Player.SendLocalizedMessage(1074942, "", 0x2A);
); // You have gained the boon of Bravehorn! You have glimpsed the nobility of those that sacrifice themselves for their people. You are one step closer to claiming your elven heritage.
instance.ClaimRewards(); // skip gump instance.ClaimRewards(); // skip gump
} }
} }
@ -161,7 +154,7 @@ namespace Server.Engines.MLQuests.Definitions
"timber wolves", "timber wolves",
new QuestArea(1074833, "Huntsman's Forest") new QuestArea(1074833, "Huntsman's Forest")
) )
); // Huntsman's Forest );
Rewards.Add(new DummyReward(1072807)); // The boon of the Huntsman. Rewards.Add(new DummyReward(1072807)); // The boon of the Huntsman.
} }
@ -170,11 +163,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.Player.SendLocalizedMessage( // You have gained the boon of the Huntsman!
1074943, // You have been given a taste of the bittersweet duty of those who guard the balance.
"", // You are one step closer to claiming your elven heritage.
0x2A instance.Player.SendLocalizedMessage(1074943, "", 0x2A);
); // You have gained the boon of the Huntsman! You have been given a taste of the bittersweet duty of those who guard the balance. You are one step closer to claiming your elven heritage.
instance.ClaimRewards(); // skip gump instance.ClaimRewards(); // skip gump
} }
} }
@ -200,11 +192,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.Player.SendLocalizedMessage( // You have gained the boon of Arielle!
1074944, // You have been taught the importance of laughter and light spirits.
"", // You are one step closer to claiming your elven heritage.
0x2A instance.Player.SendLocalizedMessage(1074944, "", 0x2A);
); // You have gained the boon of Arielle! You have been taught the importance of laughter and light spirits. You are one step closer to claiming your elven heritage.
instance.ClaimRewards(); // skip gump instance.ClaimRewards(); // skip gump
} }
} }
@ -494,11 +485,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.Player.SendLocalizedMessage( // You have demonstrated your ingenuity!
1074946, // Humans are jacks of all trades and know a little about a lot of things.
"", // You are one step closer to achieving humanity.
0x2A instance.Player.SendLocalizedMessage(1074946, "", 0x2A);
); // You have demonstrated your ingenuity! Humans are jacks of all trades and know a little about a lot of things. You are one step closer to achieving humanity.
instance.ClaimRewards(); // skip gump instance.ClaimRewards(); // skip gump
} }
} }
@ -534,11 +524,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.Player.SendLocalizedMessage( // You have demonstrated your physical strength!
1074948, // Humans can carry vast loads without complaint. You are one step closer to achieving humanity.
"", instance.Player.SendLocalizedMessage(1074948, "", 0x2A);
0x2A
); // You have demonstrated your physical strength! Humans can carry vast loads without complaint. You are one step closer to achieving humanity.
instance.ClaimRewards(); // skip gump instance.ClaimRewards(); // skip gump
} }
} }
@ -559,11 +547,8 @@ namespace Server.Engines.MLQuests.Definitions
public static void AwardTo(PlayerMobile pm) public static void AwardTo(PlayerMobile pm)
{ {
MLQuestSystem.GetOrCreateContext(pm).SetDoneQuest(MLQuestSystem.FindQuest(typeof(HumanInNeed))); MLQuestSystem.GetOrCreateContext(pm).SetDoneQuest(MLQuestSystem.FindQuest(typeof(HumanInNeed)));
pm.SendLocalizedMessage( // You have demonstrated your compassion! Your kind actions have been noted.
1074949, pm.SendLocalizedMessage(1074949, "", 0x2A);
"",
0x2A
); // You have demonstrated your compassion! Your kind actions have been noted.
} }
} }
@ -586,7 +571,7 @@ namespace Server.Engines.MLQuests.Definitions
"efreets", "efreets",
new QuestArea(1074808, "Fire") new QuestArea(1074808, "Fire")
) )
); // Fire );
Objectives.Add( Objectives.Add(
new KillObjective( new KillObjective(
5, 5,
@ -594,7 +579,7 @@ namespace Server.Engines.MLQuests.Definitions
"ice fiends", "ice fiends",
new QuestArea(1074809, "Ice") new QuestArea(1074809, "Ice")
) )
); // Ice );
Rewards.Add(new DummyReward(1074875)); // Another step closer to becoming human. Rewards.Add(new DummyReward(1074875)); // Another step closer to becoming human.
} }
@ -603,11 +588,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.Player.SendLocalizedMessage( // You have demonstrated your toughness!
1074947, // Humans are able to endure unimaginable hardships in pursuit of their goals.
"", // You are one step closer to achieving humanity.
0x2A instance.Player.SendLocalizedMessage(1074947, "", 0x2A);
); // You have demonstrated your toughness! Humans are able to endure unimaginable hardships in pursuit of their goals. You are one step closer to achieving humanity.
instance.ClaimRewards(); // skip gump instance.ClaimRewards(); // skip gump
} }
} }

View file

@ -25,7 +25,7 @@ namespace Server.Engines.MLQuests.Definitions
// OSI sends this instead, but it doesn't make sense for an escortable // OSI sends this instead, but it doesn't make sense for an escortable
// public override void OnComplete( MLQuestInstance instance ) // public override void OnComplete( MLQuestInstance instance )
// { // {
// instance.Player.SendLocalizedMessage( 1073775, "", 0x23 ); // Your quest is complete. Return for your reward. // instance.Player.SendLocalizedMessage( 1073775, "", 0x23 ); // Your quest is complete. Return for your reward.
// } // }
} }

View file

@ -988,11 +988,8 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm) public override void Shout(PlayerMobile pm)
{ {
MLQuestSystem.Tell( // The art of fencing requires a dexterous hand, a quick wit and fleet feet.
this, MLQuestSystem.Tell(this, pm, 1078187);
pm,
1078187
); // The art of fencing requires a dexterous hand, a quick wit and fleet feet.
} }
public override void Serialize(IGenericWriter writer) public override void Serialize(IGenericWriter writer)
@ -1053,11 +1050,8 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm) public override void Shout(PlayerMobile pm)
{ {
MLQuestSystem.Tell( // There is an art to slaying your enemies swiftly. It's called tactics, and I can teach it to you.
this, MLQuestSystem.Tell(this, pm, 1078136);
pm,
1078136
); // There is an art to slaying your enemies swiftly. It's called tactics, and I can teach it to you.
} }
public override void Serialize(IGenericWriter writer) public override void Serialize(IGenericWriter writer)

View file

@ -360,7 +360,7 @@ namespace Server.Engines.MLQuests.Definitions
"orcs", "orcs",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Objectives.Add( Objectives.Add(
new KillObjective( new KillObjective(
5, 5,
@ -368,7 +368,7 @@ namespace Server.Engines.MLQuests.Definitions
"orc bombers", "orc bombers",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Objectives.Add( Objectives.Add(
new KillObjective( new KillObjective(
3, 3,
@ -376,7 +376,7 @@ namespace Server.Engines.MLQuests.Definitions
"orc brutes", "orc brutes",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(ItemReward.BagOfTreasure); Rewards.Add(ItemReward.BagOfTreasure);
} }
@ -437,7 +437,7 @@ namespace Server.Engines.MLQuests.Definitions
"Moug-Guur", "Moug-Guur",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(ItemReward.BagOfTreasure); Rewards.Add(ItemReward.BagOfTreasure);
} }
@ -466,7 +466,7 @@ namespace Server.Engines.MLQuests.Definitions
"Chiikkaha", "Chiikkaha",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(ItemReward.BagOfTreasure); Rewards.Add(ItemReward.BagOfTreasure);
} }
@ -496,7 +496,7 @@ namespace Server.Engines.MLQuests.Definitions
"Szavetra", "Szavetra",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(ItemReward.Strongbox); Rewards.Add(ItemReward.Strongbox);
} }
@ -603,7 +603,7 @@ namespace Server.Engines.MLQuests.Definitions
"ogres", "ogres",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(ItemReward.BagOfTreasure); Rewards.Add(ItemReward.BagOfTreasure);
} }
@ -630,7 +630,7 @@ namespace Server.Engines.MLQuests.Definitions
"ogre lords", "ogre lords",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(ItemReward.LargeBagOfTreasure); Rewards.Add(ItemReward.LargeBagOfTreasure);
} }
@ -657,7 +657,7 @@ namespace Server.Engines.MLQuests.Definitions
"cyclops", "cyclops",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(ItemReward.LargeBagOfTreasure); Rewards.Add(ItemReward.LargeBagOfTreasure);
} }
@ -686,7 +686,7 @@ namespace Server.Engines.MLQuests.Definitions
"titans", "titans",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(ItemReward.LargeBagOfTreasure); Rewards.Add(ItemReward.LargeBagOfTreasure);
} }
@ -713,7 +713,7 @@ namespace Server.Engines.MLQuests.Definitions
"gargoyles", "gargoyles",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(ItemReward.BagOfTrinkets); Rewards.Add(ItemReward.BagOfTrinkets);
} }

View file

@ -230,7 +230,7 @@ namespace Server.Engines.MLQuests.Definitions
"rats", "rats",
new QuestArea(1074807, "Sanctuary") new QuestArea(1074807, "Sanctuary")
) )
); // Sanctuary );
Rewards.Add(new DummyReward(1074872)); // The opportunity to learn the ways of the Arcanist. Rewards.Add(new DummyReward(1074872)); // The opportunity to learn the ways of the Arcanist.
} }
@ -398,11 +398,8 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.PlayerContext.SummonFey = true; instance.PlayerContext.SummonFey = true;
instance.Player.SendLocalizedMessage( // *giggle* Mean reapers got fixed! Pixie friend now! *giggle* When mean thingies bother you, a brave pixie will help.
1074320, instance.Player.SendLocalizedMessage(1074320, "", 0x2A);
"",
0x2A
); // *giggle* Mean reapers got fixed! Pixie friend now! *giggle* When mean thingies bother you, a brave pixie will help.
base.GetRewards(instance); base.GetRewards(instance);
} }
@ -423,11 +420,9 @@ namespace Server.Engines.MLQuests.Definitions
Objectives.Add(new KillObjective(50, new[] { typeof(Imp) }, "imps")); Objectives.Add(new KillObjective(50, new[] { typeof(Imp) }, "imps"));
Rewards.Add( // The opportunity to prove yourself worthy of learning to Summon Fiends.
new DummyReward( // (Sufficient spellweaving skill is required to cast the spell)
1074873 Rewards.Add(new DummyReward(107487));
)
); // The opportunity to prove yourself worthy of learning to Summon Fiends. (Sufficient spellweaving skill is required to cast the spell)
} }
public override Type NextQuest => typeof(CrackingTheWhipI); public override Type NextQuest => typeof(CrackingTheWhipI);
@ -479,11 +474,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance) public override void GetRewards(MLQuestInstance instance)
{ {
instance.PlayerContext.SummonFiend = true; instance.PlayerContext.SummonFiend = true;
instance.Player.SendLocalizedMessage( // You've demonstrated your strength, got a means of control, and taught the imps to fear you.
1074322, // You're ready now to summon them.
"", instance.Player.SendLocalizedMessage(1074322, "", 0x2A);
0x2A
); // You've demonstrated your strength, got a means of control, and taught the imps to fear you. You're ready now to summon them.
base.GetRewards(instance); base.GetRewards(instance);
} }

View file

@ -145,15 +145,17 @@ namespace Server.Engines.MLQuests.Gumps
140, 140,
312, 312,
16, 16,
quest.IsChainTriggered || quest.NextQuest != null ? 1075024 : 1072202, quest.IsChainTriggered || quest.NextQuest != null ? 1075024 : 1072202, // Description [(quest chain)]
0x2710 0x2710
); // Description [(quest chain)] );
TextDefinition.AddHtmlText(this, 98, 156, 312, 240, quest.Description, false, true, 0x15F90, 0xBDE784); TextDefinition.AddHtmlText(this, 98, 156, 312, 240, quest.Description, false, true, 0x15F90, 0xBDE784);
} }
public void AddObjectives(MLQuest quest) public void AddObjectives(MLQuest quest)
{ {
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective: AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
// All of the following / Only one of the following
AddHtmlLocalized( AddHtmlLocalized(
98, 98,
156, 156,
@ -161,7 +163,7 @@ namespace Server.Engines.MLQuests.Gumps
16, 16,
quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209, quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209,
0x2710 0x2710
); // All of the following / Only one of the following );
var y = 172; var y = 172;
@ -186,6 +188,7 @@ namespace Server.Engines.MLQuests.Gumps
var quest = instance.Quest; var quest = instance.Quest;
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective: AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
// All of the following / Only one of the following
AddHtmlLocalized( AddHtmlLocalized(
98, 98,
156, 156,
@ -193,7 +196,7 @@ namespace Server.Engines.MLQuests.Gumps
16, 16,
quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209, quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209,
0x2710 0x2710
); // All of the following / Only one of the following );
var y = 172; var y = 172;

View file

@ -153,11 +153,9 @@ namespace Server.Engines.MLQuests
{ {
if (message) if (message)
{ {
MLQuestSystem.Tell( // I'm sorry, but I don't have anything else for you right now.
quester, // Could you check back with me in a few minutes?
pm, MLQuestSystem.Tell(quester, pm, 1075575);
1075575
); // I'm sorry, but I don't have anything else for you right now. Could you check back with me in a few minutes?
} }
return false; return false;

View file

@ -386,9 +386,8 @@ namespace Server.Engines.MLQuests
rewardItem.Delete(); rewardItem.Delete();
} }
Player.SendLocalizedMessage( // Your backpack is full. You cannot complete the quest and receive your reward.
1078524 Player.SendLocalizedMessage(1078524);
); // Your backpack is full. You cannot complete the quest and receive your reward.
return; return;
} }
@ -398,10 +397,8 @@ namespace Server.Engines.MLQuests
if (rewardItem.Stackable) if (rewardItem.Stackable)
{ {
Player.SendLocalizedMessage( // You receive a reward: ~1_QUANTITY~ ~2_ITEM~
1115917, Player.SendLocalizedMessage(1115917, $"{rewardItem.Amount}\t{rewardName}");
$"{rewardItem.Amount}\t{rewardName}"
); // You receive a reward: ~1_QUANTITY~ ~2_ITEM~
} }
else else
{ {

View file

@ -47,16 +47,12 @@ namespace Server.Engines.MLQuests.Objectives
if (minutes == 1) if (minutes == 1)
{ {
MLQuestSystem.Tell(quester, pm, "You must rest 1 minute before we set out on this journey."); MLQuestSystem.Tell(quester, pm, 1042722);
} }
else else
{ {
MLQuestSystem.Tell( // You must rest ~1_minsleft~ minutes before we set out on this journey.
quester, MLQuestSystem.Tell(quester, pm, 1071195, minutes.ToString());
pm,
1071195,
minutes.ToString()
); // You must rest ~1_minsleft~ minutes before we set out on this journey.
} }
} }
@ -141,10 +137,8 @@ namespace Server.Engines.MLQuests.Objectives
} }
else if (m_Objective.Destination.Contains(m_Escort)) else if (m_Objective.Destination.Contains(m_Escort))
{ {
m_Escort.Say( // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.
1042809, m_Escort.Say(1042809, pm.Name);
pm.Name
); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.
if (pm.Young || m_Escort.Region.IsPartOf("Haven Island")) if (pm.Young || m_Escort.Region.IsPartOf("Haven Island"))
{ {
@ -251,7 +245,7 @@ namespace Server.Engines.MLQuests.Objectives
} }
// Note: this sound is sent twice on OSI (once here and once in Cancel()) // Note: this sound is sent twice on OSI (once here and once in Cancel())
// m_Player.SendSound( 0x5B3 ); // private sound // m_Player.SendSound(0x5B3); // private sound
pm.SendLocalizedMessage(1071194); // You have failed your escort quest... pm.SendLocalizedMessage(1071194); // You have failed your escort quest...
if (!instance.Removed) if (!instance.Removed)

View file

@ -108,10 +108,8 @@ namespace Server.Engines.MLQuests.Objectives
} }
else else
{ {
pm.SendLocalizedMessage( // You have killed a quest creature. ~1_val~ more left.
1075051, pm.SendLocalizedMessage(1075051, (desired - Slain).ToString());
(desired - Slain).ToString()
); // You have killed a quest creature. ~1_val~ more left.
} }
return true; return true;

View file

@ -106,9 +106,8 @@ namespace Server.Engines.PartySystem
} }
else else
{ {
from.SendLocalizedMessage( // You have chosen to prevent your party from looting your corpse.
1005448 from.SendLocalizedMessage(1005448);
); // You have chosen to prevent your party from looting your corpse.
} }
} }
} }

View file

@ -21,9 +21,8 @@ namespace Server.Engines.PartySystem
if (from == m) if (from == m)
{ {
from.SendLocalizedMessage( // You may only remove yourself from a party if you are not the leader.
1005446 from.SendLocalizedMessage(1005446);
); // You may only remove yourself from a party if you are not the leader.
} }
else else
{ {

View file

@ -336,10 +336,9 @@ namespace Server.Engines.Plants
if (bev == null) if (bev == null)
{ {
from.Target = new PlantPourTarget(m_Plant); from.Target = new PlantPourTarget(m_Plant);
from.SendLocalizedMessage(
1060808, // Target the container you wish to use to water the ~1_val~.
$"#{m_Plant.GetLocalizedPlantStatus()}" from.SendLocalizedMessage(1060808, $"#{m_Plant.GetLocalizedPlantStatus()}");
); // Target the container you wish to use to water the ~1_val~.
} }
else else
{ {
@ -406,10 +405,9 @@ namespace Server.Engines.Plants
from.SendLocalizedMessage(1061884); // You don't have any strong potions of that type in your pack. from.SendLocalizedMessage(1061884); // You don't have any strong potions of that type in your pack.
from.Target = new PlantPourTarget(m_Plant); from.Target = new PlantPourTarget(m_Plant);
from.SendLocalizedMessage(
1060808, // Target the container you wish to use to water the ~1_val~.
$"#{m_Plant.GetLocalizedPlantStatus()}" from.SendLocalizedMessage(1060808, $"#{m_Plant.GetLocalizedPlantStatus()}");
); // Target the container you wish to use to water the ~1_val~.
return; return;
} }

View file

@ -33,11 +33,8 @@ namespace Server.Items
if (!from.CanBeginAction<GreenThorns>()) if (!from.CanBeginAction<GreenThorns>())
{ {
from.LocalOverheadMessage( // * You must wait a while before planting another thorn. *
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061908);
0x3B2,
1061908
); // * You must wait a while before planting another thorn. *
return; return;
} }
@ -80,11 +77,8 @@ namespace Server.Items
if (!from.CanBeginAction<GreenThorns>()) if (!from.CanBeginAction<GreenThorns>())
{ {
from.LocalOverheadMessage( // * You must wait a while before planting another thorn. *
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061908);
0x3B2,
1061908
); // * You must wait a while before planting another thorn. *
return; return;
} }
@ -101,11 +95,8 @@ namespace Server.Items
if (targeted is not LandTarget land) if (targeted is not LandTarget land)
{ {
from.LocalOverheadMessage( // * You cannot plant a green thorn there! *
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061912);
0x3B2,
1061912
); // * You cannot plant a green thorn there! *
} }
else else
{ {
@ -113,27 +104,18 @@ namespace Server.Items
if (effect == null) if (effect == null)
{ {
from.LocalOverheadMessage( // * You sense it would be useless to plant a green thorn there. *
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061913);
0x3B2,
1061913
); // * You sense it would be useless to plant a green thorn there. *
} }
else else
{ {
m_Thorn.Consume(); m_Thorn.Consume();
from.LocalOverheadMessage( // * You push the strange green thorn into the ground *
MessageType.Emote, from.LocalOverheadMessage(MessageType.Emote, 0x961, 1061914);
0x961,
1061914 // * ~1_PLAYER_NAME~ pushes a strange green thorn into the ground. *
); // * You push the strange green thorn into the ground * from.NonlocalOverheadMessage(MessageType.Emote, 0x961, 1061915, from.Name);
from.NonlocalOverheadMessage(
MessageType.Emote,
0x961,
1061915,
from.Name
); // * ~1_PLAYER_NAME~ pushes a strange green thorn into the ground. *
from.BeginAction<GreenThorns>(); from.BeginAction<GreenThorns>();
new EndActionTimer(from).Start(); new EndActionTimer(from).Start();

View file

@ -142,11 +142,8 @@ namespace Server.Engines.Plants
} }
else if (dirt.Amount < _dirtNeeded) else if (dirt.Amount < _dirtNeeded)
{ {
from.LocalOverheadMessage( // You need more dirt to fill a plant bowl!
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061896);
0x3B2,
1061896
); // You need more dirt to fill a plant bowl!
} }
else else
{ {
@ -157,21 +154,15 @@ namespace Server.Engines.Plants
dirt.Consume(_dirtNeeded); dirt.Consume(_dirtNeeded);
m_PlantBowl.Delete(); m_PlantBowl.Delete();
from.LocalOverheadMessage( // You fill the bowl with fresh dirt.
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061895);
0x3B2,
1061895
); // You fill the bowl with fresh dirt.
} }
else else
{ {
fullBowl.Delete(); fullBowl.Delete();
from.LocalOverheadMessage( // There is no room in your backpack for a bowl full of dirt!
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061894);
0x3B2,
1061894
); // There is no room in your backpack for a bowl full of dirt!
} }
} }
} }
@ -189,20 +180,14 @@ namespace Server.Engines.Plants
{ {
fullBowl.Delete(); fullBowl.Delete();
from.LocalOverheadMessage( // There is no room in your backpack for a bowl full of dirt!
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061894);
0x3B2,
1061894
); // There is no room in your backpack for a bowl full of dirt!
} }
} }
else else
{ {
from.LocalOverheadMessage( // You'll want to gather fresh dirt in order to raise a healthy plant!
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061893);
0x3B2,
1061893
); // You'll want to gather fresh dirt in order to raise a healthy plant!
} }
} }

View file

@ -475,10 +475,8 @@ namespace Server.Engines.Plants
} }
else if (m_PlantStatus != PlantStatus.BowlOfDirt) else if (m_PlantStatus != PlantStatus.BowlOfDirt)
{ {
from.SendLocalizedMessage( // This bowl of dirt already has a ~1_val~ in it!
1080389, from.SendLocalizedMessage(1080389, $"#{GetLocalizedPlantStatus()}");
$"#{GetLocalizedPlantStatus()}"
); // This bowl of dirt already has a ~1_val~ in it!
} }
else if (PlantSystem.Water < 2) else if (PlantSystem.Water < 2)
{ {

View file

@ -15,10 +15,8 @@ namespace Server.Engines.Plants
{ {
if (!m_Plant.IsUsableBy(from)) if (!m_Plant.IsUsableBy(from))
{ {
m_Plant.LabelTo( // You must have the item in your backpack or locked down in order to use it.
from, m_Plant.LabelTo(from, 1061856);
1061856
); // You must have the item in your backpack or locked down in order to use it.
} }
else if (!m_Plant.IsCrossable) else if (!m_Plant.IsCrossable)
{ {
@ -40,10 +38,8 @@ namespace Server.Engines.Plants
} }
else if (!targ.IsUsableBy(from)) else if (!targ.IsUsableBy(from))
{ {
targ.LabelTo( // You must have the item in your backpack or locked down in order to use it.
from, targ.LabelTo(from, 1061856);
1061856
); // You must have the item in your backpack or locked down in order to use it.
} }
else if (!targ.IsCrossable) else if (!targ.IsCrossable)
{ {

View file

@ -195,10 +195,8 @@ namespace Server.Engines.Plants
} }
else if (!m_Plant.PlantSystem.PollenProducing) else if (!m_Plant.PlantSystem.PollenProducing)
{ {
m_Plant.LabelTo( // You cannot gather pollen from a plant in this stage of development!
from, m_Plant.LabelTo(from, 1053051);
1053051
); // You cannot gather pollen from a plant in this stage of development!
} }
else if (m_Plant.PlantSystem.Health < PlantHealth.Healthy) else if (m_Plant.PlantSystem.Health < PlantHealth.Healthy)
{ {
@ -248,10 +246,8 @@ namespace Server.Engines.Plants
else else
{ {
resource.Delete(); resource.Delete();
m_Plant.LabelTo( // You attempt to gather as many resources as you can hold, but your backpack is full.
from, m_Plant.LabelTo(from, 1053058);
1053058
); // You attempt to gather as many resources as you can hold, but your backpack is full.
} }
} }
@ -283,10 +279,8 @@ namespace Server.Engines.Plants
else else
{ {
seed.Delete(); seed.Delete();
m_Plant.LabelTo( // You attempt to gather as many seeds as you can hold, but your backpack is full.
from, m_Plant.LabelTo(from, 1053062);
1053062
); // You attempt to gather as many seeds as you can hold, but your backpack is full.
} }
} }

View file

@ -76,10 +76,9 @@ namespace Server.Engines.Plants
case 3: // Ok case 3: // Ok
{ {
m_Plant.PlantStatus = PlantStatus.DecorativePlant; m_Plant.PlantStatus = PlantStatus.DecorativePlant;
m_Plant.LabelTo( // You prune the plant.
from, // This plant will no longer produce resources or seeds, but will require no upkeep.
1053077 m_Plant.LabelTo(from, 1053077);
); // You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.
break; break;
} }

View file

@ -151,7 +151,7 @@ namespace Server.Misc
pm.ToTTotalMonsterFame += (int)(bc.Fame * (1 + Math.Sqrt(pm.Luck) / 100)); pm.ToTTotalMonsterFame += (int)(bc.Fame * (1 + Math.Sqrt(pm.Luck) / 100));
// This is the Exponential regression with only 2 data points. // This is the Exponential regression with only 2 datapoints.
// A log. func would also work, but it didn't make as much sense. // A log. func would also work, but it didn't make as much sense.
// This function isn't OSI exact being that I don't know OSI's func they used ;p // This function isn't OSI exact being that I don't know OSI's func they used ;p
var x = pm.ToTTotalMonsterFame; var x = pm.ToTTotalMonsterFame;
@ -263,9 +263,7 @@ namespace Server.Mobiles
{ {
if (m.Alive && m is PlayerMobile pm) if (m.Alive && m is PlayerMobile pm)
{ {
var range = 3; if (pm.Alive && (Z - pm.Z).Abs() < 16 && InRange(m, 3) && !InRange(oldLocation, 3))
if (pm.Alive && (Z - pm.Z).Abs() < 16 && InRange(m, range) && !InRange(oldLocation, range))
{ {
if (pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward) if (pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward)
{ {
@ -327,9 +325,8 @@ namespace Server.Gumps
public ItemTileButtonInfo(Item i) : base( public ItemTileButtonInfo(Item i) : base(
i.ItemID, i.ItemID,
i.Hue, i.Hue,
i.Name == null || i.Name.Length <= 0 ? i.LabelNumber : i.Name i.Name is not { Length: > 0 } ? i.LabelNumber : i.Name
) => ) => Item = i;
Item = i;
public Item Item { get; set; } public Item Item { get; set; }
} }
@ -619,7 +616,7 @@ namespace Server.Gumps
// Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item. // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
m_Collector.SayTo(pm, 1071013); m_Collector.SayTo(pm, 1071013);
} }
// This and above case should ALWAYS be FALSE with this gump, jsut a sanity check // This and above case should ALWAYS be FALSE with this gump, just a sanity check
else if (pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward) else if (pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward)
{ {
m_Collector.SayTo( m_Collector.SayTo(

View file

@ -46,11 +46,8 @@ namespace Server.Items
{ {
if (from.Poisoned || MortalStrike.IsWounded(from)) if (from.Poisoned || MortalStrike.IsWounded(from))
{ {
from.LocalOverheadMessage( // You can not heal yourself in your current state.
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000);
0x22,
1005000
); // You can not heal yourself in your current state.
} }
else else
{ {
@ -69,19 +66,15 @@ namespace Server.Items
} }
else else
{ {
from.LocalOverheadMessage( // You must wait 10 seconds before using another healing potion.
MessageType.Regular, from.LocalOverheadMessage(MessageType.Regular, 0x22, 500235);
0x22,
500235
); // You must wait 10 seconds before using another healing potion.
} }
} }
} }
else else
{ {
from.SendLocalizedMessage( // You decide against drinking this potion, as you are already at full health.
1049547 from.SendLocalizedMessage(1049547);
); // You decide against drinking this potion, as you are already at full health.
} }
} }
} }

View file

@ -292,7 +292,7 @@ namespace Server.Items
if (weapon.Poison != null && weapon.PoisonCharges > 0) if (weapon.Poison != null && weapon.PoisonCharges > 0)
{ {
if (EvilOmenSpell.TryEndEffect(target)) if (EvilOmenSpell.EndEffect(target))
{ {
target.ApplyPoison(from, Poison.GetPoison(weapon.Poison.Level + 1)); target.ApplyPoison(from, Poison.GetPoison(weapon.Poison.Level + 1));
} }

View file

@ -1258,7 +1258,7 @@ namespace Server.Items
target.Paralyzed = false; target.Paralyzed = false;
EvilOmenSpell.TryEndEffect(target); EvilOmenSpell.EndEffect(target);
StrangleSpell.RemoveCurse(target); StrangleSpell.RemoveCurse(target);
CorpseSkinSpell.RemoveCurse(target); CorpseSkinSpell.RemoveCurse(target);
CurseSpell.RemoveEffect(target); CurseSpell.RemoveEffect(target);

View file

@ -1900,7 +1900,6 @@ namespace Server.Items
var lifeLeech = 0; var lifeLeech = 0;
var stamLeech = 0; var stamLeech = 0;
var manaLeech = 0; var manaLeech = 0;
int wraithLeech;
if ((int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLeechHits) * propertyBonus) > if ((int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLeechHits) * propertyBonus) >
Utility.Random(100)) Utility.Random(100))
@ -1935,7 +1934,7 @@ namespace Server.Items
if (context?.Type == typeof(WraithFormSpell)) if (context?.Type == typeof(WraithFormSpell))
{ {
// Wraith form gives an additional 5-20% mana leech // Wraith form gives an additional 5-20% mana leech
wraithLeech = 5 + (int)(15 * attacker.Skills.SpiritSpeak.Value / 100); var wraithLeech = 5 + (int)(15 * attacker.Skills.SpiritSpeak.Value / 100);
// Mana leeched by the Wraith Form spell is actually stolen, not just leeched. // Mana leeched by the Wraith Form spell is actually stolen, not just leeched.
defender.Mana -= AOS.Scale(damageGiven, wraithLeech); defender.Mana -= AOS.Scale(damageGiven, wraithLeech);

View file

@ -164,23 +164,20 @@ namespace Server
} }
} }
if (from?.Player != true && m.Player && m.Mount is SwampDragon pet) if (from?.Player != true && m.Player && m.Mount is SwampDragon { HasBarding: true } pet)
{ {
if (pet.HasBarding) var percent = pet.BardingExceptional ? 20 : 10;
var absorbed = Scale(totalDamage, percent);
totalDamage -= absorbed;
pet.BardingHP -= absorbed;
if (pet.BardingHP < 0)
{ {
var percent = pet.BardingExceptional ? 20 : 10; pet.HasBarding = false;
var absorbed = Scale(totalDamage, percent); pet.BardingHP = 0;
totalDamage -= absorbed; m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
pet.BardingHP -= absorbed;
if (pet.BardingHP < 0)
{
pet.HasBarding = false;
pet.BardingHP = 0;
m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
}
} }
} }

View file

@ -26,7 +26,7 @@ namespace Server
{ {
} }
// Only the timed one needs to Mobile to know when to automagically remove it. // Only the timed one needs the Mobile to know when to automagically remove it.
public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m) public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m)
: this(iconID, titleCliloc, secondaryCliloc) : this(iconID, titleCliloc, secondaryCliloc)
{ {

View file

@ -1325,7 +1325,7 @@ namespace Server.Mobiles
amount = (int)(amount * BonusPetDamageScalar); amount = (int)(amount * BonusPetDamageScalar);
} }
if (EvilOmenSpell.TryEndEffect(this)) if (EvilOmenSpell.EndEffect(this))
{ {
amount = (int)(amount * 1.25); amount = (int)(amount * 1.25);
} }
@ -1385,7 +1385,7 @@ namespace Server.Mobiles
return ApplyPoisonResult.Immune; return ApplyPoisonResult.Immune;
} }
if (EvilOmenSpell.TryEndEffect(this)) if (EvilOmenSpell.EndEffect(this))
{ {
poison = PoisonImpl.IncreaseLevel(poison); poison = PoisonImpl.IncreaseLevel(poison);
} }

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Server.Accounting; using Server.Accounting;
using Server.Collections;
using Server.ContextMenus; using Server.ContextMenus;
using Server.Engines.BulkOrders; using Server.Engines.BulkOrders;
using Server.Engines.ConPVP; using Server.Engines.ConPVP;
@ -2716,19 +2717,19 @@ namespace Server.Mobiles
if (m_BuffTable != null) if (m_BuffTable != null)
{ {
var list = new List<BuffInfo>(); using var queue = PooledRefQueue<BuffInfo>.Create();
foreach (var buff in m_BuffTable.Values) foreach (var buff in m_BuffTable.Values)
{ {
if (!buff.RetainThroughDeath) if (!buff.RetainThroughDeath)
{ {
list.Add(buff); queue.Enqueue(buff);
} }
} }
for (var i = 0; i < list.Count; i++) while (queue.Count > 0)
{ {
RemoveBuff(list[i]); RemoveBuff(queue.Dequeue());
} }
} }
} }
@ -2838,7 +2839,7 @@ namespace Server.Mobiles
public override void Damage(int amount, Mobile from = null, bool informMount = true) public override void Damage(int amount, Mobile from = null, bool informMount = true)
{ {
if (EvilOmenSpell.TryEndEffect(this)) if (EvilOmenSpell.EndEffect(this))
{ {
amount = (int)(amount * 1.25); amount = (int)(amount * 1.25);
} }
@ -4132,7 +4133,7 @@ namespace Server.Mobiles
return ApplyPoisonResult.Immune; return ApplyPoisonResult.Immune;
} }
if (EvilOmenSpell.TryEndEffect(this)) if (EvilOmenSpell.EndEffect(this))
{ {
poison = PoisonImpl.IncreaseLevel(poison); poison = PoisonImpl.IncreaseLevel(poison);
} }

View file

@ -78,9 +78,8 @@ namespace Server.SkillHandlers
if (faction == null) if (faction == null)
{ {
from.SendLocalizedMessage( // You may not disarm faction traps unless you are in an opposing faction
1010538 from.SendLocalizedMessage(1010538);
); // You may not disarm faction traps unless you are in an opposing faction
} }
else if (trap.Faction != null && faction == trap.Faction && !isOwner) else if (trap.Faction != null && faction == trap.Faction && !isOwner)
{ {
@ -88,9 +87,8 @@ namespace Server.SkillHandlers
} }
else if (!isOwner && kit == null) else if (!isOwner && kit == null)
{ {
from.SendLocalizedMessage( // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
1042530 from.SendLocalizedMessage(1042530);
); // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
} }
else else
{ {
@ -110,13 +108,8 @@ namespace Server.SkillHandlers
if (silver > 0) if (silver > 0)
{ {
from.SendLocalizedMessage( // You have been granted faction silver for removing the enemy trap :
1008113, from.SendLocalizedMessage(1008113, true, silver.ToString("N0"));
true,
silver.ToString(
"N0"
)
); // You have been granted faction silver for removing the enemy trap :
} }
} }

View file

@ -138,7 +138,7 @@ namespace Server.Spells.Chivalry
sendEffect = true; sendEffect = true;
} }
sendEffect = EvilOmenSpell.TryEndEffect(m) || sendEffect; sendEffect = EvilOmenSpell.EndEffect(m) || sendEffect;
sendEffect = StrangleSpell.RemoveCurse(m) || sendEffect; sendEffect = StrangleSpell.RemoveCurse(m) || sendEffect;
sendEffect = CorpseSkinSpell.RemoveCurse(m) || sendEffect; sendEffect = CorpseSkinSpell.RemoveCurse(m) || sendEffect;
sendEffect = CurseSpell.RemoveEffect(m) || sendEffect; sendEffect = CurseSpell.RemoveEffect(m) || sendEffect;

View file

@ -98,7 +98,7 @@ namespace Server.Spells.Chivalry
m.Paralyzed = false; m.Paralyzed = false;
EvilOmenSpell.TryEndEffect(m); EvilOmenSpell.EndEffect(m);
StrangleSpell.RemoveCurse(m); StrangleSpell.RemoveCurse(m);
CorpseSkinSpell.RemoveCurse(m); CorpseSkinSpell.RemoveCurse(m);
CurseSpell.RemoveEffect(m); CurseSpell.RemoveEffect(m);

View file

@ -66,7 +66,7 @@ namespace Server.Spells.Necromancy
var duration = TimeSpan.FromSeconds(Caster.Skills.SpiritSpeak.Value / 12 + 1.0); var duration = TimeSpan.FromSeconds(Caster.Skills.SpiritSpeak.Value / 12 + 1.0);
Timer.StartTimer(duration, () => TryEndEffect(m)); Timer.StartTimer(duration, () => EndEffect(m));
HarmfulSpell(m); HarmfulSpell(m);
@ -81,7 +81,7 @@ namespace Server.Spells.Necromancy
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12); Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
} }
public static bool TryEndEffect(Mobile m) public static bool EndEffect(Mobile m)
{ {
if (!_table.Remove(m, out var mod)) if (!_table.Remove(m, out var mod))
{ {

View file

@ -25,7 +25,7 @@ namespace Server.Spells.Ninjitsu
9002 9002
); );
private static readonly Dictionary<Mobile, int> m_LastAnimalForms = new(); private static readonly Dictionary<Mobile, int> _lastAnimalForms = new();
private static readonly Dictionary<Mobile, AnimalFormContext> _table = new(); private static readonly Dictionary<Mobile, AnimalFormContext> _table = new();
private bool m_WasMoving; private bool m_WasMoving;
@ -135,10 +135,8 @@ namespace Server.Spells.Ninjitsu
var mana = ScaleMana(RequiredMana); var mana = ScaleMana(RequiredMana);
if (mana > Caster.Mana) if (mana > Caster.Mana)
{ {
Caster.SendLocalizedMessage( // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
1060174, Caster.SendLocalizedMessage(1060174, mana.ToString());
mana.ToString()
); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
} }
else if (context != null) else if (context != null)
{ {
@ -167,24 +165,21 @@ namespace Server.Spells.Ninjitsu
} }
} }
} }
else if (Morph(Caster, GetLastAnimalForm(Caster)) == MorphResult.Fail)
{
DoFizzle();
}
else else
{ {
if (Morph(Caster, GetLastAnimalForm(Caster)) == MorphResult.Fail) Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist);
{ Caster.Mana -= mana;
DoFizzle();
}
else
{
Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist);
Caster.Mana -= mana;
}
} }
} }
FinishSequence(); FinishSequence();
} }
public int GetLastAnimalForm(Mobile m) => m_LastAnimalForms.TryGetValue(m, out var value) ? value : -1; public int GetLastAnimalForm(Mobile m) => _lastAnimalForms.TryGetValue(m, out var value) ? value : -1;
public static MorphResult Morph(Mobile m, int entryID) public static MorphResult Morph(Mobile m, int entryID)
{ {
@ -195,15 +190,12 @@ namespace Server.Spells.Ninjitsu
var entry = Entries[entryID]; var entry = Entries[entryID];
m_LastAnimalForms[m] = entryID; // On OSI, it's the last /attempted/ one not the last succeeded one _lastAnimalForms[m] = entryID; // On OSI, it's the last /attempted/ one not the last succeeded one
if (m.Skills.Ninjitsu.Value < entry.ReqSkill) if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
{ {
var args = $"{entry.ReqSkill:F1}\t{SkillName.Ninjitsu}\t "; // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
m.SendLocalizedMessage( m.SendLocalizedMessage(1063013, $"{entry.ReqSkill:F1}\t{SkillName.Ninjitsu}\t ");
1063013,
args
); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
return MorphResult.NoSkill; return MorphResult.NoSkill;
} }
@ -539,81 +531,81 @@ namespace Server.Spells.Ninjitsu
public class AnimalFormTimer : Timer public class AnimalFormTimer : Timer
{ {
private readonly int m_Body; private int _body;
private readonly int m_Hue; private int _hue;
private readonly Mobile m_Mobile; private Mobile _mobile;
private int m_Counter; private int _counter;
private Mobile m_LastTarget; private Mobile _lastTarget;
public AnimalFormTimer(Mobile from, int body, int hue) public AnimalFormTimer(Mobile from, int body, int hue)
: base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0)) : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
{ {
m_Mobile = from; _mobile = from;
m_Body = body; _body = body;
m_Hue = hue; _hue = hue;
m_Counter = 0; _counter = 0;
} }
protected override void OnTick() protected override void OnTick()
{ {
if (m_Mobile.Deleted || !m_Mobile.Alive || m_Mobile.Body != m_Body || m_Mobile.Hue != m_Hue) if (_mobile.Deleted || !_mobile.Alive || _mobile.Body != _body || _mobile.Hue != _hue)
{ {
AnimalForm.RemoveContext(m_Mobile, true); AnimalForm.RemoveContext(_mobile, true);
Stop(); Stop();
return; return;
} }
if (m_Body == 0x115) // Cu Sidhe if (_body == 0x115) // Cu Sidhe
{ {
if (m_Counter++ >= 8) if (_counter++ >= 8)
{ {
if (m_Mobile.Hits < m_Mobile.HitsMax && m_Mobile.Backpack != null) if (_mobile.Hits < _mobile.HitsMax && _mobile.Backpack != null)
{ {
var b = m_Mobile.Backpack.FindItemByType<Bandage>(); var b = _mobile.Backpack.FindItemByType<Bandage>();
if (b != null) if (b != null)
{ {
m_Mobile.Hits += Utility.RandomMinMax(20, 50); _mobile.Hits += Utility.RandomMinMax(20, 50);
b.Consume(); b.Consume();
} }
} }
m_Counter = 0; _counter = 0;
} }
} }
else if (m_Body == 0x114) // Reptalon else if (_body == 0x114) // Reptalon
{ {
if (m_Mobile.Combatant != null && m_Mobile.Combatant != m_LastTarget) if (_mobile.Combatant != null && _mobile.Combatant != _lastTarget)
{ {
m_Counter = 1; _counter = 1;
m_LastTarget = m_Mobile.Combatant; _lastTarget = _mobile.Combatant;
} }
if (m_Mobile.Warmode && m_LastTarget is { Alive: true, Deleted: false } && m_Counter-- <= 0) if (_mobile.Warmode && _lastTarget is { Alive: true, Deleted: false } && _counter-- <= 0)
{ {
if (m_Mobile.CanBeHarmful(m_LastTarget) && m_LastTarget.Map == m_Mobile.Map && if (_mobile.CanBeHarmful(_lastTarget) && _lastTarget.Map == _mobile.Map &&
m_LastTarget.InRange(m_Mobile.Location, BaseCreature.DefaultRangePerception) && _lastTarget.InRange(_mobile.Location, BaseCreature.DefaultRangePerception) &&
m_Mobile.InLOS(m_LastTarget)) _mobile.InLOS(_lastTarget))
{ {
m_Mobile.Direction = m_Mobile.GetDirectionTo(m_LastTarget); _mobile.Direction = _mobile.GetDirectionTo(_lastTarget);
m_Mobile.Freeze(TimeSpan.FromSeconds(1)); _mobile.Freeze(TimeSpan.FromSeconds(1));
m_Mobile.PlaySound(0x16A); _mobile.PlaySound(0x16A);
StartTimer(TimeSpan.FromSeconds(1.3), () => BreathEffect_Callback(m_LastTarget)); StartTimer(TimeSpan.FromSeconds(1.3), () => BreathEffect_Callback(_lastTarget));
} }
m_Counter = Math.Min((int)m_Mobile.GetDistanceToSqrt(m_LastTarget), 10); _counter = Math.Min((int)_mobile.GetDistanceToSqrt(_lastTarget), 10);
} }
} }
} }
public void BreathEffect_Callback(Mobile target) public void BreathEffect_Callback(Mobile target)
{ {
if (m_Mobile.CanBeHarmful(target)) if (_mobile.CanBeHarmful(target))
{ {
m_Mobile.RevealingAction(); _mobile.RevealingAction();
m_Mobile.PlaySound(0x227); _mobile.PlaySound(0x227);
Effects.SendMovingEffect(m_Mobile, target, 0x36D4, 5, 0); Effects.SendMovingEffect(_mobile, target, 0x36D4, 5, 0);
StartTimer(TimeSpan.FromSeconds(1), () => BreathDamage_Callback(target)); StartTimer(TimeSpan.FromSeconds(1), () => BreathDamage_Callback(target));
} }
@ -621,11 +613,11 @@ namespace Server.Spells.Ninjitsu
public void BreathDamage_Callback(Mobile target) public void BreathDamage_Callback(Mobile target)
{ {
if (m_Mobile.CanBeHarmful(target)) if (_mobile.CanBeHarmful(target))
{ {
m_Mobile.RevealingAction(); _mobile.RevealingAction();
m_Mobile.DoHarmful(target); _mobile.DoHarmful(target);
AOS.Damage(target, m_Mobile, 20, !target.Player, 0, 100, 0, 0, 0); AOS.Damage(target, _mobile, 20, !target.Player, 0, 100, 0, 0, 0);
} }
} }
} }

View file

@ -29,19 +29,15 @@ namespace Server.Spells.Ninjitsu
var ninjitsu = attacker.Skills.Ninjitsu.Value; var ninjitsu = attacker.Skills.Ninjitsu.Value;
double chance;
// TODO: should be defined onHit method, what if the player hit and remove the weapon before process? ;) // TODO: should be defined onHit method, what if the player hit and remove the weapon before process? ;)
var isRanged = attacker.Weapon is BaseRanged; var isRanged = attacker.Weapon is BaseRanged;
if (ninjitsu < 100) // This formula is an approximation from OSI data. TODO: find correct formula var chance = ninjitsu switch
{ {
chance = 30 + (ninjitsu - 85) * 2.2; // This formula is an approximation from OSI data. TODO: find correct formula
} < 100 => 30 + (ninjitsu - 85) * 2.2,
else _ => 63 + (ninjitsu - 100) * 1.1
{ };
chance = 63 + (ninjitsu - 100) * 1.1;
}
if (chance / 100 < Utility.RandomDouble()) if (chance / 100 < Utility.RandomDouble())
{ {
@ -91,19 +87,19 @@ namespace Server.Spells.Ninjitsu
private class DeathStrikeTimer : Timer private class DeathStrikeTimer : Timer
{ {
public readonly Mobile m_Attacker; private Mobile _attacker;
public readonly int m_DamageBonus; private int _damageBonus;
public readonly bool m_isRanged; private bool _isRanged;
public readonly Mobile m_Target; private Mobile _target;
public int Steps { get; set; } public int Steps { get; set; }
internal DeathStrikeTimer(Mobile target, Mobile attacker, int damageBonus, bool isRanged) internal DeathStrikeTimer(Mobile target, Mobile attacker, int damageBonus, bool isRanged)
: base(TimeSpan.FromSeconds(5.0)) : base(TimeSpan.FromSeconds(5.0))
{ {
m_Target = target; _target = target;
m_Attacker = attacker; _attacker = attacker;
m_DamageBonus = damageBonus; _damageBonus = damageBonus;
m_isRanged = isRanged; _isRanged = isRanged;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -116,13 +112,12 @@ namespace Server.Spells.Ninjitsu
{ {
int damage; int damage;
var ninjitsu = m_Attacker.Skills.Ninjitsu.Value; var ninjitsu = _attacker.Skills.Ninjitsu.Value;
var stalkingBonus = Tracking.GetStalkingBonus(m_Attacker, m_Target); var stalkingBonus = Tracking.GetStalkingBonus(_attacker, _target);
if (Core.ML) if (Core.ML)
{ {
var scalar = Math.Min(1, (m_Attacker.Skills.Hiding.Value + var scalar = Math.Min(1, (_attacker.Skills.Hiding.Value + _attacker.Skills.Stealth.Value) / 220);
m_Attacker.Skills.Stealth.Value) / 220);
// New formula doesn't apply DamageBonus anymore, caps must be, directly, 60/30. // New formula doesn't apply DamageBonus anymore, caps must be, directly, 60/30.
if (Steps >= 5) if (Steps >= 5)
@ -134,7 +129,7 @@ namespace Server.Spells.Ninjitsu
damage = (int)Math.Floor(Math.Min(30, ninjitsu / 9 * (0.3 + 0.7 * scalar) + stalkingBonus)); damage = (int)Math.Floor(Math.Min(30, ninjitsu / 9 * (0.3 + 0.7 * scalar) + stalkingBonus));
} }
if (m_isRanged) if (_isRanged)
{ {
damage /= 2; damage /= 2;
} }
@ -145,18 +140,19 @@ namespace Server.Spells.Ninjitsu
var baseDamage = ninjitsu / divisor * 10; var baseDamage = ninjitsu / divisor * 10;
var maxDamage = Steps >= 5 ? 62 : 22; var maxDamage = Steps >= 5 ? 62 : 22;
damage = Math.Clamp((int)(baseDamage + stalkingBonus), 0, maxDamage) + m_DamageBonus; damage = Math.Clamp((int)(baseDamage + stalkingBonus), 0, maxDamage) + _damageBonus;
} }
if (Core.ML) if (Core.ML)
{ {
m_Target.Damage(damage, m_Attacker); // Damage is direct. _target.Damage(damage, _attacker); // Damage is direct.
} }
else else
{ {
// Damage is physical.
AOS.Damage( AOS.Damage(
m_Target, _target,
m_Attacker, _attacker,
damage, damage,
true, true,
100, 100,
@ -169,7 +165,7 @@ namespace Server.Spells.Ninjitsu
false, false,
false, false,
true true
); // Damage is physical. );
} }
Stop(); Stop();

View file

@ -99,29 +99,29 @@ namespace Server.Spells.Ninjitsu
return 0; return 0;
} }
var xDelta = t.m_Location.X - from.X; var xDelta = t._location.X - from.X;
var yDelta = t.m_Location.Y - from.Y; var yDelta = t._location.Y - from.Y;
return Math.Min(Math.Sqrt(xDelta * xDelta + yDelta * yDelta), 20.0); return Math.Min(Math.Sqrt(xDelta * xDelta + yDelta * yDelta), 20.0);
} }
private class KiAttackTimer : Timer private class KiAttackTimer : Timer
{ {
public readonly Mobile m_Mobile; public Mobile _mobile;
public Point3D m_Location; public Point3D _location;
public KiAttackTimer(Mobile m) : base(TimeSpan.FromSeconds(2.0)) public KiAttackTimer(Mobile m) : base(TimeSpan.FromSeconds(2.0))
{ {
m_Mobile = m; _mobile = m;
m_Location = m.Location; _location = m.Location;
} }
protected override void OnTick() protected override void OnTick()
{ {
ClearCurrentMove(m_Mobile); ClearCurrentMove(_mobile);
m_Mobile.SendLocalizedMessage(1063102); // You failed to complete your Ki Attack in time. _mobile.SendLocalizedMessage(1063102); // You failed to complete your Ki Attack in time.
_table.Remove(m_Mobile); _table.Remove(_mobile);
} }
} }
} }

View file

@ -10,7 +10,7 @@ namespace Server.Spells.Ninjitsu
{ {
public class MirrorImage : NinjaSpell public class MirrorImage : NinjaSpell
{ {
private static readonly Dictionary<Mobile, int> m_CloneCount = new(); private static readonly Dictionary<Mobile, int> _cloneCount = new();
private static readonly SpellInfo _info = new( private static readonly SpellInfo _info = new(
"Mirror Image", "Mirror Image",
@ -30,7 +30,7 @@ namespace Server.Spells.Ninjitsu
public override bool BlockedByAnimalForm => false; public override bool BlockedByAnimalForm => false;
public static bool HasClone(Mobile m) => m_CloneCount.ContainsKey(m); public static bool HasClone(Mobile m) => _cloneCount.ContainsKey(m);
public static void AddClone(Mobile m) public static void AddClone(Mobile m)
{ {
@ -39,23 +39,23 @@ namespace Server.Spells.Ninjitsu
return; return;
} }
m_CloneCount[m] = 1 + (m_CloneCount.TryGetValue(m, out var count) ? count : 0); _cloneCount[m] = 1 + (_cloneCount.TryGetValue(m, out var count) ? count : 0);
} }
public static void RemoveClone(Mobile m) public static void RemoveClone(Mobile m)
{ {
if (m == null || !m_CloneCount.TryGetValue(m, out var count)) if (m == null || !_cloneCount.TryGetValue(m, out var count))
{ {
return; return;
} }
if (count <= 1) if (count <= 1)
{ {
m_CloneCount.Remove(m); _cloneCount.Remove(m);
} }
else else
{ {
m_CloneCount[m]--; _cloneCount[m]--;
} }
} }

View file

@ -6,8 +6,7 @@ namespace Server.Spells.Ninjitsu
{ {
public class SurpriseAttack : NinjaMove public class SurpriseAttack : NinjaMove
{ {
private static readonly Dictionary<Mobile, SurpriseAttackInfo> private static readonly Dictionary<Mobile, SurpriseAttackTimer> _table = new();
_table = new();
public override int BaseMana => 20; public override int BaseMana => 20;
public override double RequiredSkill => Core.ML ? 60.0 : 30.0; public override double RequiredSkill => Core.ML ? 60.0 : 30.0;
@ -59,10 +58,10 @@ namespace Server.Spells.Ninjitsu
var malus = ninjitsu / 60 + (int)Tracking.GetStalkingBonus(attacker, defender); var malus = ninjitsu / 60 + (int)Tracking.GetStalkingBonus(attacker, defender);
var info = new SurpriseAttackInfo(defender, malus); var timer = new SurpriseAttackTimer(defender, malus);
Timer.StartTimer(TimeSpan.FromSeconds(8.0), () => EndSurprise(info), out info._timerToken); timer.Start();
_table[defender] = info; _table[defender] = timer;
CheckGain(attacker); CheckGain(attacker);
} }
@ -83,34 +82,39 @@ namespace Server.Spells.Ninjitsu
return false; return false;
} }
malus = info.m_Malus; malus = info.Malus;
return true; return true;
} }
private static void StopTimer(Mobile m) private static void StopTimer(Mobile m)
{ {
if (_table.Remove(m, out var info)) if (_table.Remove(m, out var timer))
{ {
info._timerToken.Cancel(); timer.Stop();
} }
} }
private static void EndSurprise(SurpriseAttackInfo info) private static void EndSurprise(SurpriseAttackTimer info)
{ {
StopTimer(info.m_Target); StopTimer(info.Target);
info.m_Target.SendLocalizedMessage(1063131); // Your defenses have returned to normal. info.Target.SendLocalizedMessage(1063131); // Your defenses have returned to normal.
} }
private class SurpriseAttackInfo private class SurpriseAttackTimer : Timer
{ {
public readonly int m_Malus; public int Malus;
public readonly Mobile m_Target; public Mobile Target;
public TimerExecutionToken _timerToken;
public SurpriseAttackInfo(Mobile target, int effect) public SurpriseAttackTimer(Mobile target, int effect) : base(TimeSpan.FromSeconds(8.0))
{ {
m_Target = target; Target = target;
m_Malus = effect; Malus = effect;
}
protected override void OnTick()
{
StopTimer(Target);
Target.SendLocalizedMessage(1063131); // Your defenses have returned to normal.
} }
} }
} }

View file

@ -57,9 +57,9 @@ namespace Server.Spells
MessageType.Regular, MessageType.Regular,
0x3B2, 0x3B2,
3, 3,
502357, 502357, // I can not recall from that object.
from.Name from.Name
); // I can not recall from that object. );
} }
} }
else if (o is HouseRaffleDeed deed && deed.ValidLocation()) else if (o is HouseRaffleDeed deed && deed.ValidLocation())
@ -74,9 +74,9 @@ namespace Server.Spells
MessageType.Regular, MessageType.Regular,
0x3B2, 0x3B2,
3, 3,
502357, 502357, // I can not recall from that object.
from.Name from.Name
); // I can not recall from that object. );
} }
} }

View file

@ -19,6 +19,11 @@ namespace Server.Spells
protected override bool CanTarget(Mobile from, StaticTarget staticTarget, ref Point3D loc, ref Map map) => false; protected override bool CanTarget(Mobile from, StaticTarget staticTarget, ref Point3D loc, ref Map map) => false;
protected override bool CanTarget(Mobile from, Mobile mobile, ref Point3D loc, ref Map map) => false; protected override bool CanTarget(Mobile from, Mobile mobile, ref Point3D loc, ref Map map) => false;
protected override void OnCantSeeTarget(Mobile from, object o)
{
from.SendLocalizedMessage(500237); // Target can not be seen.
}
protected override void OnTarget(Mobile from, object o) protected override void OnTarget(Mobile from, object o)
{ {
_spell.Target(o as Item); _spell.Target(o as Item);

View file

@ -27,6 +27,11 @@ namespace Server.Spells
_spell.Target(o as IPoint3D); _spell.Target(o as IPoint3D);
} }
protected override void OnCantSeeTarget(Mobile from, object o)
{
from.SendLocalizedMessage(500237); // Target can not be seen.
}
protected override void OnTargetOutOfLOS(Mobile from, object o) protected override void OnTargetOutOfLOS(Mobile from, object o)
{ {
if (!_retryOnLos) if (!_retryOnLos)