forked from MagicBane/Server
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb30e52be0 | |||
| dc083c1fa6 | |||
| edd2441cda | |||
| 3cce29dcc8 | |||
| a5a7f855c6 | |||
| 52e2619a81 | |||
| 3649c629b7 | |||
| 1c31070fc8 | |||
| bff41967db | |||
| d3692d0fb7 | |||
| 074a799d01 | |||
| 36ffd08a72 | |||
| 58f828b3cd |
@@ -24,3 +24,5 @@
|
|||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
replay_pid*
|
replay_pid*
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ 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
|
||||||
@@ -46,10 +47,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 > 10000000) {
|
if (amt < 1 || amt > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||||
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
|
throwbackError(pc, "Quantity must be between 1 and " + MBServerStatics.PLAYER_GOLD_LIMIT);
|
||||||
return;
|
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.");
|
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ 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;
|
||||||
|
|
||||||
@@ -31,47 +32,82 @@ 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);
|
||||||
|
|
||||||
short weight = ib.getWeight();
|
if (ib == null)
|
||||||
if (!pc.getCharItemManager().hasRoomInventory(weight)) {
|
continue;
|
||||||
throwbackError(pc, "Not enough room in inventory for any more of this item");
|
|
||||||
|
|
||||||
|
short weight = ib.getWeight();
|
||||||
|
|
||||||
|
if (!pc.getCharItemManager().hasRoomInventory(weight)) {
|
||||||
|
throwbackError(pc, "Not enough room in inventory for any more resources.");
|
||||||
pc.getCharItemManager().updateInventory();
|
pc.getCharItemManager().updateInventory();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean worked = false;
|
Item item = new Item(
|
||||||
Item item = new Item(ib, pc.getObjectUUID(),
|
ib,
|
||||||
OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(),
|
pc.getObjectUUID(),
|
||||||
true, false, ItemContainerType.INVENTORY, (byte) 0,
|
OwnerType.PlayerCharacter,
|
||||||
new ArrayList<>(), "");
|
(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 {
|
try {
|
||||||
item = DbManager.ItemQueries.ADD_ITEM(item);
|
item = DbManager.ItemQueries.ADD_ITEM(item);
|
||||||
worked = true;
|
|
||||||
} catch (Exception e) {
|
} 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null || !worked) {
|
if (item == null) {
|
||||||
throwbackError(pc, "DB error 2: Unable to create item.");
|
throwbackError(pc, "Unable to create resource " + ib.getName() + ".");
|
||||||
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) {
|
||||||
@@ -100,7 +136,7 @@ public class MakeItemCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
numItems = (numItems < 1) ? 1 : numItems;
|
numItems = (numItems < 1) ? 1 : numItems;
|
||||||
numItems = (numItems > 5000) ? 5000 : numItems;
|
numItems = Math.min(numItems, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int itembaseID;
|
int itembaseID;
|
||||||
|
|||||||
@@ -39,6 +39,13 @@ 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,6 +289,34 @@ 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)
|
||||||
|
|||||||
@@ -693,6 +693,8 @@ public class MobAI {
|
|||||||
DefaultLogic(mob);
|
DefaultLogic(mob);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(mob.isAlive())
|
||||||
|
RecoverHealth(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -808,7 +810,7 @@ public class MobAI {
|
|||||||
chaseTarget(mob);
|
chaseTarget(mob);
|
||||||
break;
|
break;
|
||||||
case GuardMinion:
|
case GuardMinion:
|
||||||
if (!mob.npcOwner.isAlive() || ((Mob) mob.npcOwner).despawned)
|
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null)
|
||||||
randomGuardPatrolPoint(mob);
|
randomGuardPatrolPoint(mob);
|
||||||
else {
|
else {
|
||||||
if (mob.getCombatTarget() != null) {
|
if (mob.getCombatTarget() != null) {
|
||||||
@@ -827,6 +829,7 @@ public class MobAI {
|
|||||||
chaseTarget(mob);
|
chaseTarget(mob);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||||
@@ -1043,7 +1046,6 @@ public class MobAI {
|
|||||||
mob.setCombatTarget(newTarget);
|
mob.setCombatTarget(newTarget);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -1054,24 +1056,9 @@ public class MobAI {
|
|||||||
public static void GuardMinionLogic(Mob mob) {
|
public static void GuardMinionLogic(Mob mob) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!mob.npcOwner.isAlive()) {
|
boolean isComanded = mob.npcOwner.isAlive();
|
||||||
|
if (!isComanded) {
|
||||||
if (mob.getCombatTarget() == null) {
|
GuardCaptainLogic(mob);
|
||||||
CheckForPlayerGuardAggro(mob);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
|
||||||
|
|
||||||
if (newTarget != null) {
|
|
||||||
|
|
||||||
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
|
||||||
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
|
||||||
mob.setCombatTarget(newTarget);
|
|
||||||
} else
|
|
||||||
mob.setCombatTarget(newTarget);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else {
|
}else {
|
||||||
if (mob.npcOwner.getCombatTarget() != null)
|
if (mob.npcOwner.getCombatTarget() != null)
|
||||||
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
||||||
@@ -1110,22 +1097,6 @@ public class MobAI {
|
|||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
|
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
|
|
||||||
//recover health
|
|
||||||
|
|
||||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
|
||||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
|
||||||
if (mob.getHealth() < mob.getHealthMax()) {
|
|
||||||
|
|
||||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
|
||||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
|
||||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (mob.getHealth() > mob.getHealthMax())
|
|
||||||
mob.setHealth(mob.getHealthMax());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -1379,4 +1350,22 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RecoverHealth(Mob mob){
|
||||||
|
//recover health
|
||||||
|
|
||||||
|
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||||
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||||
|
|
||||||
|
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||||
|
if (mob.getHealth() < mob.getHealthMax()) {
|
||||||
|
|
||||||
|
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||||
|
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||||
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||||
|
|
||||||
|
if (mob.getHealth() > mob.getHealthMax())
|
||||||
|
mob.setHealth(mob.getHealthMax());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1259,7 +1259,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
cost *= profit;
|
cost *= profit;
|
||||||
|
|
||||||
if (gold.getNumOfItems() + cost > 10000000) {
|
if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ public class Blueprint {
|
|||||||
availableSlots = 3;
|
availableSlots = 3;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
availableSlots = 1;
|
availableSlots = Math.min(3, this.maxSlots);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
availableSlots = 0;
|
availableSlots = 0;
|
||||||
|
|||||||
@@ -427,6 +427,10 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
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);
|
||||||
|
|||||||
@@ -674,46 +674,6 @@ 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;
|
||||||
@@ -771,10 +731,49 @@ 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) {
|
||||||
|
|||||||
@@ -1239,12 +1239,17 @@ 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.charItemManager.load();
|
playerCharacter.getCharItemManager().load();
|
||||||
|
|
||||||
playerCharacter.activateCharacter();
|
playerCharacter.activateCharacter();
|
||||||
|
|
||||||
|
|||||||
@@ -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, 100000000);
|
maxResources.put(7, 1000000000);
|
||||||
maxResources.put(1580000, 10000);
|
maxResources.put(1580000, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580001, 2000);
|
maxResources.put(1580001, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580002, 2000);
|
maxResources.put(1580002, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580003, 1000);
|
maxResources.put(1580003, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580004, 10000);
|
maxResources.put(1580004, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580005, 3000);
|
maxResources.put(1580005, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580006, 3000);
|
maxResources.put(1580006, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580007, 1000);
|
maxResources.put(1580007, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580008, 3000);
|
maxResources.put(1580008, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580009, 2000);
|
maxResources.put(1580009, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580010, 2000);
|
maxResources.put(1580010, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580011, 1000);
|
maxResources.put(1580011, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580012, 2000);
|
maxResources.put(1580012, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580013, 3000);
|
maxResources.put(1580013, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580014, 1000);
|
maxResources.put(1580014, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580015, 1000);
|
maxResources.put(1580015, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580016, 1000);
|
maxResources.put(1580016, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580017, 500);
|
maxResources.put(1580017, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580018, 500);
|
maxResources.put(1580018, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580019, 500);
|
maxResources.put(1580019, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580020, 500);
|
maxResources.put(1580020, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
maxResources.put(1580021, 500);
|
maxResources.put(1580021, MBServerStatics.RESOURCE_STACK_LIMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return maxResources;
|
return maxResources;
|
||||||
|
|||||||
@@ -33,15 +33,16 @@ 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 = 25000000;
|
public static final int BANK_GOLD_LIMIT = 1000000000;
|
||||||
// incoming
|
// incoming
|
||||||
// opcodes to
|
// opcodes to
|
||||||
// console
|
// console
|
||||||
public static final int PLAYER_GOLD_LIMIT = 10000000;
|
public static final int PLAYER_GOLD_LIMIT = 500000000;
|
||||||
// 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
|
||||||
|
|||||||
Reference in New Issue
Block a user