forked from MagicBane/Server
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6572f0c805 | |||
| 496b49b349 | |||
| ffac5bf369 | |||
| 15313b3460 | |||
| 898e37eedb | |||
| d42788c694 | |||
| 46655a1cfe | |||
| 668e3ee70f | |||
| 0ec9f01130 | |||
| ad6f886e1e | |||
| 6402d228c0 | |||
| a68496d451 | |||
| 72fe3c58c6 | |||
| eb5bc14974 | |||
| 7e99e8c7a4 | |||
| 9b0f4d5aef | |||
| b58049968f | |||
| 9bf0d3f7d1 | |||
| 8300c47e4a | |||
| c73fcc19f2 | |||
| f93573177a | |||
| fe9c6437d8 | |||
| c110ffc4b1 | |||
| 7af63d1519 | |||
| 31ba1f2c4c | |||
| 33afd13a8c | |||
| b341ffacbf | |||
| 0d1d1f0f37 | |||
| 3f59ed48d2 | |||
| de832ff497 |
@@ -21,10 +21,13 @@ import static java.lang.Math.PI;
|
|||||||
public class Terrain {
|
public class Terrain {
|
||||||
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
|
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
|
||||||
public short[][] terrain_pixel_data;
|
public short[][] terrain_pixel_data;
|
||||||
|
|
||||||
|
public Vector2f image_size = new Vector2f();
|
||||||
public Vector2f terrain_size = new Vector2f();
|
public Vector2f terrain_size = new Vector2f();
|
||||||
public Vector2f cell_size = new Vector2f();
|
public Vector2f cell_size = new Vector2f();
|
||||||
public Vector2f cell_count = new Vector2f();
|
public Vector2f cell_count = new Vector2f();
|
||||||
public float terrain_scale;
|
public float terrain_scale;
|
||||||
|
public Vector2f blend_values = new Vector2f();
|
||||||
public Vector2f blend_ratio = new Vector2f();
|
public Vector2f blend_ratio = new Vector2f();
|
||||||
public int heightmap;
|
public int heightmap;
|
||||||
Zone zone;
|
Zone zone;
|
||||||
@@ -43,6 +46,7 @@ public class Terrain {
|
|||||||
// Load pixel data for this terrain from cache
|
// Load pixel data for this terrain from cache
|
||||||
|
|
||||||
this.terrain_pixel_data = Terrain._heightmap_pixel_cache.get(heightmap);
|
this.terrain_pixel_data = Terrain._heightmap_pixel_cache.get(heightmap);
|
||||||
|
this.image_size.set(this.terrain_pixel_data.length, this.terrain_pixel_data[0].length);
|
||||||
|
|
||||||
if (terrain_pixel_data == null)
|
if (terrain_pixel_data == null)
|
||||||
Logger.error("Pixel map empty for zone: " + this.zone.getObjectUUID() + ":" + this.zone.zoneName);
|
Logger.error("Pixel map empty for zone: " + this.zone.getObjectUUID() + ":" + this.zone.zoneName);
|
||||||
@@ -52,8 +56,8 @@ public class Terrain {
|
|||||||
this.terrain_size.x = this.zone.major_radius * 2;
|
this.terrain_size.x = this.zone.major_radius * 2;
|
||||||
this.terrain_size.y = this.zone.minor_radius * 2;
|
this.terrain_size.y = this.zone.minor_radius * 2;
|
||||||
|
|
||||||
this.cell_count.x = this.terrain_pixel_data.length - 1;
|
this.cell_count.x = this.image_size.x;
|
||||||
this.cell_count.y = this.terrain_pixel_data[0].length - 1;
|
this.cell_count.y = this.image_size.y; // Bug in exe
|
||||||
|
|
||||||
this.cell_size.x = terrain_size.x / this.cell_count.x;
|
this.cell_size.x = terrain_size.x / this.cell_count.x;
|
||||||
this.cell_size.y = terrain_size.y / this.cell_count.y;
|
this.cell_size.y = terrain_size.y / this.cell_count.y;
|
||||||
@@ -62,22 +66,14 @@ public class Terrain {
|
|||||||
// the blending area between child and parent terrains when
|
// the blending area between child and parent terrains when
|
||||||
// they are stitched together.
|
// they are stitched together.
|
||||||
|
|
||||||
float max_blend = this.zone.template.max_blend;
|
this.blend_values.x = this.zone.template.max_blend;
|
||||||
float min_blend = this.zone.template.min_blend;
|
this.blend_values.y = this.zone.template.min_blend;
|
||||||
|
|
||||||
// Zones with a zero blend inherit from their parent terrain
|
Vector2f major_blend = new Vector2f(this.blend_values.x / this.zone.major_radius,
|
||||||
|
this.blend_values.y / this.zone.major_radius);
|
||||||
|
|
||||||
if (this.zone.template.max_blend == 0) {
|
Vector2f minor_blend = new Vector2f(this.blend_values.x / this.zone.minor_radius,
|
||||||
Zone parentZone = this.getNextZoneWithTerrain(this.zone.parent);
|
this.blend_values.y / this.zone.minor_radius);
|
||||||
max_blend = parentZone.template.max_blend;
|
|
||||||
min_blend = parentZone.template.min_blend;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2f major_blend = new Vector2f(max_blend / this.zone.major_radius,
|
|
||||||
min_blend / this.zone.major_radius);
|
|
||||||
|
|
||||||
Vector2f minor_blend = new Vector2f(max_blend / this.zone.minor_radius,
|
|
||||||
min_blend / this.zone.minor_radius);
|
|
||||||
|
|
||||||
if (major_blend.y > 0.4f)
|
if (major_blend.y > 0.4f)
|
||||||
blend_ratio.x = major_blend.y;
|
blend_ratio.x = major_blend.y;
|
||||||
@@ -91,7 +87,7 @@ public class Terrain {
|
|||||||
|
|
||||||
// Scale coefficient for this terrain
|
// Scale coefficient for this terrain
|
||||||
|
|
||||||
this.terrain_scale = this.zone.template.terrain_max_y / 255f;
|
this.terrain_scale = this.zone.template.terrain_max_y / 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Zone getNextZoneWithTerrain(Zone zone) {
|
public static Zone getNextZoneWithTerrain(Zone zone) {
|
||||||
@@ -162,14 +158,14 @@ public class Terrain {
|
|||||||
|
|
||||||
public Vector2f getTerrainCell(Vector2f terrain_loc) {
|
public Vector2f getTerrainCell(Vector2f terrain_loc) {
|
||||||
|
|
||||||
// Calculate terrain cell with offset
|
// Calculate terrain cell with offset. Bug mirrors the exe
|
||||||
|
|
||||||
Vector2f terrain_cell = new Vector2f(terrain_loc.x / this.cell_size.x, terrain_loc.y / this.cell_size.y);
|
Vector2f terrain_cell = new Vector2f(terrain_loc.x / this.cell_size.x, terrain_loc.y / this.cell_size.x);
|
||||||
|
|
||||||
// Clamp values when standing directly on pole
|
// 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.x = Math.max(0, Math.min(this.cell_count.x - 2, terrain_cell.x));
|
||||||
terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 1, terrain_cell.y));
|
terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 2, terrain_cell.y));
|
||||||
|
|
||||||
return terrain_cell;
|
return terrain_cell;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,19 +49,33 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
float blendedHeight = Terrain.getWorldHeight(currentZone, playerCharacter.getLoc());
|
float blendedHeight = Terrain.getWorldHeight(currentZone, playerCharacter.getLoc());
|
||||||
|
|
||||||
Vector2f gridSquare = heightmapZone.terrain.getTerrainCell(childZoneLoc);
|
Vector2f terrainCell = heightmapZone.terrain.getTerrainCell(childZoneLoc);
|
||||||
gridSquare.x = (float) Math.floor(gridSquare.x);
|
Vector2f cell_offset = new Vector2f(terrainCell.x % 1, terrainCell.y % 1);
|
||||||
gridSquare.y = (float) Math.floor(gridSquare.y);
|
|
||||||
|
terrainCell.x = (float) Math.floor(terrainCell.x);
|
||||||
|
terrainCell.y = (float) Math.floor(terrainCell.y);
|
||||||
|
|
||||||
|
|
||||||
|
short top_left_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x][(int) terrainCell.y];
|
||||||
|
short top_right_pixel = heightmapZone.terrain.terrain_pixel_data[(int) terrainCell.x + 1][(int) terrainCell.y];
|
||||||
|
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);
|
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName);
|
||||||
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName);
|
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName);
|
||||||
this.throwbackInfo(playerCharacter, "Parent Zone: " + parentZone.zoneName);
|
this.throwbackInfo(playerCharacter, "Parent Zone: " + parentZone.zoneName);
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "Grid : " + "[" + gridSquare.x + "]" + "[" + gridSquare.y + "]");
|
this.throwbackInfo(playerCharacter, "Player loc: " + "[" + playerCharacter.loc.x + "]" + "[" + playerCharacter.loc.y + "]" + "[" + playerCharacter.loc.z + "]");
|
||||||
this.throwbackInfo(playerCharacter, "offset: " + "[" + childZoneOffset.x + "]" + "[" + childZoneOffset.y + "]");
|
|
||||||
|
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 + "]");
|
||||||
this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]");
|
this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]");
|
||||||
this.throwbackInfo(playerCharacter, "Heightmap blend Values: max/min" + heightmapZone.template.min_blend + " /" + heightmapZone.template.max_blend);
|
this.throwbackInfo(playerCharacter, "template blend Values: (max/min): " + heightmapZone.template.max_blend + " /" + heightmapZone.template.min_blend);
|
||||||
this.throwbackInfo(playerCharacter, "Parent blend Values: nax/min" + parentZone.template.min_blend + " /" + parentZone.template.max_blend);
|
this.throwbackInfo(playerCharacter, "terrain values (max/min): " + heightmapZone.terrain.blend_values.x + " /" + heightmapZone.terrain.blend_values.y);
|
||||||
this.throwbackInfo(playerCharacter, "Blend coefficient: " + heightmapZone.terrain.getTerrainBlendCoefficient(childZoneOffset));
|
this.throwbackInfo(playerCharacter, "Blend coefficient: " + heightmapZone.terrain.getTerrainBlendCoefficient(childZoneOffset));
|
||||||
|
|
||||||
this.throwbackInfo(playerCharacter, "------------");
|
this.throwbackInfo(playerCharacter, "------------");
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.gameManager;
|
|
||||||
|
|
||||||
import engine.loot.WorkOrder;
|
|
||||||
|
|
||||||
import java.util.concurrent.BlockingQueue;
|
|
||||||
import java.util.concurrent.DelayQueue;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
public enum ForgeManager implements Runnable {
|
|
||||||
|
|
||||||
FORGE_MANAGER;
|
|
||||||
|
|
||||||
private final BlockingQueue<WorkOrder> workQueue = new DelayQueue();
|
|
||||||
public static final AtomicInteger workOrder = new AtomicInteger(0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
WorkOrder workOrder = workQueue.take();
|
|
||||||
|
|
||||||
// Fulfill workOrder
|
|
||||||
|
|
||||||
for (int i = 0; i < workOrder.slotCount; ++i) {
|
|
||||||
|
|
||||||
// Create workOrder items; one for each slot
|
|
||||||
// assigned to this workOrder.
|
|
||||||
|
|
||||||
// if Prefix and suffix are null random roll item
|
|
||||||
// otherwise roll what was asked for
|
|
||||||
|
|
||||||
workOrder.itemCount = workOrder.itemCount - 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (workOrder.itemCount == 0) {
|
|
||||||
|
|
||||||
workOrder.runCompleted = true;
|
|
||||||
|
|
||||||
// Remove this workOrder from any slots on vendor
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resubmit workOrder
|
|
||||||
|
|
||||||
workOrder.completionTime = System.currentTimeMillis() + 10000;
|
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.loot;
|
|
||||||
|
|
||||||
import engine.gameManager.ForgeManager;
|
|
||||||
import engine.objects.NPC;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.concurrent.Delayed;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static java.lang.Math.toIntExact;
|
|
||||||
|
|
||||||
public class WorkOrder implements Delayed {
|
|
||||||
|
|
||||||
public int workOrder;
|
|
||||||
public NPC vendor;
|
|
||||||
public int slotCount;
|
|
||||||
public int itemCount;
|
|
||||||
public int itemBase;
|
|
||||||
public String itemName;
|
|
||||||
public int prefixToken;
|
|
||||||
public int suffixToken;
|
|
||||||
public boolean isRandom;
|
|
||||||
public long completionTime;
|
|
||||||
public boolean runCompleted;
|
|
||||||
|
|
||||||
public WorkOrder() {
|
|
||||||
|
|
||||||
this.workOrder = ForgeManager.workOrder.incrementAndGet();
|
|
||||||
this.completionTime = System.currentTimeMillis() + 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDelay(TimeUnit unit) {
|
|
||||||
|
|
||||||
long timeRemaining = completionTime - System.currentTimeMillis();
|
|
||||||
return unit.convert(timeRemaining, TimeUnit.MILLISECONDS);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(@NotNull Delayed o) {
|
|
||||||
return toIntExact(this.completionTime - ((WorkOrder) o).completionTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +1,11 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.mobileAI.Threads;
|
package engine.mobileAI.Threads;
|
||||||
|
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.mobileAI.MobAI;
|
import engine.mobileAI.MobAI;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
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{
|
||||||
@@ -21,27 +14,23 @@ public class MobAIThread implements Runnable{
|
|||||||
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
||||||
public static int AI_PATROL_DIVISOR = 15;
|
public static int AI_PATROL_DIVISOR = 15;
|
||||||
public static float AI_CAST_FREQUENCY;
|
public static float AI_CAST_FREQUENCY;
|
||||||
|
|
||||||
// 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
|
||||||
Logger.info(" MobAIThread thread has started!");
|
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) {
|
while (true) {
|
||||||
|
for (Zone zone : ZoneManager.getAllZones()) {
|
||||||
|
|
||||||
|
for (Mob mob : zone.zoneMobSet) {
|
||||||
|
|
||||||
for (Zone zone : ZoneManager.getAllZones())
|
|
||||||
for (Mob mob : zone.zoneMobSet)
|
|
||||||
try {
|
try {
|
||||||
if (mob != null)
|
if (mob != null)
|
||||||
MobAI.DetermineAction(mob);
|
MobAI.DetermineAction(mob);
|
||||||
@@ -50,9 +39,9 @@ public class MobAIThread implements Runnable{
|
|||||||
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());
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import engine.Enum.ItemType;
|
|||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.loot.WorkOrder;
|
|
||||||
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;
|
||||||
@@ -456,18 +455,9 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
switch (msg.getActionType()) {
|
switch (msg.getActionType()) {
|
||||||
|
|
||||||
case ACTION_PRODUCE:
|
case ACTION_PRODUCE:
|
||||||
|
boolean isRandom = false;
|
||||||
boolean isRandom = msg.getUnknown03() != 0 && msg.getpToken() == 0 && msg.getsToken() == 0;
|
if (msg.getUnknown03() != 0 && msg.getpToken() == 0 && msg.getsToken() == 0)
|
||||||
|
isRandom = true;
|
||||||
WorkOrder workOrder = new WorkOrder();
|
|
||||||
workOrder.vendor = vendorNPC;
|
|
||||||
workOrder.isRandom = isRandom;
|
|
||||||
workOrder.itemBase = msg.getItemUUID();
|
|
||||||
workOrder.itemCount = msg.getTotalProduction();
|
|
||||||
workOrder.prefixToken = msg.getpToken();
|
|
||||||
workOrder.suffixToken = msg.getsToken();
|
|
||||||
workOrder.itemName = msg.getName();
|
|
||||||
|
|
||||||
//Create Multiple Item Function.. Fill all empty slots
|
//Create Multiple Item Function.. Fill all empty slots
|
||||||
if (msg.isMultiple()) {
|
if (msg.isMultiple()) {
|
||||||
int emptySlots = vendorNPC.getRank() - vendorNPC.getRolling().size();
|
int emptySlots = vendorNPC.getRank() - vendorNPC.getRolling().size();
|
||||||
|
|||||||
@@ -287,7 +287,30 @@ public class Building extends AbstractWorldObject {
|
|||||||
|
|
||||||
public final City getCity() {
|
public final City getCity() {
|
||||||
|
|
||||||
return ZoneManager.getCityAtLocation(this.getLoc());
|
if (this.parentZone == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (this.getBlueprint() != null && this.getBlueprint().isSiegeEquip() && this.protectionState.equals(ProtectionState.PROTECTED)) {
|
||||||
|
if (this.getGuild() != null) {
|
||||||
|
if (this.getGuild().getOwnedCity() != null) {
|
||||||
|
if (this.getLoc().isInsideCircle(this.getGuild().getOwnedCity().getLoc(), CityBoundsType.ZONE.halfExtents))
|
||||||
|
return this.getGuild().getOwnedCity();
|
||||||
|
} else {
|
||||||
|
Bane bane = Bane.getBaneByAttackerGuild(this.getGuild());
|
||||||
|
|
||||||
|
if (bane != null) {
|
||||||
|
if (bane.getCity() != null) {
|
||||||
|
if (this.getLoc().isInsideCircle(bane.getCity().getLoc(), CityBoundsType.ZONE.halfExtents))
|
||||||
|
return bane.getCity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.parentZone.guild_zone == false)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return City.getCity(this.parentZone.playerCityUUID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import engine.gameManager.*;
|
|||||||
import engine.job.JobContainer;
|
import engine.job.JobContainer;
|
||||||
import engine.job.JobScheduler;
|
import engine.job.JobScheduler;
|
||||||
import engine.jobs.UpgradeNPCJob;
|
import engine.jobs.UpgradeNPCJob;
|
||||||
import engine.loot.WorkOrder;
|
|
||||||
import engine.math.Bounds;
|
import engine.math.Bounds;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -38,7 +37,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup;
|
import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup;
|
||||||
@@ -54,8 +52,6 @@ public class NPC extends AbstractCharacter {
|
|||||||
private final ArrayList<MobLoot> rolling = new ArrayList<>();
|
private final ArrayList<MobLoot> rolling = new ArrayList<>();
|
||||||
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
||||||
public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
|
public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
|
||||||
|
|
||||||
public CopyOnWriteArrayList<WorkOrder> workOrders = new CopyOnWriteArrayList();
|
|
||||||
public HashMap<Integer, MobEquipment> equip = null;
|
public HashMap<Integer, MobEquipment> equip = null;
|
||||||
public int runeSetID = 0;
|
public int runeSetID = 0;
|
||||||
public int extraRune2 = 0;
|
public int extraRune2 = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user