forked from MagicBane/Server
				
			
				 1 changed files with 114 additions and 0 deletions
			
			
		| @ -1,7 +1,121 @@@@ -1,7 +1,121 @@ | ||||
| package engine.gameManager; | ||||
| 
 | ||||
| import engine.objects.Mob; | ||||
| import engine.objects.Resists; | ||||
| import engine.objects.Zone; | ||||
| import engine.server.MBServerStatics; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| 
 | ||||
| public class HellgateManager { | ||||
|     public static ArrayList<Mob> hellgate_mobs; | ||||
|     public static ArrayList<Mob> hellgate_mini_bosses; | ||||
|     public static Mob hellgate_boss; | ||||
| 
 | ||||
|     public static Long hellgate_time_completed = 0L; | ||||
|     public static final int citadel_ruins_zone_id = 993; | ||||
|     public static final int hell_portal_1_zone_id = 994; | ||||
|     public static final int hell_portal_2_zone_id = 996; | ||||
|     public static final int hell_portal_3_zone_id = 997; | ||||
|     public static final int hell_portal_4_zone_id = 998; | ||||
| 
 | ||||
|     public static boolean initialized = false; | ||||
|     public static void confiureHellgate(){ | ||||
|         compile_mob_list(); | ||||
|     } | ||||
|     public static void pulseHellgates(){ | ||||
|         if(!initialized){ | ||||
|             confiureHellgate(); | ||||
|             initialized = true; | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         if(hellgate_mobs == null) { | ||||
|             return; | ||||
|         } | ||||
|         if(hellgate_mini_bosses == null) { | ||||
|             return; | ||||
|         } | ||||
|         if(hellgate_boss == null){ | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         if(!hellgate_boss.isAlive() && hellgate_time_completed == 0L) | ||||
|             hellgate_time_completed = System.currentTimeMillis(); | ||||
| 
 | ||||
|         if(hellgate_time_completed != 0L && System.currentTimeMillis() > hellgate_time_completed + MBServerStatics.THIRTY_MINUTES){ | ||||
|             ResetHellgate(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void compile_mob_list(){ | ||||
|         if(hellgate_mobs == null) { | ||||
|             hellgate_mobs =new ArrayList<>(); | ||||
|         } | ||||
|         if(hellgate_mini_bosses == null) { | ||||
|             hellgate_mini_bosses =new ArrayList<>(); | ||||
|         } | ||||
|         Zone hellgate_zone = ZoneManager.getZoneByZoneID(citadel_ruins_zone_id); | ||||
|         if(hellgate_zone == null) | ||||
|             return; | ||||
| 
 | ||||
|         for(Mob mob : hellgate_zone.zoneMobSet){ | ||||
|             switch(mob.getMobBaseID()){ | ||||
|                 case 14163: // basic saetor warrior
 | ||||
|                     mob.getCharItemManager().clearInventory(); | ||||
|                     LootManager.GenerateStrongholdLoot(mob,false,false); | ||||
|                     mob.setResists(new Resists("Elite")); | ||||
|                     mob.healthMax = 8500; | ||||
|                     mob.setHealth(mob.healthMax); | ||||
|                     hellgate_mobs.add(mob); | ||||
|                     break; | ||||
|                 case 12770: // minotaur mini boss
 | ||||
|                     mob.getCharItemManager().clearInventory(); | ||||
|                     LootManager.GenerateStrongholdLoot(mob,true,false); | ||||
|                     mob.setResists(new Resists("Elite")); | ||||
|                     mob.healthMax = 12500; | ||||
|                     mob.setHealth(mob.healthMax); | ||||
|                     hellgate_mini_bosses.add(mob); | ||||
|                     break; | ||||
|                 case 14180: // mordoth, son of morlock
 | ||||
|                     mob.getCharItemManager().clearInventory(); | ||||
|                     LootManager.GenerateStrongholdLoot(mob,false,true); | ||||
|                     mob.setResists(new Resists("Elite")); | ||||
|                     mob.healthMax = mob.mobBase.getHealthMax(); | ||||
|                     mob.setHealth(mob.healthMax); | ||||
|                     hellgate_boss = mob; | ||||
|                     break; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void ResetHellgate(){ | ||||
|         hellgate_time_completed = 0L; | ||||
|         for(Mob mob : hellgate_mobs){ | ||||
|             if(!mob.isAlive()){ | ||||
|                 if(!mob.despawned){ | ||||
|                     mob.despawn(); | ||||
|                 } | ||||
|                 mob.respawn(); | ||||
|             } | ||||
|             mob.setHealth(mob.healthMax); | ||||
|         } | ||||
|         for(Mob mob : hellgate_mini_bosses){ | ||||
|             if(!mob.isAlive()){ | ||||
|                 if(!mob.despawned){ | ||||
|                     mob.despawn(); | ||||
|                 } | ||||
|                 mob.respawn(); | ||||
|             } | ||||
|             mob.setHealth(mob.healthMax); | ||||
|         } | ||||
|         if(!hellgate_boss.isAlive()){ | ||||
|             if(!hellgate_boss.despawned){ | ||||
|                 hellgate_boss.despawn(); | ||||
|             } | ||||
|             hellgate_boss.respawn(); | ||||
|         } | ||||
|         hellgate_boss.setHealth(hellgate_boss.healthMax); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
					Loading…
					
					
				
		Reference in new issue