Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Maple2.Database/Storage/Game/GameStorage.Map.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,7 @@ public IList<Plot> LoadPlotsForMap(int mapId, long ownerId = -1) {
.Where(map => map.MapId == mapId && map.OwnerId == ownerId);
} else {
query = Context.UgcMap.Include(map => map.Cubes)
.Where(map => map.MapId == mapId);
.Where(map => map.MapId == mapId && map.MapId != Constant.DefaultHomeMapId);
}

return query.AsEnumerable()
Expand Down
18 changes: 10 additions & 8 deletions Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -137,12 +137,14 @@ public virtual void Init() {
}

// Create default to place liftable cubes
Plots[0] = new Plot(new UgcMapGroup(0,
0,
0,
new UgcMapGroup.Cost(0, 0, 0),
new UgcMapGroup.Cost(0, 0, 0),
new UgcMapGroup.Limits(0, 0, 0, 0, 0, 0)));
if (MapId is not Constant.DefaultHomeMapId) {
Plots[0] = new Plot(new UgcMapGroup(0,
0,
0,
new UgcMapGroup.Cost(0, 0, 0),
new UgcMapGroup.Cost(0, 0, 0),
new UgcMapGroup.Limits(0, 0, 0, 0, 0, 0)));
}

foreach (TriggerModel trigger in Entities.TriggerModels.Values) {
AddTrigger(trigger);
Expand DownExpand Up@@ -461,14 +463,14 @@ public bool UsePortal(GameSession session, int portalId, string password) {
Portal srcPortal = fieldPortal;
switch (srcPortal.Type) {
case PortalType.InHome:
PlotCube? cubePortal = Plots.First().Value.Cubes.Values.FirstOrDefault(x => x.Interact?.PortalSettings is not null && x.Interact.PortalSettings.PortalObjectId == fieldPortal.ObjectId);
PlotCube? cubePortal = session.Housing.GetFieldPlot()?.Cubes.Values.FirstOrDefault(x => x.Interact?.PortalSettings is not null && x.Interact.PortalSettings.PortalObjectId == fieldPortal.ObjectId);
if (cubePortal is null) {
return false;
}

switch (cubePortal.Interact!.PortalSettings!.Destination) {
case CubePortalDestination.PortalInHome:
PlotCube? destinationCube = Plots.First().Value.Cubes.Values.FirstOrDefault(x => x.Interact?.PortalSettings is not null && x.Interact.PortalSettings.PortalName == cubePortal.Interact.PortalSettings.DestinationTarget);
PlotCube? destinationCube = session.Housing.GetFieldPlot()?.Cubes.Values.FirstOrDefault(x => x.Interact?.PortalSettings is not null && x.Interact.PortalSettings.PortalName == cubePortal.Interact.PortalSettings.DestinationTarget);
if (destinationCube is null) {
return false;
}
Expand Down
5 changes: 4 additions & 1 deletion Maple2.Server.Game/PacketHandlers/LoadUgcMapHandler.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,7 +50,10 @@ public override void Handle(GameSession session, IByteReader packet) {
}

// Check if current plot is planner
Plot indoor = session.Field.Plots.First().Value;
Plot? indoor = session.Housing.GetFieldPlot();
if (indoor is null) {
return;
}
if (indoor.IsPlanner) {
home.EnterPlanner(indoor.PlotMode);
}
Expand Down
4 changes: 2 additions & 2 deletions Maple2.Server.Game/Session/GameSession.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,7 +202,7 @@ public bool EnterServer(long accountId, Guid machineId, MigrateInResponse migrat
case MigrationType.DecorPlanner:
case MigrationType.BlueprintDesigner:
player.Home.EnterPlanner((PlotMode) migrationType);
fieldManager.Plots.First().Value.SetPlannerMode((PlotMode) migrationType);
Housing.GetFieldPlot()?.SetPlannerMode((PlotMode) migrationType);
break;
case MigrationType.Dungeon:
if (fieldManager is not DungeonFieldManager dungeonField) {
Expand DownExpand Up@@ -486,7 +486,7 @@ public bool EnterField() {

public void ReturnField() {
Player player = Player.Value;
if (player.Home.IsHomeSetup && !Player.Field.Plots.IsEmpty && Player.Field.Plots.First().Value.IsPlanner) {
if (player.Home.IsHomeSetup && !Player.Field.Plots.IsEmpty && (Player.Session.Housing.GetFieldPlot()?.IsPlanner ?? false)) {
MigrateToPlanner(PlotMode.Normal);
return;
}
Expand Down