Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c0cd365c1d | |||
| ee5620036d | |||
| 8ff06b1200 | |||
| a348056c86 | |||
| 1c10f8a872 | |||
| 4f28fefbc2 | |||
| 9ff7e07545 | |||
| d5809fc4b1 | |||
| 0c00832264 | |||
| 300452d2d8 | |||
| 9a9ea99bc7 | |||
| d9ab1032f4 | |||
| c2ea4424cf | |||
| b22c07b000 | |||
| 8e70e0597e | |||
| cf58e7b984 | |||
| ba81a24622 | |||
| 007299eae5 | |||
| 5f92345d3e |
@@ -58,9 +58,6 @@ public abstract class dbHandlerBase {
|
|||||||
|
|
||||||
int id = rs.getInt(1);
|
int id = rs.getInt(1);
|
||||||
|
|
||||||
if (id == 39052)
|
|
||||||
Logger.info(id);
|
|
||||||
|
|
||||||
if (DbManager.inCache(localObjectType, id)) {
|
if (DbManager.inCache(localObjectType, id)) {
|
||||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -136,12 +136,6 @@ 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;
|
||||||
|
|
||||||
@@ -198,7 +192,6 @@ 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`;");
|
||||||
@@ -216,14 +209,7 @@ 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);
|
||||||
|
|||||||
@@ -104,67 +104,67 @@ public enum BuildingManager {
|
|||||||
if (building == null)
|
if (building == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//cannot access destroyed buildings
|
|
||||||
if (building.getRank() == -1)
|
if (building.getRank() == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//admin characters can always access buildings
|
|
||||||
if (player.isCSR())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
//owner can always access their own building
|
|
||||||
if (IsOwner(building, player))
|
if (IsOwner(building, player))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//check for default IC access if building belongs to same guild
|
//individual friend.
|
||||||
if(player.guild.equals(building.getGuild())) {
|
|
||||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null) {
|
|
||||||
switch (building.getBlueprint().getBuildingGroup()) {
|
|
||||||
case TOL:
|
|
||||||
case BARRACK:
|
|
||||||
case SPIRE:
|
|
||||||
case SHRINE:
|
|
||||||
case BANESTONE:
|
|
||||||
case MINE:
|
|
||||||
case WAREHOUSE:
|
|
||||||
case BULWARK:
|
|
||||||
case SIEGETENT:
|
|
||||||
if (GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
|
||||||
return true;
|
|
||||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//check against friends list entries if any present
|
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null)
|
||||||
if (building.getFriends() != null) {
|
|
||||||
|
|
||||||
//check individuals
|
|
||||||
if (building.getFriends().get(player.getObjectUUID()) != null)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (building.getFriends().get(player.guild.objectUUID) != null) {
|
//Admins can access stuff
|
||||||
|
|
||||||
//check friend type for guild related access
|
if (player.isCSR())
|
||||||
switch (building.getFriends().get(player.guild.objectUUID).friendType) {
|
|
||||||
case 8: //full member
|
|
||||||
if (GuildStatusController.isFullMember(player.getGuildStatus()))
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
|
||||||
case 9: //Inner Council
|
|
||||||
if (GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
|
||||||
return true;
|
|
||||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
//Guild stuff
|
||||||
|
|
||||||
|
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus());
|
||||||
|
|
||||||
|
//TODO test friends list once added
|
||||||
|
//does not meet above criteria. Cannot access.
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
public static boolean playerCanManageNotFriends(PlayerCharacter player, Building building) {
|
||||||
//did not meet access grant criteria, deny access
|
|
||||||
|
//Player Can only Control Building if player is in Same Guild as Building and is higher rank than IC.
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (building == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (building.getRank() == -1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (IsOwner(building, player))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
//Somehow guild leader check fails? lets check if Player is true Guild GL.
|
||||||
|
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (!GuildStatusController.isGuildLeader(player.getGuildStatus()) && !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized boolean lootBuilding(PlayerCharacter player, Building building) {
|
public static synchronized boolean lootBuilding(PlayerCharacter player, Building building) {
|
||||||
@@ -463,19 +463,29 @@ 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;
|
||||||
|
|
||||||
if(building.enforceKOS) {
|
|
||||||
if (building.getCity() != null) {
|
|
||||||
Building TOL = building.getCity().getTOL();
|
|
||||||
if (TOL != null) {
|
|
||||||
building = TOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!building.reverseKOS) {
|
if (!building.reverseKOS) {
|
||||||
|
|
||||||
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import engine.net.client.msg.UpdateStateMsg;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.DamageShield;
|
import engine.powers.DamageShield;
|
||||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||||
import engine.powers.effectmodifiers.WeaponProcEffectModifier;
|
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ public enum CombatManager {
|
|||||||
public static final int COMBAT_PARRY_ANIMATION = 299;
|
public static final int COMBAT_PARRY_ANIMATION = 299;
|
||||||
public static final int COMBAT_DODGE_ANIMATION = 300;
|
public static final int COMBAT_DODGE_ANIMATION = 300;
|
||||||
|
|
||||||
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target) {
|
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target, long addedDelay) {
|
||||||
|
|
||||||
//early exit checks
|
//early exit checks
|
||||||
|
|
||||||
@@ -79,61 +78,58 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (mainWeapon == null && offWeapon == null) {
|
if (mainWeapon == null && offWeapon == null) {
|
||||||
//no weapons equipped, punch with both fists
|
//no weapons equipped, punch with both fists
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD,addedDelay);
|
||||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon != null && offWeapon == null) {
|
if (mainWeapon != null && offWeapon == null) {
|
||||||
//swing right hand only
|
//swing right hand only
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//swing left hand only
|
//swing left hand only
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//no weapon equipped with a shield, punch with one hand
|
//no weapon equipped with a shield, punch with one hand
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//one weapon equipped with a shield, swing with one hand
|
//one weapon equipped with a shield, swing with one hand
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//two weapons equipped, swing both hands
|
//two weapons equipped, swing both hands
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD,addedDelay);
|
||||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD,addedDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processAttack(AbstractCharacter attacker, AbstractWorldObject target, mbEnums.EquipSlotType slot) {
|
public static void processAttack(AbstractCharacter attacker, AbstractWorldObject target, mbEnums.EquipSlotType slot, long addedDelay) {
|
||||||
|
|
||||||
|
if (slot == null || target == null || attacker == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||||
if (!attacker.isCombat())
|
if (!attacker.isCombat())
|
||||||
return;
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target.combatLock.writeLock().lock();
|
||||||
|
|
||||||
// check if character is in range to attack target
|
// check if character is in range to attack target
|
||||||
|
try {
|
||||||
PlayerBonuses bonus = attacker.getBonuses();
|
PlayerBonuses bonus = attacker.getBonuses();
|
||||||
|
|
||||||
float rangeMod = 1.0f;
|
float rangeMod = 1.0f;
|
||||||
@@ -158,10 +154,13 @@ public enum CombatManager {
|
|||||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||||
attackRange += ((AbstractCharacter) target).calcHitBox();
|
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||||
} else {
|
} else {
|
||||||
|
//need to handle building attacks range calculations here
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attackRange > 15 && attacker.isMoving()) {
|
attackRange += 4; // need to add 4 to the attack range to offset where the client stops short of legitimate range
|
||||||
|
|
||||||
|
float distance = target.loc.distance(attacker.loc);
|
||||||
|
if (attackRange > 25 && attacker.isMoving()) {
|
||||||
//cannot shoot bow while moving;
|
//cannot shoot bow while moving;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -169,12 +168,12 @@ 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:
|
||||||
@@ -200,43 +199,41 @@ public enum CombatManager {
|
|||||||
//get delay for the auto attack job
|
//get delay for the auto attack job
|
||||||
long delay = 5000;
|
long delay = 5000;
|
||||||
|
|
||||||
if (weapon != null) {
|
//if (weapon != null) {
|
||||||
|
|
||||||
float wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
// int 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));
|
||||||
|
|
||||||
if (attacker.getBonuses() != null && attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None) != 0f) //add effects speed bonus
|
// if (attacker.getBonuses() != null && attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None) != 0f) //add effects speed bonus
|
||||||
wepSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None));
|
// wepSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None));
|
||||||
|
|
||||||
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 = (long)wepSpeed * 100L;
|
// delay = wepSpeed * 100L;
|
||||||
|
//}
|
||||||
|
|
||||||
|
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)){
|
||||||
|
if(slot.equals(mbEnums.EquipSlotType.RHELD)){
|
||||||
|
delay = (long)(attacker.speedHandOne * 100L);
|
||||||
|
}else{
|
||||||
|
delay = (long)(attacker.speedHandTwo * 100L);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||||
((Mob) attacker).nextAttackTime = System.currentTimeMillis() + delay;
|
((Mob) attacker).nextAttackTime = System.currentTimeMillis() + delay;
|
||||||
|
delay += addedDelay;
|
||||||
if (inRange) {
|
if (inRange) {
|
||||||
|
|
||||||
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)){
|
|
||||||
if(!attacker.getTimestamps().contains(slot.name()+"Attack")){
|
|
||||||
attacker.getTimestamps().put(slot.name()+"Attack", System.currentTimeMillis() - 1000);
|
|
||||||
} else if(System.currentTimeMillis() < attacker.getTimestamps().get(slot.name()+"Attack") + delay){
|
|
||||||
setAutoAttackJob(attacker,slot,delay);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//handle retaliate
|
//handle retaliate
|
||||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||||
if (((AbstractCharacter) target).combatTarget == null || !((AbstractCharacter) target).combatTarget.isAlive()) {
|
if (((AbstractCharacter) target).combatTarget == null || !((AbstractCharacter) target).combatTarget.isAlive()) {
|
||||||
((AbstractCharacter) target).combatTarget = attacker;
|
((AbstractCharacter) target).combatTarget = attacker;
|
||||||
if (target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && ((AbstractCharacter) target).isCombat())
|
if (target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && ((AbstractCharacter) target).isCombat())
|
||||||
combatCycle((AbstractCharacter) target, attacker);
|
combatCycle((AbstractCharacter) target, attacker,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,9 +364,6 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check for proccing
|
|
||||||
checkForProc(attacker,target,weapon);
|
|
||||||
|
|
||||||
//calculate the base damage
|
//calculate the base damage
|
||||||
int damage = ThreadLocalRandom.current().nextInt(min, max + 1);
|
int damage = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||||
if (damage == 0) {
|
if (damage == 0) {
|
||||||
@@ -453,7 +447,9 @@ public enum CombatManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//calculate resisted damage including fortitude
|
//calculate resisted damage including fortitude
|
||||||
|
if(attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||||
|
if(((Mob)attacker).isPet())
|
||||||
|
damage *= attacker.level * 0.1f;
|
||||||
damage = (int) resists.getResistedDamage(attacker, (AbstractCharacter) target, damageType, damage, 0);
|
damage = (int) resists.getResistedDamage(attacker, (AbstractCharacter) target, damageType, damage, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -462,12 +458,11 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
|
|
||||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||||
((AbstractCharacter) target).modifyHealth(-damage, attacker, true);
|
((AbstractCharacter) target).modifyHealth(-damage, attacker, true);
|
||||||
((AbstractCharacter) target).cancelOnTakeDamage();
|
else
|
||||||
}else {
|
|
||||||
((Building) target).modifyHealth(-damage, attacker);
|
((Building) target).modifyHealth(-damage, attacker);
|
||||||
}
|
|
||||||
int attackAnim = getSwingAnimation(null, null, slot);
|
int attackAnim = getSwingAnimation(null, null, slot);
|
||||||
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
||||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||||
@@ -484,7 +479,12 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//set auto attack job
|
//set auto attack job
|
||||||
setAutoAttackJob(attacker, slot, delay);
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
cancelAutoAttackJob(attacker,slot);
|
||||||
|
//Logger.error("COMBAT CAUGHT ERROR: " + ex.getMessage());
|
||||||
|
} finally {
|
||||||
|
target.combatLock.writeLock().unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleCombat(boolean toggle, ClientConnection origin) {
|
public static void toggleCombat(boolean toggle, ClientConnection origin) {
|
||||||
@@ -559,7 +559,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.isEmpty()) {
|
if(wb.item_eq_slots_or == null || wb.item_eq_slots_or.isEmpty()){
|
||||||
return 75;
|
return 75;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,14 +568,14 @@ 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());
|
||||||
@@ -592,7 +592,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());
|
||||||
@@ -602,8 +602,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:
|
||||||
@@ -618,7 +618,10 @@ 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.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) == false)
|
||||||
|
return; //mobs dont submit auto attack jobs
|
||||||
|
|
||||||
|
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);
|
||||||
@@ -627,7 +630,7 @@ public enum CombatManager {
|
|||||||
ConcurrentHashMap<String, JobContainer> timers = attacker.getTimers();
|
ConcurrentHashMap<String, JobContainer> timers = attacker.getTimers();
|
||||||
|
|
||||||
if (timers != null) {
|
if (timers != null) {
|
||||||
AttackJob aj = new AttackJob(attacker, slot.ordinal(), true);
|
AttackJob aj = new AttackJob(attacker, slot.ordinal(), true, attacker.getCombatTarget());
|
||||||
JobContainer job;
|
JobContainer job;
|
||||||
job = JobScheduler.getInstance().scheduleJob(aj, (System.currentTimeMillis() + delay)); // offset 1 millisecond so no overlap issue
|
job = JobScheduler.getInstance().scheduleJob(aj, (System.currentTimeMillis() + delay)); // offset 1 millisecond so no overlap issue
|
||||||
timers.put("Attack" + slot.name(), job);
|
timers.put("Attack" + slot.name(), job);
|
||||||
@@ -635,8 +638,22 @@ 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 void cancelAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot) {
|
||||||
|
|
||||||
public static int calculatePetDamage(AbstractCharacter agent) {
|
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) == false)
|
||||||
|
return;
|
||||||
|
attacker.getTimestamps().put("Attack" + slot.name(), System.currentTimeMillis());
|
||||||
|
|
||||||
|
//handle auto attack job creation
|
||||||
|
ConcurrentHashMap<String, JobContainer> timers = attacker.getTimers();
|
||||||
|
|
||||||
|
if (timers != null) {
|
||||||
|
timers.get("Attack" + slot.name()).cancelJob();
|
||||||
|
} else
|
||||||
|
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void calculatePetDamage(AbstractCharacter agent) {
|
||||||
//damage calc for pet
|
//damage calc for pet
|
||||||
float range;
|
float range;
|
||||||
float damage;
|
float damage;
|
||||||
@@ -648,9 +665,7 @@ public enum CombatManager {
|
|||||||
dmgMultiplier += agent.getLevel() * 0.1f;
|
dmgMultiplier += agent.getLevel() * 0.1f;
|
||||||
range = (float) (maxDmg - minDmg);
|
range = (float) (maxDmg - minDmg);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@@ -658,7 +673,6 @@ 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();
|
||||||
@@ -666,20 +680,4 @@ public enum CombatManager {
|
|||||||
int masteryLevel = 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));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkForProc(AbstractCharacter attacker, AbstractWorldObject target, Item weapon){
|
|
||||||
|
|
||||||
if(weapon == null) // cant proc without a weapon
|
|
||||||
return;
|
|
||||||
|
|
||||||
for(Effect eff : weapon.effects.values()){
|
|
||||||
for(AbstractEffectModifier mod : eff.getEffectsBase().getModifiers()){
|
|
||||||
if(mod.modType.equals(mbEnums.ModType.WeaponProc))
|
|
||||||
if(ThreadLocalRandom.current().nextInt(0,101) < 6)
|
|
||||||
((WeaponProcEffectModifier)mod).applyProc(attacker,target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -164,15 +164,6 @@ public enum ConfigManager {
|
|||||||
Logger.info("Compiling regex");
|
Logger.info("Compiling regex");
|
||||||
|
|
||||||
regex.put(MB_LOGIN_FNAME_REGEX, Pattern.compile(MB_LOGIN_FNAME_REGEX.getValue()));
|
regex.put(MB_LOGIN_FNAME_REGEX, Pattern.compile(MB_LOGIN_FNAME_REGEX.getValue()));
|
||||||
|
|
||||||
Logger.info("Loading WPAK data");
|
|
||||||
|
|
||||||
// *** Needs powermanager collection
|
|
||||||
// defined before activation.
|
|
||||||
// EffectsParser.parseWpakFile();
|
|
||||||
// PowersParser.parseWpakFile();
|
|
||||||
// PowerActionParser.parseWpakFile();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,15 +49,8 @@ public enum ForgeManager implements Runnable {
|
|||||||
public static final ConcurrentHashMap<NPC, ConcurrentHashMap.KeySetView<WorkOrder, Boolean>> vendorWorkOrderLookup = new ConcurrentHashMap<>();
|
public static final ConcurrentHashMap<NPC, ConcurrentHashMap.KeySetView<WorkOrder, Boolean>> vendorWorkOrderLookup = new ConcurrentHashMap<>();
|
||||||
public static final ConcurrentHashMap<Item, WorkOrder> itemWorkOrderLookup = new ConcurrentHashMap<>();
|
public static final ConcurrentHashMap<Item, WorkOrder> itemWorkOrderLookup = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static void start() {
|
|
||||||
|
|
||||||
Thread forgeManager;
|
|
||||||
forgeManager = new Thread(FORGE_MANAGER);
|
|
||||||
forgeManager.setName("Forge Manager");
|
|
||||||
forgeManager.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
WorkOrder workOrder;
|
WorkOrder workOrder;
|
||||||
@@ -74,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.
|
||||||
@@ -119,6 +112,14 @@ public enum ForgeManager implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void start() {
|
||||||
|
|
||||||
|
Thread forgeManager;
|
||||||
|
forgeManager = new Thread(FORGE_MANAGER);
|
||||||
|
forgeManager.setName("Forge Manager");
|
||||||
|
forgeManager.start();
|
||||||
|
}
|
||||||
|
|
||||||
public static int submit(WorkOrder workOrder) {
|
public static int submit(WorkOrder workOrder) {
|
||||||
|
|
||||||
// Must have a city to roll anything
|
// Must have a city to roll anything
|
||||||
@@ -264,12 +265,12 @@ public enum ForgeManager implements Runnable {
|
|||||||
|
|
||||||
// Assign a prefix and suffix to this item if random rolled
|
// Assign a prefix and suffix to this item if random rolled
|
||||||
|
|
||||||
if (workOrder.prefixToken == 0 && workOrder.vendor.getItemModTable().contains((template.modTable)))
|
if (workOrder.prefixToken == 0)
|
||||||
forgedItem.prefixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.PREFIX, template.modTable);
|
forgedItem.prefixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.PREFIX, template.modTable);
|
||||||
else
|
else
|
||||||
forgedItem.prefixToken = workOrder.prefixToken;
|
forgedItem.prefixToken = workOrder.prefixToken;
|
||||||
|
|
||||||
if (workOrder.suffixToken == 0 && workOrder.vendor.getItemModTable().contains((template.modTable)))
|
if (workOrder.suffixToken == 0)
|
||||||
forgedItem.suffixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.SUFFIX, template.modTable);
|
forgedItem.suffixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.SUFFIX, template.modTable);
|
||||||
else
|
else
|
||||||
forgedItem.suffixToken = workOrder.suffixToken;
|
forgedItem.suffixToken = workOrder.suffixToken;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public enum ItemManager {
|
|||||||
if (characterSkill == null)
|
if (characterSkill == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (characterSkill.getModifiedAmountBeforeMods() >= required_value)
|
if (characterSkill.getModifiedAmountBeforeMods() > required_value)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,35 +172,18 @@ public enum PowersManager {
|
|||||||
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
||||||
boolean sendCastToSelf) {
|
boolean sendCastToSelf) {
|
||||||
|
|
||||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && getPowerByToken(msg.getPowerUsedID()).ignoreLore() == false) {
|
||||||
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.enforceLore()) {
|
if (pb != null && pb.isHarmful == false) {
|
||||||
//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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (usePowerA(msg, origin, sendCastToSelf)) {
|
if (usePowerA(msg, origin, sendCastToSelf)) {
|
||||||
// Cast failed for some reason, reset timer
|
// Cast failed for some reason, reset timer
|
||||||
@@ -925,6 +908,10 @@ 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) {
|
||||||
|
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
||||||
|
}
|
||||||
|
|
||||||
// update target of used power timer
|
// update target of used power timer
|
||||||
|
|
||||||
@@ -946,7 +933,8 @@ public enum PowersManager {
|
|||||||
continue;
|
continue;
|
||||||
// If something blocks the action, then stop
|
// If something blocks the action, then stop
|
||||||
|
|
||||||
if (ab.blocked(target,pb.vampDrain)) {
|
if (ab.blocked(target, pb, trains)) {
|
||||||
|
|
||||||
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
|
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1121,7 +1109,7 @@ public enum PowersManager {
|
|||||||
continue;
|
continue;
|
||||||
// If something blocks the action, then stop
|
// If something blocks the action, then stop
|
||||||
|
|
||||||
if (ab.blocked(target,pb.vampDrain))
|
if (ab.blocked(target, pb, trains))
|
||||||
continue;
|
continue;
|
||||||
// TODO handle overwrite stack order here
|
// TODO handle overwrite stack order here
|
||||||
String stackType = ab.getStackType();
|
String stackType = ab.getStackType();
|
||||||
@@ -1435,7 +1423,7 @@ public enum PowersManager {
|
|||||||
if (trains < ab.getMinTrains() || trains > ab.getMaxTrains())
|
if (trains < ab.getMinTrains() || trains > ab.getMaxTrains())
|
||||||
continue;
|
continue;
|
||||||
// If something blocks the action, then stop
|
// If something blocks the action, then stop
|
||||||
if (ab.blocked(target,pb.vampDrain))
|
if (ab.blocked(target, pb, trains))
|
||||||
// sendPowerMsg(pc, 5, msg);
|
// sendPowerMsg(pc, 5, msg);
|
||||||
continue;
|
continue;
|
||||||
// TODO handle overwrite stack order here
|
// TODO handle overwrite stack order here
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ package engine.jobs;
|
|||||||
import engine.gameManager.CombatManager;
|
import engine.gameManager.CombatManager;
|
||||||
import engine.job.AbstractJob;
|
import engine.job.AbstractJob;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
|
import engine.objects.AbstractWorldObject;
|
||||||
|
|
||||||
public class AttackJob extends AbstractJob {
|
public class AttackJob extends AbstractJob {
|
||||||
|
|
||||||
@@ -19,16 +20,20 @@ public class AttackJob extends AbstractJob {
|
|||||||
private final int slot;
|
private final int slot;
|
||||||
private final boolean success;
|
private final boolean success;
|
||||||
|
|
||||||
public AttackJob(AbstractCharacter source, int slot, boolean success) {
|
public final AbstractWorldObject target;
|
||||||
|
|
||||||
|
public AttackJob(AbstractCharacter source, int slot, boolean success, AbstractWorldObject target) {
|
||||||
super();
|
super();
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
this.success = success;
|
this.success = success;
|
||||||
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doJob() {
|
protected void doJob() {
|
||||||
CombatManager.combatCycle(this.source, this.source.combatTarget);
|
|
||||||
|
CombatManager.combatCycle(this.source,target,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean success() {
|
public boolean success() {
|
||||||
|
|||||||
@@ -84,11 +84,6 @@ 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()) {
|
||||||
@@ -112,7 +107,6 @@ 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;
|
||||||
@@ -135,8 +129,7 @@ public class WorkOrder implements Delayed {
|
|||||||
if (!workOrder.vendor.charItemManager.hasRoomInventory(template.item_wt))
|
if (!workOrder.vendor.charItemManager.hasRoomInventory(template.item_wt))
|
||||||
return 30; //30: That person cannot carry that item
|
return 30; //30: That person cannot carry that item
|
||||||
|
|
||||||
if ((workOrder.prefixToken != 0 || workOrder.suffixToken != 0) &&
|
if (!workOrder.vendor.getItemModTable().contains((template.modTable)))
|
||||||
!workOrder.vendor.getItemModTable().contains((template.modTable)))
|
|
||||||
return 59; //59: This hireling does not have this formula
|
return 59; //59: This hireling does not have this formula
|
||||||
|
|
||||||
if (!Warehouse.calcCostOverrun(workOrder).isEmpty())
|
if (!Warehouse.calcCostOverrun(workOrder).isEmpty())
|
||||||
|
|||||||
+34
-136
@@ -831,38 +831,20 @@ public class mbEnums {
|
|||||||
SPIRES,
|
SPIRES,
|
||||||
SNARE,
|
SNARE,
|
||||||
STUN,
|
STUN,
|
||||||
BLINDNESS,
|
BLIND,
|
||||||
ROOT,
|
ROOT,
|
||||||
FEAR,
|
FEAR,
|
||||||
CHARM,
|
CHARM,
|
||||||
POWERINHIBITOR,
|
POWERBLOCK,
|
||||||
DEBUFF,
|
DEBUFF,
|
||||||
STEAL,
|
STEAL,
|
||||||
DRAIN;
|
DRAIN;
|
||||||
|
|
||||||
public static DamageType getDamageType(String modName) {
|
public static DamageType getDamageType(String modName) {
|
||||||
|
DamageType damageType;
|
||||||
if (modName.isEmpty())
|
if (modName.isEmpty())
|
||||||
return DamageType.NONE;
|
return DamageType.NONE;
|
||||||
|
|
||||||
if(modName.toLowerCase().equals("blind"))
|
|
||||||
modName = "BLINDNESS";
|
|
||||||
|
|
||||||
if(modName.toLowerCase().equals("powerblock"))
|
|
||||||
modName = "POWERINHIBITOR";
|
|
||||||
|
|
||||||
//validity check for not looking up damage type that doesn't exist
|
|
||||||
boolean valid = false;
|
|
||||||
for(DamageType type : DamageType.values()){
|
|
||||||
if(type.name().equals(modName))
|
|
||||||
valid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!valid)
|
|
||||||
return DamageType.NONE;
|
|
||||||
|
|
||||||
DamageType damageType;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
damageType = DamageType.valueOf(modName.replace(",", "").toUpperCase());
|
damageType = DamageType.valueOf(modName.replace(",", "").toUpperCase());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -2733,45 +2715,42 @@ public class mbEnums {
|
|||||||
|
|
||||||
public enum ResourceType {
|
public enum ResourceType {
|
||||||
|
|
||||||
GOLD(7, -1670881623, 2308551, 100000000, 50000),
|
GOLD(7, 2308551, 100000000, 10),
|
||||||
ADAMANT(1580003, 1557001525, -1741189964, 1000, 10),
|
ADAMANT(1580003, -1741189964, 1000, 10),
|
||||||
AGATE(1580009, -1096157543, 75173057, 2000, 20),
|
AGATE(1580009, 75173057, 2000, 10),
|
||||||
ANTIMONY(1580014, 1256147265, 452320058, 1000, 10),
|
ANTIMONY(1580014, 452320058, 1000, 10),
|
||||||
AZOTH(1580012, -1205326951, 78329697, 2000, 20),
|
AZOTH(1580012, 78329697, 2000, 10),
|
||||||
BLOODSTONE(1580020, -1912381716, -1569826353, 500, 5),
|
BLOODSTONE(1580020, -1569826353, 500, 10),
|
||||||
BRONZEWOOD(1580006, -519681813, 1334770447, 1000, 30),
|
BRONZEWOOD(1580006, 1334770447, 500, 10),
|
||||||
COAL(1580008, -1672872311, 2559427, 3000, 30),
|
COAL(1580008, 2559427, 3000, 10),
|
||||||
DIAMOND(1580010, 1540225085, -1730704107, 2000, 20),
|
DIAMOND(1580010, -1730704107, 2000, 10),
|
||||||
GALVOR(1580017, -1683992404, -1596311545, 2000, 5),
|
GALVOR(1580017, -1596311545, 2000, 10),
|
||||||
IRON(1580002, -1673518119, 2504297, 2000, 20),
|
IRON(1580002, 2504297, 2000, 10),
|
||||||
LUMBER(1580004, -1628412684, -1603256692, 10000, 100),
|
LUMBER(1580004, -1603256692, 10000, 10),
|
||||||
MANDRAKE(1580007, 1519910613, 1191391799, 1000, 10),
|
MANDRAKE(1580007, 1191391799, 1000, 10),
|
||||||
MITHRIL(1580021, 626743397, -1761257186, 500, 5),
|
MITHRIL(1580021, -1761257186, 500, 10),
|
||||||
OAK(1580005, -1653034775, 74767, 3000, 30),
|
OAK(1580005, 74767, 3000, 10),
|
||||||
OBSIDIAN(1580019, 778019055, -697973233, 500, 5),
|
OBSIDIAN(1580019, -697973233, 500, 10),
|
||||||
ONYX(1580011, -1675952151, 2977263, 1000, 10),
|
ONYX(1580011, 2977263, 1000, 10),
|
||||||
ORICHALK(1580013, -1468730955, -2036290524, 3000, 30),
|
ORICHALK(1580013, -2036290524, 3000, 10),
|
||||||
QUICKSILVER(1580016, -2081208434, -472884509, 1000, 10),
|
QUICKSILVER(1580016, -472884509, 1000, 10),
|
||||||
STONE(1580000, -1094703863, 74856115, 10000, 100),
|
STONE(1580000, 74856115, 10000, 10),
|
||||||
SULFUR(1580015, -1763687412, -1586349421, 1000, 10),
|
SULFUR(1580015, -1586349421, 1000, 10),
|
||||||
TRUESTEEL(1580001, -169012482, -317484979, 2000, 20),
|
TRUESTEEL(1580001, -317484979, 2000, 10),
|
||||||
WORMWOOD(1580018, 1204785075, 1532478436, 500, 5);
|
WORMWOOD(1580018, 1532478436, 500, 10);
|
||||||
|
|
||||||
public static HashMap<Integer, ResourceType> templateLookup = new HashMap<>();
|
public static HashMap<Integer, ResourceType> resourceLookup = new HashMap<>();
|
||||||
public static HashMap<Integer, ResourceType> templateHashLookup = new HashMap<>();
|
public static HashMap<Integer, ResourceType> hashLookup = new HashMap<>();
|
||||||
public static HashMap<Integer, ResourceType> resourceHashLookup = new HashMap<>();
|
|
||||||
public int templateID;
|
public int templateID;
|
||||||
public ItemTemplate template;
|
public ItemTemplate template;
|
||||||
public int resourceHash;
|
public int hash;
|
||||||
public int templateHash;
|
|
||||||
public int deposit_limit;
|
public int deposit_limit;
|
||||||
public int mine_production;
|
public int mine_production;
|
||||||
|
|
||||||
ResourceType(int templateID, int resourceHash, int templateHash, int deposit_limit, int mine_production) {
|
ResourceType(int templateID, int hash, 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.resourceHash = resourceHash;
|
this.hash = hash;
|
||||||
this.templateHash = templateHash;
|
|
||||||
this.deposit_limit = deposit_limit;
|
this.deposit_limit = deposit_limit;
|
||||||
this.mine_production = mine_production;
|
this.mine_production = mine_production;
|
||||||
}
|
}
|
||||||
@@ -2779,11 +2758,11 @@ public class mbEnums {
|
|||||||
public static void InitializeResourceTypes() {
|
public static void InitializeResourceTypes() {
|
||||||
|
|
||||||
for (ResourceType resourceType : ResourceType.values()) {
|
for (ResourceType resourceType : ResourceType.values()) {
|
||||||
templateLookup.put(resourceType.templateID, resourceType);
|
resourceLookup.put(resourceType.templateID, resourceType);
|
||||||
templateHashLookup.put(resourceType.templateHash, resourceType);
|
hashLookup.put(resourceType.hash, resourceType);
|
||||||
resourceHashLookup.put(resourceType.resourceHash, resourceType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3034,86 +3013,5 @@ public class mbEnums {
|
|||||||
PREFIX,
|
PREFIX,
|
||||||
SUFFIX;
|
SUFFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PowerType {
|
|
||||||
None,
|
|
||||||
SPELL,
|
|
||||||
SKILL
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum CostType {
|
|
||||||
NONE,
|
|
||||||
HEALTH,
|
|
||||||
MANA,
|
|
||||||
STAMINA
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum AreaType {
|
|
||||||
NONE,
|
|
||||||
SPHERE,
|
|
||||||
POINTBLANK,
|
|
||||||
LINE,
|
|
||||||
CONE,
|
|
||||||
WALL
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ExcludeType {
|
|
||||||
NONE,
|
|
||||||
CASTER,
|
|
||||||
GROUP,
|
|
||||||
GUILD,
|
|
||||||
NATION,
|
|
||||||
PLAYERS,
|
|
||||||
ALLBUTGROUP,
|
|
||||||
ALLBUTPETS
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum CastingModeType {
|
|
||||||
NONE,
|
|
||||||
COMBAT,
|
|
||||||
NONCOMBAT,
|
|
||||||
BOTH
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum TargetSelectType {
|
|
||||||
NONE,
|
|
||||||
CLICK,
|
|
||||||
GROUP,
|
|
||||||
GUILD,
|
|
||||||
NEARBYMOBS,
|
|
||||||
NAME
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum CategoryToPowerType {
|
|
||||||
None,
|
|
||||||
GreaterThanOrEqualTo,
|
|
||||||
GreaterThan,
|
|
||||||
Always
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ModificationType {
|
|
||||||
ADD,
|
|
||||||
MULTIPLY
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ServerConfig {
|
|
||||||
MBDB_108("AERYNTH", "ARAC", "MOURNING", 300000),
|
|
||||||
MBDB_192("DALGOTH", "ARAC", "GOOK", 300001),
|
|
||||||
MBDB_162("VORGINA", "LORE", "SAEDRON", 300002),
|
|
||||||
MBDB_164("VORGINA", "ARAC", "THURIN", 300002);
|
|
||||||
|
|
||||||
public final String mapType;
|
|
||||||
public final String ruleType;
|
|
||||||
public final String serverName;
|
|
||||||
public final int realmMap;
|
|
||||||
|
|
||||||
ServerConfig(String mapType, String ruleType, String serverName, int realmMap) {
|
|
||||||
|
|
||||||
this.mapType = mapType;
|
|
||||||
this.ruleType = ruleType;
|
|
||||||
this.serverName = serverName;
|
|
||||||
this.realmMap = realmMap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ public class MobAI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.behaviourType.callsForHelp)
|
if (mob.behaviourType != null && mob.behaviourType.callsForHelp)
|
||||||
mobCallForHelp(mob);
|
mobCallForHelp(mob);
|
||||||
|
|
||||||
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
|
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
|
||||||
@@ -125,7 +125,7 @@ public class MobAI {
|
|||||||
if (mob.isMoving() && mob.getRange() > 20)
|
if (mob.isMoving() && mob.getRange() > 20)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getPet() != null)
|
if (target.getPet() != null)
|
||||||
@@ -159,7 +159,7 @@ public class MobAI {
|
|||||||
MovementManager.sendRWSSMsg(mob);
|
MovementManager.sendRWSSMsg(mob);
|
||||||
|
|
||||||
|
|
||||||
CombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target,0);
|
||||||
|
|
||||||
if (mob.isSiege()) {
|
if (mob.isSiege()) {
|
||||||
PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||||
@@ -175,7 +175,7 @@ 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)
|
if(mob == null || target == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mob.getRange() >= 30 && mob.isMoving())
|
if (mob.getRange() >= 30 && mob.isMoving())
|
||||||
@@ -183,7 +183,7 @@ public class MobAI {
|
|||||||
|
|
||||||
//no weapons, default mob attack speed 3 seconds.
|
//no weapons, default mob attack speed 3 seconds.
|
||||||
|
|
||||||
CombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target,0);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage());
|
||||||
@@ -976,7 +976,7 @@ 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;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public enum Protocol {
|
|||||||
ITEMPRODUCTION(0x3CCE8E30, ItemProductionMsg.class, ItemProductionMsgHandler.class),
|
ITEMPRODUCTION(0x3CCE8E30, ItemProductionMsg.class, ItemProductionMsgHandler.class),
|
||||||
ITEMTOVAULT(0x3ABE4927, ItemToVaultMsg.class, ItemToVaultMsgHandler.class), // Transfer Item to Vault
|
ITEMTOVAULT(0x3ABE4927, ItemToVaultMsg.class, ItemToVaultMsgHandler.class), // Transfer Item to Vault
|
||||||
ITEMFROMVAULT(0x0119A64D, ItemFromVaultMsg.class, ItemFromVaultMsgHandler.class), // Transfer Item from Vault to Inventory
|
ITEMFROMVAULT(0x0119A64D, ItemFromVaultMsg.class, ItemFromVaultMsgHandler.class), // Transfer Item from Vault to Inventory
|
||||||
JOINFORPROVINCE(0x1FB369CD, AcceptSubInviteMsg.class, SwearInGuildHandler.class), //Response to invite to swear?
|
JOINFORPROVINCE(0x1FB369CD, AcceptSubInviteMsg.class, AcceptSubInviteHandler.class), //Response to invite to swear?
|
||||||
JOINFORSWORN(0xF6A4170F, null, null),
|
JOINFORSWORN(0xF6A4170F, null, null),
|
||||||
JOINGROUP(0x7EC5E636, GroupInviteResponseMsg.class, GroupInviteResponseHandler.class), // Accept Group Invite
|
JOINGROUP(0x7EC5E636, GroupInviteResponseMsg.class, GroupInviteResponseHandler.class), // Accept Group Invite
|
||||||
JOINGUILD(0xF0C5F2FF, AcceptInviteToGuildMsg.class, AcceptInviteToGuildHandler.class), // Accept guild invite
|
JOINGUILD(0xF0C5F2FF, AcceptInviteToGuildMsg.class, AcceptInviteToGuildHandler.class), // Accept guild invite
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
|||||||
|
|
||||||
//make sure valid resource
|
//make sure valid resource
|
||||||
|
|
||||||
mbEnums.ResourceType resource = mbEnums.ResourceType.resourceHashLookup.get(changeProductionMsg.getResourceHash());
|
mbEnums.ResourceType resource = mbEnums.ResourceType.hashLookup.get(changeProductionMsg.getResourceHash());
|
||||||
|
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package engine.net.client.handlers;
|
|||||||
|
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.CombatManager;
|
import engine.gameManager.CombatManager;
|
||||||
|
import engine.jobs.AttackJob;
|
||||||
import engine.mbEnums;
|
import engine.mbEnums;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.AttackCmdMsg;
|
import engine.net.client.msg.AttackCmdMsg;
|
||||||
@@ -82,7 +83,29 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (playerCharacter.isSit())
|
if (playerCharacter.isSit())
|
||||||
CombatManager.toggleSit(false, origin);
|
CombatManager.toggleSit(false, origin);
|
||||||
|
|
||||||
CombatManager.combatCycle(playerCharacter, target);
|
long addedDelay = 0;
|
||||||
|
//check if we are changing targets, cancel outstanding jobs if so
|
||||||
|
if (playerCharacter.getTimers().containsKey("Attack" + mbEnums.EquipSlotType.RHELD)) {
|
||||||
|
AttackJob ajR = ((AttackJob)playerCharacter.getTimers().get("Attack" + mbEnums.EquipSlotType.RHELD).getJob());
|
||||||
|
if(ajR.target != null && !ajR.target.equals(target)){
|
||||||
|
playerCharacter.getTimers().get("Attack" + mbEnums.EquipSlotType.RHELD).cancelJob();
|
||||||
|
addedDelay = ajR.getStopTime() - System.currentTimeMillis();
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerCharacter.getTimers().containsKey("Attack" + mbEnums.EquipSlotType.LHELD)) {
|
||||||
|
AttackJob ajL = ((AttackJob)playerCharacter.getTimers().get("Attack" + mbEnums.EquipSlotType.LHELD).getJob());
|
||||||
|
if(ajL.target != null && !ajL.target.equals(target)){
|
||||||
|
playerCharacter.getTimers().get("Attack" + mbEnums.EquipSlotType.LHELD).cancelJob();
|
||||||
|
addedDelay = ajL.getStopTime() - System.currentTimeMillis();
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CombatManager.combatCycle(playerCharacter, target, addedDelay);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (building.getGuild().isEmptyGuild())
|
if (building.getGuild().isEmptyGuild())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!BuildingManager.playerCanManage(sourcePlayer, building))
|
if (!ManageCityAssetMsgHandler.playerCanManageNotFriends(sourcePlayer, building))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler {
|
|||||||
(building == null) || playerZone == null || playerCity == null)
|
(building == null) || playerZone == null || playerCity == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!BuildingManager.playerCanManage(sourcePlayer, building))
|
if (!ManageCityAssetMsgHandler.playerCanManageNotFriends(sourcePlayer, building))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
boolean open = (msg.getMessageType() == OPEN_CITY);
|
boolean open = (msg.getMessageType() == OPEN_CITY);
|
||||||
|
|||||||
@@ -102,9 +102,6 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
|||||||
//source guild is limited to 7 subs
|
//source guild is limited to 7 subs
|
||||||
//TODO this should be based on TOL rank
|
//TODO this should be based on TOL rank
|
||||||
|
|
||||||
//cannot be subbed into a nation if you already have your own sub guilds
|
|
||||||
if(targetGuild.getSubGuildList() != null && targetGuild.getSubGuildList().size() > 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (!sourceGuild.canSubAGuild(targetGuild)) {
|
if (!sourceGuild.canSubAGuild(targetGuild)) {
|
||||||
sendChat(source, "This Guild can't be subbed.");
|
sendChat(source, "This Guild can't be subbed.");
|
||||||
|
|||||||
@@ -28,6 +28,30 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean playerCanManageNotFriends(PlayerCharacter player, Building building) {
|
||||||
|
|
||||||
|
//Player Can only Control Building if player is in Same Guild as Building and is higher rank than IC.
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (building.getRank() == -1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (BuildingManager.IsOwner(building, player))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false && GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Somehow guild leader check fails above? lets check if Player is true Guild GL.
|
||||||
|
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return Guild.sameGuild(building.getGuild(), player.getGuild());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
City targetCity = null;
|
City targetCity = null;
|
||||||
|
|
||||||
if (isTeleport)
|
if (isTeleport)
|
||||||
cities = City.getCitiesToTeleportTo(player, false);
|
cities = City.getCitiesToTeleportTo(player);
|
||||||
else
|
else
|
||||||
cities = City.getCitiesToRepledgeTo(player);
|
cities = City.getCitiesToRepledgeTo(player);
|
||||||
for (City city : cities) {
|
for (City city : cities) {
|
||||||
|
|||||||
@@ -264,9 +264,8 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
player.cancelOnSpell();
|
player.cancelOnSpell();
|
||||||
break;
|
break;
|
||||||
case RUNE:
|
case RUNE:
|
||||||
if(ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
ApplyRuneMsg.applyRune(uuid, origin, player);
|
||||||
itemMan.consume(item);
|
itemMan.consume(item);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default: //shouldn't be here, consume item
|
default: //shouldn't be here, consume item
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (building == null)
|
if (building == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (BuildingManager.playerCanManage(player, building) == false)
|
if (ManageCityAssetMsgHandler.playerCanManageNotFriends(player, building) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (orderNpcMsg.getPatrolSize() >= 20)
|
if (orderNpcMsg.getPatrolSize() >= 20)
|
||||||
@@ -411,7 +411,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
case 2:
|
case 2:
|
||||||
player = SessionManager.getPlayerCharacter(origin);
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (BuildingManager.playerCanManage(player, building) == false)
|
if (ManageCityAssetMsgHandler.playerCanManageNotFriends(player, building) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (building.getHirelings().containsKey(npc) == false)
|
if (building.getHirelings().containsKey(npc) == false)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class PetAttackMsgHandler extends AbstractClientMsgHandler {
|
|||||||
pet.setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
|
pet.setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
|
||||||
|
|
||||||
switch (msg.getTargetType()) {
|
switch (msg.getTargetType()) {
|
||||||
case 52: //player character
|
case 53: //player character
|
||||||
pet.setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
|
pet.setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
|
||||||
break;
|
break;
|
||||||
case 37://mob
|
case 37://mob
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import engine.net.Dispatch;
|
|||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
import engine.net.client.msg.ErrorPopupMsg;
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
import engine.net.client.msg.guild.AcceptSubInviteMsg;
|
|
||||||
import engine.net.client.msg.guild.SendGuildEntryMsg;
|
import engine.net.client.msg.guild.SendGuildEntryMsg;
|
||||||
|
import engine.net.client.msg.guild.SwearInGuildMsg;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.objects.Guild;
|
import engine.objects.Guild;
|
||||||
import engine.objects.GuildStatusController;
|
import engine.objects.GuildStatusController;
|
||||||
@@ -36,18 +36,18 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||||
PlayerCharacter player;
|
PlayerCharacter player;
|
||||||
AcceptSubInviteMsg swearInMsg;
|
SwearInGuildMsg swearInMsg;
|
||||||
Guild targetGuild;
|
Guild targetGuild;
|
||||||
Guild nation;
|
Guild nation;
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
|
|
||||||
swearInMsg = (AcceptSubInviteMsg) baseMsg;
|
swearInMsg = (SwearInGuildMsg) baseMsg;
|
||||||
player = SessionManager.getPlayerCharacter(origin);
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
targetGuild = (Guild) DbManager.getObject(GameObjectType.Guild, swearInMsg.guildUUID());
|
targetGuild = (Guild) DbManager.getObject(GameObjectType.Guild, swearInMsg.getGuildUUID());
|
||||||
|
|
||||||
if (targetGuild == null) {
|
if (targetGuild == null) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
||||||
@@ -66,6 +66,15 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
|||||||
ErrorPopupMsg.sendErrorMsg(player, "Your guild is not a nation!");
|
ErrorPopupMsg.sendErrorMsg(player, "Your guild is not a nation!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (!nation.getSubGuildList().contains(targetGuild)) {
|
||||||
|
ErrorPopupMsg.sendErrorMsg(player, "Your do not have such authority!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Guild.canSwearIn(targetGuild)) {
|
||||||
|
ErrorPopupMsg.sendErrorMsg(player, targetGuild.getGuildState().name() + "cannot be sworn in");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
|
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Your do not have such authority!");
|
ErrorPopupMsg.sendErrorMsg(player, "Your do not have such authority!");
|
||||||
@@ -77,8 +86,16 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetGuild.getGuildState().equals(GuildState.Errant))
|
switch (targetGuild.getGuildState()) {
|
||||||
|
case Petitioner:
|
||||||
GuildManager.updateAllGuildBinds(targetGuild, nation.getOwnedCity());
|
GuildManager.updateAllGuildBinds(targetGuild, nation.getOwnedCity());
|
||||||
|
break;
|
||||||
|
case Protectorate:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//shouldn't get here.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//update Guild state.
|
//update Guild state.
|
||||||
targetGuild.setNation(nation);
|
targetGuild.setNation(nation);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class TransferGoldToFromBuildingMsgHandler extends AbstractClientMsgHandl
|
|||||||
|
|
||||||
if (msg.getDirection() == 2) {
|
if (msg.getDirection() == 2) {
|
||||||
|
|
||||||
if (!BuildingManager.playerCanManage(player, building))
|
if (!ManageCityAssetMsgHandler.playerCanManageNotFriends(player, building))
|
||||||
return true;
|
return true;
|
||||||
if (building.setReserve(msg.getUnknown01(), player)) {
|
if (building.setReserve(msg.getUnknown01(), player)) {
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
|
|||||||
@@ -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 (18); // 2^17 == 131,072
|
return (17); // 2^17 == 131,072
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -73,8 +73,10 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
public void configure() {
|
public void configure() {
|
||||||
|
|
||||||
cities = City.getCitiesToTeleportTo(player, !isTeleport);
|
if (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.templateHash);
|
writer.putInt(resourceType.hash);
|
||||||
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.templateHash);
|
writer.putInt(resourceType.hash);
|
||||||
writer.putInt(0); //available?
|
writer.putInt(0); //available?
|
||||||
writer.putInt(resourceType.deposit_limit); //max?
|
writer.putInt(resourceType.deposit_limit); //max?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -656,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -806,7 +806,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None));
|
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None));
|
||||||
|
|
||||||
PlayerBonuses bonuses = abstractCharacter.bonuses;
|
PlayerBonuses bonuses = abstractCharacter.bonuses;
|
||||||
if (bonuses != null) {
|
if(bonuses != null){
|
||||||
ModType modType = ModType.AttackDelay;
|
ModType modType = ModType.AttackDelay;
|
||||||
for (AbstractEffectModifier mod : bonuses.bonusFloats.keySet()) {
|
for (AbstractEffectModifier mod : bonuses.bonusFloats.keySet()) {
|
||||||
|
|
||||||
@@ -1787,7 +1787,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
final boolean fromCost) {
|
final boolean fromCost) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
this.combatLock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
boolean ready = this.healthLock.writeLock().tryLock(1, TimeUnit.SECONDS);
|
boolean ready = this.healthLock.writeLock().tryLock(1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
@@ -1829,7 +1829,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
Mob target = (Mob) this;
|
Mob target = (Mob) this;
|
||||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
|
|
||||||
if (target.playerAgroMap.containsKey(attacker.getObjectUUID()))
|
if(target.playerAgroMap.containsKey(attacker.getObjectUUID()))
|
||||||
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
|
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
|
||||||
else
|
else
|
||||||
target.playerAgroMap.put(attacker.getObjectUUID(), value);
|
target.playerAgroMap.put(attacker.getObjectUUID(), value);
|
||||||
@@ -1852,6 +1852,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
return newHealth - oldHealth;
|
return newHealth - oldHealth;
|
||||||
} finally {
|
} finally {
|
||||||
this.healthLock.writeLock().unlock();
|
this.healthLock.writeLock().unlock();
|
||||||
|
this.combatLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
private Vector3f rot = new Vector3f(0.0f, 0.0f, 0.0f);
|
private Vector3f rot = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||||
private int objectTypeMask = 0;
|
private int objectTypeMask = 0;
|
||||||
private Bounds bounds;
|
private Bounds bounds;
|
||||||
|
public ReentrantReadWriteLock combatLock = new ReentrantReadWriteLock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Id Constructor
|
* No Id Constructor
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,11 +163,6 @@ public class Building extends AbstractWorldObject {
|
|||||||
if (upgradeTimeStamp != null)
|
if (upgradeTimeStamp != null)
|
||||||
this.upgradeDateTime = LocalDateTime.ofInstant(upgradeTimeStamp.toInstant(), ZoneId.systemDefault());
|
this.upgradeDateTime = LocalDateTime.ofInstant(upgradeTimeStamp.toInstant(), ZoneId.systemDefault());
|
||||||
|
|
||||||
if(rs.getInt("enforceKOS") == 0)
|
|
||||||
this.enforceKOS = false;
|
|
||||||
else
|
|
||||||
this.enforceKOS = true;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error("Failed for object " + this.blueprintUUID + ' ' + this.getObjectUUID() + e);
|
Logger.error("Failed for object " + this.blueprintUUID + ' ' + this.getObjectUUID() + e);
|
||||||
}
|
}
|
||||||
@@ -959,7 +954,7 @@ public class Building extends AbstractWorldObject {
|
|||||||
// Altitude of this building is derived from the heightmap engine.
|
// Altitude of this building is derived from the heightmap engine.
|
||||||
|
|
||||||
Vector3fImmutable tempLoc = new Vector3fImmutable(this.statLat + this.parentZone.absX, 0, this.statLon + this.parentZone.absZ);
|
Vector3fImmutable tempLoc = new Vector3fImmutable(this.statLat + this.parentZone.absX, 0, this.statLon + this.parentZone.absZ);
|
||||||
tempLoc = new Vector3fImmutable(tempLoc.x, Terrain.getWorldHeight(tempLoc) + this.statAlt, tempLoc.z);
|
tempLoc = new Vector3fImmutable(tempLoc.x, Terrain.getWorldHeight(tempLoc), tempLoc.z);
|
||||||
this.setLoc(tempLoc);
|
this.setLoc(tempLoc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1452,7 +1447,7 @@ public class Building extends AbstractWorldObject {
|
|||||||
|
|
||||||
public synchronized boolean setReserve(int amount, PlayerCharacter player) {
|
public synchronized boolean setReserve(int amount, PlayerCharacter player) {
|
||||||
|
|
||||||
if (!BuildingManager.playerCanManage(player, this))
|
if (!BuildingManager.playerCanManageNotFriends(player, this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (amount < 0)
|
if (amount < 0)
|
||||||
|
|||||||
@@ -1400,7 +1400,6 @@ public class CharacterItemManager {
|
|||||||
|
|
||||||
if (!ItemManager.validForSkills(item, pc.getSkills())) {
|
if (!ItemManager.validForSkills(item, pc.getSkills())) {
|
||||||
this.forceToInventory(slot, item, pc, initialized);
|
this.forceToInventory(slot, item, pc, initialized);
|
||||||
this.equipped.remove(slot);
|
|
||||||
pc.applyBonuses();
|
pc.applyBonuses();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+115
-121
@@ -120,7 +120,9 @@ 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.location.getY(), this.location.getZ() + this.bindZ);
|
this.bindLoc = new Vector3fImmutable(this.location.getX() + this.bindX,
|
||||||
|
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");
|
||||||
@@ -286,133 +288,106 @@ public class City extends AbstractWorldObject {
|
|||||||
return city.getBindLoc();
|
return city.getBindLoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<City> getCitiesToTeleportTo(PlayerCharacter playerCharacter, boolean repledge) {
|
public static ArrayList<City> getCitiesToTeleportTo(PlayerCharacter pc) {
|
||||||
|
|
||||||
ArrayList<City> cities = new ArrayList<>();
|
ArrayList<City> cities = new ArrayList<>();
|
||||||
|
|
||||||
if (playerCharacter == null)
|
if (pc == 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()) {
|
||||||
|
City city = (City) ago;
|
||||||
|
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
|
||||||
|
continue;
|
||||||
|
} else if (city.isNoobIsle == 1 && pc.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")) {
|
||||||
|
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();
|
||||||
|
//add npc cities
|
||||||
|
|
||||||
for (AbstractGameObject ago : worldCities.values()) {
|
for (AbstractGameObject ago : worldCities.values()) {
|
||||||
|
|
||||||
|
if (ago.getObjectType().equals(GameObjectType.City)) {
|
||||||
City city = (City) ago;
|
City city = (City) ago;
|
||||||
|
|
||||||
// Filter Player cities
|
if (city.noTeleport)
|
||||||
|
|
||||||
if (city.parentZone == null)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Can't teleport to something without a tree
|
if (city.parentZone != null && city.parentZone.guild_zone) {
|
||||||
|
|
||||||
if (city.getTOL() == null)
|
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
|
||||||
continue;
|
|
||||||
|
|
||||||
// No abandoned cities
|
|
||||||
|
|
||||||
if (city.getTOL().getGuild().isEmptyGuild())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// No destroyed cities
|
|
||||||
|
|
||||||
if (city.getTOL().getRank() == -1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//can't repledge to a guild you're already part of
|
|
||||||
if (repledge && city.getGuild().equals(playerCharacter.guild))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (city.parentZone.guild_zone) {
|
|
||||||
|
|
||||||
//players can all port and repledge inside their own nation
|
|
||||||
|
|
||||||
if(city.getGuild().getNation().equals(playerCharacter.guild.getNation())){
|
|
||||||
cities.add(city);
|
cities.add(city);
|
||||||
continue;
|
} else
|
||||||
}
|
//list Player cities
|
||||||
|
|
||||||
if (city.isOpen() && city.getTOL().rank > 4) {
|
//open city, just list
|
||||||
|
|
||||||
// Filter Lore cities
|
if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
|
||||||
|
|
||||||
|
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
|
||||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||||
|
if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) {
|
||||||
if (repledge) {
|
|
||||||
if (!city.getGuild().charter.canJoin(playerCharacter))
|
|
||||||
continue;
|
|
||||||
} else if (!city.getGuild().charter.equals(playerCharacter.guild.charter))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer playerUUID = playerCharacter.objectUUID;
|
|
||||||
Integer guildUUID = playerCharacter.guildUUID;
|
|
||||||
Integer nationUUID = playerCharacter.guild.getNation().getObjectUUID();
|
|
||||||
boolean allowed = false;
|
|
||||||
|
|
||||||
if (city.getTOL().reverseKOS) {
|
|
||||||
|
|
||||||
//reverse KOS, specific values are allowed
|
|
||||||
|
|
||||||
if ((city.getTOL().getCondemned().containsKey(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) ||
|
|
||||||
(city.getTOL().getCondemned().containsKey(guildUUID) && city.getTOL().getCondemned().get(guildUUID).active) ||
|
|
||||||
(city.getTOL().getCondemned().containsKey(nationUUID) && city.getTOL().getCondemned().get(nationUUID).active))
|
|
||||||
allowed = true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//not reverse KOS, everyone is allowed by default
|
|
||||||
|
|
||||||
allowed = true;
|
|
||||||
|
|
||||||
//specific values are not allowed
|
|
||||||
|
|
||||||
if ((city.getTOL().getCondemned().containsKey(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) ||
|
|
||||||
(city.getTOL().getCondemned().containsKey(guildUUID) && city.getTOL().getCondemned().get(guildUUID).active) ||
|
|
||||||
(city.getTOL().getCondemned().containsKey(nationUUID) && city.getTOL().getCondemned().get(nationUUID).active))
|
|
||||||
allowed = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allowed)
|
|
||||||
cities.add(city);
|
cities.add(city);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
cities.add(city); //verify nation or guild is same
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG))
|
||||||
|
cities.add(city);
|
||||||
|
|
||||||
// Filter NPC cities
|
|
||||||
|
|
||||||
|
} else if (city.isNpc == 1) {
|
||||||
|
|
||||||
|
//list NPC cities
|
||||||
|
|
||||||
|
Guild g = city.getGuild();
|
||||||
|
if (g == null) {
|
||||||
|
if (city.isNpc == 1)
|
||||||
if (city.isNoobIsle == 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
|
||||||
|
|
||||||
if (playerCharacter.level < 20)
|
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax())
|
||||||
cities.add(city); // everyone can go to noob island if they are under level 20
|
cities.add(city); //verify nation or guild is same
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Players cannot teleport to perdition or bastion
|
|
||||||
|
|
||||||
if (city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// These cities are available for anyone off noob island
|
|
||||||
|
|
||||||
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"))) {
|
|
||||||
cities.add(city);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
@@ -432,13 +407,12 @@ 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
|
if(city.isNoobIsle == 1 && playerCharacter.level >= 21)
|
||||||
continue;
|
continue;
|
||||||
} else if (city.isNoobIsle == 1 && playerCharacter.level <= 20) {
|
cities.add(city); // anyone of the same charter can teleport to a safehold of that charter
|
||||||
cities.add(city); // everyone can go to noob island if they are under level 20
|
|
||||||
continue;
|
continue;
|
||||||
} else if (city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.canJoin(playerCharacter))
|
} else if (city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.canJoin(playerCharacter))
|
||||||
if (!city.getTOL().reverseKOS) {
|
if (!city.getTOL().reverseKOS) {
|
||||||
@@ -611,7 +585,7 @@ public class City extends AbstractWorldObject {
|
|||||||
if (this.siegesWithstood == siegesWithstood)
|
if (this.siegesWithstood == siegesWithstood)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (DbManager.CityQueries.updateSiegesWithstood(this, siegesWithstood))
|
if (DbManager.CityQueries.updateSiegesWithstood(this, siegesWithstood) == true)
|
||||||
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());
|
||||||
@@ -667,10 +641,17 @@ public class City extends AbstractWorldObject {
|
|||||||
if (this.getTOL() == null)
|
if (this.getTOL() == null)
|
||||||
return Guild.getErrantGuild();
|
return Guild.getErrantGuild();
|
||||||
|
|
||||||
|
if (this.isNpc == 1) {
|
||||||
|
|
||||||
if (this.getTOL().getOwner() == null)
|
if (this.getTOL().getOwner() == null)
|
||||||
return Guild.getErrantGuild();
|
return Guild.getErrantGuild();
|
||||||
|
|
||||||
return this.getTOL().getOwner().getGuild();
|
return this.getTOL().getOwner().getGuild();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (this.getTOL().getOwner() == null)
|
||||||
|
return Guild.getErrantGuild();
|
||||||
|
return this.getTOL().getOwner().getGuild();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean openCity(boolean open) {
|
public boolean openCity(boolean open) {
|
||||||
@@ -749,7 +730,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())
|
if (((NPC) npc).getContract().isRuneMaster() == true)
|
||||||
outNPC = (NPC) npc;
|
outNPC = (NPC) npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,13 +763,16 @@ 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.location.y, this.location.z + this.bindZ);
|
this.bindLoc = new Vector3fImmutable(this.location.x + this.bindX,
|
||||||
|
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), 0.0f);
|
new Vector2f(mbEnums.CityBoundsType.GRID.halfExtents, mbEnums.CityBoundsType.GRID.halfExtents),
|
||||||
|
0.0f);
|
||||||
this.setBounds(cityBounds);
|
this.setBounds(cityBounds);
|
||||||
|
|
||||||
// Sanity check; no tol
|
// Sanity check; no tol
|
||||||
@@ -796,7 +780,8 @@ 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)) && (this.isNpc == (byte) 0)) {
|
if ((ConfigManager.serverType.equals(ServerType.WORLDSERVER))
|
||||||
|
&& (this.isNpc == (byte) 0)) {
|
||||||
|
|
||||||
this.realm = RealmMap.getRealmAtLocation(this.getLoc());
|
this.realm = RealmMap.getRealmAtLocation(this.getLoc());
|
||||||
|
|
||||||
@@ -816,7 +801,8 @@ 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) || (sub.getGuildState() == GuildState.Province)) {
|
if ((sub.getGuildState() == GuildState.Protectorate) ||
|
||||||
|
(sub.getGuildState() == GuildState.Province)) {
|
||||||
this.isCapital = 1;
|
this.isCapital = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -841,7 +827,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
this.setHash();
|
this.setHash();
|
||||||
|
|
||||||
if (!DataWarehouse.recordExists(DataRecordType.CITY, this.getObjectUUID())) {
|
if (DataWarehouse.recordExists(mbEnums.DataRecordType.CITY, this.getObjectUUID()) == false) {
|
||||||
CityRecord cityRecord = CityRecord.borrow(this, mbEnums.RecordEventType.CREATE);
|
CityRecord cityRecord = CityRecord.borrow(this, mbEnums.RecordEventType.CREATE);
|
||||||
DataWarehouse.pushToWarehouse(cityRecord);
|
DataWarehouse.pushToWarehouse(cityRecord);
|
||||||
}
|
}
|
||||||
@@ -866,7 +852,9 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
for (Building building : this.parentZone.zoneBuildingSet) {
|
for (Building building : this.parentZone.zoneBuildingSet) {
|
||||||
|
|
||||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE && building.getBlueprint().getBuildingGroup() != BuildingGroup.TOL) {
|
if (building.getBlueprint() != null &&
|
||||||
|
building.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE &&
|
||||||
|
building.getBlueprint().getBuildingGroup() != BuildingGroup.TOL) {
|
||||||
|
|
||||||
building.healthMax += (building.healthMax * Realm.getRealmHealthMod(this));
|
building.healthMax += (building.healthMax * Realm.getRealmHealthMod(this));
|
||||||
|
|
||||||
@@ -948,7 +936,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
// Reapply effect with timeout?
|
// Reapply effect with timeout?
|
||||||
|
|
||||||
if (refreshEffect)
|
if (refreshEffect == true)
|
||||||
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1204,17 +1192,19 @@ 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() && cityBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE)
|
if (cityBuilding.getBlueprint() != null && !cityBuilding.getBlueprint().isSiegeEquip()
|
||||||
|
&& 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) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK) || (cityBuilding.getBlueprint().isWallPiece()) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) {
|
if ((cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)
|
||||||
PlayerCharacter guildLeader = PlayerCharacter.getPlayerCharacter(sourcePlayer.guild.getGuildLeaderUUID());
|
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE)
|
||||||
if(guildLeader != null)
|
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
||||||
cityBuilding.claim(guildLeader);
|
|| (cityBuilding.getBlueprint().isWallPiece())
|
||||||
else
|
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) {
|
||||||
|
|
||||||
cityBuilding.claim(sourcePlayer);
|
cityBuilding.claim(sourcePlayer);
|
||||||
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
||||||
}
|
}
|
||||||
@@ -1222,7 +1212,6 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
this.setForceRename(true);
|
this.setForceRename(true);
|
||||||
|
|
||||||
|
|
||||||
// Reset city timer for map update
|
// Reset city timer for map update
|
||||||
|
|
||||||
City.lastCityUpdate = System.currentTimeMillis();
|
City.lastCityUpdate = System.currentTimeMillis();
|
||||||
@@ -1255,7 +1244,12 @@ 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) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK) || (cityBuilding.getBlueprint().isWallPiece()) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) {
|
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.claim(sourcePlayer);
|
cityBuilding.claim(sourcePlayer);
|
||||||
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
||||||
@@ -1404,7 +1398,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.templateHashLookup.get(resourceHash));
|
resources.add(ResourceType.hashLookup.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,16 +193,12 @@ 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.resourceHash);
|
writer.putInt(mine.production.hash);
|
||||||
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
|
||||||
@@ -220,7 +220,8 @@ public class Mine extends AbstractGameObject {
|
|||||||
// Only inactive mines are returned.
|
// Only inactive mines are returned.
|
||||||
|
|
||||||
for (Mine mine : Mine.mineMap.keySet()) {
|
for (Mine mine : Mine.mineMap.keySet()) {
|
||||||
if (mine.owningGuild.getObjectUUID() == guildID)
|
if (mine.owningGuild.getObjectUUID() == guildID &&
|
||||||
|
mine.isActive == false)
|
||||||
mineList.add(mine);
|
mineList.add(mine);
|
||||||
}
|
}
|
||||||
return mineList;
|
return mineList;
|
||||||
@@ -392,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.resourceHash);
|
writer.putInt(this.production.hash);
|
||||||
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
|
||||||
@@ -481,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.templateLookup.get(this.production.templateID), this.getModifiedProductionAmount(), this.owningGuild.getOwnedCity().warehouse);
|
return Warehouse.depositFromMine(this, mbEnums.ResourceType.resourceLookup.get(this.production.templateID), this.getModifiedProductionAmount(), this.owningGuild.getOwnedCity().warehouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateGuildOwner(PlayerCharacter playerCharacter) {
|
public boolean updateGuildOwner(PlayerCharacter playerCharacter) {
|
||||||
|
|||||||
@@ -512,6 +512,29 @@ public class NPC extends AbstractCharacter {
|
|||||||
return MinionType.ContractToMinionMap.containsKey(contractID);
|
return MinionType.ContractToMinionMap.containsKey(contractID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean UpdateEquipSetID(NPC npc, int equipSetID) {
|
||||||
|
|
||||||
|
if (!LootManager._bootySetMap.containsKey(equipSetID))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!DbManager.NPCQueries.UPDATE_EQUIPSET(npc, equipSetID))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
npc.equipmentSetID = equipSetID;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean UpdateRaceID(NPC npc, int raceID) {
|
||||||
|
|
||||||
|
if (!DbManager.NPCQueries.UPDATE_MOBBASE(npc, raceID))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
npc.loadID = raceID;
|
||||||
|
npc.mobBase = MobBase.getMobBase(npc.loadID);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static NPCProfits GetNPCProfits(NPC npc) {
|
public static NPCProfits GetNPCProfits(NPC npc) {
|
||||||
return NPCProfits.ProfitCache.get(npc.currentID);
|
return NPCProfits.ProfitCache.get(npc.currentID);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,13 +349,13 @@ public class Resists {
|
|||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Stun))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Stun))
|
||||||
this.immuneTo.put(mbEnums.DamageType.STUN, true);
|
this.immuneTo.put(mbEnums.DamageType.STUN, true);
|
||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind))
|
||||||
this.immuneTo.put(mbEnums.DamageType.BLINDNESS, true);
|
this.immuneTo.put(mbEnums.DamageType.BLIND, true);
|
||||||
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None))
|
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None))
|
||||||
this.immuneTo.put(mbEnums.DamageType.ATTACK, true);
|
this.immuneTo.put(mbEnums.DamageType.ATTACK, true);
|
||||||
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None))
|
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None))
|
||||||
this.immuneTo.put(mbEnums.DamageType.POWERS, true);
|
this.immuneTo.put(mbEnums.DamageType.POWERS, true);
|
||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
||||||
this.immuneTo.put(mbEnums.DamageType.POWERINHIBITOR, true);
|
this.immuneTo.put(mbEnums.DamageType.POWERBLOCK, true);
|
||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff))
|
||||||
this.immuneTo.put(mbEnums.DamageType.DEBUFF, true);
|
this.immuneTo.put(mbEnums.DamageType.DEBUFF, true);
|
||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear))
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class Warehouse {
|
|||||||
if (warehouse == null)
|
if (warehouse == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.templateHashLookup.get(msg.getHashID());
|
mbEnums.ResourceType resourceType = mbEnums.ResourceType.hashLookup.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.templateHashLookup.get(hashID);
|
mbEnums.ResourceType resourceType = mbEnums.ResourceType.hashLookup.get(hashID);
|
||||||
|
|
||||||
// toggle lock
|
// toggle lock
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ public class Warehouse {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.templateLookup.get(resource.templateID);
|
mbEnums.ResourceType resourceType = mbEnums.ResourceType.resourceLookup.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.templateLookup.get(resource.templateID).deposit_limit)
|
if (newAmount > mbEnums.ResourceType.resourceLookup.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.resourceHash, 0);
|
msg.getResources().put(resourceType.hash, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,18 +395,20 @@ public class Warehouse {
|
|||||||
if (newAmount < amount)
|
if (newAmount < amount)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
msg.getResources().put(resourceType.resourceHash, amount);
|
msg.getResources().put(resourceType.hash, amount);
|
||||||
|
|
||||||
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
|
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
|
||||||
msg.getResources().put(resourceType.resourceHash, 0);
|
msg.getResources().put(resourceType.hash, 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,7 +431,7 @@ public class Warehouse {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (addToInventory)
|
if (addToInventory)
|
||||||
if (!itemMan.hasRoomInventory(template.item_wt)) {
|
if (!itemMan.hasRoomInventory(template.item_wt * amount)) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ package engine.powers;
|
|||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.ModType;
|
import engine.mbEnums.ModType;
|
||||||
import engine.mbEnums.SourceType;
|
import engine.mbEnums.SourceType;
|
||||||
import engine.mbEnums.StackType;
|
import engine.mbEnums.StackType;
|
||||||
import engine.objects.*;
|
import engine.objects.AbstractCharacter;
|
||||||
|
import engine.objects.AbstractWorldObject;
|
||||||
|
import engine.objects.PlayerBonuses;
|
||||||
|
import engine.objects.Runegate;
|
||||||
import engine.powers.poweractions.AbstractPowerAction;
|
import engine.powers.poweractions.AbstractPowerAction;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -242,23 +244,32 @@ public class ActionsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add blocked types here
|
//Add blocked types here
|
||||||
public boolean blocked(AbstractWorldObject awo, boolean vampDrain) {
|
public boolean blocked(AbstractWorldObject awo, PowersBase pb, int trains) {
|
||||||
//Check for immunities
|
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
|
||||||
if (AbstractCharacter.IsAbstractCharacter(awo)){
|
AbstractCharacter ac = (AbstractCharacter) awo;
|
||||||
AbstractCharacter pcTarget = (AbstractCharacter) awo;
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
PlayerBonuses bonus = pcTarget.getBonuses();
|
if (bonus == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
if(vampDrain)
|
//TODO make this more efficient then testing strings
|
||||||
return bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
|
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.STUN))
|
||||||
|
return true; //Currently stun immune. Skip stun
|
||||||
if ((this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly)) ||
|
else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.Snare))
|
||||||
(this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))) {
|
return true; //Currently snare immune. Skip snare
|
||||||
|
else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.Blind))
|
||||||
|
return true; //Currently blind immune. Skip blind
|
||||||
|
else if (this.stackType.equals("PowerInhibitor") && bonus.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
||||||
|
return true; //Currently power block immune. Skip power block
|
||||||
|
else if (this.stackType.equals("Root") && bonus.getBool(ModType.ImmuneTo, SourceType.Root))
|
||||||
return true;
|
return true;
|
||||||
}
|
// else if (pb.isHeal() && (bonus.getByte("immuneTo.Heal")) >= trains)
|
||||||
|
// return true; //Currently shadowmantled. Skip heals
|
||||||
mbEnums.DamageType damageType = mbEnums.DamageType.getDamageType(this.stackType.toUpperCase());
|
else if (this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly))
|
||||||
return pcTarget.getResists().immuneTo(damageType);
|
return true;
|
||||||
|
else if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -633,8 +633,15 @@ public class PowersBase {
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean enforceLore(){
|
public boolean ignoreLore(){
|
||||||
return this.powerCategory.equals(PowerCategoryType.SUMMON) || this.powerCategory.equals(PowerCategoryType.HEAL)|| this.powerCategory.equals(PowerCategoryType.BUFF);
|
switch(this.category){
|
||||||
|
case "HEAL":
|
||||||
|
case "BUFF":
|
||||||
|
case "DISPELL":
|
||||||
|
case "SUMMON":
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ 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;
|
||||||
@@ -53,17 +54,15 @@ 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();
|
||||||
@@ -73,31 +72,41 @@ 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
|
||||||
|
|||||||
@@ -95,12 +95,6 @@ public class DestroyCityThread implements Runnable {
|
|||||||
if (cityBuilding == null)
|
if (cityBuilding == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check null bluepritn and log error
|
|
||||||
if (cityBuilding.getBlueprint() == null){
|
|
||||||
Logger.error("Null Blueprint for building ID: " + cityBuilding.getObjectUUID());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do nothing with the banestone. It will be removed elsewhere
|
// Do nothing with the banestone. It will be removed elsewhere
|
||||||
|
|
||||||
if (cityBuilding.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.BANESTONE))
|
if (cityBuilding.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.BANESTONE))
|
||||||
@@ -131,13 +125,6 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,285 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak;
|
|
||||||
|
|
||||||
import engine.gameManager.ConfigManager;
|
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.wpak.data.ConditionEntry;
|
|
||||||
import engine.wpak.data.Effect;
|
|
||||||
import engine.wpak.data.ModifierEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class EffectsParser {
|
|
||||||
|
|
||||||
public static String effectsPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Effects.cfg";
|
|
||||||
private static final Pattern EFFECT_REGEX = Pattern.compile("(?<=EFFECTBEGIN)(.+?)(?=EFFECTEND)", Pattern.DOTALL);
|
|
||||||
private static final Pattern SOURCE_REGEX = Pattern.compile("(?<=SOURCEBEGIN)(.+?)(?=SOURCEEND)", Pattern.DOTALL);
|
|
||||||
private static final Pattern MODS_REGEX = Pattern.compile("(?<=MODSBEGIN)(.+?)(?=MODSEND)", Pattern.DOTALL);
|
|
||||||
private static final Pattern CONDITIONS_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL);
|
|
||||||
private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*"); // Regex ignores spaces within quotes
|
|
||||||
|
|
||||||
public static void parseWpakFile() {
|
|
||||||
|
|
||||||
// Read .wpak file from disk
|
|
||||||
|
|
||||||
byte[] fileData;
|
|
||||||
|
|
||||||
try {
|
|
||||||
fileData = Files.readAllBytes(Paths.get(effectsPath));
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
String fileContents = new String(fileData);
|
|
||||||
|
|
||||||
// Iterate over effect entries from .wpak data
|
|
||||||
|
|
||||||
Matcher matcher = EFFECT_REGEX.matcher(fileContents);
|
|
||||||
|
|
||||||
while (matcher.find()) {
|
|
||||||
try {
|
|
||||||
Effect effect = parseEffectEntry(matcher.group());
|
|
||||||
// WpakPowerManager._effectsLookup.put(effect.effect_id, effect);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error("EFFECT PARSE FAILED: " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Effect parseEffectEntry(String effectData) {
|
|
||||||
|
|
||||||
Effect effect = new Effect();
|
|
||||||
|
|
||||||
// Parse fields that lie outside the other tags
|
|
||||||
|
|
||||||
effect.isItemEffect = effectData.contains("IsItemEffect");
|
|
||||||
effect.isSpireEffect = effectData.contains("IsSpireEffect");
|
|
||||||
effect.ignoreNoMod = effectData.contains("IgnoreNoMod");
|
|
||||||
effect.dontSave = effectData.contains("DontSave");
|
|
||||||
|
|
||||||
// Remove all lines that contain a # and leading/trailing blank lines
|
|
||||||
|
|
||||||
effectData = effectData.replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", "");
|
|
||||||
effectData = effectData.trim();
|
|
||||||
|
|
||||||
// Parse effect entry header
|
|
||||||
|
|
||||||
String firstLine;
|
|
||||||
ArrayList<String> effectHeader = new ArrayList<>();
|
|
||||||
|
|
||||||
// Some effects exist without sources/mods or conditions
|
|
||||||
// (ACID "MOB" 0)
|
|
||||||
|
|
||||||
if (effectData.indexOf('\n') > 0)
|
|
||||||
firstLine = effectData.substring(0, effectData.indexOf('\n'));
|
|
||||||
else
|
|
||||||
firstLine = effectData;
|
|
||||||
|
|
||||||
Matcher matcher = STRSPLIT_REGEX.matcher(firstLine);
|
|
||||||
|
|
||||||
while (matcher.find())
|
|
||||||
effectHeader.add(matcher.group().trim());
|
|
||||||
|
|
||||||
effect.effect_id = effectHeader.get(0);
|
|
||||||
effect.effect_name = effectHeader.get(1);
|
|
||||||
effect.effect_name = effect.effect_name.replaceAll("\"", "");
|
|
||||||
|
|
||||||
// Some effect mods have no icon
|
|
||||||
// (SEEINVIS-SHADE "See Invis")
|
|
||||||
|
|
||||||
if (effectHeader.size() == 3)
|
|
||||||
effect.icon = Integer.parseInt(effectHeader.get(2));
|
|
||||||
else
|
|
||||||
effect.icon = 0;
|
|
||||||
|
|
||||||
// Parse source entries
|
|
||||||
|
|
||||||
matcher = SOURCE_REGEX.matcher(effectData);
|
|
||||||
|
|
||||||
while (matcher.find())
|
|
||||||
effect.sources.add(matcher.group().trim());
|
|
||||||
|
|
||||||
// Parse modifier entries
|
|
||||||
|
|
||||||
matcher = MODS_REGEX.matcher(effectData);
|
|
||||||
|
|
||||||
// Iterate effect entries from .wpak config data
|
|
||||||
|
|
||||||
while (matcher.find()) {
|
|
||||||
ModifierEntry modifierEntry = parseModEntry(matcher.group());
|
|
||||||
effect.mods.add(modifierEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse Conditions
|
|
||||||
|
|
||||||
matcher = CONDITIONS_REGEX.matcher(effectData);
|
|
||||||
|
|
||||||
while (matcher.find()) {
|
|
||||||
String[] conditions = matcher.group().trim().split("\n");
|
|
||||||
|
|
||||||
for (String condition : conditions) {
|
|
||||||
List<String> parameters = Arrays.asList(condition.trim().split("\\s+"));
|
|
||||||
Iterator<String> iterator = parameters.iterator();
|
|
||||||
|
|
||||||
ConditionEntry conditionEntry = new ConditionEntry();
|
|
||||||
conditionEntry.condition = iterator.next();
|
|
||||||
conditionEntry.arg = Integer.parseInt(iterator.next());
|
|
||||||
|
|
||||||
if (iterator.hasNext())
|
|
||||||
conditionEntry.curveType = mbEnums.CompoundCurveType.valueOf(iterator.next());
|
|
||||||
|
|
||||||
while (iterator.hasNext())
|
|
||||||
conditionEntry.damageTypes.add(mbEnums.DamageType.valueOf(iterator.next().toUpperCase()));
|
|
||||||
|
|
||||||
effect.conditions.add(conditionEntry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return effect;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ModifierEntry parseModEntry(String modData) {
|
|
||||||
|
|
||||||
ModifierEntry modifierEntry = new ModifierEntry();
|
|
||||||
|
|
||||||
String[] modEntries = modData.trim().split("\n");
|
|
||||||
|
|
||||||
for (String modEntry : modEntries) {
|
|
||||||
|
|
||||||
ArrayList<String> modValues = new ArrayList<>();
|
|
||||||
Matcher matcher = STRSPLIT_REGEX.matcher(modEntry.trim());
|
|
||||||
|
|
||||||
while (matcher.find())
|
|
||||||
modValues.add(matcher.group().trim());
|
|
||||||
|
|
||||||
modifierEntry.type = mbEnums.ModType.valueOf(modValues.get(0).trim());
|
|
||||||
|
|
||||||
switch (modifierEntry.type) {
|
|
||||||
case AnimOverride:
|
|
||||||
modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
|
|
||||||
modifierEntry.max = Float.parseFloat(modValues.get(2).trim());
|
|
||||||
break;
|
|
||||||
case Health:
|
|
||||||
case Mana:
|
|
||||||
case Stamina:
|
|
||||||
modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
|
|
||||||
modifierEntry.max = Float.parseFloat(modValues.get(2).trim());
|
|
||||||
modifierEntry.percentage = Float.parseFloat(modValues.get(3).trim());
|
|
||||||
modifierEntry.value = Float.parseFloat(modValues.get(4).trim()); // Always zero
|
|
||||||
modifierEntry.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(5).trim());
|
|
||||||
modifierEntry.arg1 = modValues.get(6).trim();
|
|
||||||
break;
|
|
||||||
case Attr:
|
|
||||||
case Resistance:
|
|
||||||
case Skill:
|
|
||||||
case HealthRecoverRate:
|
|
||||||
case ManaRecoverRate:
|
|
||||||
case StaminaRecoverRate:
|
|
||||||
case DamageShield:
|
|
||||||
case HealthFull:
|
|
||||||
case ManaFull:
|
|
||||||
case StaminaFull:
|
|
||||||
case Slay:
|
|
||||||
case Fade:
|
|
||||||
case Durability:
|
|
||||||
modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
|
|
||||||
modifierEntry.max = Float.parseFloat(modValues.get(2).trim());
|
|
||||||
modifierEntry.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(3).trim());
|
|
||||||
|
|
||||||
if (modValues.size() > 4)
|
|
||||||
modifierEntry.arg1 = modValues.get(4).trim(); // Some HeathFull entries do not have an argument
|
|
||||||
break;
|
|
||||||
case MeleeDamageModifier:
|
|
||||||
case OCV:
|
|
||||||
case DCV:
|
|
||||||
case AttackDelay:
|
|
||||||
case AdjustAboveDmgCap:
|
|
||||||
case DamageCap:
|
|
||||||
case ArmorPiercing:
|
|
||||||
case Speed:
|
|
||||||
case PowerDamageModifier:
|
|
||||||
case DR:
|
|
||||||
case PassiveDefense:
|
|
||||||
case MaxDamage:
|
|
||||||
case Value:
|
|
||||||
case WeaponSpeed:
|
|
||||||
case MinDamage:
|
|
||||||
case PowerCost:
|
|
||||||
case Block:
|
|
||||||
case Parry:
|
|
||||||
case Dodge:
|
|
||||||
case WeaponRange:
|
|
||||||
case ScanRange:
|
|
||||||
case ScaleHeight:
|
|
||||||
case ScaleWidth:
|
|
||||||
modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
|
|
||||||
modifierEntry.max = Float.parseFloat(modValues.get(2).trim());
|
|
||||||
modifierEntry.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(3).trim());
|
|
||||||
break;
|
|
||||||
case ItemName:
|
|
||||||
case BlockedPowerType:
|
|
||||||
case ImmuneTo:
|
|
||||||
case BlackMantle:
|
|
||||||
modifierEntry.arg1 = modValues.get(1).trim();
|
|
||||||
|
|
||||||
// Some BlockedPowerType entries have only one argument
|
|
||||||
|
|
||||||
if (modValues.size() > 2)
|
|
||||||
modifierEntry.arg2 = modValues.get(2).trim();
|
|
||||||
break;
|
|
||||||
case NoMod:
|
|
||||||
case ConstrainedAmbidexterity:
|
|
||||||
case ProtectionFrom:
|
|
||||||
case ExclusiveDamageCap:
|
|
||||||
case IgnoreDamageCap:
|
|
||||||
modifierEntry.arg1 = modValues.get(1).trim();
|
|
||||||
break;
|
|
||||||
case WeaponProc:
|
|
||||||
modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
|
|
||||||
modifierEntry.arg1 = modValues.get(2).trim();
|
|
||||||
modifierEntry.max = Float.parseFloat(modValues.get(3).trim());
|
|
||||||
break;
|
|
||||||
case BladeTrails: // These tags have no parms or are not parsed
|
|
||||||
case ImmuneToAttack:
|
|
||||||
case ImmuneToPowers:
|
|
||||||
case Ambidexterity:
|
|
||||||
case Silenced:
|
|
||||||
case IgnorePassiveDefense:
|
|
||||||
case Stunned:
|
|
||||||
case PowerCostHealth:
|
|
||||||
case Charmed:
|
|
||||||
case Fly:
|
|
||||||
case CannotMove:
|
|
||||||
case CannotTrack:
|
|
||||||
case CannotAttack:
|
|
||||||
case CannotCast:
|
|
||||||
case SpireBlock:
|
|
||||||
case Invisible:
|
|
||||||
case SeeInvisible:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Logger.error("Unhandled type: " + modifierEntry.type);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return modifierEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,308 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak;
|
|
||||||
|
|
||||||
import engine.gameManager.ConfigManager;
|
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.wpak.data.Effect;
|
|
||||||
import engine.wpak.data.PowerAction;
|
|
||||||
import engine.wpak.data.StatTransfer;
|
|
||||||
import engine.wpak.data.TrackEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class PowerActionParser {
|
|
||||||
private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*");
|
|
||||||
private static final Pattern POWER_ACTION_REGEX = Pattern.compile("(?<=POWERACTIONBEGIN)(.+?)(?=POWERACTIONEND)", Pattern.DOTALL);
|
|
||||||
private static final String powerActionPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/PowerActions.cfg";
|
|
||||||
|
|
||||||
public static void parseWpakFile() {
|
|
||||||
|
|
||||||
// Read .wpak file from disk
|
|
||||||
|
|
||||||
byte[] fileData;
|
|
||||||
|
|
||||||
try {
|
|
||||||
fileData = Files.readAllBytes(Paths.get(powerActionPath));
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
String fileContents = new String(fileData);
|
|
||||||
|
|
||||||
// Iterate over power entries from .wpak data
|
|
||||||
|
|
||||||
Matcher matcher = POWER_ACTION_REGEX.matcher(fileContents);
|
|
||||||
|
|
||||||
while (matcher.find()) {
|
|
||||||
|
|
||||||
PowerAction powerAction = parsePowerActionEntry(matcher.group().trim());
|
|
||||||
// WpakPowerManager._powerActionLookup.put(Hasher.SBStringHash(powerAction.action_id), powerAction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static PowerAction parsePowerActionEntry(String powerActionData) {
|
|
||||||
|
|
||||||
PowerAction powerAction = new PowerAction();
|
|
||||||
Effect effect;
|
|
||||||
StatTransfer statTransfer;
|
|
||||||
TrackEntry trackEntry;
|
|
||||||
|
|
||||||
// Remove all lines that contain a # and leading/trailing blank lines
|
|
||||||
|
|
||||||
powerActionData = powerActionData.replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", "").trim();
|
|
||||||
|
|
||||||
List<String> lineData = Arrays.asList(powerActionData.split("\n"));
|
|
||||||
|
|
||||||
// Parse effect entry header
|
|
||||||
|
|
||||||
Iterator<String> entryIterator = lineData.iterator();
|
|
||||||
String headerLine = entryIterator.next();
|
|
||||||
List<String> headerData = new ArrayList<>();
|
|
||||||
|
|
||||||
Matcher matcher = STRSPLIT_REGEX.matcher(headerLine.trim());
|
|
||||||
|
|
||||||
while (matcher.find())
|
|
||||||
headerData.add(matcher.group().trim());
|
|
||||||
|
|
||||||
Iterator<String> headerIterator = headerData.iterator();
|
|
||||||
powerAction.action_id = headerIterator.next();
|
|
||||||
powerAction.action_type = mbEnums.PowerActionType.valueOf(headerIterator.next());
|
|
||||||
|
|
||||||
switch (powerAction.action_type) {
|
|
||||||
case RemoveEffect:
|
|
||||||
effect = new Effect();
|
|
||||||
effect.effect_id = headerIterator.next();
|
|
||||||
powerAction.effects.add(effect);
|
|
||||||
break;
|
|
||||||
case CreateMob:
|
|
||||||
powerAction.petRace = Integer.parseInt(headerIterator.next());
|
|
||||||
powerAction.petLevel = Integer.parseInt(headerIterator.next());
|
|
||||||
break;
|
|
||||||
case DamageOverTime:
|
|
||||||
effect = new Effect();
|
|
||||||
effect.effect_id = headerIterator.next();
|
|
||||||
effect.cycleDuration = Integer.parseInt(headerIterator.next());
|
|
||||||
effect.cycleDelay = Integer.parseInt(headerIterator.next());
|
|
||||||
powerAction.effects.add(effect);
|
|
||||||
break;
|
|
||||||
case ApplyEffects:
|
|
||||||
int level = Integer.parseInt(headerIterator.next());
|
|
||||||
|
|
||||||
while (headerIterator.hasNext()) {
|
|
||||||
effect = new Effect();
|
|
||||||
effect.level = level;
|
|
||||||
effect.effect_id = headerIterator.next();
|
|
||||||
powerAction.effects.add(effect);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Transform:
|
|
||||||
case Invis:
|
|
||||||
case ApplyEffect:
|
|
||||||
case DeferredPower:
|
|
||||||
case DirectDamage:
|
|
||||||
case SpireDisable:
|
|
||||||
while (headerIterator.hasNext()) {
|
|
||||||
effect = new Effect();
|
|
||||||
effect.effect_id = headerIterator.next();
|
|
||||||
|
|
||||||
// Some applyEffect entries are naked withot a level
|
|
||||||
|
|
||||||
if (headerData.size() > 3)
|
|
||||||
effect.level = Integer.parseInt(headerIterator.next());
|
|
||||||
|
|
||||||
powerAction.effects.add(effect);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TransferStat:
|
|
||||||
statTransfer = new StatTransfer();
|
|
||||||
statTransfer.fromStat = mbEnums.CostType.valueOf(headerIterator.next());
|
|
||||||
statTransfer.toStat = mbEnums.CostType.valueOf(headerIterator.next());
|
|
||||||
statTransfer.ramp = Float.parseFloat(headerIterator.next());
|
|
||||||
statTransfer.rampCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
|
|
||||||
statTransfer.efficiency = Float.parseFloat(headerIterator.next());
|
|
||||||
statTransfer.efficiencyCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
|
|
||||||
statTransfer.fromStatBool = Boolean.parseBoolean(headerIterator.next());
|
|
||||||
statTransfer.isDrain = Boolean.parseBoolean(headerIterator.next());
|
|
||||||
powerAction.statTransfer = statTransfer;
|
|
||||||
break;
|
|
||||||
case TransferStatOT:
|
|
||||||
statTransfer = new StatTransfer();
|
|
||||||
statTransfer.fromStat = mbEnums.CostType.valueOf(headerIterator.next());
|
|
||||||
statTransfer.toStat = mbEnums.CostType.valueOf(headerIterator.next());
|
|
||||||
statTransfer.ramp = Float.parseFloat(headerIterator.next());
|
|
||||||
statTransfer.rampCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
|
|
||||||
statTransfer.efficiency = Float.parseFloat(headerIterator.next());
|
|
||||||
statTransfer.efficiencyCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
|
|
||||||
statTransfer.fromStatBool = Boolean.parseBoolean(headerIterator.next());
|
|
||||||
statTransfer.isDrain = Boolean.parseBoolean(headerIterator.next());
|
|
||||||
statTransfer.transfer_action = headerIterator.next();
|
|
||||||
statTransfer.transfer_ticks = Integer.parseInt(headerIterator.next());
|
|
||||||
powerAction.statTransfer = statTransfer;
|
|
||||||
break;
|
|
||||||
case Charm:
|
|
||||||
effect = new Effect();
|
|
||||||
effect.effect_id = headerIterator.next();
|
|
||||||
effect.level = Integer.parseInt(headerIterator.next());
|
|
||||||
effect.type = headerIterator.next();
|
|
||||||
powerAction.effects.add(effect);
|
|
||||||
break;
|
|
||||||
case Block:
|
|
||||||
effect = new Effect();
|
|
||||||
effect.effect_id = headerIterator.next();
|
|
||||||
effect.level = Integer.parseInt(headerIterator.next());
|
|
||||||
powerAction.effects.add(effect);
|
|
||||||
break;
|
|
||||||
case Resurrect:
|
|
||||||
powerAction.levelCap = Integer.parseInt(headerIterator.next());
|
|
||||||
break;
|
|
||||||
case SetItemFlag:
|
|
||||||
powerAction.itemFlag = mbEnums.ItemFlags.valueOf(headerIterator.next());
|
|
||||||
break;
|
|
||||||
case Track:
|
|
||||||
trackEntry = new TrackEntry();
|
|
||||||
trackEntry.action_id = headerIterator.next();
|
|
||||||
trackEntry.trackPlayer = Boolean.parseBoolean(headerIterator.next());
|
|
||||||
trackEntry.trackCorpse = Boolean.parseBoolean(headerIterator.next());
|
|
||||||
trackEntry.filter = mbEnums.MonsterType.valueOf(headerIterator.next());
|
|
||||||
trackEntry.min = Integer.parseInt(headerIterator.next());
|
|
||||||
trackEntry.max = Integer.parseInt(headerIterator.next());
|
|
||||||
powerAction.trackEntry = trackEntry;
|
|
||||||
break;
|
|
||||||
case Teleport:
|
|
||||||
if (headerIterator.hasNext())
|
|
||||||
powerAction.ignoreNoTeleSpire = Boolean.parseBoolean(headerIterator.next());
|
|
||||||
break;
|
|
||||||
case Recall: // No arguments for these tags or not parsed
|
|
||||||
case Summon:
|
|
||||||
case TreeChoke:
|
|
||||||
case SimpleDamage:
|
|
||||||
case MobRecall: // One argument always zero
|
|
||||||
case ClearAggro:
|
|
||||||
case ClearNearbyAggro:
|
|
||||||
case Peek:
|
|
||||||
case ClaimMine:
|
|
||||||
case RunegateTeleport:
|
|
||||||
case Steal:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Logger.error("Unhandled type " + powerAction.action_type + " for Pow4erAction: " + powerAction.action_id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process key value pairs after header
|
|
||||||
|
|
||||||
while (entryIterator.hasNext()) {
|
|
||||||
String lineValue = entryIterator.next();
|
|
||||||
List<String> lineValues = Arrays.asList(lineValue.split("="));
|
|
||||||
String key = lineValues.get(0).trim();
|
|
||||||
List<String> arguments;
|
|
||||||
|
|
||||||
switch (key) {
|
|
||||||
case "BODYPARTS":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
|
|
||||||
for (String bodyPart : arguments)
|
|
||||||
powerAction.bodyParts.add(Integer.parseInt(bodyPart));
|
|
||||||
break;
|
|
||||||
case "FEMALEBODYPARTS":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
|
|
||||||
for (String bodyPart : arguments)
|
|
||||||
powerAction.femaleBodyParts.add(Integer.parseInt(bodyPart));
|
|
||||||
break;
|
|
||||||
case "SCALEFACTOR":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
|
|
||||||
for (String scaleFactor : arguments)
|
|
||||||
powerAction.scaleFactor.add(Float.parseFloat(scaleFactor));
|
|
||||||
break;
|
|
||||||
case "ISRESISTABLE":
|
|
||||||
powerAction.isResistible = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "ISAGGRESSIVE":
|
|
||||||
powerAction.isAggressive = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "BLADETRAILS":
|
|
||||||
powerAction.bladeTrails = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "SHOULDSHOWWEAPONS":
|
|
||||||
powerAction.shouldShowWeapons = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "SHOULDSHOWARMOR":
|
|
||||||
powerAction.shouldShowArmor = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "APPLYEFFECTBLANK":
|
|
||||||
powerAction.applyEffectBlank = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "WEAROFFEFFECTBLANK":
|
|
||||||
powerAction.wearOffEffectBlank = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "ATTACKANIMS":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
|
|
||||||
for (String animation : arguments)
|
|
||||||
powerAction.attackAnimations.add(Integer.parseInt(animation));
|
|
||||||
break;
|
|
||||||
case "REMOVEALL":
|
|
||||||
powerAction.removeAll = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "EFFECTID":
|
|
||||||
effect = new Effect();
|
|
||||||
effect.effect_id = lineValues.get(1).trim();
|
|
||||||
powerAction.effects.add(effect);
|
|
||||||
break;
|
|
||||||
case "LEVELCAP":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
powerAction.levelCap = Integer.parseInt(arguments.get(0));
|
|
||||||
|
|
||||||
if (arguments.size() > 1) // Not all level caps have a curve
|
|
||||||
powerAction.levelCapCurve = mbEnums.CompoundCurveType.valueOf(arguments.get(1));
|
|
||||||
break;
|
|
||||||
case "CLEARAGGRO":
|
|
||||||
powerAction.clearAggro = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "TARGETBECOMESPET":
|
|
||||||
powerAction.targetBecomesPet = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "DESTROYOLDPET":
|
|
||||||
powerAction.destroyOldPet = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "DAMAGETYPE":
|
|
||||||
powerAction.damageType = mbEnums.DamageType.valueOf(lineValues.get(1).trim().toUpperCase());
|
|
||||||
break;
|
|
||||||
case "ROOTFSMID":
|
|
||||||
powerAction.rootFsmID = mbEnums.MobBehaviourType.valueOf(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "SPLASHDAMAGE":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
powerAction.splashDamageMin = Integer.parseInt(arguments.get(0));
|
|
||||||
powerAction.splashDamageMax = Integer.parseInt(arguments.get(1));
|
|
||||||
break;
|
|
||||||
case "APPLYEFFECTOTHER":
|
|
||||||
case "APPLYEFFECTSELF":
|
|
||||||
case "WEAROFFEFFECTOTHER": // Keys not parsed go here.
|
|
||||||
case "WEAROFFEFFECTSELF":
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Logger.error("Unhandled variable type:" + key + " for powerAction: " + powerAction.action_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return powerAction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,319 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak;
|
|
||||||
|
|
||||||
import engine.gameManager.ConfigManager;
|
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.wpak.data.*;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class PowersParser {
|
|
||||||
|
|
||||||
private static final Pattern POWER_REGEX = Pattern.compile("(?<=POWERBEGIN)(.+?)(?=POWEREND)", Pattern.DOTALL);
|
|
||||||
private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*");
|
|
||||||
private static final Pattern CONDITION_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL);
|
|
||||||
private static final String powersPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Powers.cfg";
|
|
||||||
|
|
||||||
public static void parseWpakFile() {
|
|
||||||
|
|
||||||
// Read .wpak file from disk
|
|
||||||
|
|
||||||
byte[] fileData;
|
|
||||||
|
|
||||||
try {
|
|
||||||
fileData = Files.readAllBytes(Paths.get(powersPath));
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
String fileContents = new String(fileData);
|
|
||||||
|
|
||||||
// Iterate over power entries from .wpak data
|
|
||||||
|
|
||||||
Matcher matcher = POWER_REGEX.matcher(fileContents);
|
|
||||||
|
|
||||||
while (matcher.find()) {
|
|
||||||
|
|
||||||
Power power = parsePowerEntry(matcher.group().trim());
|
|
||||||
// @TODO WpakPowerManager._powersLookup.put(Hasher.SBStringHash(power.power_id), power);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Power parsePowerEntry(String powerData) {
|
|
||||||
|
|
||||||
Power powerEntry = new Power();
|
|
||||||
StringBuilder conditionBuilder = new StringBuilder();
|
|
||||||
StringBuilder powerBuilder = new StringBuilder();
|
|
||||||
String conditionString;
|
|
||||||
String powerString;
|
|
||||||
java.util.Iterator<String> iterator;
|
|
||||||
java.util.Iterator<String> argumentIterator;
|
|
||||||
int endPos = 0;
|
|
||||||
|
|
||||||
// Separate out any conditions from the power data
|
|
||||||
|
|
||||||
Matcher matcher = CONDITION_REGEX.matcher(powerData);
|
|
||||||
|
|
||||||
while (matcher.find()) {
|
|
||||||
conditionBuilder.append(matcher.group().trim());
|
|
||||||
powerBuilder.append(powerData, endPos, matcher.start());
|
|
||||||
endPos = matcher.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
powerBuilder.append(powerData.substring(endPos));
|
|
||||||
|
|
||||||
// Cleanup dangling tags and lines that contain a # and leading/trailing blank lines
|
|
||||||
|
|
||||||
powerString = powerBuilder.toString().replaceAll("CONDITIONBEGINCONDITIONEND", "")
|
|
||||||
.replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", "");
|
|
||||||
conditionString = conditionBuilder.toString().replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", "");
|
|
||||||
|
|
||||||
// Parse header line in power data
|
|
||||||
|
|
||||||
List<String> lineData = Arrays.asList(powerString.trim().split("\n"));
|
|
||||||
List<String> powerHeader = new ArrayList<>();
|
|
||||||
|
|
||||||
String headerString = lineData.get(0);
|
|
||||||
headerString = headerString.replace("\n", " ");
|
|
||||||
|
|
||||||
matcher = STRSPLIT_REGEX.matcher(headerString);
|
|
||||||
|
|
||||||
while (matcher.find())
|
|
||||||
powerHeader.add(matcher.group().trim());
|
|
||||||
|
|
||||||
iterator = powerHeader.iterator();
|
|
||||||
|
|
||||||
powerEntry.power_id = iterator.next();
|
|
||||||
powerEntry.power = iterator.next().replaceAll("\"", "");
|
|
||||||
|
|
||||||
PowerEntry power = new PowerEntry();
|
|
||||||
power.power_type = mbEnums.PowerType.valueOf(iterator.next());
|
|
||||||
power.icon = Integer.parseInt(iterator.next());
|
|
||||||
power.focusLine = iterator.next().replaceAll("\"", "");
|
|
||||||
powerEntry.powers.add(power);
|
|
||||||
|
|
||||||
String nextValue = iterator.next();
|
|
||||||
|
|
||||||
// Account for second definition
|
|
||||||
|
|
||||||
if (nextValue.equals("SPELL") || nextValue.equals("SKILL")) {
|
|
||||||
power = new PowerEntry();
|
|
||||||
power.power_type = mbEnums.PowerType.valueOf(nextValue);
|
|
||||||
power.icon = Integer.parseInt(iterator.next());
|
|
||||||
power.focusLine = iterator.next().replaceAll("\"", "");
|
|
||||||
powerEntry.powers.add(power);
|
|
||||||
powerEntry.target_type = mbEnums.PowerTargetType.valueOf(iterator.next());
|
|
||||||
} else
|
|
||||||
powerEntry.target_type = mbEnums.PowerTargetType.valueOf(nextValue);
|
|
||||||
|
|
||||||
powerEntry.range = Integer.parseInt(iterator.next());
|
|
||||||
powerEntry.areaType = mbEnums.AreaType.valueOf(iterator.next());
|
|
||||||
powerEntry.areaRange = Integer.parseInt(iterator.next());
|
|
||||||
powerEntry.excludeType = mbEnums.ExcludeType.valueOf(iterator.next());
|
|
||||||
powerEntry.costType = mbEnums.CostType.valueOf(iterator.next());
|
|
||||||
powerEntry.cost = Float.parseFloat(iterator.next());
|
|
||||||
powerEntry.difficulty = Float.parseFloat(iterator.next());
|
|
||||||
powerEntry.precision = Float.parseFloat(iterator.next());
|
|
||||||
// Cleanup init_time in client data which is 0.35.1 or some such
|
|
||||||
powerEntry.init_time = Float.parseFloat(iterator.next().replaceAll("(\\.0)+$", ""));
|
|
||||||
powerEntry.release_time = Float.parseFloat(iterator.next());
|
|
||||||
powerEntry.recycle_time = Float.parseFloat(iterator.next());
|
|
||||||
powerEntry.hitRollYN = Integer.parseInt(iterator.next());
|
|
||||||
powerEntry.castingMode = mbEnums.CastingModeType.valueOf(iterator.next());
|
|
||||||
powerEntry.initAmin = Integer.parseInt(iterator.next());
|
|
||||||
powerEntry.releaseAnim = Integer.parseInt(iterator.next());
|
|
||||||
powerEntry.targetSelect = mbEnums.TargetSelectType.valueOf(iterator.next());
|
|
||||||
|
|
||||||
// Process key value pairs after header
|
|
||||||
|
|
||||||
iterator = lineData.iterator();
|
|
||||||
iterator.next(); // Ignore header
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
|
|
||||||
String lineValue = iterator.next();
|
|
||||||
List<String> lineValues = Arrays.asList(lineValue.split("="));
|
|
||||||
String key = lineValues.get(0).trim();
|
|
||||||
ActionEntry actionEntry;
|
|
||||||
List<String> arguments;
|
|
||||||
Matcher argumentMatcher;
|
|
||||||
|
|
||||||
switch (key) {
|
|
||||||
case "ACTION":
|
|
||||||
actionEntry = new ActionEntry();
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
actionEntry.action_id = arguments.get(0);
|
|
||||||
actionEntry.minTrains = Integer.parseInt(arguments.get(1));
|
|
||||||
actionEntry.maxTrains = Integer.parseInt(arguments.get(2));
|
|
||||||
actionEntry.duration = Float.parseFloat(arguments.get(3));
|
|
||||||
actionEntry.curve = mbEnums.CompoundCurveType.valueOf(arguments.get(4));
|
|
||||||
actionEntry.stackingCategory = arguments.get(5);
|
|
||||||
actionEntry.stackingPriority = Integer.parseInt(arguments.get(6));
|
|
||||||
actionEntry.categoryToPower = mbEnums.CategoryToPowerType.valueOf(arguments.get(7));
|
|
||||||
powerEntry.actionEntries.add(actionEntry);
|
|
||||||
break;
|
|
||||||
case "MaxLevel":
|
|
||||||
powerEntry.maxLevel = Integer.parseInt(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "HateValue":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
powerEntry.hateValue = Integer.parseInt(arguments.get(0));
|
|
||||||
|
|
||||||
// Not all entries have a curve. Defaults to DefaultFlat;
|
|
||||||
|
|
||||||
if (arguments.size() > 1)
|
|
||||||
powerEntry.hateCurve = mbEnums.CompoundCurveType.valueOf(arguments.get(1));
|
|
||||||
break;
|
|
||||||
case "LOOPANIMID":
|
|
||||||
powerEntry.loopAnimID = Integer.parseInt(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "GRANTOVERRIDEVAR":
|
|
||||||
powerEntry.grantOverrideVar = lineValues.get(1).trim();
|
|
||||||
break;
|
|
||||||
case "DESCRIPTION":
|
|
||||||
powerEntry.description.add(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "CATEGORY":
|
|
||||||
powerEntry.category = mbEnums.PowerCategoryType.valueOf(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "CURVE":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
powerEntry.curves.put(arguments.get(0), mbEnums.CompoundCurveType.valueOf(arguments.get(1)));
|
|
||||||
break;
|
|
||||||
case "EQPREREQ":
|
|
||||||
argumentMatcher = STRSPLIT_REGEX.matcher(lineValues.get(1).trim());
|
|
||||||
arguments = new ArrayList<>();
|
|
||||||
|
|
||||||
while (argumentMatcher.find())
|
|
||||||
arguments.add(argumentMatcher.group().trim());
|
|
||||||
|
|
||||||
argumentIterator = arguments.iterator();
|
|
||||||
|
|
||||||
while (argumentIterator.hasNext()) {
|
|
||||||
EquipmentPreReq equipmentPreReq = new EquipmentPreReq();
|
|
||||||
equipmentPreReq.slot = mbEnums.EquipSlotType.valueOf(argumentIterator.next());
|
|
||||||
equipmentPreReq.skill = argumentIterator.next().replaceAll("\"", "");
|
|
||||||
|
|
||||||
if (argumentIterator.hasNext())
|
|
||||||
equipmentPreReq.required = Integer.parseInt(argumentIterator.next());
|
|
||||||
else
|
|
||||||
equipmentPreReq.required = 0;
|
|
||||||
|
|
||||||
powerEntry.equipmentPreReq.add(equipmentPreReq);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "CANCASTWHILEMOVING":
|
|
||||||
powerEntry.canCastWhileMoving = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "CANCASTWHILEFLYING":
|
|
||||||
powerEntry.canCastWhileFlying = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "BLADETRAILS":
|
|
||||||
powerEntry.bladeTrails = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "EFFECTPREREQ":
|
|
||||||
Effect effectPreReq = new Effect();
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
effectPreReq.effect_id = arguments.get(9);
|
|
||||||
effectPreReq.level = Integer.parseInt(arguments.get(1));
|
|
||||||
effectPreReq.message = arguments.get(2);
|
|
||||||
powerEntry.effectPreReqs.add(effectPreReq);
|
|
||||||
break;
|
|
||||||
case "MONSTERTYPERESTRICTS":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
|
|
||||||
for (String restriction : arguments)
|
|
||||||
powerEntry.monsterRestricts.add(mbEnums.MonsterType.valueOf(restriction.trim()));
|
|
||||||
break;
|
|
||||||
case "MONSTERTYPEPREREQS":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
|
|
||||||
for (String restriction : arguments)
|
|
||||||
powerEntry.monsterPrereqs.add(mbEnums.MonsterType.valueOf(restriction.trim()));
|
|
||||||
break;
|
|
||||||
case "SHOULDCHECKPATH":
|
|
||||||
powerEntry.shouldCheckPath = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "STICKY":
|
|
||||||
powerEntry.sticky = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "PULSEINFO":
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
powerEntry.pulseCycle = Integer.parseInt(arguments.get(0));
|
|
||||||
powerEntry.pulseDuration = Integer.parseInt(arguments.get(1));
|
|
||||||
break;
|
|
||||||
case "MAXNUMMOBTARGETS":
|
|
||||||
powerEntry.maxMobTargets = Integer.parseInt(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "MAXNUMPLAYERTARGETS":
|
|
||||||
powerEntry.maxPlayerTargets = Integer.parseInt(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "ISADMINPOWER":
|
|
||||||
powerEntry.isAdminPower = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "ISPROJECTILE":
|
|
||||||
powerEntry.isProjectile = Boolean.parseBoolean(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "CASTERSPULSEPARTICLE":
|
|
||||||
powerEntry.casterPulseParticle = Integer.parseInt(lineValues.get(1).trim());
|
|
||||||
break;
|
|
||||||
case "TARGETEFFECTPREREQS_ORED":
|
|
||||||
Effect preReq = new Effect();
|
|
||||||
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
|
|
||||||
preReq.effect_id = arguments.get(0);
|
|
||||||
preReq.level = Integer.parseInt(arguments.get(1));
|
|
||||||
powerEntry.targetEffectPrereqs.add(preReq);
|
|
||||||
break;
|
|
||||||
case "SOUNDS": // Values not parsed
|
|
||||||
case "APPLYDAMAGESELF":
|
|
||||||
case "APPLYDAMAGECASTER":
|
|
||||||
case "APPLYDAMAGEOTHER":
|
|
||||||
case "APPLYDAMAGETARGET":
|
|
||||||
case "APPLYEFFECTSELF":
|
|
||||||
case "APPLYEFFECTOTHER":
|
|
||||||
case "APPLYEFFECTCASTER":
|
|
||||||
case "APPLYEFFECTTARGET":
|
|
||||||
case "FIZZLEOTHER":
|
|
||||||
case "FIZZLESELF":
|
|
||||||
case "INITSTRING":
|
|
||||||
case "SUCCESSOTHER":
|
|
||||||
case "SUCCESSSELF":
|
|
||||||
case "WEAROFFEFFECTOTHER":
|
|
||||||
case "WEAROFFEFFECTSELF":
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Logger.error("Unhandled variable type:" + key + " for power: " + powerEntry.power_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse power conditions
|
|
||||||
|
|
||||||
if (conditionString.isEmpty() == false) {
|
|
||||||
|
|
||||||
List<String> conditions = Arrays.asList(conditionString.split("\n"));
|
|
||||||
|
|
||||||
for (String condition : conditions) {
|
|
||||||
List<String> parameters = Arrays.asList(condition.trim().split("\\s+"));
|
|
||||||
powerEntry.conditions.put(parameters.get(0), Float.parseFloat(parameters.get(1)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return powerEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import engine.mbEnums;
|
|
||||||
|
|
||||||
public class ActionEntry {
|
|
||||||
|
|
||||||
public String action_id;
|
|
||||||
public int minTrains;
|
|
||||||
public int maxTrains;
|
|
||||||
public float duration;
|
|
||||||
public String stackingCategory;
|
|
||||||
public mbEnums.CompoundCurveType curve;
|
|
||||||
public int stackingPriority;
|
|
||||||
public mbEnums.CategoryToPowerType categoryToPower;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
//
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import engine.mbEnums;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
|
|
||||||
public class ConditionEntry {
|
|
||||||
public String condition;
|
|
||||||
public int arg;
|
|
||||||
public mbEnums.CompoundCurveType curveType;
|
|
||||||
public EnumSet<mbEnums.DamageType> damageTypes = EnumSet.noneOf(mbEnums.DamageType.class);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class Effect {
|
|
||||||
public String effect_id;
|
|
||||||
public String effect_name;
|
|
||||||
public int icon;
|
|
||||||
public HashSet<String> sources = new HashSet<>();
|
|
||||||
public ArrayList<ModifierEntry> mods = new ArrayList<>();
|
|
||||||
public ArrayList<ConditionEntry> conditions = new ArrayList<>();
|
|
||||||
|
|
||||||
// Additional variables outside of tags or parsed
|
|
||||||
// elsewhere from Effects.cfg
|
|
||||||
|
|
||||||
public boolean isItemEffect;
|
|
||||||
public boolean isSpireEffect;
|
|
||||||
public boolean ignoreNoMod;
|
|
||||||
public boolean dontSave;
|
|
||||||
|
|
||||||
public String type;
|
|
||||||
public int level;
|
|
||||||
public String message;
|
|
||||||
public int cycleDuration;
|
|
||||||
public int cycleDelay;
|
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o)
|
|
||||||
return true;
|
|
||||||
if (o == null || getClass() != o.getClass())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Effect effect = (Effect) o;
|
|
||||||
return Objects.equals(effect_id, effect.effect_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return effect_id.hashCode(); // Use only the id field for hashCode
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import engine.mbEnums;
|
|
||||||
|
|
||||||
public class EquipmentPreReq {
|
|
||||||
|
|
||||||
public mbEnums.EquipSlotType slot;
|
|
||||||
public String skill;
|
|
||||||
public int required;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import engine.mbEnums;
|
|
||||||
|
|
||||||
public class ModifierEntry {
|
|
||||||
public mbEnums.ModType type;
|
|
||||||
public float min;
|
|
||||||
public float max;
|
|
||||||
public float percentage;
|
|
||||||
public float value;
|
|
||||||
public mbEnums.CompoundCurveType compoundCurveType;
|
|
||||||
public String arg1; // ItemName "Masterwork" ""
|
|
||||||
public String arg2; // ItemName "" "of the Defender"
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import engine.mbEnums;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class Power {
|
|
||||||
public String power_id;
|
|
||||||
public String power;
|
|
||||||
public ArrayList<PowerEntry> powers = new ArrayList<>();
|
|
||||||
public mbEnums.PowerTargetType target_type;
|
|
||||||
public int range;
|
|
||||||
public mbEnums.AreaType areaType;
|
|
||||||
public int areaRange;
|
|
||||||
public mbEnums.ExcludeType excludeType;
|
|
||||||
public mbEnums.CostType costType;
|
|
||||||
public float cost;
|
|
||||||
public float difficulty;
|
|
||||||
public float precision;
|
|
||||||
public float init_time;
|
|
||||||
public float release_time;
|
|
||||||
public float recycle_time;
|
|
||||||
public int hitRollYN;
|
|
||||||
public mbEnums.CastingModeType castingMode;
|
|
||||||
public int initAmin;
|
|
||||||
public int releaseAnim;
|
|
||||||
public mbEnums.TargetSelectType targetSelect;
|
|
||||||
|
|
||||||
// Additional key/value type power entries
|
|
||||||
|
|
||||||
public ArrayList<ActionEntry> actionEntries = new ArrayList<>();
|
|
||||||
public int maxLevel;
|
|
||||||
public int hateValue;
|
|
||||||
public mbEnums.CompoundCurveType hateCurve = mbEnums.CompoundCurveType.DefaultFlat;
|
|
||||||
public int loopAnimID;
|
|
||||||
public String grantOverrideVar;
|
|
||||||
public ArrayList<String> description = new ArrayList<>();
|
|
||||||
public HashMap<String, mbEnums.CompoundCurveType> curves = new HashMap<>();
|
|
||||||
public mbEnums.PowerCategoryType category;
|
|
||||||
public boolean canCastWhileMoving = false;
|
|
||||||
public boolean bladeTrails = false;
|
|
||||||
public ArrayList<Effect> effectPreReqs = new ArrayList<>();
|
|
||||||
public ArrayList<EquipmentPreReq> equipmentPreReq = new ArrayList<>();
|
|
||||||
public EnumSet<mbEnums.MonsterType> monsterRestricts = EnumSet.noneOf(mbEnums.MonsterType.class);
|
|
||||||
public EnumSet<mbEnums.MonsterType> monsterPrereqs = EnumSet.noneOf(mbEnums.MonsterType.class);
|
|
||||||
public boolean shouldCheckPath = false;
|
|
||||||
public boolean sticky = false;
|
|
||||||
public int pulseCycle;
|
|
||||||
public int pulseDuration;
|
|
||||||
public int maxMobTargets;
|
|
||||||
public int maxPlayerTargets;
|
|
||||||
public boolean isAdminPower = false;
|
|
||||||
public int casterPulseParticle;
|
|
||||||
public ArrayList<Effect> targetEffectPrereqs = new ArrayList<>();
|
|
||||||
public boolean canCastWhileFlying = false;
|
|
||||||
public boolean isProjectile = false;
|
|
||||||
public HashMap<String, Float> conditions = new HashMap<>();
|
|
||||||
|
|
||||||
public boolean isSpell() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSkill() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isChant() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o)
|
|
||||||
return true;
|
|
||||||
if (o == null || getClass() != o.getClass())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Power power = (Power) o;
|
|
||||||
return Objects.equals(power_id, power.power_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return power_id.hashCode(); // Use only the id field for hashCode
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import engine.mbEnums;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class PowerAction {
|
|
||||||
|
|
||||||
// Header values
|
|
||||||
|
|
||||||
public String action_id;
|
|
||||||
public mbEnums.PowerActionType action_type;
|
|
||||||
public ArrayList<Effect> effects = new ArrayList<>();
|
|
||||||
public int petLevel;
|
|
||||||
public int petRace;
|
|
||||||
public StatTransfer statTransfer;
|
|
||||||
public int levelCap;
|
|
||||||
public mbEnums.CompoundCurveType levelCapCurve;
|
|
||||||
public TrackEntry trackEntry;
|
|
||||||
|
|
||||||
// Additional variables after header go here.
|
|
||||||
|
|
||||||
public ArrayList<Integer> bodyParts = new ArrayList<>();
|
|
||||||
public ArrayList<Integer> femaleBodyParts = new ArrayList<>();
|
|
||||||
public boolean shouldShowWeapons = false;
|
|
||||||
public boolean shouldShowArmor = false;
|
|
||||||
public boolean bladeTrails = false;
|
|
||||||
public boolean isResistible = false;
|
|
||||||
public ArrayList<Float> scaleFactor = new ArrayList<>();
|
|
||||||
public ArrayList<Integer> attackAnimations = new ArrayList<>();
|
|
||||||
public boolean isAggressive;
|
|
||||||
public mbEnums.DamageType damageType;
|
|
||||||
public boolean applyEffectBlank = false;
|
|
||||||
public boolean wearOffEffectBlank = false;
|
|
||||||
public boolean removeAll = false;
|
|
||||||
public boolean clearAggro = false;
|
|
||||||
public boolean targetBecomesPet = false;
|
|
||||||
public boolean destroyOldPet = false;
|
|
||||||
public mbEnums.ItemFlags itemFlag;
|
|
||||||
public mbEnums.MobBehaviourType rootFsmID;
|
|
||||||
public int splashDamageMin;
|
|
||||||
public int splashDamageMax;
|
|
||||||
public boolean ignoreNoTeleSpire = false;
|
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o)
|
|
||||||
return true;
|
|
||||||
if (o == null || getClass() != o.getClass())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
PowerAction powerAction = (PowerAction) o;
|
|
||||||
return Objects.equals(action_id, powerAction.action_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return action_id.hashCode(); // Use only the id field for hashCode
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import engine.mbEnums;
|
|
||||||
|
|
||||||
public class PowerEntry {
|
|
||||||
public mbEnums.PowerType power_type;
|
|
||||||
public int icon;
|
|
||||||
public String focusLine;
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2024
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import engine.mbEnums;
|
|
||||||
|
|
||||||
public class StatTransfer {
|
|
||||||
public mbEnums.CostType fromStat;
|
|
||||||
public float ramp;
|
|
||||||
public mbEnums.CompoundCurveType rampCurve;
|
|
||||||
public mbEnums.CostType toStat;
|
|
||||||
public float efficiency;
|
|
||||||
public mbEnums.CompoundCurveType efficiencyCurve;
|
|
||||||
public boolean fromStatBool;
|
|
||||||
public boolean isDrain;
|
|
||||||
public String transfer_action;
|
|
||||||
public int transfer_ticks;
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
package engine.wpak.data;
|
|
||||||
|
|
||||||
import engine.mbEnums;
|
|
||||||
|
|
||||||
public class TrackEntry {
|
|
||||||
|
|
||||||
public String action_id;
|
|
||||||
public Boolean trackPlayer;
|
|
||||||
public Boolean trackCorpse;
|
|
||||||
public mbEnums.MonsterType filter;
|
|
||||||
public int min;
|
|
||||||
public int max;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user