Jump to content

Recommended Posts

Posted

Hello ! One share just for fun!

 

I call it lucky coin. When you use it , you bet 100kk adena and there are 5 cases :

 

Case1 : You get the 100kk adena back

Case2 : You loose another 100kk. If you don't have to pay you go to jail for 1 minutes **

Case3 : You win 500kk adena.

Case4 : You win 1kkk adena

Case5 : You just loose the adena you just bet.

 

### Eclipse Workspace Patch 1.0
#P L2_GameServer_It
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java	(revision 4487)
+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -134,11 +149,13 @@
import net.sf.l2j.gameserver.handler.itemhandlers.Firework;
import net.sf.l2j.gameserver.handler.itemhandlers.FishShots;
import net.sf.l2j.gameserver.handler.itemhandlers.Harvester;
+import net.sf.l2j.gameserver.handler.itemhandlers.LuckyCoin;
import net.sf.l2j.gameserver.handler.itemhandlers.MercTicket;

@@ -476,6 +499,8 @@
		_itemHandler.registerItemHandler(new SpecialXMas());
		_itemHandler.registerItemHandler(new SummonItems());
		_itemHandler.registerItemHandler(new BeastSpice());
+		if (Config.ENABLE_LUCKY_COIN)
+		_itemHandler.registerItemHandler(new LuckyCoin());
        _log.config("ItemHandler: Loaded " + _itemHandler.size() + " handlers.");

		_skillHandler = SkillHandler.getInstance();
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 4487)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -1162,8 +1167,126 @@

   /** Vote Reward System */
   public static String 		VOTE_HTML_PATCH;
   public static int           VOTES_FOR_REWARD;
   public static int 			VOTE_REWARD1_ID;
   public static int 			VOTE_REWARD2_ID;
   public static int 			VOTE_REWARD1_COUNT;
   public static int 			VOTE_REWARD2_COUNT;
+    
+    /** Lucky Coin */
+    public static boolean ENABLE_LUCKY_COIN;
+    public static int LUCKY_COIN_ID;


@@ -1963,6 +2094,145 @@
              VOTE_HTML_PATCH = customs.getProperty("VoteHtmlPatch", "Null");
              VOTES_FOR_REWARD = Integer.parseInt(customs.getProperty("VotesRequiredForReward", "10"));
              VOTE_REWARD1_COUNT = Integer.parseInt(customs.getProperty("VoteReward1Count", "1000"));
              VOTE_REWARD2_COUNT = Integer.parseInt(customs.getProperty("VoteReward2Count", "1000"));
              VOTE_REWARD1_ID = Integer.parseInt(customs.getProperty("VoteReward1Id", "57"));
              VOTE_REWARD2_ID = Integer.parseInt(customs.getProperty("VoteReward2Id", "57"));
+               ENABLE_LUCKY_COIN = Boolean.parseBoolean(customs.getProperty("EnableLuckyCoin", "True"));
+               LUCKY_COIN_ID = Integer.parseInt(customs.getProperty("LuckyCoinID", "6673"));
+                   

Index: java/net/sf/l2j/gameserver/handler/itemhandlers/LuckyCoin.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/itemhandlers/LuckyCoin.java	(revision 0)
+++ java/net/sf/l2j/gameserver/handler/itemhandlers/LuckyCoin.java	(revision 0)
@@ -0,0 +1,207 @@
+/* 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.Config;
+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.gameserver.serverpackets.InventoryUpdate;
+import net.sf.l2j.gameserver.serverpackets.SocialAction;
+import net.sf.l2j.util.Rnd;
+
+/**
+ *
+ * @author  FelonBIG
+ */
+public class LuckyCoin implements IItemHandler
+{
+	private static final int ITEM_IDS[] =
+		{
+		    Config.LUCKY_COIN_ID
+		};
+	
+	public void useItem(L2PlayableInstance playable, L2ItemInstance item)
+	{
+		if (!(playable instanceof L2PcInstance))
+		{
+			return;
+		}
+		
+		  L2PcInstance activeChar = (L2PcInstance)playable;
+		  
+		  if (activeChar.getKarma() > 0)
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin now! Go burn your karma!");
+			  return;
+		  }
+		  
+		  else if (activeChar.getPvpFlag() > 0)
+			  
+		  {
+			  activeChar.sendMessage("You cannot use Lucky Coin while being flagged!");
+			  return;
+		  }
+		  
+		  else if (activeChar.isInOlympiadMode())
+			  
+		  {
+			activeChar.sendMessage("You cannot use the lucky coin in olympiad");
+			return;
+		  }
+		  
+		  else if (activeChar.inObserverMode())
+			  
+		  {
+			  activeChar.sendMessage("You cannot use lucky coin while observing an olympiad match!");
+			  return;
+		  }
+		  
+		  else if (activeChar.isFestivalParticipant())
+		  
+		  {
+			  activeChar.sendMessage("You cannot use lucky coin while participating in a festival");
+			  return;
+		  }
+		  
+		  else if (activeChar.isCastingNow())
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while casting");
+			  return;
+		  }
+		  
+		  else if (activeChar.isStunned())
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while being stunned");
+			  return;
+		  }
+		  
+		  else if (activeChar.isSleeping())
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while sleeping");
+			  return;
+		  }
+		  
+		  else if (activeChar.atEvent)
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while participating in an event!");
+			  return;
+		  }
+		  
+		  else if (activeChar.isInJail())
+		  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while being in jail!");
+		  }
+		  
+		  else if (activeChar.getInventory().getItemByItemId(57).getCount() < 100000000)
+			  
+		  {
+			  activeChar.sendMessage("You do not have 100kk adena to bet ! I am sorry! Go farm");
+			  return;
+		  }
+		  
+		  /** Enough with the -beep-ing limits xD */
+		  
+		  else
+			  
+		  {
+			  InventoryUpdate iu = new InventoryUpdate();
+			  activeChar.getInventory().destroyItemByItemId("Adena", 57, 100000000, activeChar, activeChar.getTarget());
+			  
+			  String bet = "You have now bet 100k adena! Let's see the outcome !";  
+			  
+			  switch (Rnd.get(5))
+			  
+			  {
+			  case 0 :
+
+				  activeChar.sendMessage(bet);
+				  activeChar.sendMessage("Oops, you lost your money. You were not lucky!");
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  
+				  break;
+				  
+			  case 1 :  
+
+				  activeChar.sendMessage(bet);
+				  activeChar.getInventory().addItem("Adena", 57, 100000000, activeChar, null);
+				  activeChar.sendMessage("You either won or loose ! You get your precious adena back!");
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  				  
+				  break;
+				  
+			  case 2 :
+				  activeChar.sendMessage(bet);
+				  activeChar.getInventory().addItem("Adena", 57, 500000000, activeChar, null);
+				  activeChar.sendMessage("Holy crap! You won 500kk adena!");
+				  activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 3));
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  
+				  break;
+				  
+			  case 3 :
+				  
+				  activeChar.sendMessage(bet);
+				  activeChar.getInventory().addItem("Adena", 57, 1000000000, activeChar, null);
+				  activeChar.sendMessage("Holy crap! You won 1kkk adena!");
+				  activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 3));
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  
+				  break;
+				  
+			  case 4 :
+				  
+				  activeChar.sendMessage(bet);
+				  activeChar.getInventory().destroyItemByItemId("Adena", 57, 100000000, activeChar, activeChar.getTarget());
+				  activeChar.sendMessage("Blame your bad luck! You lost another 100kk adena");
+				  
+				  if (activeChar.getInventory().getItemByItemId(57).getCount() < 100000000)
+	        		{
+	        			activeChar.setPunishLevel(L2PcInstance.PunishLevel.JAIL, 15);
+	        			activeChar.sendMessage("Blame your bad luck ! You don't have to pay so you are going to jail for 15 minutes");
+	        		}
+				  
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  
+				  break;
+				  
+				  
+			  }
+		  }
+	}
+	
+	public int[] getItemIds()
+	
+	{
+		return ITEM_IDS;
+	}
+
+}
Index: java/config/Customs.properties
===================================================================
--- java/config/Customs.properties	(revision 0)
+++ java/config/Customs.properties	(revision 0)
@@ -0,0 +1,101 @@
#--------------------------------------------#
#          Vote Reward System Config         #
#-------------------------------------------#
# Html Patch for Your Vote Site
# Works with HopZone/HopZones/TopZone and other HopZone Like
# Sample:
VoteHtmlPatch = http://l2.hopzone.net/lineage2/moreinfo/RaidFightLowRatePvPServers/69262.html
VotesRequiredForReward = 10
VoteReward1Count = 1000
VoteReward2Count = 1000
VoteReward1Id = 57
VoteReward2Id = 57
+
+# ---------------------------------------------------------------------------
+#  Lucky Coin
+# ---------------------------------------------------------------------------
+# With this coin you bet 100kk adena . There are 4 cases :
+# Case 1 : You get back the 100kk
+# Case 2 : You lose another 100kk. If you don't have to pay you head to jail for 15 min
+# Case 3 : You win 500kk
+# Case 4 : You win 1kkk
+# Just for fun xD
+# Allow lucky coin?
+EnableLuckyCoin = True
+
+# Set lucky coin's ID :
+# Default : 6673 ( Festival Adena )
+LuckyCoinID = 6673

 

** : NOTE : Tested on l2jinterlude BUT , I have added Gracia's punishment system which means that interlude users will get an error in this line :

activeChar.setPunishLevel(L2PcInstance.PunishLevel.JAIL, 15);

 

just change it to activeChar.setInJail(true, 15);

 

As i said nothing too special. A friend of mine requested it and i thought it would be nice to share it with you

 

Regards

 

PS : Code fixed thx for the report

 

Posted

another retard post, between the others. :|


there are 5 cases and rnd.get is 3.

the last 2 cases  will never be called


activeChar.sendPacket(iu); is called before 'inventory' actions

 

:\

Posted

another retard post, between the others. :|


there are 5 cases and rnd.get is 3.

the last 2 cases  will never be called


activeChar.sendPacket(iu); is called before 'inventory' actions

 

:\

 

So Vagos123 can u fix it?

Posted

Index: java/net/sf/l2j/gameserver/handler/itemhandlers/LuckyCoin.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/itemhandlers/LuckyCoin.java	(revision 0)
+++ java/net/sf/l2j/gameserver/handler/itemhandlers/LuckyCoin.java	(revision 0)
@@ -0,0 +1,207 @@
+/* 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.Config;
+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.gameserver.serverpackets.InventoryUpdate;
+import net.sf.l2j.gameserver.serverpackets.SocialAction;
+import net.sf.l2j.util.Rnd;
+
+/**
+ *
+ * @author  FelonBIG
+ */
+public class LuckyCoin implements IItemHandler
+{
+	private static final int ITEM_IDS[] =
+		{
+		    Config.LUCKY_COIN_ID
+		};
+	
+	public void useItem(L2PlayableInstance playable, L2ItemInstance item)
+	{
+		if (!(playable instanceof L2PcInstance))
+		{
+			return;
+		}
+		
+		  L2PcInstance activeChar = (L2PcInstance)playable;
+		  
+		  if (activeChar.getKarma() > 0)
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin now! Go burn your karma!");
+			  return;
+		  }
+		  
+		  else if (activeChar.getPvpFlag() > 0)
+			  
+		  {
+			  activeChar.sendMessage("You cannot use Lucky Coin while being flagged!");
+			  return;
+		  }
+		  
+		  else if (activeChar.isInOlympiadMode())
+			  
+		  {
+			activeChar.sendMessage("You cannot use the lucky coin in olympiad");
+			return;
+		  }
+		  
+		  else if (activeChar.inObserverMode())
+			  
+		  {
+			  activeChar.sendMessage("You cannot use lucky coin while observing an olympiad match!");
+			  return;
+		  }
+		  
+		  else if (activeChar.isFestivalParticipant())
+		  
+		  {
+			  activeChar.sendMessage("You cannot use lucky coin while participating in a festival");
+			  return;
+		  }
+		  
+		  else if (activeChar.isCastingNow())
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while casting");
+			  return;
+		  }
+		  
+		  else if (activeChar.isStunned())
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while being stunned");
+			  return;
+		  }
+		  
+		  else if (activeChar.isSleeping())
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while sleeping");
+			  return;
+		  }
+		  
+		  else if (activeChar.atEvent)
+			  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while participating in an event!");
+			  return;
+		  }
+		  
+		  else if (activeChar.isInJail())
+		  
+		  {
+			  activeChar.sendMessage("You cannot use the lucky coin while being in jail!");
+		  }
+		  
+		  else if (activeChar.getInventory().getItemByItemId(57).getCount() < 100000000)
+			  
+		  {
+			  activeChar.sendMessage("You do not have 100kk adena to bet ! I am sorry! Go farm");
+			  return;
+		  }
+		  
+		  /** Enough with the -beep-ing limits xD */
+		  
+		  else
+			  
+		  {
+			  InventoryUpdate iu = new InventoryUpdate();
+			  activeChar.getInventory().destroyItemByItemId("Adena", 57, 100000000, activeChar, activeChar.getTarget());
+			  
+			  String bet = "You have now bet 100k adena! Let's see the outcome !";  
+			  
+			  switch (Rnd.get(5))
+			  
+			  {
+			  case 0 :
+
+				  activeChar.sendMessage(bet);
+				  activeChar.sendMessage("Oops, you lost your money. You were not lucky!");
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  
+				  break;
+				  
+			  case 1 :  
+
+				  activeChar.sendMessage(bet);
+				  activeChar.getInventory().addItem("Adena", 57, 100000000, activeChar, null);
+				  activeChar.sendMessage("You either won or loose ! You get your precious adena back!");
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  				  
+				  break;
+				  
+			  case 2 :
+				  activeChar.sendMessage(bet);
+				  activeChar.getInventory().addItem("Adena", 57, 500000000, activeChar, null);
+				  activeChar.sendMessage("Holy crap! You won 500kk adena!");
+				  activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 3));
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  
+				  break;
+				  
+			  case 3 :
+				  
+				  activeChar.sendMessage(bet);
+				  activeChar.getInventory().addItem("Adena", 57, 1000000000, activeChar, null);
+				  activeChar.sendMessage("Holy crap! You won 1kkk adena!");
+				  activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 3));
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  
+				  break;
+				  
+			  case 4 :
+				  
+				  activeChar.sendMessage(bet);
+				  activeChar.getInventory().destroyItemByItemId("Adena", 57, 100000000, activeChar, activeChar.getTarget());
+				  activeChar.sendMessage("Blame your bad luck! You lost another 100kk adena");
+				  
+				  if (activeChar.getInventory().getItemByItemId(57).getCount() < 100000000)
+	        		{
+	        			activeChar.setPunishLevel(L2PcInstance.PunishLevel.JAIL, 15);
+	        			activeChar.sendMessage("Blame your bad luck ! You don't have to pay so you are going to jail for 15 minutes");
+	        		}
+				  
+				  activeChar.getInventory().destroyItemByItemId("Lucky Coin", Config.LUCKY_COIN_ID, 1, activeChar, activeChar.getTarget());
+				  activeChar.sendPacket(iu);
+				  
+				  break;
+				  
+				  
+			  }
+		  }
+	}
+	
+	public int[] getItemIds()
+	
+	{
+		return ITEM_IDS;
+	}
+
+}

It may work now, but i didn't really test it...

  • 4 weeks later...
  • 3 months later...
  • 2 months later...

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


  • Posts

    • New user panel SOURCE $ 200 for source code. R$ 1000,00 BRL for source code.    
    • User panel 2.0 + New features.    
    • Hello everyone, we are one of the top gaming currency stores. We work exclusively with top projects. If you are interested in anything like Adena, Coins, Equip, write to us Discord - pchelacoin Telegram - https://t.me/ipchelacoin BOHPTS, KETRAWARS, EURO-PVP, L2REBORN, E-GLOBAL, LA2DREAM TOP PRICE !!!!!!!
    • L2Elixir – Patch 4 Is Live!   We’re working non-stop, day and night, to deliver the best possible quality and bring back what made L2Elixir special. This project is built with passion, not shortcuts — for the old-school players who remember, and the new ones who want to experience it properly. Thank you for being part of the journey. Together, we’re making L2Elixir great again ❤️ The legends never fade.    ⚙️ General Enabled Class Change service (same class type only) ALT + B → Services → Character Development Enabled Shift + Click on Treasure Chests Players can now identify real chests (Adena, scroll drops) and use Key / Unlock Event deaths now cancel only debuffs, All self buffs are preserved, fixes issues with Root and similar effects Bladedancer class can now log in even when Max Clients (2) is reached. Since an active Bladedancer is not available for every damage dealer and some players tried to abuse this via VPN or a second PC, this feature was added to keep things fair. protections applies, requires testing!    🎒 Items Crystallizing enchanted items now gives the correct increased crystal amount (retail-like behavior) Removed Agathion Seal Bracelet: Rudolph from Santa rewards (Gracia Final item) Added Dualsword Craft Stamp into Milestone Exchange list    🧙 Skills Fixed Banish Undead lethal chance Hot Springs Malaria and similar effects now level up faster while being attacked
  • Topics

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