Compare commits

..

10 Commits

Author SHA1 Message Date
MagicBot 250e3407fa Merge remote-tracking branch 'origin/bugfix-safeguard-aggro' into magicbox-1.5.2 2024-01-29 12:31:26 -05:00
MagicBot fcd37cbae2 Dev cmd cleanup 2024-01-28 11:30:54 -05:00
MagicBot 70e76d9a1a Handling of mobs not in buildings. 2024-01-28 11:26:54 -05:00
MagicBot 6a3bd89095 Handling of mobs not in buildings. 2024-01-28 11:24:20 -05:00
MagicBot 4ccf03dfd3 Zone offset not world loc. 2024-01-28 10:31:02 -05:00
MagicBot f845c0ad80 Better handling of null guilds. 2024-01-28 10:15:55 -05:00
MagicBot 165752f6d6 Null fix in dev command. 2024-01-28 10:01:01 -05:00
FatBoy c0ee8b82f8 Warehosue cleanup 2024-01-24 20:21:41 -06:00
FatBoy cc1e0d8986 Warehosue cleanup 2024-01-24 20:03:27 -06:00
FatBoy 7f6fbd2bff load mesh data and structure meshes 2024-01-24 19:03:33 -06:00
30 changed files with 515 additions and 1292 deletions
@@ -1,10 +0,0 @@
package engine.collisionEngine;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.HashMap;
public class CollisionManager {
public static HashMap<Integer, ArrayList<MeshTriangle>> mesh_triangles;
public static HashMap<Integer, ArrayList<MeshData>> structure_meshes;
}
-125
View File
@@ -1,125 +0,0 @@
package engine.collisionEngine;
import engine.gameManager.BuildingManager;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractCharacter;
import engine.objects.Building;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
public class Mesh {
public int parentUUID;
public MeshData meshData;
private int meshID;
public Rectangle2D.Float bounds;
public ArrayList<MeshTriangle> triangles;
public Vector3f mesh_loc;
public Vector3f mesh_ref;
public Vector3f mesh_end;
public float mesh_maxY;
public float mesh_minY;
public Mesh(MeshData data, int parentUUID){
this.meshData = data;
this.parentUUID = parentUUID;
this.meshID = data.meshID;
this.BakeTriangles();
this.BakeBounds();
}
public void BakeTriangles(){
if(CollisionManager.mesh_triangles.containsKey(this.meshID) == false)
return; // no triangle data to bake
this.triangles = new ArrayList<>();
Building building = BuildingManager.getBuilding(this.parentUUID);
if(building == null)
return; // can't continue without a building to base location offsets from
Vector3f adjustedBuildingLoc = new Vector3f(building.loc.x,building.loc.y, building.loc.z * -1);
int rotDegrees = (int)Math.toDegrees(building.getBounds().getQuaternion().angleY);
this.mesh_loc = Vector3f.rotateAroundPoint(adjustedBuildingLoc.add(this.meshData.mesh_loc),adjustedBuildingLoc,rotDegrees);
this.mesh_ref = Vector3f.rotateAroundPoint(adjustedBuildingLoc.add(this.meshData.mesh_ref),adjustedBuildingLoc,rotDegrees);
this.mesh_end = Vector3f.rotateAroundPoint(adjustedBuildingLoc.add(this.meshData.mesh_end),adjustedBuildingLoc,rotDegrees);
this.mesh_minY = adjustedBuildingLoc.y + this.meshData.mesh_minY;
this.mesh_maxY = adjustedBuildingLoc.y + this.meshData.mesh_maxY;
for(MeshTriangle tri : CollisionManager.mesh_triangles.get(this.meshID)){
Vector3f point1 = this.mesh_loc.add(new Vector3f(tri.point1.x,this.mesh_loc.y,tri.point1.y));
Vector3f point2 = this.mesh_loc.add(new Vector3f(tri.point2.x,this.mesh_loc.y,tri.point2.y));
Vector3f point3 = this.mesh_loc.add(new Vector3f(tri.point3.x,this.mesh_loc.y,tri.point3.y));
Vector3f rotatedPoint1 = Vector3f.rotateAroundPoint(point1,this.mesh_loc,rotDegrees);
Vector3f rotatedPoint2 = Vector3f.rotateAroundPoint(point2,this.mesh_loc,rotDegrees);
Vector3f rotatedPoint3 = Vector3f.rotateAroundPoint(point3,this.mesh_loc,rotDegrees);
MeshTriangle newTri = new MeshTriangle();
newTri.point1 = new Point2D.Float(rotatedPoint1.x,rotatedPoint1.z);
newTri.point2 = new Point2D.Float(rotatedPoint2.x,rotatedPoint2.z);
newTri.point3 = new Point2D.Float(rotatedPoint3.x,rotatedPoint3.z);
newTri.sides = new ArrayList<>();
newTri.sides.add(new Line2D.Float(newTri.point1,newTri.point2));
newTri.sides.add(new Line2D.Float(newTri.point2,newTri.point3));
newTri.sides.add(new Line2D.Float(newTri.point3,newTri.point1));
this.triangles.add(newTri);
}
}
public void BakeBounds(){
float width = (this.mesh_ref.x - this.mesh_end.x) * 0.5f;
float height = (this.mesh_ref.z - this.mesh_end.z) * 0.5f;
this.bounds = new Rectangle2D.Float(this.mesh_ref.x,this.mesh_ref.z,width,height);
}
public boolean collides(AbstractCharacter mover, Vector3fImmutable destination){
if(mover == null)
return false;
Line2D.Float line = new Line2D.Float(new Point2D.Float(mover.loc.x,mover.loc.z * -1),new Point2D.Float(destination.x,destination.z * -1));
float footHeight = mover.loc.y;
float headHeight = mover.loc.y + mover.characterHeight;
if(line.intersects(this.bounds) == false)
return false; // character path doesn't cross over this mesh
if(footHeight > this.mesh_maxY || headHeight < this.mesh_minY)
return false; //character is either above or below the bounds of this mesh
for(MeshTriangle tri : this.triangles)
if(tri.collides(line))
return true; //character's path directly hits part of this mesh
return false;
}
public boolean losBlocked(AbstractCharacter looker, Vector3fImmutable target){
float headHeight = looker.loc.y + looker.characterHeight;
float targetAlt = target.y;
Line2D.Float eyeLine = new Line2D.Float(new Point2D.Float(looker.loc.x,looker.loc.z * -1),new Point2D.Float(target.x,target.z * -1));
if(eyeLine.intersects(this.bounds) == false)
return false; // character eye-line doesn't cross over this mesh
if(targetAlt > this.mesh_maxY && headHeight > this.mesh_maxY)
return false; // both characters are above this mesh
if(targetAlt < this.mesh_maxY && headHeight < this.mesh_maxY)
return false; // both characters are below this mesh
return true;
}
}
-23
View File
@@ -1,23 +0,0 @@
package engine.collisionEngine;
import engine.math.Vector3f;
public class MeshData {
public int propID;
public int meshID;
public Vector3f mesh_loc;
public Vector3f mesh_ref;
public Vector3f mesh_end;
public float mesh_maxY;
public float mesh_minY;
public MeshData(int propID,int meshID, Vector3f meshLoc, Vector3f meshRef, Vector3f meshEnd, float maxY, float minY){
this.propID = propID;
this.meshID = meshID;
this.mesh_loc = meshLoc;
this.mesh_ref = meshRef;
this.mesh_end = meshEnd;
this.mesh_maxY = maxY;
this.mesh_minY = minY;
}
}
@@ -1,20 +0,0 @@
package engine.collisionEngine;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
public class MeshTriangle {
public Point2D.Float point1;
public Point2D.Float point2;
public Point2D.Float point3;
public ArrayList<Line2D.Float> sides;
public boolean collides(Line2D.Float line){
for(Line2D.Float side : sides)
if(line.intersectsLine(side))
return true;
return false;
}
}
@@ -13,18 +13,13 @@ import engine.Enum;
import engine.Enum.DbObjectType; import engine.Enum.DbObjectType;
import engine.Enum.ProtectionState; import engine.Enum.ProtectionState;
import engine.Enum.TaxType; import engine.Enum.TaxType;
import engine.collisionEngine.CollisionManager;
import engine.collisionEngine.MeshData;
import engine.collisionEngine.MeshTriangle;
import engine.gameManager.BuildingManager; import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.*; import engine.objects.*;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.awt.geom.Point2D;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -853,69 +848,5 @@ public class dbBuildingHandler extends dbHandlerBase {
} }
return false; return false;
} }
public boolean LOAD_STRUCTURE_MESHES() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `final_structure_meshes`;")) {
ResultSet rs = preparedStatement.executeQuery();
CollisionManager.structure_meshes = new HashMap<>();
while (rs.next()) {
int propId = rs.getInt("propID");
int meshId = rs.getInt("meshID");
Vector3f meshLoc = new Vector3f(rs.getFloat("locX"),rs.getFloat("locY"),rs.getFloat("locZ"));
Vector3f meshRef = new Vector3f(rs.getFloat("refX"),rs.getFloat("refY"),rs.getFloat("refZ"));
Vector3f meshEnd = new Vector3f(rs.getFloat("endX"),rs.getFloat("endY"),rs.getFloat("endZ"));
float maxY = rs.getFloat("maxY");
float minY = rs.getFloat("minY");
MeshData data = new MeshData(propId,meshId,meshLoc,meshRef,meshEnd,maxY,minY);
if(CollisionManager.structure_meshes.containsKey(propId)){
CollisionManager.structure_meshes.get(propId).add(data);
} else{
ArrayList<MeshData> addList = new ArrayList<>();
addList.add(data);
CollisionManager.structure_meshes.put(propId,addList);
}
}
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
public boolean LOAD_MESH_TRIANGLES() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `final_mesh_triangles`;")) {
ResultSet rs = preparedStatement.executeQuery();
CollisionManager.mesh_triangles = new HashMap<>();
while (rs.next()) {
int meshId = rs.getInt("meshID");
Point2D.Float point1 = new Point2D.Float(rs.getFloat("P1X"), rs.getFloat("P1Z"));
Point2D.Float point2 = new Point2D.Float(rs.getFloat("P2X"), rs.getFloat("P2Z"));
Point2D.Float point3 = new Point2D.Float(rs.getFloat("P3X"), rs.getFloat("P3Z"));
MeshTriangle newTri = new MeshTriangle();
newTri.point1 = point1;
newTri.point2 = point2;
newTri.point3 = point3;
if(CollisionManager.mesh_triangles.containsKey(meshId)){
CollisionManager.mesh_triangles.get(meshId).add(newTri);
} else{
ArrayList<MeshTriangle> addList = new ArrayList<>();
addList.add(newTri);
CollisionManager.mesh_triangles.put(meshId,addList);
}
}
return (preparedStatement.executeUpdate() > 0);
} catch (SQLException e) {
Logger.error(e);
}
return false;
}
} }
+25 -25
View File
@@ -109,7 +109,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
preparedStatement.setLong(1, locks); preparedStatement.setLong(1, locks);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -125,7 +125,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -141,7 +141,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -157,7 +157,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -173,7 +173,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -189,7 +189,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -205,7 +205,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -221,7 +221,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -237,7 +237,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -253,7 +253,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -269,7 +269,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -285,7 +285,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -301,7 +301,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -317,7 +317,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -333,7 +333,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -349,7 +349,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -365,7 +365,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -381,7 +381,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -397,7 +397,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -413,7 +413,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -429,7 +429,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -445,7 +445,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -461,7 +461,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -477,7 +477,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
preparedStatement.setInt(1, amount); preparedStatement.setInt(1, amount);
preparedStatement.setInt(2, wh.getUID()); preparedStatement.setInt(2, wh.UID);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);
@@ -545,7 +545,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
while (rs.next()) { while (rs.next()) {
warehouse = new Warehouse(rs); warehouse = new Warehouse(rs);
warehouse.runAfterLoad(); warehouse.runAfterLoad();
warehouse.loadAllTransactions(); Warehouse.loadAllTransactions(warehouse);
} }
} catch (SQLException e) { } catch (SQLException e) {
+6 -29
View File
@@ -10,18 +10,15 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum; import engine.Enum;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable; import engine.objects.AbstractGameObject;
import engine.objects.*; import engine.objects.Mob;
import engine.objects.PlayerCharacter;
import engine.objects.Zone;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
/**
* @author Eighty
*/
public class AddMobCmd extends AbstractDevCmd { public class AddMobCmd extends AbstractDevCmd {
public AddMobCmd() { public AddMobCmd() {
@@ -38,27 +35,8 @@ public class AddMobCmd extends AbstractDevCmd {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc()); Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (words[0].equals("all")) {
for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) {
MobBase mb = (MobBase) mobbaseAGO;
int loadID = mb.getObjectUUID();
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
if (mob != null) {
mob.updateDatabase();
this.setResult(String.valueOf(mob.getDBID()));
} else {
throwbackError(pc, "Failed to create mob of type " + loadID);
Logger.error("Failed to create mob of type "
+ loadID);
}
}
return;
}
int loadID; int loadID;
try { try {
loadID = Integer.parseInt(words[0]); loadID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
@@ -72,7 +50,6 @@ public class AddMobCmd extends AbstractDevCmd {
return; // NaN return; // NaN
} }
if (zone == null) { if (zone == null) {
throwbackError(pc, "Failed to find zone to place mob in."); throwbackError(pc, "Failed to find zone to place mob in.");
return; return;
@@ -83,9 +60,9 @@ public class AddMobCmd extends AbstractDevCmd {
return; return;
} }
Mob mob = Mob.createMob(loadID, pc.getLoc(), Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE); null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
if (mob != null) { if (mob != null) {
mob.updateDatabase(); mob.updateDatabase();
ChatManager.chatSayInfo(pc, ChatManager.chatSayInfo(pc,
-79
View File
@@ -1,79 +0,0 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum;
import engine.Enum.BuildingGroup;
import engine.Enum.GameObjectType;
import engine.Enum.TargetColor;
import engine.collisionEngine.Mesh;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import engine.util.StringUtils;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author
*/
public class ColliderCmd extends AbstractDevCmd {
public ColliderCmd() {
super("collider");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (pc == null) {
return;
}
String newline = "\r\n ";
String output = "----------Collider Information----------" + newline;
if(target.getObjectType().equals(GameObjectType.Building) == false)
throwbackInfo(pc, "You Must Select A Building");
Building building = (Building)target;
output += "Mesh Count: " + ((Building) target).buildingMeshes.size() + newline;
for(Mesh mesh : building.buildingMeshes){
output += "------------------------------" + newline;
output += "Mesh ID: " + mesh.meshData.meshID + newline;
output += "Mesh Tri Count: " + mesh.triangles.size() + newline;
output += "Mesh Bounds: " + mesh.bounds + newline;
output += "Mesh Min/Max: " + mesh.mesh_minY + " / " + mesh.mesh_maxY + newline;
output += "Location Inside: " + mesh.bounds.contains(pc.loc.x,pc.loc.z * -1) + newline;
output += "------------------------------" + newline;
}
throwbackInfo(pc, output);
}
@Override
protected String _getHelpString() {
return "Gets information on an Object.";
}
@Override
protected String _getUsageString() {
return "' /info targetID'";
}
}
+1 -4
View File
@@ -13,10 +13,7 @@ import engine.Enum.BuildingGroup;
import engine.Enum.DbObjectType; import engine.Enum.DbObjectType;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager; import engine.gameManager.*;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.*; import engine.objects.*;
+4 -22
View File
@@ -14,9 +14,6 @@ import engine.Enum.BuildingGroup;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.InterestManagement.InterestManager; import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.collisionEngine.CollisionManager;
import engine.collisionEngine.Mesh;
import engine.collisionEngine.MeshData;
import engine.job.JobContainer; import engine.job.JobContainer;
import engine.job.JobScheduler; import engine.job.JobScheduler;
import engine.jobs.UpgradeBuildingJob; import engine.jobs.UpgradeBuildingJob;
@@ -237,15 +234,15 @@ public enum BuildingManager {
ChatManager.chatSystemInfo(player, "You can not carry any more of that item."); ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
return false; return false;
} }
if (warehouse.getResources().get(resourceBase) == null) if (warehouse.resources.get(resourceBase) == null)
continue; continue;
int resourceAmount = warehouse.getResources().get(resourceBase); int resourceAmount = warehouse.resources.get(resourceBase);
if (resourceAmount <= 0) if (resourceAmount <= 0)
continue; continue;
if (warehouse.loot(player, resourceBase, resourceAmount, true)) if (Warehouse.loot(warehouse, player, resourceBase, resourceAmount, true))
ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + resourceBase.getName()); ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + resourceBase.getName());
} }
break; break;
@@ -548,7 +545,7 @@ public enum BuildingManager {
NPC npc = null; NPC npc = null;
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, null, zone, (short) rank, building); npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building);
if (npc == null) if (npc == null)
return false; return false;
@@ -946,8 +943,6 @@ public enum BuildingManager {
cleanupHirelings(building); cleanupHirelings(building);
building.isDeranking.compareAndSet(true, false); building.isDeranking.compareAndSet(true, false);
BakeColliders(building);
} }
public static Building getBuildingAtLocation(Vector3fImmutable loc) { public static Building getBuildingAtLocation(Vector3fImmutable loc) {
@@ -965,17 +960,4 @@ public enum BuildingManager {
return null; return null;
} }
public static void BakeColliders(Building building){
int propID = building.meshUUID;
if(CollisionManager.structure_meshes.containsKey(propID) == false) {
Logger.error("Bake for PropID: " + propID + " Failed");
return;
}
building.buildingMeshes = new ArrayList<>();
for(MeshData data : CollisionManager.structure_meshes.get(propID)){
building.buildingMeshes.add(new Mesh(data,building.getObjectUUID()));
}
}
} }
@@ -58,7 +58,6 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new PrintResistsCmd()); DevCmdManager.registerDevCmd(new PrintResistsCmd());
DevCmdManager.registerDevCmd(new PrintLocationCmd()); DevCmdManager.registerDevCmd(new PrintLocationCmd());
DevCmdManager.registerDevCmd(new InfoCmd()); DevCmdManager.registerDevCmd(new InfoCmd());
DevCmdManager.registerDevCmd(new ColliderCmd());
DevCmdManager.registerDevCmd(new aiInfoCmd()); DevCmdManager.registerDevCmd(new aiInfoCmd());
DevCmdManager.registerDevCmd(new SimulateBootyCmd()); DevCmdManager.registerDevCmd(new SimulateBootyCmd());
DevCmdManager.registerDevCmd(new GetHeightCmd()); DevCmdManager.registerDevCmd(new GetHeightCmd());
+20 -20
View File
@@ -184,7 +184,7 @@ public enum MaintenanceManager {
if ((overDraft > 0)) if ((overDraft > 0))
if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) && if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) &&
(warehouse != null) && building.assetIsProtected() == true && (warehouse != null) && building.assetIsProtected() == true &&
(warehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) { (warehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) {
hasFunds = true; hasFunds = true;
} }
@@ -199,22 +199,22 @@ public enum MaintenanceManager {
hasResources = false; hasResources = false;
else { else {
resourceValue = warehouse.getResources().get(Warehouse.stoneIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
if (resourceValue < 1500) if (resourceValue < 1500)
hasResources = false; hasResources = false;
resourceValue = warehouse.getResources().get(Warehouse.lumberIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
if (resourceValue < 1500) if (resourceValue < 1500)
hasResources = false; hasResources = false;
resourceValue = warehouse.getResources().get(Warehouse.galvorIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
if (resourceValue < 5) if (resourceValue < 5)
hasResources = false; hasResources = false;
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
if (resourceValue < 5) if (resourceValue < 5)
hasResources = false; hasResources = false;
@@ -247,11 +247,11 @@ public enum MaintenanceManager {
if (overDraft > 0) { if (overDraft > 0) {
resourceValue = warehouse.getResources().get(Warehouse.goldIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(7));
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - overDraft) == true) { if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - overDraft) == true) {
warehouse.getResources().put(Warehouse.goldIB, resourceValue - overDraft); warehouse.resources.put(ItemBase.getItemBase(7), resourceValue - overDraft);
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft); Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft);
} else { } else {
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return true; return true;
@@ -267,11 +267,11 @@ public enum MaintenanceManager {
// Withdraw Stone // Withdraw Stone
resourceValue = warehouse.getResources().get(Warehouse.stoneIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) { if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 1500); warehouse.resources.put(ItemBase.getItemBase(1580000), resourceValue - 1500);
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500); Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
} else { } else {
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return true; return true;
@@ -279,11 +279,11 @@ public enum MaintenanceManager {
// Withdraw Lumber // Withdraw Lumber
resourceValue = warehouse.getResources().get(Warehouse.lumberIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) { if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 1500); warehouse.resources.put(ItemBase.getItemBase(1580004), resourceValue - 1500);
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500); Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
} else { } else {
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return true; return true;
@@ -291,21 +291,21 @@ public enum MaintenanceManager {
// Withdraw Galvor // Withdraw Galvor
resourceValue = warehouse.getResources().get(Warehouse.galvorIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) { if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 5); warehouse.resources.put(ItemBase.getItemBase(1580017), resourceValue - 5);
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5); Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
} else { } else {
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return true; return true;
} }
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) { if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 5); warehouse.resources.put(ItemBase.getItemBase(1580018), resourceValue - 5);
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5); Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
} else { } else {
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
} }
+3 -3
View File
@@ -939,16 +939,16 @@ public class MobAI {
//dont scan self. //dont scan self.
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) == true) if (mob.equals(awoMob))
continue; continue;
Mob aggroMob = (Mob) awoMob; Mob aggroMob = (Mob) awoMob;
//don't attack other guards //don't attack other guards
if (aggroMob.isGuard() == true)
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)))
continue; continue;
//don't attack pets
if (aggroMob.agentType.equals(Enum.AIAgentType.PET)) if (aggroMob.agentType.equals(Enum.AIAgentType.PET))
continue; continue;
@@ -171,7 +171,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
if (warehouse == null) if (warehouse == null)
return true; return true;
if (warehouse.isEmpty()) { if (Warehouse.isEmpty(warehouse)) {
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources. ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
return true; return true;
} }
@@ -437,13 +437,13 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
break; break;
case 17: case 17:
Warehouse.warehouseWithdraw(msg, player, npc, origin); Warehouse.warehouseWithdraw(msg, player, npc);
break; break;
case 18: case 18:
Warehouse.warehouseDeposit(msg, player, npc, origin); Warehouse.warehouseDeposit(msg, player, npc);
break; break;
case 19: case 19:
Warehouse.warehouseLock(msg, player, npc, origin); Warehouse.warehouseLock(msg, player, npc);
break; break;
} }
@@ -98,27 +98,27 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
return false; return false;
} }
resourceValue = warehouse.getResources().get(Warehouse.goldIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(7));
if (resourceValue < 5000000) if (resourceValue < 5000000)
hasResources = false; hasResources = false;
resourceValue = warehouse.getResources().get(Warehouse.stoneIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
if (resourceValue < 8000) if (resourceValue < 8000)
hasResources = false; hasResources = false;
resourceValue = warehouse.getResources().get(Warehouse.lumberIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
if (resourceValue < 8000) if (resourceValue < 8000)
hasResources = false; hasResources = false;
resourceValue = warehouse.getResources().get(Warehouse.galvorIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
if (resourceValue < 15) if (resourceValue < 15)
hasResources = false; hasResources = false;
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
if (resourceValue < 15) if (resourceValue < 15)
hasResources = false; hasResources = false;
@@ -130,51 +130,51 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
// Remove resources from warehouse before claiming realm // Remove resources from warehouse before claiming realm
resourceValue = warehouse.getResources().get(Warehouse.goldIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(7));
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - 5000000) == true) { if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - 5000000) == true) {
warehouse.getResources().put(Warehouse.goldIB, resourceValue - 5000000); warehouse.resources.put(ItemBase.getItemBase(7), resourceValue - 5000000);
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, 5000000); Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, 5000000);
} else { } else {
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return false; return false;
} }
resourceValue = warehouse.getResources().get(Warehouse.stoneIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 8000) == true) { if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 8000) == true) {
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 8000); warehouse.resources.put(ItemBase.getItemBase(1580000), resourceValue - 8000);
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 8000); Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 8000);
} else { } else {
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return false; return false;
} }
resourceValue = warehouse.getResources().get(Warehouse.lumberIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 8000) == true) { if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 8000) == true) {
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 8000); warehouse.resources.put(ItemBase.getItemBase(1580004), resourceValue - 8000);
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 8000); Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 8000);
} else { } else {
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return false; return false;
} }
resourceValue = warehouse.getResources().get(Warehouse.galvorIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 15) == true) { if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 15) == true) {
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 15); warehouse.resources.put(ItemBase.getItemBase(1580017), resourceValue - 15);
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 15); Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 15);
} else { } else {
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return false; return false;
} }
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB); resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 15) == true) { if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 15) == true) {
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 15); warehouse.resources.put(ItemBase.getItemBase(1580018), resourceValue - 15);
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 15); Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 15);
} else { } else {
Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID()); Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return false; return false;
@@ -111,7 +111,7 @@ public class TaxCityMsgHandler extends AbstractClientMsgHandler {
ViewResourcesMessage vrm = new ViewResourcesMessage(player); ViewResourcesMessage vrm = new ViewResourcesMessage(player);
vrm.setGuild(building.getGuild()); vrm.setGuild(building.getGuild());
vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().getBuildingUID())); vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().buildingUID));
vrm.configure(); vrm.configure();
Dispatch dispatch = Dispatch.borrow(player, msg); Dispatch dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
@@ -61,13 +61,13 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
public void configure() { public void configure() {
warehouseBuilding = BuildingManager.getBuilding(this.warehouse.getBuildingUID()); warehouseBuilding = BuildingManager.getBuilding(this.warehouse.buildingUID);
transactions = new ArrayList<>(50); transactions = new ArrayList<>(50);
if (this.warehouse.getTransactions().size() > 150) { if (this.warehouse.transactions.size() > 150) {
transactions.addAll(this.warehouse.getTransactions().subList(this.warehouse.getTransactions().size() - 150, this.warehouse.getTransactions().size())); transactions.addAll(this.warehouse.transactions.subList(this.warehouse.transactions.size() - 150, this.warehouse.transactions.size()));
} else } else
transactions = this.warehouse.getTransactions(); transactions = this.warehouse.transactions;
} }
@@ -78,7 +78,7 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
protected void _serialize(ByteBufferWriter writer) throws SerializationException { protected void _serialize(ByteBufferWriter writer) throws SerializationException {
writer.putInt(this.transactionID); writer.putInt(this.transactionID);
writer.putInt(this.warehouse.getBuildingUID()); writer.putInt(this.warehouse.buildingUID);
writer.putInt(transactions.size()); //list Size writer.putInt(transactions.size()); //list Size
for (Transaction transaction : transactions) { for (Transaction transaction : transactions) {
@@ -124,7 +124,7 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
writer.putInt(transaction.getTargetUUID()); //ID writer.putInt(transaction.getTargetUUID()); //ID
writer.putString(name); //Name of depositer/withdrawler or mine name writer.putString(name); //Name of depositer/withdrawler or mine name
writer.putInt(GameObjectType.Building.ordinal()); //Type writer.putInt(GameObjectType.Building.ordinal()); //Type
writer.putInt(warehouse.getBuildingUID()); //ID writer.putInt(warehouse.buildingUID); //ID
writer.putString(warehouseBuilding.getName()); //warehouse writer.putString(warehouseBuilding.getName()); //warehouse
writer.putInt(transaction.getTransactionType().getID()); //79,80 withdrew, 81 mine produced, 82 deposit writer.putInt(transaction.getTransactionType().getID()); //79,80 withdrew, 81 mine produced, 82 deposit
writer.putInt(transaction.getAmount()); //amount writer.putInt(transaction.getAmount()); //amount
@@ -89,23 +89,23 @@ public class ViewResourcesMessage extends ClientNetMsg {
@Override @Override
protected void _serialize(ByteBufferWriter writer) { protected void _serialize(ByteBufferWriter writer) {
writer.putInt(warehouseObject.getResources().size()); writer.putInt(warehouseObject.resources.size());
for (ItemBase ib : (warehouseObject.getResources().keySet())) { for (ItemBase ib : (warehouseObject.resources.keySet())) {
writer.putInt(ib.getHashID()); writer.putInt(ib.getHashID());
writer.putInt((warehouseObject.getResources().get(ib))); writer.putInt((warehouseObject.resources.get(ib)));
if (warehouseObject.isResourceLocked(ib) == true) if (Warehouse.isResourceLocked(warehouseObject, ib) == true)
writer.put((byte) 1); writer.put((byte) 1);
else else
writer.put((byte) 0); writer.put((byte) 0);
} }
writer.putInt(warehouseObject.getResources().size()); writer.putInt(warehouseObject.resources.size());
for (ItemBase ib : warehouseObject.getResources().keySet()) { for (ItemBase ib : warehouseObject.resources.keySet()) {
writer.putInt(ib.getHashID()); writer.putInt(ib.getHashID());
writer.putInt(0); //available? writer.putInt(0); //available?
writer.putInt(Warehouse.getMaxResources().get(ib.getUUID())); //max? writer.putInt(Warehouse.getMaxResources().get(ib.getUUID())); //max?
@@ -45,7 +45,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
public abstract class AbstractCharacter extends AbstractWorldObject { public abstract class AbstractCharacter extends AbstractWorldObject {
public float characterHeight = 0;
protected CharacterItemManager charItemManager; protected CharacterItemManager charItemManager;
private final ReentrantReadWriteLock healthLock = new ReentrantReadWriteLock(); private final ReentrantReadWriteLock healthLock = new ReentrantReadWriteLock();
public short level; public short level;
+5 -10
View File
@@ -14,7 +14,6 @@ import engine.Enum.*;
import engine.InterestManagement.RealmMap; import engine.InterestManagement.RealmMap;
import engine.InterestManagement.Terrain; import engine.InterestManagement.Terrain;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.collisionEngine.Mesh;
import engine.db.archive.CityRecord; import engine.db.archive.CityRecord;
import engine.db.archive.DataWarehouse; import engine.db.archive.DataWarehouse;
import engine.db.archive.MineRecord; import engine.db.archive.MineRecord;
@@ -100,8 +99,6 @@ public class Building extends AbstractWorldObject {
private ConcurrentHashMap<Integer, Condemned> condemned; private ConcurrentHashMap<Integer, Condemned> condemned;
private ArrayList<Building> children = null; private ArrayList<Building> children = null;
public ArrayList<Mesh> buildingMeshes;
/** /**
* ResultSet Constructor * ResultSet Constructor
*/ */
@@ -1006,8 +1003,6 @@ public class Building extends AbstractWorldObject {
if (this.upgradeDateTime != null) if (this.upgradeDateTime != null)
BuildingManager.submitUpgradeJob(this); BuildingManager.submitUpgradeJob(this);
BuildingManager.BakeColliders(this);
} }
public synchronized boolean setOwner(AbstractCharacter newOwner) { public synchronized boolean setOwner(AbstractCharacter newOwner) {
@@ -1434,18 +1429,18 @@ public class Building extends AbstractWorldObject {
if (this.getCity().getWarehouse() == null) if (this.getCity().getWarehouse() == null)
return amount; return amount;
if (this.getCity().getWarehouse().getResources().get(ItemBase.getGoldItemBase()) >= Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID())) if (this.getCity().getWarehouse().resources.get(ItemBase.getGoldItemBase()) >= Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID()))
return amount; return amount;
int profitAmount = (int) (amount * (taxAmount * .01f)); int profitAmount = (int) (amount * (taxAmount * .01f));
if (this.getCity().getWarehouse().getResources().get(ItemBase.getGoldItemBase()) + profitAmount <= Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID())) { if (this.getCity().getWarehouse().resources.get(ItemBase.getGoldItemBase()) + profitAmount <= Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID())) {
this.getCity().getWarehouse().depositProfitTax(ItemBase.getGoldItemBase(), profitAmount, this); Warehouse.depositProfitTax(ItemBase.getGoldItemBase(), profitAmount, this,this.getCity().getWarehouse());
return amount - profitAmount; return amount - profitAmount;
} }
//overDrafting //overDrafting
int warehouseDeposit = Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID()) - this.getCity().getWarehouse().getResources().get(ItemBase.getGoldItemBase()); int warehouseDeposit = Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID()) - this.getCity().getWarehouse().resources.get(ItemBase.getGoldItemBase());
this.getCity().getWarehouse().depositProfitTax(ItemBase.getGoldItemBase(), warehouseDeposit, this); Warehouse.depositProfitTax(ItemBase.getGoldItemBase(), warehouseDeposit, this,this.getCity().getWarehouse());
return amount - warehouseDeposit; return amount - warehouseDeposit;
} }
+3 -6
View File
@@ -12,10 +12,7 @@ package engine.objects;
import engine.Enum; import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ItemType; import engine.Enum.ItemType;
import engine.gameManager.BuildingManager; import engine.gameManager.*;
import engine.gameManager.ChatManager;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
@@ -345,13 +342,13 @@ public class CharacterItemManager {
Warehouse warehouse = (Warehouse) object; Warehouse warehouse = (Warehouse) object;
if (amount < 0) { if (amount < 0) {
if (!warehouse.deposit((PlayerCharacter) this.absCharacter, this.getGoldInventory(), amount * -1, true, true)) { if (!Warehouse.deposit((PlayerCharacter) this.absCharacter, this.getGoldInventory(), amount * -1, true, true,warehouse)) {
ErrorPopupMsg.sendErrorPopup((PlayerCharacter) this.absCharacter, 203); ErrorPopupMsg.sendErrorPopup((PlayerCharacter) this.absCharacter, 203);
return false; return false;
} }
} else { } else {
if (!warehouse.withdraw((PlayerCharacter) this.absCharacter, this.getGoldInventory().getItemBase(), amount * -1, true, true)) { if (!Warehouse.withdraw(warehouse, (PlayerCharacter) this.absCharacter, this.getGoldInventory().getItemBase(), amount * -1, true, true)) {
ErrorPopupMsg.sendErrorPopup((PlayerCharacter) this.absCharacter, 203); ErrorPopupMsg.sendErrorPopup((PlayerCharacter) this.absCharacter, 203);
return false; return false;
+3 -3
View File
@@ -1358,7 +1358,7 @@ public class City extends AbstractWorldObject {
ItemBase ib = ItemBase.getItemBase(itemBaseID); ItemBase ib = ItemBase.getItemBase(itemBaseID);
if (ib == null) if (ib == null)
continue; continue;
if (ruledWarehouse.isAboveCap(ib, (int) (city.getWarehouse().getResources().get(ib) * taxPercent))) { if (Warehouse.isAboveCap(ruledWarehouse, ib, (int) (city.getWarehouse().resources.get(ib) * taxPercent))) {
ErrorPopupMsg.sendErrorMsg(player, "You're warehouse has enough " + ib.getName() + " already!"); ErrorPopupMsg.sendErrorMsg(player, "You're warehouse has enough " + ib.getName() + " already!");
return true; return true;
} }
@@ -1371,7 +1371,7 @@ public class City extends AbstractWorldObject {
} }
try { try {
city.getWarehouse().transferResources(player, msg, resources, taxPercent, ruledWarehouse); Warehouse.transferResources(city.getWarehouse(), player, msg, resources, taxPercent);
} catch (Exception e) { } catch (Exception e) {
Logger.info(e.getMessage()); Logger.info(e.getMessage());
} }
@@ -1380,7 +1380,7 @@ public class City extends AbstractWorldObject {
ViewResourcesMessage vrm = new ViewResourcesMessage(player); ViewResourcesMessage vrm = new ViewResourcesMessage(player);
vrm.setGuild(building.getGuild()); vrm.setGuild(building.getGuild());
vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().getBuildingUID())); vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().buildingUID));
vrm.configure(); vrm.configure();
Dispatch dispatch = Dispatch.borrow(player, vrm); Dispatch dispatch = Dispatch.borrow(player, vrm);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
+47 -47
View File
@@ -119,7 +119,7 @@ public class ItemFactory {
// ROLL BANE SCROLL. // ROLL BANE SCROLL.
if (ib.getUUID() > 910010 && ib.getUUID() < 910019) { if (ib.getUUID() > 910010 && ib.getUUID() < 910019) {
ConcurrentHashMap<ItemBase, Integer> resources = cityWarehouse.getResources(); ConcurrentHashMap<ItemBase, Integer> resources = cityWarehouse.resources;
int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, ib.getBaseValue()); int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, ib.getBaseValue());
@@ -131,7 +131,7 @@ public class ItemFactory {
return null; return null;
} }
if (overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) { if (overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + " " + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + " " + ib.getName());
return null; return null;
@@ -167,9 +167,9 @@ public class ItemFactory {
} }
if (overdraft > 0) if (overdraft > 0)
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
//ChatManager.chatGuildError(pc, "Failed to create Item"); //ChatManager.chatGuildError(pc, "Failed to create Item");
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName()); Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
return null; return null;
} }
@@ -263,13 +263,13 @@ public class ItemFactory {
} }
if (galvorAmount > 0) { if (galvorAmount > 0) {
if (cityWarehouse.isResourceLocked(galvor)) { if (Warehouse.isResourceLocked(cityWarehouse, galvor)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Galvor is locked." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Galvor is locked." + ib.getName());
return null; return null;
} }
if (cityWarehouse.getResources().get(galvor) < galvorAmount) { if (cityWarehouse.resources.get(galvor) < galvorAmount) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Galvor in warehouse to roll this item." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Galvor in warehouse to roll this item." + ib.getName());
return null; return null;
@@ -277,13 +277,13 @@ public class ItemFactory {
} }
if (wormwoodAmount > 0) { if (wormwoodAmount > 0) {
if (cityWarehouse.isResourceLocked(wormwood)) { if (Warehouse.isResourceLocked(cityWarehouse, wormwood)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Wormwood is locked." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Wormwood is locked." + ib.getName());
return null; return null;
} }
if (cityWarehouse.getResources().get(wormwood) < wormwoodAmount) { if (cityWarehouse.resources.get(wormwood) < wormwoodAmount) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Wormwood in warehouse to roll this item." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Wormwood in warehouse to roll this item." + ib.getName());
return null; return null;
@@ -320,20 +320,20 @@ public class ItemFactory {
return null; return null;
} }
if (overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) { if (overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
return null; return null;
} }
if (overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) { if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName());
return null; return null;
} }
prefixResourceCosts = prefix.getResourcesForEffect(); prefixResourceCosts = prefix.getResourcesForEffect();
for (ItemBase ibResources : prefixResourceCosts.keySet()) { for (ItemBase ibResources : prefixResourceCosts.keySet()) {
int warehouseAmount = cityWarehouse.getResources().get(ibResources); int warehouseAmount = cityWarehouse.resources.get(ibResources);
int creationAmount = prefixResourceCosts.get(ibResources); int creationAmount = prefixResourceCosts.get(ibResources);
//ChatManager.chatInfoError(pc, "Prefix : " + ibResources.getName() + " / " + creationAmount); //ChatManager.chatInfoError(pc, "Prefix : " + ibResources.getName() + " / " + creationAmount);
if (warehouseAmount < creationAmount) { if (warehouseAmount < creationAmount) {
@@ -374,13 +374,13 @@ public class ItemFactory {
return null; return null;
} }
if (overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) { if (overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
return null; return null;
} }
if (overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) { if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName());
return null; return null;
@@ -388,7 +388,7 @@ public class ItemFactory {
for (ItemBase ibResources : suffixResourceCosts.keySet()) { for (ItemBase ibResources : suffixResourceCosts.keySet()) {
int warehouseAmount = cityWarehouse.getResources().get(ibResources); int warehouseAmount = cityWarehouse.resources.get(ibResources);
int creationAmount = suffixResourceCosts.get(ibResources); int creationAmount = suffixResourceCosts.get(ibResources);
if (warehouseAmount < creationAmount) { if (warehouseAmount < creationAmount) {
// if (pc != null) // if (pc != null)
@@ -414,13 +414,13 @@ public class ItemFactory {
return null; return null;
} }
if (overdraft > 0 && useWarehouse && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) { if (overdraft > 0 && useWarehouse && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
return null; return null;
} }
if (useWarehouse && overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) { if (useWarehouse && overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName());
return null; return null;
@@ -440,7 +440,7 @@ public class ItemFactory {
ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + ib.getName());
return null; return null;
} else { } else {
if (overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) { if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + ib.getName());
return null; return null;
} }
@@ -448,9 +448,9 @@ public class ItemFactory {
} }
if (overdraft > 0 && useWarehouse) if (overdraft > 0 && useWarehouse)
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
//ChatManager.chatGuildError(pc, "Failed to create Item"); //ChatManager.chatGuildError(pc, "Failed to create Item");
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName()); Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
return null; return null;
} }
@@ -467,18 +467,18 @@ public class ItemFactory {
int creationAmount = prefixResourceCosts.get(ibResources); int creationAmount = prefixResourceCosts.get(ibResources);
if (cityWarehouse.isResourceLocked(ibResources) == true) if (Warehouse.isResourceLocked(cityWarehouse, ibResources) == true)
return null; return null;
int oldAmount = cityWarehouse.getResources().get(ibResources); int oldAmount = cityWarehouse.resources.get(ibResources);
int amount = creationAmount; int amount = creationAmount;
if (oldAmount < amount) if (oldAmount < amount)
amount = oldAmount; amount = oldAmount;
if (!cityWarehouse.withdraw(npc, ibResources, amount, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, ibResources, amount, true)) {
//ChatManager.chatGuildError(pc, "Failed to create Item"); //ChatManager.chatGuildError(pc, "Failed to create Item");
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName()); Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
return null; return null;
} }
} }
@@ -489,18 +489,18 @@ public class ItemFactory {
for (ItemBase ibResources : suffixResourceCosts.keySet()) { for (ItemBase ibResources : suffixResourceCosts.keySet()) {
int creationAmount = suffixResourceCosts.get(ibResources); int creationAmount = suffixResourceCosts.get(ibResources);
if (cityWarehouse.isResourceLocked(ibResources) == true) { if (Warehouse.isResourceLocked(cityWarehouse, ibResources) == true) {
ChatManager.chatSystemError(pc, ibResources.getName() + " is locked!" + ib.getName()); ChatManager.chatSystemError(pc, ibResources.getName() + " is locked!" + ib.getName());
return null; return null;
} }
int oldAmount = cityWarehouse.getResources().get(ibResources); int oldAmount = cityWarehouse.resources.get(ibResources);
int amount = creationAmount; int amount = creationAmount;
if (oldAmount < amount) if (oldAmount < amount)
amount = oldAmount; amount = oldAmount;
if (!cityWarehouse.withdraw(npc, ibResources, amount, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, ibResources, amount, true)) {
//ChatManager.chatGuildError(pc, "Failed to create Item"); //ChatManager.chatGuildError(pc, "Failed to create Item");
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName()); Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
return null; return null;
} }
} }
@@ -522,14 +522,14 @@ public class ItemFactory {
return null; return null;
} }
if (overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) { if (overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
return null; return null;
} }
if (useWarehouse && overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) { if (useWarehouse && overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName());
@@ -544,7 +544,7 @@ public class ItemFactory {
ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + ib.getName());
return null; return null;
} else { } else {
if (overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) { if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + ib.getName());
return null; return null;
} }
@@ -552,16 +552,16 @@ public class ItemFactory {
} }
if (overdraft > 0) if (overdraft > 0)
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
//ChatManager.chatGuildError(pc, "Failed to create Item"); //ChatManager.chatGuildError(pc, "Failed to create Item");
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName()); Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
return null; return null;
} }
// ChatManager.chatGuildInfo(pc, "Gold Cost = " + total); // ChatManager.chatGuildInfo(pc, "Gold Cost = " + total);
if (galvorAmount > 0) { if (galvorAmount > 0) {
if (!cityWarehouse.withdraw(npc, galvor, galvorAmount, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, galvor, galvorAmount, true)) {
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + ib.getName());
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
return null; return null;
@@ -569,7 +569,7 @@ public class ItemFactory {
} }
if (wormwoodAmount > 0) { if (wormwoodAmount > 0) {
if (!cityWarehouse.withdraw(npc, wormwood, wormwoodAmount, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, wormwood, wormwoodAmount, true)) {
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse!" + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse!" + ib.getName());
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
return null; return null;
@@ -815,7 +815,7 @@ public class ItemFactory {
ConcurrentHashMap<ItemBase, Integer> resources = null; ConcurrentHashMap<ItemBase, Integer> resources = null;
if (useWarehouse) if (useWarehouse)
resources = cityWarehouse.getResources(); resources = cityWarehouse.resources;
int galvorAmount = 0; int galvorAmount = 0;
int wormwoodAmount = 0; int wormwoodAmount = 0;
@@ -852,24 +852,24 @@ public class ItemFactory {
return null; return null;
if (galvorAmount > 0) { if (galvorAmount > 0) {
if (cityWarehouse.isResourceLocked(galvor)) { if (Warehouse.isResourceLocked(cityWarehouse, galvor)) {
ErrorPopupMsg.sendErrorMsg(pc, "Galvor is locked." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Galvor is locked." + ib.getName());
return null; return null;
} }
if (cityWarehouse.getResources().get(galvor) < galvorAmount) { if (cityWarehouse.resources.get(galvor) < galvorAmount) {
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Galvor in warehouse to roll this item." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Galvor in warehouse to roll this item." + ib.getName());
return null; return null;
} }
} }
if (wormwoodAmount > 0) { if (wormwoodAmount > 0) {
if (cityWarehouse.isResourceLocked(wormwood)) { if (Warehouse.isResourceLocked(cityWarehouse, wormwood)) {
ErrorPopupMsg.sendErrorMsg(pc, "Galvor is locked." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Galvor is locked." + ib.getName());
return null; return null;
} }
if (cityWarehouse.getResources().get(wormwood) < wormwoodAmount) { if (cityWarehouse.resources.get(wormwood) < wormwoodAmount) {
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Galvor in warehouse to roll this item." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Not enough Galvor in warehouse to roll this item." + ib.getName());
return null; return null;
} }
@@ -908,7 +908,7 @@ public class ItemFactory {
return null; return null;
} }
if (useWarehouse && overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) { if (useWarehouse && overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
return null; return null;
@@ -936,12 +936,12 @@ public class ItemFactory {
// there was an overdraft, withdraw the rest from warehouse. // there was an overdraft, withdraw the rest from warehouse.
if (overdraft > 0) { if (overdraft > 0) {
if (pc != null) { if (pc != null) {
if (!cityWarehouse.withdraw(pc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) { if (!Warehouse.withdraw(cityWarehouse, pc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
return null; return null;
} }
} else { } else {
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
return null; return null;
} }
@@ -959,7 +959,7 @@ public class ItemFactory {
return null; return null;
} }
if (useWarehouse && overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) { if (useWarehouse && overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
if (pc != null) if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
return null; return null;
@@ -987,12 +987,12 @@ public class ItemFactory {
if (overdraft > 0 && useWarehouse) { if (overdraft > 0 && useWarehouse) {
if (pc != null) { if (pc != null) {
if (!cityWarehouse.withdraw(pc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) { if (!Warehouse.withdraw(cityWarehouse, pc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
return null; return null;
} }
} else { } else {
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
return null; return null;
} }
@@ -1002,7 +1002,7 @@ public class ItemFactory {
if (galvorAmount > 0 && useWarehouse) { if (galvorAmount > 0 && useWarehouse) {
//ChatManager.chatGuildInfo(pc, "Withdrawing " + galvorAmount + " galvor from warehouse"); //ChatManager.chatGuildInfo(pc, "Withdrawing " + galvorAmount + " galvor from warehouse");
if (!cityWarehouse.withdraw(npc, galvor, galvorAmount, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, galvor, galvorAmount, true)) {
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + ib.getName());
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
return null; return null;
@@ -1011,7 +1011,7 @@ public class ItemFactory {
if (wormwoodAmount > 0 && useWarehouse) { if (wormwoodAmount > 0 && useWarehouse) {
//ChatManager.chatGuildInfo(pc, "Withdrawing " + wormwoodAmount + " wormwood from warehouse"); //ChatManager.chatGuildInfo(pc, "Withdrawing " + wormwoodAmount + " wormwood from warehouse");
if (!cityWarehouse.withdraw(npc, wormwood, wormwoodAmount, false, true)) { if (!Warehouse.withdraw(cityWarehouse, npc, wormwood, wormwoodAmount, true)) {
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse for " + ib.getName()); ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse for " + ib.getName());
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
+2 -5
View File
@@ -11,10 +11,7 @@ package engine.objects;
import engine.Enum; import engine.Enum;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.gameManager.BuildingManager; import engine.gameManager.*;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.net.ByteBufferWriter; import engine.net.ByteBufferWriter;
import engine.net.client.msg.ErrorPopupMsg; import engine.net.client.msg.ErrorPopupMsg;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
@@ -483,7 +480,7 @@ public class Mine extends AbstractGameObject {
return false; return false;
ItemBase resourceIB = ItemBase.getItemBase(this.production.UUID); ItemBase resourceIB = ItemBase.getItemBase(this.production.UUID);
return this.owningGuild.getOwnedCity().getWarehouse().depositFromMine(this, resourceIB, this.getModifiedProductionAmount()); return Warehouse.depositFromMine(this, resourceIB, this.getModifiedProductionAmount(),this.owningGuild.getOwnedCity().getWarehouse());
} }
public boolean updateGuildOwner(PlayerCharacter playerCharacter) { public boolean updateGuildOwner(PlayerCharacter playerCharacter) {
+19 -2
View File
@@ -406,7 +406,6 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
Mob mobile = new Mob(); Mob mobile = new Mob();
mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET; mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
//mobile.agentType = AIAgentType.MOBILE; this method is only called to make guard captains and wall archers
mobile.agentType = mobType; mobile.agentType = mobType;
mobile.behaviourType = MobBehaviourType.None; mobile.behaviourType = MobBehaviourType.None;
mobile.loadID = loadID; mobile.loadID = loadID;
@@ -418,12 +417,17 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
mobile.guildUUID = guild.getObjectUUID(); mobile.guildUUID = guild.getObjectUUID();
mobile.parentZoneUUID = parent.getObjectUUID(); mobile.parentZoneUUID = parent.getObjectUUID();
if (building == null)
mobile.buildingUUID = 0;
else
mobile.buildingUUID = building.getObjectUUID(); mobile.buildingUUID = building.getObjectUUID();
if (mobile.buildingUUID != 0) if (mobile.buildingUUID != 0)
mobile.bindLoc = Vector3fImmutable.ZERO; mobile.bindLoc = Vector3fImmutable.ZERO;
else else
mobile.bindLoc = spawn; mobile.bindLoc = ZoneManager.worldToLocal(spawn, parent);
;
mobile.firstName = pirateName; mobile.firstName = pirateName;
@@ -1889,6 +1893,19 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
} }
} }
public Boolean isGuard(){
switch(this.behaviourType){
case GuardMinion:
case GuardCaptain:
case GuardWallArcher:
case HamletGuard:
case SimpleStandingGuard:
return true;
}
return false;
}
@Override @Override
public long getDelay(@NotNull TimeUnit unit) { public long getDelay(@NotNull TimeUnit unit) {
long timeRemaining = this.respawnTime - System.currentTimeMillis(); long timeRemaining = this.respawnTime - System.currentTimeMillis();
+6 -2
View File
@@ -461,15 +461,19 @@ public class NPC extends AbstractCharacter {
NPC newNPC = new NPC(); NPC newNPC = new NPC();
newNPC.parentZoneUUID = parent.getObjectUUID();
newNPC.name = name; newNPC.name = name;
newNPC.contractUUID = contractID; newNPC.contractUUID = contractID;
if (building == null) if (building == null)
newNPC.bindLoc = spawn; newNPC.bindLoc = ZoneManager.worldToLocal(spawn, parent);
else else
newNPC.bindLoc = Vector3fImmutable.ZERO; newNPC.bindLoc = Vector3fImmutable.ZERO;
newNPC.parentZoneUUID = parent.getObjectUUID(); if (guild == null)
newNPC.guildUUID = 0;
else
newNPC.guildUUID = guild.getObjectUUID(); newNPC.guildUUID = guild.getObjectUUID();
if (building == null) if (building == null)
+5
View File
@@ -165,6 +165,7 @@ public class PlayerCharacter extends AbstractCharacter {
private boolean wasTripped75 = false; private boolean wasTripped75 = false;
private boolean wasTripped50 = false; private boolean wasTripped50 = false;
private boolean wasTripped25 = false; private boolean wasTripped25 = false;
private float characterHeight = 0;
private boolean lastSwimming = false; private boolean lastSwimming = false;
private boolean isTeleporting = false; private boolean isTeleporting = false;
private boolean dirtyLoad = true; private boolean dirtyLoad = true;
@@ -5426,6 +5427,10 @@ public class PlayerCharacter extends AbstractCharacter {
this.lastStamUpdateTime = System.currentTimeMillis(); this.lastStamUpdateTime = System.currentTimeMillis();
} }
public float getCharacterHeight() {
return characterHeight;
}
public boolean isEnteredWorld() { public boolean isEnteredWorld() {
return enteredWorld; return enteredWorld;
} }
File diff suppressed because it is too large Load Diff
-4
View File
@@ -315,10 +315,6 @@ public class WorldServer {
Logger.info("Initializing PowersManager."); Logger.info("Initializing PowersManager.");
PowersManager.initPowersManager(true); PowersManager.initPowersManager(true);
Logger.info("Loading Collider Data");
DbManager.BuildingQueries.LOAD_MESH_TRIANGLES();
DbManager.BuildingQueries.LOAD_STRUCTURE_MESHES();
Logger.info("Loading granted Skills for Runes"); Logger.info("Loading granted Skills for Runes");
DbManager.SkillsBaseQueries.LOAD_ALL_RUNE_SKILLS(); DbManager.SkillsBaseQueries.LOAD_ALL_RUNE_SKILLS();