Skip to content

Commit

Permalink
Add characters for all available zones
Browse files Browse the repository at this point in the history
- Each character allows you to load into a different zone
- Small restructering for the character controller
  • Loading branch information
eXpl0it3r committed Oct 9, 2021
1 parent c4728e7 commit f7984cf
Show file tree
Hide file tree
Showing 21 changed files with 255 additions and 138 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [1.1.0] - 2021-10-09

### Added

- Characters for each available zone with usable spawn location

## [1.0.0] - 2021-10-06

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -44,16 +44,16 @@ PlayIntroMovie = false

### Features

- Loading into the New Eden zone
- Loading into any of the existing zone
- Basic character movement, including jetpacks
- Primary and secondary weapon usage
- **Note:** In about one third of the cases, the weapons can't be used, try a relog in those cases
- One partially working ability that breaks the camera position
- Sound effects, ambient and music
- The map can be opened

### Limitations

- Currently only one map is supported, other zones can be loaded with small modifications of the source code
- Weapons don't always work
- Jetpacks are missing all visual effects
- Most of the UI doesn't work properly
Expand Down
4 changes: 2 additions & 2 deletions SharedAssemblyInfo.cs
Expand Up @@ -4,5 +4,5 @@
[assembly: AssemblyCopyright("Copyright ©2019-2021 by The Melding Wars")]
[assembly: AssemblyTrademark("")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
11 changes: 8 additions & 3 deletions UdpHosts/GameServer/NetworkPlayer.cs
Expand Up @@ -5,6 +5,7 @@
using GameServer.Packets.GSS.Character.ObserverView;
using GameServer.Packets.Matrix;
using GameServer.Test;
using Serilog.Core;
using System.Net;
using System.Numerics;
using System.Threading;
Expand Down Expand Up @@ -47,12 +48,16 @@ public void Login(ulong charID)
var wel = new WelcomeToTheMatrix { InstanceID = AssignedShard.InstanceID };
NetChans[ChannelType.Matrix].SendClass(wel);

EnterZone(DataUtils.GetZone(448));
var zone = (uint)(charID & 0x000000000000ffff);

Program.Logger.Verbose("Zone {0}", zone);

EnterZone(DataUtils.GetZone(zone));
}

public void Respawn()
{
var p = DataUtils.GetZone(448).POIs["watchtower"];
var p = DataUtils.GetZone(CurrentZone.ID).POIs["spawn"];
CharacterEntity.Position = p;

var forcedMove = new ForcedMovement
Expand Down Expand Up @@ -154,7 +159,7 @@ public void Tick(double deltaTime, ulong currTime, CancellationToken ct)
public void EnterZone(Zone z)
{
CurrentZone = z;
CharacterEntity.Position = CurrentZone.POIs["watchtower"];
CharacterEntity.Position = CurrentZone.POIs["spawn"];

// EnterZone
var enterZone = new EnterZone();
Expand Down
66 changes: 47 additions & 19 deletions UdpHosts/GameServer/Test/DataUtils.cs
Expand Up @@ -11,30 +11,58 @@ public static class DataUtils
public static void Init()
{
_zones = new ConcurrentDictionary<uint, Zone>();

AddZone(12, "Nothing", 1461290341326u, new Vector3(-9.92f, 0.53f, 0.0f));
AddZone(162, "Diamond Head", 1461290341098u, new Vector3(-718.07f, 735.62f, 103.0f));
AddZone(448, "New Eden", 1461290346895u, new Vector3(176.65f, 250.13f, 491.94f));
_zones[448].POIs.Add("watchtower", new Vector3(176.65f, 250.13f, 491.94f));
_zones[448].POIs.Add("jacuzzi", new Vector3(-532.0f, -469.0f, 473.0f));
AddZone(805, "Epicenter Melding Tornado Pocket", 1461290355101u, new Vector3(-112.39f, 60.02f, 536.0f));
AddZone(844, "Omnidyne-M Prototype Stadium", 1461290362014u, new Vector3(-2.26f, -44.72f, 130.17f));
AddZone(865, "Abyss - Melding Tornado Pocket", 1461290368902u, new Vector3(0.0f, 0.0f, 0.0f));
AddZone(868, "Cinerarium", 1461290369176u, new Vector3(54.54f, -129.94f, 356.0f));
AddZone(1030, "Sertao", 1461290383710u, new Vector3(524.82f, -1110.16f, 773.0f));
AddZone(1051, "Baneclaw Lair", 1461290384421u, new Vector3(-56.0f, -36.0f, 216.0f));
AddZone(1069, "OP01_Operation_Miru", 1461290388635u, new Vector3(-253.31f, -238.03f, 60.5f));
AddZone(1089, "OP03_Operation_The_ARES_Team", 1461290393342u, new Vector3(819.31f, 148.59f, 75.7f));
AddZone(1093, "OP02_Operation_High_Tide", 1461290397267u, new Vector3(-811.53f, -749.51f, 45.4f));
AddZone(1100, "M01_Mission_01_Everything_Is_Shadow", 1461290405259u, new Vector3(38.9f, 7.55f, 12.2f));
AddZone(1104, "M02_Mission_02_Bathsheba", 1461290412668u, new Vector3(-222.88f, -25.55f, 401.4f));
AddZone(1003, "M03EMission_03_Crash_Down", 1461290373898u, new Vector3(2.49f, -139.21f, 93.4f));
AddZone(1102, "M04_Mission_04_Razorwind", 1461290409497u, new Vector3(567.44f, -265.96f, 402.2f));
AddZone(1117, "M05_Mission_05_No_Exit", 1461290428811u, new Vector3(-7.04f, 40.15f, 124.1f));
AddZone(1113, "M06_Mission_06_Safe_House", 1461290423131u, new Vector3(-55.0f, 14.5f, 124.0f));
AddZone(1101, "M07_Mission_07_Trespass", 1461290405806u, new Vector3(56.29f, -4.66f, 71.5f));
AddZone(1134, "M08_Mission_08_Catch_Of_The_Day", 1461290437018u, new Vector3(-107.61f, 224.07f, -10.5f));
AddZone(1099, "M09_Mission_09_Taken", 1461290398077u, new Vector3(-142.23f, 8.34f, 491.2f));
AddZone(1106, "M10_Mission_10_Off_The_Grid", 1461290416745u, new Vector3(112.19f, -247.70f, 491.2f));
AddZone(1114, "M11_Mission_11_Consequence", 1461290424543u, new Vector3(4.8f, 134.89f, 48.3f));
AddZone(1155, "M12EMission_12_Prison_Break", 1461290446057u, new Vector3(-318.91f, -212.05f, 119.18f));
AddZone(1154, "M13_Mission_13_Accelerate", 1461290444073u, new Vector3(-85.07f, 72.51f, 13.3f));
AddZone(1008, "M14EMission_14_Icebreaker", 1461290378632u, new Vector3(104.64f, -99.24f, 23.9f));
AddZone(803, "M15_Mission_15_Agrievan", 1461290348235u, new Vector3(677.6f, 116.86f, 1008.3f));
AddZone(864, "M16EMission_16_Unearthed", 1461290364500u, new Vector3(-308.27f, 349.28f, 1.14f));
AddZone(1151, "M17_Mission_17_SOS", 1461290441302u, new Vector3(67.18f, -29.68f, 77.99f));
AddZone(1007, "M18EMission_18_Vagrant_Dawn", 1461290375832u, new Vector3(352.81f, 266.75f, 7.9f));
AddZone(1171, "M19_Mission_19_Gatecrasher", 1461290455548u, new Vector3(-69.75f, -297.67f, 67.9f));
AddZone(833, "M20EMission_20_Razors_Edge", 1461290358180u, new Vector3(-117.2f, 388.62f, 43.0f));
AddZone(1181, "M22_Mission_22_Homecoming", 1461290465151u, new Vector3(-325.26f, 54.31f, 13.0f));
AddZone(1125, "Battlelab_01", 1461290430075u, new Vector3(-63.27f, 4.69f, 217.0f));
AddZone(1147, "Refinery: TDM", 1461290437107u, new Vector3(-14.57f, -17.03f, -3.0f));
AddZone(1162, "BattleLab The Danger Room", 1461290451458u, new Vector3(82.26f, -21.89f, 197.0f));
AddZone(1163, "Holdout: Jericho", 1461290451297u, new Vector3(-10.45f, 260.87f, 386.87f));
AddZone(1173, "Raid_01_Defense_of_Dredge", 1461290460325u, new Vector3(-116.67f, 67.18f, 191.0f));
}

public static Zone GetZone(uint id)
{
if (_zones.ContainsKey(id))
{
return _zones[id];
}

if (id != 448)
{
return null;
}

var ret = new Zone();
ret.ID = id;
ret.Name = "New Eden";
ret.Timestamp = 1461290346895u;

ret.POIs.Add("origin", new Vector3(0, 0, 0));
ret.POIs.Add("watchtower", new Vector3(176.65f, 250.13f, 491.94f));
ret.POIs.Add("jacuzzi", new Vector3(-532.0f, -469.0f, 473.0f));
return _zones.ContainsKey(id) ? _zones[id] : _zones[448];
}

return _zones.AddOrUpdate(id, ret, (k, nc) => nc);
private static void AddZone(uint id, string name, ulong timestamp, Vector3 spawn)
{
var zone = new Zone { ID = id, Name = name, Timestamp = timestamp, POIs = { { "origin", new Vector3(0.0f, 0.0f, 0.0f) }, { "spawn", spawn } } };
_zones.AddOrUpdate(zone.ID, zone, (k, nc) => nc);
}
}
}
23 changes: 23 additions & 0 deletions WebHosts/WebHost.ClientApi/Characters/CharactersController.cs
@@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc;
using WebHost.ClientApi.Characters.Models;

namespace WebHost.ClientApi.Characters
{
[ApiController]
public class CharactersController : ControllerBase
{
private readonly ICharactersRepository _charactersRepository;

public CharactersController(ICharactersRepository charactersRepository)
{
_charactersRepository = charactersRepository;
}

[Route("api/v2/characters/list")]
[HttpGet]
public CharactersList GetCharactersList()
{
return _charactersRepository.GetCharacters();
}
}
}
139 changes: 139 additions & 0 deletions WebHosts/WebHost.ClientApi/Characters/CharactersRepository.cs
@@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using WebHost.ClientApi.Characters.Models;
using WebHost.ClientApi.Models.Base;

namespace WebHost.ClientApi.Characters
{
public class CharactersRepository : ICharactersRepository
{
public CharactersList GetCharacters()
{
return new CharactersList
{
Characters = new List<Character>
{
GetCharacter("M22 Homecoming", 0x99aabbccddee0000 + 1181),
GetCharacter("M20 Razor Edge", 0x99aabbccddee0000 + 833),
GetCharacter("M19 Gatecrasher", 0x99aabbccddee0000 + 1171),
GetCharacter("M18 Vagrant Dawn", 0x99aabbccddee0000 + 1007),
GetCharacter("M17 SOS", 0x99aabbccddee0000 + 1151),
GetCharacter("M16 Unearthed", 0x99aabbccddee0000 + 864),
GetCharacter("M15 Agrievan", 0x99aabbccddee0000 + 803),
GetCharacter("M14 Icebreaker", 0x99aabbccddee0000 + 1008),
GetCharacter("M13 Accelerate", 0x99aabbccddee0000 + 1154),
GetCharacter("M12 Prison Break", 0x99aabbccddee0000 + 1155),
GetCharacter("M11 Consequence", 0x99aabbccddee0000 + 1114),
GetCharacter("M10 Off the Grid", 0x99aabbccddee0000 + 1106),
GetCharacter("M09 Taken", 0x99aabbccddee0000 + 1099),
GetCharacter("M08 Catch", 0x99aabbccddee0000 + 1134),
GetCharacter("M07 Trespass", 0x99aabbccddee0000 + 1101),
GetCharacter("M06 Safehouse", 0x99aabbccddee0000 + 1113),
GetCharacter("M05 No Exit", 0x99aabbccddee0000 + 1117),
GetCharacter("M04 Razorwind", 0x99aabbccddee0000 + 1102),
GetCharacter("M03 Crash Down", 0x99aabbccddee0000 + 1003),
GetCharacter("M02 Bathsheba", 0x99aabbccddee0000 + 1104),
GetCharacter("M01 Shadow", 0x99aabbccddee0000 + 1100),

GetCharacter("OP3 ARES Team", 0x99aabbccddee0000 + 1089),
GetCharacter("OP2 High Tide", 0x99aabbccddee0000 + 1093),
GetCharacter("OP1 Miru", 0x99aabbccddee0000 + 1069),

GetCharacter("TDM Refinery", 0x99aabbccddee0000 + 1147),
GetCharacter("Omnidyne-M Stadium", 0x99aabbccddee0000 + 844),

GetCharacter("Holdout Jericho", 0x99aabbccddee0000 + 1163),
GetCharacter("R1 Defense of Dredge", 0x99aabbccddee0000 + 1173),

GetCharacter("Epicenter Melding Tornado", 0x99aabbccddee0000 + 805),
GetCharacter("Abyss Melding Tornado", 0x99aabbccddee0000 + 865),
GetCharacter("Cinerarium", 0x99aabbccddee0000 + 868),
GetCharacter("Danger Room", 0x99aabbccddee0000 + 1162),
GetCharacter("Baneclaw Lair", 0x99aabbccddee0000 + 1051),
GetCharacter("Battlelab", 0x99aabbccddee0000 + 1125),

GetCharacter("Nothing", 0x99aabbccddee0000 + 12),
GetCharacter("Diamond Head", 0x99aabbccddee0000 + 162),
GetCharacter("Sertao", 0x99aabbccddee0000 + 1030),
GetCharacter("New Eden", 0x99aabbccddee0000 + 448),
},
IsDev = false,
RbBalance = 0,
NameChangeCost = 100
};
}

private static Character GetCharacter(string name, ulong guid)
{
return new Character
{
CharacterGuid = guid,
Name = name,
UniqueName = "Ascendant",
IsDev = false,
IsActive = true,
CreatedAt = new DateTime(2017, 1, 3, 23, 41, 26),
TitleId = 0,
TimePlayedSecs = 500,
NeedsNameChange = false,
MaxFrameLevel = 10,
FrameSdbId = 76334,
CurrentLevel = 10,
Gender = 1,
CurrentGender = "female",
EliteRank = 95487,
LastSeenAt = DateTime.Now - TimeSpan.FromDays(365),
Visuals = new Visuals
{
Id = 0,
Race = 0,
Gender = 1,
SkinColor = new ColoredItem { Id = 118969, Value = new ColorValue { Color = 4294930822 } },
VoiceSet = new Item { Id = 1033 },
Head = new Item { Id = 10026 },
EyeColor = new ColoredItem { Id = 118980, Value = new ColorValue { Color = 1633685600 } },
LipColor = new ColoredItem { Id = 1, Value = new ColorValue { Color = 4294903873 } },
HairColor = new ColoredItem { Id = 77193, Value = new ColorValue { Color = 1917780001 } },
FacialHairColor = new ColoredItem { Id = 77193, Value = new ColorValue { Color = 1917780001 } },
HeadAccessories = new List<ColoredItem> { new() { Id = 10117, Value = new ColorValue { Color = 1211031763 } } },
Ornaments = new List<ColoredItem>(),
Eyes = new Item { Id = 10001 },
Hair = new HairItem { Id = 10113, Color = new ColorItem { Id = 77193, Value = 1917780001 } },
FacialHair = new HairItem { Id = 0, Color = new ColorItem { Id = 77187, Value = 1518862368 } },
Glider = new Item { Id = 0 },
Vehicle = new Item { Id = 0 },
Decals = new List<ColoredTransformableSdbItem>(),
WarpaintId = 143225,
Warpaint = new List<long>
{
4216738474,
0,
4216717312,
418250752,
1525350400,
4162844703,
4162844703
},
Decalgradients = new List<long>(),
WarpaintPatterns = new List<WarpaintPattern>(),
VisualOverrides = new List<long>()
},
Gear = new List<Gear>
{
new() { SlotTypeId = 1, SdbId = 86969, ItemGuid = 5068916056568384765 },
new() { SlotTypeId = 2, SdbId = 87918, ItemGuid = 5068916056568385021 },
new() { SlotTypeId = 6, SdbId = 91770, ItemGuid = 5068923373180718589 },
new() { SlotTypeId = 116, SdbId = 126000, ItemGuid = 5068916056568385277 },
new() { SlotTypeId = 122, SdbId = 129359, ItemGuid = 5068916056568385533 },
new() { SlotTypeId = 126, SdbId = 127501, ItemGuid = 5068916056568385789 },
new() { SlotTypeId = 127, SdbId = 128271, ItemGuid = 5068916056568386045 },
new() { SlotTypeId = 128, SdbId = 126731, ItemGuid = 5068916056568386301 },
new() { SlotTypeId = 129, SdbId = 129067, ItemGuid = 5068916056568386557 }
},
ExpiresIn = 0,
Race = "chosen",
Migrations = new List<int>()
};
}
}
}
@@ -0,0 +1,9 @@
using WebHost.ClientApi.Characters.Models;

namespace WebHost.ClientApi.Characters
{
public interface ICharactersRepository
{
CharactersList GetCharacters();
}
}
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

namespace WebHost.ClientApi.Models.Characters
namespace WebHost.ClientApi.Characters.Models
{
public class Character
{
Expand Down
@@ -1,8 +1,8 @@
using System.Collections.Generic;

namespace WebHost.ClientApi.Models.Characters
namespace WebHost.ClientApi.Characters.Models
{
public class CharatersList
public class CharactersList
{
public IEnumerable<Character> Characters { get; set; }
public bool IsDev { get; set; }
Expand Down
@@ -1,6 +1,6 @@
using WebHost.ClientApi.Models.Base;

namespace WebHost.ClientApi.Models.Characters
namespace WebHost.ClientApi.Characters.Models
{
public class ColorItem : Item
{
Expand Down
@@ -1,4 +1,4 @@
namespace WebHost.ClientApi.Models.Characters
namespace WebHost.ClientApi.Characters.Models
{
public class ColorValue
{
Expand Down
@@ -1,6 +1,6 @@
using WebHost.ClientApi.Models.Base;

namespace WebHost.ClientApi.Models.Characters
namespace WebHost.ClientApi.Characters.Models
{
public class ColoredItem : Item
{
Expand Down
@@ -1,6 +1,6 @@
using WebHost.ClientApi.Models.Base;

namespace WebHost.ClientApi.Models.Characters
namespace WebHost.ClientApi.Characters.Models
{
public class ColoredTransformableSdbItem : TransformableSdbItem
{
Expand Down
@@ -1,4 +1,4 @@
namespace WebHost.ClientApi.Models.Characters
namespace WebHost.ClientApi.Characters.Models
{
public class Gear
{
Expand Down
@@ -1,6 +1,6 @@
using WebHost.ClientApi.Models.Base;

namespace WebHost.ClientApi.Models.Characters
namespace WebHost.ClientApi.Characters.Models
{
public class HairItem : Item
{
Expand Down

0 comments on commit f7984cf

Please sign in to comment.