Unhardcoded faction guards, fixed aggro and various improvements.
This commit is contained in:
@@ -10,10 +10,6 @@ EnableFactionSystem = False
|
||||
# Default: 85332,16199,-1252
|
||||
StartingLocation = 85332,16199,-1252
|
||||
|
||||
# Faction manager NPC ID.
|
||||
# Default: 500
|
||||
FactionManagerNpcId = 500
|
||||
|
||||
# Spawn location for faction manager NPC.
|
||||
# Default: 85712,15974,-1260,26808
|
||||
ManagerSpawnLocation = 85712,15974,-1260,26808
|
||||
@@ -47,14 +43,6 @@ EvilNameColor = 0000FF
|
||||
# Default: True
|
||||
EnableFactionGuards = True
|
||||
|
||||
# Good Guard NPC ID.
|
||||
# Default: 501
|
||||
GoodGuardNpcId = 501
|
||||
|
||||
# Evil Guard NPC ID.
|
||||
# Default: 502
|
||||
EvilGuardNpcId = 502
|
||||
|
||||
# Upon death, respawn at faction base.
|
||||
# Default: True
|
||||
RespawnAtFactionBase = True
|
||||
|
@@ -19,7 +19,6 @@ package custom.FactionSystem;
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.enums.ChatType;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@@ -32,9 +31,7 @@ import ai.AbstractNpcAI;
|
||||
public final class FactionSystem extends AbstractNpcAI
|
||||
{
|
||||
// NPCs
|
||||
private static final int MANAGER = Config.FACTION_MANAGER_NPCID;
|
||||
private static final int GOOD_GUARD = Config.FACTION_GOOD_GUARD_NPCID;
|
||||
private static final int EVIL_GUARD = Config.FACTION_EVIL_GUARD_NPCID;
|
||||
private static final int MANAGER = 500;
|
||||
// Other
|
||||
private static final String[] TEXTS =
|
||||
{
|
||||
@@ -49,7 +46,6 @@ public final class FactionSystem extends AbstractNpcAI
|
||||
addStartNpc(MANAGER);
|
||||
addTalkId(MANAGER);
|
||||
addFirstTalkId(MANAGER);
|
||||
addSeeCreatureId(EVIL_GUARD, GOOD_GUARD);
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
@@ -169,16 +165,6 @@ public final class FactionSystem extends AbstractNpcAI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && creature.isPlayer() && ((creature.getActingPlayer().isGood() && (npc.getId() == EVIL_GUARD)) || (creature.getActingPlayer().isEvil() && (npc.getId() == GOOD_GUARD))))
|
||||
{
|
||||
addAttackDesire(npc, creature);
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new FactionSystem();
|
||||
|
@@ -1278,7 +1278,6 @@ public final class Config
|
||||
public static Map<String, Location> COMMUNITY_AVAILABLE_TELEPORTS;
|
||||
public static boolean FACTION_SYSTEM_ENABLED;
|
||||
public static Location FACTION_STARTING_LOCATION;
|
||||
public static int FACTION_MANAGER_NPCID;
|
||||
public static Location FACTION_MANAGER_LOCATION;
|
||||
public static Location FACTION_GOOD_BASE_LOCATION;
|
||||
public static Location FACTION_EVIL_BASE_LOCATION;
|
||||
@@ -1287,8 +1286,6 @@ public final class Config
|
||||
public static int FACTION_GOOD_NAME_COLOR;
|
||||
public static int FACTION_EVIL_NAME_COLOR;
|
||||
public static boolean FACTION_GUARDS_ENABLED;
|
||||
public static int FACTION_GOOD_GUARD_NPCID;
|
||||
public static int FACTION_EVIL_GUARD_NPCID;
|
||||
public static boolean FACTION_RESPAWN_AT_BASE;
|
||||
public static boolean FACTION_AUTO_NOBLESS;
|
||||
public static boolean FACTION_SPECIFIC_CHAT;
|
||||
@@ -2798,7 +2795,6 @@ public final class Config
|
||||
FACTION_SYSTEM_ENABLED = Boolean.valueOf(FactionSystem.getBoolean("EnableFactionSystem", false));
|
||||
tempString = FactionSystem.getString("StartingLocation", "85332,16199,-1252").split(",");
|
||||
FACTION_STARTING_LOCATION = new Location(Integer.parseInt(tempString[0]), Integer.parseInt(tempString[1]), Integer.parseInt(tempString[2]));
|
||||
FACTION_MANAGER_NPCID = FactionSystem.getInt("FactionManagerNpcId", 500);
|
||||
tempString = FactionSystem.getString("ManagerSpawnLocation", "85712,15974,-1260,26808").split(",");
|
||||
FACTION_MANAGER_LOCATION = new Location(Integer.parseInt(tempString[0]), Integer.parseInt(tempString[1]), Integer.parseInt(tempString[2]), tempString[3] != null ? Integer.parseInt(tempString[3]) : 0);
|
||||
tempString = FactionSystem.getString("GoodBaseLocation", "45306,48878,-3058").split(",");
|
||||
@@ -2810,8 +2806,6 @@ public final class Config
|
||||
FACTION_GOOD_NAME_COLOR = Integer.decode("0x" + FactionSystem.getString("GoodNameColor", "00FF00"));
|
||||
FACTION_EVIL_NAME_COLOR = Integer.decode("0x" + FactionSystem.getString("EvilNameColor", "0000FF"));
|
||||
FACTION_GUARDS_ENABLED = FactionSystem.getBoolean("EnableFactionGuards", true);
|
||||
FACTION_GOOD_GUARD_NPCID = FactionSystem.getInt("GoodGuardNpcId", 501);
|
||||
FACTION_EVIL_GUARD_NPCID = FactionSystem.getInt("EvilGuardNpcId", 502);
|
||||
FACTION_RESPAWN_AT_BASE = FactionSystem.getBoolean("RespawnAtFactionBase", true);
|
||||
FACTION_AUTO_NOBLESS = FactionSystem.getBoolean("FactionAutoNobless", false);
|
||||
FACTION_SPECIFIC_CHAT = FactionSystem.getBoolean("EnableFactionChat", true);
|
||||
|
@@ -225,6 +225,11 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && ((player.isGood() && ((L2Npc) _actor).getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (player.isEvil() && ((L2Npc) _actor).getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.isInParty() && player.getParty().isInDimensionalRift())
|
||||
{
|
||||
final byte riftType = player.getParty().getDimensionalRift().getType();
|
||||
|
@@ -51,6 +51,14 @@ public class L2GuardInstance extends L2Attackable
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && attacker.isPlayable())
|
||||
{
|
||||
L2PcInstance player = attacker.getActingPlayer();
|
||||
if ((player.isGood() && getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (player.isEvil() && getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.isAutoAttackable(attacker);
|
||||
}
|
||||
|
||||
|
@@ -8469,6 +8469,15 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
}
|
||||
|
||||
if (attacker instanceof L2GuardInstance)
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && ((_isGood && ((L2Npc) attacker).getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (_isEvil && ((L2Npc) attacker).getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return (getKarma() > 0); // Guards attack only PK players.
|
||||
}
|
||||
|
||||
// Check if the L2PcInstance has Karma
|
||||
if ((getKarma() > 0) || (_pvpFlag > 0))
|
||||
{
|
||||
|
Reference in New Issue
Block a user