Jump to content
  • 0

[REQUEST]Christmas Box (JAVA)


KOZANE

Question

Kalispera sas, tha ithela na valo ston server mou to eksis:

o gm tha mporei na pataei gia paradigma .boxreward kati tetio kai oloi oi online pektes tha pernoun as poume kati items(valte id oti thelete tha to alaksw) kai oi pektes an to patane auto tha tous dinei dwra tixea, gia paradigma: adenas i bogs i lifestones kai etsi. den kserw apo java , iparxei periptosi na me to kanei kaneis apo esas free? euxaristw.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

### Eclipse Workspace Patch 1.0
#P INTERLUDE_GAMESERVER_TEST
Index: java/net/sf/l2j/gameserver/handler/itemhandlers/boxrewarding.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/itemhandlers/boxrewarding.java	(revision 0)
+++ java/net/sf/l2j/gameserver/handler/itemhandlers/boxrewarding.java	(revision 0)
@@ -0,0 +1,65 @@
+/* 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.itemhandlers;
+
+import net.sf.l2j.gameserver.handler.IItemHandler;
+import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
+import net.sf.l2j.util.Rnd;
+
+/**
+ *
+ * @author  Codex
+ */
+public class boxrewarding implements IItemHandler
+{
+
+	private static final int[] ITEM_IDS = {3481};
+	
+	/**
+	 * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
+	 */
+	public void useItem(L2PlayableInstance playable, L2ItemInstance item)
+	{
+		if (!(playable instanceof L2PcInstance))
+			return;
+		L2PcInstance activeChar = (L2PcInstance) playable;
+		
+		if(item == null ) return; else
+		{
+			switch(Rnd.get(1)){
+			case 0:
+				activeChar.getInventory().addItem("CASE 1", 57, 250000000, activeChar, null);
+				activeChar.sendMessage("The ~Christmas Box had adenas, you took them");
+			case 1:
+				activeChar.getInventory().addItem("CASE 1", 8762, 20, activeChar, null);
+				activeChar.sendMessage("The ~Christmas Box had life stones, you took them");
+			}
+		}	
+	}
+
+	/**
+	 * @see net.sf.l2j.gameserver.handler.IItemHandler#getItemIds()
+	 */
+	public int[] getItemIds()
+	{
+		return ITEM_IDS;
+	}
+
+}
Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/boxreward.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/boxreward.java	(revision 0)
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/boxreward.java	(revision 0)
@@ -0,0 +1,59 @@
+/* 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.voicedcommandhandlers;
+
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ *
+ * @author  Codex
+ */
+public class boxreward implements IVoicedCommandHandler
+{
+
+	/**
+	 * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
+	 */
+	
+	public static String[] VOICED_COMMANDS = {"boxreward"};
+	
+	public boolean useVoicedCommand(String command, L2PcInstance activeChar,String target)	
+	{
+		if(command.equalsIgnoreCase("boxreward") && activeChar.isGM()){
+			for(L2PcInstance players : L2World.getInstance().getAllPlayers()){
+				if(!players.isGM()){
+				players.getInventory().addItem("CHRISTMAS", 3481, 1, players, null);
+				players.sendMessage("Admin rewarded you with a ~Christmas Box~,press it to see the reward");
+			  }
+			}
+			activeChar.sendMessage("Players rewarded successfully with the Christmas Box");
+		}
+		return true;
+	}
+
+	/**
+	 * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
+	 */
+	public String[] getVoicedCommandList()
+	{
+		return VOICED_COMMANDS;
+	}
+
+}
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java	(revision 5048)
+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -152,6 +152,7 @@
import net.sf.l2j.gameserver.handler.itemhandlers.SpiritShot;
import net.sf.l2j.gameserver.handler.itemhandlers.SummonItems;
import net.sf.l2j.gameserver.handler.itemhandlers.Maps;
+import net.sf.l2j.gameserver.handler.itemhandlers.boxrewarding;
import net.sf.l2j.gameserver.handler.skillhandlers.BalanceLife;
import net.sf.l2j.gameserver.handler.skillhandlers.BeastFeed;
import net.sf.l2j.gameserver.handler.skillhandlers.Blow;
@@ -197,6 +198,7 @@
import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo;
import net.sf.l2j.gameserver.handler.usercommandhandlers.Time;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.boxreward;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats;
import net.sf.l2j.gameserver.idfactory.IdFactory;
import net.sf.l2j.gameserver.instancemanager.AuctionManager;
@@ -444,6 +446,7 @@
		_log.config("AutoSpawnHandler: Loaded " + _autoSpawnHandler.size() + " handlers in total.");

		_itemHandler = ItemHandler.getInstance();
+		_itemHandler.registerItemHandler(new boxrewarding());
		_itemHandler.registerItemHandler(new ScrollOfEscape());
		_itemHandler.registerItemHandler(new ScrollOfResurrection());
		_itemHandler.registerItemHandler(new SoulShots());
@@ -589,6 +592,7 @@

		_voicedCommandHandler = VoicedCommandHandler.getInstance();
		_voicedCommandHandler.registerVoicedCommandHandler(new stats());
+		_voicedCommandHandler.registerVoicedCommandHandler(new boxreward());

		if(Config.L2JMOD_ALLOW_WEDDING)
			_voicedCommandHandler.registerVoicedCommandHandler(new Wedding());

 

το κανα πολυ γρηγορα, πρωτα διαβασε το και μετα αρχισε το edit ;)

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
Answer this question...

×   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...