Jump to content

Recommended Posts

  • 3 weeks later...
Posted

just a few tip

 

When you do something like that you dont need to use runnable.

Since you made it for epilogue you can place the whole thing into the DP.

Using so many social actions is bad you can just one 1 of them.

Instead of textbuilder you can use StringBuilder.

When you declare something like that: int unstuckTimer = (1*1000 ); you dont need to multiple it with 1 unless its not configurable.

 

Overall better than your previous shares now you just need to learn some coding.

Posted

Instead of textbuilder you can use StringBuilder.

" This class represents an Appendable text whose capacity expands gently without incurring expensive resize/copy operations ever.

 

This class is not intended for large documents manipulations which should be performed with the Text class directly (O(Log(n)) insertion and deletion capabilities).

 

This implementation is not synchronized."

 

TextBuilder is by far a better option then a string builder.

Posted

Good idea ty for sharing, but where is the NPC or how i can add one for this .java script???? I don't see any NPC ID in your script... If you can tell me how...?  Ty

Posted

Good idea ty for sharing, but where is the NPC or how i can add one for this .java script???? I don't see any NPC ID in your script... If you can tell me how...?  Ty

 

Because its NPC Instance (like L2Npc, L2Buffer, L2Gatekeeper, L2Merchant etc)

 

So u have to create new NPC with type L2CasinoInstance.

  • 4 weeks later...
Posted

Link is dead ;)

 

For interlude reworked

 

package com.src.gameserver.model.actor.instance;

import javolution.text.TextBuilder;

import com.src.gameserver.GameTimeController;
import com.src.gameserver.ai.CtrlIntention;
import com.src.gameserver.network.serverpackets.ExShowScreenMessage;
import com.src.gameserver.network.serverpackets.MagicSkillUser;
import com.src.gameserver.network.serverpackets.NpcHtmlMessage;
import com.src.gameserver.network.serverpackets.SetupGauge;
import com.src.gameserver.network.serverpackets.SocialAction;
import com.src.gameserver.templates.L2NpcTemplate;
import com.src.gameserver.thread.ThreadPoolManager;
import com.src.gameserver.util.Broadcast;
import com.src.util.random.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 || player.getLastFolkNPC() == null || player.getLastFolkNPC().getObjectId() != this.getObjectId())
       {
           return;
       }

       if(command.startsWith("play1"))
       {
           Casino1(player);
       }

       if(command.startsWith("play2"))
       {
           Casino2(player);
       }

       if(command.startsWith("play3"))
       {
           Casino3(player);
       }

       if(command.startsWith("play4"))
       {
           Casino4(player);
       }
   }

   public static void displayCongrats(L2PcInstance player)
   {
       player.broadcastPacket(new SocialAction(player.getObjectId(), 3));
       MagicSkillUser  MSU = new MagicSkillUser(player, player, 2024, 1, 1, 0);
       player.broadcastPacket(MSU);
       ExShowScreenMessage screen = new ExShowScreenMessage("Congratulations "+player.getName()+"! You won!", 15000);
       player.sendPacket(screen);
   }

   public static void displayCongrats2(L2PcInstance player)
   {
       ExShowScreenMessage screen = new ExShowScreenMessage(""+player.getName()+"! You lost!", 15000);
       player.sendPacket(screen);
   }

   @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= 100KK action=\"bypass -h npc_%objectId%_play1\" width=130 height=25 back= L2UI_ct1.button_df fore = L2UI_ct1.button_df></td>");
       tb.append("<td><button value= 300KK action=\"bypass -h npc_%objectId%_play2\" width=130 height=25 back= L2UI_ct1.button_df fore = L2UI_ct1.button_df></td>");
       tb.append("</tr>");
       tb.append("<tr>");
       tb.append("<td><button value= 500KK action=\"bypass -h npc_%objectId%_play3\" width=130 height=25 back= L2UI_ct1.button_df fore = L2UI_ct1.button_df></td>");
       tb.append("<td><button value= 1KKK action=\"bypass -h npc_%objectId%_play4\" width=130 height=25 back= L2UI_ct1.button_df fore = L2UI_ct1.button_df></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 = (1*1000 );
       player.setTarget(player);
       player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
       player.disableAllSkills();
       MagicSkillUser msk = new MagicSkillUser(player, 361, 1, unstuckTimer, 0);
       Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
       SetupGauge sg = new SetupGauge(0, unstuckTimer);
       player.sendPacket(sg);

       Casino1 ef = new Casino1(player);
       player.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer));
       player.setSkillCastEndTime(10+GameTimeController.getGameTicks()+unstuckTimer/GameTimeController.MILLIS_IN_TICK);
   }

   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.isNoble() && _player.getInventory().getInventoryItemCount(57, 0) >= 100000000)
           {
               if(chance == 0)
               {
                   displayCongrats(_player);
                   _player.getInventory().addItem("Adena", 57, 100000000, _player, null);
               }

               if(chance == 1)
               {
                   displayCongrats2(_player);
                   _player.getInventory().destroyItemByItemId("Adena", 57, 100000000, _player, null);
               }
           }
           else
           {
               _player.sendMessage("You do not have eneough items.");
           }
       }
   }

   public static void Casino2(L2PcInstance player)
   {
       int unstuckTimer = (1*1000 );
       player.setTarget(player);
       player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
       player.disableAllSkills();
       MagicSkillUser msk = new MagicSkillUser(player, 361, 1, unstuckTimer, 0);
       Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
       SetupGauge sg = new SetupGauge(0, unstuckTimer);
       player.sendPacket(sg);

       Casino2 ef = new Casino2(player);
       player.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer));
       player.setSkillCastEndTime(10+GameTimeController.getGameTicks()+unstuckTimer/GameTimeController.MILLIS_IN_TICK);
   }

   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.isNoble() && _player.getInventory().getInventoryItemCount(57, 0) >= 300000000)
           {
               if(chance == 0)
               {
                   displayCongrats(_player);
                   _player.getInventory().addItem("Adena", 57, 300000000, _player, null);
               }

               if(chance == 1)
               {
                   displayCongrats2(_player);
                   _player.getInventory().destroyItemByItemId("Adena", 57, 300000000, _player, null);
               }

               if(chance == 2)
               {
                   displayCongrats2(_player);
                   _player.getInventory().destroyItemByItemId("Adena", 57, 300000000, _player, null);
               }
           }
           else
           {
               _player.sendMessage("You do not have eneough items.");
           }
       }
   }

   public static void Casino3(L2PcInstance player)
   {
       int unstuckTimer = (1*1000 );
       player.setTarget(player);
       player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
       player.disableAllSkills();
       MagicSkillUser msk = new MagicSkillUser(player, 361, 1, unstuckTimer, 0);
       Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
       SetupGauge sg = new SetupGauge(0, unstuckTimer);
       player.sendPacket(sg);

       Casino3 ef = new Casino3(player);
       player.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer));
       player.setSkillCastEndTime(10+GameTimeController.getGameTicks()+unstuckTimer/GameTimeController.MILLIS_IN_TICK);
   }

   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.isNoble() && _player.getInventory().getInventoryItemCount(57, 0) >= 500000000)
           {
               if(chance == 0)
               {
                   displayCongrats(_player);
                   _player.getInventory().addItem("Adena", 57, 500000000, _player, null);
               }

               if(chance == 1)
               {
                   displayCongrats2(_player);
                   _player.getInventory().destroyItemByItemId("Adena", 57, 500000000, _player, null);
               }

               if(chance == 2)
               {
                   displayCongrats2(_player);
                   _player.getInventory().destroyItemByItemId("Adena", 57, 500000000, _player, null);
               }
           }
           else
           {
               _player.sendMessage("You do not have eneough items.");
           }
       }
   }

   public static void Casino4(L2PcInstance player)
   {
       int unstuckTimer = (1*1000 );
       player.setTarget(player);
       player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
       player.disableAllSkills();
       MagicSkillUser msk = new MagicSkillUser(player, 361, 1, unstuckTimer, 0);
       Broadcast.toSelfAndKnownPlayersInRadius(player, msk, 810000);
       SetupGauge sg = new SetupGauge(0, unstuckTimer);
       player.sendPacket(sg);

       Casino4 ef = new Casino4(player);
       player.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer));
       player.setSkillCastEndTime(10+GameTimeController.getGameTicks()+unstuckTimer/GameTimeController.MILLIS_IN_TICK);
   }

   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.isNoble() && _player.getInventory().getInventoryItemCount(57, 0) >= 1000000000)
           {
               if(chance == 0)
               {
                   displayCongrats(_player);
                   _player.getInventory().addItem("Adena", 57, 1000000000, _player, null);
               }

               if(chance == 1)
               {
                   displayCongrats2(_player);
                   _player.getInventory().destroyItemByItemId("Adena", 57, 1000000000, _player, null);
               }

               if(chance == 2)
               {
                   displayCongrats2(_player);
                   _player.getInventory().destroyItemByItemId("Adena", 57, 1000000000, _player, null);
               }
           }
           else
           {
               _player.sendMessage("You do not have eneough items.");
           }
       }
   }
}

 

No problem ;p

Guest
This topic is now closed to further replies.


  • Posts

    • L2REBORN x10  l2reborn x1   LU4 MASTERWORRK BOHPTS - TOP PRICE discord - adver745645
    • 我们感谢您的 反馈 并希望让服务变得更加 优秀! 如果您使用过我们的服务并愿意分享您的体验(任何体验——积极或建设性),请在Trustpilot上留下评价,并获得$1作为感谢。 链接: https://www.trustpilot.com/review/socnet.pro 如何获得奖励: 1. 前往Trustpilot并留下您的评价 2. 向我们发送发布确认截图,以及带有与评价用户名一致的授权账户截图。 3. 指定哪个商店应收到这 $1 奖励。根据商店不同,可能需要您的用户名/电子邮箱。 您的反馈帮助我们成长,并让项目对社区中的每一位成员变得更好。感谢您与我们同行! 条款: 此活动仅适用于一个唯一用户。不允许多账号行为。 项目有效链接: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram 方便访问商店。 虚拟号码服务: 前往 用于购买 Telegram Stars 的 Telegram 机器人: 前往 – 在 Telegram 中快捷且优惠地购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们想向您展示当前的 促销和特别优惠列表 用于购买我们提供的产品与服务: 1. 您可在首次购买时使用优惠码:SOCNET(15% 折扣) 2. 获得 $1 商店余额或 10–20% 折扣——只需在我们网站注册后,按照模板填写您的用户名:“SEND ME BONUS, MY USERNAME IS...”并在我们的论坛主题中发布! 3. 首次启动 SMM 面板可获得 $1:只需在我们的网站(Support)提交主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道以及 Stars 购买机器人中每周都有 Telegram Stars 抽奖! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • 我们感谢您的 反馈 并希望让服务变得更加 优秀! 如果您使用过我们的服务并愿意分享您的体验(任何体验——积极或建设性),请在Trustpilot上留下评价,并获得$1作为感谢。 链接: https://www.trustpilot.com/review/socnet.pro 如何获得奖励: 1. 前往Trustpilot并留下您的评价 2. 向我们发送发布确认截图,以及带有与评价用户名一致的授权账户截图。 3. 指定哪个商店应收到这 $1 奖励。根据商店不同,可能需要您的用户名/电子邮箱。 您的反馈帮助我们成长,并让项目对社区中的每一位成员变得更好。感谢您与我们同行! 条款: 此活动仅适用于一个唯一用户。不允许多账号行为。 项目有效链接: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram 方便访问商店。 虚拟号码服务: 前往 用于购买 Telegram Stars 的 Telegram 机器人: 前往 – 在 Telegram 中快捷且优惠地购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们想向您展示当前的 促销和特别优惠列表 用于购买我们提供的产品与服务: 1. 您可在首次购买时使用优惠码:SOCNET(15% 折扣) 2. 获得 $1 商店余额或 10–20% 折扣——只需在我们网站注册后,按照模板填写您的用户名:“SEND ME BONUS, MY USERNAME IS...”并在我们的论坛主题中发布! 3. 首次启动 SMM 面板可获得 $1:只需在我们的网站(Support)提交主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道以及 Stars 购买机器人中每周都有 Telegram Stars 抽奖! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • 我们感谢您的 反馈 并希望让服务变得更加 优秀! 如果您使用过我们的服务并愿意分享您的体验(任何体验——积极或建设性),请在Trustpilot上留下评价,并获得$1作为感谢。 链接: https://www.trustpilot.com/review/socnet.pro 如何获得奖励: 1. 前往Trustpilot并留下您的评价 2. 向我们发送发布确认截图,以及带有与评价用户名一致的授权账户截图。 3. 指定哪个商店应收到这 $1 奖励。根据商店不同,可能需要您的用户名/电子邮箱。 您的反馈帮助我们成长,并让项目对社区中的每一位成员变得更好。感谢您与我们同行! 条款: 此活动仅适用于一个唯一用户。不允许多账号行为。 项目有效链接: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram 方便访问商店。 虚拟号码服务: 前往 用于购买 Telegram Stars 的 Telegram 机器人: 前往 – 在 Telegram 中快捷且优惠地购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们想向您展示当前的 促销和特别优惠列表 用于购买我们提供的产品与服务: 1. 您可在首次购买时使用优惠码:SOCNET(15% 折扣) 2. 获得 $1 商店余额或 10–20% 折扣——只需在我们网站注册后,按照模板填写您的用户名:“SEND ME BONUS, MY USERNAME IS...”并在我们的论坛主题中发布! 3. 首次启动 SMM 面板可获得 $1:只需在我们的网站(Support)提交主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道以及 Stars 购买机器人中每周都有 Telegram Stars 抽奖! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • @Maxtor @Celestine @Atom  why not block this gypsy?
  • 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