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

    • Do you want stability? Lagless and bugless game? Instant support? Daily PVP? Long-Term playing? You are in the right place, time to start! Lineage2 X70 Interlude NEW Season 2025 February 8th 13:00 UTC+2 Greece/Lithuania: 13:00 UTC+2 Poland/Norway: 12:00 UTC+1 United Kingdom: 11:00 UTC+0 Brazil/Argentina: 8:00 UTC-3 Opening Bonus First 100 players after third class changing will automaticly get Premium Coin award in their inventory. All new players spawn in town of Gludio! All players start from 25 LvL with starter pack (adenas and equipment)! RATES XP: x70 | SP: x70 Party XP/ SP: x1.2 Adenas drop rate: x30 Drop Items: x25 | Spoil: x25 Drop SealStones rate: x1.2 Drop Manor rate: x1 Drop Quest rate: x5 | Reward rates: x2 (NOT FOR ALL) Raid Boss Drop: x10 Raid Boss Adenas Drop: x3 Grand Boss Drop: x1 Grand Boss Adenas Drop: x2 Information NPC Buffer 32 Buffs | 4 Debuffs PET Buffer for all classes [Except Necromancer] Scheme buffer: 3 Profiles. Buffs time: 2 Hours | Summons buffs - 60min. Global Gatekeeper. GM SHOP till weapon / armor / jewel B grade. Caradine letter 3rd part in GM Shop. Offline shop: SELL , PRIVATE CREATION , PACKAGE SALE from 35 LvL ! Mana potions: 500MP/2s. Spawn Protection: 20 Seconds. EVENTS Manager [TVT/DM]. Max Clients for one PC: 5 Rift | 4S Players: 3 Maximum inventory slots: 240 Maximum inventory slots for Dwarf: 250 Custom drop list: - Raid Boss Horus, Ember, Brakki, Nakondas: 1 VIP COIN (25%) | Korim (50%). - Raid Boss Apepi, Shacram, Atraiban, Korim: 1 BEWS (25%). - Raid Boss Glaki, Olkuth: 1-2 BEAS (40%). - Raid Boss Golkonda, Galaxia: 1-3 BEAS (60%). - Raid Boss Shyeed: 1-3 BEWS (30%) | 1-7 BEAS (40%) | 1-5 TOP LS 76 (50%). - Raid Boss Shuriel: 1-7 TOP LS 76 (50%) | 1-4 BEAS (60%). - Raid Boss Ashakiel: 1-2 BEWS (30%) | 1-7 TOP LS 76 (50%) | 1-4 BEAS (75%). - Raid Boss Antharas Priest Cloe: 1-3 BEWS (30%) | 1-7 TOP LS 76 (70%). ------------------------------------------------ - Hestia: Demon Splinters / Forgotten Blande (10%). - Ember: Arcana Mace / Draconic Bow (10%). - Galaxia: Angel Slayer / Heaven's Divider (10%). 1. Baium Lair and TOI 13/14 are PVP zones. 2. Valakas PVP zone near NPC "Klein" and inside Valakas room. 3. Antharas Lair and near "Heart Of Warding" are PVP zones. 4. Frintezza PVP zone is in first Imperial Tomb room. 5. Queen Ant PVP zone after the bridge and near Boss. 6. Zaken ship deck and rooms - PVP area. How to connect STEP BY STEP: 1. Install clear Lineage2 Interlude client 2. Download our patch, delete old system folder and add our 3. Delete, turn off anti virus or add our system folder to anti virus exceptions 4. Run l2.exe from Lineage2/system 5. Enter data on login window and enjoy the game! * You have to remove, turn off or use exceptions of antivirus because of our security protection. It is not a virus. * If you have connection issues with Windows 8 or 10, press right mouse button on l2.exe icon, press Properties, choose compatibility and unmark compatibility mode. Take your friends, clan, alliance, enemys, sharp your swords, clean your armors and meet your destiny at 2025 February 8th 13:00 UTC+2! WWW.L2BLAZE.NET INTERLUDE Empire X70 New Season: 2025 February 8th 13:00 UTC+2! WEBSITE: http://WWW.L2BLAZE.NET
    • Hello all,  i use L2jAcis 409 and i have problem with oly cycle, everyday is a different oly cycle and oly won't finish at the end of the month...almost 50 cycles and no end. I see oly matches in db but no points and after a day pass with /olympiadstat no points... Any help welcome, thank you.
    • Bump NEW USER IN TELEGRAM AND DISCORD IS "mileanum"  NEW USER IN TELEGRAM AND DISCORD IS "mileanum"  NEW USER IN TELEGRAM AND DISCORD IS "mileanum" NEW USER IN TELEGRAM AND DISCORD IS "mileanum" 
  • Topics

×
×
  • Create New...