Jump to content

[Share] Item buffer


MiDnEx

Recommended Posts

http://img266.imageshack.us/img266/3457/itembufferzn6.jpg

 

I found it on l2j forum premaded to l2jfree core hellbaund.

 

1.Aplly patch

Patch:

Index: src/main/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- src/main/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 2)
+++ src/main/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 7)
@@ -26,5 +26,7 @@
import net.sf.l2j.gameserver.datatables.ClanTable;
import net.sf.l2j.gameserver.handler.AdminCommandHandler;
+import net.sf.l2j.gameserver.handler.CustomCommandHandler;
import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.handler.ICustomCommandHandler;
import net.sf.l2j.gameserver.instancemanager.games.Trivia;
import net.sf.l2j.gameserver.model.GMAudit;
@@ -254,4 +256,17 @@
                     activeChar.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());
             }
+			else if (_command.startsWith("Custom "))
+			{
+				String command = _command.split(" ")[1];
+
+				ICustomCommandHandler ach = CustomCommandHandler.getInstance().getCustomCommandHandler(command);
+				
+				if (ach == null)
+					return;
+				
+				//remove the "Custom" at the beginning
+				command = _command.replace("Custom ", "");
+				ach.useCustomCommand(command, activeChar);
+			}
		else if (_command.startsWith("trivia "))
		{
Index: src/main/java/net/sf/l2j/gameserver/handler/customcommandhandlers/buffItem.java
===================================================================
--- src/main/java/net/sf/l2j/gameserver/handler/customcommandhandlers/buffItem.java (revision 7)
+++src/main/java/net/sf/l2j/gameserver/handler/customcommandhandlers/buffItem.java (revision 7)
@@ -0,0 +1,72 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.handler.customcommandhandlers;
+
+import java.util.Iterator;
+
+import javolution.text.TextBuilder;
+import net.sf.l2j.gameserver.cache.HtmCache;
+import net.sf.l2j.gameserver.datatables.SkillTable;
+import net.sf.l2j.gameserver.handler.ICustomCommandHandler;
+import net.sf.l2j.gameserver.model.L2Skill;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+
+/**
+ *
+ *
+ */
+public class buffItem implements ICustomCommandHandler
+{
+    private static final String[] CUSTOM_COMMANDS = {"doBuff"};
+
+	/**
+     * @see net.sf.l2j.gameserver.handler.ICustomCommandHandler#useCustomCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)
+     */
+    @Override
+    public boolean useCustomCommand(String command, L2PcInstance activeChar)
+    {
+    	if(command.startsWith("doBuff"))
+	    {
+	    	String actualCommand = command.split(" ")[0]; //will not be used :P
+	    	int skillId = Integer.parseInt(command.split(" ")[1]);   
+	    	int skillLevel = Integer.parseInt(command.split(" ")[2]);  
+	    	
+	    	L2Skill skillToCast = SkillTable.getInstance().getInfo(skillId, skillLevel);
+	    	if(skillToCast != null)
+	    	{
+		    	skillToCast.getEffects(activeChar, activeChar);	
+	    	}else
+	    	{
+	    		//lol unknown buff? XD
+	    		//skills can also be added to database for some security....
+	    	}    	
+	    	
+			String content = HtmCache.getInstance().getHtm("data/html/itemBuffer/buffList.html");
+	        NpcHtmlMessage customReply = new NpcHtmlMessage(1);
+	        customReply.setHtml(content);
+	        activeChar.sendPacket(customReply);
+			activeChar.sendPacket( ActionFailed.STATIC_PACKET );
+	    }
+	    return false;
+    }
+
+    public String[] getCustomCommandList()
+    {
+        return CUSTOM_COMMANDS;
+    }
+
+}
Index: src/main/java/net/sf/l2j/gameserver/handler/ICustomCommandHandler.java
===================================================================
--- src/main/java/net/sf/l2j/gameserver/handler/ICustomCommandHandler.java (revision 7)
+++ src/main/java/net/sf/l2j/gameserver/handler/ICustomCommandHandler.java (revision 7)
@@ -0,0 +1,37 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.handler;
+
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * This class ...
+ *
+ * @version $Revision: 1.1.4.2 $ $Date: 2005/03/27 15:30:09 $
+ */
+public interface ICustomCommandHandler
+{
+	/**
+	 * @param activeChar
+	 * @param command
+	 */
+	public boolean useCustomCommand(String command, L2PcInstance activeChar);
+
+	/**
+	 * this method is called at initialization to register all the item ids automatically
+	 * @return all known itemIds
+	 */
+	public String[] getCustomCommandList();
+}
Index: src/main/java/net/sf/l2j/gameserver/handler/ItemHandler.java
===================================================================
--- src/main/java/net/sf/l2j/gameserver/handler/ItemHandler.java (revision 2)
+++ src/main/java/net/sf/l2j/gameserver/handler/ItemHandler.java (revision 7)
@@ -28,4 +28,5 @@
import net.sf.l2j.gameserver.handler.itemhandlers.BlessedSpiritShot;
import net.sf.l2j.gameserver.handler.itemhandlers.Book;
+import net.sf.l2j.gameserver.handler.itemhandlers.BuffItems;
import net.sf.l2j.gameserver.handler.itemhandlers.CharChangePotions;
import net.sf.l2j.gameserver.handler.itemhandlers.ChestKey;
@@ -102,4 +103,5 @@
		registerItemHandler(new BeastSoulShot());
		registerItemHandler(new BeastSpice());
+		registerItemHandler(new BuffItems());
		registerItemHandler(new BeastSpiritShot());
		registerItemHandler(new BlessedSpiritShot());
Index: src/main/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- src/main/java/net/sf/l2j/gameserver/GameServer.java (revision 2)
+++src/main/java/net/sf/l2j/gameserver/GameServer.java (revision 7)
@@ -64,4 +64,5 @@
import net.sf.l2j.gameserver.handler.AdminCommandHandler;
import net.sf.l2j.gameserver.handler.ChatHandler;
+import net.sf.l2j.gameserver.handler.CustomCommandHandler;
import net.sf.l2j.gameserver.handler.ItemHandler;
import net.sf.l2j.gameserver.handler.SkillHandler;
@@ -334,4 +335,5 @@
		UserCommandHandler.getInstance();
		VoicedCommandHandler.getInstance();
+		CustomCommandHandler.getInstance();
		ChatHandler.getInstance();

2.Crate folder in html folder named "itemBuffer" and create html called "buffList"

insert this code:

<html><title>Buffer</title>
<body>
<center>
<td align=center><button value="Noblesse Blessing" action="bypass -h Custom doBuff 1323 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<img src="L2UI_CH3.onscrmsg_pattern01_1" width=300 height=32 align=left>
<table width=230>
</tr>
<tr>
<td align=center><button value="Focus" action="bypass -h Custom doBuff 7041 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button value="Death Whisper" action="bypass -h Custom doBuff 7042 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td align=center><button value="Haste" action="bypass -h Custom doBuff 7043 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button value="Guidance" action="bypass -h Custom doBuff 7044 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
</tr>
<tr>
<td align=center><button value="Agility" action="bypass -h Custom doBuff 7047 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button value="Acumen" action="bypass -h Custom doBuff 7048 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td align=center><button value="Decrease Weight" action="bypass -h Custom doBuff 7049 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button value="Might" action="bypass -h Custom doBuff 7050 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td align=center><button value="Shield" action="bypass -h Custom doBuff 7051 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button value="Magic Barrier" action="bypass -h Custom doBuff 7052 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td align=center><button value="Vampiric Rage" action="bypass -h Custom doBuff 7053 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button value="Empower" action="bypass -h Custom doBuff 7054 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td align=center><button value="Wind Walk" action="bypass -h Custom doBuff 7055 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button value="Berserker Spirit" action="bypass -h Custom doBuff 7056 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td align=center><button value="Greater Might" action="bypass -h Custom doBuff 7057 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button value="Greater Shield" action="bypass -h Custom doBuff 7058 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td align=center><button value="Wild Magic" action="bypass -h Custom doBuff 7059 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button value="Clarity" action="bypass -h Custom doBuff 7060 1" width=130 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<tr><td></td></tr>
</table>
<img src="L2UI_CH3.onscrmsg_pattern01_2" width=300 height=32 align=left>
<br>Midnex(c)
</center>
</body>
</html>

 

 

Link to comment
Share on other sites

O.O that is friking cool mate :^D Nice start

 

Keep up , Btw now i am woundering how to do shop or buffer whit item (is there any guide in mxc?)

Link to comment
Share on other sites

Index: src/main/java/net/sf/l2j/gameserver/handler/ICustomCommandHandler.java
===================================================================
--- src/main/java/net/sf/l2j/gameserver/handler/ICustomCommandHandler.java (revision 7)
+++ src/main/java/net/sf/l2j/gameserver/handler/ICustomCommandHandler.java (revision 7)
@@ -0,0 +1,37 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.handler;
+
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * This class ...
+ *
+ * @version $Revision: 1.1.4.2 $ $Date: 2005/03/27 15:30:09 $
+ */
+public interface ICustomCommandHandler
+{
+	/**
+	 * @param activeChar
+	 * @param command
+	 */
+	public boolean useCustomCommand(String command, L2PcInstance activeChar);
+
+	/**
+	 * this method is called at initialization to register all the item ids automatically
+	 * @return all known itemIds
+	 */
+	public String[] getCustomCommandList();
+}

Link to comment
Share on other sites

Using l2j server interlude latest rev.

Only 1 problem:

My itemhandler.java not look like this,

i mean there isnt any line like thesE:

import net.sf.l2j.gameserver.handler.AdminCommandHandler;

import net.sf.l2j.gameserver.handler.ChatHandler;

import net.sf.l2j.gameserver.handler.ItemHandler;

import net.sf.l2j.gameserver.handler.SkillHandler;

 

registerItemHandler(new BeastSoulShot());

registerItemHandler(new BeastSpice());

registerItemHandler(new BeastSpiritShot());

registerItemHandler(new BlessedSpiritShot());

What Should i do?

My itemhandler.java looks like:

/*

* This program is free software; you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation; either version 2, or (at your option)

* any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

* GNU General Public License for more details.

*

* You should have received a copy of the GNU General Public License

* along with this program; if not, write to the Free Software

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

* 02111-1307, USA.

*

* http://www.gnu.org/copyleft/gpl.html

*/

package net.sf.l2j.gameserver.handler;

 

import java.util.Map;

import java.util.TreeMap;

 

/**

* This class manages handlers of items

*

* @version $Revision: 1.1.4.3 $ $Date: 2005/03/27 15:30:09 $

*/

public class ItemHandler

{

//private static Logger _log = Logger.getLogger(ItemHandler.class.getName());

 

private static ItemHandler _instance;

 

private Map<Integer, IItemHandler> _datatable;

 

/**

* Create ItemHandler if doesn't exist and returns ItemHandler

* @return ItemHandler

*/

public static ItemHandler getInstance()

{

if (_instance == null)

{

_instance = new ItemHandler();

}

return _instance;

}

 

/**

* Returns the number of elements contained in datatable

* @return int : Size of the datatable

*/

    public int size()

    {

        return _datatable.size();

    }

 

    /**

     * Constructor of ItemHandler

     */

private ItemHandler()

{

_datatable = new TreeMap<Integer, IItemHandler>();

}

 

/**

* Adds handler of item type in <I>datatable</I>.<BR><BR>

* <B><I>Concept :</I></U><BR>

* This handler is put in <I>datatable</I> Map <Integer ; IItemHandler > for each ID corresponding to an item type

* (existing in classes of package itemhandlers) sets as key of the Map.

* @param handler (IItemHandler)

*/

public void registerItemHandler(IItemHandler handler)

{

// Get all ID corresponding to the item type of the handler

int[] ids = handler.getItemIds();

// Add handler for each ID found

for (int i = 0; i < ids.length; i++)

{

_datatable.put(new Integer(ids), handler);

}

}

 

/**

* Returns the handler of the item

* @param itemId : int designating the itemID

* @return IItemHandler

*/

public IItemHandler getItemHandler(int itemId)

{

return _datatable.get(new Integer(itemId));

}

}

 

Link to comment
Share on other sites

  • 7 months later...
  • 2 weeks later...
  • 1 month later...

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.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock