feat: Customize expansion and set maps on first boot (#1425)

This commit is contained in:
mdodkins 2023-08-01 04:46:49 +01:00 • committed by GitHub
parent 3ffe049e08
commit a9a2a89908
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 700 additions and 269 deletions

View file

@ -4,6 +4,7 @@ using System.Runtime.CompilerServices;
using Server.Accounting;
using Server.Items;
using Server.Logging;
using Server.Maps;
using Server.Mobiles;
using Server.Network;
@ -197,7 +198,6 @@ public static class CharacterCreation
}
var city = GetStartLocation(args, young);
newChar.MoveToWorld(city.Location, city.Map);
logger.Information(
@ -218,11 +218,13 @@ public static class CharacterCreation
private static CityInfo GetStartLocation(CharacterCreatedEventArgs args, bool isYoung)
{
// We don't get the actual client version until after character creation
var post6000Supported = !TileMatrix.Pre6000ClientSupport;
var availableMaps = ExpansionInfo.CoreExpansion.MapSelectionFlags;
if (Core.ML && post6000Supported)
if (Core.ML && post6000Supported && availableMaps.Includes(MapSelectionFlags.Trammel))
{
return _newHavenInfo; // We don't get the client Version until AFTER Character creation
return _newHavenInfo;
}
var useHaven = isYoung;
@ -236,7 +238,7 @@ public static class CharacterCreation
{
case "necromancer":
{
if ((flags & ClientFlags.Malas) != 0)
if ((flags & ClientFlags.Malas) != 0 && availableMaps.Includes(MapSelectionFlags.Malas))
{
return new CityInfo("Umbra", "Mardoth's Tower", 2114, 1301, -50, Map.Malas);
}
@ -256,11 +258,21 @@ public static class CharacterCreation
}
case "paladin":
{
return _newHavenInfo;
if (availableMaps.Includes(MapSelectionFlags.Trammel) && post6000Supported)
{
return _newHavenInfo;
}
break;
}
case "samurai":
{
if ((flags & ClientFlags.Tokuno) != 0)
bool haotisAndTokunoAccessible =
(flags & ClientFlags.Tokuno) == ClientFlags.Tokuno &&
(flags & ClientFlags.Malas) == ClientFlags.Malas &&
availableMaps.Includes(MapSelectionFlags.Malas | MapSelectionFlags.Tokuno);
if (haotisAndTokunoAccessible)
{
return new CityInfo("Samurai DE", "Haoti's Grounds", 368, 780, -1, Map.Malas);
}
@ -280,7 +292,12 @@ public static class CharacterCreation
}
case "ninja":
{
if ((flags & ClientFlags.Tokuno) != 0)
bool enimosAndTokunoAccessible =
(flags & ClientFlags.Tokuno) == ClientFlags.Tokuno &&
(flags & ClientFlags.Malas) == ClientFlags.Malas &&
availableMaps.Includes(MapSelectionFlags.Malas | MapSelectionFlags.Tokuno);
if (enimosAndTokunoAccessible)
{
return new CityInfo("Ninja DE", "Enimo's Residence", 414, 823, -1, Map.Malas);
}
@ -300,7 +317,43 @@ public static class CharacterCreation
}
}
return post6000Supported && useHaven ? _newHavenInfo : args.City;
if (post6000Supported && useHaven && availableMaps.Includes(MapSelectionFlags.Trammel))
{
// New Haven is supported, so put them there...
// Note: if your server maps don't contain New Haven, this will place
// them in the wilderness of Ocllo
return _newHavenInfo;
}
if (useHaven)
{
// New Haven is not available, so place them in Ocllo instead, if they're aiming for Haven
CityInfo oclloBank = new CityInfo("Ocllo", "Near the bank", 3677, 2513, -1, Map.Trammel);
if (availableMaps.Includes(MapSelectionFlags.Trammel))
{
return oclloBank;
}
if (availableMaps.Includes(MapSelectionFlags.Felucca))
{
oclloBank.Map = Map.Felucca;
return oclloBank;
}
}
// They're not trying to get to Haven, so use their city selection
// instead - adjusted according to available maps
if (args.City.Map == Map.Trammel && !availableMaps.Includes(MapSelectionFlags.Trammel))
{
args.City.Map = Map.Felucca;
}
if (args.City.Map == Map.Felucca && !availableMaps.Includes(MapSelectionFlags.Felucca))
{
args.City.Map = Map.Trammel;
}
return args.City;
}
private static void SetStats(Mobile m, NetState state, StatNameValue[] stats, int prof)

View file

@ -1,9 +1,9 @@
using System;
using Server.Buffers;
using Server.Gumps;
using Server.Logging;
using Server.Mobiles;
using Server.Network;
using Server.Text;
namespace Server.Misc
{

View file

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using Server.Buffers;
using Server.Text;
namespace Server.Misc
{

View file

@ -1,8 +1,7 @@
using System;
using System.Text;
using Server.Buffers;
using Server.Engines.CannedEvil;
using Server.Mobiles;
using Server.Text;
namespace Server.Misc
{