fix(content): Localizes some messages and cleans up virtues (#657)
This commit is contained in:
parent
fb915992dd
commit
f8820e581a
9 changed files with 122 additions and 80 deletions
|
|
@ -20,7 +20,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy(Mobile from)
|
||||
{
|
||||
if (!(from is PlayerMobile pm))
|
||||
if (from is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
private static int GetHonorDuration(PlayerMobile from)
|
||||
private static int GetHonorDuration(Mobile from)
|
||||
{
|
||||
return VirtueHelper.GetLevel(from, VirtueName.Honor) switch
|
||||
{
|
||||
|
|
@ -56,9 +56,9 @@ namespace Server
|
|||
var remainingMinutes = (int)Math.Ceiling(remainingTime.TotalMinutes);
|
||||
|
||||
pm.SendLocalizedMessage(
|
||||
1063240,
|
||||
1063240, // You must wait ~1_HONOR_WAIT~ minutes before embracing honor again
|
||||
remainingMinutes.ToString()
|
||||
); // You must wait ~1_HONOR_WAIT~ minutes before embracing honor again
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
if (target.Body.IsHuman && (!(target is BaseCreature cret) || !cret.AlwaysAttackable && !cret.AlwaysMurderer))
|
||||
if (target.Body.IsHuman && (target is not BaseCreature cret || !cret.AlwaysAttackable && !cret.AlwaysMurderer))
|
||||
{
|
||||
if (reg?.IsDisabled() != true)
|
||||
{
|
||||
|
|
@ -143,7 +143,7 @@ namespace Server
|
|||
else
|
||||
{
|
||||
source.SendLocalizedMessage(1001018); // You cannot perform negative acts
|
||||
return; // cannot honor in trammel town on blue
|
||||
return; // cannot honor in trammel town on blue
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ namespace Server
|
|||
|
||||
source.SentHonorContext?.Cancel();
|
||||
|
||||
new HonorContext(source, target);
|
||||
_ = new HonorContext(source, target);
|
||||
|
||||
source.Direction = source.GetDirectionTo(target);
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ namespace Server
|
|||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (!(from is PlayerMobile pm))
|
||||
if (from is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,25 +29,10 @@ namespace Server
|
|||
return GetMapRegion(map, first.Location) == GetMapRegion(map, second.Location);
|
||||
}
|
||||
|
||||
public static int GetMapRegion(Map map, Point3D loc)
|
||||
{
|
||||
if (map == null || map.MapID >= 2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (loc.X < 5120)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (loc.Y < 2304)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
public static int GetMapRegion(Map map, Point3D loc) =>
|
||||
map is not { MapID: < 2 } ? 0 :
|
||||
loc.X < 5120 ? 0 :
|
||||
loc.Y < 2304 ? 1 : 2;
|
||||
|
||||
public static void OnVirtueUsed(Mobile from)
|
||||
{
|
||||
|
|
@ -56,7 +41,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(from is PlayerMobile protector))
|
||||
if (from is not PlayerMobile protector)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -192,7 +177,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy(Mobile from)
|
||||
{
|
||||
if (!(from is PlayerMobile pm))
|
||||
if (from is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -240,9 +225,9 @@ namespace Server
|
|||
20,
|
||||
360,
|
||||
25,
|
||||
1049365,
|
||||
1049365, // Another player is offering you their <a href="?ForceTopic88">protection</a>:
|
||||
0x7FFF
|
||||
); // Another player is offering you their <a href="?ForceTopic88">protection</a>:
|
||||
);
|
||||
AddLabel(90, 55, 1153, protector.Name);
|
||||
|
||||
AddImage(50, 45, 9005);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy(Mobile from)
|
||||
{
|
||||
if (!(from is PlayerMobile pm))
|
||||
if (from is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(from is PlayerMobile pm))
|
||||
if (from is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -106,12 +106,12 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(from is PlayerMobile pm))
|
||||
if (from is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(targeted is Mobile targ))
|
||||
if (targeted is not Mobile targ)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -142,20 +142,12 @@ namespace Server
|
|||
}
|
||||
else
|
||||
{
|
||||
int toGain;
|
||||
|
||||
if (from.Fame < 5000)
|
||||
int toGain = from.Fame switch
|
||||
{
|
||||
toGain = 500;
|
||||
}
|
||||
else if (from.Fame < 10000)
|
||||
{
|
||||
toGain = 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
toGain = 2000;
|
||||
}
|
||||
< 5000 => 500,
|
||||
< 10000 => 1000,
|
||||
_ => 2000
|
||||
};
|
||||
|
||||
from.Fame = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy(Mobile from)
|
||||
{
|
||||
if (!(from is PlayerMobile pm))
|
||||
if (from is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ namespace Server
|
|||
|
||||
public static void Valor(Mobile from, object targ)
|
||||
{
|
||||
if (!(targ is IdolOfTheChampion idol) || idol.Deleted || idol.Spawn?.Deleted != false)
|
||||
if (targ is not IdolOfTheChampion idol || idol.Deleted || idol.Spawn?.Deleted != false)
|
||||
{
|
||||
from.SendLocalizedMessage(1054035); // You must target a Champion Idol to challenge the Champion's spawn!
|
||||
}
|
||||
|
|
@ -103,17 +103,15 @@ namespace Server
|
|||
if (from.Virtues.GetValue((int)VirtueName.Valor) >= needed)
|
||||
{
|
||||
VirtueHelper.Atrophy(from, VirtueName.Valor, consumed);
|
||||
from.SendLocalizedMessage(
|
||||
1054037
|
||||
); // Your challenge is heard by the Champion of this region! Beware its wrath!
|
||||
// Your challenge is heard by the Champion of this region! Beware its wrath!
|
||||
from.SendLocalizedMessage(1054037);
|
||||
idol.Spawn.HasBeenAdvanced = true;
|
||||
idol.Spawn.AdvanceLevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1054039
|
||||
); // The Champion of this region ignores your challenge. You must further prove your valor.
|
||||
// The Champion of this region ignores your challenge. You must further prove your valor.
|
||||
from.SendLocalizedMessage(1054039);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -121,17 +119,15 @@ namespace Server
|
|||
if (vl == VirtueLevel.Knight)
|
||||
{
|
||||
VirtueHelper.Atrophy(from, VirtueName.Valor, 11000);
|
||||
from.SendLocalizedMessage(
|
||||
1054037
|
||||
); // Your challenge is heard by the Champion of this region! Beware its wrath!
|
||||
// Your challenge is heard by the Champion of this region! Beware its wrath!
|
||||
from.SendLocalizedMessage(1054037);
|
||||
idol.Spawn.EndRestart();
|
||||
idol.Spawn.HasBeenAdvanced = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1054036
|
||||
); // You must be a Knight of Valor to summon the champion's spawn in this manner!
|
||||
// You must be a Knight of Valor to summon the champion's spawn in this manner!
|
||||
from.SendLocalizedMessage(1054036);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,12 +51,60 @@ namespace Server
|
|||
return (VirtueLevel)vl;
|
||||
}
|
||||
|
||||
public static string GetName(this VirtueName virtue) =>
|
||||
virtue switch
|
||||
{
|
||||
VirtueName.Humility => "Humility",
|
||||
VirtueName.Sacrifice => "Sacrifice",
|
||||
VirtueName.Compassion => "Compassion",
|
||||
VirtueName.Spirituality => "Spirituality",
|
||||
VirtueName.Valor => "Valor",
|
||||
VirtueName.Honor => "Honor",
|
||||
VirtueName.Justice => "Justice",
|
||||
VirtueName.Honesty => "Honesty",
|
||||
_ => ""
|
||||
};
|
||||
|
||||
public static int GetMaxAmount(VirtueName virtue) =>
|
||||
virtue switch
|
||||
{
|
||||
VirtueName.Honor => 20000,
|
||||
VirtueName.Honor => 20000,
|
||||
VirtueName.Sacrifice => 22000,
|
||||
_ => 21000
|
||||
_ => 21000
|
||||
};
|
||||
|
||||
public static int GetGainedLocalizedMessage(VirtueName virtue) =>
|
||||
virtue switch
|
||||
{
|
||||
VirtueName.Sacrifice => 1054160, // You have gained in sacrifice.
|
||||
VirtueName.Compassion => 1053002, // You have gained in compassion.
|
||||
VirtueName.Spirituality => 1155832, // You have gained in Spirituality.
|
||||
VirtueName.Valor => 1054030, // You have gained in Valor!
|
||||
VirtueName.Honor => 1063225, // You have gained in Honor.
|
||||
VirtueName.Justice => 1049363, // You have gained in Justice.
|
||||
VirtueName.Humility => 1052070, // You have gained in Humility.
|
||||
_ => 0
|
||||
};
|
||||
|
||||
public static int GetGainedAPathLocalizedMessage(VirtueName virtue) =>
|
||||
virtue switch
|
||||
{
|
||||
VirtueName.Sacrifice => 1052008, // You have gained a path in Sacrifice!
|
||||
VirtueName.Spirituality => 1155833, // You have gained a path in Spirituality!
|
||||
VirtueName.Valor => 1054032, // You have gained a path in Valor!
|
||||
VirtueName.Honor => 1063226, // You have gained a path in Honor!
|
||||
VirtueName.Justice => 1049367, // You have gained a path in Justice!
|
||||
VirtueName.Humility => 1155811, // You have gained a path in Humility!
|
||||
_ => 0
|
||||
};
|
||||
|
||||
public static int GetHightestPathLocalizedMessage(VirtueName virtue) =>
|
||||
virtue switch
|
||||
{
|
||||
VirtueName.Compassion => 1053003, // You have achieved the highest path of compassion and can no longer gain any further.
|
||||
VirtueName.Valor => 1054031, // You have achieved the highest path in Valor and can no longer gain any further.
|
||||
VirtueName.Honesty => 1153771, // You have achieved the highest path in Honesty and can no longer gain any further.
|
||||
_ => 0
|
||||
};
|
||||
|
||||
public static bool Award(Mobile from, VirtueName virtue, int amount, ref bool gainedPath)
|
||||
|
|
@ -126,37 +174,58 @@ namespace Server
|
|||
}
|
||||
|
||||
var gainedPath = false;
|
||||
var virtueName = Enum.GetName(typeof(VirtueName), virtue);
|
||||
var virtueName = virtue.GetName();
|
||||
|
||||
if (Award(pm, virtue, amount, ref gainedPath))
|
||||
{
|
||||
// TODO: Localize?
|
||||
if (gainedPath)
|
||||
{
|
||||
pm.SendMessage("You have gained a path in {0}!", virtueName);
|
||||
var gainedPathMessage = GetGainedAPathLocalizedMessage(virtue);
|
||||
if (gainedPathMessage != 0)
|
||||
{
|
||||
pm.SendLocalizedMessage(gainedPathMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendMessage("You have gained a path in {0}!", virtueName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendMessage("You have gained in {0}.", virtueName);
|
||||
var gainMessage = GetGainedLocalizedMessage(virtue);
|
||||
if (gainMessage != 0)
|
||||
{
|
||||
pm.SendLocalizedMessage(gainMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendMessage("You have gained in {0}.", virtueName);
|
||||
}
|
||||
}
|
||||
|
||||
if (virtue == VirtueName.Compassion)
|
||||
{
|
||||
pm.NextCompassionDay = Core.Now + TimeSpan.FromDays(1.0);
|
||||
++pm.CompassionGains;
|
||||
|
||||
if (pm.CompassionGains >= 5)
|
||||
if (++pm.CompassionGains >= 5)
|
||||
{
|
||||
pm.SendLocalizedMessage(
|
||||
1053004
|
||||
); // You must wait about a day before you can gain in compassion again.
|
||||
// You must wait about a day before you can gain in compassion again.
|
||||
pm.SendLocalizedMessage(1053004);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Localize?
|
||||
pm.SendMessage("You have achieved the highest path of {0} and can no longer gain any further.", virtueName);
|
||||
var highestPathMessage = GetHightestPathLocalizedMessage(virtue);
|
||||
if (highestPathMessage != 0)
|
||||
{
|
||||
pm.SendLocalizedMessage(highestPathMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendMessage("You have achieved the highest path in {0} and can no longer gain any further.", virtueName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace Server.Items
|
|||
{
|
||||
damage *= 1.5;
|
||||
|
||||
attacker.SendMessage("You deliver a crushing blow!"); // Is this not localized?
|
||||
attacker.SendLocalizedMessage(1060090); // You have delivered a crushing blow!
|
||||
attacker.PlaySound(0x11C);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ namespace Server.Items
|
|||
attacker.Skills.Anatomy.Value / 400.0 >= Utility.RandomDouble() &&
|
||||
DuelContext.AllowSpecialAbility(attacker, "Paralyzing Blow", false))
|
||||
{
|
||||
defender.SendMessage("You receive a paralyzing blow!"); // Is this not localized?
|
||||
defender.SendLocalizedMessage(1072221); // You have been hit by a paralyzing blow!
|
||||
defender.Freeze(TimeSpan.FromSeconds(2.0));
|
||||
|
||||
attacker.SendMessage("You deliver a paralyzing blow!"); // Is this not localized?
|
||||
attacker.SendLocalizedMessage(1060163); // You deliver a paralyzing blow!
|
||||
attacker.PlaySound(0x11C);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ namespace Server.Spells.Second
|
|||
|
||||
public void Target(Item item)
|
||||
{
|
||||
if (!(item is TrappableContainer cont))
|
||||
if (item is not TrappableContainer cont)
|
||||
{
|
||||
Caster.SendMessage("You can't trap that"); // TODO: Localization for this?
|
||||
Caster.SendLocalizedMessage(502942); // You can't trap this!
|
||||
}
|
||||
else if (!Caster.CanSee(item))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue