2 changed files with 0 additions and 251 deletions
@ -1,203 +1,7 @@
@@ -1,203 +1,7 @@
|
||||
package engine.gameManager; |
||||
|
||||
import engine.Enum; |
||||
import engine.InterestManagement.InterestManager; |
||||
import engine.InterestManagement.WorldGrid; |
||||
import engine.math.Vector3fImmutable; |
||||
import engine.mobileAI.MobAI; |
||||
import engine.net.DispatchMessage; |
||||
import engine.net.client.msg.chat.ChatSystemMsg; |
||||
import engine.objects.Guild; |
||||
import engine.objects.Hellgate; |
||||
import engine.objects.Mob; |
||||
import engine.objects.Resists; |
||||
import engine.server.MBServerStatics; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
public class HellgateManager { |
||||
public static ArrayList<Hellgate> hellgates; |
||||
public static void Reset(Hellgate hellgate){ |
||||
hellgate.completionTime = 0L; |
||||
for(Mob mob : hellgate.mobs){ |
||||
mob.respawn(); |
||||
mob.destination = mob.bindLoc; |
||||
mob.setLoc(mob.bindLoc); |
||||
LootManager.GenerateStrongholdLoot(mob,false,false); |
||||
} |
||||
for(Mob mob : hellgate.mini_bosses){ |
||||
mob.respawn(); |
||||
mob.setLoc(mob.bindLoc); |
||||
LootManager.GenerateStrongholdLoot(mob,true,false); |
||||
} |
||||
hellgate.boss.respawn(); |
||||
hellgate.boss.setLoc(hellgate.boss.bindLoc); |
||||
LootManager.GenerateStrongholdLoot(hellgate.boss,false,true); |
||||
} |
||||
|
||||
public static void Spawn(Hellgate hellgate){ |
||||
int offsetUID = 1; |
||||
//create mobs
|
||||
for(Vector3fImmutable loc : getMobSpawns(hellgate)){ |
||||
Vector3fImmutable realLoc = hellgate.parent.getLoc().add(loc); |
||||
Mob mob = CreateHellgateMiniBoss(); |
||||
if(mob == null) |
||||
continue; |
||||
completeMobSpawn(mob,realLoc); |
||||
LootManager.GenerateStrongholdLoot(mob,true,false); |
||||
hellgate.mini_bosses.add(mob); |
||||
mob.setObjectUUID(Integer.MAX_VALUE - (10000 + offsetUID)); |
||||
DbManager.addToCache(mob); |
||||
offsetUID++; |
||||
for(int i = 0; i < 5; i++){ |
||||
Mob minion = CreateHellgateMob(); |
||||
if(minion == null) |
||||
continue; |
||||
Vector3fImmutable offset = Vector3fImmutable.getRandomPointOnCircle(realLoc,32f); |
||||
completeMobSpawn(minion,offset); |
||||
LootManager.GenerateStrongholdLoot(minion,false,false); |
||||
hellgate.mobs.add(minion); |
||||
minion.setObjectUUID(Integer.MAX_VALUE - (10000 + offsetUID)); |
||||
DbManager.addToCache(minion); |
||||
offsetUID++; |
||||
} |
||||
} |
||||
|
||||
//spawn boss
|
||||
Mob mob = CreateHellgateBoss(); |
||||
if(mob == null) |
||||
return; |
||||
completeMobSpawn(mob,hellgate.parent.getLoc()); |
||||
LootManager.GenerateStrongholdLoot(mob,false,true); |
||||
hellgate.boss = mob; |
||||
mob.setObjectUUID(Integer.MAX_VALUE - (10000 + offsetUID)); |
||||
DbManager.addToCache(mob); |
||||
offsetUID++; |
||||
} |
||||
|
||||
public static void completeMobSpawn(Mob mob, Vector3fImmutable loc){ |
||||
mob.setLoc(loc); |
||||
mob.bindLoc = loc; |
||||
mob.spawnTime = 1000000000; |
||||
mob.setResists(new Resists("Elite")); |
||||
WorldGrid.addObject(mob,loc.x,loc.z); |
||||
InterestManager.setObjectDirty(mob); |
||||
WorldGrid.updateObject(mob); |
||||
mob.runAfterLoad(); |
||||
} |
||||
|
||||
public static Mob CreateHellgateMob(){ |
||||
int soldierID = 14163; |
||||
Mob mob = null; |
||||
mob = createHellgateMob(soldierID,Vector3fImmutable.ZERO,"Hellgate Minion",75); |
||||
mob.equipmentSetID = 7545; |
||||
return mob; |
||||
} |
||||
|
||||
public static Mob CreateHellgateMiniBoss(){ |
||||
int miniBossID = 12761; |
||||
Mob mob = null; |
||||
mob = createHellgateMob(miniBossID,Vector3fImmutable.ZERO,"Hellgate Commander",75); |
||||
mob.equipmentSetID = 7816; |
||||
return mob; |
||||
} |
||||
|
||||
public static Mob CreateHellgateBoss(){ |
||||
int bossID = 2018; |
||||
Mob mob = null; |
||||
mob = createHellgateMob(bossID,Vector3fImmutable.ZERO,"Demonic Lord-Commander",85); |
||||
mob.equipmentSetID = 0; |
||||
return mob; |
||||
} |
||||
|
||||
public static ArrayList<Vector3fImmutable> getMobSpawns(Hellgate hellgate){ |
||||
ArrayList<Vector3fImmutable> offsets = new ArrayList<>(); |
||||
offsets.add(new Vector3fImmutable(128,0,0)); |
||||
offsets.add(new Vector3fImmutable(256,0,0)); |
||||
offsets.add(new Vector3fImmutable(384,0,0)); |
||||
offsets.add(new Vector3fImmutable(512,0,0)); |
||||
offsets.add(new Vector3fImmutable(-128,0,0)); |
||||
offsets.add(new Vector3fImmutable(-256,0,0)); |
||||
offsets.add(new Vector3fImmutable(-384,0,0)); |
||||
offsets.add(new Vector3fImmutable(-512,0,0)); |
||||
offsets.add(new Vector3fImmutable(0, 0, 128)); |
||||
offsets.add(new Vector3fImmutable(0, 0, 256)); |
||||
offsets.add(new Vector3fImmutable(0, 0, 384)); |
||||
offsets.add(new Vector3fImmutable(0, 0, 512)); |
||||
offsets.add(new Vector3fImmutable(0, 0, -128)); |
||||
offsets.add(new Vector3fImmutable(0, 0, -256)); |
||||
offsets.add(new Vector3fImmutable(0, 0, -384)); |
||||
offsets.add(new Vector3fImmutable(0, 0, -512)); |
||||
return offsets; |
||||
} |
||||
|
||||
public static Mob createHellgateMob(int loadID, Vector3fImmutable spawn, String pirateName, int level) { |
||||
|
||||
// Create a new Mob instance
|
||||
Mob mobWithoutID = new Mob(pirateName, "", (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 1, 0, false, false, false, spawn, spawn, Vector3fImmutable.ZERO, (short) 1, (short) 1, (short) 1, Guild.getErrantGuild(), (byte) 0, loadID, true, null, null, 0); |
||||
|
||||
// Check if mobBase is null
|
||||
if (mobWithoutID.mobBase == null) |
||||
return null; |
||||
|
||||
// Set mob level
|
||||
mobWithoutID.level = (short) level; |
||||
mobWithoutID.bindLoc = spawn; |
||||
// Set the parent zone and parentZoneID
|
||||
mobWithoutID.parentZone = ZoneManager.getZoneByUUID(993); |
||||
mobWithoutID.parentZoneID = 993; |
||||
|
||||
// Avoid database actions and directly return the created mobWithoutID
|
||||
mobWithoutID.setObjectTypeMask(MBServerStatics.MASK_MOB | mobWithoutID.getTypeMasks()); |
||||
|
||||
return mobWithoutID; |
||||
} |
||||
|
||||
public static void pulseHellgates(){ |
||||
if(HellgateManager.hellgates == null || HellgateManager.hellgates.isEmpty()){ |
||||
HellgateManager.hellgates = new ArrayList<>(); |
||||
Hellgate hellgate = new Hellgate(993); |
||||
HellgateManager.hellgates.add(hellgate); |
||||
return; |
||||
} |
||||
|
||||
//handle MobAI controller
|
||||
for(Hellgate hellgate : HellgateManager.hellgates){ |
||||
for(Mob mob : hellgate.mobs){ |
||||
//MobAI.DetermineAction(mob);
|
||||
//mob.teleport(mob.bindLoc);
|
||||
} |
||||
for(Mob mob : hellgate.mini_bosses){ |
||||
//MobAI.DetermineAction(mob);
|
||||
//mob.teleport(mob.bindLoc);
|
||||
} |
||||
//MobAI.DetermineAction(hellgate.boss);
|
||||
//hellgate.boss.teleport(hellgate.boss.bindLoc);
|
||||
|
||||
//check if boss has been defeated
|
||||
if(!hellgate.boss.isAlive() && hellgate.completionTime == 0L){ |
||||
hellgate.completionTime = System.currentTimeMillis(); |
||||
for(Mob mob : hellgate.mobs){ |
||||
mob.killCharacter("Hellgate Over"); |
||||
mob.despawn(); |
||||
} |
||||
for(Mob mob : hellgate.mini_bosses){ |
||||
mob.killCharacter("Hellgate Over"); |
||||
mob.despawn(); |
||||
} |
||||
return; |
||||
} |
||||
|
||||
//reset hellgate on 15 minute intervals
|
||||
//if(!hellgate.boss.isAlive() && hellgate.completionTime != 0L && hellgate.completionTime + MBServerStatics.FIFTEEN_MINUTES < System.currentTimeMillis()){
|
||||
if(!hellgate.boss.isAlive() && hellgate.completionTime != 0L && hellgate.completionTime + 5000 < System.currentTimeMillis()){ |
||||
Reset(hellgate); |
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, "Citadel Ruins Hellgate Has Begun!"); |
||||
chatMsg.setMessageType(10); |
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); |
||||
DispatchMessage.dispatchMsgToAll(chatMsg); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,55 +0,0 @@
@@ -1,55 +0,0 @@
|
||||
package engine.objects; |
||||
|
||||
import engine.gameManager.HellgateManager; |
||||
import engine.gameManager.LootManager; |
||||
import engine.gameManager.ZoneManager; |
||||
import engine.math.Vector3fImmutable; |
||||
import org.pmw.tinylog.Logger; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
public class Hellgate { |
||||
public Zone parent; |
||||
public ArrayList<Vector3fImmutable> entrances; |
||||
public ArrayList<Mob> mobs; |
||||
public ArrayList<Mob> mini_bosses; |
||||
public Mob boss; |
||||
|
||||
public Long completionTime; |
||||
|
||||
public Hellgate(Integer zoneID){ |
||||
Zone parentZone = ZoneManager.getZoneByUUID(zoneID); |
||||
if(parentZone == null){ |
||||
Logger.error("Failed To Spawn Hellgate"); |
||||
return; |
||||
} |
||||
this.parent = parentZone; |
||||
this.entrances = new ArrayList<>(); |
||||
Zone entrance1 = ZoneManager.getZoneByUUID(994); |
||||
Zone entrance2 = ZoneManager.getZoneByUUID(996); |
||||
Zone entrance3 = ZoneManager.getZoneByUUID(997); |
||||
Zone entrance4 = ZoneManager.getZoneByUUID(998); |
||||
//entrances.add(ZoneManager.getZoneByUUID(994).getLoc());
|
||||
//entrances.add(ZoneManager.getZoneByUUID(996).getLoc());
|
||||
//entrances.add(ZoneManager.getZoneByUUID(997).getLoc());
|
||||
//entrances.add(ZoneManager.getZoneByUUID(998).getLoc());
|
||||
this.mobs = new ArrayList<>(); |
||||
this.mini_bosses = new ArrayList<>(); |
||||
this.completionTime = 0L; |
||||
this.init(); |
||||
} |
||||
|
||||
public void init(){ |
||||
HellgateManager.Spawn(this); |
||||
for(Mob mob : this.mobs){ |
||||
mob.respawn(); |
||||
LootManager.GenerateStrongholdLoot(mob,false,false); |
||||
} |
||||
for(Mob mob : this.mini_bosses){ |
||||
mob.respawn(); |
||||
LootManager.GenerateStrongholdLoot(mob,true,false); |
||||
} |
||||
LootManager.GenerateStrongholdLoot(this.boss,false,true); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue