Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 84446eb726 | |||
| 99f5a9c606 | |||
| 235b5e7375 | |||
| 7289f9e006 | |||
| 9c1afd9441 | |||
| 56226c71eb | |||
| c1eb6796f5 | |||
| 88e16448a8 | |||
| 4cb428e993 | |||
| af9945f9db | |||
| f0594fb1b2 | |||
| a155bc0308 | |||
| dce7444483 | |||
| 76eed79b0a | |||
| f73ed17c05 | |||
| b049d21aff | |||
| f6cce5ee1f | |||
| 8038c2ebe2 | |||
| 9f51b9af57 | |||
| cbc75bf9d7 | |||
| 0ecfa546cd | |||
| b89fb0803d | |||
| 11005d58a7 | |||
| b0c6239314 | |||
| 67f66155e9 | |||
| 7fbae12e99 | |||
| 65580c0a47 | |||
| 236afe4cc6 | |||
| c23a6af28f | |||
| 2535106d2c | |||
| d8379ae5a9 | |||
| 9f13f5fc5d | |||
| 884cb30ebd |
+9
-17
@@ -9,15 +9,13 @@
|
||||
package engine;
|
||||
|
||||
import ch.claude_martin.enumbitset.EnumBitSetHelper;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.ItemBase;
|
||||
import engine.objects.Shrine;
|
||||
import engine.objects.Zone;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -471,11 +469,14 @@ public class Enum {
|
||||
|
||||
// 14001 does not have a banestone to bind at
|
||||
|
||||
if (ruinZone.getLoadNum() == 14001)
|
||||
if (ruinZone.getLoadNum() == 14001) {
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||
else
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||
.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
||||
}else {
|
||||
//spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||
//.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,30f);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1090,15 +1091,6 @@ public class Enum {
|
||||
DamageShield,
|
||||
DeathShroud,
|
||||
DefenseBuff,
|
||||
DefenseBuffAss,
|
||||
DefenseBuffChn,
|
||||
DefenseBuffDsr,
|
||||
DefenseBuffFur,
|
||||
DefenseBuffNec,
|
||||
DefenseBuffNsr,
|
||||
DefenseBuffPrl,
|
||||
DefenseBuffRng,
|
||||
DefenseBuffWiz,
|
||||
DefenseBuffGroup,
|
||||
DefenseDebuff,
|
||||
DetectInvis,
|
||||
|
||||
@@ -134,9 +134,13 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
worked = rs.getBoolean("result");
|
||||
|
||||
if (rs.next()) {
|
||||
try {
|
||||
worked = rs.getBoolean("result");
|
||||
}catch(Exception e){
|
||||
worked = false;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.StringUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -530,6 +531,13 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Corpse:
|
||||
Corpse corpse = (Corpse)target;
|
||||
Long timeLeft = MBServerStatics.CORPSE_CLEANUP_TIMER_MS - (System.currentTimeMillis() - corpse.spawnedTime);
|
||||
output += "Despawn in: " + timeLeft;
|
||||
output += newline;
|
||||
break;
|
||||
}
|
||||
|
||||
throwbackInfo(pc, output);
|
||||
|
||||
@@ -49,10 +49,20 @@ public class ArenaManager {
|
||||
if (!playerQueue.contains(player)) {
|
||||
playerQueue.add(player);
|
||||
}
|
||||
for(PlayerCharacter pc : playerQueue){
|
||||
if(pc.equals(player))
|
||||
continue;
|
||||
ChatManager.chatSystemInfo(pc, player.getName() + " has joined the arena que. There are now " + playerQueue.size() + " players queued.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void leaveQueue(PlayerCharacter player) {
|
||||
playerQueue.remove(player);
|
||||
for(PlayerCharacter pc : playerQueue){
|
||||
if(pc.equals(player))
|
||||
continue;
|
||||
ChatManager.chatSystemInfo(pc, player.getName() + " has left the arena que. There are now " + playerQueue.size() + " players queued.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void createArena() {
|
||||
|
||||
@@ -1453,19 +1453,17 @@ public enum CombatManager {
|
||||
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
|
||||
}
|
||||
|
||||
public static boolean LandHit(int atr, int defense){
|
||||
public static boolean LandHit(int C5, int D5){
|
||||
|
||||
float chance = (C5-((C5+D5)*.315f)) / ((D5-((C5+D5)*.315f)) + (C5-((C5+D5)*.315f)));
|
||||
int convertedChance = Math.round(chance * 100);
|
||||
//convertedChance = Math.max(5, Math.min(95, convertedChance));
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
||||
float chance = (float)((atr-((atr+defense)*0.315))/((defense-((atr+defense)*0.315))+(atr-((atr+defense)*0.315))));
|
||||
|
||||
int connvertedChance = (int)(chance * 100);
|
||||
if(roll < 5)//always 5% chance ot miss
|
||||
return false;
|
||||
|
||||
if(connvertedChance < 5)
|
||||
connvertedChance = 5;
|
||||
|
||||
if(connvertedChance > 95)
|
||||
connvertedChance = 95;
|
||||
|
||||
return connvertedChance > roll;
|
||||
return roll <= convertedChance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,12 @@ public enum LootManager {
|
||||
}
|
||||
|
||||
public static void GenerateMobLoot(Mob mob) {
|
||||
|
||||
//no loot for safezones
|
||||
if(mob == null || mob.getSafeZone()){
|
||||
return;
|
||||
}
|
||||
|
||||
//determine if mob is in hotzone
|
||||
boolean inHotzone = false;
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ public enum PowersManager {
|
||||
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if(!pc.isFlying()) //cant be sitting if flying
|
||||
if(!pc.isFlying() && powersBaseByToken.get(msg.getPowerUsedID()) != null && powersBaseByToken.get(msg.getPowerUsedID()).isSpell) //cant be sitting if flying
|
||||
CombatManager.toggleSit(false,origin);
|
||||
|
||||
if(pc.isMoving())
|
||||
@@ -787,10 +787,13 @@ public enum PowersManager {
|
||||
if (playerCharacter == null || msg == null)
|
||||
return;
|
||||
|
||||
if((msg.getPowerUsedID() == 429495514 || msg.getPowerUsedID() == 429407306) && playerCharacter.getRace().getName().toLowerCase().contains("shade")){
|
||||
//msg.setPowerUsedID(407015607);
|
||||
applyPower(playerCharacter,playerCharacter,playerCharacter.loc,429397210,msg.getNumTrains(),false);
|
||||
}
|
||||
//if((msg.getPowerUsedID() == 429495514 || msg.getPowerUsedID() == 429407306) && playerCharacter.getRace().getName().toLowerCase().contains("shade")){
|
||||
// //use sneak instead of hide
|
||||
// PowersBase pb = PowersManager.getPowerByToken(429397210);
|
||||
// int offsetTrains = (40 - msg.getNumTrains()) ;
|
||||
// applyPower(playerCharacter,playerCharacter,playerCharacter.loc,429397210,msg.getNumTrains(),false);
|
||||
// applyPower(playerCharacter,playerCharacter,playerCharacter.loc,427857146,offsetTrains,false);
|
||||
//}
|
||||
if(msg.getPowerUsedID() == 429494441) {//wildkins chase
|
||||
playerCharacter.removeEffectBySource(EffectSourceType.Root,40,true);
|
||||
playerCharacter.removeEffectBySource(EffectSourceType.Snare,40,true);
|
||||
|
||||
@@ -117,7 +117,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
public void endEffect() {
|
||||
if (this.eb == null)
|
||||
if (this.eb == null || this.power == null)
|
||||
return;
|
||||
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package engine.mobileAI.BehaviourFiles;
|
||||
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class PlayerGuard {
|
||||
|
||||
public static void process(Mob guard){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package engine.mobileAI.BehaviourFiles;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.mobileAI.enumMobState;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.ItemBase;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PlayerPet {
|
||||
|
||||
public static void process(Mob pet){
|
||||
if(pet.getOwner() == null && !pet.isNecroPet()){
|
||||
pet.killCharacter("no owner");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!WorldGrid.getObjectsInRangePartial(pet.loc, MBServerStatics.CHARACTER_LOAD_RANGE,1).contains(pet.getOwner())){
|
||||
pet.teleport(pet.getOwner().loc);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(enumMobState.getState(pet)){
|
||||
case dead:
|
||||
pet.despawn();
|
||||
return;
|
||||
case patrolling:
|
||||
if(pet.loc.distanceSquared(pet.getOwner().loc) > 90 && !pet.isMoving()){
|
||||
MovementUtilities.aiMove(pet,pet.getOwner().loc,false);
|
||||
}
|
||||
return;
|
||||
case attacking:
|
||||
attack(pet);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void attack(Mob mob){
|
||||
|
||||
if (mob.combatTarget == null || !mob.combatTarget.isAlive()) {
|
||||
mob.setCombatTarget(null);
|
||||
aggro(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!CombatUtilities.inRangeToAttack(mob,mob.combatTarget)){
|
||||
if (!MovementUtilities.canMove(mob))
|
||||
return;
|
||||
MovementUtilities.aiMove(mob,mob.combatTarget.loc,false);
|
||||
return;
|
||||
}
|
||||
|
||||
mob.updateLocation();
|
||||
|
||||
ItemBase weapon = mob.getWeaponItemBase(true);
|
||||
boolean mainHand = true;
|
||||
if(weapon == null) {
|
||||
weapon = mob.getWeaponItemBase(false);
|
||||
mainHand = false;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() > mob.getNextAttackTime()) {
|
||||
CombatUtilities.combatCycle(mob, mob.combatTarget, mainHand, weapon);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + 3000L);
|
||||
}
|
||||
}
|
||||
public static void aggro(Mob mob){
|
||||
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(mob.loc,30, MBServerStatics.MASK_MOB)) {
|
||||
Mob potentialTarget = (Mob) awo;
|
||||
if (!potentialTarget.isAlive())
|
||||
continue;
|
||||
if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
mob.setCombatTarget(potentialTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package engine.mobileAI.BehaviourFiles;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class SiegeMob {
|
||||
public static void process(Mob treb){
|
||||
if(!treb.isAlive()){
|
||||
if(!treb.despawned){
|
||||
treb.despawn();
|
||||
treb.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
|
||||
if(treb.deathTime == 0) {
|
||||
treb.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
if(treb.deathTime + 900000L > System.currentTimeMillis()) {
|
||||
treb.respawn();
|
||||
treb.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(treb.combatTarget == null)
|
||||
return;
|
||||
|
||||
if(!treb.combatTarget.getObjectType().equals(Enum.GameObjectType.Building)) {
|
||||
treb.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!treb.combatTarget.isAlive()) {
|
||||
treb.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!CombatUtilities.inRangeToAttack(treb,treb.combatTarget))
|
||||
treb.setCombatTarget(null);
|
||||
|
||||
if (System.currentTimeMillis() > treb.getNextAttackTime()) {
|
||||
CombatUtilities.combatCycle(treb, treb.combatTarget, true, null);
|
||||
treb.setNextAttackTime(System.currentTimeMillis() + 11000L);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package engine.mobileAI.BehaviourFiles;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.mobileAI.enumMobState;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.objects.*;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class StandardMob {
|
||||
public static void process(Mob mob){
|
||||
switch(enumMobState.getState(mob)){
|
||||
case idle:
|
||||
return;
|
||||
case dead:
|
||||
respawn(mob);
|
||||
return;
|
||||
case patrolling:
|
||||
if(mob.combatTarget == null)
|
||||
aggro(mob);
|
||||
if(mob.combatTarget == null)
|
||||
patrol(mob);
|
||||
return;
|
||||
case attacking:
|
||||
attack(mob);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void respawn(Mob mob){
|
||||
if (mob.deathTime == 0) {
|
||||
mob.setDeathTime(System.currentTimeMillis());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mob.despawned) {
|
||||
|
||||
if (mob.getCharItemManager() != null && mob.getCharItemManager().getInventoryCount() > 0) {
|
||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) {
|
||||
mob.despawn();
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//No items in inventory.
|
||||
} else if (mob.isHasLoot()) {
|
||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||
mob.despawn();
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//Mob never had Loot.
|
||||
} else {
|
||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER) {
|
||||
mob.despawn();
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Mob.discDroppers.contains(mob))
|
||||
return;
|
||||
|
||||
if (System.currentTimeMillis() > (mob.deathTime + (mob.spawnTime * 1000L))) {
|
||||
if (!Zone.respawnQue.contains(mob)) {
|
||||
Zone.respawnQue.add(mob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void aggro(Mob mob){
|
||||
if(enumMobState.Agressive(mob)){
|
||||
for(int id : mob.playerAgroMap.keySet()){
|
||||
PlayerCharacter potentialTarget = PlayerCharacter.getFromCache(id);
|
||||
if(!potentialTarget.isAlive() || !mob.canSee(potentialTarget))
|
||||
continue;
|
||||
if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
mob.setCombatTarget(potentialTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(mob.loc,60, MBServerStatics.MASK_PET)){
|
||||
Mob potentialTarget = (Mob)awo;
|
||||
if(!potentialTarget.isAlive())
|
||||
continue;
|
||||
if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
mob.setCombatTarget(potentialTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void patrol(Mob mob){
|
||||
if (!MovementUtilities.canMove(mob))
|
||||
return;
|
||||
|
||||
if (mob.stopPatrolTime + 5000L > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
if(mob.isMoving())
|
||||
return;
|
||||
|
||||
if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1)
|
||||
mob.lastPatrolPointIndex = 0;
|
||||
|
||||
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
|
||||
mob.lastPatrolPointIndex += 1;
|
||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||
}
|
||||
|
||||
public static void attack(Mob mob){
|
||||
if (!MovementUtilities.inRangeOfBindLocation(mob)) {
|
||||
|
||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
for (Map.Entry playerEntry : mob.playerAgroMap.entrySet())
|
||||
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.combatTarget == null || !mob.combatTarget.isAlive()) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!mob.isMoving() && !CombatUtilities.inRangeToAttack(mob,mob.combatTarget)){
|
||||
if (!MovementUtilities.canMove(mob))
|
||||
return;
|
||||
MovementUtilities.aiMove(mob,mob.combatTarget.loc,false);
|
||||
return;
|
||||
}
|
||||
|
||||
mob.updateLocation();
|
||||
|
||||
ItemBase weapon = mob.getWeaponItemBase(true);
|
||||
boolean mainHand = true;
|
||||
if(weapon == null) {
|
||||
weapon = mob.getWeaponItemBase(false);
|
||||
mainHand = false;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() > mob.getNextAttackTime()) {
|
||||
CombatUtilities.combatCycle(mob, mob.combatTarget, mainHand, weapon);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + 3000L);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package engine.mobileAI;
|
||||
|
||||
import engine.mobileAI.BehaviourFiles.PlayerGuard;
|
||||
import engine.mobileAI.BehaviourFiles.PlayerPet;
|
||||
import engine.mobileAI.BehaviourFiles.SiegeMob;
|
||||
import engine.mobileAI.BehaviourFiles.StandardMob;
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class EasyAI {
|
||||
|
||||
public static void aiRun(Mob mob) {
|
||||
if (mob == null)
|
||||
return;
|
||||
|
||||
if (mob.isPlayerGuard) {
|
||||
PlayerGuard.process(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mob.isSiege()){
|
||||
SiegeMob.process(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.isPet()) {
|
||||
PlayerPet.process(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
StandardMob.process(mob);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
package engine.mobileAI;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3f;
|
||||
@@ -17,9 +16,7 @@ import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PerformActionMsg;
|
||||
import engine.net.client.msg.PowerProjectileMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
@@ -118,7 +115,7 @@ public class MobAI {
|
||||
|
||||
//no weapons, default mob attack speed 3 seconds.
|
||||
|
||||
if (System.currentTimeMillis() < mob.getLastAttackTime())
|
||||
if (System.currentTimeMillis() < mob.getNextAttackTime())
|
||||
return;
|
||||
|
||||
// ranged mobs cant attack while running. skip until they finally stop.
|
||||
@@ -136,19 +133,19 @@ public class MobAI {
|
||||
int delay = 3000;
|
||||
if (mob.isSiege())
|
||||
delay = 11000;
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + delay);
|
||||
} else if (mob.getWeaponItemBase(true) != null) {
|
||||
int delay = 3000;
|
||||
if (mob.isSiege())
|
||||
delay = 11000;
|
||||
CombatUtilities.combatCycle(mob, target, true, mob.getWeaponItemBase(true));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + delay);
|
||||
} else if (mob.getWeaponItemBase(false) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 11000;
|
||||
CombatUtilities.combatCycle(mob, target, false, mob.getWeaponItemBase(false));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,19 +190,19 @@ public class MobAI {
|
||||
int delay = 3000;
|
||||
if (mob.isSiege())
|
||||
delay = 15000;
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + delay);
|
||||
} else if (mob.getWeaponItemBase(true) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 15000;
|
||||
CombatUtilities.combatCycle(mob, target, true, mob.getWeaponItemBase(true));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
} else if (mob.getWeaponItemBase(false) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 15000;
|
||||
CombatUtilities.combatCycle(mob, target, false, mob.getWeaponItemBase(false));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
}
|
||||
|
||||
//if (mob.isSiege()) {
|
||||
@@ -236,19 +233,19 @@ public class MobAI {
|
||||
int delay = 3000;
|
||||
if (mob.isSiege())
|
||||
delay = 11000;
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + delay);
|
||||
} else if (mob.getWeaponItemBase(true) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 11000;
|
||||
CombatUtilities.combatCycle(mob, target, true, mob.getWeaponItemBase(true));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
} else if (mob.getWeaponItemBase(false) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 11000;
|
||||
CombatUtilities.combatCycle(mob, target, false, mob.getWeaponItemBase(false));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
if (target.getCombatTarget() == null) {
|
||||
target.setCombatTarget(mob);
|
||||
}
|
||||
@@ -918,7 +915,7 @@ public class MobAI {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
if (System.currentTimeMillis() > mob.getLastAttackTime())
|
||||
if (System.currentTimeMillis() > mob.getNextAttackTime())
|
||||
AttackTarget(mob, mob.getCombatTarget());
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package engine.mobileAI.Threads;
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.mobileAI.EasyAI;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.Mob;
|
||||
@@ -33,7 +34,7 @@ public class MobAIThread implements Runnable{
|
||||
|
||||
try {
|
||||
if (mob != null)
|
||||
MobAI.DetermineAction(mob);
|
||||
EasyAI.aiRun(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package engine.mobileAI;
|
||||
|
||||
import engine.objects.Mob;
|
||||
|
||||
public enum enumMobState {
|
||||
idle,
|
||||
attacking,
|
||||
patrolling,
|
||||
dead;
|
||||
|
||||
public static enumMobState getState(Mob mob){
|
||||
if(mob.playerAgroMap.isEmpty())
|
||||
return enumMobState.idle;
|
||||
|
||||
if(!mob.isAlive())
|
||||
return enumMobState.dead;
|
||||
|
||||
if(mob.combatTarget != null)
|
||||
return enumMobState.attacking;
|
||||
|
||||
return enumMobState.patrolling;
|
||||
}
|
||||
|
||||
public static boolean Agressive(Mob mob){
|
||||
return mob.BehaviourType.name().contains("Aggro");
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class CombatUtilities {
|
||||
case Building:
|
||||
return false;
|
||||
}
|
||||
return CombatManager.LandHit(atr,defense);
|
||||
return !CombatManager.LandHit(atr,defense);
|
||||
}
|
||||
|
||||
public static boolean triggerBlock(Mob agent, AbstractWorldObject ac) {
|
||||
|
||||
@@ -83,7 +83,7 @@ public class MovementUtilities {
|
||||
|
||||
}
|
||||
|
||||
public static boolean inRangeToAggro(Mob agent, PlayerCharacter target) {
|
||||
public static boolean inRangeToAggro(Mob agent, AbstractCharacter target) {
|
||||
|
||||
Vector3fImmutable sl = agent.getLoc();
|
||||
Vector3fImmutable tl = target.getLoc();
|
||||
@@ -169,6 +169,9 @@ public class MovementUtilities {
|
||||
if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags()))
|
||||
return false;
|
||||
|
||||
if(!agent.BehaviourType.canRoam)
|
||||
return false;
|
||||
|
||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
||||
}
|
||||
|
||||
|
||||
@@ -1681,15 +1681,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
int cost = ((int)((toRepair.getMagicValue()/max*(max - dur)) + (npc.getSpecialPrice() * npc.buyPercent))) + (int)(npc.getSpecialPrice() * (max - dur));
|
||||
|
||||
//int pointsToRepair = max - dur;
|
||||
//int magicValue = toRepair.getMagicValue();
|
||||
//if(magicValue == 0)
|
||||
// magicValue = 1;
|
||||
//int calculatedValue = toRepair.getDurabilityMax() * magicValue;
|
||||
//float costPerPoint = (magicValue / max) * ( 1 + npc.buyPercent);
|
||||
//cost = (int)(pointsToRepair * costPerPoint) + npc.getSpecialPrice();
|
||||
int pointsToRepair = max - dur;
|
||||
double damageRatio = (double)1.0d - (toRepair.getDurabilityMax() - toRepair.getDurabilityCurrent()) / toRepair.getDurabilityMax();
|
||||
int modifiedValue = (int)(damageRatio * toRepair.getMagicValue());
|
||||
int costPerPoint = modifiedValue / toRepair.getDurabilityMax();
|
||||
int modifiedRepairCost = (int)(pointsToRepair * costPerPoint)+ npc.getSpecialPrice();
|
||||
int cost = (int)(modifiedRepairCost * 1 + npc.buyPercent) + npc.getSpecialPrice();
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null)
|
||||
|
||||
@@ -146,6 +146,8 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
valid = true;
|
||||
if(runeID == 3035 && baseClassID == 2501)
|
||||
valid = true;
|
||||
if(runeID == 3028 && baseClassID == 2501 && playerCharacter.getRace().getName().contains("Irekei"))
|
||||
valid = true;
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -631,6 +631,11 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
.getObjectUUID(), true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
if(pc.getCharItemManager() != null && pc.getCharItemManager().getGoldInventory() != null && pc.getCharItemManager().getGoldInventory().getNumOfItems() < 1000) {
|
||||
pc.getCharItemManager().addGoldToInventory(1000, false);
|
||||
pc.getCharItemManager().addItemToInventory(new MobLoot(pc, ItemBase.getItemBase(980066), 1, false).promoteToItem(pc));
|
||||
pc.getCharItemManager().updateInventory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,7 @@ import engine.Enum.*;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.CombatManager;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.job.AbstractJob;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
@@ -764,7 +761,11 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
public abstract Vector3fImmutable getBindLoc();
|
||||
|
||||
public final void setBindLoc(final Vector3fImmutable value) {
|
||||
this.bindLoc = value;
|
||||
if(this.getObjectType().equals(GameObjectType.PlayerCharacter) && this.guild.getNation().equals(Guild.getErrantGuild())){
|
||||
this.bindLoc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,20f);
|
||||
}else {
|
||||
this.bindLoc = value;
|
||||
}
|
||||
}
|
||||
|
||||
public final Vector3fImmutable getFaceDir() {
|
||||
@@ -1558,7 +1559,15 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
Effect eff = this.effects.get(s);
|
||||
if (eff == null)
|
||||
continue;
|
||||
if (eff.cancelOnMove() && eff.cancel()) {
|
||||
|
||||
Boolean override = false;
|
||||
if(this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter) this;
|
||||
if (eff.getEffectsBase().getIDString().equals("INVIS-B") && s.equals("Invisible") && pc.getRace().getName().contains("Shade"))
|
||||
override = true;
|
||||
}
|
||||
|
||||
if (!override && eff.cancelOnMove() && eff.cancel()) {
|
||||
//System.out.println("canceling on Move");
|
||||
eff.cancelJob();
|
||||
this.effects.remove(s);
|
||||
|
||||
@@ -43,6 +43,7 @@ public class Corpse extends AbstractWorldObject {
|
||||
private int inBuildingID = 0;
|
||||
private int inFloorID = -1;
|
||||
private int inBuilding = -1;
|
||||
public Long spawnedTime = 0L;
|
||||
|
||||
/**
|
||||
* No Id Constructor
|
||||
@@ -74,6 +75,7 @@ public class Corpse extends AbstractWorldObject {
|
||||
}
|
||||
this.setObjectTypeMask(MBServerStatics.MASK_CORPSE);
|
||||
|
||||
this.spawnedTime = System.currentTimeMillis();
|
||||
if (!safeZone)
|
||||
transferInventory(belongsTo, enterWorld);
|
||||
|
||||
|
||||
@@ -1227,7 +1227,10 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final int getMagicValue() {
|
||||
return this.magicValue;
|
||||
int val = this.calcMagicValue();
|
||||
if(val == 0)
|
||||
val = 1;
|
||||
return val + this.getItemBase().getMagicValue();
|
||||
}
|
||||
|
||||
public int getBaseValue() {
|
||||
|
||||
@@ -12,6 +12,7 @@ package engine.objects;
|
||||
import ch.claude_martin.enumbitset.EnumBitSet;
|
||||
import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.*;
|
||||
@@ -95,7 +96,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
private AbstractWorldObject fearedObject = null;
|
||||
private int buildingID;
|
||||
private boolean isSiege = false;
|
||||
private long lastAttackTime = 0;
|
||||
private long nextAttackTime = 0;
|
||||
private int lastMobPowerToken = 0;
|
||||
private HashMap<Integer, MobEquipment> equip = null;
|
||||
private DeferredPowerJob weaponPower;
|
||||
@@ -1326,8 +1327,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Dispatch dispatch;
|
||||
|
||||
try {
|
||||
//resync corpses
|
||||
//this.setLoc(this.getMovementLoc());
|
||||
if (this.isSiege) {
|
||||
this.deathTime = System.currentTimeMillis();
|
||||
//this.state = STATE.Dead;
|
||||
@@ -1407,6 +1406,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Logger.error(e);
|
||||
}
|
||||
this.updateLocation();
|
||||
//resync corpses
|
||||
InterestManager.setObjectDirty(this);
|
||||
}
|
||||
|
||||
public void respawn() {
|
||||
@@ -2165,6 +2166,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
|
||||
this.deathTime = 0;
|
||||
InterestManager.setObjectDirty(this);
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
@@ -2235,12 +2237,12 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
return this.upgradeDateTime != null;
|
||||
}
|
||||
|
||||
public long getLastAttackTime() {
|
||||
return lastAttackTime;
|
||||
public long getNextAttackTime() {
|
||||
return nextAttackTime;
|
||||
}
|
||||
|
||||
public void setLastAttackTime(long lastAttackTime) {
|
||||
this.lastAttackTime = lastAttackTime;
|
||||
public void setNextAttackTime(long lastAttackTime) {
|
||||
this.nextAttackTime = lastAttackTime;
|
||||
}
|
||||
|
||||
public void setDeathTime(long deathTime) {
|
||||
|
||||
@@ -1300,7 +1300,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
|
||||
if (ConfigManager.serverType.equals(ServerType.WORLDSERVER))
|
||||
player.setLoc(player.bindLoc);
|
||||
player.setLoc(player.getBindLoc());
|
||||
player.endLoc = Vector3fImmutable.ZERO;
|
||||
|
||||
//get level based on experience
|
||||
@@ -2925,6 +2925,9 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
public synchronized void grantXP(int xp) {
|
||||
int groupSize = 1;
|
||||
if(GroupManager.getGroup(this)!= null)
|
||||
groupSize = GroupManager.getGroup(this).members.size();
|
||||
if(this.promotionClass == null && this.level == 10){
|
||||
this.setOverFlowEXP(0);
|
||||
this.update(false);
|
||||
@@ -3075,6 +3078,14 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
SetObjectValueMsg upm = new SetObjectValueMsg(this, 9);
|
||||
DispatchMessage.dispatchMsgToInterestArea(this, upm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
checkGuildStatus();
|
||||
|
||||
//give gold for level up if level is under or equal to 20 and over 10
|
||||
if(this.level >= 10 && this.level < 20) {
|
||||
int gold = (int) ((100000 * (this.level - 10) / 55.0) / groupSize);
|
||||
this.charItemManager.addGoldToInventory(gold, false);
|
||||
this.charItemManager.updateInventory();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
this.exp += remainingXP;
|
||||
@@ -4640,7 +4651,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
tmpLevel = targetLevel;
|
||||
|
||||
tmpLevel = (short) Math.min(tmpLevel, 75);
|
||||
tmpLevel = (short) Math.min(tmpLevel, MBServerStatics.LEVELCAP);
|
||||
|
||||
while (this.level < tmpLevel) {
|
||||
grantXP(Experience.getBaseExperience(tmpLevel) - this.exp);
|
||||
@@ -4845,8 +4856,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
@Override
|
||||
public void update(Boolean newSystem) {
|
||||
|
||||
if(!newSystem)
|
||||
return;
|
||||
//if(!newSystem)
|
||||
// return;
|
||||
|
||||
if (this.updateLock.writeLock().tryLock()) {
|
||||
try {
|
||||
@@ -4858,19 +4869,19 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
forceRespawn(this);
|
||||
return;
|
||||
}
|
||||
updateLocation();
|
||||
updateMovementState();
|
||||
updateRegen();
|
||||
this.updateLocation();
|
||||
this.updateMovementState();
|
||||
this.updateRegen();
|
||||
|
||||
if (this.getStamina() < 10) {
|
||||
if (this.getAltitude() > 0 || this.getDesiredAltitude() > 0) {
|
||||
PlayerCharacter.GroundPlayer(this);
|
||||
updateRegen();
|
||||
this.updateRegen();
|
||||
}
|
||||
}
|
||||
|
||||
RealmMap.updateRealm(this);
|
||||
updateBlessingMessage();
|
||||
this.updateBlessingMessage();
|
||||
|
||||
this.safeZone = this.isInSafeZone();
|
||||
if(!this.timestamps.containsKey("nextBoxCheck"))
|
||||
@@ -4886,11 +4897,11 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
while (this.level < 10) {
|
||||
grantXP(Experience.getBaseExperience(this.level + 1) - this.exp);
|
||||
}
|
||||
if(this.charItemManager != null && this.charItemManager.getGoldInventory() != null && this.charItemManager.getGoldInventory().getNumOfItems() < 1000) {
|
||||
this.getCharItemManager().addGoldToInventory(1000, false);
|
||||
this.getCharItemManager().addItemToInventory(new MobLoot(this, ItemBase.getItemBase(980066), 1, false).promoteToItem(this));
|
||||
this.getCharItemManager().updateInventory();
|
||||
}
|
||||
//if(this.charItemManager != null && this.charItemManager.getGoldInventory() != null && this.charItemManager.getGoldInventory().getNumOfItems() < 1000) {
|
||||
// this.getCharItemManager().addGoldToInventory(1000, false);
|
||||
// this.getCharItemManager().addItemToInventory(new MobLoot(this, ItemBase.getItemBase(980066), 1, false).promoteToItem(this));
|
||||
// this.getCharItemManager().updateInventory();
|
||||
//}
|
||||
}
|
||||
|
||||
if(this.isBoxed && !this.containsEffect(1672601862)) {
|
||||
|
||||
@@ -517,8 +517,8 @@ public class WorldServer {
|
||||
Logger.info("Starting Bane Thread");
|
||||
BaneThread.startBaneThread();
|
||||
|
||||
Logger.info("Starting Player Update Thread");
|
||||
UpdateThread.startUpdateThread();
|
||||
//Logger.info("Starting Player Update Thread");
|
||||
//UpdateThread.startUpdateThread();
|
||||
|
||||
|
||||
printThreads();
|
||||
|
||||
Reference in New Issue
Block a user