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

    • wtf is your website lol ai slop
    • who have this files? or info about cached packets?
    • Hi maxcheaters, i am trying to bring back an old server ( L2Revenge) but with my own ideas, i only liked how it was and made the gameplay based on that just putting my own ideas.   So practicly is a PTS C6 with an extender that i work lately    Exp / SP is x45 adena is x200 and drops x5  so safe is +3 , max is unlimited and rate is 65% for both mage and fighter weapons I created a system that you can get on the levels the gear you need based on farm but for S grade theres a little farm to get some armor Tokens to unseal them. As you remember L2Revenge had olympiad / Tournament gear. So people abused them and had S grades that way just couldnt enchant them. So i made to be wearable only if u are nobless. That way i cancel this "exploit".  The server gives opportunity to solo and clans , epic gear ( epic weapons) or armors can be bought with raid tokens and you can craft them or get them with various ways Regarding Buffs: 24 buff slots no changes asked. Cov/Pony/Cat , siren - renewal - champion out of buffer , if u make the char as main roll u can use them or use the offline buffer system to sell them and get adenas. their time is 20 mins so that way we see again the " 1kk for rene/siren" or rec = song  Regarding armors: they are dropped ( parts ) from 3 only raids , rest lvl 76+ raids drop recipes , so crafting takes place (so if u are solo u can craft them )  there are 3 armors each armor have its purpose: Revenge Armors - Example for light ( its a glass cannon , high damage , less atk speed and less pdef ) - they mostly modify your base stats, so useable on sieges or off tank chars Titanium Armors - A little bit of balanced of all  Epic Armor - Daggers/Enchanters/Healers mostly but u can always combine your build    Regarding weapons: can be dropped from Monastery of Silence monsters or get them from NPC with Raid Tokens its like a 5% better than S grades and the S/A Activates at +4  Regarding retail gear: you need to unseal only S grades for a great amount of armor tokens all weapons on any grade need Soul crystals that are sold for adenas  stage 13 crystals are expensive or dropped from raids Regarding fun: There is a squash event a Fortress vs Fortress pvp event an RB Event at weekends and from Monday - Wednesday Tournament ( Olympiad is closed monday/tuesday/wednesday)  at tournament you can practice 1vs1 like olympiad but pots/ss allowed , gear allowed is only olympiad or tournament , each win of match gives u 5 glits at 100 glits u can be hero till restart Olympiad works the same way regarding gear allowance but works only thursday to friday and you win monthly hero Auction with Raid Tokens is activated Event medals from events can be exchanged for various items i try to make the oldschool with a little bit of new school systems Not planing to open it anytime soon as i still develop and make corrections to extender , looking forward to meet people that actually played this and are hyped to help on testing / development   P.S is c5 into interlude ( theres no akamanah / nor PI aswell , no lifestones) forgot to mention
    • Announcement – L2 Relic Server Opening Soon! We’re excited to share some great news! Our team has been working hard behind the scenes, and we’re nearly ready to launch our brand-new Lineage server this winter. The journey is just about to begin – so prepare yourselves! Gather your friends, sharpen your skills, and get ready to experience an epic adventure. Stay tuned for more details, updates, and the official beta-opening date. This winter, history will be written once again… are you ready?   Developed by https://dailyhost.eu/
  • 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