Jump to content

[Share]NPC Crest


Recommended Posts

Well,hi someone from here asked this.Its already at Gracia Epilogue but i did it for Gracia Final if someone need it.Let's see

Index: java/config/NPC.properties
===================================================================
--- java/config/NPC.properties	(revision 4129)
+++ java/config/NPC.properties	(working copy)
@@ -46,6 +46,10 @@
# Default: False 
ShowNpcLevel = False

+# Show clan, alliance crests for territory NPCs without quests
+# Default: False
+ShowCrestWithoutQuest = False
+
# Do you want mobs to drop Vitality resplenishing herbs?
# Notes:
#	Works only if EnableVitality = True
Index: java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java
===================================================================
--- java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java	(revision 4129)
+++ java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java	(working copy)
@@ -15,7 +15,10 @@
package net.sf.l2j.gameserver.network.serverpackets;

import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.datatables.ClanTable;
import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;
+import net.sf.l2j.gameserver.instancemanager.TownManager;
+import net.sf.l2j.gameserver.model.L2Clan;
import net.sf.l2j.gameserver.model.L2Transformation;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.L2Decoy;
@@ -86,6 +89,10 @@
    public static class NpcInfo extends AbstractNpcInfo
    {
    	private L2Npc _npc;
+    	private int _clanCrest = 0;
+		private int _allyCrest = 0;
+		private int _allyId = 0;
+		private int _clanId = 0;
    	
    	public NpcInfo(L2Npc cha, L2Character attacker)
    	{
@@ -108,15 +115,29 @@
        		_title = cha.getTitle(); // On every subclass

            if (Config.SHOW_NPC_LVL && _npc instanceof L2MonsterInstance)
-    	    {
-    			String t = "Lv " + cha.getLevel() + (cha.getAggroRange() > 0 ? "*" : "");
-    			if (_title != null)
-    				t += " " + _title;
-
-    			_title = t;
-    	    }
-    	}
+			{
+				String t = "Lv " + cha.getLevel() + (cha.getAggroRange() > 0 ? "*" : "");
+				if (_title != null)
+					t += " " + _title;
+				
+				_title = t;
+			}
    	
+    	// npc crest of owning clan/ally of castle
+		if (cha instanceof L2Npc && cha.isInsideZone(L2Character.ZONE_TOWN) && (Config.SHOW_CREST_WITHOUT_QUEST || cha.getCastle().getShowNpcCrest()) && cha.getCastle().getOwnerId() != 0)
+		{
+			int townId = TownManager.getTown(_x, _y, _z).getTownId();
+			if (townId != 33 && townId != 22)
+			{
+				L2Clan clan = ClanTable.getInstance().getClan(cha.getCastle().getOwnerId());
+				_clanCrest = clan.getCrestId();
+				_clanId = clan.getClanId();
+				_allyCrest = clan.getAllyCrestId();
+				_allyId = clan.getAllyId();
+			}
+		}
+	}
+    	
    	@Override
		protected void writeImpl()
		{
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 4129)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -629,6 +629,7 @@
	public static boolean DEEPBLUE_DROP_RULES;
	public static boolean DEEPBLUE_DROP_RULES_RAID;
	public static boolean SHOW_NPC_LVL;
+	public static boolean SHOW_CREST_WITHOUT_QUEST;
	public static boolean GUARD_ATTACK_AGGRO_MOB;
	public static boolean ALLOW_WYVERN_UPGRADER;
	public static String PET_RENT_NPC;
@@ -1669,6 +1670,7 @@
					DEEPBLUE_DROP_RULES = Boolean.parseBoolean(NPC.getProperty("UseDeepBlueDropRules", "True"));
					DEEPBLUE_DROP_RULES_RAID = Boolean.parseBoolean(NPC.getProperty("UseDeepBlueDropRulesRaid", "True"));
					SHOW_NPC_LVL = Boolean.parseBoolean(NPC.getProperty("ShowNpcLevel", "False"));
+					SHOW_CREST_WITHOUT_QUEST = Boolean.parseBoolean(NPC.getProperty("ShowCrestWithoutQuest", "False"));
					ENABLE_DROP_VITALITY_HERBS = Boolean.parseBoolean(NPC.getProperty("EnableVitalityHerbs", "True"));
					GUARD_ATTACK_AGGRO_MOB = Boolean.parseBoolean(NPC.getProperty("GuardAttackAggroMob", "False"));
					ALLOW_WYVERN_UPGRADER = Boolean.parseBoolean(NPC.getProperty("AllowWyvernUpgrader", "False"));
@@ -2270,6 +2272,7 @@

		else if (pName.equalsIgnoreCase("ShowServerNews")) SERVER_NEWS = Boolean.parseBoolean(pValue);
		else if (pName.equalsIgnoreCase("ShowNpcLevel")) SHOW_NPC_LVL = Boolean.parseBoolean(pValue);
+		else if (pName.equalsIgnoreCase("ShowCrestWithoutQuest")) SHOW_CREST_WITHOUT_QUEST = Boolean.parseBoolean(pValue);

		else if (pName.equalsIgnoreCase("ForceInventoryUpdate")) FORCE_INVENTORY_UPDATE = Boolean.parseBoolean(pValue);

Index: java/net/sf/l2j/gameserver/model/entity/Castle.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/Castle.java	(revision 4129)
+++ java/net/sf/l2j/gameserver/model/entity/Castle.java	(working copy)
@@ -85,6 +85,7 @@
	private int _taxPercent = 0;
	private double _taxRate = 0;
	private long _treasury = 0;
+	private boolean _showNpcCrest = false;
	private L2CastleZone _zone = null;
	private L2CastleTeleportZone _teleZone;
	private L2Clan _formerOwner = null;
@@ -531,6 +532,7 @@
		}

		updateOwnerInDB(clan); // Update in database
+		setShowNpcCrest(false);

		// if clan have fortress, remove it
		if (clan.getHasFort() > 0)
@@ -707,6 +709,8 @@

				_taxPercent = rs.getInt("taxPercent");
				_treasury = rs.getLong("treasury");
+				
+				_showNpcCrest = rs.getBoolean("showNpcCrest");
			}
			rs.close();
			statement.close();
@@ -1129,6 +1133,20 @@
		return _treasury;
	}

+	public final boolean getShowNpcCrest()
+	{
+		return _showNpcCrest;
+	}
+	
+	public final void setShowNpcCrest(boolean showNpcCrest)
+	{
+		if (_showNpcCrest != showNpcCrest)
+		{
+			_showNpcCrest = showNpcCrest;
+			updateShowNpcCrest();
+		}
+	}
+	
	public List<SeedProduction> getSeedProduction(int period)
	{
		return (period == CastleManorManager.PERIOD_CURRENT ? _production : _productionNext);
@@ -1579,6 +1597,36 @@
		}
	}

+	public void updateShowNpcCrest()
+	{
+		Connection con = null;
+		PreparedStatement statement;
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			
+			statement = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?");
+			statement.setString(1, String.valueOf(getShowNpcCrest()));
+			statement.setInt(2, getCastleId());
+			statement.execute();
+			statement.close();
+		}
+		catch (Exception e)
+		{
+			_log.info("Error saving showNpcCrest for castle " + getName() + ": " + e.getMessage());
+		}
+		finally
+		{
+			try
+			{
+				con.close();
+			}
+			catch (Exception e)
+			{
+			}
+		}
+	}
+	
	public FastList<L2Skill> getResidentialSkills()
	{
		return _residentialSkills;

 

Also dont forget this:

Index: /trunk/Eclipse_Datapack/sql/castle.sql
===================================================================
--- /trunk/Eclipse_Datapack/sql/castle.sql (revision 202)
+++ /trunk/Eclipse_Datapack/sql/castle.sql (revision 206)
@@ -7,4 +7,5 @@
   `regTimeOver` enum('true','false') DEFAULT 'true' NOT NULL,
   `regTimeEnd` DECIMAL(20,0) NOT NULL default 0,
+  `showNpcCrest` enum('true','false') DEFAULT 'false' NOT NULL,
   PRIMARY KEY (`name`),
   KEY `id` (`id`)
@@ -12,11 +13,11 @@

INSERT IGNORE INTO `castle` VALUES
-(1,'Gludio',0,0,0,'true',0),
-(2,'Dion',0,0,0,'true',0),
-(3,'Giran',0,0,0,'true',0),
-(4,'Oren',0,0,0,'true',0),
-(5,'Aden',0,0,0,'true',0),
-(6,'Innadril',0,0,0,'true',0),
-(7,'Goddard',0,0,0,'true',0),
-(8,'Rune',0,0,0,'true',0),
-(9,'Schuttgart',0,0,0,'true',0);
+(1,'Gludio',0,0,0,'true',0,'false'),
+(2,'Dion',0,0,0,'true',0,'false'),
+(3,'Giran',0,0,0,'true',0,'false'),
+(4,'Oren',0,0,0,'true',0,'false'),
+(5,'Aden',0,0,0,'true',0,'false'),
+(6,'Innadril',0,0,0,'true',0,'false'),
+(7,'Goddard',0,0,0,'true',0,'false'),
+(8,'Rune',0,0,0,'true',0,'false'),
+(9,'Schuttgart',0,0,0,'true',0,'false');

 

 

Credits to L2JForum and Me For adapt it

Link to comment
Share on other sites

/facepalm...

You sanded us links to this topic just to see a thing that a guy made on l2jserver forum?

Dude.. aamm no words.. ur pro! keep it up >.> and ull make smth of yourself.

Link to comment
Share on other sites

/facepalm...

You sanded us links to this topic just to see a thing that a guy made on l2jserver forum?

Dude.. aamm no words.. ur pro! keep it up >.> and ull make smth of yourself.

yes what's your problem?

for someone will be useful but for you i know it isn't

Link to comment
Share on other sites

do it and for interlude..

 

FACEPALM x2.

Anw, as I told you start making your own codes.

By adapting stuff you will not learn anything, just how to change the imports.

Link to comment
Share on other sites

FACEPALM x2.

Anw, as I told you start making your own codes.

By adapting stuff you will not learn anything, just how to change the imports.

what its your problem??? i want and for interlude have any problem with my opinion???
Link to comment
Share on other sites

what its your problem??? i want and for interlude have any problem with my opinion???

 

It's nonsense adding every single gracia string in shitlude, instead of using Gracia.

 

And btw Ventic don't add useless hides >_>

Link to comment
Share on other sites

It's nonsense adding every single gracia string in shitlude, instead of using Gracia.

 

And btw Ventic don't add useless hides >_>

 

Why hide it?As he said it's from l2j forum...Anyone who go and search for it,he's gonna find it...so?

Anyways I like servers with this mode...Great job keep sharing...!

Link to comment
Share on other sites

Why hide it?As he said it's from l2j forum...Anyone who go and search for it,he's gonna find it...so?

 

Read what I wrote.

I told him not to hide such posts.

He had hidden it for 50 posts, and I just removed it.

God.. >_>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • What unique features ? 
    • Welcome to SmurfsZone   Buy League of Legends accounts across all servers and jump straight into Ranked Games with amazing quality and support.   Why Choose SmurfsZone? 24/7 Instant Delivery: Get your full access LoL smurf account immediately. 100% Hand-Leveled: High-quality accounts leveled by hand. Versatile MMR Options: High MMR, Standard MMR, Fresh MMR (ARAMs), and Ranked accounts available. Valorant Accounts: Expand your gaming experience. Our Commitment to You: Unopened Loot: Customize your champion pool. Lifetime Warranty: Valid if you change the email, username, and password upon purchase. Password Changeable: Ensure your account's security. Full Recovery Information: Complete access to account recovery details. Unverified and Changeable Email: Easy to personalize and secure your account. Completely Unranked: Fresh start with no ranked history in any season. Responsive Customer Support: Our dedicated team is available to assist you 24/7.   Experience the best place to buy League of Legends accounts with exceptional quality and dedicated support. We're here for YOU!
    • Thanks! I'll take a second look and let you know if my implementation of the clearCircle() helps with the stuttering once I find time for some extensive testing.
    • Thank you for your reply. I have removed it from the L2Server.exe file, but the L2Server still crashes. It doesn't crash if I don't start l2npc, otherwise it will crash within a few days at the latest.
    • Welcome to my store :  https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11 Telegram : https://t.me/ultrastore1 Welcome to my store :  https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11 Welcome to my store :  https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11
  • Topics

×
×
  • Create New...