Project cleanup pre merge.
This commit is contained in:
@@ -100,7 +100,7 @@ public class HeightMap {
|
||||
float numOfBuckets = this.heightmapImage.getWidth() - 1;
|
||||
float calculatedWidth = this.fullExtentsX / numOfBuckets;
|
||||
this.bucketWidthX = calculatedWidth;
|
||||
this.bucketWidthY = this.bucketWidthX; // This makes no sense.
|
||||
this.bucketWidthY = this.bucketWidthX; // This makes no sense.
|
||||
|
||||
// Generate pixel array from image data
|
||||
|
||||
@@ -142,7 +142,7 @@ public class HeightMap {
|
||||
this.bucketWidthX = 1;
|
||||
this.bucketWidthY = 1;
|
||||
|
||||
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY+1];
|
||||
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
||||
|
||||
for (int y = 0; y <= this.fullExtentsY; y++) {
|
||||
for (int x = 0; x <= this.fullExtentsX; x++) {
|
||||
@@ -153,7 +153,7 @@ public class HeightMap {
|
||||
|
||||
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
|
||||
}
|
||||
|
||||
|
||||
public HeightMap(Zone zone) {
|
||||
|
||||
this.heightMapID = 999999;
|
||||
@@ -180,7 +180,7 @@ public class HeightMap {
|
||||
this.bucketWidthX = 1;
|
||||
this.bucketWidthY = 1;
|
||||
|
||||
this.pixelColorValues = new int[this.fullExtentsX+1][this.fullExtentsY+1];
|
||||
this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
|
||||
|
||||
for (int y = 0; y <= this.fullExtentsY; y++) {
|
||||
for (int x = 0; x <= this.fullExtentsX; x++) {
|
||||
@@ -197,97 +197,15 @@ public class HeightMap {
|
||||
HeightMap.PlayerCityHeightMap = new HeightMap();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void GenerateCustomHeightMap(Zone zone) {
|
||||
|
||||
HeightMap heightMap = new HeightMap(zone);
|
||||
|
||||
|
||||
HeightMap.heightmapByLoadNum.put(zone.getLoadNum(), heightMap);
|
||||
|
||||
}
|
||||
|
||||
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
||||
|
||||
if (zoneLoc.x < 0)
|
||||
zoneLoc.setX(0);
|
||||
|
||||
if (zoneLoc.x > this.fullExtentsX - 1)
|
||||
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
|
||||
|
||||
if (zoneLoc.y < 0)
|
||||
zoneLoc.setY(0);
|
||||
|
||||
if (zoneLoc.y > this.fullExtentsY - 1)
|
||||
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
|
||||
|
||||
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
||||
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
||||
|
||||
return new Vector2f(xBucket, yBucket);
|
||||
}
|
||||
|
||||
public float getInterpolatedTerrainHeight(Vector2f zoneLoc) {
|
||||
|
||||
Vector2f gridSquare;
|
||||
|
||||
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||
return -1;
|
||||
|
||||
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||
return -1;
|
||||
|
||||
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
||||
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
||||
|
||||
//flip the Y so it grabs from the bottom left instead of top left.
|
||||
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||
|
||||
gridSquare = getGridSquare(zoneLoc);
|
||||
|
||||
int gridX = (int) gridSquare.x;
|
||||
int gridY = (int) (gridSquare.y);
|
||||
|
||||
if (gridX > maxX)
|
||||
gridX = maxX;
|
||||
if (gridY > maxY)
|
||||
gridY = maxY;
|
||||
|
||||
float offsetX = (gridSquare.x - gridX);
|
||||
float offsetY = gridSquare.y - gridY;
|
||||
|
||||
//get height of the 4 vertices.
|
||||
|
||||
float topLeftHeight = 0;
|
||||
float topRightHeight = 0;
|
||||
float bottomLeftHeight = 0;
|
||||
float bottomRightHeight = 0;
|
||||
|
||||
int nextY = gridY +1;
|
||||
int nextX = gridX + 1;
|
||||
|
||||
if (nextY > maxY)
|
||||
nextY = gridY;
|
||||
|
||||
if (nextX > maxX)
|
||||
nextX = gridX;
|
||||
|
||||
topLeftHeight = pixelColorValues[gridX][gridY];
|
||||
topRightHeight = pixelColorValues[nextX][gridY];
|
||||
bottomLeftHeight = pixelColorValues[gridX][nextY];
|
||||
bottomRightHeight = pixelColorValues[nextX][nextY];
|
||||
|
||||
float interpolatedHeight;
|
||||
|
||||
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||
|
||||
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||
|
||||
return interpolatedHeight;
|
||||
}
|
||||
|
||||
public static Zone getNextZoneWithTerrain(Zone zone) {
|
||||
|
||||
Zone nextZone = zone;
|
||||
@@ -505,48 +423,6 @@ public class HeightMap {
|
||||
return realWorldAltitude;
|
||||
}
|
||||
|
||||
public float getInterpolatedTerrainHeight(Vector3fImmutable zoneLoc3f) {
|
||||
|
||||
Vector2f zoneLoc = new Vector2f(zoneLoc3f.x, zoneLoc3f.z);
|
||||
|
||||
Vector2f gridSquare;
|
||||
|
||||
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||
return -1;
|
||||
|
||||
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||
return -1;
|
||||
|
||||
//flip the Y so it grabs from the bottom left instead of top left.
|
||||
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||
|
||||
gridSquare = getGridSquare(zoneLoc);
|
||||
|
||||
int gridX = (int) gridSquare.x;
|
||||
int gridY = (int) (gridSquare.y);
|
||||
|
||||
float offsetX = (gridSquare.x - gridX);
|
||||
float offsetY = gridSquare.y - gridY;
|
||||
|
||||
//get height of the 4 vertices.
|
||||
|
||||
float topLeftHeight = pixelColorValues[gridX][gridY];
|
||||
float topRightHeight = pixelColorValues[gridX + 1][gridY];
|
||||
float bottomLeftHeight = pixelColorValues[gridX][gridY + 1];
|
||||
float bottomRightHeight = pixelColorValues[gridX + 1][gridY + 1];
|
||||
|
||||
float interpolatedHeight;
|
||||
|
||||
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||
|
||||
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||
|
||||
return interpolatedHeight;
|
||||
}
|
||||
|
||||
public static float getOutsetHeight(float interpolatedAltitude, Zone zone, Vector3fImmutable worldLocation) {
|
||||
|
||||
Vector2f parentLoc;
|
||||
@@ -620,6 +496,170 @@ public class HeightMap {
|
||||
return outsetALt;
|
||||
}
|
||||
|
||||
public static Vector2f getGridOffset(Vector2f gridSquare) {
|
||||
|
||||
int floorX = (int) gridSquare.x;
|
||||
int floorY = (int) gridSquare.y;
|
||||
|
||||
return new Vector2f(gridSquare.x - floorX, gridSquare.y - floorY);
|
||||
|
||||
}
|
||||
|
||||
public static void loadAlHeightMaps() {
|
||||
|
||||
// Load the heightmaps into staging hashmap keyed by HashMapID
|
||||
|
||||
DbManager.HeightMapQueries.LOAD_ALL_HEIGHTMAPS();
|
||||
|
||||
//generate static player city heightmap.
|
||||
|
||||
HeightMap.GeneratePlayerCityHeightMap();
|
||||
|
||||
|
||||
// Clear all heightmap image data as it's no longer needed.
|
||||
|
||||
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
|
||||
heightMap.heightmapImage = null;
|
||||
}
|
||||
|
||||
Logger.info(HeightMap.heightmapByLoadNum.size() + " Heightmaps cached.");
|
||||
}
|
||||
|
||||
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
|
||||
|
||||
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
||||
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
||||
|
||||
if (localAltitude < zone.getSeaLevel())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
||||
|
||||
if (zoneLoc.x < 0)
|
||||
zoneLoc.setX(0);
|
||||
|
||||
if (zoneLoc.x > this.fullExtentsX - 1)
|
||||
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
|
||||
|
||||
if (zoneLoc.y < 0)
|
||||
zoneLoc.setY(0);
|
||||
|
||||
if (zoneLoc.y > this.fullExtentsY - 1)
|
||||
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
|
||||
|
||||
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
||||
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
||||
|
||||
return new Vector2f(xBucket, yBucket);
|
||||
}
|
||||
|
||||
public float getInterpolatedTerrainHeight(Vector2f zoneLoc) {
|
||||
|
||||
Vector2f gridSquare;
|
||||
|
||||
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||
return -1;
|
||||
|
||||
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||
return -1;
|
||||
|
||||
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
||||
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
||||
|
||||
//flip the Y so it grabs from the bottom left instead of top left.
|
||||
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||
|
||||
gridSquare = getGridSquare(zoneLoc);
|
||||
|
||||
int gridX = (int) gridSquare.x;
|
||||
int gridY = (int) (gridSquare.y);
|
||||
|
||||
if (gridX > maxX)
|
||||
gridX = maxX;
|
||||
if (gridY > maxY)
|
||||
gridY = maxY;
|
||||
|
||||
float offsetX = (gridSquare.x - gridX);
|
||||
float offsetY = gridSquare.y - gridY;
|
||||
|
||||
//get height of the 4 vertices.
|
||||
|
||||
float topLeftHeight = 0;
|
||||
float topRightHeight = 0;
|
||||
float bottomLeftHeight = 0;
|
||||
float bottomRightHeight = 0;
|
||||
|
||||
int nextY = gridY + 1;
|
||||
int nextX = gridX + 1;
|
||||
|
||||
if (nextY > maxY)
|
||||
nextY = gridY;
|
||||
|
||||
if (nextX > maxX)
|
||||
nextX = gridX;
|
||||
|
||||
topLeftHeight = pixelColorValues[gridX][gridY];
|
||||
topRightHeight = pixelColorValues[nextX][gridY];
|
||||
bottomLeftHeight = pixelColorValues[gridX][nextY];
|
||||
bottomRightHeight = pixelColorValues[nextX][nextY];
|
||||
|
||||
float interpolatedHeight;
|
||||
|
||||
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||
|
||||
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||
|
||||
return interpolatedHeight;
|
||||
}
|
||||
|
||||
public float getInterpolatedTerrainHeight(Vector3fImmutable zoneLoc3f) {
|
||||
|
||||
Vector2f zoneLoc = new Vector2f(zoneLoc3f.x, zoneLoc3f.z);
|
||||
|
||||
Vector2f gridSquare;
|
||||
|
||||
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||
return -1;
|
||||
|
||||
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||
return -1;
|
||||
|
||||
//flip the Y so it grabs from the bottom left instead of top left.
|
||||
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||
|
||||
gridSquare = getGridSquare(zoneLoc);
|
||||
|
||||
int gridX = (int) gridSquare.x;
|
||||
int gridY = (int) (gridSquare.y);
|
||||
|
||||
float offsetX = (gridSquare.x - gridX);
|
||||
float offsetY = gridSquare.y - gridY;
|
||||
|
||||
//get height of the 4 vertices.
|
||||
|
||||
float topLeftHeight = pixelColorValues[gridX][gridY];
|
||||
float topRightHeight = pixelColorValues[gridX + 1][gridY];
|
||||
float bottomLeftHeight = pixelColorValues[gridX][gridY + 1];
|
||||
float bottomRightHeight = pixelColorValues[gridX + 1][gridY + 1];
|
||||
|
||||
float interpolatedHeight;
|
||||
|
||||
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||
|
||||
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||
|
||||
return interpolatedHeight;
|
||||
}
|
||||
|
||||
private void generatePixelData() {
|
||||
|
||||
Color color;
|
||||
@@ -638,40 +678,11 @@ public class HeightMap {
|
||||
|
||||
}
|
||||
|
||||
public static Vector2f getGridOffset(Vector2f gridSquare) {
|
||||
|
||||
int floorX = (int) gridSquare.x;
|
||||
int floorY = (int) gridSquare.y;
|
||||
|
||||
return new Vector2f(gridSquare.x - floorX, gridSquare.y - floorY);
|
||||
|
||||
}
|
||||
|
||||
public float getScaledHeightForColor(float color) {
|
||||
|
||||
return (color / 256) * this.maxHeight;
|
||||
}
|
||||
|
||||
public static void loadAlHeightMaps() {
|
||||
|
||||
// Load the heightmaps into staging hashmap keyed by HashMapID
|
||||
|
||||
DbManager.HeightMapQueries.LOAD_ALL_HEIGHTMAPS();
|
||||
|
||||
//generate static player city heightmap.
|
||||
|
||||
HeightMap.GeneratePlayerCityHeightMap();
|
||||
|
||||
|
||||
// Clear all heightmap image data as it's no longer needed.
|
||||
|
||||
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
|
||||
heightMap.heightmapImage = null;
|
||||
}
|
||||
|
||||
Logger.info(HeightMap.heightmapByLoadNum.size() + " Heightmaps cached.");
|
||||
}
|
||||
|
||||
public float getBucketWidthX() {
|
||||
return bucketWidthX;
|
||||
}
|
||||
@@ -692,15 +703,4 @@ public class HeightMap {
|
||||
return seaLevel;
|
||||
}
|
||||
|
||||
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
|
||||
|
||||
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
||||
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
||||
|
||||
if (localAltitude < zone.getSeaLevel())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,14 +38,128 @@ public enum InterestManager implements Runnable {
|
||||
private static long lastTime;
|
||||
private static boolean keepGoing = true;
|
||||
|
||||
public void shutdown() {
|
||||
this.keepGoing = false;
|
||||
}
|
||||
|
||||
InterestManager() {
|
||||
Logger.info(" Interest Management thread is running.");
|
||||
}
|
||||
|
||||
public static void forceLoad(AbstractWorldObject awo) {
|
||||
|
||||
AbstractNetMsg msg = null;
|
||||
LoadStructureMsg lsm;
|
||||
LoadCharacterMsg lcm;
|
||||
NPC npc;
|
||||
Corpse corpse;
|
||||
HashSet<AbstractWorldObject> toUpdate;
|
||||
|
||||
switch (awo.getObjectType()) {
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building) awo);
|
||||
msg = lsm;
|
||||
break;
|
||||
case Corpse:
|
||||
corpse = (Corpse) awo;
|
||||
lcm = new LoadCharacterMsg(corpse, false);
|
||||
msg = lcm;
|
||||
break;
|
||||
case NPC:
|
||||
npc = (NPC) awo;
|
||||
lcm = new LoadCharacterMsg(npc, false);
|
||||
msg = lcm;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
toUpdate = WorldGrid.getObjectsInRangePartial(awo.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
||||
|
||||
boolean send;
|
||||
|
||||
for (AbstractWorldObject tar : toUpdate) {
|
||||
PlayerCharacter player = (PlayerCharacter) tar;
|
||||
HashSet<AbstractWorldObject> loadedStaticObjects = player.getLoadedStaticObjects();
|
||||
send = false;
|
||||
|
||||
if (!loadedStaticObjects.contains(awo)) {
|
||||
loadedStaticObjects.add(awo);
|
||||
send = true;
|
||||
}
|
||||
|
||||
if (send) {
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void HandleSpecialUnload(Building building, ClientConnection origin) {
|
||||
|
||||
if (Regions.FurnitureRegionMap.get(building.getObjectUUID()) == null)
|
||||
return;
|
||||
|
||||
Regions buildingRegion = Regions.FurnitureRegionMap.get(building.getObjectUUID());
|
||||
|
||||
if (!buildingRegion.isOutside())
|
||||
return;
|
||||
|
||||
MoveToPointMsg moveMsg = new MoveToPointMsg(building);
|
||||
|
||||
if (origin != null)
|
||||
origin.sendMsg(moveMsg);
|
||||
}
|
||||
|
||||
public static void reloadCharacter(AbstractCharacter absChar) {
|
||||
|
||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||
uom.addObject(absChar);
|
||||
LoadCharacterMsg lcm = new LoadCharacterMsg(absChar, false);
|
||||
|
||||
HashSet<AbstractWorldObject> toSend = WorldGrid.getObjectsInRangePartial(absChar.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE,
|
||||
MBServerStatics.MASK_PLAYER);
|
||||
|
||||
PlayerCharacter pc = null;
|
||||
|
||||
if (absChar.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
pc = (PlayerCharacter) absChar;
|
||||
|
||||
for (AbstractWorldObject awo : toSend) {
|
||||
|
||||
PlayerCharacter pcc = (PlayerCharacter) awo;
|
||||
|
||||
if (pcc == null)
|
||||
continue;
|
||||
|
||||
ClientConnection cc = SessionManager.getClientConnection(pcc);
|
||||
|
||||
if (cc == null)
|
||||
continue;
|
||||
|
||||
if (pcc.getObjectUUID() == absChar.getObjectUUID())
|
||||
continue;
|
||||
|
||||
else {
|
||||
if (pc != null)
|
||||
if (pcc.getSeeInvis() < pc.getHidden())
|
||||
continue;
|
||||
|
||||
if (!cc.sendMsg(uom)) {
|
||||
String classType = uom.getClass().getSimpleName();
|
||||
Logger.error("Failed to send message ");
|
||||
}
|
||||
|
||||
if (!cc.sendMsg(lcm)) {
|
||||
String classType = lcm.getClass().getSimpleName();
|
||||
Logger.error("Failed to send message");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
this.keepGoing = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
beginLoadJob();
|
||||
@@ -84,6 +198,9 @@ public enum InterestManager implements Runnable {
|
||||
return dur;
|
||||
}
|
||||
|
||||
// Forces the loading of static objects (corpses and buildings).
|
||||
// Needed to override threshold limits on loading statics
|
||||
|
||||
private void updateAllPlayers() {
|
||||
// get all players
|
||||
|
||||
@@ -341,7 +458,7 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||
//MobileFSM.setAwake(awonpc, false);
|
||||
((Mob)awonpc).setCombatTarget(null);
|
||||
((Mob) awonpc).setCombatTarget(null);
|
||||
// IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000));
|
||||
// awonpc.enableIntelligence();
|
||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||
@@ -358,7 +475,7 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
if (awonpc.isMob())
|
||||
//MobileFSM.setAwake(awonpc, false);
|
||||
((Mob)awonpc).setCombatTarget(null);
|
||||
((Mob) awonpc).setCombatTarget(null);
|
||||
// IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000));
|
||||
// awonpc.enableIntelligence();
|
||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||
@@ -385,76 +502,6 @@ public enum InterestManager implements Runnable {
|
||||
//JobScheduler.getInstance().scheduleJob(new LoadEffectsJob(players, origin), MBServerStatics.LOAD_OBJECT_DELAY);
|
||||
}
|
||||
|
||||
// Forces the loading of static objects (corpses and buildings).
|
||||
// Needed to override threshold limits on loading statics
|
||||
|
||||
public static void forceLoad(AbstractWorldObject awo) {
|
||||
|
||||
AbstractNetMsg msg = null;
|
||||
LoadStructureMsg lsm;
|
||||
LoadCharacterMsg lcm;
|
||||
NPC npc;
|
||||
Corpse corpse;
|
||||
HashSet<AbstractWorldObject> toUpdate;
|
||||
|
||||
switch (awo.getObjectType()) {
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building) awo);
|
||||
msg = lsm;
|
||||
break;
|
||||
case Corpse:
|
||||
corpse = (Corpse) awo;
|
||||
lcm = new LoadCharacterMsg(corpse, false);
|
||||
msg = lcm;
|
||||
break;
|
||||
case NPC:
|
||||
npc = (NPC) awo;
|
||||
lcm = new LoadCharacterMsg(npc, false);
|
||||
msg = lcm;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
toUpdate = WorldGrid.getObjectsInRangePartial(awo.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
||||
|
||||
boolean send;
|
||||
|
||||
for (AbstractWorldObject tar : toUpdate) {
|
||||
PlayerCharacter player = (PlayerCharacter) tar;
|
||||
HashSet<AbstractWorldObject> loadedStaticObjects = player.getLoadedStaticObjects();
|
||||
send = false;
|
||||
|
||||
if (!loadedStaticObjects.contains(awo)) {
|
||||
loadedStaticObjects.add(awo);
|
||||
send = true;
|
||||
}
|
||||
|
||||
if (send) {
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void HandleSpecialUnload(Building building, ClientConnection origin) {
|
||||
|
||||
if (Regions.FurnitureRegionMap.get(building.getObjectUUID()) == null)
|
||||
return;
|
||||
|
||||
Regions buildingRegion = Regions.FurnitureRegionMap.get(building.getObjectUUID());
|
||||
|
||||
if (!buildingRegion.isOutside())
|
||||
return;
|
||||
|
||||
MoveToPointMsg moveMsg = new MoveToPointMsg(building);
|
||||
|
||||
if (origin != null)
|
||||
origin.sendMsg(moveMsg);
|
||||
}
|
||||
|
||||
public synchronized void HandleLoadForEnterWorld(PlayerCharacter player) {
|
||||
|
||||
if (player == null)
|
||||
@@ -504,51 +551,4 @@ public enum InterestManager implements Runnable {
|
||||
Logger.error("InterestManager.updateAllMobilePlayers: " + player.getObjectUUID(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void reloadCharacter(AbstractCharacter absChar) {
|
||||
|
||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||
uom.addObject(absChar);
|
||||
LoadCharacterMsg lcm = new LoadCharacterMsg(absChar, false);
|
||||
|
||||
HashSet<AbstractWorldObject> toSend = WorldGrid.getObjectsInRangePartial(absChar.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE,
|
||||
MBServerStatics.MASK_PLAYER);
|
||||
|
||||
PlayerCharacter pc = null;
|
||||
|
||||
if (absChar.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
pc = (PlayerCharacter) absChar;
|
||||
|
||||
for (AbstractWorldObject awo : toSend) {
|
||||
|
||||
PlayerCharacter pcc = (PlayerCharacter) awo;
|
||||
|
||||
if (pcc == null)
|
||||
continue;
|
||||
|
||||
ClientConnection cc = SessionManager.getClientConnection(pcc);
|
||||
|
||||
if (cc == null)
|
||||
continue;
|
||||
|
||||
if (pcc.getObjectUUID() == absChar.getObjectUUID())
|
||||
continue;
|
||||
|
||||
else {
|
||||
if (pc != null)
|
||||
if (pcc.getSeeInvis() < pc.getHidden())
|
||||
continue;
|
||||
|
||||
if (!cc.sendMsg(uom)) {
|
||||
String classType = uom.getClass().getSimpleName();
|
||||
Logger.error("Failed to send message ");
|
||||
}
|
||||
|
||||
if (!cc.sendMsg(lcm)) {
|
||||
String classType = lcm.getClass().getSimpleName();
|
||||
Logger.error("Failed to send message");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,8 +36,8 @@ public enum RealmMap {
|
||||
// Spatial hashmap. Used for determining which Realm
|
||||
// a player is currently located within.
|
||||
|
||||
public static int[][] _realmImageMap;
|
||||
private static final HashMap<Color, Integer> _rgbToIDMap = new HashMap<>();
|
||||
public static int[][] _realmImageMap;
|
||||
|
||||
public static int getRealmIDByColor(Color color) {
|
||||
|
||||
|
||||
@@ -25,177 +25,177 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
public class WorldGrid {
|
||||
|
||||
public static ConcurrentHashMap<Integer,AbstractWorldObject>[][] DynamicGridMap;
|
||||
public static ConcurrentHashMap<Integer,AbstractWorldObject>[][] StaticGridMap;
|
||||
private static float dynamicBucketScale = 0.00390625f; // 256 bucket size, 1/256
|
||||
private static float staticBucketScale = 0.00390625f;
|
||||
public static void startLoadJob() {
|
||||
|
||||
Thread loadJobThread;
|
||||
|
||||
|
||||
loadJobThread = new Thread(InterestManager.INTERESTMANAGER);
|
||||
loadJobThread.setName("InterestManager");
|
||||
loadJobThread.start();
|
||||
}
|
||||
public static ConcurrentHashMap<Integer, AbstractWorldObject>[][] DynamicGridMap;
|
||||
public static ConcurrentHashMap<Integer, AbstractWorldObject>[][] StaticGridMap;
|
||||
private static float dynamicBucketScale = 0.00390625f; // 256 bucket size, 1/256
|
||||
private static float staticBucketScale = 0.00390625f;
|
||||
|
||||
public static boolean moveWorldObject(AbstractWorldObject awo, Vector3fImmutable location) {
|
||||
awo.setLoc(location);
|
||||
return true;
|
||||
}
|
||||
public static void startLoadJob() {
|
||||
|
||||
public static HashSet<AbstractWorldObject> getInRange(Vector3f loc, double r) {
|
||||
HashSet<AbstractWorldObject> outbound = new HashSet<>();
|
||||
return outbound;
|
||||
}
|
||||
Thread loadJobThread;
|
||||
|
||||
public static HashSet<AbstractWorldObject> getObjectsInRangePartial(Vector3fImmutable loc, double r, int mask) {
|
||||
HashSet<AbstractWorldObject> outbound = new HashSet<>();
|
||||
float scale;
|
||||
|
||||
if ((mask & MBServerStatics.MASK_STATIC) != 0)
|
||||
scale = WorldGrid.staticBucketScale;
|
||||
else
|
||||
scale = WorldGrid.dynamicBucketScale;
|
||||
int gridX = (int) Math.abs(loc.x * scale);
|
||||
int gridZ = (int)Math.abs(loc.z * scale);
|
||||
int bucketSize = (int) (r *scale) + 1;
|
||||
//start at top left most corner to scan.
|
||||
int startingX = gridX - bucketSize;
|
||||
int startingZ = gridZ + bucketSize;
|
||||
|
||||
|
||||
|
||||
int limitX = Math.abs((int) (MBServerStatics.MAX_WORLD_WIDTH *scale));
|
||||
int limitZ = Math.abs((int) (MBServerStatics.MAX_WORLD_HEIGHT *scale)); //LimitZ is negative, remember to flip sign.
|
||||
|
||||
if (startingX < 0)
|
||||
startingX = 0;
|
||||
|
||||
if (startingZ < 0)
|
||||
startingZ = 0;
|
||||
|
||||
if (startingX > limitX)
|
||||
startingX = limitX;
|
||||
|
||||
if (startingZ > limitZ)
|
||||
startingZ = limitZ;
|
||||
|
||||
int endX = startingX + (bucketSize * 2);
|
||||
int endZ = startingZ - (bucketSize * 2);
|
||||
|
||||
if (endX < 0)
|
||||
endX = 0;
|
||||
|
||||
if (endZ < 0)
|
||||
endZ = 0;
|
||||
|
||||
if (endX > limitX)
|
||||
endX = limitX;
|
||||
|
||||
if (endZ > limitZ)
|
||||
endZ = limitZ;
|
||||
|
||||
int auditMob = 0;
|
||||
for (int x = startingX;x<=endX;x++){
|
||||
for (int z = startingZ;z >= endZ;z--){
|
||||
|
||||
ConcurrentHashMap<Integer,AbstractWorldObject> gridMap;
|
||||
|
||||
if ((MBServerStatics.MASK_STATIC & mask) != 0)
|
||||
gridMap = WorldGrid.StaticGridMap[x][z];
|
||||
else
|
||||
gridMap = WorldGrid.DynamicGridMap[x][z];
|
||||
for (AbstractWorldObject gridObject: gridMap.values()){
|
||||
if ((gridObject.getObjectTypeMask() & mask) == 0)
|
||||
continue;
|
||||
if (gridObject.getLoc().distanceSquared2D(loc) <= FastMath.sqr(r))
|
||||
outbound.add(gridObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
return outbound;
|
||||
}
|
||||
|
||||
public static HashSet<AbstractWorldObject> getObjectsInRangePartialNecroPets(Vector3fImmutable loc, double r) {
|
||||
HashSet<AbstractWorldObject> outbound = new HashSet<>();
|
||||
return outbound;
|
||||
}
|
||||
loadJobThread = new Thread(InterestManager.INTERESTMANAGER);
|
||||
loadJobThread.setName("InterestManager");
|
||||
loadJobThread.start();
|
||||
}
|
||||
|
||||
public static HashSet<AbstractWorldObject> getObjectsInRangeContains(Vector3fImmutable loc, double r, int mask) {
|
||||
HashSet<AbstractWorldObject> outbound = getObjectsInRangePartial(loc,r,mask);
|
||||
return outbound;
|
||||
}
|
||||
public static boolean moveWorldObject(AbstractWorldObject awo, Vector3fImmutable location) {
|
||||
awo.setLoc(location);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static HashSet<AbstractWorldObject> getObjectsInRangePartial(AbstractWorldObject awo, double range, int mask) {
|
||||
return getObjectsInRangePartial(awo.getLoc(), range, mask);
|
||||
}
|
||||
public static HashSet<AbstractWorldObject> getInRange(Vector3f loc, double r) {
|
||||
HashSet<AbstractWorldObject> outbound = new HashSet<>();
|
||||
return outbound;
|
||||
}
|
||||
|
||||
|
||||
public static void InitializeGridObjects(){
|
||||
|
||||
int dynamicWidth = (int) Math.abs(MBServerStatics.MAX_WORLD_WIDTH *WorldGrid.dynamicBucketScale);
|
||||
int dynamicHeight = (int) Math.abs(MBServerStatics.MAX_WORLD_HEIGHT*WorldGrid.dynamicBucketScale);
|
||||
|
||||
int staticWidth = (int) Math.abs(MBServerStatics.MAX_WORLD_WIDTH *WorldGrid.staticBucketScale);
|
||||
int staticHeight = (int) Math.abs(MBServerStatics.MAX_WORLD_HEIGHT*WorldGrid.staticBucketScale);
|
||||
WorldGrid.DynamicGridMap = new ConcurrentHashMap[dynamicWidth+ 1][dynamicHeight + 1];
|
||||
WorldGrid.StaticGridMap = new ConcurrentHashMap[staticWidth + 1][staticHeight + 1];
|
||||
//create new hash maps for each bucket
|
||||
for (int x = 0; x<= staticWidth; x++)
|
||||
for (int y = 0; y<= staticHeight; y++){
|
||||
WorldGrid.StaticGridMap[x][y] = new ConcurrentHashMap<Integer,AbstractWorldObject>();
|
||||
}
|
||||
|
||||
for (int x = 0; x<= dynamicWidth; x++)
|
||||
for (int y = 0; y<= dynamicHeight; y++){
|
||||
WorldGrid.DynamicGridMap[x][y] = new ConcurrentHashMap<Integer,AbstractWorldObject>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RemoveWorldObject(AbstractWorldObject gridObject){
|
||||
|
||||
if (gridObject == null)
|
||||
return;
|
||||
AbstractWorldObject.RemoveFromWorldGrid(gridObject);
|
||||
}
|
||||
|
||||
public static boolean addObject(AbstractWorldObject gridObject, float x, float z){
|
||||
|
||||
if (gridObject == null)
|
||||
return false;
|
||||
|
||||
if (x > MBServerStatics.MAX_WORLD_WIDTH)
|
||||
return false;
|
||||
|
||||
if (z < MBServerStatics.MAX_WORLD_HEIGHT)
|
||||
return false;
|
||||
|
||||
if (x < 0)
|
||||
return false;
|
||||
if (z > 0)
|
||||
return false;
|
||||
|
||||
int gridX;
|
||||
int gridZ;
|
||||
|
||||
if (gridObject.getGridObjectType().equals(GridObjectType.STATIC)){
|
||||
gridX = Math.abs((int) (x *WorldGrid.staticBucketScale));
|
||||
gridZ = Math.abs((int) (z*WorldGrid.staticBucketScale));
|
||||
}else{
|
||||
gridX = Math.abs((int) (x *WorldGrid.dynamicBucketScale));
|
||||
gridZ = Math.abs((int) (z*WorldGrid.dynamicBucketScale));
|
||||
}
|
||||
|
||||
|
||||
WorldGrid.RemoveWorldObject(gridObject);
|
||||
|
||||
return AbstractWorldObject.AddToWorldGrid(gridObject, gridX, gridZ);
|
||||
|
||||
|
||||
}
|
||||
public static HashSet<AbstractWorldObject> getObjectsInRangePartial(Vector3fImmutable loc, double r, int mask) {
|
||||
HashSet<AbstractWorldObject> outbound = new HashSet<>();
|
||||
float scale;
|
||||
|
||||
if ((mask & MBServerStatics.MASK_STATIC) != 0)
|
||||
scale = WorldGrid.staticBucketScale;
|
||||
else
|
||||
scale = WorldGrid.dynamicBucketScale;
|
||||
int gridX = (int) Math.abs(loc.x * scale);
|
||||
int gridZ = (int) Math.abs(loc.z * scale);
|
||||
int bucketSize = (int) (r * scale) + 1;
|
||||
//start at top left most corner to scan.
|
||||
int startingX = gridX - bucketSize;
|
||||
int startingZ = gridZ + bucketSize;
|
||||
|
||||
|
||||
int limitX = Math.abs((int) (MBServerStatics.MAX_WORLD_WIDTH * scale));
|
||||
int limitZ = Math.abs((int) (MBServerStatics.MAX_WORLD_HEIGHT * scale)); //LimitZ is negative, remember to flip sign.
|
||||
|
||||
if (startingX < 0)
|
||||
startingX = 0;
|
||||
|
||||
if (startingZ < 0)
|
||||
startingZ = 0;
|
||||
|
||||
if (startingX > limitX)
|
||||
startingX = limitX;
|
||||
|
||||
if (startingZ > limitZ)
|
||||
startingZ = limitZ;
|
||||
|
||||
int endX = startingX + (bucketSize * 2);
|
||||
int endZ = startingZ - (bucketSize * 2);
|
||||
|
||||
if (endX < 0)
|
||||
endX = 0;
|
||||
|
||||
if (endZ < 0)
|
||||
endZ = 0;
|
||||
|
||||
if (endX > limitX)
|
||||
endX = limitX;
|
||||
|
||||
if (endZ > limitZ)
|
||||
endZ = limitZ;
|
||||
|
||||
int auditMob = 0;
|
||||
for (int x = startingX; x <= endX; x++) {
|
||||
for (int z = startingZ; z >= endZ; z--) {
|
||||
|
||||
ConcurrentHashMap<Integer, AbstractWorldObject> gridMap;
|
||||
|
||||
if ((MBServerStatics.MASK_STATIC & mask) != 0)
|
||||
gridMap = WorldGrid.StaticGridMap[x][z];
|
||||
else
|
||||
gridMap = WorldGrid.DynamicGridMap[x][z];
|
||||
for (AbstractWorldObject gridObject : gridMap.values()) {
|
||||
if ((gridObject.getObjectTypeMask() & mask) == 0)
|
||||
continue;
|
||||
if (gridObject.getLoc().distanceSquared2D(loc) <= FastMath.sqr(r))
|
||||
outbound.add(gridObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
return outbound;
|
||||
}
|
||||
|
||||
public static HashSet<AbstractWorldObject> getObjectsInRangePartialNecroPets(Vector3fImmutable loc, double r) {
|
||||
HashSet<AbstractWorldObject> outbound = new HashSet<>();
|
||||
return outbound;
|
||||
}
|
||||
|
||||
public static HashSet<AbstractWorldObject> getObjectsInRangeContains(Vector3fImmutable loc, double r, int mask) {
|
||||
HashSet<AbstractWorldObject> outbound = getObjectsInRangePartial(loc, r, mask);
|
||||
return outbound;
|
||||
}
|
||||
|
||||
public static HashSet<AbstractWorldObject> getObjectsInRangePartial(AbstractWorldObject awo, double range, int mask) {
|
||||
return getObjectsInRangePartial(awo.getLoc(), range, mask);
|
||||
}
|
||||
|
||||
|
||||
public static void InitializeGridObjects() {
|
||||
|
||||
int dynamicWidth = (int) Math.abs(MBServerStatics.MAX_WORLD_WIDTH * WorldGrid.dynamicBucketScale);
|
||||
int dynamicHeight = (int) Math.abs(MBServerStatics.MAX_WORLD_HEIGHT * WorldGrid.dynamicBucketScale);
|
||||
|
||||
int staticWidth = (int) Math.abs(MBServerStatics.MAX_WORLD_WIDTH * WorldGrid.staticBucketScale);
|
||||
int staticHeight = (int) Math.abs(MBServerStatics.MAX_WORLD_HEIGHT * WorldGrid.staticBucketScale);
|
||||
WorldGrid.DynamicGridMap = new ConcurrentHashMap[dynamicWidth + 1][dynamicHeight + 1];
|
||||
WorldGrid.StaticGridMap = new ConcurrentHashMap[staticWidth + 1][staticHeight + 1];
|
||||
//create new hash maps for each bucket
|
||||
for (int x = 0; x <= staticWidth; x++)
|
||||
for (int y = 0; y <= staticHeight; y++) {
|
||||
WorldGrid.StaticGridMap[x][y] = new ConcurrentHashMap<Integer, AbstractWorldObject>();
|
||||
}
|
||||
|
||||
for (int x = 0; x <= dynamicWidth; x++)
|
||||
for (int y = 0; y <= dynamicHeight; y++) {
|
||||
WorldGrid.DynamicGridMap[x][y] = new ConcurrentHashMap<Integer, AbstractWorldObject>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RemoveWorldObject(AbstractWorldObject gridObject) {
|
||||
|
||||
if (gridObject == null)
|
||||
return;
|
||||
AbstractWorldObject.RemoveFromWorldGrid(gridObject);
|
||||
}
|
||||
|
||||
public static boolean addObject(AbstractWorldObject gridObject, float x, float z) {
|
||||
|
||||
if (gridObject == null)
|
||||
return false;
|
||||
|
||||
if (x > MBServerStatics.MAX_WORLD_WIDTH)
|
||||
return false;
|
||||
|
||||
if (z < MBServerStatics.MAX_WORLD_HEIGHT)
|
||||
return false;
|
||||
|
||||
if (x < 0)
|
||||
return false;
|
||||
if (z > 0)
|
||||
return false;
|
||||
|
||||
int gridX;
|
||||
int gridZ;
|
||||
|
||||
if (gridObject.getGridObjectType().equals(GridObjectType.STATIC)) {
|
||||
gridX = Math.abs((int) (x * WorldGrid.staticBucketScale));
|
||||
gridZ = Math.abs((int) (z * WorldGrid.staticBucketScale));
|
||||
} else {
|
||||
gridX = Math.abs((int) (x * WorldGrid.dynamicBucketScale));
|
||||
gridZ = Math.abs((int) (z * WorldGrid.dynamicBucketScale));
|
||||
}
|
||||
|
||||
|
||||
WorldGrid.RemoveWorldObject(gridObject);
|
||||
|
||||
return AbstractWorldObject.AddToWorldGrid(gridObject, gridX, gridZ);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void unloadObject(AbstractWorldObject awo) {
|
||||
|
||||
@@ -204,109 +204,109 @@ public class WorldGrid {
|
||||
DispatchMessage.sendToAllInRange(awo, uom);
|
||||
}
|
||||
|
||||
public static void loadObject(AbstractWorldObject awo) {
|
||||
public static void loadObject(AbstractWorldObject awo) {
|
||||
|
||||
LoadStructureMsg lsm;
|
||||
LoadCharacterMsg lcm;
|
||||
LoadStructureMsg lsm;
|
||||
LoadCharacterMsg lcm;
|
||||
|
||||
switch (awo.getObjectType()) {
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building)awo);
|
||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||
break;
|
||||
case NPC:
|
||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case Mob:
|
||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
default:
|
||||
// *** Refactor: Log error?
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (awo.getObjectType()) {
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building) awo);
|
||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||
break;
|
||||
case NPC:
|
||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case Mob:
|
||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
default:
|
||||
// *** Refactor: Log error?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadObject(AbstractWorldObject awo, ClientConnection origin) {
|
||||
public static void loadObject(AbstractWorldObject awo, ClientConnection origin) {
|
||||
|
||||
LoadStructureMsg lsm;
|
||||
LoadCharacterMsg lcm;
|
||||
LoadStructureMsg lsm;
|
||||
LoadCharacterMsg lcm;
|
||||
|
||||
switch (awo.getObjectType()) {
|
||||
switch (awo.getObjectType()) {
|
||||
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building)awo);
|
||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||
break;
|
||||
case NPC:
|
||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case Mob:
|
||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case PlayerCharacter:
|
||||
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
default:
|
||||
// *** Refactor: Log error?
|
||||
break;
|
||||
}
|
||||
}
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building) awo);
|
||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||
break;
|
||||
case NPC:
|
||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case Mob:
|
||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case PlayerCharacter:
|
||||
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
default:
|
||||
// *** Refactor: Log error?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void unloadObject(AbstractWorldObject awo,
|
||||
ClientConnection origin) {
|
||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||
uom.addObject(awo);
|
||||
DispatchMessage.sendToAllInRange(awo, uom);
|
||||
}
|
||||
public static void unloadObject(AbstractWorldObject awo,
|
||||
ClientConnection origin) {
|
||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||
uom.addObject(awo);
|
||||
DispatchMessage.sendToAllInRange(awo, uom);
|
||||
}
|
||||
|
||||
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||
if (pc == null || awo == null)
|
||||
return;
|
||||
ClientConnection origin = pc.getClientConnection();
|
||||
if (origin == null)
|
||||
return;
|
||||
loadObject(awo, origin);
|
||||
}
|
||||
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||
if (pc == null || awo == null)
|
||||
return;
|
||||
ClientConnection origin = pc.getClientConnection();
|
||||
if (origin == null)
|
||||
return;
|
||||
loadObject(awo, origin);
|
||||
}
|
||||
|
||||
public static void removeObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||
if (pc == null || awo == null)
|
||||
return;
|
||||
ClientConnection origin = pc.getClientConnection();
|
||||
if (origin == null)
|
||||
return;
|
||||
unloadObject(awo, origin);
|
||||
}
|
||||
public static void removeObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||
if (pc == null || awo == null)
|
||||
return;
|
||||
ClientConnection origin = pc.getClientConnection();
|
||||
if (origin == null)
|
||||
return;
|
||||
unloadObject(awo, origin);
|
||||
}
|
||||
|
||||
public static void updateObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||
if (pc == null || awo == null)
|
||||
return;
|
||||
ClientConnection origin = pc.getClientConnection();
|
||||
if (origin == null)
|
||||
return;
|
||||
unloadObject(awo, origin);
|
||||
loadObject(awo, origin);
|
||||
}
|
||||
public static void updateObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||
if (pc == null || awo == null)
|
||||
return;
|
||||
ClientConnection origin = pc.getClientConnection();
|
||||
if (origin == null)
|
||||
return;
|
||||
unloadObject(awo, origin);
|
||||
loadObject(awo, origin);
|
||||
}
|
||||
|
||||
public static void updateObject(AbstractWorldObject awo) {
|
||||
if (awo == null)
|
||||
return;
|
||||
unloadObject(awo);
|
||||
loadObject(awo);
|
||||
}
|
||||
public static void updateObject(AbstractWorldObject awo) {
|
||||
if (awo == null)
|
||||
return;
|
||||
unloadObject(awo);
|
||||
loadObject(awo);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public static void removeObject(AbstractWorldObject awo) {
|
||||
if (awo == null)
|
||||
return;
|
||||
unloadObject(awo);
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public static void removeObject(AbstractWorldObject awo) {
|
||||
if (awo == null)
|
||||
return;
|
||||
unloadObject(awo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user