Addition of configuration to show NPC clan crests.

Contributed by caioconc.
This commit is contained in:
MobiusDevelopment
2020-07-02 04:09:53 +00:00
parent 5bde7d0228
commit 460aa353a9
6 changed files with 74 additions and 10 deletions

View File

@@ -605,6 +605,10 @@ ShowNpcLevel = False
# Default: false # Default: false
ShowNpcAggression = False ShowNpcAggression = False
# Show clan, alliance crests for territory NPCs.
# Default: False
ShowNpcClanCrest = False
# Record the location of the characters in the file before the off / restarting the server? # Record the location of the characters in the file before the off / restarting the server?
ActivatePositionRecorder = False ActivatePositionRecorder = False

View File

@@ -172,6 +172,7 @@ public class Config
public static String BBS_DEFAULT; public static String BBS_DEFAULT;
public static boolean SHOW_NPC_LVL; public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION; public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_NPC_CLAN_CREST;
public static int ZONE_TOWN; public static int ZONE_TOWN;
public static int DEFAULT_PUNISH; public static int DEFAULT_PUNISH;
public static int DEFAULT_PUNISH_PARAM; public static int DEFAULT_PUNISH_PARAM;
@@ -1481,6 +1482,7 @@ public class Config
MAX_MONSTER_ANIMATION = generalConfig.getInt("MaxMonsterAnimation", 60); MAX_MONSTER_ANIMATION = generalConfig.getInt("MaxMonsterAnimation", 60);
SHOW_NPC_LVL = generalConfig.getBoolean("ShowNpcLevel", false); SHOW_NPC_LVL = generalConfig.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = generalConfig.getBoolean("ShowNpcAggression", false); SHOW_NPC_AGGRESSION = generalConfig.getBoolean("ShowNpcAggression", false);
SHOW_NPC_CLAN_CREST = generalConfig.getBoolean("ShowNpcClanCrest", false);
FORCE_INVENTORY_UPDATE = generalConfig.getBoolean("ForceInventoryUpdate", false); FORCE_INVENTORY_UPDATE = generalConfig.getBoolean("ForceInventoryUpdate", false);
FORCE_COMPLETE_STATUS_UPDATE = generalConfig.getBoolean("ForceCompletePlayerStatusUpdate", true); FORCE_COMPLETE_STATUS_UPDATE = generalConfig.getBoolean("ForceCompletePlayerStatusUpdate", true);
CHAR_DATA_STORE_INTERVAL = generalConfig.getInt("CharacterDataStoreInterval", 15) * 60 * 1000; CHAR_DATA_STORE_INTERVAL = generalConfig.getInt("CharacterDataStoreInterval", 15) * 60 * 1000;

View File

@@ -17,12 +17,20 @@
package org.l2jmobius.gameserver.network.serverpackets; package org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.datatables.sql.ClanTable;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.actor.instance.ControlTowerInstance;
import org.l2jmobius.gameserver.model.actor.instance.FortSiegeGuardInstance;
import org.l2jmobius.gameserver.model.actor.instance.GuardInstance;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance; import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
import org.l2jmobius.gameserver.model.actor.instance.SiegeGuardInstance;
import org.l2jmobius.gameserver.model.actor.instance.SiegeNpcInstance;
import org.l2jmobius.gameserver.model.actor.instance.SummonInstance; import org.l2jmobius.gameserver.model.actor.instance.SummonInstance;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.zone.ZoneId;
/** /**
* @version $Revision: 1.7.2.4.2.9 $ $Date: 2005/04/11 10:05:54 $ * @version $Revision: 1.7.2.4.2.9 $ $Date: 2005/04/11 10:05:54 $
@@ -51,6 +59,10 @@ public class NpcInfo extends GameServerPacket
private int _lhand; private int _lhand;
private int _collisionHeight; private int _collisionHeight;
private int _collisionRadius; private int _collisionRadius;
protected int _clanCrest;
protected int _allyCrest;
protected int _allyId;
protected int _clanId;
private String _name = ""; private String _name = "";
private String _title = ""; private String _title = "";
@@ -76,6 +88,20 @@ public class NpcInfo extends GameServerPacket
_isSummoned = false; _isSummoned = false;
_collisionHeight = cha.getCollisionHeight(); _collisionHeight = cha.getCollisionHeight();
_collisionRadius = cha.getCollisionRadius(); _collisionRadius = cha.getCollisionRadius();
if (Config.SHOW_NPC_CLAN_CREST && (cha.getCastle() != null) && (cha.getCastle().getOwnerId() != 0) && !cha.isMonster() && !cha.isArtefact() && !(cha instanceof ControlTowerInstance))
{
if (cha.isInsideZone(ZoneId.TOWN) || cha.isInsideZone(ZoneId.CASTLE) //
|| (cha instanceof GuardInstance) || (cha instanceof SiegeGuardInstance) || (cha instanceof FortSiegeGuardInstance) || (cha instanceof SiegeNpcInstance))
{
final Clan clan = ClanTable.getInstance().getClan(cha.getCastle().getOwnerId());
_clanCrest = clan.getCrestId();
_clanId = clan.getClanId();
_allyCrest = clan.getAllyCrestId();
_allyId = clan.getAllyId();
}
}
if (cha.getTemplate().isServerSideName()) if (cha.getTemplate().isServerSideName())
{ {
_name = cha.getTemplate().getName(); _name = cha.getTemplate().getName();
@@ -234,11 +260,11 @@ public class NpcInfo extends GameServerPacket
} }
writeD(_creature.getAbnormalEffect()); // C2 writeD(_creature.getAbnormalEffect()); // C2
writeD(0000); // C2 writeD(_clanId); // C2
writeD(0000); // C2 writeD(_clanCrest); // C2
writeD(0000); // C2 writeD(_allyId); // C2
writeD(0000); // C2 writeD(_allyCrest); // C2
writeC(0000); // C2 writeC(0x00); // C2
writeC(0x00); // C3 team circle 1-blue, 2-red writeC(0x00); // C3 team circle 1-blue, 2-red
writeF(_collisionRadius); writeF(_collisionRadius);

View File

@@ -633,6 +633,10 @@ ShowNpcLevel = False
# Default: false # Default: false
ShowNpcAggression = False ShowNpcAggression = False
# Show clan, alliance crests for territory NPCs.
# Default: False
ShowNpcClanCrest = False
# Record the location of the characters in the file before the off / restarting the server? # Record the location of the characters in the file before the off / restarting the server?
ActivatePositionRecorder = False ActivatePositionRecorder = False

View File

@@ -178,6 +178,7 @@ public class Config
public static String BBS_DEFAULT; public static String BBS_DEFAULT;
public static boolean SHOW_NPC_LVL; public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION; public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_NPC_CLAN_CREST;
public static int ZONE_TOWN; public static int ZONE_TOWN;
public static int DEFAULT_PUNISH; public static int DEFAULT_PUNISH;
public static int DEFAULT_PUNISH_PARAM; public static int DEFAULT_PUNISH_PARAM;
@@ -1531,6 +1532,7 @@ public class Config
MAX_MONSTER_ANIMATION = generalConfig.getInt("MaxMonsterAnimation", 60); MAX_MONSTER_ANIMATION = generalConfig.getInt("MaxMonsterAnimation", 60);
SHOW_NPC_LVL = generalConfig.getBoolean("ShowNpcLevel", false); SHOW_NPC_LVL = generalConfig.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = generalConfig.getBoolean("ShowNpcAggression", false); SHOW_NPC_AGGRESSION = generalConfig.getBoolean("ShowNpcAggression", false);
SHOW_NPC_CLAN_CREST = generalConfig.getBoolean("ShowNpcClanCrest", false);
FORCE_INVENTORY_UPDATE = generalConfig.getBoolean("ForceInventoryUpdate", false); FORCE_INVENTORY_UPDATE = generalConfig.getBoolean("ForceInventoryUpdate", false);
FORCE_COMPLETE_STATUS_UPDATE = generalConfig.getBoolean("ForceCompletePlayerStatusUpdate", true); FORCE_COMPLETE_STATUS_UPDATE = generalConfig.getBoolean("ForceCompletePlayerStatusUpdate", true);
CHAR_DATA_STORE_INTERVAL = generalConfig.getInt("CharacterDataStoreInterval", 15) * 60 * 1000; CHAR_DATA_STORE_INTERVAL = generalConfig.getInt("CharacterDataStoreInterval", 15) * 60 * 1000;

View File

@@ -17,12 +17,20 @@
package org.l2jmobius.gameserver.network.serverpackets; package org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.datatables.sql.ClanTable;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.actor.instance.ControlTowerInstance;
import org.l2jmobius.gameserver.model.actor.instance.FortSiegeGuardInstance;
import org.l2jmobius.gameserver.model.actor.instance.GuardInstance;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance; import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
import org.l2jmobius.gameserver.model.actor.instance.PetInstance; import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
import org.l2jmobius.gameserver.model.actor.instance.SiegeGuardInstance;
import org.l2jmobius.gameserver.model.actor.instance.SiegeNpcInstance;
import org.l2jmobius.gameserver.model.actor.instance.SummonInstance; import org.l2jmobius.gameserver.model.actor.instance.SummonInstance;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.zone.ZoneId;
/** /**
* @version $Revision: 1.7.2.4.2.9 $ $Date: 2005/04/11 10:05:54 $ * @version $Revision: 1.7.2.4.2.9 $ $Date: 2005/04/11 10:05:54 $
@@ -51,6 +59,10 @@ public class NpcInfo extends GameServerPacket
private int _lhand; private int _lhand;
private int _collisionHeight; private int _collisionHeight;
private int _collisionRadius; private int _collisionRadius;
protected int _clanCrest;
protected int _allyCrest;
protected int _allyId;
protected int _clanId;
private String _name = ""; private String _name = "";
private String _title = ""; private String _title = "";
@@ -76,6 +88,20 @@ public class NpcInfo extends GameServerPacket
_isSummoned = false; _isSummoned = false;
_collisionHeight = cha.getCollisionHeight(); _collisionHeight = cha.getCollisionHeight();
_collisionRadius = cha.getCollisionRadius(); _collisionRadius = cha.getCollisionRadius();
if (Config.SHOW_NPC_CLAN_CREST && (cha.getCastle() != null) && (cha.getCastle().getOwnerId() != 0) && !cha.isMonster() && !cha.isArtefact() && !(cha instanceof ControlTowerInstance))
{
if (cha.isInsideZone(ZoneId.TOWN) || cha.isInsideZone(ZoneId.CASTLE) //
|| (cha instanceof GuardInstance) || (cha instanceof SiegeGuardInstance) || (cha instanceof FortSiegeGuardInstance) || (cha instanceof SiegeNpcInstance))
{
final Clan clan = ClanTable.getInstance().getClan(cha.getCastle().getOwnerId());
_clanCrest = clan.getCrestId();
_clanId = clan.getClanId();
_allyCrest = clan.getAllyCrestId();
_allyId = clan.getAllyId();
}
}
if (cha.getTemplate().isServerSideName()) if (cha.getTemplate().isServerSideName())
{ {
_name = cha.getTemplate().getName(); _name = cha.getTemplate().getName();
@@ -234,11 +260,11 @@ public class NpcInfo extends GameServerPacket
} }
writeD(_creature.getAbnormalEffect()); // C2 writeD(_creature.getAbnormalEffect()); // C2
writeD(0000); // C2 writeD(_clanId); // C2
writeD(0000); // C2 writeD(_clanCrest); // C2
writeD(0000); // C2 writeD(_allyId); // C2
writeD(0000); // C2 writeD(_allyCrest); // C2
writeC(0000); // C2 writeC(0x00); // C2
writeC(0x00); // C3 team circle 1-blue, 2-red writeC(0x00); // C3 team circle 1-blue, 2-red
writeF(_collisionRadius); writeF(_collisionRadius);