Compare commits

..

5 Commits

Author SHA1 Message Date
MagicBot 490141b71b Case added for protectorate. 2026-05-10 08:22:58 -04:00
MagicBot 2487915a13 Case added for protectorate. 2026-05-10 08:21:34 -04:00
MagicBot e2909564a4 state updated properly 2026-05-10 08:08:18 -04:00
MagicBot c02564d7af state updated properly 2026-05-07 15:38:21 -04:00
MagicBot 945f85443d db call added 2026-05-07 15:20:24 -04:00
15 changed files with 166 additions and 237 deletions
-2
View File
@@ -24,5 +24,3 @@
hs_err_pid* hs_err_pid*
replay_pid* replay_pid*
.idea/
*.iml
+3 -4
View File
@@ -14,7 +14,6 @@ import engine.gameManager.ChatManager;
import engine.objects.AbstractGameObject; import engine.objects.AbstractGameObject;
import engine.objects.Item; import engine.objects.Item;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
/** /**
* @author Eighty * @author Eighty
@@ -47,10 +46,10 @@ public class AddGoldCmd extends AbstractDevCmd {
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid"); throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
return; return;
} }
if (amt < 1 || amt > MBServerStatics.PLAYER_GOLD_LIMIT) { if (amt < 1 || amt > 10000000) {
throwbackError(pc, "Quantity must be between 1 and " + MBServerStatics.PLAYER_GOLD_LIMIT); throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
return; return;
} else if ((curAmt + amt) > MBServerStatics.PLAYER_GOLD_LIMIT) { } else if ((curAmt + amt) > 10000000) {
throwbackError(pc, "This would place your inventory over 10,000,000 gold."); throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
return; return;
} }
+16 -52
View File
@@ -16,7 +16,6 @@ import engine.devcmd.AbstractDevCmd;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.objects.*; import engine.objects.*;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.server.MBServerStatics;
import java.util.ArrayList; import java.util.ArrayList;
@@ -32,82 +31,47 @@ public class MakeItemCmd extends AbstractDevCmd {
@Override @Override
protected void _doCmd(PlayerCharacter pc, String[] words, protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) { AbstractGameObject target) {
if (words[0].equals("resources")) { if (words[0].equals("resources")) {
int resourceAmount = 1000;
if (words.length > 1) {
try {
resourceAmount = Integer.parseInt(words[1]);
} catch (NumberFormatException e) {
throwbackError(pc, "Resource amount must be a number.");
return;
}
}
if (resourceAmount < 1)
resourceAmount = 1;
resourceAmount = Math.min(
resourceAmount,
MBServerStatics.RESOURCE_STACK_LIMIT
);
for (int ibID : Warehouse.getMaxResources().keySet()) { for (int ibID : Warehouse.getMaxResources().keySet()) {
if (ibID == 7) if (ibID == 7)
continue; continue;
ItemBase ib = ItemBase.getItemBase(ibID); ItemBase ib = ItemBase.getItemBase(ibID);
if (ib == null)
continue;
short weight = ib.getWeight(); short weight = ib.getWeight();
if (!pc.getCharItemManager().hasRoomInventory(weight)) { if (!pc.getCharItemManager().hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more resources."); throwbackError(pc, "Not enough room in inventory for any more of this item");
pc.getCharItemManager().updateInventory(); pc.getCharItemManager().updateInventory();
return; return;
} }
Item item = new Item( boolean worked = false;
ib, Item item = new Item(ib, pc.getObjectUUID(),
pc.getObjectUUID(), OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(),
OwnerType.PlayerCharacter, true, false, ItemContainerType.INVENTORY, (byte) 0,
(byte) 0, new ArrayList<>(), "");
(byte) 0,
(short) ib.getDurability(),
(short) ib.getDurability(),
true,
false,
ItemContainerType.INVENTORY,
(byte) 0,
new ArrayList<>(),
""
);
item.setNumOfItems(resourceAmount); item.setNumOfItems(Warehouse.getMaxResources().get(ibID));
try { try {
item = DbManager.ItemQueries.ADD_ITEM(item); item = DbManager.ItemQueries.ADD_ITEM(item);
worked = true;
} catch (Exception e) { } catch (Exception e) {
throwbackError( throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
pc,
"Unable to create resource " + ib.getName() + ": " + e.getMessage()
);
return; return;
} }
if (item == null) { if (item == null || !worked) {
throwbackError(pc, "Unable to create resource " + ib.getName() + "."); throwbackError(pc, "DB error 2: Unable to create item.");
return; return;
} }
//add item to inventory
pc.getCharItemManager().addItemToInventory(item); pc.getCharItemManager().addItemToInventory(item);
} }
pc.getCharItemManager().updateInventory();
return; return;
} }
if (words.length < 3 || words.length > 5) { if (words.length < 3 || words.length > 5) {
@@ -136,7 +100,7 @@ public class MakeItemCmd extends AbstractDevCmd {
return; return;
} }
numItems = (numItems < 1) ? 1 : numItems; numItems = (numItems < 1) ? 1 : numItems;
numItems = Math.min(numItems, MBServerStatics.RESOURCE_STACK_LIMIT); numItems = (numItems > 5000) ? 5000 : numItems;
} }
int itembaseID; int itembaseID;
-7
View File
@@ -39,13 +39,6 @@ public class SlotTestCmd extends AbstractDevCmd {
Building building = (Building) target; Building building = (Building) target;
outString += "Rank: " + building.getRank() + "\r\n";
outString += "MaxSlots: " + building.getBlueprint().getMaxSlots() + "\r\n";
outString += "SlotsForRank: "
+ building.getBlueprint().getSlotsForRank(building.getRank())
+ "\r\n";
outString += "Hireling Count: " + building.getHirelings().size() + "\r\n\r\n";
buildingLocations = BuildingManager._slotLocations.get(building.meshUUID); buildingLocations = BuildingManager._slotLocations.get(building.meshUUID);
if (buildingLocations == null) { if (buildingLocations == null) {
@@ -289,34 +289,6 @@ public enum BuildingManager {
// Method transfers ownership of all hirelings in a building // Method transfers ownership of all hirelings in a building
public static void reslotHirelings(Building building) {
if (building == null)
return;
ArrayList<AbstractCharacter> hirelings =
new ArrayList<>(building.getHirelings().keySet());
building.getHirelings().clear();
for (AbstractCharacter hireling : hirelings) {
int newSlot = NPCManager.slotCharacterInBuilding(hireling);
if (newSlot == -1) {
Logger.error("Unable to re-slot hireling "
+ hireling.getObjectUUID()
+ " for building "
+ building.getObjectUUID());
continue;
}
hireling.setLoc(hireling.getBindLoc());
WorldGrid.updateObject(hireling);
InterestManager.setObjectDirty(hireling);
}
}
public static void refreshHirelings(Building building) { public static void refreshHirelings(Building building) {
if (building == null) if (building == null)
+1 -1
View File
@@ -1259,7 +1259,7 @@ public class ClientMessagePump implements NetMsgHandler {
cost *= profit; cost *= profit;
if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) { if (gold.getNumOfItems() + cost > 10000000) {
return; return;
} }
@@ -15,6 +15,7 @@ import engine.Enum.GuildState;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.GuildManager;
import engine.gameManager.SessionManager; import engine.gameManager.SessionManager;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
@@ -26,8 +27,6 @@ import engine.objects.Guild;
import engine.objects.GuildStatusController; import engine.objects.GuildStatusController;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import java.util.ArrayList;
public class AcceptSubInviteHandler extends AbstractClientMsgHandler { public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
public AcceptSubInviteHandler() { public AcceptSubInviteHandler() {
@@ -38,69 +37,76 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
AcceptSubInviteMsg msg = (AcceptSubInviteMsg) baseMsg; AcceptSubInviteMsg msg = (AcceptSubInviteMsg) baseMsg;
PlayerCharacter sourcePlayer; PlayerCharacter playerCharacter;
Guild sourceGuild; Guild protectorate;
Guild targetGuild; Guild nation;
Dispatch dispatch; Dispatch dispatch;
// get PlayerCharacter of person sending sub invite // get PlayerCharacter of person sending sub invite
sourcePlayer = SessionManager.getPlayerCharacter(origin); playerCharacter = SessionManager.getPlayerCharacter(origin);
if (sourcePlayer == null) if (playerCharacter == null)
return true; return true;
sourceGuild = sourcePlayer.getGuild(); protectorate = playerCharacter.getGuild();
targetGuild = (Guild) DbManager.getObject(GameObjectType.Guild, msg.guildUUID()); nation = (Guild) DbManager.getObject(GameObjectType.Guild, msg.guildUUID());
//must be source guild to sub to //must be source guild to sub to
if (targetGuild == null) { if (nation == null) {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild ErrorPopupMsg.sendErrorPopup(playerCharacter, 45); // Failure to swear guild
return true; return true;
} }
if (sourceGuild == null) { if (protectorate == null) {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild ErrorPopupMsg.sendErrorPopup(playerCharacter, 45); // Failure to swear guild
return true; return true;
} }
if (sourceGuild.equals(targetGuild)) if (protectorate.equals(nation))
return true; return true;
if (GuildStatusController.isGuildLeader(sourcePlayer.getGuildStatus()) == false) { if (GuildStatusController.isGuildLeader(playerCharacter.getGuildStatus()) == false) {
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Only a guild leader can accept fealty!"); ErrorPopupMsg.sendErrorMsg(playerCharacter, "Only a guild leader can accept fealty!");
return true; return true;
} }
//source guild is limited to 7 subs //source guild is limited to 7 subs
//TODO this should be based on TOL rank //TODO this should be based on TOL rank
if (!targetGuild.canSubAGuild(sourceGuild)) { if (!nation.canSubAGuild(protectorate)) {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild ErrorPopupMsg.sendErrorPopup(playerCharacter, 45); // Failure to swear guild
return true; return true;
} }
//all tests passed, let's Handle code //all tests passed, let's Handle code
//Update Target Guild State.
sourceGuild.upgradeGuildState(false); // Update database
//Add sub so GuildMaster can Swear in. if (!DbManager.GuildQueries.UPDATE_PARENT(protectorate.getObjectUUID(), nation.getObjectUUID())) {
ErrorPopupMsg.sendErrorMsg(playerCharacter, "A Serious error has occured. Please post details for to ensure transaction integrity");
return true;
}
ArrayList<Guild> subs = targetGuild.getSubGuildList(); //update Guild states.
subs.add(sourceGuild);
targetGuild.setGuildState(GuildState.Nation); protectorate.setNation(nation);
GuildManager.updateAllGuildTags(protectorate);
protectorate.upgradeGuildState(false);
if (nation.getGuildState() == GuildState.Sovereign)
nation.upgradeGuildState(true);
nation.getSubGuildList().add(protectorate);
//Let's send the message back. //Let's send the message back.
msg.setUnknown02(1); msg.setUnknown02(1);
msg.setResponse("Your guild is now a " + sourceGuild.getGuildState().name() + '.'); msg.setResponse("Your guild is now a " + protectorate.getGuildState().name() + '.');
dispatch = Dispatch.borrow(sourcePlayer, msg); dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
ChatManager.chatSystemInfo(sourcePlayer, "Your guild is now a " + sourceGuild.getGuildState().name() + '.'); ChatManager.chatSystemInfo(playerCharacter, "Your guild is now a " + protectorate.getGuildState().name() + '.');
return true; return true;
} }
} }
@@ -26,6 +26,7 @@ import engine.net.client.msg.guild.SendGuildEntryMsg;
import engine.objects.*; import engine.objects.*;
import engine.server.world.WorldServer; import engine.server.world.WorldServer;
import engine.session.Session; import engine.session.Session;
import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
@@ -40,8 +41,8 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
BreakFealtyMsg bfm; BreakFealtyMsg bfm;
PlayerCharacter player; PlayerCharacter player;
Guild toBreak; Guild nation;
Guild guild; Guild protectorate;
Dispatch dispatch; Dispatch dispatch;
bfm = (BreakFealtyMsg) baseMsg; bfm = (BreakFealtyMsg) baseMsg;
@@ -54,46 +55,50 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
if (player == null) if (player == null)
return true; return true;
toBreak = (Guild) DbManager.getObject(GameObjectType.Guild, bfm.getGuildUUID()); nation = (Guild) DbManager.getObject(GameObjectType.Guild, bfm.getGuildUUID());
if (toBreak == null) { if (nation == null) {
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity"); ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
return true; return true;
} }
guild = player.getGuild(); protectorate = player.getGuild();
if (guild == null) { if (protectorate == null) {
ErrorPopupMsg.sendErrorMsg(player, "You do not belong to a guild!"); ErrorPopupMsg.sendErrorMsg(player, "You do not belong to a guild!");
return true; return true;
} }
if (toBreak.isNPCGuild()) { if (nation.isNPCGuild()) {
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) { if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
ErrorPopupMsg.sendErrorMsg(player, "Only guild leader can break fealty!"); ErrorPopupMsg.sendErrorMsg(player, "Only guild leader can break fealty!");
return true; return true;
} }
if (!DbManager.GuildQueries.UPDATE_PARENT(guild.getObjectUUID(), WorldServer.worldUUID)) { if (!DbManager.GuildQueries.UPDATE_PARENT(protectorate.getObjectUUID(), WorldServer.worldUUID)) {
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity"); ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity");
return true; return true;
} }
switch (guild.getGuildState()) { switch (protectorate.getGuildState()) {
case Sworn: case Sworn:
guild.setNation(null); protectorate.setNation(Guild.getErrantGuild());
GuildManager.updateAllGuildTags(guild); GuildManager.updateAllGuildTags(protectorate);
GuildManager.updateAllGuildBinds(guild, null); GuildManager.updateAllGuildBinds(protectorate, null);
break; break;
case Province: case Province:
guild.setNation(guild); case Protectorate:
GuildManager.updateAllGuildTags(guild); protectorate.setNation(protectorate);
GuildManager.updateAllGuildBinds(guild, guild.getOwnedCity()); GuildManager.updateAllGuildTags(protectorate);
GuildManager.updateAllGuildBinds(protectorate, protectorate.getOwnedCity());
break;
default:
Logger.error("Unhandled guild state");
break; break;
} }
guild.downgradeGuildState(); protectorate.downgradeGuildState();
SendGuildEntryMsg msg = new SendGuildEntryMsg(player); SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
dispatch = Dispatch.borrow(player, msg); dispatch = Dispatch.borrow(player, msg);
@@ -106,16 +111,16 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
City.lastCityUpdate = System.currentTimeMillis(); City.lastCityUpdate = System.currentTimeMillis();
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(guild.getObjectUUID()); ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(protectorate.getObjectUUID());
for (PlayerCharacter member : guildMembers) { for (PlayerCharacter member : guildMembers) {
ChatManager.chatGuildInfo(member, guild.getName() + " has broke fealty from " + toBreak.getName() + '!'); ChatManager.chatGuildInfo(member, protectorate.getName() + " has broke fealty from " + nation.getName() + '!');
} }
ArrayList<PlayerCharacter> breakFealtyMembers = SessionManager.getActivePCsInGuildID(toBreak.getObjectUUID()); ArrayList<PlayerCharacter> breakFealtyMembers = SessionManager.getActivePCsInGuildID(nation.getObjectUUID());
for (PlayerCharacter member : breakFealtyMembers) { for (PlayerCharacter member : breakFealtyMembers) {
ChatManager.chatGuildInfo(member, guild.getName() + " has broken fealty from " + toBreak.getName() + '!'); ChatManager.chatGuildInfo(member, protectorate.getName() + " has broken fealty from " + nation.getName() + '!');
} }
return true; return true;
@@ -123,7 +128,7 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
} }
if (!toBreak.getSubGuildList().contains(guild)) { if (!nation.getSubGuildList().contains(protectorate)) {
ErrorPopupMsg.sendErrorMsg(player, "Failure to break fealty!"); ErrorPopupMsg.sendErrorMsg(player, "Failure to break fealty!");
return true; return true;
} }
@@ -133,34 +138,34 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
return true; return true;
} }
if (Bane.getBaneByAttackerGuild(guild) != null) { if (Bane.getBaneByAttackerGuild(protectorate) != null) {
ErrorPopupMsg.sendErrorMsg(player, "You may break fealty with active bane!"); ErrorPopupMsg.sendErrorMsg(player, "You may break fealty with active bane!");
return true; return true;
} }
if (!DbManager.GuildQueries.UPDATE_PARENT(guild.getObjectUUID(), WorldServer.worldUUID)) { if (!DbManager.GuildQueries.UPDATE_PARENT(protectorate.getObjectUUID(), WorldServer.worldUUID)) {
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity"); ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity");
return true; return true;
} }
switch (guild.getGuildState()) { switch (protectorate.getGuildState()) {
case Sworn: case Sworn:
guild.setNation(null); protectorate.setNation(null);
GuildManager.updateAllGuildTags(guild); GuildManager.updateAllGuildTags(protectorate);
GuildManager.updateAllGuildBinds(guild, null); GuildManager.updateAllGuildBinds(protectorate, null);
break; break;
case Province: case Province:
guild.setNation(guild); protectorate.setNation(protectorate);
GuildManager.updateAllGuildTags(guild); GuildManager.updateAllGuildTags(protectorate);
GuildManager.updateAllGuildBinds(guild, guild.getOwnedCity()); GuildManager.updateAllGuildBinds(protectorate, protectorate.getOwnedCity());
break; break;
} }
guild.downgradeGuildState(); protectorate.downgradeGuildState();
toBreak.getSubGuildList().remove(guild); nation.getSubGuildList().remove(protectorate);
if (toBreak.getSubGuildList().isEmpty()) if (nation.getSubGuildList().isEmpty())
toBreak.downgradeGuildState(); nation.downgradeGuildState();
SendGuildEntryMsg msg = new SendGuildEntryMsg(player); SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
dispatch = Dispatch.borrow(player, msg); dispatch = Dispatch.borrow(player, msg);
@@ -173,16 +178,16 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
City.lastCityUpdate = System.currentTimeMillis(); City.lastCityUpdate = System.currentTimeMillis();
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(guild.getObjectUUID()); ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(protectorate.getObjectUUID());
for (PlayerCharacter member : guildMembers) { for (PlayerCharacter member : guildMembers) {
ChatManager.chatGuildInfo(member, guild.getName() + " has broke fealty from " + toBreak.getName() + '!'); ChatManager.chatGuildInfo(member, protectorate.getName() + " has broke fealty from " + nation.getName() + '!');
} }
ArrayList<PlayerCharacter> breakFealtyMembers = SessionManager.getActivePCsInGuildID(toBreak.getObjectUUID()); ArrayList<PlayerCharacter> breakFealtyMembers = SessionManager.getActivePCsInGuildID(nation.getObjectUUID());
for (PlayerCharacter member : breakFealtyMembers) { for (PlayerCharacter member : breakFealtyMembers) {
ChatManager.chatGuildInfo(member, guild.getName() + " has broken fealty from " + toBreak.getName() + '!'); ChatManager.chatGuildInfo(member, protectorate.getName() + " has broken fealty from " + nation.getName() + '!');
} }
return true; return true;
+1 -1
View File
@@ -335,7 +335,7 @@ public class Blueprint {
availableSlots = 3; availableSlots = 3;
break; break;
case 8: case 8:
availableSlots = Math.min(3, this.maxSlots); availableSlots = 1;
break; break;
default: default:
availableSlots = 0; availableSlots = 0;
-4
View File
@@ -427,10 +427,6 @@ public class Building extends AbstractWorldObject {
BuildingManager.cleanupHirelings(this); BuildingManager.cleanupHirelings(this);
if (this.getBlueprint().getBuildingGroup() == BuildingGroup.TOL
&& this.rank == 8)
BuildingManager.reslotHirelings(this);
this.isDeranking.compareAndSet(true, false); this.isDeranking.compareAndSet(true, false);
} }
+3 -2
View File
@@ -2335,14 +2335,15 @@ public class CharacterItemManager {
} }
if (this.getGoldInventory().getNumOfItems() + goldFrom2 > MBServerStatics.PLAYER_GOLD_LIMIT) { if (this.getGoldInventory().getNumOfItems() + goldFrom2 > 10000000) {
PlayerCharacter pc = (PlayerCharacter) this.absCharacter; PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
if (pc.getClientConnection() != null) if (pc.getClientConnection() != null)
ErrorPopupMsg.sendErrorPopup(pc, 202); ErrorPopupMsg.sendErrorPopup(pc, 202);
return false; return false;
} }
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > MBServerStatics.PLAYER_GOLD_LIMIT) {
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > 10000000) {
PlayerCharacter pc = (PlayerCharacter) tradingWith.absCharacter; PlayerCharacter pc = (PlayerCharacter) tradingWith.absCharacter;
if (pc.getClientConnection() != null) if (pc.getClientConnection() != null)
ErrorPopupMsg.sendErrorPopup(pc, 202); ErrorPopupMsg.sendErrorPopup(pc, 202);
+40 -39
View File
@@ -674,6 +674,46 @@ public class Item extends AbstractWorldObject {
public static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType) { public static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType) {
return newGoldItem(awo, ib, containerType, true); return newGoldItem(awo, ib, containerType, true);
} }
//used for vault!
public static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType) {
return newGoldItem(accountID, ib, containerType, true);
}
private static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) {
int ownerID;
OwnerType ownerType;
ownerID = accountID;
ownerType = OwnerType.Account;
Item newGold = new Item(ib, ownerID, ownerType,
(byte) 0, (byte) 0, (short) 0, (short) 0, true, false, containerType, (byte) 0,
new ArrayList<>(), "");
synchronized (newGold) {
newGold.numberOfItems = 0;
}
if (persist) {
try {
newGold = DbManager.ItemQueries.ADD_ITEM(newGold);
if (newGold != null) {
synchronized (newGold) {
newGold.numberOfItems = 0;
}
}
} catch (Exception e) {
Logger.error(e);
}
DbManager.ItemQueries.ZERO_ITEM_STACK(newGold);
}
return newGold;
}
private static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) { private static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) {
int ownerID; int ownerID;
@@ -731,49 +771,10 @@ public class Item extends AbstractWorldObject {
} }
DbManager.ItemQueries.ZERO_ITEM_STACK(newGold); DbManager.ItemQueries.ZERO_ITEM_STACK(newGold);
} }
newGold.containerType = containerType; newGold.containerType = containerType;
return newGold; return newGold;
} }
//used for vault!
public static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType) {
return newGoldItem(accountID, ib, containerType, true);
}
private static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) {
int ownerID;
OwnerType ownerType;
ownerID = accountID;
ownerType = OwnerType.Account;
Item newGold = new Item(ib, ownerID, ownerType,
(byte) 0, (byte) 0, (short) 0, (short) 0, true, false, containerType, (byte) 0,
new ArrayList<>(), "");
synchronized (newGold) {
newGold.numberOfItems = 0;
}
if (persist) {
try {
newGold = DbManager.ItemQueries.ADD_ITEM(newGold);
if (newGold != null) {
synchronized (newGold) {
newGold.numberOfItems = 0;
}
}
} catch (Exception e) {
Logger.error(e);
}
DbManager.ItemQueries.ZERO_ITEM_STACK(newGold);
}
return newGold;
}
// This is to be used for trades - the new item is not stored in the database // This is to be used for trades - the new item is not stored in the database
public static Item newGoldItemTemp(AbstractWorldObject awo, ItemBase ib) { public static Item newGoldItemTemp(AbstractWorldObject awo, ItemBase ib) {
+1 -6
View File
@@ -1239,17 +1239,12 @@ public class PlayerCharacter extends AbstractCharacter {
playerCharacter.deactivateCharacter(); playerCharacter.deactivateCharacter();
return null; return null;
} }
// Ebonreach: give new characters starter gold.
Item starterGold = Item.newGoldItem(playerCharacter, ItemBase.getItemBase(7), Enum.ItemContainerType.INVENTORY);
if (starterGold != null)
DbManager.ItemQueries.UPDATE_GOLD(starterGold, 10000);
// Get any new skills that belong to the player // Get any new skills that belong to the player
playerCharacter.calculateSkills(); playerCharacter.calculateSkills();
a.setLastCharacter(playerCharacter.getObjectUUID()); a.setLastCharacter(playerCharacter.getObjectUUID());
playerCharacter.getCharItemManager().load(); playerCharacter.charItemManager.load();
playerCharacter.activateCharacter(); playerCharacter.activateCharacter();
+23 -23
View File
@@ -99,29 +99,29 @@ public class Warehouse extends AbstractWorldObject {
public static ConcurrentHashMap<Integer, Integer> getMaxResources() { public static ConcurrentHashMap<Integer, Integer> getMaxResources() {
if (maxResources.size() != 23) { if (maxResources.size() != 23) {
maxResources.put(7, 1000000000); maxResources.put(7, 100000000);
maxResources.put(1580000, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580000, 10000);
maxResources.put(1580001, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580001, 2000);
maxResources.put(1580002, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580002, 2000);
maxResources.put(1580003, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580003, 1000);
maxResources.put(1580004, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580004, 10000);
maxResources.put(1580005, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580005, 3000);
maxResources.put(1580006, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580006, 3000);
maxResources.put(1580007, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580007, 1000);
maxResources.put(1580008, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580008, 3000);
maxResources.put(1580009, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580009, 2000);
maxResources.put(1580010, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580010, 2000);
maxResources.put(1580011, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580011, 1000);
maxResources.put(1580012, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580012, 2000);
maxResources.put(1580013, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580013, 3000);
maxResources.put(1580014, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580014, 1000);
maxResources.put(1580015, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580015, 1000);
maxResources.put(1580016, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580016, 1000);
maxResources.put(1580017, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580017, 500);
maxResources.put(1580018, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580018, 500);
maxResources.put(1580019, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580019, 500);
maxResources.put(1580020, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580020, 500);
maxResources.put(1580021, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580021, 500);
} }
return maxResources; return maxResources;
+2 -3
View File
@@ -33,16 +33,15 @@ public class MBServerStatics {
// hit box // hit box
// calcs // calcs
public static final boolean PRINT_INCOMING_OPCODES = false; // print public static final boolean PRINT_INCOMING_OPCODES = false; // print
public static final int BANK_GOLD_LIMIT = 1000000000; public static final int BANK_GOLD_LIMIT = 25000000;
// incoming // incoming
// opcodes to // opcodes to
// console // console
public static final int PLAYER_GOLD_LIMIT = 500000000; public static final int PLAYER_GOLD_LIMIT = 10000000;
// buildings, npcs // buildings, npcs
/* /*
* Login cache flags * Login cache flags
*/ */
public static final int RESOURCE_STACK_LIMIT = 1000000000;
public static final boolean SKIP_CACHE_LOGIN = false; // skip caching // login server public static final boolean SKIP_CACHE_LOGIN = false; // skip caching // login server
public static final boolean SKIP_CACHE_LOGIN_PLAYER = false; // skip caching // on login public static final boolean SKIP_CACHE_LOGIN_PLAYER = false; // skip caching // on login
public static final boolean SKIP_CACHE_LOGIN_ITEM = false; // skip caching public static final boolean SKIP_CACHE_LOGIN_ITEM = false; // skip caching