New way to show NPC level and aggression.
Thanks to Edoo.
This commit is contained in:
@@ -40,6 +40,7 @@ public class Config
|
||||
private static final String RATES_CONFIG_FILE = "config/rates.ini";
|
||||
private static final String KARMA_CONFIG_FILE = "config/karma.ini";
|
||||
private static final String THREADPOOL_CONFIG_FILE = "config/threadpool.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/npc.ini";
|
||||
|
||||
// Game
|
||||
public static String _ip;
|
||||
@@ -68,6 +69,9 @@ public class Config
|
||||
// ThreadPool
|
||||
public static int SCHEDULED_THREAD_POOL_COUNT;
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
// Npc
|
||||
public static boolean SHOW_NPC_LVL;
|
||||
public static boolean SHOW_NPC_AGGRESSION;
|
||||
|
||||
public static void load()
|
||||
{
|
||||
@@ -117,5 +121,11 @@ public class Config
|
||||
|
||||
SCHEDULED_THREAD_POOL_COUNT = threadpoolSettings.getInt("ScheduledThreadPoolCount", 40);
|
||||
INSTANT_THREAD_POOL_COUNT = threadpoolSettings.getInt("InstantThreadPoolCount", 20);
|
||||
|
||||
// Load NPC config file (if exists)
|
||||
final PropertiesParser npcSettings = new PropertiesParser(NPC_CONFIG_FILE);
|
||||
|
||||
SHOW_NPC_LVL = npcSettings.getBoolean("ShowNpcLevel", false);
|
||||
SHOW_NPC_AGGRESSION = npcSettings.getBoolean("ShowNpcAggression", false);
|
||||
}
|
||||
}
|
||||
|
@@ -119,7 +119,7 @@ public abstract class Creature extends WorldObject
|
||||
private boolean _2ndHit = false;
|
||||
private boolean _currentlyAttacking = false;
|
||||
private WorldObject _attackTarget;
|
||||
protected String title;
|
||||
protected String _title;
|
||||
|
||||
public boolean knownsObject(WorldObject object)
|
||||
{
|
||||
@@ -703,12 +703,12 @@ public abstract class Creature extends WorldObject
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
return _title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
this._title = title;
|
||||
}
|
||||
|
||||
public int getRunSpeed()
|
||||
|
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
|
||||
@@ -24,6 +26,7 @@ public class NpcInfo extends ServerBasePacket
|
||||
{
|
||||
private NpcInstance _cha;
|
||||
private PetInstance _chaPet;
|
||||
protected String _title = "";
|
||||
|
||||
public NpcInfo(NpcInstance cha)
|
||||
{
|
||||
@@ -100,7 +103,37 @@ public class NpcInfo extends ServerBasePacket
|
||||
}
|
||||
writeC(0);
|
||||
writeS(_cha.getName());
|
||||
writeS(_cha.getTitle());
|
||||
|
||||
_title = _cha.getTitle();
|
||||
// Custom level titles
|
||||
if (_cha.isMonster() && (Config.SHOW_NPC_LVL || Config.SHOW_NPC_AGGRESSION))
|
||||
{
|
||||
String t1 = "";
|
||||
if (Config.SHOW_NPC_LVL)
|
||||
{
|
||||
t1 += "Lv " + _cha.getLevel();
|
||||
}
|
||||
String t2 = "";
|
||||
if (Config.SHOW_NPC_AGGRESSION)
|
||||
{
|
||||
if (!t1.isEmpty())
|
||||
{
|
||||
t2 += " ";
|
||||
}
|
||||
if (((MonsterInstance) _cha).isAggressive())
|
||||
{
|
||||
t2 += "[A]"; // Aggressive.
|
||||
}
|
||||
}
|
||||
t1 += t2;
|
||||
if ((_title != null) && !_title.isEmpty())
|
||||
{
|
||||
t1 += " " + _title;
|
||||
}
|
||||
_title = t1;
|
||||
}
|
||||
|
||||
writeS(_title);
|
||||
writeD(0);
|
||||
writeD(0);
|
||||
writeD(0);
|
||||
|
Reference in New Issue
Block a user