Stronghold variations
This commit is contained in:
@@ -490,7 +490,7 @@ public enum LootManager {
|
|||||||
|
|
||||||
//roll 1-100 for the gen table selection
|
//roll 1-100 for the gen table selection
|
||||||
|
|
||||||
int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
int genRoll = ThreadLocalRandom.current().nextInt(94, 100) + 1;
|
||||||
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
|
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
|
||||||
|
|
||||||
if(selectedRow == null)
|
if(selectedRow == null)
|
||||||
@@ -654,14 +654,18 @@ public enum LootManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void DropPresent(Mob mob){
|
public static void DropPresent(Mob mob){
|
||||||
int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size() - 1);
|
int random = 971049 + ThreadLocalRandom.current().nextInt(24);
|
||||||
int presentID = ItemBase.AnniverseryGifts.get(random);
|
if (random > 971071)
|
||||||
ItemBase presentBase = ItemBase.getItemBase(presentID);
|
random = 971071;
|
||||||
if(presentBase != null){
|
|
||||||
MobLoot lootItem = new MobLoot(mob, presentBase, true);
|
|
||||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int baseLoot = rollRandomItem(random);
|
||||||
|
ItemBase contract = ItemBase.getItemBase(baseLoot);
|
||||||
|
if (contract != null) {
|
||||||
|
MobLoot toAdd = new MobLoot(mob, contract, true);
|
||||||
|
|
||||||
|
if (toAdd != null)
|
||||||
|
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateStrongholdLoot(Mob mob, boolean commander) {
|
public static void GenerateStrongholdLoot(Mob mob, boolean commander) {
|
||||||
@@ -680,20 +684,13 @@ public enum LootManager {
|
|||||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||||
mob.getCharItemManager().addItemToInventory(goldAmount);
|
mob.getCharItemManager().addItemToInventory(goldAmount);
|
||||||
}
|
}
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 65)
|
||||||
|
DropPresent(mob);
|
||||||
|
|
||||||
int random = 3211 + ThreadLocalRandom.current().nextInt(6);
|
if (commander) {
|
||||||
if(random > 3216)
|
|
||||||
random = 3216;
|
|
||||||
|
|
||||||
int baseLoot = rollRandomItem(random);
|
//chance for glass
|
||||||
ItemBase contract = ItemBase.getItemBase(baseLoot);
|
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
||||||
if (contract != null) {
|
|
||||||
MobLoot toAdd = new MobLoot(mob, contract, true);
|
|
||||||
|
|
||||||
if (toAdd != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
|
||||||
|
|
||||||
if (commander) {
|
|
||||||
int glassID = rollRandomItem(126);
|
int glassID = rollRandomItem(126);
|
||||||
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
||||||
if (glassItem != null) {
|
if (glassItem != null) {
|
||||||
@@ -702,16 +699,22 @@ public enum LootManager {
|
|||||||
if (toAdd2 != null)
|
if (toAdd2 != null)
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd2);
|
mob.getCharItemManager().addItemToInventory(toAdd2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//chance for disc
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
||||||
int discID = rollRandomItem(3202);
|
int discID = rollRandomItem(3202);
|
||||||
ItemBase discItem = ItemBase.getItemBase(discID);
|
ItemBase discItem = ItemBase.getItemBase(discID);
|
||||||
if (glassItem != null) {
|
if (discItem != null) {
|
||||||
MobLoot toAdd3 = new MobLoot(mob, discItem, true);
|
MobLoot toAdd3 = new MobLoot(mob, discItem, true);
|
||||||
|
|
||||||
if (toAdd3 != null)
|
if (toAdd3 != null)
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd3);
|
mob.getCharItemManager().addItemToInventory(toAdd3);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//chance for stat rune
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
||||||
int runeID = rollRandomItem(3201);
|
int runeID = rollRandomItem(3201);
|
||||||
ItemBase runeItem = ItemBase.getItemBase(runeID);
|
ItemBase runeItem = ItemBase.getItemBase(runeID);
|
||||||
if (runeItem != null) {
|
if (runeItem != null) {
|
||||||
@@ -721,7 +724,6 @@ public enum LootManager {
|
|||||||
mob.getCharItemManager().addItemToInventory(toAdd4);
|
mob.getCharItemManager().addItemToInventory(toAdd4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,256 @@
|
|||||||
|
package engine.gameManager;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.InterestManagement.InterestManager;
|
||||||
|
import engine.InterestManagement.WorldGrid;
|
||||||
|
import engine.math.Vector3f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
public class StrongholdManager {
|
||||||
|
|
||||||
|
public static void processStrongholds() {
|
||||||
|
//end all current stronghold activities
|
||||||
|
ArrayList<Mine> mines = Mine.getMines();
|
||||||
|
for(Mine mine : mines){
|
||||||
|
if (mine.isStronghold)
|
||||||
|
StrongholdManager.EndStronghold(mine);
|
||||||
|
}
|
||||||
|
|
||||||
|
//process strongholds selecting 2 randomly to become active
|
||||||
|
int count = 0;
|
||||||
|
while (count < 2) {
|
||||||
|
int random = ThreadLocalRandom.current().nextInt(1, mines.size()) - 1;
|
||||||
|
Mine mine = mines.get(random);
|
||||||
|
if (mine != null) {
|
||||||
|
if (!mine.isActive && !mine.isStronghold) {
|
||||||
|
StartStronghold(mine);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void StartStronghold(Mine mine){
|
||||||
|
|
||||||
|
//remove buildings
|
||||||
|
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
||||||
|
if(tower == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mine.isStronghold = true;
|
||||||
|
mine.strongholdMobs = new ArrayList<>();
|
||||||
|
mine.oldBuildings = new HashMap<>();
|
||||||
|
|
||||||
|
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
||||||
|
for(Building building : mineZone.zoneBuildingSet){
|
||||||
|
mine.oldBuildings.put(building.getObjectUUID(),building.meshUUID);
|
||||||
|
building.setMeshUUID(407650);
|
||||||
|
building.setMeshScale(new Vector3f(0,0,0));
|
||||||
|
InterestManager.setObjectDirty(building);
|
||||||
|
WorldGrid.updateObject(building);
|
||||||
|
}
|
||||||
|
|
||||||
|
//update tower to become stronghold mesh
|
||||||
|
tower.setMeshUUID(getStrongholdMeshID(mine.getParentZone()));
|
||||||
|
tower.setMeshScale(new Vector3f(1,1,1));
|
||||||
|
InterestManager.setObjectDirty(tower);
|
||||||
|
WorldGrid.updateObject(tower);
|
||||||
|
|
||||||
|
//create elite mobs
|
||||||
|
for(int i = 0; i < 10; i++){
|
||||||
|
Mob guard = Mob.createMob(getStrongholdGuardianID(mine.getParentZone()), Vector3fImmutable.getRandomPointOnCircle(tower.loc,30), Guild.getErrantGuild(),true,mineZone,null,0, "Elite Guardian",65);
|
||||||
|
if(guard != null){
|
||||||
|
guard.equipmentSetID = getStrongholdMobEquipSetID(guard.getMobBaseID());
|
||||||
|
guard.runAfterLoad();
|
||||||
|
guard.setLevel((short)65);
|
||||||
|
guard.setResists(new Resists("Elite"));
|
||||||
|
guard.healthMax = 12500;
|
||||||
|
guard.setHealth(guard.healthMax);
|
||||||
|
guard.spawnTime = 1000000000;
|
||||||
|
guard.BehaviourType = Enum.MobBehaviourType.Aggro;
|
||||||
|
guard.maxDamageHandOne = 1550;
|
||||||
|
guard.minDamageHandOne = 750;
|
||||||
|
guard.atrHandOne = 1800;
|
||||||
|
guard.defenseRating = 2200;
|
||||||
|
InterestManager.setObjectDirty(guard);
|
||||||
|
mine.strongholdMobs.add(guard);
|
||||||
|
LootManager.GenerateStrongholdLoot(guard,false);
|
||||||
|
}
|
||||||
|
if(guard!= null && guard.level < 60)
|
||||||
|
guard.despawn();
|
||||||
|
}
|
||||||
|
//create stronghold commander
|
||||||
|
Mob commander = Mob.createMob(getStrongholdCommanderID(mine.getParentZone()), tower.loc,Guild.getErrantGuild(),true,mineZone,null,0, "Guardian Commander",75);
|
||||||
|
if(commander != null){
|
||||||
|
commander.equipmentSetID = getStrongholdMobEquipSetID(commander.getMobBaseID());
|
||||||
|
commander.runAfterLoad();
|
||||||
|
commander.setLevel((short)75);
|
||||||
|
commander.setResists(new Resists("Elite"));
|
||||||
|
commander.healthMax = 50000;
|
||||||
|
commander.setHealth(commander.healthMax);
|
||||||
|
commander.spawnTime = 1000000000;
|
||||||
|
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
|
||||||
|
commander.maxDamageHandOne = 3500;
|
||||||
|
commander.minDamageHandOne = 1500;
|
||||||
|
commander.atrHandOne = 3500;
|
||||||
|
commander.defenseRating = 3500;
|
||||||
|
commander.mobPowers.clear();
|
||||||
|
commander.mobPowers.put(563107033,40); //grounding shot
|
||||||
|
commander.mobPowers.put(429032838,40); // gravechill
|
||||||
|
commander.mobPowers.put(429413547,40); // grasp of thurin
|
||||||
|
commander.StrongholdCommander = true;
|
||||||
|
InterestManager.setObjectDirty(commander);
|
||||||
|
mine.strongholdMobs.add(commander);
|
||||||
|
LootManager.GenerateStrongholdLoot(commander,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
mine.setActive(true);
|
||||||
|
tower.setProtectionState(Enum.ProtectionState.PROTECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void EndStronghold(Mine mine){
|
||||||
|
|
||||||
|
//restore the buildings
|
||||||
|
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
||||||
|
if(tower == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mine.isStronghold = false;
|
||||||
|
|
||||||
|
//get rid of the mobs
|
||||||
|
for(Mob mob : mine.strongholdMobs) {
|
||||||
|
mob.despawn();
|
||||||
|
mob.removeFromCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
//restore the buildings
|
||||||
|
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
||||||
|
for(Building building : mineZone.zoneBuildingSet){
|
||||||
|
if(mine.oldBuildings.containsKey(building.getObjectUUID())) {
|
||||||
|
building.setMeshUUID(mine.oldBuildings.get(building.getObjectUUID()));
|
||||||
|
building.setMeshScale(new Vector3f(1, 1, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//update tower to become Mine Tower again
|
||||||
|
tower.setMeshUUID(1500100);
|
||||||
|
|
||||||
|
mine.setActive(false);
|
||||||
|
tower.setProtectionState(Enum.ProtectionState.NPC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStrongholdMeshID(Zone parent){
|
||||||
|
while(!parent.isMacroZone()){
|
||||||
|
parent = parent.getParent();
|
||||||
|
if(parent.getName().toLowerCase().equals("seafloor")){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch(parent.getObjectUUID()){
|
||||||
|
case 197:
|
||||||
|
case 234:
|
||||||
|
case 178:
|
||||||
|
case 122:
|
||||||
|
return 814000; //Frost Giant Hall (ICE)
|
||||||
|
case 968:
|
||||||
|
case 951:
|
||||||
|
case 313:
|
||||||
|
case 331:
|
||||||
|
return 5001500; // Lich Queens Keep (UNDEAD)
|
||||||
|
case 785:
|
||||||
|
case 761:
|
||||||
|
case 717:
|
||||||
|
case 737:
|
||||||
|
return 1306600; // Temple of the Dragon (DESERT)
|
||||||
|
case 353:
|
||||||
|
case 371:
|
||||||
|
case 388:
|
||||||
|
case 532:
|
||||||
|
return 564600; // Undead Lord's Keep (SWAMP)
|
||||||
|
}
|
||||||
|
return 456100; // small stockade
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStrongholdGuardianID(Zone parent){
|
||||||
|
switch(parent.getObjectUUID()){
|
||||||
|
case 197:
|
||||||
|
case 234:
|
||||||
|
case 178:
|
||||||
|
case 122:
|
||||||
|
return 13528; // Mountain Giant Raider Axe
|
||||||
|
case 968:
|
||||||
|
case 951:
|
||||||
|
case 313:
|
||||||
|
case 331:
|
||||||
|
return 13643; // Vampire Spear Warrior
|
||||||
|
case 785:
|
||||||
|
case 761:
|
||||||
|
case 717:
|
||||||
|
case 737:
|
||||||
|
return 13802; // Desert Orc Warrior
|
||||||
|
case 353:
|
||||||
|
case 371:
|
||||||
|
case 388:
|
||||||
|
case 532:
|
||||||
|
return 12728; // Kolthoss Warrior
|
||||||
|
}
|
||||||
|
return 13434; // human sword and board warrior
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStrongholdCommanderID(Zone parent){
|
||||||
|
switch(parent.getObjectUUID()){
|
||||||
|
case 197: // Storm Giant Crossbow
|
||||||
|
case 234: // Storm Giant Crossbow
|
||||||
|
case 178: // Storm Giant Crossbow
|
||||||
|
case 122: // Storm Giant Crossbow
|
||||||
|
return 13515;
|
||||||
|
case 968: // Skeleton Bird Archer
|
||||||
|
case 951: // Skeleton Bird Archer
|
||||||
|
case 313: // Skeleton Bird Archer
|
||||||
|
case 331: // Skeleton Bird Archer
|
||||||
|
return 14280;
|
||||||
|
case 785:
|
||||||
|
case 761:
|
||||||
|
case 717:
|
||||||
|
case 737:
|
||||||
|
return 13789; // Desert Orc Xbow
|
||||||
|
case 353:
|
||||||
|
case 371:
|
||||||
|
case 388:
|
||||||
|
case 532:
|
||||||
|
return 12724; // xbow kolthoss
|
||||||
|
}
|
||||||
|
return 13433;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStrongholdMobEquipSetID(int mobbaseUUID){
|
||||||
|
switch(mobbaseUUID){
|
||||||
|
case 14280:
|
||||||
|
return 10790;
|
||||||
|
case 13643:
|
||||||
|
return 6317;
|
||||||
|
case 13515:
|
||||||
|
return 7820;
|
||||||
|
case 13528:
|
||||||
|
return 5966;
|
||||||
|
case 13802:
|
||||||
|
return 9043;
|
||||||
|
case 13789:
|
||||||
|
return 9035;
|
||||||
|
case 12728:
|
||||||
|
return 6826;
|
||||||
|
case 12724:
|
||||||
|
return 9471;
|
||||||
|
case 13434:
|
||||||
|
return 6327;
|
||||||
|
case 13433:
|
||||||
|
return 6900;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -400,7 +400,7 @@ public class MobAI {
|
|||||||
|
|
||||||
PerformActionMsg msg;
|
PerformActionMsg msg;
|
||||||
|
|
||||||
if (!mobPower.isHarmful() || mobPower.targetSelf) {
|
if (!mob.StrongholdCommander && (!mobPower.isHarmful() || mobPower.targetSelf)) {
|
||||||
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
||||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -91,17 +91,17 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
protected Resists resists = new Resists("Genric");
|
protected Resists resists = new Resists("Genric");
|
||||||
protected ConcurrentHashMap<String, JobContainer> timers;
|
protected ConcurrentHashMap<String, JobContainer> timers;
|
||||||
protected ConcurrentHashMap<String, Long> timestamps;
|
protected ConcurrentHashMap<String, Long> timestamps;
|
||||||
protected int atrHandOne;
|
public int atrHandOne;
|
||||||
protected int atrHandTwo;
|
protected int atrHandTwo;
|
||||||
protected int minDamageHandOne;
|
public int minDamageHandOne;
|
||||||
protected int maxDamageHandOne;
|
public int maxDamageHandOne;
|
||||||
protected int minDamageHandTwo;
|
protected int minDamageHandTwo;
|
||||||
protected int maxDamageHandTwo;
|
protected int maxDamageHandTwo;
|
||||||
protected float rangeHandOne;
|
protected float rangeHandOne;
|
||||||
protected float rangeHandTwo;
|
protected float rangeHandTwo;
|
||||||
protected float speedHandOne;
|
protected float speedHandOne;
|
||||||
protected float speedHandTwo;
|
protected float speedHandTwo;
|
||||||
protected int defenseRating;
|
public int defenseRating;
|
||||||
protected boolean isActive; // <-Do not use this for deleting character!
|
protected boolean isActive; // <-Do not use this for deleting character!
|
||||||
protected float altitude = 0; // 0=on terrain, 1=tier 1, 2=tier 2, etc.
|
protected float altitude = 0; // 0=on terrain, 1=tier 1, 2=tier 2, etc.
|
||||||
protected ConcurrentHashMap<Integer, JobContainer> recycleTimers;
|
protected ConcurrentHashMap<Integer, JobContainer> recycleTimers;
|
||||||
|
|||||||
@@ -658,106 +658,4 @@ public class Mine extends AbstractGameObject {
|
|||||||
|
|
||||||
_playerMemory.removeAll(toRemove);
|
_playerMemory.removeAll(toRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartStronghold(){
|
|
||||||
|
|
||||||
//remove buildings
|
|
||||||
Building tower = BuildingManager.getBuilding(this.buildingID);
|
|
||||||
if(tower == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this.isStronghold = true;
|
|
||||||
this.strongholdMobs = new ArrayList<>();
|
|
||||||
this.oldBuildings = new HashMap<>();
|
|
||||||
|
|
||||||
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
|
||||||
for(Building building : mineZone.zoneBuildingSet){
|
|
||||||
oldBuildings.put(building.getObjectUUID(),building.meshUUID);
|
|
||||||
building.setMeshUUID(407650);
|
|
||||||
building.setMeshScale(new Vector3f(0,0,0));
|
|
||||||
InterestManager.setObjectDirty(building);
|
|
||||||
WorldGrid.updateObject(building);
|
|
||||||
}
|
|
||||||
|
|
||||||
//update tower to become stronghold mesh
|
|
||||||
tower.setMeshUUID(423600);
|
|
||||||
tower.setMeshScale(new Vector3f(1,1,1));
|
|
||||||
InterestManager.setObjectDirty(tower);
|
|
||||||
WorldGrid.updateObject(tower);
|
|
||||||
|
|
||||||
//create elite mobs
|
|
||||||
for(int i = 0; i < 10; i++){
|
|
||||||
Mob guard = Mob.createMob(14315, Vector3fImmutable.getRandomPointOnCircle(tower.loc,30),Guild.getErrantGuild(),true,mineZone,null,0, "Elite Guardian",65);
|
|
||||||
if(guard != null){
|
|
||||||
guard.setLevel((short)65);
|
|
||||||
guard.setResists(new Resists("Elite"));
|
|
||||||
guard.healthMax *= 2;
|
|
||||||
guard.setHealth(guard.healthMax);
|
|
||||||
guard.spawnTime = 1000000000;
|
|
||||||
guard.BehaviourType = Enum.MobBehaviourType.Aggro;
|
|
||||||
guard.maxDamageHandOne *= 2;
|
|
||||||
guard.minDamageHandOne *= 2;
|
|
||||||
guard.atrHandOne *= 2;
|
|
||||||
guard.defenseRating *= 2;
|
|
||||||
InterestManager.setObjectDirty(guard);
|
|
||||||
this.strongholdMobs.add(guard);
|
|
||||||
LootManager.GenerateStrongholdLoot(guard,false);
|
|
||||||
}
|
|
||||||
if(guard!= null && guard.level < 60)
|
|
||||||
guard.despawn();
|
|
||||||
}
|
|
||||||
//create stronghold commander
|
|
||||||
Mob commander = Mob.createMob(14293, tower.loc,Guild.getErrantGuild(),true,mineZone,null,0, "Guardian Commander",75);
|
|
||||||
if(commander != null){
|
|
||||||
commander.setLevel((short)75);
|
|
||||||
commander.setResists(new Resists("Elite"));
|
|
||||||
commander.healthMax = 50000;
|
|
||||||
commander.setHealth(commander.healthMax);
|
|
||||||
commander.spawnTime = 1000000000;
|
|
||||||
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
|
|
||||||
commander.maxDamageHandOne = 1500;
|
|
||||||
commander.minDamageHandOne = 3500;
|
|
||||||
commander.atrHandOne = 3500;
|
|
||||||
commander.defenseRating = 3500;
|
|
||||||
commander.mobPowers.put(429413547,40);
|
|
||||||
commander.mobPowers.put(429032838,40);
|
|
||||||
commander.mobPowers.put(57584498,40);
|
|
||||||
InterestManager.setObjectDirty(commander);
|
|
||||||
this.strongholdMobs.add(commander);
|
|
||||||
LootManager.GenerateStrongholdLoot(commander,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setActive(true);
|
|
||||||
tower.setProtectionState(Enum.ProtectionState.PROTECTED);
|
|
||||||
}
|
|
||||||
public void EndStronghold(){
|
|
||||||
|
|
||||||
//restore the buildings
|
|
||||||
Building tower = BuildingManager.getBuilding(this.buildingID);
|
|
||||||
if(tower == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this.isStronghold = false;
|
|
||||||
|
|
||||||
//get rid of the mobs
|
|
||||||
for(Mob mob : this.strongholdMobs) {
|
|
||||||
mob.despawn();
|
|
||||||
mob.removeFromCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
//restore the buildings
|
|
||||||
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
|
||||||
for(Building building : mineZone.zoneBuildingSet){
|
|
||||||
if(this.oldBuildings.containsKey(building.getObjectUUID())) {
|
|
||||||
building.setMeshUUID(this.oldBuildings.get(building.getObjectUUID()));
|
|
||||||
building.setMeshScale(new Vector3f(1, 1, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//update tower to become Mine Tower again
|
|
||||||
tower.setMeshUUID(1500100);
|
|
||||||
|
|
||||||
this.setActive(false);
|
|
||||||
tower.setProtectionState(Enum.ProtectionState.NPC);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
private DeferredPowerJob weaponPower;
|
private DeferredPowerJob weaponPower;
|
||||||
private DateTime upgradeDateTime = null;
|
private DateTime upgradeDateTime = null;
|
||||||
private boolean lootSync = false;
|
private boolean lootSync = false;
|
||||||
|
public boolean StrongholdCommander = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
import static engine.gameManager.StrongholdManager.EndStronghold;
|
||||||
import static engine.server.MBServerStatics.MINE_LATE_WINDOW;
|
import static engine.server.MBServerStatics.MINE_LATE_WINDOW;
|
||||||
|
|
||||||
public class HalfHourlyJobThread implements Runnable {
|
public class HalfHourlyJobThread implements Runnable {
|
||||||
@@ -43,12 +44,8 @@ public class HalfHourlyJobThread implements Runnable {
|
|||||||
|
|
||||||
for (Mine mine : mines) {
|
for (Mine mine : mines) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(mine.isStronghold)
|
|
||||||
mine.EndStronghold();
|
|
||||||
|
|
||||||
//handle mines opening on server reboot weird time interval
|
//handle mines opening on server reboot weird time interval
|
||||||
if(LocalDateTime.now().isAfter(LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute))) {
|
if (LocalDateTime.now().isAfter(LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute))) {
|
||||||
if (LocalDateTime.now().isBefore(LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute).plusMinutes(30))) {
|
if (LocalDateTime.now().isBefore(LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute).plusMinutes(30))) {
|
||||||
HalfHourlyJobThread.mineWindowOpen(mine);
|
HalfHourlyJobThread.mineWindowOpen(mine);
|
||||||
continue;
|
continue;
|
||||||
@@ -64,7 +61,7 @@ public class HalfHourlyJobThread implements Runnable {
|
|||||||
|
|
||||||
// Close the mine if it reaches this far
|
// Close the mine if it reaches this far
|
||||||
LocalDateTime openTime = LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute);
|
LocalDateTime openTime = LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute);
|
||||||
if(LocalDateTime.now().plusMinutes(1).isAfter(openTime.plusMinutes(30)))
|
if (LocalDateTime.now().plusMinutes(1).isAfter(openTime.plusMinutes(30)))
|
||||||
mineWindowClose(mine);
|
mineWindowClose(mine);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -72,19 +69,7 @@ public class HalfHourlyJobThread implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//process stronghold
|
StrongholdManager.processStrongholds();
|
||||||
int count = 0;
|
|
||||||
while(count < 2){
|
|
||||||
int random = ThreadLocalRandom.current().nextInt(1,mines.size()) - 1;
|
|
||||||
Mine mine = mines.get(random);
|
|
||||||
if(mine != null){
|
|
||||||
if(!mine.isActive){
|
|
||||||
mine.StartStronghold();
|
|
||||||
count ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.toString());
|
Logger.error(e.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user