forked from MagicBane/Server
Merge branch 'lakebane-mines' into lakebane-master
# Conflicts: # src/engine/gameManager/CombatManager.java # src/engine/mobileAI/utilities/MovementUtilities.java # src/engine/net/client/ClientMessagePump.java # src/engine/net/client/msg/VendorDialogMsg.java # src/engine/objects/CharacterItemManager.java # src/engine/objects/Mine.java # src/engine/objects/PlayerCharacter.java # src/engine/objects/Warehouse.java
This commit is contained in:
@@ -148,6 +148,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
pc.setActive(true);
|
||||
|
||||
pc.setLastTarget(GameObjectType.values()[msg.getTargetType()], msg.getTargetID());
|
||||
|
||||
if(!pc.getTimestamps().containsKey("lastTab"))
|
||||
pc.getTimestamps().put("lastTab",System.currentTimeMillis());
|
||||
|
||||
if(System.currentTimeMillis() - pc.getTimestamps().get("lastTab") < 100)
|
||||
Logger.error("USE OF /TAR SUSPECTED BY PLAYER: " + pc.getName());
|
||||
}
|
||||
|
||||
private static void social(SocialMsg msg, ClientConnection origin) throws MsgSendException {
|
||||
@@ -340,18 +346,11 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
if (!NPCVaultBankRangeCheck(player, origin, "bank"))
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
|
||||
if(msg.getNumItems() < 1 && itemManager.getItemByUUID(msg.getUUID()).getItemBaseID() == 7) {
|
||||
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
|
||||
return;//catch gold dupe for negative numbers
|
||||
}
|
||||
|
||||
if (itemManager == null)
|
||||
return;
|
||||
|
||||
@@ -404,17 +403,11 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
|
||||
if (!NPCVaultBankRangeCheck(player, origin, "bank"))
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
|
||||
if(msg.getNumItems() < 1 && itemManager.getItemByUUID(msg.getUUID()).getItemBaseID() == 7) {
|
||||
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
|
||||
return;//catch gold dupe for negative numbers
|
||||
}
|
||||
|
||||
if (itemManager == null)
|
||||
return;
|
||||
|
||||
@@ -458,6 +451,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
private static void transferItemFromVaultToInventory(TransferItemFromVaultToInventoryMsg msg, ClientConnection origin) {
|
||||
@@ -471,6 +465,8 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (player.getAccount() == null)
|
||||
return;
|
||||
player.getAccount().transferItemFromVaultToInventory(msg, origin);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//call this if the transfer fails server side to kick the item back to inventory from vault
|
||||
@@ -517,7 +513,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
ChatManager.chatInfoError(player, "Can't transfer to vault: " + reason);
|
||||
player.getAccount().transferItemFromInventoryToVault(msg, origin);
|
||||
}
|
||||
|
||||
private static void transferGoldFromVaultToInventory(TransferGoldFromVaultToInventoryMsg msg, ClientConnection origin) {
|
||||
@@ -528,11 +523,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if(msg.getAmount() < 1) {
|
||||
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
|
||||
return;//catch gold dupe for negative numbers
|
||||
}
|
||||
|
||||
Account account = player.getAccount();
|
||||
|
||||
if (account == null)
|
||||
@@ -549,11 +539,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if(msg.getAmount() < 1) {
|
||||
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
|
||||
return;//catch gold dupe for negative numbers
|
||||
}
|
||||
|
||||
Account account = player.getAccount();
|
||||
|
||||
if (account == null)
|
||||
@@ -603,7 +588,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
}
|
||||
if (itemManager.delete(i) == true) {
|
||||
sourcePlayer.getCharItemManager().addGoldToInventory(value,false);
|
||||
sourcePlayer.getCharItemManager().StackResources();
|
||||
sourcePlayer.getCharItemManager().updateInventory();
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
@@ -945,7 +930,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
DispatchMessage.dispatchMsgToInterestArea(corpse, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, true);
|
||||
|
||||
|
||||
//player.getCharItemManager().StackResources();
|
||||
//player.getCharItemManager().updateInventory();
|
||||
}
|
||||
|
||||
//TODO send group loot message if player is grouped and visible
|
||||
@@ -969,9 +954,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if(item.getItemBase().getType().equals(ItemType.RESOURCE))
|
||||
player.getCharItemManager().StackResources();
|
||||
|
||||
if (item.getItemBase().getType().equals(engine.Enum.ItemType.GOLD)) {
|
||||
// this is done to prevent the temporary goldItem item
|
||||
// (from the mob) from appearing in player's inventory.
|
||||
@@ -1005,7 +987,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
dispatch = Dispatch.borrow(player, newItemMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
//player.getCharItemManager().StackResources();
|
||||
//player.getCharItemManager().updateInventory();
|
||||
}
|
||||
|
||||
//TODO send group loot message if player is grouped and visible
|
||||
@@ -1016,7 +998,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
String text = player.getFirstName() + " has looted " + name + '.';
|
||||
ChatManager.chatGroupInfoCanSee(player, text);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(e.getMessage());
|
||||
} finally {
|
||||
@@ -1024,6 +1005,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// called when player types /show
|
||||
@@ -1488,11 +1470,39 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
ChatManager.chatSystemError(sourcePlayer, "Failed To Buy Item");
|
||||
return;
|
||||
}
|
||||
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
||||
if (buy != null) {
|
||||
me.transferEnchants(buy);
|
||||
itemMan.addItemToInventory(buy);
|
||||
//itemMan.StackResources();
|
||||
if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){
|
||||
boolean stacked = false;
|
||||
for(Item item : itemMan.getInventory()){
|
||||
int itemID = item.getItemBaseID();
|
||||
int meID = me.getItemBase().getUUID();
|
||||
if(itemID == meID){
|
||||
if(Warehouse.maxResources.isEmpty())
|
||||
Warehouse.getMaxResources();
|
||||
int maxStack = Warehouse.maxResources.get(itemID);
|
||||
if(maxStack > item.getNumOfItems() + 1){
|
||||
item.setNumOfItems(item.getNumOfItems() + 1);
|
||||
stacked = true;
|
||||
itemMan.updateInventory();
|
||||
DbManager.ItemQueries.UPDATE_NUM_ITEMS(item,item.getNumOfItems(),0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!stacked){
|
||||
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
||||
if (buy != null) {
|
||||
me.transferEnchants(buy);
|
||||
itemMan.addItemToInventory(buy);
|
||||
//itemMan.updateInventory();
|
||||
}
|
||||
}
|
||||
}else {
|
||||
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
||||
if (buy != null) {
|
||||
me.transferEnchants(buy);
|
||||
itemMan.addItemToInventory(buy);
|
||||
//itemMan.updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1632,8 +1642,9 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
// msg.setItemID(buy.getObjectUUID());
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
itemMan.StackResources();
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
|
||||
} finally {
|
||||
origin.buyLock.unlock();
|
||||
}
|
||||
@@ -1898,9 +1909,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
s = SessionManager.getSession(origin);
|
||||
|
||||
protocolMsg = msg.getProtocolMsg();
|
||||
PlayerCharacter player = ((ClientConnection) msg.getOrigin()).getPlayerCharacter();
|
||||
if(player != null)
|
||||
player.lastAction = System.currentTimeMillis();
|
||||
|
||||
switch (protocolMsg) {
|
||||
case SETSELECTEDOBECT:
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
||||
if (city != null)
|
||||
bane = city.getBane();
|
||||
|
||||
if (bane != null && bane.getSiegePhase() == Enum.SiegePhase.WAR) {
|
||||
if (bane != null) {
|
||||
ErrorPopupMsg.sendErrorPopup(pc, 171);
|
||||
return true;
|
||||
}
|
||||
@@ -71,9 +71,12 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
||||
if (blueprint.getBuildingGroup() == BuildingGroup.TOL)
|
||||
return true;
|
||||
|
||||
// Can't destroy a shrine
|
||||
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE)
|
||||
// destorying a shrine will yield a rubble pile for looting
|
||||
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE) {
|
||||
building.modifyHealth(-building.getHealth(), origin.getPlayerCharacter());
|
||||
building.destroyOrDerank(origin.getPlayerCharacter());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cannot destroy mines outside of normal mine mechanics
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Bounds;
|
||||
@@ -62,7 +63,6 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
Building building;
|
||||
|
||||
msg = (ManageCityAssetsMsg) baseMsg;
|
||||
|
||||
player = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (player == null)
|
||||
@@ -72,34 +72,21 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (building == null) {
|
||||
if (msg.actionType == 14) {
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
||||
|
||||
if (!zone.isPlayerCity()) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
||||
return true;
|
||||
}
|
||||
|
||||
City city = City.GetCityFromCache(zone.getPlayerCityUUID());
|
||||
|
||||
if (city == null) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!city.getGuild().equals(player.getGuild())) {
|
||||
if (city == null || !city.getGuild().equals(player.getGuild()) ||
|
||||
(!GuildStatusController.isInnerCouncil(player.getGuildStatus()) &&
|
||||
!GuildStatusController.isGuildLeader(player.getGuildStatus()))) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "You are not in the correct guild to command this city.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!GuildStatusController.isInnerCouncil(player.getGuildStatus()) && !GuildStatusController.isGuildLeader(player.getGuildStatus())) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "You must be an Inner Council or Guild leader to access city commands.");
|
||||
return true;
|
||||
}
|
||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
||||
mca.actionType = 15;
|
||||
Dispatch dispatch = Dispatch.borrow(player, mca);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, mca), DispatchChannel.SECONDARY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -111,181 +98,126 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setAssetName(building.getName());
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (msg.actionType == 2 || msg.actionType == 22) {
|
||||
|
||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == engine.Enum.BuildingGroup.BANESTONE) {
|
||||
|
||||
outMsg.actionType = 18;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
|
||||
} else if (BuildingManager.playerCanManage(player, building)) { //TODO allow Friends list.
|
||||
switch (msg.actionType) {
|
||||
case 2:
|
||||
case 22:
|
||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == engine.Enum.BuildingGroup.BANESTONE) {
|
||||
outMsg.actionType = 18;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
} else if (BuildingManager.playerCanManage(player, building)) {
|
||||
configWindowState(player, building, outMsg);
|
||||
outMsg.actionType = 3;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setTargetType3(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID3(building.getObjectUUID());
|
||||
outMsg.setUnknown54(1);
|
||||
} else {
|
||||
// Handle other cases
|
||||
if (building.getRank() == -1) {
|
||||
if (!Bounds.collide(player.getLoc(), building)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 64);
|
||||
return true;
|
||||
}
|
||||
switch (building.getBlueprint().getBuildingGroup()) {
|
||||
case SHRINE:
|
||||
Shrine shrine = Shrine.shrinesByBuildingUUID.get(building.getObjectUUID());
|
||||
if (shrine == null || shrine.getFavors() == 0) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 166); // There is no more favor in this shrine to loot
|
||||
return true;
|
||||
}
|
||||
//loot elan stones
|
||||
MobLoot elanStones = new MobLoot(player,ItemBase.getItemBase(1705032),1,false);
|
||||
Item promotedItem = elanStones.promoteToItem(player);
|
||||
promotedItem.setNumOfItems(shrine.getFavors());
|
||||
player.getCharItemManager().addItemToInventory(promotedItem);
|
||||
DbManager.ItemQueries.UPDATE_NUM_ITEMS(promotedItem,promotedItem.getNumOfItems(),1);
|
||||
player.getCharItemManager().updateInventory();
|
||||
shrine.setFavors(0);
|
||||
break;
|
||||
case WAREHOUSE:
|
||||
Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(building.getObjectUUID());
|
||||
if (warehouse == null || warehouse.isEmpty()) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
AbstractCharacter owner = building.getOwner();
|
||||
if (owner == null) {
|
||||
msg.actionType = 4;
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, msg), DispatchChannel.SECONDARY);
|
||||
} else {
|
||||
outMsg.actionType = 4;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setAssetName(building.getName());
|
||||
}
|
||||
}
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
case 13:
|
||||
outMsg.actionType = 13;
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
case 5:
|
||||
building.setName(msg.getAssetName());
|
||||
configWindowState(player, building, outMsg);
|
||||
outMsg.actionType = 3;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setTargetType3(building.getObjectType().ordinal());
|
||||
outMsg.setTargetType3(GameObjectType.Building.ordinal());
|
||||
outMsg.setTargetID3(building.getObjectUUID());
|
||||
outMsg.setAssetName1(building.getName());
|
||||
outMsg.setUnknown54(1);
|
||||
|
||||
} else {
|
||||
|
||||
if (building.getBlueprintUUID() != 0)
|
||||
switch (building.getBlueprint().getBuildingGroup()) {
|
||||
case SHRINE:
|
||||
if (building.getRank() == -1) {
|
||||
if (!Bounds.collide(player.getLoc(), building)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 64);
|
||||
return true;
|
||||
}
|
||||
|
||||
Shrine shrine = Shrine.shrinesByBuildingUUID.get(building.getObjectUUID());
|
||||
|
||||
if (shrine == null)
|
||||
return true;
|
||||
|
||||
if (shrine.getFavors() == 0) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 166); // There is no more favor in this shrine to loot
|
||||
return true;
|
||||
}
|
||||
|
||||
BuildingManager.lootBuilding(player, building);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case WAREHOUSE:
|
||||
//TODO check
|
||||
if (building.getRank() == -1) {
|
||||
if (!Bounds.collide(player.getLoc(), building)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 64);
|
||||
return true;
|
||||
}
|
||||
|
||||
Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(building.getObjectUUID());
|
||||
|
||||
if (warehouse == null)
|
||||
return true;
|
||||
|
||||
if (warehouse.isEmpty()) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
|
||||
return true;
|
||||
}
|
||||
|
||||
BuildingManager.lootBuilding(player, building);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (building.getRank() == -1)
|
||||
return true;
|
||||
|
||||
AbstractCharacter owner = building.getOwner();
|
||||
|
||||
//no owner, send building info
|
||||
if (owner == null) {
|
||||
msg.actionType = 4;
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
outMsg.actionType = 4;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setAssetName(building.getName());
|
||||
|
||||
}
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (msg.actionType == 13) {
|
||||
outMsg.actionType = 13;
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//Rename Building.
|
||||
|
||||
if (msg.actionType == 5) {
|
||||
|
||||
//TODO we need to check names before allowing
|
||||
building.setName(msg.getAssetName());
|
||||
configWindowState(player, building, outMsg);
|
||||
|
||||
outMsg.actionType = 3;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setTargetType3(GameObjectType.Building.ordinal());
|
||||
outMsg.setTargetID3(building.getObjectUUID());
|
||||
outMsg.setAssetName1(building.getName());
|
||||
outMsg.setUnknown54(1);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
|
||||
//TOL, update city name also
|
||||
//TODO update city and zone in database
|
||||
//TODO update city map data in game server
|
||||
}
|
||||
|
||||
if (msg.actionType == 14) {
|
||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
||||
mca.actionType = 15;
|
||||
Dispatch dispatch = Dispatch.borrow(player, mca);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (msg.actionType == 20) {
|
||||
|
||||
Zone baneZone = building.getParentZone();
|
||||
|
||||
if (baneZone == null)
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
|
||||
City banedCity = City.getCity(baneZone.getPlayerCityUUID());
|
||||
|
||||
if (banedCity == null)
|
||||
case 14:
|
||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
||||
mca.actionType = 15;
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, mca), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
|
||||
Bane bane = banedCity.getBane();
|
||||
|
||||
if (bane == null || bane.getLiveDate() != null || player.getGuild() != banedCity.getGuild() || GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
|
||||
case 20:
|
||||
// Handle case 20
|
||||
return handleCase20(player, outMsg, building, msg, origin);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int baneHour = msg.getBaneHour();
|
||||
|
||||
if (baneHour < 16 || baneHour > 24) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||
return true;
|
||||
}
|
||||
|
||||
DateTime baneLive = new DateTime(bane.getPlacementDate());
|
||||
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
|
||||
baneLive = baneHour == 24 ? baneLive.hourOfDay().setCopy(0) : baneLive.hourOfDay().setCopy(baneHour);
|
||||
baneLive = baneLive.minuteOfHour().setCopy(0);
|
||||
baneLive = baneLive.secondOfMinute().setCopy(1);
|
||||
bane.setLiveDate(baneLive);
|
||||
outMsg.actionType = 18;
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
private boolean handleCase20(PlayerCharacter player, ManageCityAssetsMsg outMsg, Building building, ManageCityAssetsMsg msg, ClientConnection origin) throws MsgSendException {
|
||||
Zone baneZone = building.getParentZone();
|
||||
if (baneZone == null)
|
||||
return true;
|
||||
City banedCity = City.getCity(baneZone.getPlayerCityUUID());
|
||||
if (banedCity == null)
|
||||
return true;
|
||||
Bane bane = banedCity.getBane();
|
||||
if (bane == null || bane.getLiveDate() != null || player.getGuild() != banedCity.getGuild() || !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
int baneHour = msg.getBaneHour();
|
||||
if (baneHour < 16 || baneHour > 24) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||
return true;
|
||||
}
|
||||
DateTime baneLive = new DateTime(bane.getPlacementDate());
|
||||
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
|
||||
baneLive = baneHour == 24 ? baneLive.hourOfDay().setCopy(0) : baneLive.hourOfDay().setCopy(baneHour);
|
||||
baneLive = baneLive.minuteOfHour().setCopy(0);
|
||||
baneLive = baneLive.secondOfMinute().setCopy(1);
|
||||
bane.setLiveDate(baneLive);
|
||||
outMsg.actionType = 18;
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void configWindowState(PlayerCharacter player, Building building, ManageCityAssetsMsg manageCityAssetsMsg) {
|
||||
|
||||
// Tests to turn on upgrade button if a building is not
|
||||
|
||||
@@ -306,6 +306,8 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
}
|
||||
//if discipline, check number applied
|
||||
if (isDiscipline(runeID)) {
|
||||
//if(playerCharacter.getLevel() == 80)
|
||||
discCount -= 1; // level 80 characters get an extra disc rune
|
||||
if (playerCharacter.getLevel() < 70) {
|
||||
if (discCount > 2) {
|
||||
return false;
|
||||
|
||||
@@ -137,16 +137,20 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
}
|
||||
|
||||
if(contract.getObjectUUID() == 1502040){
|
||||
if(!playerCharacter.getTimestamps().containsKey("lastBoxChange"))
|
||||
playerCharacter.getTimestamps().put("lastBoxChange",System.currentTimeMillis() - 1000);
|
||||
|
||||
if(playerCharacter.getTimeStamp("lastBoxChange") + 30000L > System.currentTimeMillis()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(playerCharacter.isBoxed == false) {
|
||||
ChatManager.chatSystemInfo(playerCharacter, "You Are Already The Active Character.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(playerCharacter.getTimestamps().containsKey("BoxChange") && playerCharacter.getTimeStamp("BoxChange") + 5000 > System.currentTimeMillis()) {
|
||||
ChatManager.chatSystemInfo(playerCharacter, "You Are Enrolling Too Often.");
|
||||
return;
|
||||
}
|
||||
playerCharacter.getTimestamps().put("BoxChange",System.currentTimeMillis());
|
||||
playerCharacter.getTimestamps().put("lastBoxChange",System.currentTimeMillis());
|
||||
|
||||
playerCharacter.isBoxed = false;
|
||||
playerCharacter.removeEffectBySource(Enum.EffectSourceType.DeathShroud,50,true);
|
||||
ChatManager.chatSystemInfo(playerCharacter, "Promoting To Active Duty");
|
||||
@@ -157,12 +161,12 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
}
|
||||
playerCharacter.isBoxed = false;
|
||||
playerCharacter.title = CharacterTitle.NONE;
|
||||
InterestManager.reloadCharacter(playerCharacter);
|
||||
InterestManager.setObjectDirty(playerCharacter);
|
||||
playerCharacter.removeEffectBySource(Enum.EffectSourceType.DeathShroud,50,true);
|
||||
for(PlayerCharacter box : currentBoxes) {
|
||||
box.isBoxed = true;
|
||||
box.title = CharacterTitle.BOX;
|
||||
InterestManager.reloadCharacter(box);
|
||||
InterestManager.setObjectDirty(box);
|
||||
}
|
||||
}
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
|
||||
Reference in New Issue
Block a user