Jump to content
  • 0

Question

Posted

Hello, I want to add effect when someone win at casino.

 

For example, someone won at casino I want to do something like firework.

 


 

What about this line?

 

MagicSkillUser msk = new MagicSkillUser(activeChar, 1050, 1, teleportTimer, 0);

 

Thanks!

8 answers to this question

Recommended Posts

  • 0
Posted

Hello, I want to add effect when someone win at casino.

 

For example, someone won at casino I want to do something like firework.

 


 

What about this line?

 

MagicSkillUser msk = new MagicSkillUser(activeChar, 1050, 1, teleportTimer, 0);

 

Thanks!

 

seems fine just add after case if sucess

 

  • 0
Posted

So this code it's working?

 

I have no idea, try this

 

MagicSkillUse  MSU = new MagicSkillUse(player, player, 2024, 1, 1, 0);

 

Anyway, here you go Casino with such effects.

 

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2CasinoInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2CasinoInstance.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2CasinoInstance.java	(revision 0)
@@ -0,0 +1,469 @@
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import javolution.text.TextBuilder;
+
+import net.sf.l2j.gameserver.ai.CtrlIntention;
+import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.network.serverpackets.SetupGauge;
+import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
+import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.util.Broadcast;
+import net.sf.l2j.util.Rnd;
+
+public class L2CasinoInstance extends L2NpcInstance
+{
+    public String filename;
+
+    public L2CasinoInstance(int objectId, L2NpcTemplate template)
+    {
+        super(objectId, template);
+    }
+
+    @Override
+    public void onBypassFeedback(L2PcInstance player, String command)
+    {
+        if(player == null)
+            return;
+
+        if(command.startsWith("play1") && player.getInventory().getInventoryItemCount(9142, 0) >= 2)
+            Casino1(player);
+        if(command.startsWith("play2") && player.getInventory().getInventoryItemCount(9142, 0) >= 4)
+            Casino2(player);
+        if(command.startsWith("play3") && player.getInventory().getInventoryItemCount(9142, 0) >= 8)
+            Casino3(player);
+        if(command.startsWith("play4") && player.getInventory().getInventoryItemCount(9142, 0) >= 16)
+            Casino4(player);
+        if(command.startsWith("play5") && player.getInventory().getInventoryItemCount(57, 0) >= 500000)
+            Casino5(player);
+        if(command.startsWith("play6") && player.getInventory().getInventoryItemCount(57, 0) >= 1000000)
+            Casino6(player);
+        if(command.startsWith("play7") && player.getInventory().getInventoryItemCount(57, 0) >= 10000000)
+            Casino7(player);
+    }
+
+    public static void displayCongrats(L2PcInstance player)
+    {
+        player.broadcastPacket(new SocialAction(player, 3));
+        MagicSkillUse  MSU = new MagicSkillUse(player, player, 2024, 1, 1, 0);
+        player.broadcastPacket(MSU);
+        player.sendMessage("Congratulations! you won");
+    }
+
+    @Override
+    public void showChatWindow(L2PcInstance player, int val)
+    {
+        filename = (getHtmlPath(getNpcId(), val));
+        NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+        msg.setHtml(casinoWindow(player));
+        msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+        player.sendPacket(msg);
+    }
+
+    private String casinoWindow(L2PcInstance player)
+    {
+        TextBuilder tb = new TextBuilder();
+        tb.append("<html><title>Casino Manager</title><body>");
+        tb.append("<center>");
+        tb.append("<br>");
+        tb.append("<font color=\"999999\">Chance to win : 50%</font><br>");
+        tb.append("<img src=\"L2UI.SquareGray\" width=\"200\" height=\"1\"><br>");
+        tb.append("Welcome "+player.getName()+"<br>");
+        tb.append("<tr><td>Double or Nothing ?</td></tr><br>");
+        tb.append("<img src=\"L2UI.SquareGray\" width=\"280\" height=\"1\"></center><br>");
+        tb.append("<center>");
+        tb.append("Place your bets");
+        tb.append("</center>");
+        tb.append("<img src=\"L2UI.SquareGray\" width=\"280\" height=\"1\"></center><br>");
+        tb.append("<br>");
+        tb.append("<center>");
+        tb.append("<tr>");
+        tb.append("<td><button value=\"2 Apiga\" action=\"bypass -h npc_%objectId%_play1\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21></td>");
+        tb.append("<td><button value=\"4 Apiga\" action=\"bypass -h npc_%objectId%_play2\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21></td>");
+        tb.append("</tr>");
+        tb.append("<tr>");
+        tb.append("<td><button value=\"8 Apiga\" action=\"bypass -h npc_%objectId%_play3\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21></td>");
+        tb.append("<td><button value=\"16 Apiga\" action=\"bypass -h npc_%objectId%_play4\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21></td>");
+        tb.append("</tr>");
+        tb.append("<tr>");
+        tb.append("<td><button value=\"500k\" action=\"bypass -h npc_%objectId%_play5\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21></td>");
+        tb.append("<td><button value=\"1kk\" action=\"bypass -h npc_%objectId%_play6\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21></td>");
+        tb.append("</tr>");
+        tb.append("<tr>");
+        tb.append("<td><button value=\"10kk\" action=\"bypass -h npc_%objectId%_play7\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21></td>");
+        tb.append("</tr>");
+        tb.append("</center>");
+        tb.append("<center><img src=\"L2UI.SquareGray\" width=\"280\" height=\"1\">");
+        tb.append("</body></html>");
+        return tb.toString();
+    }
+
+    public static void Casino1(L2PcInstance player)
+    {
+        int unstuckTimer = 1000;
+        player.setTarget(player);
+        player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+        player.disableAllSkills();
+        MagicSkillUse msk = new MagicSkillUse(player, 361, 1, unstuckTimer, 0);
+        Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
+        SetupGauge sg = new SetupGauge(0, unstuckTimer);
+        player.sendPacket(sg);
+
+        Casino1 ef = new Casino1(player);
+        ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer);
+    }
+
+    static class Casino1 implements Runnable
+    {
+        private L2PcInstance _player;
+        Casino1(L2PcInstance player)
+        {
+            _player = player;
+        }
+        public void run()
+        {
+            if(_player.isDead())
+                return;
+
+            _player.setIsIn7sDungeon(false);
+            _player.enableAllSkills();
+            int chance = Rnd.get(2);
+
+            if(_player.getInventory().getInventoryItemCount(9142, 0) >= 2)
+            {
+                if(chance == 0)
+                {
+                    displayCongrats(_player);
+                    _player.getInventory().addItem("Adena", 9142, 2, _player, null);
+                }
+                if(chance == 1)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 9142, 2, _player, null);
+                }
+            }
+            else
+                _player.sendMessage("You do not have eneough items.");
+        }
+    }
+
+    public static void Casino2(L2PcInstance player)
+    {
+        int unstuckTimer = 1000;
+        player.setTarget(player);
+        player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+        player.disableAllSkills();
+        MagicSkillUse msk = new MagicSkillUse(player, 361, 1, unstuckTimer, 0);
+        Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
+        SetupGauge sg = new SetupGauge(0, unstuckTimer);
+        player.sendPacket(sg);
+
+        Casino2 ef = new Casino2(player);
+        ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer);
+    }
+
+    static class Casino2 implements Runnable
+    {
+        private L2PcInstance _player;
+        Casino2(L2PcInstance player)
+        {
+            _player = player;
+        }
+        public void run()
+        {
+            if(_player.isDead())
+                return;
+
+            _player.setIsIn7sDungeon(false);
+            _player.enableAllSkills();
+            int chance = Rnd.get(3);
+
+            if(_player.getInventory().getInventoryItemCount(9142, 0) >= 4)
+            {
+                if(chance == 0)
+                {
+                    displayCongrats(_player);
+                    _player.getInventory().addItem("Adena", 9142, 4, _player, null);
+                }
+                if(chance == 1)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 9142, 4, _player, null);
+                }
+                if(chance == 2)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 9142, 4, _player, null);
+                }
+            }
+            else
+            	_player.sendMessage("You do not have eneough items.");
+        }
+    }
+
+    public static void Casino3(L2PcInstance player)
+    {
+        int unstuckTimer = 1000;
+        player.setTarget(player);
+        player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+        player.disableAllSkills();
+        MagicSkillUse msk = new MagicSkillUse(player, 361, 1, unstuckTimer, 0);
+        Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
+        SetupGauge sg = new SetupGauge(0, unstuckTimer);
+        player.sendPacket(sg);
+
+        Casino3 ef = new Casino3(player);
+        ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer);
+    }
+
+    static class Casino3 implements Runnable
+    {
+        private L2PcInstance _player;
+        Casino3(L2PcInstance player)
+        {
+            _player = player;
+        }
+        public void run()
+        {
+            if(_player.isDead())
+                return;
+
+            _player.setIsIn7sDungeon(false);
+            _player.enableAllSkills();
+            int chance = Rnd.get(3);
+
+            if(_player.getInventory().getInventoryItemCount(9142, 0) >= 8)
+            {
+                if(chance == 0)
+                {
+                    displayCongrats(_player);
+                    _player.getInventory().addItem("Adena", 9142, 8, _player, null);
+                }
+                if(chance == 1)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 9142, 8, _player, null);
+                }
+                if(chance == 2)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 9142, 8, _player, null);
+                }
+            }
+            else
+            	_player.sendMessage("You do not have eneough items.");
+        }
+    }
+
+    public static void Casino4(L2PcInstance player)
+    {
+        int unstuckTimer = 1000;
+        player.setTarget(player);
+        player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+        player.disableAllSkills();
+        MagicSkillUse msk = new MagicSkillUse(player, 361, 1, unstuckTimer, 0);
+        Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
+        SetupGauge sg = new SetupGauge(0, unstuckTimer);
+        player.sendPacket(sg);
+
+        Casino4 ef = new Casino4(player);
+        ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer);
+    }
+
+    static class Casino4 implements Runnable
+    {
+        private L2PcInstance _player;
+        Casino4(L2PcInstance player)
+        {
+            _player = player;
+        }
+        public void run()
+        {
+            if(_player.isDead())
+                return;
+
+            _player.setIsIn7sDungeon(false);
+            _player.enableAllSkills();
+            int chance = Rnd.get(3);
+
+            if(_player.getInventory().getInventoryItemCount(9142, 0) >= 16)
+            {
+                if(chance == 0)
+                {
+                    displayCongrats(_player);
+                    _player.getInventory().addItem("Adena", 9142, 16, _player, null);
+                }
+                if(chance == 1)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 9142, 16, _player, null);
+                }
+                if(chance == 2)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 9142, 16, _player, null);
+                }
+            }
+            else
+            	_player.sendMessage("You do not have eneough items.");
+        }
+    }
+    
+    public static void Casino5(L2PcInstance player)
+    {
+        int unstuckTimer = 1000;
+        player.setTarget(player);
+        player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+        player.disableAllSkills();
+        MagicSkillUse msk = new MagicSkillUse(player, 361, 1, unstuckTimer, 0);
+        Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
+        SetupGauge sg = new SetupGauge(0, unstuckTimer);
+        player.sendPacket(sg);
+
+        Casino5 ef = new Casino5(player);
+        ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer);
+    }
+
+    static class Casino5 implements Runnable
+    {
+        private L2PcInstance _player;
+        Casino5(L2PcInstance player)
+        {
+            _player = player;
+        }
+        public void run()
+        {
+            if(_player.isDead())
+                return;
+
+            _player.setIsIn7sDungeon(false);
+            _player.enableAllSkills();
+            int chance = Rnd.get(2);
+
+            if(_player.getInventory().getInventoryItemCount(57, 0) >= 500000)
+            {
+                if(chance == 0)
+                {
+                    displayCongrats(_player);
+                    _player.getInventory().addItem("Adena", 57, 500000, _player, null);
+                }
+                if(chance == 1)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 57, 500000, _player, null);
+                }
+            }
+            else
+            	_player.sendMessage("You do not have eneough items.");
+        }
+    }
+    
+    public static void Casino6(L2PcInstance player)
+    {
+        int unstuckTimer = 1000;
+        player.setTarget(player);
+        player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+        player.disableAllSkills();
+        MagicSkillUse msk = new MagicSkillUse(player, 361, 1, unstuckTimer, 0);
+        Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
+        SetupGauge sg = new SetupGauge(0, unstuckTimer);
+        player.sendPacket(sg);
+
+        Casino6 ef = new Casino6(player);
+        ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer);
+    }
+
+    static class Casino6 implements Runnable
+    {
+        private L2PcInstance _player;
+        Casino6(L2PcInstance player)
+        {
+            _player = player;
+        }
+        public void run()
+        {
+            if(_player.isDead())
+                return;
+
+            _player.setIsIn7sDungeon(false);
+            _player.enableAllSkills();
+            int chance = Rnd.get(3);
+
+            if(_player.getInventory().getInventoryItemCount(57, 0) >= 1000000)
+            {
+                if(chance == 0)
+                {
+                    displayCongrats(_player);
+                    _player.getInventory().addItem("Adena", 57, 1000000, _player, null);
+                }
+                if(chance == 1)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 57, 1000000, _player, null);
+                }
+                if(chance == 2)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 57, 1000000, _player, null);
+                }
+            }
+            else
+            	_player.sendMessage("You do not have eneough items.");
+        }
+    }
+    
+    public static void Casino7(L2PcInstance player)
+    {
+        int unstuckTimer = 1000;
+        player.setTarget(player);
+        player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+        player.disableAllSkills();
+        MagicSkillUse msk = new MagicSkillUse(player, 361, 1, unstuckTimer, 0);
+        Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
+        SetupGauge sg = new SetupGauge(0, unstuckTimer);
+        player.sendPacket(sg);
+
+        Casino7 ef = new Casino7(player);
+        ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer);
+    }
+
+    static class Casino7 implements Runnable
+    {
+        private L2PcInstance _player;
+        Casino7(L2PcInstance player)
+        {
+            _player = player;
+        }
+        public void run()
+        {
+            if(_player.isDead())
+                return;
+
+            _player.setIsIn7sDungeon(false);
+            _player.enableAllSkills();
+            int chance = Rnd.get(3);
+
+            if(_player.getInventory().getInventoryItemCount(57, 0) >= 10000000)
+            {
+                if(chance == 0)
+                {
+                    displayCongrats(_player);
+                    _player.getInventory().addItem("Adena", 57, 10000000, _player, null);
+                }
+                if(chance == 1)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 57, 10000000, _player, null);
+                }
+                if(chance == 2)
+                {
+                	_player.sendMessage("You lost the bet");
+                    _player.getInventory().destroyItemByItemId("Adena", 57, 10000000, _player, null);
+                }
+            }
+            else
+            	_player.sendMessage("You do not have eneough items.");
+        }
+    }
+}
\ No newline at end of file

  • 0
Posted

MagicSkillUser msk = new MagicSkillUser(activeChar, 1050, 1, teleportTimer, 0);

 

Forgot to say that this line only creates the packet , then you must send it to the player also , so you will have to add one more line to work fine.

activeChar.sendPacket(msk);

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

    • Hello everyone, Lineage II clan MightyTeam is reopening recruitment and looking for ambitious, active players who want to compete seriously and grow together. We are building a disciplined and organized environment focused on teamwork, strategy, and long-term success. What we offer: Strong and experienced leadership, Fair and respectful treatment for every member, Organized clan structure and tactical gameplay, Competitive mentality with clear goals, Stable and drama-free environment, What we expect: Activity and willingness to improve, Teamplay and communication, Respect toward clan members, Motivation to compete and dominate, No politics. No toxicity. Only focused players with the right mentality.   If you are interested in joining MightyTeam, contact on Discord: tzelal.  <-- there is a dot  or Telegram tz3gg. 
    • Lol thanks no l better get Acis /Lucera/Mobius and will squeeze more profit that your crazy ass price files for fucks know what. Even Reborn was smart enough use Acis after Lucera to squeeze shit a lot of money 😁 Fucking hell 15 grants lol 😂 
    • It seems the SkyLord is simply not familiar with what l2-scripts and Bonux represents today. His opinion is likely based on our older materials — which is understandable. We haven't been standing still. Over the years, the studio has moved to a fundamentally different level of development. Our early builds are still available on the legacy site at very accessible prices — and they remain entirely viable for launching a project. As practice shows, solid servers can still be built on them, albeit with greater effort. As for the market — Classic, Essence, and Main have long been running on l2-scripts engines, and the majority of successful servers have, at one stage or another, used our source code as their foundation. This isn't self-promotion — it's the history of the industry. Today, for established projects with a reputation, we offer a different format: private partnership with individual terms tailored to your business goals. If you're interested in long-term collaboration — we're open to the conversation. We have solutions for every level — from newcomers to top-tier projects. Feel free to reach out, and we'll be happy to discuss.
    • implemented Black Market NPC that can copy and make discount on desired multisells , spawns despawns and fully configurable with schedule and random timer   implemented Dungeon Finder , fully configurable for custom dungeons and can be accessed from 2-9 party size. Your choice! 
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..