Nobless NPC

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
returNix
Posts: 76
Joined: Thu Oct 07, 2010 9:03 pm

Nobless NPC

Post by returNix »

Hey guys, can someone give me an NPC that does me noble for a Caradine letter?
Thanks
User avatar
LasTravel
Posts: 888
Joined: Tue Jan 05, 2010 12:08 am
Location: Spain

Re: Nobless NPC

Post by LasTravel »

Create the default htm for the npc 700001 and done:

Code: Select all

### Eclipse Workspace Patch 1.0#P datapack_developmentIndex: data/scripts/custom/FreeNoble/FreeNoble.java===================================================================--- data/scripts/custom/FreeNoble/FreeNoble.java    (revision 0)+++ data/scripts/custom/FreeNoble/FreeNoble.java    (revision 0)@@ -0,0 +1,78 @@+package custom.FreeNoble;++import com.l2jserver.gameserver.instancemanager.QuestManager;+import com.l2jserver.gameserver.model.actor.L2Npc;+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;+import com.l2jserver.gameserver.model.quest.Quest;+import com.l2jserver.gameserver.model.quest.QuestState;++/**+ * @author LasTravel+ */+ +public class FreeNoble extends Quest+{+   private static final int NPCID = 700001;+   private static final int LevelMin = 80;+   private static final int ItemId = 7678; //Caradine's Letter +   private static final int Amount = 1;+   +   private static final String qn = "FreeNoble";+   +   public FreeNoble(int questId, String name, String descr)+   {+       super(questId, name, descr);+       addStartNpc(NPCID);+       addTalkId(NPCID);+   }+   +   @Override+   public String onTalk(L2Npc npc, L2PcInstance player)+   {+       String htmltext ="";+       QuestState st = player.getQuestState(getName());+       if (st == null)+       {+           Quest q = QuestManager.getInstance().getQuest(getName());+           st = q.newQuestState(player);+       }+       if (npc.getNpcId() == NPCID)+           htmltext = "1.htm";+   return htmltext;+   }+   +   private boolean CheckCondition(L2PcInstance player)+   {+       if (player == null)+           return false;+       +       else if (player.isHero() || player.isNoble())+           return false;+       else if (player.getLevel() < LevelMin)+           return false;+       else if (!(player.getQuestState(qn).getQuestItemsCount(ItemId) >= Amount))+           return false;+       else+           return true;+   }+   +   @Override+   public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)+   {+       //Give Noble Status+       if (event.equalsIgnoreCase("getnoble"))+           if (CheckCondition(player))+           {   +               player.getQuestState(qn).takeItems(ItemId, Amount);+               player.setNoble(true);+               player.sendMessage("Congrats you are noble now!");+           }   +           else+               player.sendMessage("You can't use this, go away!");+   return "";+   }+   +   public static void main(String[] args)+   {+       new FreeNoble(-1, qn, "custom");+   }+}Index: data/scripts/custom/FreeNoble/1.htm===================================================================--- data/scripts/custom/FreeNoble/1.htm    (revision 0)+++ data/scripts/custom/FreeNoble/1.htm    (revision 0)@@ -0,0 +1,5 @@+<html>+<body>+<a action="bypass -h Quest FreeNoble getnoble">TEST</a><br>+</body>+</html>\ No newline at end of file 
returNix
Posts: 76
Joined: Thu Oct 07, 2010 9:03 pm

Re: Nobless NPC

Post by returNix »

LasTravel wrote:Create the default htm for the npc 700001 and done:

Code: Select all

### Eclipse Workspace Patch 1.0#P datapack_developmentIndex: data/scripts/custom/FreeNoble/FreeNoble.java===================================================================--- data/scripts/custom/FreeNoble/FreeNoble.java    (revision 0)+++ data/scripts/custom/FreeNoble/FreeNoble.java    (revision 0)@@ -0,0 +1,78 @@+package custom.FreeNoble;++import com.l2jserver.gameserver.instancemanager.QuestManager;+import com.l2jserver.gameserver.model.actor.L2Npc;+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;+import com.l2jserver.gameserver.model.quest.Quest;+import com.l2jserver.gameserver.model.quest.QuestState;++/**+ * @author LasTravel+ */+ +public class FreeNoble extends Quest+{+   private static final int NPCID = 700001;+   private static final int LevelMin = 80;+   private static final int ItemId = 7678; //Caradine's Letter +   private static final int Amount = 1;+   +   private static final String qn = "FreeNoble";+   +   public FreeNoble(int questId, String name, String descr)+   {+       super(questId, name, descr);+       addStartNpc(NPCID);+       addTalkId(NPCID);+   }+   +   @Override+   public String onTalk(L2Npc npc, L2PcInstance player)+   {+       String htmltext ="";+       QuestState st = player.getQuestState(getName());+       if (st == null)+       {+           Quest q = QuestManager.getInstance().getQuest(getName());+           st = q.newQuestState(player);+       }+       if (npc.getNpcId() == NPCID)+           htmltext = "1.htm";+   return htmltext;+   }+   +   private boolean CheckCondition(L2PcInstance player)+   {+       if (player == null)+           return false;+       +       else if (player.isHero() || player.isNoble())+           return false;+       else if (player.getLevel() < LevelMin)+           return false;+       else if (!(player.getQuestState(qn).getQuestItemsCount(ItemId) >= Amount))+           return false;+       else+           return true;+   }+   +   @Override+   public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)+   {+       //Give Noble Status+       if (event.equalsIgnoreCase("getnoble"))+           if (CheckCondition(player))+           {   +               player.getQuestState(qn).takeItems(ItemId, Amount);+               player.setNoble(true);+               player.sendMessage("Congrats you are noble now!");+           }   +           else+               player.sendMessage("You can't use this, go away!");+   return "";+   }+   +   public static void main(String[] args)+   {+       new FreeNoble(-1, qn, "custom");+   }+}Index: data/scripts/custom/FreeNoble/1.htm===================================================================--- data/scripts/custom/FreeNoble/1.htm    (revision 0)+++ data/scripts/custom/FreeNoble/1.htm    (revision 0)@@ -0,0 +1,5 @@+<html>+<body>+<a action="bypass -h Quest FreeNoble getnoble">TEST</a><br>+</body>+</html>\ No newline at end of file 
Should i do "Apply patch" and copy from clipboard?
if yes, to gameserver right?
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7005
Joined: Tue Aug 11, 2009 3:36 am

Re: Nobless NPC

Post by Zoey76 »

# ### Eclipse Workspace Patch 1.0
# #P datapack_development

Apply to datapack, and yes, you can copy the patch and use from clipboard option.
Be careful when you copy the patch from forum, check you don't add extra lines.
Powered by Eclipse 4.30 🌌 | Eclipse Temurin 21 ☕ | MariaDB 11.2.2 🗃️ | L2J Server 2.6.3.0 - High Five 🚀

🔗 Join our Discord! 🎮💬
User avatar
LasTravel
Posts: 888
Joined: Tue Jan 05, 2010 12:08 am
Location: Spain

Re: Nobless NPC

Post by LasTravel »

Don't forget add it to scripts.cfg
returNix
Posts: 76
Joined: Thu Oct 07, 2010 9:03 pm

Re: Nobless NPC

Post by returNix »

LasTravel wrote:Don't forget add it to scripts.cfg
Hey.
If i understood right, i need to open a directory at gameserver\data\scripts\custom
named freenoble, put there the 1.htm file,
open scripts.cfg
write there:
custom/freenoble/1.htm
double click at caradine letter in-game and im noble ?
User avatar
LasTravel
Posts: 888
Joined: Tue Jan 05, 2010 12:08 am
Location: Spain

Re: Nobless NPC

Post by LasTravel »

returNix wrote:
LasTravel wrote:Don't forget add it to scripts.cfg
Hey.
If i understood right, i need to open a directory at gameserver\data\scripts\custom
named freenoble, put there the 1.htm file,
open scripts.cfg
write there:
custom/freenoble/1.htm
double click at caradine letter in-game and im noble ?
Why you do one request if you don't know what do with it?

1- Copy the folder FreeNoble to data/scripts/custom/, then open scripts.cfg and add custom/FreeNoble/FreeNoble.java
2- Create one npc with id 700001
3- Create the default html for the npc 700001 and put it on data/html/default

Add this link on the default html

Code: Select all

<a action="bypass -h npc_%objectId%_Quest FreeNoble">FreeNoble</a><br>
returNix
Posts: 76
Joined: Thu Oct 07, 2010 9:03 pm

Re: Nobless NPC

Post by returNix »

LasTravel wrote:
returNix wrote:
LasTravel wrote:Don't forget add it to scripts.cfg
Hey.
If i understood right, i need to open a directory at gameserver\data\scripts\custom
named freenoble, put there the 1.htm file,
open scripts.cfg
write there:
custom/freenoble/1.htm
double click at caradine letter in-game and im noble ?
Why you do one request if you don't know what do with it?

1- Copy the folder FreeNoble to data/scripts/custom/, then open scripts.cfg and add custom/FreeNoble/FreeNoble.java
2- Create one npc with id 700001
3- Create the default html for the npc 700001 and put it on data/html/default

Add this link on the default html

Code: Select all

<a action="bypass -h npc_%objectId%_Quest FreeNoble">FreeNoble</a><br>
The allowed range is from 1 to 65553 :X
I will try other.
returNix
Posts: 76
Joined: Thu Oct 07, 2010 9:03 pm

Re: Nobless NPC

Post by returNix »

LasTravel wrote:
returNix wrote:
LasTravel wrote:Don't forget add it to scripts.cfg
Hey.
If i understood right, i need to open a directory at gameserver\data\scripts\custom
named freenoble, put there the 1.htm file,
open scripts.cfg
write there:
custom/freenoble/1.htm
double click at caradine letter in-game and im noble ?
Why you do one request if you don't know what do with it?

1- Copy the folder FreeNoble to data/scripts/custom/, then open scripts.cfg and add custom/FreeNoble/FreeNoble.java
2- Create one npc with id 700001
3- Create the default html for the npc 700001 and put it on data/html/default

Add this link on the default html

Code: Select all

<a action="bypass -h npc_%objectId%_Quest FreeNoble">FreeNoble</a><br>
The allowed range is from 1 to 65553 :X
I will try other.
Ok i changed npc ID and all, I needed to add them 1.htm to make this work in quest folder, and its wroking.
THANKS ALOT FOR EVERONE WHO HELPED , even if you were pretty angry about me :(
Thanks. now i learned more thing :)
Post Reply