Browse Source

can teleport to owned mines

lakebane-mine-tele
FatBoy-DOTC 2 months ago
parent
commit
0901c03b74
  1. 28
      src/engine/net/client/handlers/MerchantMsgHandler.java
  2. 44
      src/engine/objects/Mine.java

28
src/engine/net/client/handlers/MerchantMsgHandler.java

@ -274,9 +274,30 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { @@ -274,9 +274,30 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
}
}
if (targetCity == null)
if (targetCity == null){
Mine mineTele = null;
for(Mine mine : Mine.getMinesToTeleportTo(player)){
if(mine.getObjectUUID() == msg.getCityID()){
mineTele = mine;
}
}
if(mineTele == null){
return;
}else {
int time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
msg.setTeleportTime(time);
Building tower = Mine.getTower(mineTele);
if (tower == null)
return;
Vector3fImmutable teleportLoc = Vector3fImmutable.getRandomPointOnCircle(tower.getLoc(), 10);
if (time > 0) {
//TODO add timer to teleport
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
}
}
}else{
//finish porting to a city
//verify level required to teleport or repledge
Guild toGuild = targetCity.getGuild();
@ -330,6 +351,9 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { @@ -330,6 +351,9 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
}
}
}
private static PowersBase getPowerforHermit(NPC npc) {
int contractID;

44
src/engine/objects/Mine.java

@ -673,7 +673,10 @@ public class Mine extends AbstractGameObject { @@ -673,7 +673,10 @@ public class Mine extends AbstractGameObject {
_playerMemory.removeAll(toRemove);
}
public static Building getTower(Mine mine){
Building tower = BuildingManager.getBuildingFromCache(mine.buildingID);
if(tower != null)
return tower;
else
return null;
}
public static void serializeForClientMsgTeleport(Mine mine, ByteBufferWriter writer) {
@ -685,17 +688,18 @@ public class Mine extends AbstractGameObject { @@ -685,17 +688,18 @@ public class Mine extends AbstractGameObject {
// Cities aren't a mine without a TOL. Time to early exit.
// No need to spam the log here as non-existant TOL's are indicated
// during bootstrap routines.
Building tower = Mine.getTower(mine);
if (tower == null) {
if (Mine.getTower(mine) == null) {
Logger.error("NULL TOL FOR " + mine.zoneName + " mine");
Logger.error("NULL TOWER FOR " + mine.zoneName + " mine");
return;
}
// Assign mine owner
if (Mine.getTower(mine) != null && Mine.getTower(mine).getOwner() != null)
guildRuler = Mine.getTower(mine).getOwner();
if (tower.getOwner() != null)
guildRuler = tower.getOwner();
else
guildRuler = null;
@ -712,7 +716,7 @@ public class Mine extends AbstractGameObject { @@ -712,7 +716,7 @@ public class Mine extends AbstractGameObject {
// Begin Serialzing soverign guild data
writer.putInt(mine.getObjectType().ordinal());
writer.putInt(mine.getObjectUUID());
writer.putString(Mine.getTower(mine).getName());
writer.putString(mine.zoneName + " Mine");
writer.putInt(rulingGuild.getObjectType().ordinal());
writer.putInt(rulingGuild.getObjectUUID());
@ -767,11 +771,8 @@ public class Mine extends AbstractGameObject { @@ -767,11 +771,8 @@ public class Mine extends AbstractGameObject {
else
writer.putString(rulingNation.getName());
if(Mine.getTower(mine) != null) {
writer.putInt(Mine.getTower(mine).getRank());
} else{
writer.putInt(1);
}
writer.putInt(0xFFFFFFFF);
writer.putInt(0);
@ -781,20 +782,17 @@ public class Mine extends AbstractGameObject { @@ -781,20 +782,17 @@ public class Mine extends AbstractGameObject {
else
writer.putString(Guild.GetGL(rulingNation).getFirstName() + ' ' + Guild.GetGL(rulingNation).getLastName());
writer.putLocalDateTime(LocalDateTime.now());
// writer.put((byte) mine.established.getDayOfMonth());
// writer.put((byte) mine.established.minusMonths(1).getMonth().getValue());
// writer.putInt((int) years);
// writer.put((byte) hours);
// writer.put((byte) minutes);
// writer.put((byte) seconds);
writer.putFloat(Mine.getTower(mine).loc.x);
writer.putFloat(Mine.getTower(mine).loc.y);
writer.putFloat(Mine.getTower(mine).loc.z);
if(tower != null) {
writer.putFloat(tower.loc.x);
writer.putFloat(tower.loc.y);
writer.putFloat(tower.loc.z);
} else{
writer.putFloat(0);
writer.putFloat(0);
writer.putFloat(0);
}
writer.putInt(0);
writer.put((byte) 1);

Loading…
Cancel
Save