fix: Optimizes TextDefinition to eliminate allocations. Removes TextDefinition ctor. (#1221)

### BREAKING CHANGE ###
The constructor for `TextDefinition` has been removed. Instead use `TextDefinition.Of()` or cast the integer/string to TextDefinition.
This commit is contained in:
Kamron Batman 2022-10-30 16:53:23 -07:00 • committed by GitHub
parent 213b7025af
commit 910e06767b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 790 additions and 722 deletions

View file

@ -0,0 +1,30 @@
using System;
using Xunit;
namespace Server.Tests;
public class TextDefinitionTests
{
[Theory]
[InlineData(10345, "", "#10345")]
[InlineData(0, "Hello", "Hello")]
[InlineData(10345, "Hello", "#10345")]
public void TestTextDefinitionToString(int a1, string a2, string expected)
{
Assert.Equal(expected, TextDefinition.Of(a1, a2).ToString());
}
[Theory]
[InlineData(10345, "", 10345, "", true)]
[InlineData(10345, "", 0, "Hello", false)]
[InlineData(0, "Hello", 0, "Hello", true)]
[InlineData(0, "Hello", 0, "hello", false)]
[InlineData(10345, "Hello", 10345, "Goodbye", true)]
[InlineData(10345, "Hello", 10510, "Hello", false)]
public void TestTextDefinitionIsEqual(int a1, string a2, int b1, string b2, bool isEqual)
{
var a = TextDefinition.Of(a1, a2);
var b = TextDefinition.Of(b1, b2);
Assert.Equal(isEqual, a.Equals(b));
}
}

View file

@ -112,17 +112,16 @@ public struct Point2D
} }
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider) public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider)
{ => destination.TryWrite(provider, $"({m_X}, {m_Y})", out charsWritten);
return destination.TryWrite(provider, $"({m_X}, {m_Y})", out charsWritten);
}
public override string ToString() { public override string ToString() {
// Maximum number of characters that are needed to represent this: // Maximum number of characters that are needed to represent this:
// 4 characters for (, ) // 4 characters for (, )
// Up to 11 characters to represent each integer // Up to 11 characters to represent each integer
Span<char> span = stackalloc char[4+11*2]; const int maxLength = 4 + 11 * 2;
this.TryFormat(span, out var charsWritten, null, null); Span<char> span = stackalloc char[maxLength];
return span.Slice(0, charsWritten).ToString(); TryFormat(span, out var charsWritten, null, null);
return span[..charsWritten].ToString();
} }
public string ToString(string format, IFormatProvider formatProvider) public string ToString(string format, IFormatProvider formatProvider)
@ -131,5 +130,4 @@ public struct Point2D
// default ToString implementation. // default ToString implementation.
return ToString(); return ToString();
} }
} }

View file

@ -24,8 +24,8 @@ namespace Server.Json
public override TextDefinition Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => public override TextDefinition Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
reader.TokenType switch reader.TokenType switch
{ {
JsonTokenType.String => new TextDefinition(reader.GetString()), JsonTokenType.String => TextDefinition.Of(reader.GetString()),
JsonTokenType.Number => new TextDefinition(reader.GetInt32()), JsonTokenType.Number => TextDefinition.Of(reader.GetInt32()),
_ => throw new JsonException("TextDefinition value must be an integer or string") _ => throw new JsonException("TextDefinition value must be an integer or string")
}; };

View file

@ -124,9 +124,9 @@ public interface IGenericReader
{ {
return ReadEncodedInt() switch return ReadEncodedInt() switch
{ {
0 => new TextDefinition(), 0 => TextDefinition.Empty,
1 => new TextDefinition(ReadEncodedInt()), 1 => ReadEncodedInt(),
2 => new TextDefinition(ReadString()), 2 => ReadString(),
_ => null _ => null
}; };
} }

View file

@ -13,17 +13,31 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * * along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/ *************************************************************************/
using System;
using System.Runtime.CompilerServices;
namespace Server; namespace Server;
[Parsable] [Parsable]
[PropertyObject] [PropertyObject]
public class TextDefinition public class TextDefinition : IEquatable<object>, IEquatable<TextDefinition>
{ {
public TextDefinition(string text) : this(0, text) public static readonly TextDefinition Empty = new();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TextDefinition Of(int number) => Of(number, null);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TextDefinition Of(string text) => Of(0, text);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TextDefinition Of(int number, string text) => new(number, text);
private TextDefinition()
{ {
} }
public TextDefinition(int number = 0, string text = null) private TextDefinition(int number, string text)
{ {
Number = number; Number = number;
String = text; String = text;
@ -45,9 +59,9 @@ public class TextDefinition
public string GetValue() => Number > 0 ? Number.ToString() : String ?? ""; public string GetValue() => Number > 0 ? Number.ToString() : String ?? "";
public static implicit operator TextDefinition(int v) => new(v); public static implicit operator TextDefinition(int v) => Of(v);
public static implicit operator TextDefinition(string s) => new(s); public static implicit operator TextDefinition(string s) => Of(s);
public static implicit operator int(TextDefinition m) => m?.Number ?? 0; public static implicit operator int(TextDefinition m) => m?.Number ?? 0;
@ -60,6 +74,48 @@ public class TextDefinition
return null; return null;
} }
return Utility.ToInt32(value, out var i) ? new TextDefinition(i) : new TextDefinition(value); return Utility.ToInt32(value, out var i) ? Of(i) : Of(value);
} }
public void Deconstruct(out int number, out string s)
{
if (Number > 0)
{
number = Number;
s = null;
}
else
{
number = 0;
s = String;
}
}
public override bool Equals(object obj) => Equals(obj as TextDefinition);
public bool Equals(TextDefinition other)
{
if (ReferenceEquals(null, other))
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
if (Number > 0 || other.Number > 0)
{
return Number == other.Number;
}
return String == other.String;
}
public override int GetHashCode() => Number > 0 ? HashCode.Combine(Number) : HashCode.Combine(String);
public static bool operator ==(TextDefinition left, TextDefinition right) => Equals(left, right);
public static bool operator !=(TextDefinition left, TextDefinition right) => !Equals(left, right);
} }

View file

@ -50,7 +50,7 @@ namespace Server.Engines.Craft
public abstract SkillName MainSkill { get; } public abstract SkillName MainSkill { get; }
public virtual TextDefinition GumpTitle => 0; public virtual TextDefinition GumpTitle => TextDefinition.Empty;
public virtual CraftECA ECA => CraftECA.ChanceMinusSixty; public virtual CraftECA ECA => CraftECA.ChanceMinusSixty;

View file

@ -33,7 +33,7 @@ public class Recipe
public int ID { get; } public int ID { get; }
public TextDefinition TextDefinition => _td ??= new TextDefinition(CraftItem.NameNumber, CraftItem.NameString); public TextDefinition TextDefinition => _td ??= TextDefinition.Of(CraftItem.NameNumber, CraftItem.NameString);
public static void Initialize() public static void Initialize()
{ {

View file

@ -18,7 +18,7 @@ public class DefAlchemy : CraftSystem
public override SkillName MainSkill => SkillName.Alchemy; public override SkillName MainSkill => SkillName.Alchemy;
public override TextDefinition GumpTitle => 1044001; public override TextDefinition GumpTitle { get; } = 1044001;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -19,7 +19,7 @@ public class DefBlacksmithy : CraftSystem
public override SkillName MainSkill => SkillName.Blacksmith; public override SkillName MainSkill => SkillName.Blacksmith;
public override TextDefinition GumpTitle => 1044002; public override TextDefinition GumpTitle { get; } = 1044002;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -16,7 +16,7 @@ public class DefBowFletching : CraftSystem
public override SkillName MainSkill => SkillName.Fletching; public override SkillName MainSkill => SkillName.Fletching;
public override TextDefinition GumpTitle => 1044006; public override TextDefinition GumpTitle { get; } = 1044006;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -16,7 +16,7 @@ public class DefCarpentry : CraftSystem
public override SkillName MainSkill => SkillName.Carpentry; public override SkillName MainSkill => SkillName.Carpentry;
public override TextDefinition GumpTitle => 1044004; public override TextDefinition GumpTitle { get; } = 1044004;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -16,7 +16,7 @@ public class DefCartography : CraftSystem
public override SkillName MainSkill => SkillName.Cartography; public override SkillName MainSkill => SkillName.Cartography;
public override TextDefinition GumpTitle => 1044008; public override TextDefinition GumpTitle { get; } = 1044008;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -16,7 +16,7 @@ public class DefCooking : CraftSystem
public override SkillName MainSkill => SkillName.Cooking; public override SkillName MainSkill => SkillName.Cooking;
public override TextDefinition GumpTitle => 1044003; public override TextDefinition GumpTitle { get; } = 1044003;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -17,7 +17,7 @@ public class DefGlassblowing : CraftSystem
public override SkillName MainSkill => SkillName.Alchemy; public override SkillName MainSkill => SkillName.Alchemy;
public override TextDefinition GumpTitle => 1044622; public override TextDefinition GumpTitle { get; } = 1044622;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -36,7 +36,7 @@ public class DefInscription : CraftSystem
public override SkillName MainSkill => SkillName.Inscribe; public override SkillName MainSkill => SkillName.Inscribe;
public override TextDefinition GumpTitle => 1044009; public override TextDefinition GumpTitle { get; } = 1044009;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -17,7 +17,7 @@ public class DefMasonry : CraftSystem
public override SkillName MainSkill => SkillName.Carpentry; public override SkillName MainSkill => SkillName.Carpentry;
public override TextDefinition GumpTitle => 1044500; public override TextDefinition GumpTitle { get; } = 1044500;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -24,7 +24,7 @@ public class DefTailoring : CraftSystem
public override SkillName MainSkill => SkillName.Tailoring; public override SkillName MainSkill => SkillName.Tailoring;
public override TextDefinition GumpTitle => 1044005; // Tailoring Menu public override TextDefinition GumpTitle { get; } = 1044005; // Tailoring Menu
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -32,7 +32,7 @@ public class DefTinkering : CraftSystem
public override SkillName MainSkill => SkillName.Tinkering; public override SkillName MainSkill => SkillName.Tinkering;
public override TextDefinition GumpTitle => 1044007; public override TextDefinition GumpTitle { get; } = 1044007;
public static CraftSystem CraftSystem { get; private set; } public static CraftSystem CraftSystem { get; private set; }

View file

@ -42,44 +42,44 @@ namespace Server.Factions
new( new(
SkillName.Inscribe, SkillName.Inscribe,
90.0, 90.0,
new TextDefinition(1060773, "Scribe"), 1060773, // Scribe
new TextDefinition(1011468, "SCRIBE"), 1011468, // SCRIBE
new TextDefinition(1010121, "You now have the faction title of scribe") 1010121 // You now have the faction title of scribe
), ),
new( new(
SkillName.Carpentry, SkillName.Carpentry,
90.0, 90.0,
new TextDefinition(1060774, "Carpenter"), 1060774, // Carpenter
new TextDefinition(1011469, "CARPENTER"), 1011469, // CARPENTER
new TextDefinition(1010122, "You now have the faction title of carpenter") 1010122 // You now have the faction title of carpenter
), ),
new( new(
SkillName.Tinkering, SkillName.Tinkering,
90.0, 90.0,
new TextDefinition(1022984, "Tinker"), 1022984, // Tinker
new TextDefinition(1011470, "TINKER"), 1011470, // TINKER
new TextDefinition(1010123, "You now have the faction title of tinker") 1010123 // You now have the faction title of tinker
), ),
new( new(
SkillName.Blacksmith, SkillName.Blacksmith,
90.0, 90.0,
new TextDefinition(1023016, "Blacksmith"), 1023016, // Blacksmith
new TextDefinition(1011471, "BLACKSMITH"), 1011471, // BLACKSMITH
new TextDefinition(1010124, "You now have the faction title of blacksmith") 1010124 // You now have the faction title of blacksmith
), ),
new( new(
SkillName.Fletching, SkillName.Fletching,
90.0, 90.0,
new TextDefinition(1023022, "Bowyer"), 1023022, // Bowyer
new TextDefinition(1011472, "BOWYER"), 1011472, // BOWYER
new TextDefinition(1010125, "You now have the faction title of Bowyer") 1010125 // You now have the faction title of Bowyer
), ),
new( new(
SkillName.Tailoring, SkillName.Tailoring,
90.0, 90.0,
new TextDefinition(1022982, "Tailor"), 1022982, // Tailor
new TextDefinition(1018300, "TAILOR"), 1018300, // TAILOR
new TextDefinition(1042162, "You now have the faction title of Tailor") 1042162 // You now have the faction title of Tailor
) )
}; };

View file

@ -42,8 +42,8 @@ namespace Server.Factions
5000, 5000,
1000, 1000,
10, 10,
new TextDefinition(1011549, "POTION BOTTLE VENDOR"), 1011549, // POTION BOTTLE VENDOR
new TextDefinition(1011544, "Buy Potion Bottle Vendor") 1011544 // Buy Potion Bottle Vendor
), ),
new( new(
typeof(FactionBoardVendor), typeof(FactionBoardVendor),
@ -51,8 +51,8 @@ namespace Server.Factions
3000, 3000,
500, 500,
10, 10,
new TextDefinition(1011552, "WOOD VENDOR"), 1011552, // WOOD VENDOR
new TextDefinition(1011545, "Buy Wooden Board Vendor") 1011545 // Buy Wooden Board Vendor
), ),
new( new(
typeof(FactionOreVendor), typeof(FactionOreVendor),
@ -60,8 +60,8 @@ namespace Server.Factions
3000, 3000,
500, 500,
10, 10,
new TextDefinition(1011553, "IRON ORE VENDOR"), 1011553, // IRON ORE VENDOR
new TextDefinition(1011546, "Buy Iron Ore Vendor") 1011546 // Buy Iron Ore Vendor
), ),
new( new(
typeof(FactionReagentVendor), typeof(FactionReagentVendor),
@ -69,8 +69,8 @@ namespace Server.Factions
5000, 5000,
1000, 1000,
10, 10,
new TextDefinition(1011554, "REAGENT VENDOR"), 1011554, // REAGENT VENDOR
new TextDefinition(1011547, "Buy Reagent Vendor") 1011547 // Buy Reagent Vendor
), ),
new( new(
typeof(FactionHorseVendor), typeof(FactionHorseVendor),
@ -78,8 +78,8 @@ namespace Server.Factions
5000, 5000,
1000, 1000,
1, 1,
new TextDefinition(1011556, "HORSE BREEDER"), 1011556, // HORSE BREEDER
new TextDefinition(1011555, "Buy Horse Breeder") 1011555 // Buy Horse Breeder
) )
}; };
} }

View file

@ -1,140 +1,139 @@
namespace Server.Factions namespace Server.Factions;
public class CouncilOfMages : Faction
{ {
public class CouncilOfMages : Faction public CouncilOfMages()
{ {
public CouncilOfMages() Instance = this;
{
Instance = this;
Definition = Definition =
new FactionDefinition( new FactionDefinition(
1, 1,
1325, // blue 1325, // blue
1310, // bluish white 1310, // bluish white
1325, // join stone : blue 1325, // join stone : blue
1325, // broadcast : blue 1325, // broadcast : blue
0x77, 0x77,
0x3EB1, // war horse 0x3EB1, // war horse
"Council of Mages", "Council of Mages",
"council", "council",
"CoM", "CoM",
new TextDefinition(1011535, "COUNCIL OF MAGES"), 1011535, // COUNCIL OF MAGES
new TextDefinition(1060770, "Council of Mages faction"), 1060770, // Council of Mages faction
new TextDefinition(1011422, "<center>COUNCIL OF MAGES</center>"), 1011422, // <center>COUNCIL OF MAGES</center>
new TextDefinition( /*
1011449, * The council of Mages have their roots in the city of Moonglow, where
"The council of Mages have their roots in the city of Moonglow, where " + * they once convened. They began as a small movement, dedicated to
"they once convened. They began as a small movement, dedicated to " + * calling forth the Stranger, who saved the lands once before. A
"calling forth the Stranger, who saved the lands once before. A " + * series of war and murders and misbegotten trials by those loyal to
"series of war and murders and misbegotten trials by those loyal to " + * Lord British has caused the group to take up the banner of war.
"Lord British has caused the group to take up the banner of war." */
), 1011449,
new TextDefinition(1011455, "This city is controlled by the Council of Mages."), 1011455, // This city is controlled by the Council of Mages.
new TextDefinition(1042253, "This sigil has been corrupted by the Council of Mages"), 1042253, // This sigil has been corrupted by the Council of Mages
new TextDefinition(1041044, "The faction signup stone for the Council of Mages"), 1041044, // The faction signup stone for the Council of Mages
new TextDefinition(1041382, "The Faction Stone of the Council of Mages"), 1041382, // The Faction Stone of the Council of Mages
new TextDefinition(1011464, ": Council of Mages"), 1011464, // : Council of Mages
new TextDefinition(1005187, "Members of the Council of Mages will now be ignored."), 1005187, // Members of the Council of Mages will now be ignored.
new TextDefinition(1005188, "Members of the Council of Mages will now be warned to leave."), 1005188, // Members of the Council of Mages will now be warned to leave.
new TextDefinition(1005189, "Members of the Council of Mages will now be beaten with a stick."), 1005189, // Members of the Council of Mages will now be beaten with a stick.
// Moonglow // Moonglow
new StrongholdDefinition( new StrongholdDefinition(
new[]
{
new Rectangle2D(4463, 1487, 15, 35),
new Rectangle2D(4450, 1522, 35, 48)
},
new Point3D(4469, 1486, 0),
new Point3D(4457, 1544, 0),
new[]
{
new Point3D(4464, 1534, 21),
new Point3D(4470, 1536, 21),
new Point3D(4468, 1534, 21),
new Point3D(4470, 1534, 21),
new Point3D(4468, 1536, 21),
new Point3D(4466, 1534, 21),
new Point3D(4466, 1536, 21),
new Point3D(4464, 1536, 21)
}
),
// Magincia
/* new StrongholdDefinition(
new Rectangle2D[]
{
new Rectangle2D( 3756, 2232, 4, 23 ),
new Rectangle2D( 3760, 2227, 60, 28 ),
new Rectangle2D( 3782, 2219, 18, 8 ),
new Rectangle2D( 3778, 2255, 35, 17 )
},
new Point3D( 3750, 2241, 20 ),
new Point3D( 3795, 2259, 20 ),
new Point3D[]
{
new Point3D( 3793, 2255, 20 ),
new Point3D( 3793, 2252, 20 ),
new Point3D( 3793, 2249, 20 ),
new Point3D( 3793, 2246, 20 ),
new Point3D( 3797, 2255, 20 ),
new Point3D( 3797, 2252, 20 ),
new Point3D( 3797, 2249, 20 ),
new Point3D( 3797, 2246, 20 )
} ), */
new[] new[]
{ {
new RankDefinition(10, 991, 8, new TextDefinition(1060789, "Inquisitor of the Council")), new Rectangle2D(4463, 1487, 15, 35),
new RankDefinition(9, 950, 7, new TextDefinition(1060788, "Archon of Principle")), new Rectangle2D(4450, 1522, 35, 48)
new RankDefinition(8, 900, 6, new TextDefinition(1060787, "Luminary")),
new RankDefinition(7, 800, 6, new TextDefinition(1060787, "Luminary")),
new RankDefinition(6, 700, 5, new TextDefinition(1060786, "Diviner")),
new RankDefinition(5, 600, 5, new TextDefinition(1060786, "Diviner")),
new RankDefinition(4, 500, 5, new TextDefinition(1060786, "Diviner")),
new RankDefinition(3, 400, 4, new TextDefinition(1060785, "Mystic")),
new RankDefinition(2, 200, 4, new TextDefinition(1060785, "Mystic")),
new RankDefinition(1, 0, 4, new TextDefinition(1060785, "Mystic"))
}, },
new Point3D(4469, 1486, 0),
new Point3D(4457, 1544, 0),
new[] new[]
{ {
new GuardDefinition( new Point3D(4464, 1534, 21),
typeof(FactionHenchman), new Point3D(4470, 1536, 21),
0x1403, new Point3D(4468, 1534, 21),
5000, new Point3D(4470, 1534, 21),
1000, new Point3D(4468, 1536, 21),
10, new Point3D(4466, 1534, 21),
new TextDefinition(1011526, "HENCHMAN"), new Point3D(4466, 1536, 21),
new TextDefinition(1011510, "Hire Henchman") new Point3D(4464, 1536, 21)
),
new GuardDefinition(
typeof(FactionMercenary),
0x0F62,
6000,
2000,
10,
new TextDefinition(1011527, "MERCENARY"),
new TextDefinition(1011511, "Hire Mercenary")
),
new GuardDefinition(
typeof(FactionSorceress),
0x0E89,
7000,
3000,
10,
new TextDefinition(1011507, "SORCERESS"),
new TextDefinition(1011501, "Hire Sorceress")
),
new GuardDefinition(
typeof(FactionWizard),
0x13F8,
8000,
4000,
10,
new TextDefinition(1011508, "ELDER WIZARD"),
new TextDefinition(1011502, "Hire Elder Wizard")
)
} }
); ),
} // Magincia
/* new StrongholdDefinition(
public static Faction Instance { get; private set; } new Rectangle2D[]
{
new Rectangle2D( 3756, 2232, 4, 23 ),
new Rectangle2D( 3760, 2227, 60, 28 ),
new Rectangle2D( 3782, 2219, 18, 8 ),
new Rectangle2D( 3778, 2255, 35, 17 )
},
new Point3D( 3750, 2241, 20 ),
new Point3D( 3795, 2259, 20 ),
new Point3D[]
{
new Point3D( 3793, 2255, 20 ),
new Point3D( 3793, 2252, 20 ),
new Point3D( 3793, 2249, 20 ),
new Point3D( 3793, 2246, 20 ),
new Point3D( 3797, 2255, 20 ),
new Point3D( 3797, 2252, 20 ),
new Point3D( 3797, 2249, 20 ),
new Point3D( 3797, 2246, 20 )
} ), */
new[]
{
new RankDefinition(10, 991, 8, 1060789), // Inquisitor of the Council
new RankDefinition(9, 950, 7, 1060788), // Archon of Principle
new RankDefinition(8, 900, 6, 1060787), // Luminary
new RankDefinition(7, 800, 6, 1060787), // Luminary
new RankDefinition(6, 700, 5, 1060786), // Diviner
new RankDefinition(5, 600, 5, 1060786), // Diviner
new RankDefinition(4, 500, 5, 1060786), // Diviner
new RankDefinition(3, 400, 4, 1060785), // Mystic
new RankDefinition(2, 200, 4, 1060785), // Mystic
new RankDefinition(1, 0, 4, 1060785) // Mystic
},
new[]
{
new GuardDefinition(
typeof(FactionHenchman),
0x1403,
5000,
1000,
10,
1011526, // HENCHMAN
1011510 // Hire Henchman
),
new GuardDefinition(
typeof(FactionMercenary),
0x0F62,
6000,
2000,
10,
1011527, // MERCENARY
1011511 // Hire Mercenary
),
new GuardDefinition(
typeof(FactionSorceress),
0x0E89,
7000,
3000,
10,
1011507, // SORCERESS
1011501 // Hire Sorceress
),
new GuardDefinition(
typeof(FactionWizard),
0x13F8,
8000,
4000,
10,
1011508, // ELDER WIZARD
1011502 // Hire Elder Wizard
)
}
);
} }
public static Faction Instance { get; private set; }
} }

View file

@ -1,117 +1,116 @@
namespace Server.Factions namespace Server.Factions;
public class Minax : Faction
{ {
public class Minax : Faction public Minax()
{ {
public Minax() Instance = this;
{
Instance = this;
Definition = Definition =
new FactionDefinition( new FactionDefinition(
0, 0,
1645, // dark red 1645, // dark red
1109, // shadow 1109, // shadow
1645, // join stone : dark red 1645, // join stone : dark red
1645, // broadcast : dark red 1645, // broadcast : dark red
0x78, 0x78,
0x3EAF, // war horse 0x3EAF, // war horse
"Minax", "Minax",
"minax", "minax",
"Min", "Min",
new TextDefinition(1011534, "MINAX"), 1011534, // MINAX
new TextDefinition(1060769, "Minax faction"), 1060769, // Minax faction
new TextDefinition(1011421, "<center>FOLLOWERS OF MINAX</center>"), 1011421, // <center>FOLLOWERS OF MINAX</center>
new TextDefinition( /*
1011448, * The followers of Minax have taken control in the old lands,
"The followers of Minax have taken control in the old lands, " + * and intend to hold it for as long as they can. Allying themselves
"and intend to hold it for as long as they can. Allying themselves " + * with orcs, headless, gazers, trolls, and other beasts, they seek
"with orcs, headless, gazers, trolls, and other beasts, they seek " + * revenge against Lord British, for slights both real and imagined,
"revenge against Lord British, for slights both real and imagined, " + * though some of the followers wish only to wreak havoc on the
"though some of the followers wish only to wreak havoc on the " + * unsuspecting populace."
"unsuspecting populace." */
), 1011448,
new TextDefinition(1011453, "This city is controlled by Minax."), 1011453, // This city is controlled by Minax.
new TextDefinition(1042252, "This sigil has been corrupted by the Followers of Minax"), 1042252, // This sigil has been corrupted by the Followers of Minax
new TextDefinition(1041043, "The faction signup stone for the Followers of Minax"), 1041043, // The faction signup stone for the Followers of Minax
new TextDefinition(1041381, "The Faction Stone of Minax"), 1041381, // The Faction Stone of Minax
new TextDefinition(1011463, ": Minax"), 1011463, // : Minax
new TextDefinition(1005190, "Followers of Minax will now be ignored."), 1005190, // Followers of Minax will now be ignored.
new TextDefinition(1005191, "Followers of Minax will now be told to go away."), 1005191, // Followers of Minax will now be told to go away.
new TextDefinition(1005192, "Followers of Minax will now be hanged by their toes."), 1005192, // Followers of Minax will now be hanged by their toes.
new StrongholdDefinition( new StrongholdDefinition(
new[]
{
new Rectangle2D(1097, 2570, 70, 50)
},
new Point3D(1172, 2593, 0),
new Point3D(1117, 2587, 18),
new[]
{
new Point3D(1113, 2601, 18),
new Point3D(1113, 2598, 18),
new Point3D(1113, 2595, 18),
new Point3D(1113, 2592, 18),
new Point3D(1116, 2601, 18),
new Point3D(1116, 2598, 18),
new Point3D(1116, 2595, 18),
new Point3D(1116, 2592, 18)
}
),
new[] new[]
{ {
new RankDefinition(10, 991, 8, new TextDefinition(1060784, "Avenger of Mondain")), new Rectangle2D(1097, 2570, 70, 50)
new RankDefinition(9, 950, 7, new TextDefinition(1060783, "Dread Knight")),
new RankDefinition(8, 900, 6, new TextDefinition(1060782, "Warlord")),
new RankDefinition(7, 800, 6, new TextDefinition(1060782, "Warlord")),
new RankDefinition(6, 700, 5, new TextDefinition(1060781, "Executioner")),
new RankDefinition(5, 600, 5, new TextDefinition(1060781, "Executioner")),
new RankDefinition(4, 500, 5, new TextDefinition(1060781, "Executioner")),
new RankDefinition(3, 400, 4, new TextDefinition(1060780, "Defiler")),
new RankDefinition(2, 200, 4, new TextDefinition(1060780, "Defiler")),
new RankDefinition(1, 0, 4, new TextDefinition(1060780, "Defiler"))
}, },
new Point3D(1172, 2593, 0),
new Point3D(1117, 2587, 18),
new[] new[]
{ {
new GuardDefinition( new Point3D(1113, 2601, 18),
typeof(FactionHenchman), new Point3D(1113, 2598, 18),
0x1403, new Point3D(1113, 2595, 18),
5000, new Point3D(1113, 2592, 18),
1000, new Point3D(1116, 2601, 18),
10, new Point3D(1116, 2598, 18),
new TextDefinition(1011526, "HENCHMAN"), new Point3D(1116, 2595, 18),
new TextDefinition(1011510, "Hire Henchman") new Point3D(1116, 2592, 18)
),
new GuardDefinition(
typeof(FactionMercenary),
0x0F62,
6000,
2000,
10,
new TextDefinition(1011527, "MERCENARY"),
new TextDefinition(1011511, "Hire Mercenary")
),
new GuardDefinition(
typeof(FactionBerserker),
0x0F4B,
7000,
3000,
10,
new TextDefinition(1011505, "BERSERKER"),
new TextDefinition(1011499, "Hire Berserker")
),
new GuardDefinition(
typeof(FactionDragoon),
0x1439,
8000,
4000,
10,
new TextDefinition(1011506, "DRAGOON"),
new TextDefinition(1011500, "Hire Dragoon")
)
} }
); ),
} new[]
{
public static Faction Instance { get; private set; } new RankDefinition(10, 991, 8, 1060784), // Avenger of Mondain
new RankDefinition(9, 950, 7, 1060783), // Dread Knight
new RankDefinition(8, 900, 6, 1060782), // Warlord
new RankDefinition(7, 800, 6, 1060782), // Warlord
new RankDefinition(6, 700, 5, 1060781), // Executioner
new RankDefinition(5, 600, 5, 1060781), // Executioner
new RankDefinition(4, 500, 5, 1060781), // Executioner
new RankDefinition(3, 400, 4, 1060780), // Defiler
new RankDefinition(2, 200, 4, 1060780), // Defiler
new RankDefinition(1, 0, 4, 1060780) // Defiler
},
new[]
{
new GuardDefinition(
typeof(FactionHenchman),
0x1403,
5000,
1000,
10,
1011526, // HENCHMAN
1011510 // Hire Henchman
),
new GuardDefinition(
typeof(FactionMercenary),
0x0F62,
6000,
2000,
10,
1011527, // MERCENARY
1011511 // Hire Mercenary
),
new GuardDefinition(
typeof(FactionBerserker),
0x0F4B,
7000,
3000,
10,
1011505, // BERSERKER
1011499 // Hire Berserker
),
new GuardDefinition(
typeof(FactionDragoon),
0x1439,
8000,
4000,
10,
1011506, // DRAGOON
1011500 // Hire Dragoon
)
}
);
} }
public static Faction Instance { get; private set; }
} }

View file

@ -1,117 +1,116 @@
namespace Server.Factions namespace Server.Factions;
public class Shadowlords : Faction
{ {
public class Shadowlords : Faction public Shadowlords()
{ {
public Shadowlords() Instance = this;
{
Instance = this;
Definition = Definition =
new FactionDefinition( new FactionDefinition(
3, 3,
1109, // shadow 1109, // shadow
2211, // green 2211, // green
1109, // join stone : shadow 1109, // join stone : shadow
2211, // broadcast : green 2211, // broadcast : green
0x79, 0x79,
0x3EB0, // war horse 0x3EB0, // war horse
"Shadowlords", "Shadowlords",
"shadow", "shadow",
"SL", "SL",
new TextDefinition(1011537, "SHADOWLORDS"), 1011537, // SHADOWLORDS
new TextDefinition(1060772, "Shadowlords faction"), 1060772, // Shadowlords faction
new TextDefinition(1011424, "<center>SHADES OF DARKNESS</center>"), 1011424, // <center>SHADES OF DARKNESS</center>
new TextDefinition( /*
1011451, * The Shadow Lords are a faction that has sprung up within the ranks of
"The Shadow Lords are a faction that has sprung up within the ranks of " + * Minax. Comprised mostly of undead and those who would seek to be
"Minax. Comprised mostly of undead and those who would seek to be " + * necromancers, they pose a threat to both the sides of good and evil.
"necromancers, they pose a threat to both the sides of good and evil. " + * Their plans have disrupted the hold Minax has over Felucca, and their
"Their plans have disrupted the hold Minax has over Felucca, and their " + * ultimate goal is to destroy all life.
"ultimate goal is to destroy all life." */
), 1011451,
new TextDefinition(1011456, "This city is controlled by the Shadow Lords."), 1011456, // This city is controlled by the Shadow Lords.
new TextDefinition(1042255, "This sigil has been corrupted by the Shadowlords"), 1042255, // This sigil has been corrupted by the Shadowlords
new TextDefinition(1041046, "The faction signup stone for the Shadowlords"), 1041046, // The faction signup stone for the Shadowlords
new TextDefinition(1041384, "The Faction Stone of the Shadowlords"), 1041384, // The Faction Stone of the Shadowlords
new TextDefinition(1011466, ": Shadowlords"), 1011466, // : Shadowlords
new TextDefinition(1005184, "Minions of the Shadowlords will now be ignored."), 1005184, // Minions of the Shadowlords will now be ignored.
new TextDefinition(1005185, "Minions of the Shadowlords will now be warned of their impending deaths."), 1005185, // Minions of the Shadowlords will now be warned of their impending deaths.
new TextDefinition(1005186, "Minions of the Shadowlords will now be attacked at will."), 1005186, // Minions of the Shadowlords will now be attacked at will.
new StrongholdDefinition( new StrongholdDefinition(
new[]
{
new Rectangle2D(960, 688, 8, 9),
new Rectangle2D(944, 697, 24, 23)
},
new Point3D(969, 768, 0),
new Point3D(947, 713, 0),
new[]
{
new Point3D(953, 713, 20),
new Point3D(953, 709, 20),
new Point3D(953, 705, 20),
new Point3D(953, 701, 20),
new Point3D(957, 713, 20),
new Point3D(957, 709, 20),
new Point3D(957, 705, 20),
new Point3D(957, 701, 20)
}
),
new[] new[]
{ {
new RankDefinition(10, 991, 8, new TextDefinition(1060799, "Purveyor of Darkness")), new Rectangle2D(960, 688, 8, 9),
new RankDefinition(9, 950, 7, new TextDefinition(1060798, "Agent of Evil")), new Rectangle2D(944, 697, 24, 23)
new RankDefinition(8, 900, 6, new TextDefinition(1060797, "Bringer of Sorrow")),
new RankDefinition(7, 800, 6, new TextDefinition(1060797, "Bringer of Sorrow")),
new RankDefinition(6, 700, 5, new TextDefinition(1060796, "Keeper of Lies")),
new RankDefinition(5, 600, 5, new TextDefinition(1060796, "Keeper of Lies")),
new RankDefinition(4, 500, 5, new TextDefinition(1060796, "Keeper of Lies")),
new RankDefinition(3, 400, 4, new TextDefinition(1060795, "Servant")),
new RankDefinition(2, 200, 4, new TextDefinition(1060795, "Servant")),
new RankDefinition(1, 0, 4, new TextDefinition(1060795, "Servant"))
}, },
new Point3D(969, 768, 0),
new Point3D(947, 713, 0),
new[] new[]
{ {
new GuardDefinition( new Point3D(953, 713, 20),
typeof(FactionHenchman), new Point3D(953, 709, 20),
0x1403, new Point3D(953, 705, 20),
5000, new Point3D(953, 701, 20),
1000, new Point3D(957, 713, 20),
10, new Point3D(957, 709, 20),
new TextDefinition(1011526, "HENCHMAN"), new Point3D(957, 705, 20),
new TextDefinition(1011510, "Hire Henchman") new Point3D(957, 701, 20)
),
new GuardDefinition(
typeof(FactionMercenary),
0x0F62,
6000,
2000,
10,
new TextDefinition(1011527, "MERCENARY"),
new TextDefinition(1011511, "Hire Mercenary")
),
new GuardDefinition(
typeof(FactionDeathKnight),
0x0F45,
7000,
3000,
10,
new TextDefinition(1011512, "DEATH KNIGHT"),
new TextDefinition(1011503, "Hire Death Knight")
),
new GuardDefinition(
typeof(FactionNecromancer),
0x13F8,
8000,
4000,
10,
new TextDefinition(1011513, "SHADOW MAGE"),
new TextDefinition(1011504, "Hire Shadow Mage")
)
} }
); ),
} new[]
{
public static Faction Instance { get; private set; } new RankDefinition(10, 991, 8, 1060799), // Purveyor of Darkness
new RankDefinition(9, 950, 7, 1060798), // Agent of Evil
new RankDefinition(8, 900, 6, 1060797), // Bringer of Sorrow
new RankDefinition(7, 800, 6, 1060797), // Bringer of Sorrow
new RankDefinition(6, 700, 5, 1060796), // Keeper of Lies
new RankDefinition(5, 600, 5, 1060796), // Keeper of Lies
new RankDefinition(4, 500, 5, 1060796), // Keeper of Lies
new RankDefinition(3, 400, 4, 1060795), // Servant
new RankDefinition(2, 200, 4, 1060795), // Servant
new RankDefinition(1, 0, 4, 1060795) // Servant
},
new[]
{
new GuardDefinition(
typeof(FactionHenchman),
0x1403,
5000,
1000,
10,
1011526, // HENCHMAN
1011510 // Hire Henchman
),
new GuardDefinition(
typeof(FactionMercenary),
0x0F62,
6000,
2000,
10,
1011527, // MERCENARY
1011511 // Hire Mercenary
),
new GuardDefinition(
typeof(FactionDeathKnight),
0x0F45,
7000,
3000,
10,
1011512, // DEATH KNIGHT
1011503 // Hire Death Knight
),
new GuardDefinition(
typeof(FactionNecromancer),
0x13F8,
8000,
4000,
10,
1011513, // SHADOW MAGE
1011504 // Hire Shadow Mage
)
}
);
} }
public static Faction Instance { get; private set; }
} }

View file

@ -1,122 +1,121 @@
namespace Server.Factions namespace Server.Factions;
public class TrueBritannians : Faction
{ {
public class TrueBritannians : Faction public TrueBritannians()
{ {
public TrueBritannians() Instance = this;
{
Instance = this;
Definition = Definition =
new FactionDefinition( new FactionDefinition(
2, 2,
1254, // dark purple 1254, // dark purple
2125, // gold 2125, // gold
2214, // join stone : gold 2214, // join stone : gold
2125, // broadcast : gold 2125, // broadcast : gold
0x76, 0x76,
0x3EB2, // war horse 0x3EB2, // war horse
"True Britannians", "True Britannians",
"true", "true",
"TB", "TB",
new TextDefinition(1011536, "LORD BRITISH"), 1011536, // LORD BRITISH
new TextDefinition(1060771, "True Britannians faction"), 1060771, // True Britannians faction
new TextDefinition(1011423, "<center>TRUE BRITANNIANS</center>"), 1011423, // <center>TRUE BRITANNIANS</center>
new TextDefinition( /*
1011450, * True Britannians are loyal to the throne of Lord British. They refuse
"True Britannians are loyal to the throne of Lord British. They refuse " + * to give up their homelands to the vile Minax, and detest the Shadowlords
"to give up their homelands to the vile Minax, and detest the Shadowlords " + * for their evil ways. In addition, the Council of Mages threatens the
"for their evil ways. In addition, the Council of Mages threatens the " + * existence of their ruler, and as such they have armed themselves, and
"existence of their ruler, and as such they have armed themselves, and " + * prepare for war with all.
"prepare for war with all." */
), 1011450,
new TextDefinition(1011454, "This city is controlled by Lord British."), 1011454, // This city is controlled by Lord British.
new TextDefinition(1042254, "This sigil has been corrupted by the True Britannians"), 1042254, // This sigil has been corrupted by the True Britannians
new TextDefinition(1041045, "The faction signup stone for the True Britannians"), 1041045, // The faction signup stone for the True Britannians
new TextDefinition(1041383, "The Faction Stone of the True Britannians"), 1041383, // The Faction Stone of the True Britannians
new TextDefinition(1011465, ": True Britannians"), 1011465, // : True Britannians
new TextDefinition(1005181, "Followers of Lord British will now be ignored."), 1005181, // Followers of Lord British will now be ignored.
new TextDefinition(1005182, "Followers of Lord British will now be warned of their impending doom."), 1005182, // Followers of Lord British will now be warned of their impending doom.
new TextDefinition(1005183, "Followers of Lord British will now be attacked on sight."), 1005183, // Followers of Lord British will now be attacked on sight.
new StrongholdDefinition( new StrongholdDefinition(
new[]
{
new Rectangle2D(1292, 1556, 25, 25),
new Rectangle2D(1292, 1676, 120, 25),
new Rectangle2D(1388, 1556, 25, 25),
new Rectangle2D(1317, 1563, 71, 18),
new Rectangle2D(1300, 1581, 105, 95),
new Rectangle2D(1405, 1612, 12, 21),
new Rectangle2D(1405, 1633, 11, 5)
},
new Point3D(1419, 1622, 20),
new Point3D(1330, 1621, 50),
new[]
{
new Point3D(1328, 1627, 50),
new Point3D(1328, 1621, 50),
new Point3D(1334, 1627, 50),
new Point3D(1334, 1621, 50),
new Point3D(1340, 1627, 50),
new Point3D(1340, 1621, 50),
new Point3D(1345, 1621, 50),
new Point3D(1345, 1627, 50)
}
),
new[] new[]
{ {
new RankDefinition(10, 991, 8, new TextDefinition(1060794, "Knight of the Codex")), new Rectangle2D(1292, 1556, 25, 25),
new RankDefinition(9, 950, 7, new TextDefinition(1060793, "Knight of Virtue")), new Rectangle2D(1292, 1676, 120, 25),
new RankDefinition(8, 900, 6, new TextDefinition(1060792, "Crusader")), new Rectangle2D(1388, 1556, 25, 25),
new RankDefinition(7, 800, 6, new TextDefinition(1060792, "Crusader")), new Rectangle2D(1317, 1563, 71, 18),
new RankDefinition(6, 700, 5, new TextDefinition(1060791, "Sentinel")), new Rectangle2D(1300, 1581, 105, 95),
new RankDefinition(5, 600, 5, new TextDefinition(1060791, "Sentinel")), new Rectangle2D(1405, 1612, 12, 21),
new RankDefinition(4, 500, 5, new TextDefinition(1060791, "Sentinel")), new Rectangle2D(1405, 1633, 11, 5)
new RankDefinition(3, 400, 4, new TextDefinition(1060790, "Defender")),
new RankDefinition(2, 200, 4, new TextDefinition(1060790, "Defender")),
new RankDefinition(1, 0, 4, new TextDefinition(1060790, "Defender"))
}, },
new Point3D(1419, 1622, 20),
new Point3D(1330, 1621, 50),
new[] new[]
{ {
new GuardDefinition( new Point3D(1328, 1627, 50),
typeof(FactionHenchman), new Point3D(1328, 1621, 50),
0x1403, new Point3D(1334, 1627, 50),
5000, new Point3D(1334, 1621, 50),
1000, new Point3D(1340, 1627, 50),
10, new Point3D(1340, 1621, 50),
new TextDefinition(1011526, "HENCHMAN"), new Point3D(1345, 1621, 50),
new TextDefinition(1011510, "Hire Henchman") new Point3D(1345, 1627, 50)
),
new GuardDefinition(
typeof(FactionMercenary),
0x0F62,
6000,
2000,
10,
new TextDefinition(1011527, "MERCENARY"),
new TextDefinition(1011511, "Hire Mercenary")
),
new GuardDefinition(
typeof(FactionKnight),
0x0F4D,
7000,
3000,
10,
new TextDefinition(1011528, "KNIGHT"),
new TextDefinition(1011497, "Hire Knight")
),
new GuardDefinition(
typeof(FactionPaladin),
0x143F,
8000,
4000,
10,
new TextDefinition(1011529, "PALADIN"),
new TextDefinition(1011498, "Hire Paladin")
)
} }
); ),
} new[]
{
public static Faction Instance { get; private set; } new RankDefinition(10, 991, 8, 1060794), // Knight of the Codex
new RankDefinition(9, 950, 7, 1060793), // Knight of Virtue
new RankDefinition(8, 900, 6, 1060792), // Crusader
new RankDefinition(7, 800, 6, 1060792), // Crusader
new RankDefinition(6, 700, 5, 1060791), // Sentinel
new RankDefinition(5, 600, 5, 1060791), // Sentinel
new RankDefinition(4, 500, 5, 1060791), // Sentinel
new RankDefinition(3, 400, 4, 1060790), // Defender
new RankDefinition(2, 200, 4, 1060790), // Defender
new RankDefinition(1, 0, 4, 1060790), // Defender
},
new[]
{
new GuardDefinition(
typeof(FactionHenchman),
0x1403,
5000,
1000,
10,
1011526, // HENCHMAN
1011510 // Hire Henchman
),
new GuardDefinition(
typeof(FactionMercenary),
0x0F62,
6000,
2000,
10,
1011527, // MERCENARY
1011511 // Hire Mercenary
),
new GuardDefinition(
typeof(FactionKnight),
0x0F4D,
7000,
3000,
10,
1011528, // KNIGHT
1011497 // Hire Knight
),
new GuardDefinition(
typeof(FactionPaladin),
0x143F,
8000,
4000,
10,
1011529, // PALADIN
1011498 // Hire Paladin
)
}
);
} }
public static Faction Instance { get; private set; }
} }

View file

@ -1,23 +1,22 @@
namespace Server.Factions namespace Server.Factions;
public class Britain : Town
{ {
public class Britain : Town public Britain() =>
{ Definition =
public Britain() => new TownDefinition(
Definition = 0,
new TownDefinition( 0x1869,
0, "Britain",
0x1869, "Britain",
"Britain", 1011433, // BRITAIN
"Britain", 1011561, // TOWN STONE FOR BRITAIN
new TextDefinition(1011433, "BRITAIN"), 1041034, // The Faction Sigil Monolith of Britain
new TextDefinition(1011561, "TOWN STONE FOR BRITAIN"), 1041404, // The Faction Town Sigil Monolith of Britain
new TextDefinition(1041034, "The Faction Sigil Monolith of Britain"), 1041413, // Faction Town Stone of Britain
new TextDefinition(1041404, "The Faction Town Sigil Monolith of Britain"), 1041395, // Faction Town Sigil of Britain
new TextDefinition(1041413, "Faction Town Stone of Britain"), 1041386, // Corrupted Faction Town Sigil of Britain
new TextDefinition(1041395, "Faction Town Sigil of Britain"), new Point3D(1592, 1680, 10),
new TextDefinition(1041386, "Corrupted Faction Town Sigil of Britain"), new Point3D(1588, 1676, 10)
new Point3D(1592, 1680, 10), );
new Point3D(1588, 1676, 10)
);
}
} }

View file

@ -1,23 +1,22 @@
namespace Server.Factions namespace Server.Factions;
public class Magincia : Town
{ {
public class Magincia : Town public Magincia() =>
{ Definition =
public Magincia() => new TownDefinition(
Definition = 7,
new TownDefinition( 0x1870,
7, "Magincia",
0x1870, "Magincia",
"Magincia", 1011440, // MAGINCIA
"Magincia", 1011568, // TOWN STONE FOR MAGINCIA
new TextDefinition(1011440, "MAGINCIA"), 1041041, // The Faction Sigil Monolith of Magincia
new TextDefinition(1011568, "TOWN STONE FOR MAGINCIA"), 1041411, // The Faction Town Sigil Monolith of Magincia
new TextDefinition(1041041, "The Faction Sigil Monolith of Magincia"), 1041420, // Faction Town Stone of Magincia
new TextDefinition(1041411, "The Faction Town Sigil Monolith of Magincia"), 1041402, // Faction Town Sigil of Magincia
new TextDefinition(1041420, "Faction Town Stone of Magincia"), 1041393, // Corrupted Faction Town Sigil of Magincia
new TextDefinition(1041402, "Faction Town Sigil of Magincia"), new Point3D(3714, 2235, 20),
new TextDefinition(1041393, "Corrupted Faction Town Sigil of Magincia"), new Point3D(3712, 2230, 20)
new Point3D(3714, 2235, 20), );
new Point3D(3712, 2230, 20)
);
}
} }

View file

@ -1,23 +1,22 @@
namespace Server.Factions namespace Server.Factions;
public class Minoc : Town
{ {
public class Minoc : Town public Minoc() =>
{ Definition =
public Minoc() => new TownDefinition(
Definition = 2,
new TownDefinition( 0x186B,
2, "Minoc",
0x186B, "Minoc",
"Minoc", 1011437, // MINOC
"Minoc", 1011564, // TOWN STONE FOR MINOC
new TextDefinition(1011437, "MINOC"), 1041036, // The Faction Sigil Monolith of Minoc
new TextDefinition(1011564, "TOWN STONE FOR MINOC"), 1041406, // The Faction Town Sigil Monolith Minoc
new TextDefinition(1041036, "The Faction Sigil Monolith of Minoc"), 1041415, // Faction Town Stone of Minoc
new TextDefinition(1041406, "The Faction Town Sigil Monolith Minoc"), 1041397, // Faction Town Sigil of Minoc
new TextDefinition(1041415, "Faction Town Stone of Minoc"), 1041388, // Corrupted Faction Town Sigil of Minoc
new TextDefinition(1041397, "Faction Town Sigil of Minoc"), new Point3D(2471, 439, 15),
new TextDefinition(1041388, "Corrupted Faction Town Sigil of Minoc"), new Point3D(2469, 445, 15)
new Point3D(2471, 439, 15), );
new Point3D(2469, 445, 15)
);
}
} }

View file

@ -1,23 +1,22 @@
namespace Server.Factions namespace Server.Factions;
public class Moonglow : Town
{ {
public class Moonglow : Town public Moonglow() =>
{ Definition =
public Moonglow() => new TownDefinition(
Definition = 3,
new TownDefinition( 0x186C,
3, "Moonglow",
0x186C, "Moonglow",
"Moonglow", 1011435, // MOONGLOW
"Moonglow", 1011563, // TOWN STONE FOR MOONGLOW
new TextDefinition(1011435, "MOONGLOW"), 1041037, // The Faction Sigil Monolith of Moonglow
new TextDefinition(1011563, "TOWN STONE FOR MOONGLOW"), 1041407, // The Faction Town Sigil Monolith of Moonglow
new TextDefinition(1041037, "The Faction Sigil Monolith of Moonglow"), 1041416, // Faction Town Stone of Moonglow
new TextDefinition(1041407, "The Faction Town Sigil Monolith of Moonglow"), 1041398, // Faction Town Sigil of Moonglow
new TextDefinition(1041416, "Faction Town Stone of Moonglow"), 1041389, // Corrupted Faction Town Sigil of Moonglow
new TextDefinition(1041398, "Faction Town Sigil of Moonglow"), new Point3D(4436, 1083, 0),
new TextDefinition(1041389, "Corrupted Faction Town Sigil of Moonglow"), new Point3D(4432, 1086, 0)
new Point3D(4436, 1083, 0), );
new Point3D(4432, 1086, 0)
);
}
} }

View file

@ -1,23 +1,22 @@
namespace Server.Factions namespace Server.Factions;
public class SkaraBrae : Town
{ {
public class SkaraBrae : Town public SkaraBrae() =>
{ Definition =
public SkaraBrae() => new TownDefinition(
Definition = 6,
new TownDefinition( 0x186F,
6, "Skara Brae",
0x186F, "Skara Brae",
"Skara Brae", 1011439, // SKARA BRAE
"Skara Brae", 1011567, // TOWN STONE FOR SKARA BRAE
new TextDefinition(1011439, "SKARA BRAE"), 1041040, // The Faction Sigil Monolith of Skara Brae
new TextDefinition(1011567, "TOWN STONE FOR SKARA BRAE"), 1041410, // The Faction Town Sigil Monolith of Skara Brae
new TextDefinition(1041040, "The Faction Sigil Monolith of Skara Brae"), 1041419, // Faction Town Stone of Skara Brae
new TextDefinition(1041410, "The Faction Town Sigil Monolith of Skara Brae"), 1041401, // Faction Town Sigil of Skara Brae
new TextDefinition(1041419, "Faction Town Stone of Skara Brae"), 1041392, // Corrupted Faction Town Sigil of Skara Brae
new TextDefinition(1041401, "Faction Town Sigil of Skara Brae"), new Point3D(576, 2200, 0),
new TextDefinition(1041392, "Corrupted Faction Town Sigil of Skara Brae"), new Point3D(572, 2196, 0)
new Point3D(576, 2200, 0), );
new Point3D(572, 2196, 0)
);
}
} }

View file

@ -1,23 +1,22 @@
namespace Server.Factions namespace Server.Factions;
public class Trinsic : Town
{ {
public class Trinsic : Town public Trinsic() =>
{ Definition =
public Trinsic() => new TownDefinition(
Definition = 1,
new TownDefinition( 0x186A,
1, "Trinsic",
0x186A, "Trinsic",
"Trinsic", 1011434, // TRINSIC
"Trinsic", 1011562, // TOWN STONE FOR TRINSIC
new TextDefinition(1011434, "TRINSIC"), 1041035, // The Faction Sigil Monolith of Trinsic
new TextDefinition(1011562, "TOWN STONE FOR TRINSIC"), 1041405, // The Faction Town Sigil Monolith of Trinsic
new TextDefinition(1041035, "The Faction Sigil Monolith of Trinsic"), 1041414, // Faction Town Stone of Trinsic
new TextDefinition(1041405, "The Faction Town Sigil Monolith of Trinsic"), 1041396, // Faction Town Sigil of Trinsic
new TextDefinition(1041414, "Faction Town Stone of Trinsic"), 1041387, // Corrupted Faction Town Sigil of Trinsic
new TextDefinition(1041396, "Faction Town Sigil of Trinsic"), new Point3D(1914, 2717, 20),
new TextDefinition(1041387, "Corrupted Faction Town Sigil of Trinsic"), new Point3D(1909, 2720, 20)
new Point3D(1914, 2717, 20), );
new Point3D(1909, 2720, 20)
);
}
} }

View file

@ -1,23 +1,22 @@
namespace Server.Factions namespace Server.Factions;
public class Vesper : Town
{ {
public class Vesper : Town public Vesper() =>
{ Definition =
public Vesper() => new TownDefinition(
Definition = 5,
new TownDefinition( 0x186E,
5, "Vesper",
0x186E, "Vesper",
"Vesper", 1016413, // VESPER
"Vesper", 1011566, // TOWN STONE FOR VESPER
new TextDefinition(1016413, "VESPER"), 1041039, // The Faction Sigil Monolith of Vesper
new TextDefinition(1011566, "TOWN STONE FOR VESPER"), 1041409, // The Faction Town Sigil Monolith of Vesper
new TextDefinition(1041039, "The Faction Sigil Monolith of Vesper"), 1041418, // Faction Town Stone of Vesper
new TextDefinition(1041409, "The Faction Town Sigil Monolith of Vesper"), 1041400, // Faction Town Sigil of Vesper
new TextDefinition(1041418, "Faction Town Stone of Vesper"), 1041391, // Corrupted Faction Town Sigil of Vesper
new TextDefinition(1041400, "Faction Town Sigil of Vesper"), new Point3D(2982, 818, 0),
new TextDefinition(1041391, "Corrupted Faction Town Sigil of Vesper"), new Point3D(2985, 821, 0)
new Point3D(2982, 818, 0), );
new Point3D(2985, 821, 0)
);
}
} }

View file

@ -1,23 +1,22 @@
namespace Server.Factions namespace Server.Factions;
public class Yew : Town
{ {
public class Yew : Town public Yew() =>
{ Definition =
public Yew() => new TownDefinition(
Definition = 4,
new TownDefinition( 0x186D,
4, "Yew",
0x186D, "Yew",
"Yew", 1011438, // YEW
"Yew", 1011565, // TOWN STONE FOR YEW
new TextDefinition(1011438, "YEW"), 1041038, // The Faction Sigil Monolith of Yew
new TextDefinition(1011565, "TOWN STONE FOR YEW"), 1041408, // The Faction Town Sigil Monolith of Yew
new TextDefinition(1041038, "The Faction Sigil Monolith of Yew"), 1041417, // Faction Town Stone of Yew
new TextDefinition(1041408, "The Faction Town Sigil Monolith of Yew"), 1041399, // Faction Town Sigil of Yew
new TextDefinition(1041417, "Faction Town Stone of Yew"), 1041390, // Corrupted Faction Town Sigil of Yew
new TextDefinition(1041399, "Faction Town Sigil of Yew"), new Point3D(548, 979, 0),
new TextDefinition(1041390, "Corrupted Faction Town Sigil of Yew"), new Point3D(542, 980, 0)
new Point3D(548, 979, 0), );
new Point3D(542, 980, 0)
);
}
} }

View file

@ -12,13 +12,14 @@ namespace Server.Engines.MLQuests.Definitions
{ {
Activated = true; Activated = true;
Title = 1075392; // Honest Beggar Title = 1075392; // Honest Beggar
Description = // Beg pardon, sir. I mean, madam. Uh, can I ask a favor of you? I found this jeweled ring. Most people would sell it and keep the money, but not me. I ain't never stole nothing, and I ain't about to start. I tried to take it over to Brit castle, figgerin' it must belong to some highborn lady, but the guards threw me out. You look like they might let you pass. Will you take the ring over there and see if you can find the owner?
1075393; // Beg pardon, sir. I mean, madam. Uh, can I ask a favor of you? I found this jeweled ring. Most people would sell it and keep the money, but not me. I ain't never stole nothing, and I ain't about to start. I tried to take it over to Brit castle, figgerin' it must belong to some highborn lady, but the guards threw me out. You look like they might let you pass. Will you take the ring over there and see if you can find the owner?
Description = 1075393;
RefusalMessage = 1075395; // I see. Too good to help an honest beggar like me, eh? RefusalMessage = 1075395; // I see. Too good to help an honest beggar like me, eh?
InProgressMessage = // A jewel like this must be worth a lot, so it must belong to some noble or another. I would show it around the castle. Someone's bound to recognize it.
1075396; // A jewel like this must be worth a lot, so it must belong to some noble or another. I would show it around the castle. Someone's bound to recognize it. InProgressMessage = 1075396;
CompletionMessage = // Didst thou find my ring? I thank thee very much! It is an old ring, and a gift from my husband. I was most distraught when I realized it was missing.
1075397; // Didst thou find my ring? I thank thee very much! It is an old ring, and a gift from my husband. I was most distraught when I realized it was missing. CompletionMessage = 1075397;
CompletionNotice = CompletionNoticeShort; CompletionNotice = CompletionNoticeShort;
Objectives.Add(new DeliverObjective(typeof(ReginasRing), 1, "Regina's Ring", typeof(Regina))); Objectives.Add(new DeliverObjective(typeof(ReginasRing), 1, "Regina's Ring", typeof(Regina)));

View file

@ -17,17 +17,16 @@ namespace Server.Engines.MLQuests
public class MLQuest public class MLQuest
{ {
public static readonly TextDefinition // You've completed a quest! Don't forget to collect your reward.
CompletionNoticeDefault = public static TextDefinition CompletionNoticeDefault = 1072273;
new(1072273); // You've completed a quest! Don't forget to collect your reward.
public static readonly TextDefinition CompletionNoticeShort = new(1046258); // Your quest is complete. public static TextDefinition CompletionNoticeShort = 1046258; // Your quest is complete.
public static readonly TextDefinition // Your quest is complete. Return for your reward.
CompletionNoticeShortReturn = new(1073775); // Your quest is complete. Return for your reward. public static TextDefinition CompletionNoticeShortReturn = 1073775;
public static readonly TextDefinition // You obtained what you seek, now receive your reward.
CompletionNoticeCraft = new(1073967); // You obtained what you seek, now receive your reward. public static TextDefinition CompletionNoticeCraft = 1073967;
public MLQuest() public MLQuest()
{ {

View file

@ -5,8 +5,7 @@ namespace Server.Engines.MLQuests.Rewards
{ {
public class DummyReward : BaseReward public class DummyReward : BaseReward
{ {
public DummyReward(TextDefinition name) public DummyReward(TextDefinition name) : base(name)
: base(name)
{ {
} }

View file

@ -41,8 +41,7 @@ namespace Server.Engines.MLQuests.Rewards
private readonly Type m_Type; private readonly Type m_Type;
public ItemReward(TextDefinition name = null, Type type = null, int amount = 1) public ItemReward(TextDefinition name = null, Type type = null, int amount = 1) : base(name)
: base(name)
{ {
m_Type = type; m_Type = type;
m_Amount = amount; m_Amount = amount;

View file

@ -70,9 +70,7 @@ namespace Server.Guilds
defs[0] = name; defs[0] = name;
defs[1] = pm.GuildRank.Name; defs[1] = pm.GuildRank.Name;
defs[2] = pm.NetState != null defs[2] = pm.NetState != null ? 1063015 : pm.LastOnline.ToString("yyyy-MM-dd");
? new TextDefinition(1063015)
: new TextDefinition(pm.LastOnline.ToString("yyyy-MM-dd"));
defs[3] = pm.GuildTitle ?? ""; defs[3] = pm.GuildTitle ?? "";
return defs; return defs;
@ -151,8 +149,8 @@ namespace Server.Guilds
{ {
pm.SendLocalizedMessage(1063051, targ.Name); // ~1_val~ is already a member of a guild. pm.SendLocalizedMessage(1063051, targ.Name); // ~1_val~ is already a member of a guild.
} }
else if (targ.HasGump<BaseGuildGump>() || targ.HasGump<CreateGuildGump>() // TODO: Check message if CreateGuildGump Open
) // TODO: Check message if CreateGuildGump Open else if (targ.HasGump<BaseGuildGump>() || targ.HasGump<CreateGuildGump>())
{ {
pm.SendLocalizedMessage(1063052, targ.Name); // ~1_val~ is currently considering another guild invitation. pm.SendLocalizedMessage(1063052, targ.Name); // ~1_val~ is currently considering another guild invitation.
} }

View file

@ -122,11 +122,11 @@ public partial class SoulstoneFragmentToken : PromotionalToken
{ {
} }
public override TextDefinition ItemGumpName => 1070999; // <center>Soulstone Fragment</center> public override TextDefinition ItemGumpName { get; } = 1070999; // <center>Soulstone Fragment</center>
public override TextDefinition ItemName => 1071000; // soulstone fragment public override TextDefinition ItemName { get; } = 1071000; // soulstone fragment
// A soulstone fragment has been created in your bank box. // A soulstone fragment has been created in your bank box.
public override TextDefinition ItemReceiveMessage => 1070976; public override TextDefinition ItemReceiveMessage { get; } = 1070976;
public override Item CreateItemFor(Mobile from) => public override Item CreateItemFor(Mobile from) =>
from?.Account != null ? new SoulstoneFragment(from.Account.ToString()) : null; from?.Account != null ? new SoulstoneFragment(from.Account.ToString()) : null;

View file

@ -17,7 +17,7 @@ namespace Server.Spells
public virtual SkillName MoveSkill => SkillName.Bushido; public virtual SkillName MoveSkill => SkillName.Bushido;
public virtual double RequiredSkill => 0.0; public virtual double RequiredSkill => 0.0;
public virtual TextDefinition AbilityMessage => 0; public virtual TextDefinition AbilityMessage => TextDefinition.Empty;
public virtual bool BlockedByAnimalForm => true; public virtual bool BlockedByAnimalForm => true;
public virtual bool DelayedContext => false; public virtual bool DelayedContext => false;

View file

@ -10,8 +10,8 @@ namespace Server.Spells.Bushido
public override int BaseMana => 0; public override int BaseMana => 0;
public override double RequiredSkill => 25.0; public override double RequiredSkill => 25.0;
public override TextDefinition AbilityMessage => // You better kill your enemy with your next hit or you'll be rather sorry...
new(1063122); // You better kill your enemy with your next hit or you'll be rather sorry... public override TextDefinition AbilityMessage { get; } = 1063122;
public override double GetDamageScalar(Mobile attacker, Mobile defender) => public override double GetDamageScalar(Mobile attacker, Mobile defender) =>
// TODO: 20 -> Perfection // TODO: 20 -> Perfection

View file

@ -7,7 +7,7 @@ namespace Server.Spells.Bushido
public override int BaseMana => 5; public override int BaseMana => 5;
public override double RequiredSkill => 50.0; public override double RequiredSkill => 50.0;
public override TextDefinition AbilityMessage => new(1063167); // You prepare to strike quickly. public override TextDefinition AbilityMessage { get; } = 1063167; // You prepare to strike quickly.
public override bool DelayedContext => true; public override bool DelayedContext => true;

View file

@ -7,8 +7,8 @@ namespace Server.Spells.Bushido
public override int BaseMana => 10; public override int BaseMana => 10;
public override double RequiredSkill => 70.0; public override double RequiredSkill => 70.0;
public override TextDefinition AbilityMessage => // You prepare to strike two enemies with one blow.
new(1070757); // You prepare to strike two enemies with one blow. public override TextDefinition AbilityMessage { get; } = 1070757;
public override void OnHit(Mobile attacker, Mobile defender, int damage) public override void OnHit(Mobile attacker, Mobile defender, int damage)
{ {

View file

@ -8,8 +8,8 @@ namespace Server.Spells.Ninjitsu
public override int BaseMana => 30; public override int BaseMana => 30;
public override double RequiredSkill => Core.ML ? 40.0 : 20.0; public override double RequiredSkill => Core.ML ? 40.0 : 20.0;
public override TextDefinition AbilityMessage => // You prepare to Backstab your opponent.
new(1063089); // You prepare to Backstab your opponent. public override TextDefinition AbilityMessage { get; } = 1063089;
public override bool ValidatesDuringHit => false; public override bool ValidatesDuringHit => false;

View file

@ -13,8 +13,8 @@ namespace Server.Spells.Ninjitsu
public override int BaseMana => 30; public override int BaseMana => 30;
public override double RequiredSkill => 85.0; public override double RequiredSkill => 85.0;
public override TextDefinition AbilityMessage => // You prepare to hit your opponent with a Death Strike.
new(1063091); // You prepare to hit your opponent with a Death Strike. public override TextDefinition AbilityMessage { get; } = 1063091;
public override double GetDamageScalar(Mobile attacker, Mobile defender) => 0.5; public override double GetDamageScalar(Mobile attacker, Mobile defender) => 0.5;

View file

@ -7,8 +7,8 @@ namespace Server.Spells.Ninjitsu
public override int BaseMana => Core.ML ? 10 : 20; public override int BaseMana => Core.ML ? 10 : 20;
public override double RequiredSkill => Core.ML ? 30.0 : 60; public override double RequiredSkill => Core.ML ? 30.0 : 60;
public override TextDefinition AbilityMessage => // You prepare to focus all of your abilities into your next strike.
new(1063095); // You prepare to focus all of your abilities into your next strike. public override TextDefinition AbilityMessage { get; } = 1063095;
public override bool Validate(Mobile from) public override bool Validate(Mobile from)
{ {

View file

@ -11,8 +11,8 @@ namespace Server.Spells.Ninjitsu
public override int BaseMana => 25; public override int BaseMana => 25;
public override double RequiredSkill => 80.0; public override double RequiredSkill => 80.0;
public override TextDefinition AbilityMessage => // Your Ki Attack must be complete within 2 seconds for the damage bonus!
new(1063099); // Your Ki Attack must be complete within 2 seconds for the damage bonus! public override TextDefinition AbilityMessage { get; } = 1063099;
public override void OnUse(Mobile from) public override void OnUse(Mobile from)
{ {

View file

@ -11,7 +11,7 @@ namespace Server.Spells.Ninjitsu
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;
public override TextDefinition AbilityMessage => new(1063128); // You prepare to surprise your prey. public override TextDefinition AbilityMessage { get; } = 1063128; // You prepare to surprise your prey.
public override bool ValidatesDuringHit => false; public override bool ValidatesDuringHit => false;

View file

@ -31,7 +31,7 @@ namespace Server.Items
[CommandProperty(AccessLevel.GameMaster)] [CommandProperty(AccessLevel.GameMaster)]
public int StrengthBonus { get; set; } public int StrengthBonus { get; set; }
public override TextDefinition InvalidTransferMessage => 1073480; // Your arcane focus disappears. public override TextDefinition InvalidTransferMessage { get; } = 1073480; // Your arcane focus disappears.
public override bool Nontransferable => true; public override bool Nontransferable => true;
public override void GetProperties(IPropertyList list) public override void GetProperties(IPropertyList list)

View file

@ -29,7 +29,7 @@ namespace Server.Items
public override bool Nontransferable => true; public override bool Nontransferable => true;
public virtual TextDefinition InvalidTransferMessage => null; public virtual TextDefinition InvalidTransferMessage => TextDefinition.Empty;
public override void HandleInvalidTransfer(Mobile from) public override void HandleInvalidTransfer(Mobile from)
{ {