Public Repository for the Magicbane Shadowbane Emulator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
5.1 KiB

// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.LootManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable;
import engine.mobileAI.utilities.MovementUtilities;
import engine.objects.*;
import org.pmw.tinylog.Logger;
/**
* @author Eighty
*/
public class AddMobCmd extends AbstractDevCmd {
public AddMobCmd() {
super("mob");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length != 1) {
this.sendUsage(pc);
return;
}
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (words[0].equals("all")) {
for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) {
MobBase mb = (MobBase) mobbaseAGO;
int loadID = mb.getObjectUUID();
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
null, true, zone, null, 0, "", 1);
if (mob != null) {
mob.updateDatabase();
this.setResult(String.valueOf(mob.getDBID()));
} else {
throwbackError(pc, "Failed to create mob of type " + loadID);
Logger.error("Failed to create mob of type "
+ loadID);
}
}
return;
}
int loadID;
try {
loadID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied type " + words[0]
+ " failed to parse to an Integer");
return;
} catch (Exception e) {
throwbackError(pc,
"An unknown exception occurred when trying to use mob command for type "
+ words[0]);
return; // NaN
}
if (zone == null) {
throwbackError(pc, "Failed to find zone to place mob in.");
return;
}
if (zone.isPlayerCity()) {
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
return;
}
Mob mob = Mob.createMob(loadID, pc.getLoc(),null, true, zone, null, 0, "", 1);
//Mob mob = Mob.createStrongholdMob(loadID,pc.loc,Guild.getErrantGuild(),true,zone,null,0,"Whitehorn Militant",75);
if (mob != null) {
mob.updateDatabase();
ChatManager.chatSayInfo(pc,
"Mob with ID " + mob.getDBID() + " added");
this.setResult(String.valueOf(mob.getDBID()));
mob.parentZone = zone;
mob.bindLoc = pc.loc;
mob.setLoc(pc.loc);
mob.equipmentSetID = 6327;
mob.runAfterLoad();
mob.setLevel((short)75);
mob.setResists(new Resists("Elite"));
mob.spawnTime = 10;
mob.BehaviourType = Enum.MobBehaviourType.Aggro;
zone.zoneMobSet.add(mob);
mob.isHellgateMob = true;
LootManager.GenerateStrongholdLoot(mob,false,false);
mob.healthMax = mob.mobBase.getHealthMax();
mob.setHealth(mob.healthMax);
mob.maxDamageHandOne = 1550;
mob.minDamageHandOne = 750;
mob.atrHandOne = 1800;
mob.defenseRating = 2200;
mob.setFirstName("Whitehorn Militant");
//InterestManager.setObjectDirty(mob);
//WorldGrid.addObject(mob,pc.loc.x,pc.loc.z);
//WorldGrid.updateObject(mob);
//guard.stronghold = mine;
mob.mobPowers.clear();
mob.mobPowers.put(429399948,20); // find weakness
} else {
throwbackError(pc, "Failed to create mob of type " + loadID);
Logger.error("Failed to create mob of type "
+ loadID);
}
}
@Override
protected String _getHelpString() {
return "Creates a Mob of type 'mobID' at the location your character is standing";
}
@Override
protected String _getUsageString() {
return "' /mob mobID'";
}
}