Jump to content

Recommended Posts

Posted

Ok guys lets say some things about that topic http://maxcheaters.com/forum/index.php?topic=239078.msg2160044;topicseen#msg2160044

fofas is leacher that casino is coded by Ovenus if any one know him so take the code...

 

first html's create 1 folder with name in \data\html\casino

 

1 html) "name of that html casino.htm"

<html><title>%npcname%</title>
<body><font color="FF0000">Double Or Nothing</font><br>
<font color ="LEVEL">Hello! I am the Casino Manager of "Server Name"</font><br>
<font color ="LEVEL">You have to bet 20 Vote Rewards!!! You have</font> <font color="6655FF">50%</font> <font color ="LEVEL">Chance to Double and</font> <font color="6655FF">50%</font> <font color ="LEVEL">to loose them.</font><br>
<font color ="LEVEL">But if you are Lucky and you will win the</font> <font color="6655FF">Jackpot</font> <font color ="LEVEL">You will win a lot of Vote Reward Items.</font><br><br><br><br>
<center><font color="LEVEL">Play 20 Vote Reward's:</font>
<br><center><button value="20 Reward's" action="bypass -h npc_%objectId%_votereward" width=75 height=21 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal">
<font color="FF0000">Jackpot of Vote Reward's: %voterewardjackpot%</font></center><br>
<center><font color="LEVEL">Play 20 Farm Item:</font>
<br><center><button value="20 Farm Item" action="bypass -h npc_%objectId%_votereward" width=75 height=21 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal">
<font color="FF0000">Jackpot of Farm Item's: %farmjackpot%</font><br><br></center>
</body></html>

 

2 html) "name of that html casino-lowfarmitem.htm"

<html><title>Casino Manager:</title>
<body>Sorry but i want <font color="FF0000">20</font> Farm Item's, to let you to play.<br>
Come back when you will got them Good Luck Traveller.<br>
</body></html>

 

3 html) "name of that html casino-lowvoterewarditem.htm"

<html><title>Casino Manager:</title>
<body>Sorry but i want <font color="FF0000">20</font> Reward's Item's, to let you to play.<br>
Come back when you will got them Good Luck Traveller.<br>
</body></html>

 

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

import com.l2jprim.Config;
import com.l2jprim.gameserver.ThreadPoolManager;
import com.l2jprim.gameserver.ai.CtrlIntention;
import com.l2jprim.gameserver.model.L2World;
import com.l2jprim.gameserver.model.actor.L2Npc;
import com.l2jprim.gameserver.network.clientpackets.Say2;
import com.l2jprim.gameserver.network.serverpackets.ActionFailed;
import com.l2jprim.gameserver.network.serverpackets.CreatureSay;
import com.l2jprim.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jprim.gameserver.network.serverpackets.L2GameServerPacket;
import com.l2jprim.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jprim.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jprim.gameserver.network.serverpackets.SetupGauge;
import com.l2jprim.gameserver.network.serverpackets.SocialAction;
import com.l2jprim.gameserver.templates.actor.L2NpcTemplate;
import com.l2jprim.gameserver.util.Broadcast;
import com.l2jprim.gameserver.util.Rnd;

/**
* @author Ovenus
*/
public class L2CasinoInstance extends L2Npc
{
    protected int _ammount = 20;
    protected int _voterewardItemsJackpot = 0;
    protected int _farmItemsJackpot = 0;
    protected int _jacpot = 0;
public static final String CASINO_HTML_PATH = "data/html/casino/";

    public L2CasinoInstance(int objectId, L2NpcTemplate template)
    {
        super(objectId, template);
    }

    


@Override
public void showChatWindow(L2PcInstance player)
{
	player.sendPacket(ActionFailed.STATIC_PACKET);
	String filename = "data/html/casino/casino.htm";
	NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
	html.setFile(player.getHtmlPrefix(), filename);
	html.replace("%objectId%", String.valueOf(getObjectId()));
	html.replace("%npcname%", getName());
	html.replace("%jackpot%",String.valueOf(_jacpot));
	html.replace("%voterewardjackpot%",String.valueOf(_voterewardItemsJackpot));
	html.replace("%farmjackpot%",String.valueOf(_farmItemsJackpot));
	player.sendPacket(html);
}

@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
	if (command.startsWith("votereward")) 
	{
		sendCasinoVoteReardChat("casino-playvotereward.htm",player);
		PlayCasinoVoteRewardItem(player,20);
		return;

	}
	else if (command.startsWith("farmitem")) 
	{
		sendCasinoVoteReardChat("casino-playvotereward.htm",player);
		PlayCasinoFarmItem(player,20);
		return;
	}
	super.onBypassFeedback(player,command);
}

public static void autoannounceToOnlinePlayers(String text)
{
		CreatureSay cs = new CreatureSay(0, Say2.CRITICAL_ANNOUNCE, "", text);
		toAllOnlinePlayers(cs);

}

public static void toAllOnlinePlayers(L2GameServerPacket mov)
{
	if (Config.DEBUG)
		_log.fine("Players to notify: " + L2World.getInstance().getAllPlayersCount() + " (with packet " + mov.getType() + ")");

	L2World.getInstance().forEachPlayer(new Broadcast.ForEachPlayerBroadcastPacket(mov));
}

public void announceToAll(String text)
{
	Broadcast.autoannounceToOnlinePlayers(text);
}

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

    public void displayCongratsLostVoteRewardItem(L2PcInstance player,int ammount)
    {
        ExShowScreenMessage screen = new ExShowScreenMessage("Try next Time "+ player.getName() +", now you lost "+ _ammount +" of Vote Reward's!", 15000);
        player.sendPacket(screen);
    }
    
    public void displayCongratsLostFarmItem(L2PcInstance player,int ammount)
    {
        ExShowScreenMessage screen = new ExShowScreenMessage("Try next Time "+ player.getName() +", now you lost "+ _ammount +" of Farm Item's!", 15000);
        player.sendPacket(screen);
    }

    public void PlayCasinoFarmItem(L2PcInstance player,int ammount)
    {
       
    	if(player.getInventory().getInventoryItemCount(7217, 0) < 20)
        {
		sendCasinoFarmItemChat("casino-lowfarmitem.htm",player);
		return;
        }
    	int unstuckTimer = (1 * 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);
        CasinoFarmItem ef = new CasinoFarmItem(player,20);
        player.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer));
    }
    
    public void PlayCasinoVoteRewardItem(L2PcInstance player,int ammount)
    {
    	if(player.getInventory().getInventoryItemCount(7542, 0) < 20)
        {
		sendCasinoVoteReardChat("casino-lowvoterewarditem.htm",player);
		return;
        }
    	int unstuckTimer = (1 * 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);
        CasinoVoteRewardItem ef = new CasinoVoteRewardItem(player,20);
        player.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer));
    }

     class CasinoVoteRewardItem implements Runnable
    {
        private L2PcInstance _player;
	private int _ammount;
	CasinoVoteRewardItem(L2PcInstance player,int ammount)
        {	
		_ammount= ammount;
            _player = player;
        }
        public void run()
        {
            if(_player.isDead())
                return;
            _player.setIsIn7sDungeon(false);
            _player.enableAllSkills();
            
            if( _player.getInventory().getInventoryItemCount(7542, 0) >= 20)
            {   
            switch(Rnd.get(16))
            {
            case 0:
            	 displayCongrats(_player, _ammount);
			_player.addItem("Gift",7542,_ammount,_player,true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 1:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 2:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 3:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 4:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 5:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 6:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 7:
            	RewardJacpotVoteReward(_player);
            	if(RewardJacpotVoteReward(_player) == 11)
            	{
            		return;
            	}
            	else
            	 displayCongrats(_player, _ammount);
			_player.addItem("Gift",7542,_ammount,_player,true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 8:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 9:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 10:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 11:
            	 displayCongrats(_player, _ammount);
				_player.addItem("Gift",7542,_ammount,_player,true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
            	break;
            case 12:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 13:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 14:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
                break;
            case 15:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
                break;
               } 
             }
            else
            {
            	sendCasinoVoteReardChat("casino-lowvoterewarditem.htm",_player);
            }
        }
    }
     
     
     class CasinoFarmItem implements Runnable
     {
         private L2PcInstance _player;
		private int _ammount;
		CasinoFarmItem(L2PcInstance player,int ammount)
         {	
			_ammount= ammount;
             _player = player;
         }
         public void run()
         {
             if(_player.isDead())
                 return;
             _player.setIsIn7sDungeon(false);
             _player.enableAllSkills();
             
             if( _player.getInventory().getInventoryItemCount(7217, 0) >= 20)
             {   
             switch(Rnd.get(16))
             {
             case 0:
             	 displayCongrats(_player, _ammount);
				_player.addItem("Gift",7542,_ammount,_player,true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 1:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 2:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 3:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 4:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 5:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 6:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 7:
            	 RewardJacpotFarmItem(_player);
             	if(RewardJacpotFarmItem(_player) == 11)
             	{
             		return;
             	}
             	else
             	 displayCongrats(_player, _ammount);
				_player.addItem("Gift",7217,_ammount,_player,true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 8:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 9:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 10:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 11:
             	 displayCongrats(_player, _ammount);
					_player.addItem("Gift",7217,_ammount,_player,true);
					_player.broadcastUserInfo();
					_voterewardItemsJackpot += _ammount;
             	break;
             case 12:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 13:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 14:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
                 break;
             case 15:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
                 break;
                } 
              }
             else
             {
             	sendCasinoFarmItemChat("casino-lowfarmitem.htm",_player);
             }
         }
     }
     
     public final int RewardJacpotVoteReward(L2PcInstance player)
     {
    	 int reward = 30;
    	 switch(Rnd.get(reward))
         {
         case 0:
         	break;
         case 1:
         	break;
         case 2:
         	break;
         case 3:
         	break;
         case 4:
         	break;
         case 5:
         	break;
         case 6:
         	break;
         case 7:
         	break;
         case 8:
         	break;
         case 9:
         	break;
         case 10:
         	break;
         case 11:
        	 displayCongrats(player, _ammount);
         	player.addItem("Gift",7542,_ammount + _voterewardItemsJackpot,player,true);
         	player.broadcastUserInfo();
		autoannounceToOnlinePlayers("Congratulations "+ player.getName() +" he won "+ _voterewardItemsJackpot +" Jackpot of Vote Reward's Item's!");
		_voterewardItemsJackpot = 0;
         	break;
         case 12:
         	break;
         case 13:
         	break;
         case 14:
             break;
         case 15:
             break;
         case 16:
             break;
         case 17:
             break;
         case 18:
             break;
         case 19:
             break;
         case 20:
             break;
         case 21:
             break;
         case 22:
             break;
         case 23:
             break;
         case 24:
             break;
         case 25:
             break;
         case 26:
             break;
         case 27:
             break;
         case 28:
             break;
         case 29:
             break;
             
             
         }
	return reward;
	}
     
     public final int RewardJacpotFarmItem(L2PcInstance player)
     {
    	 int reward = 30;
    	 switch(Rnd.get(reward))
         {
         case 0:
         	break;
         case 1:
         	break;
         case 2:
         	break;
         case 3:
         	break;
         case 4:
         	break;
         case 5:
         	break;
         case 6:
         	break;
         case 7:
         	break;
         case 8:
         	break;
         case 9:
         	break;
         case 10:
         	break;
         case 11:
        	 displayCongrats(player, _ammount);
         	player.addItem("Gift",7217,_ammount + _farmItemsJackpot,player,true);
         	player.broadcastUserInfo();
		autoannounceToOnlinePlayers("Congratulations "+ player.getName() +" he won "+ _farmItemsJackpot +" Jackpot of Farm Item's!");
		_voterewardItemsJackpot = 0;
         	break;
         case 12:
         	break;
         case 13:
         	break;
         case 14:
             break;
         case 15:
             break;
         case 16:
             break;
         case 17:
             break;
         case 18:
             break;
         case 19:
             break;
         case 20:
             break;
         case 21:
             break;
         case 22:
             break;
         case 23:
             break;
         case 24:
             break;
         case 25:
             break;
         case 26:
             break;
         case 27:
             break;
         case 28:
             break;
         case 29:
             break;
             
             
         }
	return reward;
	}
    
    public final void sendCasinoVoteReardChat(String file, L2PcInstance player)
    {
    	sendCasinoVoteReardChat(file,player,getObjectId());
}
    
public static final void sendCasinoVoteReardChat(String file, L2PcInstance player, int oID)
{
	NpcHtmlMessage html = new NpcHtmlMessage(oID);
	html.setFile(CASINO_HTML_PATH + file);
	html.replace("%objectId%",String.valueOf(oID));
	player.sendPacket(html);
}

    public final void sendCasinoFarmItemChat(String file, L2PcInstance player)
    {
    	sendCasinoFarmItemChat(file,player,getObjectId());
}
    
public static final void sendCasinoFarmItemChat(String file, L2PcInstance player, int oID)
{
	NpcHtmlMessage html = new NpcHtmlMessage(oID);
	html.setFile(CASINO_HTML_PATH + file);
	html.replace("%objectId%",String.valueOf(oID));
	player.sendPacket(html);
}
}

 

 

Posted

if you use frozen and old packets interlude use that code

 

if you have problem with that code just use that

[code]package com.l2jprim.gameserver.model.actor.instance;

import com.l2jprim.Config;
import com.l2jprim.gameserver.ThreadPoolManager;
import com.l2jprim.gameserver.ai.CtrlIntention;
import com.l2jprim.gameserver.model.L2World;
import com.l2jprim.gameserver.model.actor.L2Npc;
import com.l2jprim.gameserver.network.clientpackets.Say2;
import com.l2jprim.gameserver.network.serverpackets.ActionFailed;
import com.l2jprim.gameserver.network.serverpackets.CreatureSay;
import com.l2jprim.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jprim.gameserver.network.serverpackets.L2GameServerPacket;
import com.l2jprim.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jprim.gameserver.network.serverpackets.MyTargetSelected;
import com.l2jprim.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jprim.gameserver.network.serverpackets.SetupGauge;
import com.l2jprim.gameserver.network.serverpackets.SocialAction;
import com.l2jprim.gameserver.network.serverpackets.ValidateLocation;
import com.l2jprim.gameserver.templates.actor.L2NpcTemplate;
import com.l2jprim.gameserver.util.Broadcast;
import com.l2jprim.gameserver.util.Rnd;

/**
* @author Ovenus
*/
public class L2CasinoInstance extends L2Npc
{
    protected int _ammount = 20;
    protected int _voterewardItemsJackpot = 0;
    protected int _farmItemsJackpot = 0;
    protected int _jacpot = 0;
public static final String CASINO_HTML_PATH = "data/html/casino/";

    public L2CasinoInstance(int objectId, L2NpcTemplate template)
    {
        super(objectId, template);
    }

    

    
    /**
 * this is called when a player interacts with this NPC
 * 
 * @param player
 */
@Override
public void onAction(L2PcInstance player)
{
	if (!canTarget(player))
		return;

	player.setTarget(this);

	// Check if the L2PcInstance already target the L2NpcInstance
	if (this != player.getTarget())
	{
		// Set the target of the L2PcInstance player
		player.setTarget(this);

		// Send a Server->Client packet MyTargetSelected to the L2PcInstance
		// player
		MyTargetSelected my = new MyTargetSelected(getObjectId(), 0);
		player.sendPacket(my);

		// Send a Server->Client packet ValidateLocation to correct the
		// L2Npc position and heading on the client
		player.sendPacket(new ValidateLocation(this));
	} else
	{
		// Calculate the distance between the L2PcInstance and the
		// L2NpcInstance
		if (!canInteract(player))
		{
			// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
			player.getAI().setIntention(
					CtrlIntention.AI_INTENTION_INTERACT, this);
		}
		else
		{
			showChatWindow(player);
		}
	}
	// Send a Server->Client ActionFailed to the L2PcInstance in order to
	// avoid that the client wait another packet
	player.sendPacket(ActionFailed.STATIC_PACKET);
}

@Override
public void showChatWindow(L2PcInstance player)
{
	player.sendPacket(ActionFailed.STATIC_PACKET);
	String filename = "data/html/casino/casino.htm";
	NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
	html.setFile(player.getHtmlPrefix(), filename);
	html.replace("%objectId%", String.valueOf(getObjectId()));
	html.replace("%npcname%", getName());
	html.replace("%jackpot%",String.valueOf(_jacpot));
	html.replace("%voterewardjackpot%",String.valueOf(_voterewardItemsJackpot));
	html.replace("%farmjackpot%",String.valueOf(_farmItemsJackpot));
	player.sendPacket(html);
}

@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
	if (command.startsWith("votereward")) 
	{
		sendCasinoVoteReardChat("casino-playvotereward.htm",player);
		PlayCasinoVoteRewardItem(player,20);
		return;

	}
	else if (command.startsWith("farmitem")) 
	{
		sendCasinoVoteReardChat("casino-playvotereward.htm",player);
		PlayCasinoFarmItem(player,20);
		return;
	}
	super.onBypassFeedback(player,command);
}

public static void autoannounceToOnlinePlayers(String text)
{
		CreatureSay cs = new CreatureSay(0, Say2.CRITICAL_ANNOUNCE, "", text);
		toAllOnlinePlayers(cs);

}

public static void toAllOnlinePlayers(L2GameServerPacket mov)
{
	if (Config.DEBUG)
		_log.fine("Players to notify: " + L2World.getInstance().getAllPlayersCount() + " (with packet " + mov.getType() + ")");

	L2World.getInstance().forEachPlayer(new Broadcast.ForEachPlayerBroadcastPacket(mov));
}

public void announceToAll(String text)
{
	Broadcast.autoannounceToOnlinePlayers(text);
}

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

    public void displayCongratsLostVoteRewardItem(L2PcInstance player,int ammount)
    {
        ExShowScreenMessage screen = new ExShowScreenMessage("Try next Time "+ player.getName() +", now you lost "+ _ammount +" of Vote Reward's!", 15000);
        player.sendPacket(screen);
    }
    
    public void displayCongratsLostFarmItem(L2PcInstance player,int ammount)
    {
        ExShowScreenMessage screen = new ExShowScreenMessage("Try next Time "+ player.getName() +", now you lost "+ _ammount +" of Farm Item's!", 15000);
        player.sendPacket(screen);
    }

    public void PlayCasinoFarmItem(L2PcInstance player,int ammount)
    {
       
    	if(player.getInventory().getInventoryItemCount(7217, 0) < 20)
        {
		sendCasinoFarmItemChat("casino-lowfarmitem.htm",player);
		return;
        }
    	int unstuckTimer = (1 * 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);
        CasinoFarmItem ef = new CasinoFarmItem(player,20);
        player.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer));
    }
    
    public void PlayCasinoVoteRewardItem(L2PcInstance player,int ammount)
    {
    	if(player.getInventory().getInventoryItemCount(7542, 0) < 20)
        {
		sendCasinoVoteReardChat("casino-lowvoterewarditem.htm",player);
		return;
        }
    	int unstuckTimer = (1 * 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);
        CasinoVoteRewardItem ef = new CasinoVoteRewardItem(player,20);
        player.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer));
    }

     class CasinoVoteRewardItem implements Runnable
    {
        private L2PcInstance _player;
	private int _ammount;
	CasinoVoteRewardItem(L2PcInstance player,int ammount)
        {	
		_ammount= ammount;
            _player = player;
        }
        public void run()
        {
            if(_player.isDead())
                return;
            _player.setIsIn7sDungeon(false);
            _player.enableAllSkills();
            
            if( _player.getInventory().getInventoryItemCount(7542, 0) >= 20)
            {   
            switch(Rnd.get(16))
            {
            case 0:
            	 displayCongrats(_player, _ammount);
			_player.addItem("Gift",7542,_ammount,_player,true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 1:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 2:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 3:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 4:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 5:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 6:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 7:
            	RewardJacpotVoteReward(_player);
            	if(RewardJacpotVoteReward(_player) == 11)
            	{
            		return;
            	}
            	else
            	 displayCongrats(_player, _ammount);
			_player.addItem("Gift",7542,_ammount,_player,true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 8:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 9:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 10:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 11:
            	 displayCongrats(_player, _ammount);
				_player.addItem("Gift",7542,_ammount,_player,true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
            	break;
            case 12:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 13:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
            	break;
            case 14:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
                break;
            case 15:
            	displayCongratsLostVoteRewardItem(_player, _ammount);
			_player.destroyItemByItemId("Consume", 7542, _ammount, _player, true);
			_player.broadcastUserInfo();
			_voterewardItemsJackpot += _ammount;
                break;
               } 
             }
            else
            {
            	sendCasinoVoteReardChat("casino-lowvoterewarditem.htm",_player);
            }
        }
    }
     
     
     class CasinoFarmItem implements Runnable
     {
         private L2PcInstance _player;
		private int _ammount;
		CasinoFarmItem(L2PcInstance player,int ammount)
         {	
			_ammount= ammount;
             _player = player;
         }
         public void run()
         {
             if(_player.isDead())
                 return;
             _player.setIsIn7sDungeon(false);
             _player.enableAllSkills();
             
             if( _player.getInventory().getInventoryItemCount(7217, 0) >= 20)
             {   
             switch(Rnd.get(16))
             {
             case 0:
             	 displayCongrats(_player, _ammount);
				_player.addItem("Gift",7542,_ammount,_player,true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 1:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 2:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 3:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 4:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 5:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 6:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 7:
            	 RewardJacpotFarmItem(_player);
             	if(RewardJacpotFarmItem(_player) == 11)
             	{
             		return;
             	}
             	else
             	 displayCongrats(_player, _ammount);
				_player.addItem("Gift",7217,_ammount,_player,true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 8:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 9:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 10:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 11:
             	 displayCongrats(_player, _ammount);
					_player.addItem("Gift",7217,_ammount,_player,true);
					_player.broadcastUserInfo();
					_voterewardItemsJackpot += _ammount;
             	break;
             case 12:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 13:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
             	break;
             case 14:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
                 break;
             case 15:
            	 displayCongratsLostFarmItem(_player, _ammount);
				_player.destroyItemByItemId("Consume", 7217, _ammount, _player, true);
				_player.broadcastUserInfo();
				_voterewardItemsJackpot += _ammount;
                 break;
                } 
              }
             else
             {
             	sendCasinoFarmItemChat("casino-lowfarmitem.htm",_player);
             }
         }
     }
     
     public final int RewardJacpotVoteReward(L2PcInstance player)
     {
    	 int reward = 30;
    	 switch(Rnd.get(reward))
         {
         case 0:
         	break;
         case 1:
         	break;
         case 2:
         	break;
         case 3:
         	break;
         case 4:
         	break;
         case 5:
         	break;
         case 6:
         	break;
         case 7:
         	break;
         case 8:
         	break;
         case 9:
         	break;
         case 10:
         	break;
         case 11:
        	 displayCongrats(player, _ammount);
         	player.addItem("Gift",7542,_ammount + _voterewardItemsJackpot,player,true);
         	player.broadcastUserInfo();
		autoannounceToOnlinePlayers("Congratulations "+ player.getName() +" he won "+ _voterewardItemsJackpot +" Jackpot of Vote Reward's Item's!");
		_voterewardItemsJackpot = 0;
         	break;
         case 12:
         	break;
         case 13:
         	break;
         case 14:
             break;
         case 15:
             break;
         case 16:
             break;
         case 17:
             break;
         case 18:
             break;
         case 19:
             break;
         case 20:
             break;
         case 21:
             break;
         case 22:
             break;
         case 23:
             break;
         case 24:
             break;
         case 25:
             break;
         case 26:
             break;
         case 27:
             break;
         case 28:
             break;
         case 29:
             break;
             
             
         }
	return reward;
	}
     
     public final int RewardJacpotFarmItem(L2PcInstance player)
     {
    	 int reward = 30;
    	 switch(Rnd.get(reward))
         {
         case 0:
         	break;
         case 1:
         	break;
         case 2:
         	break;
         case 3:
         	break;
         case 4:
         	break;
         case 5:
         	break;
         case 6:
         	break;
         case 7:
         	break;
         case 8:
         	break;
         case 9:
         	break;
         case 10:
         	break;
         case 11:
        	 displayCongrats(player, _ammount);
         	player.addItem("Gift",7217,_ammount + _farmItemsJackpot,player,true);
         	player.broadcastUserInfo();
		autoannounceToOnlinePlayers("Congratulations "+ player.getName() +" he won "+ _farmItemsJackpot +" Jackpot of Farm Item's!");
		_voterewardItemsJackpot = 0;
         	break;
         case 12:
         	break;
         case 13:
         	break;
         case 14:
             break;
         case 15:
             break;
         case 16:
             break;
         case 17:
             break;
         case 18:
             break;
         case 19:
             break;
         case 20:
             break;
         case 21:
             break;
         case 22:
             break;
         case 23:
             break;
         case 24:
             break;
         case 25:
             break;
         case 26:
             break;
         case 27:
             break;
         case 28:
             break;
         case 29:
             break;
             
             
         }
	return reward;
	}
    
    public final void sendCasinoVoteReardChat(String file, L2PcInstance player)
    {
    	sendCasinoVoteReardChat(file,player,getObjectId());
}
    
public static final void sendCasinoVoteReardChat(String file, L2PcInstance player, int oID)
{
	NpcHtmlMessage html = new NpcHtmlMessage(oID);
	html.setFile(CASINO_HTML_PATH + file);
	html.replace("%objectId%",String.valueOf(oID));
	player.sendPacket(html);
}

    public final void sendCasinoFarmItemChat(String file, L2PcInstance player)
    {
    	sendCasinoFarmItemChat(file,player,getObjectId());
}
    
public static final void sendCasinoFarmItemChat(String file, L2PcInstance player, int oID)
{
	NpcHtmlMessage html = new NpcHtmlMessage(oID);
	html.setFile(CASINO_HTML_PATH + file);
	html.replace("%objectId%",String.valueOf(oID));
	player.sendPacket(html);
}
}

[/code]

Posted

Like i said, fofas couldn't have created that. He was even begging me to sell him aCis, lol.

 

But i expected it to be saving the jackpot.. Anyway, good job and thanks ;)

Posted

by ovenus?hmm I used to speak with dat guy couple of years ago but I missed him when he got banned from mxc..are you ovenus?!

 

thanks anyway.

Posted

who the f@ck is Ovenus ?

 

anyway thanks for share

Ovenus, was the developer of L2jGreece.

 

Edited: And developer of L2jPrim based on L2jArchid. Now, he has left the developing as I know.

Posted

dont this is Ovenus By me pfff :S

Ovenus scammer me casino to L2Mafia

learn how to write proper english in order to be understand by everyone..

Its obvious that you didnt made this since you cant even code a shit on your own

who the f@ck is Ovenus ?

 

anyway thanks for share

an old member here that used to be active back in 2010 dayz.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...