Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 28836a7a4f | |||
| 5511dc7899 | |||
| e5b2247204 | |||
| 0404ca1a94 |
@@ -32,14 +32,10 @@ public class dbBuildingLocationHandler extends dbHandlerBase {
|
||||
ArrayList<BuildingLocation> buildingLocations = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"SELECT MIN(ID), BuildingID, slot, MIN(type), MIN(unknown), MIN(locX), MIN(locY), MIN(locZ), " +
|
||||
"MIN(w), MIN(rotX), MIN(rotY), MIN(rotZ) " +
|
||||
"FROM static_building_location " +
|
||||
"WHERE type IN (6, 8) " +
|
||||
"GROUP BY BuildingID, slot " +
|
||||
"ORDER BY BuildingID, slot ASC;"
|
||||
)) {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("select `ID`, `BuildingID`, `type`, `slot`, `unknown`, `locX`, `locY`, `locZ`, `w`, `rotX`, `rotY`, `rotZ` from static_building_location " +
|
||||
"where type = 6 or type = 8 " +
|
||||
"GROUP BY buildingID, slot " +
|
||||
"ORDER BY buildingID, slot ASC;")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
buildingLocations = getObjectsFromRs(rs, 20);
|
||||
|
||||
@@ -210,7 +210,7 @@ public class dbCityHandler extends dbHandlerBase {
|
||||
public boolean updateSiegesWithstood(City city, int value) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_city` SET `siegesWithstood`=?"
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_city` SET `name`=?"
|
||||
+ " WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, value);
|
||||
|
||||
@@ -58,9 +58,6 @@ public abstract class dbHandlerBase {
|
||||
|
||||
int id = rs.getInt(1);
|
||||
|
||||
if (id == 883640)
|
||||
Logger.info("hit");
|
||||
|
||||
if (DbManager.inCache(localObjectType, id)) {
|
||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||
} else {
|
||||
|
||||
@@ -2732,7 +2732,7 @@ public class mbEnums {
|
||||
DIAMOND(1580010, 1540225085, -1730704107, 2000, 20),
|
||||
GALVOR(1580017, -1683992404, -1596311545, 2000, 5),
|
||||
IRON(1580002, -1673518119, 2504297, 2000, 20),
|
||||
LUMBER(1580004, 1628412684, -1603256692, 10000, 100),
|
||||
LUMBER(1580004, -1628412684, -1603256692, 10000, 100),
|
||||
MANDRAKE(1580007, 1519910613, 1191391799, 1000, 10),
|
||||
MITHRIL(1580021, 626743397, -1761257186, 500, 5),
|
||||
OAK(1580005, -1653034775, 74767, 3000, 30),
|
||||
|
||||
@@ -17,8 +17,9 @@ import engine.mbEnums.BuildingGroup;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClaimAssetMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.objects.*;
|
||||
import engine.objects.Blueprint;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
@@ -110,9 +111,9 @@ public class ClaimAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
// Can't claim a tree if your guild already owns one
|
||||
// *** Refactor : Send error to player here
|
||||
|
||||
if(blueprint.getBuildingGroup() == BuildingGroup.TOL && !validateTreeClaim(sourcePlayer)){
|
||||
if ((sourcePlayer.getGuild().isNation()) &&
|
||||
(blueprint.getBuildingGroup() == BuildingGroup.TOL))
|
||||
return true;
|
||||
}
|
||||
|
||||
// Process the transfer of the building(s)
|
||||
|
||||
@@ -134,24 +135,4 @@ public class ClaimAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean validateTreeClaim(PlayerCharacter sourcePlayer) {
|
||||
|
||||
if(sourcePlayer.guild.equals(Guild.getErrantGuild())) {
|
||||
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Errant Players Cannot Claim Cities!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(sourcePlayer.guild.getOwnedCity() != null) {
|
||||
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Your Guild Already Owns A City!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!GuildStatusController.isGuildLeader(sourcePlayer.getGuildStatus())) {
|
||||
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Only A Guild Leader Can Claim A Tree Of Life!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -528,15 +528,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
|
||||
if (cityObject.warehouse != null) {
|
||||
if(cityObject.warehouse.building != null) {
|
||||
//warehosue has a building already, warehouse still should exist
|
||||
PlaceAssetMsg.sendPlaceAssetError(origin, 50, ""); //"You can only have one warehouse"
|
||||
return false;
|
||||
}else{
|
||||
//warehouse has no building and needs a cleanup
|
||||
DbManager.WarehouseQueries.DELETE_WAREHOUSE(cityObject.warehouse);
|
||||
cityObject.warehouse = null;
|
||||
}
|
||||
PlaceAssetMsg.sendPlaceAssetError(origin, 50, ""); //"You can only have one warehouse"
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the warehouse object and it's entry in the database
|
||||
|
||||
@@ -306,8 +306,22 @@ public class City extends AbstractWorldObject {
|
||||
if (city.parentZone == null)
|
||||
continue;
|
||||
|
||||
//can't repledge to a guild you're already part of
|
||||
// Can't teleport to something without a tree
|
||||
|
||||
if (city.getTOL() == null)
|
||||
continue;
|
||||
|
||||
// No abandoned cities
|
||||
|
||||
if (city.getTOL().getGuild().isEmptyGuild())
|
||||
continue;
|
||||
|
||||
// No destroyed cities
|
||||
|
||||
if (city.getTOL().getRank() == -1)
|
||||
continue;
|
||||
|
||||
//can't repledge to a guild you're already part of
|
||||
if (repledge && city.getGuild().equals(playerCharacter.guild))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -220,8 +220,7 @@ public class Mine extends AbstractGameObject {
|
||||
// Only inactive mines are returned.
|
||||
|
||||
for (Mine mine : Mine.mineMap.keySet()) {
|
||||
if (mine.owningGuild.getObjectUUID() == guildID &&
|
||||
mine.isActive == false)
|
||||
if (mine.owningGuild.getObjectUUID() == guildID)
|
||||
mineList.add(mine);
|
||||
}
|
||||
return mineList;
|
||||
|
||||
@@ -95,6 +95,12 @@ public class DestroyCityThread implements Runnable {
|
||||
if (cityBuilding == null)
|
||||
continue;
|
||||
|
||||
// check null bluepritn and log error
|
||||
if (cityBuilding.getBlueprint() == null){
|
||||
Logger.error("Null Blueprint for building ID: " + cityBuilding.getObjectUUID());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Do nothing with the banestone. It will be removed elsewhere
|
||||
|
||||
if (cityBuilding.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.BANESTONE))
|
||||
|
||||
Reference in New Issue
Block a user