2022-04-30 09:41:17 -04:00
|
|
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
|
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
|
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
|
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
|
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
|
|
|
// Magicbane Emulator Project © 2013 - 2022
|
|
|
|
|
// www.magicbane.com
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package engine.powers.poweractions;
|
|
|
|
|
|
|
|
|
|
import engine.Enum.GameObjectType;
|
|
|
|
|
import engine.InterestManagement.WorldGrid;
|
2024-05-05 20:26:45 -05:00
|
|
|
import engine.gameManager.DbManager;
|
2022-04-30 09:41:17 -04:00
|
|
|
import engine.gameManager.MovementManager;
|
2024-05-05 20:26:45 -05:00
|
|
|
import engine.gameManager.ZoneManager;
|
2022-04-30 09:41:17 -04:00
|
|
|
import engine.math.Vector3fImmutable;
|
|
|
|
|
import engine.net.Dispatch;
|
|
|
|
|
import engine.net.DispatchMessage;
|
|
|
|
|
import engine.net.client.ClientConnection;
|
|
|
|
|
import engine.net.client.msg.PromptRecallMsg;
|
2024-05-05 20:26:45 -05:00
|
|
|
import engine.objects.*;
|
2022-04-30 09:41:17 -04:00
|
|
|
import engine.powers.ActionsBase;
|
|
|
|
|
import engine.powers.PowersBase;
|
|
|
|
|
import engine.server.MBServerStatics;
|
|
|
|
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
import java.sql.SQLException;
|
2024-05-05 20:26:45 -05:00
|
|
|
import java.util.concurrent.ThreadLocalRandom;
|
2022-04-30 09:41:17 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public class RecallPowerAction extends AbstractPowerAction {
|
|
|
|
|
|
2023-07-15 09:23:48 -04:00
|
|
|
public RecallPowerAction(ResultSet rs) throws SQLException {
|
|
|
|
|
super(rs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
|
|
|
|
if (!AbstractWorldObject.IsAbstractCharacter(awo) || source == null)
|
|
|
|
|
return;
|
|
|
|
|
AbstractCharacter awoac = (AbstractCharacter) awo;
|
|
|
|
|
|
|
|
|
|
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
|
|
|
|
|
|
|
|
|
PlayerCharacter pc = (PlayerCharacter) awo;
|
|
|
|
|
|
|
|
|
|
if (pc.hasBoon())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (source.getObjectUUID() != pc.getObjectUUID()) {
|
|
|
|
|
pc.setTimeStampNow("PromptRecall");
|
|
|
|
|
pc.setTimeStamp("LastRecallType", 1); //recall to bind
|
|
|
|
|
PromptRecallMsg promptRecallMsgmsg = new PromptRecallMsg();
|
|
|
|
|
Dispatch dispatch = Dispatch.borrow(pc, promptRecallMsgmsg);
|
|
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
|
|
|
|
|
|
|
|
|
} else {
|
2024-05-05 20:26:45 -05:00
|
|
|
if(pc.guild.equals(Guild.getErrantGuild()) || pc.guild.getNation().equals(Guild.getErrantGuild())){
|
|
|
|
|
Vector3fImmutable loc;
|
|
|
|
|
for (AbstractGameObject cityAgo : DbManager.getList(GameObjectType.City)) {
|
|
|
|
|
City city = (City) cityAgo;
|
|
|
|
|
if (city == null)
|
|
|
|
|
continue;
|
|
|
|
|
if (!city.getCityName().equalsIgnoreCase("sea dog's rest"))
|
|
|
|
|
continue;
|
|
|
|
|
Zone zone = city.getParent();
|
|
|
|
|
if (zone != null) {
|
|
|
|
|
if (zone.isNPCCity() || zone.isPlayerCity())
|
|
|
|
|
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
|
|
|
|
else
|
|
|
|
|
loc = zone.getLoc();
|
|
|
|
|
|
|
|
|
|
MovementManager.translocate(awoac, loc, null);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
MovementManager.translocate(awoac, awoac.getBindLoc(), null);
|
|
|
|
|
}
|
2023-07-15 09:23:48 -04:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Vector3fImmutable bindloc = awoac.getBindLoc();
|
|
|
|
|
if (bindloc.x == 0.0f || bindloc.y == 0.0f)
|
|
|
|
|
awoac.setBindLoc(MBServerStatics.startX, MBServerStatics.startY, MBServerStatics.startZ);
|
|
|
|
|
awoac.teleport(awoac.getBindLoc());
|
|
|
|
|
if (awoac.getObjectType() == GameObjectType.Mob) {
|
|
|
|
|
((Mob) awoac).setCombatTarget(null);
|
|
|
|
|
if (awoac.isAlive())
|
|
|
|
|
WorldGrid.updateObject(awoac);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
|
|
|
|
|
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
}
|
2022-04-30 09:41:17 -04:00
|
|
|
}
|