Browse Source

Merge branch 'magicbox1.5' of http://repo.magicbane.com/MagicBane/Server into magicbox1.5

master
FatBoy-DOTC 1 year ago
parent
commit
9a68509847
  1. 206
      src/engine/Enum.java
  2. 7
      src/engine/ai/MobileFSMManager.java
  3. 9
      src/engine/gameManager/ConfigManager.java
  4. 5
      src/engine/gameManager/ZoneManager.java
  5. 3
      src/engine/objects/PlayerCharacter.java

206
src/engine/Enum.java

@ -9,6 +9,7 @@
package engine; package engine;
import ch.claude_martin.enumbitset.EnumBitSetHelper; import ch.claude_martin.enumbitset.EnumBitSetHelper;
import engine.gameManager.ConfigManager;
import engine.gameManager.PowersManager; import engine.gameManager.PowersManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector2f; import engine.math.Vector2f;
@ -143,18 +144,10 @@ public class Enum {
this.scaleHeight = scaleHeight; this.scaleHeight = scaleHeight;
} }
public int getRuneID() {
return this.runeID;
}
public static RaceType getRaceTypebyRuneID(int runeID) { public static RaceType getRaceTypebyRuneID(int runeID) {
return _raceTypeByID.get(runeID); return _raceTypeByID.get(runeID);
} }
public float getScaleHeight(){
return this.scaleHeight;
}
public static void initRaceTypeTables() { public static void initRaceTypeTables() {
for (RaceType raceType : RaceType.values()) { for (RaceType raceType : RaceType.values()) {
@ -162,6 +155,14 @@ public class Enum {
} }
} }
public int getRuneID() {
return this.runeID;
}
public float getScaleHeight() {
return this.scaleHeight;
}
public MonsterType getMonsterType() { public MonsterType getMonsterType() {
return monsterType; return monsterType;
} }
@ -217,11 +218,6 @@ public class Enum {
return runCombat; return runCombat;
} }
public float getSwim() {
return swim;
}
public float getFlyRun() { public float getFlyRun() {
return flyRun; return flyRun;
} }
@ -256,10 +252,6 @@ public class Enum {
this.listType = listType; this.listType = listType;
} }
public int getListType() {
return this.listType;
}
public static FriendListType getListTypeByID(int listType) { public static FriendListType getListTypeByID(int listType) {
FriendListType outType = null; FriendListType outType = null;
@ -270,6 +262,7 @@ public class Enum {
} }
return outType; return outType;
} }
} }
public enum DispatchChannel { public enum DispatchChannel {
@ -334,10 +327,6 @@ public class Enum {
this.meshID = meshID; this.meshID = meshID;
} }
public int getMeshID() {
return meshID;
}
public static CharterType getCharterTypeByID(int charterID) { public static CharterType getCharterTypeByID(int charterID) {
CharterType outType = null; CharterType outType = null;
@ -347,6 +336,10 @@ public class Enum {
} }
return outType; return outType;
} }
public int getMeshID() {
return meshID;
}
} }
@ -424,8 +417,14 @@ public class Enum {
this.zoneUUID = uuid; this.zoneUUID = uuid;
} }
public int getZoneUUID() { public static Ruins getRandomRuin() {
return this.zoneUUID;
Ruins ruins;
ruins = Ruins.values()[ThreadLocalRandom.current()
.nextInt(Ruins.values().length)];
return ruins;
} }
public Vector3fImmutable getLocation() { public Vector3fImmutable getLocation() {
@ -433,20 +432,25 @@ public class Enum {
Zone ruinZone; Zone ruinZone;
Vector3fImmutable spawnLocation; Vector3fImmutable spawnLocation;
// Send to SDR if so configured
if (ConfigManager.MB_USE_RUINS.getValue().equalsIgnoreCase("true")) {
ruinZone = ZoneManager.getZoneByUUID(this.zoneUUID); ruinZone = ZoneManager.getZoneByUUID(this.zoneUUID);
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30); spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
} else {
ruinZone = ZoneManager.getZoneByName("sea dog's rest");
return spawnLocation; // 14001 does not have a banestone to bind at
}
public static Ruins getRandomRuin() { if (ruinZone.getLoadNum() == 14001)
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
Ruins ruins; else
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
}
ruins = Ruins.values()[ThreadLocalRandom.current()
.nextInt(Ruins.values().length)];
return ruins; return spawnLocation;
} }
} }
@ -562,8 +566,8 @@ public class Enum {
RESOURCE(34), RESOURCE(34),
REALMCHARTER(35); REALMCHARTER(35);
private final int _value;
private final static HashMap<Integer, ItemType> _typeLookup = new HashMap<>(); private final static HashMap<Integer, ItemType> _typeLookup = new HashMap<>();
private final int _value;
ItemType(int value) { ItemType(int value) {
this._value = value; this._value = value;
@ -630,22 +634,6 @@ public class Enum {
this.token = token; this.token = token;
} }
public int getBlueprintUUID() {
return blueprintUUID;
}
public int getEffectFlag() {
return effectFlag;
}
public int getToken() {
return token;
}
public EffectsBase getEffectBase() {
return PowersManager.getEffectByToken(token);
}
public static SpireType getByBlueprintUUID(int uuid) { public static SpireType getByBlueprintUUID(int uuid) {
SpireType outType = SpireType.GROUNDING; SpireType outType = SpireType.GROUNDING;
@ -662,6 +650,22 @@ public class Enum {
return outType; return outType;
} }
public int getBlueprintUUID() {
return blueprintUUID;
}
public int getEffectFlag() {
return effectFlag;
}
public int getToken() {
return token;
}
public EffectsBase getEffectBase() {
return PowersManager.getEffectByToken(token);
}
} }
public enum TransactionType { public enum TransactionType {
@ -755,6 +759,7 @@ public class Enum {
Powerblock, Powerblock,
Steel, Steel,
Drain; Drain;
public static DamageType GetDamageType(String modName) { public static DamageType GetDamageType(String modName) {
DamageType damageType; DamageType damageType;
if (modName.isEmpty()) if (modName.isEmpty())
@ -923,6 +928,7 @@ public class Enum {
VAMPDRAIN, VAMPDRAIN,
WEAPON, WEAPON,
Wizardry; Wizardry;
public static SourceType GetSourceType(String modName) { public static SourceType GetSourceType(String modName) {
SourceType returnMod; SourceType returnMod;
if (modName.isEmpty()) if (modName.isEmpty())
@ -1120,6 +1126,7 @@ public class Enum {
Track, Track,
Transform, Transform,
WeaponMove; WeaponMove;
public static StackType GetStackType(String modName) { public static StackType GetStackType(String modName) {
StackType stackType; StackType stackType;
if (modName.isEmpty()) if (modName.isEmpty())
@ -1220,6 +1227,7 @@ public class Enum {
return modType; return modType;
} }
} }
public enum MovementState { public enum MovementState {
IDLE, IDLE,
@ -1355,18 +1363,28 @@ public class Enum {
this.reqLvl = reqLvl; this.reqLvl = reqLvl;
} }
public long getFlag() { public static CharacterSkills GetCharacterSkillByToken(int token) {
return flag; for (CharacterSkills skill : CharacterSkills.values()) {
if (skill.token == token)
return skill;
} }
public int getReqLvl() { Logger.info("Returned No Skill for token " + token + ". Defaulting to Axe");
return this.reqLvl; return CharacterSkills.Axe;
}
public long getFlag() {
return flag;
} }
public void setFlag(long flag) { public void setFlag(long flag) {
this.flag = flag; this.flag = flag;
} }
public int getReqLvl() {
return this.reqLvl;
}
public int getToken() { public int getToken() {
return token; return token;
} }
@ -1374,16 +1392,6 @@ public class Enum {
public void setToken(int token) { public void setToken(int token) {
this.token = token; this.token = token;
} }
public static CharacterSkills GetCharacterSkillByToken(int token) {
for (CharacterSkills skill : CharacterSkills.values()) {
if (skill.token == token)
return skill;
}
Logger.info("Returned No Skill for token " + token + ". Defaulting to Axe");
return CharacterSkills.Axe;
}
} }
; ;
@ -1440,7 +1448,8 @@ public class Enum {
Warrior(SexType.NONE), Warrior(SexType.NONE),
Wizard(SexType.NONE), Wizard(SexType.NONE),
Nightstalker(SexType.NONE), Nightstalker(SexType.NONE),
Necromancer(SexType.NONE),; Necromancer(SexType.NONE),
;
private SexType sexRestriction; private SexType sexRestriction;
@ -2478,37 +2487,14 @@ public class Enum {
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}); new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"});
GuildType(String name, String[][] ranks, String[] leadershipTypes) {
this.name = name;
this.ranks = ranks;
this.leadershipTypes = leadershipTypes;
}
private final String name; private final String name;
private final String[][] ranks; //Stored Rank#->Gender(M,F) private final String[][] ranks; //Stored Rank#->Gender(M,F)
private final String[] leadershipTypes; private final String[] leadershipTypes;
public String getCharterName() { GuildType(String name, String[][] ranks, String[] leadershipTypes) {
return this.name; this.name = name;
} this.ranks = ranks;
this.leadershipTypes = leadershipTypes;
public int getNumberOfRanks() {
return ranks.length;
}
public String getRankForGender(int rank, boolean male) {
if(ranks.length < rank) {
return "";
}
if(ranks[rank].length != 1 && !male) {
return ranks[rank][1];
}
return ranks[rank][0];
}
public String getLeadershipType(int i) {
return leadershipTypes[i];
} }
public static GuildType getGuildTypeFromCharter(ItemBase itemBase) { public static GuildType getGuildTypeFromCharter(ItemBase itemBase) {
@ -2595,6 +2581,29 @@ public class Enum {
return GuildType.values()[i]; return GuildType.values()[i];
} }
public String getCharterName() {
return this.name;
}
public int getNumberOfRanks() {
return ranks.length;
}
public String getRankForGender(int rank, boolean male) {
if (ranks.length < rank) {
return "";
}
if (ranks[rank].length != 1 && !male) {
return ranks[rank][1];
}
return ranks[rank][0];
}
public String getLeadershipType(int i) {
return leadershipTypes[i];
}
} }
public enum MinionClass { public enum MinionClass {
@ -2639,14 +2648,13 @@ public class Enum {
UNDEADMAGE(980102, 1675, MinionClass.MAGE, "Adept", "Undead"), UNDEADMAGE(980102, 1675, MinionClass.MAGE, "Adept", "Undead"),
WEREWOLFGUARD(980104, 0, MinionClass.MELEE, "Guard", "Werewolf"), WEREWOLFGUARD(980104, 0, MinionClass.MELEE, "Guard", "Werewolf"),
WEREBEARGUARD(980103, 0, MinionClass.MELEE, "Guard", "Werebear"); WEREBEARGUARD(980103, 0, MinionClass.MELEE, "Guard", "Werebear");
public static HashMap<Integer, MinionType> ContractToMinionMap = new HashMap<>();
private final int captainContractID; private final int captainContractID;
private final int equipSetID; private final int equipSetID;
private final MinionClass minionClass; private final MinionClass minionClass;
private final String name; private final String name;
private final String race; private final String race;
public static HashMap<Integer,MinionType> ContractToMinionMap = new HashMap<>();
MinionType(int captainContractID, int equipSetID, MinionClass minionClass, String name, String race) { MinionType(int captainContractID, int equipSetID, MinionClass minionClass, String name, String race) {
this.captainContractID = captainContractID; this.captainContractID = captainContractID;
@ -2663,18 +2671,6 @@ public class Enum {
ContractToMinionMap.put(minionType.captainContractID, minionType); ContractToMinionMap.put(minionType.captainContractID, minionType);
} }
public int getCaptainContractID() {
return captainContractID;
}
public int getEquipSetID() {
return equipSetID;
}
public MinionClass getMinionClass() {
return minionClass;
}
public String getName() { public String getName() {
return name; return name;
} }
@ -2699,8 +2695,8 @@ public class Enum {
ACCEPTTAX(7), ACCEPTTAX(7),
CONFIRMPROTECT(8); CONFIRMPROTECT(8);
private final int type;
public static HashMap<Integer, SupportMsgType> typeLookup = new HashMap<>(); public static HashMap<Integer, SupportMsgType> typeLookup = new HashMap<>();
private final int type;
SupportMsgType(int messageType) { SupportMsgType(int messageType) {
this.type = messageType; this.type = messageType;

7
src/engine/ai/MobileFSMManager.java

@ -47,10 +47,15 @@ public class MobileFSMManager {
}; };
alive = true; alive = true;
//assign the AI varibales base don difficulty scaling from config file: //assign the AI varibales base don difficulty scaling from config file:
float difficulty = Float.parseFloat(ConfigManager.MB_MOB_DIFFICULTY.getValue());
float difficulty = Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue());
AI_BASE_AGGRO_RANGE = (int) (100 * difficulty); // range at which aggressive mobs will attack you AI_BASE_AGGRO_RANGE = (int) (100 * difficulty); // range at which aggressive mobs will attack you
difficulty = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
AI_POWER_DIVISOR = (int) (20 * (1.5f - difficulty)); //duration between mob casts AI_POWER_DIVISOR = (int) (20 * (1.5f - difficulty)); //duration between mob casts
Thread t = new Thread(worker, "MobileFSMManager"); Thread t = new Thread(worker, "MobileFSMManager");
t.start(); t.start();
} }

9
src/engine/gameManager/ConfigManager.java

@ -61,6 +61,11 @@ public enum ConfigManager {
MB_WORLD_MAINTENANCE, MB_WORLD_MAINTENANCE,
MB_WORLD_GREETING, MB_WORLD_GREETING,
MB_WORLD_KEYCLONE_MAX, MB_WORLD_KEYCLONE_MAX,
MB_USE_RUINS,
// Mobile AI modifiers
MB_AI_CAST_FREQUENCY,
MB_AI_AGGRO_RANGE,
//drop rates //drop rates
MB_NORMAL_EXP_RATE, MB_NORMAL_EXP_RATE,
@ -86,9 +91,7 @@ public enum ConfigManager {
MB_MAGICBOT_FORTOFIX, MB_MAGICBOT_FORTOFIX,
MB_MAGICBOT_RECRUIT, MB_MAGICBOT_RECRUIT,
MB_MAGICBOT_MAGICBOX, MB_MAGICBOT_MAGICBOX,
MB_MAGICBOT_ADMINLOG, MB_MAGICBOT_ADMINLOG;
MB_MOB_DIFFICULTY;//0.1(easy) - 1.0(hard)
// Map to hold our config pulled in from the environment // Map to hold our config pulled in from the environment
// We also use the config to point to the current message pump // We also use the config to point to the current message pump

5
src/engine/gameManager/ZoneManager.java

@ -103,7 +103,6 @@ public enum ZoneManager {
ZoneManager.zonesByID.put(zoneID, zone); ZoneManager.zonesByID.put(zoneID, zone);
if (zone != null)
ZoneManager.zonesByUUID.put(zone.getObjectUUID(), zone); ZoneManager.zonesByUUID.put(zone.getObjectUUID(), zone);
ZoneManager.zonesByName.put(zone.getName().toLowerCase(), zone); ZoneManager.zonesByName.put(zone.getName().toLowerCase(), zone);
@ -144,6 +143,10 @@ public enum ZoneManager {
return ZoneManager.zonesByID.get(zoneID); return ZoneManager.zonesByID.get(zoneID);
} }
public static Zone getZoneByName(final String zoneName) {
return ZoneManager.zonesByName.get(zoneName);
}
public static final Collection<Zone> getAllZones() { public static final Collection<Zone> getAllZones() {
return ZoneManager.zonesByUUID.values(); return ZoneManager.zonesByUUID.values();
} }

3
src/engine/objects/PlayerCharacter.java

@ -879,14 +879,11 @@ public class PlayerCharacter extends AbstractCharacter {
//handle rented room binds. //handle rented room binds.
if (bindBuilding == null){ if (bindBuilding == null){
bindLocation = Enum.Ruins.getRandomRuin().getLocation(); bindLocation = Enum.Ruins.getRandomRuin().getLocation();
return bindLocation; return bindLocation;
} }
bindLocation = BuildingManager.GetBindLocationForBuilding(bindBuilding); bindLocation = BuildingManager.GetBindLocationForBuilding(bindBuilding);
if (bindLocation == null) if (bindLocation == null)

Loading…
Cancel
Save