Custom guard escape to spawn.
This commit is contained in:
parent
ce4079b0b5
commit
a9ba453313
3
trunk/dist/game/config/NPC.ini
vendored
3
trunk/dist/game/config/NPC.ini
vendored
@ -103,6 +103,9 @@ CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
|
||||
# Default: False
|
||||
GuardAttackAggroMob = False
|
||||
|
||||
# True - Allows guards to use return skill after combat.
|
||||
# Default: False
|
||||
EnableGuardReturn = False
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Pets
|
||||
|
@ -21,6 +21,8 @@ package handlers.effecthandlers;
|
||||
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.TeleportWhereType;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2GuardInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
@ -61,7 +63,15 @@ public final class Escape extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
info.getEffected().teleToLocation(MapRegionManager.getInstance().getTeleToLocation(info.getEffected(), _escapeType), true);
|
||||
info.getEffected().setInstanceId(0);
|
||||
if (info.getEffected() instanceof L2GuardInstance)
|
||||
{
|
||||
info.getEffected().teleToLocation(((L2Npc) info.getEffected()).getSpawn());
|
||||
info.getEffected().setHeading(((L2Npc) info.getEffected()).getSpawn().getHeading());
|
||||
}
|
||||
else
|
||||
{
|
||||
info.getEffected().teleToLocation(MapRegionManager.getInstance().getTeleToLocation(info.getEffected(), _escapeType), true);
|
||||
info.getEffected().setInstanceId(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -873,6 +873,7 @@ public final class Config
|
||||
public static int SPOILED_CORPSE_EXTEND_TIME;
|
||||
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
|
||||
public static boolean GUARD_ATTACK_AGGRO_MOB;
|
||||
public static boolean ENABLE_GUARD_RETURN;
|
||||
public static boolean ALLOW_WYVERN_UPGRADER;
|
||||
public static List<Integer> LIST_PET_RENT_NPC;
|
||||
public static double RAID_HP_REGEN_MULTIPLIER;
|
||||
@ -2036,6 +2037,7 @@ public final class Config
|
||||
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
|
||||
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
|
||||
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
|
||||
ENABLE_GUARD_RETURN = NPC.getBoolean("EnableGuardReturn", false);
|
||||
ALLOW_WYVERN_UPGRADER = NPC.getBoolean("AllowWyvernUpgrader", false);
|
||||
String[] listPetRentNpc = NPC.getString("ListPetRentNpc", "30827").split(",");
|
||||
LIST_PET_RENT_NPC = new ArrayList<>(listPetRentNpc.length);
|
||||
|
@ -33,6 +33,7 @@ import com.l2jserver.gameserver.GameTimeController;
|
||||
import com.l2jserver.gameserver.GeoData;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.sql.impl.TerritoryTable;
|
||||
import com.l2jserver.gameserver.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.enums.AISkillScope;
|
||||
import com.l2jserver.gameserver.enums.AIType;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
@ -575,8 +576,17 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
// Check if the actor is a L2GuardInstance
|
||||
if ((npc instanceof L2GuardInstance) && !npc.isWalker())
|
||||
{
|
||||
// Order to the L2GuardInstance to return to its home location because there's no target to attack
|
||||
npc.returnHome();
|
||||
if (Config.ENABLE_GUARD_RETURN && (npc.getSpawn() != null) && (Util.calculateDistance(npc, npc.getSpawn(), false, false) > 50) && /* !npc.isInsideZone(ZoneId.SIEGE) && */!npc.isCastingNow())
|
||||
{
|
||||
// Custom guard teleport to spawn.
|
||||
npc.clearAggroList();
|
||||
npc.doCast(SkillData.getInstance().getSkill(1050, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Order to the L2GuardInstance to return to its home location because there's no target to attack
|
||||
npc.returnHome();
|
||||
}
|
||||
}
|
||||
|
||||
// Minions following leader
|
||||
|
Loading…
Reference in New Issue
Block a user