forked from MagicBane/Server
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 695a78b1e2 | |||
| 9f6710ccb9 | |||
| fff1e80f61 | |||
| 141af19daa | |||
| 630748541f | |||
| d32818f351 | |||
| d6f94bd0e7 | |||
| db6a4e471d | |||
| a24c611bac | |||
| 3926160ab1 | |||
| 4a7013de61 | |||
| 56564f1c3b | |||
| 8a3e39e97d | |||
| 5224c79441 | |||
| ede016a93d | |||
| cc1825dec9 | |||
| d257ce50cf | |||
| 5b246211e1 | |||
| 33c923b0de | |||
| 02d524663a | |||
| 5bd85addb7 | |||
| 40bae67443 | |||
| 1cf1d731c4 | |||
| 24215e21c9 | |||
| 3accd779b9 | |||
| 1d673ca2e5 | |||
| c935ea1986 | |||
| 678ccafd3c | |||
| 31292785a5 | |||
| cdc4717033 | |||
| 35c8ac0289 | |||
| f5cc4a3290 | |||
| 74bd7ddb8b | |||
| 4feb95131c | |||
| d22ba7b89d | |||
| 722fd14be5 | |||
| 12e73d59c7 | |||
| 5c70f15064 | |||
| 8ca641f353 |
@@ -136,6 +136,12 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
int cityUID = rs.getInt("cityUUID");
|
int cityUID = rs.getInt("cityUUID");
|
||||||
JSONObject jsonObject = new JSONObject(rs.getString("warehouse"));
|
JSONObject jsonObject = new JSONObject(rs.getString("warehouse"));
|
||||||
City city = City.getCity(cityUID);
|
City city = City.getCity(cityUID);
|
||||||
|
|
||||||
|
if (city == null) {
|
||||||
|
Logger.error("No city " + cityUID + " for warehouse");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
city.warehouse = new Warehouse(jsonObject);
|
city.warehouse = new Warehouse(jsonObject);
|
||||||
city.warehouse.city = city;
|
city.warehouse.city = city;
|
||||||
|
|
||||||
@@ -192,6 +198,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
// via the client interface.
|
// via the client interface.
|
||||||
|
|
||||||
ArrayList<WorkOrder> submitList = new ArrayList<>();
|
ArrayList<WorkOrder> submitList = new ArrayList<>();
|
||||||
|
ArrayList<WorkOrder> orphanList = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;");
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;");
|
||||||
@@ -209,7 +216,14 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
// Submit new workOrders to the ForgeManager
|
// Submit new workOrders to the ForgeManager
|
||||||
|
|
||||||
for (WorkOrder workOrder : submitList) {
|
for (WorkOrder workOrder : submitList) {
|
||||||
|
|
||||||
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||||
|
|
||||||
|
// Delete but do not reconstitute orphan workOrders
|
||||||
|
|
||||||
|
if (workOrder.vendor == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
workOrder.workOrderID = ForgeManager.workOrderCounter.incrementAndGet();
|
workOrder.workOrderID = ForgeManager.workOrderCounter.incrementAndGet();
|
||||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||||
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
||||||
|
|||||||
@@ -463,26 +463,8 @@ public enum BuildingManager {
|
|||||||
return GuildStatusController.isGuildLeader(player.getGuildStatus()) || GuildStatusController.isInnerCouncil(player.getGuildStatus());
|
return GuildStatusController.isGuildLeader(player.getGuildStatus()) || GuildStatusController.isInnerCouncil(player.getGuildStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetAvailableGold(Building building) {
|
|
||||||
|
|
||||||
if (building.getStrongboxValue() == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (building.getStrongboxValue() < building.reserve)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return building.getStrongboxValue() - building.reserve;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
||||||
|
|
||||||
//Nation Members and Guild members are not hostile.
|
|
||||||
// if (building.getGuild() != null){
|
|
||||||
// if (pc.getGuild() != null)
|
|
||||||
// if (building.getGuild().getObjectUUID() == pc.getGuildUUID()
|
|
||||||
// || pc.getGuild().getNation().getObjectUUID() == building.getGuild().getNation().getObjectUUID())
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
if (Guild.sameNationExcludeErrant(building.getGuild(), player.getGuild()))
|
if (Guild.sameNationExcludeErrant(building.getGuild(), player.getGuild()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import engine.job.JobContainer;
|
|||||||
import engine.job.JobScheduler;
|
import engine.job.JobScheduler;
|
||||||
import engine.jobs.AttackJob;
|
import engine.jobs.AttackJob;
|
||||||
import engine.jobs.DeferredPowerJob;
|
import engine.jobs.DeferredPowerJob;
|
||||||
import engine.math.Vector3f;
|
|
||||||
import engine.mbEnums;
|
import engine.mbEnums;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
import engine.net.client.msg.TargetedActionMsg;
|
||||||
@@ -124,9 +123,9 @@ public enum CombatManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//check if this slot is on attack timer, if timer has passed clear it, else early exit
|
//check if this slot is on attack timer, if timer has passed clear it, else early exit
|
||||||
if(attacker.getTimers().containsKey("Attack"+slot.name()))
|
if (attacker.getTimers() != null && attacker.getTimers().containsKey("Attack" + slot.name()))
|
||||||
if(attacker.getTimers().get("Attack"+slot.name()).timeToExecutionLeft() <= 0)
|
if (attacker.getTimers().get("Attack" + slot.name()).timeToExecutionLeft() <= 0)
|
||||||
attacker.getTimers().remove("Attack"+slot.name());
|
attacker.getTimers().remove("Attack" + slot.name());
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -156,12 +155,12 @@ public enum CombatManager {
|
|||||||
|
|
||||||
boolean inRange = false;
|
boolean inRange = false;
|
||||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||||
attackRange += ((AbstractCharacter)target).calcHitBox();
|
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(attackRange > 15 && attacker.isMoving()){
|
if (attackRange > 15 && attacker.isMoving()) {
|
||||||
//cannot shoot bow while moving;
|
//cannot shoot bow while moving;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -169,23 +168,23 @@ public enum CombatManager {
|
|||||||
switch (target.getObjectType()) {
|
switch (target.getObjectType()) {
|
||||||
case PlayerCharacter:
|
case PlayerCharacter:
|
||||||
attackRange += ((PlayerCharacter) target).getCharacterHeight() * 0.5f;
|
attackRange += ((PlayerCharacter) target).getCharacterHeight() * 0.5f;
|
||||||
if (distanceSquared < attackRange * attackRange)
|
if (distanceSquared <= attackRange * attackRange)
|
||||||
inRange = true;
|
inRange = true;
|
||||||
break;
|
break;
|
||||||
case Mob:
|
case Mob:
|
||||||
attackRange += ((AbstractCharacter) target).calcHitBox();
|
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||||
if (distanceSquared < attackRange * attackRange)
|
if (distanceSquared <= attackRange * attackRange)
|
||||||
inRange = true;
|
inRange = true;
|
||||||
break;
|
break;
|
||||||
case Building:
|
case Building:
|
||||||
if(attackRange > 15){
|
if (attackRange > 15) {
|
||||||
float rangeSquared = (attackRange + target.getBounds().getHalfExtents().x) * (attackRange + target.getBounds().getHalfExtents().x);
|
float rangeSquared = (attackRange + target.getBounds().getHalfExtents().x) * (attackRange + target.getBounds().getHalfExtents().x);
|
||||||
//float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
//float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||||
if(distanceSquared < rangeSquared) {
|
if (distanceSquared < rangeSquared) {
|
||||||
inRange = true;
|
inRange = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
||||||
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
||||||
float sizeX = (target.getBounds().getHalfExtents().x + attackRange) * 2;
|
float sizeX = (target.getBounds().getHalfExtents().x + attackRange) * 2;
|
||||||
@@ -202,7 +201,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (weapon != null) {
|
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
|
if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus
|
||||||
wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
|
wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
|
||||||
@@ -213,7 +212,7 @@ public enum CombatManager {
|
|||||||
if (wepSpeed < 10)
|
if (wepSpeed < 10)
|
||||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
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))
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||||
@@ -264,6 +263,22 @@ public enum CombatManager {
|
|||||||
atr = attacker.atrHandTwo;
|
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;
|
int def = 0;
|
||||||
|
|
||||||
if (AbstractCharacter.IsAbstractCharacter(target))
|
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||||
@@ -293,7 +308,7 @@ public enum CombatManager {
|
|||||||
DispatchManager.sendToAllInRange(attacker, msg);
|
DispatchManager.sendToAllInRange(attacker, msg);
|
||||||
|
|
||||||
//we need to send the animation even if the attacker misses
|
//we need to send the animation even if the attacker misses
|
||||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template,null,slot));
|
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||||
DispatchManager.sendToAllInRange(target, cmm);
|
DispatchManager.sendToAllInRange(target, cmm);
|
||||||
|
|
||||||
//set auto attack job
|
//set auto attack job
|
||||||
@@ -332,6 +347,9 @@ public enum CombatManager {
|
|||||||
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
|
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
|
||||||
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
|
|
||||||
|
//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
|
//set auto attack job
|
||||||
setAutoAttackJob(attacker, slot, delay);
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
return;
|
return;
|
||||||
@@ -345,7 +363,7 @@ public enum CombatManager {
|
|||||||
setAutoAttackJob(attacker, slot, delay);
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(attacker.getObjectType().equals(mbEnums.GameObjectType.Mob) && ((Mob)attacker).isPet())
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob) && ((Mob) attacker).isPet())
|
||||||
calculatePetDamage(attacker);
|
calculatePetDamage(attacker);
|
||||||
|
|
||||||
//get the damage type
|
//get the damage type
|
||||||
@@ -414,6 +432,9 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (resists.immuneTo(damageType)) {
|
if (resists.immuneTo(damageType)) {
|
||||||
//set auto attack job
|
//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);
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -446,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
|
//set auto attack job
|
||||||
setAutoAttackJob(attacker, slot, delay);
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
|
|
||||||
@@ -537,7 +544,7 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Item has no equipment slots and should not try to return an animation, return default instead
|
//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.size() == 0){
|
if (wb.item_eq_slots_or == null || wb.item_eq_slots_or.isEmpty()) {
|
||||||
return 75;
|
return 75;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,15 +553,15 @@ public enum CombatManager {
|
|||||||
int random;
|
int random;
|
||||||
|
|
||||||
//Item can only be equipped in one slot, return animation for that slot
|
//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.size() == 1) {
|
||||||
if (wb.item_eq_slots_or.iterator().next().equals(mbEnums.EquipSlotType.RHELD)) {
|
if (wb.item_eq_slots_or.iterator().next().equals(mbEnums.EquipSlotType.RHELD)) {
|
||||||
anim = wb.weapon_attack_anim_right.get(0)[0];
|
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||||
if (dpj != null) {
|
if (dpj != null) {
|
||||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||||
if (dpj != null) {
|
if (dpj != null) {
|
||||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||||
anim = wb.weapon_attack_anim_left.get(random)[0];
|
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||||
@@ -570,7 +577,7 @@ public enum CombatManager {
|
|||||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||||
if (dpj != null) {
|
if (dpj != null) {
|
||||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||||
@@ -580,8 +587,8 @@ public enum CombatManager {
|
|||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getPassiveAnimation(mbEnums.PassiveType passiveType){
|
public static int getPassiveAnimation(mbEnums.PassiveType passiveType) {
|
||||||
switch(passiveType){
|
switch (passiveType) {
|
||||||
case Block:
|
case Block:
|
||||||
return COMBAT_BLOCK_ANIMATION;
|
return COMBAT_BLOCK_ANIMATION;
|
||||||
case Parry:
|
case Parry:
|
||||||
@@ -596,7 +603,7 @@ public enum CombatManager {
|
|||||||
public static void setAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot, long delay) {
|
public static void setAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot, long delay) {
|
||||||
//calculate next allowed attack and update the timestamp
|
//calculate next allowed attack and update the timestamp
|
||||||
|
|
||||||
if(attacker.getTimestamps().containsKey("Attack" + slot.name()) && attacker.getTimestamps().get("Attack" + slot.name()) > System.currentTimeMillis())
|
if (attacker.getTimestamps().containsKey("Attack" + slot.name()) && attacker.getTimestamps().get("Attack" + slot.name()) > System.currentTimeMillis())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
attacker.getTimestamps().put("Attack" + slot.name(), System.currentTimeMillis() + delay);
|
attacker.getTimestamps().put("Attack" + slot.name(), System.currentTimeMillis() + delay);
|
||||||
@@ -613,6 +620,7 @@ public enum CombatManager {
|
|||||||
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int calculatePetDamage(AbstractCharacter agent) {
|
public static int calculatePetDamage(AbstractCharacter agent) {
|
||||||
//damage calc for pet
|
//damage calc for pet
|
||||||
float range;
|
float range;
|
||||||
@@ -627,6 +635,7 @@ public enum CombatManager {
|
|||||||
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
return (int) (damage * dmgMultiplier);
|
return (int) (damage * dmgMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMinDmg(double min, AbstractCharacter agent) {
|
public static double getMinDmg(double min, AbstractCharacter agent) {
|
||||||
int primary = agent.getStatStrCurrent();
|
int primary = agent.getStatStrCurrent();
|
||||||
int secondary = agent.getStatDexCurrent();
|
int secondary = agent.getStatDexCurrent();
|
||||||
@@ -634,6 +643,7 @@ public enum CombatManager {
|
|||||||
int masteryLevel = 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));
|
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) {
|
public static double getMaxDmg(double max, AbstractCharacter agent) {
|
||||||
int primary = agent.getStatStrCurrent();
|
int primary = agent.getStatStrCurrent();
|
||||||
int secondary = agent.getStatDexCurrent();
|
int secondary = agent.getStatDexCurrent();
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public enum ForgeManager implements Runnable {
|
|||||||
// Early exit for completed workOrders loaded from disk
|
// Early exit for completed workOrders loaded from disk
|
||||||
// or vendors who were re-deeded with items still cooking.
|
// 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;
|
continue;
|
||||||
|
|
||||||
// This workOrder has completed production.
|
// This workOrder has completed production.
|
||||||
@@ -393,6 +393,12 @@ public enum ForgeManager implements Runnable {
|
|||||||
if (rollForModifier < 80) {
|
if (rollForModifier < 80) {
|
||||||
int randomModifier = LootManager.TableRoll(vendor.getLevel(), false);
|
int randomModifier = LootManager.TableRoll(vendor.getLevel(), false);
|
||||||
modTableEntry = ModTableEntry.rollTable(modTypeTableEntry.modTableID, randomModifier);
|
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);
|
EffectsBase effectsBase = PowersManager.getEffectByIDString(modTableEntry.action);
|
||||||
modifier = effectsBase.getToken();
|
modifier = effectsBase.getToken();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,12 +176,29 @@ public enum PowersManager {
|
|||||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||||
PlayerCharacter caster = origin.getPlayerCharacter();
|
PlayerCharacter caster = origin.getPlayerCharacter();
|
||||||
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||||
if (pb != null && pb.isHarmful == false) {
|
if (pb != null && pb.enforceLore()) {
|
||||||
//if (caster.guild.equals(Guild.getErrantGuild()))
|
//if (caster.guild.equals(Guild.getErrantGuild()))
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(GameObjectType.Building) == false)
|
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(GameObjectType.Building) == false) {
|
||||||
|
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||||
|
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||||
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
|
|
||||||
|
// Send Fail to cast message
|
||||||
|
PlayerCharacter pc = SessionManager
|
||||||
|
.getPlayerCharacter(origin);
|
||||||
|
|
||||||
|
if (pc != null) {
|
||||||
|
sendPowerMsg(pc, 2, msg);
|
||||||
|
if (pc.isCasting()) {
|
||||||
|
pc.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
pc.setIsCasting(false);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,9 +925,20 @@ public enum PowersManager {
|
|||||||
if (pb.isHarmful())
|
if (pb.isHarmful())
|
||||||
mobTarget.handleDirectAggro(playerCharacter);
|
mobTarget.handleDirectAggro(playerCharacter);
|
||||||
}
|
}
|
||||||
//Power is aiding a target, handle aggro if combat target is a Mob.
|
|
||||||
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
//Check for immunities
|
||||||
|
if (target.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
||||||
|
PlayerBonuses tarBonus = pcTarget.getBonuses();
|
||||||
|
SourceType source = SourceType.GetSourceType(pb.category);
|
||||||
|
boolean immune = tarBonus.getBool(ModType.ImmuneTo, source);
|
||||||
|
if(!immune){
|
||||||
|
DamageType damageType = DamageType.getDamageType(pb.category);
|
||||||
|
immune = pcTarget.getResists().immuneTo(damageType);
|
||||||
|
}
|
||||||
|
if(immune){
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update target of used power timer
|
// update target of used power timer
|
||||||
|
|||||||
@@ -84,6 +84,11 @@ public class WorkOrder implements Delayed {
|
|||||||
this.completionTime = jsonWorkOrder.getLong("completionTime");
|
this.completionTime = jsonWorkOrder.getLong("completionTime");
|
||||||
this.runCompleted.set(jsonWorkOrder.getBoolean("runCompleted"));
|
this.runCompleted.set(jsonWorkOrder.getBoolean("runCompleted"));
|
||||||
|
|
||||||
|
// Vendor sanity check. Might have been deleted
|
||||||
|
|
||||||
|
if (this.vendor == null)
|
||||||
|
return;
|
||||||
|
|
||||||
JSONObject productionCostMap = jsonWorkOrder.getJSONObject("production_cost");
|
JSONObject productionCostMap = jsonWorkOrder.getJSONObject("production_cost");
|
||||||
|
|
||||||
for (String key : productionCostMap.keySet()) {
|
for (String key : productionCostMap.keySet()) {
|
||||||
@@ -107,6 +112,7 @@ public class WorkOrder implements Delayed {
|
|||||||
for (Object o : tokenList) {
|
for (Object o : tokenList) {
|
||||||
int prefix = ((JSONArray) o).getInt(0);
|
int prefix = ((JSONArray) o).getInt(0);
|
||||||
int suffix = ((JSONArray) o).getInt(1);
|
int suffix = ((JSONArray) o).getInt(1);
|
||||||
|
|
||||||
Item cookingItem = ForgeManager.forgeItem(this);
|
Item cookingItem = ForgeManager.forgeItem(this);
|
||||||
cookingItem.prefixToken = prefix;
|
cookingItem.prefixToken = prefix;
|
||||||
cookingItem.suffixToken = suffix;
|
cookingItem.suffixToken = suffix;
|
||||||
|
|||||||
+32
-31
@@ -2715,42 +2715,44 @@ public class mbEnums {
|
|||||||
|
|
||||||
public enum ResourceType {
|
public enum ResourceType {
|
||||||
|
|
||||||
GOLD(7, 2308551, 100000000, 10),
|
GOLD(7, -1670881623, 2308551, 100000000, 50000),
|
||||||
ADAMANT(1580003, -1741189964, 1000, 10),
|
ADAMANT(1580003, 1557001525, -1741189964, 1000, 10),
|
||||||
AGATE(1580009, 75173057, 2000, 10),
|
AGATE(1580009, -1096157543, 75173057, 2000, 20),
|
||||||
ANTIMONY(1580014, 452320058, 1000, 10),
|
ANTIMONY(1580014, 1256147265, 452320058, 1000, 10),
|
||||||
AZOTH(1580012, 78329697, 2000, 10),
|
AZOTH(1580012, -1205326951, 78329697, 2000, 20),
|
||||||
BLOODSTONE(1580020, -1569826353, 500, 10),
|
BLOODSTONE(1580020, -1912381716, -1569826353, 500, 5),
|
||||||
BRONZEWOOD(1580006, 1334770447, 500, 10),
|
BRONZEWOOD(1580006, -519681813, 1334770447, 500, 10),
|
||||||
COAL(1580008, 2559427, 3000, 10),
|
COAL(1580008, -1672872311, 2559427, 3000, 30),
|
||||||
DIAMOND(1580010, -1730704107, 2000, 10),
|
DIAMOND(1580010, 1540225085, -1730704107, 2000, 20),
|
||||||
GALVOR(1580017, -1596311545, 2000, 10),
|
GALVOR(1580017, -1683992404, -1596311545, 2000, 5),
|
||||||
IRON(1580002, 2504297, 2000, 10),
|
IRON(1580002, -1673518119, 2504297, 2000, 20),
|
||||||
LUMBER(1580004, -1603256692, 10000, 10),
|
LUMBER(1580004, 1628412684, -1603256692, 10000, 100),
|
||||||
MANDRAKE(1580007, 1191391799, 1000, 10),
|
MANDRAKE(1580007, 1519910613, 1191391799, 1000, 10),
|
||||||
MITHRIL(1580021, -1761257186, 500, 10),
|
MITHRIL(1580021, 626743397, -1761257186, 500, 5),
|
||||||
OAK(1580005, 74767, 3000, 10),
|
OAK(1580005, -1653034775, 74767, 3000, 30),
|
||||||
OBSIDIAN(1580019, -697973233, 500, 10),
|
OBSIDIAN(1580019, 778019055, -697973233, 500, 5),
|
||||||
ONYX(1580011, 2977263, 1000, 10),
|
ONYX(1580011, -1675952151, 2977263, 1000, 10),
|
||||||
ORICHALK(1580013, -2036290524, 3000, 10),
|
ORICHALK(1580013, -1468730955, -2036290524, 3000, 30),
|
||||||
QUICKSILVER(1580016, -472884509, 1000, 10),
|
QUICKSILVER(1580016, -2081208434, -472884509, 1000, 10),
|
||||||
STONE(1580000, 74856115, 10000, 10),
|
STONE(1580000, -1094703863, 74856115, 10000, 100),
|
||||||
SULFUR(1580015, -1586349421, 1000, 10),
|
SULFUR(1580015, -1763687412, -1586349421, 1000, 10),
|
||||||
TRUESTEEL(1580001, -317484979, 2000, 10),
|
TRUESTEEL(1580001, -169012482, -317484979, 2000, 20),
|
||||||
WORMWOOD(1580018, 1532478436, 500, 10);
|
WORMWOOD(1580018, 1204785075, 1532478436, 500, 5);
|
||||||
|
|
||||||
public static HashMap<Integer, ResourceType> resourceLookup = new HashMap<>();
|
public static HashMap<Integer, ResourceType> templateLookup = new HashMap<>();
|
||||||
public static HashMap<Integer, ResourceType> hashLookup = new HashMap<>();
|
public static HashMap<Integer, ResourceType> templateHashLookup = new HashMap<>();
|
||||||
public int templateID;
|
public int templateID;
|
||||||
public ItemTemplate template;
|
public ItemTemplate template;
|
||||||
public int hash;
|
public int resourceHash;
|
||||||
|
public int templateHash;
|
||||||
public int deposit_limit;
|
public int deposit_limit;
|
||||||
public int mine_production;
|
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.templateID = templateID;
|
||||||
this.template = ItemTemplate.templates.get(this.templateID);
|
this.template = ItemTemplate.templates.get(this.templateID);
|
||||||
this.hash = hash;
|
this.resourceHash = resourceHash;
|
||||||
|
this.templateHash = templateHash;
|
||||||
this.deposit_limit = deposit_limit;
|
this.deposit_limit = deposit_limit;
|
||||||
this.mine_production = mine_production;
|
this.mine_production = mine_production;
|
||||||
}
|
}
|
||||||
@@ -2758,11 +2760,10 @@ public class mbEnums {
|
|||||||
public static void InitializeResourceTypes() {
|
public static void InitializeResourceTypes() {
|
||||||
|
|
||||||
for (ResourceType resourceType : ResourceType.values()) {
|
for (ResourceType resourceType : ResourceType.values()) {
|
||||||
resourceLookup.put(resourceType.templateID, resourceType);
|
templateLookup.put(resourceType.templateID, resourceType);
|
||||||
hashLookup.put(resourceType.hash, resourceType);
|
templateHashLookup.put(resourceType.templateHash, resourceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class MobAI {
|
|||||||
public static void attackPlayer(Mob mob, PlayerCharacter target) {
|
public static void attackPlayer(Mob mob, PlayerCharacter target) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(target == null || !target.isAlive() || !target.isActive() ) {
|
if (target == null || !target.isAlive() || !target.isActive()) {
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -175,6 +175,8 @@ public class MobAI {
|
|||||||
public static void attackMob(Mob mob, Mob target) {
|
public static void attackMob(Mob mob, Mob target) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (mob == null || target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (mob.getRange() >= 30 && mob.isMoving())
|
if (mob.getRange() >= 30 && mob.isMoving())
|
||||||
return;
|
return;
|
||||||
@@ -973,36 +975,36 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void hamletGuardAggro(Mob mob) {
|
private static void hamletGuardAggro(Mob mob) {
|
||||||
Realm realm = RealmMap.getRealmAtLocation(mob.loc);
|
Realm realm = RealmMap.getRealmAtLocation(mob.loc);
|
||||||
if(realm.getRealmName().equals("Uthgaard")){
|
if (realm.getRealmName().equals("Uthgaard")) {
|
||||||
HashSet<AbstractWorldObject> loadedMobs = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_MOB);
|
HashSet<AbstractWorldObject> loadedMobs = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_MOB);
|
||||||
for (AbstractWorldObject awo : loadedMobs) {
|
for (AbstractWorldObject awo : loadedMobs) {
|
||||||
Mob targetMob = (Mob) awo;
|
Mob targetMob = (Mob) awo;
|
||||||
if (targetMob.equals(mob))
|
if (targetMob.equals(mob))
|
||||||
continue;
|
continue;
|
||||||
if (!targetMob.isAlive() || targetMob.despawned)
|
if (!targetMob.isAlive() || targetMob.despawned)
|
||||||
continue;
|
continue;
|
||||||
if (targetMob.isPet())
|
if (targetMob.isPet())
|
||||||
continue;
|
continue;
|
||||||
mob.combatTarget = targetMob;
|
mob.combatTarget = targetMob;
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PLAYER);
|
return;
|
||||||
for (AbstractWorldObject awo : loadedPlayers) {
|
}
|
||||||
PlayerCharacter pc = (PlayerCharacter) awo;
|
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PLAYER);
|
||||||
if (!pc.isAlive() || !pc.isActive())
|
for (AbstractWorldObject awo : loadedPlayers) {
|
||||||
continue;
|
PlayerCharacter pc = (PlayerCharacter) awo;
|
||||||
if (pc.guild.equals(Guild.getErrantGuild())) {
|
if (!pc.isAlive() || !pc.isActive())
|
||||||
mob.combatTarget = pc;
|
continue;
|
||||||
return;
|
if (pc.guild.equals(Guild.getErrantGuild())) {
|
||||||
}
|
|
||||||
if (pc.guild.charter.equals(mob.guild.charter))
|
|
||||||
continue;
|
|
||||||
mob.combatTarget = pc;
|
mob.combatTarget = pc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (pc.guild.charter.equals(mob.guild.charter))
|
||||||
|
continue;
|
||||||
|
mob.combatTarget = pc;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void defaultLogic(Mob mob) {
|
private static void defaultLogic(Mob mob) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
|||||||
|
|
||||||
//make sure valid resource
|
//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)
|
if (resource == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
City targetCity = null;
|
City targetCity = null;
|
||||||
|
|
||||||
if (isTeleport)
|
if (isTeleport)
|
||||||
cities = City.getCitiesToTeleportTo(player);
|
cities = City.getCitiesToTeleportTo(player, false);
|
||||||
else
|
else
|
||||||
cities = City.getCitiesToRepledgeTo(player);
|
cities = City.getCitiesToRepledgeTo(player);
|
||||||
for (City city : cities) {
|
for (City city : cities) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class SendOwnPlayerMsg extends ClientNetMsg {
|
|||||||
@Override
|
@Override
|
||||||
protected int getPowerOfTwoBufferSize() {
|
protected int getPowerOfTwoBufferSize() {
|
||||||
//Larger size for historically larger opcodes
|
//Larger size for historically larger opcodes
|
||||||
return (17); // 2^17 == 131,072
|
return (18); // 2^17 == 131,072
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -73,10 +73,8 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
public void configure() {
|
public void configure() {
|
||||||
|
|
||||||
if (isTeleport)
|
cities = City.getCitiesToTeleportTo(player, !isTeleport);
|
||||||
cities = City.getCitiesToTeleportTo(player);
|
|
||||||
else
|
|
||||||
cities = City.getCitiesToRepledgeTo(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class ViewResourcesMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
for (mbEnums.ResourceType resourceType : (warehouseObject.resources.keySet())) {
|
for (mbEnums.ResourceType resourceType : (warehouseObject.resources.keySet())) {
|
||||||
|
|
||||||
writer.putInt(resourceType.hash);
|
writer.putInt(resourceType.templateHash);
|
||||||
writer.putInt((warehouseObject.resources.get(resourceType)));
|
writer.putInt((warehouseObject.resources.get(resourceType)));
|
||||||
|
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public class ViewResourcesMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
for (mbEnums.ResourceType resourceType : warehouseObject.resources.keySet()) {
|
for (mbEnums.ResourceType resourceType : warehouseObject.resources.keySet()) {
|
||||||
|
|
||||||
writer.putInt(resourceType.hash);
|
writer.putInt(resourceType.templateHash);
|
||||||
writer.putInt(0); //available?
|
writer.putInt(0); //available?
|
||||||
writer.putInt(resourceType.deposit_limit); //max?
|
writer.putInt(resourceType.deposit_limit); //max?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import engine.net.client.msg.ApplyRuneMsg;
|
|||||||
import engine.net.client.msg.UpdateStateMsg;
|
import engine.net.client.msg.UpdateStateMsg;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.PowersBase;
|
import engine.powers.PowersBase;
|
||||||
|
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
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));
|
AssignDamageAtrForPlayers(abstractCharacter, equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD));
|
||||||
if (abstractCharacter.getObjectType().equals(GameObjectType.Mob)) {
|
if (abstractCharacter.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
Mob mob = (Mob) abstractCharacter;
|
Mob mob = (Mob) abstractCharacter;
|
||||||
abstractCharacter.minDamageHandOne += (int) mob.mobBase.getDamageMin();
|
abstractCharacter.minDamageHandOne = (int) mob.mobBase.getDamageMin();
|
||||||
abstractCharacter.minDamageHandTwo += (int) mob.mobBase.getDamageMin();
|
abstractCharacter.minDamageHandTwo = (int) mob.mobBase.getDamageMin();
|
||||||
abstractCharacter.maxDamageHandOne += (int) mob.mobBase.getDamageMax();
|
abstractCharacter.maxDamageHandOne = (int) mob.mobBase.getDamageMax();
|
||||||
abstractCharacter.maxDamageHandTwo += (int) mob.mobBase.getDamageMax();
|
abstractCharacter.maxDamageHandTwo = (int) mob.mobBase.getDamageMax();
|
||||||
abstractCharacter.atrHandOne += mob.mobBase.getAttackRating();
|
abstractCharacter.atrHandOne = mob.mobBase.getAttackRating();
|
||||||
abstractCharacter.atrHandTwo += mob.mobBase.getAttackRating();
|
abstractCharacter.atrHandTwo = mob.mobBase.getAttackRating();
|
||||||
abstractCharacter.defenseRating += mob.mobBase.getDefenseRating();
|
abstractCharacter.defenseRating = mob.mobBase.getDefenseRating();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -804,7 +805,25 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
if (weapon != null)
|
if (weapon != null)
|
||||||
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None));
|
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)
|
if (speed < 10)
|
||||||
speed = 10;
|
speed = 10;
|
||||||
@@ -1809,7 +1828,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
//handle hate value addition
|
//handle hate value addition
|
||||||
Mob target = (Mob) this;
|
Mob target = (Mob) this;
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
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.isPlayerGuard()) {
|
||||||
if (target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
|
if (target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
|
||||||
target.guardedCity.cityOutlaws.add(attacker.getObjectUUID());
|
target.guardedCity.cityOutlaws.add(attacker.getObjectUUID());
|
||||||
|
|||||||
@@ -641,18 +641,18 @@ public final class Bane {
|
|||||||
return cityUUID;
|
return cityUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startBane(){
|
public void startBane() {
|
||||||
City city = this.getCity();
|
City city = this.getCity();
|
||||||
if(city == null)
|
if (city == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.isStarted = true; //flag the bane as started
|
this.isStarted = true; //flag the bane as started
|
||||||
|
|
||||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(city.loc,mbEnums.CityBoundsType.ZONE.halfExtents + 64,MBServerStatics.MASK_BUILDING)){
|
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(city.loc, mbEnums.CityBoundsType.ZONE.halfExtents + 64, MBServerStatics.MASK_BUILDING)) {
|
||||||
Building building = (Building)awo;
|
Building building = (Building) awo;
|
||||||
if(building == null)
|
if (building == null)
|
||||||
continue;
|
continue;
|
||||||
if(building.protectionState.equals(ProtectionState.UNDERSIEGE) == false)
|
if (building.protectionState.equals(ProtectionState.UNDERSIEGE) == false)
|
||||||
building.protectionState = ProtectionState.UNDERSIEGE;
|
building.protectionState = ProtectionState.UNDERSIEGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+95
-132
@@ -120,9 +120,7 @@ public class City extends AbstractWorldObject {
|
|||||||
this.treeOfLifeID = rs.getInt("treeOfLifeUUID");
|
this.treeOfLifeID = rs.getInt("treeOfLifeUUID");
|
||||||
this.bindX = rs.getFloat("bindX");
|
this.bindX = rs.getFloat("bindX");
|
||||||
this.bindZ = rs.getFloat("bindZ");
|
this.bindZ = rs.getFloat("bindZ");
|
||||||
this.bindLoc = new Vector3fImmutable(this.location.getX() + this.bindX,
|
this.bindLoc = new Vector3fImmutable(this.location.getX() + this.bindX, this.location.getY(), this.location.getZ() + this.bindZ);
|
||||||
this.location.getY(),
|
|
||||||
this.location.getZ() + this.bindZ);
|
|
||||||
this.radiusType = rs.getInt("radiusType");
|
this.radiusType = rs.getInt("radiusType");
|
||||||
|
|
||||||
float bindradiustemp = rs.getFloat("bindRadius");
|
float bindradiustemp = rs.getFloat("bindRadius");
|
||||||
@@ -288,108 +286,97 @@ public class City extends AbstractWorldObject {
|
|||||||
return city.getBindLoc();
|
return city.getBindLoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<City> getCitiesToTeleportTo(PlayerCharacter pc) {
|
public static ArrayList<City> getCitiesToTeleportTo(PlayerCharacter playerCharacter, boolean repledge) {
|
||||||
|
|
||||||
ArrayList<City> cities = new ArrayList<>();
|
ArrayList<City> cities = new ArrayList<>();
|
||||||
|
|
||||||
if (pc == null)
|
if (playerCharacter == null)
|
||||||
return cities;
|
return cities;
|
||||||
|
|
||||||
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(mbEnums.GameObjectType.City);
|
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(mbEnums.GameObjectType.City);
|
||||||
|
|
||||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
//handle compiling of cities able to be teleported to for lore rule-set
|
||||||
//handle compiling of cities able to be teleported to for lore rule-set
|
|
||||||
for (AbstractGameObject ago : worldCities.values()) {
|
for (AbstractGameObject ago : worldCities.values()) {
|
||||||
City city = (City) ago;
|
|
||||||
if(city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
City city = (City) ago;
|
||||||
continue; // cannot teleport to perdition or bastion
|
|
||||||
if (city.isNpc == 1 && city.getGuild().charter.equals(pc.guild.charter)) {
|
// Filter Player cities
|
||||||
cities.add(city); // anyone of the same charter can teleport to a safehold of that charter
|
|
||||||
|
if (city.parentZone == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (city.parentZone.guild_zone && city.isOpen() && city.getTOL().rank > 4) {
|
||||||
|
|
||||||
|
// Filter Lore cities
|
||||||
|
|
||||||
|
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||||
|
|
||||||
|
if (!repledge)
|
||||||
|
if (!city.getGuild().charter.equals(playerCharacter.guild.charter))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (repledge)
|
||||||
|
if (!city.getGuild().charter.canJoin(playerCharacter))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!city.getTOL().reverseKOS) {
|
||||||
|
cities.add(city);//can teleport to any open ToL that shares charter
|
||||||
continue;
|
continue;
|
||||||
} else if (city.isNoobIsle == 1 && pc.level <= 20) {
|
}
|
||||||
|
|
||||||
|
if (city.getTOL().getCondemned().containsKey(playerCharacter.objectUUID) && city.getTOL().getCondemned().get(playerCharacter.objectUUID).active) {
|
||||||
|
cities.add(city);//this player is allowed for the reverse KOS
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (city.getTOL().getCondemned().containsKey(playerCharacter.guildUUID) && city.getTOL().getCondemned().get(playerCharacter.guildUUID).active) {
|
||||||
|
cities.add(city);//this guild is allowed for the reverse KOS
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (city.getTOL().getCondemned().containsKey(playerCharacter.guild.getNation().getObjectUUID()) && city.getTOL().getCondemned().get(playerCharacter.guild.getNation().getObjectUUID()).active) {
|
||||||
|
cities.add(city);//this nation is allowed for the reverse KOS
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter NPC cities
|
||||||
|
|
||||||
|
if (city.isNoobIsle == 1) {
|
||||||
|
|
||||||
|
if (playerCharacter.level < 20)
|
||||||
cities.add(city); // everyone can go to noob island if they are under level 20
|
cities.add(city); // everyone can go to noob island if they are under level 20
|
||||||
continue;
|
|
||||||
} else if (city.cityName.equals("Khan'Ov Srekel")) {
|
continue;
|
||||||
cities.add(city); //everyone anytime can teleport to khan
|
|
||||||
continue;
|
|
||||||
} else if (city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.equals(pc.guild.charter))
|
|
||||||
if (!city.getTOL().reverseKOS) {
|
|
||||||
cities.add(city);//can teleport to any open ToL that shares charter
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
if (city.getTOL().getCondemned().contains(pc.objectUUID) && city.getTOL().getCondemned().get(pc.objectUUID).active) {
|
|
||||||
cities.add(city);//this player is allowed for the reverse KOS
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (city.getTOL().getCondemned().contains(pc.guildUUID) && city.getTOL().getCondemned().get(pc.guildUUID).active) {
|
|
||||||
cities.add(city);//this guild is allowed for the reverse KOS
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (city.getTOL().getCondemned().contains(pc.guild.getNation().getObjectUUID()) && city.getTOL().getCondemned().get(pc.guild.getNation().getObjectUUID()).active) {
|
|
||||||
cities.add(city);//this nation is allowed for the reverse KOS
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (city.getGuild().getNation().equals(pc.guild.getNation())) {
|
|
||||||
cities.add(city);//can always teleport inside your own nation
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
|
||||||
Guild pcG = pc.getGuild();
|
// Players cannot teleport to perdition or bastion
|
||||||
//add npc cities
|
|
||||||
|
|
||||||
for (AbstractGameObject ago : worldCities.values()) {
|
if (city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (ago.getObjectType().equals(GameObjectType.City)) {
|
// These cities are available for anyone off noob island
|
||||||
City city = (City) ago;
|
|
||||||
|
|
||||||
if (city.noTeleport)
|
if (playerCharacter.level >= 20 && (city.cityName.equals("Sea Dog's Rest") || city.cityName.equals("Khan'Ov Srekel") || city.cityName.equals("City of Khar Th'Sekt"))) {
|
||||||
continue;
|
cities.add(city);
|
||||||
|
continue;
|
||||||
if (city.parentZone != null && city.parentZone.guild_zone) {
|
|
||||||
|
|
||||||
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
|
|
||||||
cities.add(city);
|
|
||||||
} else
|
|
||||||
//list Player cities
|
|
||||||
|
|
||||||
//open city, just list
|
|
||||||
|
|
||||||
if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
|
|
||||||
|
|
||||||
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
|
|
||||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
|
||||||
if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) {
|
|
||||||
cities.add(city);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cities.add(city); //verify nation or guild is same
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG))
|
|
||||||
cities.add(city);
|
|
||||||
|
|
||||||
|
|
||||||
} else if (city.isNpc == 1) {
|
|
||||||
|
|
||||||
//list NPC cities
|
|
||||||
|
|
||||||
Guild g = city.getGuild();
|
|
||||||
if (g == null) {
|
|
||||||
if (city.isNpc == 1)
|
|
||||||
if (city.isNoobIsle == 1) {
|
|
||||||
if (pc.getLevel() < 21)
|
|
||||||
cities.add(city); //verify nation or guild is same
|
|
||||||
} else if (pc.getLevel() > 9)
|
|
||||||
cities.add(city); //verify nation or guild is same
|
|
||||||
|
|
||||||
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax())
|
|
||||||
cities.add(city); //verify nation or guild is same
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add Lore cities
|
||||||
|
|
||||||
|
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||||
|
|
||||||
|
if (repledge) {
|
||||||
|
if (city.getGuild().charter.canJoin(playerCharacter))
|
||||||
|
cities.add(city);
|
||||||
|
} else if (city.getGuild().charter.equals(playerCharacter.guild.charter))
|
||||||
|
cities.add(city);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cities;
|
return cities;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,7 +394,7 @@ public class City extends AbstractWorldObject {
|
|||||||
//handle compiling of cities able to be repledged to for lore rule-set
|
//handle compiling of cities able to be repledged to for lore rule-set
|
||||||
for (AbstractGameObject ago : worldCities.values()) {
|
for (AbstractGameObject ago : worldCities.values()) {
|
||||||
City city = (City) ago;
|
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
|
continue; // cannot repledge to perdition or bastion
|
||||||
if (city.isNpc == 1 && city.getGuild().charter.canJoin(playerCharacter)) {
|
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
|
cities.add(city); // anyone of the same charter can teleport to a safehold of that charter
|
||||||
@@ -586,7 +573,7 @@ public class City extends AbstractWorldObject {
|
|||||||
if (this.siegesWithstood == siegesWithstood)
|
if (this.siegesWithstood == siegesWithstood)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (DbManager.CityQueries.updateSiegesWithstood(this, siegesWithstood) == true)
|
if (DbManager.CityQueries.updateSiegesWithstood(this, siegesWithstood))
|
||||||
this.siegesWithstood = siegesWithstood;
|
this.siegesWithstood = siegesWithstood;
|
||||||
else
|
else
|
||||||
Logger.error("Error when writing to database for cityUUID: " + this.getObjectUUID());
|
Logger.error("Error when writing to database for cityUUID: " + this.getObjectUUID());
|
||||||
@@ -640,19 +627,12 @@ public class City extends AbstractWorldObject {
|
|||||||
public Guild getGuild() {
|
public Guild getGuild() {
|
||||||
|
|
||||||
if (this.getTOL() == null)
|
if (this.getTOL() == null)
|
||||||
return null;
|
return Guild.getErrantGuild();
|
||||||
|
|
||||||
if (this.isNpc == 1) {
|
if (this.getTOL().getOwner() == null)
|
||||||
|
return Guild.getErrantGuild();
|
||||||
|
|
||||||
if (this.getTOL().getOwner() == null)
|
return this.getTOL().getOwner().getGuild();
|
||||||
return null;
|
|
||||||
return this.getTOL().getOwner().getGuild();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (this.getTOL().getOwner() == null)
|
|
||||||
return null;
|
|
||||||
return this.getTOL().getOwner().getGuild();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean openCity(boolean open) {
|
public boolean openCity(boolean open) {
|
||||||
@@ -731,7 +711,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
for (AbstractCharacter npc : getTOL().getHirelings().keySet()) {
|
for (AbstractCharacter npc : getTOL().getHirelings().keySet()) {
|
||||||
if (npc.getObjectType() == GameObjectType.NPC)
|
if (npc.getObjectType() == GameObjectType.NPC)
|
||||||
if (((NPC) npc).getContract().isRuneMaster() == true)
|
if (((NPC) npc).getContract().isRuneMaster())
|
||||||
outNPC = (NPC) npc;
|
outNPC = (NPC) npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,16 +744,13 @@ public class City extends AbstractWorldObject {
|
|||||||
// Set location for this city
|
// Set location for this city
|
||||||
|
|
||||||
this.location = new Vector3fImmutable(this.parentZone.absX, this.parentZone.absY, this.parentZone.absZ);
|
this.location = new Vector3fImmutable(this.parentZone.absX, this.parentZone.absY, this.parentZone.absZ);
|
||||||
this.bindLoc = new Vector3fImmutable(this.location.x + this.bindX,
|
this.bindLoc = new Vector3fImmutable(this.location.x + this.bindX, this.location.y, this.location.z + this.bindZ);
|
||||||
this.location.y,
|
|
||||||
this.location.z + this.bindZ);
|
|
||||||
|
|
||||||
// set city bounds
|
// set city bounds
|
||||||
|
|
||||||
Bounds cityBounds = Bounds.borrow();
|
Bounds cityBounds = Bounds.borrow();
|
||||||
cityBounds.setBounds(new Vector2f(this.location.x + 64, this.location.z + 64), // location x and z are offset by 64 from the center of the city.
|
cityBounds.setBounds(new Vector2f(this.location.x + 64, this.location.z + 64), // location x and z are offset by 64 from the center of the city.
|
||||||
new Vector2f(mbEnums.CityBoundsType.GRID.halfExtents, mbEnums.CityBoundsType.GRID.halfExtents),
|
new Vector2f(mbEnums.CityBoundsType.GRID.halfExtents, mbEnums.CityBoundsType.GRID.halfExtents), 0.0f);
|
||||||
0.0f);
|
|
||||||
this.setBounds(cityBounds);
|
this.setBounds(cityBounds);
|
||||||
|
|
||||||
// Sanity check; no tol
|
// Sanity check; no tol
|
||||||
@@ -781,8 +758,7 @@ public class City extends AbstractWorldObject {
|
|||||||
if (BuildingManager.getBuilding(this.treeOfLifeID) == null)
|
if (BuildingManager.getBuilding(this.treeOfLifeID) == null)
|
||||||
Logger.info("City UID " + this.getObjectUUID() + " Failed to Load Tree of Life with ID " + this.treeOfLifeID);
|
Logger.info("City UID " + this.getObjectUUID() + " Failed to Load Tree of Life with ID " + this.treeOfLifeID);
|
||||||
|
|
||||||
if ((ConfigManager.serverType.equals(ServerType.WORLDSERVER))
|
if ((ConfigManager.serverType.equals(ServerType.WORLDSERVER)) && (this.isNpc == (byte) 0)) {
|
||||||
&& (this.isNpc == (byte) 0)) {
|
|
||||||
|
|
||||||
this.realm = RealmMap.getRealmAtLocation(this.getLoc());
|
this.realm = RealmMap.getRealmAtLocation(this.getLoc());
|
||||||
|
|
||||||
@@ -802,8 +778,7 @@ public class City extends AbstractWorldObject {
|
|||||||
if (this.getGuild().getGuildState() == GuildState.Nation)
|
if (this.getGuild().getGuildState() == GuildState.Nation)
|
||||||
for (Guild sub : this.getGuild().getSubGuildList()) {
|
for (Guild sub : this.getGuild().getSubGuildList()) {
|
||||||
|
|
||||||
if ((sub.getGuildState() == GuildState.Protectorate) ||
|
if ((sub.getGuildState() == GuildState.Protectorate) || (sub.getGuildState() == GuildState.Province)) {
|
||||||
(sub.getGuildState() == GuildState.Province)) {
|
|
||||||
this.isCapital = 1;
|
this.isCapital = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -828,7 +803,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
this.setHash();
|
this.setHash();
|
||||||
|
|
||||||
if (DataWarehouse.recordExists(mbEnums.DataRecordType.CITY, this.getObjectUUID()) == false) {
|
if (!DataWarehouse.recordExists(DataRecordType.CITY, this.getObjectUUID())) {
|
||||||
CityRecord cityRecord = CityRecord.borrow(this, mbEnums.RecordEventType.CREATE);
|
CityRecord cityRecord = CityRecord.borrow(this, mbEnums.RecordEventType.CREATE);
|
||||||
DataWarehouse.pushToWarehouse(cityRecord);
|
DataWarehouse.pushToWarehouse(cityRecord);
|
||||||
}
|
}
|
||||||
@@ -853,9 +828,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
for (Building building : this.parentZone.zoneBuildingSet) {
|
for (Building building : this.parentZone.zoneBuildingSet) {
|
||||||
|
|
||||||
if (building.getBlueprint() != null &&
|
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE && building.getBlueprint().getBuildingGroup() != BuildingGroup.TOL) {
|
||||||
building.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE &&
|
|
||||||
building.getBlueprint().getBuildingGroup() != BuildingGroup.TOL) {
|
|
||||||
|
|
||||||
building.healthMax += (building.healthMax * Realm.getRealmHealthMod(this));
|
building.healthMax += (building.healthMax * Realm.getRealmHealthMod(this));
|
||||||
|
|
||||||
@@ -937,7 +910,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
// Reapply effect with timeout?
|
// Reapply effect with timeout?
|
||||||
|
|
||||||
if (refreshEffect == true)
|
if (refreshEffect)
|
||||||
player.addCityEffect(Integer.toString(effectBase.getUUID()), effectBase, rank, MBServerStatics.FOURTYFIVE_SECONDS, false, this);
|
player.addCityEffect(Integer.toString(effectBase.getUUID()), effectBase, rank, MBServerStatics.FOURTYFIVE_SECONDS, false, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1193,18 +1166,13 @@ public class City extends AbstractWorldObject {
|
|||||||
// All protection contracts are void upon transfer of a city
|
// All protection contracts are void upon transfer of a city
|
||||||
//Dont forget to not Flip protection on Banestones and siege Equipment... Noob.
|
//Dont forget to not Flip protection on Banestones and siege Equipment... Noob.
|
||||||
|
|
||||||
if (cityBuilding.getBlueprint() != null && !cityBuilding.getBlueprint().isSiegeEquip()
|
if (cityBuilding.getBlueprint() != null && !cityBuilding.getBlueprint().isSiegeEquip() && cityBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE)
|
||||||
&& cityBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE)
|
|
||||||
cityBuilding.setProtectionState(ProtectionState.NONE);
|
cityBuilding.setProtectionState(ProtectionState.NONE);
|
||||||
|
|
||||||
// Transfer ownership of valid city assets
|
// Transfer ownership of valid city assets
|
||||||
// these assets are autoprotected.
|
// these assets are autoprotected.
|
||||||
|
|
||||||
if ((cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)
|
if ((cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.TOL) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK) || (cityBuilding.getBlueprint().isWallPiece()) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) {
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE)
|
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
|
||||||
|| (cityBuilding.getBlueprint().isWallPiece())
|
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) {
|
|
||||||
|
|
||||||
cityBuilding.claim(sourcePlayer);
|
cityBuilding.claim(sourcePlayer);
|
||||||
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
||||||
@@ -1245,12 +1213,7 @@ public class City extends AbstractWorldObject {
|
|||||||
// Transfer ownership of valid city assets
|
// Transfer ownership of valid city assets
|
||||||
// these assets are autoprotected.
|
// these assets are autoprotected.
|
||||||
|
|
||||||
if ((cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)
|
if ((cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.TOL) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK) || (cityBuilding.getBlueprint().isWallPiece()) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) {
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE)
|
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
|
||||||
|| (cityBuilding.getBlueprint().isWallPiece())
|
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)
|
|
||||||
) {
|
|
||||||
|
|
||||||
cityBuilding.claim(sourcePlayer);
|
cityBuilding.claim(sourcePlayer);
|
||||||
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
||||||
@@ -1399,7 +1362,7 @@ public class City extends AbstractWorldObject {
|
|||||||
taxPercent = .20f;
|
taxPercent = .20f;
|
||||||
|
|
||||||
for (int resourceHash : msg.getResources().keySet())
|
for (int resourceHash : msg.getResources().keySet())
|
||||||
resources.add(ResourceType.hashLookup.get(resourceHash));
|
resources.add(ResourceType.templateHashLookup.get(resourceHash));
|
||||||
|
|
||||||
for (ResourceType resourceType : resources) {
|
for (ResourceType resourceType : resources) {
|
||||||
if (Warehouse.isAboveCap(ruledWarehouse, resourceType, (int) (city.warehouse.resources.get(resourceType) * taxPercent))) {
|
if (Warehouse.isAboveCap(ruledWarehouse, resourceType, (int) (city.warehouse.resources.get(resourceType) * taxPercent))) {
|
||||||
|
|||||||
@@ -193,12 +193,16 @@ public class Guild extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean sameNationExcludeErrant(Guild a, Guild b) {
|
public static boolean sameNationExcludeErrant(Guild a, Guild b) {
|
||||||
|
|
||||||
if (a == null || b == null)
|
if (a == null || b == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (a.getObjectUUID() == b.getObjectUUID())
|
if (a.getObjectUUID() == b.getObjectUUID())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (a.nation == null || b.nation == null)
|
if (a.nation == null || b.nation == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return a.nation.getObjectUUID() == b.nation.getObjectUUID() && !a.nation.isEmptyGuild();
|
return a.nation.getObjectUUID() == b.nation.getObjectUUID() && !a.nation.isEmptyGuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class Mine extends AbstractGameObject {
|
|||||||
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
|
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
|
||||||
writer.putString(mine.mineType.name);
|
writer.putString(mine.mineType.name);
|
||||||
writer.putString(mine.zoneName);
|
writer.putString(mine.zoneName);
|
||||||
writer.putInt(mine.production.hash);
|
writer.putInt(mine.production.resourceHash);
|
||||||
writer.putInt(mine.production.mine_production);
|
writer.putInt(mine.production.mine_production);
|
||||||
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
|
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||||
writer.putInt(3600); //window in seconds
|
writer.putInt(3600); //window in seconds
|
||||||
@@ -393,7 +393,7 @@ public class Mine extends AbstractGameObject {
|
|||||||
// writer.putInt(0x215C92BB); //this.unknown1);
|
// writer.putInt(0x215C92BB); //this.unknown1);
|
||||||
writer.putString(this.mineType.name);
|
writer.putString(this.mineType.name);
|
||||||
writer.putString(this.zoneName);
|
writer.putString(this.zoneName);
|
||||||
writer.putInt(this.production.hash);
|
writer.putInt(this.production.resourceHash);
|
||||||
writer.putInt(this.production.mine_production);
|
writer.putInt(this.production.mine_production);
|
||||||
writer.putInt(this.getModifiedProductionAmount()); //TODO calculate range penalty here
|
writer.putInt(this.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||||
writer.putInt(3600); //window in seconds
|
writer.putInt(3600); //window in seconds
|
||||||
@@ -482,7 +482,7 @@ public class Mine extends AbstractGameObject {
|
|||||||
if (this.owningGuild.getOwnedCity().warehouse == null)
|
if (this.owningGuild.getOwnedCity().warehouse == null)
|
||||||
return false;
|
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) {
|
public boolean updateGuildOwner(PlayerCharacter playerCharacter) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
public class PlayerBonuses {
|
public class PlayerBonuses {
|
||||||
|
|
||||||
//First bonus set
|
//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, DamageShield> bonusDamageShields = new ConcurrentHashMap<>();
|
||||||
private ConcurrentHashMap<AbstractEffectModifier, String> bonusStrings = new ConcurrentHashMap<>();
|
private ConcurrentHashMap<AbstractEffectModifier, String> bonusStrings = new ConcurrentHashMap<>();
|
||||||
private ConcurrentHashMap<ModType, HashSet<SourceType>> bonusLists = new ConcurrentHashMap<>();
|
private ConcurrentHashMap<ModType, HashSet<SourceType>> bonusLists = new ConcurrentHashMap<>();
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class Warehouse {
|
|||||||
if (warehouse == null)
|
if (warehouse == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.hashLookup.get(msg.getHashID());
|
mbEnums.ResourceType resourceType = mbEnums.ResourceType.templateHashLookup.get(msg.getHashID());
|
||||||
|
|
||||||
if (isResourceLocked(warehouse, resourceType)) {
|
if (isResourceLocked(warehouse, resourceType)) {
|
||||||
ChatManager.chatSystemInfo(playerCharacter, "You cannot withdrawl a locked resource.");
|
ChatManager.chatSystemInfo(playerCharacter, "You cannot withdrawl a locked resource.");
|
||||||
@@ -182,7 +182,7 @@ public class Warehouse {
|
|||||||
|
|
||||||
warehouse = city.warehouse;
|
warehouse = city.warehouse;
|
||||||
|
|
||||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.hashLookup.get(hashID);
|
mbEnums.ResourceType resourceType = mbEnums.ResourceType.templateHashLookup.get(hashID);
|
||||||
|
|
||||||
// toggle lock
|
// toggle lock
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ public class Warehouse {
|
|||||||
return false;
|
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)
|
if (warehouse.resources.get(resourceType) == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -261,7 +261,7 @@ public class Warehouse {
|
|||||||
|
|
||||||
int newAmount = oldAmount + amount;
|
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;
|
return false;
|
||||||
|
|
||||||
if (removeFromInventory) {
|
if (removeFromInventory) {
|
||||||
@@ -381,7 +381,7 @@ public class Warehouse {
|
|||||||
int amount = (int) (warehouse.resources.get(resourceType) * taxPercent);
|
int amount = (int) (warehouse.resources.get(resourceType) * taxPercent);
|
||||||
|
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
msg.getResources().put(resourceType.hash, 0);
|
msg.getResources().put(resourceType.resourceHash, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,20 +395,18 @@ public class Warehouse {
|
|||||||
if (newAmount < amount)
|
if (newAmount < amount)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
msg.getResources().put(resourceType.hash, amount);
|
msg.getResources().put(resourceType.resourceHash, amount);
|
||||||
|
|
||||||
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
|
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
|
||||||
msg.getResources().put(resourceType.hash, 0);
|
msg.getResources().put(resourceType.resourceHash, 0);
|
||||||
warehouse.resources.put(resourceType, oldAmount);
|
warehouse.resources.put(resourceType, oldAmount);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
warehouse.resources.put(resourceType, newAmount);
|
warehouse.resources.put(resourceType, newAmount);
|
||||||
depositRealmTaxes(taxer, resourceType, amount, warehouse);
|
depositRealmTaxes(taxer, resourceType, amount, warehouse);
|
||||||
mbEnums.ResourceType resource;
|
|
||||||
|
|
||||||
AddTransactionToWarehouse(warehouse, taxer.getObjectType(), taxer.getObjectUUID(), mbEnums.TransactionType.TAXRESOURCE, resourceType, amount);
|
AddTransactionToWarehouse(warehouse, taxer.getObjectType(), taxer.getObjectUUID(), mbEnums.TransactionType.TAXRESOURCE, resourceType, amount);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,7 +429,7 @@ public class Warehouse {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (addToInventory)
|
if (addToInventory)
|
||||||
if (!itemMan.hasRoomInventory(template.item_wt * amount)) {
|
if (!itemMan.hasRoomInventory(template.item_wt)) {
|
||||||
ChatManager.chatSystemInfo(playerCharacter, "You can not carry any more of that item.");
|
ChatManager.chatSystemInfo(playerCharacter, "You can not carry any more of that item.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -633,4 +633,8 @@ public class PowersBase {
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean enforceLore(){
|
||||||
|
return this.powerCategory.equals(PowerCategoryType.SUMMON) || this.powerCategory.equals(PowerCategoryType.HEAL)|| this.powerCategory.equals(PowerCategoryType.BUFF);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package engine.powers.poweractions;
|
|||||||
|
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mbEnums;
|
import engine.mbEnums;
|
||||||
import engine.mbEnums.BuildingGroup;
|
|
||||||
import engine.mbEnums.GameObjectType;
|
import engine.mbEnums.GameObjectType;
|
||||||
import engine.mbEnums.PortalType;
|
import engine.mbEnums.PortalType;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
@@ -54,15 +53,17 @@ public class OpenGatePowerAction extends AbstractPowerAction {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Make sure target building is a runegate
|
// Make sure target building is a runegate
|
||||||
if(targetBuilding.meshUUID != 24500) // runegate
|
|
||||||
|
if (targetBuilding.meshUUID != 24500) // runegate
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Which runegate was clicked on?
|
// Which runegate was clicked on?
|
||||||
|
|
||||||
Runegate runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
|
Runegate runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
|
||||||
|
|
||||||
if(runeGate == null){
|
if (runeGate == null)
|
||||||
return; // mob camp prop runegate cannot be opened
|
return; // mob camp prop runegate cannot be opened
|
||||||
}
|
|
||||||
// Which portal was opened?
|
// Which portal was opened?
|
||||||
|
|
||||||
token = pb.getToken();
|
token = pb.getToken();
|
||||||
@@ -72,41 +73,31 @@ public class OpenGatePowerAction extends AbstractPowerAction {
|
|||||||
case 428937084: //Death Gate
|
case 428937084: //Death Gate
|
||||||
portalType = PortalType.OBLIV;
|
portalType = PortalType.OBLIV;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 429756284: //Chaos Gate
|
case 429756284: //Chaos Gate
|
||||||
portalType = PortalType.CHAOS;
|
portalType = PortalType.CHAOS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 429723516: //Khar Gate
|
case 429723516: //Khar Gate
|
||||||
portalType = PortalType.MERCHANT;
|
portalType = PortalType.MERCHANT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 429559676: //Spirit Gate
|
case 429559676: //Spirit Gate
|
||||||
portalType = PortalType.SPIRIT;
|
portalType = PortalType.SPIRIT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 429592444: //Water Gate
|
case 429592444: //Water Gate
|
||||||
portalType = PortalType.WATER;
|
portalType = PortalType.WATER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 429428604: //Fire Gate
|
case 429428604: //Fire Gate
|
||||||
portalType = PortalType.FIRE;
|
portalType = PortalType.FIRE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 429526908: //Air Gate
|
case 429526908: //Air Gate
|
||||||
portalType = PortalType.AIR;
|
portalType = PortalType.AIR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 429625212: //Earth Gate
|
case 429625212: //Earth Gate
|
||||||
portalType = PortalType.EARTH;
|
portalType = PortalType.EARTH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
runeGate.activatePortal(portalType);
|
runeGate.activatePortal(portalType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -125,6 +125,13 @@ public class DestroyCityThread implements Runnable {
|
|||||||
|
|
||||||
cityBuilding.setProtectionState(mbEnums.ProtectionState.NONE);
|
cityBuilding.setProtectionState(mbEnums.ProtectionState.NONE);
|
||||||
|
|
||||||
|
// Remove warehouse entry if one exists.
|
||||||
|
|
||||||
|
if (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.WAREHOUSE) {
|
||||||
|
DbManager.WarehouseQueries.DELETE_WAREHOUSE(city.warehouse);
|
||||||
|
city.warehouse = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Destroy all remaining city assets
|
// Destroy all remaining city assets
|
||||||
|
|
||||||
if ((cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.BARRACK)
|
if ((cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.BARRACK)
|
||||||
|
|||||||
@@ -289,10 +289,10 @@ public class HourlyJobThread implements Runnable {
|
|||||||
Logger.info(PurgeOprhans.recordsDeleted.toString() + "orphaned items deleted");
|
Logger.info(PurgeOprhans.recordsDeleted.toString() + "orphaned items deleted");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processBanes(){
|
public static void processBanes() {
|
||||||
//handle banes
|
//handle banes
|
||||||
for(Bane bane : Bane.banes.values()){
|
for (Bane bane : Bane.banes.values()) {
|
||||||
if(bane.getLiveDate() != null && DateTime.now().isAfter(bane.getLiveDate().minusMinutes(1)) && bane.isStarted == false)
|
if (bane.getLiveDate() != null && DateTime.now().isAfter(bane.getLiveDate().minusMinutes(1)) && bane.isStarted == false)
|
||||||
bane.startBane();
|
bane.startBane();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user