Compare commits

..

5 Commits

21 changed files with 163 additions and 415 deletions
+2
View File
@@ -24,3 +24,5 @@
hs_err_pid*
replay_pid*
.idea/
*.iml
+4 -3
View File
@@ -14,6 +14,7 @@ import engine.gameManager.ChatManager;
import engine.objects.AbstractGameObject;
import engine.objects.Item;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
/**
* @author Eighty
@@ -46,10 +47,10 @@ public class AddGoldCmd extends AbstractDevCmd {
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
return;
}
if (amt < 1 || amt > 10000000) {
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
if (amt < 1 || amt > MBServerStatics.PLAYER_GOLD_LIMIT) {
throwbackError(pc, "Quantity must be between 1 and " + MBServerStatics.PLAYER_GOLD_LIMIT);
return;
} else if ((curAmt + amt) > 10000000) {
} else if ((curAmt + amt) > MBServerStatics.PLAYER_GOLD_LIMIT) {
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
return;
}
+53 -17
View File
@@ -16,6 +16,7 @@ import engine.devcmd.AbstractDevCmd;
import engine.gameManager.DbManager;
import engine.objects.*;
import engine.powers.EffectsBase;
import engine.server.MBServerStatics;
import java.util.ArrayList;
@@ -31,47 +32,82 @@ public class MakeItemCmd extends AbstractDevCmd {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
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()) {
if (ibID == 7)
continue;
ItemBase ib = ItemBase.getItemBase(ibID);
short weight = ib.getWeight();
if (!pc.getCharItemManager().hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more of this item");
if (ib == null)
continue;
short weight = ib.getWeight();
if (!pc.getCharItemManager().hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more resources.");
pc.getCharItemManager().updateInventory();
return;
}
boolean worked = false;
Item item = new Item(ib, pc.getObjectUUID(),
OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(),
true, false, ItemContainerType.INVENTORY, (byte) 0,
new ArrayList<>(), "");
Item item = new Item(
ib,
pc.getObjectUUID(),
OwnerType.PlayerCharacter,
(byte) 0,
(byte) 0,
(short) ib.getDurability(),
(short) ib.getDurability(),
true,
false,
ItemContainerType.INVENTORY,
(byte) 0,
new ArrayList<>(),
""
);
item.setNumOfItems(Warehouse.getMaxResources().get(ibID));
item.setNumOfItems(resourceAmount);
try {
item = DbManager.ItemQueries.ADD_ITEM(item);
worked = true;
} catch (Exception e) {
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
throwbackError(
pc,
"Unable to create resource " + ib.getName() + ": " + e.getMessage()
);
return;
}
if (item == null || !worked) {
throwbackError(pc, "DB error 2: Unable to create item.");
if (item == null) {
throwbackError(pc, "Unable to create resource " + ib.getName() + ".");
return;
}
//add item to inventory
pc.getCharItemManager().addItemToInventory(item);
}
pc.getCharItemManager().updateInventory();
return;
}
if (words.length < 3 || words.length > 5) {
@@ -100,7 +136,7 @@ public class MakeItemCmd extends AbstractDevCmd {
return;
}
numItems = (numItems < 1) ? 1 : numItems;
numItems = (numItems > 5000) ? 5000 : numItems;
numItems = Math.min(numItems, MBServerStatics.RESOURCE_STACK_LIMIT);
}
int itembaseID;
@@ -1,61 +0,0 @@
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.PowersManager;
import engine.gameManager.ZoneManager;
import engine.objects.*;
public class SetCampLevelCmd extends AbstractDevCmd {
public SetCampLevelCmd() { super("setcamplevel"); }
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args, AbstractGameObject target) {
if (args.length > 1)
{
this.sendUsage(pcSender);
}
int targetLevel = 0;
if (args.length == 1) {
try {
targetLevel = Integer.parseInt(args[0]);
} catch (NumberFormatException nfe) {
throwbackError(pcSender, "Argument MUST be integer. Received: " + args[0]);
} catch (Exception e) {
throwbackError(pcSender, "Unknown command parsing provided camp level: " + args[0]);
}
}
if ((target instanceof Mob))
{
// Get the camp that owns the targeted Mob
Zone campZone = ((Mob) target).parentZone;
// Make sure that the zone we're targeting is valid for action
if (campZone == null ||
campZone.zoneMobSet.isEmpty() ||
campZone.isPlayerCity()) {
throwbackError(pcSender, "Current zone must own mobs, and NOT be a city.");
return;
}
campZone.setCampLvl(targetLevel);
}
else if (target instanceof PlayerCharacter)
{
PlayerCharacter pc = (PlayerCharacter)target;
PowersManager.applyPower(pc, pc, pc.getLoc(), "CMP-001", targetLevel, false);
}
}
@Override
protected String _getUsageString() {
return "Sets the level of the currently occupied camp to the desired level";
}
@Override
protected String _getHelpString() {
return "'./setcamplevel levelNum'";
}
}
+7
View File
@@ -39,6 +39,13 @@ public class SlotTestCmd extends AbstractDevCmd {
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);
if (buildingLocations == null) {
@@ -143,7 +143,6 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
DevCmdManager.registerDevCmd(new SlotTestCmd());
DevCmdManager.registerDevCmd(new SetCampLevelCmd());
}
+6 -17
View File
@@ -14,7 +14,6 @@ import engine.net.DispatchMessage;
import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.objects.*;
import engine.util.ZoneLevel;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
@@ -101,16 +100,6 @@ public enum LootManager {
boolean hotzoneWasRan = false;
float dropRate = 1.0f;
if (mob.getSafeZone() == false)
dropRate = LootManager.NORMAL_DROP_RATE;
if (inHotzone == true)
dropRate = LootManager.HOTZONE_DROP_RATE;
// Adjust for camp scaling
Zone camp = mob.getParentZone();
dropRate = dropRate * ZoneLevel.getLootDropModifier(camp);
// Iterate all entries in this bootySet and process accordingly
for (BootySetEntry bse : entries) {
@@ -120,6 +109,12 @@ public enum LootManager {
break;
case "LOOT":
if (mob.getSafeZone() == false)
dropRate = LootManager.NORMAL_DROP_RATE;
if (inHotzone == true)
dropRate = LootManager.HOTZONE_DROP_RATE;
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
GenerateLootDrop(mob, bse.genTable, false); //generate normal loot drop
@@ -201,9 +196,6 @@ public enum LootManager {
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
}
}
// We don't want to bother with identifying gear
outItem.setIsID(true);
return outItem;
}
@@ -314,9 +306,6 @@ public enum LootManager {
else
gold = (int) (gold * NORMAL_GOLD_RATE);
Zone camp = mob.getParentZone();
gold = (int) (gold * ZoneLevel.getGoldDropModifier(camp));
if (gold > 0) {
MobLoot goldAmount = new MobLoot(mob, gold);
mob.getCharItemManager().addItemToInventory(goldAmount);
@@ -11,7 +11,6 @@ package engine.mobileAI.Threads;
import engine.gameManager.ZoneManager;
import engine.objects.Mob;
import engine.objects.Zone;
import engine.util.ZoneLevel;
import org.pmw.tinylog.Logger;
/**
@@ -26,6 +25,7 @@ import org.pmw.tinylog.Logger;
public class MobRespawnThread implements Runnable {
public MobRespawnThread() {
Logger.info(" MobRespawnThread thread has started!");
@@ -34,85 +34,23 @@ public class MobRespawnThread implements Runnable {
@Override
public void run() {
long startTime = System.currentTimeMillis();
long rollingKeepFraction = (Zone.rollingAvgMobsAliveDepth - 1) / Zone.rollingAvgMobsAliveDepth;
long rollingAddFraction = 1 / Zone.rollingAvgMobsAliveDepth;
while (true) {
try {
for (Zone zone : ZoneManager.getAllZones()) {
/*
if (zone.respawnQue.size() > ZoneLevel.queueLengthToLevelUp) {
zone.setCampLvl(zone.getCamplvl() + 1);
if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) {
Mob respawner = zone.respawnQue.iterator().next();
if (respawner == null)
continue;
respawner.respawn();
zone.respawnQue.remove(respawner);
zone.lastRespawn = System.currentTimeMillis();
}
else if (zone.respawnQue.isEmpty() &&
(zone.lastRespawn + ZoneLevel.msToLevelDown < System.currentTimeMillis()) &&
zone.getCamplvl() > 0) {
zone.setCampLvl(zone.getCamplvl() - 1);
}
*/
int aliveCount = 0;
int deadCount = 0;
for (Mob mob : zone.zoneMobSet) {
if (mob.isAlive()) {
aliveCount = aliveCount + 1;
}
else {
deadCount = deadCount + 1;
}
}
zone.rollingAvgMobsAlive =
((zone.rollingAvgMobsAlive * (Zone.rollingAvgMobsAliveDepth - 1) + aliveCount) / Zone.rollingAvgMobsAliveDepth);
/*
if (startTime + ZoneLevel.msDelayToCampLevel < System.currentTimeMillis()) {
if (aliveCount > Math.floor(zone.zoneMobSet.size() / 2.0)) {
if (zone.levelUpTimer == 0) {
zone.levelUpTimer = System.currentTimeMillis();
} else if (zone.levelUpTimer + ZoneLevel.msTolevelUp < System.currentTimeMillis()) {
zone.setCampLvl(zone.getCampLvl() + 1);
zone.levelUpTimer = 0;
}
} else if (aliveCount == 0) {
if (zone.levelDownTimer == 0) {
zone.levelDownTimer = System.currentTimeMillis();
} else if (zone.levelDownTimer + ZoneLevel.msToLevelDown < System.currentTimeMillis()) {
if (zone.getCampLvl() > 0) {
zone.setCampLvl(zone.getCampLvl() + 1);
zone.levelDownTimer = 0;
}
}
} else {
zone.levelUpTimer = 0;
zone.levelDownTimer = 0;
}
}
*/
}
// --------------------------------------------------------------------------------------------------------------------
// Manage mob respawn
// --------------------------------------------------------------------------------------------------------------------
if (!Zone.respawnQue.isEmpty() && Zone.lastRespawn + 100 < System.currentTimeMillis()) {
Mob respawner = Zone.respawnQue.iterator().next();
if (respawner == null)
continue;
respawner.respawn();
Zone.respawnQue.remove(respawner);
Zone.lastRespawn = System.currentTimeMillis();
}
} catch (Exception e) {
Logger.error(e);
}
+1 -1
View File
@@ -1259,7 +1259,7 @@ public class ClientMessagePump implements NetMsgHandler {
cost *= profit;
if (gold.getNumOfItems() + cost > 10000000) {
if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) {
return;
}
+1 -1
View File
@@ -335,7 +335,7 @@ public class Blueprint {
availableSlots = 3;
break;
case 8:
availableSlots = 1;
availableSlots = Math.min(3, this.maxSlots);
break;
default:
availableSlots = 0;
+2 -3
View File
@@ -2335,15 +2335,14 @@ public class CharacterItemManager {
}
if (this.getGoldInventory().getNumOfItems() + goldFrom2 > 10000000) {
if (this.getGoldInventory().getNumOfItems() + goldFrom2 > MBServerStatics.PLAYER_GOLD_LIMIT) {
PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
if (pc.getClientConnection() != null)
ErrorPopupMsg.sendErrorPopup(pc, 202);
return false;
}
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > 10000000) {
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > MBServerStatics.PLAYER_GOLD_LIMIT) {
PlayerCharacter pc = (PlayerCharacter) tradingWith.absCharacter;
if (pc.getClientConnection() != null)
ErrorPopupMsg.sendErrorPopup(pc, 202);
+39 -40
View File
@@ -674,46 +674,6 @@ public class Item extends AbstractWorldObject {
public static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType) {
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) {
int ownerID;
@@ -771,10 +731,49 @@ public class Item extends AbstractWorldObject {
}
DbManager.ItemQueries.ZERO_ITEM_STACK(newGold);
}
newGold.containerType = containerType;
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
public static Item newGoldItemTemp(AbstractWorldObject awo, ItemBase ib) {
+4 -7
View File
@@ -290,9 +290,7 @@ public class Mine extends AbstractGameObject {
if (treeRank < 1)
return false;
// We check the limit against only the player guild right now
// each guild (even within a nation) is limited by the nation tree
if (guildUnderMineLimit(playerGuild, treeRank) == false) {
if (guildUnderMineLimit(playerGuild.getNation(), treeRank) == false) {
ErrorPopupMsg.sendErrorMsg(playerCharacter, "Your nation cannot support another mine.");
return false;
}
@@ -306,11 +304,10 @@ public class Mine extends AbstractGameObject {
mineCnt += Mine.getMinesForGuild(playerGuild.getObjectUUID()).size();
// Only count mines for a specific guild
//for (Guild guild : playerGuild.getSubGuildList())
// mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size();
for (Guild guild : playerGuild.getSubGuildList())
mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size();
return mineCnt <= (tolRank * 2);
return mineCnt <= tolRank;
}
public boolean changeProductionType(Resource resource) {
-36
View File
@@ -31,7 +31,6 @@ import engine.net.client.msg.PlaceAssetMsg;
import engine.powers.EffectsBase;
import engine.powers.MobPowerEntry;
import engine.server.MBServerStatics;
import engine.util.ZoneLevel;
import org.joda.time.DateTime;
import org.pmw.tinylog.Logger;
@@ -102,8 +101,6 @@ public class Mob extends AbstractIntelligenceAgent {
private DateTime upgradeDateTime = null;
private boolean lootSync = false;
private String originalFirstName;
private String originalLastName;
/**
* No Id Constructor
@@ -132,9 +129,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.lastName = "the " + contract.getName();
}
clearStatic();
originalFirstName = this.firstName;
originalLastName = this.lastName;
}
/**
@@ -156,9 +150,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.building = building;
initializeMob(false, false, false);
clearStatic();
originalFirstName = this.firstName;
originalLastName = this.lastName;
}
/**
@@ -175,9 +166,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.BehaviourType = Enum.MobBehaviourType.Pet1;
initializeMob(true, false, false);
clearStatic();
originalFirstName = this.firstName;
originalLastName = this.lastName;
}
//SIEGE CONSTRUCTOR
@@ -192,9 +180,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.equip = new HashMap<>();
initializeMob(false, true, isPlayerGuard);
clearStatic();
originalFirstName = this.firstName;
originalLastName = this.lastName;
}
/**
@@ -303,8 +288,6 @@ public class Mob extends AbstractIntelligenceAgent {
Logger.error("Mobile:" + this.dbID + ": " + e);
}
originalFirstName = this.firstName;
originalLastName = this.lastName;
}
public static void serializeMobForClientMsgOtherPlayer(Mob mob, ByteBufferWriter writer) throws SerializationException {
@@ -1399,12 +1382,6 @@ public class Mob extends AbstractIntelligenceAgent {
NPCManager.applyRuneSetEffects(this);
// Set Name based on parent zone level
Zone camp = this.getParentZone();
this.lastName = this.originalLastName + ZoneLevel.getNameSuffix(camp);
//PowersManager.applyPower(this, this, this.getLoc(), "CMP-001", camp.getCamplvl(), false);
this.recalculateStats();
this.setHealth(this.healthMax);
@@ -1518,10 +1495,6 @@ public class Mob extends AbstractIntelligenceAgent {
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
}
// Modify max health based on camp level - bad, we need to use effects for this
Zone camp = this.getParentZone();
h = h * ZoneLevel.getMaxHealthPctModifier(camp);
// Set max health, mana and stamina
if (h > 0)
@@ -1622,11 +1595,6 @@ public class Mob extends AbstractIntelligenceAgent {
Logger.error("Error: missing bonuses");
defense = (defense < 1) ? 1 : defense;
// Modify defense for camp level - bad, we need to use effects for this
Zone camp = this.getParentZone();
defense = defense * ZoneLevel.getDefPctModifier(camp);
this.defenseRating = (short) (defense + 0.5f);
} catch (Exception e) {
Logger.info("Mobbase ID " + this.getMobBaseID() + " returned an error. Setting to Default Defense." + e.getMessage());
@@ -1828,10 +1796,6 @@ public class Mob extends AbstractIntelligenceAgent {
atr *= (1 + neg_Bonus);
}
// Modify atr for camp level - bad, we need to use effects for this
Zone camp = this.getParentZone();
atr = atr * ZoneLevel.getAtrPctModifier(camp);
atr = (atr < 1) ? 1 : atr;
// set atr
+6 -1
View File
@@ -1239,12 +1239,17 @@ public class PlayerCharacter extends AbstractCharacter {
playerCharacter.deactivateCharacter();
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
playerCharacter.calculateSkills();
a.setLastCharacter(playerCharacter.getObjectUUID());
playerCharacter.charItemManager.load();
playerCharacter.getCharItemManager().load();
playerCharacter.activateCharacter();
+23 -23
View File
@@ -99,29 +99,29 @@ public class Warehouse extends AbstractWorldObject {
public static ConcurrentHashMap<Integer, Integer> getMaxResources() {
if (maxResources.size() != 23) {
maxResources.put(7, 100000000);
maxResources.put(1580000, 10000);
maxResources.put(1580001, 2000);
maxResources.put(1580002, 2000);
maxResources.put(1580003, 1000);
maxResources.put(1580004, 10000);
maxResources.put(1580005, 3000);
maxResources.put(1580006, 3000);
maxResources.put(1580007, 1000);
maxResources.put(1580008, 3000);
maxResources.put(1580009, 2000);
maxResources.put(1580010, 2000);
maxResources.put(1580011, 1000);
maxResources.put(1580012, 2000);
maxResources.put(1580013, 3000);
maxResources.put(1580014, 1000);
maxResources.put(1580015, 1000);
maxResources.put(1580016, 1000);
maxResources.put(1580017, 500);
maxResources.put(1580018, 500);
maxResources.put(1580019, 500);
maxResources.put(1580020, 500);
maxResources.put(1580021, 500);
maxResources.put(7, 1000000000);
maxResources.put(1580000, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580001, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580002, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580003, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580004, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580005, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580006, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580007, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580008, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580009, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580010, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580011, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580012, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580013, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580014, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580015, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580016, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580017, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580018, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580019, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580020, MBServerStatics.RESOURCE_STACK_LIMIT);
maxResources.put(1580021, MBServerStatics.RESOURCE_STACK_LIMIT);
}
return maxResources;
-35
View File
@@ -18,10 +18,7 @@ import engine.math.Bounds;
import engine.math.Vector2f;
import engine.math.Vector3fImmutable;
import engine.net.ByteBufferWriter;
import engine.net.DispatchMessage;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.server.MBServerStatics;
import engine.util.ZoneLevel;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
@@ -64,13 +61,6 @@ public class Zone extends AbstractGameObject {
//public static ArrayList<Mob> respawnQue = new ArrayList<>();
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
public static long lastRespawn = 0;
private int campLvl = 0;
public long levelUpTimer = 0;
public long levelDownTimer = 0;
public int rollingAvgMobsAlive = 0;
public static final int rollingAvgMobsAliveDepth = 100;
/**
* ResultSet Constructor
*/
@@ -110,33 +100,8 @@ public class Zone extends AbstractGameObject {
if (hash == null)
setHash();
}
public void setCampLvl(int level)
{
this.campLvl = level;
if (this.campLvl > ZoneLevel.campMaxLvl)
{
this.campLvl = ZoneLevel.campMaxLvl;
}
else if (this.campLvl < 0)
{
this.campLvl = 0;
}
//if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold)
{
ChatSystemMsg chatMsg = new ChatSystemMsg(null, this.getName() + " has reached camp level " + this.campLvl + "! Will anyone contest?!");
chatMsg.setMessageType(2);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
}
}
public int getCampLvl()
{
return this.campLvl;
}
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
+3 -2
View File
@@ -33,15 +33,16 @@ public class MBServerStatics {
// hit box
// calcs
public static final boolean PRINT_INCOMING_OPCODES = false; // print
public static final int BANK_GOLD_LIMIT = 25000000;
public static final int BANK_GOLD_LIMIT = 1000000000;
// incoming
// opcodes to
// console
public static final int PLAYER_GOLD_LIMIT = 10000000;
public static final int PLAYER_GOLD_LIMIT = 500000000;
// buildings, npcs
/*
* 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_PLAYER = false; // skip caching // on login
public static final boolean SKIP_CACHE_LOGIN_ITEM = false; // skip caching
-1
View File
@@ -288,7 +288,6 @@ public class WorldServer {
private boolean init() {
Logger.info("Server Code: [NovaTest] Branch");
Logger.info("MAGICBANE SERVER GREETING:");
Logger.info(ConfigManager.MB_WORLD_GREETING.getValue());
-84
View File
@@ -1,84 +0,0 @@
package engine.util;
import engine.objects.Zone;
public class ZoneLevel {
private static final float healthPctPerLevel = (float)0.2;
private static final float atrPctPerLevel = (float)0.2;
private static final float defPctPerLevel = (float)0.2;
private static final float lootPctPerLevel = (float)0.1;
private static final float goldPctPerLevel = (float)0.2;
public static final int campLvlAnnounceThreshold = 5;
public static final int campMaxLvl = 10;
public static final int queueLengthToLevelUp = 5;
public static final int msToLevelDown = 60 * 1000;
public static final int msTolevelUp = 60 * 1000;
public static final long msDelayToCampLevel = 60 * 1000;
private static final String[] nameMap =
{
"",
" I",
" II",
" III",
" IV",
" V",
" VI",
" VII",
" VIII",
" IX",
" X"
};
public static String getNameSuffix(Zone zone)
{
try {
return nameMap[zone.getCampLvl()];
}
catch (Exception ignored)
{
}
return "";
}
public static float getMaxHealthPctModifier(Zone zone)
{
return getGenericModifier(zone, healthPctPerLevel);
}
public static float getAtrPctModifier(Zone zone)
{
return getGenericModifier(zone, atrPctPerLevel);
}
public static float getDefPctModifier(Zone zone)
{
return getGenericModifier(zone, defPctPerLevel);
}
public static float getLootDropModifier(Zone zone)
{
return getGenericModifier(zone, lootPctPerLevel);
}
public static float getGoldDropModifier(Zone zone)
{
return getGenericModifier(zone, goldPctPerLevel);
}
private static float getGenericModifier(Zone zone, float modifierPerLevel)
{
float modifier = (float)1.0;
if (zone != null)
{
modifier += zone.getCampLvl() * modifierPerLevel;
}
return modifier;
}
}
+1 -9
View File
@@ -128,12 +128,10 @@ public class HourlyJobThread implements Runnable {
if (mine.isActive == false)
return false;
Logger.info(mine.getZoneName() + "'s Mine is now Closing");
Building mineBuilding = BuildingManager.getBuildingFromCache(mine.getBuildingID());
if (mineBuilding == null) {
Logger.info("Null mine building for Mine " + mine.getObjectUUID() + " Building " + mine.getBuildingID());
Logger.debug("Null mine building for Mine " + mine.getObjectUUID() + " Building " + mine.getBuildingID());
return false;
}
@@ -141,8 +139,6 @@ public class HourlyJobThread implements Runnable {
// We can early exit here.
if (mineBuilding.getRank() > 0) {
Logger.info("Mine still standing when closing window. Mine Object UUID: " + mine.getObjectUUID() + " Building Id: " + mine.getBuildingID());
mine.setActive(false);
mine.lastClaimer = null;
return true;
@@ -153,8 +149,6 @@ public class HourlyJobThread implements Runnable {
// and keep the window open.
if (!Mine.validateClaimer(mine.lastClaimer)) {
Logger.info("Mine has no valid claimer when closing window. Mine Object UUID: " + mine.getObjectUUID() + " Building Id: " + mine.getBuildingID());
mine.lastClaimer = null;
mine.updateGuildOwner(null);
mine.setActive(true);
@@ -163,8 +157,6 @@ public class HourlyJobThread implements Runnable {
//Update ownership to map
Logger.info("Mine ownership changing when closing window. Mine Object UUID: " + mine.getObjectUUID() + " Building Id: " + mine.getBuildingID() + " new owning guild: " + mine.getOwningGuild().getObjectUUID());
mine.guildName = mine.getOwningGuild().getName();
mine.guildTag = mine.getOwningGuild().getGuildTag();
Guild nation = mine.getOwningGuild().getNation();