Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 40bae67443 | |||
| 1cf1d731c4 | |||
| 24215e21c9 | |||
| 3accd779b9 | |||
| 1d673ca2e5 | |||
| c935ea1986 | |||
| 678ccafd3c | |||
| 31292785a5 | |||
| cdc4717033 | |||
| 35c8ac0289 | |||
| f5cc4a3290 | |||
| 74bd7ddb8b | |||
| 4feb95131c | |||
| d22ba7b89d | |||
| 722fd14be5 | |||
| 12e73d59c7 | |||
| 5c70f15064 | |||
| 8ca641f353 | |||
| 0f9500a0d7 | |||
| 0d51afb737 | |||
| 60e331de1a | |||
| 4a554b0d61 | |||
| 3f3d85fb36 | |||
| d2d655a839 | |||
| 0096b8051c | |||
| 86102c8933 | |||
| f06e2c2e5c | |||
| 74b425e567 | |||
| 22c8cdcf65 | |||
| 7ed026f088 | |||
| 232c381e96 | |||
| 69ea460d5e | |||
| cbe9a30590 |
@@ -192,6 +192,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
// via the client interface.
|
||||
|
||||
ArrayList<WorkOrder> submitList = new ArrayList<>();
|
||||
ArrayList<WorkOrder> orphanList = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;");
|
||||
@@ -209,7 +210,14 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
// Submit new workOrders to the ForgeManager
|
||||
|
||||
for (WorkOrder workOrder : submitList) {
|
||||
|
||||
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||
|
||||
// Delete but do not reconstitute orphan workOrders
|
||||
|
||||
if (workOrder.vendor == null)
|
||||
continue;
|
||||
|
||||
workOrder.workOrderID = ForgeManager.workOrderCounter.incrementAndGet();
|
||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
||||
|
||||
@@ -12,7 +12,6 @@ import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.AttackJob;
|
||||
import engine.jobs.DeferredPowerJob;
|
||||
import engine.math.Vector3f;
|
||||
import engine.mbEnums;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
@@ -29,6 +28,8 @@ import java.util.EnumSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static java.lang.Math.pow;
|
||||
|
||||
public enum CombatManager {
|
||||
|
||||
|
||||
@@ -42,6 +43,9 @@ public enum CombatManager {
|
||||
//
|
||||
|
||||
COMBAT_MANAGER;
|
||||
public static final int COMBAT_BLOCK_ANIMATION = 298;
|
||||
public static final int COMBAT_PARRY_ANIMATION = 299;
|
||||
public static final int COMBAT_DODGE_ANIMATION = 300;
|
||||
|
||||
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target) {
|
||||
|
||||
@@ -118,12 +122,15 @@ public enum CombatManager {
|
||||
if (!attacker.isCombat())
|
||||
return;
|
||||
|
||||
if (attacker.getTimestamps().get("Attack" + slot.name()) != null && attacker.getTimestamps().get("Attack" + slot.name()) < System.currentTimeMillis()) {
|
||||
setAutoAttackJob(attacker, slot, 1000);
|
||||
return;
|
||||
}
|
||||
//check if this slot is on attack timer, if timer has passed clear it, else early exit
|
||||
if (attacker.getTimers() != null && attacker.getTimers().containsKey("Attack" + slot.name()))
|
||||
if (attacker.getTimers().get("Attack" + slot.name()).timeToExecutionLeft() <= 0)
|
||||
attacker.getTimers().remove("Attack" + slot.name());
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// check if character is in range to attack target
|
||||
|
||||
PlayerBonuses bonus = attacker.getBonuses();
|
||||
@@ -137,7 +144,7 @@ public enum CombatManager {
|
||||
if (bonus != null)
|
||||
rangeMod += bonus.getFloatPercentAll(mbEnums.ModType.WeaponRange, mbEnums.SourceType.None);
|
||||
|
||||
attackRange = weapon.template.item_weapon_max_range * rangeMod;
|
||||
attackRange += weapon.template.item_weapon_max_range * rangeMod;
|
||||
}
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||
@@ -147,31 +154,37 @@ public enum CombatManager {
|
||||
float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||
|
||||
boolean inRange = false;
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
attackRange += ((PlayerCharacter) attacker).getCharacterHeight() * 0.5f;
|
||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||
} else {
|
||||
attackRange += attacker.calcHitBox();
|
||||
|
||||
}
|
||||
|
||||
if (attackRange > 15 && attacker.isMoving()) {
|
||||
//cannot shoot bow while moving;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (target.getObjectType()) {
|
||||
case PlayerCharacter:
|
||||
attackRange += ((PlayerCharacter) target).getCharacterHeight() * 0.5f;
|
||||
if (distanceSquared < attackRange * attackRange)
|
||||
if (distanceSquared <= attackRange * attackRange)
|
||||
inRange = true;
|
||||
break;
|
||||
case Mob:
|
||||
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||
if (distanceSquared < attackRange * attackRange)
|
||||
if (distanceSquared <= attackRange * attackRange)
|
||||
inRange = true;
|
||||
break;
|
||||
case Building:
|
||||
if(attackRange > 15){
|
||||
if (attackRange > 15) {
|
||||
float rangeSquared = (attackRange + target.getBounds().getHalfExtents().x) * (attackRange + target.getBounds().getHalfExtents().x);
|
||||
//float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||
if(distanceSquared < rangeSquared) {
|
||||
if (distanceSquared < rangeSquared) {
|
||||
inRange = true;
|
||||
break;
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
||||
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
||||
float sizeX = (target.getBounds().getHalfExtents().x + attackRange) * 2;
|
||||
@@ -188,7 +201,7 @@ public enum CombatManager {
|
||||
|
||||
if (weapon != null) {
|
||||
|
||||
int wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
||||
float wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
||||
|
||||
if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus
|
||||
wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
|
||||
@@ -199,7 +212,7 @@ public enum CombatManager {
|
||||
if (wepSpeed < 10)
|
||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||
|
||||
delay = wepSpeed * 100L;
|
||||
delay = (long)wepSpeed * 100L;
|
||||
}
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||
@@ -216,22 +229,21 @@ public enum CombatManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//check if Out of Stamina
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getStamina() < (weapon.template.item_wt / 3f)) {
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
// take stamina away from attacker if its not a mob
|
||||
if (weapon != null && !attacker.getObjectType().equals(mbEnums.GameObjectType.Mob)) {
|
||||
//check if Out of Stamina
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getStamina() < (weapon.template.item_wt / 3f)) {
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// take stamina away from attacker
|
||||
if (weapon != null) {
|
||||
float stam = weapon.template.item_wt / 3f;
|
||||
stam = (stam < 1) ? 1 : stam;
|
||||
attacker.modifyStamina(-(stam), attacker, true);
|
||||
} else
|
||||
attacker.modifyStamina(-0.5f, attacker, true);
|
||||
attacker.modifyStamina(1, attacker, true);
|
||||
|
||||
//cancel things that are cancelled by an attack
|
||||
|
||||
@@ -251,6 +263,22 @@ public enum CombatManager {
|
||||
atr = attacker.atrHandTwo;
|
||||
}
|
||||
|
||||
//apply weapon powers before early exit for miss or passives
|
||||
DeferredPowerJob dpj = null;
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
|
||||
if (dpj != null) {
|
||||
dpj.attack(target, attackRange);
|
||||
|
||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int def = 0;
|
||||
|
||||
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||
@@ -270,16 +298,7 @@ public enum CombatManager {
|
||||
|
||||
if (target.getObjectType() == mbEnums.GameObjectType.Building)
|
||||
hitChance = 100;
|
||||
int passiveAnim = getSwingAnimation(null, null, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
if(attacker.getObjectType().equals(mbEnums.GameObjectType.Mob)){
|
||||
if (weapon != null) {
|
||||
passiveAnim = getSwingAnimation(weapon.template, null, true);
|
||||
}
|
||||
}else {
|
||||
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
||||
passiveAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, true);
|
||||
}
|
||||
}
|
||||
int passiveAnim = getPassiveAnimation(mbEnums.PassiveType.None); // checking for a miss due to ATR vs Def
|
||||
if (ThreadLocalRandom.current().nextInt(100) > hitChance) {
|
||||
TargetedActionMsg msg = new TargetedActionMsg(attacker, target, 0f, passiveAnim);
|
||||
|
||||
@@ -288,6 +307,10 @@ public enum CombatManager {
|
||||
else
|
||||
DispatchManager.sendToAllInRange(attacker, msg);
|
||||
|
||||
//we need to send the animation even if the attacker misses
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
@@ -318,13 +341,15 @@ public enum CombatManager {
|
||||
|
||||
|
||||
if (!passiveType.equals(mbEnums.PassiveType.None)) {
|
||||
passiveAnim = getPassiveAnimation(passiveType);
|
||||
TargetedActionMsg msg = new TargetedActionMsg(attacker, passiveAnim, target, passiveType.value);
|
||||
|
||||
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
|
||||
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
else
|
||||
DispatchManager.sendToAllInRange(attacker, msg);
|
||||
|
||||
//we need to send the animation even if the attacker misses
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
@@ -338,6 +363,9 @@ public enum CombatManager {
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob) && ((Mob) attacker).isPet())
|
||||
calculatePetDamage(attacker);
|
||||
|
||||
//get the damage type
|
||||
|
||||
mbEnums.DamageType damageType;
|
||||
@@ -404,6 +432,9 @@ public enum CombatManager {
|
||||
|
||||
if (resists.immuneTo(damageType)) {
|
||||
//set auto attack job
|
||||
//we need to send the animation even if the attacker misses
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
@@ -422,13 +453,13 @@ public enum CombatManager {
|
||||
else
|
||||
((Building) target).modifyHealth(-damage, attacker);
|
||||
|
||||
int attackAnim = getSwingAnimation(null, null, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
int attackAnim = getSwingAnimation(null, null, slot);
|
||||
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
DeferredPowerJob weaponPower = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, weaponPower, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
attackAnim = getSwingAnimation(weapon.template, weaponPower, slot);
|
||||
} else {
|
||||
attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
attackAnim = getSwingAnimation(weapon.template, null, slot);
|
||||
}
|
||||
}
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, attackAnim);
|
||||
@@ -436,20 +467,6 @@ public enum CombatManager {
|
||||
}
|
||||
}
|
||||
|
||||
DeferredPowerJob dpj = null;
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
|
||||
if (dpj != null) {
|
||||
dpj.attack(target, attackRange);
|
||||
|
||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
||||
}
|
||||
}
|
||||
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
|
||||
@@ -510,7 +527,11 @@ public enum CombatManager {
|
||||
target.setCombatTarget(attacker);
|
||||
}
|
||||
|
||||
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, boolean mainHand) {
|
||||
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, mbEnums.EquipSlotType slot) {
|
||||
|
||||
//No weapon, return default animation
|
||||
if (wb == null)
|
||||
return 75;
|
||||
|
||||
int token;
|
||||
|
||||
@@ -520,32 +541,71 @@ public enum CombatManager {
|
||||
|
||||
if (token == 563721004) //kick animation
|
||||
return 79;
|
||||
|
||||
if (wb != null) {
|
||||
if (mainHand) {
|
||||
int random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
int anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
return anim;
|
||||
} else {
|
||||
int random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
return wb.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wb == null)
|
||||
//Item has no equipment slots and should not try to return an animation, return default instead
|
||||
if (wb.item_eq_slots_or == null || wb.item_eq_slots_or.isEmpty()) {
|
||||
return 75;
|
||||
if(wb.item_skill_used.equals("Bow") || wb.obj_name.equals("Siege Bow"))
|
||||
return wb.weapon_attack_anim_left.get(0)[0];
|
||||
if (mainHand)
|
||||
return wb.weapon_attack_anim_right.get(0)[0];
|
||||
else
|
||||
return wb.weapon_attack_anim_left.get(0)[0];
|
||||
}
|
||||
|
||||
//declare variables
|
||||
int anim;
|
||||
int random;
|
||||
|
||||
//Item can only be equipped in one slot, return animation for that slot
|
||||
if (wb.item_eq_slots_or.size() == 1) {
|
||||
if (wb.item_eq_slots_or.iterator().next().equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
}
|
||||
} else {
|
||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
return anim;
|
||||
}
|
||||
|
||||
//Item can be equipped in either hand, and should have animation sets for each hand
|
||||
if (slot.equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
}
|
||||
} else {
|
||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
return anim;
|
||||
}
|
||||
|
||||
public static int getPassiveAnimation(mbEnums.PassiveType passiveType) {
|
||||
switch (passiveType) {
|
||||
case Block:
|
||||
return COMBAT_BLOCK_ANIMATION;
|
||||
case Parry:
|
||||
return COMBAT_PARRY_ANIMATION;
|
||||
case Dodge:
|
||||
return COMBAT_DODGE_ANIMATION;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot, long delay) {
|
||||
//calculate next allowed attack and update the timestamp
|
||||
|
||||
if (attacker.getTimestamps().containsKey("Attack" + slot.name()) && attacker.getTimestamps().get("Attack" + slot.name()) > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
attacker.getTimestamps().put("Attack" + slot.name(), System.currentTimeMillis() + delay);
|
||||
|
||||
//handle auto attack job creation
|
||||
@@ -555,9 +615,40 @@ public enum CombatManager {
|
||||
AttackJob aj = new AttackJob(attacker, slot.ordinal(), true);
|
||||
JobContainer job;
|
||||
job = JobScheduler.getInstance().scheduleJob(aj, (System.currentTimeMillis() + delay)); // offset 1 millisecond so no overlap issue
|
||||
timers.put("Attack" + slot, job);
|
||||
timers.put("Attack" + slot.name(), job);
|
||||
} else
|
||||
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
||||
|
||||
}
|
||||
|
||||
public static int calculatePetDamage(AbstractCharacter agent) {
|
||||
//damage calc for pet
|
||||
float range;
|
||||
float damage;
|
||||
float min = 40;
|
||||
float max = 60;
|
||||
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(mbEnums.ModType.MeleeDamageModifier, mbEnums.SourceType.None);
|
||||
double minDmg = getMinDmg(min, agent);
|
||||
double maxDmg = getMaxDmg(max, agent);
|
||||
dmgMultiplier += agent.getLevel() * 0.1f;
|
||||
range = (float) (maxDmg - minDmg);
|
||||
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||
return (int) (damage * dmgMultiplier);
|
||||
}
|
||||
|
||||
public static double getMinDmg(double min, AbstractCharacter agent) {
|
||||
int primary = agent.getStatStrCurrent();
|
||||
int secondary = agent.getStatDexCurrent();
|
||||
int focusLevel = 0;
|
||||
int masteryLevel = 0;
|
||||
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||
}
|
||||
|
||||
public static double getMaxDmg(double max, AbstractCharacter agent) {
|
||||
int primary = agent.getStatStrCurrent();
|
||||
int secondary = agent.getStatDexCurrent();
|
||||
int focusLevel = 0;
|
||||
int masteryLevel = 0;
|
||||
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public enum ForgeManager implements Runnable {
|
||||
// Early exit for completed workOrders loaded from disk
|
||||
// or vendors who were re-deeded with items still cooking.
|
||||
|
||||
if (workOrder.vendor == null && workOrder.runCompleted.get())
|
||||
if (workOrder.vendor == null || workOrder.runCompleted.get())
|
||||
continue;
|
||||
|
||||
// This workOrder has completed production.
|
||||
@@ -393,6 +393,12 @@ public enum ForgeManager implements Runnable {
|
||||
if (rollForModifier < 80) {
|
||||
int randomModifier = LootManager.TableRoll(vendor.getLevel(), false);
|
||||
modTableEntry = ModTableEntry.rollTable(modTypeTableEntry.modTableID, randomModifier);
|
||||
|
||||
// @TODO : Figure out how a null can be returned from a defined set.
|
||||
|
||||
if (modTableEntry == null)
|
||||
return 0;
|
||||
|
||||
EffectsBase effectsBase = PowersManager.getEffectByIDString(modTableEntry.action);
|
||||
modifier = effectsBase.getToken();
|
||||
}
|
||||
|
||||
@@ -525,6 +525,9 @@ public enum NPCManager {
|
||||
|
||||
ConcurrentHashMap.KeySetView<WorkOrder, Boolean> vendorWorkOrders = ForgeManager.vendorWorkOrderLookup.get(npc);
|
||||
|
||||
if (vendorWorkOrders == null)
|
||||
return itemList;
|
||||
|
||||
for (WorkOrder workOrder : vendorWorkOrders)
|
||||
itemList.addAll(workOrder.cooking);
|
||||
|
||||
|
||||
@@ -177,10 +177,10 @@ public enum PowersManager {
|
||||
PlayerCharacter caster = origin.getPlayerCharacter();
|
||||
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||
if (pb != null && pb.isHarmful == false) {
|
||||
if (caster.guild.equals(Guild.getErrantGuild()))
|
||||
return;
|
||||
//if (caster.guild.equals(Guild.getErrantGuild()))
|
||||
// return;
|
||||
|
||||
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false)
|
||||
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(GameObjectType.Building) == false)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,11 @@ public class WorkOrder implements Delayed {
|
||||
this.completionTime = jsonWorkOrder.getLong("completionTime");
|
||||
this.runCompleted.set(jsonWorkOrder.getBoolean("runCompleted"));
|
||||
|
||||
// Vendor sanity check. Might have been deleted
|
||||
|
||||
if (this.vendor == null)
|
||||
return;
|
||||
|
||||
JSONObject productionCostMap = jsonWorkOrder.getJSONObject("production_cost");
|
||||
|
||||
for (String key : productionCostMap.keySet()) {
|
||||
@@ -107,6 +112,7 @@ public class WorkOrder implements Delayed {
|
||||
for (Object o : tokenList) {
|
||||
int prefix = ((JSONArray) o).getInt(0);
|
||||
int suffix = ((JSONArray) o).getInt(1);
|
||||
|
||||
Item cookingItem = ForgeManager.forgeItem(this);
|
||||
cookingItem.prefixToken = prefix;
|
||||
cookingItem.suffixToken = suffix;
|
||||
|
||||
+32
-31
@@ -2715,42 +2715,44 @@ public class mbEnums {
|
||||
|
||||
public enum ResourceType {
|
||||
|
||||
GOLD(7, 2308551, 100000000, 10),
|
||||
ADAMANT(1580003, -1741189964, 1000, 10),
|
||||
AGATE(1580009, 75173057, 2000, 10),
|
||||
ANTIMONY(1580014, 452320058, 1000, 10),
|
||||
AZOTH(1580012, 78329697, 2000, 10),
|
||||
BLOODSTONE(1580020, -1569826353, 500, 10),
|
||||
BRONZEWOOD(1580006, 1334770447, 500, 10),
|
||||
COAL(1580008, 2559427, 3000, 10),
|
||||
DIAMOND(1580010, -1730704107, 2000, 10),
|
||||
GALVOR(1580017, -1596311545, 2000, 10),
|
||||
IRON(1580002, 2504297, 2000, 10),
|
||||
LUMBER(1580004, -1603256692, 10000, 10),
|
||||
MANDRAKE(1580007, 1191391799, 1000, 10),
|
||||
MITHRIL(1580021, -1761257186, 500, 10),
|
||||
OAK(1580005, 74767, 3000, 10),
|
||||
OBSIDIAN(1580019, -697973233, 500, 10),
|
||||
ONYX(1580011, 2977263, 1000, 10),
|
||||
ORICHALK(1580013, -2036290524, 3000, 10),
|
||||
QUICKSILVER(1580016, -472884509, 1000, 10),
|
||||
STONE(1580000, 74856115, 10000, 10),
|
||||
SULFUR(1580015, -1586349421, 1000, 10),
|
||||
TRUESTEEL(1580001, -317484979, 2000, 10),
|
||||
WORMWOOD(1580018, 1532478436, 500, 10);
|
||||
GOLD(7, -1670881623, 2308551, 100000000, 50000),
|
||||
ADAMANT(1580003, 1557001525, -1741189964, 1000, 10),
|
||||
AGATE(1580009, -1096157543, 75173057, 2000, 20),
|
||||
ANTIMONY(1580014, 1256147265, 452320058, 1000, 10),
|
||||
AZOTH(1580012, -1205326951, 78329697, 2000, 20),
|
||||
BLOODSTONE(1580020, -1912381716, -1569826353, 500, 5),
|
||||
BRONZEWOOD(1580006, -519681813, 1334770447, 500, 10),
|
||||
COAL(1580008, -1672872311, 2559427, 3000, 30),
|
||||
DIAMOND(1580010, 1540225085, -1730704107, 2000, 20),
|
||||
GALVOR(1580017, -1683992404, -1596311545, 2000, 5),
|
||||
IRON(1580002, -1673518119, 2504297, 2000, 20),
|
||||
LUMBER(1580004, 1628412684, -1603256692, 10000, 100),
|
||||
MANDRAKE(1580007, 1519910613, 1191391799, 1000, 10),
|
||||
MITHRIL(1580021, 626743397, -1761257186, 500, 5),
|
||||
OAK(1580005, -1653034775, 74767, 3000, 30),
|
||||
OBSIDIAN(1580019, 778019055, -697973233, 500, 5),
|
||||
ONYX(1580011, -1675952151, 2977263, 1000, 10),
|
||||
ORICHALK(1580013, -1468730955, -2036290524, 3000, 30),
|
||||
QUICKSILVER(1580016, -2081208434, -472884509, 1000, 10),
|
||||
STONE(1580000, -1094703863, 74856115, 10000, 100),
|
||||
SULFUR(1580015, -1763687412, -1586349421, 1000, 10),
|
||||
TRUESTEEL(1580001, -169012482, -317484979, 2000, 20),
|
||||
WORMWOOD(1580018, 1204785075, 1532478436, 500, 5);
|
||||
|
||||
public static HashMap<Integer, ResourceType> resourceLookup = new HashMap<>();
|
||||
public static HashMap<Integer, ResourceType> hashLookup = new HashMap<>();
|
||||
public static HashMap<Integer, ResourceType> templateLookup = new HashMap<>();
|
||||
public static HashMap<Integer, ResourceType> templateHashLookup = new HashMap<>();
|
||||
public int templateID;
|
||||
public ItemTemplate template;
|
||||
public int hash;
|
||||
public int resourceHash;
|
||||
public int templateHash;
|
||||
public int deposit_limit;
|
||||
public int mine_production;
|
||||
|
||||
ResourceType(int templateID, int hash, int deposit_limit, int mine_production) {
|
||||
ResourceType(int templateID, int resourceHash, int templateHash, int deposit_limit, int mine_production) {
|
||||
this.templateID = templateID;
|
||||
this.template = ItemTemplate.templates.get(this.templateID);
|
||||
this.hash = hash;
|
||||
this.resourceHash = resourceHash;
|
||||
this.templateHash = templateHash;
|
||||
this.deposit_limit = deposit_limit;
|
||||
this.mine_production = mine_production;
|
||||
}
|
||||
@@ -2758,11 +2760,10 @@ public class mbEnums {
|
||||
public static void InitializeResourceTypes() {
|
||||
|
||||
for (ResourceType resourceType : ResourceType.values()) {
|
||||
resourceLookup.put(resourceType.templateID, resourceType);
|
||||
hashLookup.put(resourceType.hash, resourceType);
|
||||
templateLookup.put(resourceType.templateID, resourceType);
|
||||
templateHashLookup.put(resourceType.templateHash, resourceType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public class MobAI {
|
||||
public static void attackPlayer(Mob mob, PlayerCharacter target) {
|
||||
|
||||
try {
|
||||
if(target == null || !target.isAlive() || !target.isActive() ) {
|
||||
if (target == null || !target.isAlive() || !target.isActive()) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
@@ -175,6 +175,8 @@ public class MobAI {
|
||||
public static void attackMob(Mob mob, Mob target) {
|
||||
|
||||
try {
|
||||
if (mob == null || target == null)
|
||||
return;
|
||||
|
||||
if (mob.getRange() >= 30 && mob.isMoving())
|
||||
return;
|
||||
@@ -973,36 +975,36 @@ public class MobAI {
|
||||
}
|
||||
|
||||
private static void hamletGuardAggro(Mob mob) {
|
||||
Realm realm = RealmMap.getRealmAtLocation(mob.loc);
|
||||
if(realm.getRealmName().equals("Uthgaard")){
|
||||
HashSet<AbstractWorldObject> loadedMobs = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_MOB);
|
||||
for (AbstractWorldObject awo : loadedMobs) {
|
||||
Mob targetMob = (Mob) awo;
|
||||
if (targetMob.equals(mob))
|
||||
continue;
|
||||
if (!targetMob.isAlive() || targetMob.despawned)
|
||||
continue;
|
||||
if (targetMob.isPet())
|
||||
continue;
|
||||
mob.combatTarget = targetMob;
|
||||
return;
|
||||
}
|
||||
Realm realm = RealmMap.getRealmAtLocation(mob.loc);
|
||||
if (realm.getRealmName().equals("Uthgaard")) {
|
||||
HashSet<AbstractWorldObject> loadedMobs = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_MOB);
|
||||
for (AbstractWorldObject awo : loadedMobs) {
|
||||
Mob targetMob = (Mob) awo;
|
||||
if (targetMob.equals(mob))
|
||||
continue;
|
||||
if (!targetMob.isAlive() || targetMob.despawned)
|
||||
continue;
|
||||
if (targetMob.isPet())
|
||||
continue;
|
||||
mob.combatTarget = targetMob;
|
||||
return;
|
||||
}
|
||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PLAYER);
|
||||
for (AbstractWorldObject awo : loadedPlayers) {
|
||||
PlayerCharacter pc = (PlayerCharacter) awo;
|
||||
if (!pc.isAlive() || !pc.isActive())
|
||||
continue;
|
||||
if (pc.guild.equals(Guild.getErrantGuild())) {
|
||||
mob.combatTarget = pc;
|
||||
return;
|
||||
}
|
||||
if (pc.guild.charter.equals(mob.guild.charter))
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PLAYER);
|
||||
for (AbstractWorldObject awo : loadedPlayers) {
|
||||
PlayerCharacter pc = (PlayerCharacter) awo;
|
||||
if (!pc.isAlive() || !pc.isActive())
|
||||
continue;
|
||||
if (pc.guild.equals(Guild.getErrantGuild())) {
|
||||
mob.combatTarget = pc;
|
||||
return;
|
||||
}
|
||||
if (pc.guild.charter.equals(mob.guild.charter))
|
||||
continue;
|
||||
mob.combatTarget = pc;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static void defaultLogic(Mob mob) {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
||||
|
||||
//make sure valid resource
|
||||
|
||||
mbEnums.ResourceType resource = mbEnums.ResourceType.hashLookup.get(changeProductionMsg.getResourceHash());
|
||||
mbEnums.ResourceType resource = mbEnums.ResourceType.templateHashLookup.get(changeProductionMsg.getResourceHash());
|
||||
|
||||
if (resource == null)
|
||||
return true;
|
||||
|
||||
@@ -67,12 +67,6 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
||||
return true; // cannot attack a null target
|
||||
}
|
||||
|
||||
// No point in setting combat target to someone you are already fighting
|
||||
|
||||
if (playerCharacter.isCombat() && playerCharacter.getCombatTarget() != null &&
|
||||
playerCharacter.getCombatTarget().equals(target))
|
||||
return true;
|
||||
|
||||
//set sources target
|
||||
|
||||
playerCharacter.setCombatTarget(target);
|
||||
|
||||
@@ -46,9 +46,6 @@ public class PetAttackMsgHandler extends AbstractClientMsgHandler {
|
||||
if (!pet.isAlive())
|
||||
return true;
|
||||
|
||||
if (pet.getCombatTarget() == null)
|
||||
return true;
|
||||
|
||||
if ((playerCharacter.inSafeZone())
|
||||
&& (msg.getTargetType() == mbEnums.GameObjectType.PlayerCharacter.ordinal()))
|
||||
return true;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ViewResourcesMsg extends ClientNetMsg {
|
||||
|
||||
for (mbEnums.ResourceType resourceType : (warehouseObject.resources.keySet())) {
|
||||
|
||||
writer.putInt(resourceType.hash);
|
||||
writer.putInt(resourceType.templateHash);
|
||||
writer.putInt((warehouseObject.resources.get(resourceType)));
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public class ViewResourcesMsg extends ClientNetMsg {
|
||||
|
||||
for (mbEnums.ResourceType resourceType : warehouseObject.resources.keySet()) {
|
||||
|
||||
writer.putInt(resourceType.hash);
|
||||
writer.putInt(resourceType.templateHash);
|
||||
writer.putInt(0); //available?
|
||||
writer.putInt(resourceType.deposit_limit); //max?
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import engine.net.client.msg.ApplyRuneMsg;
|
||||
import engine.net.client.msg.UpdateStateMsg;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -655,13 +656,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
AssignDamageAtrForPlayers(abstractCharacter, equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD));
|
||||
if (abstractCharacter.getObjectType().equals(GameObjectType.Mob)) {
|
||||
Mob mob = (Mob) abstractCharacter;
|
||||
abstractCharacter.minDamageHandOne += (int) mob.mobBase.getDamageMin();
|
||||
abstractCharacter.minDamageHandTwo += (int) mob.mobBase.getDamageMin();
|
||||
abstractCharacter.maxDamageHandOne += (int) mob.mobBase.getDamageMax();
|
||||
abstractCharacter.maxDamageHandTwo += (int) mob.mobBase.getDamageMax();
|
||||
abstractCharacter.atrHandOne += mob.mobBase.getAttackRating();
|
||||
abstractCharacter.atrHandTwo += mob.mobBase.getAttackRating();
|
||||
abstractCharacter.defenseRating += mob.mobBase.getDefenseRating();
|
||||
abstractCharacter.minDamageHandOne = (int) mob.mobBase.getDamageMin();
|
||||
abstractCharacter.minDamageHandTwo = (int) mob.mobBase.getDamageMin();
|
||||
abstractCharacter.maxDamageHandOne = (int) mob.mobBase.getDamageMax();
|
||||
abstractCharacter.maxDamageHandTwo = (int) mob.mobBase.getDamageMax();
|
||||
abstractCharacter.atrHandOne = mob.mobBase.getAttackRating();
|
||||
abstractCharacter.atrHandTwo = mob.mobBase.getAttackRating();
|
||||
abstractCharacter.defenseRating = mob.mobBase.getDefenseRating();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -804,7 +805,25 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
if (weapon != null)
|
||||
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None));
|
||||
|
||||
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None));
|
||||
PlayerBonuses bonuses = abstractCharacter.bonuses;
|
||||
if (bonuses != null) {
|
||||
ModType modType = ModType.AttackDelay;
|
||||
for (AbstractEffectModifier mod : bonuses.bonusFloats.keySet()) {
|
||||
|
||||
if (mod.getPercentMod() == 0)
|
||||
continue;
|
||||
|
||||
|
||||
if (!mod.modType.equals(modType))
|
||||
continue;
|
||||
|
||||
if (bonuses.bonusFloats.get(mod) == null)
|
||||
continue;
|
||||
|
||||
speed *= (1 + bonuses.bonusFloats.get(mod));
|
||||
}
|
||||
}
|
||||
//speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None));
|
||||
|
||||
if (speed < 10)
|
||||
speed = 10;
|
||||
@@ -1809,7 +1828,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
//handle hate value addition
|
||||
Mob target = (Mob) this;
|
||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
|
||||
|
||||
if (target.playerAgroMap.containsKey(attacker.getObjectUUID()))
|
||||
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
|
||||
else
|
||||
target.playerAgroMap.put(attacker.getObjectUUID(), value);
|
||||
|
||||
|
||||
if (target.isPlayerGuard()) {
|
||||
if (target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
|
||||
target.guardedCity.cityOutlaws.add(attacker.getObjectUUID());
|
||||
|
||||
@@ -641,18 +641,18 @@ public final class Bane {
|
||||
return cityUUID;
|
||||
}
|
||||
|
||||
public void startBane(){
|
||||
public void startBane() {
|
||||
City city = this.getCity();
|
||||
if(city == null)
|
||||
if (city == null)
|
||||
return;
|
||||
|
||||
this.isStarted = true; //flag the bane as started
|
||||
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(city.loc,mbEnums.CityBoundsType.ZONE.halfExtents + 64,MBServerStatics.MASK_BUILDING)){
|
||||
Building building = (Building)awo;
|
||||
if(building == null)
|
||||
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(city.loc, mbEnums.CityBoundsType.ZONE.halfExtents + 64, MBServerStatics.MASK_BUILDING)) {
|
||||
Building building = (Building) awo;
|
||||
if (building == null)
|
||||
continue;
|
||||
if(building.protectionState.equals(ProtectionState.UNDERSIEGE) == false)
|
||||
if (building.protectionState.equals(ProtectionState.UNDERSIEGE) == false)
|
||||
building.protectionState = ProtectionState.UNDERSIEGE;
|
||||
}
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ public class City extends AbstractWorldObject {
|
||||
//handle compiling of cities able to be teleported to for lore rule-set
|
||||
for (AbstractGameObject ago : worldCities.values()) {
|
||||
City city = (City) ago;
|
||||
if(city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
||||
if (city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
||||
continue; // cannot teleport to perdition or bastion
|
||||
if (city.isNpc == 1 && city.getGuild().charter.equals(pc.guild.charter)) {
|
||||
cities.add(city); // anyone of the same charter can teleport to a safehold of that charter
|
||||
@@ -407,7 +407,7 @@ public class City extends AbstractWorldObject {
|
||||
//handle compiling of cities able to be repledged to for lore rule-set
|
||||
for (AbstractGameObject ago : worldCities.values()) {
|
||||
City city = (City) ago;
|
||||
if(city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
||||
if (city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
||||
continue; // cannot repledge to perdition or bastion
|
||||
if (city.isNpc == 1 && city.getGuild().charter.canJoin(playerCharacter)) {
|
||||
cities.add(city); // anyone of the same charter can teleport to a safehold of that charter
|
||||
@@ -1399,7 +1399,7 @@ public class City extends AbstractWorldObject {
|
||||
taxPercent = .20f;
|
||||
|
||||
for (int resourceHash : msg.getResources().keySet())
|
||||
resources.add(ResourceType.hashLookup.get(resourceHash));
|
||||
resources.add(ResourceType.templateHashLookup.get(resourceHash));
|
||||
|
||||
for (ResourceType resourceType : resources) {
|
||||
if (Warehouse.isAboveCap(ruledWarehouse, resourceType, (int) (city.warehouse.resources.get(resourceType) * taxPercent))) {
|
||||
|
||||
@@ -166,7 +166,7 @@ public class Mine extends AbstractGameObject {
|
||||
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
|
||||
writer.putString(mine.mineType.name);
|
||||
writer.putString(mine.zoneName);
|
||||
writer.putInt(mine.production.hash);
|
||||
writer.putInt(mine.production.resourceHash);
|
||||
writer.putInt(mine.production.mine_production);
|
||||
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||
writer.putInt(3600); //window in seconds
|
||||
@@ -393,7 +393,7 @@ public class Mine extends AbstractGameObject {
|
||||
// writer.putInt(0x215C92BB); //this.unknown1);
|
||||
writer.putString(this.mineType.name);
|
||||
writer.putString(this.zoneName);
|
||||
writer.putInt(this.production.hash);
|
||||
writer.putInt(this.production.resourceHash);
|
||||
writer.putInt(this.production.mine_production);
|
||||
writer.putInt(this.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||
writer.putInt(3600); //window in seconds
|
||||
@@ -482,7 +482,7 @@ public class Mine extends AbstractGameObject {
|
||||
if (this.owningGuild.getOwnedCity().warehouse == null)
|
||||
return false;
|
||||
|
||||
return Warehouse.depositFromMine(this, mbEnums.ResourceType.resourceLookup.get(this.production.templateID), this.getModifiedProductionAmount(), this.owningGuild.getOwnedCity().warehouse);
|
||||
return Warehouse.depositFromMine(this, mbEnums.ResourceType.templateLookup.get(this.production.templateID), this.getModifiedProductionAmount(), this.owningGuild.getOwnedCity().warehouse);
|
||||
}
|
||||
|
||||
public boolean updateGuildOwner(PlayerCharacter playerCharacter) {
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class PlayerBonuses {
|
||||
|
||||
//First bonus set
|
||||
private ConcurrentHashMap<AbstractEffectModifier, Float> bonusFloats = new ConcurrentHashMap<>();
|
||||
ConcurrentHashMap<AbstractEffectModifier, Float> bonusFloats = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<AbstractEffectModifier, DamageShield> bonusDamageShields = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<AbstractEffectModifier, String> bonusStrings = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<ModType, HashSet<SourceType>> bonusLists = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -140,7 +140,7 @@ public class Warehouse {
|
||||
if (warehouse == null)
|
||||
return;
|
||||
|
||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.hashLookup.get(msg.getHashID());
|
||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.templateHashLookup.get(msg.getHashID());
|
||||
|
||||
if (isResourceLocked(warehouse, resourceType)) {
|
||||
ChatManager.chatSystemInfo(playerCharacter, "You cannot withdrawl a locked resource.");
|
||||
@@ -182,7 +182,7 @@ public class Warehouse {
|
||||
|
||||
warehouse = city.warehouse;
|
||||
|
||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.hashLookup.get(hashID);
|
||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.templateHashLookup.get(hashID);
|
||||
|
||||
// toggle lock
|
||||
|
||||
@@ -233,7 +233,7 @@ public class Warehouse {
|
||||
return false;
|
||||
}
|
||||
|
||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.resourceLookup.get(resource.templateID);
|
||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.templateLookup.get(resource.templateID);
|
||||
|
||||
if (warehouse.resources.get(resourceType) == null)
|
||||
return false;
|
||||
@@ -261,7 +261,7 @@ public class Warehouse {
|
||||
|
||||
int newAmount = oldAmount + amount;
|
||||
|
||||
if (newAmount > mbEnums.ResourceType.resourceLookup.get(resource.templateID).deposit_limit)
|
||||
if (newAmount > mbEnums.ResourceType.templateLookup.get(resource.templateID).deposit_limit)
|
||||
return false;
|
||||
|
||||
if (removeFromInventory) {
|
||||
@@ -381,7 +381,7 @@ public class Warehouse {
|
||||
int amount = (int) (warehouse.resources.get(resourceType) * taxPercent);
|
||||
|
||||
if (amount <= 0) {
|
||||
msg.getResources().put(resourceType.hash, 0);
|
||||
msg.getResources().put(resourceType.resourceHash, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -395,20 +395,18 @@ public class Warehouse {
|
||||
if (newAmount < amount)
|
||||
continue;
|
||||
|
||||
msg.getResources().put(resourceType.hash, amount);
|
||||
msg.getResources().put(resourceType.resourceHash, amount);
|
||||
|
||||
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
|
||||
msg.getResources().put(resourceType.hash, 0);
|
||||
msg.getResources().put(resourceType.resourceHash, 0);
|
||||
warehouse.resources.put(resourceType, oldAmount);
|
||||
continue;
|
||||
}
|
||||
|
||||
warehouse.resources.put(resourceType, newAmount);
|
||||
depositRealmTaxes(taxer, resourceType, amount, warehouse);
|
||||
mbEnums.ResourceType resource;
|
||||
|
||||
AddTransactionToWarehouse(warehouse, taxer.getObjectType(), taxer.getObjectUUID(), mbEnums.TransactionType.TAXRESOURCE, resourceType, amount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ package engine.powers.poweractions;
|
||||
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.BuildingGroup;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.PortalType;
|
||||
import engine.objects.AbstractCharacter;
|
||||
@@ -53,15 +52,17 @@ public class OpenGatePowerAction extends AbstractPowerAction {
|
||||
if (source == null || awo == null || !(awo.getObjectType().equals(mbEnums.GameObjectType.Building)) || pb == null)
|
||||
return;
|
||||
|
||||
// Make sure building has a blueprint
|
||||
// Make sure target building is a runegate
|
||||
|
||||
if (targetBuilding.getBlueprintUUID() == 0)
|
||||
if (targetBuilding.meshUUID != 24500) // runegate
|
||||
return;
|
||||
|
||||
// Make sure building is actually a runegate.
|
||||
// Which runegate was clicked on?
|
||||
|
||||
if (targetBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.RUNEGATE)
|
||||
return;
|
||||
Runegate runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
|
||||
|
||||
if (runeGate == null)
|
||||
return; // mob camp prop runegate cannot be opened
|
||||
|
||||
// Which portal was opened?
|
||||
|
||||
@@ -72,43 +73,31 @@ public class OpenGatePowerAction extends AbstractPowerAction {
|
||||
case 428937084: //Death Gate
|
||||
portalType = PortalType.OBLIV;
|
||||
break;
|
||||
|
||||
case 429756284: //Chaos Gate
|
||||
portalType = PortalType.CHAOS;
|
||||
break;
|
||||
|
||||
case 429723516: //Khar Gate
|
||||
portalType = PortalType.MERCHANT;
|
||||
break;
|
||||
|
||||
case 429559676: //Spirit Gate
|
||||
portalType = PortalType.SPIRIT;
|
||||
break;
|
||||
|
||||
case 429592444: //Water Gate
|
||||
portalType = PortalType.WATER;
|
||||
break;
|
||||
|
||||
case 429428604: //Fire Gate
|
||||
portalType = PortalType.FIRE;
|
||||
break;
|
||||
|
||||
case 429526908: //Air Gate
|
||||
portalType = PortalType.AIR;
|
||||
break;
|
||||
|
||||
case 429625212: //Earth Gate
|
||||
portalType = PortalType.EARTH;
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
// Which runegate was clicked on?
|
||||
|
||||
Runegate runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
|
||||
runeGate.activatePortal(portalType);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -273,7 +273,7 @@ public class MBServerStatics {
|
||||
public static final float COMBATRUNSPEED = 14.67f;
|
||||
public static final float RUNSPEED_MOB = 15.4f;
|
||||
public static final float MOVEMENT_DESYNC_TOLERANCE = 2f; // Distance out of
|
||||
public static final float NO_WEAPON_RANGE = 8f; // Range for attack with no
|
||||
public static final float NO_WEAPON_RANGE = 4f; // Range for attack with no
|
||||
public static final float REGEN_IDLE = .06f;
|
||||
/*
|
||||
* Base regen rates. Do NOT modify these. They must match the client %per
|
||||
|
||||
@@ -289,10 +289,10 @@ public class HourlyJobThread implements Runnable {
|
||||
Logger.info(PurgeOprhans.recordsDeleted.toString() + "orphaned items deleted");
|
||||
}
|
||||
|
||||
public static void processBanes(){
|
||||
public static void processBanes() {
|
||||
//handle banes
|
||||
for(Bane bane : Bane.banes.values()){
|
||||
if(bane.getLiveDate() != null && DateTime.now().isAfter(bane.getLiveDate().minusMinutes(1)) && bane.isStarted == false)
|
||||
for (Bane bane : Bane.banes.values()) {
|
||||
if (bane.getLiveDate() != null && DateTime.now().isAfter(bane.getLiveDate().minusMinutes(1)) && bane.isStarted == false)
|
||||
bane.startBane();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user