Page 1 of 1

Nobless NPC

Posted: Wed Oct 20, 2010 2:05 pm
by returNix
Hey guys, can someone give me an NPC that does me noble for a Caradine letter?
Thanks

Re: Nobless NPC

Posted: Wed Oct 20, 2010 5:01 pm
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 

Re: Nobless NPC

Posted: Wed Oct 20, 2010 5:22 pm
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?

Re: Nobless NPC

Posted: Wed Oct 20, 2010 5:35 pm
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.

Re: Nobless NPC

Posted: Wed Oct 20, 2010 5:54 pm
by LasTravel
Don't forget add it to scripts.cfg

Re: Nobless NPC

Posted: Wed Oct 20, 2010 6:39 pm
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 ?

Re: Nobless NPC

Posted: Wed Oct 20, 2010 6:46 pm
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>

Re: Nobless NPC

Posted: Thu Oct 21, 2010 2:21 pm
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.

Re: Nobless NPC

Posted: Thu Oct 21, 2010 2:21 pm
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 :)

Re: Nobless NPC

Posted: Sun Oct 11, 2020 7:57 pm
by Cherish
How can i make this code in multi line?