Skip to content

Commit

Permalink
Fixed dueling in Panesterra + cleanup for 22b0e46
Browse files Browse the repository at this point in the history
  • Loading branch information
neon-dev committed Nov 30, 2024
1 parent f2d9a49 commit 210e1e4
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,10 @@
@AIName("panesterra_entry_corridor")
public class PanesterraEntryCorridorAI extends GeneralNpcAI {

private int relatedFortressId;
private final int relatedFortressId;

public PanesterraEntryCorridorAI(Npc owner) {
super(owner);
}

@Override
protected void handleSpawned() {
super.handleSpawned();
relatedFortressId = switch (getNpcId()) {
case 730946, 730950 -> 10111;
case 730947, 730951 -> 10211;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import java.util.Map;
import java.util.stream.Collectors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.aionemu.commons.utils.Rnd;
import com.aionemu.gameserver.ai.AIName;
import com.aionemu.gameserver.configs.main.SiegeConfig;
Expand All @@ -28,9 +31,6 @@

import ai.AggressiveNpcAI;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @author Yeats, Estrayl
*/
Expand Down
2 changes: 0 additions & 2 deletions game-server/data/static_data/spawns/spawns.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@
<xs:attribute name="handler" type="SpawnHandlerType"/>
<xs:attribute name="custom" type="xs:boolean" use="optional" default="false"/>
<xs:attribute name="difficult_id" type="xs:byte"/>
<xs:attribute name="initial_spawn_time" type="xs:int" use="optional"/>
<xs:attribute name="condition" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="SpawnSpotTemplate">
<xs:sequence>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,16 @@ public void doReward() {
@Override
public void onBeforeSpawn() {
super.onBeforeSpawn();
if (getOwner().isDead())
return;
if (getOwner().getIsFlyingBeforeDeath())
getOwner().unsetState(CreatureState.FLOATING_CORPSE);
else if (getOwner().isInState(CreatureState.DEAD))
getOwner().unsetState(CreatureState.DEAD);
getOwner().setState(CreatureState.ACTIVE);
if (!getOwner().isDead()) {
if (getOwner().getIsFlyingBeforeDeath())
getOwner().unsetState(CreatureState.FLOATING_CORPSE);
else if (getOwner().isInState(CreatureState.DEAD))
getOwner().unsetState(CreatureState.DEAD);
getOwner().setState(CreatureState.ACTIVE);
}
getOwner().setHitTimeBoost(0, 0);
if (getOwner().getPanesterraFaction() != null && !WorldMapType.isPanesterraMap(getOwner().getWorldId()))
getOwner().setPanesterraFaction(null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.model.team.TemporaryPlayerTeam;
import com.aionemu.gameserver.services.BaseService;
import com.aionemu.gameserver.services.panesterra.PanesterraService;
import com.aionemu.gameserver.services.panesterra.ahserion.PanesterraFaction;

/**
* @author Source, Rolandas
Expand Down Expand Up @@ -50,10 +48,8 @@ private BaseOccupier findOccupierType(GeneralAIEvent event) {
private BaseOccupier findOccupierType(Player player) {
if (base instanceof PanesterraFactionCamp)
return BaseOccupier.PEACE; // If the soul anchor (boss) is destroyed, the camp will be eliminated

if (base instanceof PanesterraBase && player.getPanesterraFaction() != null) {
if (base instanceof PanesterraBase && player.getPanesterraFaction() != null)
return BaseOccupier.findBy(player.getPanesterraFaction());
}
return BaseOccupier.findBy(player.getRace());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -933,9 +933,6 @@ public boolean isEnemyFrom(Player enemy) {
if (isInCustomState(CustomPlayerState.ENEMY_OF_ALL_PLAYERS) || enemy.isInCustomState(CustomPlayerState.ENEMY_OF_ALL_PLAYERS)) {
return !isInFfaTeamMode || !enemy.isInFfaTeamMode() || !isInSameTeam(enemy);
}
if (panesterraFaction != null && WorldMapType.isPanesterraMap(getWorldId())) {
return panesterraFaction != enemy.getPanesterraFaction();
}
return canPvP(enemy) || isDueling(enemy);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;

import com.aionemu.gameserver.services.panesterra.PanesterraService;

import org.quartz.CronExpression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -29,6 +27,7 @@
import com.aionemu.gameserver.model.templates.spawns.SpawnTemplate;
import com.aionemu.gameserver.model.templates.spawns.siegespawns.SiegeSpawnTemplate;
import com.aionemu.gameserver.network.aion.serverpackets.*;
import com.aionemu.gameserver.services.panesterra.PanesterraService;
import com.aionemu.gameserver.services.siege.*;
import com.aionemu.gameserver.spawnengine.SpawnEngine;
import com.aionemu.gameserver.utils.PacketSendUtility;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static boolean isAggressive(Creature creature1, Creature creature2) {
}
break;
}
if (creature1.getTribe().name().startsWith("GAB1_") && creature2 instanceof Player p && p.getPanesterraFaction() != null) {
if (creature2 instanceof Player p && p.getPanesterraFaction() != null && creature1.getTribe().name().startsWith("GAB1_")) {
TribeClass playerTribe = creature1.getTribe().name().startsWith("GAB1_SUB") ? p.getPanesterraFaction().getSubTribe() : p.getPanesterraFaction().getTribe();
if (creature1.getTribe() == playerTribe)
return false;
Expand Down Expand Up @@ -101,7 +101,7 @@ public static boolean isFriend(Creature creature1, Creature creature2) {
return true;
break;
}
if (creature1.getTribe().name().startsWith("GAB1_") && creature2 instanceof Player p && p.getPanesterraFaction() != null) {
if (creature2 instanceof Player p && p.getPanesterraFaction() != null && creature1.getTribe().name().startsWith("GAB1_")) {
TribeClass playerTribe = creature1.getTribe().name().startsWith("GAB1_SUB") ? p.getPanesterraFaction().getSubTribe() : p.getPanesterraFaction().getTribe();
if (creature1.getTribe() == playerTribe)
return true;
Expand All @@ -126,7 +126,7 @@ public static boolean isSupport(Creature creature1, Creature creature2) {
return true;
break;
}
if (creature1.getTribe().name().startsWith("GAB1_") && creature2 instanceof Player p && p.getPanesterraFaction() != null) {
if (creature2 instanceof Player p && p.getPanesterraFaction() != null && creature1.getTribe().name().startsWith("GAB1_")) {
TribeClass playerTribe = creature1.getTribe().name().startsWith("GAB1_SUB") ? p.getPanesterraFaction().getSubTribe() : p.getPanesterraFaction().getTribe();
if (creature1.getTribe() == playerTribe)
return true;
Expand Down Expand Up @@ -179,7 +179,7 @@ public static boolean isHostile(Creature creature1, Creature creature2) {
}
}

if (creature1.getTribe().name().startsWith("GAB1_") && creature2 instanceof Player p && p.getPanesterraFaction() != null) {
if (creature2 instanceof Player p && p.getPanesterraFaction() != null && creature1.getTribe().name().startsWith("GAB1_")) {
TribeClass playerTribe = creature1.getTribe().name().startsWith("GAB1_SUB") ? p.getPanesterraFaction().getSubTribe() : p.getPanesterraFaction().getTribe();
if (creature1.getTribe() == playerTribe)
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.aionemu.gameserver.services.panesterra;

import static com.aionemu.gameserver.services.panesterra.ahserion.PanesterraFaction.*;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;

import com.aionemu.commons.utils.Rnd;
import com.aionemu.gameserver.world.WorldPosition;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.aionemu.commons.utils.Rnd;
import com.aionemu.gameserver.model.base.BaseOccupier;
import com.aionemu.gameserver.model.base.BaseType;
import com.aionemu.gameserver.model.gameobjects.player.Player;
Expand All @@ -28,8 +28,7 @@
import com.aionemu.gameserver.utils.PacketSendUtility;
import com.aionemu.gameserver.world.World;
import com.aionemu.gameserver.world.WorldMapType;

import static com.aionemu.gameserver.services.panesterra.ahserion.PanesterraFaction.*;
import com.aionemu.gameserver.world.WorldPosition;

/**
* Workflow for Panesterra sieges:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package com.aionemu.gameserver.services.player;

import com.aionemu.gameserver.services.panesterra.PanesterraService;

import com.aionemu.gameserver.world.WorldMapType;

import org.slf4j.LoggerFactory;

import com.aionemu.gameserver.configs.administration.AdminConfig;
Expand All @@ -20,13 +16,14 @@
import com.aionemu.gameserver.model.vortex.VortexLocation;
import com.aionemu.gameserver.network.aion.serverpackets.*;
import com.aionemu.gameserver.services.VortexService;
import com.aionemu.gameserver.services.panesterra.ahserion.AhserionRaid;
import com.aionemu.gameserver.services.panesterra.PanesterraService;
import com.aionemu.gameserver.services.teleport.TeleportService;
import com.aionemu.gameserver.skillengine.model.Effect;
import com.aionemu.gameserver.utils.PacketSendUtility;
import com.aionemu.gameserver.utils.audit.AuditLogger;
import com.aionemu.gameserver.world.World;
import com.aionemu.gameserver.world.WorldMap;
import com.aionemu.gameserver.world.WorldMapType;
import com.aionemu.gameserver.world.WorldPosition;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ public static void teleportTo(final Player player, final int worldId, final int
} else if (DuelService.getInstance().isDueling(player)) {
DuelService.getInstance().loseDuel(player);
}
if (player.getPanesterraFaction() != null && !WorldMapType.isPanesterraMap(worldId))
player.setPanesterraFaction(null);

sendLoc(player, worldId, instanceId, x, y, z, heading, animation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.aionemu.gameserver.geoEngine.collision.IgnoreProperties;
import com.aionemu.gameserver.geoEngine.math.Vector3f;
import com.aionemu.gameserver.model.Race;
import com.aionemu.gameserver.model.base.Base;
import com.aionemu.gameserver.model.gameobjects.*;
import com.aionemu.gameserver.model.gameobjects.player.PetCommonData;
import com.aionemu.gameserver.model.gameobjects.player.Player;
Expand All @@ -31,7 +32,6 @@
import com.aionemu.gameserver.network.aion.serverpackets.SM_PLAYER_STATE;
import com.aionemu.gameserver.services.BaseService;
import com.aionemu.gameserver.services.RiftService;
import com.aionemu.gameserver.model.base.Base;
import com.aionemu.gameserver.skillengine.effect.SummonOwner;
import com.aionemu.gameserver.skillengine.model.SkillTemplate;
import com.aionemu.gameserver.utils.PacketSendUtility;
Expand All @@ -48,7 +48,7 @@
public class VisibleObjectSpawner {

private static final Logger log = LoggerFactory.getLogger(VisibleObjectSpawner.class);

protected static VisibleObject spawnNpc(SpawnTemplate spawn, int instanceIndex) {
int npcId = spawn.getNpcId();
NpcTemplate npcTemplate = DataManager.NPC_DATA.getNpcTemplate(npcId);
Expand Down

0 comments on commit 210e1e4

Please sign in to comment.