make wall archers great again

This commit is contained in:
2023-04-22 21:55:06 -05:00
parent ed1a6192c7
commit 09d7ff0740
3 changed files with 39 additions and 50 deletions
+22
View File
@@ -352,6 +352,16 @@ public class MobileFSM {
if (mob == null) {
return;
}
if(mob.despawned == true && mob.getMobBase().getLoadID() == 13171){
//trebuchet spawn handler
CheckForRespawn(mob);
return;
}
if(mob.despawned == true && mob.isPlayerGuard == true){
//override for guards
CheckForRespawn(mob);
return;
}
if (mob.isAlive() == false) {
//no need to continue if mob is dead, check for respawn and move on
CheckForRespawn(mob);
@@ -362,6 +372,7 @@ public class MobileFSM {
return;
}
CheckToSendMobHome(mob);
mob.updateLocation();
switch(mob.BehaviourType){
case GuardCaptain:
GuardCaptainLogic(mob);
@@ -484,6 +495,16 @@ public class MobileFSM {
if (mob.isAlive() == false){
return;
}
if(MovementUtilities.inRangeDropAggro(mob,(PlayerCharacter)mob.getCombatTarget()) == false){
mob.setCombatTarget(null);
if (mob.isCombat()) {
mob.setCombat(false);
UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(mob);
DispatchMessage.sendToAllInRange(mob, rwss);
}
return;
}
if (!mob.isCombat()) {
mob.setCombat(true);
UpdateStateMsg rwss = new UpdateStateMsg();
@@ -580,6 +601,7 @@ public class MobileFSM {
if(mob.getCombatTarget() != null && mob.getCombatTarget().isAlive() == false){
mob.setCombatTarget(null);
}
if(MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam){
CheckMobMovement(mob);
}
+2 -1
View File
@@ -477,7 +477,8 @@ public enum BuildingManager {
mob.setRank(rank);
mob.setPlayerGuard(true);
mob.setParentZone(zone);
mob.BehaviourType = Enum.MobBehaviourType.GuardWallArcher;
MovementManager.translocate(mob,mob.getBindLoc(),mob.getRegion());
return true;
}
if (NPC.ISGuardCaptain(contractID.getContractID())) {
+15 -49
View File
@@ -501,51 +501,6 @@ public class Mob extends AbstractIntelligenceAgent {
writer.putInt(objectType);
writer.putInt(mob.currentID);
}
/**
* Generate a random quantity of gold for this mob.
*
* @return Quantity of gold
*/
public static int randomGoldAmount(Mob mob) {
// percentage chance to drop gold
//R8 mobs have 100% gold drop.
if (mob.getLevel() < 80)
if ((ThreadLocalRandom.current().nextDouble() * 100d) > MBServerStatics.GOLD_DROP_PERCENTAGE_CHANCE)
return 0;
int level = mob.getLevel();
level = Math.max(level, 0);
level = Math.min(level, 50);
double minGold;
double maxGold;
if (mob.mobBase != null) {
minGold = mob.mobBase.getMinGold();
maxGold = mob.mobBase.getMaxGold();
} else {
minGold = MBServerStatics.GOLD_DROP_MINIMUM_PER_MOB_LEVEL[level];
maxGold = MBServerStatics.GOLD_DROP_MAXIMUM_PER_MOB_LEVEL[level];
}
double gold = (ThreadLocalRandom.current().nextDouble() * (maxGold - minGold) + minGold);
//server specific gold multiplier
gold *= Float.parseFloat(ConfigManager.MB_NORMAL_DROP_RATE.getValue());
//modify for hotzone
if (ZoneManager.inHotZone(mob.getLoc()))
gold *= Float.parseFloat(ConfigManager.MB_HOTZONE_DROP_RATE.getValue());
return (int) gold;
}
public static Mob createMob(int loadID, Vector3fImmutable spawn, Guild guild, boolean isMob, Zone parent, Building building, int contractID) {
Mob mobWithoutID = new Mob("", "", (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 1, 0, false, false, false, spawn, spawn, Vector3fImmutable.ZERO, (short) 1, (short) 1, (short) 1, guild, (byte) 0, loadID, isMob, parent, building, contractID);
@@ -561,10 +516,19 @@ public class Mob extends AbstractIntelligenceAgent {
mob.setObjectTypeMask(MBServerStatics.MASK_MOB | mob.getTypeMasks());
mob.setMob();
mob.setParentZone(parent);
mob.setInBuildingLoc(building, mob);
Vector3fImmutable buildingWorldLoc = ZoneManager.convertLocalToWorld(building, mob.inBuildingLoc);
mob.setBindLoc(buildingWorldLoc);
mob.setLoc(buildingWorldLoc);
mob.region = AbstractWorldObject.GetRegionByWorldObject(mob);
MovementManager.translocate(mob,buildingWorldLoc,mob.region);
mob.nameOverride = NPC.getPirateName(mob.getMobBaseID()) + " the " + mob.getContract().getName();
mob.runAfterLoad();
} catch (Exception e) {
Logger.error("SQLException:" + e.getMessage());
mob = null;
}
return mob;
}
@@ -853,7 +817,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.endLoc = buildingWorldLoc;
this.stopMovement(endLoc);
if (this.building.getBlueprintUUID() != 0 && this.building.getBlueprint().isWallPiece())
if (this.building.getBlueprintUUID() != 0 && this.building.getBlueprint().isWallPiece() && this.contract == null)
MovementManager.translocate(this, new Vector3fImmutable(this.building.getLoc().x, this.npcOwner.getLoc().y, this.building.getLoc().z), this.region);
return;
@@ -1646,9 +1610,11 @@ public class Mob extends AbstractIntelligenceAgent {
if (npc != null) {
if (npc.getSiegeMinionMap().containsKey(this)) putSlot = npc.getSiegeMinionMap().get(this);
} else if (mob != null)
if (mob.getSiegeMinionMap().containsKey(this)) putSlot = mob.getSiegeMinionMap().get(this);
} else if (mob != null) {
//if (mob.getSiegeMinionMap().containsKey(this)) putSlot = mob.getSiegeMinionMap().get(this);
int hirelings = mob.building.getHirelings().size();
putSlot = hirelings;
}
int count = 0;
for (BuildingLocation slotLoc : buildingModel.getLocations())