Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2047ee6cdd | ||
|
|
92a888d618 | ||
|
|
93eb77fcc8 | ||
|
|
efd35e89f1 | ||
|
|
e79a3af870 | ||
|
|
8d6457b91c | ||
|
|
70b941239a | ||
|
|
800f72512d | ||
|
|
e9ce418772 | ||
|
|
effd79984f | ||
|
|
55fea8a20b | ||
|
|
19c6baf927 | ||
|
|
4130a767dc |
@@ -14,7 +14,6 @@ import engine.gameManager.DbManager;
|
|||||||
import engine.objects.Bane;
|
import engine.objects.Bane;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
@@ -34,8 +33,8 @@ public class BaneRecord extends DataRecord {
|
|||||||
private String baneDropperHash;
|
private String baneDropperHash;
|
||||||
private String baneGuildHash;
|
private String baneGuildHash;
|
||||||
private String baneNationHash;
|
private String baneNationHash;
|
||||||
private DateTime baneLiveTime;
|
private LocalDateTime baneLiveTime;
|
||||||
private DateTime baneDropTime;
|
private LocalDateTime baneDropTime;
|
||||||
|
|
||||||
private BaneRecord(Bane bane) {
|
private BaneRecord(Bane bane) {
|
||||||
this.recordType = Enum.DataRecordType.BANE;
|
this.recordType = Enum.DataRecordType.BANE;
|
||||||
@@ -129,9 +128,9 @@ public class BaneRecord extends DataRecord {
|
|||||||
return outStatement;
|
return outStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTime getLastBaneDateTime(City city) {
|
public static LocalDateTime getLastBaneDateTime(City city) {
|
||||||
|
|
||||||
DateTime outDateTime = null;
|
LocalDateTime outDateTime = null;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement statement = buildDateTimeQueryStatement(connection, city);
|
PreparedStatement statement = buildDateTimeQueryStatement(connection, city);
|
||||||
@@ -139,7 +138,7 @@ public class BaneRecord extends DataRecord {
|
|||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
outDateTime = new DateTime(rs.getTimestamp("endDatetime"));
|
outDateTime = rs.getTimestamp("endDatetime").toLocalDateTime();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +159,7 @@ public class BaneRecord extends DataRecord {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateLiveDate(Bane bane, DateTime dateTime) {
|
public static void updateLiveDate(Bane bane, LocalDateTime dateTime) {
|
||||||
|
|
||||||
if (bane == null)
|
if (bane == null)
|
||||||
return;
|
return;
|
||||||
@@ -175,13 +174,13 @@ public class BaneRecord extends DataRecord {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PreparedStatement buildUpdateLiveDateStatement(Connection connection, Bane bane, DateTime dateTime) throws SQLException {
|
private static PreparedStatement buildUpdateLiveDateStatement(Connection connection, Bane bane, LocalDateTime dateTime) throws SQLException {
|
||||||
|
|
||||||
PreparedStatement outStatement = null;
|
PreparedStatement outStatement = null;
|
||||||
String queryString = "UPDATE `warehouse_banehistory` SET `liveDatetime` = ?, `dirty` = 1 WHERE `city_id` = ? AND `resolution` = 'PENDING'";
|
String queryString = "UPDATE `warehouse_banehistory` SET `liveDatetime` = ?, `dirty` = 1 WHERE `city_id` = ? AND `resolution` = 'PENDING'";
|
||||||
|
|
||||||
outStatement = connection.prepareStatement(queryString);
|
outStatement = connection.prepareStatement(queryString);
|
||||||
outStatement.setTimestamp(1, new java.sql.Timestamp(dateTime.getMillis()));
|
outStatement.setTimestamp(1, Timestamp.valueOf(dateTime));
|
||||||
outStatement.setString(2, bane.getCity().getHash());
|
outStatement.setString(2, bane.getCity().getHash());
|
||||||
|
|
||||||
return outStatement;
|
return outStatement;
|
||||||
@@ -366,12 +365,12 @@ public class BaneRecord extends DataRecord {
|
|||||||
if (this.baneDropTime == null)
|
if (this.baneDropTime == null)
|
||||||
outStatement.setNull(8, java.sql.Types.DATE);
|
outStatement.setNull(8, java.sql.Types.DATE);
|
||||||
else
|
else
|
||||||
outStatement.setTimestamp(8, new java.sql.Timestamp(this.baneDropTime.getMillis()));
|
outStatement.setTimestamp(8, Timestamp.valueOf(this.baneDropTime));
|
||||||
|
|
||||||
if (this.baneLiveTime == null)
|
if (this.baneLiveTime == null)
|
||||||
outStatement.setNull(9, java.sql.Types.DATE);
|
outStatement.setNull(9, java.sql.Types.DATE);
|
||||||
else
|
else
|
||||||
outStatement.setTimestamp(9, new java.sql.Timestamp(this.baneLiveTime.getMillis()));
|
outStatement.setTimestamp(9, Timestamp.valueOf(this.baneLiveTime));
|
||||||
|
|
||||||
outStatement.setString(10, this.eventType.name());
|
outStatement.setString(10, this.eventType.name());
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import engine.objects.Bane;
|
|||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import org.joda.time.DateTime;
|
import java.time.LocalDateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -71,12 +71,12 @@ public class dbBaneHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean SET_BANE_TIME(DateTime toSet, int cityUUID) {
|
public boolean SET_BANE_TIME(LocalDateTime toSet, int cityUUID) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=? WHERE `cityUUID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=? WHERE `cityUUID`=?")) {
|
||||||
|
|
||||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(toSet.getMillis()));
|
preparedStatement.setTimestamp(1, java.sql.Timestamp.valueOf(toSet));
|
||||||
preparedStatement.setLong(2, cityUUID);
|
preparedStatement.setLong(2, cityUUID);
|
||||||
|
|
||||||
preparedStatement.execute();
|
preparedStatement.execute();
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ import engine.Enum.TaxType;
|
|||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -38,7 +40,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
public Building CREATE_BUILDING(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
public Building CREATE_BUILDING(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||||
Vector3fImmutable location, float meshScale, int currentHP,
|
Vector3fImmutable location, float meshScale, int currentHP,
|
||||||
ProtectionState protectionState, int currentGold, int rank,
|
ProtectionState protectionState, int currentGold, int rank,
|
||||||
DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
|
Instant upgradeDate, int blueprintUUID, float w, float rotY) {
|
||||||
|
|
||||||
Building building = null;
|
Building building = null;
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(12, rank);
|
preparedStatement.setInt(12, rank);
|
||||||
|
|
||||||
if (upgradeDate != null)
|
if (upgradeDate != null)
|
||||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
|
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.toEpochMilli()));
|
||||||
else
|
else
|
||||||
preparedStatement.setNull(13, java.sql.Types.DATE);
|
preparedStatement.setNull(13, java.sql.Types.DATE);
|
||||||
|
|
||||||
@@ -752,7 +754,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateBuildingUpgradeTime(LocalDateTime upgradeDateTime, Building toUpgrade, int costToUpgrade) {
|
public boolean updateBuildingUpgradeTime(Instant upgradeDateTime, Building toUpgrade, int costToUpgrade) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_building SET upgradeDate=?, currentGold=? "
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_building SET upgradeDate=?, currentGold=? "
|
||||||
@@ -761,8 +763,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
if (upgradeDateTime == null)
|
if (upgradeDateTime == null)
|
||||||
preparedStatement.setNull(1, java.sql.Types.DATE);
|
preparedStatement.setNull(1, java.sql.Types.DATE);
|
||||||
else
|
else
|
||||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(upgradeDateTime.atZone(ZoneId.systemDefault())
|
preparedStatement.setTimestamp(1, new java.sql.Timestamp(upgradeDateTime.toEpochMilli()));
|
||||||
.toInstant().toEpochMilli()));
|
|
||||||
|
|
||||||
preparedStatement.setInt(2, toUpgrade.getStrongboxValue() - costToUpgrade);
|
preparedStatement.setInt(2, toUpgrade.getStrongboxValue() - costToUpgrade);
|
||||||
preparedStatement.setInt(3, toUpgrade.getObjectUUID());
|
preparedStatement.setInt(3, toUpgrade.getObjectUUID());
|
||||||
@@ -841,7 +842,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_building SET taxDate=? "
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_building SET taxDate=? "
|
||||||
+ "WHERE UID = ?")) {
|
+ "WHERE UID = ?")) {
|
||||||
|
|
||||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(DateTime.now().plusDays(7).getMillis()));
|
preparedStatement.setTimestamp(1, new java.sql.Timestamp(Instant.now().plus(7, java.time.temporal.ChronoUnit.DAYS).toEpochMilli()));
|
||||||
preparedStatement.setInt(2, building.getObjectUUID());
|
preparedStatement.setInt(2, building.getObjectUUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import engine.Enum.GuildHistoryType;
|
|||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
@@ -125,7 +125,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_TO_GUILDHISTORY(int target, PlayerCharacter playerCharacter, DateTime historyDate, GuildHistoryType historyType) {
|
public boolean ADD_TO_GUILDHISTORY(int target, PlayerCharacter playerCharacter, Instant historyDate, GuildHistoryType historyType) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_character_guildhistory` (`GuildID`, `CharacterID`, `historyDate`, `historyType`) VALUES (?,?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_character_guildhistory` (`GuildID`, `CharacterID`, `historyDate`, `historyType`) VALUES (?,?,?,?)")) {
|
||||||
@@ -136,7 +136,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
if (historyDate == null)
|
if (historyDate == null)
|
||||||
preparedStatement.setNull(3, java.sql.Types.DATE);
|
preparedStatement.setNull(3, java.sql.Types.DATE);
|
||||||
else
|
else
|
||||||
preparedStatement.setTimestamp(3, new Timestamp(historyDate.getMillis()));
|
preparedStatement.setTimestamp(3, java.sql.Timestamp.from(historyDate));
|
||||||
|
|
||||||
preparedStatement.setString(4, historyType.name());
|
preparedStatement.setString(4, historyType.name());
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ package engine.db.handlers;
|
|||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -69,7 +69,7 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
return mobile;
|
return mobile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) {
|
public boolean updateUpgradeTime(Mob mob, Instant upgradeDateTime) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_mob SET upgradeDate=? "
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_mob SET upgradeDate=? "
|
||||||
@@ -78,7 +78,7 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
if (upgradeDateTime == null)
|
if (upgradeDateTime == null)
|
||||||
preparedStatement.setNull(1, java.sql.Types.DATE);
|
preparedStatement.setNull(1, java.sql.Types.DATE);
|
||||||
else
|
else
|
||||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(upgradeDateTime.getMillis()));
|
preparedStatement.setTimestamp(1, java.sql.Timestamp.from(upgradeDateTime));
|
||||||
|
|
||||||
preparedStatement.setInt(2, mob.getObjectUUID());
|
preparedStatement.setInt(2, mob.getObjectUUID());
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import engine.objects.NPC;
|
|||||||
import engine.objects.NPCProfits;
|
import engine.objects.NPCProfits;
|
||||||
import engine.objects.ProducedItem;
|
import engine.objects.ProducedItem;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -203,7 +203,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateUpgradeTime(NPC npc, DateTime upgradeDateTime) {
|
public boolean updateUpgradeTime(NPC npc, Instant upgradeDateTime) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET upgradeDate=? "
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET upgradeDate=? "
|
||||||
@@ -212,7 +212,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
if (upgradeDateTime == null)
|
if (upgradeDateTime == null)
|
||||||
preparedStatement.setNull(1, java.sql.Types.DATE);
|
preparedStatement.setNull(1, java.sql.Types.DATE);
|
||||||
else
|
else
|
||||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(upgradeDateTime.getMillis()));
|
preparedStatement.setTimestamp(1, java.sql.Timestamp.from(upgradeDateTime));
|
||||||
|
|
||||||
preparedStatement.setInt(2, npc.getObjectUUID());
|
preparedStatement.setInt(2, npc.getObjectUUID());
|
||||||
|
|
||||||
@@ -308,7 +308,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
+ NPC._pirateNames.size() + " mobBases");
|
+ NPC._pirateNames.size() + " mobBases");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_TO_PRODUCTION_LIST(final long ID, final long npcUID, final long itemBaseID, DateTime dateTime, String prefix, String suffix, String name, boolean isRandom, int playerID) {
|
public boolean ADD_TO_PRODUCTION_LIST(final long ID, final long npcUID, final long itemBaseID, long dateTime, String prefix, String suffix, String name, boolean isRandom, int playerID) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_npc_production` (`ID`,`npcUID`, `itemBaseID`,`dateToUpgrade`, `isRandom`, `prefix`, `suffix`, `name`,`playerID`) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_npc_production` (`ID`,`npcUID`, `itemBaseID`,`dateToUpgrade`, `isRandom`, `prefix`, `suffix`, `name`,`playerID`) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
||||||
@@ -316,7 +316,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setLong(1, ID);
|
preparedStatement.setLong(1, ID);
|
||||||
preparedStatement.setLong(2, npcUID);
|
preparedStatement.setLong(2, npcUID);
|
||||||
preparedStatement.setLong(3, itemBaseID);
|
preparedStatement.setLong(3, itemBaseID);
|
||||||
preparedStatement.setTimestamp(4, new java.sql.Timestamp(dateTime.getMillis()));
|
preparedStatement.setTimestamp(4, new java.sql.Timestamp(dateTime));
|
||||||
preparedStatement.setBoolean(5, isRandom);
|
preparedStatement.setBoolean(5, isRandom);
|
||||||
preparedStatement.setString(6, prefix);
|
preparedStatement.setString(6, prefix);
|
||||||
preparedStatement.setString(7, suffix);
|
preparedStatement.setString(7, suffix);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import engine.math.Vector3fImmutable;
|
|||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Shrine;
|
import engine.objects.Shrine;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -52,7 +52,7 @@ public class dbShrineHandler extends dbHandlerBase {
|
|||||||
public ArrayList<AbstractGameObject> CREATE_SHRINE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
public ArrayList<AbstractGameObject> CREATE_SHRINE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||||
Vector3fImmutable location, float meshScale, int currentHP,
|
Vector3fImmutable location, float meshScale, int currentHP,
|
||||||
ProtectionState protectionState, int currentGold, int rank,
|
ProtectionState protectionState, int currentGold, int rank,
|
||||||
DateTime upgradeDate, int blueprintUUID, float w, float rotY, String shrineType) {
|
Instant upgradeDate, int blueprintUUID, float w, float rotY, String shrineType) {
|
||||||
|
|
||||||
ArrayList<AbstractGameObject> shrineList = new ArrayList<>();
|
ArrayList<AbstractGameObject> shrineList = new ArrayList<>();
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public class dbShrineHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(12, rank);
|
preparedStatement.setInt(12, rank);
|
||||||
|
|
||||||
if (upgradeDate != null)
|
if (upgradeDate != null)
|
||||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
|
preparedStatement.setTimestamp(13, java.sql.Timestamp.from(upgradeDate));
|
||||||
else
|
else
|
||||||
preparedStatement.setNull(13, java.sql.Types.DATE);
|
preparedStatement.setNull(13, java.sql.Types.DATE);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import engine.gameManager.DbManager;
|
|||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -55,7 +55,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
public ArrayList<AbstractGameObject> CREATE_WAREHOUSE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
public ArrayList<AbstractGameObject> CREATE_WAREHOUSE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||||
Vector3fImmutable location, float meshScale, int currentHP,
|
Vector3fImmutable location, float meshScale, int currentHP,
|
||||||
ProtectionState protectionState, int currentGold, int rank,
|
ProtectionState protectionState, int currentGold, int rank,
|
||||||
DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
|
Instant upgradeDate, int blueprintUUID, float w, float rotY) {
|
||||||
|
|
||||||
ArrayList<AbstractGameObject> warehouseList = new ArrayList<>();
|
ArrayList<AbstractGameObject> warehouseList = new ArrayList<>();
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(12, rank);
|
preparedStatement.setInt(12, rank);
|
||||||
|
|
||||||
if (upgradeDate != null)
|
if (upgradeDate != null)
|
||||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
|
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.toEpochMilli()));
|
||||||
else
|
else
|
||||||
preparedStatement.setNull(13, java.sql.Types.DATE);
|
preparedStatement.setNull(13, java.sql.Types.DATE);
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, DateTime date) {
|
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, Instant date) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
||||||
@@ -498,7 +498,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setString(4, transactionType.name());
|
preparedStatement.setString(4, transactionType.name());
|
||||||
preparedStatement.setString(5, resource.name());
|
preparedStatement.setString(5, resource.name());
|
||||||
preparedStatement.setInt(6, amount);
|
preparedStatement.setInt(6, amount);
|
||||||
preparedStatement.setTimestamp(7, new java.sql.Timestamp(date.getMillis()));
|
preparedStatement.setTimestamp(7, new java.sql.Timestamp(date.toEpochMilli()));
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
if (building == null)
|
if (building == null)
|
||||||
return;
|
return;
|
||||||
if (!DbManager.BuildingQueries.updateBuildingUpgradeTime(upgradeDateTime, building, rankCost)) {
|
if (!DbManager.BuildingQueries.updateBuildingUpgradeTime(upgradeDateTime.atZone(ZoneId.systemDefault()).toInstant(), building, rankCost)) {
|
||||||
Logger.error("Failed to set upgradeTime for building " + building.getObjectUUID());
|
Logger.error("Failed to set upgradeTime for building " + building.getObjectUUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import engine.net.client.ClientConnection;
|
|||||||
import engine.net.client.msg.guild.AcceptInviteToGuildMsg;
|
import engine.net.client.msg.guild.AcceptInviteToGuildMsg;
|
||||||
import engine.net.client.msg.guild.GuildInfoMsg;
|
import engine.net.client.msg.guild.GuildInfoMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
|
|
||||||
public enum GuildManager {
|
public enum GuildManager {
|
||||||
|
|
||||||
@@ -68,8 +68,8 @@ public enum GuildManager {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (playerCharacter.getGuild() != null && !playerCharacter.getGuild().isEmptyGuild()) {
|
if (playerCharacter.getGuild() != null && !playerCharacter.getGuild().isEmptyGuild()) {
|
||||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(playerCharacter.getGuildUUID(), playerCharacter, DateTime.now(), GuildHistoryType.LEAVE)) {
|
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(playerCharacter.getGuildUUID(), playerCharacter, Instant.now(), GuildHistoryType.LEAVE)) {
|
||||||
GuildHistory guildHistory = new GuildHistory(playerCharacter.getGuildUUID(), playerCharacter.getGuild().getName(), DateTime.now(), GuildHistoryType.LEAVE);
|
GuildHistory guildHistory = new GuildHistory(playerCharacter.getGuildUUID(), playerCharacter.getGuild().getName(), Instant.now(), GuildHistoryType.LEAVE);
|
||||||
playerCharacter.getGuildHistory().add(guildHistory);
|
playerCharacter.getGuildHistory().add(guildHistory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,8 +91,8 @@ public enum GuildManager {
|
|||||||
dispatch = Dispatch.borrow(playerCharacter, msg);
|
dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), playerCharacter, DateTime.now(), historyType)) {
|
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), playerCharacter, Instant.now(), historyType)) {
|
||||||
GuildHistory guildHistory = new GuildHistory(guild.getObjectUUID(), guild.getName(), DateTime.now(), historyType);
|
GuildHistory guildHistory = new GuildHistory(guild.getObjectUUID(), guild.getName(), Instant.now(), historyType);
|
||||||
playerCharacter.getGuildHistory().add(guildHistory);
|
playerCharacter.getGuildHistory().add(guildHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package engine.jobs;
|
|||||||
|
|
||||||
import engine.job.AbstractScheduleJob;
|
import engine.job.AbstractScheduleJob;
|
||||||
import engine.objects.Bane;
|
import engine.objects.Bane;
|
||||||
import org.joda.time.DateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
public class BaneDefaultTimeJob extends AbstractScheduleJob {
|
public class BaneDefaultTimeJob extends AbstractScheduleJob {
|
||||||
|
|
||||||
@@ -31,11 +31,8 @@ public class BaneDefaultTimeJob extends AbstractScheduleJob {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime defaultTime = new DateTime(this.bane.getPlacementDate());
|
LocalDateTime defaultTime = this.bane.getPlacementDate()
|
||||||
defaultTime = defaultTime.plusDays(2);
|
.plusDays(2).withHour(22).withMinute(0).withSecond(0).withNano(0);
|
||||||
defaultTime = defaultTime.hourOfDay().setCopy(22);
|
|
||||||
defaultTime = defaultTime.minuteOfHour().setCopy(0);
|
|
||||||
defaultTime = defaultTime.secondOfMinute().setCopy(0);
|
|
||||||
this.bane.setLiveDate(defaultTime);
|
this.bane.setLiveDate(defaultTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ package engine.net;
|
|||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.util.ByteBufferUtils;
|
import engine.util.ByteBufferUtils;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -57,13 +58,13 @@ public class ByteBufferWriter {
|
|||||||
this.bb.putLong(x);
|
this.bb.putLong(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void putDateTime(DateTime dateTime) {
|
public synchronized void putDateTime(Instant dateTime) {
|
||||||
this.put((byte) dateTime.getDayOfMonth());
|
this.put((byte) dateTime.atZone(ZoneId.systemDefault()).toLocalDate().getDayOfMonth());
|
||||||
this.put((byte) ((byte) dateTime.getMonthOfYear() - 1));
|
this.put((byte) ((byte) dateTime.atZone(ZoneId.systemDefault()).toLocalDate().getMonthValue() - 1));
|
||||||
this.putInt(dateTime.getYear() - 1900);
|
this.putInt(dateTime.atZone(ZoneId.systemDefault()).toLocalDate().getYear() - 1900);
|
||||||
this.put((byte) dateTime.getHourOfDay());
|
this.put((byte) dateTime.atZone(ZoneId.systemDefault()).toLocalTime().getHour());
|
||||||
this.put((byte) dateTime.getMinuteOfHour());
|
this.put((byte) dateTime.atZone(ZoneId.systemDefault()).toLocalTime().getMinute());
|
||||||
this.put((byte) dateTime.getSecondOfDay());
|
this.put((byte) dateTime.atZone(ZoneId.systemDefault()).toLocalTime().getSecond());
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void putLocalDateTime(LocalDateTime dateTime) {
|
public synchronized void putLocalDateTime(LocalDateTime dateTime) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import engine.net.client.ClientConnection;
|
|||||||
import engine.net.client.Protocol;
|
import engine.net.client.Protocol;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
@@ -86,7 +86,7 @@ public class NetMsgFactory {
|
|||||||
|
|
||||||
if (protocolMsg == Protocol.NONE) {
|
if (protocolMsg == Protocol.NONE) {
|
||||||
|
|
||||||
String errorString = DateTime.now().toString() + origin.lastProtocol.name();
|
String errorString = Instant.now().toString() + origin.lastProtocol.name();
|
||||||
|
|
||||||
int errorCode = errorString.hashCode();
|
int errorCode = errorString.hashCode();
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import engine.net.client.msg.guild.GuildInfoMsg;
|
|||||||
import engine.objects.Guild;
|
import engine.objects.Guild;
|
||||||
import engine.objects.GuildHistory;
|
import engine.objects.GuildHistory;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
|
|
||||||
public class AcceptInviteToGuildHandler extends AbstractClientMsgHandler {
|
public class AcceptInviteToGuildHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
@@ -95,8 +95,8 @@ public class AcceptInviteToGuildHandler extends AbstractClientMsgHandler {
|
|||||||
//Add to guild History
|
//Add to guild History
|
||||||
|
|
||||||
if (player.getGuild() != null) {
|
if (player.getGuild() != null) {
|
||||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(player.getGuildUUID(), player, DateTime.now(), GuildHistoryType.JOIN)) {
|
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(player.getGuildUUID(), player, Instant.now(), GuildHistoryType.JOIN)) {
|
||||||
GuildHistory guildHistory = new GuildHistory(player.getGuildUUID(), player.getGuild().getName(), DateTime.now(), GuildHistoryType.JOIN);
|
GuildHistory guildHistory = new GuildHistory(player.getGuildUUID(), player.getGuild().getName(), Instant.now(), GuildHistoryType.JOIN);
|
||||||
player.getGuildHistory().add(guildHistory);
|
player.getGuildHistory().add(guildHistory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import engine.objects.Guild;
|
|||||||
import engine.objects.GuildHistory;
|
import engine.objects.GuildHistory;
|
||||||
import engine.objects.GuildStatusController;
|
import engine.objects.GuildStatusController;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
|
|
||||||
public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
@@ -96,8 +96,8 @@ public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
//Set guild history
|
//Set guild history
|
||||||
|
|
||||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), toBanish, DateTime.now(), GuildHistoryType.BANISHED)) {
|
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), toBanish, Instant.now(), GuildHistoryType.BANISHED)) {
|
||||||
GuildHistory guildHistory = new GuildHistory(toBanish.getGuildUUID(), toBanish.getGuild().getName(), DateTime.now(), GuildHistoryType.BANISHED);
|
GuildHistory guildHistory = new GuildHistory(toBanish.getGuildUUID(), toBanish.getGuild().getName(), Instant.now(), GuildHistoryType.BANISHED);
|
||||||
toBanish.getGuildHistory().add(guildHistory);
|
toBanish.getGuildHistory().add(guildHistory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import engine.net.client.msg.ErrorPopupMsg;
|
|||||||
import engine.net.client.msg.ManageCityAssetsMsg;
|
import engine.net.client.msg.ManageCityAssetsMsg;
|
||||||
import engine.net.client.msg.PlaceAssetMsg;
|
import engine.net.client.msg.PlaceAssetMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.joda.time.DateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author:
|
* @Author:
|
||||||
@@ -271,11 +271,10 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime baneLive = new DateTime(bane.getPlacementDate());
|
LocalDateTime baneLive = bane.getPlacementDate();
|
||||||
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
|
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
|
||||||
baneLive = baneHour == 24 ? baneLive.hourOfDay().setCopy(0) : baneLive.hourOfDay().setCopy(baneHour);
|
baneLive = baneHour == 24 ? baneLive.withHour(0) : baneLive.withHour(baneHour);
|
||||||
baneLive = baneLive.minuteOfHour().setCopy(0);
|
baneLive = baneLive.withMinute(0).withSecond(1).withNano(0);
|
||||||
baneLive = baneLive.secondOfMinute().setCopy(1);
|
|
||||||
bane.setLiveDate(baneLive);
|
bane.setLiveDate(baneLive);
|
||||||
outMsg.actionType = 18;
|
outMsg.actionType = 18;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import engine.net.client.msg.PlaceAssetMsg;
|
|||||||
import engine.net.client.msg.PlaceAssetMsg.PlacementInfo;
|
import engine.net.client.msg.PlaceAssetMsg.PlacementInfo;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -1160,7 +1160,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
Blueprint blueprint;
|
Blueprint blueprint;
|
||||||
Building newMesh;
|
Building newMesh;
|
||||||
DateTime completionDate;
|
Instant completionDate;
|
||||||
float vendorRotation;
|
float vendorRotation;
|
||||||
float buildingRotation;
|
float buildingRotation;
|
||||||
|
|
||||||
@@ -1174,9 +1174,9 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
// All siege buildings build in 15 minutes
|
// All siege buildings build in 15 minutes
|
||||||
if ((blueprint.getBuildingGroup().equals(BuildingGroup.SIEGETENT))
|
if ((blueprint.getBuildingGroup().equals(BuildingGroup.SIEGETENT))
|
||||||
|| (blueprint.getBuildingGroup().equals(BuildingGroup.BULWARK)))
|
|| (blueprint.getBuildingGroup().equals(BuildingGroup.BULWARK)))
|
||||||
completionDate = DateTime.now().plusMinutes(15);
|
completionDate = Instant.now().plusSeconds(15 * 60);
|
||||||
else
|
else
|
||||||
completionDate = DateTime.now().plusHours(blueprint.getRankTime(1));
|
completionDate = Instant.now().plusSeconds(blueprint.getRankTime(1) * 3600);
|
||||||
|
|
||||||
Vector3fImmutable localLoc = new Vector3fImmutable(ZoneManager.worldToLocal(buildingInfo.getLoc(), currentZone));
|
Vector3fImmutable localLoc = new Vector3fImmutable(ZoneManager.worldToLocal(buildingInfo.getLoc(), currentZone));
|
||||||
|
|
||||||
@@ -1244,7 +1244,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
ArrayList<AbstractGameObject> shrineObjects = DbManager.ShrineQueries.CREATE_SHRINE(
|
ArrayList<AbstractGameObject> shrineObjects = DbManager.ShrineQueries.CREATE_SHRINE(
|
||||||
currentZone.getObjectUUID(), player.getObjectUUID(), blueprint.getName(), blueprint.getMeshForRank(0),
|
currentZone.getObjectUUID(), player.getObjectUUID(), blueprint.getName(), blueprint.getMeshForRank(0),
|
||||||
localLoc, 1.0f, blueprint.getMaxHealth(0), ProtectionState.PROTECTED, 0, 0,
|
localLoc, 1.0f, blueprint.getMaxHealth(0), ProtectionState.PROTECTED, 0, 0,
|
||||||
DateTime.now().plusHours(blueprint.getRankTime(1)), blueprint.getMeshForRank(0), vendorRotation, buildingRotation, shrineType.name());
|
Instant.now().plusSeconds(blueprint.getRankTime(1) * 3600), blueprint.getMeshForRank(0), vendorRotation, buildingRotation, shrineType.name());
|
||||||
|
|
||||||
if (shrineObjects == null) {
|
if (shrineObjects == null) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
@@ -1304,7 +1304,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
float buildingRotation = buildingInfo.getRot().y;
|
float buildingRotation = buildingInfo.getRot().y;
|
||||||
float vendorRotation = buildingInfo.getW();
|
float vendorRotation = buildingInfo.getW();
|
||||||
DateTime completionDate = DateTime.now().plusHours(blueprint.getRankTime(1));
|
Instant completionDate = Instant.now().plusSeconds(blueprint.getRankTime(1) * 3600);
|
||||||
|
|
||||||
|
|
||||||
newMesh = DbManager.BuildingQueries.CREATE_BUILDING(
|
newMesh = DbManager.BuildingQueries.CREATE_BUILDING(
|
||||||
@@ -1347,7 +1347,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
warehouseObjects = DbManager.WarehouseQueries.CREATE_WAREHOUSE(
|
warehouseObjects = DbManager.WarehouseQueries.CREATE_WAREHOUSE(
|
||||||
currentZone.getObjectUUID(), player.getObjectUUID(), blueprint.getName(), blueprint.getMeshForRank(0),
|
currentZone.getObjectUUID(), player.getObjectUUID(), blueprint.getName(), blueprint.getMeshForRank(0),
|
||||||
localLoc, 1.0f, blueprint.getMaxHealth(0), ProtectionState.NONE, 0, 0,
|
localLoc, 1.0f, blueprint.getMaxHealth(0), ProtectionState.NONE, 0, 0,
|
||||||
DateTime.now().plusHours(blueprint.getRankTime(1)), blueprint.getMeshForRank(0), vendorRotation, buildingRotation);
|
Instant.now().plusSeconds(blueprint.getRankTime(1) * 3600), blueprint.getMeshForRank(0), vendorRotation, buildingRotation);
|
||||||
|
|
||||||
if (warehouseObjects == null) {
|
if (warehouseObjects == null) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ import engine.net.client.Protocol;
|
|||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Guild;
|
import engine.objects.Guild;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.joda.time.Seconds;
|
import java.time.Duration;
|
||||||
|
import java.time.temporal.ChronoField;
|
||||||
|
|
||||||
public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||||
|
|
||||||
@@ -27,8 +28,8 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
|||||||
private Building treeOfLife;
|
private Building treeOfLife;
|
||||||
|
|
||||||
private int currentMineHour;
|
private int currentMineHour;
|
||||||
private Seconds secondsLeft;
|
private Duration secondsLeft;
|
||||||
private DateTime lateTime;
|
private Instant lateTime;
|
||||||
private int late;
|
private int late;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,15 +74,15 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
|||||||
currentMineHour = guild.getMineTime();
|
currentMineHour = guild.getMineTime();
|
||||||
|
|
||||||
late = MBServerStatics.MINE_LATE_WINDOW;
|
late = MBServerStatics.MINE_LATE_WINDOW;
|
||||||
lateTime = DateTime.now();
|
lateTime = Instant.now();
|
||||||
|
|
||||||
if (late == 0)
|
if (late == 0)
|
||||||
lateTime = lateTime.plusDays(1);
|
lateTime = lateTime.plus(Duration.ofDays(1));
|
||||||
|
|
||||||
lateTime = lateTime.hourOfDay().setCopy(late);
|
lateTime = lateTime.with(ChronoField.HOUR_OF_DAY, late);
|
||||||
|
|
||||||
late = ((late > 23) ? (late - 24) : late);
|
late = ((late > 23) ? (late - 24) : late);
|
||||||
secondsLeft = Seconds.secondsBetween(DateTime.now(), lateTime);
|
secondsLeft = Duration.between(Instant.now(), lateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ import engine.net.ByteBufferReader;
|
|||||||
import engine.net.ByteBufferWriter;
|
import engine.net.ByteBufferWriter;
|
||||||
import engine.net.client.Protocol;
|
import engine.net.client.Protocol;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.joda.time.Period;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -397,37 +394,33 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
|||||||
else
|
else
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
|
|
||||||
DateTime placedOn = bane.getLiveDate();
|
LocalDateTime placedOn = bane.getLiveDate();
|
||||||
|
|
||||||
if (placedOn == null)
|
if (placedOn == null)
|
||||||
placedOn = new DateTime(DateTime.now());
|
placedOn = LocalDateTime.now();
|
||||||
|
|
||||||
//set Calander to date of bane live.
|
//set Calander to date of bane live.
|
||||||
DateTime now = DateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
DateTime defaultTime = new DateTime(bane.getPlacementDate());
|
LocalDateTime defaultTime = bane.getPlacementDate();
|
||||||
DateTime playerEnterWorldTime = new DateTime(this.assetManager.getTimeStamp("EnterWorld"));
|
LocalDateTime playerEnterWorldTime = LocalDateTime.ofInstant(java.time.Instant.ofEpochMilli(this.assetManager.getTimeStamp("EnterWorld")), ZoneId.systemDefault());
|
||||||
Period period = new Period(playerEnterWorldTime.getMillis(), now.getMillis());
|
int hoursLoggedIn = (int) java.time.Duration.between(playerEnterWorldTime, now).toHours();
|
||||||
int hoursLoggedIn = period.getHours();
|
|
||||||
hoursLoggedIn = hoursLoggedIn < 0 ? 0 : hoursLoggedIn;
|
hoursLoggedIn = hoursLoggedIn < 0 ? 0 : hoursLoggedIn;
|
||||||
|
|
||||||
defaultTime = defaultTime.plusDays(2);
|
defaultTime = defaultTime.plusDays(2).withHour(22).withMinute(0).withSecond(0).withNano(0);
|
||||||
defaultTime = defaultTime.hourOfDay().setCopy(22);
|
|
||||||
defaultTime = defaultTime.minuteOfHour().setCopy(0);
|
|
||||||
defaultTime = defaultTime.secondOfMinute().setCopy(0);
|
|
||||||
|
|
||||||
long curTime = now.getMillis();
|
long curTime = now.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
long timeLeft = 0;
|
long timeLeft = 0;
|
||||||
|
|
||||||
if (bane.getLiveDate() != null)
|
if (bane.getLiveDate() != null)
|
||||||
timeLeft = bane.getLiveDate().getMillis() - curTime;
|
timeLeft = bane.getLiveDate().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() - curTime;
|
||||||
else
|
else
|
||||||
timeLeft = defaultTime.getMillis() - curTime + 1000;
|
timeLeft = defaultTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() - curTime + 1000;
|
||||||
|
|
||||||
//DO not touch these. They are static formula's until i get the correct converter for SB Time.
|
//DO not touch these. They are static formula's until i get the correct converter for SB Time.
|
||||||
|
|
||||||
writer.put((byte) placedOn.dayOfMonth().get());
|
writer.put((byte) placedOn.getDayOfMonth());
|
||||||
writer.put((byte) placedOn.monthOfYear().get());
|
writer.put((byte) placedOn.getMonthValue());
|
||||||
writer.putInt(placedOn.year().get() - 1900);
|
writer.putInt(placedOn.getYear() - 1900);
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ import engine.net.ByteBufferWriter;
|
|||||||
import engine.net.client.Protocol;
|
import engine.net.client.Protocol;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.joda.time.Period;
|
|
||||||
import org.joda.time.Seconds;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -140,7 +137,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
@Override
|
@Override
|
||||||
protected void _serialize(ByteBufferWriter writer) {
|
protected void _serialize(ByteBufferWriter writer) {
|
||||||
|
|
||||||
Period upgradePeriod;
|
java.time.Duration upgradePeriod;
|
||||||
int upgradePeriodInSeconds;
|
int upgradePeriodInSeconds;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -202,21 +199,22 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
writer.putInt(npc.getUpgradeCost());
|
writer.putInt(npc.getUpgradeCost());
|
||||||
|
|
||||||
if (npc.isRanking() && npc.getUpgradeDateTime().isAfter(DateTime.now()))
|
if (npc.isRanking() && npc.getUpgradeDateTime().isAfter(java.time.Instant.now()))
|
||||||
upgradePeriod = new Period(DateTime.now(), npc.getUpgradeDateTime());
|
upgradePeriod = java.time.Duration.between(java.time.Instant.now(), npc.getUpgradeDateTime());
|
||||||
else
|
else
|
||||||
upgradePeriod = new Period(0);
|
upgradePeriod = java.time.Duration.ZERO;
|
||||||
|
|
||||||
writer.put((byte) upgradePeriod.getDays()); //for timer
|
long npcUpgradeSec = Math.max(0L, upgradePeriod.getSeconds());
|
||||||
|
writer.put((byte) (int) (npcUpgradeSec / 86400)); //for timer
|
||||||
writer.put((byte) unknown26);//unknown
|
writer.put((byte) unknown26);//unknown
|
||||||
writer.putInt(100); //unknown
|
writer.putInt(100); //unknown
|
||||||
|
|
||||||
writer.put((byte) upgradePeriod.getHours()); //for timer
|
writer.put((byte) (int) ((npcUpgradeSec % 86400) / 3600)); //for timer
|
||||||
writer.put((byte) upgradePeriod.getMinutes()); //for timer
|
writer.put((byte) (int) ((npcUpgradeSec % 3600) / 60)); //for timer
|
||||||
writer.put((byte) upgradePeriod.getSeconds()); //for timer
|
writer.put((byte) (int) (npcUpgradeSec % 60)); //for timer
|
||||||
|
|
||||||
if (npc.isRanking() && npc.getUpgradeDateTime().isAfter(DateTime.now()))
|
if (npc.isRanking() && npc.getUpgradeDateTime().isAfter(java.time.Instant.now()))
|
||||||
upgradePeriodInSeconds = Seconds.secondsBetween(DateTime.now(), npc.getUpgradeDateTime()).getSeconds();
|
upgradePeriodInSeconds = (int) npcUpgradeSec;
|
||||||
else
|
else
|
||||||
upgradePeriodInSeconds = 0;
|
upgradePeriodInSeconds = 0;
|
||||||
|
|
||||||
@@ -610,21 +608,22 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
writer.putInt(Mob.getUpgradeCost(mobA));
|
writer.putInt(Mob.getUpgradeCost(mobA));
|
||||||
|
|
||||||
if (mobA.isRanking() && mobA.getUpgradeDateTime().isAfter(DateTime.now()))
|
if (mobA.isRanking() && mobA.getUpgradeDateTime().isAfter(java.time.Instant.now()))
|
||||||
upgradePeriod = new Period(DateTime.now(), mobA.getUpgradeDateTime());
|
upgradePeriod = java.time.Duration.between(java.time.Instant.now(), mobA.getUpgradeDateTime());
|
||||||
else
|
else
|
||||||
upgradePeriod = new Period(0);
|
upgradePeriod = java.time.Duration.ZERO;
|
||||||
|
|
||||||
writer.put((byte) upgradePeriod.getDays()); //for timer
|
long mobUpgradeSec = Math.max(0L, upgradePeriod.getSeconds());
|
||||||
|
writer.put((byte) (int) (mobUpgradeSec / 86400)); //for timer
|
||||||
writer.put((byte) unknown26);//unknown
|
writer.put((byte) unknown26);//unknown
|
||||||
writer.putInt(100); //unknown
|
writer.putInt(100); //unknown
|
||||||
|
|
||||||
writer.put((byte) upgradePeriod.getHours()); //for timer
|
writer.put((byte) (int) ((mobUpgradeSec % 86400) / 3600)); //for timer
|
||||||
writer.put((byte) upgradePeriod.getMinutes()); //for timer
|
writer.put((byte) (int) ((mobUpgradeSec % 3600) / 60)); //for timer
|
||||||
writer.put((byte) upgradePeriod.getSeconds()); //for timer
|
writer.put((byte) (int) (mobUpgradeSec % 60)); //for timer
|
||||||
|
|
||||||
if (mobA.isRanking() && mobA.getUpgradeDateTime().isAfter(DateTime.now()))
|
if (mobA.isRanking() && mobA.getUpgradeDateTime().isAfter(java.time.Instant.now()))
|
||||||
upgradePeriodInSeconds = Seconds.secondsBetween(DateTime.now(), mobA.getUpgradeDateTime()).getSeconds();
|
upgradePeriodInSeconds = (int) mobUpgradeSec;
|
||||||
else
|
else
|
||||||
upgradePeriodInSeconds = 0;
|
upgradePeriodInSeconds = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import engine.net.ByteBufferWriter;
|
|||||||
import engine.net.client.Protocol;
|
import engine.net.client.Protocol;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
|
|
||||||
|
|
||||||
public class GuildInfoMsg extends ClientNetMsg {
|
public class GuildInfoMsg extends ClientNetMsg {
|
||||||
@@ -306,7 +306,7 @@ class GuildInfoMessageType4 extends GuildInfoMessageType {
|
|||||||
writer.putString(guildLeaderName);
|
writer.putString(guildLeaderName);
|
||||||
writer.putString(pc.getName());
|
writer.putString(pc.getName());
|
||||||
|
|
||||||
writer.putDateTime(DateTime.now());
|
writer.putDateTime(Instant.now());
|
||||||
writer.put((byte) 1);
|
writer.put((byte) 1);
|
||||||
writer.put((byte) 1);
|
writer.put((byte) 1);
|
||||||
writer.put((byte) 1);
|
writer.put((byte) 1);
|
||||||
@@ -401,7 +401,7 @@ class GuildInfoMessageType5 extends GuildInfoMessageType {
|
|||||||
writer.putString("Guild Leader");
|
writer.putString("Guild Leader");
|
||||||
writer.putString(""); //Nation Leader - I believe
|
writer.putString(""); //Nation Leader - I believe
|
||||||
|
|
||||||
DateTime now = DateTime.now();
|
Instant now = Instant.now();
|
||||||
writer.putDateTime(now);
|
writer.putDateTime(now);
|
||||||
|
|
||||||
writer.put((byte) 1);
|
writer.put((byte) 1);
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ import engine.net.client.ClientConnection;
|
|||||||
import engine.net.client.msg.PlaceAssetMsg;
|
import engine.net.client.msg.PlaceAssetMsg;
|
||||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -45,8 +46,8 @@ public final class Bane {
|
|||||||
private final int cityUUID;
|
private final int cityUUID;
|
||||||
private final int stoneUUID;
|
private final int stoneUUID;
|
||||||
private int ownerUUID;
|
private int ownerUUID;
|
||||||
private DateTime placementDate = null;
|
private LocalDateTime placementDate = null;
|
||||||
private DateTime liveDate = null;
|
private LocalDateTime liveDate = null;
|
||||||
private BaneDefaultTimeJob defaultTimeJob;
|
private BaneDefaultTimeJob defaultTimeJob;
|
||||||
|
|
||||||
// Internal cache for banes
|
// Internal cache for banes
|
||||||
@@ -57,7 +58,7 @@ public final class Bane {
|
|||||||
*/
|
*/
|
||||||
public Bane(ResultSet rs) throws SQLException {
|
public Bane(ResultSet rs) throws SQLException {
|
||||||
|
|
||||||
Date sqlDateTime;
|
java.sql.Timestamp sqlDateTime;
|
||||||
ActivateBaneJob abtj;
|
ActivateBaneJob abtj;
|
||||||
|
|
||||||
this.cityUUID = rs.getInt("cityUUID");
|
this.cityUUID = rs.getInt("cityUUID");
|
||||||
@@ -67,12 +68,12 @@ public final class Bane {
|
|||||||
sqlDateTime = rs.getTimestamp("placementDate");
|
sqlDateTime = rs.getTimestamp("placementDate");
|
||||||
|
|
||||||
if (sqlDateTime != null)
|
if (sqlDateTime != null)
|
||||||
this.placementDate = new DateTime(sqlDateTime);
|
this.placementDate = sqlDateTime.toLocalDateTime();
|
||||||
|
|
||||||
sqlDateTime = rs.getTimestamp("liveDate");
|
sqlDateTime = rs.getTimestamp("liveDate");
|
||||||
|
|
||||||
if (sqlDateTime != null)
|
if (sqlDateTime != null)
|
||||||
this.liveDate = new DateTime(sqlDateTime);
|
this.liveDate = sqlDateTime.toLocalDateTime();
|
||||||
|
|
||||||
switch (this.getSiegePhase()) {
|
switch (this.getSiegePhase()) {
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ public final class Bane {
|
|||||||
this.activateBaneJob.cancelJob();
|
this.activateBaneJob.cancelJob();
|
||||||
|
|
||||||
abtj = new ActivateBaneJob(cityUUID);
|
abtj = new ActivateBaneJob(cityUUID);
|
||||||
JobScheduler.getInstance().scheduleJob(abtj, this.liveDate.getMillis());
|
JobScheduler.getInstance().scheduleJob(abtj, toEpochMillis(this.liveDate));
|
||||||
this.activateBaneJob = abtj;
|
this.activateBaneJob = abtj;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -98,7 +99,7 @@ public final class Bane {
|
|||||||
this.activateBaneJob.cancelJob();
|
this.activateBaneJob.cancelJob();
|
||||||
|
|
||||||
abtj = new ActivateBaneJob(cityUUID);
|
abtj = new ActivateBaneJob(cityUUID);
|
||||||
JobScheduler.getInstance().scheduleJob(abtj, this.liveDate.getMillis());
|
JobScheduler.getInstance().scheduleJob(abtj, toEpochMillis(this.liveDate));
|
||||||
this.activateBaneJob = abtj;
|
this.activateBaneJob = abtj;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -356,7 +357,7 @@ public final class Bane {
|
|||||||
return phase;
|
return phase;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DateTime.now().isAfter(this.liveDate)) {
|
if (LocalDateTime.now().isAfter(this.liveDate)) {
|
||||||
phase = SiegePhase.WAR; //war
|
phase = SiegePhase.WAR; //war
|
||||||
return phase;
|
return phase;
|
||||||
}
|
}
|
||||||
@@ -371,15 +372,10 @@ public final class Bane {
|
|||||||
|
|
||||||
private void setDefaultTime() {
|
private void setDefaultTime() {
|
||||||
|
|
||||||
DateTime timeToSetDefault = new DateTime(this.placementDate);
|
LocalDateTime timeToSetDefault = this.placementDate.plusDays(1);
|
||||||
timeToSetDefault = timeToSetDefault.plusDays(1);
|
LocalDateTime currentTime = LocalDateTime.now();
|
||||||
|
LocalDateTime defaultTime = this.placementDate.plusDays(2)
|
||||||
DateTime currentTime = DateTime.now();
|
.withHour(22).withMinute(0).withSecond(0).withNano(0);
|
||||||
DateTime defaultTime = new DateTime(this.placementDate);
|
|
||||||
defaultTime = defaultTime.plusDays(2);
|
|
||||||
defaultTime = defaultTime.hourOfDay().setCopy(22);
|
|
||||||
defaultTime = defaultTime.minuteOfHour().setCopy(0);
|
|
||||||
defaultTime = defaultTime.secondOfMinute().setCopy(0);
|
|
||||||
|
|
||||||
if (currentTime.isAfter(timeToSetDefault))
|
if (currentTime.isAfter(timeToSetDefault))
|
||||||
this.setLiveDate(defaultTime);
|
this.setLiveDate(defaultTime);
|
||||||
@@ -389,7 +385,7 @@ public final class Bane {
|
|||||||
this.defaultTimeJob.cancelJob();
|
this.defaultTimeJob.cancelJob();
|
||||||
|
|
||||||
BaneDefaultTimeJob bdtj = new BaneDefaultTimeJob(this);
|
BaneDefaultTimeJob bdtj = new BaneDefaultTimeJob(this);
|
||||||
JobScheduler.getInstance().scheduleJob(bdtj, timeToSetDefault.getMillis());
|
JobScheduler.getInstance().scheduleJob(bdtj, toEpochMillis(timeToSetDefault));
|
||||||
this.defaultTimeJob = bdtj;
|
this.defaultTimeJob = bdtj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -456,7 +452,7 @@ public final class Bane {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final DateTime getPlacementDate() {
|
public final LocalDateTime getPlacementDate() {
|
||||||
return placementDate;
|
return placementDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,14 +461,14 @@ public final class Bane {
|
|||||||
return (this.getSiegePhase() != SiegePhase.CHALLENGE);
|
return (this.getSiegePhase() != SiegePhase.CHALLENGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final DateTime getLiveDate() {
|
public final LocalDateTime getLiveDate() {
|
||||||
return liveDate;
|
return liveDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLiveDate(DateTime baneTime) {
|
public void setLiveDate(LocalDateTime baneTime) {
|
||||||
|
|
||||||
if (DbManager.BaneQueries.SET_BANE_TIME(baneTime, this.getCity().getObjectUUID())) {
|
if (DbManager.BaneQueries.SET_BANE_TIME(baneTime, this.getCity().getObjectUUID())) {
|
||||||
this.liveDate = new DateTime(baneTime);
|
this.liveDate = baneTime;
|
||||||
|
|
||||||
// Push event to warehouse
|
// Push event to warehouse
|
||||||
|
|
||||||
@@ -514,7 +510,7 @@ public final class Bane {
|
|||||||
|
|
||||||
ActivateBaneJob abtj = new ActivateBaneJob(cityUUID);
|
ActivateBaneJob abtj = new ActivateBaneJob(cityUUID);
|
||||||
|
|
||||||
JobScheduler.getInstance().scheduleJob(abtj, this.liveDate.getMillis());
|
JobScheduler.getInstance().scheduleJob(abtj, toEpochMillis(this.liveDate));
|
||||||
this.activateBaneJob = abtj;
|
this.activateBaneJob = abtj;
|
||||||
} else {
|
} else {
|
||||||
Logger.debug("error with city " + this.getCity().getName());
|
Logger.debug("error with city " + this.getCity().getName());
|
||||||
@@ -644,4 +640,8 @@ public final class Bane {
|
|||||||
return cityUUID;
|
return cityUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long toEpochMillis(LocalDateTime ldt) {
|
||||||
|
return ldt.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import engine.net.client.msg.ErrorPopupMsg;
|
|||||||
import engine.net.client.msg.UpdateClientAlliancesMsg;
|
import engine.net.client.msg.UpdateClientAlliancesMsg;
|
||||||
import engine.net.client.msg.guild.GuildInfoMsg;
|
import engine.net.client.msg.guild.GuildInfoMsg;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -654,8 +654,8 @@ public class Guild extends AbstractWorldObject {
|
|||||||
|
|
||||||
//Add to Guild History
|
//Add to Guild History
|
||||||
if (pc.getGuild() != null) {
|
if (pc.getGuild() != null) {
|
||||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(pc.getGuildUUID(), pc, DateTime.now(), historyType)) {
|
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(pc.getGuildUUID(), pc, Instant.now(), historyType)) {
|
||||||
GuildHistory guildHistory = new GuildHistory(pc.getGuildUUID(), pc.getGuild().name, DateTime.now(), historyType);
|
GuildHistory guildHistory = new GuildHistory(pc.getGuildUUID(), pc.getGuild().name, Instant.now(), historyType);
|
||||||
pc.getGuildHistory().add(guildHistory);
|
pc.getGuildHistory().add(guildHistory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ package engine.objects;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.GuildHistoryType;
|
import engine.Enum.GuildHistoryType;
|
||||||
import engine.net.ByteBufferWriter;
|
import engine.net.ByteBufferWriter;
|
||||||
import org.joda.time.DateTime;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
|
||||||
|
|
||||||
public class GuildHistory {
|
public class GuildHistory {
|
||||||
@@ -24,12 +25,12 @@ public class GuildHistory {
|
|||||||
|
|
||||||
private int guildID;
|
private int guildID;
|
||||||
private String guildName;
|
private String guildName;
|
||||||
private DateTime time;
|
private Instant time;
|
||||||
private GuildHistoryType historyType;
|
private GuildHistoryType historyType;
|
||||||
|
|
||||||
|
|
||||||
public GuildHistory(int guildID, String guildName,
|
public GuildHistory(int guildID, String guildName,
|
||||||
DateTime dateTime, GuildHistoryType historyType) {
|
Instant dateTime, GuildHistoryType historyType) {
|
||||||
super();
|
super();
|
||||||
this.guildID = guildID;
|
this.guildID = guildID;
|
||||||
this.guildName = guildName;
|
this.guildName = guildName;
|
||||||
@@ -49,9 +50,9 @@ public class GuildHistory {
|
|||||||
|
|
||||||
sqlDateTime = rs.getTimestamp("historyDate");
|
sqlDateTime = rs.getTimestamp("historyDate");
|
||||||
if (sqlDateTime != null)
|
if (sqlDateTime != null)
|
||||||
this.time = new DateTime(sqlDateTime);
|
this.time = sqlDateTime.toInstant();
|
||||||
else
|
else
|
||||||
this.time = DateTime.now().minusYears(1);
|
this.time = Instant.now().minus(1, ChronoUnit.YEARS);
|
||||||
this.historyType = GuildHistoryType.valueOf(rs.getString("historyType"));
|
this.historyType = GuildHistoryType.valueOf(rs.getString("historyType"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,11 +78,11 @@ public class GuildHistory {
|
|||||||
writer.putDateTime(this.time);
|
writer.putDateTime(this.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getTime() {
|
public Instant getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(DateTime time) {
|
public void setTime(Instant time) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import engine.net.client.ClientConnection;
|
|||||||
import engine.net.client.msg.ErrorPopupMsg;
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -199,8 +198,6 @@ public class ItemFactory {
|
|||||||
// to this, not when 'compelte' is pressed.
|
// to this, not when 'compelte' is pressed.
|
||||||
long upgradeTime = System.currentTimeMillis() + (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
long upgradeTime = System.currentTimeMillis() + (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
||||||
|
|
||||||
DateTime dateTime = new DateTime();
|
|
||||||
dateTime = dateTime.withMillis(upgradeTime);
|
|
||||||
ml.setDateToUpgrade(upgradeTime);
|
ml.setDateToUpgrade(upgradeTime);
|
||||||
|
|
||||||
npc.addItemToForge(ml);
|
npc.addItemToForge(ml);
|
||||||
@@ -209,8 +206,8 @@ public class ItemFactory {
|
|||||||
|
|
||||||
if (pc != null)
|
if (pc != null)
|
||||||
playerID = pc.getObjectUUID();
|
playerID = pc.getObjectUUID();
|
||||||
DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getItemBaseID(), dateTime, "", "", "", false, playerID);
|
DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getItemBaseID(), upgradeTime, "", "", "", false, playerID);
|
||||||
ProducedItem pi = new ProducedItem(ml.getObjectUUID(), npc.getObjectUUID(), ml.getItemBaseID(), dateTime, false, "", "", "", playerID);
|
ProducedItem pi = new ProducedItem(ml.getObjectUUID(), npc.getObjectUUID(), ml.getItemBaseID(), upgradeTime, false, "", "", "", playerID);
|
||||||
pi.setProducedItemID(ml.getObjectUUID());
|
pi.setProducedItemID(ml.getObjectUUID());
|
||||||
pi.setAmount(itemsToRoll);
|
pi.setAmount(itemsToRoll);
|
||||||
pi.setRandom(false);
|
pi.setRandom(false);
|
||||||
@@ -616,8 +613,6 @@ public class ItemFactory {
|
|||||||
// to this, not when 'compelte' is pressed.
|
// to this, not when 'compelte' is pressed.
|
||||||
long upgradeTime = System.currentTimeMillis() + (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
long upgradeTime = System.currentTimeMillis() + (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
||||||
|
|
||||||
DateTime dateTime = new DateTime();
|
|
||||||
dateTime = dateTime.withMillis(upgradeTime);
|
|
||||||
ml.setDateToUpgrade(upgradeTime);
|
ml.setDateToUpgrade(upgradeTime);
|
||||||
|
|
||||||
npc.addItemToForge(ml);
|
npc.addItemToForge(ml);
|
||||||
@@ -626,8 +621,8 @@ public class ItemFactory {
|
|||||||
if (pc != null)
|
if (pc != null)
|
||||||
playerID = pc.getObjectUUID();
|
playerID = pc.getObjectUUID();
|
||||||
|
|
||||||
DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getItemBaseID(), dateTime, prefixString, suffixString, ml.getCustomName(), false, playerID);
|
DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getItemBaseID(), upgradeTime, prefixString, suffixString, ml.getCustomName(), false, playerID);
|
||||||
ProducedItem pi = new ProducedItem(npc.getRolling().size(), npc.getObjectUUID(), ml.getItemBaseID(), dateTime, false, prefixString, suffixString, ml.getCustomName(), playerID);
|
ProducedItem pi = new ProducedItem(npc.getRolling().size(), npc.getObjectUUID(), ml.getItemBaseID(), upgradeTime, false, prefixString, suffixString, ml.getCustomName(), playerID);
|
||||||
pi.setProducedItemID(ml.getObjectUUID());
|
pi.setProducedItemID(ml.getObjectUUID());
|
||||||
pi.setAmount(itemsToRoll);
|
pi.setAmount(itemsToRoll);
|
||||||
|
|
||||||
@@ -754,8 +749,6 @@ public class ItemFactory {
|
|||||||
|
|
||||||
long upgradeTime = System.currentTimeMillis() + (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
long upgradeTime = System.currentTimeMillis() + (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
||||||
|
|
||||||
DateTime dateTime = new DateTime();
|
|
||||||
dateTime = dateTime.withMillis(upgradeTime);
|
|
||||||
toRoll.setDateToUpgrade(upgradeTime);
|
toRoll.setDateToUpgrade(upgradeTime);
|
||||||
|
|
||||||
int playerID = 0;
|
int playerID = 0;
|
||||||
@@ -763,9 +756,9 @@ public class ItemFactory {
|
|||||||
if (playerCharacter != null)
|
if (playerCharacter != null)
|
||||||
playerID = playerCharacter.getObjectUUID();
|
playerID = playerCharacter.getObjectUUID();
|
||||||
|
|
||||||
DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getItemBaseID(), dateTime, prefix, suffix, toRoll.getCustomName(), true, playerID);
|
DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getItemBaseID(), upgradeTime, prefix, suffix, toRoll.getCustomName(), true, playerID);
|
||||||
|
|
||||||
ProducedItem pi = new ProducedItem(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getItemBaseID(), dateTime, true, prefix, suffix, toRoll.getCustomName(), playerID);
|
ProducedItem pi = new ProducedItem(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getItemBaseID(), upgradeTime, true, prefix, suffix, toRoll.getCustomName(), playerID);
|
||||||
pi.setProducedItemID(toRoll.getObjectUUID());
|
pi.setProducedItemID(toRoll.getObjectUUID());
|
||||||
pi.setAmount(itemsToRoll);
|
pi.setAmount(itemsToRoll);
|
||||||
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())));
|
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())));
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import engine.net.client.msg.PlaceAssetMsg;
|
|||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.MobPowerEntry;
|
import engine.powers.MobPowerEntry;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -98,7 +98,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
private int lastMobPowerToken = 0;
|
private int lastMobPowerToken = 0;
|
||||||
private HashMap<Integer, MobEquipment> equip = null;
|
private HashMap<Integer, MobEquipment> equip = null;
|
||||||
private DeferredPowerJob weaponPower;
|
private DeferredPowerJob weaponPower;
|
||||||
private DateTime upgradeDateTime = null;
|
private Instant upgradeDateTime = null;
|
||||||
private boolean lootSync = false;
|
private boolean lootSync = false;
|
||||||
|
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
sqlDateTime = rs.getTimestamp("upgradeDate");
|
sqlDateTime = rs.getTimestamp("upgradeDate");
|
||||||
|
|
||||||
if (sqlDateTime != null)
|
if (sqlDateTime != null)
|
||||||
upgradeDateTime = new DateTime(sqlDateTime);
|
upgradeDateTime = sqlDateTime.toInstant();
|
||||||
else
|
else
|
||||||
upgradeDateTime = null;
|
upgradeDateTime = null;
|
||||||
|
|
||||||
@@ -654,8 +654,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
// Submit upgrade job for future date or current instant
|
// Submit upgrade job for future date or current instant
|
||||||
|
|
||||||
if (mob.getUpgradeDateTime().isAfter(DateTime.now()))
|
if (mob.getUpgradeDateTime().isAfter(Instant.now()))
|
||||||
JobScheduler.getInstance().scheduleJob(new UpgradeNPCJob(mob), mob.getUpgradeDateTime().getMillis());
|
JobScheduler.getInstance().scheduleJob(new UpgradeNPCJob(mob), mob.getUpgradeDateTime().toEpochMilli());
|
||||||
else
|
else
|
||||||
JobScheduler.getInstance().scheduleJob(new UpgradeNPCJob(mob), 0);
|
JobScheduler.getInstance().scheduleJob(new UpgradeNPCJob(mob), 0);
|
||||||
|
|
||||||
@@ -681,7 +681,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
return upgradeCost;
|
return upgradeCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setUpgradeDateTime(Mob mob, DateTime upgradeDateTime) {
|
public static void setUpgradeDateTime(Mob mob, Instant upgradeDateTime) {
|
||||||
|
|
||||||
if (!DbManager.MobQueries.updateUpgradeTime(mob, upgradeDateTime)) {
|
if (!DbManager.MobQueries.updateUpgradeTime(mob, upgradeDateTime)) {
|
||||||
Logger.error("Failed to set upgradeTime for building " + mob.currentID);
|
Logger.error("Failed to set upgradeTime for building " + mob.currentID);
|
||||||
@@ -2118,7 +2118,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
return siegeMinionMap;
|
return siegeMinionMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getUpgradeDateTime() {
|
public Instant getUpgradeDateTime() {
|
||||||
|
|
||||||
lock.readLock().lock();
|
lock.readLock().lock();
|
||||||
|
|
||||||
@@ -2208,7 +2208,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
if (!building.transferGold(-rankCost, false))
|
if (!building.transferGold(-rankCost, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DateTime dateToUpgrade = DateTime.now().plusHours(Mob.getUpgradeTime(this));
|
Instant dateToUpgrade = Instant.now().plusSeconds(Mob.getUpgradeTime(this) * 3600);
|
||||||
Mob.setUpgradeDateTime(this, dateToUpgrade);
|
Mob.setUpgradeDateTime(this, dateToUpgrade);
|
||||||
|
|
||||||
// Schedule upgrade job
|
// Schedule upgrade job
|
||||||
|
|||||||
+12
-12
@@ -28,7 +28,7 @@ import engine.net.client.msg.ItemProductionMsg;
|
|||||||
import engine.net.client.msg.PetMsg;
|
import engine.net.client.msg.PetMsg;
|
||||||
import engine.net.client.msg.PlaceAssetMsg;
|
import engine.net.client.msg.PlaceAssetMsg;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -75,7 +75,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
protected int symbol;
|
protected int symbol;
|
||||||
// Variables NOT to be stored in db
|
// Variables NOT to be stored in db
|
||||||
protected boolean isStatic = false;
|
protected boolean isStatic = false;
|
||||||
private DateTime upgradeDateTime = null;
|
private Instant upgradeDateTime = null;
|
||||||
private HashSet<Integer> canRoll = null;
|
private HashSet<Integer> canRoll = null;
|
||||||
public int parentZoneUUID;
|
public int parentZoneUUID;
|
||||||
public int equipmentSetID = 0;
|
public int equipmentSetID = 0;
|
||||||
@@ -132,13 +132,13 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
this.guildUUID = rs.getInt("npc_guildID");
|
this.guildUUID = rs.getInt("npc_guildID");
|
||||||
|
|
||||||
// Set upgrade date JodaTime DateTime object
|
// Set upgrade date (java.time.Instant) object
|
||||||
// if one exists in the database.
|
// if one exists in the database.
|
||||||
|
|
||||||
sqlDateTime = rs.getTimestamp("upgradeDate");
|
sqlDateTime = rs.getTimestamp("upgradeDate");
|
||||||
|
|
||||||
if (sqlDateTime != null)
|
if (sqlDateTime != null)
|
||||||
upgradeDateTime = new DateTime(sqlDateTime);
|
upgradeDateTime = sqlDateTime.toInstant();
|
||||||
else
|
else
|
||||||
upgradeDateTime = null;
|
upgradeDateTime = null;
|
||||||
|
|
||||||
@@ -554,9 +554,9 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
// Submit upgrade job for future date or current instant
|
// Submit upgrade job for future date or current instant
|
||||||
|
|
||||||
if (this.getUpgradeDateTime().isAfter(DateTime.now()))
|
if (this.getUpgradeDateTime().isAfter(Instant.now()))
|
||||||
jc = JobScheduler.getInstance().scheduleJob(new UpgradeNPCJob(this),
|
jc = JobScheduler.getInstance().scheduleJob(new UpgradeNPCJob(this),
|
||||||
this.getUpgradeDateTime().getMillis());
|
this.getUpgradeDateTime().toEpochMilli());
|
||||||
else
|
else
|
||||||
JobScheduler.getInstance().scheduleJob(new UpgradeNPCJob(this), 0);
|
JobScheduler.getInstance().scheduleJob(new UpgradeNPCJob(this), 0);
|
||||||
|
|
||||||
@@ -939,7 +939,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
ml.loadEnchantments();
|
ml.loadEnchantments();
|
||||||
|
|
||||||
ml.setValue(producedItem.getValue());
|
ml.setValue(producedItem.getValue());
|
||||||
ml.setDateToUpgrade(producedItem.getDateToUpgrade().getMillis());
|
ml.setDateToUpgrade(producedItem.getDateToUpgrade());
|
||||||
ml.containerType = Enum.ItemContainerType.FORGE;
|
ml.containerType = Enum.ItemContainerType.FORGE;
|
||||||
this.addItemToForge(ml);
|
this.addItemToForge(ml);
|
||||||
|
|
||||||
@@ -955,7 +955,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
ml.setSuffix(producedItem.getSuffix());
|
ml.setSuffix(producedItem.getSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
ml.setDateToUpgrade(producedItem.getDateToUpgrade().getMillis());
|
ml.setDateToUpgrade(producedItem.getDateToUpgrade());
|
||||||
ml.containerType = Enum.ItemContainerType.INVENTORY;
|
ml.containerType = Enum.ItemContainerType.INVENTORY;
|
||||||
ml.setIsID(true);
|
ml.setIsID(true);
|
||||||
|
|
||||||
@@ -982,7 +982,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
return new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
return new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getUpgradeDateTime() {
|
public Instant getUpgradeDateTime() {
|
||||||
lock.readLock().lock();
|
lock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
return upgradeDateTime;
|
return upgradeDateTime;
|
||||||
@@ -991,7 +991,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpgradeDateTime(DateTime upgradeDateTime) {
|
public void setUpgradeDateTime(Instant upgradeDateTime) {
|
||||||
|
|
||||||
if (!DbManager.NPCQueries.updateUpgradeTime(this, upgradeDateTime)) {
|
if (!DbManager.NPCQueries.updateUpgradeTime(this, upgradeDateTime)) {
|
||||||
Logger.error("Failed to set upgradeTime for building " + currentID);
|
Logger.error("Failed to set upgradeTime for building " + currentID);
|
||||||
@@ -1286,7 +1286,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
int rankCost;
|
int rankCost;
|
||||||
Building building;
|
Building building;
|
||||||
DateTime dateToUpgrade;
|
Instant dateToUpgrade;
|
||||||
|
|
||||||
|
|
||||||
this.lock.writeLock().lock();
|
this.lock.writeLock().lock();
|
||||||
@@ -1329,7 +1329,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
if (!building.transferGold(-rankCost, false))
|
if (!building.transferGold(-rankCost, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dateToUpgrade = DateTime.now().plusHours(this.getUpgradeTime());
|
dateToUpgrade = Instant.now().plusSeconds(this.getUpgradeTime() * 3600);
|
||||||
|
|
||||||
this.setUpgradeDateTime(dateToUpgrade);
|
this.setUpgradeDateTime(dateToUpgrade);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ import engine.server.login.LoginServer;
|
|||||||
import engine.server.login.LoginServerMsgHandler;
|
import engine.server.login.LoginServerMsgHandler;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
import engine.util.MiscUtils;
|
import engine.util.MiscUtils;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
|
import java.time.ZoneId;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -718,11 +719,11 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
writer.putInt(token);
|
writer.putInt(token);
|
||||||
writer.putInt((int) timeLeft / 1000);
|
writer.putInt((int) timeLeft / 1000);
|
||||||
}
|
}
|
||||||
DateTime enterWorld = new DateTime(playerCharacter.timestamps.get("EnterWorld"));
|
Instant enterWorld = Instant.ofEpochMilli(playerCharacter.timestamps.get("EnterWorld"));
|
||||||
writer.putDateTime(enterWorld);
|
writer.putDateTime(enterWorld);
|
||||||
|
|
||||||
writer.putInt(0x49EF1E98); //DUnno what playerCharacter is.
|
writer.putInt(0x49EF1E98); //DUnno what playerCharacter is.
|
||||||
writer.putFloat(DateTime.now().hourOfDay().get()); //daylight in float.
|
writer.putFloat(Instant.now().atZone(ZoneId.systemDefault()).toLocalTime().getHour()); //daylight in float.
|
||||||
writer.putFloat(6); //interval of light to change per game hour //float
|
writer.putFloat(6); //interval of light to change per game hour //float
|
||||||
//writer.putInt(1637194901); //playerCharacter is actually an opcode taht is in recordings, no clue what it is, dumped it and it changes nothing
|
//writer.putInt(1637194901); //playerCharacter is actually an opcode taht is in recordings, no clue what it is, dumped it and it changes nothing
|
||||||
} else {
|
} else {
|
||||||
@@ -4872,7 +4873,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
this.timestamps.put("RealmClaim", DateTime.now().plusMinutes(3).getMillis());
|
this.timestamps.put("RealmClaim", Instant.now().plusSeconds(180).toEpochMilli());
|
||||||
for (PlayerCharacter toSend : SessionManager.getAllActivePlayerCharacters()) {
|
for (PlayerCharacter toSend : SessionManager.getAllActivePlayerCharacters()) {
|
||||||
ChatManager.chatSystemInfo(toSend, this.getCombinedName() + " is seeking to claim a realm and already has " + count + " blessngs!");
|
ChatManager.chatSystemInfo(toSend, this.getCombinedName() + " is seeking to claim a realm and already has " + count + " blessngs!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import engine.gameManager.PowersManager;
|
|||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.msg.ItemProductionMsg;
|
import engine.net.client.msg.ItemProductionMsg;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -26,7 +25,7 @@ public class ProducedItem {
|
|||||||
private int ID;
|
private int ID;
|
||||||
private int npcUID;
|
private int npcUID;
|
||||||
private int itemBaseID;
|
private int itemBaseID;
|
||||||
private DateTime dateToUpgrade;
|
private long dateToUpgrade;
|
||||||
private boolean isRandom;
|
private boolean isRandom;
|
||||||
|
|
||||||
private String prefix;
|
private String prefix;
|
||||||
@@ -52,9 +51,9 @@ public class ProducedItem {
|
|||||||
Date sqlDateTime = rs.getTimestamp("dateToUpgrade");
|
Date sqlDateTime = rs.getTimestamp("dateToUpgrade");
|
||||||
|
|
||||||
if (sqlDateTime != null)
|
if (sqlDateTime != null)
|
||||||
this.dateToUpgrade = new DateTime(sqlDateTime);
|
this.dateToUpgrade = sqlDateTime.getTime();
|
||||||
else
|
else
|
||||||
dateToUpgrade = null;
|
dateToUpgrade = 0;
|
||||||
this.isRandom = rs.getBoolean("isRandom");
|
this.isRandom = rs.getBoolean("isRandom");
|
||||||
this.prefix = rs.getString("prefix");
|
this.prefix = rs.getString("prefix");
|
||||||
this.suffix = rs.getString("suffix");
|
this.suffix = rs.getString("suffix");
|
||||||
@@ -64,7 +63,7 @@ public class ProducedItem {
|
|||||||
this.playerID = rs.getInt("playerID");
|
this.playerID = rs.getInt("playerID");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProducedItem(int ID, int npcUID, int itemBaseID, DateTime dateToUpgrade, boolean isRandom, String prefix, String suffix, String name, int playerID) {
|
public ProducedItem(int ID, int npcUID, int itemBaseID, long dateToUpgrade, boolean isRandom, String prefix, String suffix, String name, int playerID) {
|
||||||
super();
|
super();
|
||||||
this.ID = ID;
|
this.ID = ID;
|
||||||
this.npcUID = npcUID;
|
this.npcUID = npcUID;
|
||||||
@@ -84,7 +83,7 @@ public class ProducedItem {
|
|||||||
return npcUID;
|
return npcUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getDateToUpgrade() {
|
public long getDateToUpgrade() {
|
||||||
return dateToUpgrade;
|
return dateToUpgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package engine.objects;
|
|||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.TransactionType;
|
import engine.Enum.TransactionType;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -23,7 +23,7 @@ public class Transaction implements Comparable<Transaction> {
|
|||||||
private final int warehouseUUID;
|
private final int warehouseUUID;
|
||||||
private final int targetUUID;
|
private final int targetUUID;
|
||||||
private final Resource resource;
|
private final Resource resource;
|
||||||
private final DateTime date;
|
private final Instant date;
|
||||||
private final int amount;
|
private final int amount;
|
||||||
private final TransactionType transactionType;
|
private final TransactionType transactionType;
|
||||||
private GameObjectType targetType;
|
private GameObjectType targetType;
|
||||||
@@ -40,15 +40,15 @@ public class Transaction implements Comparable<Transaction> {
|
|||||||
Date sqlDateTime = rs.getTimestamp("date");
|
Date sqlDateTime = rs.getTimestamp("date");
|
||||||
|
|
||||||
if (sqlDateTime != null)
|
if (sqlDateTime != null)
|
||||||
this.date = new DateTime(sqlDateTime);
|
this.date = sqlDateTime.toInstant();
|
||||||
else
|
else
|
||||||
this.date = DateTime.now();
|
this.date = Instant.now();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Transaction(int warehouseUUID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount,
|
public Transaction(int warehouseUUID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount,
|
||||||
DateTime date) {
|
Instant date) {
|
||||||
this.warehouseUUID = warehouseUUID;
|
this.warehouseUUID = warehouseUUID;
|
||||||
this.targetUUID = targetUUID;
|
this.targetUUID = targetUUID;
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
@@ -74,7 +74,7 @@ public class Transaction implements Comparable<Transaction> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DateTime getDate() {
|
public Instant getDate() {
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import engine.net.DispatchMessage;
|
|||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.*;
|
import engine.net.client.msg.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import java.time.Instant;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -1308,10 +1308,10 @@ public class Warehouse extends AbstractWorldObject {
|
|||||||
public boolean AddTransactionToWarehouse(GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount) {
|
public boolean AddTransactionToWarehouse(GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount) {
|
||||||
|
|
||||||
|
|
||||||
if (!DbManager.WarehouseQueries.CREATE_TRANSACTION(this.buildingUID, targetType, targetUUID, transactionType, resource, amount, DateTime.now()))
|
if (!DbManager.WarehouseQueries.CREATE_TRANSACTION(this.buildingUID, targetType, targetUUID, transactionType, resource, amount, Instant.now()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Transaction transaction = new Transaction(this.buildingUID, targetType, targetUUID, transactionType, resource, amount, DateTime.now());
|
Transaction transaction = new Transaction(this.buildingUID, targetType, targetUUID, transactionType, resource, amount, Instant.now());
|
||||||
this.transactions.add(transaction);
|
this.transactions.add(transaction);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user