forked from MagicBane/Server
Merge branch 'magicbox1.5' of http://repo.magicbane.com/MagicBane/Server into magicbox1.5
This commit is contained in:
+112
-116
@@ -9,6 +9,7 @@
|
||||
package engine;
|
||||
|
||||
import ch.claude_martin.enumbitset.EnumBitSetHelper;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector2f;
|
||||
@@ -143,18 +144,10 @@ public class Enum {
|
||||
this.scaleHeight = scaleHeight;
|
||||
}
|
||||
|
||||
public int getRuneID() {
|
||||
return this.runeID;
|
||||
}
|
||||
|
||||
public static RaceType getRaceTypebyRuneID(int runeID) {
|
||||
return _raceTypeByID.get(runeID);
|
||||
}
|
||||
|
||||
public float getScaleHeight(){
|
||||
return this.scaleHeight;
|
||||
}
|
||||
|
||||
public static void initRaceTypeTables() {
|
||||
|
||||
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() {
|
||||
return monsterType;
|
||||
}
|
||||
@@ -217,11 +218,6 @@ public class Enum {
|
||||
return runCombat;
|
||||
}
|
||||
|
||||
public float getSwim() {
|
||||
return swim;
|
||||
}
|
||||
|
||||
|
||||
public float getFlyRun() {
|
||||
return flyRun;
|
||||
}
|
||||
@@ -256,10 +252,6 @@ public class Enum {
|
||||
this.listType = listType;
|
||||
}
|
||||
|
||||
public int getListType() {
|
||||
return this.listType;
|
||||
}
|
||||
|
||||
public static FriendListType getListTypeByID(int listType) {
|
||||
|
||||
FriendListType outType = null;
|
||||
@@ -270,6 +262,7 @@ public class Enum {
|
||||
}
|
||||
return outType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum DispatchChannel {
|
||||
@@ -334,10 +327,6 @@ public class Enum {
|
||||
this.meshID = meshID;
|
||||
}
|
||||
|
||||
public int getMeshID() {
|
||||
return meshID;
|
||||
}
|
||||
|
||||
public static CharterType getCharterTypeByID(int charterID) {
|
||||
CharterType outType = null;
|
||||
|
||||
@@ -347,6 +336,10 @@ public class Enum {
|
||||
}
|
||||
return outType;
|
||||
}
|
||||
|
||||
public int getMeshID() {
|
||||
return meshID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -424,21 +417,6 @@ public class Enum {
|
||||
this.zoneUUID = uuid;
|
||||
}
|
||||
|
||||
public int getZoneUUID() {
|
||||
return this.zoneUUID;
|
||||
}
|
||||
|
||||
public Vector3fImmutable getLocation() {
|
||||
|
||||
Zone ruinZone;
|
||||
Vector3fImmutable spawnLocation;
|
||||
|
||||
ruinZone = ZoneManager.getZoneByUUID(this.zoneUUID);
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||
|
||||
return spawnLocation;
|
||||
}
|
||||
|
||||
public static Ruins getRandomRuin() {
|
||||
|
||||
Ruins ruins;
|
||||
@@ -449,6 +427,32 @@ public class Enum {
|
||||
return ruins;
|
||||
}
|
||||
|
||||
public Vector3fImmutable getLocation() {
|
||||
|
||||
Zone ruinZone;
|
||||
Vector3fImmutable spawnLocation;
|
||||
|
||||
// Send to SDR if so configured
|
||||
|
||||
if (ConfigManager.MB_USE_RUINS.getValue().equalsIgnoreCase("true")) {
|
||||
ruinZone = ZoneManager.getZoneByUUID(this.zoneUUID);
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||
} else {
|
||||
ruinZone = ZoneManager.getZoneByName("sea dog's rest");
|
||||
|
||||
// 14001 does not have a banestone to bind at
|
||||
|
||||
if (ruinZone.getLoadNum() == 14001)
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||
else
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||
.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
||||
}
|
||||
|
||||
|
||||
return spawnLocation;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum Guards {
|
||||
@@ -562,8 +566,8 @@ public class Enum {
|
||||
RESOURCE(34),
|
||||
REALMCHARTER(35);
|
||||
|
||||
private final int _value;
|
||||
private final static HashMap<Integer, ItemType> _typeLookup = new HashMap<>();
|
||||
private final int _value;
|
||||
|
||||
ItemType(int value) {
|
||||
this._value = value;
|
||||
@@ -630,22 +634,6 @@ public class Enum {
|
||||
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) {
|
||||
|
||||
SpireType outType = SpireType.GROUNDING;
|
||||
@@ -662,6 +650,22 @@ public class Enum {
|
||||
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 {
|
||||
@@ -755,6 +759,7 @@ public class Enum {
|
||||
Powerblock,
|
||||
Steel,
|
||||
Drain;
|
||||
|
||||
public static DamageType GetDamageType(String modName) {
|
||||
DamageType damageType;
|
||||
if (modName.isEmpty())
|
||||
@@ -923,6 +928,7 @@ public class Enum {
|
||||
VAMPDRAIN,
|
||||
WEAPON,
|
||||
Wizardry;
|
||||
|
||||
public static SourceType GetSourceType(String modName) {
|
||||
SourceType returnMod;
|
||||
if (modName.isEmpty())
|
||||
@@ -1120,6 +1126,7 @@ public class Enum {
|
||||
Track,
|
||||
Transform,
|
||||
WeaponMove;
|
||||
|
||||
public static StackType GetStackType(String modName) {
|
||||
StackType stackType;
|
||||
if (modName.isEmpty())
|
||||
@@ -1220,6 +1227,7 @@ public class Enum {
|
||||
return modType;
|
||||
}
|
||||
}
|
||||
|
||||
public enum MovementState {
|
||||
|
||||
IDLE,
|
||||
@@ -1355,26 +1363,6 @@ public class Enum {
|
||||
this.reqLvl = reqLvl;
|
||||
}
|
||||
|
||||
public long getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public int getReqLvl() {
|
||||
return this.reqLvl;
|
||||
}
|
||||
|
||||
public void setFlag(long flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public int getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(int token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public static CharacterSkills GetCharacterSkillByToken(int token) {
|
||||
for (CharacterSkills skill : CharacterSkills.values()) {
|
||||
if (skill.token == token)
|
||||
@@ -1384,6 +1372,26 @@ public class Enum {
|
||||
Logger.info("Returned No Skill for token " + token + ". Defaulting to Axe");
|
||||
return CharacterSkills.Axe;
|
||||
}
|
||||
|
||||
public long getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(long flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public int getReqLvl() {
|
||||
return this.reqLvl;
|
||||
}
|
||||
|
||||
public int getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(int token) {
|
||||
this.token = token;
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
@@ -1440,7 +1448,8 @@ public class Enum {
|
||||
Warrior(SexType.NONE),
|
||||
Wizard(SexType.NONE),
|
||||
Nightstalker(SexType.NONE),
|
||||
Necromancer(SexType.NONE),;
|
||||
Necromancer(SexType.NONE),
|
||||
;
|
||||
|
||||
private SexType sexRestriction;
|
||||
|
||||
@@ -2478,37 +2487,14 @@ public class Enum {
|
||||
|
||||
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[][] ranks; //Stored Rank#->Gender(M,F)
|
||||
private final String[] leadershipTypes;
|
||||
|
||||
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];
|
||||
GuildType(String name, String[][] ranks, String[] leadershipTypes) {
|
||||
this.name = name;
|
||||
this.ranks = ranks;
|
||||
this.leadershipTypes = leadershipTypes;
|
||||
}
|
||||
|
||||
public static GuildType getGuildTypeFromCharter(ItemBase itemBase) {
|
||||
@@ -2595,6 +2581,29 @@ public class Enum {
|
||||
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 {
|
||||
@@ -2639,14 +2648,13 @@ public class Enum {
|
||||
UNDEADMAGE(980102, 1675, MinionClass.MAGE, "Adept", "Undead"),
|
||||
WEREWOLFGUARD(980104, 0, MinionClass.MELEE, "Guard", "Werewolf"),
|
||||
WEREBEARGUARD(980103, 0, MinionClass.MELEE, "Guard", "Werebear");
|
||||
public static HashMap<Integer, MinionType> ContractToMinionMap = new HashMap<>();
|
||||
private final int captainContractID;
|
||||
private final int equipSetID;
|
||||
private final MinionClass minionClass;
|
||||
private final String name;
|
||||
private final String race;
|
||||
|
||||
public static HashMap<Integer,MinionType> ContractToMinionMap = new HashMap<>();
|
||||
|
||||
MinionType(int captainContractID, int equipSetID, MinionClass minionClass, String name, String race) {
|
||||
|
||||
this.captainContractID = captainContractID;
|
||||
@@ -2663,18 +2671,6 @@ public class Enum {
|
||||
ContractToMinionMap.put(minionType.captainContractID, minionType);
|
||||
}
|
||||
|
||||
public int getCaptainContractID() {
|
||||
return captainContractID;
|
||||
}
|
||||
|
||||
public int getEquipSetID() {
|
||||
return equipSetID;
|
||||
}
|
||||
|
||||
public MinionClass getMinionClass() {
|
||||
return minionClass;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -2699,8 +2695,8 @@ public class Enum {
|
||||
ACCEPTTAX(7),
|
||||
CONFIRMPROTECT(8);
|
||||
|
||||
private final int type;
|
||||
public static HashMap<Integer, SupportMsgType> typeLookup = new HashMap<>();
|
||||
private final int type;
|
||||
|
||||
SupportMsgType(int messageType) {
|
||||
this.type = messageType;
|
||||
|
||||
@@ -47,10 +47,15 @@ public class MobileFSMManager {
|
||||
};
|
||||
|
||||
alive = true;
|
||||
|
||||
//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
|
||||
|
||||
difficulty = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
|
||||
AI_POWER_DIVISOR = (int) (20 * (1.5f - difficulty)); //duration between mob casts
|
||||
|
||||
Thread t = new Thread(worker, "MobileFSMManager");
|
||||
t.start();
|
||||
}
|
||||
|
||||
@@ -61,6 +61,11 @@ public enum ConfigManager {
|
||||
MB_WORLD_MAINTENANCE,
|
||||
MB_WORLD_GREETING,
|
||||
MB_WORLD_KEYCLONE_MAX,
|
||||
MB_USE_RUINS,
|
||||
|
||||
// Mobile AI modifiers
|
||||
MB_AI_CAST_FREQUENCY,
|
||||
MB_AI_AGGRO_RANGE,
|
||||
|
||||
//drop rates
|
||||
MB_NORMAL_EXP_RATE,
|
||||
@@ -86,9 +91,7 @@ public enum ConfigManager {
|
||||
MB_MAGICBOT_FORTOFIX,
|
||||
MB_MAGICBOT_RECRUIT,
|
||||
MB_MAGICBOT_MAGICBOX,
|
||||
MB_MAGICBOT_ADMINLOG,
|
||||
|
||||
MB_MOB_DIFFICULTY;//0.1(easy) - 1.0(hard)
|
||||
MB_MAGICBOT_ADMINLOG;
|
||||
|
||||
// Map to hold our config pulled in from the environment
|
||||
// We also use the config to point to the current message pump
|
||||
|
||||
@@ -103,7 +103,6 @@ public enum ZoneManager {
|
||||
|
||||
ZoneManager.zonesByID.put(zoneID, zone);
|
||||
|
||||
if (zone != null)
|
||||
ZoneManager.zonesByUUID.put(zone.getObjectUUID(), zone);
|
||||
|
||||
ZoneManager.zonesByName.put(zone.getName().toLowerCase(), zone);
|
||||
@@ -144,6 +143,10 @@ public enum ZoneManager {
|
||||
return ZoneManager.zonesByID.get(zoneID);
|
||||
}
|
||||
|
||||
public static Zone getZoneByName(final String zoneName) {
|
||||
return ZoneManager.zonesByName.get(zoneName);
|
||||
}
|
||||
|
||||
public static final Collection<Zone> getAllZones() {
|
||||
return ZoneManager.zonesByUUID.values();
|
||||
}
|
||||
|
||||
@@ -879,14 +879,11 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
//handle rented room binds.
|
||||
|
||||
|
||||
if (bindBuilding == null){
|
||||
bindLocation = Enum.Ruins.getRandomRuin().getLocation();
|
||||
return bindLocation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bindLocation = BuildingManager.GetBindLocationForBuilding(bindBuilding);
|
||||
|
||||
if (bindLocation == null)
|
||||
|
||||
Reference in New Issue
Block a user