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

@ -600,6 +600,7 @@ public class Config
public static boolean ALT_GAME_VIEWNPC;
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;
@ -2127,6 +2128,7 @@ public class Config
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
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

@ -2216,21 +2216,43 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
*/
public String getTitle()
{
// Custom level titles
if (isMonster() && (Config.SHOW_NPC_LVL || Config.SHOW_NPC_AGGRESSION))
{
String t1 = "";
if (Config.SHOW_NPC_LVL)
{
t1 += "Lv " + getLevel();
}
String t2 = "";
if (Config.SHOW_NPC_AGGRESSION)
{
if (!t1.isEmpty())
{
t2 += " ";
}
final MonsterInstance monster = (MonsterInstance) this;
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;
}
return isChampion() ? Config.CHAMP_TITLE + " " + t1 : t1;
}
// Champion titles
if (isChampion())
{
return Config.CHAMP_TITLE;
}
// Custom level titles
if (Config.SHOW_NPC_LVL && isMonster())
{
String t = "Lv " + getLevel() + (((MonsterInstance) this).isAggressive() ? "*" : "");
if (_title != null)
{
t += " " + _title;
}
return t;
}
// Set trap title
if (isTrap() && (((TrapInstance) this).getOwner() != null))
{

View File

@ -170,7 +170,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
addComponentType(NpcInfoType.NAME);
}
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion() || npc.isTrap())
if (npc.getTemplate().isUsingServerSideTitle() || (npc.isMonster() && (Config.SHOW_NPC_LVL || Config.SHOW_NPC_AGGRESSION)) || npc.isChampion() || npc.isTrap())
{
addComponentType(NpcInfoType.TITLE);
}