Files
Server/src/engine/powers/poweractions/OpenGatePowerAction.java
T

125 lines
4.1 KiB
Java
Raw Normal View History

2022-04-30 09:41:17 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.powers.poweractions;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
import engine.mbEnums.BuildingGroup;
import engine.mbEnums.GameObjectType;
import engine.mbEnums.PortalType;
2022-04-30 09:41:17 -04:00
import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject;
import engine.objects.Building;
import engine.objects.Runegate;
import engine.powers.ActionsBase;
import engine.powers.PowersBase;
import java.sql.ResultSet;
import java.sql.SQLException;
public class OpenGatePowerAction extends AbstractPowerAction {
2023-07-15 09:23:48 -04:00
/**
* ResultSet Constructor
*/
public OpenGatePowerAction(ResultSet rs) throws SQLException {
super(rs);
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public OpenGatePowerAction(int uUID, String iDString, String type, boolean isAggressive, long validItemFlags) {
super(uUID, iDString, type, isAggressive, validItemFlags);
// TODO Auto-generated constructor stub
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
if (awo.getObjectType().equals(GameObjectType.Building) == false)
return;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
Building targetBuilding = (Building) awo;
int token;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
// Sanity check.
2022-04-30 09:41:17 -04:00
if (source == null || awo == null || !(awo.getObjectType().equals(mbEnums.GameObjectType.Building)) || pb == null)
2023-07-15 09:23:48 -04:00
return;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
// Make sure building has a blueprint
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
if (targetBuilding.getBlueprintUUID() == 0)
return;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
// Make sure building is actually a runegate.
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
if (targetBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.RUNEGATE)
return;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
// Which portal was opened?
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
token = pb.getToken();
PortalType portalType = PortalType.AIR;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
switch (token) {
case 428937084: //Death Gate
portalType = PortalType.OBLIV;
break;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
case 429756284: //Chaos Gate
portalType = PortalType.CHAOS;
break;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
case 429723516: //Khar Gate
portalType = PortalType.MERCHANT;
break;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
case 429559676: //Spirit Gate
portalType = PortalType.SPIRIT;
break;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
case 429592444: //Water Gate
portalType = PortalType.WATER;
break;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
case 429428604: //Fire Gate
portalType = PortalType.FIRE;
break;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
case 429526908: //Air Gate
portalType = PortalType.AIR;
break;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
case 429625212: //Earth Gate
portalType = PortalType.EARTH;
break;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
default:
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
// Which runegate was clicked on?
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
Runegate runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
runeGate.activatePortal(portalType);
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
@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
}