New way to show NPC level and aggression.

Thanks to Edoo.
This commit is contained in:
MobiusDevelopment
2019-12-06 16:22:34 +00:00
parent 8af413c0b3
commit 3b5ce2f7fa
73 changed files with 753 additions and 211 deletions

View File

@@ -39,9 +39,12 @@ MaxAggroRange = 450
# Default: 300
MaxDriftRange = 300
# Default: False
# Default: False
ShowNpcLevel = False
# Default: False
ShowNpcAggression = False
# Show clan, alliance crests for territory NPCs without quests
# Default: False
ShowCrestWithoutQuest = False

View File

@@ -709,6 +709,7 @@ public class Config
public static int MAX_AGGRO_RANGE;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
public static boolean ENABLE_RANDOM_ENCHANT_EFFECT;
public static int MIN_NPC_LVL_DMG_PENALTY;
@@ -2220,6 +2221,7 @@ public class Config
MAX_AGGRO_RANGE = NPC.getInt("MaxAggroRange", 450);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
ENABLE_RANDOM_ENCHANT_EFFECT = NPC.getBoolean("EnableRandomEnchantEffect", false);
MIN_NPC_LVL_DMG_PENALTY = NPC.getInt("MinNPCLevelForDmgPenalty", 78);

View File

@@ -25,6 +25,7 @@ import org.l2jmobius.gameserver.model.PlayerCondOverride;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.TrapInstance;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
@@ -179,10 +180,6 @@ public abstract class AbstractNpcInfo implements IClientOutgoingPacket
{
_title = "Invisible";
}
else if (Config.CHAMPION_ENABLE && _npc.isChampion())
{
_title = (Config.CHAMP_TITLE); // On every subclass
}
else if (_localisation == null)
{
if (_npc.getTemplate().isUsingServerSideTitle())
@@ -194,14 +191,41 @@ public abstract class AbstractNpcInfo implements IClientOutgoingPacket
_title = _npc.getTitle(); // On every subclass
}
}
if (Config.SHOW_NPC_LVL && _npc.isMonster())
// Custom level titles
if (_npc.isMonster() && (Config.SHOW_NPC_LVL || Config.SHOW_NPC_AGGRESSION))
{
String t = "Lv " + _npc.getLevel() + (_npc.isAggressive() ? "*" : "");
if (_title != null)
String t1 = "";
if (Config.SHOW_NPC_LVL)
{
t += " " + _title;
t1 += "Lv " + _npc.getLevel();
}
_title = t;
String t2 = "";
if (Config.SHOW_NPC_AGGRESSION)
{
if (!t1.isEmpty())
{
t2 += " ";
}
final MonsterInstance monster = (MonsterInstance) _npc;
if (monster.isAggressive())
{
t2 += "[A]"; // Aggressive.
}
if ((monster.getTemplate().getClans() != null) && (monster.getTemplate().getClanHelpRange() > 0))
{
t2 += "[G]"; // Group.
}
}
t1 += t2;
if ((_title != null) && !_title.isEmpty())
{
t1 += " " + _title;
}
_title = _npc.isChampion() ? Config.CHAMP_TITLE + " " + t1 : t1;
}
else if (Config.CHAMPION_ENABLE && _npc.isChampion())
{
_title = (Config.CHAMP_TITLE); // On every subclass
}
packet.writeS(_title);
packet.writeD(0x00); // Title color 0=client default