Jump to content
Sign in to follow this  
Fuzenseth

[MATRIX] Caskets [718] + [667]

Recommended Posts

I wouldn't made a java file but my Caskets java got more content.

About the release: I'm giving you a simple casket opening system, it contains no bugs and can be used straight away. [B]
NOTE: MY packaging is different than yours, please replace the com.enso. imports to com.rs.[/B]

Let's begin. So first you add Caskets.java to com.rs.game.player.content;
[CODE]package com.enso.game.player.content;

import com.enso.game.item.Item;
import com.enso.game.player.Player;
import com.enso.utils.Utils;
/**
* @author Fuzen Seth
* @information Represents the caskets.
*/
public class Caskets {

/**
* Casket rewards.
*/
private static final int[] ITEM_REWARDS = {1712, 1215, 4587, 1305, 1079, 1127, };

/**
* Open a casket.
*/
public static final boolean lootCasket(Player player, Item item) {
if (player.isDead())
return false;
if (item.getName().equals("Casket")) {
player.getInventory().deleteItem(item.getId(), 1);
player.addStopDelay(1);
player.sendMessage("You loot the casket!");
switch (Utils.getRandom(1)) {
case 0: // The gold coin reward.
if (!player.isDonator())
player.getInventory().addItem(995, Utils.random(50000, 150000));
else
player.getInventory().addItem(995, Utils.random(75000, 190000));
return true;
case 1: //The item reward.
player.getInventory().addItem(ITEM_REWARDS[Utils.getRandom(ITEM_REWARDS.length - 1)], 1);
return true;
}
}
return false;
}

}
[/CODE]

Next go to InventoryOptions handler and add this
[CODE] if (Caskets.lootCasket(player, item))
return;[/CODE]

Hope I saved your time. :)

Picture
[img]http://puu.sh/9GjAL/f5005da6c4.jpg[/img]

Share this post


Link to post
Share on other sites
Sign in to follow this  

×