Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 221ae0a58b | |||
| 3649c629b7 | |||
| 1c31070fc8 | |||
| bff41967db | |||
| d3692d0fb7 | |||
| 074a799d01 | |||
| 36ffd08a72 | |||
| 58f828b3cd |
+132
-272
@@ -46,7 +46,7 @@ public class Enum {
|
|||||||
EXPLOIT,
|
EXPLOIT,
|
||||||
BUG,
|
BUG,
|
||||||
GAME_STOPPER,
|
GAME_STOPPER,
|
||||||
TECH_SUPPORT
|
TECH_SUPPORT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class Enum {
|
|||||||
Undead,
|
Undead,
|
||||||
Nephilim,
|
Nephilim,
|
||||||
Vampire,
|
Vampire,
|
||||||
SiegeEngineer
|
SiegeEngineer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ public class Enum {
|
|||||||
MALE,
|
MALE,
|
||||||
FEMALE,
|
FEMALE,
|
||||||
FUZZY,
|
FUZZY,
|
||||||
OTHER
|
OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RaceType {
|
public enum RaceType {
|
||||||
@@ -155,13 +155,13 @@ public class Enum {
|
|||||||
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1);
|
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static final HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
|
private static HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
|
||||||
|
|
||||||
int runeID;
|
int runeID;
|
||||||
private final MonsterType monsterType;
|
private MonsterType monsterType;
|
||||||
private final CharacterSex characterSex;
|
private CharacterSex characterSex;
|
||||||
private final RunSpeed runSpeed;
|
private RunSpeed runSpeed;
|
||||||
private final float scaleHeight;
|
private float scaleHeight;
|
||||||
|
|
||||||
RaceType(int runeID, MonsterType aggroType, RunSpeed runspeed, CharacterSex characterSex, float scaleHeight) {
|
RaceType(int runeID, MonsterType aggroType, RunSpeed runspeed, CharacterSex characterSex, float scaleHeight) {
|
||||||
this.runeID = runeID;
|
this.runeID = runeID;
|
||||||
@@ -210,13 +210,13 @@ public class Enum {
|
|||||||
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
||||||
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f);
|
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f);
|
||||||
|
|
||||||
private final float walkStandard;
|
private float walkStandard;
|
||||||
private final float walkCombat;
|
private float walkCombat;
|
||||||
private final float runStandard;
|
private float runStandard;
|
||||||
private final float runCombat;
|
private float runCombat;
|
||||||
private final float swim;
|
private float swim;
|
||||||
private final float flyRun;
|
private float flyRun;
|
||||||
private final float flyWalk;
|
private float flyWalk;
|
||||||
|
|
||||||
RunSpeed(float walkStandard, float runStandard, float walkCombat, float runCombat, float flyWalk, float flyRun, float swim) {
|
RunSpeed(float walkStandard, float runStandard, float walkCombat, float runCombat, float flyWalk, float flyRun, float swim) {
|
||||||
this.walkStandard = walkStandard;
|
this.walkStandard = walkStandard;
|
||||||
@@ -310,13 +310,13 @@ public class Enum {
|
|||||||
|
|
||||||
public enum PvpHistoryType {
|
public enum PvpHistoryType {
|
||||||
KILLS,
|
KILLS,
|
||||||
DEATHS
|
DEATHS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ChatMessageType {
|
public enum ChatMessageType {
|
||||||
ERROR,
|
ERROR,
|
||||||
INFO,
|
INFO,
|
||||||
MOTD
|
MOTD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DataRecordType {
|
public enum DataRecordType {
|
||||||
@@ -327,7 +327,7 @@ public class Enum {
|
|||||||
CITY,
|
CITY,
|
||||||
ZONE,
|
ZONE,
|
||||||
REALM,
|
REALM,
|
||||||
MINE
|
MINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RecordEventType {
|
public enum RecordEventType {
|
||||||
@@ -338,7 +338,7 @@ public class Enum {
|
|||||||
TRANSFER,
|
TRANSFER,
|
||||||
PENDING,
|
PENDING,
|
||||||
DEFEND,
|
DEFEND,
|
||||||
LOST // Realm event
|
LOST; // Realm event
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CharterType {
|
public enum CharterType {
|
||||||
@@ -346,8 +346,8 @@ public class Enum {
|
|||||||
MERCANTILE(-15978914, 5060400),
|
MERCANTILE(-15978914, 5060400),
|
||||||
BELLIGERENT(762228431, 5060800);
|
BELLIGERENT(762228431, 5060800);
|
||||||
|
|
||||||
private final int charterID;
|
private int charterID;
|
||||||
private final int meshID;
|
private int meshID;
|
||||||
|
|
||||||
CharterType(int charterID, int meshID) {
|
CharterType(int charterID, int meshID) {
|
||||||
this.charterID = charterID;
|
this.charterID = charterID;
|
||||||
@@ -402,7 +402,7 @@ public class Enum {
|
|||||||
Npc,
|
Npc,
|
||||||
PlayerCharacter,
|
PlayerCharacter,
|
||||||
Account,
|
Account,
|
||||||
Mob
|
Mob;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SiegePhase {
|
public enum SiegePhase {
|
||||||
@@ -410,20 +410,20 @@ public class Enum {
|
|||||||
CHALLENGE,
|
CHALLENGE,
|
||||||
STANDOFF,
|
STANDOFF,
|
||||||
WAR,
|
WAR,
|
||||||
CEASEFIRE
|
CEASEFIRE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SiegeResult {
|
public enum SiegeResult {
|
||||||
PENDING,
|
PENDING,
|
||||||
DEFEND,
|
DEFEND,
|
||||||
DESTROY,
|
DESTROY,
|
||||||
CAPTURE
|
CAPTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TaxType {
|
public enum TaxType {
|
||||||
PROFIT,
|
PROFIT,
|
||||||
WEEKLY,
|
WEEKLY,
|
||||||
NONE
|
NONE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +469,7 @@ public class Enum {
|
|||||||
|
|
||||||
// 14001 does not have a banestone to bind at
|
// 14001 does not have a banestone to bind at
|
||||||
|
|
||||||
if (ruinZone.templateID == 14001)
|
if (ruinZone.getLoadNum() == 14001)
|
||||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||||
else
|
else
|
||||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||||
@@ -1261,7 +1261,7 @@ public class Enum {
|
|||||||
SITTING,
|
SITTING,
|
||||||
RUNNING,
|
RUNNING,
|
||||||
FLYING,
|
FLYING,
|
||||||
SWIMMING
|
SWIMMING;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DoorState {
|
public enum DoorState {
|
||||||
@@ -1269,7 +1269,7 @@ public class Enum {
|
|||||||
OPEN,
|
OPEN,
|
||||||
CLOSED,
|
CLOSED,
|
||||||
LOCKED,
|
LOCKED,
|
||||||
UNLOCKED
|
UNLOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used with stored procedure GET_UID_ENUM() for
|
// Used with stored procedure GET_UID_ENUM() for
|
||||||
@@ -1290,9 +1290,11 @@ public class Enum {
|
|||||||
SHRINE,
|
SHRINE,
|
||||||
WORLDSERVER,
|
WORLDSERVER,
|
||||||
ZONE,
|
ZONE,
|
||||||
WAREHOUSE
|
WAREHOUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enumeration of Building Protection Status stored in the database as a
|
* Enumeration of Building Protection Status stored in the database as a
|
||||||
* mysql enumfield. WARNING: This enumeration is fragile. Do not rename. Do
|
* mysql enumfield. WARNING: This enumeration is fragile. Do not rename. Do
|
||||||
@@ -1307,63 +1309,10 @@ public class Enum {
|
|||||||
CONTRACT,
|
CONTRACT,
|
||||||
DESTROYED,
|
DESTROYED,
|
||||||
PENDING,
|
PENDING,
|
||||||
NPC
|
NPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DisciplineType {
|
;
|
||||||
|
|
||||||
Alchemist,
|
|
||||||
Animator,
|
|
||||||
Archer,
|
|
||||||
Berserker,
|
|
||||||
BlackMask,
|
|
||||||
Blacksmith,
|
|
||||||
BladeMaster,
|
|
||||||
BladeWeaver,
|
|
||||||
BloodProphet,
|
|
||||||
BountyHunter,
|
|
||||||
Clanwarden,
|
|
||||||
Commander,
|
|
||||||
DarkKnight,
|
|
||||||
Duelist,
|
|
||||||
ForgeMaster,
|
|
||||||
GiantKiller,
|
|
||||||
Gladiator,
|
|
||||||
Huntsman,
|
|
||||||
Knight,
|
|
||||||
RatCatcher,
|
|
||||||
RuneCaster,
|
|
||||||
Enchanter,
|
|
||||||
StormLord,
|
|
||||||
Summoner,
|
|
||||||
Sundancer,
|
|
||||||
Trainer,
|
|
||||||
Traveler,
|
|
||||||
UndeadHunter,
|
|
||||||
Werebear,
|
|
||||||
Wererat,
|
|
||||||
Werewolf,
|
|
||||||
Wyrmslayer,
|
|
||||||
Conjurer,
|
|
||||||
Darksworn,
|
|
||||||
Valkyr,
|
|
||||||
BloodHorn,
|
|
||||||
Shroudborne,
|
|
||||||
Archmage,
|
|
||||||
Thrall,
|
|
||||||
Artillerist,
|
|
||||||
Savant,
|
|
||||||
SkyDancer,
|
|
||||||
Prospector,
|
|
||||||
Belgosch,
|
|
||||||
Drannok,
|
|
||||||
Gorgoi,
|
|
||||||
Strigoi,
|
|
||||||
Sapper,
|
|
||||||
Saboteur,
|
|
||||||
BattleMagus,
|
|
||||||
Sanctifier,
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum CharacterSkills {
|
public enum CharacterSkills {
|
||||||
|
|
||||||
@@ -1433,7 +1382,7 @@ public class Enum {
|
|||||||
|
|
||||||
private long flag;
|
private long flag;
|
||||||
private int token;
|
private int token;
|
||||||
private final int reqLvl;
|
private int reqLvl;
|
||||||
|
|
||||||
CharacterSkills(long flag, int token, int reqLvl) {
|
CharacterSkills(long flag, int token, int reqLvl) {
|
||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
@@ -1472,6 +1421,8 @@ public class Enum {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
public enum GuildHistoryType {
|
public enum GuildHistoryType {
|
||||||
JOIN(1),
|
JOIN(1),
|
||||||
LEAVE(4),
|
LEAVE(4),
|
||||||
@@ -1492,14 +1443,17 @@ public class Enum {
|
|||||||
public enum SexType {
|
public enum SexType {
|
||||||
NONE,
|
NONE,
|
||||||
MALE,
|
MALE,
|
||||||
FEMALE
|
FEMALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ClassType {
|
public enum ClassType {
|
||||||
Fighter(SexType.NONE),
|
FIGHTER,
|
||||||
Healer(SexType.NONE),
|
HEALER,
|
||||||
Rogue(SexType.NONE),
|
ROGUE,
|
||||||
Mage(SexType.NONE),
|
MAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum PromoteType {
|
||||||
Assassin(SexType.NONE),
|
Assassin(SexType.NONE),
|
||||||
Barbarian(SexType.NONE),
|
Barbarian(SexType.NONE),
|
||||||
Bard(SexType.NONE),
|
Bard(SexType.NONE),
|
||||||
@@ -1524,9 +1478,9 @@ public class Enum {
|
|||||||
Necromancer(SexType.NONE),
|
Necromancer(SexType.NONE),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final SexType sexRestriction;
|
private SexType sexRestriction;
|
||||||
|
|
||||||
ClassType(SexType sexRestriction) {
|
PromoteType(SexType sexRestriction) {
|
||||||
this.sexRestriction = sexRestriction;
|
this.sexRestriction = sexRestriction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1706,13 +1660,13 @@ public class Enum {
|
|||||||
REGEN,
|
REGEN,
|
||||||
FLIGHT,
|
FLIGHT,
|
||||||
LOCATION,
|
LOCATION,
|
||||||
MOVEMENTSTATE
|
MOVEMENTSTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ServerType {
|
public enum ServerType {
|
||||||
WORLDSERVER,
|
WORLDSERVER,
|
||||||
LOGINSERVER,
|
LOGINSERVER,
|
||||||
NONE
|
NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ChatChannel implements EnumBitSetHelper<ChatChannel> {
|
public enum ChatChannel implements EnumBitSetHelper<ChatChannel> {
|
||||||
@@ -1766,7 +1720,7 @@ public class Enum {
|
|||||||
Thief,
|
Thief,
|
||||||
Warlock,
|
Warlock,
|
||||||
Warrior,
|
Warrior,
|
||||||
Wizard
|
Wizard;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1774,13 +1728,13 @@ public class Enum {
|
|||||||
RecommendedAlly,
|
RecommendedAlly,
|
||||||
RecommendedEnemy,
|
RecommendedEnemy,
|
||||||
Ally,
|
Ally,
|
||||||
Enemy
|
Enemy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FriendStatus {
|
public enum FriendStatus {
|
||||||
Available,
|
Available,
|
||||||
Away,
|
Away,
|
||||||
Busy
|
Busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ProfitType {
|
public enum ProfitType {
|
||||||
@@ -1795,7 +1749,7 @@ public class Enum {
|
|||||||
|
|
||||||
public String dbField;
|
public String dbField;
|
||||||
|
|
||||||
ProfitType(String dbField) {
|
private ProfitType(String dbField) {
|
||||||
this.dbField = dbField;
|
this.dbField = dbField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1888,15 +1842,17 @@ public class Enum {
|
|||||||
WorldServerInfoSnapshot,
|
WorldServerInfoSnapshot,
|
||||||
Shrine,
|
Shrine,
|
||||||
Zone,
|
Zone,
|
||||||
Transaction
|
Transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ContainerType {
|
public enum ContainerType {
|
||||||
BANK,
|
BANK,
|
||||||
INVENTORY,
|
INVENTORY,
|
||||||
VAULT
|
VAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
public enum CompoundCurveType {
|
public enum CompoundCurveType {
|
||||||
DefaultFlat(0),
|
DefaultFlat(0),
|
||||||
DefaultSlope(1),
|
DefaultSlope(1),
|
||||||
@@ -2204,7 +2160,7 @@ public class Enum {
|
|||||||
|
|
||||||
private final double value;
|
private final double value;
|
||||||
|
|
||||||
CompoundCurveType(double value) {
|
private CompoundCurveType(double value) {
|
||||||
|
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
@@ -2227,7 +2183,7 @@ public class Enum {
|
|||||||
Sit,
|
Sit,
|
||||||
TakeDamage,
|
TakeDamage,
|
||||||
TerritoryClaim,
|
TerritoryClaim,
|
||||||
UnEquip
|
UnEquip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PowerSubType {
|
public enum PowerSubType {
|
||||||
@@ -2237,7 +2193,7 @@ public class Enum {
|
|||||||
DamageType1,
|
DamageType1,
|
||||||
DamageType2,
|
DamageType2,
|
||||||
DamageType3,
|
DamageType3,
|
||||||
Cancel
|
Cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PowerCategoryType {
|
public enum PowerCategoryType {
|
||||||
@@ -2272,7 +2228,7 @@ public class Enum {
|
|||||||
RECALL,
|
RECALL,
|
||||||
SPIREPROOFTELEPORT,
|
SPIREPROOFTELEPORT,
|
||||||
SPIREDISABLE,
|
SPIREDISABLE,
|
||||||
THIEF
|
THIEF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PowerTargetType {
|
public enum PowerTargetType {
|
||||||
@@ -2291,7 +2247,7 @@ public class Enum {
|
|||||||
JEWELRY,
|
JEWELRY,
|
||||||
WEAPONARMOR,
|
WEAPONARMOR,
|
||||||
ARMOR,
|
ARMOR,
|
||||||
ITEM
|
ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum objectMaskType {
|
public enum objectMaskType {
|
||||||
@@ -2324,7 +2280,7 @@ public class Enum {
|
|||||||
BANK,
|
BANK,
|
||||||
VAULT,
|
VAULT,
|
||||||
FORGE,
|
FORGE,
|
||||||
WAREHOUSE
|
WAREHOUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ItemSlotType implements EnumBitSetHelper<ItemSlotType> {
|
public enum ItemSlotType implements EnumBitSetHelper<ItemSlotType> {
|
||||||
@@ -2345,7 +2301,7 @@ public class Enum {
|
|||||||
UPARM,
|
UPARM,
|
||||||
WINGS,
|
WINGS,
|
||||||
BEARD,
|
BEARD,
|
||||||
HAIR
|
HAIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CityBoundsType {
|
public enum CityBoundsType {
|
||||||
@@ -2354,19 +2310,15 @@ public class Enum {
|
|||||||
ZONE(875),
|
ZONE(875),
|
||||||
PLACEMENT(876);
|
PLACEMENT(876);
|
||||||
|
|
||||||
public final float halfExtents;
|
public final float extents;
|
||||||
|
|
||||||
CityBoundsType(float halfExtents) {
|
CityBoundsType(float extents) {
|
||||||
this.halfExtents = halfExtents;
|
this.extents = extents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GuildCharterType {
|
public enum GuildType {
|
||||||
NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"},
|
NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}),
|
||||||
EnumSet.noneOf(ClassType.class),
|
|
||||||
EnumSet.noneOf(MonsterType.class),
|
|
||||||
EnumSet.noneOf(SexType.class)),
|
|
||||||
|
|
||||||
CATHEDRAL("Church of the All-Father", new String[][]{
|
CATHEDRAL("Church of the All-Father", new String[][]{
|
||||||
{"Acolyte", "Acolyte"},
|
{"Acolyte", "Acolyte"},
|
||||||
{"Catechist"},
|
{"Catechist"},
|
||||||
@@ -2376,12 +2328,7 @@ public class Enum {
|
|||||||
{"Bishop", "Bishop"},
|
{"Bishop", "Bishop"},
|
||||||
{"Lord Cardinal", "Lady Cardinal"},
|
{"Lord Cardinal", "Lady Cardinal"},
|
||||||
{"Patriarch", "Matriarch"}},
|
{"Patriarch", "Matriarch"}},
|
||||||
new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"},
|
new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Bard, ClassType.Channeler, ClassType.Crusader, ClassType.Nightstalker,
|
|
||||||
ClassType.Prelate, ClassType.Priest, ClassType.Sentinel, ClassType.Scout),
|
|
||||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Centaur, MonsterType.Elf, MonsterType.HalfGiant,
|
|
||||||
MonsterType.Human),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
MILITARY("Military", new String[][]{
|
MILITARY("Military", new String[][]{
|
||||||
{"Recruit"},
|
{"Recruit"},
|
||||||
{"Footman"},
|
{"Footman"},
|
||||||
@@ -2391,11 +2338,7 @@ public class Enum {
|
|||||||
{"Captain"},
|
{"Captain"},
|
||||||
{"General"},
|
{"General"},
|
||||||
{"Lord Marshall", "Lady Marshall"}},
|
{"Lord Marshall", "Lady Marshall"}},
|
||||||
new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"},
|
new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}),
|
||||||
EnumSet.of(ClassType.Bard, ClassType.Priest, ClassType.Scout, ClassType.Warlock,
|
|
||||||
ClassType.Warrior, ClassType.Wizard),
|
|
||||||
EnumSet.of(MonsterType.Centaur, MonsterType.HalfGiant, MonsterType.Human),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
TEMPLE("Temple of the Cleansing Flame", new String[][]{
|
TEMPLE("Temple of the Cleansing Flame", new String[][]{
|
||||||
{"Aspirant"},
|
{"Aspirant"},
|
||||||
{"Novice"},
|
{"Novice"},
|
||||||
@@ -2406,11 +2349,7 @@ public class Enum {
|
|||||||
{"Lictor"},
|
{"Lictor"},
|
||||||
{"Justiciar"},
|
{"Justiciar"},
|
||||||
{"Pontifex", "Pontifectrix"}},
|
{"Pontifex", "Pontifectrix"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Confessor,
|
|
||||||
ClassType.Nightstalker, ClassType.Priest, ClassType.Scout, ClassType.Templar),
|
|
||||||
EnumSet.of(MonsterType.HalfGiant, MonsterType.Human),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
BARBARIAN("Barbarian Clan", new String[][]{
|
BARBARIAN("Barbarian Clan", new String[][]{
|
||||||
{"Barbarian"},
|
{"Barbarian"},
|
||||||
{"Skald"},
|
{"Skald"},
|
||||||
@@ -2419,11 +2358,7 @@ public class Enum {
|
|||||||
{"Jarl"},
|
{"Jarl"},
|
||||||
{"Chieftain"},
|
{"Chieftain"},
|
||||||
{"Thane"}},
|
{"Thane"}},
|
||||||
new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Barbarian, ClassType.Bard, ClassType.Doomsayer, ClassType.Fury,
|
|
||||||
ClassType.Priest, ClassType.Scout, ClassType.Thief, ClassType.Warrior),
|
|
||||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Minotaur),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
RANGER("Ranger's Brotherhood", new String[][]{
|
RANGER("Ranger's Brotherhood", new String[][]{
|
||||||
{"Yeoman"},
|
{"Yeoman"},
|
||||||
{"Pathfinder"},
|
{"Pathfinder"},
|
||||||
@@ -2432,11 +2367,7 @@ public class Enum {
|
|||||||
{"Protector"},
|
{"Protector"},
|
||||||
{"Guardian"},
|
{"Guardian"},
|
||||||
{"Lord Protector", "Lady Protector"}},
|
{"Lord Protector", "Lady Protector"}},
|
||||||
new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Bard, ClassType.Channeler, ClassType.Druid, ClassType.Priest,
|
|
||||||
ClassType.Ranger, ClassType.Scout, ClassType.Warrior),
|
|
||||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
AMAZON("Amazon Temple", new String[][]{
|
AMAZON("Amazon Temple", new String[][]{
|
||||||
{"Amazon Thrall", "Amazon"},
|
{"Amazon Thrall", "Amazon"},
|
||||||
{"Amazon Slave", "Amazon Warrior"},
|
{"Amazon Slave", "Amazon Warrior"},
|
||||||
@@ -2444,11 +2375,7 @@ public class Enum {
|
|||||||
{"Amazon Consort", "Amazon Princess"},
|
{"Amazon Consort", "Amazon Princess"},
|
||||||
{"Amazon Seneschal", "Majestrix"},
|
{"Amazon Seneschal", "Majestrix"},
|
||||||
{"Amazon Regent", "Imperatrix"}},
|
{"Amazon Regent", "Imperatrix"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"},
|
new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}),
|
||||||
EnumSet.of(ClassType.Bard, ClassType.Druid, ClassType.Fury, ClassType.Huntress,
|
|
||||||
ClassType.Priest, ClassType.Scout, ClassType.Warrior, ClassType.Wizard),
|
|
||||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human),
|
|
||||||
EnumSet.of(SexType.FEMALE)),
|
|
||||||
NOBLE("Noble House", new String[][]{
|
NOBLE("Noble House", new String[][]{
|
||||||
{"Serf"},
|
{"Serf"},
|
||||||
{"Vassal"},
|
{"Vassal"},
|
||||||
@@ -2459,11 +2386,7 @@ public class Enum {
|
|||||||
{"Duke", "Duchess"},
|
{"Duke", "Duchess"},
|
||||||
{"King", "Queen"},
|
{"King", "Queen"},
|
||||||
{"Emperor", "Empress"}},
|
{"Emperor", "Empress"}},
|
||||||
new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"},
|
new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}),
|
||||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Priest,
|
|
||||||
ClassType.Scout, ClassType.Thief, ClassType.Warlock, ClassType.Warrior, ClassType.Wizard),
|
|
||||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
WIZARD("Wizard's Conclave", new String[][]{
|
WIZARD("Wizard's Conclave", new String[][]{
|
||||||
{"Apprentice"},
|
{"Apprentice"},
|
||||||
{"Neophyte"},
|
{"Neophyte"},
|
||||||
@@ -2472,11 +2395,7 @@ public class Enum {
|
|||||||
{"Magus"},
|
{"Magus"},
|
||||||
{"High Magus"},
|
{"High Magus"},
|
||||||
{"Archmagus"}},
|
{"Archmagus"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"},
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}),
|
||||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Doomsayer,
|
|
||||||
ClassType.Fury, ClassType.Necromancer, ClassType.Priest, ClassType.Warlock, ClassType.Wizard),
|
|
||||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.Human, MonsterType.Nephilim, MonsterType.Shade),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
MERCENARY("Mercenary Company", new String[][]{
|
MERCENARY("Mercenary Company", new String[][]{
|
||||||
{"Soldier"},
|
{"Soldier"},
|
||||||
{"Man-at-Arms"},
|
{"Man-at-Arms"},
|
||||||
@@ -2486,11 +2405,7 @@ public class Enum {
|
|||||||
{"Commander"},
|
{"Commander"},
|
||||||
{"High Commander"},
|
{"High Commander"},
|
||||||
{"Warlord"}},
|
{"Warlord"}},
|
||||||
new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"},
|
new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Priest, ClassType.Scout,
|
|
||||||
ClassType.Thief, ClassType.Warlock, ClassType.Warrior),
|
|
||||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
THIEVES("Thieve's Den", new String[][]{
|
THIEVES("Thieve's Den", new String[][]{
|
||||||
{"Urchin"},
|
{"Urchin"},
|
||||||
{"Footpad"},
|
{"Footpad"},
|
||||||
@@ -2501,12 +2416,7 @@ public class Enum {
|
|||||||
{"Treasurer"},
|
{"Treasurer"},
|
||||||
{"Grandmaster Thief"},
|
{"Grandmaster Thief"},
|
||||||
{"Grandfather"}},
|
{"Grandfather"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Assassin, ClassType.Barbarian, ClassType.Bard, ClassType.Priest,
|
|
||||||
ClassType.Scout, ClassType.Thief, ClassType.Wizard),
|
|
||||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.Elf, MonsterType.Human, MonsterType.Irekei,
|
|
||||||
MonsterType.Nephilim, MonsterType.Shade, MonsterType.Vampire),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
DWARF("Dwarf Hold", new String[][]{
|
DWARF("Dwarf Hold", new String[][]{
|
||||||
{"Citizen"},
|
{"Citizen"},
|
||||||
{"Master"},
|
{"Master"},
|
||||||
@@ -2514,11 +2424,7 @@ public class Enum {
|
|||||||
{"Thane"},
|
{"Thane"},
|
||||||
{"Great Thane"},
|
{"Great Thane"},
|
||||||
{"High Thane"}},
|
{"High Thane"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Crusader, ClassType.Prelate, ClassType.Priest, ClassType.Sentinel,
|
|
||||||
ClassType.Warrior),
|
|
||||||
EnumSet.of(MonsterType.Dwarf),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
HIGHCOURT("High Court", new String[][]{
|
HIGHCOURT("High Court", new String[][]{
|
||||||
{"Eccekebe"},
|
{"Eccekebe"},
|
||||||
{"Saedulor"},
|
{"Saedulor"},
|
||||||
@@ -2529,12 +2435,7 @@ public class Enum {
|
|||||||
{"Dar Thaelostor", "Dar Thaelostril"},
|
{"Dar Thaelostor", "Dar Thaelostril"},
|
||||||
{"Aglaeron"},
|
{"Aglaeron"},
|
||||||
{"Ellestor", "Elestril"}},
|
{"Ellestor", "Elestril"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Druid,
|
|
||||||
ClassType.Necromancer, ClassType.Priest, ClassType.Ranger, ClassType.Scout,
|
|
||||||
ClassType.Thief, ClassType.Warrior, ClassType.Wizard),
|
|
||||||
EnumSet.of(MonsterType.Elf, MonsterType.Minotaur),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
VIRAKT("Virakt", new String[][]{
|
VIRAKT("Virakt", new String[][]{
|
||||||
{"Jov'uus"},
|
{"Jov'uus"},
|
||||||
{"Urikhan"},
|
{"Urikhan"},
|
||||||
@@ -2544,12 +2445,7 @@ public class Enum {
|
|||||||
{"Khal'uvho"},
|
{"Khal'uvho"},
|
||||||
{"Khar'uus"},
|
{"Khar'uus"},
|
||||||
{"Kryqh'khalin"}},
|
{"Kryqh'khalin"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Fury,
|
|
||||||
ClassType.Huntress, ClassType.Nightstalker, ClassType.Priest, ClassType.Ranger,
|
|
||||||
ClassType.Scout, ClassType.Thief, ClassType.Warrior, ClassType.Wizard),
|
|
||||||
EnumSet.of(MonsterType.Irekei),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names
|
BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names
|
||||||
{"Devotee"},
|
{"Devotee"},
|
||||||
{"Initiated"},
|
{"Initiated"},
|
||||||
@@ -2559,11 +2455,7 @@ public class Enum {
|
|||||||
{"Elder"},
|
{"Elder"},
|
||||||
{"Hierophant"},
|
{"Hierophant"},
|
||||||
{"Witch King", "Witch Queen"}},
|
{"Witch King", "Witch Queen"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.allOf(ClassType.class),
|
|
||||||
EnumSet.allOf(MonsterType.class),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
|
|
||||||
UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names
|
UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names
|
||||||
{"Footman"},
|
{"Footman"},
|
||||||
{"Fell Legionaire"},
|
{"Fell Legionaire"},
|
||||||
@@ -2573,23 +2465,14 @@ public class Enum {
|
|||||||
{"Dark Master", "Dark Mistress"},
|
{"Dark Master", "Dark Mistress"},
|
||||||
{"Dread Master", "Dread Mistress"},
|
{"Dread Master", "Dread Mistress"},
|
||||||
{"Dread Lord", "Dread Lady"}},
|
{"Dread Lord", "Dread Lady"}},
|
||||||
new String[]{"Despot Rule", "Despot Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Despot Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Assassin, ClassType.Channeler, ClassType.Necromancer, ClassType.Priest,
|
|
||||||
ClassType.Scout, ClassType.Thief, ClassType.Warlock, ClassType.Warrior,
|
|
||||||
ClassType.Wizard),
|
|
||||||
EnumSet.of(MonsterType.Human, MonsterType.Shade, MonsterType.Vampire),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
SCOURGE("Cult of the Scourge", new String[][]{
|
SCOURGE("Cult of the Scourge", new String[][]{
|
||||||
{"Thrall"},
|
{"Thrall"},
|
||||||
{"Mudir"},
|
{"Mudir"},
|
||||||
{"Dark Brother", "Dark Sister"},
|
{"Dark Brother", "Dark Sister"},
|
||||||
{"Hand of the Dark"},
|
{"Hand of the Dark"},
|
||||||
{"Dark Father", "Dark Mother"}},
|
{"Dark Father", "Dark Mother"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Bard, ClassType.Channeler, ClassType.Doomsayer, ClassType.Priest,
|
|
||||||
ClassType.Scout, ClassType.Warrior, ClassType.Wizard),
|
|
||||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Human, MonsterType.Minotaur, MonsterType.Nephilim),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
PIRATE("Pirate Crew", new String[][]{
|
PIRATE("Pirate Crew", new String[][]{
|
||||||
{"Midshipman", "Midshipwoman"},
|
{"Midshipman", "Midshipwoman"},
|
||||||
{"Sailor"},
|
{"Sailor"},
|
||||||
@@ -2597,10 +2480,7 @@ public class Enum {
|
|||||||
{"Second Mat"},
|
{"Second Mat"},
|
||||||
{"First Mate"},
|
{"First Mate"},
|
||||||
{"Captain"}},
|
{"Captain"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.allOf(ClassType.class),
|
|
||||||
EnumSet.allOf(MonsterType.class),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
HERALD("Academy of Heralds", new String[][]{
|
HERALD("Academy of Heralds", new String[][]{
|
||||||
{"Pupil"},
|
{"Pupil"},
|
||||||
{"Scribe"},
|
{"Scribe"},
|
||||||
@@ -2610,10 +2490,7 @@ public class Enum {
|
|||||||
{"Scholar"},
|
{"Scholar"},
|
||||||
{"Archivist"},
|
{"Archivist"},
|
||||||
{"Loremaster"}},
|
{"Loremaster"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.allOf(ClassType.class),
|
|
||||||
EnumSet.allOf(MonsterType.class),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
CENTAUR("Centaur Cohort", new String[][]{
|
CENTAUR("Centaur Cohort", new String[][]{
|
||||||
{"Hoplite"},
|
{"Hoplite"},
|
||||||
{"Peltast"},
|
{"Peltast"},
|
||||||
@@ -2623,12 +2500,7 @@ public class Enum {
|
|||||||
{"Septenrion"},
|
{"Septenrion"},
|
||||||
{"Praetorian"},
|
{"Praetorian"},
|
||||||
{"Paragon"}},
|
{"Paragon"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
|
||||||
EnumSet.of(ClassType.Barbarian, ClassType.Crusader, ClassType.Druid, ClassType.Huntress,
|
|
||||||
ClassType.Prelate, ClassType.Priest, ClassType.Ranger, ClassType.Sentinel,
|
|
||||||
ClassType.Warrior),
|
|
||||||
EnumSet.of(MonsterType.Centaur),
|
|
||||||
EnumSet.allOf(SexType.class)),
|
|
||||||
KHREE("Aracoix Kh'ree", new String[][]{
|
KHREE("Aracoix Kh'ree", new String[][]{
|
||||||
{"Duriacor"},
|
{"Duriacor"},
|
||||||
{"Exarch"},
|
{"Exarch"},
|
||||||
@@ -2640,108 +2512,101 @@ public class Enum {
|
|||||||
{"Erentar"},
|
{"Erentar"},
|
||||||
{"Araceos"},
|
{"Araceos"},
|
||||||
{"Hierarch"}},
|
{"Hierarch"}},
|
||||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
|
||||||
EnumSet.of(ClassType.Assassin, ClassType.Barbarian, ClassType.Bard, ClassType.Huntress,
|
|
||||||
ClassType.Priest, ClassType.Ranger, ClassType.Scout, ClassType.Thief,
|
|
||||||
ClassType.Warlock, ClassType.Warrior),
|
|
||||||
EnumSet.of(MonsterType.Aracoix),
|
|
||||||
EnumSet.allOf(SexType.class));
|
|
||||||
|
|
||||||
public final EnumSet<ClassType> requiredClasses;
|
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"});
|
||||||
public final EnumSet<MonsterType> requiredRaces;
|
|
||||||
public final EnumSet<SexType> sexRequired;
|
|
||||||
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;
|
||||||
|
|
||||||
GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet<ClassType> requiredClasses,
|
GuildType(String name, String[][] ranks, String[] leadershipTypes) {
|
||||||
EnumSet<MonsterType> requiredRaces, EnumSet<SexType> sexRequired) {
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.ranks = ranks;
|
this.ranks = ranks;
|
||||||
this.leadershipTypes = leadershipTypes;
|
this.leadershipTypes = leadershipTypes;
|
||||||
this.requiredClasses = requiredClasses;
|
|
||||||
this.requiredRaces = requiredRaces;
|
|
||||||
this.sexRequired = sexRequired;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GuildCharterType getGuildTypeFromCharter(ItemBase itemBase) {
|
public static GuildType getGuildTypeFromCharter(ItemBase itemBase) {
|
||||||
|
|
||||||
GuildCharterType charterType;
|
GuildType charterType;
|
||||||
|
|
||||||
// Must be a valid charter object
|
// Must be a valid charter object
|
||||||
|
|
||||||
if (itemBase.getType().equals(ItemType.GUILDCHARTER) == false)
|
if (itemBase.getType().equals(ItemType.GUILDCHARTER) == false)
|
||||||
return GuildCharterType.NONE; //No guild Type
|
return GuildType.NONE; //No guild Type
|
||||||
|
|
||||||
|
// No switches on long in java. Cast to int
|
||||||
|
// when refactor to long uuid's. Loss won't matter
|
||||||
|
// with values this small.
|
||||||
|
|
||||||
switch (itemBase.getUUID()) {
|
switch (itemBase.getUUID()) {
|
||||||
|
|
||||||
case 559:
|
case 559:
|
||||||
charterType = GuildCharterType.CATHEDRAL;
|
charterType = GuildType.CATHEDRAL;
|
||||||
break;
|
break;
|
||||||
case 560:
|
case 560:
|
||||||
charterType = GuildCharterType.MILITARY;
|
charterType = GuildType.MILITARY;
|
||||||
break;
|
break;
|
||||||
case 561:
|
case 561:
|
||||||
charterType = GuildCharterType.TEMPLE;
|
charterType = GuildType.TEMPLE;
|
||||||
break;
|
break;
|
||||||
case 562:
|
case 562:
|
||||||
charterType = GuildCharterType.BARBARIAN;
|
charterType = GuildType.BARBARIAN;
|
||||||
break;
|
break;
|
||||||
case 563:
|
case 563:
|
||||||
charterType = GuildCharterType.RANGER;
|
charterType = GuildType.RANGER;
|
||||||
break;
|
break;
|
||||||
case 564:
|
case 564:
|
||||||
charterType = GuildCharterType.AMAZON;
|
charterType = GuildType.AMAZON;
|
||||||
break;
|
break;
|
||||||
case 565:
|
case 565:
|
||||||
charterType = GuildCharterType.NOBLE;
|
charterType = GuildType.NOBLE;
|
||||||
break;
|
break;
|
||||||
case 566:
|
case 566:
|
||||||
charterType = GuildCharterType.WIZARD;
|
charterType = GuildType.WIZARD;
|
||||||
break;
|
break;
|
||||||
case 567:
|
case 567:
|
||||||
charterType = GuildCharterType.MERCENARY;
|
charterType = GuildType.MERCENARY;
|
||||||
break;
|
break;
|
||||||
case 568:
|
case 568:
|
||||||
charterType = GuildCharterType.THIEVES;
|
charterType = GuildType.THIEVES;
|
||||||
break;
|
break;
|
||||||
case 569:
|
case 569:
|
||||||
charterType = GuildCharterType.DWARF;
|
charterType = GuildType.DWARF;
|
||||||
break;
|
break;
|
||||||
case 570:
|
case 570:
|
||||||
charterType = GuildCharterType.HIGHCOURT;
|
charterType = GuildType.HIGHCOURT;
|
||||||
break;
|
break;
|
||||||
case 571:
|
case 571:
|
||||||
charterType = GuildCharterType.VIRAKT;
|
charterType = GuildType.VIRAKT;
|
||||||
break;
|
break;
|
||||||
case 572:
|
case 572:
|
||||||
charterType = GuildCharterType.SCOURGE;
|
charterType = GuildType.SCOURGE;
|
||||||
break;
|
break;
|
||||||
case 573:
|
case 573:
|
||||||
charterType = GuildCharterType.KHREE;
|
charterType = GuildType.KHREE;
|
||||||
break;
|
break;
|
||||||
case 574:
|
case 574:
|
||||||
charterType = GuildCharterType.CENTAUR;
|
charterType = GuildType.CENTAUR;
|
||||||
break;
|
break;
|
||||||
case 575:
|
case 575:
|
||||||
charterType = GuildCharterType.UNHOLY;
|
charterType = GuildType.UNHOLY;
|
||||||
break;
|
break;
|
||||||
case 576:
|
case 576:
|
||||||
charterType = GuildCharterType.PIRATE;
|
charterType = GuildType.PIRATE;
|
||||||
break;
|
break;
|
||||||
case 577:
|
case 577:
|
||||||
charterType = GuildCharterType.BRIALIA;
|
charterType = GuildType.BRIALIA;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
charterType = GuildCharterType.HERALD;
|
charterType = GuildType.HERALD;
|
||||||
}
|
}
|
||||||
|
|
||||||
return charterType;
|
return charterType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GuildCharterType getGuildTypeFromInt(int i) {
|
public static GuildType getGuildTypeFromInt(int i) {
|
||||||
return GuildCharterType.values()[i];
|
return GuildType.values()[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCharterName() {
|
public String getCharterName() {
|
||||||
@@ -2767,15 +2632,12 @@ public class Enum {
|
|||||||
return leadershipTypes[i];
|
return leadershipTypes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canJoin(AbstractCharacter character){
|
|
||||||
return this.requiredRaces.contains(character.absRace) && this.requiredClasses.contains(character.absPromotionClass) && this.sexRequired.contains(character.absGender);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum MinionClass {
|
public enum MinionClass {
|
||||||
MELEE,
|
MELEE,
|
||||||
ARCHER,
|
ARCHER,
|
||||||
MAGE
|
MAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum MinionType {
|
public enum MinionType {
|
||||||
@@ -2845,14 +2707,14 @@ public class Enum {
|
|||||||
return race;
|
return race;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isMage() {
|
public Boolean isMage(){
|
||||||
return this.minionClass.ordinal() == MinionClass.MAGE.ordinal();
|
return this.minionClass.ordinal() == MinionClass.MAGE.ordinal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GridObjectType {
|
public enum GridObjectType {
|
||||||
STATIC,
|
STATIC,
|
||||||
DYNAMIC
|
DYNAMIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SupportMsgType {
|
public enum SupportMsgType {
|
||||||
@@ -2955,11 +2817,12 @@ public class Enum {
|
|||||||
public enum AccountStatus {
|
public enum AccountStatus {
|
||||||
BANNED,
|
BANNED,
|
||||||
ACTIVE,
|
ACTIVE,
|
||||||
ADMIN
|
ADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum MobBehaviourType {
|
public enum MobBehaviourType {
|
||||||
None(null, false, false, false, false, false),
|
None(null, false, false, false, false, false),
|
||||||
|
//Power
|
||||||
Power(null, false, true, true, true, false),
|
Power(null, false, true, true, true, false),
|
||||||
PowerHelpee(Power, false, true, true, false, true),
|
PowerHelpee(Power, false, true, true, false, true),
|
||||||
PowerHelpeeWimpy(Power, true, false, true, false, false),
|
PowerHelpeeWimpy(Power, true, false, true, false, false),
|
||||||
@@ -2984,7 +2847,6 @@ public class Enum {
|
|||||||
//Independent Types
|
//Independent Types
|
||||||
SimpleStandingGuard(null, false, false, false, false, false),
|
SimpleStandingGuard(null, false, false, false, false, false),
|
||||||
Pet1(null, false, false, true, false, false),
|
Pet1(null, false, false, true, false, false),
|
||||||
SiegeEngine(null, false, false, false, false, false),
|
|
||||||
Simple(null, false, false, true, false, false),
|
Simple(null, false, false, true, false, false),
|
||||||
Helpee(null, false, true, true, false, true),
|
Helpee(null, false, true, true, false, true),
|
||||||
HelpeeWimpy(null, true, false, true, false, false),
|
HelpeeWimpy(null, true, false, true, false, false),
|
||||||
@@ -2995,12 +2857,13 @@ public class Enum {
|
|||||||
HamletGuard(null, false, true, false, false, false),
|
HamletGuard(null, false, true, false, false, false),
|
||||||
AggroWanderer(null, false, false, true, false, false);
|
AggroWanderer(null, false, false, true, false, false);
|
||||||
|
|
||||||
public final MobBehaviourType BehaviourHelperType;
|
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
|
||||||
public final boolean isWimpy;
|
public MobBehaviourType BehaviourHelperType;
|
||||||
public final boolean isAgressive;
|
public boolean isWimpy;
|
||||||
public final boolean canRoam;
|
public boolean isAgressive;
|
||||||
public final boolean callsForHelp;
|
public boolean canRoam;
|
||||||
public final boolean respondsToCallForHelp;
|
public boolean callsForHelp;
|
||||||
|
public boolean respondsToCallForHelp;
|
||||||
|
|
||||||
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
|
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
|
||||||
this.BehaviourHelperType = helpeebehaviourType;
|
this.BehaviourHelperType = helpeebehaviourType;
|
||||||
@@ -3015,11 +2878,8 @@ public class Enum {
|
|||||||
|
|
||||||
public enum AIAgentType {
|
public enum AIAgentType {
|
||||||
MOBILE,
|
MOBILE,
|
||||||
GUARDCAPTAIN,
|
|
||||||
GUARDMINION,
|
|
||||||
GUARDWALLARCHER,
|
|
||||||
PET,
|
PET,
|
||||||
CHARMED,
|
CHARMED,
|
||||||
SIEGEENGINE
|
GUARD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,706 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.InterestManagement;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.gameManager.ConfigManager;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.math.Vector2f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.AbstractWorldObject;
|
||||||
|
import engine.objects.Zone;
|
||||||
|
import engine.util.MapLoader;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class HeightMap {
|
||||||
|
|
||||||
|
// Class variables
|
||||||
|
|
||||||
|
// Heightmap data for all zones.
|
||||||
|
|
||||||
|
public static final HashMap<Integer, HeightMap> heightmapByLoadNum = new HashMap<>();
|
||||||
|
|
||||||
|
// Bootstrap Tracking
|
||||||
|
|
||||||
|
public static int heightMapsCreated = 0;
|
||||||
|
public static HeightMap PlayerCityHeightMap;
|
||||||
|
|
||||||
|
// Heightmap data for this heightmap
|
||||||
|
|
||||||
|
public BufferedImage heightmapImage;
|
||||||
|
|
||||||
|
private int heightMapID;
|
||||||
|
private int maxHeight;
|
||||||
|
private int fullExtentsX;
|
||||||
|
private int fullExtentsY;
|
||||||
|
|
||||||
|
private float bucketWidthX;
|
||||||
|
private float bucketWidthY;
|
||||||
|
private int zoneLoadID;
|
||||||
|
private float seaLevel = 0;
|
||||||
|
private float outsetX;
|
||||||
|
private float outsetZ;
|
||||||
|
private int[][] pixelColorValues;
|
||||||
|
|
||||||
|
public HeightMap(ResultSet rs) throws SQLException {
|
||||||
|
|
||||||
|
this.heightMapID = rs.getInt("heightMapID");
|
||||||
|
this.maxHeight = rs.getInt("maxHeight");
|
||||||
|
int halfExtentsX = rs.getInt("xRadius");
|
||||||
|
int halfExtentsY = rs.getInt("zRadius");
|
||||||
|
this.zoneLoadID = rs.getInt("zoneLoadID");
|
||||||
|
this.seaLevel = rs.getFloat("seaLevel");
|
||||||
|
this.outsetX = rs.getFloat("outsetX");
|
||||||
|
this.outsetZ = rs.getFloat("outsetZ");
|
||||||
|
|
||||||
|
|
||||||
|
// Cache the full extents to avoid the calculation
|
||||||
|
|
||||||
|
this.fullExtentsX = halfExtentsX * 2;
|
||||||
|
this.fullExtentsY = halfExtentsY * 2;
|
||||||
|
|
||||||
|
this.heightmapImage = null;
|
||||||
|
File imageFile = new File(ConfigManager.DEFAULT_DATA_DIR + "heightmaps/" + this.heightMapID + ".bmp");
|
||||||
|
|
||||||
|
// early exit if no image file was found. Will log in caller.
|
||||||
|
|
||||||
|
if (!imageFile.exists())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// load the heightmap image.
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.heightmapImage = ImageIO.read(imageFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Logger.error("***Error loading heightmap data for heightmap " + this.heightMapID + e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
||||||
|
|
||||||
|
this.heightmapImage = MapLoader.flipImage(this.heightmapImage);
|
||||||
|
|
||||||
|
// Calculate the data we do not load from table
|
||||||
|
|
||||||
|
float numOfBuckets = this.heightmapImage.getWidth() - 1;
|
||||||
|
float calculatedWidth = this.fullExtentsX / numOfBuckets;
|
||||||
|
this.bucketWidthX = calculatedWidth;
|
||||||
|
this.bucketWidthY = this.bucketWidthX; // This makes no sense.
|
||||||
|
|
||||||
|
// Generate pixel array from image data
|
||||||
|
|
||||||
|
generatePixelData();
|
||||||
|
|
||||||
|
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||||
|
|
||||||
|
heightMapsCreated++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Created for PlayerCities
|
||||||
|
public HeightMap() {
|
||||||
|
|
||||||
|
this.heightMapID = 999999;
|
||||||
|
this.maxHeight = 5; // for real...
|
||||||
|
int halfExtentsX = (int) Enum.CityBoundsType.ZONE.extents;
|
||||||
|
int halfExtentsY = (int) Enum.CityBoundsType.ZONE.extents;
|
||||||
|
this.zoneLoadID = 0;
|
||||||
|
this.seaLevel = 0;
|
||||||
|
this.outsetX = 128;
|
||||||
|
this.outsetZ = 128;
|
||||||
|
|
||||||
|
|
||||||
|
// Cache the full extents to avoid the calculation
|
||||||
|
|
||||||
|
this.fullExtentsX = halfExtentsX * 2;
|
||||||
|
this.fullExtentsY = halfExtentsY * 2;
|
||||||
|
|
||||||
|
|
||||||
|
// load the heightmap image.
|
||||||
|
|
||||||
|
|
||||||
|
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
||||||
|
|
||||||
|
this.heightmapImage = null;
|
||||||
|
|
||||||
|
// Calculate the data we do not load from table
|
||||||
|
|
||||||
|
this.bucketWidthX = 1;
|
||||||
|
this.bucketWidthY = 1;
|
||||||
|
|
||||||
|
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
||||||
|
|
||||||
|
for (int y = 0; y <= this.fullExtentsY; y++) {
|
||||||
|
for (int x = 0; x <= this.fullExtentsX; x++) {
|
||||||
|
pixelColorValues[x][y] = 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeightMap(Zone zone) {
|
||||||
|
|
||||||
|
this.heightMapID = 999999;
|
||||||
|
this.maxHeight = 0;
|
||||||
|
int halfExtentsX = (int) zone.getBounds().getHalfExtents().x;
|
||||||
|
int halfExtentsY = (int) zone.getBounds().getHalfExtents().y;
|
||||||
|
this.zoneLoadID = 0;
|
||||||
|
this.seaLevel = 0;
|
||||||
|
this.outsetX = 0;
|
||||||
|
this.outsetZ = 0;
|
||||||
|
|
||||||
|
// Cache the full extents to avoid the calculation
|
||||||
|
|
||||||
|
this.fullExtentsX = halfExtentsX * 2;
|
||||||
|
this.fullExtentsY = halfExtentsY * 2;
|
||||||
|
|
||||||
|
|
||||||
|
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
|
||||||
|
|
||||||
|
this.heightmapImage = null;
|
||||||
|
|
||||||
|
// Calculate the data we do not load from table
|
||||||
|
|
||||||
|
this.bucketWidthX = 1;
|
||||||
|
this.bucketWidthY = 1;
|
||||||
|
|
||||||
|
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
||||||
|
|
||||||
|
for (int y = 0; y <= this.fullExtentsY; y++) {
|
||||||
|
for (int x = 0; x <= this.fullExtentsX; x++) {
|
||||||
|
pixelColorValues[x][y] = 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GeneratePlayerCityHeightMap() {
|
||||||
|
|
||||||
|
HeightMap.PlayerCityHeightMap = new HeightMap();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GenerateCustomHeightMap(Zone zone) {
|
||||||
|
|
||||||
|
HeightMap heightMap = new HeightMap(zone);
|
||||||
|
|
||||||
|
HeightMap.heightmapByLoadNum.put(zone.getLoadNum(), heightMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Zone getNextZoneWithTerrain(Zone zone) {
|
||||||
|
|
||||||
|
Zone nextZone = zone;
|
||||||
|
|
||||||
|
if (zone.getHeightMap() != null)
|
||||||
|
return zone;
|
||||||
|
|
||||||
|
if (zone.equals(ZoneManager.getSeaFloor()))
|
||||||
|
return zone;
|
||||||
|
|
||||||
|
while (nextZone.getHeightMap() == null)
|
||||||
|
nextZone = nextZone.getParent();
|
||||||
|
|
||||||
|
return nextZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getWorldHeight(AbstractWorldObject worldObject) {
|
||||||
|
|
||||||
|
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(worldObject.getLoc());
|
||||||
|
|
||||||
|
if (currentZone == null)
|
||||||
|
return worldObject.getAltitude();
|
||||||
|
|
||||||
|
currentZone = getNextZoneWithTerrain(currentZone);
|
||||||
|
|
||||||
|
if (currentZone == ZoneManager.getSeaFloor())
|
||||||
|
return currentZone.getAbsY() + worldObject.getAltitude();
|
||||||
|
|
||||||
|
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
||||||
|
HeightMap heightMap = currentZone.getHeightMap();
|
||||||
|
|
||||||
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), currentZone);
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldObject.getLoc(), currentZone);
|
||||||
|
|
||||||
|
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(worldObject.getLoc(), parentZone);
|
||||||
|
|
||||||
|
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
|
||||||
|
float worldAltitude = currentZone.getWorldAltitude();
|
||||||
|
|
||||||
|
float realWorldAltitude = interaltitude + worldAltitude;
|
||||||
|
|
||||||
|
//OUTSET
|
||||||
|
|
||||||
|
if (parentZone != null) {
|
||||||
|
|
||||||
|
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
||||||
|
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
||||||
|
|
||||||
|
if (bucketScaleX <= 0.40000001)
|
||||||
|
bucketScaleX = heightMap.outsetZ / parentXRadius;
|
||||||
|
|
||||||
|
if (bucketScaleX > 0.40000001)
|
||||||
|
bucketScaleX = 0.40000001f;
|
||||||
|
|
||||||
|
if (bucketScaleZ <= 0.40000001)
|
||||||
|
bucketScaleZ = heightMap.outsetX / parentZRadius;
|
||||||
|
|
||||||
|
if (bucketScaleZ > 0.40000001)
|
||||||
|
bucketScaleZ = 0.40000001f;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
float weight;
|
||||||
|
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return realWorldAltitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getWorldHeight(Vector3fImmutable worldLoc) {
|
||||||
|
|
||||||
|
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(worldLoc);
|
||||||
|
|
||||||
|
if (currentZone == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
currentZone = getNextZoneWithTerrain(currentZone);
|
||||||
|
|
||||||
|
if (currentZone == ZoneManager.getSeaFloor())
|
||||||
|
return currentZone.getAbsY();
|
||||||
|
|
||||||
|
Zone parentZone = getNextZoneWithTerrain(currentZone.getParent());
|
||||||
|
HeightMap heightMap = currentZone.getHeightMap();
|
||||||
|
|
||||||
|
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor()))
|
||||||
|
return currentZone.getAbsY();
|
||||||
|
|
||||||
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(worldLoc, currentZone);
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLoc, currentZone);
|
||||||
|
|
||||||
|
if ((parentZone != null) && (parentZone.getHeightMap() != null))
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(worldLoc, parentZone);
|
||||||
|
|
||||||
|
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
|
||||||
|
float worldAltitude = currentZone.getWorldAltitude();
|
||||||
|
|
||||||
|
float realWorldAltitude = interaltitude + worldAltitude;
|
||||||
|
|
||||||
|
//OUTSET
|
||||||
|
|
||||||
|
if (parentZone != null) {
|
||||||
|
|
||||||
|
// if (currentZone.getHeightMap() != null && parentZone.getHeightMap() != null && parentZone.getParent() != null && parentZone.getParent().getHeightMap() != null)
|
||||||
|
// return realWorldAltitude;
|
||||||
|
|
||||||
|
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
float bucketScaleX = heightMap.outsetX / parentXRadius;
|
||||||
|
float bucketScaleZ = heightMap.outsetZ / parentZRadius;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
float weight;
|
||||||
|
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getWorldAltitude();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return realWorldAltitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getOutsetHeight(float interpolatedAltitude, Zone zone, Vector3fImmutable worldLocation) {
|
||||||
|
|
||||||
|
Vector2f parentLoc;
|
||||||
|
float outsetALt = 0;
|
||||||
|
|
||||||
|
if (zone.getParent() == null || zone.getParent().getHeightMap() == null)
|
||||||
|
return interpolatedAltitude + zone.getWorldAltitude();
|
||||||
|
|
||||||
|
if (zone.getParent() != null && zone.getParent().getHeightMap() != null) {
|
||||||
|
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(worldLocation, zone.getParent());
|
||||||
|
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLocation, zone);
|
||||||
|
|
||||||
|
float parentXRadius = zone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = zone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float bucketScaleX = zone.getHeightMap().outsetX / parentXRadius;
|
||||||
|
float bucketScaleZ = zone.getHeightMap().outsetZ / parentZRadius;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
|
||||||
|
float weight;
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone.getParent()));
|
||||||
|
|
||||||
|
parentCenterAltitude += zone.getYCoord();
|
||||||
|
parentCenterAltitude += interpolatedAltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += zone.getParent().getAbsY();
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = zone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone));
|
||||||
|
|
||||||
|
parentCenterAltitude += zone.getYCoord();
|
||||||
|
parentCenterAltitude += interpolatedAltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += zone.getParent().getAbsY();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return outsetALt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector2f getGridOffset(Vector2f gridSquare) {
|
||||||
|
|
||||||
|
int floorX = (int) gridSquare.x;
|
||||||
|
int floorY = (int) gridSquare.y;
|
||||||
|
|
||||||
|
return new Vector2f(gridSquare.x - floorX, gridSquare.y - floorY);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void loadAlHeightMaps() {
|
||||||
|
|
||||||
|
// Load the heightmaps into staging hashmap keyed by HashMapID
|
||||||
|
|
||||||
|
DbManager.HeightMapQueries.LOAD_ALL_HEIGHTMAPS();
|
||||||
|
|
||||||
|
//generate static player city heightmap.
|
||||||
|
|
||||||
|
HeightMap.GeneratePlayerCityHeightMap();
|
||||||
|
|
||||||
|
|
||||||
|
// Clear all heightmap image data as it's no longer needed.
|
||||||
|
|
||||||
|
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
|
||||||
|
heightMap.heightmapImage = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info(HeightMap.heightmapByLoadNum.size() + " Heightmaps cached.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
|
||||||
|
|
||||||
|
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
||||||
|
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
||||||
|
|
||||||
|
if (localAltitude < zone.getSeaLevel())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
||||||
|
|
||||||
|
if (zoneLoc.x < 0)
|
||||||
|
zoneLoc.setX(0);
|
||||||
|
|
||||||
|
if (zoneLoc.x > this.fullExtentsX - 1)
|
||||||
|
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
|
||||||
|
|
||||||
|
if (zoneLoc.y < 0)
|
||||||
|
zoneLoc.setY(0);
|
||||||
|
|
||||||
|
if (zoneLoc.y > this.fullExtentsY - 1)
|
||||||
|
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
|
||||||
|
|
||||||
|
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
||||||
|
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
||||||
|
|
||||||
|
return new Vector2f(xBucket, yBucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getInterpolatedTerrainHeight(Vector2f zoneLoc) {
|
||||||
|
|
||||||
|
Vector2f gridSquare;
|
||||||
|
|
||||||
|
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
||||||
|
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
||||||
|
|
||||||
|
//flip the Y so it grabs from the bottom left instead of top left.
|
||||||
|
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||||
|
|
||||||
|
gridSquare = getGridSquare(zoneLoc);
|
||||||
|
|
||||||
|
int gridX = (int) gridSquare.x;
|
||||||
|
int gridY = (int) (gridSquare.y);
|
||||||
|
|
||||||
|
if (gridX > maxX)
|
||||||
|
gridX = maxX;
|
||||||
|
if (gridY > maxY)
|
||||||
|
gridY = maxY;
|
||||||
|
|
||||||
|
float offsetX = (gridSquare.x - gridX);
|
||||||
|
float offsetY = gridSquare.y - gridY;
|
||||||
|
|
||||||
|
//get height of the 4 vertices.
|
||||||
|
|
||||||
|
float topLeftHeight = 0;
|
||||||
|
float topRightHeight = 0;
|
||||||
|
float bottomLeftHeight = 0;
|
||||||
|
float bottomRightHeight = 0;
|
||||||
|
|
||||||
|
int nextY = gridY + 1;
|
||||||
|
int nextX = gridX + 1;
|
||||||
|
|
||||||
|
if (nextY > maxY)
|
||||||
|
nextY = gridY;
|
||||||
|
|
||||||
|
if (nextX > maxX)
|
||||||
|
nextX = gridX;
|
||||||
|
|
||||||
|
topLeftHeight = pixelColorValues[gridX][gridY];
|
||||||
|
topRightHeight = pixelColorValues[nextX][gridY];
|
||||||
|
bottomLeftHeight = pixelColorValues[gridX][nextY];
|
||||||
|
bottomRightHeight = pixelColorValues[nextX][nextY];
|
||||||
|
|
||||||
|
float interpolatedHeight;
|
||||||
|
|
||||||
|
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||||
|
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||||
|
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||||
|
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||||
|
|
||||||
|
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||||
|
|
||||||
|
return interpolatedHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getInterpolatedTerrainHeight(Vector3fImmutable zoneLoc3f) {
|
||||||
|
|
||||||
|
Vector2f zoneLoc = new Vector2f(zoneLoc3f.x, zoneLoc3f.z);
|
||||||
|
|
||||||
|
Vector2f gridSquare;
|
||||||
|
|
||||||
|
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
//flip the Y so it grabs from the bottom left instead of top left.
|
||||||
|
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||||
|
|
||||||
|
gridSquare = getGridSquare(zoneLoc);
|
||||||
|
|
||||||
|
int gridX = (int) gridSquare.x;
|
||||||
|
int gridY = (int) (gridSquare.y);
|
||||||
|
|
||||||
|
float offsetX = (gridSquare.x - gridX);
|
||||||
|
float offsetY = gridSquare.y - gridY;
|
||||||
|
|
||||||
|
//get height of the 4 vertices.
|
||||||
|
|
||||||
|
float topLeftHeight = pixelColorValues[gridX][gridY];
|
||||||
|
float topRightHeight = pixelColorValues[gridX + 1][gridY];
|
||||||
|
float bottomLeftHeight = pixelColorValues[gridX][gridY + 1];
|
||||||
|
float bottomRightHeight = pixelColorValues[gridX + 1][gridY + 1];
|
||||||
|
|
||||||
|
float interpolatedHeight;
|
||||||
|
|
||||||
|
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||||
|
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||||
|
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||||
|
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||||
|
|
||||||
|
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||||
|
|
||||||
|
return interpolatedHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generatePixelData() {
|
||||||
|
|
||||||
|
Color color;
|
||||||
|
|
||||||
|
// Generate altitude lookup table for this heightmap
|
||||||
|
|
||||||
|
this.pixelColorValues = new int[this.heightmapImage.getWidth()][this.heightmapImage.getHeight()];
|
||||||
|
|
||||||
|
for (int y = 0; y < this.heightmapImage.getHeight(); y++) {
|
||||||
|
for (int x = 0; x < this.heightmapImage.getWidth(); x++) {
|
||||||
|
|
||||||
|
color = new Color(this.heightmapImage.getRGB(x, y));
|
||||||
|
pixelColorValues[x][y] = color.getRed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getScaledHeightForColor(float color) {
|
||||||
|
|
||||||
|
return (color / 256) * this.maxHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getBucketWidthX() {
|
||||||
|
return bucketWidthX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getBucketWidthY() {
|
||||||
|
return bucketWidthY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeightMapID() {
|
||||||
|
return heightMapID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BufferedImage getHeightmapImage() {
|
||||||
|
return heightmapImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getSeaLevel() {
|
||||||
|
return seaLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -140,7 +140,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
if (pc != null)
|
if (pc != null)
|
||||||
if (pcc.getSeeInvis() < pc.hidden)
|
if (pcc.getSeeInvis() < pc.getHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!cc.sendMsg(uom)) {
|
if (!cc.sendMsg(uom)) {
|
||||||
@@ -340,7 +340,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player.getSeeInvis() < loadedPlayer.hidden)
|
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (loadedPlayer.safemodeInvis())
|
if (loadedPlayer.safemodeInvis())
|
||||||
@@ -372,7 +372,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
||||||
if (player.getSeeInvis() < loadedPlayer.hidden)
|
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
else if (loadedPlayer.safemodeInvis())
|
else if (loadedPlayer.safemodeInvis())
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
@@ -437,7 +437,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
// dont load if invis
|
// dont load if invis
|
||||||
|
|
||||||
if (player.getSeeInvis() < awopc.hidden)
|
if (player.getSeeInvis() < awopc.getHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
||||||
@@ -467,7 +467,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (awonpc.despawned == true)
|
if (awonpc.despawned == true)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||||
|
|
||||||
@@ -480,7 +480,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (!awonpc.isAlive())
|
if (!awonpc.isAlive())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||||
|
|
||||||
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
|
|||||||
@@ -1,230 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.InterestManagement;
|
|
||||||
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.math.Vector2f;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import static java.lang.Math.PI;
|
|
||||||
|
|
||||||
public class Terrain {
|
|
||||||
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
|
|
||||||
public short[][] terrain_pixel_data;
|
|
||||||
public Vector2f terrain_size = new Vector2f();
|
|
||||||
public Vector2f cell_size = new Vector2f();
|
|
||||||
public Vector2f cell_count = new Vector2f();
|
|
||||||
public float terrain_scale;
|
|
||||||
public Vector2f blend_values = new Vector2f();
|
|
||||||
public Vector2f blend_ratio = new Vector2f();
|
|
||||||
public int heightmap;
|
|
||||||
Zone zone;
|
|
||||||
|
|
||||||
public Terrain(Zone zone) {
|
|
||||||
|
|
||||||
this.zone = zone;
|
|
||||||
this.heightmap = this.zone.template.terrain_image;
|
|
||||||
|
|
||||||
// Configure PLANAR zones to use the same 16x16 pixel image
|
|
||||||
// that all similar terrains share. (See JSON)
|
|
||||||
|
|
||||||
if (this.zone.template.terrain_type.equals("PLANAR"))
|
|
||||||
this.heightmap = 1006300; // all 0
|
|
||||||
|
|
||||||
// Load pixel data for this terrain from cache
|
|
||||||
|
|
||||||
this.terrain_pixel_data = Terrain._heightmap_pixel_cache.get(heightmap);
|
|
||||||
|
|
||||||
if (terrain_pixel_data == null)
|
|
||||||
Logger.error("Pixel map empty for zone: " + this.zone.getObjectUUID() + ":" + this.zone.zoneName);
|
|
||||||
|
|
||||||
// Configure terrain based on zone properties
|
|
||||||
|
|
||||||
this.terrain_size.x = this.zone.major_radius * 2;
|
|
||||||
this.terrain_size.y = this.zone.minor_radius * 2;
|
|
||||||
|
|
||||||
this.cell_count.x = this.terrain_pixel_data.length - 1;
|
|
||||||
this.cell_count.y = this.terrain_pixel_data[0].length - 1;
|
|
||||||
|
|
||||||
this.cell_size.x = terrain_size.x / this.cell_count.x;
|
|
||||||
this.cell_size.y = terrain_size.y / this.cell_count.y;
|
|
||||||
|
|
||||||
// Blending configuration. These ratios are used to calculate
|
|
||||||
// the blending area between child and parent terrains when
|
|
||||||
// they are stitched together.
|
|
||||||
|
|
||||||
this.blend_values.x = this.zone.template.max_blend;
|
|
||||||
this.blend_values.y = this.zone.template.min_blend;
|
|
||||||
|
|
||||||
Vector2f major_blend = new Vector2f(this.blend_values.x / this.zone.major_radius,
|
|
||||||
this.blend_values.y / this.zone.major_radius);
|
|
||||||
|
|
||||||
Vector2f minor_blend = new Vector2f(this.blend_values.x / this.zone.minor_radius,
|
|
||||||
this.blend_values.y / this.zone.minor_radius);
|
|
||||||
|
|
||||||
if (major_blend.y > 0.4f)
|
|
||||||
blend_ratio.x = major_blend.y;
|
|
||||||
else
|
|
||||||
blend_ratio.x = Math.min(major_blend.x, 0.4f);
|
|
||||||
|
|
||||||
if (minor_blend.y > 0.4f)
|
|
||||||
blend_ratio.y = minor_blend.y;
|
|
||||||
else
|
|
||||||
blend_ratio.y = Math.min(minor_blend.x, 0.4f);
|
|
||||||
|
|
||||||
// Scale coefficient for this terrain
|
|
||||||
|
|
||||||
this.terrain_scale = this.zone.template.terrain_max_y / 255f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Zone getNextZoneWithTerrain(Zone zone) {
|
|
||||||
|
|
||||||
// Not all zones have a terrain. Some are for display only
|
|
||||||
// and heights returned are from the parent heightmap. This
|
|
||||||
// is controlled in the JSON via the has_terrain_gen field.
|
|
||||||
|
|
||||||
Zone terrain_zone = zone;
|
|
||||||
|
|
||||||
if (zone == null)
|
|
||||||
return ZoneManager.seaFloor;
|
|
||||||
|
|
||||||
if (zone.terrain != null)
|
|
||||||
return zone;
|
|
||||||
|
|
||||||
if (zone.equals(ZoneManager.seaFloor))
|
|
||||||
return zone;
|
|
||||||
|
|
||||||
while (terrain_zone.terrain == null)
|
|
||||||
terrain_zone = terrain_zone.parent;
|
|
||||||
|
|
||||||
return terrain_zone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getWorldHeight(Zone zone, Vector3fImmutable world_loc) {
|
|
||||||
|
|
||||||
// Retrieve the next zone with a terrain defined.
|
|
||||||
|
|
||||||
Zone terrainZone = getNextZoneWithTerrain(zone);
|
|
||||||
Zone parentZone = getNextZoneWithTerrain(zone.parent);
|
|
||||||
|
|
||||||
// Transform world loc into zone space coordinate system
|
|
||||||
|
|
||||||
Vector2f terrainLoc = ZoneManager.worldToTerrainSpace(world_loc, terrainZone);
|
|
||||||
Vector2f parentLoc = ZoneManager.worldToTerrainSpace(world_loc, parentZone);
|
|
||||||
|
|
||||||
// Offset from origin needed for blending function
|
|
||||||
|
|
||||||
Vector2f terrainOffset = ZoneManager.worldToZoneOffset(world_loc, terrainZone);
|
|
||||||
|
|
||||||
// Interpolate height for this position in both terrains
|
|
||||||
|
|
||||||
float interpolatedChildHeight = terrainZone.terrain.getInterpolatedTerrainHeight(terrainLoc);
|
|
||||||
interpolatedChildHeight += terrainZone.global_height;
|
|
||||||
|
|
||||||
float interpolatedParentTerrainHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentLoc);
|
|
||||||
interpolatedParentTerrainHeight += parentZone.global_height;
|
|
||||||
|
|
||||||
// Blend between terrains
|
|
||||||
|
|
||||||
float blendCoefficient = terrainZone.terrain.getTerrainBlendCoefficient(terrainOffset);
|
|
||||||
|
|
||||||
float terrainHeight = interpolatedChildHeight * blendCoefficient;
|
|
||||||
terrainHeight += interpolatedParentTerrainHeight * (1 - blendCoefficient);
|
|
||||||
|
|
||||||
return terrainHeight;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getWorldHeight(Vector3fImmutable world_loc) {
|
|
||||||
|
|
||||||
Zone currentZone = ZoneManager.findSmallestZone(world_loc);
|
|
||||||
|
|
||||||
return getWorldHeight(currentZone, world_loc);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector2f getTerrainCell(Vector2f terrain_loc) {
|
|
||||||
|
|
||||||
// Calculate terrain cell with offset
|
|
||||||
|
|
||||||
Vector2f terrain_cell = new Vector2f(terrain_loc.x / this.cell_size.x, terrain_loc.y / this.cell_size.y);
|
|
||||||
|
|
||||||
// Clamp values when standing directly on pole
|
|
||||||
|
|
||||||
terrain_cell.x = Math.max(0, Math.min(this.cell_count.x - 1, terrain_cell.x));
|
|
||||||
terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 1, terrain_cell.y));
|
|
||||||
|
|
||||||
return terrain_cell;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getInterpolatedTerrainHeight(Vector2f terrain_loc) {
|
|
||||||
|
|
||||||
float interpolatedHeight;
|
|
||||||
|
|
||||||
// Early exit for guild zones
|
|
||||||
|
|
||||||
if (this.zone.guild_zone)
|
|
||||||
return 5.0f;
|
|
||||||
|
|
||||||
// Determine terrain and offset from top left vertex
|
|
||||||
|
|
||||||
Vector2f terrain_cell = getTerrainCell(terrain_loc);
|
|
||||||
|
|
||||||
int pixel_x = (int) Math.floor(terrain_cell.x);
|
|
||||||
int pixel_y = (int) Math.floor(terrain_cell.y);
|
|
||||||
|
|
||||||
Vector2f pixel_offset = new Vector2f(terrain_cell.x % 1, terrain_cell.y % 1);
|
|
||||||
|
|
||||||
// 4 surrounding vertices from the pixel array.
|
|
||||||
|
|
||||||
short top_left_pixel = terrain_pixel_data[pixel_x][pixel_y];
|
|
||||||
short top_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y];
|
|
||||||
short bottom_left_pixel = terrain_pixel_data[pixel_x][pixel_y + 1];
|
|
||||||
short bottom_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y + 1];
|
|
||||||
|
|
||||||
// Interpolate between the 4 vertices
|
|
||||||
|
|
||||||
interpolatedHeight = top_left_pixel * (1 - pixel_offset.x) * (1 - pixel_offset.y);
|
|
||||||
interpolatedHeight += top_right_pixel * (1 - pixel_offset.y) * (pixel_offset.x);
|
|
||||||
interpolatedHeight += (bottom_left_pixel * (1 - pixel_offset.x) * pixel_offset.y);
|
|
||||||
interpolatedHeight += (bottom_right_pixel * pixel_offset.y * pixel_offset.x);
|
|
||||||
|
|
||||||
interpolatedHeight *= this.terrain_scale; // Scale height
|
|
||||||
|
|
||||||
return interpolatedHeight;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getTerrainBlendCoefficient(Vector2f zone_offset) {
|
|
||||||
|
|
||||||
// Normalize terrain offset
|
|
||||||
|
|
||||||
Vector2f normalizedOffset = new Vector2f(Math.abs(zone_offset.x) / this.zone.template.major_radius,
|
|
||||||
Math.abs(zone_offset.y) / this.zone.template.minor_radius);
|
|
||||||
|
|
||||||
float blendCoefficient;
|
|
||||||
|
|
||||||
if (normalizedOffset.x <= 1 - blend_ratio.x || normalizedOffset.x <= normalizedOffset.y) {
|
|
||||||
|
|
||||||
if (normalizedOffset.y < 1 - blend_ratio.y)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
blendCoefficient = (normalizedOffset.y - (1 - blend_ratio.y)) / blend_ratio.y;
|
|
||||||
} else
|
|
||||||
blendCoefficient = (normalizedOffset.x - (1 - blend_ratio.x)) / blend_ratio.x;
|
|
||||||
|
|
||||||
blendCoefficient = (float) Math.atan((0.5f - blendCoefficient) * PI);
|
|
||||||
|
|
||||||
return (blendCoefficient + 1) * 0.5f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -67,7 +67,7 @@ public class CityRecord extends DataRecord {
|
|||||||
cityRecord.locX = cityRecord.city.getTOL().getLoc().x;
|
cityRecord.locX = cityRecord.city.getTOL().getLoc().x;
|
||||||
cityRecord.locY = -cityRecord.city.getTOL().getLoc().z; // flip sign on 'y' coordinate
|
cityRecord.locY = -cityRecord.city.getTOL().getLoc().z; // flip sign on 'y' coordinate
|
||||||
|
|
||||||
cityRecord.zoneHash = cityRecord.city.getParent().hash;
|
cityRecord.zoneHash = cityRecord.city.getParent().getHash();
|
||||||
|
|
||||||
if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
|
if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
|
||||||
cityRecord.establishedDatetime = cityRecord.city.established;
|
cityRecord.establishedDatetime = cityRecord.city.established;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
guildRecord.guildHash = guildRecord.guild.getHash();
|
guildRecord.guildHash = guildRecord.guild.getHash();
|
||||||
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
||||||
guildRecord.guildName = guildRecord.guild.getName();
|
guildRecord.guildName = guildRecord.guild.getName();
|
||||||
guildRecord.charterName = Enum.GuildCharterType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
|
guildRecord.charterName = Enum.GuildType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
|
||||||
|
|
||||||
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class MineRecord extends DataRecord {
|
|||||||
mineRecord.eventType = eventType;
|
mineRecord.eventType = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
mineRecord.zoneHash = mine.getParentZone().hash;
|
mineRecord.zoneHash = mine.getParentZone().getHash();
|
||||||
|
|
||||||
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||||
player = (PlayerCharacter) character;
|
player = (PlayerCharacter) character;
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ public class PvpRecord extends DataRecord {
|
|||||||
outStatement.setInt(8, this.victim.getLevel());
|
outStatement.setInt(8, this.victim.getLevel());
|
||||||
|
|
||||||
outStatement.setString(9, DataWarehouse.hasher.encrypt(zone.getObjectUUID()));
|
outStatement.setString(9, DataWarehouse.hasher.encrypt(zone.getObjectUUID()));
|
||||||
outStatement.setString(10, zone.zoneName);
|
outStatement.setString(10, zone.getName());
|
||||||
outStatement.setFloat(11, this.location.getX());
|
outStatement.setFloat(11, this.location.getX());
|
||||||
outStatement.setFloat(12, -this.location.getZ()); // flip sign on 'y' coordinate
|
outStatement.setFloat(12, -this.location.getZ()); // flip sign on 'y' coordinate
|
||||||
outStatement.setBoolean(13, this.pvpExp);
|
outStatement.setBoolean(13, this.pvpExp);
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import engine.Enum;
|
|||||||
import engine.Enum.DbObjectType;
|
import engine.Enum.DbObjectType;
|
||||||
import engine.Enum.ProtectionState;
|
import engine.Enum.ProtectionState;
|
||||||
import engine.Enum.TaxType;
|
import engine.Enum.TaxType;
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
@@ -28,7 +27,6 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
public class dbBuildingHandler extends dbHandlerBase {
|
public class dbBuildingHandler extends dbHandlerBase {
|
||||||
|
|
||||||
@@ -90,12 +88,14 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
return removeFromBuildings(b);
|
return removeFromBuildings(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Building> GET_ALL_BUILDINGS() {
|
public ArrayList<Building> GET_ALL_BUILDINGS_FOR_ZONE(Zone zone) {
|
||||||
|
|
||||||
ArrayList<Building> buildings = new ArrayList<>();
|
ArrayList<Building> buildings = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_building`.*, `object`.`parent` FROM `object` INNER JOIN `obj_building` ON `obj_building`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_building`.*, `object`.`parent` FROM `object` INNER JOIN `obj_building` ON `obj_building`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
|
||||||
|
|
||||||
|
preparedStatement.setLong(1, zone.getObjectUUID());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
buildings = getObjectsFromRs(rs, 1000);
|
buildings = getObjectsFromRs(rs, 1000);
|
||||||
@@ -425,28 +425,26 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_BUILDING_FRIENDS() {
|
public void LOAD_ALL_FRIENDS_FOR_BUILDING(Building building) {
|
||||||
|
|
||||||
|
if (building == null)
|
||||||
|
return;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_friends`")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_friends` WHERE `buildingUID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, building.getObjectUUID());
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
BuildingFriends friend = new BuildingFriends(rs);
|
BuildingFriends friend = new BuildingFriends(rs);
|
||||||
|
switch (friend.getFriendType()) {
|
||||||
// Create map if it does not yet exist
|
|
||||||
|
|
||||||
if (!BuildingManager._buildingFriends.containsKey(friend.buildingUID))
|
|
||||||
BuildingManager._buildingFriends.put(friend.buildingUID, new ConcurrentHashMap<>());
|
|
||||||
|
|
||||||
switch (friend.friendType) {
|
|
||||||
case 7:
|
case 7:
|
||||||
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.playerUID, friend);
|
building.getFriends().put(friend.getPlayerUID(), friend);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
case 9:
|
case 9:
|
||||||
BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.guildUID, friend);
|
building.getFriends().put(friend.getGuildUID(), friend);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -457,29 +455,26 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_BUILDING_CONDEMNED() {
|
public void LOAD_ALL_CONDEMNED_FOR_BUILDING(Building building) {
|
||||||
|
|
||||||
|
if (building == null)
|
||||||
|
return;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_condemned`")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_condemned` WHERE `buildingUID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, building.getObjectUUID());
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
Condemned condemned = new Condemned(rs);
|
Condemned condemned = new Condemned(rs);
|
||||||
|
switch (condemned.getFriendType()) {
|
||||||
// Create map if it does not yet exist
|
|
||||||
|
|
||||||
if (!BuildingManager._buildingCondemned.containsKey(condemned.buildingUUID))
|
|
||||||
BuildingManager._buildingCondemned.put(condemned.buildingUUID, new ConcurrentHashMap<>());
|
|
||||||
|
|
||||||
switch (condemned.friendType) {
|
|
||||||
case 2:
|
case 2:
|
||||||
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.playerUID, condemned);
|
building.getCondemned().put(condemned.getPlayerUID(), condemned);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
BuildingManager._buildingCondemned.get(condemned.buildingUUID).put(condemned.guildUID, condemned);
|
building.getCondemned().put(condemned.getGuildUID(), condemned);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -489,27 +484,35 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_BARRACKS_PATROL_POINTS() {
|
public ArrayList<Vector3fImmutable> LOAD_PATROL_POINTS(Building building) {
|
||||||
|
|
||||||
|
if (building == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
ArrayList<Vector3fImmutable> patrolPoints = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_patrol_points`")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_patrol_points` WHERE `buildingUID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, building.getObjectUUID());
|
||||||
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
float x1 = rs.getFloat("patrolX");
|
||||||
int buildingUUID = rs.getInt("buildingUID");
|
float y1 = rs.getFloat("patrolY");
|
||||||
|
float z1 = rs.getFloat("patrolZ");
|
||||||
if (!BuildingManager._buildingPatrolPoints.containsKey(buildingUUID))
|
Vector3fImmutable patrolPoint = new Vector3fImmutable(x1, y1, z1);
|
||||||
BuildingManager._buildingPatrolPoints.put(buildingUUID, new ArrayList<>());
|
patrolPoints.add(patrolPoint);
|
||||||
|
|
||||||
Vector3fImmutable patrolPoint = new Vector3fImmutable(rs.getFloat("patrolX"), rs.getFloat("patrolY"), rs.getFloat("patrolZ"));
|
|
||||||
BuildingManager._buildingPatrolPoints.get(buildingUUID).add(patrolPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return patrolPoints;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_TO_CONDEMNLIST(final long parentUID, final long playerUID, final long guildID, final int friendType) {
|
public boolean ADD_TO_CONDEMNLIST(final long parentUID, final long playerUID, final long guildID, final int friendType) {
|
||||||
@@ -719,10 +722,10 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
+ "WHERE`buildingUID` = ? AND `playerUID` = ? AND `guildUID` = ? AND `friendType` = ?")) {
|
+ "WHERE`buildingUID` = ? AND `playerUID` = ? AND `guildUID` = ? AND `friendType` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setBoolean(1, active);
|
preparedStatement.setBoolean(1, active);
|
||||||
preparedStatement.setInt(2, condemn.buildingUUID);
|
preparedStatement.setInt(2, condemn.getParent());
|
||||||
preparedStatement.setInt(3, condemn.playerUID);
|
preparedStatement.setInt(3, condemn.getPlayerUID());
|
||||||
preparedStatement.setInt(4, condemn.guildUID);
|
preparedStatement.setInt(4, condemn.getGuildUID());
|
||||||
preparedStatement.setInt(5, condemn.friendType);
|
preparedStatement.setInt(5, condemn.getFriendType());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -34,19 +34,16 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
case "zone":
|
case "zone":
|
||||||
Zone zone = new Zone(rs);
|
Zone zone = new Zone(rs);
|
||||||
DbManager.addToCache(zone);
|
DbManager.addToCache(zone);
|
||||||
zone.runAfterLoad();
|
|
||||||
list.add(zone);
|
list.add(zone);
|
||||||
break;
|
break;
|
||||||
case "building":
|
case "building":
|
||||||
Building building = new Building(rs);
|
Building building = new Building(rs);
|
||||||
DbManager.addToCache(building);
|
DbManager.addToCache(building);
|
||||||
building.runAfterLoad();
|
|
||||||
list.add(building);
|
list.add(building);
|
||||||
break;
|
break;
|
||||||
case "city":
|
case "city":
|
||||||
City city = new City(rs);
|
City city = new City(rs);
|
||||||
DbManager.addToCache(city);
|
DbManager.addToCache(city);
|
||||||
city.runAfterLoad();
|
|
||||||
list.add(city);
|
list.add(city);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -99,12 +96,14 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
return objectList;
|
return objectList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<City> GET_ALL_CITIES() {
|
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
|
||||||
|
|
||||||
ArrayList<City> cityList = new ArrayList<>();
|
ArrayList<City> cityList = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` WHERE `object`.`parent`=?;")) {
|
||||||
|
|
||||||
|
preparedStatement.setLong(1, objectUUID);
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
cityList = getObjectsFromRs(rs, 100);
|
cityList = getObjectsFromRs(rs, 100);
|
||||||
|
|||||||
@@ -695,4 +695,24 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO uncomment this when finished with guild history warehouse integration
|
||||||
|
// public HashMap<Integer, GuildRecord> GET_WAREHOUSE_GUILD_HISTORY(){
|
||||||
|
//
|
||||||
|
// HashMap<Integer, GuildRecord> tempMap = new HashMap<>();
|
||||||
|
// prepareCallable("SELECT * FROM `warehouse_guildhistory` WHERE `eventType` = 'CREATE'");
|
||||||
|
// try {
|
||||||
|
// ResultSet rs = executeQuery();
|
||||||
|
//
|
||||||
|
// while (rs.next()) {
|
||||||
|
// GuildRecord guildRecord = new GuildRecord(rs);
|
||||||
|
// tempMap.put(guildRecord.guildID, guildRecord);
|
||||||
|
// }
|
||||||
|
// }catch (Exception e){
|
||||||
|
// Logger.error(e);
|
||||||
|
// }
|
||||||
|
// return tempMap;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.InterestManagement.HeightMap;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class dbHeightMapHandler extends dbHandlerBase {
|
||||||
|
|
||||||
|
public dbHeightMapHandler() {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_ALL_HEIGHTMAPS() {
|
||||||
|
|
||||||
|
HeightMap thisHeightmap;
|
||||||
|
HeightMap.heightMapsCreated = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_zone_heightmap INNER JOIN static_zone_size ON static_zone_size.loadNum = static_zone_heightmap.zoneLoadID")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
thisHeightmap = new HeightMap(rs);
|
||||||
|
|
||||||
|
if (thisHeightmap.getHeightmapImage() == null) {
|
||||||
|
Logger.info("Imagemap for " + thisHeightmap.getHeightMapID() + " was null");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -86,7 +86,6 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
|||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
recordsRead++;
|
recordsRead++;
|
||||||
itemBase = new ItemBase(rs);
|
itemBase = new ItemBase(rs);
|
||||||
|
|
||||||
ItemBase.addToCache(itemBase);
|
ItemBase.addToCache(itemBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package engine.db.handlers;
|
|||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
|
import engine.objects.Zone;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -27,27 +28,31 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mob PERSIST(Mob toAdd) {
|
public Mob ADD_MOB(Mob toAdd) {
|
||||||
|
|
||||||
Mob mobile = null;
|
Mob mobile = null;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, toAdd.parentZoneUUID);
|
preparedStatement.setLong(1, toAdd.getParentZoneID());
|
||||||
preparedStatement.setInt(2, toAdd.loadID);
|
preparedStatement.setInt(2, toAdd.getMobBaseID());
|
||||||
preparedStatement.setInt(3, toAdd.guildUUID);
|
preparedStatement.setInt(3, toAdd.getGuildUUID());
|
||||||
preparedStatement.setFloat(4, toAdd.bindLoc.x);
|
preparedStatement.setFloat(4, toAdd.getSpawnX());
|
||||||
preparedStatement.setFloat(5, toAdd.bindLoc.y);
|
preparedStatement.setFloat(5, toAdd.getSpawnY());
|
||||||
preparedStatement.setFloat(6, toAdd.bindLoc.z);
|
preparedStatement.setFloat(6, toAdd.getSpawnZ());
|
||||||
preparedStatement.setInt(7, 0);
|
preparedStatement.setInt(7, 0);
|
||||||
preparedStatement.setFloat(8, toAdd.spawnRadius);
|
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
|
||||||
preparedStatement.setInt(9, toAdd.spawnDelay);
|
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
|
||||||
preparedStatement.setInt(10, toAdd.contractUUID);
|
|
||||||
preparedStatement.setInt(11, toAdd.buildingUUID);
|
if (toAdd.getContract() != null)
|
||||||
preparedStatement.setInt(12, toAdd.level);
|
preparedStatement.setInt(10, toAdd.getContract().getContractID());
|
||||||
preparedStatement.setString(13, toAdd.firstName);
|
else
|
||||||
preparedStatement.setString(14, toAdd.behaviourType.toString());
|
preparedStatement.setInt(10, 0);
|
||||||
|
|
||||||
|
preparedStatement.setInt(11, toAdd.getBuildingID());
|
||||||
|
preparedStatement.setInt(12, toAdd.getLevel());
|
||||||
|
preparedStatement.setString(13, toAdd.getFirstName());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
@@ -64,23 +69,6 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
return mobile;
|
return mobile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Mob> GET_ALL_MOBS() {
|
|
||||||
|
|
||||||
ArrayList<Mob> mobileList = new ArrayList<>();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
mobileList = getObjectsFromRs(rs, 1000);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mobileList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) {
|
public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
@@ -118,17 +106,17 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
return row_count;
|
return row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
|
public void LOAD_PATROL_POINTS(Mob captain) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, guardCaptain.getObjectUUID());
|
preparedStatement.setInt(1, captain.getObjectUUID());
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String minionName = rs.getString("minionName");
|
String name = rs.getString("name");
|
||||||
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
|
||||||
|
|
||||||
if (toCreate == null)
|
if (toCreate == null)
|
||||||
return;
|
return;
|
||||||
@@ -143,13 +131,15 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_GUARD_MINION(final long captainUID, final String minionName) {
|
public boolean ADD_TO_GUARDS(final long captainUID, final int mobBaseID, final String name, final int slot) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `minionName`) VALUES (?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `mobBaseID`,`name`, `slot`) VALUES (?,?,?,?)")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setString(2, minionName);
|
preparedStatement.setInt(2, mobBaseID);
|
||||||
|
preparedStatement.setString(3, name);
|
||||||
|
preparedStatement.setInt(4, slot);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -159,13 +149,14 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean REMOVE_GUARD_MINION(final long captainUID, final String minionName) {
|
public boolean REMOVE_FROM_GUARDS(final long captainUID, final int mobBaseID, final int slot) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `minionName`=? LIMIT 1;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `mobBaseID`=? AND `slot` =?")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setString(2, minionName);
|
preparedStatement.setInt(2, mobBaseID);
|
||||||
|
preparedStatement.setInt(3, slot);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -175,19 +166,24 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean REMOVE_ALL_MINIONS(final long captainUID) {
|
|
||||||
|
public ArrayList<Mob> GET_ALL_MOBS_FOR_ZONE(Zone zone) {
|
||||||
|
|
||||||
|
ArrayList<Mob> mobileList = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, zone.getObjectUUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
mobileList = getObjectsFromRs(rs, 1000);
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return mobileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mob GET_MOB(final int objectUUID) {
|
public Mob GET_MOB(final int objectUUID) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import engine.math.Vector3fImmutable;
|
|||||||
import engine.objects.NPC;
|
import engine.objects.NPC;
|
||||||
import engine.objects.NPCProfits;
|
import engine.objects.NPCProfits;
|
||||||
import engine.objects.ProducedItem;
|
import engine.objects.ProducedItem;
|
||||||
|
import engine.objects.Zone;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -93,12 +94,14 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
return row_count;
|
return row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<NPC> GET_ALL_NPCS() {
|
public ArrayList<NPC> GET_ALL_NPCS_FOR_ZONE(Zone zone) {
|
||||||
|
|
||||||
ArrayList<NPC> npcList = new ArrayList<>();
|
ArrayList<NPC> npcList = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_npc`.*, `object`.`parent` FROM `object` INNER JOIN `obj_npc` ON `obj_npc`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_npc`.*, `object`.`parent` FROM `object` INNER JOIN `obj_npc` ON `obj_npc`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
|
||||||
|
|
||||||
|
preparedStatement.setLong(1, zone.getObjectUUID());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
npcList = getObjectsFromRs(rs, 1000);
|
npcList = getObjectsFromRs(rs, 1000);
|
||||||
@@ -240,8 +243,12 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public boolean UPDATE_EQUIPSET(NPC npc, int equipSetID) {
|
public boolean UPDATE_EQUIPSET(NPC npc, int equipSetID) {
|
||||||
|
|
||||||
|
// Column name must match what NPC/Mob loaders read ("equipmentSet").
|
||||||
|
// Using the wrong column here causes the update to fail silently and
|
||||||
|
// dev command to report "Unable to find Equipset" despite a valid ID.
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_npc` SET `equipsetID`=? WHERE `UID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_npc` SET `equipmentSet`=? WHERE `UID`=?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, equipSetID);
|
preparedStatement.setInt(1, equipSetID);
|
||||||
preparedStatement.setLong(2, npc.getObjectUUID());
|
preparedStatement.setLong(2, npc.getObjectUUID());
|
||||||
@@ -464,4 +471,4 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,9 +15,15 @@ import engine.gameManager.PowersManager;
|
|||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PreparedStatementShared;
|
import engine.objects.PreparedStatementShared;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
|
import engine.powers.MobPowerEntry;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class dbPowerHandler extends dbHandlerBase {
|
public class dbPowerHandler extends dbHandlerBase {
|
||||||
@@ -80,4 +86,43 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashMap<Integer, ArrayList<MobPowerEntry>> LOAD_MOB_POWERS() {
|
||||||
|
|
||||||
|
HashMap<Integer, ArrayList<MobPowerEntry>> mobPowers = new HashMap<>();
|
||||||
|
MobPowerEntry mobPowerEntry;
|
||||||
|
|
||||||
|
int mobbaseID;
|
||||||
|
int recordsRead = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_mobbase_powers ORDER BY `id` ASC;")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
recordsRead++;
|
||||||
|
|
||||||
|
mobbaseID = rs.getInt("mobbaseUUID");
|
||||||
|
mobPowerEntry = new MobPowerEntry(rs);
|
||||||
|
|
||||||
|
if (mobPowers.get(mobbaseID) == null) {
|
||||||
|
ArrayList<MobPowerEntry> powerList = new ArrayList<>();
|
||||||
|
powerList.add(mobPowerEntry);
|
||||||
|
mobPowers.put(mobbaseID, powerList);
|
||||||
|
} else {
|
||||||
|
ArrayList<MobPowerEntry> powerList = mobPowers.get(mobbaseID);
|
||||||
|
powerList.add(mobPowerEntry);
|
||||||
|
mobPowers.put(mobbaseID, powerList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return mobPowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
||||||
|
return mobPowers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ package engine.db.handlers;
|
|||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.RuneBase;
|
import engine.objects.RuneBase;
|
||||||
import engine.powers.RunePowerEntry;
|
|
||||||
import engine.powers.RuneSkillAdjustEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -29,84 +27,6 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
|
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<RunePowerEntry>> mobPowers = new HashMap<>();
|
|
||||||
RunePowerEntry runePowerEntry;
|
|
||||||
|
|
||||||
int rune_id;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_powers")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
|
|
||||||
recordsRead++;
|
|
||||||
|
|
||||||
rune_id = rs.getInt("rune_id");
|
|
||||||
runePowerEntry = new RunePowerEntry(rs);
|
|
||||||
|
|
||||||
if (mobPowers.get(rune_id) == null) {
|
|
||||||
ArrayList<RunePowerEntry> runePowerList = new ArrayList<>();
|
|
||||||
runePowerList.add(runePowerEntry);
|
|
||||||
mobPowers.put(rune_id, runePowerList);
|
|
||||||
} else {
|
|
||||||
ArrayList<RunePowerEntry> powerList = mobPowers.get(rune_id);
|
|
||||||
powerList.add(runePowerEntry);
|
|
||||||
mobPowers.put(rune_id, powerList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return mobPowers;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
|
||||||
return mobPowers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> LOAD_RUNE_SKILL_ADJUSTS() {
|
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> runeSkillAdjusts = new HashMap<>();
|
|
||||||
RuneSkillAdjustEntry runeSkillAdjustEntry;
|
|
||||||
|
|
||||||
int rune_id;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_skill_adjusts")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
|
|
||||||
recordsRead++;
|
|
||||||
|
|
||||||
rune_id = rs.getInt("rune_id");
|
|
||||||
runeSkillAdjustEntry = new RuneSkillAdjustEntry(rs);
|
|
||||||
|
|
||||||
if (runeSkillAdjusts.get(rune_id) == null) {
|
|
||||||
ArrayList<RuneSkillAdjustEntry> skillAdjustList = new ArrayList<>();
|
|
||||||
skillAdjustList.add(runeSkillAdjustEntry);
|
|
||||||
runeSkillAdjusts.put(rune_id, skillAdjustList);
|
|
||||||
} else {
|
|
||||||
ArrayList<RuneSkillAdjustEntry> powerList = runeSkillAdjusts.get(rune_id);
|
|
||||||
powerList.add(runeSkillAdjustEntry);
|
|
||||||
runeSkillAdjusts.put(rune_id, powerList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return runeSkillAdjusts;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + runeSkillAdjusts.size());
|
|
||||||
return runeSkillAdjusts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GET_RUNE_REQS(final RuneBase rb) {
|
public void GET_RUNE_REQS(final RuneBase rb) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, locks);
|
preparedStatement.setLong(1, locks);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -381,7 +381,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -413,7 +413,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -429,7 +429,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -445,7 +445,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, amount);
|
preparedStatement.setInt(1, amount);
|
||||||
preparedStatement.setInt(2, wh.UID);
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -545,7 +545,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
warehouse = new Warehouse(rs);
|
warehouse = new Warehouse(rs);
|
||||||
warehouse.runAfterLoad();
|
warehouse.runAfterLoad();
|
||||||
Warehouse.loadAllTransactions(warehouse);
|
warehouse.loadAllTransactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ package engine.db.handlers;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.math.Vector2f;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
import engine.objects.ZoneTemplate;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -29,21 +29,25 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Zone> GET_ALL_ZONES() {
|
public ArrayList<Zone> GET_ALL_NODES(Zone zone) {
|
||||||
|
ArrayList<Zone> wsmList = new ArrayList<>();
|
||||||
ArrayList<Zone> zoneList = new ArrayList<>();
|
wsmList.addAll(zone.getNodes());
|
||||||
|
if (zone.absX == 0.0f) {
|
||||||
try (Connection connection = DbManager.getConnection();
|
zone.absX = zone.getXCoord();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
zoneList = getObjectsFromRs(rs, 2000);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
}
|
||||||
|
if (zone.absY == 0.0f) {
|
||||||
return zoneList;
|
zone.absY = zone.getYCoord();
|
||||||
|
}
|
||||||
|
if (zone.absZ == 0.0f) {
|
||||||
|
zone.absZ = zone.getZCoord();
|
||||||
|
}
|
||||||
|
for (Zone child : zone.getNodes()) {
|
||||||
|
child.absX = child.getXCoord() + zone.absX;
|
||||||
|
child.absY = child.getYCoord() + zone.absY;
|
||||||
|
child.absZ = child.getZCoord() + zone.absZ;
|
||||||
|
wsmList.addAll(this.GET_ALL_NODES(child));
|
||||||
|
}
|
||||||
|
return wsmList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Zone GET_BY_UID(long ID) {
|
public Zone GET_BY_UID(long ID) {
|
||||||
@@ -68,38 +72,43 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_ALL_ZONE_TEMPLATES() {
|
public ArrayList<Zone> GET_MAP_NODES(final int objectUUID) {
|
||||||
|
|
||||||
|
ArrayList<Zone> zoneList = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_zone_templates")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
|
||||||
|
|
||||||
|
preparedStatement.setLong(1, objectUUID);
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
zoneList = getObjectsFromRs(rs, 2000);
|
||||||
while (rs.next()) {
|
|
||||||
ZoneTemplate zoneTemplate = new ZoneTemplate(rs);
|
|
||||||
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add player city
|
|
||||||
|
|
||||||
ZoneTemplate zoneTemplate = new ZoneTemplate();
|
|
||||||
|
|
||||||
zoneTemplate.templateID = 0;
|
|
||||||
zoneTemplate.sea_level_type = "PARENT";
|
|
||||||
zoneTemplate.sea_level = 0;
|
|
||||||
zoneTemplate.max_blend = 128;
|
|
||||||
zoneTemplate.min_blend = 128;
|
|
||||||
zoneTemplate.terrain_max_y = 5;
|
|
||||||
zoneTemplate.major_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
|
||||||
zoneTemplate.minor_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
|
||||||
zoneTemplate.terrain_type = "PLANAR";
|
|
||||||
|
|
||||||
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return zoneList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_ZONE_EXTENTS() {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_zone_size`;")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
Vector2f zoneSize = new Vector2f();
|
||||||
|
int loadNum = rs.getInt("loadNum");
|
||||||
|
zoneSize.x = rs.getFloat("xRadius");
|
||||||
|
zoneSize.y = rs.getFloat("zRadius");
|
||||||
|
ZoneManager._zone_size_data.put(loadNum, zoneSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean DELETE_ZONE(final Zone zone) {
|
public boolean DELETE_ZONE(final Zone zone) {
|
||||||
|
|||||||
@@ -9,16 +9,18 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.Mob;
|
import engine.objects.*;
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eighty
|
||||||
|
*/
|
||||||
public class AddMobCmd extends AbstractDevCmd {
|
public class AddMobCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
public AddMobCmd() {
|
public AddMobCmd() {
|
||||||
@@ -35,8 +37,27 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
|
|
||||||
int loadID;
|
if (words[0].equals("all")) {
|
||||||
|
|
||||||
|
for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) {
|
||||||
|
MobBase mb = (MobBase) mobbaseAGO;
|
||||||
|
int loadID = mb.getObjectUUID();
|
||||||
|
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
||||||
|
null, true, zone, null, 0, "", 1);
|
||||||
|
if (mob != null) {
|
||||||
|
mob.updateDatabase();
|
||||||
|
this.setResult(String.valueOf(mob.getDBID()));
|
||||||
|
} else {
|
||||||
|
throwbackError(pc, "Failed to create mob of type " + loadID);
|
||||||
|
Logger.error("Failed to create mob of type "
|
||||||
|
+ loadID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int loadID;
|
||||||
try {
|
try {
|
||||||
loadID = Integer.parseInt(words[0]);
|
loadID = Integer.parseInt(words[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@@ -50,19 +71,20 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
return; // NaN
|
return; // NaN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (zone == null) {
|
if (zone == null) {
|
||||||
throwbackError(pc, "Failed to find zone to place mob in.");
|
throwbackError(pc, "Failed to find zone to place mob in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zone.guild_zone) {
|
if (zone.isPlayerCity()) {
|
||||||
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
|
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
|
||||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
|
||||||
|
|
||||||
|
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||||
|
null, true, zone, null, 0, "", 1);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.InterestManagement.HeightMap;
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.math.Vector2f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.objects.Zone;
|
||||||
|
|
||||||
|
public class AuditHeightMapCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public AuditHeightMapCmd() {
|
||||||
|
super("auditheightmap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
int count = Integer.parseInt(words[0]);
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
|
||||||
|
|
||||||
|
Zone currentZone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
||||||
|
|
||||||
|
|
||||||
|
Vector3fImmutable currentLoc = Vector3fImmutable.getRandomPointInCircle(currentZone.getLoc(), currentZone.getBounds().getHalfExtents().x < currentZone.getBounds().getHalfExtents().y ? currentZone.getBounds().getHalfExtents().x : currentZone.getBounds().getHalfExtents().y);
|
||||||
|
|
||||||
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(currentLoc, currentZone);
|
||||||
|
|
||||||
|
if (currentZone != null && currentZone.getHeightMap() != null) {
|
||||||
|
float altitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
float outsetAltitude = HeightMap.getOutsetHeight(altitude, currentZone, pcSender.getLoc());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
|
||||||
|
long delta = end - start;
|
||||||
|
|
||||||
|
this.throwbackInfo(pcSender, "Audit Heightmap took " + delta + " ms to run " + count + " times!");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /auditmobs [zone.UUID]'";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Audits all the mobs in a zone.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -40,8 +40,8 @@ public class AuditMobsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (size >= count) {
|
if (size >= count) {
|
||||||
plusplus++;
|
plusplus++;
|
||||||
throwbackInfo(pcSender, zoneMicro.zoneName + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
|
throwbackInfo(pcSender, zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
|
||||||
System.out.println(zoneMicro.zoneName + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
|
System.out.println(zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ public class AuditMobsCmd extends AbstractDevCmd {
|
|||||||
//ConcurrentHashMap<Mob, Long> respawnMap = Mob.getRespawnMap();
|
//ConcurrentHashMap<Mob, Long> respawnMap = Mob.getRespawnMap();
|
||||||
// ConcurrentHashMap<Mob, Long> despawnMap = Mob.getDespawnMap();
|
// ConcurrentHashMap<Mob, Long> despawnMap = Mob.getDespawnMap();
|
||||||
|
|
||||||
throwbackInfo(pcSender, zone.zoneName + ", numMobs: " + zone.zoneMobSet.size());
|
throwbackInfo(pcSender, zone.getName() + ", numMobs: " + zone.zoneMobSet.size());
|
||||||
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
|
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,11 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.InterestManagement.Terrain;
|
import engine.InterestManagement.HeightMap;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
@@ -21,79 +22,205 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
public GetHeightCmd() {
|
public GetHeightCmd() {
|
||||||
super("getHeight");
|
super("getHeight");
|
||||||
|
this.addCmdString("height");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
Zone currentZone;
|
boolean end = true;
|
||||||
Zone parentZone;
|
|
||||||
Zone heightmapZone;
|
|
||||||
|
|
||||||
currentZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
float height = HeightMap.getWorldHeight(pc);
|
||||||
heightmapZone = Terrain.getNextZoneWithTerrain(currentZone);
|
|
||||||
parentZone = Terrain.getNextZoneWithTerrain(currentZone.parent);
|
|
||||||
|
|
||||||
Vector2f childZoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), heightmapZone);
|
this.throwbackInfo(pc, "Altitude : " + height);
|
||||||
Vector2f childZoneOffset = ZoneManager.worldToZoneOffset(playerCharacter.getLoc(), heightmapZone);
|
|
||||||
Vector2f normalizedOffset = new Vector2f(Math.abs(childZoneOffset.x) / heightmapZone.template.major_radius,
|
|
||||||
Math.abs(childZoneOffset.y) / heightmapZone.template.minor_radius);
|
|
||||||
Vector2f parentZoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), parentZone);
|
|
||||||
|
|
||||||
float childHeight = heightmapZone.terrain.getInterpolatedTerrainHeight(childZoneLoc);
|
this.throwbackInfo(pc, "Character Height: " + pc.getCharacterHeight());
|
||||||
childHeight = childHeight + heightmapZone.global_height;
|
this.throwbackInfo(pc, "Character Height to start swimming: " + pc.centerHeight);
|
||||||
|
|
||||||
float parentHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentZoneLoc);
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
parentHeight += parentZone.global_height;
|
this.throwbackInfo(pc, "Water Level : " + zone.getSeaLevel());
|
||||||
|
this.throwbackInfo(pc, "Character Water Level Above : " + (pc.getCharacterHeight() + height - zone.getSeaLevel()));
|
||||||
|
|
||||||
float blendedHeight = Terrain.getWorldHeight(currentZone, playerCharacter.getLoc());
|
if (end)
|
||||||
|
return;
|
||||||
|
|
||||||
Vector2f terrainCell = heightmapZone.terrain.getTerrainCell(childZoneLoc);
|
Vector2f gridSquare;
|
||||||
Vector2f cell_offset = new Vector2f(terrainCell.x % 1, terrainCell.y % 1);
|
Vector2f gridOffset;
|
||||||
|
Vector2f parentGrid;
|
||||||
|
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||||
|
|
||||||
terrainCell.x = (float) Math.floor(terrainCell.x);
|
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
terrainCell.y = (float) Math.floor(terrainCell.y);
|
|
||||||
|
if (currentZone == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Zone parentZone = currentZone.getParent();
|
||||||
|
|
||||||
|
HeightMap heightMap = currentZone.getHeightMap();
|
||||||
|
|
||||||
|
|
||||||
short top_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y];
|
//find the next parents heightmap if the currentzone heightmap is null.
|
||||||
short top_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y];
|
while (heightMap == null) {
|
||||||
short bottom_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y + 1];
|
|
||||||
short bottom_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y + 1];
|
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName);
|
if (currentZone == ZoneManager.getSeaFloor()) {
|
||||||
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName);
|
this.throwbackInfo(pc, "Could not find a heightmap to get height.");
|
||||||
this.throwbackInfo(playerCharacter, "Parent Zone: " + parentZone.zoneName);
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "Player loc: " + "[" + playerCharacter.loc.x + "]" + "[" + playerCharacter.loc.y + "]" + "[" + playerCharacter.loc.z + "]");
|
this.throwbackError(pc, "Heightmap does not exist for " + currentZone.getName());
|
||||||
|
this.throwbackInfo(pc, "Using parent zone instead: ");
|
||||||
|
currentZone = currentZone.getParent();
|
||||||
|
heightMap = currentZone.getHeightMap();
|
||||||
|
}
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "Terrain Cell : " + "[" + terrainCell.x + "]" + "[" + terrainCell.y + "]");
|
|
||||||
this.throwbackInfo(playerCharacter, "Cell Offset : " + "[" + cell_offset.x + "]" + "[" + cell_offset.y + "]");
|
|
||||||
this.throwbackInfo(playerCharacter, "Pixels : " + "[" + top_left_pixel + "]" + "[" + top_right_pixel + "]");
|
|
||||||
this.throwbackInfo(playerCharacter, "Pixels : " + "[" + bottom_left_pixel + "]" + "[" + bottom_right_pixel + "]");
|
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "Child Zone Offset: " + "[" + childZoneOffset.x + "]" + "[" + childZoneOffset.y + "]");
|
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor())) {
|
||||||
this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]");
|
this.throwbackInfo(pc, currentZone.getName() + " has no heightmap ");
|
||||||
this.throwbackInfo(playerCharacter, "template blend Values: (max/min): " + heightmapZone.template.max_blend + " /" + heightmapZone.template.min_blend);
|
this.throwbackInfo(pc, "Current altitude: " + currentZone.absY);
|
||||||
this.throwbackInfo(playerCharacter, "terrain values (max/min): " + heightmapZone.terrain.blend_values.x + " /" + heightmapZone.terrain.blend_values.y);
|
return;
|
||||||
this.throwbackInfo(playerCharacter, "Blend coefficient: " + heightmapZone.terrain.getTerrainBlendCoefficient(childZoneOffset));
|
}
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "------------");
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone);
|
||||||
|
|
||||||
|
Vector3fImmutable seaFloorLocalLoc = ZoneManager.worldToLocal(pc.getLoc(), ZoneManager.getSeaFloor());
|
||||||
|
this.throwbackInfo(pc, "SeaFloor Local : " + seaFloorLocalLoc.x + " , " + seaFloorLocalLoc.y);
|
||||||
|
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, "Local Zone Location : " + zoneLoc.x + " , " + zoneLoc.y);
|
||||||
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone);
|
||||||
|
Vector3fImmutable parentLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone.getParent());
|
||||||
|
this.throwbackInfo(pc, "Local Zone Location from center : " + localLocFromCenter);
|
||||||
|
this.throwbackInfo(pc, "parent Zone Location from center : " + parentLocFromCenter);
|
||||||
|
|
||||||
|
Vector2f parentZoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone.getParent());
|
||||||
|
this.throwbackInfo(pc, "Parent Zone Location from Bottom Left : " + parentZoneLoc);
|
||||||
|
|
||||||
|
if ((parentZone != null) && (parentZone.getHeightMap() != null)) {
|
||||||
|
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
|
||||||
|
parentGrid = parentZone.getHeightMap().getGridSquare(parentLoc);
|
||||||
|
} else
|
||||||
|
parentGrid = new Vector2f(-1, -1);
|
||||||
|
|
||||||
|
gridSquare = heightMap.getGridSquare(zoneLoc);
|
||||||
|
gridOffset = HeightMap.getGridOffset(gridSquare);
|
||||||
|
|
||||||
|
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, currentZone.getName());
|
||||||
|
this.throwbackInfo(pc, "Current Grid Square: " + gridSquare.x + " , " + gridSquare.y);
|
||||||
|
this.throwbackInfo(pc, "Grid Offset: " + gridOffset.x + " , " + gridOffset.y);
|
||||||
|
this.throwbackInfo(pc, "Parent Grid: " + parentGrid.x + " , " + parentGrid.y);
|
||||||
|
|
||||||
|
if (parentGrid.x != -1) {
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
this.throwbackInfo(pc, "Parent ALTITUDE: " + (parentAltitude));
|
||||||
|
this.throwbackInfo(pc, "Parent Interpolation: " + (parentAltitude + parentZone.getWorldAltitude()));
|
||||||
|
}
|
||||||
|
this.throwbackInfo(pc, "interpolated height: " + interaltitude);
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, "interpolated height with World: " + (interaltitude + currentZone.getWorldAltitude()));
|
||||||
|
|
||||||
|
float realWorldAltitude = interaltitude + currentZone.getWorldAltitude();
|
||||||
|
|
||||||
|
//OUTSET
|
||||||
|
if (parentZone != null) {
|
||||||
|
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
|
||||||
|
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
|
||||||
|
|
||||||
|
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
|
||||||
|
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
|
||||||
|
|
||||||
|
float bucketScaleX = 100 / parentXRadius;
|
||||||
|
float bucketScaleZ = 200 / parentZRadius;
|
||||||
|
|
||||||
|
float outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||||
|
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||||
|
float weight;
|
||||||
|
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
|
||||||
|
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
|
||||||
|
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
|
||||||
|
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getAbsY();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
} else if (offsetZ > outsideGridSizeZ) {
|
||||||
|
|
||||||
|
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||||
|
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||||
|
|
||||||
|
float scaleChild = (float) ((scale + 1) * .5);
|
||||||
|
float scaleParent = 1 - scaleChild;
|
||||||
|
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||||
|
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||||
|
|
||||||
|
parentCenterAltitude += currentZone.getYCoord();
|
||||||
|
parentCenterAltitude += interaltitude;
|
||||||
|
float firstScale = parentAltitude * scaleParent;
|
||||||
|
float secondScale = parentCenterAltitude * scaleChild;
|
||||||
|
float outsetALt = firstScale + secondScale;
|
||||||
|
|
||||||
|
outsetALt += currentZone.getParent().getAbsY();
|
||||||
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float strMod = pc.statStrBase - 40;
|
||||||
|
|
||||||
|
strMod *= .00999999998f;
|
||||||
|
|
||||||
|
strMod += 1f;
|
||||||
|
|
||||||
|
float radius = 0;
|
||||||
|
switch (pc.getRaceID()) {
|
||||||
|
case 2017:
|
||||||
|
radius = 3.1415927f;
|
||||||
|
case 2000:
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
strMod *= 1.5707964f;
|
||||||
|
|
||||||
|
strMod += 3.1415927f;
|
||||||
|
|
||||||
|
strMod -= .5f;
|
||||||
|
|
||||||
|
|
||||||
|
realWorldAltitude += strMod;
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "Child Height at loc: " + Math.ceil(childHeight));
|
|
||||||
this.throwbackInfo(playerCharacter, "Parent Height at loc: " + Math.ceil(parentHeight));
|
|
||||||
this.throwbackInfo(playerCharacter, "Blended Height (Ceil): " + blendedHeight + " (" + Math.ceil(blendedHeight) + ")");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Queries heightmap engine";
|
return "Temporarily Changes SubRace";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "' /getheight";
|
return "' /subrace mobBaseID";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class GetOffsetCmd extends AbstractDevCmd {
|
|||||||
float difY = pcSender.getLoc().y - zone.absY;
|
float difY = pcSender.getLoc().y - zone.absY;
|
||||||
float difZ = pcSender.getLoc().z - zone.absZ;
|
float difZ = pcSender.getLoc().z - zone.absZ;
|
||||||
|
|
||||||
throwbackInfo(pcSender, zone.zoneName + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
|
throwbackInfo(pcSender, zone.getName() + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class GetZoneCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Zone zone : allIn)
|
for (Zone zone : allIn)
|
||||||
throwbackInfo(pcSender, zone.zoneName + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.templateID);
|
throwbackInfo(pcSender, zone.getName() + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.getLoadNum());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class GotoCmd extends AbstractDevCmd {
|
|||||||
continue;
|
continue;
|
||||||
Zone zone = city.getParent();
|
Zone zone = city.getParent();
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
if (zone.isNPCCity || zone.guild_zone)
|
if (zone.isNPCCity() || zone.isPlayerCity())
|
||||||
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
||||||
else
|
else
|
||||||
loc = zone.getLoc();
|
loc = zone.getLoc();
|
||||||
@@ -97,10 +97,10 @@ public class GotoCmd extends AbstractDevCmd {
|
|||||||
Zone zone = (Zone) zoneAgo;
|
Zone zone = (Zone) zoneAgo;
|
||||||
if (zone == null)
|
if (zone == null)
|
||||||
continue;
|
continue;
|
||||||
if (!zone.zoneName.equalsIgnoreCase(cityName))
|
if (!zone.getName().equalsIgnoreCase(cityName))
|
||||||
continue;
|
continue;
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
if (zone.isNPCCity || zone.guild_zone)
|
if (zone.isNPCCity() || zone.isPlayerCity())
|
||||||
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
||||||
else
|
else
|
||||||
loc = zone.getLoc();
|
loc = zone.getLoc();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class HotzoneCmd extends AbstractDevCmd {
|
|||||||
String input = data.toString().trim();
|
String input = data.toString().trim();
|
||||||
|
|
||||||
if (input.length() == 0) {
|
if (input.length() == 0) {
|
||||||
outString = "Current hotZone: " + ZoneManager.hotZone.zoneName + "\r\n";
|
outString = "Current hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
|
||||||
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
||||||
throwbackInfo(playerCharacter, outString);
|
throwbackInfo(playerCharacter, outString);
|
||||||
return;
|
return;
|
||||||
@@ -48,7 +48,7 @@ public class HotzoneCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (input.equalsIgnoreCase("random")) {
|
if (input.equalsIgnoreCase("random")) {
|
||||||
ZoneManager.generateAndSetRandomHotzone();
|
ZoneManager.generateAndSetRandomHotzone();
|
||||||
outString = "New hotZone: " + ZoneManager.hotZone.zoneName + "\r\n";
|
outString = "New hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
|
||||||
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
||||||
throwbackInfo(playerCharacter, outString);
|
throwbackInfo(playerCharacter, outString);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "EquipSet: " + targetNPC.getEquipmentSetID();
|
output += "EquipSet: " + targetNPC.getEquipmentSetID();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().templateID;
|
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,9 +440,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "isSummonedPet: true";
|
output += "isSummonedPet: true";
|
||||||
else
|
else
|
||||||
output += "isSummonedPet: false";
|
output += "isSummonedPet: false";
|
||||||
|
PlayerCharacter owner = targetMob.getOwner();
|
||||||
|
|
||||||
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
|
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
output += " owner: " + owner.getObjectUUID();
|
output += " owner: " + owner.getObjectUUID();
|
||||||
output += newline;
|
output += newline;
|
||||||
@@ -473,7 +471,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "EquipSet: " + targetMob.equipmentSetID;
|
output += "EquipSet: " + targetMob.equipmentSetID;
|
||||||
output += newline;
|
output += newline;
|
||||||
try {
|
try {
|
||||||
output += "Parent Zone LoadNum : " + targetMob.getParentZone().templateID;
|
output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//who cares
|
//who cares
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.Enum.TargetColor;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.SessionManager;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.util.StringUtils;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author
|
|
||||||
*/
|
|
||||||
public class ItemInfoCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public ItemInfoCmd() {
|
|
||||||
super("iteminfo");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,AbstractGameObject target) {
|
|
||||||
if (pc == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(target.getObjectType().equals(GameObjectType.Item) == false){
|
|
||||||
throwbackInfo(pc, "Must Select An Item");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Item item = (Item)target;
|
|
||||||
String newline = "\r\n ";
|
|
||||||
String output = "";
|
|
||||||
output += "Required Races:" + newline;
|
|
||||||
for(Enum.MonsterType required : item.getItemBase().requiredRaces)
|
|
||||||
output += " " + required.name() + newline;
|
|
||||||
output += "Restricted Races:" + newline;
|
|
||||||
for(Enum.MonsterType required : item.getItemBase().restrictedRaces)
|
|
||||||
output += " " + required.name() + newline;
|
|
||||||
output += "Required Classes:" + newline;
|
|
||||||
for(Enum.ClassType required : item.getItemBase().requiredClasses)
|
|
||||||
output += " " + required.name() + newline;
|
|
||||||
output += "Restricted Classes:" + newline;
|
|
||||||
for(Enum.ClassType required : item.getItemBase().restrictedClasses)
|
|
||||||
output += " " + required.name() + newline;
|
|
||||||
output += "Required Disciplines:" + newline;
|
|
||||||
for(Enum.DisciplineType required : item.getItemBase().requiredDiscs)
|
|
||||||
output += " " + required.name() + newline;
|
|
||||||
output += "Restricted Disciplines:" + newline;
|
|
||||||
for(Enum.DisciplineType required : item.getItemBase().restrictedDiscs)
|
|
||||||
output += " " + required.name() + newline;
|
|
||||||
throwbackInfo(pc, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Gets information on an Object.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /iteminfo'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -111,12 +111,12 @@ public class MakeBaneCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zone.guild_zone) {
|
if (!zone.isPlayerCity()) {
|
||||||
throwbackError(pc, "This is not a player city.");
|
throwbackError(pc, "This is not a player city.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityUUID);
|
City city = City.getCity(zone.getPlayerCityUUID());
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||||
return;
|
return;
|
||||||
@@ -167,7 +167,7 @@ public class MakeBaneCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stone.addEffectBit((1 << 19));
|
stone.addEffectBit((1 << 19));
|
||||||
BuildingManager.setRank(stone, (byte) rank);
|
stone.setRank((byte) rank);
|
||||||
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
|
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
|
||||||
stone.setCurrentHitPoints(stone.getMaxHitPoints());
|
stone.setCurrentHitPoints(stone.getMaxHitPoints());
|
||||||
BuildingManager.setUpgradeDateTime(stone, null, 0);
|
BuildingManager.setUpgradeDateTime(stone, null, 0);
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class PrintEffectsCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public PrintEffectsCmd() {
|
|
||||||
super("printeffects");
|
|
||||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
|
|
||||||
if (equip.containsKey(slot)) {
|
|
||||||
MobEquipment item = equip.get(slot);
|
|
||||||
if (item != null && item.getItemBase() != null) {
|
|
||||||
return item.getItemBase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
AbstractCharacter tar;
|
|
||||||
|
|
||||||
if (target != null && target instanceof AbstractCharacter) {
|
|
||||||
tar = (AbstractCharacter) target;
|
|
||||||
|
|
||||||
String newline = "\r\n ";
|
|
||||||
String output = "Effects For Character: " + tar.getName() + newline;
|
|
||||||
|
|
||||||
for(String effect : tar.effects.keySet()){
|
|
||||||
output += effect + newline;
|
|
||||||
}
|
|
||||||
throwbackInfo(pc, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Returns the player's current stats";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /printstats'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class PrintRunesCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public PrintRunesCmd() {
|
|
||||||
super("printrunes");
|
|
||||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
|
|
||||||
if (equip.containsKey(slot)) {
|
|
||||||
MobEquipment item = equip.get(slot);
|
|
||||||
if (item != null && item.getItemBase() != null) {
|
|
||||||
return item.getItemBase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
AbstractCharacter tar;
|
|
||||||
|
|
||||||
if (target != null && target instanceof AbstractCharacter) {
|
|
||||||
tar = (AbstractCharacter) target;
|
|
||||||
|
|
||||||
String newline = "\r\n ";
|
|
||||||
String output = "Applied Runes For Character: " + ((AbstractCharacter) target).getName() + newline;
|
|
||||||
|
|
||||||
for(CharacterRune rune : ((AbstractCharacter)target).runes){
|
|
||||||
output += rune.getRuneBaseID() + " " + rune.getRuneBase().getName() + newline;
|
|
||||||
}
|
|
||||||
throwbackInfo(pc, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Returns the player's current stats";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /printstats'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -103,19 +103,15 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
main = getWeaponBase(1, equip);
|
main = getWeaponBase(1, equip);
|
||||||
ItemBase off = null;
|
ItemBase off = null;
|
||||||
|
|
||||||
if(equip != null){
|
if (equip != null)
|
||||||
if(equip.get(2) != null && !equip.get(2).getItemBase().isShield()){
|
getWeaponBase(2, equip);
|
||||||
//off hand weapon
|
if (main == null && off == null) {
|
||||||
out += "Attack Rating: " + tar.atrHandTwo + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: 6" + newline;
|
||||||
out += "Damage: " + tar.minDamageHandTwo + " - " + tar.maxDamageHandTwo + newline;
|
} else {
|
||||||
out += "Range: " + tar.rangeHandTwo + newline;
|
if (main != null)
|
||||||
out += "Attack Speed: " + tar.speedHandTwo + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: " + main.getRange() + newline;
|
||||||
} else{
|
if (off != null)
|
||||||
out += "Attack Rating: " + tar.atrHandOne + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + ", range: " + off.getRange() + newline;
|
||||||
out += "Damage: " + tar.minDamageHandOne + " - " + tar.maxDamageHandOne + newline;
|
|
||||||
out += "Range: " + tar.rangeHandOne + newline;
|
|
||||||
out += "Attack Speed: " + tar.speedHandOne + newline;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
private static void PurgeWalls(Zone zone, PlayerCharacter pc) {
|
private static void PurgeWalls(Zone zone, PlayerCharacter pc) {
|
||||||
|
|
||||||
if (!zone.guild_zone)
|
if (!zone.isPlayerCity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Building building : zone.zoneBuildingSet) {
|
for (Building building : zone.zoneBuildingSet) {
|
||||||
@@ -59,25 +59,22 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
DbManager.removeFromCache(GameObjectType.NPC,
|
DbManager.removeFromCache(GameObjectType.NPC,
|
||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Integer minionUUID : mobA.minions) {
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -154,11 +151,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -167,11 +163,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Integer minionUUID : mobA.minions) {
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
Mob mob = Mob.getMob(minionUUID);
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ public class RealmInfoCmd extends AbstractDevCmd {
|
|||||||
outString += ")";
|
outString += ")";
|
||||||
outString += newline;
|
outString += newline;
|
||||||
|
|
||||||
outString += " Zone: " + serverZone.zoneName;
|
outString += " Zone: " + serverZone.getName();
|
||||||
|
|
||||||
outString += newline;
|
outString += newline;
|
||||||
|
|
||||||
if (serverZone.parent != null)
|
if (serverZone.getParent() != null)
|
||||||
outString += " Parent: " + serverZone.parent.zoneName;
|
outString += " Parent: " + serverZone.getParent().getName();
|
||||||
else
|
else
|
||||||
outString += "Parent: NONE";
|
outString += "Parent: NONE";
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,9 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.*;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
@@ -26,28 +25,42 @@ public class RegionCmd extends AbstractDevCmd {
|
|||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
String newline = "\r\n ";
|
|
||||||
String output;
|
|
||||||
output = "Target Region Information:" + newline;
|
|
||||||
|
|
||||||
Building building = BuildingManager.getBuildingAtLocation(((AbstractCharacter) target).loc);
|
if (pc.region == null) {
|
||||||
if(building == null){
|
|
||||||
this.throwbackInfo(pc, "No Building At This Location.") ;
|
|
||||||
}
|
|
||||||
Regions region = ((AbstractCharacter)target).region;
|
|
||||||
if (region == null) {
|
|
||||||
this.throwbackInfo(pc, "No Region Found.");
|
this.throwbackInfo(pc, "No Region Found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(region != null) {
|
|
||||||
output += "Player Info: " + ((AbstractCharacter) target).getName() + newline;
|
String newLine = System.getProperty("line.separator");
|
||||||
output += "Region Building: " + building.getName() + newline;
|
String result = "";
|
||||||
output += "Region Height: " + region.lerpY((AbstractCharacter)target) + newline;
|
result += (pc.region.getClass().getSimpleName());
|
||||||
output += "is Stairs: " + region.isStairs() + newline;
|
result += (" {");
|
||||||
output += "is Outside: " + region.isOutside();
|
result += (newLine);
|
||||||
this.throwbackInfo(pc, output);
|
Field[] fields = pc.region.getClass().getDeclaredFields();
|
||||||
|
|
||||||
|
//print field names paired with their values
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
result += (" ");
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (field.getName().contains("Furniture"))
|
||||||
|
continue;
|
||||||
|
result += (field.getName());
|
||||||
|
result += (": ");
|
||||||
|
//requires access to private field:
|
||||||
|
result += (field.get(pc.region).toString());
|
||||||
|
} catch (IllegalAccessException ex) {
|
||||||
|
System.out.println(ex);
|
||||||
|
}
|
||||||
|
result.trim();
|
||||||
|
result += (newLine);
|
||||||
}
|
}
|
||||||
|
result += ("}");
|
||||||
|
|
||||||
|
this.throwbackInfo(pc, result.toString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ public class RemoveBaneCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zone.guild_zone) {
|
if (!zone.isPlayerCity()) {
|
||||||
throwbackError(pc, "This is not a player city.");
|
throwbackError(pc, "This is not a player city.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityUUID);
|
City city = City.getCity(zone.getPlayerCityUUID());
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -11,9 +11,13 @@ package engine.devcmd.cmds;
|
|||||||
|
|
||||||
import engine.Enum.BuildingGroup;
|
import engine.Enum.BuildingGroup;
|
||||||
import engine.Enum.DbObjectType;
|
import engine.Enum.DbObjectType;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.BuildingManager;
|
||||||
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
@@ -127,23 +131,56 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
building.disableSpire(false);
|
building.disableSpire(false);
|
||||||
|
|
||||||
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) {
|
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) {
|
||||||
City city = City.getCity(building.getParentZone().playerCityUUID);
|
City city = City.getCity(building.getParentZone().getPlayerCityUUID());
|
||||||
if (city != null) {
|
if (city != null) {
|
||||||
city.setWarehouseBuildingID(0);
|
city.setWarehouseBuildingID(0);
|
||||||
}
|
}
|
||||||
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
|
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//remove cached shrines.
|
//remove cached shrines.
|
||||||
if ((building.getBlueprintUUID() != 0)
|
if ((building.getBlueprintUUID() != 0)
|
||||||
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
|
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
|
||||||
Shrine.RemoveShrineFromCacheByBuilding(building);
|
Shrine.RemoveShrineFromCacheByBuilding(building);
|
||||||
|
|
||||||
// Remove hirelings for this building
|
for (AbstractCharacter ac : building.getHirelings().keySet()) {
|
||||||
|
NPC npc = null;
|
||||||
|
Mob mobA = null;
|
||||||
|
|
||||||
for (AbstractCharacter abstractCharacter : building.getHirelings().keySet())
|
if (ac.getObjectType() == GameObjectType.NPC)
|
||||||
BuildingManager.removeHireling(building, abstractCharacter);
|
npc = (NPC) ac;
|
||||||
|
else if (ac.getObjectType() == GameObjectType.Mob)
|
||||||
|
mobA = (Mob) ac;
|
||||||
|
|
||||||
|
if (npc != null) {
|
||||||
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
|
if (mob.getParentZone() != null)
|
||||||
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
|
}
|
||||||
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
|
DbManager.removeFromCache(npc);
|
||||||
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
|
WorldGrid.removeObject(npc, pc);
|
||||||
|
} else if (mobA != null) {
|
||||||
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
//Mob.getRespawnMap().remove(mob);
|
||||||
|
if (mob.getParentZone() != null)
|
||||||
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
|
}
|
||||||
|
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||||
|
DbManager.removeFromCache(mobA);
|
||||||
|
WorldGrid.RemoveWorldObject(mobA);
|
||||||
|
WorldGrid.removeObject(mobA, pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Zone zone = building.getParentZone();
|
Zone zone = building.getParentZone();
|
||||||
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
||||||
DbManager.removeFromCache(building);
|
DbManager.removeFromCache(building);
|
||||||
@@ -172,13 +209,11 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
if (npc.building != null)
|
if (npc.building != null)
|
||||||
npc.building.getHirelings().remove(npc);
|
npc.building.getHirelings().remove(npc);
|
||||||
|
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
Mob minionMob = Mob.getMob(minionUUID);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.RemoveWorldObject(minionMob);
|
WorldGrid.removeObject(mob, pc);
|
||||||
WorldGrid.removeObject(minionMob, pc);
|
if (mob.getParentZone() != null)
|
||||||
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
if (minionMob.getParentZone() != null)
|
|
||||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ public class SetBaneActiveCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zone.guild_zone) {
|
if (!zone.isPlayerCity()) {
|
||||||
throwbackError(pc, "This is not a player city.");
|
throwbackError(pc, "This is not a player city.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityUUID);
|
City city = City.getCity(zone.getPlayerCityUUID());
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ public class SetForceRenameCityCmd extends AbstractDevCmd {
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
return;
|
return;
|
||||||
boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
|
boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
|
||||||
if (zone.playerCityUUID == 0)
|
if (zone.getPlayerCityUUID() == 0)
|
||||||
return;
|
return;
|
||||||
City city = City.getCity(zone.playerCityUUID);
|
City city = City.getCity(zone.getPlayerCityUUID());
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return;
|
return;
|
||||||
city.setForceRename(rename);
|
city.setForceRename(rename);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class SetRankCmd extends AbstractDevCmd {
|
|||||||
Blueprint blueprint = targetBuilding.getBlueprint();
|
Blueprint blueprint = targetBuilding.getBlueprint();
|
||||||
|
|
||||||
if (blueprint == null) {
|
if (blueprint == null) {
|
||||||
BuildingManager.setRank(targetBuilding, targetRank);
|
targetBuilding.setRank(targetRank);
|
||||||
ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID());
|
ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -68,8 +68,9 @@ public class SetRankCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the current targetRank
|
// Set the current targetRank
|
||||||
|
int lastMeshID = targetBuilding.getMeshUUID();
|
||||||
|
targetBuilding.setRank(targetRank);
|
||||||
|
|
||||||
BuildingManager.setRank(targetBuilding, targetRank);
|
|
||||||
ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
|
ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
|
||||||
break;
|
break;
|
||||||
case NPC:
|
case NPC:
|
||||||
@@ -113,7 +114,7 @@ public class SetRankCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
// Set the current targetRank
|
// Set the current targetRank
|
||||||
int lastMeshID = targetBuilding.getMeshUUID();
|
int lastMeshID = targetBuilding.getMeshUUID();
|
||||||
BuildingManager.setRank(targetBuilding, targetRank);
|
targetBuilding.setRank(targetRank);
|
||||||
|
|
||||||
if (lastMeshID != targetBuilding.getMeshUUID())
|
if (lastMeshID != targetBuilding.getMeshUUID())
|
||||||
targetBuilding.refresh(true);
|
targetBuilding.refresh(true);
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
// pum.setEffectID(token);
|
// pum.setEffectID(token);
|
||||||
// pum.setSourceType(pc.getObjectType().ordinal());
|
// pum.setSourceType(pc.getObjectType().ordinal());
|
||||||
// pum.setSourceID(pc.getObjectUUID());
|
// pum.setSourceID(pc.getObjectUUID());
|
||||||
// pum.setStartLocType(pc.getObjectType().ordinal());
|
// pum.setTargetType(pc.getObjectType().ordinal());
|
||||||
// pum.setTargetID(pc.getObjectUUID());
|
// pum.setTargetID(pc.getObjectUUID());
|
||||||
// pum.setNumTrains(40);
|
// pum.setNumTrains(40);
|
||||||
// pum.setDuration(-1);
|
// pum.setDuration(-1);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
if (stringIndex == -1)
|
if (stringIndex == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Validate we have a correct building group name
|
// Validate we have a corrent building group name
|
||||||
|
|
||||||
for (BuildingGroup group : BuildingGroup.values()) {
|
for (BuildingGroup group : BuildingGroup.values()) {
|
||||||
if (group.name().equals(userInput[0].toUpperCase()))
|
if (group.name().equals(userInput[0].toUpperCase()))
|
||||||
@@ -114,7 +114,8 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
||||||
Logger.error("Failed to update Database for Contract Allowed buildings");
|
Logger.error("Failed to update Database for Contract Allowed buildings");
|
||||||
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. ");
|
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. " +
|
||||||
|
"Contact A CCR, oh wait, you are a CCR. You're Fubared.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +125,8 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
contract.getAllowedBuildings().remove(buildingGroup);
|
contract.getAllowedBuildings().remove(buildingGroup);
|
||||||
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
|
||||||
Logger.error("Failed to update Database for Contract Allowed buildings");
|
Logger.error("Failed to update Database for Contract Allowed buildings");
|
||||||
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. ");
|
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. " +
|
||||||
|
"Contact A CCR, oh wait, you are a CCR. You're Fubared.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,14 +138,14 @@ public class SlotNpcCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Toggles a building group on a targeted npc";
|
return "Sets a building slot on a targeted npc";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class methods
|
// Class methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
String usage = "/npcslot [BuildingGroup] on-off \n";
|
String usage = "/npcslot [BuildingType] on-off \n";
|
||||||
|
|
||||||
for (BuildingGroup group : BuildingGroup.values()) {
|
for (BuildingGroup group : BuildingGroup.values()) {
|
||||||
usage += group.name() + ' ';
|
usage += group.name() + ' ';
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -111,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
mobile = Mob.createMob(_mobileUUID,
|
mobile = Mob.createMob(_mobileUUID,
|
||||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||||
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, true, serverZone, null, 0, "", 1);
|
||||||
|
|
||||||
if (mobile != null) {
|
if (mobile != null) {
|
||||||
mobile.updateDatabase();
|
mobile.updateDatabase();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class SummonCmd extends AbstractDevCmd {
|
|||||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
String location = "Somewhere";
|
String location = "Somewhere";
|
||||||
if (zone != null)
|
if (zone != null)
|
||||||
location = zone.zoneName;
|
location = zone.getName();
|
||||||
RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(),
|
RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(),
|
||||||
location, false);
|
location, false);
|
||||||
toSummon.getClientConnection().sendMsg(rsrm);
|
toSummon.getClientConnection().sendMsg(rsrm);
|
||||||
|
|||||||
@@ -73,41 +73,44 @@ public class ZoneInfoCmd extends AbstractDevCmd {
|
|||||||
output = "Target Information:" + newline;
|
output = "Target Information:" + newline;
|
||||||
output += StringUtils.addWS("UUID: " + objectUUID, 20);
|
output += StringUtils.addWS("UUID: " + objectUUID, 20);
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "name: " + zone.zoneName;
|
output += "name: " + zone.getName();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "loadNum: " + zone.templateID;
|
output += "loadNum: " + zone.getLoadNum();
|
||||||
if (zone.parent != null) {
|
if (zone.getParent() != null) {
|
||||||
output += StringUtils.addWS(", parent: " + zone.parent.getObjectUUID(), 30);
|
output += StringUtils.addWS(", parent: " + zone.getParent().getObjectUUID(), 30);
|
||||||
output += "Parentabs: x: " + zone.parent.absX + ", y: " + zone.parent.absY + ", z: " + zone.parent.absZ;
|
output += "Parentabs: x: " + zone.getParent().getAbsX() + ", y: " + zone.getParent().getAbsY() + ", z: " + zone.getParent().getAbsZ();
|
||||||
|
|
||||||
} else
|
} else
|
||||||
output += StringUtils.addWS(", parent: none", 30);
|
output += StringUtils.addWS(", parent: none", 30);
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "absLoc: x: " + zone.absX + ", y: " + zone.absY + ", z: " + zone.absZ;
|
output += "absLoc: x: " + zone.getAbsX() + ", y: " + zone.getAbsY() + ", z: " + zone.getAbsZ();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "offset: x: " + zone.xOffset + ", y: " + zone.yOffset + ", z: " + zone.zOffset;
|
output += "offset: x: " + zone.getXCoord() + ", y: " + zone.getYCoord() + ", z: " + zone.getZCoord();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "radius: x: " + zone.bounds.getHalfExtents().x + ", z: " + zone.bounds.getHalfExtents().y;
|
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
|
||||||
output += newline;
|
output += newline;
|
||||||
|
|
||||||
if (zone.terrain != null) {
|
if (zone.getHeightMap() != null) {
|
||||||
output += "Terrain image: " + zone.template.terrain_image;
|
output += "HeightMap ID: " + zone.getHeightMap().getHeightMapID();
|
||||||
output += newline;
|
output += newline;
|
||||||
}
|
output += "Bucket Width X : " + zone.getHeightMap().getBucketWidthX();
|
||||||
|
output += newline;
|
||||||
|
output += "Bucket Width Y : " + zone.getHeightMap().getBucketWidthY();
|
||||||
|
|
||||||
output += "radius: x: " + zone.bounds.getHalfExtents().x + ", z: " + zone.bounds.getHalfExtents().y;
|
}
|
||||||
|
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
|
||||||
output += newline;
|
output += newline;
|
||||||
// output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
|
// output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Sea Level = " + zone.sea_level;
|
output += "Sea Level = " + zone.getSeaLevel();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "World Altitude = " + zone.global_height;
|
output += "World Altitude = " + zone.getWorldAltitude();
|
||||||
throwbackInfo(player, output);
|
throwbackInfo(player, output);
|
||||||
|
|
||||||
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
||||||
|
|
||||||
output += newline;
|
output += newline;
|
||||||
output += (city == null) ? "None" : city.getParent().zoneName;
|
output += (city == null) ? "None" : city.getParent().getName();
|
||||||
|
|
||||||
if (city != null) {
|
if (city != null) {
|
||||||
|
|
||||||
@@ -120,14 +123,14 @@ public class ZoneInfoCmd extends AbstractDevCmd {
|
|||||||
} else {
|
} else {
|
||||||
output = "children:";
|
output = "children:";
|
||||||
|
|
||||||
ArrayList<Zone> nodes = zone.nodes;
|
ArrayList<Zone> nodes = zone.getNodes();
|
||||||
|
|
||||||
if (nodes.isEmpty())
|
if (nodes.isEmpty())
|
||||||
output += " none";
|
output += " none";
|
||||||
|
|
||||||
for (Zone child : nodes) {
|
for (Zone child : nodes) {
|
||||||
output += newline;
|
output += newline;
|
||||||
output += child.zoneName + " (" + child.templateID + ')';
|
output += child.getName() + " (" + child.getLoadNum() + ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throwbackInfo(player, output);
|
throwbackInfo(player, output);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class ZoneSetCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
zone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
zone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
||||||
|
|
||||||
throwbackInfo(playerCharacter, zone.zoneName + " (" + zone.templateID + ") " + zone.getObjectUUID());
|
throwbackInfo(playerCharacter, zone.getName() + " (" + zone.getLoadNum() + ") " + zone.getObjectUUID());
|
||||||
|
|
||||||
// NPC
|
// NPC
|
||||||
|
|
||||||
|
|||||||
@@ -9,17 +9,12 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.PowersManager;
|
|
||||||
import engine.mobileAI.MobAI;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.powers.RunePowerEntry;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@@ -61,95 +56,36 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
output = "Mob AI Information:" + newline;
|
output = "Mob AI Information:" + newline;
|
||||||
output += mob.getName() + newline;
|
output += mob.getName() + newline;
|
||||||
output += mob.agentType.toString() + newline;
|
if (mob.BehaviourType != null) {
|
||||||
|
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
|
||||||
int contractID = 0;
|
if (mob.BehaviourType.BehaviourHelperType != null) {
|
||||||
|
output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
|
||||||
if (mob.isPlayerGuard() == true) {
|
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
|
||||||
contractID = mob.guardCaptain.contract.getContractID();
|
|
||||||
else
|
|
||||||
contractID = mob.contract.getContractID();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contractID != 0) {
|
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
|
||||||
output += "Captain Contract: " + contractID + newline;
|
|
||||||
output += "Captain UUID: " + mob.guardCaptain.getObjectUUID() + newline;
|
|
||||||
} else
|
|
||||||
output += "Contract: " + contractID + newline;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mob.behaviourType != null) {
|
|
||||||
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
|
||||||
if (mob.behaviourType.BehaviourHelperType != null) {
|
|
||||||
output += "Behaviour Helper Type: " + mob.behaviourType.BehaviourHelperType.toString() + newline;
|
|
||||||
} else {
|
} else {
|
||||||
output += "Behaviour Helper Type: NULL" + newline;
|
output += "Behaviour Helper Type: NULL" + newline;
|
||||||
}
|
}
|
||||||
output += "Wimpy: " + mob.behaviourType.isWimpy + newline;
|
output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
|
||||||
output += "Agressive: " + mob.behaviourType.isAgressive + newline;
|
output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
|
||||||
output += "Can Roam: " + mob.behaviourType.canRoam + newline;
|
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
|
||||||
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline;
|
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
|
||||||
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline;
|
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
|
||||||
} else {
|
} else {
|
||||||
output += "BehaviourType: NULL" + newline;
|
output += "BehaviourType: NULL" + newline;
|
||||||
}
|
}
|
||||||
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
||||||
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
|
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
|
||||||
if (mob.playerAgroMap.size() > 0) {
|
if (mob.playerAgroMap.size() > 0) {
|
||||||
output += "Players Loaded:" + newline;
|
output += "Players Loaded:" + newline;
|
||||||
}
|
}
|
||||||
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) {
|
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
|
||||||
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline;
|
output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline;
|
||||||
}
|
}
|
||||||
if (mob.getCombatTarget() != null)
|
if (mob.getCombatTarget() != null)
|
||||||
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
|
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
|
||||||
else
|
else
|
||||||
output += "Current Target: NULL" + newline;
|
output += "Current Target: NULL" + newline;
|
||||||
|
|
||||||
if (mob.guardedCity != null)
|
for (int token : mob.mobPowers.keySet())
|
||||||
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
output += token + newline;
|
||||||
output += "See Invis Level: " + mob.mobBase.getSeeInvis() + newline;
|
|
||||||
output += "Can Cast: " + MobAI.canCast(mob) + newline;
|
|
||||||
output += "Powers:" + newline;
|
|
||||||
|
|
||||||
ArrayList<RunePowerEntry> powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
|
||||||
|
|
||||||
// Additional powers may come from the contract ID. This is to support
|
|
||||||
// powers for player guards irrespective of the mobbase used.
|
|
||||||
|
|
||||||
if (mob.isPlayerGuard()) {
|
|
||||||
|
|
||||||
ArrayList<RunePowerEntry> contractEntries = new ArrayList<>();
|
|
||||||
|
|
||||||
if (mob.contract != null)
|
|
||||||
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
|
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
|
||||||
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
|
|
||||||
|
|
||||||
powerEntries.addAll(contractEntries);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (RunePowerEntry runePowerEntry : powerEntries)
|
|
||||||
output += PowersManager.getPowerByToken(runePowerEntry.token).getName() + newline;
|
|
||||||
|
|
||||||
// List outlaws defined for this player guard's city
|
|
||||||
|
|
||||||
if (mob.isPlayerGuard()) {
|
|
||||||
|
|
||||||
ArrayList<Integer> outlaws = new ArrayList(mob.guardedCity.cityOutlaws);
|
|
||||||
|
|
||||||
if (outlaws.isEmpty() == false)
|
|
||||||
output += "Outlaws: " + newline;
|
|
||||||
|
|
||||||
for (Integer outlawUUID : outlaws)
|
|
||||||
output += outlawUUID + newline;
|
|
||||||
}
|
|
||||||
|
|
||||||
throwbackInfo(playerCharacter, output);
|
throwbackInfo(playerCharacter, output);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public enum BuildingManager {
|
public enum BuildingManager {
|
||||||
@@ -41,9 +40,6 @@ public enum BuildingManager {
|
|||||||
public static HashMap<Integer, ArrayList<BuildingLocation>> _stuckLocations = new HashMap<>();
|
public static HashMap<Integer, ArrayList<BuildingLocation>> _stuckLocations = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<BuildingLocation>> _slotLocations = new HashMap<>();
|
public static HashMap<Integer, ArrayList<BuildingLocation>> _slotLocations = new HashMap<>();
|
||||||
|
|
||||||
public static HashMap<Integer, ConcurrentHashMap<Integer, BuildingFriends>> _buildingFriends = new HashMap<>();
|
|
||||||
public static HashMap<Integer, ConcurrentHashMap<Integer, Condemned>> _buildingCondemned = new HashMap<>();
|
|
||||||
public static HashMap<Integer, ArrayList<Vector3fImmutable>> _buildingPatrolPoints = new HashMap<>();
|
|
||||||
public static int getAvailableSlot(Building building) {
|
public static int getAvailableSlot(Building building) {
|
||||||
|
|
||||||
ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID);
|
ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID);
|
||||||
@@ -108,6 +104,7 @@ public enum BuildingManager {
|
|||||||
if (building == null)
|
if (building == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if (building.getRank() == -1)
|
if (building.getRank() == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -115,25 +112,26 @@ public enum BuildingManager {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
//individual friend.
|
//individual friend.
|
||||||
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null)
|
if (building.getFriends().get(player.getObjectUUID()) != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Admins can access stuff
|
//Admin's can access stuff
|
||||||
|
|
||||||
if (player.isCSR())
|
if (player.isCSR())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Guild stuff
|
//Guild stuff
|
||||||
|
|
||||||
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
|
|
||||||
|
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).getFriendType() == 8)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).getFriendType() == 9
|
||||||
&& GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
&& GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -234,15 +232,15 @@ public enum BuildingManager {
|
|||||||
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (warehouse.resources.get(resourceBase) == null)
|
if (warehouse.getResources().get(resourceBase) == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int resourceAmount = warehouse.resources.get(resourceBase);
|
int resourceAmount = warehouse.getResources().get(resourceBase);
|
||||||
|
|
||||||
if (resourceAmount <= 0)
|
if (resourceAmount <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Warehouse.loot(warehouse, player, resourceBase, resourceAmount, true))
|
if (warehouse.loot(player, resourceBase, resourceAmount, true))
|
||||||
ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + resourceBase.getName());
|
ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + resourceBase.getName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -310,72 +308,6 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeHireling(Building building, AbstractCharacter hireling) {
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
|
|
||||||
|
|
||||||
Mob guardCaptain = (Mob) hireling;
|
|
||||||
|
|
||||||
// Clear minions from database if a guard captain
|
|
||||||
|
|
||||||
if (guardCaptain.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
|
||||||
DbManager.MobQueries.REMOVE_ALL_MINIONS(hireling.getObjectUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear minions from world
|
|
||||||
|
|
||||||
for (Integer minionUUID : hireling.minions) {
|
|
||||||
Mob minionMob = Mob.getMob(minionUUID);
|
|
||||||
DbManager.removeFromCache(minionMob);
|
|
||||||
WorldGrid.RemoveWorldObject(minionMob);
|
|
||||||
WorldGrid.unloadObject(minionMob);
|
|
||||||
|
|
||||||
if (minionMob.getParentZone() != null)
|
|
||||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove hireling from building
|
|
||||||
|
|
||||||
building.getHirelings().remove(hireling);
|
|
||||||
|
|
||||||
// Remove from zone mob set
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.Mob)) {
|
|
||||||
|
|
||||||
Mob hirelingMob = (Mob) hireling;
|
|
||||||
|
|
||||||
if (hirelingMob.getParentZone() != null)
|
|
||||||
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
|
|
||||||
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
|
||||||
|
|
||||||
NPC hirelingNPC = (NPC) hireling;
|
|
||||||
|
|
||||||
if (hirelingNPC.getParentZone() != null)
|
|
||||||
if (hirelingNPC.getParentZone().zoneNPCSet.contains(hirelingNPC))
|
|
||||||
hirelingNPC.getParentZone().zoneNPCSet.remove(hireling);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unload hireling from world
|
|
||||||
|
|
||||||
DbManager.removeFromCache(hireling);
|
|
||||||
WorldGrid.RemoveWorldObject(hireling);
|
|
||||||
WorldGrid.removeObject(hireling);
|
|
||||||
|
|
||||||
// Delete hireling from database
|
|
||||||
|
|
||||||
if (hireling.getObjectType().equals(GameObjectType.Mob))
|
|
||||||
DbManager.MobQueries.DELETE_MOB((Mob) hireling);
|
|
||||||
else
|
|
||||||
DbManager.NPCQueries.DELETE_NPC((NPC) hireling);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void cleanupHirelings(Building building) {
|
public static void cleanupHirelings(Building building) {
|
||||||
|
|
||||||
// Early exit: Cannot have hirelings in a building
|
// Early exit: Cannot have hirelings in a building
|
||||||
@@ -388,18 +320,42 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
if (building.getRank() < 1) {
|
if (building.getRank() < 1) {
|
||||||
|
|
||||||
for (AbstractCharacter slottedNPC : building.getHirelings().keySet())
|
for (AbstractCharacter slottedNPC : building.getHirelings().keySet()) {
|
||||||
BuildingManager.removeHireling(building, slottedNPC);
|
|
||||||
|
|
||||||
|
if (slottedNPC.getObjectType() == Enum.GameObjectType.NPC)
|
||||||
|
((NPC) slottedNPC).remove();
|
||||||
|
else if (slottedNPC.getObjectType() == Enum.GameObjectType.Mob)
|
||||||
|
NPCManager.removeMobileFromBuilding(((Mob) slottedNPC), building);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete hireling if building has deranked.
|
// Delete hireling if building has deranked.
|
||||||
|
|
||||||
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
||||||
|
|
||||||
|
NPC npc = null;
|
||||||
|
Mob mob = null;
|
||||||
|
|
||||||
|
if (hireling.getObjectType() == Enum.GameObjectType.NPC)
|
||||||
|
npc = (NPC) hireling;
|
||||||
|
else if (hireling.getObjectType() == Enum.GameObjectType.Mob)
|
||||||
|
mob = (Mob) hireling;
|
||||||
|
|
||||||
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
||||||
BuildingManager.removeHireling(building, hireling);
|
|
||||||
|
if (npc != null) {
|
||||||
|
if (!npc.remove())
|
||||||
|
Logger.error("Failed to remove npc " + npc.getObjectUUID()
|
||||||
|
+ "from Building " + building.getObjectUUID());
|
||||||
|
else
|
||||||
|
building.getHirelings().remove(npc);
|
||||||
|
} else if (mob != null) {
|
||||||
|
if (!NPCManager.removeMobileFromBuilding(mob, building))
|
||||||
|
Logger.error("Failed to remove npc " + npc.getObjectUUID()
|
||||||
|
+ "from Building " + building.getObjectUUID());
|
||||||
|
else
|
||||||
|
building.getHirelings().remove(npc);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,18 +452,18 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
||||||
|
|
||||||
if (condemn != null && condemn.active)
|
if (condemn != null && condemn.isActive())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (player.getGuild() != null) {
|
if (player.getGuild() != null) {
|
||||||
|
|
||||||
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
|
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
|
||||||
|
|
||||||
if (guildCondemn != null && guildCondemn.active)
|
if (guildCondemn != null && guildCondemn.isActive())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
|
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
|
||||||
return nationCondemn != null && nationCondemn.active && nationCondemn.friendType == Condemned.NATION;
|
return nationCondemn != null && nationCondemn.isActive() && nationCondemn.getFriendType() == Condemned.NATION;
|
||||||
} else {
|
} else {
|
||||||
//TODO ADD ERRANT KOS CHECK
|
//TODO ADD ERRANT KOS CHECK
|
||||||
}
|
}
|
||||||
@@ -515,18 +471,18 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
||||||
|
|
||||||
if (condemn != null && condemn.active)
|
if (condemn != null && condemn.isActive())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (player.getGuild() != null) {
|
if (player.getGuild() != null) {
|
||||||
|
|
||||||
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
|
Condemned guildCondemn = building.getCondemned().get(player.getGuild().getObjectUUID());
|
||||||
|
|
||||||
if (guildCondemn != null && guildCondemn.active)
|
if (guildCondemn != null && guildCondemn.isActive())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
|
Condemned nationCondemn = building.getCondemned().get(player.getGuild().getNation().getObjectUUID());
|
||||||
return nationCondemn == null || !nationCondemn.active || nationCondemn.friendType != Condemned.NATION;
|
return nationCondemn == null || !nationCondemn.isActive() || nationCondemn.getFriendType() != Condemned.NATION;
|
||||||
} else {
|
} else {
|
||||||
//TODO ADD ERRANT KOS CHECK
|
//TODO ADD ERRANT KOS CHECK
|
||||||
}
|
}
|
||||||
@@ -545,7 +501,7 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
NPC npc = null;
|
NPC npc = null;
|
||||||
|
|
||||||
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building);
|
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, null, zone, (short) rank, building);
|
||||||
|
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -574,63 +530,41 @@ public enum BuildingManager {
|
|||||||
else
|
else
|
||||||
rank = 10;
|
rank = 10;
|
||||||
|
|
||||||
Mob mobile;
|
Mob mob;
|
||||||
NPC npc;
|
NPC npc;
|
||||||
|
|
||||||
if (NPC.ISWallArcher(contract)) {
|
if (NPC.ISWallArcher(contract)) {
|
||||||
|
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDWALLARCHER);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardWallArcher;
|
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
// Spawn new mobile
|
|
||||||
|
|
||||||
mobile.setLoc(mobile.getLoc());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
||||||
|
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
// Spawn new mobile
|
|
||||||
|
|
||||||
mobile.setLoc(mobile.getLoc());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contract.getContractID() == 910) {
|
if (contract.getContractID() == 910) {
|
||||||
|
|
||||||
//guard dog
|
//guard dog
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
|
||||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
// Spawn new mobile
|
|
||||||
|
|
||||||
mobile.setLoc(mobile.getLoc());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -853,110 +787,4 @@ public enum BuildingManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void rebuildMine(Building mineBuilding) {
|
|
||||||
setRank(mineBuilding, 1);
|
|
||||||
mineBuilding.meshUUID = mineBuilding.getBlueprint().getMeshForRank(mineBuilding.rank);
|
|
||||||
|
|
||||||
// New rank mean new max hit points.
|
|
||||||
|
|
||||||
mineBuilding.healthMax = mineBuilding.getBlueprint().getMaxHealth(mineBuilding.rank);
|
|
||||||
mineBuilding.setCurrentHitPoints(mineBuilding.healthMax);
|
|
||||||
mineBuilding.getBounds().setBounds(mineBuilding);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setRank(Building building, int rank) {
|
|
||||||
|
|
||||||
int newMeshUUID;
|
|
||||||
boolean success;
|
|
||||||
|
|
||||||
|
|
||||||
// If this building has no blueprint then set rank and exit immediatly.
|
|
||||||
|
|
||||||
if (building.blueprintUUID == 0 || building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)) {
|
|
||||||
building.rank = rank;
|
|
||||||
DbManager.BuildingQueries.CHANGE_RANK(building.getObjectUUID(), rank);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete any upgrade jobs before doing anything else. It won't quite work
|
|
||||||
// if in a few lines we happen to delete this building.
|
|
||||||
|
|
||||||
JobContainer jc = building.getTimers().get("UPGRADE");
|
|
||||||
|
|
||||||
if (jc != null) {
|
|
||||||
if (!JobScheduler.getInstance().cancelScheduledJob(jc))
|
|
||||||
Logger.error("failed to cancel existing upgrade job.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attempt write to database, or delete the building
|
|
||||||
// if we are destroying it.
|
|
||||||
|
|
||||||
if (rank == -1)
|
|
||||||
success = DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
|
||||||
else
|
|
||||||
success = DbManager.BuildingQueries.updateBuildingRank(building, rank);
|
|
||||||
|
|
||||||
if (success == false) {
|
|
||||||
Logger.error("Error writing to database UUID: " + building.getObjectUUID());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
building.isDeranking.compareAndSet(false, true);
|
|
||||||
|
|
||||||
// Change the building's rank
|
|
||||||
|
|
||||||
building.rank = rank;
|
|
||||||
|
|
||||||
// New rank means new mesh
|
|
||||||
newMeshUUID = building.getBlueprint().getMeshForRank(building.rank);
|
|
||||||
|
|
||||||
if ((building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)&& (building.rank == 8))
|
|
||||||
newMeshUUID = Realm.getRealmMesh(building.getCity());
|
|
||||||
|
|
||||||
building.meshUUID = newMeshUUID;
|
|
||||||
|
|
||||||
// New rank mean new max hitpoints.
|
|
||||||
|
|
||||||
building.healthMax = building.getBlueprint().getMaxHealth(building.rank);
|
|
||||||
building.setCurrentHitPoints(building.healthMax);
|
|
||||||
|
|
||||||
if (building.getUpgradeDateTime() != null)
|
|
||||||
setUpgradeDateTime(building, null, 0);
|
|
||||||
|
|
||||||
// If we destroyed this building make sure to turn off
|
|
||||||
// protection
|
|
||||||
|
|
||||||
if (building.rank == -1)
|
|
||||||
building.protectionState = Enum.ProtectionState.NONE;
|
|
||||||
|
|
||||||
// update object to clients
|
|
||||||
|
|
||||||
building.refresh(true);
|
|
||||||
|
|
||||||
if (building.getBounds() != null)
|
|
||||||
building.getBounds().setBounds(building);
|
|
||||||
|
|
||||||
// Cleanup hirelings resulting from rank change
|
|
||||||
|
|
||||||
cleanupHirelings(building);
|
|
||||||
|
|
||||||
building.isDeranking.compareAndSet(true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Building getBuildingAtLocation(Vector3fImmutable loc) {
|
|
||||||
|
|
||||||
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(loc, 64, MBServerStatics.MASK_BUILDING)) {
|
|
||||||
Building building = (Building) awo;
|
|
||||||
|
|
||||||
if (building == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (Bounds.collide(loc, building.getBounds()))
|
|
||||||
return building;
|
|
||||||
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -788,7 +788,7 @@ public enum ChatManager {
|
|||||||
it.remove();
|
it.remove();
|
||||||
else {
|
else {
|
||||||
PlayerCharacter pcc = (PlayerCharacter) awo;
|
PlayerCharacter pcc = (PlayerCharacter) awo;
|
||||||
if (pcc.getSeeInvis() < pc.hidden)
|
if (pcc.getSeeInvis() < pc.getHidden())
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import java.util.HashSet;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
import static engine.math.FastMath.sqr;
|
||||||
|
|
||||||
public enum CombatManager {
|
public enum CombatManager {
|
||||||
|
|
||||||
COMBATMANAGER;
|
COMBATMANAGER;
|
||||||
@@ -39,6 +41,63 @@ public enum CombatManager {
|
|||||||
/**
|
/**
|
||||||
* Message sent by player to attack something.
|
* Message sent by player to attack something.
|
||||||
*/
|
*/
|
||||||
|
public static void setAttackTarget(AttackCmdMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
|
|
||||||
|
PlayerCharacter player;
|
||||||
|
int targetType;
|
||||||
|
AbstractWorldObject target;
|
||||||
|
|
||||||
|
if (TargetedActionMsg.un2cnt == 60 || TargetedActionMsg.un2cnt == 70)
|
||||||
|
return;
|
||||||
|
|
||||||
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//source must match player this account belongs to
|
||||||
|
|
||||||
|
if (player.getObjectUUID() != msg.getSourceID() || player.getObjectType().ordinal() != msg.getSourceType()) {
|
||||||
|
Logger.error("Msg Source ID " + msg.getSourceID() + " Does not Match Player ID " + player.getObjectUUID());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetType = msg.getTargetType();
|
||||||
|
|
||||||
|
if (targetType == GameObjectType.PlayerCharacter.ordinal()) {
|
||||||
|
target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||||
|
} else if (targetType == GameObjectType.Building.ordinal()) {
|
||||||
|
target = BuildingManager.getBuildingFromCache(msg.getTargetID());
|
||||||
|
} else if (targetType == GameObjectType.Mob.ordinal()) {
|
||||||
|
target = Mob.getFromCache(msg.getTargetID());
|
||||||
|
} else {
|
||||||
|
player.setCombatTarget(null);
|
||||||
|
return; //not valid type to attack
|
||||||
|
}
|
||||||
|
|
||||||
|
// quit of the combat target is already the current combat target
|
||||||
|
// or there is no combat target
|
||||||
|
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//set sources target
|
||||||
|
|
||||||
|
player.setCombatTarget(target);
|
||||||
|
|
||||||
|
//put in combat if not already
|
||||||
|
|
||||||
|
if (!player.isCombat())
|
||||||
|
toggleCombat(true, origin);
|
||||||
|
|
||||||
|
//make character stand if sitting
|
||||||
|
|
||||||
|
if (player.isSit())
|
||||||
|
toggleSit(false, origin);
|
||||||
|
|
||||||
|
AttackTarget(player, target);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) {
|
public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) {
|
||||||
|
|
||||||
@@ -82,6 +141,11 @@ public enum CombatManager {
|
|||||||
if (off == null)
|
if (off == null)
|
||||||
CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second
|
CombatManager.createTimer(playerCharacter, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second
|
||||||
}
|
}
|
||||||
|
|
||||||
|
City playerCity = ZoneManager.getCityAtLocation(playerCharacter.getLoc());
|
||||||
|
|
||||||
|
if (playerCity != null && playerCity.getGuild().getNation().equals(playerCharacter.getGuild().getNation()) == false && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
|
||||||
|
playerCity.cityOutlaws.add(playerCharacter.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {
|
public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
@@ -459,7 +523,7 @@ public enum CombatManager {
|
|||||||
/**
|
/**
|
||||||
* Attempt to attack target
|
* Attempt to attack target
|
||||||
*/
|
*/
|
||||||
private static void attack(AbstractCharacter attacker, AbstractWorldObject target, Item weapon, ItemBase wb, boolean mainHand) {
|
private static void attack(AbstractCharacter ac, AbstractWorldObject target, Item weapon, ItemBase wb, boolean mainHand) {
|
||||||
|
|
||||||
float atr;
|
float atr;
|
||||||
int minDamage, maxDamage;
|
int minDamage, maxDamage;
|
||||||
@@ -467,20 +531,20 @@ public enum CombatManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (attacker == null)
|
if (ac == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mainHand) {
|
if (mainHand) {
|
||||||
atr = attacker.getAtrHandOne();
|
atr = ac.getAtrHandOne();
|
||||||
minDamage = attacker.getMinDamageHandOne();
|
minDamage = ac.getMinDamageHandOne();
|
||||||
maxDamage = attacker.getMaxDamageHandOne();
|
maxDamage = ac.getMaxDamageHandOne();
|
||||||
} else {
|
} else {
|
||||||
atr = attacker.getAtrHandTwo();
|
atr = ac.getAtrHandTwo();
|
||||||
minDamage = attacker.getMinDamageHandTwo();
|
minDamage = ac.getMinDamageHandTwo();
|
||||||
maxDamage = attacker.getMaxDamageHandTwo();
|
maxDamage = ac.getMaxDamageHandTwo();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean tarIsRat = false;
|
boolean tarIsRat = false;
|
||||||
@@ -499,9 +563,9 @@ public enum CombatManager {
|
|||||||
//Dont think we need to do this anymore.
|
//Dont think we need to do this anymore.
|
||||||
|
|
||||||
if (tarIsRat)
|
if (tarIsRat)
|
||||||
if (attacker.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0) { //strip away current % dmg buffs then add with rat %
|
if (ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0) { //strip away current % dmg buffs then add with rat %
|
||||||
|
|
||||||
float percent = 1 + attacker.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat);
|
float percent = 1 + ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat);
|
||||||
|
|
||||||
minDamage *= percent;
|
minDamage *= percent;
|
||||||
maxDamage *= percent;
|
maxDamage *= percent;
|
||||||
@@ -512,24 +576,24 @@ public enum CombatManager {
|
|||||||
//subtract stamina
|
//subtract stamina
|
||||||
|
|
||||||
if (wb == null)
|
if (wb == null)
|
||||||
attacker.modifyStamina(-0.5f, attacker, true);
|
ac.modifyStamina(-0.5f, ac, true);
|
||||||
else {
|
else {
|
||||||
float stam = wb.getWeight() / 3;
|
float stam = wb.getWeight() / 3;
|
||||||
stam = (stam < 1) ? 1 : stam;
|
stam = (stam < 1) ? 1 : stam;
|
||||||
attacker.modifyStamina(-(stam), attacker, true);
|
ac.modifyStamina(-(stam), ac, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
attacker.cancelOnAttackSwing();
|
ac.cancelOnAttackSwing();
|
||||||
|
|
||||||
errorTrack = 2;
|
errorTrack = 2;
|
||||||
|
|
||||||
//set last time this player has attacked something.
|
//set last time this player has attacked something.
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectUUID() != attacker.getObjectUUID() && attacker.getObjectType() == GameObjectType.PlayerCharacter) {
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectUUID() != ac.getObjectUUID() && ac.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
attacker.setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
ac.setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
||||||
((PlayerCharacter) target).setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
((PlayerCharacter) target).setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
|
||||||
} else
|
} else
|
||||||
attacker.setTimeStamp("LastCombatMob", System.currentTimeMillis());
|
ac.setTimeStamp("LastCombatMob", System.currentTimeMillis());
|
||||||
|
|
||||||
errorTrack = 3;
|
errorTrack = 3;
|
||||||
|
|
||||||
@@ -540,16 +604,42 @@ public enum CombatManager {
|
|||||||
if (target.getObjectType().equals(GameObjectType.Building)) {
|
if (target.getObjectType().equals(GameObjectType.Building)) {
|
||||||
|
|
||||||
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||||
attacker.setCombatTarget(null);
|
ac.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
defense = 0;
|
defense = 0;
|
||||||
|
|
||||||
|
Building building = (Building) target;
|
||||||
|
|
||||||
|
if (building.getParentZone() != null && building.getParentZone().isPlayerCity()) {
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() > building.getTimeStamp("CallForHelp")) {
|
||||||
|
|
||||||
|
building.getTimestamps().put("CallForHelp", System.currentTimeMillis() + 15000);
|
||||||
|
|
||||||
|
for (Mob mob : building.getParentZone().zoneMobSet) {
|
||||||
|
if (!mob.isPlayerGuard())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mob.getCombatTarget() != null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mob.getGuild() != null && building.getGuild() != null)
|
||||||
|
if (!Guild.sameGuild(mob.getGuild().getNation(), building.getGuild().getNation()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mob.getLoc().distanceSquared2D(building.getLoc()) > sqr(300))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
mob.setCombatTarget(ac);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
AbstractCharacter tar = (AbstractCharacter) target;
|
AbstractCharacter tar = (AbstractCharacter) target;
|
||||||
defense = tar.getDefenseRating();
|
defense = tar.getDefenseRating();
|
||||||
handleRetaliate(tar, attacker); //Handle target attacking back if in combat and has no other target
|
handleRetaliate(tar, ac); //Handle target attacking back if in combat and has no other target
|
||||||
}
|
}
|
||||||
|
|
||||||
errorTrack = 4;
|
errorTrack = 4;
|
||||||
@@ -575,11 +665,11 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (roll < chance) {
|
if (roll < chance) {
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
updateAttackTimers((PlayerCharacter) attacker, target, true);
|
updateAttackTimers((PlayerCharacter) ac, target, true);
|
||||||
|
|
||||||
boolean skipPassives = false;
|
boolean skipPassives = false;
|
||||||
PlayerBonuses bonuses = attacker.getBonuses();
|
PlayerBonuses bonuses = ac.getBonuses();
|
||||||
|
|
||||||
if (bonuses != null && bonuses.getBool(ModType.IgnorePassiveDefense, SourceType.None))
|
if (bonuses != null && bonuses.getBool(ModType.IgnorePassiveDefense, SourceType.None))
|
||||||
skipPassives = true;
|
skipPassives = true;
|
||||||
@@ -594,26 +684,26 @@ public enum CombatManager {
|
|||||||
// Apply Weapon power effect if any. don't try to apply twice if
|
// Apply Weapon power effect if any. don't try to apply twice if
|
||||||
// dual wielding. Perform after passive test for sync purposes.
|
// dual wielding. Perform after passive test for sync purposes.
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
||||||
|
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
dpj = ((PlayerCharacter) ac).getWeaponPower();
|
||||||
|
|
||||||
if (dpj != null) {
|
if (dpj != null) {
|
||||||
|
|
||||||
PlayerBonuses bonus = attacker.getBonuses();
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
float attackRange = getWeaponRange(wb, bonus);
|
float attackRange = getWeaponRange(wb, bonus);
|
||||||
dpj.attack(target, attackRange);
|
dpj.attack(target, attackRange);
|
||||||
|
|
||||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
((PlayerCharacter) ac).setWeaponPower(dpj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check to apply second backstab.
|
//check to apply second backstab.
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand) {
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand) {
|
||||||
|
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
dpj = ((PlayerCharacter) ac).getWeaponPower();
|
||||||
|
|
||||||
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
|
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
|
||||||
float attackRange = getWeaponRange(wb, bonuses);
|
float attackRange = getWeaponRange(wb, bonuses);
|
||||||
@@ -633,24 +723,24 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//Handle Block passive
|
//Handle Block passive
|
||||||
|
|
||||||
if (testPassive(attacker, tarAc, "Block") && canTestBlock(attacker, target)) {
|
if (testPassive(ac, tarAc, "Block") && canTestBlock(ac, target)) {
|
||||||
|
|
||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj, mainHand);
|
sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj, mainHand);
|
||||||
passiveFired = true;
|
passiveFired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Parry passive
|
//Handle Parry passive
|
||||||
|
|
||||||
if (!passiveFired)
|
if (!passiveFired)
|
||||||
if (canTestParry(attacker, target) && testPassive(attacker, tarAc, "Parry")) {
|
if (canTestParry(ac, target) && testPassive(ac, tarAc, "Parry")) {
|
||||||
|
|
||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj, mainHand);
|
sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj, mainHand);
|
||||||
passiveFired = true;
|
passiveFired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -661,12 +751,12 @@ public enum CombatManager {
|
|||||||
//Handle Dodge passive
|
//Handle Dodge passive
|
||||||
|
|
||||||
if (!passiveFired)
|
if (!passiveFired)
|
||||||
if (testPassive(attacker, tarAc, "Dodge")) {
|
if (testPassive(ac, tarAc, "Dodge")) {
|
||||||
|
|
||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendPassiveDefenseMessage(attacker, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj, mainHand);
|
sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj, mainHand);
|
||||||
passiveFired = true;
|
passiveFired = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -682,7 +772,7 @@ public enum CombatManager {
|
|||||||
//if target is player, set last attack timestamp
|
//if target is player, set last attack timestamp
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
updateAttackTimers((PlayerCharacter) target, attacker, false);
|
updateAttackTimers((PlayerCharacter) target, ac, false);
|
||||||
|
|
||||||
//Get damage Type
|
//Get damage Type
|
||||||
|
|
||||||
@@ -690,7 +780,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (wb != null)
|
if (wb != null)
|
||||||
damageType = wb.getDamageType();
|
damageType = wb.getDamageType();
|
||||||
else if (attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob) attacker).isSiege())
|
else if (ac.getObjectType().equals(GameObjectType.Mob) && ((Mob) ac).isSiege())
|
||||||
damageType = DamageType.Siege;
|
damageType = DamageType.Siege;
|
||||||
else
|
else
|
||||||
damageType = DamageType.Crush;
|
damageType = DamageType.Crush;
|
||||||
@@ -709,7 +799,7 @@ public enum CombatManager {
|
|||||||
//make sure target is not immune to damage type;
|
//make sure target is not immune to damage type;
|
||||||
|
|
||||||
if (resists != null && resists.immuneTo(damageType)) {
|
if (resists != null && resists.immuneTo(damageType)) {
|
||||||
sendCombatMessage(attacker, target, 0f, wb, dpj, mainHand);
|
sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -720,9 +810,9 @@ public enum CombatManager {
|
|||||||
float damage;
|
float damage;
|
||||||
|
|
||||||
if (wb != null)
|
if (wb != null)
|
||||||
damage = calculateDamage(attacker, tarAc, minDamage, maxDamage, damageType, resists);
|
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||||
else
|
else
|
||||||
damage = calculateDamage(attacker, tarAc, minDamage, maxDamage, damageType, resists);
|
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||||
|
|
||||||
float d = 0f;
|
float d = 0f;
|
||||||
|
|
||||||
@@ -735,35 +825,40 @@ public enum CombatManager {
|
|||||||
if (tarAc.isSit())
|
if (tarAc.isSit())
|
||||||
damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
|
||||||
|
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||||
|
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
|
||||||
|
((Mob) tarAc).handleDirectAggro(ac);
|
||||||
|
}
|
||||||
|
|
||||||
if (tarAc.getHealth() > 0)
|
if (tarAc.getHealth() > 0)
|
||||||
d = tarAc.modifyHealth(-damage, attacker, false);
|
d = tarAc.modifyHealth(-damage, ac, false);
|
||||||
|
|
||||||
} else if (target.getObjectType().equals(GameObjectType.Building)) {
|
} else if (target.getObjectType().equals(GameObjectType.Building)) {
|
||||||
|
|
||||||
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||||
attacker.setCombatTarget(null);
|
ac.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getHealth() > 0)
|
if (target.getHealth() > 0)
|
||||||
d = ((Building) target).modifyHealth(-damage, attacker);
|
d = ((Building) target).modifyHealth(-damage, ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
errorTrack = 13;
|
errorTrack = 13;
|
||||||
|
|
||||||
//Test to see if any damage needs done to weapon or armor
|
//Test to see if any damage needs done to weapon or armor
|
||||||
|
|
||||||
testItemDamage(attacker, target, weapon, wb);
|
testItemDamage(ac, target, weapon, wb);
|
||||||
|
|
||||||
// if target is dead, we got the killing blow, remove attack timers on our weapons
|
// if target is dead, we got the killing blow, remove attack timers on our weapons
|
||||||
|
|
||||||
if (tarAc != null && !tarAc.isAlive())
|
if (tarAc != null && !tarAc.isAlive())
|
||||||
removeAttackTimers(attacker);
|
removeAttackTimers(ac);
|
||||||
|
|
||||||
//test double death fix
|
//test double death fix
|
||||||
|
|
||||||
if (d != 0)
|
if (d != 0)
|
||||||
sendCombatMessage(attacker, target, damage, wb, dpj, mainHand); //send damage message
|
sendCombatMessage(ac, target, damage, wb, dpj, mainHand); //send damage message
|
||||||
|
|
||||||
errorTrack = 14;
|
errorTrack = 14;
|
||||||
|
|
||||||
@@ -790,7 +885,7 @@ public enum CombatManager {
|
|||||||
int procChance = ThreadLocalRandom.current().nextInt(100);
|
int procChance = ThreadLocalRandom.current().nextInt(100);
|
||||||
|
|
||||||
if (procChance < MBServerStatics.PROC_CHANCE)
|
if (procChance < MBServerStatics.PROC_CHANCE)
|
||||||
((WeaponProcEffectModifier) aem).applyProc(attacker, target);
|
((WeaponProcEffectModifier) aem).applyProc(ac, target);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -802,52 +897,52 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//handle damage shields
|
//handle damage shields
|
||||||
|
|
||||||
if (attacker.isAlive() && tarAc != null && tarAc.isAlive())
|
if (ac.isAlive() && tarAc != null && tarAc.isAlive())
|
||||||
handleDamageShields(attacker, tarAc, damage);
|
handleDamageShields(ac, tarAc, damage);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Apply Weapon power effect if any.
|
// Apply Weapon power effect if any.
|
||||||
// don't try to apply twice if dual wielding.
|
// don't try to apply twice if dual wielding.
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || wb.isTwoHanded())) {
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
dpj = ((PlayerCharacter) ac).getWeaponPower();
|
||||||
|
|
||||||
if (dpj != null) {
|
if (dpj != null) {
|
||||||
|
|
||||||
PowersBase wp = dpj.getPower();
|
PowersBase wp = dpj.getPower();
|
||||||
|
|
||||||
if (wp.requiresHitRoll() == false) {
|
if (wp.requiresHitRoll() == false) {
|
||||||
PlayerBonuses bonus = attacker.getBonuses();
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
float attackRange = getWeaponRange(wb, bonus);
|
float attackRange = getWeaponRange(wb, bonus);
|
||||||
dpj.attack(target, attackRange);
|
dpj.attack(target, attackRange);
|
||||||
} else
|
} else
|
||||||
((PlayerCharacter) attacker).setWeaponPower(null);
|
((PlayerCharacter) ac).setWeaponPower(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getObjectType() == GameObjectType.Mob)
|
if (target.getObjectType() == GameObjectType.Mob)
|
||||||
((Mob) target).handleDirectAggro(attacker);
|
((Mob) target).handleDirectAggro(ac);
|
||||||
|
|
||||||
errorTrack = 17;
|
errorTrack = 17;
|
||||||
|
|
||||||
//miss, Send miss message
|
//miss, Send miss message
|
||||||
|
|
||||||
sendCombatMessage(attacker, target, 0f, wb, dpj, mainHand);
|
sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
|
||||||
|
|
||||||
//if attacker is player, set last attack timestamp
|
//if attacker is player, set last attack timestamp
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
updateAttackTimers((PlayerCharacter) attacker, target, true);
|
updateAttackTimers((PlayerCharacter) ac, target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
errorTrack = 18;
|
errorTrack = 18;
|
||||||
|
|
||||||
//cancel effects that break on attack or attackSwing
|
//cancel effects that break on attack or attackSwing
|
||||||
attacker.cancelOnAttack();
|
ac.cancelOnAttack();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(attacker.getName() + ' ' + errorTrack + ' ' + e);
|
Logger.error(ac.getName() + ' ' + errorTrack + ' ' + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1125,7 +1220,7 @@ public enum CombatManager {
|
|||||||
toggleCombat(msg.getToggle(), origin);
|
toggleCombat(msg.getToggle(), origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleCombat(boolean toggle, ClientConnection origin) {
|
private static void toggleCombat(boolean toggle, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
@@ -1142,7 +1237,7 @@ public enum CombatManager {
|
|||||||
DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSit(boolean toggle, ClientConnection origin) {
|
private static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
@@ -1172,69 +1267,61 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Called when character takes damage.
|
//Called when character takes damage.
|
||||||
public static void handleRetaliate(AbstractCharacter target, AbstractCharacter attacker) {
|
public static void handleRetaliate(AbstractCharacter tarAc, AbstractCharacter ac) {
|
||||||
|
|
||||||
if (attacker == null || target == null)
|
if (ac == null || tarAc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (attacker.equals(target))
|
if (ac.equals(tarAc))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target.isMoving() && target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (tarAc.isMoving() && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!target.isAlive() || !attacker.isAlive())
|
if (!tarAc.isAlive() || !ac.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean isCombat = target.isCombat();
|
boolean isCombat = tarAc.isCombat();
|
||||||
|
|
||||||
//If target in combat and has no target, then attack back
|
//If target in combat and has no target, then attack back
|
||||||
|
|
||||||
AbstractWorldObject awoCombTar = target.getCombatTarget();
|
AbstractWorldObject awoCombTar = tarAc.getCombatTarget();
|
||||||
|
|
||||||
if ((target.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || target.isCombat() && NotInRange(target, awoCombTar, target.getRange()))) || (target != null && target.getObjectType() == GameObjectType.Mob && ((Mob) target).isSiege()))
|
if ((tarAc.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || tarAc.isCombat() && NotInRange(tarAc, awoCombTar, tarAc.getRange()))) || (tarAc != null && tarAc.getObjectType() == GameObjectType.Mob && ((Mob) tarAc).isSiege()))
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
||||||
|
|
||||||
PlayerCharacter pc = (PlayerCharacter) target;
|
PlayerCharacter pc = (PlayerCharacter) tarAc;
|
||||||
target.setCombatTarget(attacker);
|
tarAc.setCombatTarget(ac);
|
||||||
pc.setLastTarget(attacker.getObjectType(), attacker.getObjectUUID());
|
pc.setLastTarget(ac.getObjectType(), ac.getObjectUUID());
|
||||||
|
|
||||||
if (target.getTimers() != null)
|
if (tarAc.getTimers() != null)
|
||||||
if (!target.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
if (!tarAc.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
||||||
CombatManager.AttackTarget((PlayerCharacter) target, target.getCombatTarget());
|
CombatManager.AttackTarget((PlayerCharacter) tarAc, tarAc.getCombatTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
|
|
||||||
Mob pet = ((PlayerCharacter) target).getPet();
|
Mob pet = ((PlayerCharacter) tarAc).getPet();
|
||||||
|
|
||||||
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
||||||
pet.setCombatTarget(attacker);
|
pet.setCombatTarget(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Mob Retaliate.
|
//Handle Mob Retaliate.
|
||||||
|
|
||||||
if (target.getObjectType() == GameObjectType.Mob) {
|
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||||
|
|
||||||
Mob attackedMobile = (Mob) target;
|
Mob retaliater = (Mob) tarAc;
|
||||||
|
|
||||||
//handle minion informing his captain of an attack
|
if (retaliater.getCombatTarget() != null && !retaliater.isSiege())
|
||||||
|
|
||||||
if (attackedMobile.agentType.equals(AIAgentType.GUARDMINION) && attackedMobile.guardCaptain != null && attackedMobile.guardCaptain.isAlive()) {
|
|
||||||
|
|
||||||
if (attackedMobile.guardCaptain.combatTarget == null)
|
|
||||||
attackedMobile.guardCaptain.setCombatTarget(attacker);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mobile already has a target; don't switch.
|
|
||||||
|
|
||||||
if (attackedMobile.getCombatTarget() != null && !attackedMobile.isSiege())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
attackedMobile.setCombatTarget(attacker);
|
if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege())
|
||||||
|
return;
|
||||||
|
|
||||||
|
retaliater.setCombatTarget(ac);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ public enum ConfigManager {
|
|||||||
|
|
||||||
MB_BIND_ADDR,
|
MB_BIND_ADDR,
|
||||||
MB_EXTERNAL_ADDR,
|
MB_EXTERNAL_ADDR,
|
||||||
|
|
||||||
// Database connection config
|
// Database connection config
|
||||||
|
|
||||||
MB_DATABASE_ADDRESS,
|
MB_DATABASE_ADDRESS,
|
||||||
@@ -67,7 +66,6 @@ public enum ConfigManager {
|
|||||||
MB_WORLD_GREETING,
|
MB_WORLD_GREETING,
|
||||||
MB_WORLD_KEYCLONE_MAX,
|
MB_WORLD_KEYCLONE_MAX,
|
||||||
MB_USE_RUINS,
|
MB_USE_RUINS,
|
||||||
MB_RULESET,
|
|
||||||
|
|
||||||
// Mobile AI modifiers
|
// Mobile AI modifiers
|
||||||
MB_AI_CAST_FREQUENCY,
|
MB_AI_CAST_FREQUENCY,
|
||||||
@@ -136,6 +134,7 @@ public enum ConfigManager {
|
|||||||
File file = new File("mbbranch.sh");
|
File file = new File("mbbranch.sh");
|
||||||
|
|
||||||
if (file.exists() && !file.isDirectory()) {
|
if (file.exists() && !file.isDirectory()) {
|
||||||
|
|
||||||
String[] command = {"./mbbranch.sh"};
|
String[] command = {"./mbbranch.sh"};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public enum DbManager {
|
public enum DbManager {
|
||||||
@@ -71,6 +70,7 @@ public enum DbManager {
|
|||||||
public static final dbBlueprintHandler BlueprintQueries = new dbBlueprintHandler();
|
public static final dbBlueprintHandler BlueprintQueries = new dbBlueprintHandler();
|
||||||
public static final dbBoonHandler BoonQueries = new dbBoonHandler();
|
public static final dbBoonHandler BoonQueries = new dbBoonHandler();
|
||||||
public static final dbShrineHandler ShrineQueries = new dbShrineHandler();
|
public static final dbShrineHandler ShrineQueries = new dbShrineHandler();
|
||||||
|
public static final dbHeightMapHandler HeightMapQueries = new dbHeightMapHandler();
|
||||||
public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler();
|
public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler();
|
||||||
|
|
||||||
public static final dbPowerHandler PowerQueries = new dbPowerHandler();
|
public static final dbPowerHandler PowerQueries = new dbPowerHandler();
|
||||||
@@ -267,40 +267,6 @@ public enum DbManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <E extends java.lang.Enum<E>> EnumSet<E> parseEnumSet(String mysqlSet, Class<E> enumClass) {
|
|
||||||
|
|
||||||
// Create empty output set of the passed Enum class
|
|
||||||
|
|
||||||
EnumSet<E> enumSet = EnumSet.noneOf(enumClass);
|
|
||||||
|
|
||||||
// Early exit for empty sets
|
|
||||||
|
|
||||||
if (mysqlSet.isEmpty())
|
|
||||||
return enumSet;
|
|
||||||
|
|
||||||
// Split set string and trim each element
|
|
||||||
|
|
||||||
String[] elements = mysqlSet.split(";");
|
|
||||||
|
|
||||||
for (String element : elements) {
|
|
||||||
|
|
||||||
element = element.trim();
|
|
||||||
|
|
||||||
// Parse the element into an enum; add to the output set
|
|
||||||
|
|
||||||
try {
|
|
||||||
E enumConstant = java.lang.Enum.valueOf(enumClass, element);
|
|
||||||
enumSet.add(enumConstant);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(" Parse error: " + mysqlSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the output set
|
|
||||||
|
|
||||||
return enumSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void printCacheCount(PlayerCharacter pc) {
|
public static void printCacheCount(PlayerCharacter pc) {
|
||||||
ChatManager.chatSystemInfo(pc, "Cache Lists");
|
ChatManager.chatSystemInfo(pc, "Cache Lists");
|
||||||
|
|
||||||
@@ -359,5 +325,4 @@ public enum DbManager {
|
|||||||
|
|
||||||
Logger.info("Database configured with " + connectionCount + " connections");
|
Logger.info("Database configured with " + connectionCount + " connections");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,11 +46,9 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new GetZoneCmd());
|
DevCmdManager.registerDevCmd(new GetZoneCmd());
|
||||||
DevCmdManager.registerDevCmd(new ZoneSetCmd());
|
DevCmdManager.registerDevCmd(new ZoneSetCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintBankCmd());
|
DevCmdManager.registerDevCmd(new PrintBankCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintEffectsCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new PrintEquipCmd());
|
DevCmdManager.registerDevCmd(new PrintEquipCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintInventoryCmd());
|
DevCmdManager.registerDevCmd(new PrintInventoryCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintVaultCmd());
|
DevCmdManager.registerDevCmd(new PrintVaultCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintRunesCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new PrintStatsCmd());
|
DevCmdManager.registerDevCmd(new PrintStatsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintSkillsCmd());
|
DevCmdManager.registerDevCmd(new PrintSkillsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintPowersCmd());
|
DevCmdManager.registerDevCmd(new PrintPowersCmd());
|
||||||
@@ -58,7 +56,6 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new PrintResistsCmd());
|
DevCmdManager.registerDevCmd(new PrintResistsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintLocationCmd());
|
DevCmdManager.registerDevCmd(new PrintLocationCmd());
|
||||||
DevCmdManager.registerDevCmd(new InfoCmd());
|
DevCmdManager.registerDevCmd(new InfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new ItemInfoCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new aiInfoCmd());
|
DevCmdManager.registerDevCmd(new aiInfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new SimulateBootyCmd());
|
DevCmdManager.registerDevCmd(new SimulateBootyCmd());
|
||||||
DevCmdManager.registerDevCmd(new GetHeightCmd());
|
DevCmdManager.registerDevCmd(new GetHeightCmd());
|
||||||
@@ -131,6 +128,7 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
||||||
DevCmdManager.registerDevCmd(new GotoObj());
|
DevCmdManager.registerDevCmd(new GotoObj());
|
||||||
DevCmdManager.registerDevCmd(new convertLoc());
|
DevCmdManager.registerDevCmd(new convertLoc());
|
||||||
|
DevCmdManager.registerDevCmd(new AuditHeightMapCmd());
|
||||||
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
|
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
|
DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
|
DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
|
||||||
@@ -145,6 +143,7 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
||||||
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
||||||
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerDevCmd(AbstractDevCmd cmd) {
|
private static void registerDevCmd(AbstractDevCmd cmd) {
|
||||||
|
|||||||
@@ -200,13 +200,5 @@ public enum GuildManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static Boolean meetsLoreRequirements(Guild guild, PlayerCharacter player){
|
|
||||||
Enum.GuildCharterType charter = guild.getGuildType();
|
|
||||||
if(charter.requiredClasses.contains(player.absPromotionClass))
|
|
||||||
if(charter.requiredRaces.contains(player.absRace))
|
|
||||||
if(charter.sexRequired.contains(player.absGender))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public enum LootManager {
|
|||||||
if(ib == null)
|
if(ib == null)
|
||||||
break;
|
break;
|
||||||
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||||
chatMsg.setMessageType(10);
|
chatMsg.setMessageType(10);
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||||
@@ -330,8 +330,6 @@ public enum LootManager {
|
|||||||
|
|
||||||
public static void GenerateEquipmentDrop(Mob mob) {
|
public static void GenerateEquipmentDrop(Mob mob) {
|
||||||
|
|
||||||
if(mob.behaviourType.equals(Enum.MobBehaviourType.HamletGuard))
|
|
||||||
return; // safehold guards don't drop their equipment
|
|
||||||
//do equipment here
|
//do equipment here
|
||||||
int dropCount = 0;
|
int dropCount = 0;
|
||||||
if (mob.getEquip() != null)
|
if (mob.getEquip() != null)
|
||||||
|
|||||||
@@ -45,27 +45,22 @@ public enum MaintenanceManager {
|
|||||||
// Deduct upkeep and build list of buildings
|
// Deduct upkeep and build list of buildings
|
||||||
// which did not have funds available
|
// which did not have funds available
|
||||||
|
|
||||||
try {
|
for (Building building : maintList) {
|
||||||
for (Building building : maintList)
|
|
||||||
if (chargeUpkeep(building) == false)
|
if (chargeUpkeep(building) == false)
|
||||||
derankList.add(building);
|
derankList.add(building);
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
}
|
||||||
// Reset maintenance dates for these buildings
|
// Reset maintenance dates for these buildings
|
||||||
|
|
||||||
for (Building building : maintList)
|
for (Building building : maintList) {
|
||||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
||||||
|
|
||||||
|
}
|
||||||
// Derak or destroy buildings that did not
|
// Derak or destroy buildings that did not
|
||||||
// have funds available.
|
// have funds available.
|
||||||
|
|
||||||
try {
|
for (Building building : derankList)
|
||||||
for (Building building : derankList)
|
building.destroyOrDerank(null);
|
||||||
building.destroyOrDerank(null);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
|
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
|
||||||
}
|
}
|
||||||
@@ -184,7 +179,7 @@ public enum MaintenanceManager {
|
|||||||
if ((overDraft > 0))
|
if ((overDraft > 0))
|
||||||
if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) &&
|
if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) &&
|
||||||
(warehouse != null) && building.assetIsProtected() == true &&
|
(warehouse != null) && building.assetIsProtected() == true &&
|
||||||
(warehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) {
|
(warehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) {
|
||||||
hasFunds = true;
|
hasFunds = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,22 +194,22 @@ public enum MaintenanceManager {
|
|||||||
hasResources = false;
|
hasResources = false;
|
||||||
else {
|
else {
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
|
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||||
|
|
||||||
if (resourceValue < 1500)
|
if (resourceValue < 1500)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
|
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||||
|
|
||||||
if (resourceValue < 1500)
|
if (resourceValue < 1500)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
|
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||||
|
|
||||||
if (resourceValue < 5)
|
if (resourceValue < 5)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
|
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||||
|
|
||||||
if (resourceValue < 5)
|
if (resourceValue < 5)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
@@ -247,11 +242,11 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
if (overDraft > 0) {
|
if (overDraft > 0) {
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(7));
|
resourceValue = warehouse.getResources().get(Warehouse.goldIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - overDraft) == true) {
|
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - overDraft) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(7), resourceValue - overDraft);
|
warehouse.getResources().put(Warehouse.goldIB, resourceValue - overDraft);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft);
|
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
return true;
|
return true;
|
||||||
@@ -267,11 +262,11 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
// Withdraw Stone
|
// Withdraw Stone
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
|
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
|
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(1580000), resourceValue - 1500);
|
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 1500);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
|
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
return true;
|
return true;
|
||||||
@@ -279,11 +274,11 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
// Withdraw Lumber
|
// Withdraw Lumber
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
|
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
|
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(1580004), resourceValue - 1500);
|
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 1500);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
|
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
return true;
|
return true;
|
||||||
@@ -291,21 +286,21 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
// Withdraw Galvor
|
// Withdraw Galvor
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
|
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
|
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(1580017), resourceValue - 5);
|
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 5);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
|
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
|
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
|
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(1580018), resourceValue - 5);
|
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 5);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
|
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ public enum MovementManager {
|
|||||||
|
|
||||||
// if inside a building, convert both locations from the building local reference frame to the world reference frame
|
// if inside a building, convert both locations from the building local reference frame to the world reference frame
|
||||||
|
|
||||||
if (msg.getInBuildingUUID() > 0) {
|
if (msg.getTargetID() > 0) {
|
||||||
Building building = BuildingManager.getBuildingFromCache(msg.getInBuildingUUID());
|
Building building = BuildingManager.getBuildingFromCache(msg.getTargetID());
|
||||||
if (building != null) {
|
if (building != null) {
|
||||||
|
|
||||||
Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
|
Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
|
||||||
@@ -128,8 +128,8 @@ public enum MovementManager {
|
|||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
toMove.setInBuilding(msg.getInBuilding());
|
toMove.setInBuilding(msg.getInBuilding());
|
||||||
toMove.setInFloorID(msg.getInBuildingFloor());
|
toMove.setInFloorID(msg.getUnknown01());
|
||||||
toMove.setInBuildingID(msg.getInBuildingUUID());
|
toMove.setInBuildingID(msg.getTargetID());
|
||||||
msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
|
msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
|
||||||
|
|
||||||
if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
|
if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
@@ -174,9 +174,9 @@ public enum MovementManager {
|
|||||||
msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
|
msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
|
||||||
msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
|
msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
|
||||||
msg.setInBuilding(toMove.region.level);
|
msg.setInBuilding(toMove.region.level);
|
||||||
msg.setInBuildingFloor(toMove.region.room);
|
msg.setUnknown01(toMove.region.room);
|
||||||
msg.setStartLocType(GameObjectType.Building.ordinal());
|
msg.setTargetType(GameObjectType.Building.ordinal());
|
||||||
msg.setInBuildingUUID(regionBuilding.getObjectUUID());
|
msg.setTargetID(regionBuilding.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -185,8 +185,8 @@ public enum MovementManager {
|
|||||||
toMove.setInBuilding(-1);
|
toMove.setInBuilding(-1);
|
||||||
msg.setStartCoord(toMove.getLoc());
|
msg.setStartCoord(toMove.getLoc());
|
||||||
msg.setEndCoord(endLocation);
|
msg.setEndCoord(endLocation);
|
||||||
msg.setStartLocType(0);
|
msg.setTargetType(0);
|
||||||
msg.setInBuildingUUID(0);
|
msg.setTargetID(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//checks sync between character and server, if out of sync, teleport player to original position and return.
|
//checks sync between character and server, if out of sync, teleport player to original position and return.
|
||||||
@@ -233,7 +233,7 @@ public enum MovementManager {
|
|||||||
toMove.cancelOnMove();
|
toMove.cancelOnMove();
|
||||||
|
|
||||||
//cancel any attacks for manual move.
|
//cancel any attacks for manual move.
|
||||||
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getInitiatedFromAttack() == 0)
|
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getUnknown02() == 0)
|
||||||
toMove.setCombatTarget(null);
|
toMove.setCombatTarget(null);
|
||||||
|
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ public enum MovementManager {
|
|||||||
Zone serverZone = null;
|
Zone serverZone = null;
|
||||||
|
|
||||||
serverZone = ZoneManager.findSmallestZone(player.getLoc());
|
serverZone = ZoneManager.findSmallestZone(player.getLoc());
|
||||||
cityObject = (City) DbManager.getFromCache(GameObjectType.City, serverZone.playerCityUUID);
|
cityObject = (City) DbManager.getFromCache(GameObjectType.City, serverZone.getPlayerCityUUID());
|
||||||
|
|
||||||
// Do not send group messages if player is on grid
|
// Do not send group messages if player is on grid
|
||||||
|
|
||||||
@@ -464,20 +464,34 @@ public enum MovementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc) {
|
public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc, Regions region) {
|
||||||
|
|
||||||
|
|
||||||
if (targetLoc == null)
|
if (targetLoc == null)
|
||||||
return;
|
return;
|
||||||
teleporter.stopMovement(targetLoc);
|
|
||||||
Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc());
|
Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc());
|
||||||
teleporter.setLoc(targetLoc);
|
|
||||||
|
teleporter.stopMovement(targetLoc);
|
||||||
|
teleporter.setRegion(region);
|
||||||
|
|
||||||
|
//mobs ignore region sets for now.
|
||||||
|
if (teleporter.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
|
teleporter.setInBuildingID(0);
|
||||||
|
teleporter.setInBuilding(-1);
|
||||||
|
teleporter.setInFloorID(-1);
|
||||||
|
TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, targetLoc.getX(), targetLoc.getY(), targetLoc.getZ(), 0, -1, -1);
|
||||||
|
DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, targetLoc.getX(), targetLoc.getY(), targetLoc.getZ(), 0, -1, -1);
|
||||||
|
//we shouldnt need to send teleport message to new area, as loadjob should pick it up.
|
||||||
|
// DispatchMessage.dispatchMsgToInterestArea(teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
|
||||||
if (teleporter.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (teleporter.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) teleporter);
|
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) teleporter);
|
||||||
|
|
||||||
TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, teleporter.loc.getX(), teleporter.loc.getY(), teleporter.loc.getZ(), 0, -1, -1);
|
|
||||||
DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void syncLoc(AbstractCharacter ac, Vector3fImmutable clientLoc, boolean useClientLoc) {
|
private static void syncLoc(AbstractCharacter ac, Vector3fImmutable clientLoc, boolean useClientLoc) {
|
||||||
|
|||||||
@@ -5,17 +5,13 @@ import engine.InterestManagement.WorldGrid;
|
|||||||
import engine.math.Quaternion;
|
import engine.math.Quaternion;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mobileAI.MobAI;
|
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.msg.PetMsg;
|
import engine.net.client.msg.PetMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.PowersBase;
|
|
||||||
import engine.powers.RuneSkillAdjustEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import javax.smartcardio.ATR;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
@@ -27,6 +23,92 @@ public enum NPCManager {
|
|||||||
NPC_MANAGER;
|
NPC_MANAGER;
|
||||||
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
||||||
|
|
||||||
|
public static void LoadAllRuneSets() {
|
||||||
|
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LoadAllBootySets() {
|
||||||
|
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyRuneSetEffects(Mob mob) {
|
||||||
|
|
||||||
|
// Early exit
|
||||||
|
|
||||||
|
if (mob.runeSet == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Apply all rune effects.
|
||||||
|
|
||||||
|
if (NPCManager._runeSetMap.get(mob.runeSet).contains(252623)) {
|
||||||
|
mob.isPlayerGuard = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only captains have contracts
|
||||||
|
|
||||||
|
if (mob.contract != null || mob.isPlayerGuard)
|
||||||
|
applyEffectsForRune(mob, 252621);
|
||||||
|
|
||||||
|
|
||||||
|
// Apply effects from RuneSet
|
||||||
|
|
||||||
|
if (mob.runeSet != 0)
|
||||||
|
for (int runeID : _runeSetMap.get(mob.runeSet))
|
||||||
|
applyEffectsForRune(mob, runeID);
|
||||||
|
|
||||||
|
// Not sure why but apply Warrior effects for some reason?
|
||||||
|
|
||||||
|
applyEffectsForRune(mob, 2518);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyEffectsForRune(AbstractCharacter character, int runeID) {
|
||||||
|
|
||||||
|
EffectsBase effectsBase;
|
||||||
|
RuneBase sourceRune = RuneBase.getRuneBase(runeID);
|
||||||
|
|
||||||
|
// Race runes are in the runeset but not in runebase for some reason
|
||||||
|
|
||||||
|
if (sourceRune == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (MobBaseEffects mbe : sourceRune.getEffectsList()) {
|
||||||
|
|
||||||
|
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
|
||||||
|
|
||||||
|
if (effectsBase == null) {
|
||||||
|
Logger.info("Mob: " + character.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//check to upgrade effects if needed.
|
||||||
|
if (character.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
|
||||||
|
|
||||||
|
if (mbe.getReqLvl() > (int) character.level)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Effect eff = character.effects.get(Integer.toString(effectsBase.getUUID()));
|
||||||
|
|
||||||
|
if (eff == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Current effect is a higher rank, dont apply.
|
||||||
|
if (eff.getTrains() > mbe.getRank())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//new effect is of a higher rank. remove old effect and apply new one.
|
||||||
|
eff.cancelJob();
|
||||||
|
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (mbe.getReqLvl() > (int) character.level)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
|
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
|
||||||
|
|
||||||
necroPet.setCombatTarget(null);
|
necroPet.setCombatTarget(null);
|
||||||
@@ -45,12 +127,10 @@ public enum NPCManager {
|
|||||||
|
|
||||||
DbManager.removeFromCache(necroPet);
|
DbManager.removeFromCache(necroPet);
|
||||||
|
|
||||||
|
PlayerCharacter petOwner = necroPet.getOwner();
|
||||||
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
|
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (petOwner != null) {
|
||||||
|
necroPet.setOwner(null);
|
||||||
necroPet.guardCaptain = null;
|
|
||||||
petOwner.setPet(null);
|
petOwner.setPet(null);
|
||||||
|
|
||||||
if (updateOwner == false)
|
if (updateOwner == false)
|
||||||
@@ -122,6 +202,78 @@ public enum NPCManager {
|
|||||||
playerCharacter.necroPets.clear();
|
playerCharacter.necroPets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void removeSiegeMinions(Mob mobile) {
|
||||||
|
|
||||||
|
for (Mob toRemove : mobile.siegeMinionMap.keySet()) {
|
||||||
|
|
||||||
|
if (mobile.isMoving()) {
|
||||||
|
|
||||||
|
mobile.stopMovement(mobile.getLoc());
|
||||||
|
|
||||||
|
if (toRemove.parentZone != null)
|
||||||
|
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
toRemove.clearEffects();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toRemove.parentZone != null)
|
||||||
|
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
WorldGrid.removeObject(toRemove);
|
||||||
|
DbManager.removeFromCache(toRemove);
|
||||||
|
|
||||||
|
PlayerCharacter petOwner = toRemove.getOwner();
|
||||||
|
|
||||||
|
if (petOwner != null) {
|
||||||
|
|
||||||
|
petOwner.setPet(null);
|
||||||
|
toRemove.setOwner(null);
|
||||||
|
|
||||||
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean removeMobileFromBuilding(Mob mobile, Building building) {
|
||||||
|
|
||||||
|
// Remove npc from it's building
|
||||||
|
|
||||||
|
try {
|
||||||
|
mobile.clearEffects();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mobile.parentZone != null)
|
||||||
|
mobile.parentZone.zoneMobSet.remove(mobile);
|
||||||
|
|
||||||
|
if (building != null) {
|
||||||
|
building.getHirelings().remove(mobile);
|
||||||
|
removeSiegeMinions(mobile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete npc from database
|
||||||
|
|
||||||
|
if (DbManager.MobQueries.DELETE_MOB(mobile) == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Remove npc from the simulation
|
||||||
|
|
||||||
|
mobile.removeFromCache();
|
||||||
|
DbManager.removeFromCache(mobile);
|
||||||
|
WorldGrid.RemoveWorldObject(mobile);
|
||||||
|
WorldGrid.removeObject(mobile);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static void loadAllPirateNames() {
|
public static void loadAllPirateNames() {
|
||||||
|
|
||||||
DbManager.NPCQueries.LOAD_PIRATE_NAMES();
|
DbManager.NPCQueries.LOAD_PIRATE_NAMES();
|
||||||
@@ -188,19 +340,10 @@ public enum NPCManager {
|
|||||||
else
|
else
|
||||||
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
||||||
|
|
||||||
// Override slot for siege engines
|
|
||||||
|
|
||||||
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
|
|
||||||
Mob siegeMobile = (Mob) abstractCharacter;
|
|
||||||
buildingSlot = siegeMobile.guardCaptain.minions.size() + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buildingSlot == -1)
|
if (buildingSlot == -1)
|
||||||
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
||||||
|
|
||||||
// Pets are regular mobiles not hirelings (Siege engines)
|
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||||
if (abstractCharacter.contract != null)
|
|
||||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
|
||||||
|
|
||||||
// Override bind and location for this npc derived
|
// Override bind and location for this npc derived
|
||||||
// from BuildingManager slot location data.
|
// from BuildingManager slot location data.
|
||||||
@@ -227,251 +370,4 @@ public enum NPCManager {
|
|||||||
|
|
||||||
return buildingSlot;
|
return buildingSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AssignPatrolPoints(Mob mob) {
|
|
||||||
mob.patrolPoints = new ArrayList<>();
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
|
||||||
float patrolRadius = mob.getSpawnRadius();
|
|
||||||
|
|
||||||
if (patrolRadius > 256)
|
|
||||||
patrolRadius = 256;
|
|
||||||
|
|
||||||
if (patrolRadius < 60)
|
|
||||||
patrolRadius = 60;
|
|
||||||
|
|
||||||
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(mob.getBindLoc(), patrolRadius);
|
|
||||||
mob.patrolPoints.add(newPatrolPoint);
|
|
||||||
|
|
||||||
if (i == 1) {
|
|
||||||
mob.setLoc(newPatrolPoint);
|
|
||||||
mob.endLoc = newPatrolPoint;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyGuardStanceModifiers(Mob guard){
|
|
||||||
float damageModifier = 1;
|
|
||||||
float attackRatingModifier = 1;
|
|
||||||
float defenseModifier = 1;
|
|
||||||
float attackSpeedModifier = 1;
|
|
||||||
float powerDamageModifier = 1;
|
|
||||||
//handle stance modifiers for guard mob
|
|
||||||
if(guard.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER)){
|
|
||||||
//apply rogue bonuses
|
|
||||||
attackRatingModifier += 0.5f;
|
|
||||||
defenseModifier += 0.5f;
|
|
||||||
damageModifier += 0.5f;
|
|
||||||
attackSpeedModifier -= 0.36f;
|
|
||||||
}else {
|
|
||||||
Integer contractID;
|
|
||||||
if (guard.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
|
||||||
contractID = guard.guardCaptain.contract.getContractID();
|
|
||||||
} else{
|
|
||||||
contractID = guard.contract.getContractID();
|
|
||||||
}
|
|
||||||
if (Enum.MinionType.ContractToMinionMap.get(contractID) != null && Enum.MinionType.ContractToMinionMap.get(contractID).isMage()){
|
|
||||||
//apply mage offensive Stance
|
|
||||||
powerDamageModifier += 0.5f;
|
|
||||||
} else{
|
|
||||||
//apply fighter offensive stance
|
|
||||||
damageModifier += 0.5f;
|
|
||||||
attackSpeedModifier -= 0.36f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
guard.minDamageHandOne *= damageModifier;
|
|
||||||
guard.minDamageHandTwo *= damageModifier;
|
|
||||||
guard.maxDamageHandOne *= damageModifier;
|
|
||||||
guard.maxDamageHandTwo *= damageModifier;
|
|
||||||
guard.atrHandOne *= attackRatingModifier;
|
|
||||||
guard.atrHandTwo *= attackRatingModifier;
|
|
||||||
guard.defenseRating *= defenseModifier;
|
|
||||||
guard.speedHandOne *= attackSpeedModifier;
|
|
||||||
guard.speedHandTwo *= attackSpeedModifier;
|
|
||||||
|
|
||||||
//TODO figure out how to apply +50% powerdamage to mage guards
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDamageAndSpeedForGuard(Mob guard){
|
|
||||||
|
|
||||||
float rankModifier = 1 + (guard.getRank() * 0.1f);
|
|
||||||
int primaryStat = 0;
|
|
||||||
if(guard.equip == null) {
|
|
||||||
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier);
|
|
||||||
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier);
|
|
||||||
guard.speedHandOne = 30.0f;
|
|
||||||
}else{
|
|
||||||
if(guard.equip.containsKey(1)){
|
|
||||||
//has main hand weapon
|
|
||||||
ItemBase weapon = guard.equip.get(1).getItemBase();
|
|
||||||
if(weapon.isStrBased())
|
|
||||||
primaryStat = guard.getStatStrCurrent();
|
|
||||||
else
|
|
||||||
primaryStat = guard.getStatDexCurrent();
|
|
||||||
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.speedHandOne = weapon.getSpeed();
|
|
||||||
guard.rangeHandOne = weapon.getRange();
|
|
||||||
} else if(guard.equip.containsKey(2) && !guard.equip.get(2).getItemBase().isShield()){
|
|
||||||
//has off hand weapon
|
|
||||||
ItemBase weapon = guard.equip.get(2).getItemBase();
|
|
||||||
if(weapon.isStrBased())
|
|
||||||
primaryStat = guard.getStatStrCurrent();
|
|
||||||
else
|
|
||||||
primaryStat = guard.getStatDexCurrent();
|
|
||||||
guard.minDamageHandTwo = (int)((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.maxDamageHandTwo = (int)((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat;
|
|
||||||
guard.speedHandTwo = weapon.getSpeed();
|
|
||||||
guard.rangeHandTwo = weapon.getRange();
|
|
||||||
} else {
|
|
||||||
primaryStat = guard.getStatStrCurrent();
|
|
||||||
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier) + primaryStat;
|
|
||||||
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier) + primaryStat;
|
|
||||||
guard.speedHandOne = 30.0f;
|
|
||||||
guard.rangeHandOne = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDefenseForGuard(Mob guard){
|
|
||||||
int dexterity = guard.getStatDexCurrent();
|
|
||||||
if(dexterity < 1)
|
|
||||||
dexterity = 1;
|
|
||||||
int baseDef = guard.mobBase.getDefenseRating();
|
|
||||||
int armorDefense = 0;
|
|
||||||
for(MobEquipment equipped : guard.equip.values())
|
|
||||||
if(equipped.getItemBase().isArmor() || equipped.getItemBase().isShield())
|
|
||||||
armorDefense += equipped.getItemBase().getDefense();
|
|
||||||
guard.defenseRating = dexterity + baseDef + armorDefense;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setAttackRatingForGuard(Mob guard) {
|
|
||||||
int strength = guard.getStatStrCurrent();
|
|
||||||
int baseAtr = guard.mobBase.getAttackRating();
|
|
||||||
if (guard.equip.get(1) != null)
|
|
||||||
guard.atrHandOne = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(1).getItemBase().getPercentRequired() * 4) + (guard.equip.get(1).getItemBase().getPercentRequired() * 3));
|
|
||||||
else if (guard.equip.get(2) != null && !guard.equip.get(2).getItemBase().isShield())
|
|
||||||
guard.atrHandTwo = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(2).getItemBase().getPercentRequired() * 4) + (guard.equip.get(2).getItemBase().getPercentRequired() * 3));
|
|
||||||
else
|
|
||||||
guard.atrHandOne = baseAtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setMaxHealthForGuard(Mob guard){
|
|
||||||
//values derived fom reading memory address for health on client when selecting player guards
|
|
||||||
switch(guard.getRank()){
|
|
||||||
default:
|
|
||||||
guard.healthMax = 750; //rank 1
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
guard.healthMax = 2082;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
guard.healthMax = 2740;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
guard.healthMax = 3414;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
guard.healthMax = 4080;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
guard.healthMax = 4746;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
guard.healthMax = 5412;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyMobbaseEffects(Mob mob) {
|
|
||||||
EffectsBase effectsBase;
|
|
||||||
for (MobBaseEffects mbe : mob.mobBase.effectsList) {
|
|
||||||
|
|
||||||
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
|
|
||||||
|
|
||||||
if (effectsBase == null) {
|
|
||||||
Logger.info("Mob: " + mob.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//check to upgrade effects if needed.
|
|
||||||
if (mob.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
|
|
||||||
|
|
||||||
if (mbe.getReqLvl() > (int) mob.level)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Effect eff = mob.effects.get(Integer.toString(effectsBase.getUUID()));
|
|
||||||
|
|
||||||
if (eff == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//Current effect is a higher rank, dont apply.
|
|
||||||
if (eff.getTrains() > mbe.getRank())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//new effect is of a higher rank. remove old effect and apply new one.
|
|
||||||
eff.cancelJob();
|
|
||||||
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (mbe.getReqLvl() > (int) mob.level)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyEquipmentResists(Mob mob){
|
|
||||||
if(mob.equip != null){
|
|
||||||
for(MobEquipment equipped : mob.equip.values()){
|
|
||||||
ItemBase itemBase = equipped.getItemBase();
|
|
||||||
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){
|
|
||||||
mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush,0) + itemBase.getCrushResist());
|
|
||||||
mob.resists.setResist(Enum.DamageType.Slash, mob.resists.getResist(Enum.DamageType.Slash,0) + itemBase.getCrushResist());
|
|
||||||
mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce,0) + itemBase.getCrushResist());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyMobbaseSkill(Mob mob) {
|
|
||||||
SkillsBase baseSkill = DbManager.SkillsBaseQueries.GET_BASE_BY_TOKEN(mob.mobBase.getMobBaseStats().getBaseSkill());
|
|
||||||
if(baseSkill != null)
|
|
||||||
mob.getSkills().put(baseSkill.getName(),new CharacterSkill(baseSkill,mob,mob.mobBase.getMobBaseStats().getBaseSkillAmount()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyRuneSkills(Mob mob, int runeID){
|
|
||||||
//load mob skill adjustments from mobbase rune
|
|
||||||
if(PowersManager._allRuneSkillAdjusts.containsKey(runeID))
|
|
||||||
for(RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) {
|
|
||||||
if(SkillsBase.getFromCache(entry.skill_type) == null)
|
|
||||||
SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type));
|
|
||||||
SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type);
|
|
||||||
if(skillBase == null)
|
|
||||||
continue;
|
|
||||||
if (entry.level <= mob.level)
|
|
||||||
if (mob.skills.containsKey(entry.name) == false)
|
|
||||||
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank));
|
|
||||||
else
|
|
||||||
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank + mob.skills.get(entry.skill_type).getNumTrains()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyRunesForNPC(NPC npc){
|
|
||||||
npc.runes = new ArrayList<>();
|
|
||||||
RuneBase shopkeeperBase = RuneBase.getRuneBase(252620);
|
|
||||||
CharacterRune shopkeeper = new CharacterRune(shopkeeperBase,npc.getObjectUUID());
|
|
||||||
npc.runes.add(shopkeeper);
|
|
||||||
if(NPCManager._runeSetMap.containsKey(npc.runeSetID)) {
|
|
||||||
for (int runeID : _runeSetMap.get(npc.runeSetID)) {
|
|
||||||
RuneBase rb = RuneBase.getRuneBase(runeID);
|
|
||||||
if(rb != null) {
|
|
||||||
CharacterRune toApply = new CharacterRune(rb, npc.getObjectUUID());
|
|
||||||
npc.runes.add(toApply);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
import engine.InterestManagement.Terrain;
|
import engine.InterestManagement.HeightMap;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.db.handlers.dbEffectsBaseHandler;
|
import engine.db.handlers.dbEffectsBaseHandler;
|
||||||
import engine.db.handlers.dbPowerHandler;
|
import engine.db.handlers.dbPowerHandler;
|
||||||
@@ -53,10 +53,13 @@ public enum PowersManager {
|
|||||||
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
||||||
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
||||||
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
|
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> _allRunePowers;
|
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
|
||||||
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> _allRuneSkillAdjusts;
|
|
||||||
private static JobScheduler js;
|
private static JobScheduler js;
|
||||||
|
|
||||||
|
private PowersManager() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void initPowersManager(boolean fullPowersLoad) {
|
public static void initPowersManager(boolean fullPowersLoad) {
|
||||||
|
|
||||||
if (fullPowersLoad)
|
if (fullPowersLoad)
|
||||||
@@ -100,16 +103,6 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<RunePowerEntry> getPowersForRune(int rune_id) {
|
|
||||||
|
|
||||||
ArrayList<RunePowerEntry> powerEntries = PowersManager._allRunePowers.get(rune_id);
|
|
||||||
|
|
||||||
if (powerEntries == null)
|
|
||||||
powerEntries = new ArrayList<>();
|
|
||||||
|
|
||||||
return powerEntries;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This pre-loads all powers and effects
|
// This pre-loads all powers and effects
|
||||||
public static void InitializePowers() {
|
public static void InitializePowers() {
|
||||||
|
|
||||||
@@ -170,19 +163,6 @@ public enum PowersManager {
|
|||||||
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
||||||
boolean sendCastToSelf) {
|
boolean sendCastToSelf) {
|
||||||
|
|
||||||
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
|
|
||||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
|
||||||
PlayerCharacter caster = origin.getPlayerCharacter();
|
|
||||||
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
|
||||||
if(pb != null && pb.isHarmful == false) {
|
|
||||||
if (caster.guild.equals(Guild.getErrantGuild()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usePowerA(msg, origin, sendCastToSelf)) {
|
if (usePowerA(msg, origin, sendCastToSelf)) {
|
||||||
// Cast failed for some reason, reset timer
|
// Cast failed for some reason, reset timer
|
||||||
|
|
||||||
@@ -859,6 +839,8 @@ public enum PowersManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playerCharacter.setHateValue(pb.getHateValue(trains));
|
||||||
|
|
||||||
//Send Cast Message.
|
//Send Cast Message.
|
||||||
// PerformActionMsg castMsg = new PerformActionMsg(msg);
|
// PerformActionMsg castMsg = new PerformActionMsg(msg);
|
||||||
// castMsg.setNumTrains(9999);
|
// castMsg.setNumTrains(9999);
|
||||||
@@ -909,6 +891,8 @@ public enum PowersManager {
|
|||||||
//Power is aiding a target, handle aggro if combat target is a Mob.
|
//Power is aiding a target, handle aggro if combat target is a Mob.
|
||||||
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
||||||
|
if (!pb.isHarmful())
|
||||||
|
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update target of used power timer
|
// update target of used power timer
|
||||||
@@ -1271,13 +1255,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
|
|
||||||
if (pc.guild.getGuildType().equals(target.guild.getGuildType()) == false) {
|
|
||||||
ChatManager.chatInfoError(pc,
|
|
||||||
"Cannot summon player outside your charter.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PerformActionMsg pam = new PerformActionMsg(msg.getPowerToken(), msg
|
PerformActionMsg pam = new PerformActionMsg(msg.getPowerToken(), msg
|
||||||
.getTrains(), msg.getSourceType(), msg.getSourceID(), target
|
.getTrains(), msg.getSourceType(), msg.getSourceID(), target
|
||||||
.getObjectType().ordinal(), target.getObjectUUID(), 0f, 0f, 0f, 1, 0);
|
.getObjectType().ordinal(), target.getObjectUUID(), 0f, 0f, 0f, 1, 0);
|
||||||
@@ -1791,7 +1769,7 @@ public enum PowersManager {
|
|||||||
} else {
|
} else {
|
||||||
targetLoc = tl;
|
targetLoc = tl;
|
||||||
try {
|
try {
|
||||||
targetLoc = targetLoc.setY(Terrain.getWorldHeight(targetLoc)); //on ground
|
targetLoc = targetLoc.setY(HeightMap.getWorldHeight(targetLoc)); //on ground
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
targetLoc = tl;
|
targetLoc = tl;
|
||||||
@@ -1993,7 +1971,7 @@ public enum PowersManager {
|
|||||||
} else {
|
} else {
|
||||||
targetLoc = tl;
|
targetLoc = tl;
|
||||||
try {
|
try {
|
||||||
targetLoc = targetLoc.setY(Terrain.getWorldHeight(targetLoc)); //on ground
|
targetLoc = targetLoc.setY(HeightMap.getWorldHeight(targetLoc)); //on ground
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.InterestManagement.Terrain;
|
import engine.db.archive.CityRecord;
|
||||||
|
import engine.db.archive.DataWarehouse;
|
||||||
import engine.math.Bounds;
|
import engine.math.Bounds;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
@@ -17,7 +18,6 @@ import engine.math.Vector3fImmutable;
|
|||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
import engine.objects.ZoneTemplate;
|
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -36,8 +36,6 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
ZONEMANAGER;
|
ZONEMANAGER;
|
||||||
|
|
||||||
public static HashMap<Integer, ZoneTemplate> _zone_templates = new HashMap<>();
|
|
||||||
|
|
||||||
public static final Set<Zone> macroZones = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
public static final Set<Zone> macroZones = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||||
private static final ConcurrentHashMap<Integer, Zone> zonesByID = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD);
|
private static final ConcurrentHashMap<Integer, Zone> zonesByID = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD);
|
||||||
private static final ConcurrentHashMap<Integer, Zone> zonesByUUID = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD);
|
private static final ConcurrentHashMap<Integer, Zone> zonesByUUID = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD);
|
||||||
@@ -47,9 +45,9 @@ public enum ZoneManager {
|
|||||||
public static Instant hotZoneLastUpdate;
|
public static Instant hotZoneLastUpdate;
|
||||||
public static Zone hotZone = null;
|
public static Zone hotZone = null;
|
||||||
public static int hotZoneCycle = 0; // Used with HOTZONE_DURATION from config.
|
public static int hotZoneCycle = 0; // Used with HOTZONE_DURATION from config.
|
||||||
|
public static HashMap<Integer, Vector2f> _zone_size_data = new HashMap<>();
|
||||||
/* Instance variables */
|
/* Instance variables */
|
||||||
public static Zone seaFloor = null;
|
private static Zone seaFloor = null;
|
||||||
|
|
||||||
// Find all zones coordinates fit into, starting with Sea Floor
|
// Find all zones coordinates fit into, starting with Sea Floor
|
||||||
|
|
||||||
@@ -62,8 +60,8 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
allIn.add(zone);
|
allIn.add(zone);
|
||||||
while (zone.parent != null) {
|
while (zone.getParent() != null) {
|
||||||
zone = zone.parent;
|
zone = zone.getParent();
|
||||||
allIn.add(zone);
|
allIn.add(zone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +70,7 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
// Find smallest zone coordinates fit into.
|
// Find smallest zone coordinates fit into.
|
||||||
|
|
||||||
public static Zone findSmallestZone(final Vector3fImmutable loc) {
|
public static final Zone findSmallestZone(final Vector3fImmutable loc) {
|
||||||
|
|
||||||
Zone zone = ZoneManager.seaFloor;
|
Zone zone = ZoneManager.seaFloor;
|
||||||
|
|
||||||
@@ -85,13 +83,13 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
childFound = false;
|
childFound = false;
|
||||||
|
|
||||||
ArrayList<Zone> nodes = zone.nodes;
|
ArrayList<Zone> nodes = zone.getNodes();
|
||||||
|
|
||||||
// Logger.info("soze", "" + nodes.size());
|
// Logger.info("soze", "" + nodes.size());
|
||||||
if (nodes != null)
|
if (nodes != null)
|
||||||
for (Zone child : nodes) {
|
for (Zone child : nodes) {
|
||||||
|
|
||||||
if (Bounds.collide(loc, child.bounds)) {
|
if (Bounds.collide(loc, child.getBounds()) == true) {
|
||||||
zone = child;
|
zone = child;
|
||||||
childFound = true;
|
childFound = true;
|
||||||
break;
|
break;
|
||||||
@@ -101,6 +99,16 @@ public enum ZoneManager {
|
|||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addZone(final int zoneID, final Zone zone) {
|
||||||
|
|
||||||
|
ZoneManager.zonesByID.put(zoneID, zone);
|
||||||
|
|
||||||
|
ZoneManager.zonesByUUID.put(zone.getObjectUUID(), zone);
|
||||||
|
|
||||||
|
ZoneManager.zonesByName.put(zone.getName().toLowerCase(), zone);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the number of available hotZones
|
// Returns the number of available hotZones
|
||||||
// remaining in this cycle (1am)
|
// remaining in this cycle (1am)
|
||||||
|
|
||||||
@@ -121,8 +129,8 @@ public enum ZoneManager {
|
|||||||
public static void resetHotZones() {
|
public static void resetHotZones() {
|
||||||
|
|
||||||
for (Zone zone : ZoneManager.macroZones)
|
for (Zone zone : ZoneManager.macroZones)
|
||||||
if (zone.wasHotzonw)
|
if (zone.hasBeenHotzone)
|
||||||
zone.wasHotzonw = false;
|
zone.hasBeenHotzone = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,18 +147,18 @@ public enum ZoneManager {
|
|||||||
return ZoneManager.zonesByName.get(zoneName);
|
return ZoneManager.zonesByName.get(zoneName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<Zone> getAllZones() {
|
public static final Collection<Zone> getAllZones() {
|
||||||
return ZoneManager.zonesByUUID.values();
|
return ZoneManager.zonesByUUID.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setHotZone(final Zone zone) {
|
public static final void setHotZone(final Zone zone) {
|
||||||
|
|
||||||
if (!zone.isMacroZone())
|
if (!zone.isMacroZone())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ZoneManager.hotZone = zone;
|
ZoneManager.hotZone = zone;
|
||||||
ZoneManager.hotZoneCycle = 1; // Used with HOTZONE_DURATION from config.
|
ZoneManager.hotZoneCycle = 1; // Used with HOTZONE_DURATION from config.
|
||||||
zone.wasHotzonw = true;
|
zone.hasBeenHotzone = true;
|
||||||
ZoneManager.hotZoneLastUpdate = LocalDateTime.now().withMinute(0).withSecond(0).atZone(ZoneId.systemDefault()).toInstant();
|
ZoneManager.hotZoneLastUpdate = LocalDateTime.now().withMinute(0).withSecond(0).atZone(ZoneId.systemDefault()).toInstant();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -160,32 +168,37 @@ public enum ZoneManager {
|
|||||||
if (ZoneManager.hotZone == null)
|
if (ZoneManager.hotZone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (Bounds.collide(loc, ZoneManager.hotZone.bounds));
|
return (Bounds.collide(loc, ZoneManager.hotZone.getBounds()) == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void populateZoneCollections(final Zone zone) {
|
public static Zone getSeaFloor() {
|
||||||
|
return ZoneManager.seaFloor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setSeaFloor(final Zone value) {
|
||||||
|
ZoneManager.seaFloor = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final void populateWorldZones(final Zone zone) {
|
||||||
|
|
||||||
|
int loadNum = zone.getLoadNum();
|
||||||
|
|
||||||
// Zones are added to separate
|
// Zones are added to separate
|
||||||
// collections for quick access
|
// collections for quick access
|
||||||
// based upon their type.
|
// based upon their type.
|
||||||
|
|
||||||
ZoneManager.zonesByID.put(zone.templateID, zone);
|
|
||||||
|
|
||||||
ZoneManager.zonesByUUID.put(zone.getObjectUUID(), zone);
|
|
||||||
|
|
||||||
ZoneManager.zonesByName.put(zone.zoneName.toLowerCase(), zone);
|
|
||||||
|
|
||||||
if (zone.isMacroZone()) {
|
if (zone.isMacroZone()) {
|
||||||
addMacroZone(zone);
|
addMacroZone(zone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zone.guild_zone) {
|
|
||||||
ZoneManager.playerCityZones.add(zone);
|
if (zone.isPlayerCity()) {
|
||||||
|
addPlayerCityZone(zone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zone.isNPCCity)
|
if (zone.isNPCCity())
|
||||||
addNPCCityZone(zone);
|
addNPCCityZone(zone);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -195,10 +208,15 @@ public enum ZoneManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void addNPCCityZone(final Zone zone) {
|
private static void addNPCCityZone(final Zone zone) {
|
||||||
zone.isNPCCity = true;
|
zone.setNPCCity(true);
|
||||||
ZoneManager.npcCityZones.add(zone);
|
ZoneManager.npcCityZones.add(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final void addPlayerCityZone(final Zone zone) {
|
||||||
|
zone.setPlayerCity(true);
|
||||||
|
ZoneManager.playerCityZones.add(zone);
|
||||||
|
}
|
||||||
|
|
||||||
public static final void generateAndSetRandomHotzone() {
|
public static final void generateAndSetRandomHotzone() {
|
||||||
|
|
||||||
Zone hotZone;
|
Zone hotZone;
|
||||||
@@ -231,23 +249,23 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
public static final boolean validHotZone(Zone zone) {
|
public static final boolean validHotZone(Zone zone) {
|
||||||
|
|
||||||
if (zone.peace_zone == (byte) 1)
|
if (zone.getSafeZone() == (byte) 1)
|
||||||
return false; // no safe zone hotzones// if (this.hotzone == null)
|
return false; // no safe zone hotzones// if (this.hotzone == null)
|
||||||
|
|
||||||
|
if (zone.getNodes().isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (zone.equals(ZoneManager.seaFloor))
|
if (zone.equals(ZoneManager.seaFloor))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (zone.nodes.isEmpty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//no duplicate hotZones
|
//no duplicate hotZones
|
||||||
|
|
||||||
if (zone.wasHotzonw == true)
|
if (zone.hasBeenHotzone == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Enforce min level
|
// Enforce min level
|
||||||
|
|
||||||
if (zone.min_level < Integer.parseInt(ConfigManager.MB_HOTZONE_MIN_LEVEL.getValue()))
|
if (zone.minLvl < Integer.parseInt(ConfigManager.MB_HOTZONE_MIN_LEVEL.getValue()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (ZoneManager.hotZone != null)
|
if (ZoneManager.hotZone != null)
|
||||||
@@ -259,50 +277,55 @@ public enum ZoneManager {
|
|||||||
// Converts world coordinates to coordinates local to a given zone.
|
// Converts world coordinates to coordinates local to a given zone.
|
||||||
|
|
||||||
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector,
|
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector,
|
||||||
Zone zone) {
|
Zone serverZone) {
|
||||||
|
|
||||||
Vector3fImmutable localCoords;
|
Vector3fImmutable localCoords;
|
||||||
|
|
||||||
localCoords = new Vector3fImmutable(worldVector.x - zone.absX,
|
localCoords = new Vector3fImmutable(worldVector.x - serverZone.absX,
|
||||||
worldVector.y - zone.absY, worldVector.z
|
worldVector.y - serverZone.absY, worldVector.z
|
||||||
- zone.absZ);
|
- serverZone.absZ);
|
||||||
|
|
||||||
return localCoords;
|
return localCoords;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector2f worldToZoneOffset(Vector3fImmutable worldLoc,
|
public static Vector2f worldToZoneSpace(Vector3fImmutable worldVector,
|
||||||
Zone zone) {
|
Zone serverZone) {
|
||||||
|
|
||||||
Vector2f zoneLoc;
|
|
||||||
|
|
||||||
zoneLoc = new Vector2f(worldLoc.x, worldLoc.z).subtract(zone.getLoc().x, zone.getLoc().z);
|
|
||||||
zoneLoc.y *= -1;
|
|
||||||
|
|
||||||
return zoneLoc;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vector2f worldToTerrainSpace(Vector3fImmutable worldLoc,
|
|
||||||
Zone zone) {
|
|
||||||
|
|
||||||
Vector2f localCoords;
|
Vector2f localCoords;
|
||||||
Vector2f zoneOrigin;
|
Vector2f zoneOrigin;
|
||||||
|
|
||||||
// Top left corner of zone is calculated in world space by the center and it's extents.
|
// Top left corner of zone is calculated in world space by the center and it's extents.
|
||||||
|
|
||||||
zoneOrigin = new Vector2f(zone.getLoc().x, zone.getLoc().z);
|
zoneOrigin = new Vector2f(serverZone.getLoc().x, serverZone.getLoc().z);
|
||||||
zoneOrigin = zoneOrigin.subtract(new Vector2f(zone.bounds.getHalfExtents().x, zone.bounds.getHalfExtents().y));
|
zoneOrigin = zoneOrigin.subtract(new Vector2f(serverZone.getBounds().getHalfExtents().x, serverZone.getBounds().getHalfExtents().y));
|
||||||
|
|
||||||
// Local coordinate in world space translated to an offset from the calculated zone origin.
|
// Local coordinate in world space translated to an offset from the calculated zone origin.
|
||||||
|
|
||||||
localCoords = new Vector2f(worldLoc.x, worldLoc.z);
|
localCoords = new Vector2f(worldVector.x, worldVector.z);
|
||||||
localCoords = localCoords.subtract(zoneOrigin);
|
localCoords = localCoords.subtract(zoneOrigin);
|
||||||
|
|
||||||
|
localCoords.setY((serverZone.getBounds().getHalfExtents().y * 2) - localCoords.y);
|
||||||
|
|
||||||
|
|
||||||
|
// TODO : Make sure this value does not go outside the zone's bounds.
|
||||||
|
|
||||||
return localCoords;
|
return localCoords;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts local zone coordinates to world coordinates
|
// Converts local zone coordinates to world coordinates
|
||||||
|
|
||||||
|
public static Vector3fImmutable localToWorld(Vector3fImmutable worldVector,
|
||||||
|
Zone serverZone) {
|
||||||
|
|
||||||
|
Vector3fImmutable worldCoords;
|
||||||
|
|
||||||
|
worldCoords = new Vector3fImmutable(worldVector.x + serverZone.absX,
|
||||||
|
worldVector.y + serverZone.absY, worldVector.z
|
||||||
|
+ serverZone.absZ);
|
||||||
|
|
||||||
|
return worldCoords;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts from local (relative to this building) to world.
|
* Converts from local (relative to this building) to world.
|
||||||
@@ -318,10 +341,9 @@ public enum ZoneManager {
|
|||||||
if (building.getBounds().getQuaternion() == null)
|
if (building.getBounds().getQuaternion() == null)
|
||||||
return building.getLoc();
|
return building.getLoc();
|
||||||
|
|
||||||
// handle building rotation
|
|
||||||
|
|
||||||
Vector3fImmutable rotatedLocal = Vector3fImmutable.rotateAroundPoint(Vector3fImmutable.ZERO, localPos, building.getBounds().getQuaternion());
|
Vector3fImmutable rotatedLocal = Vector3fImmutable.rotateAroundPoint(Vector3fImmutable.ZERO, localPos, building.getBounds().getQuaternion());
|
||||||
|
|
||||||
|
// handle building rotation
|
||||||
// handle building translation
|
// handle building translation
|
||||||
|
|
||||||
return building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z);
|
return building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z);
|
||||||
@@ -331,10 +353,12 @@ public enum ZoneManager {
|
|||||||
//used for regions, Building bounds not set yet.
|
//used for regions, Building bounds not set yet.
|
||||||
public static Vector3f convertLocalToWorld(Building building, Vector3f localPos, Bounds bounds) {
|
public static Vector3f convertLocalToWorld(Building building, Vector3f localPos, Bounds bounds) {
|
||||||
|
|
||||||
// handle building rotation
|
// convert from SB rotation value to radians
|
||||||
|
|
||||||
|
|
||||||
Vector3f rotatedLocal = Vector3f.rotateAroundPoint(Vector3f.ZERO, localPos, bounds.getQuaternion());
|
Vector3f rotatedLocal = Vector3f.rotateAroundPoint(Vector3f.ZERO, localPos, bounds.getQuaternion());
|
||||||
|
|
||||||
|
// handle building rotation
|
||||||
// handle building translation
|
// handle building translation
|
||||||
|
|
||||||
return new Vector3f(building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z));
|
return new Vector3f(building.getLoc().add(rotatedLocal.x, rotatedLocal.y, rotatedLocal.z));
|
||||||
@@ -357,11 +381,13 @@ public enum ZoneManager {
|
|||||||
public static City getCityAtLocation(Vector3fImmutable worldLoc) {
|
public static City getCityAtLocation(Vector3fImmutable worldLoc) {
|
||||||
|
|
||||||
Zone currentZone;
|
Zone currentZone;
|
||||||
|
ArrayList<Zone> zoneList;
|
||||||
|
City city;
|
||||||
|
|
||||||
currentZone = ZoneManager.findSmallestZone(worldLoc);
|
currentZone = ZoneManager.findSmallestZone(worldLoc);
|
||||||
|
|
||||||
if (currentZone.guild_zone)
|
if (currentZone.isPlayerCity())
|
||||||
return City.getCity(currentZone.playerCityUUID);
|
return City.getCity(currentZone.getPlayerCityUUID());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -384,16 +410,16 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
|
|
||||||
treeBounds = Bounds.borrow();
|
treeBounds = Bounds.borrow();
|
||||||
treeBounds.setBounds(new Vector2f(positionX, positionZ), new Vector2f(Enum.CityBoundsType.PLACEMENT.halfExtents, Enum.CityBoundsType.PLACEMENT.halfExtents), 0.0f);
|
treeBounds.setBounds(new Vector2f(positionX, positionZ), new Vector2f(Enum.CityBoundsType.PLACEMENT.extents, Enum.CityBoundsType.PLACEMENT.extents), 0.0f);
|
||||||
|
|
||||||
zoneList = currentZone.nodes;
|
zoneList = currentZone.getNodes();
|
||||||
|
|
||||||
for (Zone zone : zoneList) {
|
for (Zone zone : zoneList) {
|
||||||
|
|
||||||
if (zone.isContinent())
|
if (zone.isContinent())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Bounds.collide(treeBounds, zone.bounds, 0.0f))
|
if (Bounds.collide(treeBounds, zone.getBounds(), 0.0f))
|
||||||
validLocation = false;
|
validLocation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,36 +427,30 @@ public enum ZoneManager {
|
|||||||
return validLocation;
|
return validLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float calculateGlobalZoneHeight(Zone zone) {
|
public static void loadCities(Zone zone) {
|
||||||
|
|
||||||
float worldAltitude = MBServerStatics.SEA_FLOOR_ALTITUDE;
|
ArrayList<City> cities = DbManager.CityQueries.GET_CITIES_BY_ZONE(zone.getObjectUUID());
|
||||||
|
|
||||||
// Seafloor
|
for (City city : cities) {
|
||||||
|
|
||||||
if (ZoneManager.seaFloor.equals(zone))
|
city.setParent(zone);
|
||||||
return worldAltitude;
|
city.setObjectTypeMask(MBServerStatics.MASK_CITY);
|
||||||
|
city.setLoc(city.getLoc()); // huh?
|
||||||
|
|
||||||
// Children of seafloor
|
//not player city, must be npc city..
|
||||||
|
|
||||||
if (ZoneManager.seaFloor.equals(zone.parent))
|
if (!zone.isPlayerCity())
|
||||||
return worldAltitude + zone.yOffset;
|
zone.setNPCCity(true);
|
||||||
|
|
||||||
// return height from heightmap engine at zone location
|
if ((ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER)) && (city.getHash() == null)) {
|
||||||
|
|
||||||
worldAltitude = Terrain.getWorldHeight(zone.parent, zone.getLoc());
|
city.setHash();
|
||||||
|
|
||||||
// Add zone offset to value
|
if (DataWarehouse.recordExists(Enum.DataRecordType.CITY, city.getObjectUUID()) == false) {
|
||||||
|
CityRecord cityRecord = CityRecord.borrow(city, Enum.RecordEventType.CREATE);
|
||||||
worldAltitude += zone.yOffset;
|
DataWarehouse.pushToWarehouse(cityRecord);
|
||||||
|
}
|
||||||
return worldAltitude;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
|
|
||||||
|
|
||||||
float localAltitude = Terrain.getWorldHeight(currentLoc);
|
|
||||||
Zone zone = findSmallestZone(currentLoc);
|
|
||||||
|
|
||||||
return localAltitude < zone.sea_level;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class EndFearJob extends AbstractEffectJob {
|
|||||||
if (this.target == null || (!(this.target instanceof Mob)))
|
if (this.target == null || (!(this.target instanceof Mob)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((Mob) this.target).fearedObject = null;
|
((Mob) this.target).setFearedObject(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
|
|||||||
if (this.target == null || (!(this.target instanceof Mob)))
|
if (this.target == null || (!(this.target instanceof Mob)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((Mob) this.target).fearedObject = null;
|
((Mob) this.target).setFearedObject(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ public class FinishSummonsJob extends AbstractScheduleJob {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.source.region != null)
|
||||||
|
this.target.setRegion(this.source.region);
|
||||||
//teleport target to source
|
//teleport target to source
|
||||||
target.teleport(source.getLoc());
|
target.teleport(source.getLoc());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package engine.jobs;
|
package engine.jobs;
|
||||||
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.job.AbstractScheduleJob;
|
import engine.job.AbstractScheduleJob;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -40,7 +39,7 @@ public class UpgradeBuildingJob extends AbstractScheduleJob {
|
|||||||
// SetCurrentRank also changes the mesh and maxhp
|
// SetCurrentRank also changes the mesh and maxhp
|
||||||
// accordingly for buildings with blueprints
|
// accordingly for buildings with blueprints
|
||||||
|
|
||||||
BuildingManager.setRank(rankingBuilding, rankingBuilding.getRank() + 1);
|
rankingBuilding.setRank(rankingBuilding.getRank() + 1);
|
||||||
|
|
||||||
// Reload the object
|
// Reload the object
|
||||||
|
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ public class Bounds {
|
|||||||
this.origin.set(building.getLoc().x, building.getLoc().z);
|
this.origin.set(building.getLoc().x, building.getLoc().z);
|
||||||
|
|
||||||
|
|
||||||
// Magicbane uses halfExtents
|
// Magicbane uses half halfExtents
|
||||||
|
|
||||||
if (meshBounds == null) {
|
if (meshBounds == null) {
|
||||||
halfExtentX = 1;
|
halfExtentX = 1;
|
||||||
@@ -438,10 +438,8 @@ public class Bounds {
|
|||||||
// The rotation is reset after the new aabb is calculated.
|
// The rotation is reset after the new aabb is calculated.
|
||||||
|
|
||||||
this.rotation = building.getRot().y;
|
this.rotation = building.getRot().y;
|
||||||
|
|
||||||
// Caclculate and set the new half halfExtents for the rotated bounding box
|
// Caclculate and set the new half halfExtents for the rotated bounding box
|
||||||
// and reset the rotation to 0 for this bounds.
|
// and reset the rotation to 0 for this bounds.
|
||||||
|
|
||||||
this.halfExtents.set(halfExtentX, (halfExtentY));
|
this.halfExtents.set(halfExtentX, (halfExtentY));
|
||||||
this.rotation = 0;
|
this.rotation = 0;
|
||||||
|
|
||||||
@@ -455,6 +453,7 @@ public class Bounds {
|
|||||||
this.halfExtents.set(blueprint.getExtents());
|
this.halfExtents.set(blueprint.getExtents());
|
||||||
this.flipExtents = Bounds.calculateFlipExtents(this);
|
this.flipExtents = Bounds.calculateFlipExtents(this);
|
||||||
|
|
||||||
|
|
||||||
this.setRegions(building);
|
this.setRegions(building);
|
||||||
this.setColliders(building);
|
this.setColliders(building);
|
||||||
|
|
||||||
|
|||||||
+359
-287
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,66 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.mobileAI.Threads;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.objects.Mob;
|
||||||
|
import engine.objects.Zone;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thread blocks until MagicBane dispatch messages are
|
||||||
|
* enqueued then processes them in FIFO order. The collection
|
||||||
|
* is thread safe.
|
||||||
|
* <p>
|
||||||
|
* Any large messages not time sensitive such as load object
|
||||||
|
* sent to more than a single individual should be spawned
|
||||||
|
* individually on a DispatchMessageThread.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MobRespawnThread implements Runnable {
|
||||||
|
|
||||||
|
|
||||||
|
public MobRespawnThread() {
|
||||||
|
Logger.info(" MobRespawnThread thread has started!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (Zone zone : ZoneManager.getAllZones()) {
|
||||||
|
|
||||||
|
if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) {
|
||||||
|
|
||||||
|
Mob respawner = zone.respawnQue.iterator().next();
|
||||||
|
|
||||||
|
if (respawner == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
respawner.respawn();
|
||||||
|
zone.respawnQue.remove(respawner);
|
||||||
|
zone.lastRespawn = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void startRespawnThread() {
|
||||||
|
Thread respawnThread;
|
||||||
|
respawnThread = new Thread(new MobRespawnThread());
|
||||||
|
respawnThread.setName("respawnThread");
|
||||||
|
respawnThread.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.mobileAI.Threads;
|
|
||||||
import engine.objects.Mob;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.util.concurrent.BlockingQueue;
|
|
||||||
import java.util.concurrent.DelayQueue;
|
|
||||||
|
|
||||||
public enum Respawner implements Runnable {
|
|
||||||
RESPAWNER;
|
|
||||||
public static BlockingQueue<Mob> respawnQueue = new DelayQueue();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
Mob mobile = respawnQueue.take();
|
|
||||||
mobile.respawn();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Logger.error(e.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void start() {
|
|
||||||
Thread respawnThread;
|
|
||||||
respawnThread = new Thread(RESPAWNER);
|
|
||||||
respawnThread.setName("respawnThread");
|
|
||||||
respawnThread.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -48,7 +48,7 @@ public class CombatUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
|
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
|
||||||
return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range;
|
return entity1.getLoc().distance2D(entity2.getLoc()) < range;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
|
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
|
||||||
@@ -264,9 +264,19 @@ public class CombatUtilities {
|
|||||||
swingIsBlock(agent, target, passiveAnim);
|
swingIsBlock(agent, target, passiveAnim);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (agent.getEquip().get(1) != null && agent.getEquip().get(2) != null && agent.getEquip().get(2).getItemBase().isShield() == false) {
|
||||||
swingIsDamage(agent, target, determineDamage(agent), anim);
|
//mob is duel wielding and should conduct an attack for each hand
|
||||||
|
ItemBase weapon1 = agent.getEquip().get(1).getItemBase();
|
||||||
|
double range1 = getMaxDmg(weapon1.getMinDamage(), agent, weapon1) - getMinDmg(weapon1.getMinDamage(), agent, weapon1);
|
||||||
|
double damage1 = getMinDmg(weapon1.getMinDamage(), agent, weapon1) + ((ThreadLocalRandom.current().nextFloat() * range1) + (ThreadLocalRandom.current().nextFloat() * range1)) / 2;
|
||||||
|
swingIsDamage(agent, target, (float) damage1, CombatManager.getSwingAnimation(weapon1, null, true));
|
||||||
|
ItemBase weapon2 = agent.getEquip().get(2).getItemBase();
|
||||||
|
double range2 = getMaxDmg(weapon2.getMinDamage(), agent, weapon2) - getMinDmg(weapon2.getMinDamage(), agent, weapon2);
|
||||||
|
double damage2 = getMinDmg(weapon2.getMinDamage(), agent, weapon2) + ((ThreadLocalRandom.current().nextFloat() * range2) + (ThreadLocalRandom.current().nextFloat() * range2)) / 2;
|
||||||
|
swingIsDamage(agent, target, (float) damage2, CombatManager.getSwingAnimation(weapon1, null, false));
|
||||||
|
} else {
|
||||||
|
swingIsDamage(agent, target, determineDamage(agent), anim);
|
||||||
|
}
|
||||||
|
|
||||||
if (agent.getWeaponPower() != null)
|
if (agent.getWeaponPower() != null)
|
||||||
agent.getWeaponPower().attack(target, MBServerStatics.ONE_MINUTE);
|
agent.getWeaponPower().attack(target, MBServerStatics.ONE_MINUTE);
|
||||||
@@ -309,10 +319,19 @@ public class CombatUtilities {
|
|||||||
if (target == null)
|
if (target == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int damage = 0;
|
float damage = 0;
|
||||||
|
|
||||||
DamageType dt = getDamageType(agent);
|
DamageType dt = getDamageType(agent);
|
||||||
damage = ThreadLocalRandom.current().nextInt((int)getMinDmg(agent), (int)getMaxDmg(agent) + 1);
|
if ((agent.agentType.equals(AIAgentType.PET)) == true || agent.isPet() == true || agent.isNecroPet() == true) {
|
||||||
|
damage = calculatePetDamage(agent);
|
||||||
|
} else if (agent.isPlayerGuard() == true) {
|
||||||
|
//damage = calculateGuardDamage(agent);
|
||||||
|
damage = calculateMobDamage(agent);
|
||||||
|
} else if (agent.getLevel() > 80) {
|
||||||
|
damage = calculateEpicDamage(agent);
|
||||||
|
} else {
|
||||||
|
damage = calculateMobDamage(agent);
|
||||||
|
}
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||||
if (((AbstractCharacter) target).isSit()) {
|
if (((AbstractCharacter) target).isSit()) {
|
||||||
damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
@@ -338,16 +357,158 @@ public class CombatUtilities {
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMinDmg(Mob agent) {
|
public static int calculatePetDamage(Mob agent) {
|
||||||
if(agent.equip.get(2) != null && !agent.equip.get(2).getItemBase().isShield())
|
//damage calc for pet
|
||||||
return agent.minDamageHandTwo;
|
float range;
|
||||||
else return agent.minDamageHandOne;
|
float damage;
|
||||||
|
float min = 40;
|
||||||
|
float max = 60;
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double minDmg = getMinDmg(min, agent, null);
|
||||||
|
double maxDmg = getMaxDmg(max, agent, null);
|
||||||
|
dmgMultiplier += agent.getLevel() * 0.1f;
|
||||||
|
range = (float) (maxDmg - minDmg);
|
||||||
|
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
return (int) (damage * dmgMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMaxDmg(Mob agent) {
|
public static int calculateGuardDamage(Mob agent) {
|
||||||
if(agent.equip.get(2) != null && !agent.equip.get(2).getItemBase().isShield())
|
//damage calc for guard
|
||||||
return agent.maxDamageHandTwo;
|
ItemBase weapon = agent.getEquip().get(1).getItemBase();
|
||||||
else return agent.maxDamageHandOne;
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
|
||||||
|
double minDmg = weapon.getMinDamage();
|
||||||
|
double maxDmg = weapon.getMaxDamage();
|
||||||
|
double min = getMinDmg(minDmg, agent, weapon);
|
||||||
|
double max = getMaxDmg(maxDmg, agent, weapon);
|
||||||
|
|
||||||
|
DamageType dt = weapon.getDamageType();
|
||||||
|
|
||||||
|
double range = max - min;
|
||||||
|
double damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
if (((AbstractCharacter) target).isSit())
|
||||||
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int calculateEpicDamage(Mob agent) {
|
||||||
|
//handle r8 mob damage
|
||||||
|
DamageType dt = DamageType.Crush;
|
||||||
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double min = agent.getMinDamageHandOne();
|
||||||
|
double max = agent.getMaxDamageHandOne();
|
||||||
|
if (agent.getEquip().get(1) != null) {
|
||||||
|
if (agent.getEquip().get(1).getItemBase() != null) {
|
||||||
|
dt = agent.getEquip().get(1).getItemBase().getDamageType();
|
||||||
|
min = agent.getMinDamageHandOne();
|
||||||
|
max = agent.getMaxDamageHandOne();
|
||||||
|
} else if (agent.getEquip().get(2).getItemBase() != null && agent.getEquip().get(2).getItemBase().isShield() == false) {
|
||||||
|
dt = agent.getEquip().get(2).getItemBase().getDamageType();
|
||||||
|
min = agent.getMinDamageHandTwo();
|
||||||
|
max = agent.getMaxDamageHandTwo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double range = max - min;
|
||||||
|
double damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int calculateMobDamage(Mob agent) {
|
||||||
|
ItemBase weapon = null;
|
||||||
|
double minDmg;
|
||||||
|
double maxDmg;
|
||||||
|
DamageType dt;
|
||||||
|
|
||||||
|
//main hand or offhand damage
|
||||||
|
|
||||||
|
if (agent.getEquip().get(1) != null)
|
||||||
|
weapon = agent.getEquip().get(1).getItemBase();
|
||||||
|
else if (agent.getEquip().get(2) != null)
|
||||||
|
weapon = agent.getEquip().get(2).getItemBase();
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
minDmg = getMinDmg(weapon.getMinDamage(), agent, weapon);
|
||||||
|
maxDmg = getMaxDmg(weapon.getMaxDamage(), agent, weapon);
|
||||||
|
dt = weapon.getDamageType();
|
||||||
|
} else {
|
||||||
|
minDmg = agent.getMobBase().getDamageMin();
|
||||||
|
maxDmg = agent.getMobBase().getDamageMax();
|
||||||
|
dt = DamageType.Crush;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
|
||||||
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double range = maxDmg - minDmg;
|
||||||
|
double damage = minDmg + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
if (((AbstractCharacter) target).isSit())
|
||||||
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMinDmg(double min, Mob agent, ItemBase weapon) {
|
||||||
|
|
||||||
|
int primary = agent.getStatStrCurrent();
|
||||||
|
int secondary = agent.getStatDexCurrent();
|
||||||
|
int focusLevel = 0;
|
||||||
|
int masteryLevel = 0;
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
if (weapon.isStrBased() == true) {
|
||||||
|
primary = agent.getStatStrCurrent();
|
||||||
|
secondary = agent.getStatDexCurrent();
|
||||||
|
} else {
|
||||||
|
primary = agent.getStatDexCurrent();
|
||||||
|
secondary = agent.getStatStrCurrent();
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired())) {
|
||||||
|
focusLevel = (int) agent.getSkills().get(weapon.getSkillRequired()).getModifiedAmount();
|
||||||
|
}
|
||||||
|
if (agent.getSkills().containsKey(weapon.getMastery())) {
|
||||||
|
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMaxDmg(double max, Mob agent, ItemBase weapon) {
|
||||||
|
|
||||||
|
int primary = agent.getStatStrCurrent();
|
||||||
|
int secondary = agent.getStatDexCurrent();
|
||||||
|
int focusLevel = 0;
|
||||||
|
int masteryLevel = 0;
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
|
||||||
|
if (weapon.isStrBased() == true) {
|
||||||
|
primary = agent.getStatStrCurrent();
|
||||||
|
secondary = agent.getStatDexCurrent();
|
||||||
|
} else {
|
||||||
|
primary = agent.getStatDexCurrent();
|
||||||
|
secondary = agent.getStatStrCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
|
||||||
|
focusLevel = (int) agent.getSkills().get(weapon.getSkillRequired()).getModifiedAmount();
|
||||||
|
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
|
||||||
|
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||||
|
|
||||||
|
}
|
||||||
|
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import engine.Enum;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.ModType;
|
import engine.Enum.ModType;
|
||||||
import engine.Enum.SourceType;
|
import engine.Enum.SourceType;
|
||||||
|
import engine.mobileAI.Threads.MobAIThread;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.MovementManager;
|
import engine.gameManager.MovementManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mobileAI.Threads.MobAIThread;
|
|
||||||
import engine.net.client.msg.MoveToPointMsg;
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -38,7 +38,7 @@ public class MovementUtilities {
|
|||||||
if (agent.getContract() != null)
|
if (agent.getContract() != null)
|
||||||
guardCaptain = agent;
|
guardCaptain = agent;
|
||||||
else
|
else
|
||||||
guardCaptain = (Mob) agent.guardCaptain;
|
guardCaptain = (Mob) agent.npcOwner;
|
||||||
|
|
||||||
if (guardCaptain != null) {
|
if (guardCaptain != null) {
|
||||||
Building barracks = guardCaptain.building;
|
Building barracks = guardCaptain.building;
|
||||||
@@ -51,7 +51,7 @@ public class MovementUtilities {
|
|||||||
|
|
||||||
//Guards recall distance = 814.
|
//Guards recall distance = 814.
|
||||||
if (tol != null) {
|
if (tol != null) {
|
||||||
return !(agent.getLoc().distanceSquared2D(tol.getLoc()) > sqr(Enum.CityBoundsType.ZONE.halfExtents));
|
return !(agent.getLoc().distanceSquared2D(tol.getLoc()) > sqr(Enum.CityBoundsType.ZONE.extents));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -68,8 +68,8 @@ public class MovementUtilities {
|
|||||||
float zoneRange = 250;
|
float zoneRange = 250;
|
||||||
|
|
||||||
if (agent.getParentZone() != null) {
|
if (agent.getParentZone() != null) {
|
||||||
if (agent.getParentZone().bounds != null)
|
if (agent.getParentZone().getBounds() != null)
|
||||||
zoneRange = agent.getParentZone().bounds.getHalfExtents().x * 2;
|
zoneRange = agent.getParentZone().getBounds().getHalfExtents().x * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zoneRange > 300)
|
if (zoneRange > 300)
|
||||||
@@ -147,7 +147,7 @@ public class MovementUtilities {
|
|||||||
return aiAgent.getLoc().ClosestPointOnLine(aggroTarget.getLoc(), aggroTarget.getEndLoc());
|
return aiAgent.getLoc().ClosestPointOnLine(aggroTarget.getLoc(), aggroTarget.getEndLoc());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void moveToLocation(Mob agent, Vector3fImmutable newLocation, float offset, boolean isWalking) {
|
public static void moveToLocation(Mob agent, Vector3fImmutable newLocation, float offset) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//don't move farther than 30 units from player.
|
//don't move farther than 30 units from player.
|
||||||
@@ -158,7 +158,7 @@ public class MovementUtilities {
|
|||||||
|
|
||||||
agent.setFaceDir(newLoc.subtract2D(agent.getLoc()).normalize());
|
agent.setFaceDir(newLoc.subtract2D(agent.getLoc()).normalize());
|
||||||
|
|
||||||
aiMove(agent, newLoc, isWalking);
|
aiMove(agent, newLoc, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.toString());
|
Logger.error(e.toString());
|
||||||
}
|
}
|
||||||
@@ -244,10 +244,10 @@ public class MovementUtilities {
|
|||||||
msg.setSourceID(agent.getObjectUUID());
|
msg.setSourceID(agent.getObjectUUID());
|
||||||
msg.setStartCoord(startLoc);
|
msg.setStartCoord(startLoc);
|
||||||
msg.setEndCoord(endLoc);
|
msg.setEndCoord(endLoc);
|
||||||
msg.setInBuildingFloor(-1);
|
msg.setUnknown01(-1);
|
||||||
msg.setInBuilding(-1);
|
msg.setInBuilding(-1);
|
||||||
msg.setStartLocType(0);
|
msg.setTargetType(0);
|
||||||
msg.setInBuildingUUID(0);
|
msg.setTargetID(0);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import static engine.net.MessageDispatcher.maxRecipients;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispatch Message is the main interface to Magicbane's threaded
|
* Dispatch Message is the main interface to Magicbane's threaded
|
||||||
* async message delivery system.
|
* asynch message delivery system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DispatchMessage {
|
public class DispatchMessage {
|
||||||
|
|||||||
@@ -643,7 +643,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
moveMsg.setStartCoord(sourcePlayer.getLoc());
|
moveMsg.setStartCoord(sourcePlayer.getLoc());
|
||||||
moveMsg.setEndCoord(sourcePlayer.getLoc());
|
moveMsg.setEndCoord(sourcePlayer.getLoc());
|
||||||
moveMsg.setInBuilding(-1);
|
moveMsg.setInBuilding(-1);
|
||||||
moveMsg.setInBuildingFloor(-1);
|
moveMsg.setUnknown01(-1);
|
||||||
|
|
||||||
dispatch = Dispatch.borrow(sourcePlayer, moveMsg);
|
dispatch = Dispatch.borrow(sourcePlayer, moveMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
@@ -1196,7 +1196,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
|
|
||||||
if (npc.getCharItemManager().getInventoryCount() > 150) {
|
if (npc.getCharItemManager().getInventoryCount() > 150) {
|
||||||
if (npc.getParentZone() != null && npc.getParentZone().playerCityUUID == 0) {
|
if (npc.getParentZone() != null && npc.getParentZone().getPlayerCityUUID() == 0) {
|
||||||
ArrayList<Item> inv = npc.getInventory();
|
ArrayList<Item> inv = npc.getInventory();
|
||||||
for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
try {
|
try {
|
||||||
@@ -1229,7 +1229,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (ib == null)
|
if (ib == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (npc.getParentZone() != null && npc.getParentZone().playerCityUUID != 0)
|
if (npc.getParentZone() != null && npc.getParentZone().getPlayerCityUUID() != 0)
|
||||||
if (!npc.getCharItemManager().hasRoomInventory(ib.getWeight())) {
|
if (!npc.getCharItemManager().hasRoomInventory(ib.getWeight())) {
|
||||||
|
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||||
@@ -1280,7 +1280,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
if (building != null && building.getProtectionState().equals(ProtectionState.NPC))
|
if (building != null && building.getProtectionState().equals(ProtectionState.NPC))
|
||||||
building = null;
|
building = null;
|
||||||
if (npc.getParentZone().playerCityUUID == 0)
|
if (npc.getParentZone().getPlayerCityUUID() == 0)
|
||||||
building = null;
|
building = null;
|
||||||
|
|
||||||
//make sure npc can afford item
|
//make sure npc can afford item
|
||||||
@@ -1892,6 +1892,9 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
case POWER:
|
case POWER:
|
||||||
PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
||||||
break;
|
break;
|
||||||
|
case REQUESTMELEEATTACK:
|
||||||
|
CombatManager.setAttackTarget((AttackCmdMsg) msg, origin);
|
||||||
|
break;
|
||||||
case READYTOENTER:
|
case READYTOENTER:
|
||||||
break;
|
break;
|
||||||
case OPENVAULT:
|
case OPENVAULT:
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public enum Protocol {
|
|||||||
REPAIROBJECT(0x782219CE, RepairMsg.class, null), //Repair Window Req/Ack, RepairObject item Req/Ack
|
REPAIROBJECT(0x782219CE, RepairMsg.class, null), //Repair Window Req/Ack, RepairObject item Req/Ack
|
||||||
REQUESTCONTENTS(0xA786B0A2, LootWindowRequestMsg.class, null), // MoveObjectToContainer Window Request
|
REQUESTCONTENTS(0xA786B0A2, LootWindowRequestMsg.class, null), // MoveObjectToContainer Window Request
|
||||||
REQUESTGUILDLIST(0x85DCC6D7, ReqGuildListMsg.class, RequestGuildListHandler.class),
|
REQUESTGUILDLIST(0x85DCC6D7, ReqGuildListMsg.class, RequestGuildListHandler.class),
|
||||||
REQUESTMELEEATTACK(0x98C71545, AttackCmdMsg.class, AttackCmdMsgHandler.class), // Attack
|
REQUESTMELEEATTACK(0x98C71545, AttackCmdMsg.class, null), // Attack
|
||||||
REQUESTMEMBERLIST(0x3235E5EA, GuildControlMsg.class, GuildControlHandler.class), // Part of Promote/Demote, Also Player History
|
REQUESTMEMBERLIST(0x3235E5EA, GuildControlMsg.class, GuildControlHandler.class), // Part of Promote/Demote, Also Player History
|
||||||
REQUESTTOOPENBANK(0xF26E453F, null, null), // RequestToOpenBankMsg
|
REQUESTTOOPENBANK(0xF26E453F, null, null), // RequestToOpenBankMsg
|
||||||
REQUESTTOTRADE(0x4D84259B, TradeRequestMsg.class, null), // Trade Request
|
REQUESTTOTRADE(0x4D84259B, TradeRequestMsg.class, null), // Trade Request
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc());
|
cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc());
|
||||||
|
|
||||||
// Can't abandon a tree not within a player city zone
|
// Can't abandon a tree not within a player city zone
|
||||||
if (cityZone.guild_zone == false)
|
if (cityZone.isPlayerCity() == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (targetBuilding.getCity() == null)
|
if (targetBuilding.getCity() == null)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
serverCity = City.GetCityFromCache(serverZone.playerCityUUID);
|
serverCity = City.GetCityFromCache(serverZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (serverCity == null)
|
if (serverCity == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
package engine.net.client.handlers;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.exception.MsgSendException;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.CombatManager;
|
|
||||||
import engine.net.client.ClientConnection;
|
|
||||||
import engine.net.client.msg.AttackCmdMsg;
|
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
|
||||||
import engine.objects.*;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @Author:
|
|
||||||
* @Summary: Processes application protocol message which keeps
|
|
||||||
* client's tcp connection open.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
|
||||||
|
|
||||||
public AttackCmdMsgHandler() {
|
|
||||||
super(AttackCmdMsg.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
|
||||||
|
|
||||||
// Member variable declaration
|
|
||||||
|
|
||||||
AttackCmdMsg msg;
|
|
||||||
|
|
||||||
// Member variable assignment
|
|
||||||
|
|
||||||
msg = (AttackCmdMsg) baseMsg;
|
|
||||||
|
|
||||||
if (TargetedActionMsg.un2cnt == 60 || TargetedActionMsg.un2cnt == 70)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (playerCharacter == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
AbstractWorldObject target = null;
|
|
||||||
Enum.GameObjectType targetType;
|
|
||||||
|
|
||||||
targetType = Enum.GameObjectType.values()[msg.getTargetType()];
|
|
||||||
|
|
||||||
switch(targetType){
|
|
||||||
case Mob:
|
|
||||||
target = Mob.getMob(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
case PlayerCharacter:
|
|
||||||
target = PlayerCharacter.getPlayerCharacter(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
case Building:
|
|
||||||
target = BuildingManager.getBuilding(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
case NPC:
|
|
||||||
target = NPC.getNPC(msg.getTargetID());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(target == null) {
|
|
||||||
playerCharacter.setCombatTarget(null);
|
|
||||||
return true; // cannot attack a null target
|
|
||||||
}
|
|
||||||
//set sources target
|
|
||||||
|
|
||||||
playerCharacter.setCombatTarget(target);
|
|
||||||
|
|
||||||
//put in combat if not already
|
|
||||||
|
|
||||||
if (!playerCharacter.isCombat())
|
|
||||||
CombatManager.toggleCombat(true, origin);
|
|
||||||
|
|
||||||
//make character stand if sitting
|
|
||||||
|
|
||||||
if (playerCharacter.isSit())
|
|
||||||
CombatManager.toggleSit(false, origin);
|
|
||||||
|
|
||||||
CombatManager.AttackTarget(playerCharacter, target);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -76,7 +76,7 @@ public class ChangeGuildLeaderHandler extends AbstractClientMsgHandler {
|
|||||||
boolean isMale = true;
|
boolean isMale = true;
|
||||||
boolean updateTarget;
|
boolean updateTarget;
|
||||||
|
|
||||||
Enum.GuildCharterType t = Enum.GuildCharterType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter());
|
Enum.GuildType t = Enum.GuildType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter());
|
||||||
|
|
||||||
|
|
||||||
if (!DbManager.GuildQueries.SET_GUILD_LEADER(targetPlayer.getObjectUUID(), glGuild.getObjectUUID())) {
|
if (!DbManager.GuildQueries.SET_GUILD_LEADER(targetPlayer.getObjectUUID(), glGuild.getObjectUUID())) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class ChangeRankHandler extends AbstractClientMsgHandler {
|
|||||||
boolean isMale;
|
boolean isMale;
|
||||||
|
|
||||||
if (msg.getPreviousRank() != msg.getNewRank()) {
|
if (msg.getPreviousRank() != msg.getNewRank()) {
|
||||||
Enum.GuildCharterType t = Enum.GuildCharterType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter());
|
Enum.GuildType t = Enum.GuildType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter());
|
||||||
|
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
targetPlayer.setGuildTitle(msg.getNewRank());
|
targetPlayer.setGuildTitle(msg.getNewRank());
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class ChannelMuteMsgHandler extends AbstractClientMsgHandler {
|
|||||||
cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc());
|
cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc());
|
||||||
|
|
||||||
// Can't abandon a tree not within a player city zone
|
// Can't abandon a tree not within a player city zone
|
||||||
if (cityZone.guild_zone == false)
|
if (cityZone.isPlayerCity() == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (targetBuilding.getCity().hasBeenTransfered == true) {
|
if (targetBuilding.getCity().hasBeenTransfered == true) {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler {
|
|||||||
playerZone = building.getParentZone();
|
playerZone = building.getParentZone();
|
||||||
|
|
||||||
if (playerZone != null)
|
if (playerZone != null)
|
||||||
playerCity = City.getCity(playerZone.playerCityUUID);
|
playerCity = City.getCity(playerZone.getPlayerCityUUID());
|
||||||
|
|
||||||
// Oops! *** Refactor: Log error
|
// Oops! *** Refactor: Log error
|
||||||
switch (msg.getMessageType()) {
|
switch (msg.getMessageType()) {
|
||||||
@@ -117,7 +117,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler {
|
|||||||
dispatch = Dispatch.borrow(sourcePlayer, gtsm);
|
dispatch = Dispatch.borrow(sourcePlayer, gtsm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
CityZoneMsg czm = new CityZoneMsg(2, playerZone.getLoc().x, playerZone.getLoc().y, playerZone.getLoc().z, playerCity.getCityName(), playerZone, Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents);
|
CityZoneMsg czm = new CityZoneMsg(2, playerZone.getLoc().x, playerZone.getLoc().y, playerZone.getLoc().z, playerCity.getCityName(), playerZone, Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents);
|
||||||
DispatchMessage.dispatchMsgToAll(czm);
|
DispatchMessage.dispatchMsgToAll(czm);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
|||||||
city.setWarehouseBuildingID(0);
|
city.setWarehouseBuildingID(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildingManager.setRank(building, -1);
|
building.setRank(-1);
|
||||||
WorldGrid.RemoveWorldObject(building);
|
WorldGrid.RemoveWorldObject(building);
|
||||||
WorldGrid.removeObject(building);
|
WorldGrid.removeObject(building);
|
||||||
building.getParentZone().zoneBuildingSet.remove(building);
|
building.getParentZone().zoneBuildingSet.remove(building);
|
||||||
|
|||||||
@@ -12,9 +12,7 @@ package engine.net.client.handlers;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.ConfigManager;
|
|
||||||
import engine.gameManager.GroupManager;
|
import engine.gameManager.GroupManager;
|
||||||
import engine.gameManager.GuildManager;
|
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
@@ -23,7 +21,6 @@ import engine.net.client.msg.ClientNetMsg;
|
|||||||
import engine.net.client.msg.group.GroupInviteMsg;
|
import engine.net.client.msg.group.GroupInviteMsg;
|
||||||
import engine.net.client.msg.group.GroupUpdateMsg;
|
import engine.net.client.msg.group.GroupUpdateMsg;
|
||||||
import engine.objects.Group;
|
import engine.objects.Group;
|
||||||
import engine.objects.Guild;
|
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
public class GroupInviteHandler extends AbstractClientMsgHandler {
|
public class GroupInviteHandler extends AbstractClientMsgHandler {
|
||||||
@@ -106,15 +103,7 @@ public class GroupInviteHandler extends AbstractClientMsgHandler {
|
|||||||
if (target.isIgnoringPlayer(source))
|
if (target.isIgnoringPlayer(source))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
|
|
||||||
if(source.guild.equals(Guild.getErrantGuild()))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (source.guild.getGuildType() != null) {
|
|
||||||
if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// dont block invites to people already in a group and
|
// dont block invites to people already in a group and
|
||||||
// dont check for pending invites, the client does it
|
// dont check for pending invites, the client does it
|
||||||
// Send invite message to target
|
// Send invite message to target
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
PlayerCharacter player;
|
PlayerCharacter player;
|
||||||
GuildCreationFinalizeMsg msg;
|
GuildCreationFinalizeMsg msg;
|
||||||
Enum.GuildCharterType charterType;
|
Enum.GuildType charterType;
|
||||||
Guild newGuild;
|
Guild newGuild;
|
||||||
Guild playerGuild;
|
Guild playerGuild;
|
||||||
ItemBase itemBase;
|
ItemBase itemBase;
|
||||||
@@ -78,7 +78,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
charterType = Enum.GuildCharterType.getGuildTypeFromCharter(itemBase);
|
charterType = Enum.GuildType.getGuildTypeFromCharter(itemBase);
|
||||||
|
|
||||||
if (charterType == null) {
|
if (charterType == null) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND);
|
ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND);
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import engine.Enum;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.ConfigManager;
|
|
||||||
import engine.gameManager.GuildManager;
|
import engine.gameManager.GuildManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
@@ -85,9 +84,9 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Enum.GuildCharterType guildCharterType = Enum.GuildCharterType.values()[sourcePlayer.getGuild().getCharter()];
|
Enum.GuildType guildType = Enum.GuildType.values()[sourcePlayer.getGuild().getCharter()];
|
||||||
|
|
||||||
if (guildCharterType == null) {
|
if (guildType == null) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, GuildManager.NO_CHARTER_FOUND);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, GuildManager.NO_CHARTER_FOUND);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -125,12 +124,7 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler {
|
|||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 135);// you do not meet the level required for this SWORN guild
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 135);// you do not meet the level required for this SWORN guild
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
|
|
||||||
if (GuildManager.meetsLoreRequirements(sourcePlayer.guild, targetPlayer) == false) {
|
|
||||||
ChatManager.chatGuildError(sourcePlayer,targetPlayer.getFirstName() + " does not meet charter requirements!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
targetPlayer.setLastGuildToInvite(sourcePlayer.getGuild().getObjectUUID());
|
targetPlayer.setLastGuildToInvite(sourcePlayer.getGuild().getObjectUUID());
|
||||||
|
|
||||||
// setup guild invite message to send to targetPlayer
|
// setup guild invite message to send to targetPlayer
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ package engine.net.client.handlers;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.SessionManager;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
@@ -109,12 +111,7 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
|||||||
sendChat(source, "This Guild can't be subbed.");
|
sendChat(source, "This Guild can't be subbed.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
|
|
||||||
if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false){
|
|
||||||
sendChat(source, "You Must Be The Same Charter To Form A Nation.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//all tests passed, let's send invite.
|
//all tests passed, let's send invite.
|
||||||
|
|
||||||
if (target.getClientConnection() != null) {
|
if (target.getClientConnection() != null) {
|
||||||
|
|||||||
@@ -11,13 +11,17 @@ package engine.net.client.handlers;
|
|||||||
|
|
||||||
import engine.Enum.GuildHistoryType;
|
import engine.Enum.GuildHistoryType;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.SessionManager;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
import engine.net.client.msg.guild.LeaveGuildMsg;
|
import engine.net.client.msg.guild.LeaveGuildMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.Guild;
|
||||||
|
import engine.objects.GuildStatusController;
|
||||||
|
import engine.objects.Mine;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
public class LeaveGuildHandler extends AbstractClientMsgHandler {
|
public class LeaveGuildHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
@@ -61,10 +65,7 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler {
|
|||||||
ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");
|
ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");
|
||||||
|
|
||||||
oldGuild.removePlayer(playerCharacter, GuildHistoryType.LEAVE);
|
oldGuild.removePlayer(playerCharacter, GuildHistoryType.LEAVE);
|
||||||
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
|
|
||||||
if(GroupManager.getGroup(playerCharacter) != null)
|
|
||||||
GroupManager.getGroup(playerCharacter).removeGroupMember(playerCharacter);
|
|
||||||
}
|
|
||||||
// Send message back to client
|
// Send message back to client
|
||||||
msg.setMessage("You have left the guild.");
|
msg.setMessage("You have left the guild.");
|
||||||
dispatch = Dispatch.borrow(playerCharacter, msg);
|
dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
||||||
|
|
||||||
if (!zone.guild_zone) {
|
if (!zone.isPlayerCity()) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.GetCityFromCache(zone.playerCityUUID);
|
City city = City.GetCityFromCache(zone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
||||||
@@ -171,7 +171,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (warehouse == null)
|
if (warehouse == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Warehouse.isEmpty(warehouse)) {
|
if (warehouse.isEmpty()) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
|
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (baneZone == null)
|
if (baneZone == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
City banedCity = City.getCity(baneZone.playerCityUUID);
|
City banedCity = City.getCity(baneZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (banedCity == null)
|
if (banedCity == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -437,13 +437,13 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
Warehouse.warehouseWithdraw(msg, player, npc);
|
Warehouse.warehouseWithdraw(msg, player, npc, origin);
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
Warehouse.warehouseDeposit(msg, player, npc);
|
Warehouse.warehouseDeposit(msg, player, npc, origin);
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
Warehouse.warehouseLock(msg, player, npc);
|
Warehouse.warehouseLock(msg, player, npc, origin);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import engine.gameManager.BuildingManager;
|
|||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.NPCManager;
|
import engine.gameManager.NPCManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
@@ -15,6 +16,9 @@ import engine.net.client.msg.*;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author:
|
* @Author:
|
||||||
* @Summary: Processes application protocol message which
|
* @Summary: Processes application protocol message which
|
||||||
@@ -23,6 +27,8 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
|
public static HashMap<Integer, ArrayList<Integer>> _minionsByCaptain = null;
|
||||||
|
|
||||||
public MinionTrainingMsgHandler() {
|
public MinionTrainingMsgHandler() {
|
||||||
super(MinionTrainingMessage.class);
|
super(MinionTrainingMessage.class);
|
||||||
}
|
}
|
||||||
@@ -32,9 +38,9 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (playerCharacter == null)
|
if (player == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
||||||
@@ -44,24 +50,23 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc == null)
|
if (npc == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Building building = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
Building b = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
||||||
|
|
||||||
if (building == null)
|
if (b == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//clear minion
|
//clear minion
|
||||||
|
|
||||||
if (npc.minionLock.writeLock().tryLock()) {
|
if (npc.minionLock.writeLock().tryLock()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (minionMsg.getType() == 2) {
|
if (minionMsg.getType() == 2) {
|
||||||
|
|
||||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||||
|
|
||||||
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
npc.getSiegeMinionMap().remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -69,35 +74,33 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(toRemove);
|
||||||
|
PlayerCharacter petOwner = toRemove.getOwner();
|
||||||
|
|
||||||
if(toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
if (petOwner != null) {
|
||||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
petOwner.setPet(null);
|
||||||
|
toRemove.setOwner(null);
|
||||||
if (petOwner != null) {
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
petOwner.setPet(null);
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
toRemove.guardCaptain = null;
|
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
|
||||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
// we Found the move to remove, lets break the for loop so it doesnt look for more.
|
||||||
|
|
||||||
|
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, b);
|
||||||
mca1.actionType = 3;
|
mca1.actionType = 3;
|
||||||
mca1.setTargetType(building.getObjectType().ordinal());
|
mca1.setTargetType(b.getObjectType().ordinal());
|
||||||
mca1.setTargetID(building.getObjectUUID());
|
mca1.setTargetID(b.getObjectUUID());
|
||||||
|
|
||||||
mca1.setTargetType3(npc.getObjectType().ordinal());
|
mca1.setTargetType3(npc.getObjectType().ordinal());
|
||||||
mca1.setTargetID3(npc.getObjectUUID());
|
mca1.setTargetID3(npc.getObjectUUID());
|
||||||
mca1.setAssetName1(building.getName());
|
mca1.setAssetName1(b.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -112,7 +115,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc.getContractID() == 842)
|
if (npc.getContractID() == 842)
|
||||||
maxSlots = 1;
|
maxSlots = 1;
|
||||||
|
|
||||||
if (npc.minions.size() == maxSlots)
|
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase;
|
int mobBase;
|
||||||
@@ -143,15 +146,47 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (mobBase == 0)
|
if (mobBase == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase);
|
Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
|
||||||
|
|
||||||
if (siegeMob == null)
|
if (siegeMob == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (siegeMob != null) {
|
||||||
|
|
||||||
|
siegeMob.setSpawnTime(60 * 15);
|
||||||
|
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
|
||||||
|
|
||||||
|
siegeMob.building = building;
|
||||||
|
siegeMob.parentZone = zone;
|
||||||
|
|
||||||
|
// Slot siege minion
|
||||||
|
// Can be either corner tower or bulwark.
|
||||||
|
|
||||||
|
int slot;
|
||||||
|
|
||||||
|
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER))
|
||||||
|
slot = 2;
|
||||||
|
else
|
||||||
|
slot = ((NPC) siegeMob.npcOwner).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain
|
||||||
|
|
||||||
|
BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
|
||||||
|
siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation());
|
||||||
|
|
||||||
|
// Rotate slot position by the building rotation
|
||||||
|
|
||||||
|
siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY);
|
||||||
|
|
||||||
|
siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc);
|
||||||
|
siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc);
|
||||||
|
|
||||||
|
zone.zoneMobSet.add(siegeMob);
|
||||||
|
siegeMob.setLoc(siegeMob.bindLoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
mnm.setMessageType(1);
|
mnm.setMessageType(1);
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
@@ -179,13 +214,13 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||||
|
|
||||||
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.MobQueries.REMOVE_GUARD_MINION(npc.getObjectUUID(), toRemove.firstName))
|
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.getMobBaseID(), npc.getSiegeMinionMap().get(toRemove)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
npc.getSiegeMinionMap().remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -193,22 +228,17 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(toRemove);
|
||||||
|
PlayerCharacter petOwner = toRemove.getOwner();
|
||||||
|
|
||||||
if (toRemove.agentType.equals(Enum.AIAgentType.SIEGEENGINE)) {
|
if (petOwner != null) {
|
||||||
|
petOwner.setPet(null);
|
||||||
PlayerCharacter trebOwner = (PlayerCharacter) toRemove.guardCaptain;
|
toRemove.setOwner(null);
|
||||||
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
if (trebOwner != null) {
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
trebOwner.setPet(null);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
toRemove.guardCaptain = null;
|
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
|
||||||
Dispatch dispatch = Dispatch.borrow(trebOwner, petMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, building);
|
||||||
mca1.actionType = 3;
|
mca1.actionType = 3;
|
||||||
mca1.setTargetType(building.getObjectType().ordinal());
|
mca1.setTargetType(building.getObjectType().ordinal());
|
||||||
mca1.setTargetID(building.getObjectUUID());
|
mca1.setTargetID(building.getObjectUUID());
|
||||||
@@ -218,11 +248,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
mca1.setAssetName1(building.getName());
|
mca1.setAssetName1(building.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -258,7 +288,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npc.minions.size() == maxSlots)
|
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase = npc.getMobBaseID();
|
int mobBase = npc.getMobBaseID();
|
||||||
@@ -268,12 +298,12 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
String pirateName = NPCManager.getPirateName(mobBase);
|
String pirateName = NPCManager.getPirateName(mobBase);
|
||||||
|
|
||||||
Mob toCreate = Mob.createGuardMinion(npc, npc.getLevel(), pirateName);
|
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||||
|
|
||||||
if (toCreate == null)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.MobQueries.ADD_GUARD_MINION(npc.getObjectUUID(), pirateName))
|
Mob toCreate = Mob.createGuardMob(npc, npc.getGuild(), zone, building.getLoc(), npc.getLevel(), pirateName);
|
||||||
|
|
||||||
|
if (toCreate == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (toCreate != null) {
|
if (toCreate != null) {
|
||||||
@@ -284,7 +314,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
mnm.setMessageType(1);
|
mnm.setMessageType(1);
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -9,14 +9,12 @@
|
|||||||
|
|
||||||
package engine.net.client.handlers;
|
package engine.net.client.handlers;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.MovementManager;
|
import engine.gameManager.MovementManager;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
import engine.net.client.msg.MoveToPointMsg;
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
public class MoveToPointHandler extends AbstractClientMsgHandler {
|
public class MoveToPointHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
@@ -28,11 +26,13 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
|
|||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg,
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg,
|
||||||
ClientConnection origin) throws MsgSendException {
|
ClientConnection origin) throws MsgSendException {
|
||||||
MoveToPointMsg msg = (MoveToPointMsg) baseMsg;
|
MoveToPointMsg msg = (MoveToPointMsg) baseMsg;
|
||||||
PlayerCharacter pc = origin.getPlayerCharacter();
|
|
||||||
if(pc == null)
|
PlayerCharacter pc = (origin != null) ? (origin.getPlayerCharacter()) : null;
|
||||||
return true;
|
if (pc == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
MovementManager.movement(msg, pc);
|
MovementManager.movement(msg, pc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,27 +98,27 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(7));
|
resourceValue = warehouse.getResources().get(Warehouse.goldIB);
|
||||||
|
|
||||||
if (resourceValue < 5000000)
|
if (resourceValue < 5000000)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
|
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||||
|
|
||||||
if (resourceValue < 8000)
|
if (resourceValue < 8000)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
|
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||||
|
|
||||||
if (resourceValue < 8000)
|
if (resourceValue < 8000)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
|
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||||
|
|
||||||
if (resourceValue < 15)
|
if (resourceValue < 15)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
|
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||||
|
|
||||||
if (resourceValue < 15)
|
if (resourceValue < 15)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
@@ -130,51 +130,51 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Remove resources from warehouse before claiming realm
|
// Remove resources from warehouse before claiming realm
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(7));
|
resourceValue = warehouse.getResources().get(Warehouse.goldIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - 5000000) == true) {
|
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - 5000000) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(7), resourceValue - 5000000);
|
warehouse.getResources().put(Warehouse.goldIB, resourceValue - 5000000);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, 5000000);
|
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, 5000000);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
|
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 8000) == true) {
|
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 8000) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(1580000), resourceValue - 8000);
|
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 8000);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 8000);
|
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 8000);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
|
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 8000) == true) {
|
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 8000) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(1580004), resourceValue - 8000);
|
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 8000);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 8000);
|
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 8000);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
|
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 15) == true) {
|
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 15) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(1580017), resourceValue - 15);
|
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 15);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 15);
|
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 15);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
|
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||||
|
|
||||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 15) == true) {
|
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 15) == true) {
|
||||||
warehouse.resources.put(ItemBase.getItemBase(1580018), resourceValue - 15);
|
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 15);
|
||||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 15);
|
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 15);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
return false;
|
return false;
|
||||||
@@ -182,7 +182,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
realm.claimRealmForCity(city, charterUUID);
|
realm.claimRealmForCity(city, charterUUID);
|
||||||
|
|
||||||
BuildingManager.setRank(tol, 8);
|
tol.setRank(8);
|
||||||
WorldGrid.updateObject(tol);
|
WorldGrid.updateObject(tol);
|
||||||
|
|
||||||
for (Building building : city.getParent().zoneBuildingSet) {
|
for (Building building : city.getParent().zoneBuildingSet) {
|
||||||
@@ -334,7 +334,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
||||||
|
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
if (zone.guild_zone) {
|
if (zone.isPlayerCity()) {
|
||||||
loc = zone.getLoc();
|
loc = zone.getLoc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class OpenFriendsCondemnListMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (removeCondemn == null)
|
if (removeCondemn == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.BuildingQueries.REMOVE_FROM_CONDEMNED_LIST(removeCondemn.buildingUUID, removeCondemn.playerUID, removeCondemn.guildUID, removeCondemn.friendType))
|
if (!DbManager.BuildingQueries.REMOVE_FROM_CONDEMNED_LIST(removeCondemn.getParent(), removeCondemn.getPlayerUID(), removeCondemn.getGuildUID(), removeCondemn.getFriendType()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
sourceBuilding.getCondemned().remove(msg.getRemoveFriendID());
|
sourceBuilding.getCondemned().remove(msg.getRemoveFriendID());
|
||||||
@@ -175,7 +175,7 @@ public class OpenFriendsCondemnListMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
condemn.setActive(msg.isReverseKOS());
|
condemn.setActive(msg.isReverseKOS());
|
||||||
openFriendsCondemnListMsg.setReverseKOS(condemn.active);
|
openFriendsCondemnListMsg.setReverseKOS(condemn.isActive());
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
break;
|
break;
|
||||||
@@ -354,7 +354,7 @@ public class OpenFriendsCondemnListMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (friend == null)
|
if (friend == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.BuildingQueries.REMOVE_FROM_FRIENDS_LIST(sourceBuilding.getObjectUUID(), friend.playerUID, friend.guildUID, friend.friendType)) {
|
if (!DbManager.BuildingQueries.REMOVE_FROM_FRIENDS_LIST(sourceBuilding.getObjectUUID(), friend.getPlayerUID(), friend.getGuildUID(), friend.getFriendType())) {
|
||||||
Logger.debug("Failed to remove Friend: " + msg.getRemoveFriendID() + " from Building With UID " + sourceBuilding.getObjectUUID());
|
Logger.debug("Failed to remove Friend: " + msg.getRemoveFriendID() + " from Building With UID " + sourceBuilding.getObjectUUID());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import engine.Enum.ProfitType;
|
|||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.NPCManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.math.FastMath;
|
import engine.math.FastMath;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -36,7 +37,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
super(OrderNPCMsg.class);
|
super(OrderNPCMsg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processRedeedHireling(AbstractCharacter hireling, Building building, ClientConnection origin) {
|
public static void processRedeedMob(Mob mob, Building building, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter player;
|
PlayerCharacter player;
|
||||||
Contract contract;
|
Contract contract;
|
||||||
@@ -47,28 +48,33 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
player = SessionManager.getPlayerCharacter(origin);
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
itemMan = player.getCharItemManager();
|
itemMan = player.getCharItemManager();
|
||||||
|
|
||||||
contract = hireling.contract;
|
contract = mob.getContract();
|
||||||
|
|
||||||
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
|
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!building.getHirelings().containsKey(hireling))
|
if (!building.getHirelings().containsKey(mob))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BuildingManager.removeHireling(building, hireling);
|
if (!NPCManager.removeMobileFromBuilding(mob, building)) {
|
||||||
|
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
building.getHirelings().remove(mob);
|
||||||
|
|
||||||
itemBase = ItemBase.getItemBase(contract.getContractID());
|
itemBase = ItemBase.getItemBase(contract.getContractID());
|
||||||
|
|
||||||
if (itemBase == null) {
|
if (itemBase == null) {
|
||||||
Logger.error("Could not find Contract for npc: " + hireling.getObjectUUID());
|
Logger.error("Could not find Contract for npc: " + mob.getObjectUUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean itemWorked = false;
|
boolean itemWorked = false;
|
||||||
|
|
||||||
item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) hireling.getRank() - 1), (byte) ((byte) hireling.getRank() - 1), (short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0, new ArrayList<>(), "");
|
item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) mob.getRank() - 1), (byte) ((byte) mob.getRank() - 1), (short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0, new ArrayList<>(), "");
|
||||||
item.setNumOfItems(1);
|
item.setNumOfItems(1);
|
||||||
item.containerType = Enum.ItemContainerType.INVENTORY;
|
item.containerType = Enum.ItemContainerType.INVENTORY;
|
||||||
|
|
||||||
@@ -206,6 +212,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (AbstractCharacter guard : building.getHirelings().keySet()) {
|
||||||
|
if (guard.getObjectType() == GameObjectType.Mob)
|
||||||
|
((Mob) guard).setPatrolPointIndex(0);
|
||||||
|
}
|
||||||
} else if (building.getPatrolPoints() != null)
|
} else if (building.getPatrolPoints() != null)
|
||||||
ClearPatrolPoints(building.getObjectUUID());
|
ClearPatrolPoints(building.getObjectUUID());
|
||||||
|
|
||||||
@@ -213,6 +223,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
||||||
} else if (building.getSentryPoints() != null)
|
} else if (building.getSentryPoints() != null)
|
||||||
ClearSentryPoints(building.getObjectUUID());
|
ClearSentryPoints(building.getObjectUUID());
|
||||||
|
|
||||||
|
// Dispatch dispatch = Dispatch.borrow(pc, msg);
|
||||||
|
// DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
||||||
@@ -276,6 +290,28 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static synchronized void processRedeedNPC(AbstractCharacter abstractCharacter, Building building, ClientConnection origin) {
|
||||||
|
|
||||||
|
// Member variable declaration
|
||||||
|
|
||||||
|
switch (abstractCharacter.getObjectType()) {
|
||||||
|
case NPC:
|
||||||
|
NPC npc = (NPC) abstractCharacter;
|
||||||
|
|
||||||
|
Building cityBuilding = npc.getBuilding();
|
||||||
|
|
||||||
|
if (cityBuilding == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BuildingManager.processRedeedNPC(npc, npc.building, origin);
|
||||||
|
break;
|
||||||
|
case Mob:
|
||||||
|
Mob mob = (Mob) abstractCharacter;
|
||||||
|
processRedeedMob(mob, mob.building, origin);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean AddPatrolPoints(int buildingID, ArrayList<Vector3fImmutable> patrolPoints) {
|
private static boolean AddPatrolPoints(int buildingID, ArrayList<Vector3fImmutable> patrolPoints) {
|
||||||
|
|
||||||
Building building = BuildingManager.getBuildingFromCache(buildingID);
|
Building building = BuildingManager.getBuildingFromCache(buildingID);
|
||||||
@@ -288,7 +324,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (zone.playerCityUUID == 0)
|
if (zone.getPlayerCityUUID() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
City city = building.getCity();
|
City city = building.getCity();
|
||||||
@@ -466,7 +502,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
processRedeedHireling(npc, building, origin);
|
processRedeedNPC(npc, building, origin);
|
||||||
return true;
|
return true;
|
||||||
//MB TODO HANDLE all profits.
|
//MB TODO HANDLE all profits.
|
||||||
case 7:
|
case 7:
|
||||||
@@ -505,7 +541,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
||||||
|
|
||||||
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
|
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
|
||||||
|
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
return true;
|
return true;
|
||||||
@@ -534,7 +570,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (building.getHirelings().containsKey(mob) == false)
|
if (building.getHirelings().containsKey(mob) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
BuildingManager.removeHireling(building, mob);
|
if (NPCManager.removeMobileFromBuilding(mob, building) == false) {
|
||||||
|
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg manageCityAssetsMsg = new ManageCityAssetsMsg();
|
ManageCityAssetsMsg manageCityAssetsMsg = new ManageCityAssetsMsg();
|
||||||
manageCityAssetsMsg.actionType = SVR_CLOSE_WINDOW;
|
manageCityAssetsMsg.actionType = SVR_CLOSE_WINDOW;
|
||||||
@@ -569,7 +608,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
if (BuildingManager.PlayerCanControlNotOwner(building, player) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
processRedeedHireling(mob, building, origin);
|
processRedeedNPC(mob, building, origin);
|
||||||
return true;
|
return true;
|
||||||
//MB TODO HANDLE all profits.
|
//MB TODO HANDLE all profits.
|
||||||
case 7:
|
case 7:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package engine.net.client.handlers;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
|
import engine.InterestManagement.HeightMap;
|
||||||
import engine.InterestManagement.InterestManager;
|
import engine.InterestManagement.InterestManager;
|
||||||
import engine.InterestManagement.RealmMap;
|
import engine.InterestManagement.RealmMap;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
@@ -111,7 +112,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Cannot place a tree underwater
|
// Cannot place a tree underwater
|
||||||
|
|
||||||
if (ZoneManager.isLocUnderwater(placementInfo.getLoc())) {
|
if (HeightMap.isLocUnderwater(placementInfo.getLoc())) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater
|
PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -137,7 +138,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
private static boolean validateBuildingPlacement(Zone serverZone, PlaceAssetMsg msg, ClientConnection origin, PlayerCharacter player, PlacementInfo placementInfo) {
|
private static boolean validateBuildingPlacement(Zone serverZone, PlaceAssetMsg msg, ClientConnection origin, PlayerCharacter player, PlacementInfo placementInfo) {
|
||||||
|
|
||||||
if (serverZone.guild_zone == false) {
|
if (serverZone.isPlayerCity() == false) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 52, player.getName());
|
PlaceAssetMsg.sendPlaceAssetError(origin, 52, player.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -156,7 +157,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Retrieve the building details we're placing
|
// Retrieve the building details we're placing
|
||||||
|
|
||||||
if (serverZone.isNPCCity == true) {
|
if (serverZone.isNPCCity() == true) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 15, ""); // Cannot place in a peace zone
|
PlaceAssetMsg.sendPlaceAssetError(origin, 15, ""); // Cannot place in a peace zone
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -177,7 +178,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Cannot place a building underwater
|
// Cannot place a building underwater
|
||||||
|
|
||||||
if (ZoneManager.isLocUnderwater(placementInfo.getLoc())) {
|
if (HeightMap.isLocUnderwater(placementInfo.getLoc())) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater
|
PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -185,7 +186,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
// Players cannot place buildings in mob zones.
|
// Players cannot place buildings in mob zones.
|
||||||
|
|
||||||
if ((serverZone.isMacroZone() == true)
|
if ((serverZone.isMacroZone() == true)
|
||||||
|| (serverZone.parent.isMacroZone() == true)) {
|
|| (serverZone.getParent().isMacroZone() == true)) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 57, player.getName()); // No building may be placed within this territory
|
PlaceAssetMsg.sendPlaceAssetError(origin, 57, player.getName()); // No building may be placed within this territory
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -201,8 +202,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Cannot place assets on a dead tree
|
// Cannot place assets on a dead tree
|
||||||
|
|
||||||
if ((serverZone.guild_zone)
|
if ((serverZone.isPlayerCity())
|
||||||
&& (City.getCity(serverZone.playerCityUUID).getTOL().getRank() == -1)) {
|
&& (City.getCity(serverZone.getPlayerCityUUID()).getTOL().getRank() == -1)) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot place asset on dead tree until world heals");
|
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot place asset on dead tree until world heals");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -261,14 +262,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Must be a player city
|
// Must be a player city
|
||||||
|
|
||||||
if (serverZone.guild_zone == false) {
|
if (serverZone.isPlayerCity() == false) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 41, player.getName()); // Cannot place outside a guild zone
|
PlaceAssetMsg.sendPlaceAssetError(origin, 41, player.getName()); // Cannot place outside a guild zone
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Test zone has a city object
|
//Test zone has a city object
|
||||||
|
|
||||||
City city = City.getCity(serverZone.playerCityUUID);
|
City city = City.getCity(serverZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 52, ""); //"no city to associate asset with"
|
PlaceAssetMsg.sendPlaceAssetError(origin, 52, ""); //"no city to associate asset with"
|
||||||
@@ -512,7 +513,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
cityObject = City.getCity(serverZone.playerCityUUID);
|
cityObject = City.getCity(serverZone.getPlayerCityUUID());
|
||||||
|
|
||||||
// Early exit if something went horribly wrong
|
// Early exit if something went horribly wrong
|
||||||
|
|
||||||
@@ -571,7 +572,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// No valid player city found
|
// No valid player city found
|
||||||
|
|
||||||
if (serverCity == null || serverCity.getParent().guild_zone == false) {
|
if (serverCity == null || serverCity.getParent().isPlayerCity() == false) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 52, ""); // Cannot place outisde a guild zone
|
PlaceAssetMsg.sendPlaceAssetError(origin, 52, ""); // Cannot place outisde a guild zone
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -660,7 +661,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (!building.getBlueprint().isSiegeEquip())
|
if (!building.getBlueprint().isSiegeEquip())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!building.getLoc().isInsideCircle(serverCity.getLoc(), CityBoundsType.ZONE.halfExtents))
|
if (!building.getLoc().isInsideCircle(serverCity.getLoc(), CityBoundsType.ZONE.extents))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (building.getGuild() == null)
|
if (building.getGuild() == null)
|
||||||
@@ -744,16 +745,15 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector3fImmutable plantLoc = new Vector3fImmutable(treeInfo.getLoc().x,
|
Vector3fImmutable plantLoc = new Vector3fImmutable(treeInfo.getLoc().x,
|
||||||
0,
|
HeightMap.getWorldHeight(treeInfo.getLoc()),
|
||||||
treeInfo.getLoc().z);
|
treeInfo.getLoc().z);
|
||||||
|
|
||||||
cityObjects = DbManager.CityQueries.CREATE_CITY(playerCharacter.getObjectUUID(), serverZone.getObjectUUID(),
|
cityObjects = DbManager.CityQueries.CREATE_CITY(playerCharacter.getObjectUUID(), serverZone.getObjectUUID(),
|
||||||
serverRealm.getRealmID(),
|
serverRealm.getRealmID(),
|
||||||
plantLoc.x - serverZone.absX, plantLoc.y,
|
plantLoc.x - serverZone.getAbsX(), plantLoc.y,
|
||||||
plantLoc.z - serverZone.absZ, treeInfo.getRot().y, treeInfo.getW(), playerCharacter.getGuild().getName(), LocalDateTime.now());
|
plantLoc.z - serverZone.getAbsZ(), treeInfo.getRot().y, treeInfo.getW(), playerCharacter.getGuild().getName(), LocalDateTime.now());
|
||||||
|
|
||||||
// Uh oh!
|
// Uh oh!
|
||||||
|
|
||||||
if (cityObjects == null || cityObjects.isEmpty()) {
|
if (cityObjects == null || cityObjects.isEmpty()) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
return false;
|
return false;
|
||||||
@@ -766,6 +766,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
cityObjectMap.put(gameObject.getObjectType(), gameObject);
|
cityObjectMap.put(gameObject.getObjectType(), gameObject);
|
||||||
|
|
||||||
treeObject = (Building) cityObjectMap.get(GameObjectType.Building);
|
treeObject = (Building) cityObjectMap.get(GameObjectType.Building);
|
||||||
|
treeObject.runAfterLoad();
|
||||||
|
;
|
||||||
cityObject = (City) cityObjectMap.get(GameObjectType.City);
|
cityObject = (City) cityObjectMap.get(GameObjectType.City);
|
||||||
zoneObject = (Zone) cityObjectMap.get(GameObjectType.Zone);
|
zoneObject = (Zone) cityObjectMap.get(GameObjectType.Zone);
|
||||||
|
|
||||||
@@ -778,30 +780,44 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
playerNation = playerCharacter.getGuild();
|
playerNation = playerCharacter.getGuild();
|
||||||
playerNation.setGuildState(GuildState.Sovereign);
|
playerNation.setGuildState(GuildState.Sovereign);
|
||||||
|
|
||||||
|
// Link the zone with the city and then add
|
||||||
|
// to the appropriate hash tables and cache
|
||||||
|
|
||||||
|
zoneObject.setPlayerCity(true);
|
||||||
|
|
||||||
|
if (zoneObject.getParent() != null)
|
||||||
|
zoneObject.getParent().addNode(zoneObject); //add as child to parent
|
||||||
|
|
||||||
|
ZoneManager.addZone(zoneObject.getObjectUUID(), zoneObject);
|
||||||
|
ZoneManager.addPlayerCityZone(zoneObject);
|
||||||
|
serverZone.addNode(zoneObject);
|
||||||
|
|
||||||
|
zoneObject.generateWorldAltitude();
|
||||||
|
|
||||||
|
cityObject.setParent(zoneObject);
|
||||||
|
cityObject.setObjectTypeMask(MBServerStatics.MASK_CITY); // *** Refactor : should have it already
|
||||||
|
//Link the tree of life with the new zone
|
||||||
|
|
||||||
|
treeObject.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||||
|
treeObject.setParentZone(zoneObject);
|
||||||
|
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(7));
|
||||||
|
|
||||||
// Update guild binds and tags
|
// 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.ZONE.extents, Enum.CityBoundsType.ZONE.extents);
|
||||||
|
DispatchMessage.dispatchMsgToAll(czm);
|
||||||
|
|
||||||
GuildManager.updateAllGuildBinds(playerNation, cityObject);
|
GuildManager.updateAllGuildBinds(playerNation, cityObject);
|
||||||
GuildManager.updateAllGuildTags(playerNation);
|
GuildManager.updateAllGuildTags(playerNation);
|
||||||
|
|
||||||
//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.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents);
|
|
||||||
DispatchMessage.dispatchMsgToAll(czm);
|
|
||||||
|
|
||||||
// Set maintenance date
|
|
||||||
|
|
||||||
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(7));
|
|
||||||
|
|
||||||
// Send all the cities to the clients?
|
// Send all the cities to the clients?
|
||||||
// *** Refactor : figure out how to send like, one?
|
// *** Refactor : figure out how to send like, one?
|
||||||
|
|
||||||
City.lastCityUpdate = System.currentTimeMillis();
|
City.lastCityUpdate = System.currentTimeMillis();
|
||||||
treeObject.setLoc(treeObject.getLoc());
|
treeObject.setLoc(treeObject.getLoc());
|
||||||
|
|
||||||
// As this is a new static object set it's dirtyFlag
|
|
||||||
// so players already near it will have the object loaded.
|
|
||||||
|
|
||||||
InterestManager.setObjectDirty(treeObject);
|
InterestManager.setObjectDirty(treeObject);
|
||||||
|
// WorldGrid.addObject(treeObject, playerCharacter);
|
||||||
|
|
||||||
serverRealm.addCity(cityObject.getObjectUUID());
|
serverRealm.addCity(cityObject.getObjectUUID());
|
||||||
playerNation.setCityUUID(cityObject.getObjectUUID());
|
playerNation.setCityUUID(cityObject.getObjectUUID());
|
||||||
@@ -841,7 +857,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
cityObject = City.getCity(serverZone.playerCityUUID);
|
cityObject = City.getCity(serverZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (cityObject == null)
|
if (cityObject == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -899,7 +915,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Early exit if something went horribly wrong
|
// Early exit if something went horribly wrong
|
||||||
// with locating the current realm and/or zone
|
// with locating the current realm and/or zone
|
||||||
|
|
||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -915,7 +930,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
int shrineCount = 0;
|
int shrineCount = 0;
|
||||||
|
|
||||||
cityObject = City.getCity(serverZone.playerCityUUID);
|
cityObject = City.getCity(serverZone.getPlayerCityUUID());
|
||||||
|
|
||||||
// Cannot place shrine in abandoned city. Shrines must be owned
|
// Cannot place shrine in abandoned city. Shrines must be owned
|
||||||
// by the tol owner not the person placing them.
|
// by the tol owner not the person placing them.
|
||||||
@@ -962,8 +977,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
City cityObject;
|
City cityObject;
|
||||||
PlacementInfo buildingList;
|
PlacementInfo buildingList;
|
||||||
|
|
||||||
// Setup working variables
|
// Setup working variables we'll need
|
||||||
|
|
||||||
buildingList = msg.getFirstPlacementInfo();
|
buildingList = msg.getFirstPlacementInfo();
|
||||||
|
|
||||||
serverZone = ZoneManager.findSmallestZone(buildingList.getLoc());
|
serverZone = ZoneManager.findSmallestZone(buildingList.getLoc());
|
||||||
@@ -985,7 +999,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
int barracksCount = 0;
|
int barracksCount = 0;
|
||||||
|
|
||||||
cityObject = City.getCity(serverZone.playerCityUUID);
|
cityObject = City.getCity(serverZone.getPlayerCityUUID());
|
||||||
|
|
||||||
// Cannot place barracks in abandoned city.
|
// Cannot place barracks in abandoned city.
|
||||||
|
|
||||||
@@ -1045,7 +1059,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (validateCityBuildingPlacement(serverZone, msg, origin, player, msg.getFirstPlacementInfo()) == false)
|
if (validateCityBuildingPlacement(serverZone, msg, origin, player, msg.getFirstPlacementInfo()) == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
cityObject = City.getCity(serverZone.playerCityUUID);
|
cityObject = City.getCity(serverZone.getPlayerCityUUID());
|
||||||
|
|
||||||
// We need to be able to access how much gold a character is carrying
|
// We need to be able to access how much gold a character is carrying
|
||||||
|
|
||||||
@@ -1076,6 +1090,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
placementCost = 0; // reset placement cost for fix bug with wall pieces somethings not taking gold out if forced an error.
|
placementCost = 0; // reset placement cost for fix bug with wall pieces somethings not taking gold out if forced an error.
|
||||||
|
|
||||||
|
|
||||||
// Overlap check and wall deed verifications
|
// Overlap check and wall deed verifications
|
||||||
for (PlacementInfo wall : walls) {
|
for (PlacementInfo wall : walls) {
|
||||||
|
|
||||||
@@ -1094,6 +1109,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
for (Building building : serverZone.zoneBuildingSet) {
|
for (Building building : serverZone.zoneBuildingSet) {
|
||||||
|
|
||||||
|
|
||||||
//TODO Clean up collision with placementInfo. don't need to create the same placementinfo bounds for collision checks on each building.
|
//TODO Clean up collision with placementInfo. don't need to create the same placementinfo bounds for collision checks on each building.
|
||||||
if ((building.getBlueprintUUID() != 0) && (Bounds.collide(wall, building) == true)) {
|
if ((building.getBlueprintUUID() != 0) && (Bounds.collide(wall, building) == true)) {
|
||||||
|
|
||||||
@@ -1101,7 +1117,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
building.removeFromCache();
|
building.removeFromCache();
|
||||||
WorldGrid.RemoveWorldObject(building);
|
WorldGrid.RemoveWorldObject(building);
|
||||||
WorldGrid.removeObject(building);
|
WorldGrid.removeObject(building);
|
||||||
building.getParentZone().parent.zoneBuildingSet.remove(building);
|
building.getParentZone().getParent().zoneBuildingSet.remove(building);
|
||||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BARRACK)) {
|
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BARRACK)) {
|
||||||
building.RemoveFromBarracksList();
|
building.RemoveFromBarracksList();
|
||||||
}
|
}
|
||||||
@@ -1113,14 +1129,12 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
placementCost = PlaceAssetMsg.getWallCost(wall.getBlueprintUUID());
|
placementCost = PlaceAssetMsg.getWallCost(wall.getBlueprintUUID());
|
||||||
|
|
||||||
if (!itemMan.modifyInventoryGold(-placementCost)) {
|
if (!itemMan.modifyInventoryGold(-placementCost)) {
|
||||||
ChatManager.chatSystemInfo(player, player.getFirstName() + " can't has free moneys! no for real.. Thor.. seriously... I didnt fix it because you getting laid isnt important enough for me.");
|
ChatManager.chatSystemInfo(player, player.getFirstName() + " can't has free moneys! no for real.. Thor.. seriously... I didnt fix it because you getting laid isnt important enough for me.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to place wall piece
|
// Attempt to place wall piece
|
||||||
|
|
||||||
wallPiece = createStructure(player, wall, serverZone);
|
wallPiece = createStructure(player, wall, serverZone);
|
||||||
@@ -1131,12 +1145,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// walls are auto protected
|
// walls are auto protected
|
||||||
|
|
||||||
wallPiece.setProtectionState(ProtectionState.PROTECTED);
|
wallPiece.setProtectionState(ProtectionState.PROTECTED);
|
||||||
PlaceAssetMsg.sendPlaceAssetConfirmWall(origin, serverZone);
|
PlaceAssetMsg.sendPlaceAssetConfirmWall(origin, serverZone);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deduct gold from character's inventory
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1156,7 +1172,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All siege buildings build in 15 minutes
|
// All siege buildings build in 15 minutes
|
||||||
|
|
||||||
if ((blueprint.getBuildingGroup().equals(BuildingGroup.SIEGETENT))
|
if ((blueprint.getBuildingGroup().equals(BuildingGroup.SIEGETENT))
|
||||||
|| (blueprint.getBuildingGroup().equals(BuildingGroup.BULWARK)))
|
|| (blueprint.getBuildingGroup().equals(BuildingGroup.BULWARK)))
|
||||||
completionDate = DateTime.now().plusMinutes(15);
|
completionDate = DateTime.now().plusMinutes(15);
|
||||||
@@ -1176,7 +1191,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
completionDate, blueprint.getMeshForRank(0), vendorRotation, buildingRotation);
|
completionDate, blueprint.getMeshForRank(0), vendorRotation, buildingRotation);
|
||||||
|
|
||||||
// Make sure we have a valid mesh
|
// Make sure we have a valid mesh
|
||||||
|
|
||||||
if (newMesh == null) {
|
if (newMesh == null) {
|
||||||
Logger.error("CreateStructure: DB returned null object.");
|
Logger.error("CreateStructure: DB returned null object.");
|
||||||
return null;
|
return null;
|
||||||
@@ -1213,7 +1227,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
shrineType = Shrine.getShrineTypeByBlueprintUUID(blueprint.getBlueprintUUID());
|
shrineType = Shrine.getShrineTypeByBlueprintUUID(blueprint.getBlueprintUUID());
|
||||||
|
|
||||||
city = City.getCity(currentZone.playerCityUUID);
|
city = City.getCity(currentZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -1278,7 +1292,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
city = City.getCity(currentZone.playerCityUUID);
|
city = City.getCity(currentZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -1348,16 +1362,15 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
newMesh = (Building) ago;
|
newMesh = (Building) ago;
|
||||||
newMesh.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
newMesh.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||||
MaintenanceManager.setMaintDateTime(newMesh, LocalDateTime.now().plusDays(7));
|
MaintenanceManager.setMaintDateTime(newMesh, LocalDateTime.now().plusDays(7));
|
||||||
|
// WorldGrid.addObject(newMesh, player);
|
||||||
newMesh.setLoc(newMesh.getLoc());
|
newMesh.setLoc(newMesh.getLoc());
|
||||||
InterestManager.setObjectDirty(newMesh);
|
InterestManager.setObjectDirty(newMesh);
|
||||||
newMesh.runAfterLoad();
|
newMesh.runAfterLoad();
|
||||||
} else if (ago.getObjectType() == GameObjectType.Warehouse) {
|
} else if (ago.getObjectType() == GameObjectType.Warehouse) {
|
||||||
Warehouse warehouse = (Warehouse) ago;
|
Warehouse warehouse = (Warehouse) ago;
|
||||||
City city = City.getCity(currentZone.playerCityUUID);
|
City city = City.getCity(currentZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
city.setWarehouseBuildingID(newMesh.getObjectUUID());
|
city.setWarehouseBuildingID(newMesh.getObjectUUID());
|
||||||
Warehouse.warehouseByBuildingUUID.put(newMesh.getObjectUUID(), warehouse);
|
Warehouse.warehouseByBuildingUUID.put(newMesh.getObjectUUID(), warehouse);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ public class RepairBuildingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
serverZone = ZoneManager.findSmallestZone(pc.getLoc());
|
serverZone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
|
|
||||||
if (serverZone.playerCityUUID == 0 && targetBuilding.getBlueprint() != null && targetBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.MINE)
|
if (serverZone.getPlayerCityUUID() == 0 && targetBuilding.getBlueprint() != null && targetBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.MINE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
City city = City.GetCityFromCache(serverZone.playerCityUUID);
|
City city = City.GetCityFromCache(serverZone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (city != null) {
|
if (city != null) {
|
||||||
if (city.getBane() != null && city.protectionEnforced == false)
|
if (city.getBane() != null && city.protectionEnforced == false)
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ public class RequestEnterWorldHandler extends AbstractClientMsgHandler {
|
|||||||
player.stopMovement(player.getBindLoc());
|
player.stopMovement(player.getBindLoc());
|
||||||
player.setSafeMode();
|
player.setSafeMode();
|
||||||
player.updateLocation();
|
player.updateLocation();
|
||||||
|
player.setRegion(AbstractWorldObject.GetRegionByWorldObject(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setTimeStamp("logout", 0);
|
player.setTimeStamp("logout", 0);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class TaxCityMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
ViewResourcesMessage vrm = new ViewResourcesMessage(player);
|
ViewResourcesMessage vrm = new ViewResourcesMessage(player);
|
||||||
vrm.setGuild(building.getGuild());
|
vrm.setGuild(building.getGuild());
|
||||||
vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().buildingUID));
|
vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().getBuildingUID()));
|
||||||
vrm.configure();
|
vrm.configure();
|
||||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
|
|||||||
@@ -61,13 +61,13 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
public void configure() {
|
public void configure() {
|
||||||
|
|
||||||
warehouseBuilding = BuildingManager.getBuilding(this.warehouse.buildingUID);
|
warehouseBuilding = BuildingManager.getBuilding(this.warehouse.getBuildingUID());
|
||||||
transactions = new ArrayList<>(50);
|
transactions = new ArrayList<>(50);
|
||||||
|
|
||||||
if (this.warehouse.transactions.size() > 150) {
|
if (this.warehouse.getTransactions().size() > 150) {
|
||||||
transactions.addAll(this.warehouse.transactions.subList(this.warehouse.transactions.size() - 150, this.warehouse.transactions.size()));
|
transactions.addAll(this.warehouse.getTransactions().subList(this.warehouse.getTransactions().size() - 150, this.warehouse.getTransactions().size()));
|
||||||
} else
|
} else
|
||||||
transactions = this.warehouse.transactions;
|
transactions = this.warehouse.getTransactions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
|
|||||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||||
|
|
||||||
writer.putInt(this.transactionID);
|
writer.putInt(this.transactionID);
|
||||||
writer.putInt(this.warehouse.buildingUID);
|
writer.putInt(this.warehouse.getBuildingUID());
|
||||||
writer.putInt(transactions.size()); //list Size
|
writer.putInt(transactions.size()); //list Size
|
||||||
|
|
||||||
for (Transaction transaction : transactions) {
|
for (Transaction transaction : transactions) {
|
||||||
@@ -124,7 +124,7 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
|
|||||||
writer.putInt(transaction.getTargetUUID()); //ID
|
writer.putInt(transaction.getTargetUUID()); //ID
|
||||||
writer.putString(name); //Name of depositer/withdrawler or mine name
|
writer.putString(name); //Name of depositer/withdrawler or mine name
|
||||||
writer.putInt(GameObjectType.Building.ordinal()); //Type
|
writer.putInt(GameObjectType.Building.ordinal()); //Type
|
||||||
writer.putInt(warehouse.buildingUID); //ID
|
writer.putInt(warehouse.getBuildingUID()); //ID
|
||||||
writer.putString(warehouseBuilding.getName()); //warehouse
|
writer.putString(warehouseBuilding.getName()); //warehouse
|
||||||
writer.putInt(transaction.getTransactionType().getID()); //79,80 withdrew, 81 mine produced, 82 deposit
|
writer.putInt(transaction.getTransactionType().getID()); //79,80 withdrew, 81 mine produced, 82 deposit
|
||||||
writer.putInt(transaction.getAmount()); //amount
|
writer.putInt(transaction.getAmount()); //amount
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class CityAssetMsg extends ClientNetMsg {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
city = City.getCity(zone.playerCityUUID);
|
city = City.getCity(zone.getPlayerCityUUID());
|
||||||
|
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
Logger.debug("Failed to load city data for Tree of life.");
|
Logger.debug("Failed to load city data for Tree of life.");
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ public class GuildTreeStatusMsg extends ClientNetMsg {
|
|||||||
city = null;
|
city = null;
|
||||||
|
|
||||||
if (cityZone != null)
|
if (cityZone != null)
|
||||||
if (cityZone.guild_zone)
|
if (cityZone.isPlayerCity())
|
||||||
city = City.GetCityFromCache(cityZone.playerCityUUID);
|
city = City.GetCityFromCache(cityZone.getPlayerCityUUID());
|
||||||
else if (this.treeOfLife != null && this.treeOfLife.getGuild() != null)
|
else if (this.treeOfLife != null && this.treeOfLife.getGuild() != null)
|
||||||
city = this.treeOfLife.getGuild().getOwnedCity();
|
city = this.treeOfLife.getGuild().getOwnedCity();
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user