Compare commits

..

3 Commits

Author SHA1 Message Date
FatBoy 6a6856876e stronghold generation 2025-01-05 09:15:27 -06:00
FatBoy d1971e7d6e stronghold islands? 2025-01-04 19:34:59 -06:00
FatBoy 2dfa7b9090 stronghold islands? 2025-01-04 19:20:19 -06:00
29 changed files with 170 additions and 502 deletions
+17 -9
View File
@@ -9,13 +9,15 @@
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.*;
import engine.objects.AbstractCharacter;
import engine.objects.ItemBase;
import engine.objects.Shrine;
import engine.objects.Zone;
import engine.powers.EffectsBase;
import org.pmw.tinylog.Logger;
@@ -469,14 +471,11 @@ 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);
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,30f);
}
else
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
}
@@ -1091,6 +1090,15 @@ public class Enum {
DamageShield,
DeathShroud,
DefenseBuff,
DefenseBuffAss,
DefenseBuffChn,
DefenseBuffDsr,
DefenseBuffFur,
DefenseBuffNec,
DefenseBuffNsr,
DefenseBuffPrl,
DefenseBuffRng,
DefenseBuffWiz,
DefenseBuffGroup,
DefenseDebuff,
DetectInvis,
+3 -7
View File
@@ -134,13 +134,9 @@ public class dbItemHandler extends dbHandlerBase {
ResultSet rs = preparedStatement.executeQuery();
if (rs.next()) {
try {
worked = rs.getBoolean("result");
}catch(Exception e){
worked = false;
}
}
if (rs.next())
worked = rs.getBoolean("result");
} catch (SQLException e) {
Logger.error(e);
}
-8
View File
@@ -18,7 +18,6 @@ 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;
@@ -531,13 +530,6 @@ 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,20 +49,10 @@ 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() {
+10 -8
View File
@@ -1453,17 +1453,19 @@ public enum CombatManager {
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
}
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));
public static boolean LandHit(int atr, int defense){
int roll = ThreadLocalRandom.current().nextInt(101);
float chance = (float)((atr-((atr+defense)*0.315))/((defense-((atr+defense)*0.315))+(atr-((atr+defense)*0.315))));
if(roll < 5)//always 5% chance ot miss
return false;
int connvertedChance = (int)(chance * 100);
return roll <= convertedChance;
if(connvertedChance < 5)
connvertedChance = 5;
if(connvertedChance > 95)
connvertedChance = 95;
return connvertedChance > roll;
}
}
-6
View File
@@ -75,12 +75,6 @@ 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;
+5 -8
View File
@@ -165,7 +165,7 @@ public enum PowersManager {
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
if(!pc.isFlying() && powersBaseByToken.get(msg.getPowerUsedID()) != null && powersBaseByToken.get(msg.getPowerUsedID()).isSpell) //cant be sitting if flying
if(!pc.isFlying()) //cant be sitting if flying
CombatManager.toggleSit(false,origin);
if(pc.isMoving())
@@ -787,13 +787,10 @@ public enum PowersManager {
if (playerCharacter == null || msg == null)
return;
//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() == 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() == 429494441) {//wildkins chase
playerCharacter.removeEffectBySource(EffectSourceType.Root,40,true);
playerCharacter.removeEffectBySource(EffectSourceType.Snare,40,true);
@@ -3,9 +3,11 @@ package engine.gameManager;
import engine.Enum;
import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid;
import engine.math.Vector2f;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
@@ -344,4 +346,38 @@ public class StrongholdManager {
}
}
}
//=====================================NEW STUFF
public static void generateMaze(){
Zone stronghold = ZoneManager.getZoneByUUID(995);
ArrayList<Vector3fImmutable> gridLocs = new ArrayList<>();
for(int x = -7; x < 8; x++){
for(int z = -7; z < 8; z++) {
if((x >= -1 || x <= 1) && (z >= -1 || z <= 1))
continue;
float offsetX = x * 128;
float offsetZ = z * 128;
Vector3fImmutable sLoc = stronghold.getLoc();
Vector3fImmutable loc = new Vector3fImmutable(offsetX,sLoc.y,offsetZ);
gridLocs.add(loc);
}
}
for(Vector3fImmutable loc : gridLocs){
createBuilding(stronghold,405600,loc);
}
}
public static void createBuilding(Zone zone, int blueprint, Vector3fImmutable offset){
Vector3fImmutable localLoc = ZoneManager.worldToLocal(offset, zone);
Building building = DbManager.BuildingQueries.
CREATE_BUILDING(
zone.getObjectUUID(), 0, "", 1,
localLoc, 1.0f, 0, Enum.ProtectionState.PROTECTED, 0, 1,
null, blueprint, 0, 0);
building.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
WorldGrid.addObject(building,zone.getLoc().x + offset.x,zone.getLoc().z + offset.z);
}
}
+1 -1
View File
@@ -117,7 +117,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
}
public void endEffect() {
if (this.eb == null || this.power == null)
if (this.eb == null)
return;
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
}
@@ -1,10 +0,0 @@
package engine.mobileAI.BehaviourFiles;
import engine.objects.Mob;
public class PlayerGuard {
public static void process(Mob guard){
}
}
@@ -1,86 +0,0 @@
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;
}
}
}
}
@@ -1,47 +0,0 @@
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);
}
}
}
@@ -1,155 +0,0 @@
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);
}
}
}
-32
View File
@@ -1,32 +0,0 @@
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);
}
}
+14 -11
View File
@@ -9,6 +9,7 @@
package engine.mobileAI;
import engine.Enum;
import engine.Enum.DispatchChannel;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.*;
import engine.math.Vector3f;
@@ -16,7 +17,9 @@ 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;
@@ -115,7 +118,7 @@ public class MobAI {
//no weapons, default mob attack speed 3 seconds.
if (System.currentTimeMillis() < mob.getNextAttackTime())
if (System.currentTimeMillis() < mob.getLastAttackTime())
return;
// ranged mobs cant attack while running. skip until they finally stop.
@@ -133,19 +136,19 @@ public class MobAI {
int delay = 3000;
if (mob.isSiege())
delay = 11000;
mob.setNextAttackTime(System.currentTimeMillis() + delay);
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.setNextAttackTime(System.currentTimeMillis() + delay);
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.setNextAttackTime(System.currentTimeMillis() + attackDelay);
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
}
}
@@ -190,19 +193,19 @@ public class MobAI {
int delay = 3000;
if (mob.isSiege())
delay = 15000;
mob.setNextAttackTime(System.currentTimeMillis() + delay);
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.setNextAttackTime(System.currentTimeMillis() + attackDelay);
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.setNextAttackTime(System.currentTimeMillis() + attackDelay);
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
}
//if (mob.isSiege()) {
@@ -233,19 +236,19 @@ public class MobAI {
int delay = 3000;
if (mob.isSiege())
delay = 11000;
mob.setNextAttackTime(System.currentTimeMillis() + delay);
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.setNextAttackTime(System.currentTimeMillis() + attackDelay);
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.setNextAttackTime(System.currentTimeMillis() + attackDelay);
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
if (target.getCombatTarget() == null) {
target.setCombatTarget(mob);
}
@@ -915,7 +918,7 @@ public class MobAI {
mob.setCombatTarget(null);
return;
}
if (System.currentTimeMillis() > mob.getNextAttackTime())
if (System.currentTimeMillis() > mob.getLastAttackTime())
AttackTarget(mob, mob.getCombatTarget());
} catch (Exception e) {
+1 -2
View File
@@ -1,7 +1,6 @@
package engine.mobileAI.Threads;
import engine.gameManager.ConfigManager;
import engine.mobileAI.EasyAI;
import engine.mobileAI.MobAI;
import engine.gameManager.ZoneManager;
import engine.objects.Mob;
@@ -34,7 +33,7 @@ public class MobAIThread implements Runnable{
try {
if (mob != null)
EasyAI.aiRun(mob);
MobAI.DetermineAction(mob);
} catch (Exception e) {
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
e.printStackTrace();
-27
View File
@@ -1,27 +0,0 @@
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, AbstractCharacter target) {
public static boolean inRangeToAggro(Mob agent, PlayerCharacter target) {
Vector3fImmutable sl = agent.getLoc();
Vector3fImmutable tl = target.getLoc();
@@ -169,9 +169,6 @@ 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));
}
+9 -6
View File
@@ -1681,12 +1681,15 @@ public class ClientMessagePump implements NetMsgHandler {
return;
}
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();
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();
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
if (b != null)
@@ -146,8 +146,6 @@ 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,11 +631,6 @@ 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();
}
}
+6 -15
View File
@@ -14,7 +14,10 @@ import engine.Enum.*;
import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid;
import engine.exception.SerializationException;
import engine.gameManager.*;
import engine.gameManager.CombatManager;
import engine.gameManager.ConfigManager;
import engine.gameManager.MovementManager;
import engine.gameManager.PowersManager;
import engine.job.AbstractJob;
import engine.job.JobContainer;
import engine.job.JobScheduler;
@@ -761,11 +764,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public abstract Vector3fImmutable getBindLoc();
public final void setBindLoc(final Vector3fImmutable 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;
}
this.bindLoc = value;
}
public final Vector3fImmutable getFaceDir() {
@@ -1559,15 +1558,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
Effect eff = this.effects.get(s);
if (eff == null)
continue;
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()) {
if (eff.cancelOnMove() && eff.cancel()) {
//System.out.println("canceling on Move");
eff.cancelJob();
this.effects.remove(s);
-2
View File
@@ -43,7 +43,6 @@ public class Corpse extends AbstractWorldObject {
private int inBuildingID = 0;
private int inFloorID = -1;
private int inBuilding = -1;
public Long spawnedTime = 0L;
/**
* No Id Constructor
@@ -75,7 +74,6 @@ public class Corpse extends AbstractWorldObject {
}
this.setObjectTypeMask(MBServerStatics.MASK_CORPSE);
this.spawnedTime = System.currentTimeMillis();
if (!safeZone)
transferInventory(belongsTo, enterWorld);
+1 -4
View File
@@ -1227,10 +1227,7 @@ public class Item extends AbstractWorldObject {
}
public final int getMagicValue() {
int val = this.calcMagicValue();
if(val == 0)
val = 1;
return val + this.getItemBase().getMagicValue();
return this.magicValue;
}
public int getBaseValue() {
+7 -9
View File
@@ -12,7 +12,6 @@ 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.*;
@@ -96,7 +95,7 @@ public class Mob extends AbstractIntelligenceAgent {
private AbstractWorldObject fearedObject = null;
private int buildingID;
private boolean isSiege = false;
private long nextAttackTime = 0;
private long lastAttackTime = 0;
private int lastMobPowerToken = 0;
private HashMap<Integer, MobEquipment> equip = null;
private DeferredPowerJob weaponPower;
@@ -1327,6 +1326,8 @@ 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;
@@ -1406,8 +1407,6 @@ public class Mob extends AbstractIntelligenceAgent {
Logger.error(e);
}
this.updateLocation();
//resync corpses
InterestManager.setObjectDirty(this);
}
public void respawn() {
@@ -2166,7 +2165,6 @@ public class Mob extends AbstractIntelligenceAgent {
}
this.deathTime = 0;
InterestManager.setObjectDirty(this);
} catch (Exception e) {
Logger.error(e.getMessage());
}
@@ -2237,12 +2235,12 @@ public class Mob extends AbstractIntelligenceAgent {
return this.upgradeDateTime != null;
}
public long getNextAttackTime() {
return nextAttackTime;
public long getLastAttackTime() {
return lastAttackTime;
}
public void setNextAttackTime(long lastAttackTime) {
this.nextAttackTime = lastAttackTime;
public void setLastAttackTime(long lastAttackTime) {
this.lastAttackTime = lastAttackTime;
}
public void setDeathTime(long deathTime) {
+14 -25
View File
@@ -1300,7 +1300,7 @@ public class PlayerCharacter extends AbstractCharacter {
if (ConfigManager.serverType.equals(ServerType.WORLDSERVER))
player.setLoc(player.getBindLoc());
player.setLoc(player.bindLoc);
player.endLoc = Vector3fImmutable.ZERO;
//get level based on experience
@@ -2925,9 +2925,6 @@ 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);
@@ -3078,14 +3075,6 @@ 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;
@@ -4651,7 +4640,7 @@ public class PlayerCharacter extends AbstractCharacter {
tmpLevel = targetLevel;
tmpLevel = (short) Math.min(tmpLevel, MBServerStatics.LEVELCAP);
tmpLevel = (short) Math.min(tmpLevel, 75);
while (this.level < tmpLevel) {
grantXP(Experience.getBaseExperience(tmpLevel) - this.exp);
@@ -4856,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 {
@@ -4869,19 +4858,19 @@ public class PlayerCharacter extends AbstractCharacter {
forceRespawn(this);
return;
}
this.updateLocation();
this.updateMovementState();
this.updateRegen();
updateLocation();
updateMovementState();
updateRegen();
if (this.getStamina() < 10) {
if (this.getAltitude() > 0 || this.getDesiredAltitude() > 0) {
PlayerCharacter.GroundPlayer(this);
this.updateRegen();
updateRegen();
}
}
RealmMap.updateRealm(this);
this.updateBlessingMessage();
updateBlessingMessage();
this.safeZone = this.isInSafeZone();
if(!this.timestamps.containsKey("nextBoxCheck"))
@@ -4897,11 +4886,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)) {
+41
View File
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
public class Zone extends AbstractGameObject {
@@ -103,6 +104,46 @@ public class Zone extends AbstractGameObject {
}
//custom constructor
public Zone(int template, Vector3fImmutable loc, String name){
this.parentZoneID = 100;//seafloor
this.playerCityID = 0;
this.isPlayerCity = false;
this.zoneName = name;
this.xCoord = loc.x;
this.zCoord = loc.z;
this.yCoord = loc.y;
this.loadNum = template;
this.safeZone = (byte)0;
this.Icon1 = "T_Bandits";
this.Icon2 = "B_Standard";
this.Icon3 = "H_T_Bandits";
this.hash = null;
this.minLvl = 10;
this.maxLvl = 75;
//this needs to be here specifically for new zones created after server boot (e.g. player city zones)
Zone parentZone = ZoneManager.getZoneByUUID(parentZoneID);
this.setParent(parentZone);
if (this.minLvl == 0 && parentZone != null) {
this.minLvl = parentZone.minLvl;
this.maxLvl = parentZone.maxLvl;
}
if (parentZone != null)
parentZone.addNode(this);
// If zone doesn't yet hava a hash then write it back to the zone table
if (hash == null)
setHash();
}
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
if (zone.loadNum == 0 && zone.playerCityID == 0)
+3 -2
View File
@@ -517,13 +517,14 @@ 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();
Logger.info("Threads Running:");
StrongholdManager.generateMaze();
return true;
}