From 460aa353a92373e2f409174d1a750635ca4d010d Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Thu, 2 Jul 2020 04:09:53 +0000 Subject: [PATCH] Addition of configuration to show NPC clan crests. Contributed by caioconc. --- .../dist/game/config/main/General.ini | 4 +++ .../java/org/l2jmobius/Config.java | 2 ++ .../network/serverpackets/NpcInfo.java | 36 ++++++++++++++++--- .../dist/game/config/main/General.ini | 4 +++ .../java/org/l2jmobius/Config.java | 2 ++ .../network/serverpackets/NpcInfo.java | 36 ++++++++++++++++--- 6 files changed, 74 insertions(+), 10 deletions(-) diff --git a/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/main/General.ini b/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/main/General.ini index 7bb209e1bc..b9c57d3c80 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/main/General.ini +++ b/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/main/General.ini @@ -605,6 +605,10 @@ ShowNpcLevel = False # Default: 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? ActivatePositionRecorder = False diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java index 9a7cb835d6..aa2fa2f4d2 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java @@ -172,6 +172,7 @@ public class Config public static String BBS_DEFAULT; public static boolean SHOW_NPC_LVL; public static boolean SHOW_NPC_AGGRESSION; + public static boolean SHOW_NPC_CLAN_CREST; public static int ZONE_TOWN; public static int DEFAULT_PUNISH; public static int DEFAULT_PUNISH_PARAM; @@ -1481,6 +1482,7 @@ public class Config MAX_MONSTER_ANIMATION = generalConfig.getInt("MaxMonsterAnimation", 60); SHOW_NPC_LVL = generalConfig.getBoolean("ShowNpcLevel", false); SHOW_NPC_AGGRESSION = generalConfig.getBoolean("ShowNpcAggression", false); + SHOW_NPC_CLAN_CREST = generalConfig.getBoolean("ShowNpcClanCrest", false); FORCE_INVENTORY_UPDATE = generalConfig.getBoolean("ForceInventoryUpdate", false); FORCE_COMPLETE_STATUS_UPDATE = generalConfig.getBoolean("ForceCompletePlayerStatusUpdate", true); CHAR_DATA_STORE_INTERVAL = generalConfig.getInt("CharacterDataStoreInterval", 15) * 60 * 1000; diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/serverpackets/NpcInfo.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/serverpackets/NpcInfo.java index 3ab1b5fdd3..5508456b38 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/serverpackets/NpcInfo.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/serverpackets/NpcInfo.java @@ -17,12 +17,20 @@ package org.l2jmobius.gameserver.network.serverpackets; import org.l2jmobius.Config; +import org.l2jmobius.gameserver.datatables.sql.ClanTable; import org.l2jmobius.gameserver.model.actor.Creature; 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.NpcInstance; 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.clan.Clan; +import org.l2jmobius.gameserver.model.zone.ZoneId; /** * @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 _collisionHeight; private int _collisionRadius; + protected int _clanCrest; + protected int _allyCrest; + protected int _allyId; + protected int _clanId; private String _name = ""; private String _title = ""; @@ -76,6 +88,20 @@ public class NpcInfo extends GameServerPacket _isSummoned = false; _collisionHeight = cha.getCollisionHeight(); _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()) { _name = cha.getTemplate().getName(); @@ -234,11 +260,11 @@ public class NpcInfo extends GameServerPacket } writeD(_creature.getAbnormalEffect()); // C2 - writeD(0000); // C2 - writeD(0000); // C2 - writeD(0000); // C2 - writeD(0000); // C2 - writeC(0000); // C2 + writeD(_clanId); // C2 + writeD(_clanCrest); // C2 + writeD(_allyId); // C2 + writeD(_allyCrest); // C2 + writeC(0x00); // C2 writeC(0x00); // C3 team circle 1-blue, 2-red writeF(_collisionRadius); diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/main/General.ini b/L2J_Mobius_C6_Interlude/dist/game/config/main/General.ini index e578878f9b..eaf83a281a 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/config/main/General.ini +++ b/L2J_Mobius_C6_Interlude/dist/game/config/main/General.ini @@ -633,6 +633,10 @@ ShowNpcLevel = False # Default: 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? ActivatePositionRecorder = False diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java index 290acacf75..4e12f30388 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java @@ -178,6 +178,7 @@ public class Config public static String BBS_DEFAULT; public static boolean SHOW_NPC_LVL; public static boolean SHOW_NPC_AGGRESSION; + public static boolean SHOW_NPC_CLAN_CREST; public static int ZONE_TOWN; public static int DEFAULT_PUNISH; public static int DEFAULT_PUNISH_PARAM; @@ -1531,6 +1532,7 @@ public class Config MAX_MONSTER_ANIMATION = generalConfig.getInt("MaxMonsterAnimation", 60); SHOW_NPC_LVL = generalConfig.getBoolean("ShowNpcLevel", false); SHOW_NPC_AGGRESSION = generalConfig.getBoolean("ShowNpcAggression", false); + SHOW_NPC_CLAN_CREST = generalConfig.getBoolean("ShowNpcClanCrest", false); FORCE_INVENTORY_UPDATE = generalConfig.getBoolean("ForceInventoryUpdate", false); FORCE_COMPLETE_STATUS_UPDATE = generalConfig.getBoolean("ForceCompletePlayerStatusUpdate", true); CHAR_DATA_STORE_INTERVAL = generalConfig.getInt("CharacterDataStoreInterval", 15) * 60 * 1000; diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/NpcInfo.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/NpcInfo.java index 337df82fa4..9c531738d8 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/NpcInfo.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/NpcInfo.java @@ -17,12 +17,20 @@ package org.l2jmobius.gameserver.network.serverpackets; import org.l2jmobius.Config; +import org.l2jmobius.gameserver.datatables.sql.ClanTable; import org.l2jmobius.gameserver.model.actor.Creature; 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.NpcInstance; 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.clan.Clan; +import org.l2jmobius.gameserver.model.zone.ZoneId; /** * @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 _collisionHeight; private int _collisionRadius; + protected int _clanCrest; + protected int _allyCrest; + protected int _allyId; + protected int _clanId; private String _name = ""; private String _title = ""; @@ -76,6 +88,20 @@ public class NpcInfo extends GameServerPacket _isSummoned = false; _collisionHeight = cha.getCollisionHeight(); _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()) { _name = cha.getTemplate().getName(); @@ -234,11 +260,11 @@ public class NpcInfo extends GameServerPacket } writeD(_creature.getAbnormalEffect()); // C2 - writeD(0000); // C2 - writeD(0000); // C2 - writeD(0000); // C2 - writeD(0000); // C2 - writeC(0000); // C2 + writeD(_clanId); // C2 + writeD(_clanCrest); // C2 + writeD(_allyId); // C2 + writeD(_allyCrest); // C2 + writeC(0x00); // C2 writeC(0x00); // C3 team circle 1-blue, 2-red writeF(_collisionRadius);