Jump to content

Recommended Posts

Posted

Here is l2jsigmo's casino.

 

Go here, Java\com\src\gameserver\model\actor\instance and create java file with name L2CasinoInstance.java

 

And copy the follow code into the file:

 

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.ItemList;
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.chars.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);
	}
}

private static void displayCongrats(L2PcInstance player)
{
	player.broadcastPacket(new SocialAction(player.getObjectId(), 3));
	player.broadcastPacket(new MagicSkillUser(player, player, 2024, 1, 1, 0));
	player.sendPacket(new ExShowScreenMessage("Congratulations " + player.getName() + " you win!", 4000, 0x02, true));
}

private static void displayCongrats2(L2PcInstance player)
{
	player.broadcastPacket(new SocialAction(player.getObjectId(), 13));
	player.sendPacket(new ExShowScreenMessage("-beep- " + player.getName() + " you lost!", 4000, 0x02, true));
}

@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("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32><br>");
	tb.append("<font color=\"999999\">Chance to win: 50%</font><br><br>");
	tb.append("Welcome " + player.getName() + "<br>");
	tb.append("<tr><td>Double or Nothing ?</td></tr><br>");
	tb.append("Place your bets");
	tb.append("<br>");
	tb.append("<tr>");
	tb.append("<td><button value= 100KK action=\"bypass -h npc_%objectId%_play1\" width=70 height=21 back=L2UI.DefaultButton_click fore=L2UI.DefaultButton></td>");
	tb.append("<td><button value= 300KK action=\"bypass -h npc_%objectId%_play2\" width=70 height=21 back=L2UI.DefaultButton_click fore=L2UI.DefaultButton></td>");
	tb.append("</tr>");
	tb.append("<tr>");
	tb.append("<td><button value= 500KK action=\"bypass -h npc_%objectId%_play3\" width=70 height=21 back=L2UI.DefaultButton_click fore=L2UI.DefaultButton></td>");
	tb.append("<td><button value= 1KKK action=\"bypass -h npc_%objectId%_play4\" width=70 height=21 back=L2UI.DefaultButton_click fore=L2UI.DefaultButton></td>");
	tb.append("</tr>");
	tb.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32><br>");
	tb.append("</center>");
	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);
}

private 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);
				_player.sendPacket(new ItemList(_player, false));
			}
		}
		else
		{
			_player.sendMessage("You don't have enough 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);
}

private 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);
				_player.sendPacket(new ItemList(_player, false));
			}

			if(chance == 2)
			{
				displayCongrats2(_player);
				_player.getInventory().destroyItemByItemId("Adena", 57, 300000000, _player, null);
				_player.sendPacket(new ItemList(_player, false));
			}
		}
		else
		{
			_player.sendMessage("You don't have enough 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);
}

private 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);
				_player.sendPacket(new ItemList(_player, false));
			}

			if(chance == 2)
			{
				displayCongrats2(_player);
				_player.getInventory().destroyItemByItemId("Adena", 57, 500000000, _player, null);
				_player.sendPacket(new ItemList(_player, false));
			}
		}
		else
		{
			_player.sendMessage("You don't have enough 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);
}

private 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);
				_player.sendPacket(new ItemList(_player, false));
			}

			if(chance == 2)
			{
				displayCongrats2(_player);
				_player.getInventory().destroyItemByItemId("Adena", 57, 1000000000, _player, null);
				_player.sendPacket(new ItemList(_player, false));
			}
		}
		else
		{
			_player.sendMessage("You don't have enough items.");
		}
	}
}
}

 

After all these, add a npc into database with type L2Casino !

 


 

PS; If someone need this casino for another project, just tell me to change the imports!

 


 

Because, Vhalior prix my balls credits to: Vhalior aka L2jSigmo's Owner! Okay?

 


Guest Elfocrash
Posted

you miss bypasses... its useless..

I searched for, but nothing.

 

you both have no idea..

 

@Override
public void onBypassFeedback(L2PcInstance player, String command)

 

understand how this method works

Posted

give creedits

 

[share]L2jSigmo's Casino

bitch please everyone knows that you were a developer of l2jsigmo but crystalia put the proper creadits, i mean your project name etc.. //friendly

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

    • IAM one of customers of this project. Have anti cheat, have user panel everything is working. Blocking adrenaline trashy plans without any problems.  So just GL for all lin2 project. I get support every time I need it. 
    • Convert package formats from Old to New in one click Create new packages of any format Lineage2Ver121 encryption (included in the package) Safe editing: work in a copy, full undo history (Ctrl+Z / Ctrl+Shift+Z), single "Save" button System integration Open .utx / .ugx files with a single click in Explorer (associations are registered during installation) One example: open a file and add its tab to an existing window Multilingual interface (EN, RU, UK, ES, PT, EL, KO, VI, ZH) — the language is picked up from the system Supported formats Packages: UTX, UGX Textures: RGBA8, DXT1, DXT3, DXT5, G16, P8 Resources: GFX (Scaleform) Requirements Windows. Java is not required—it's included in the build. Installation Run La2Tools-3.0.2.exe—the installer will create shortcuts and register related files. Alternatively, use the portable version. https://la2.tools/files/La2Tools_3.0.3_setup.exe   https://la2.tools/files/La2Tools_3.0.3_portable.zip  - Portable version  
    • WHEN SAYING “YES” IS A MISTAKE Not every project is worth taking on, even if the client is ready to pay. Sometimes refusing isn’t about losing money — it’s about protecting your reputation and time. Over the years, we’ve learned to quickly spot the cases that are almost guaranteed to turn into problems. Here are the most common situations where we turn down work: ▪ The client wants it “like everyone else’s,” but with lots of custom changes and on a minimal budget ▪ There are no proper source materials, yet the deadlines are already burning and everything is needed “yesterday” ▪ Constant changes to requirements after the work has already started ▪ A task with a very low chance of success, but very high expectations ▪ The client isn’t willing to discuss the process and sees us as just an executor - A good result almost always starts when both sides have an honest understanding of the risks and real possibilities of the project. If you’re currently discussing a project and unsure whether to move forward — write to us. We’ll honestly and directly tell you whether it’s worth taking on or if it’s better to look for another solution. › TG: @mustang_service_ms ( https:// t.me/ mustang_service_ms ) › Channel: Mustang Service ( https:// t.me/ +JPpJCETg-xM1NjNl ) #documents #drawing #photoshop #refuse #cases
    • The price reflects the value of the project, not just the source files. This is a complete, production-ready server that has already proven itself over the course of a full year, with a loyal player base and no major issues requiring ongoing development. To put it into perspective, the asking price is approximately what the server generated in one year. You're not buying an unfinished pack that still needs months of work, you're buying a polished, fully tested, revenue-proven project that's ready to go online. Considering that, I believe €35000 is a fair price.
    • How we can explain the amount? Is something special there in?
  • 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..