Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 93d80c0005 |
@@ -1,150 +0,0 @@
|
||||
package engine.Dungeons;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Dungeon {
|
||||
|
||||
public static int NoFlyEffectID = -1733819072;
|
||||
public static int NoTeleportEffectID = -1971545187;
|
||||
public static int NoSummonEffectID = 2122002462;
|
||||
public ArrayList<PlayerCharacter> participants;
|
||||
public int maxPerGuild;
|
||||
public Vector3fImmutable entrance;
|
||||
public ArrayList<Mob> dungeon_mobs;
|
||||
public Long respawnTime = 0L;
|
||||
|
||||
public Dungeon(Vector3fImmutable entrance, int maxCount){
|
||||
this.participants = new ArrayList<>();
|
||||
this.entrance = entrance;
|
||||
this.dungeon_mobs = new ArrayList<>();
|
||||
this.maxPerGuild = maxCount;
|
||||
}
|
||||
public void applyDungeonEffects(PlayerCharacter player){
|
||||
EffectsBase noFly = PowersManager.getEffectByToken(NoFlyEffectID);
|
||||
EffectsBase noTele = PowersManager.getEffectByToken(NoTeleportEffectID);
|
||||
EffectsBase noSum = PowersManager.getEffectByToken(NoSummonEffectID);
|
||||
|
||||
if(noFly != null)
|
||||
player.addEffectNoTimer(noFly.getName(),noFly,40,true);
|
||||
|
||||
if(noTele != null)
|
||||
player.addEffectNoTimer(noTele.getName(),noTele,40,true);
|
||||
|
||||
if(noSum != null)
|
||||
player.addEffectNoTimer(noSum.getName(),noSum,40,true);
|
||||
}
|
||||
|
||||
public void removeDungeonEffects(PlayerCharacter player) {
|
||||
EffectsBase noFly = PowersManager.getEffectByToken(NoFlyEffectID);
|
||||
EffectsBase noTele = PowersManager.getEffectByToken(NoTeleportEffectID);
|
||||
EffectsBase noSum = PowersManager.getEffectByToken(NoSummonEffectID);
|
||||
for (Effect eff : player.effects.values()) {
|
||||
if (noFly != null && eff.getEffectsBase().equals(noFly))
|
||||
eff.endEffect();
|
||||
|
||||
if (noTele != null && eff.getEffectsBase().equals(noTele))
|
||||
eff.endEffect();
|
||||
|
||||
if (noSum != null && eff.getEffectsBase().equals(noSum))
|
||||
eff.endEffect();
|
||||
}
|
||||
}
|
||||
|
||||
public static void serializeForClientMsgTeleport(ByteBufferWriter writer) {
|
||||
Guild rulingGuild = Guild.getErrantGuild();
|
||||
Guild rulingNation = Guild.getErrantGuild();
|
||||
|
||||
Zone zone = ZoneManager.getZoneByUUID(994);
|
||||
// Begin Serialzing soverign guild data
|
||||
writer.putInt(Enum.GameObjectType.Zone.ordinal());
|
||||
writer.putInt(994);
|
||||
writer.putString("Whitehorn Citadel");
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
|
||||
writer.putString("Whitehorn Militants"); // guild name
|
||||
writer.putString("In the Citadel, We Fight!"); // motto
|
||||
writer.putString(rulingGuild.getLeadershipType());
|
||||
|
||||
// Serialize guild ruler's name
|
||||
// If tree is abandoned blank out the name
|
||||
// to allow them a rename.
|
||||
|
||||
writer.putString("Kol'roth The Destroyer");//sovreign
|
||||
|
||||
writer.putInt(rulingGuild.getCharter());
|
||||
writer.putInt(0); // always 00000000
|
||||
|
||||
writer.put((byte)1);//set safehold
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1); // *** Refactor: What are these flags?
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
|
||||
GuildTag._serializeForDisplay(rulingGuild.getGuildTag(), writer);
|
||||
GuildTag._serializeForDisplay(rulingNation.getGuildTag(), writer);
|
||||
|
||||
writer.putInt(0);// TODO Implement description text
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 1);
|
||||
|
||||
// Begin serializing nation guild info
|
||||
|
||||
if (rulingNation.isEmptyGuild()) {
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
} else {
|
||||
writer.putInt(rulingNation.getObjectType().ordinal());
|
||||
writer.putInt(rulingNation.getObjectUUID());
|
||||
}
|
||||
|
||||
|
||||
// Serialize nation name
|
||||
|
||||
writer.putString("Whitehorn Militants"); //nation name
|
||||
|
||||
writer.putInt(-1);//city rank, -1 puts it at top of list always
|
||||
|
||||
writer.putInt(0xFFFFFFFF);
|
||||
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putString("Kol'roth The Destroyer");//nation ruler
|
||||
|
||||
writer.putLocalDateTime(LocalDateTime.now());
|
||||
|
||||
//location
|
||||
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(2827951).loc,30f);
|
||||
|
||||
writer.putFloat(loc.x);
|
||||
writer.putFloat(loc.y);
|
||||
writer.putFloat(loc.z);
|
||||
|
||||
writer.putInt(0);
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0x64);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package engine.Dungeons;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class DungeonManager {
|
||||
public static ArrayList<Dungeon> dungeons;
|
||||
|
||||
private static final float dungeonAiRange = 64f;
|
||||
private static final float maxTravel = 64f;
|
||||
|
||||
public static void joinDungeon(PlayerCharacter pc, Dungeon dungeon){
|
||||
if(requestEnter(pc,dungeon)) {
|
||||
dungeon.participants.add(pc);
|
||||
dungeon.applyDungeonEffects(pc);
|
||||
translocateToDungeon(pc, dungeon);
|
||||
}
|
||||
}
|
||||
|
||||
public static void leaveDungeon(PlayerCharacter pc, Dungeon dungeon){
|
||||
dungeon.participants.remove(pc);
|
||||
dungeon.removeDungeonEffects(pc);
|
||||
translocateOutOfDungeon(pc);
|
||||
}
|
||||
|
||||
public static boolean requestEnter(PlayerCharacter pc, Dungeon dungeon){
|
||||
int current = 0;
|
||||
Guild nation = pc.guild.getNation();
|
||||
|
||||
if(nation == null)
|
||||
return false;
|
||||
|
||||
for(PlayerCharacter participant : dungeon.participants){
|
||||
if(participant.guild.getNation().equals(nation)){
|
||||
current ++;
|
||||
}
|
||||
}
|
||||
|
||||
if(current >= dungeon.maxPerGuild)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void translocateToDungeon(PlayerCharacter pc, Dungeon dungeon){
|
||||
pc.teleport(dungeon.entrance);
|
||||
pc.setSafeMode();
|
||||
}
|
||||
|
||||
public static void translocateOutOfDungeon(PlayerCharacter pc){
|
||||
pc.teleport(pc.bindLoc);
|
||||
pc.setSafeMode();
|
||||
}
|
||||
|
||||
public static void pulse_dungeons(){
|
||||
for(Dungeon dungeon : dungeons){
|
||||
|
||||
//early exit, if no players present don't waste resources
|
||||
if(dungeon.participants.isEmpty())
|
||||
continue;
|
||||
|
||||
if(dungeon.respawnTime > 0 && System.currentTimeMillis() > dungeon.respawnTime){
|
||||
respawnMobs(dungeon);
|
||||
}
|
||||
|
||||
//remove any players that have left
|
||||
HashSet<AbstractWorldObject> obj = WorldGrid.getObjectsInRangePartial(dungeon.entrance,4096f,MBServerStatics.MASK_PLAYER);
|
||||
for(PlayerCharacter player : dungeon.participants)
|
||||
if(!obj.contains(player))
|
||||
leaveDungeon(player,dungeon);
|
||||
|
||||
//cycle dungeon mob AI
|
||||
for(Mob mob : dungeon.dungeon_mobs)
|
||||
dungeonMobAI(mob);
|
||||
}
|
||||
}
|
||||
|
||||
public static void dungeonMobAI(Mob mob){
|
||||
|
||||
}
|
||||
|
||||
public static void respawnMobs(Dungeon dungeon){
|
||||
for(Mob mob : dungeon.dungeon_mobs){
|
||||
|
||||
if(!mob.isAlive() && mob.despawned)
|
||||
mob.respawn();
|
||||
|
||||
if(!mob.isAlive() && !mob.despawned){
|
||||
mob.despawn();
|
||||
mob.respawn();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -511,18 +511,6 @@ public enum InterestManager implements Runnable {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
||||
if(pc.equals(player)){
|
||||
try{
|
||||
WorldGrid.RemoveWorldObject(player);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ClientConnection origin = player.getClientConnection();
|
||||
|
||||
if (origin == null)
|
||||
|
||||
@@ -19,7 +19,10 @@ import engine.objects.Account;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class dbAccountHandler extends dbHandlerBase {
|
||||
@@ -275,21 +278,4 @@ public class dbAccountHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void TRASH_CHEATERS() {
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
CallableStatement callableStatement = connection.prepareCall("{CALL BanAccountsWithMachineID()}")) {
|
||||
|
||||
boolean hasResultSet = callableStatement.execute();
|
||||
|
||||
if (!hasResultSet && callableStatement.getUpdateCount() > 0) {
|
||||
Logger.info("TRASHED CHEATERS");
|
||||
} else {
|
||||
Logger.warn("No cheaters to trash.");
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error("Error trashing cheaters: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Dungeons.DungeonManager;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*/
|
||||
public class DungenonCmd extends AbstractDevCmd {
|
||||
|
||||
public DungenonCmd() {
|
||||
super("dungeon");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
Zone parent = ZoneManager.findSmallestZone(pc.loc);
|
||||
if(parent == null)
|
||||
return;
|
||||
|
||||
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(2827951).loc,30f);
|
||||
pc.teleport(loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "indicate mob or building followed by an id and a level";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'/dungeon mob 2001 10'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -303,9 +303,6 @@ public enum CombatManager {
|
||||
//pet to assist in attacking target
|
||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter attacker = (PlayerCharacter)abstractCharacter;
|
||||
if(attacker.combatStats == null){
|
||||
attacker.combatStats = new PlayerCombatStats(attacker);
|
||||
}
|
||||
if(attacker.getPet() != null){
|
||||
Mob pet = attacker.getPet();
|
||||
if(pet.combatTarget == null && pet.assist)
|
||||
@@ -329,13 +326,10 @@ public enum CombatManager {
|
||||
else if (!tar.isActive())
|
||||
return 0;
|
||||
|
||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getTimers().get("Attack" + slot) == null) {
|
||||
if(((PlayerCharacter)target).combatStats == null){
|
||||
((PlayerCharacter)target).combatStats = new PlayerCombatStats(((PlayerCharacter)target));
|
||||
}
|
||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getTimers().get("Attack" + slot) == null)
|
||||
if (!((PlayerCharacter) abstractCharacter).canSee((PlayerCharacter) target))
|
||||
return 0;
|
||||
}
|
||||
|
||||
//must not be immune to all or immune to attack
|
||||
|
||||
Resists res = tar.getResists();
|
||||
@@ -692,9 +686,6 @@ public enum CombatManager {
|
||||
} else {
|
||||
AbstractCharacter tar = (AbstractCharacter) target;
|
||||
if(tar.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
if(((PlayerCharacter)tar).combatStats == null){
|
||||
((PlayerCharacter)tar).combatStats = new PlayerCombatStats((PlayerCharacter)tar);
|
||||
}
|
||||
((PlayerCharacter)tar).combatStats.calculateDefense();
|
||||
defense = ((PlayerCharacter)tar).combatStats.defense;
|
||||
}else {
|
||||
@@ -1006,16 +997,6 @@ public enum CombatManager {
|
||||
if (ac.isAlive() && tarAc != null && tarAc.isAlive())
|
||||
handleDamageShields(ac, tarAc, damage);
|
||||
|
||||
//handle mob hate values
|
||||
if(target.getObjectType().equals(GameObjectType.Mob) && ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
Mob mobTarget = (Mob)target;
|
||||
if(mobTarget.hate_values.containsKey((PlayerCharacter) ac)){
|
||||
mobTarget.hate_values.put((PlayerCharacter) ac,mobTarget.hate_values.get((PlayerCharacter) ac) + damage);
|
||||
}else{
|
||||
mobTarget.hate_values.put((PlayerCharacter) ac, damage);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Apply Weapon power effect if any.
|
||||
@@ -1088,6 +1069,12 @@ public enum CombatManager {
|
||||
|
||||
AbstractCharacter tar = (AbstractCharacter) target;
|
||||
|
||||
if(target.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter) target;
|
||||
if(pc.getRaceID() == 1999)
|
||||
return true;
|
||||
}
|
||||
|
||||
CharacterItemManager acItem = ac.getCharItemManager();
|
||||
CharacterItemManager tarItem = tar.getCharItemManager();
|
||||
|
||||
@@ -1099,12 +1086,6 @@ public enum CombatManager {
|
||||
Item tarMain = tarItem.getItemFromEquipped(1);
|
||||
Item tarOff = tarItem.getItemFromEquipped(2);
|
||||
|
||||
if(target.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter) target;
|
||||
if(pc.getRaceID() == 1999 && !isRanged(acMain) && !isRanged(acOff))
|
||||
return true;
|
||||
}
|
||||
|
||||
return !isRanged(acMain) && !isRanged(acOff) && !isRanged(tarMain) && !isRanged(tarOff);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,430 +0,0 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.AttackJob;
|
||||
import engine.jobs.DeferredPowerJob;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AttackCmdMsg;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.DamageShield;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.powers.effectmodifiers.WeaponProcEffectModifier;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class CombatSystem {
|
||||
|
||||
public static void attemptCombat(AbstractCharacter source, AbstractWorldObject target, boolean mainhand){
|
||||
|
||||
//1. source or target doesn't exist, early exit
|
||||
if(source == null || target == null)
|
||||
return;
|
||||
|
||||
//2. source or target is dead, early exit
|
||||
if(!source.isAlive() || !target.isAlive())
|
||||
return;
|
||||
|
||||
//3. make sure if target is a building to ensure that it is damageable
|
||||
if(target.getObjectType().equals(Enum.GameObjectType.Building)){
|
||||
Building building = (Building)target;
|
||||
if(building.assetIsProtected() || building.getProtectionState().equals(Enum.ProtectionState.NPC))
|
||||
return;
|
||||
}
|
||||
|
||||
//after thought: make sure target is in range of source
|
||||
if(!inRange(source,target,mainhand))
|
||||
return;
|
||||
|
||||
//4. apply any weapon powers and then clear the weapon power memory for the player
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter)source;
|
||||
if(pc.getWeaponPower() != null){
|
||||
pc.getWeaponPower().attack(target,pc.getRange());
|
||||
pc.setWeaponPower(null);
|
||||
}
|
||||
}
|
||||
|
||||
//5. make sure if target is AbstractCharacter to check for defense trigger and passive trigger
|
||||
if(AbstractCharacter.IsAbstractCharacter(target)) {
|
||||
int atr;
|
||||
int def;
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter)source;
|
||||
if(pc.combatStats == null)
|
||||
pc.combatStats = new PlayerCombatStats(pc);
|
||||
atr = (int) pc.combatStats.atrHandOne;
|
||||
if(!mainhand)
|
||||
atr =(int) pc.combatStats.atrHandTwo;
|
||||
|
||||
def = pc.combatStats.defense;
|
||||
} else {
|
||||
atr = (int) ((source.getAtrHandOne() + source.getAtrHandTwo()) * 0.5f);
|
||||
def = source.defenseRating;
|
||||
}
|
||||
|
||||
if(!LandHit(atr,def)) {
|
||||
createTimer(source,mainhand);
|
||||
return;
|
||||
}
|
||||
|
||||
if(source.getBonuses() != null)
|
||||
if(!source.getBonuses().getBool(Enum.ModType.IgnorePassiveDefense, Enum.SourceType.None))
|
||||
if(triggerPassive(source,target)) {
|
||||
createTimer(source,mainhand);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//commence actual combat management
|
||||
|
||||
//6. check for any procs
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter)source;
|
||||
if(pc.getCharItemManager() != null && pc.getCharItemManager().getEquipped() != null){
|
||||
Item weapon = pc.getCharItemManager().getEquipped(1);
|
||||
if(!mainhand)
|
||||
weapon = pc.getCharItemManager().getEquipped(2);
|
||||
if(weapon != null){
|
||||
if(weapon.effects != null){
|
||||
for (Effect eff : weapon.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.WeaponProc)){
|
||||
int procChance = ThreadLocalRandom.current().nextInt(0,101);
|
||||
if (procChance <= MBServerStatics.PROC_CHANCE) {
|
||||
try {
|
||||
((WeaponProcEffectModifier) mod).applyProc(source, target);
|
||||
}catch(Exception e){
|
||||
Logger.error(eff.getName() + " Failed To Cast Proc");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//7. configure damage amounts and type
|
||||
Enum.DamageType damageType = Enum.DamageType.Crush;
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter) source;
|
||||
if(mainhand){
|
||||
min = pc.combatStats.minDamageHandOne;
|
||||
max = pc.combatStats.maxDamageHandOne;
|
||||
}else{
|
||||
min = pc.combatStats.minDamageHandTwo;
|
||||
max = pc.combatStats.maxDamageHandTwo;
|
||||
}
|
||||
}else if (source.getObjectType().equals(Enum.GameObjectType.Mob)) {
|
||||
Mob mob = (Mob) source;
|
||||
min = (int) mob.mobBase.getDamageMin();
|
||||
max = (int) mob.mobBase.getDamageMax();
|
||||
}
|
||||
|
||||
int damage = ThreadLocalRandom.current().nextInt(min,max + 1);
|
||||
|
||||
if(source.getBonuses() != null){
|
||||
damage *= 1 + source.getBonuses().getFloatPercentAll(Enum.ModType.MeleeDamageModifier, Enum.SourceType.None);
|
||||
}
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter) source;
|
||||
damage *= pc.ZergMultiplier;
|
||||
}
|
||||
|
||||
//8. configure the attack message to be sent to the clients
|
||||
int animation = 0;
|
||||
ItemBase wb = null;
|
||||
if(source.getCharItemManager() != null && source.getCharItemManager().getEquipped() != null) {
|
||||
Item weapon = source.getCharItemManager().getEquipped(1);
|
||||
if (!mainhand)
|
||||
weapon = source.getCharItemManager().getEquipped(2);
|
||||
|
||||
if(weapon != null && weapon.getItemBase().getAnimations() != null && !weapon.getItemBase().getAnimations().isEmpty()){
|
||||
animation = weapon.getItemBase().getAnimations().get(0);
|
||||
wb = weapon.getItemBase();
|
||||
damageType = wb.getDamageType();
|
||||
}
|
||||
}
|
||||
|
||||
//9. reduce damage from resists and apply damage shields
|
||||
if(AbstractCharacter.IsAbstractCharacter(target)){
|
||||
AbstractCharacter abs = (AbstractCharacter) target;
|
||||
damage = (int) abs.getResists().getResistedDamage(source, abs,damageType,damage,1);
|
||||
handleDamageShields(source,abs,damage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
sendCombatMessage(source, target, 0f, wb, null, mainhand, animation);
|
||||
|
||||
//if attacker is player, set last attack timestamp
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
updateAttackTimers((PlayerCharacter) source, target);
|
||||
|
||||
//10. cancel all effects that cancel on attack
|
||||
source.cancelOnAttack();
|
||||
}
|
||||
|
||||
public static boolean LandHit(int ATR, int DEF){
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
||||
|
||||
float chance = PlayerCombatStats.getHitChance(ATR,DEF);
|
||||
return chance >= roll;
|
||||
}
|
||||
|
||||
private static void sendCombatMessage(AbstractCharacter source, AbstractWorldObject target, float damage, ItemBase wb, DeferredPowerJob dpj, boolean mainHand, int swingAnimation) {
|
||||
|
||||
if (dpj != null)
|
||||
if (PowersManager.AnimationOverrides.containsKey(dpj.getAction().getEffectID()))
|
||||
swingAnimation = PowersManager.AnimationOverrides.get(dpj.getAction().getEffectID());
|
||||
|
||||
if (source.getObjectType() == Enum.GameObjectType.PlayerCharacter)
|
||||
for (Effect eff : source.getEffects().values())
|
||||
if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 || eff.getPower().getToken() == 429415295))
|
||||
swingAnimation = 0;
|
||||
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(source, target, damage, swingAnimation);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
}
|
||||
|
||||
private static void updateAttackTimers(PlayerCharacter pc, AbstractWorldObject target) {
|
||||
|
||||
//Set Attack Timers
|
||||
|
||||
if (target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
pc.setLastPlayerAttackTime();
|
||||
}
|
||||
|
||||
public static void handleDamageShields(AbstractCharacter ac, AbstractCharacter target, float damage) {
|
||||
|
||||
if (ac == null || target == null)
|
||||
return;
|
||||
|
||||
PlayerBonuses bonuses = target.getBonuses();
|
||||
|
||||
if (bonuses != null) {
|
||||
|
||||
ConcurrentHashMap<AbstractEffectModifier, DamageShield> damageShields = bonuses.getDamageShields();
|
||||
float total = 0;
|
||||
|
||||
for (DamageShield ds : damageShields.values()) {
|
||||
|
||||
//get amount to damage back
|
||||
|
||||
float amount;
|
||||
|
||||
if (ds.usePercent())
|
||||
amount = damage * ds.getAmount() / 100;
|
||||
else
|
||||
amount = ds.getAmount();
|
||||
|
||||
//get resisted damage for damagetype
|
||||
|
||||
Resists resists = ac.getResists();
|
||||
|
||||
if (resists != null) {
|
||||
amount = resists.getResistedDamage(target, ac, ds.getDamageType(), amount, 0);
|
||||
}
|
||||
total += amount;
|
||||
}
|
||||
|
||||
if (total > 0) {
|
||||
|
||||
//apply Damage back
|
||||
|
||||
ac.modifyHealth(-total, target, true);
|
||||
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(ac, ac, total, 0);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean inRange(AbstractCharacter source, AbstractWorldObject target, boolean mainhand){
|
||||
|
||||
if(source == null || target == null)
|
||||
return false;
|
||||
|
||||
float distanceSquared = source.loc.distanceSquared(target.loc);
|
||||
|
||||
float rangeSquared = 16.0f;
|
||||
|
||||
if(source.getCharItemManager() != null && source.getCharItemManager().getEquipped() != null){
|
||||
Item weapon = source.getCharItemManager().getEquipped(1);
|
||||
if(!mainhand)
|
||||
weapon = source.getCharItemManager().getEquipped(2);
|
||||
if(weapon != null)
|
||||
rangeSquared = weapon.getItemBase().getRange() * weapon.getItemBase().getRange();
|
||||
}
|
||||
|
||||
if(source.getBonuses() != null){
|
||||
rangeSquared *= 1 + source.getBonuses().getFloatPercentAll(Enum.ModType.WeaponRange, Enum.SourceType.None);
|
||||
}
|
||||
|
||||
return distanceSquared <= rangeSquared;
|
||||
}
|
||||
|
||||
public static boolean triggerPassive(AbstractCharacter source, AbstractWorldObject target) {
|
||||
boolean passiveFired = false;
|
||||
|
||||
if (!AbstractCharacter.IsAbstractCharacter(target))
|
||||
return false;
|
||||
|
||||
AbstractCharacter tarAc = (AbstractCharacter) target;
|
||||
//Handle Block passive
|
||||
if (testPassive(source, tarAc, "Block")) {
|
||||
sendPassiveDefenseMessage(source, null, target, MBServerStatics.COMBAT_SEND_DODGE, null, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//Handle Parry passive
|
||||
if (testPassive(source, tarAc, "Parry")) {
|
||||
sendPassiveDefenseMessage(source, null, target, MBServerStatics.COMBAT_SEND_DODGE, null, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//Handle Dodge passive
|
||||
if (testPassive(source, tarAc, "Dodge")) {
|
||||
sendPassiveDefenseMessage(source, null, target, MBServerStatics.COMBAT_SEND_DODGE, null, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemBase wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) {
|
||||
|
||||
int swingAnimation = 75;
|
||||
|
||||
if (dpj != null)
|
||||
if (PowersManager.AnimationOverrides.containsKey(dpj.getAction().getEffectID()))
|
||||
swingAnimation = PowersManager.AnimationOverrides.get(dpj.getAction().getEffectID());
|
||||
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(source, swingAnimation, target, passiveType);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
}
|
||||
|
||||
private static boolean testPassive(AbstractCharacter source, AbstractCharacter target, String type) {
|
||||
|
||||
if(target.getBonuses() != null)
|
||||
if(target.getBonuses().getBool(Enum.ModType.Stunned, Enum.SourceType.None))
|
||||
return false;
|
||||
|
||||
float chance = target.getPassiveChance(type, source.getLevel(), true);
|
||||
|
||||
if (chance == 0f)
|
||||
return false;
|
||||
|
||||
//max 75% chance of passive to fire
|
||||
|
||||
if (chance > 75f)
|
||||
chance = 75f;
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(1,100);
|
||||
|
||||
return roll < chance;
|
||||
|
||||
}
|
||||
|
||||
private static void createTimer(AbstractCharacter source, boolean mainhand) {
|
||||
|
||||
ConcurrentHashMap<String, JobContainer> timers = source.getTimers();
|
||||
int slot = 1;
|
||||
if(!mainhand)
|
||||
slot = 2;
|
||||
|
||||
int time = 3000;
|
||||
if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter)source;
|
||||
if(mainhand){
|
||||
time = (int) pc.combatStats.attackSpeedHandOne;
|
||||
}else{
|
||||
time = (int) pc.combatStats.attackSpeedHandTwo;
|
||||
}
|
||||
}
|
||||
|
||||
if (timers != null) {
|
||||
AttackJob aj = new AttackJob(source, slot, true);
|
||||
JobContainer job;
|
||||
job = JobScheduler.getInstance().scheduleJob(aj, (time * 100));
|
||||
timers.put("Attack" + slot, job);
|
||||
} else {
|
||||
Logger.error("Unable to find Timers for Character " + source.getObjectUUID());
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAttackTarget(AttackCmdMsg msg, ClientConnection origin) throws MsgSendException {
|
||||
|
||||
PlayerCharacter player;
|
||||
int targetType;
|
||||
AbstractWorldObject target;
|
||||
|
||||
if (TargetedActionMsg.un2cnt == 60 || TargetedActionMsg.un2cnt == 70)
|
||||
return;
|
||||
|
||||
player = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
//source must match player this account belongs to
|
||||
|
||||
if (player.getObjectUUID() != msg.getSourceID() || player.getObjectType().ordinal() != msg.getSourceType()) {
|
||||
Logger.error("Msg Source ID " + msg.getSourceID() + " Does not Match Player ID " + player.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
|
||||
targetType = msg.getTargetType();
|
||||
|
||||
if (targetType == Enum.GameObjectType.PlayerCharacter.ordinal()) {
|
||||
target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||
} else if (targetType == Enum.GameObjectType.Building.ordinal()) {
|
||||
target = BuildingManager.getBuildingFromCache(msg.getTargetID());
|
||||
} else if (targetType == Enum.GameObjectType.Mob.ordinal()) {
|
||||
target = Mob.getFromCache(msg.getTargetID());
|
||||
} else {
|
||||
player.setCombatTarget(null);
|
||||
return; //not valid type to attack
|
||||
}
|
||||
|
||||
// quit of the combat target is already the current combat target
|
||||
// or there is no combat target
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//set sources target
|
||||
|
||||
player.setCombatTarget(target);
|
||||
|
||||
boolean hasMain = false;
|
||||
boolean hasOff = false;
|
||||
if(player.getCharItemManager() != null && player.getCharItemManager().getEquipped() != null){
|
||||
if(player.getCharItemManager().getEquipped(1) != null)
|
||||
hasMain = true;
|
||||
if(player.getCharItemManager().getEquipped(2) != null && !player.getCharItemManager().getEquipped(2).getItemBase().isShield())
|
||||
hasOff = true;
|
||||
}
|
||||
|
||||
if(hasMain){
|
||||
createTimer(player,true);
|
||||
}
|
||||
|
||||
if(hasOff){
|
||||
createTimer(player,false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,6 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new AddBuildingCmd());
|
||||
DevCmdManager.registerDevCmd(new AddNPCCmd());
|
||||
DevCmdManager.registerDevCmd(new AddMobCmd());
|
||||
DevCmdManager.registerDevCmd(new DungenonCmd());
|
||||
DevCmdManager.registerDevCmd(new RemoveObjectCmd());
|
||||
DevCmdManager.registerDevCmd(new RotateCmd());
|
||||
DevCmdManager.registerDevCmd(new FlashMsgCmd());
|
||||
|
||||
@@ -174,27 +174,15 @@ public enum PowersManager {
|
||||
|
||||
if(pc.isMoving())
|
||||
pc.stopMovement(pc.getMovementLoc());
|
||||
if(msg.getPowerUsedID() != 421084024 && origin.getPlayerCharacter().getPromotionClassID() != 2513) {
|
||||
if (!origin.getPlayerCharacter().getPowers().containsKey(msg.getPowerUsedID())) {
|
||||
Logger.error(origin.getPlayerCharacter().getFirstName() + " attempted to cast a power they do not have");
|
||||
return;
|
||||
}
|
||||
|
||||
if(msg.getPowerUsedID() == 429429978){
|
||||
applyPower(origin.getPlayerCharacter(),origin.getPlayerCharacter(),origin.getPlayerCharacter().getLoc(),429429978,msg.getNumTrains(),false);
|
||||
origin.getPlayerCharacter().getRecycleTimers().remove(429429978);
|
||||
return;
|
||||
}
|
||||
//crusader sacrifice
|
||||
if((msg.getPowerUsedID() == 428695403 && msg.getTargetID() == pc.getObjectUUID())){
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
// Send Fail to cast message
|
||||
if (pc != null) {
|
||||
sendPowerMsg(pc, 2, msg);
|
||||
if (pc.isCasting()) {
|
||||
pc.update(false);
|
||||
}
|
||||
|
||||
pc.setIsCasting(false);
|
||||
}
|
||||
if(!origin.getPlayerCharacter().getPowers().containsKey(msg.getPowerUsedID())){
|
||||
Logger.error(origin.getPlayerCharacter().getFirstName() + " attempted to cast a power they do not have");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,10 +204,6 @@ public enum PowersManager {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(msg.getPowerUsedID() == 429429978){
|
||||
origin.getPlayerCharacter().getRecycleTimers().remove(429429978);
|
||||
}
|
||||
}
|
||||
|
||||
public static void useMobPower(Mob caster, AbstractCharacter target, PowersBase pb, int rank) {
|
||||
@@ -1176,18 +1160,7 @@ public enum PowersManager {
|
||||
|
||||
|
||||
//DispatchMessage.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
//handle mob hate values
|
||||
HashSet<AbstractWorldObject> mobs = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,60.0f,MBServerStatics.MASK_MOB);
|
||||
for(AbstractWorldObject awo : mobs){
|
||||
Mob mobTarget = (Mob)awo;
|
||||
if(mobTarget.hate_values != null) {
|
||||
if (mobTarget.hate_values.containsKey(playerCharacter)) {
|
||||
mobTarget.hate_values.put(playerCharacter, mobTarget.hate_values.get(playerCharacter) + pb.getHateValue(trains));
|
||||
} else {
|
||||
mobTarget.hate_values.put(playerCharacter, pb.getHateValue(trains));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
+85
-107
@@ -27,7 +27,6 @@ import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -95,7 +94,7 @@ public class MobAI {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,9 +133,6 @@ public class MobAI {
|
||||
if (mob.isMoving() && mob.getRange() > 20)
|
||||
return;
|
||||
|
||||
if(target.combatStats == null)
|
||||
target.combatStats = new PlayerCombatStats(target);
|
||||
|
||||
// add timer for last attack.
|
||||
|
||||
ItemBase mainHand = mob.getWeaponItemBase(true);
|
||||
@@ -174,7 +170,7 @@ public class MobAI {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackPlayer" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackPlayer" + " " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -232,7 +228,7 @@ public class MobAI {
|
||||
//}
|
||||
|
||||
} catch (Exception e) {
|
||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +267,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +320,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,7 +364,7 @@ public class MobAI {
|
||||
return mob.nextCastTime <= System.currentTimeMillis();
|
||||
|
||||
} catch (Exception e) {
|
||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: canCast" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: canCast" + " " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -454,7 +450,7 @@ public class MobAI {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -576,7 +572,7 @@ public class MobAI {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -612,7 +608,7 @@ public class MobAI {
|
||||
mob.nextCallForHelp = System.currentTimeMillis() + 60000;
|
||||
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCallForHelp" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCallForHelp" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,14 +729,12 @@ public class MobAI {
|
||||
if(mob.isAlive())
|
||||
RecoverHealth(mob);
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckForAggro(Mob aiAgent) {
|
||||
|
||||
|
||||
//old system
|
||||
try {
|
||||
|
||||
//looks for and sets mobs combatTarget
|
||||
@@ -775,11 +769,13 @@ public class MobAI {
|
||||
continue;
|
||||
|
||||
// No aggro for this race type
|
||||
if (aiAgent.notEnemy.size() > 0 && aiAgent.notEnemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
||||
|
||||
if (aiAgent.notEnemy.size() > 0 && aiAgent.notEnemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()) == true)
|
||||
continue;
|
||||
|
||||
//mob has enemies and this player race is not it
|
||||
if (aiAgent.enemy.size() > 0 && !aiAgent.enemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
||||
|
||||
if (aiAgent.enemy.size() > 0 && aiAgent.enemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()) == false)
|
||||
continue;
|
||||
|
||||
if (MovementUtilities.inRangeToAggro(aiAgent, loadedPlayer)) {
|
||||
@@ -808,7 +804,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForAggro" + " " + e.getMessage());
|
||||
Logger.info(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForAggro" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -869,7 +865,7 @@ public class MobAI {
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -923,7 +919,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForRespawn" + " " + e.getMessage());
|
||||
Logger.info(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForRespawn" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,7 +945,7 @@ public class MobAI {
|
||||
AttackTarget(mob, mob.getCombatTarget());
|
||||
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForAttack" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForAttack" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -976,8 +972,7 @@ public class MobAI {
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
} else {
|
||||
if(mob.combatTarget == null)
|
||||
NewAggroMechanic(mob);
|
||||
CheckForAggro(mob);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,7 +1006,7 @@ public class MobAI {
|
||||
mob.setCombatTarget(null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1054,7 +1049,7 @@ public class MobAI {
|
||||
mob.updateMovementState();
|
||||
mob.updateLocation();
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: chaseTarget" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: chaseTarget" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1086,7 +1081,7 @@ public class MobAI {
|
||||
mob.setCombatTarget(aggroMob);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: SafeGuardAggro" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: SafeGuardAggro" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1109,10 +1104,21 @@ public class MobAI {
|
||||
if (mob.getCombatTarget() == null)
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
|
||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||
|
||||
if (newTarget != null) {
|
||||
|
||||
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
||||
mob.setCombatTarget(newTarget);
|
||||
} else
|
||||
mob.setCombatTarget(newTarget);
|
||||
|
||||
}
|
||||
CheckMobMovement(mob);
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1134,7 +1140,7 @@ public class MobAI {
|
||||
CheckMobMovement(mob);
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1148,7 +1154,7 @@ public class MobAI {
|
||||
else
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardWallArcherLogic" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardWallArcherLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1169,7 +1175,7 @@ public class MobAI {
|
||||
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1185,7 +1191,7 @@ public class MobAI {
|
||||
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: HamletGuardLogic" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: HamletGuardLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1200,11 +1206,17 @@ public class MobAI {
|
||||
|
||||
if (mob.BehaviourType.isAgressive) {
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
|
||||
SafeGuardAggro(mob); //safehold guard
|
||||
else
|
||||
NewAggroMechanic(mob);//CheckForAggro(mob); //normal aggro
|
||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||
|
||||
if (newTarget != null)
|
||||
mob.setCombatTarget(newTarget);
|
||||
else {
|
||||
if (mob.getCombatTarget() == null) {
|
||||
if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
|
||||
SafeGuardAggro(mob); //safehold guard
|
||||
else
|
||||
CheckForAggro(mob); //normal aggro
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1220,7 +1232,7 @@ public class MobAI {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DefaultLogic" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DefaultLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1270,7 +1282,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForPlayerGuardAggro" + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForPlayerGuardAggro" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1333,7 +1345,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCanAggro" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCanAggro" + " " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1382,10 +1394,41 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: randomGuardPatrolPoints" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: randomGuardPatrolPoints" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static AbstractWorldObject ChangeTargetFromHateValue(Mob mob) {
|
||||
|
||||
try {
|
||||
|
||||
float CurrentHateValue = 0;
|
||||
|
||||
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
CurrentHateValue = ((PlayerCharacter) mob.getCombatTarget()).getHateValue();
|
||||
|
||||
AbstractWorldObject mostHatedTarget = null;
|
||||
|
||||
for (Entry playerEntry : mob.playerAgroMap.entrySet()) {
|
||||
|
||||
PlayerCharacter potentialTarget = PlayerCharacter.getFromCache((int) playerEntry.getKey());
|
||||
|
||||
if (potentialTarget.equals(mob.getCombatTarget()))
|
||||
continue;
|
||||
|
||||
if (potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
CurrentHateValue = potentialTarget.getHateValue();
|
||||
mostHatedTarget = potentialTarget;
|
||||
}
|
||||
|
||||
}
|
||||
return mostHatedTarget;
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: ChangeTargetFromMostHated" + " " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void RecoverHealth(Mob mob) {
|
||||
//recover health
|
||||
try {
|
||||
@@ -1403,7 +1446,7 @@ public class MobAI {
|
||||
mob.setHealth(mob.getHealthMax());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: RecoverHealth" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: RecoverHealth" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1413,69 +1456,4 @@ public class MobAI {
|
||||
rwss.setPlayer(mob);
|
||||
DispatchMessage.sendToAllInRange(mob, rwss);
|
||||
}
|
||||
|
||||
public static void NewAggroMechanic(Mob mob){
|
||||
|
||||
if(mob == null || !mob.isAlive() || mob.playerAgroMap.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.HamletGuard)){
|
||||
return;
|
||||
}
|
||||
|
||||
if(mob.hate_values == null)
|
||||
mob.hate_values = new HashMap<>();
|
||||
|
||||
if(mob.combatTarget != null)
|
||||
return;
|
||||
|
||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(mob.loc,60.0f,MBServerStatics.MASK_PLAYER);
|
||||
|
||||
if(inRange.isEmpty()){
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
//clear out any players who are not in hated range anymore
|
||||
ArrayList<PlayerCharacter> toRemove = new ArrayList<>();
|
||||
for(PlayerCharacter pc : mob.hate_values.keySet()){
|
||||
if(!inRange.contains(pc))
|
||||
toRemove.add(pc);
|
||||
}
|
||||
for(PlayerCharacter pc : toRemove){
|
||||
mob.hate_values.remove(pc);
|
||||
}
|
||||
|
||||
//find most hated target
|
||||
PlayerCharacter mostHated = (PlayerCharacter)inRange.iterator().next();
|
||||
for(AbstractWorldObject awo : inRange){
|
||||
PlayerCharacter loadedPlayer = (PlayerCharacter)awo;
|
||||
if (loadedPlayer == null)
|
||||
continue;
|
||||
|
||||
//Player is Dead, Mob no longer needs to attempt to aggro. Remove them from aggro map.
|
||||
if (!loadedPlayer.isAlive())
|
||||
continue;
|
||||
|
||||
//Can't see target, skip aggro.
|
||||
if (!mob.canSee(loadedPlayer))
|
||||
continue;
|
||||
|
||||
// No aggro for this race type
|
||||
if (mob.notEnemy != null && mob.notEnemy.size() > 0 && mob.notEnemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
||||
continue;
|
||||
|
||||
//mob has enemies and this player race is not it
|
||||
if (mob.enemy != null && mob.enemy.size() > 0 && !mob.enemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
||||
continue;
|
||||
|
||||
if(mob.hate_values.containsKey(loadedPlayer))
|
||||
if(mob.hate_values.get(loadedPlayer) > mob.hate_values.get(mostHated))
|
||||
mostHated = loadedPlayer;
|
||||
}
|
||||
|
||||
if(mostHated != null)
|
||||
mob.setCombatTarget(mostHated);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package engine.mobileAI.MobBehaviours;
|
||||
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.objects.Mob;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
public class Pet {
|
||||
|
||||
public static void run(Mob pet){
|
||||
|
||||
try {
|
||||
|
||||
if(StaticBehaviours.EarlyExit(pet))
|
||||
return;
|
||||
|
||||
if (pet.getOwner() == null && pet.isNecroPet() == false && pet.isSiege() == false)
|
||||
if (ZoneManager.getSeaFloor().zoneMobSet.contains(pet))
|
||||
pet.killCharacter("no owner");
|
||||
|
||||
if(!pet.isSiege())
|
||||
pet.BehaviourType.canRoam = true;
|
||||
|
||||
|
||||
if (MovementUtilities.canMove(pet) && pet.BehaviourType.canRoam)
|
||||
StaticBehaviours.CheckMobMovement(pet);
|
||||
|
||||
StaticBehaviours.CheckForAttack(pet);
|
||||
} catch (Exception e) {
|
||||
Logger.info(pet.getObjectUUID() + " " + pet.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package engine.mobileAI.MobBehaviours;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
public class PlayerGuard {
|
||||
|
||||
public static void run(Mob guard) {
|
||||
|
||||
if(StaticBehaviours.EarlyExit(guard))
|
||||
return;
|
||||
|
||||
if (guard.mobPowers.isEmpty()) {
|
||||
//mele
|
||||
if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardWallArcher)) {
|
||||
GuardWallArcherLogic(guard);
|
||||
} else {
|
||||
if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
||||
GuardCaptainLogic(guard);
|
||||
} else if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
||||
GuardMinionLogic(guard);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//caster
|
||||
if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
||||
MagisterCaptainLogic(guard);
|
||||
} else if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
||||
MagisterMinionLogic(guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GuardCaptainLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
StaticBehaviours.checkToDropGuardAggro(mob);
|
||||
if (mob.getCombatTarget() == null)
|
||||
StaticBehaviours.CheckForPlayerGuardAggro(mob);
|
||||
|
||||
AbstractWorldObject newTarget = StaticBehaviours.ChangeTargetFromHateValue(mob);
|
||||
|
||||
if (newTarget != null) {
|
||||
|
||||
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (StaticBehaviours.GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
||||
mob.setCombatTarget(newTarget);
|
||||
} else
|
||||
mob.setCombatTarget(newTarget);
|
||||
|
||||
}
|
||||
StaticBehaviours.CheckMobMovement(mob);
|
||||
StaticBehaviours.CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void GuardMinionLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
StaticBehaviours.checkToDropGuardAggro(mob);
|
||||
|
||||
boolean isComanded = mob.npcOwner.isAlive();
|
||||
if (!isComanded) {
|
||||
GuardCaptainLogic(mob);
|
||||
}else {
|
||||
if (mob.npcOwner.getCombatTarget() != null)
|
||||
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
||||
else
|
||||
if (mob.getCombatTarget() != null)
|
||||
mob.setCombatTarget(null);
|
||||
}
|
||||
StaticBehaviours.CheckMobMovement(mob);
|
||||
StaticBehaviours.CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void GuardWallArcherLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
StaticBehaviours.checkToDropGuardAggro(mob);
|
||||
|
||||
if (mob.getCombatTarget() == null)
|
||||
StaticBehaviours.CheckForPlayerGuardAggro(mob);
|
||||
else
|
||||
StaticBehaviours.CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardWallArcherLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void MagisterCaptainLogic(Mob mob){
|
||||
try {
|
||||
StaticBehaviours.checkToDropGuardAggro(mob);
|
||||
if (mob.getCombatTarget() == null)
|
||||
StaticBehaviours.CheckForPlayerGuardAggro(mob);
|
||||
|
||||
AbstractWorldObject newTarget = StaticBehaviours.ChangeTargetFromHateValue(mob);
|
||||
|
||||
if (newTarget != null) {
|
||||
|
||||
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (StaticBehaviours.GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
||||
mob.setCombatTarget(newTarget);
|
||||
} else
|
||||
mob.setCombatTarget(newTarget);
|
||||
|
||||
}
|
||||
StaticBehaviours.CheckMobMovement(mob);
|
||||
CheckForCast(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void MagisterMinionLogic(Mob mob){
|
||||
try {
|
||||
StaticBehaviours.checkToDropGuardAggro(mob);
|
||||
|
||||
boolean isComanded = mob.npcOwner.isAlive();
|
||||
if (!isComanded) {
|
||||
MagisterCaptainLogic(mob);
|
||||
}else {
|
||||
if (mob.npcOwner.getCombatTarget() != null)
|
||||
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
||||
else
|
||||
if (mob.getCombatTarget() != null)
|
||||
mob.setCombatTarget(null);
|
||||
}
|
||||
StaticBehaviours.CheckMobMovement(mob);
|
||||
CheckForCast(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckForCast(Mob mob){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package engine.mobileAI.MobBehaviours;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class SiegeEngine {
|
||||
|
||||
public static void run(Mob engine){
|
||||
|
||||
if(StaticBehaviours.EarlyExit(engine))
|
||||
return;
|
||||
|
||||
if(engine.getOwner() == null)
|
||||
return;
|
||||
|
||||
if(engine.combatTarget == null)
|
||||
return;
|
||||
|
||||
if(engine.combatTarget.loc.distanceSquared(engine.loc) > engine.getRange() * engine.getRange())
|
||||
return;
|
||||
|
||||
if(!engine.combatTarget.getObjectType().equals(Enum.GameObjectType.Building))
|
||||
return;
|
||||
|
||||
StaticBehaviours.CheckForAttack(engine);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package engine.mobileAI.MobBehaviours;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Mob;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
public class Standard {
|
||||
|
||||
public static void run(Mob mob){
|
||||
|
||||
try {
|
||||
|
||||
if(StaticBehaviours.EarlyExit(mob))
|
||||
return;
|
||||
|
||||
//check for players that can be aggroed if mob is agressive and has no target
|
||||
|
||||
if (mob.getCombatTarget() != null && !mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()))
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
if (mob.BehaviourType.isAgressive) {
|
||||
|
||||
AbstractWorldObject newTarget = StaticBehaviours.ChangeTargetFromHateValue(mob);
|
||||
|
||||
if (newTarget != null)
|
||||
mob.setCombatTarget(newTarget);
|
||||
else {
|
||||
if (mob.getCombatTarget() == null) {
|
||||
if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
|
||||
StaticBehaviours.SafeGuardAggro(mob); //safehold guard
|
||||
else
|
||||
StaticBehaviours.CheckForAggro(mob); //normal aggro
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check if mob can move for patrol or moving to target
|
||||
|
||||
if (mob.BehaviourType.canRoam)
|
||||
StaticBehaviours.CheckMobMovement(mob);
|
||||
|
||||
//check if mob can attack if it isn't wimpy
|
||||
|
||||
if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null)
|
||||
StaticBehaviours.CheckForAttack(mob);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DefaultLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ package engine.mobileAI.Threads;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.mobileAI.MobBehaviours.StaticBehaviours;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.Zone;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -33,7 +34,8 @@ public class MobAIThread implements Runnable{
|
||||
for (Mob mob : zone.zoneMobSet) {
|
||||
try {
|
||||
if (mob != null) {
|
||||
MobAI.DetermineAction(mob);
|
||||
//MobAI.DetermineAction(mob);
|
||||
StaticBehaviours.runBehaviour(mob);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error("Error processing Mob [Name: {}, UUID: {}]", mob.getName(), mob.getObjectUUID(), e);
|
||||
|
||||
@@ -156,8 +156,6 @@ public class CombatUtilities {
|
||||
switch (target.getObjectType()) {
|
||||
case PlayerCharacter:
|
||||
PlayerCharacter pc = (PlayerCharacter)target;
|
||||
if(pc.combatStats == null)
|
||||
pc.combatStats = new PlayerCombatStats(pc);
|
||||
pc.combatStats.calculateDefense();
|
||||
defense = pc.combatStats.defense;
|
||||
break;
|
||||
|
||||
@@ -66,7 +66,6 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
// Send Guild, Nation and IC MOTD
|
||||
GuildManager.enterWorldMOTD(player);
|
||||
ChatManager.sendSystemMessage(player, ConfigManager.MB_WORLD_GREETING.getValue());
|
||||
ChatManager.sendSystemMessage(player, " Experience Gain: " + ConfigManager.MB_NORMAL_EXP_RATE.getValue());
|
||||
|
||||
// Send branch string if available from ConfigManager.
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!BuildingManager.PlayerCanControlNotOwner(building, pc) && !pc.getAccount().status.equals(Enum.AccountStatus.ADMIN))
|
||||
if (!BuildingManager.PlayerCanControlNotOwner(building, pc))
|
||||
return true;
|
||||
|
||||
// Can't delete siege assets during an active bane.
|
||||
@@ -72,8 +72,8 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
|
||||
// Can't destroy a shrine
|
||||
//if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE)
|
||||
// return true;
|
||||
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE)
|
||||
return true;
|
||||
|
||||
// Cannot destroy mines outside of normal mine mechanics
|
||||
|
||||
|
||||
@@ -282,14 +282,6 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
}
|
||||
if(mineTele == null){
|
||||
//must be the dungeon request?
|
||||
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(2827951).loc,30f);
|
||||
ChatManager.chatSystemInfo(player, "You Will Teleport To Whitehorn Citadel In " + 10 + " Seconds.");
|
||||
if (10 > 0) {
|
||||
//TODO add timer to teleport
|
||||
TeleportJob tj = new TeleportJob(player, npc, loc, origin, true);
|
||||
JobScheduler.getInstance().scheduleJob(tj, 10 * 1000);
|
||||
}
|
||||
return;
|
||||
}else {
|
||||
int time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
||||
|
||||
@@ -1027,10 +1027,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
private boolean placeCityWalls(PlayerCharacter player, ClientConnection origin, PlaceAssetMsg msg) {
|
||||
|
||||
if(player.getAccount().status.equals(AccountStatus.ADMIN)){
|
||||
adminCreateBuildings(player,msg);
|
||||
return false;
|
||||
}
|
||||
// Member variables
|
||||
|
||||
Zone serverZone;
|
||||
@@ -1169,7 +1165,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Building createStructure(PlayerCharacter playerCharacter, PlacementInfo buildingInfo, Zone currentZone) {
|
||||
private Building createStructure(PlayerCharacter playerCharacter, PlacementInfo buildingInfo, Zone currentZone) {
|
||||
|
||||
Blueprint blueprint;
|
||||
Building newMesh;
|
||||
@@ -1391,16 +1387,4 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void adminCreateBuildings(PlayerCharacter pc, PlaceAssetMsg msg){
|
||||
//handled for building dungeon layouts
|
||||
Zone zone = ZoneManager.getZoneByZoneID(993);
|
||||
for(PlacementInfo placement : msg.getPlacementInfo()){
|
||||
Building building = createStructure(pc,placement,zone);
|
||||
if(building != null) {
|
||||
building.setProtectionState(ProtectionState.NPC);
|
||||
building.setRank(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -567,12 +567,8 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
writer.put(labelSiege);// 1 sets the protection under siege
|
||||
writer.put(labelCeaseFire); //0 with 1 set above sets to under siege // 1 with 1 set above sets protection status to under siege(cease fire)
|
||||
|
||||
writer.put(buttonTransfer);
|
||||
if(building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.SHRINE)) {// 1 enables the transfer asset button
|
||||
writer.put((byte)1);
|
||||
}else {
|
||||
writer.put(buttonDestroy);// 1 enables the destroy asset button
|
||||
}
|
||||
writer.put(buttonTransfer);// 1 enables the transfer asset button
|
||||
writer.put(buttonDestroy);// 1 enables the destroy asset button
|
||||
writer.put(buttonAbandon);// 1 here enables the abandon asset button
|
||||
writer.put(buttonUpgrade); //disable upgrade building
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.Dungeons.Dungeon;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.ByteBufferReader;
|
||||
@@ -109,7 +108,7 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
for (int i = 0; i < 3; i++)
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(cities.size() + mines.size() + 1);
|
||||
writer.putInt(cities.size() + mines.size());
|
||||
|
||||
for (City city : cities)
|
||||
City.serializeForClientMsg(city, writer);
|
||||
@@ -117,7 +116,6 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
for(Mine mine : mines)
|
||||
Mine.serializeForClientMsgTeleport(mine, writer);
|
||||
|
||||
Dungeon.serializeForClientMsgTeleport(writer);
|
||||
}
|
||||
|
||||
public PlayerCharacter getPlayer() {
|
||||
|
||||
@@ -2448,9 +2448,6 @@ public class CharacterItemManager {
|
||||
public void damageItem(Item item, int amount) {
|
||||
if (item == null || amount < 1 || amount > 5)
|
||||
return;
|
||||
if(item.getItemBase().isGlass()){
|
||||
amount = 1;
|
||||
}
|
||||
|
||||
//verify the item is equipped by this player
|
||||
int slot = item.getEquipSlot();
|
||||
|
||||
@@ -608,62 +608,52 @@ public class Contract extends AbstractGameObject {
|
||||
case 250019:
|
||||
case 250028:
|
||||
case 250037:
|
||||
me.magicValue = 1000000;
|
||||
me.magicValue = 3000000;
|
||||
break;
|
||||
case 250002: //10 stats
|
||||
case 250011:
|
||||
case 250020:
|
||||
case 250029:
|
||||
case 250038:
|
||||
me.magicValue = 2000000;
|
||||
me.magicValue = 4000000;
|
||||
break;
|
||||
case 250003: //15 stats
|
||||
case 250012:
|
||||
case 250021:
|
||||
case 250030:
|
||||
case 250039:
|
||||
me.magicValue = 3000000;
|
||||
me.magicValue = 5000000;
|
||||
break;
|
||||
case 250004: //20 stats
|
||||
case 250013:
|
||||
case 250022:
|
||||
case 250031:
|
||||
case 250040:
|
||||
me.magicValue = 4000000;
|
||||
me.magicValue = 6000000;
|
||||
break;
|
||||
case 250005: //25 stats
|
||||
case 250014:
|
||||
case 250023:
|
||||
case 250032:
|
||||
case 250041:
|
||||
me.magicValue = 5000000;
|
||||
me.magicValue = 7000000;
|
||||
break;
|
||||
case 250006: //30 stats
|
||||
case 250015:
|
||||
case 250024:
|
||||
case 250033:
|
||||
case 250042:
|
||||
me.magicValue = 6000000;
|
||||
me.magicValue = 8000000;
|
||||
break;
|
||||
case 250007: //35 stats
|
||||
case 250016:
|
||||
case 250025:
|
||||
case 250034:
|
||||
case 250043:
|
||||
me.magicValue = 7000000;
|
||||
break;
|
||||
case 250008: //40 stats
|
||||
case 250017:
|
||||
case 250026:
|
||||
case 250035:
|
||||
case 250044:
|
||||
me.magicValue = 10000000;
|
||||
break;
|
||||
case 252127:
|
||||
me.magicValue = 5000000;
|
||||
me.magicValue = 9000000;
|
||||
break;
|
||||
default:
|
||||
me.magicValue = 1000000;
|
||||
me.magicValue = 10000000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,19 +818,15 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public void stripCastableEnchants(){
|
||||
try {
|
||||
ArrayList<Effect> ToRemove = new ArrayList<>();
|
||||
for (Effect eff : this.effects.values()) {
|
||||
if (eff.getJobContainer() != null && !eff.getJobContainer().noTimer()) {
|
||||
eff.endEffectNoPower();
|
||||
eff.getJobContainer().cancelJob();
|
||||
ToRemove.add(eff);
|
||||
}
|
||||
ArrayList<Effect> ToRemove = new ArrayList<>();
|
||||
for(Effect eff : this.effects.values()){
|
||||
if(eff.getJobContainer() != null && !eff.getJobContainer().noTimer()){
|
||||
eff.endEffectNoPower();
|
||||
eff.getJobContainer().cancelJob();
|
||||
ToRemove.add(eff);
|
||||
}
|
||||
this.effects.values().removeAll(ToRemove);
|
||||
}catch(Exception ignored){
|
||||
|
||||
}
|
||||
this.effects.values().removeAll(ToRemove);
|
||||
}
|
||||
//Only to be used for trading
|
||||
public void setOwnerID(int ownerID) {
|
||||
|
||||
@@ -259,53 +259,51 @@ public class ItemBase {
|
||||
case 250019:
|
||||
case 250028:
|
||||
case 250037:
|
||||
return 1000000;
|
||||
return 3000000;
|
||||
case 250002: //10 stats
|
||||
case 250011:
|
||||
case 250020:
|
||||
case 250029:
|
||||
case 250038:
|
||||
return 2000000;
|
||||
return 4000000;
|
||||
case 250003: //15 stats
|
||||
case 250012:
|
||||
case 250021:
|
||||
case 250030:
|
||||
case 250039:
|
||||
return 3000000;
|
||||
return 5000000;
|
||||
case 250004: //20 stats
|
||||
case 250013:
|
||||
case 250022:
|
||||
case 250031:
|
||||
case 250040:
|
||||
return 4000000;
|
||||
return 6000000;
|
||||
case 250005: //25 stats
|
||||
case 250014:
|
||||
case 250023:
|
||||
case 250032:
|
||||
case 250041:
|
||||
return 5000000;
|
||||
return 7000000;
|
||||
case 250006: //30 stats
|
||||
case 250015:
|
||||
case 250024:
|
||||
case 250033:
|
||||
case 250042:
|
||||
return 6000000;
|
||||
return 8000000;
|
||||
case 250007: //35 stats
|
||||
case 250016:
|
||||
case 250025:
|
||||
case 250034:
|
||||
case 250043:
|
||||
return 7000000;
|
||||
return 9000000;
|
||||
case 250008: //40 stats
|
||||
case 250017:
|
||||
case 250026:
|
||||
case 250035:
|
||||
case 250044:
|
||||
return 10000000;
|
||||
case 252127:
|
||||
return 5000000;
|
||||
}
|
||||
return 1000000;
|
||||
return 10000000;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -710,8 +710,6 @@ public class ItemFactory {
|
||||
int randomPrefix = TableRoll(vendor.getLevel());
|
||||
if(vendor.contract.getName().contains("Heavy") || vendor.contract.getName().contains("Medium") || vendor.contract.getName().contains("Leather"))
|
||||
randomPrefix += vendor.level * 0.5f;
|
||||
if(randomPrefix > 320)
|
||||
randomPrefix = 320;
|
||||
prefixEntry = ModTableEntry.rollTable(prefixTypeTable.modTableID, randomPrefix);
|
||||
|
||||
if (prefixEntry != null)
|
||||
@@ -729,8 +727,6 @@ public class ItemFactory {
|
||||
int randomSuffix = TableRoll(vendor.getLevel());
|
||||
if(vendor.contract.getName().contains("Heavy") || vendor.contract.getName().contains("Medium") || vendor.contract.getName().contains("Leather"))
|
||||
randomSuffix += vendor.level * 0.25f;
|
||||
if(randomSuffix > 320)
|
||||
randomSuffix = 320;
|
||||
suffixEntry = ModTableEntry.rollTable(suffixTypeTable.modTableID, randomSuffix);
|
||||
|
||||
if (suffixEntry != null)
|
||||
|
||||
@@ -111,8 +111,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
public boolean StrongholdEpic = false;
|
||||
public boolean isDropper = false;
|
||||
|
||||
public HashMap<PlayerCharacter,Float> hate_values;
|
||||
|
||||
|
||||
/**
|
||||
* No Id Constructor
|
||||
@@ -1452,7 +1450,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.stopPatrolTime = 0;
|
||||
this.lastPatrolPointIndex = 0;
|
||||
InterestManager.setObjectDirty(this);
|
||||
this.hate_values = new HashMap<>();
|
||||
}
|
||||
|
||||
public void despawn() {
|
||||
|
||||
@@ -41,7 +41,6 @@ import engine.server.MBServerStatics;
|
||||
import engine.server.login.LoginServer;
|
||||
import engine.server.login.LoginServerMsgHandler;
|
||||
import engine.server.world.WorldServer;
|
||||
import engine.util.KeyCloneAudit;
|
||||
import engine.util.MiscUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -2958,7 +2957,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
public synchronized void grantXP(int xp) {
|
||||
xp *= LootManager.NORMAL_EXP_RATE;
|
||||
int groupSize = 1;
|
||||
if(GroupManager.getGroup(this)!= null)
|
||||
groupSize = GroupManager.getGroup(this).members.size();
|
||||
@@ -5161,11 +5159,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (this.combatStats == null) {
|
||||
this.combatStats = new PlayerCombatStats(this);
|
||||
} else {
|
||||
try {
|
||||
this.combatStats.update();
|
||||
}catch(Exception ignored){
|
||||
|
||||
}
|
||||
this.combatStats.update();
|
||||
}
|
||||
this.doRegen();
|
||||
}
|
||||
@@ -5180,26 +5174,24 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.updateBlessingMessage();
|
||||
|
||||
this.safeZone = this.isInSafeZone();
|
||||
if (!this.timestamps.containsKey("nextBoxCheck"))
|
||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||
|
||||
if(this.isActive && this.enteredWorld) {
|
||||
if (!this.timestamps.containsKey("nextBoxCheck"))
|
||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||
if (!this.isBoxed && this.timestamps.get("nextBoxCheck") < System.currentTimeMillis()) {
|
||||
this.isBoxed = checkIfBoxed(this);
|
||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||
}
|
||||
|
||||
if (!this.isBoxed && this.timestamps.get("nextBoxCheck") < System.currentTimeMillis()) {
|
||||
this.isBoxed = checkIfBoxed(this);
|
||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||
}
|
||||
|
||||
if (this.level < 10 && this.enteredWorld) {
|
||||
while (this.level < 10) {
|
||||
grantXP(Experience.getBaseExperience(this.level + 1) - this.exp);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isBoxed && !this.containsEffect(1672601862)) {
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
if (this.level < 10 && this.enteredWorld) {
|
||||
while (this.level < 10) {
|
||||
grantXP(Experience.getBaseExperience(this.level + 1) - this.exp);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isBoxed && !this.containsEffect(1672601862)) {
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
}
|
||||
|
||||
if (this.isFlying()) {
|
||||
if (this.effects.containsKey("MoveBuff")) {
|
||||
GroundPlayer(this);
|
||||
@@ -5221,11 +5213,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
}
|
||||
try {
|
||||
this.clearClientEffects();
|
||||
}catch(Exception ignored){
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
@@ -5237,17 +5224,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
Logger.error("UPDATE ISSUE: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearClientEffects(){
|
||||
if(this.bonuses != null) {
|
||||
if (!bonuses.getBool(ModType.Stunned, SourceType.None)) {
|
||||
this.removeEffectBySource(EffectSourceType.Stun, 40, true);
|
||||
}
|
||||
if(!this.bonuses.getBool(Enum.ModType.CannotMove,Enum.SourceType.None)){
|
||||
this.removeEffectBySource(EffectSourceType.Root,40,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void unboxPlayer(PlayerCharacter player){
|
||||
String machineID = player.getClientConnection().machineID;
|
||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||
@@ -5684,8 +5660,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
public void setEnteredWorld(boolean enteredWorld) {
|
||||
if(enteredWorld)
|
||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||
this.enteredWorld = enteredWorld;
|
||||
}
|
||||
|
||||
|
||||
@@ -358,22 +358,13 @@ public class PlayerCombatStats {
|
||||
|
||||
float stanceValue = 0.0f;
|
||||
float atrEnchants = 0;
|
||||
float healerDefStance = 0.0f;
|
||||
|
||||
for(String effID : this.owner.effects.keySet()) {
|
||||
if (effID.contains("Stance")) {
|
||||
Effect effect = this.owner.effects.get(effID);
|
||||
EffectsBase eb = effect.getEffectsBase();
|
||||
if(eb.getIDString().equals("STC-H-DA")){
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.OCV)) {
|
||||
float percent = mod.getPercentMod();
|
||||
int trains = this.owner.effects.get(effID).getTrains();
|
||||
float modValue = percent + (trains * mod.getRamp());
|
||||
healerDefStance += modValue * 0.01f;
|
||||
}
|
||||
}
|
||||
if(eb.getIDString().equals("STC-H-DA"))
|
||||
continue;
|
||||
}
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.OCV)) {
|
||||
float percent = mod.getPercentMod();
|
||||
@@ -441,7 +432,6 @@ public class PlayerCombatStats {
|
||||
if(stanceValue > 0.0f){
|
||||
modifier -= (stanceValue);
|
||||
}
|
||||
modifier -= healerDefStance;
|
||||
atr *= modifier;
|
||||
}
|
||||
atr = (float) Math.round(atr);
|
||||
@@ -776,20 +766,16 @@ public class PlayerCombatStats {
|
||||
blockSkill = this.owner.skills.get("Block").getModifiedAmount();
|
||||
|
||||
float shieldDefense = 0.0f;
|
||||
try {
|
||||
if (this.owner.charItemManager.getEquipped(2) != null && this.owner.charItemManager.getEquipped(2).getItemBase().isShield()) {
|
||||
Item shield = this.owner.charItemManager.getEquipped(2);
|
||||
shieldDefense += shield.getItemBase().getDefense();
|
||||
for (Effect eff : shield.effects.values()) {
|
||||
for (AbstractEffectModifier mod : eff.getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.DR)) {
|
||||
shieldDefense += mod.minMod + (mod.getRamp() * eff.getTrains());
|
||||
}
|
||||
if(this.owner.charItemManager.getEquipped(2) != null && this.owner.charItemManager.getEquipped(2).getItemBase().isShield()){
|
||||
Item shield = this.owner.charItemManager.getEquipped(2);
|
||||
shieldDefense += shield.getItemBase().getDefense();
|
||||
for(Effect eff : shield.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.DR)){
|
||||
shieldDefense += mod.minMod + (mod.getRamp() * eff.getTrains());
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(Exception ignore){
|
||||
|
||||
}
|
||||
|
||||
float weaponSkill = 0.0f;
|
||||
@@ -852,10 +838,9 @@ public class PlayerCombatStats {
|
||||
|
||||
//right ring
|
||||
if(this.owner.charItemManager != null){
|
||||
try{
|
||||
if(this.owner.charItemManager.getEquipped(7) != null){
|
||||
for(String effID : this.owner.charItemManager.getEquipped(7).effects.keySet()) {
|
||||
for (AbstractEffectModifier mod : this.owner.charItemManager.getEquipped(7).effects.get(effID).getEffectModifiers()) {
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.DCV)) {
|
||||
if (mod.getPercentMod() == 0) {
|
||||
float value = mod.getMinMod();
|
||||
@@ -867,33 +852,27 @@ public class PlayerCombatStats {
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
//left ring
|
||||
try {
|
||||
if (this.owner.charItemManager.getEquipped(8) != null) {
|
||||
for (String effID : this.owner.charItemManager.getEquipped(8).effects.keySet()) {
|
||||
for (AbstractEffectModifier mod : this.owner.charItemManager.getEquipped(8).effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.DCV)) {
|
||||
if (mod.getPercentMod() == 0) {
|
||||
float value = mod.getMinMod();
|
||||
int trains = this.owner.effects.get(effID).getTrains();
|
||||
float modValue = value + (trains * mod.getRamp());
|
||||
flatBonuses += modValue;
|
||||
}
|
||||
if(this.owner.charItemManager.getEquipped(8) != null){
|
||||
for(String effID : this.owner.charItemManager.getEquipped(8).effects.keySet()) {
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.DCV)) {
|
||||
if (mod.getPercentMod() == 0) {
|
||||
float value = mod.getMinMod();
|
||||
int trains = this.owner.effects.get(effID).getTrains();
|
||||
float modValue = value + (trains * mod.getRamp());
|
||||
flatBonuses += modValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
|
||||
//necklace
|
||||
try{
|
||||
if(this.owner.charItemManager.getEquipped(9) != null){
|
||||
for(String effID : this.owner.charItemManager.getEquipped(9).effects.keySet()) {
|
||||
for (AbstractEffectModifier mod : this.owner.charItemManager.getEquipped(9).effects.get(effID).getEffectModifiers()) {
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.DCV)) {
|
||||
if (mod.getPercentMod() == 0) {
|
||||
float value = mod.getMinMod();
|
||||
@@ -905,20 +884,12 @@ public class PlayerCombatStats {
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
try{
|
||||
if(this.owner.charItemManager.getEquipped(2) == null)
|
||||
blockSkill = 0;
|
||||
else if(this.owner.charItemManager != null && this.owner.charItemManager.getEquipped(2) != null && !this.owner.charItemManager.getEquipped(2).getItemBase().isShield())
|
||||
blockSkill = 0;
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.owner.charItemManager.getEquipped(2) == null)
|
||||
blockSkill = 0;
|
||||
else if(this.owner.charItemManager != null && this.owner.charItemManager.getEquipped(2) != null && !this.owner.charItemManager.getEquipped(2).getItemBase().isShield())
|
||||
blockSkill = 0;
|
||||
|
||||
float defense = (1 + armorSkill / 50) * armorDefense;
|
||||
defense += (1 + blockSkill / 100) * shieldDefense;
|
||||
@@ -1011,22 +982,12 @@ public class PlayerCombatStats {
|
||||
float stanceMod = 1.0f;
|
||||
float atrBuffs = 0.0f;
|
||||
|
||||
float healerDefStance = 0.0f;
|
||||
for(String effID : pc.effects.keySet()) {
|
||||
if (effID.contains("Stance")) {
|
||||
Effect effect = pc.effects.get(effID);
|
||||
EffectsBase eb = effect.getEffectsBase();
|
||||
if(eb.getIDString().equals("STC-H-DA")){
|
||||
for (AbstractEffectModifier mod : pc.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.OCV)) {
|
||||
float percent = mod.getPercentMod();
|
||||
int trains = pc.effects.get(effID).getTrains();
|
||||
float modValue = percent + (trains * mod.getRamp());
|
||||
healerDefStance += modValue * 0.01f;
|
||||
}
|
||||
}
|
||||
if(eb.getIDString().equals("STC-H-DA"))
|
||||
continue;
|
||||
}
|
||||
for (AbstractEffectModifier mod : pc.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.OCV)) {
|
||||
float percent = mod.getPercentMod();
|
||||
@@ -1054,7 +1015,7 @@ public class PlayerCombatStats {
|
||||
atr *= precise;
|
||||
atr += atrBuffs;
|
||||
if(pc.bonuses != null)
|
||||
atr *= 1 + (pc.bonuses.getFloatPercentAll(Enum.ModType.OCV, Enum.SourceType.None) - (stanceMod - 1) - (precise - 1) - healerDefStance);
|
||||
atr *= 1 + (pc.bonuses.getFloatPercentAll(Enum.ModType.OCV, Enum.SourceType.None) - (stanceMod - 1) - (precise - 1));
|
||||
atr *= stanceMod;
|
||||
return atr;
|
||||
}
|
||||
|
||||
@@ -176,8 +176,7 @@ public class HealthEffectModifier extends AbstractEffectModifier {
|
||||
}
|
||||
|
||||
if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
||||
float multiplier = ((PlayerCharacter)source).ZergMultiplier;
|
||||
modAmount *= multiplier;
|
||||
modAmount *= ((PlayerCharacter)source).ZergMultiplier;
|
||||
}
|
||||
|
||||
if (modAmount == 0f)
|
||||
|
||||
@@ -281,9 +281,6 @@ public class LoginServer {
|
||||
Logger.info("Loading All Realms");
|
||||
Realm.loadAllRealms();
|
||||
|
||||
Logger.info("Trashing Multibox Cheaters");
|
||||
DbManager.AccountQueries.TRASH_CHEATERS();
|
||||
|
||||
Logger.info("***Boot Successful***");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,27 +97,5 @@ public class HourlyJobThread implements Runnable {
|
||||
bane.setDefaultTime();
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
Logger.info("Trashing Multibox Cheaters");
|
||||
DbManager.AccountQueries.TRASH_CHEATERS();
|
||||
|
||||
//disconnect all players who were banned and are still in game
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayers()){
|
||||
Account account = pc.getClientConnection().getAccount();
|
||||
if(account == null)
|
||||
continue;
|
||||
try {
|
||||
boolean banned = DbManager.AccountQueries.GET_ACCOUNT(account.getUname()).status.equals(Enum.AccountStatus.BANNED);
|
||||
if (banned) {
|
||||
pc.getClientConnection().forceDisconnect();
|
||||
}
|
||||
}catch(Exception e){
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
Logger.error("Failed To Run Ban Multibox Abusers");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user