Browse Source

Signature refactor.

mobile-class-refactor
MagicBot 1 year ago
parent
commit
e2d843b65e
  1. 35
      src/engine/net/client/handlers/MinionTrainingMsgHandler.java
  2. 21
      src/engine/objects/Mob.java

35
src/engine/net/client/handlers/MinionTrainingMsgHandler.java

@ -8,7 +8,6 @@ import engine.gameManager.BuildingManager; @@ -8,7 +8,6 @@ import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.gameManager.NPCManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
@ -146,42 +145,10 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler { @@ -146,42 +145,10 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (mobBase == 0)
return true;
Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase);
if (siegeMob == null)
return true;
if (siegeMob != null) {
siegeMob.setSpawnTime(60 * 15);
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
siegeMob.building = building;
siegeMob.parentZone = zone;
// Slot siege minion
// Can be either corner tower or bulwark.
int slot;
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER))
slot = 2;
else
slot = ((NPC) siegeMob.guardCaptain).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain
BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation());
// Rotate slot position by the building rotation
siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY);
siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc);
siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc);
zone.zoneMobSet.add(siegeMob);
siegeMob.setLoc(siegeMob.bindLoc);
}
}
ManageNPCMsg mnm = new ManageNPCMsg(npc);

21
src/engine/objects/Mob.java

@ -663,38 +663,39 @@ public class Mob extends AbstractIntelligenceAgent { @@ -663,38 +663,39 @@ public class Mob extends AbstractIntelligenceAgent {
return minionMobile;
}
public static synchronized Mob createSiegeMob(NPC owner, int loadID, Guild guild, Zone parent, Vector3fImmutable loc, short level) {
public static synchronized Mob createSiegeMinion(NPC artyCaptain, int loadID) {
Mob siegeMinion;
if (owner.getSiegeMinionMap().size() == 3)
if (artyCaptain.getSiegeMinionMap().size() == 3)
return null;
siegeMinion = new Mob();
siegeMinion.level = 1;
siegeMinion.loadID = loadID;
siegeMinion.guildUUID = guild.getObjectUUID();
siegeMinion.guildUUID = artyCaptain.guildUUID;
siegeMinion.equipmentSetID = 0;
siegeMinion.buildingUUID = owner.buildingUUID;
siegeMinion.guardCaptain = owner;
siegeMinion.parentZoneUUID = parent.getObjectUUID();
siegeMinion.buildingUUID = artyCaptain.buildingUUID;
siegeMinion.guardCaptain = artyCaptain;
siegeMinion.parentZoneUUID = artyCaptain.parentZoneUUID;
siegeMinion.behaviourType = MobBehaviourType.SiegeEngine;
siegeMinion.bindLoc = Vector3fImmutable.ZERO;
siegeMinion.spawnTime = (60 * 15);
int slot = 0;
if (!owner.getSiegeMinionMap().containsValue(1))
if (!artyCaptain.getSiegeMinionMap().containsValue(1))
slot = 1;
else if (!owner.getSiegeMinionMap().containsValue(2))
else if (!artyCaptain.getSiegeMinionMap().containsValue(2))
slot = 2;
owner.getSiegeMinionMap().put(siegeMinion, slot);
artyCaptain.getSiegeMinionMap().put(siegeMinion, slot);
siegeMinion.runAfterLoad();
siegeMinion.despawned = true;
DbManager.addToCache(siegeMinion);
siegeMinion.setLoc(siegeMinion.bindLoc);
siegeMinion.despawn();
return siegeMinion;
}

Loading…
Cancel
Save