SailFpO

Guide Free help-Requests l2j

13 posts in this topic

SailFpO    0

Hello all,


Since I love to help people if my knowledge can provide the solution, I'm here to help you with your requests/problems about l2j.
I'm usually on for 3-4 hours per day so don't expect fast respond.

  • I'd love to create your idea and give you the code ready but get real, I wont spend hours for just one thing , so don't request something big
  • Feel free to ask any thing you cant understand, blame is not allowed here :)
  • I have no idea for anything related to client side.
  • Atm I'm working on aCis project (feel free to ask something which is related to another project ).

 

Finally,

I want to do this because it will be useful (for some members) but for me too, I'm learning java and I would like to improve my skills so I found it great idea.

 

If this post is in wrong section please a mod move it to the proper one :) Thank you!

 

Edited by SailFpO

Share this post


Link to post
Share on other sites
kreis    0

maybe can you help me , how to disable Quiz event on l2jmythras files its shered here 

[15:23:48]  INFO Dress me system: Load 27 Big Sword(s).
[15:23:48]  INFO Dress me system: Load 4 Rod(s).
[15:23:48]  INFO Dress me system: Load 44 Big Blunt(s).
[15:23:48]  INFO Dress me system: Load 20 Crossbow(s).
[15:23:48]  INFO Dress me system: Load 21 Rapier(s).
[15:23:48]  INFO Dress me system: Load 21 Ancient Sword(s).
[15:23:48]  INFO Dress me system: Load 9 Dual Dagger(s).
Loading Quiz.java
[15:23:51]  INFO Loaded Service: ScripsConfig
[15:23:51]  INFO Loaded Service: SellPcService
[15:23:51]  INFO CommunityBoard: Manage Career service loaded.
[15:23:51]  INFO CommunityBoard: Auction System Service loaded.
[15:23:51]  INFO CommunityBoard: service loaded.
[15:23:51]  INFO CommunityBoard: Bosses loaded.
[15:23:51]  INFO CommunityBoard: Clan Community service loaded.
[15:23:51]  INFO CommunityBoard: Drop Calculator service loaded.

im tring to find where i can turn it off but cant. can you help?

Share this post


Link to post
Share on other sites
SailFpO    0

Take a look in your gameserver.java if there exists a line 'Quiz.getinstance()' , if you found it just add // or delete it

p.s. it could be with configs for enable/disable

Edited by SailFpO

Share this post


Link to post
Share on other sites
Benskis    0

Hey, maybe You could share Your buffer's code if You have one. I just hate scheme buffers. 

Share this post


Link to post
Share on other sites
SailFpO    0
3 hours ago, Benskis said:

Hey, maybe You could share Your buffer's code if You have one. I just hate scheme buffers. 

Well I do not have anything because I'm not planning to open a server :P , you can find infinity buffers here in mxc especially without scheme options

Share this post


Link to post
Share on other sites

I need simple npc for l2jacis , I want to be something like this:
it will requre item "X" to get item "Y", and the second option is to buy equipment with item "Y"

Share this post


Link to post
Share on other sites
Reborn12    66
12 minutes ago, Blood Tears ♡ said:

I need simple npc for l2jacis , I want to be something like this:
it will requre item "X" to get item "Y", and the second option is to buy equipment with item "Y"

There is a donate shop shared you can take it and see how things works reading a code it will be helpful

Share this post


Link to post
Share on other sites
SailFpO    0

Request from: Blood Tears ♡

3 hours ago, Blood Tears ♡ said:

I need simple npc for l2jacis , I want to be something like this:
it will requre item "X" to get item "Y", and the second option is to buy equipment with item "Y"

Let me know if you need configs.

code:

 

Source:

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/actor/instance/Trader.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/Trader.java	(nonexistent)
+++ java/net/sf/l2j/gameserver/model/actor/instance/Trader.java	(working copy)
@@ -0,0 +1,72 @@
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import java.util.StringTokenizer;
+
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
+
+public class Trader extends Folk
+{
+	private static final int[] REQUIRE_ITEM_FOR_EX =
+	{
+		3031,	//the item that the user must have to exchange it with the REWARD_ITEM
+		10 		//the count
+	};
+	private static final int[] REWARD_ITEM =
+	{
+		1872,	//the item that will get after the exchange
+		1		//the count
+	};
+	
+	private static final int REQUIRE_EQUIP_ITEM_CNT = 1;	//the count of items that the npc will consume to give the equip item, the id is the REWARD_ITEM[0]
+	private static final int EQUIP_ITEM_ID[] =
+	{
+		7575,	//the equipment item
+		1		//the count
+	};
+
+
+	
+	public Trader(int objectId, NpcTemplate template)
+	{
+		super(objectId, template);
+	}
+	
+	@Override
+	public void onBypassFeedback(Player player, String command)
+	{
+		StringTokenizer st = new StringTokenizer(command, " ");
+		String currentCommand = st.nextToken();
+		
+		if (currentCommand.startsWith("exchange"))
+		{
+			if (!player.destroyItemByItemId("ex", REQUIRE_ITEM_FOR_EX[0], REQUIRE_ITEM_FOR_EX[1], null, true))
+				player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_ENOUGH_REQUIRED_ITEMS));
+			else
+				player.addItem("rew", REWARD_ITEM[0], REWARD_ITEM[1], null, true);
+		}
+		else if (currentCommand.startsWith("buy"))
+		{
+			if (!player.destroyItemByItemId("ex", REWARD_ITEM[0], REQUIRE_EQUIP_ITEM_CNT, null, true))
+				player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_ENOUGH_REQUIRED_ITEMS));
+			else
+				player.addItem("rew", EQUIP_ITEM_ID[0], EQUIP_ITEM_ID[1], null, true);
+		}
+		
+		super.onBypassFeedback(player, command);
+	}
+	
+	@Override
+	public String getHtmlPath(int npcId, int val)
+	{
+		String filename = "";
+		if (val == 0)
+			filename = "" + npcId;
+		else
+			filename = npcId + "-" + val;
+		
+		return "data/html/mods/Trader/" + filename + ".htm";
+	}
+	
+}
\ No newline at end of file


Npc XML:
### Eclipse Workspace Patch 1.0
#P aCis_datapack
Index: data/xml/npcs/50000-50999.xml
===================================================================
--- data/xml/npcs/50000-50999.xml	(revision 4)
+++ data/xml/npcs/50000-50999.xml	(working copy)
@@ -111,4 +111,42 @@
 			<skill id="4416" level="18"/>
 		</skills>
 	</npc>
+	
+		<npc id="50009" idTemplate="30519" name="Trader" title="Crappy Trader">
+		<set name="usingServerSideName" val="true"/>
+		<set name="usingServerSideTitle" val="true"/>
+		<set name="level" val="70"/>
+		<set name="radius" val="7"/>
+		<set name="height" val="18"/>
+		<set name="rHand" val="0"/>
+		<set name="lHand" val="0"/>
+		<set name="type" val="Trader"/>
+		<set name="exp" val="0"/>
+		<set name="sp" val="0"/>
+		<set name="hp" val="2444.46819"/>
+		<set name="mp" val="1345.8"/>
+		<set name="hpRegen" val="7.5"/>
+		<set name="mpRegen" val="2.7"/>
+		<set name="pAtk" val="688.86373"/>
+		<set name="pDef" val="295.91597"/>
+		<set name="mAtk" val="470.40463"/>
+		<set name="mDef" val="216.53847"/>
+		<set name="crit" val="4"/>
+		<set name="atkSpd" val="253"/>
+		<set name="str" val="40"/>
+		<set name="int" val="21"/>
+		<set name="dex" val="30"/>
+		<set name="wit" val="20"/>
+		<set name="con" val="43"/>
+		<set name="men" val="20"/>
+		<set name="corpseTime" val="7"/>
+		<set name="walkSpd" val="50"/>
+		<set name="runSpd" val="120"/>
+		<set name="dropHerbGroup" val="0"/>
+		<ai type="DEFAULT" ssCount="0" ssRate="0" spsCount="0" spsRate="0" aggro="0" canMove="true" seedable="false"/>
+		<skills>
+			<skill id="4045" level="1"/>
+			<skill id="4416" level="18"/>
+		</skills>
+	</npc>
 </list>
\ No newline at end of file


Npc HTML:
### Eclipse Workspace Patch 1.0
#P aCis_datapack
Index: data/html/mods/trader/50009.htm
===================================================================
--- data/html/mods/trader/50009.htm	(nonexistent)
+++ data/html/mods/trader/50009.htm	(working copy)
@@ -0,0 +1,8 @@
+<html><body>
+	<center>
+	Your custom staff here.
+	
+	<button value="exchange" action="bypass npc_%objectId%_exchange" height=15 width=45 back="sek.cbui94" fore="sek.cbui92">
+	<button value="buy" action="bypass npc_%objectId%_buy" height=15 width=45 back="sek.cbui94" fore="sek.cbui92">
+	
+</body></html>
\ No newline at end of file


 

 

You have to create a new folder in data/html/mods with name trader and inside create a new html with the npc id as name. (in my case was 50009), then paste the html code

Edited by SailFpO

Share this post


Link to post
Share on other sites
1 hour ago, SailFpO said:

Request from: Blood Tears ♡

Let me know if you need configs.

code:

  Reveal hidden contents


Source:

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/actor/instance/Trader.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/Trader.java	(nonexistent)
+++ java/net/sf/l2j/gameserver/model/actor/instance/Trader.java	(working copy)
@@ -0,0 +1,72 @@
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import java.util.StringTokenizer;
+
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
+
+public class Trader extends Folk
+{
+	private static final int[] REQUIRE_ITEM_FOR_EX =
+	{
+		3031,	//the item that the user must have to exchange it with the REWARD_ITEM
+		10 		//the count
+	};
+	private static final int[] REWARD_ITEM =
+	{
+		1872,	//the item that will get after the exchange
+		1		//the count
+	};
+	
+	private static final int REQUIRE_EQUIP_ITEM_CNT = 1;	//the count of items that the npc will consume to give the equip item, the id is the REWARD_ITEM[0]
+	private static final int EQUIP_ITEM_ID[] =
+	{
+		7575,	//the equipment item
+		1		//the count
+	};
+
+
+	
+	public Trader(int objectId, NpcTemplate template)
+	{
+		super(objectId, template);
+	}
+	
+	@Override
+	public void onBypassFeedback(Player player, String command)
+	{
+		StringTokenizer st = new StringTokenizer(command, " ");
+		String currentCommand = st.nextToken();
+		
+		if (currentCommand.startsWith("exchange"))
+		{
+			if (!player.destroyItemByItemId("ex", REQUIRE_ITEM_FOR_EX[0], REQUIRE_ITEM_FOR_EX[1], null, true))
+				player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_ENOUGH_REQUIRED_ITEMS));
+			else
+				player.addItem("rew", REWARD_ITEM[0], REWARD_ITEM[1], null, true);
+		}
+		else if (currentCommand.startsWith("buy"))
+		{
+			if (!player.destroyItemByItemId("ex", REWARD_ITEM[0], REQUIRE_EQUIP_ITEM_CNT, null, true))
+				player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_ENOUGH_REQUIRED_ITEMS));
+			else
+				player.addItem("rew", EQUIP_ITEM_ID[0], EQUIP_ITEM_ID[1], null, true);
+		}
+		
+		super.onBypassFeedback(player, command);
+	}
+	
+	@Override
+	public String getHtmlPath(int npcId, int val)
+	{
+		String filename = "";
+		if (val == 0)
+			filename = "" + npcId;
+		else
+			filename = npcId + "-" + val;
+		
+		return "data/html/mods/Trader/" + filename + ".htm";
+	}
+	
+}
\ No newline at end of file


Npc XML:
### Eclipse Workspace Patch 1.0
#P aCis_datapack
Index: data/xml/npcs/50000-50999.xml
===================================================================
--- data/xml/npcs/50000-50999.xml	(revision 4)
+++ data/xml/npcs/50000-50999.xml	(working copy)
@@ -111,4 +111,42 @@
 			<skill id="4416" level="18"/>
 		</skills>
 	</npc>
+	
+		<npc id="50009" idTemplate="30519" name="Trader" title="Crappy Trader">
+		<set name="usingServerSideName" val="true"/>
+		<set name="usingServerSideTitle" val="true"/>
+		<set name="level" val="70"/>
+		<set name="radius" val="7"/>
+		<set name="height" val="18"/>
+		<set name="rHand" val="0"/>
+		<set name="lHand" val="0"/>
+		<set name="type" val="Trader"/>
+		<set name="exp" val="0"/>
+		<set name="sp" val="0"/>
+		<set name="hp" val="2444.46819"/>
+		<set name="mp" val="1345.8"/>
+		<set name="hpRegen" val="7.5"/>
+		<set name="mpRegen" val="2.7"/>
+		<set name="pAtk" val="688.86373"/>
+		<set name="pDef" val="295.91597"/>
+		<set name="mAtk" val="470.40463"/>
+		<set name="mDef" val="216.53847"/>
+		<set name="crit" val="4"/>
+		<set name="atkSpd" val="253"/>
+		<set name="str" val="40"/>
+		<set name="int" val="21"/>
+		<set name="dex" val="30"/>
+		<set name="wit" val="20"/>
+		<set name="con" val="43"/>
+		<set name="men" val="20"/>
+		<set name="corpseTime" val="7"/>
+		<set name="walkSpd" val="50"/>
+		<set name="runSpd" val="120"/>
+		<set name="dropHerbGroup" val="0"/>
+		<ai type="DEFAULT" ssCount="0" ssRate="0" spsCount="0" spsRate="0" aggro="0" canMove="true" seedable="false"/>
+		<skills>
+			<skill id="4045" level="1"/>
+			<skill id="4416" level="18"/>
+		</skills>
+	</npc>
 </list>
\ No newline at end of file


Npc HTML:
### Eclipse Workspace Patch 1.0
#P aCis_datapack
Index: data/html/mods/trader/50009.htm
===================================================================
--- data/html/mods/trader/50009.htm	(nonexistent)
+++ data/html/mods/trader/50009.htm	(working copy)
@@ -0,0 +1,8 @@
+<html><body>
+	<center>
+	Your custom staff here.
+	
+	<button value="exchange" action="bypass npc_%objectId%_exchange" height=15 width=45 back="sek.cbui94" fore="sek.cbui92">
+	<button value="buy" action="bypass npc_%objectId%_buy" height=15 width=45 back="sek.cbui94" fore="sek.cbui92">
+	
+</body></html>
\ No newline at end of file


 

 

You have to create a new folder in data/html/mods with name trader and inside create a new html with the npc id as name. (in my case was 50009), then paste the html code

Thank you.

Share this post


Link to post
Share on other sites
tazerman2    13

you can make this 

<button value="exchange" action="bypass npc_%objectId%_exchange" height=15 width=45 back="sek.cbui94" fore="sek.cbui92">

as like this

<button value="exchange" action="bypass npc_%objectId%_exchange $count" height=15 width=45 back="sek.cbui94" fore="sek.cbui92">

for player dont need press all time 1 button with <edit var="$count" width=120 height=15> default conut = 1 if box is space

Share this post


Link to post
Share on other sites
melron    21
6 minutes ago, tazerman2 said:

you can make this 


<button value="exchange" action="bypass npc_%objectId%_exchange" height=15 width=45 back="sek.cbui94" fore="sek.cbui92">

as like this


<button value="exchange" action="bypass npc_%objectId%_exchange $count" height=15 width=45 back="sek.cbui94" fore="sek.cbui92">

for player dont need press all time 1 button with <edit var="$count" width=120 height=15> default conut = 1 if box is space

Well a good code must be secured too, Generally avoid to create codes that uses value from html because this one can be easily bypassed from programs like andrenaline...

Even in buffer case where the bypass is npc_%objectId%_buff 1204 2 can be bypassed to npc_%objectId%_buff 7029 4

and the user will get gm speed lvl 4...

 

p.s Ofc a code like you did with all necessary checks inside can be worked too without any problem but its a huge amount of wasted time :D

 

Ontopic: good job for your time

Edited by melron

Share this post


Link to post
Share on other sites
SweeTs    9
if (!player.destroyItemByItemId("ex", REQUIRE_ITEM_FOR_EX[0], REQUIRE_ITEM_FOR_EX[1], null, true))
    player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_ENOUGH_REQUIRED_ITEMS));
else
    player.addItem("rew", REWARD_ITEM[0], REWARD_ITEM[1], null, true);

You could make it like

if (!player.destroyItemByItemId("ex", REQUIRE_ITEM_FOR_EX[0], REQUIRE_ITEM_FOR_EX[1], null, true))
    return;
	player.addItem("rew", REWARD_ITEM[0], REWARD_ITEM[1], null, true);

If destroyItem.. return false, you get the message about incorect item count. With your message, you get it twice.

Edited by SweeTs

Share this post


Link to post
Share on other sites
SailFpO    0
7 hours ago, SweeTs said:

If destroyItem.. return false, you get the message about incorect item count. With your message, you get it twice.

Well, it's not twice :P if you look carefully

the default one inside of destroyitem.... is

if (sendMessage)
	sendPacket(SystemMessageId.NOT_ENOUGH_ITEMS);

which is the message "Incorrect item count." in the player's chat.

the second one (I added) is

SystemMessageId.NOT_ENOUGH_REQUIRED_ITEMS)

which is the message in dialog "You do not have enough required items." :D

I just like the dialog to appear when the player haven't all the required items. (it's just optional)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now