Custom guard escape to spawn.

This commit is contained in:
MobiusDev
2015-10-03 23:20:14 +00:00
parent ce4079b0b5
commit a9ba453313
4 changed files with 29 additions and 4 deletions

View File

@ -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);

View File

@ -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