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:
@@ -1114,23 +1114,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final void setCombatTarget(final AbstractWorldObject value) {
|
||||
if(this.getObjectTypeMask() == 2050) {//MOB?
|
||||
if (value == null) {
|
||||
if (this.isCombat()) {
|
||||
this.setCombat(false);
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(this);
|
||||
DispatchMessage.sendToAllInRange(this, rwss);
|
||||
}
|
||||
}else {
|
||||
if (!this.isCombat()) {
|
||||
this.setCombat(true);
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(this);
|
||||
DispatchMessage.sendToAllInRange(this, rwss);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.combatTarget = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -607,6 +607,10 @@ public final class Bane {
|
||||
|
||||
DispatchMessage.dispatchMsgToAll(msg);
|
||||
}
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(this.getCity().loc,1500,MBServerStatics.MASK_BUILDING)){
|
||||
Building building = (Building)awo;
|
||||
if(building.setOwner(this.getOwner()));
|
||||
}
|
||||
break;
|
||||
case DESTROY:
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package engine.objects;
|
||||
import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.CityRecord;
|
||||
@@ -394,7 +395,7 @@ public class Building extends AbstractWorldObject {
|
||||
this.rank = newRank;
|
||||
|
||||
// New rank means new mesh
|
||||
|
||||
int oldMeshID = this.meshUUID;
|
||||
newMeshUUID = this.getBlueprint().getMeshForRank(this.rank);
|
||||
this.meshUUID = newMeshUUID;
|
||||
|
||||
@@ -428,6 +429,15 @@ public class Building extends AbstractWorldObject {
|
||||
BuildingManager.cleanupHirelings(this);
|
||||
|
||||
this.isDeranking.compareAndSet(true, false);
|
||||
|
||||
if(oldMeshID != this.meshUUID) {
|
||||
//move NPCs to new slot locations if the mesh was changed and force reload them
|
||||
int index = 0;
|
||||
for (AbstractCharacter hireling : this.hirelings.keySet()) {
|
||||
hireling.setLoc(BuildingManager._slotLocations.get(newMeshUUID).get(index).getLocation());
|
||||
InterestManager.reloadCharacter(hireling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final int getOwnerUUID() {
|
||||
|
||||
@@ -12,7 +12,6 @@ package engine.objects;
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.devcmd.cmds.MakeItemCmd;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
@@ -24,7 +23,10 @@ import engine.powers.poweractions.AbstractPowerAction;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -68,6 +70,8 @@ public class CharacterItemManager {
|
||||
*/
|
||||
private byte equipVer = (byte) 0;
|
||||
|
||||
public boolean updateLock = false;
|
||||
|
||||
public CharacterItemManager(AbstractCharacter ac) {
|
||||
super();
|
||||
this.absCharacter = ac;
|
||||
@@ -103,7 +107,7 @@ public class CharacterItemManager {
|
||||
return;
|
||||
if (take != null) {
|
||||
itemMan.buyFromNPC(take, npc);
|
||||
itemMan.StackResources();
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +694,7 @@ public class CharacterItemManager {
|
||||
this.addGoldToTrade(amt);
|
||||
|
||||
// BONUS CODE BELOW: Thanks some unknown retard!
|
||||
// sourceItemMan.StackResources(sourceItemMan.getInventory(), true);
|
||||
// sourceItemMan.updateInventory(sourceItemMan.getInventory(), true);
|
||||
|
||||
UpdateGoldMsg ugm = new UpdateGoldMsg(source);
|
||||
ugm.configure();
|
||||
@@ -776,8 +780,6 @@ public class CharacterItemManager {
|
||||
this.commitTrade();
|
||||
this.closeTradeWindow(ctwm1, false);
|
||||
other.getCharItemManager().closeTradeWindow(ctwm2, false);
|
||||
this.StackResources();
|
||||
other.getCharItemManager().StackResources();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -938,13 +940,13 @@ public class CharacterItemManager {
|
||||
return junk(i, true);
|
||||
}
|
||||
|
||||
private synchronized boolean junk(Item i, boolean StackResources) {
|
||||
private synchronized boolean junk(Item i, boolean updateInventory) {
|
||||
if (i.getItemBase().getType().equals(ItemType.GOLD)) {
|
||||
if (this.getGoldInventory().getObjectUUID() == i.getObjectUUID())
|
||||
if (DbManager.ItemQueries.UPDATE_GOLD(i, 0)) {
|
||||
this.getGoldInventory().setNumOfItems(0);
|
||||
if (StackResources)
|
||||
StackResources();
|
||||
if (updateInventory)
|
||||
updateInventory();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -972,9 +974,9 @@ public class CharacterItemManager {
|
||||
|
||||
calculateWeights();
|
||||
|
||||
if (StackResources)
|
||||
if (updateInventory)
|
||||
// Send the new inventory
|
||||
//StackResources(i, false); this line was causing entire inventory to disappear
|
||||
//updateInventory(i, false); this line was causing entire inventory to disappear
|
||||
updateInventory(this.getInventory(), true);
|
||||
|
||||
return true;
|
||||
@@ -1249,12 +1251,21 @@ public class CharacterItemManager {
|
||||
} else {
|
||||
int amt = i.getNumOfItems();
|
||||
if (DbManager.ItemQueries.UPDATE_GOLD(this.goldInventory, this.goldInventory.getNumOfItems() + amt)) {
|
||||
StackResources();
|
||||
updateInventory();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} //else if (i.getItemBase().getType().equals(ItemType.RESOURCE)) {
|
||||
// if(this.inventoryContainsResource(i)){
|
||||
// Item resource = getResource(i);
|
||||
// if(resource != null){
|
||||
// resource.setNumOfItems(resource.getNumOfItems() + i.getNumOfItems());
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
||||
this.inventory.add(i);
|
||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||
return true;
|
||||
@@ -1477,7 +1488,7 @@ public class CharacterItemManager {
|
||||
|
||||
if (sdrMerchant) {
|
||||
this.delete(itemToSell);
|
||||
this.StackResources();
|
||||
this.updateInventory();
|
||||
|
||||
} else if (!itemToSell.moveItemToInventory(npc))
|
||||
return false;
|
||||
@@ -2276,10 +2287,13 @@ public class CharacterItemManager {
|
||||
|
||||
if (this.absCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) == false)
|
||||
return;
|
||||
|
||||
if(this.updateLock)
|
||||
return;
|
||||
PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
|
||||
|
||||
UpdateInventoryMsg StackResourcesMsg = new UpdateInventoryMsg(inventory, this.getBank(), this.getGoldInventory(), add);
|
||||
Dispatch dispatch = Dispatch.borrow(pc, StackResourcesMsg);
|
||||
UpdateInventoryMsg updateInventoryMsg = new UpdateInventoryMsg(inventory, this.getBank(), this.getGoldInventory(), add);
|
||||
Dispatch dispatch = Dispatch.borrow(pc, updateInventoryMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
@@ -2616,43 +2630,4 @@ public class CharacterItemManager {
|
||||
|
||||
}
|
||||
|
||||
public void StackResources(){
|
||||
if(!this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
return;
|
||||
ArrayList<Item> resources = new ArrayList<>();
|
||||
HashMap<Integer,Integer> newStacks = new HashMap<>();
|
||||
for(Item item : this.getInventory()){
|
||||
if(item.getItemBase().getType().equals(ItemType.RESOURCE)){
|
||||
resources.add(item);
|
||||
if(newStacks.containsKey(item.getItemBaseID())){
|
||||
newStacks.put(item.getItemBaseID(),newStacks.get(item.getItemBaseID()) + item.getNumOfItems());
|
||||
}else{
|
||||
newStacks.put(item.getItemBaseID(),item.getNumOfItems());
|
||||
}
|
||||
}
|
||||
}
|
||||
//do stacking here
|
||||
PlayerCharacter pc = PlayerCharacter.getFromCache(this.getOwner().getObjectUUID());
|
||||
for(Integer id : newStacks.keySet()){
|
||||
ItemBase ib = ItemBase.getItemBase(id);
|
||||
Item item = new Item(ib, pc.getObjectUUID(),
|
||||
Enum.OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(),
|
||||
true, false, Enum.ItemContainerType.INVENTORY, (byte) 0,
|
||||
new ArrayList<>(), "");
|
||||
|
||||
item.setNumOfItems(newStacks.get(id));
|
||||
try{
|
||||
item = DbManager.ItemQueries.ADD_ITEM(item);
|
||||
this.addItemToInventory(item);
|
||||
}catch(Exception e){
|
||||
ChatManager.chatSystemError(pc, "Failed To Stack Resources");
|
||||
}
|
||||
|
||||
}
|
||||
for(Item item : resources)
|
||||
this.delete(item);
|
||||
|
||||
this.updateInventory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
|
||||
package engine.objects;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.TargetColor;
|
||||
import engine.gameManager.LootManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -117,6 +119,11 @@ public class Experience {
|
||||
159932666, // Level 74
|
||||
169707808, // Level 75
|
||||
179921247, // Level 76
|
||||
190548651, // Level 77
|
||||
201590020, // Level 78
|
||||
213045354, // Level 79
|
||||
224914653, // Level 80
|
||||
237197917 // Level 81
|
||||
|
||||
};
|
||||
|
||||
@@ -214,9 +221,21 @@ public class Experience {
|
||||
235166.21f, // Level 72
|
||||
246039.34f, // Level 73
|
||||
257240.58f, // Level 74
|
||||
1 // 268774.71 //Level 75
|
||||
268765.03f, // Level 75
|
||||
280612.69f, // Level 76
|
||||
292783.56f, // Level 77
|
||||
305277.64f, // Level 78
|
||||
318094.93f, // Level 79
|
||||
1, // Level 80
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
// Used to calcuate the amount of experience a monster grants in the
|
||||
// following formula
|
||||
// expGranted = a(moblevel)^2 + b(moblevel) + c
|
||||
@@ -268,8 +287,8 @@ public class Experience {
|
||||
if (level < 1)
|
||||
level = 1;
|
||||
|
||||
if (level > 75)
|
||||
level = 75;
|
||||
if (level > MBServerStatics.LEVELCAP)
|
||||
level = MBServerStatics.LEVELCAP;
|
||||
|
||||
return MaxExpPerLevel[level];
|
||||
}
|
||||
@@ -354,8 +373,8 @@ public class Experience {
|
||||
|
||||
if (leaderskill != null)
|
||||
leadership = leaderskill.getNumTrains();
|
||||
if (leadership > 90)
|
||||
leadership = 90; // leadership caps at 90%
|
||||
//if (leadership > 90)
|
||||
// leadership = 90; // leadership caps at 90%
|
||||
}
|
||||
|
||||
// Check every group member for distance to see if they get xp
|
||||
@@ -393,6 +412,8 @@ public class Experience {
|
||||
|
||||
// Process XP for this member
|
||||
|
||||
grantedExperience *= (1/giveEXPTo.size()+0.9);
|
||||
|
||||
penalty = getGroupMemberPenalty(leadership, playerCharacter, giveEXPTo,
|
||||
highestLevel);
|
||||
|
||||
@@ -423,8 +444,14 @@ public class Experience {
|
||||
if (grantedExperience == 0)
|
||||
grantedExperience = 1;
|
||||
|
||||
grantedExperience *= LootManager.NORMAL_EXP_RATE;
|
||||
// Grant the player the EXP
|
||||
playerCharacter.grantXP((int) Math.floor(grantedExperience));
|
||||
if(mob.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (((PlayerCharacter) mob).pvpDeaths.contains(killer.getObjectUUID()) == false)
|
||||
playerCharacter.grantXP((int) Math.floor(grantedExperience), true);
|
||||
}else {
|
||||
playerCharacter.grantXP((int) Math.floor(grantedExperience), false);
|
||||
}
|
||||
}
|
||||
|
||||
} else { // Give EXP to a single character
|
||||
@@ -435,7 +462,8 @@ public class Experience {
|
||||
return;
|
||||
|
||||
// Get XP and adjust for Mob Level with world xp modifier taken into account
|
||||
grantedExperience = (double) LOOTMANAGER.NORMAL_EXP_RATE * maxXPPerKill(killer.getLevel());
|
||||
float mdofier = LOOTMANAGER.NORMAL_EXP_RATE;
|
||||
grantedExperience = maxXPPerKill(killer.getLevel());
|
||||
grantedExperience *= getConMod(killer, mob);
|
||||
|
||||
// Modify for hotzone
|
||||
@@ -448,7 +476,12 @@ public class Experience {
|
||||
grantedExperience *= .6;
|
||||
|
||||
// Grant XP
|
||||
killer.grantXP((int) Math.floor(grantedExperience));
|
||||
if(mob.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (((PlayerCharacter) mob).pvpDeaths.contains(killer.getObjectUUID()) == false)
|
||||
killer.grantXP((int) Math.floor(grantedExperience), true);
|
||||
}else {
|
||||
killer.grantXP((int) Math.floor(grantedExperience), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+78
-235
@@ -16,17 +16,15 @@ import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.workthreads.ZergMechanicThread;
|
||||
import org.joda.time.DateTime;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static engine.gameManager.DbManager.MineQueries;
|
||||
import static engine.gameManager.DbManager.getObject;
|
||||
@@ -60,7 +58,8 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
public boolean hasProduced = false;
|
||||
|
||||
public int liveTime;
|
||||
public int liveHour;
|
||||
public int liveMinute;
|
||||
public Boolean firstThirty = true;
|
||||
|
||||
public static ArrayList<Mine> ChinaMines = new ArrayList<>();
|
||||
@@ -115,142 +114,20 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
this.production = Resource.valueOf(rs.getString("mine_resource"));
|
||||
this.lastClaimer = null;
|
||||
}
|
||||
}
|
||||
this.liveHour = rs.getInt("mineLiveHour");
|
||||
this.liveMinute = rs.getInt("mineLiveMinute");
|
||||
this.capSize = rs.getInt("capSize");
|
||||
|
||||
public static void SetTimes(){
|
||||
try {
|
||||
EuroMines.get(0).liveTime = 20;
|
||||
EuroMines.get(1).liveTime = 20;
|
||||
EuroMines.get(2).liveTime = 20;
|
||||
EuroMines.get(3).liveTime = 20;
|
||||
EuroMines.get(4).liveTime = 20;
|
||||
EuroMines.get(5).liveTime = 20;
|
||||
EuroMines.get(6).liveTime = 20;
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
try{
|
||||
ChinaMines.get(0).liveTime = 11;
|
||||
ChinaMines.get(1).liveTime = 11;
|
||||
ChinaMines.get(2).liveTime = 11;
|
||||
ChinaMines.get(3).liveTime = 12;
|
||||
ChinaMines.get(4).liveTime = 12;
|
||||
ChinaMines.get(5).liveTime = 12;
|
||||
ChinaMines.get(6).liveTime = 12;
|
||||
ChinaMines.get(7).liveTime = 12;
|
||||
ChinaMines.get(8).liveTime = 12;
|
||||
ChinaMines.get(9).liveTime = 12;
|
||||
ChinaMines.get(10).liveTime = 13;
|
||||
ChinaMines.get(11).liveTime = 13;
|
||||
ChinaMines.get(12).liveTime = 13;
|
||||
ChinaMines.get(13).liveTime = 13;
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
try{
|
||||
AmericaMines.get(0).liveTime = 1;
|
||||
AmericaMines.get(1).liveTime = 1;
|
||||
AmericaMines.get(2).liveTime = 1;
|
||||
AmericaMines.get(3).liveTime = 2;
|
||||
AmericaMines.get(4).liveTime = 2;
|
||||
AmericaMines.get(5).liveTime = 2;
|
||||
AmericaMines.get(6).liveTime = 2;
|
||||
AmericaMines.get(7).liveTime = 2;
|
||||
AmericaMines.get(8).liveTime = 2;
|
||||
AmericaMines.get(9).liveTime = 2;
|
||||
AmericaMines.get(10).liveTime = 3;
|
||||
AmericaMines.get(11).liveTime = 3;
|
||||
AmericaMines.get(12).liveTime = 3;
|
||||
AmericaMines.get(13).liveTime = 3;
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
|
||||
int count = 1;
|
||||
for(Mine mine : EuroMines){
|
||||
switch(count){
|
||||
case 1:
|
||||
mine.capSize = 3;
|
||||
break;
|
||||
case 2:
|
||||
mine.capSize = 5;
|
||||
break;
|
||||
case 3:
|
||||
mine.capSize = 10;
|
||||
break;
|
||||
case 4:
|
||||
mine.capSize = 3;
|
||||
break;
|
||||
}
|
||||
count ++;
|
||||
if(count == 5)
|
||||
count = 1;
|
||||
if(BuildingManager.getBuilding(mine.buildingID) != null) {
|
||||
Building mineTower = BuildingManager.getBuilding(mine.buildingID);
|
||||
if(BuildingManager.getBuilding(this.buildingID) != null) {
|
||||
Building mineTower = BuildingManager.getBuilding(this.buildingID);
|
||||
if (mineTower != null) {
|
||||
mineTower.setMaxHitPoints(5000 * mine.capSize);
|
||||
mineTower.setCurrentHitPoints((float) 5000 * mine.capSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(Mine mine : ChinaMines){
|
||||
switch(count){
|
||||
case 1:
|
||||
mine.capSize = 3;
|
||||
break;
|
||||
case 2:
|
||||
mine.capSize = 5;
|
||||
break;
|
||||
case 3:
|
||||
mine.capSize = 10;
|
||||
break;
|
||||
case 4:
|
||||
mine.capSize = 3;
|
||||
break;
|
||||
}
|
||||
count ++;
|
||||
if(count == 5)
|
||||
count = 1;
|
||||
|
||||
if(BuildingManager.getBuilding(mine.buildingID) != null) {
|
||||
Building mineTower = BuildingManager.getBuilding(mine.buildingID);
|
||||
if (mineTower != null) {
|
||||
mineTower.setMaxHitPoints(5000 * mine.capSize);
|
||||
mineTower.setCurrentHitPoints((float) 5000 * mine.capSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(Mine mine : AmericaMines){
|
||||
switch(count){
|
||||
case 1:
|
||||
mine.capSize = 3;
|
||||
break;
|
||||
case 2:
|
||||
mine.capSize = 5;
|
||||
break;
|
||||
case 3:
|
||||
mine.capSize = 10;
|
||||
break;
|
||||
case 4:
|
||||
mine.capSize = 3;
|
||||
break;
|
||||
}
|
||||
count ++;
|
||||
if(count == 5)
|
||||
count = 1;
|
||||
|
||||
if(BuildingManager.getBuilding(mine.buildingID) != null) {
|
||||
Building mineTower = BuildingManager.getBuilding(mine.buildingID);
|
||||
if (mineTower != null) {
|
||||
mineTower.setMaxHitPoints(5000 * mine.capSize);
|
||||
mineTower.setCurrentHitPoints((float) 5000 * mine.capSize);
|
||||
mineTower.setMaxHitPoints(5000 * this.capSize);
|
||||
mineTower.setCurrentHitPoints((float) 5000 * this.capSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void releaseMineClaims(PlayerCharacter playerCharacter) {
|
||||
|
||||
if (playerCharacter == null)
|
||||
@@ -306,89 +183,8 @@ public class Mine extends AbstractGameObject {
|
||||
//mine.mineType = MineProduction.LUMBER;
|
||||
}
|
||||
|
||||
try {
|
||||
ChinaMines.add(serverMines.get(0));
|
||||
ChinaMines.add(serverMines.get(3));
|
||||
ChinaMines.add(serverMines.get(6));
|
||||
ChinaMines.add(serverMines.get(9));
|
||||
ChinaMines.add(serverMines.get(12));
|
||||
ChinaMines.add(serverMines.get(15));
|
||||
ChinaMines.add(serverMines.get(18));
|
||||
ChinaMines.add(serverMines.get(21));
|
||||
ChinaMines.add(serverMines.get(23));
|
||||
ChinaMines.add(serverMines.get(25));
|
||||
ChinaMines.add(serverMines.get(27));
|
||||
ChinaMines.add(serverMines.get(29));
|
||||
ChinaMines.add(serverMines.get(31));
|
||||
ChinaMines.add(serverMines.get(33));
|
||||
}catch(Exception e){
|
||||
}catch(Exception e) {
|
||||
|
||||
}
|
||||
try{
|
||||
AmericaMines.add(serverMines.get(1));
|
||||
AmericaMines.add(serverMines.get(4));
|
||||
AmericaMines.add(serverMines.get(7));
|
||||
AmericaMines.add(serverMines.get(10));
|
||||
AmericaMines.add(serverMines.get(13));
|
||||
AmericaMines.add(serverMines.get(16));
|
||||
AmericaMines.add(serverMines.get(19));
|
||||
AmericaMines.add(serverMines.get(22));
|
||||
AmericaMines.add(serverMines.get(24));
|
||||
AmericaMines.add(serverMines.get(26));
|
||||
AmericaMines.add(serverMines.get(28));
|
||||
AmericaMines.add(serverMines.get(30));
|
||||
AmericaMines.add(serverMines.get(32));
|
||||
AmericaMines.add(serverMines.get(34));
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
try{
|
||||
EuroMines.add(serverMines.get(2));
|
||||
EuroMines.add(serverMines.get(5));
|
||||
EuroMines.add(serverMines.get(8));
|
||||
EuroMines.add(serverMines.get(11));
|
||||
EuroMines.add(serverMines.get(14));
|
||||
EuroMines.add(serverMines.get(17));
|
||||
EuroMines.add(serverMines.get(20));
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
|
||||
|
||||
SetTimes();
|
||||
for(Mine mine : EuroMines){
|
||||
if(EuroMines.indexOf(mine) %2 == 0 ){
|
||||
mine.firstThirty = true;
|
||||
} else{
|
||||
mine.firstThirty = false;
|
||||
}
|
||||
}
|
||||
for(Mine mine : AmericaMines){
|
||||
if(AmericaMines.indexOf(mine) %2 == 0 ){
|
||||
mine.firstThirty = true;
|
||||
} else{
|
||||
mine.firstThirty = false;
|
||||
}
|
||||
}
|
||||
for(Mine mine : ChinaMines){
|
||||
if(ChinaMines.indexOf(mine) %2 == 0 ){
|
||||
mine.firstThirty = true;
|
||||
} else{
|
||||
mine.firstThirty = false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for(Mine mine : Mine.getMines()){
|
||||
int minute = 0;
|
||||
if (mine.firstThirty == false)
|
||||
minute = 30;
|
||||
LocalDateTime openTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(minute).withSecond(0);
|
||||
LocalDateTime closeTime = openTime.plusMinutes(30);
|
||||
if(LocalDateTime.now().isAfter(closeTime))
|
||||
mine.wasOpened = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,20 +196,30 @@ public class Mine extends AbstractGameObject {
|
||||
return Mine.towerMap.get(towerID);
|
||||
}
|
||||
|
||||
public static String getMineNationality(int time){
|
||||
switch(time){
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
return "CN";
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
return "EU";
|
||||
case 20:
|
||||
case 21:
|
||||
case 22:
|
||||
return "NA";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
public static void serializeForClientMsg(Mine mine, ByteBufferWriter writer) {
|
||||
writer.putInt(mine.getObjectType().ordinal());
|
||||
writer.putInt(mine.getObjectUUID());
|
||||
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
|
||||
writer.putString(mine.mineType.name);
|
||||
if(ChinaMines.contains((mine))) {
|
||||
writer.putString("Chinese" + " {" + mine.capSize + " Man}");
|
||||
} else if(AmericaMines.contains(mine)){
|
||||
writer.putString("American" + " {" + mine.capSize + " Man}");
|
||||
} else if(EuroMines.contains(mine)){
|
||||
writer.putString("European" + " {" + mine.capSize + " Man}");
|
||||
}else{
|
||||
writer.putString("Unknown" + " {" + mine.capSize + " Man}");
|
||||
}
|
||||
writer.putString(Mine.getMineNationality(mine.liveHour) + " " + mine.capSize + " Man ");
|
||||
writer.putInt(mine.production.hash);
|
||||
writer.putInt(mine.getModifiedProductionAmount());
|
||||
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||
@@ -421,21 +227,16 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
// Errant mines are currently open. Set time to now.
|
||||
|
||||
LocalDateTime mineOpenTime;// = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
|
||||
if(mine.firstThirty == true){
|
||||
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).withNano(0);
|
||||
}
|
||||
else{
|
||||
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0).withNano(0);
|
||||
}
|
||||
LocalDateTime mineOpenTime = LocalDateTime.now().withHour(mine.liveHour).withMinute(mine.liveMinute);
|
||||
|
||||
LocalDateTime mineCloseTime = mineOpenTime.plusMinutes(30);
|
||||
if(LocalDateTime.now().isAfter(mineCloseTime)){
|
||||
if(LocalDateTime.now().isAfter(mineCloseTime) && mine.isActive == false){
|
||||
mineOpenTime = mineOpenTime.plusDays(1);
|
||||
mineCloseTime = mineCloseTime.plusDays(1);
|
||||
}
|
||||
writer.putLocalDateTime(mineOpenTime);
|
||||
writer.putLocalDateTime(mineCloseTime);
|
||||
|
||||
writer.put(mine.isActive ? (byte) 0x01 : (byte) 0x00);
|
||||
|
||||
Building mineTower = BuildingManager.getBuilding(mine.buildingID);
|
||||
@@ -445,9 +246,51 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
writer.putInt(mine.isExpansion() ? mine.mineType.xpacHash : mine.mineType.hash);
|
||||
|
||||
writer.putString(mine.guildName);
|
||||
GuildTag._serializeForDisplay(mine.guildTag, writer);
|
||||
writer.putString(mine.nationName);
|
||||
GuildTag._serializeForDisplay(mine.guildTag, writer);
|
||||
|
||||
boolean isPM = false;
|
||||
if(mineOpenTime.getHour() > 11)
|
||||
isPM = true;
|
||||
|
||||
int hourOpen = mineOpenTime.getHour();
|
||||
int minuteOpen = mineOpenTime.getMinute();
|
||||
int hourClose = mineCloseTime.getHour();
|
||||
int minuteClose = mineCloseTime.getMinute();
|
||||
|
||||
if(isPM){
|
||||
hourOpen -= 12;
|
||||
hourClose -= 12;
|
||||
}
|
||||
String timeString = hourOpen + ":";
|
||||
if(minuteOpen == 0){
|
||||
timeString += "00 ";
|
||||
}else{
|
||||
timeString += "30 ";
|
||||
}
|
||||
|
||||
if(isPM){
|
||||
timeString += "PM ";
|
||||
}else{
|
||||
timeString += "AM ";
|
||||
}
|
||||
|
||||
timeString += " to ";
|
||||
|
||||
timeString += hourClose + ":";
|
||||
|
||||
if(minuteClose == 0){
|
||||
timeString += "00 ";
|
||||
}else{
|
||||
timeString += "30 ";
|
||||
}
|
||||
|
||||
if(isPM){
|
||||
timeString += "PM CST";
|
||||
}else{
|
||||
timeString += "AM CST";
|
||||
}
|
||||
writer.putString(timeString);
|
||||
GuildTag._serializeForDisplay(mine.nationTag, writer);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.HashMap;
|
||||
|
||||
public enum MineProduction {
|
||||
|
||||
LUMBER("Universal Mine", new HashMap<>(), Resource.WORMWOOD, 1618637196, 1663491950),
|
||||
LUMBER("Lumber Mine", new HashMap<>(), Resource.WORMWOOD, 1618637196, 1663491950),
|
||||
ORE("Ore Mine", new HashMap<>(), Resource.OBSIDIAN, 518103023, -788976428),
|
||||
GOLD("Gold Mine", new HashMap<>(), Resource.GALVOR, -662193002, -1227205358),
|
||||
MAGIC("Magic Mine", new HashMap<>(), Resource.BLOODSTONE, 504746863, -1753567069),
|
||||
|
||||
@@ -160,7 +160,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
private boolean asciiLastName = true;
|
||||
private int spamCount = 0;
|
||||
private boolean initialized = false;
|
||||
public boolean enteredWorld = false;
|
||||
private boolean enteredWorld = false;
|
||||
private boolean canBreathe = true;
|
||||
private String hash;
|
||||
private ArrayList<GuildHistory> guildHistory = new ArrayList<>();
|
||||
@@ -178,9 +178,11 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
public float ZergMultiplier = 1.0f;
|
||||
public int mineAppliedID = 0;
|
||||
|
||||
public long lastAction = 0;
|
||||
public boolean depositingWarehouse = false;
|
||||
public Building warehouseBuilding;
|
||||
|
||||
public ArrayList<PlayerCharacter> killedCharacters = new ArrayList<>();
|
||||
|
||||
public long nextBoxCheck = System.currentTimeMillis();
|
||||
/**
|
||||
* No Id Constructor
|
||||
*/
|
||||
@@ -1827,20 +1829,18 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
//see if we shold grant xp to attacker
|
||||
boolean doPVPEXP = false;
|
||||
long lastKill = att.getLastKillOfTarget(this.getObjectUUID());
|
||||
if ((System.currentTimeMillis() - lastKill) > MBServerStatics.PLAYER_KILL_XP_TIMER)
|
||||
if (attacker.getLevel() > 39 && this.getLevel() > 39) {
|
||||
Guild aN = null;
|
||||
Guild tN = null;
|
||||
if (attacker.getGuild() != null)
|
||||
aN = attacker.getGuild().getNation();
|
||||
if (this.getGuild() != null)
|
||||
tN = this.getGuild().getNation();
|
||||
if (aN == null || tN == null || aN.isEmptyGuild() || Guild.sameGuild(aN, tN) || this.isDeathShroud()) {
|
||||
//skip giving xp if same guild or attacker is errant, or target is in death shroud.
|
||||
} else {
|
||||
doPVPEXP = true;
|
||||
}
|
||||
}
|
||||
|
||||
Guild aN = null;
|
||||
Guild tN = null;
|
||||
if (attacker.getGuild() != null)
|
||||
aN = attacker.getGuild().getNation();
|
||||
if (this.getGuild() != null)
|
||||
tN = this.getGuild().getNation();
|
||||
|
||||
if (aN != null || tN != null || !aN.equals(tN) || !this.isDeathShroud()) {
|
||||
doPVPEXP = true;
|
||||
}
|
||||
|
||||
//apply death shroud to non safeholds.
|
||||
Zone zone = ZoneManager.findSmallestZone(this.getLoc());
|
||||
|
||||
@@ -2916,14 +2916,21 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
return endSpeed;
|
||||
}
|
||||
|
||||
public synchronized void grantXP(int xp) {
|
||||
public synchronized void grantXP(int xp, boolean fromPVP) {
|
||||
|
||||
if(this.level > 75 && !fromPVP){
|
||||
return;
|
||||
} else{
|
||||
xp *= 2;
|
||||
}
|
||||
|
||||
if(GroupManager.getGroup(this) == null)
|
||||
xp *= 2;
|
||||
xp *= 1.9f;
|
||||
|
||||
// Stop players from getting experience past the cap
|
||||
if (this.exp + xp >= Experience.getBaseExperience(MBServerStatics.LEVELCAP))
|
||||
xp = Experience.getBaseExperience(MBServerStatics.LEVELCAP) - this.exp + 1;
|
||||
int levelCap = MBServerStatics.LEVELCAP;
|
||||
if (this.exp + xp >= Experience.getBaseExperience(levelCap))
|
||||
xp = Experience.getBaseExperience(levelCap) - this.exp + 1;
|
||||
|
||||
if (xp == 0)
|
||||
xp = 1;
|
||||
@@ -4633,10 +4640,10 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
tmpLevel = targetLevel;
|
||||
|
||||
tmpLevel = (short) Math.min(tmpLevel, 75);
|
||||
tmpLevel = (short) Math.min(tmpLevel, MBServerStatics.LEVELCAP);
|
||||
|
||||
while (this.level < tmpLevel) {
|
||||
grantXP(Experience.getBaseExperience(tmpLevel) - this.exp);
|
||||
grantXP(Experience.getBaseExperience(tmpLevel) - this.exp, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4852,7 +4859,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
//if(this.isBoxed && this.containsEffect(429611355) == false) {//pathfinding
|
||||
// PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 429611355, 40, false);
|
||||
//}
|
||||
if(enteredWorld && this.isActive() && this.isAlive()){
|
||||
if(this.isEnteredWorld() && this.isActive()){
|
||||
if( this.getLevel() < 10) {
|
||||
this.setLevel((short) 10);
|
||||
boolean hasConc = false;
|
||||
@@ -4865,25 +4872,19 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
ItemFactory.fillInventory(this, 980066, 1);
|
||||
}
|
||||
}
|
||||
if(!this.isBoxed && System.currentTimeMillis() < this.nextBoxCheck) {
|
||||
checkIfBoxed(this);
|
||||
}
|
||||
if(this.isBoxed) {
|
||||
if(!this.title.equals(CharacterTitle.BOX)) {
|
||||
this.title = CharacterTitle.BOX;
|
||||
//InterestManager.reloadCharacter(this);
|
||||
}
|
||||
|
||||
if (!this.containsEffect(1672601862)) {//Deathshroud
|
||||
if(this.isBoxed) {
|
||||
if(this.title.equals(CharacterTitle.BOX) == false) {
|
||||
this.title = CharacterTitle.BOX;
|
||||
InterestManager.reloadCharacter(this);
|
||||
}
|
||||
if (this.containsEffect(1672601862) == false) {//Deathshroud
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
if(!this.getEffects().containsKey("MoveBuff")){
|
||||
PowersManager.applyPower(this, this, this.loc, 1514898036, 40, false);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!this.title.equals(CharacterTitle.NONE)) {
|
||||
if(this.title.equals(CharacterTitle.NONE) == false) {
|
||||
this.title = CharacterTitle.NONE;
|
||||
//InterestManager.reloadCharacter(this);
|
||||
InterestManager.reloadCharacter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4894,11 +4895,23 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.updateLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
if(this.depositingWarehouse){
|
||||
long sinceLast = System.currentTimeMillis() - this.getTimestamps().get("lastDepositWarehouse");
|
||||
if(sinceLast > 1000) {
|
||||
this.depositingWarehouse = false;
|
||||
ViewResourcesMessage vrm = new ViewResourcesMessage(this);
|
||||
vrm.setGuild(this.getGuild());
|
||||
vrm.setWarehouseBuilding(this.warehouseBuilding);
|
||||
vrm.configure();
|
||||
Dispatch dispatch = Dispatch.borrow(this, vrm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
this.charItemManager.updateLock = false;
|
||||
this.charItemManager.updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkIfBoxed(PlayerCharacter player){
|
||||
|
||||
player.nextBoxCheck = System.currentTimeMillis() + 10000;
|
||||
public static boolean checkIfBoxed(PlayerCharacter player){
|
||||
try {
|
||||
for (PlayerCharacter pc : SessionManager.getAllActivePlayers()) {
|
||||
if(pc.getClientConnection().machineID.equals(player.getClientConnection().machineID) == false)
|
||||
@@ -4910,17 +4923,15 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (pc.equals(player))
|
||||
continue;
|
||||
if (pc.isBoxed == false) {
|
||||
player.isBoxed = true;
|
||||
InterestManager.setObjectDirty(player);
|
||||
return;
|
||||
player.title = CharacterTitle.BOX;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
player.isBoxed = false;
|
||||
InterestManager.setObjectDirty(player);
|
||||
player.title = CharacterTitle.NONE;
|
||||
return false;
|
||||
}catch(Exception e){
|
||||
player.isBoxed = false;
|
||||
InterestManager.setObjectDirty(player);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5554,6 +5565,14 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.centerHeight = centerHeight;
|
||||
}
|
||||
|
||||
public boolean isEnteredWorld() {
|
||||
return enteredWorld;
|
||||
}
|
||||
|
||||
public void setEnteredWorld(boolean enteredWorld) {
|
||||
this.enteredWorld = enteredWorld;
|
||||
}
|
||||
|
||||
public long getChannelMute() {
|
||||
return channelMute;
|
||||
}
|
||||
|
||||
@@ -129,67 +129,47 @@ public class Warehouse extends AbstractWorldObject {
|
||||
|
||||
public static void warehouseDeposit(MerchantMsg msg, PlayerCharacter player, NPC npc, ClientConnection origin) {
|
||||
|
||||
long nextAllowedAction = player.lastAction + 5000;
|
||||
if(nextAllowedAction > System.currentTimeMillis()){
|
||||
ChatManager.chatSystemInfo(player, "You Must Wait To Do This");
|
||||
return;
|
||||
}
|
||||
player.lastAction = System.currentTimeMillis();
|
||||
|
||||
Building warehouseBuilding;
|
||||
Warehouse warehouse;
|
||||
int depositAmount;
|
||||
Dispatch dispatch;
|
||||
|
||||
Item resource = Item.getFromCache(msg.getItemID());
|
||||
|
||||
if (resource == null)
|
||||
return;
|
||||
|
||||
depositAmount = msg.getAmount();
|
||||
if(depositAmount < 1){
|
||||
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
|
||||
}
|
||||
CharacterItemManager itemMan = player.getCharItemManager();
|
||||
|
||||
if (itemMan.doesCharOwnThisItem(resource.getObjectUUID()) == false)
|
||||
return;
|
||||
|
||||
warehouseBuilding = npc.getBuilding();
|
||||
|
||||
if (warehouseBuilding == null)
|
||||
return;
|
||||
|
||||
warehouse = warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID());
|
||||
|
||||
if (warehouse == null)
|
||||
return;
|
||||
|
||||
ItemBase ib = resource.getItemBase();
|
||||
|
||||
if (!warehouse.deposit(player, resource, depositAmount, true, true)) {
|
||||
// ChatManager.chatGuildError(player, "Failed to deposit " + ib.getName() +".");
|
||||
// Logger.debug("OpenWindow", player.getName() + " Failed to deposit Item with ID " + resource.getObjectUUID() + " from Warehouse With ID = " + warehouseBuilding.getObjectUUID());
|
||||
Building warehouseBuilding = npc.getBuilding();
|
||||
if (warehouseBuilding == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ViewResourcesMessage vrm = new ViewResourcesMessage(player);
|
||||
vrm.setGuild(player.getGuild());
|
||||
vrm.setWarehouseBuilding(warehouseBuilding);
|
||||
vrm.configure();
|
||||
dispatch = Dispatch.borrow(player, vrm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
player.getTimestamps().put("lastDepositWarehouse", System.currentTimeMillis());
|
||||
player.depositingWarehouse = true;
|
||||
player.warehouseBuilding = warehouseBuilding;
|
||||
player.getCharItemManager().updateLock = true;
|
||||
Item resource = Item.getFromCache(msg.getItemID());
|
||||
|
||||
if (resource == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int depositAmount = msg.getAmount();
|
||||
CharacterItemManager itemMan = player.getCharItemManager();
|
||||
|
||||
if (!itemMan.doesCharOwnThisItem(resource.getObjectUUID())) {
|
||||
return;
|
||||
}
|
||||
|
||||
Warehouse warehouse = warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID());
|
||||
if (warehouse == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!warehouse.deposit(player, resource, depositAmount, true, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//ViewResourcesMessage vrm = new ViewResourcesMessage(player);
|
||||
//vrm.setGuild(player.getGuild());
|
||||
//vrm.setWarehouseBuilding(warehouseBuilding);
|
||||
//vrm.configure();
|
||||
//Dispatch dispatch = Dispatch.borrow(player, vrm);
|
||||
//DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
public static void warehouseWithdraw(MerchantMsg msg, PlayerCharacter player, NPC npc, ClientConnection origin) {
|
||||
|
||||
long nextAllowedAction = player.lastAction + 5000;
|
||||
if(nextAllowedAction > System.currentTimeMillis()){
|
||||
ChatManager.chatSystemInfo(player, "You Must Wait To Do This");
|
||||
return;
|
||||
}
|
||||
player.lastAction = System.currentTimeMillis();
|
||||
|
||||
int withdrawAmount;
|
||||
Building warehouseBuilding;
|
||||
Warehouse warehouse;
|
||||
@@ -479,6 +459,59 @@ public class Warehouse extends AbstractWorldObject {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean removeFromInventory(CharacterItemManager itemMan, ItemBase ib, int amount, PlayerCharacter pc) {
|
||||
if (ib.getUUID() == 7) {
|
||||
if (!itemMan.modifyInventoryGold(-amount)) {
|
||||
// ChatManager.chatSystemError(pc, "You do not have this Gold.");
|
||||
return false;
|
||||
}
|
||||
UpdateGoldMsg ugm = new UpdateGoldMsg(pc);
|
||||
ugm.configure();
|
||||
Dispatch dispatch = Dispatch.borrow(pc, ugm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
} else {
|
||||
Item resource = itemMan.getItemByUUID(ib.getUUID());
|
||||
if (resource == null) return false;
|
||||
itemMan.delete(resource);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean updateDatabase(int itemID, int newAmount) {
|
||||
switch (itemID) {
|
||||
case 7: return DbManager.WarehouseQueries.updateGold(this, newAmount);
|
||||
case 1580000: return DbManager.WarehouseQueries.updateStone(this, newAmount);
|
||||
case 1580001: return DbManager.WarehouseQueries.updateTruesteel(this, newAmount);
|
||||
case 1580002: return DbManager.WarehouseQueries.updateIron(this, newAmount);
|
||||
case 1580003: return DbManager.WarehouseQueries.updateAdamant(this, newAmount);
|
||||
case 1580004: return DbManager.WarehouseQueries.updateLumber(this, newAmount);
|
||||
case 1580005: return DbManager.WarehouseQueries.updateOak(this, newAmount);
|
||||
case 1580006: return DbManager.WarehouseQueries.updateBronzewood(this, newAmount);
|
||||
case 1580007: return DbManager.WarehouseQueries.updateMandrake(this, newAmount);
|
||||
case 1580008: return DbManager.WarehouseQueries.updateCoal(this, newAmount);
|
||||
case 1580009: return DbManager.WarehouseQueries.updateAgate(this, newAmount);
|
||||
case 1580010: return DbManager.WarehouseQueries.updateDiamond(this, newAmount);
|
||||
case 1580011: return DbManager.WarehouseQueries.updateOnyx(this, newAmount);
|
||||
case 1580012: return DbManager.WarehouseQueries.updateAzoth(this, newAmount);
|
||||
case 1580013: return DbManager.WarehouseQueries.updateOrichalk(this, newAmount);
|
||||
case 1580014: return DbManager.WarehouseQueries.updateAntimony(this, newAmount);
|
||||
case 1580015: return DbManager.WarehouseQueries.updateSulfur(this, newAmount);
|
||||
case 1580016: return DbManager.WarehouseQueries.updateQuicksilver(this, newAmount);
|
||||
case 1580017: return DbManager.WarehouseQueries.updateGalvor(this, newAmount);
|
||||
case 1580018: return DbManager.WarehouseQueries.updateWormwood(this, newAmount);
|
||||
case 1580019: return DbManager.WarehouseQueries.updateObsidian(this, newAmount);
|
||||
case 1580020: return DbManager.WarehouseQueries.updateBloodstone(this, newAmount);
|
||||
case 1580021: return DbManager.WarehouseQueries.updateMithril(this, newAmount);
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
private Resource getResourceType(Item resource) {
|
||||
return resource.getItemBase().getType().equals(engine.Enum.ItemType.GOLD)
|
||||
? Resource.GOLD
|
||||
: Resource.valueOf(resource.getItemBase().getName().toUpperCase());
|
||||
}
|
||||
|
||||
//for mine deposit
|
||||
public synchronized boolean depositFromMine(Mine mine, ItemBase resource, int amount) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user