Compare commits

...

38 Commits

Author SHA1 Message Date
FatBoy 39638e4789 mob ai work 2025-01-08 18:08:38 -06:00
FatBoy 277bb14bab mob ai work 2025-01-08 17:55:06 -06:00
FatBoy 033f7c9ccf mob ai work 2025-01-08 17:53:46 -06:00
FatBoy b3026c9cab mob ai work 2025-01-08 17:46:59 -06:00
FatBoy a33ac85b21 mob ai work 2025-01-08 17:46:46 -06:00
FatBoy ff4010d652 mob ai work 2025-01-08 17:41:21 -06:00
FatBoy 9d46da8d07 mob ai work 2025-01-08 17:38:55 -06:00
FatBoy c581d19990 mob ai work 2025-01-08 17:36:51 -06:00
FatBoy 40c77df0fe mob ai work 2025-01-08 17:34:35 -06:00
FatBoy 789b3f3ffb mob ai work 2025-01-08 17:32:25 -06:00
FatBoy 83be9f4ec5 mob ai work 2025-01-08 17:28:19 -06:00
FatBoy 728db63024 mob ai work 2025-01-08 07:20:49 -06:00
FatBoy 2815bc74ad mob ai work 2025-01-07 21:56:34 -06:00
FatBoy 87d95e3c48 mob ai work 2025-01-07 21:48:18 -06:00
FatBoy 20f9d136b6 new mob AI 2025-01-06 21:14:05 -06:00
FatBoy f0594fb1b2 sitting only toggle when casting spells not skills 2025-01-06 12:45:20 -06:00
FatBoy a155bc0308 modified ht chance 2025-01-06 07:14:40 -06:00
FatBoy dce7444483 modified ht chance 2025-01-06 06:54:26 -06:00
FatBoy 76eed79b0a repair cost formula fixed 2025-01-05 20:05:41 -06:00
FatBoy f73ed17c05 repair cost formula 2025-01-05 19:24:05 -06:00
FatBoy b049d21aff corpse timer 2025-01-05 18:53:00 -06:00
FatBoy f6cce5ee1f corpse timer 2025-01-05 18:52:53 -06:00
FatBoy 8038c2ebe2 arena que messages 2025-01-05 18:52:10 -06:00
FatBoy 9f51b9af57 arena que messages 2025-01-05 18:42:06 -06:00
FatBoy cbc75bf9d7 irekei healer blood prophet 2025-01-05 17:40:55 -06:00
FatBoy 0ecfa546cd SDR bind loc for errants 2025-01-05 16:43:38 -06:00
FatBoy b89fb0803d SDR bind loc for errants 2025-01-05 15:41:10 -06:00
FatBoy 11005d58a7 SDR bind loc for errants 2025-01-05 15:39:41 -06:00
FatBoy b0c6239314 SDR bind loc for errants 2025-01-05 15:36:30 -06:00
FatBoy 67f66155e9 SDR bind loc for errants 2025-01-05 15:28:51 -06:00
FatBoy 7fbae12e99 mob update 2025-01-05 14:53:05 -06:00
FatBoy 65580c0a47 mob update 2025-01-05 14:51:43 -06:00
FatBoy 236afe4cc6 mob update 2025-01-05 14:48:51 -06:00
FatBoy c23a6af28f mob update 2025-01-05 14:45:45 -06:00
FatBoy 2535106d2c player update sync 2025-01-05 14:38:07 -06:00
FatBoy d8379ae5a9 shades dont break hide when moving 2025-01-05 11:18:39 -06:00
FatBoy 9f13f5fc5d add sprint to shade stealth 2025-01-05 10:56:14 -06:00
FatBoy 884cb30ebd trade bug 2025-01-05 09:26:42 -06:00
18 changed files with 491 additions and 66 deletions
+9 -17
View File
@@ -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,
+7 -3
View File
@@ -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);
}
+8
View File
@@ -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);
+10
View File
@@ -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() {
+8 -10
View File
@@ -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;
}
}
+8 -5
View File
@@ -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);
+17
View File
@@ -601,6 +601,23 @@ public class MobAI {
if (mob == null)
return;
boolean continueExecution = false;
switch(mob.BehaviourType){
case GuardCaptain:
case GuardMinion:
case Pet1:
case GuardWallArcher:
case HamletGuard:
case SimpleStandingGuard:
continueExecution = true;
break;
}
if(!continueExecution) {
MobAi2.runAI(mob);
return;
}
if(mob.isAlive())
if(!mob.getMovementLoc().equals(Vector3fImmutable.ZERO))
mob.setLoc(mob.getMovementLoc());
+360
View File
@@ -0,0 +1,360 @@
package engine.mobileAI;
import engine.Enum;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.*;
import engine.mobileAI.Threads.MobAIThread;
import engine.mobileAI.utilities.CombatUtilities;
import engine.mobileAI.utilities.MovementUtilities;
import engine.objects.*;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.util.HashSet;
import java.util.concurrent.ThreadLocalRandom;
public class MobAi2 {
public enum State
{
Idle,
Patrolling,
Attacking,
Dead
}
public static boolean Agressive(Mob mob){
return mob.BehaviourType.name().contains("Aggro");
}
public static boolean Caster(Mob mob){
return mob.BehaviourType.name().contains("Power");
}
public static boolean HelpResponder(Mob mob){
return mob.BehaviourType.name().contains("Helpee");
}
public static State getState(Mob mob){
if(!mob.isAlive())
return State.Dead;
if(mob.playerAgroMap.isEmpty())
return State.Idle;
if(mob.combatTarget != null)
return State.Attacking;
return State.Patrolling;
}
public static void runAI(Mob mob){
//these will be handled in special conditions later
switch(mob.BehaviourType){
case GuardCaptain:
case GuardMinion:
case Pet1:
case GuardWallArcher:
case HamletGuard:
case SimpleStandingGuard:
return;
}
switch(getState(mob)){
case Idle:
if(mob.isMoving())
mob.stopMovement(mob.loc);
if(mob.combatTarget != null) {
mob.setCombatTarget(null);
mob.setCombat(false);
}
return;
case Dead:
respawn(mob);
break;
case Patrolling:
patrol(mob);
break;
case Attacking:
attack(mob);
break;
}
}
//handles respawning and de-spawning for mobs and their corpses
public static void respawn(Mob mob){
//if mob doesn't have a death time somehow, set it to now
if (mob.deathTime == 0)
mob.setDeathTime(System.currentTimeMillis());
//only execute this logic is the mob hasn't de-spawned yet
if (!mob.despawned) {
//if the inventory is empty, the mob can disappear
if(mob.getInventory(true).isEmpty() && System.currentTimeMillis() > mob.deathTime + 10000L) {
mob.despawn();
mob.deathTime = System.currentTimeMillis();
return;
}
//if the mob has been dead for 10 seconds it can disappear
if (System.currentTimeMillis() > mob.deathTime + 10000L) {
mob.despawn();
mob.deathTime = System.currentTimeMillis();
return;
}
}
//disc dropper respawns are handled elsewhere
if(Mob.discDroppers.contains(mob))
return;
//if mob isn't queued for respawn, do so now
if (!Zone.respawnQue.contains(mob)) {
if (System.currentTimeMillis() > (mob.deathTime + (mob.spawnTime * 1000L))) {
Zone.respawnQue.add(mob);
}
}
}
//handles patrolling and looking for potential combat targets
public static void patrol(Mob mob){
if(Agressive(mob) && mob.combatTarget == null) {
HashSet<AbstractWorldObject> potentialTargets = WorldGrid.getObjectsInRangePartial(mob.loc, 50, MBServerStatics.MASK_PLAYER);
for (AbstractWorldObject awo : potentialTargets) {
PlayerCharacter target = (PlayerCharacter) awo;
if (mob.canSee(target))
mob.setCombatTarget(target);
if (mob.combatTarget != null) {
return;
}
}
}
if(mob.isMoving() || !mob.BehaviourType.canRoam)
return;
int patrolDelay = ThreadLocalRandom.current().nextInt((int) (MobAIThread.AI_PATROL_DIVISOR * 0.5f), MobAIThread.AI_PATROL_DIVISOR) + MobAIThread.AI_PATROL_DIVISOR;
if (mob.stopPatrolTime + (patrolDelay * 1000L) > System.currentTimeMillis())
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){
AbstractWorldObject target = mob.combatTarget;
if (target == null || !target.isAlive()) {
mob.setCombatTarget(null);
return;
}
if(!mob.isCombat())
mob.setCombat(true);
if (!CombatUtilities.inRangeToAttack(mob, target) && mob.BehaviourType.canRoam) {
if(mob.nextChaseUpdate < System.currentTimeMillis()) {
mob.nextChaseUpdate = System.currentTimeMillis() + 2500L;
MovementUtilities.aiMove(mob, target.loc, false);
}
return;
}
switch (target.getObjectType()) {
case PlayerCharacter:
PlayerCharacter targetPlayer = (PlayerCharacter) target;
AttackPlayer(mob, targetPlayer);
break;
case Building:
Building targetBuilding = (Building) target;
AttackBuilding(mob, targetBuilding);
break;
case Mob:
Mob targetMob = (Mob) target;
AttackMob(mob, targetMob);
break;
}
}
public static void AttackPlayer(Mob mob, PlayerCharacter target) {
try {
if (!mob.canSee(target)) {
mob.setCombatTarget(null);
return;
}
if (mob.BehaviourType.callsForHelp)
MobCallForHelp(mob);
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
mob.setCombatTarget(null);
return;
}
if (CombatUtilities.inRange2D(mob, target, mob.getRange())) {
//no weapons, default mob attack speed 3 seconds.
if (System.currentTimeMillis() < mob.getLastAttackTime())
return;
// ranged mobs can't attack while running. skip until they finally stop.
if (mob.isMoving() && mob.getRange() > 20)
return;
// add timer for last attack.
ItemBase mainHand = mob.getWeaponItemBase(true);
ItemBase offHand = mob.getWeaponItemBase(false);
if (mainHand == null && offHand == null) {
CombatUtilities.combatCycle(mob, target, true, null);
int delay = 3000;
if (mob.isSiege())
delay = 11000;
mob.setLastAttackTime(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);
} 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);
}
}
if (target.getPet() != null)
if (target.getPet().getCombatTarget() == null && target.getPet().assist)
target.getPet().setCombatTarget(mob);
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackPlayer" + " " + e.getMessage());
}
}
public static void AttackBuilding(Mob mob, Building target) {
try {
if(mob == null || target == null)
return;
if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
mob.setCombatTarget(null);
return;
}
City playerCity = ZoneManager.getCityAtLocation(mob.getLoc());
if (playerCity != null)
for (Mob guard : playerCity.getParent().zoneMobSet)
if (guard.BehaviourType != null && guard.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
if (guard.getCombatTarget() == null && guard.getGuild() != null && mob.getGuild() != null && !guard.getGuild().equals(mob.getGuild()))
guard.setCombatTarget(mob);
if (mob.isSiege())
MovementManager.sendRWSSMsg(mob);
ItemBase mainHand = mob.getWeaponItemBase(true);
ItemBase offHand = mob.getWeaponItemBase(false);
if (mainHand == null && offHand == null) {
CombatUtilities.combatCycle(mob, target, true, null);
int delay = 3000;
if (mob.isSiege())
delay = 15000;
mob.setLastAttackTime(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);
} 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);
}
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
}
}
public static void AttackMob(Mob mob, Mob target) {
try {
if (mob.getRange() >= 30 && mob.isMoving())
return;
//no weapons, default mob attack speed 3 seconds.
ItemBase mainHand = mob.getWeaponItemBase(true);
ItemBase offHand = mob.getWeaponItemBase(false);
if (mainHand == null && offHand == null) {
CombatUtilities.combatCycle(mob, target, true, null);
int delay = 3000;
if (mob.isSiege())
delay = 11000;
mob.setLastAttackTime(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);
} 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);
if (target.getCombatTarget() == null) {
target.setCombatTarget(mob);
}
}
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage());
}
}
public static void MobCallForHelp(Mob mob) {
if (mob.nextCallForHelp == 0)
mob.nextCallForHelp = System.currentTimeMillis();
if (mob.nextCallForHelp > System.currentTimeMillis())
return;
Zone mobCamp = mob.getParentZone();
for (Mob helper : mobCamp.zoneMobSet) {
if (HelpResponder(helper)) {
helper.setCombatTarget(mob.getCombatTarget());
break;
}
}
mob.nextCallForHelp = System.currentTimeMillis() + 30000L;
}
}
@@ -8,6 +8,8 @@
package engine.mobileAI.Threads;
import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.ZoneManager;
import engine.objects.Mob;
import engine.objects.Zone;
@@ -49,6 +51,8 @@ public class MobRespawnThread implements Runnable {
respawner.respawn();
zone.respawnQue.remove(respawner);
zone.lastRespawn = System.currentTimeMillis();
WorldGrid.updateObject(respawner);
InterestManager.setObjectDirty(respawner);
}
}
} catch (Exception e) {
@@ -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) {
+6 -9
View File
@@ -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;
}
+15 -6
View File
@@ -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);
+2
View File
@@ -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);
+4 -1
View File
@@ -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() {
+20 -4
View File
@@ -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.*;
@@ -23,6 +24,7 @@ import engine.math.Quaternion;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.mobileAI.Threads.MobAIThread;
import engine.mobileAI.utilities.MovementUtilities;
import engine.net.ByteBufferWriter;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
@@ -82,6 +84,7 @@ public class Mob extends AbstractIntelligenceAgent {
public int lastPatrolPointIndex = 0;
public long stopPatrolTime = 0;
public City guardedCity;
public long nextChaseUpdate = 0;
protected int dbID; //the database ID
protected int loadID;
protected float spawnRadius;
@@ -1326,8 +1329,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 +1408,8 @@ public class Mob extends AbstractIntelligenceAgent {
Logger.error(e);
}
this.updateLocation();
//resync corpses
InterestManager.setObjectDirty(this);
}
public void respawn() {
@@ -1441,12 +1444,23 @@ public class Mob extends AbstractIntelligenceAgent {
loadInventory();
this.updateLocation();
reloadAgroMap(this);
}
private static void reloadAgroMap(Mob mob){
mob.playerAgroMap.clear();
for(AbstractWorldObject obj : WorldGrid.getObjectsInRangePartial(mob.loc,MBServerStatics.CHARACTER_LOAD_RANGE,1)){
if(!mob.playerAgroMap.containsKey(obj.getObjectUUID())){
mob.playerAgroMap.put(obj.getObjectUUID(),false);
}
}
}
public void despawn() {
this.despawned = true;
this.stopPatrolTime = System.currentTimeMillis();
WorldGrid.RemoveWorldObject(this);
this.charItemManager.clearInventory();
@@ -2146,8 +2160,9 @@ public class Mob extends AbstractIntelligenceAgent {
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(this.getBindLoc(), patrolRadius);
this.patrolPoints.add(newPatrolPoint);
if (i == 1)
MovementManager.translocate(this, newPatrolPoint, null);
if (i == 1) {
MovementUtilities.aiMove(this,newPatrolPoint,true);
}
}
}
@@ -2165,6 +2180,7 @@ public class Mob extends AbstractIntelligenceAgent {
}
this.deathTime = 0;
InterestManager.setObjectDirty(this);
} catch (Exception e) {
Logger.error(e.getMessage());
}
+8 -8
View File
@@ -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
@@ -4845,8 +4845,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 +4858,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"))
+2 -2
View File
@@ -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();