From 7153216f09f47e238b1d1cb219db0defff2887c1 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 10 Mar 2024 18:27:09 -0500 Subject: [PATCH] custom races --- src/engine/Enum.java | 3 +- src/engine/InterestManagement/HeightMap.java | 4 +- .../client/handlers/PlaceAssetMsgHandler.java | 2 +- src/engine/net/client/msg/CityZoneMsg.java | 4 +- .../msg/login/CommitNewCharacterMsg.java | 3 +- src/engine/objects/Race.java | 50 +++++++++++++++++++ src/engine/objects/Zone.java | 4 +- 7 files changed, 61 insertions(+), 9 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 2a1e611d..8463e136 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -152,7 +152,8 @@ public class Enum { NEPHFEMALE(2026, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f), HALFGIANTFEMALE(2027, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.15f), VAMPMALE(2028, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.MALE, 1), - VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1); + VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1), + SAETOR(1999, MonsterType.Monster, RunSpeed.STANDARD, CharacterSex.MALE, 0.80000001f); @SuppressWarnings("unchecked") private static HashMap _raceTypeByID = new HashMap<>(); diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index 176aaf36..3909028d 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -116,8 +116,8 @@ public class HeightMap { this.heightMapID = 999999; this.maxHeight = 5; // for real... - int halfExtentsX = (int) Enum.CityBoundsType.GRID.extents; - int halfExtentsY = (int) Enum.CityBoundsType.GRID.extents; + int halfExtentsX = (int) Enum.CityBoundsType.ZONE.extents; + int halfExtentsY = (int) Enum.CityBoundsType.ZONE.extents; this.zoneLoadID = 0; this.seaLevel = 0; this.outsetX = 128; diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index 86da5405..c5f59add 100644 --- a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java +++ b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java @@ -805,7 +805,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Update guild binds and tags //load the new city on the clients - CityZoneMsg czm = new CityZoneMsg(1, treeObject.getLoc().x, treeObject.getLoc().y, treeObject.getLoc().z, cityObject.getCityName(), zoneObject, Enum.CityBoundsType.GRID.extents, Enum.CityBoundsType.GRID.extents); + CityZoneMsg czm = new CityZoneMsg(1, treeObject.getLoc().x, treeObject.getLoc().y, treeObject.getLoc().z, cityObject.getCityName(), zoneObject, Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents); DispatchMessage.dispatchMsgToAll(czm); GuildManager.updateAllGuildBinds(playerNation, cityObject); diff --git a/src/engine/net/client/msg/CityZoneMsg.java b/src/engine/net/client/msg/CityZoneMsg.java index dc8d6564..684fa0c1 100644 --- a/src/engine/net/client/msg/CityZoneMsg.java +++ b/src/engine/net/client/msg/CityZoneMsg.java @@ -43,8 +43,8 @@ public class CityZoneMsg extends ClientNetMsg { this.locY = locY; this.locZ = locZ; this.name = name; - this.radiusX = Enum.CityBoundsType.GRID.extents; - this.radiusZ = Enum.CityBoundsType.GRID.extents; + this.radiusX = Enum.CityBoundsType.ZONE.extents; + this.radiusZ = Enum.CityBoundsType.ZONE.extents; this.unknown01 = 0; } diff --git a/src/engine/net/client/msg/login/CommitNewCharacterMsg.java b/src/engine/net/client/msg/login/CommitNewCharacterMsg.java index 673656cf..43766a9a 100644 --- a/src/engine/net/client/msg/login/CommitNewCharacterMsg.java +++ b/src/engine/net/client/msg/login/CommitNewCharacterMsg.java @@ -15,6 +15,7 @@ import engine.net.ByteBufferReader; import engine.net.ByteBufferWriter; import engine.net.client.Protocol; import engine.net.client.msg.ClientNetMsg; +import engine.objects.Race; public class CommitNewCharacterMsg extends ClientNetMsg { @@ -175,7 +176,7 @@ public class CommitNewCharacterMsg extends ClientNetMsg { public int getRace() { for (int i = 0; i < 23; i++) - if (this.runes[i] > 1999 && this.runes[i] < 2030) + if(Race.getRace(this.runes[i]) != null) return this.runes[i]; return 0; } diff --git a/src/engine/objects/Race.java b/src/engine/objects/Race.java index 93ef9426..5eb0228b 100644 --- a/src/engine/objects/Race.java +++ b/src/engine/objects/Race.java @@ -12,6 +12,7 @@ package engine.objects; import engine.Enum; import engine.Enum.RaceType; import engine.gameManager.DbManager; +import engine.math.Vector3f; import engine.net.ByteBufferWriter; import engine.server.MBServerStatics; @@ -107,8 +108,57 @@ public class Race { } + //Custom Race constructor + Race(int id, String name, String description, Vector3f str,Vector3f dex, Vector3f con, Vector3f intel, Vector3f spi,byte startingPoints,int token, short healthBonus, short stamBonus,float minHeight, short manaBonus,ArrayList baseClasses,ArrayList skillsGranted,ArrayList powersGranted,ArrayList effectsList){ + this.raceRuneID = id; + this.raceType = Enum.RaceType.getRaceTypebyRuneID(raceRuneID); + this.name = name; + this.description = description; + this.strStart = (short)str.x; + this.strMin = (short)str.y; + this.strMax = (short)str.z; + this.dexStart = (short)dex.x; + this.dexMin = (short)dex.y; + this.dexMax = (short)dex.z; + this.conStart = (short)con.x; + this.conMin = (short)con.y; + this.conMax = (short)con.z; + this.intStart = (short)intel.x; + this.intMin = (short)intel.y; + this.intMax = (short)intel.z; + this.spiStart = (short)spi.x; + this.spiMin = (short)spi.y; + this.spiMax = (short)spi.z; + this.token = token; + this.healthBonus = healthBonus; + this.manaBonus = manaBonus; + this.staminaBonus = stamBonus; + this.startingPoints = startingPoints; + this.raceType = RaceType.getRaceTypebyRuneID(this.raceRuneID); + this.minHeight = minHeight; + this.strHeightMod = 0.005882f; + this.hairStyles = null; + this.beardStyles = null; + this.skinColors = null; + this.beardColors = null; + this.hairColors = null; + this.baseClasses = baseClasses; + this.skillsGranted = skillsGranted; + this.powersGranted = powersGranted; + this.effectsList = effectsList; + } + public static void loadAllRaces() { Race._raceByID = DbManager.RaceQueries.LOAD_ALL_RACES(); + + //create Saetor race + ArrayList baseClassesSaetor = new ArrayList<>(); + ArrayList skillsGrantedSaetor = new ArrayList<>(); + ArrayList powersGrantedSaetor = new ArrayList<>(); + ArrayList effectsListSaetor = new ArrayList<>(); + Race saetor = new Race(1999,"Saetor","Half goat half man, the Saetor race does the bidding of the Choas Gods.",new Vector3f(35,30,85),new Vector3f(55,50,120),new Vector3f(50,45,115),new Vector3f(45,40,110),new Vector3f(35,30,85),(byte)10,19991999,(short)0,(short)0,5.0f,(short)0,baseClassesSaetor,skillsGrantedSaetor,powersGrantedSaetor,effectsListSaetor); + Race._raceByID.put(1999,saetor); + } public static Race getRace(int id) { diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index f95f8f49..45314553 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -113,8 +113,8 @@ public class Zone extends AbstractGameObject { if (zone.playerCityID > 0) { writer.put((byte) 1); // Player City - True - writer.putFloat(Enum.CityBoundsType.GRID.extents); - writer.putFloat(Enum.CityBoundsType.GRID.extents); + writer.putFloat(Enum.CityBoundsType.ZONE.extents); + writer.putFloat(Enum.CityBoundsType.ZONE.extents); } else writer.put((byte) 0); // Player City - False