|
|
@ -1,11 +1,10 @@ |
|
|
|
package engine.mobileAI.Threads; |
|
|
|
package engine.mobileAI.Threads; |
|
|
|
|
|
|
|
|
|
|
|
import engine.gameManager.ConfigManager; |
|
|
|
import engine.gameManager.ConfigManager; |
|
|
|
import engine.mobileAI.MobAI; |
|
|
|
|
|
|
|
import engine.gameManager.ZoneManager; |
|
|
|
import engine.gameManager.ZoneManager; |
|
|
|
|
|
|
|
import engine.mobileAI.MobAI; |
|
|
|
import engine.objects.Mob; |
|
|
|
import engine.objects.Mob; |
|
|
|
import engine.objects.Zone; |
|
|
|
import engine.objects.Zone; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
public class MobAIThread implements Runnable{ |
|
|
|
public class MobAIThread implements Runnable{ |
|
|
@ -17,20 +16,22 @@ public class MobAIThread implements Runnable{ |
|
|
|
// Thread constructor
|
|
|
|
// Thread constructor
|
|
|
|
|
|
|
|
|
|
|
|
public MobAIThread() { |
|
|
|
public MobAIThread() { |
|
|
|
Logger.info(" MobAIThread thread has started!"); |
|
|
|
//cache config value for mobile casting delay
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue()); |
|
|
|
|
|
|
|
AI_BASE_AGGRO_RANGE = (int) (60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue())); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
//cache config value for mobile casting delay
|
|
|
|
|
|
|
|
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue()); |
|
|
|
|
|
|
|
AI_BASE_AGGRO_RANGE = (int)(60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue())); |
|
|
|
|
|
|
|
while (true) { |
|
|
|
|
|
|
|
for (Zone zone : ZoneManager.getAllZones()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Mob mob : zone.zoneMobSet) { |
|
|
|
Logger.info(" MobAIThread thread has started!"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (true) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Zone zone : ZoneManager.getAllZones()) |
|
|
|
|
|
|
|
for (Mob mob : zone.zoneMobSet) |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (mob != null) |
|
|
|
if (mob != null) |
|
|
|
MobAI.DetermineAction(mob); |
|
|
|
MobAI.DetermineAction(mob); |
|
|
@ -38,10 +39,10 @@ public class MobAIThread implements Runnable{ |
|
|
|
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e); |
|
|
|
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e); |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void startAIThread() { |
|
|
|
public static void startAIThread() { |
|
|
|
Thread aiThread; |
|
|
|
Thread aiThread; |
|
|
|
aiThread = new Thread(new MobAIThread()); |
|
|
|
aiThread = new Thread(new MobAIThread()); |
|
|
|