Jump to content
Sign in to follow this  
Tyler

Dungeoneering Shop

Recommended Posts

Dungeoneering Shop based off my Arrow Project. Enjoy.

[CODE]package arrow.system.engine.player.content.dungeoneering;

import java.util.HashMap;
import java.util.Map;

import arrow.system.cache.parser.ItemDefinitions;
import arrow.system.engine.player.Player;
import arrow.system.engine.player.Skills;

/**
*
* [MENTION=52317]auth[/MENTION]or Tylerr
* Skype: tylerr.rsps
* RuneLocus: Tylerr
*
*/

public class DungeonRewards {

public enum DungeonReward {
BONECRUSHER(18337, 0, 21, 34000),
HERBICIDE(19675, 5, 21, 34000),
SCROLL_OF_LIFE(18336, 15, 25, 10000),
SCROLL_OF_CLEANSING(19890, 40, 49, 20000),
SCROLL_OF_EFFICIENCY(19670, 105, 55, 20000),
SCROLL_OF_AUGURY(18344, 150, 77, 153000),
SCROLL_OF_RIGOUR(18839, 145, 74, 140000),
SCROLL_OF_RENEWAL(18343, 125, 65, 107000),
MERCENARY_GLOVES(18347, 140, 73, 48500),
TOME_OF_FROST(18346, 80, 48, 43000),
ARCANE_PULSE_NECKLACE(18333, 20, 30, 6500),
GRAVITE_SHORTBOW(18373, 70, 45, 40000),
GRAVITE_LONGSWORD(18367, 55, 45, 40000),
GRAVITE_RAPIER(18365, 50, 45, 40000),
GRAVITE_STAFF(18371, 65, 45, 40000),
GRAVITE_2H(18369, 60, 45, 40000),
ARCANE_BLAST_NECKLACE(18334, 90, 50, 15500),
RING_OF_VIGOUR(19669, 120, 62, 50000),
ARCANE_STREAM_NECKLACE(18335, 130, 70, 30500),
CHAOTIC_RAPIER(18349, 155, 80, 200000),
CHAOTIC_LONGSWORD(18351, 160, 80, 200000),
CHAOTIC_MAUL(18353, 165, 80, 200000),
CHAOTIC_STAFF(18355, 170, 80, 200000),
CHAOTIC_CROSSBOW(18357, 175, 80, 200000),
CHAOTIC_KITESHIELD(18359, 180, 80, 200000),
EAGLE_EYE_KITESHIELD(18361, 185, 80, 200000),
FARSEER_KITESHIELD(18363, 190, 80, 200000),
SNEAKERPEEPER(19894, 195, 80, 85000),
TWISTEDNECKLACE(19886, 25, 30, 8500),
DRAGONTOOTHNECKLACE(19887, 115, 60, 17000),
DEMONHORNNECKLACE(19888, 200, 90, 35000);

private static Map<Integer, DungeonReward> monsters = new HashMap<Integer, DungeonReward>();

public static DungeonReward forId(int id) {
return monsters.get(id);
}

static {
for (DungeonReward monster : DungeonReward.values())
monsters.put(monster.slotId, monster);
}

private int id;
private int req;
private int cost;
private int slotId;
private String name;

private DungeonReward(int id, int slotId, int req, int cost) {
this.id = id;
this.req = req;
this.cost = cost;
this.slotId = slotId;
this.name = ItemDefinitions.getItemDefinitions(id).getName();
}

public int getId() {
return id;
}

public String getName() {
return name;
}

public int getCost() {
return cost;
}

public int getSlotId() {
return slotId;
}

public int getRequirement() {
return req;
}
}

public static void openRewardsShop(Player player) {
player.getInterfaceManager().sendInterface(940);
player.getPackets().sendIComponentSettings(940, 2, 0, 205, 1278);
refresh(player);
}

public static void refresh(Player player) {
player.getPackets().sendIComponentText(940, 31, ""+player.dungTokens);
}

public static void handleButtons(Player player, int componentId, int slotId, int packetId) {
if (componentId == 64 && packetId == 14) {
if (player.getTemporaryAttributtes().get("dungReward") != null) {
DungeonReward reward = (DungeonReward) player.getTemporaryAttributtes().get("dungReward");
if (reward != null) {
if (player.getSkills().getLevelForXp(Skills.DUNGEONEERING) < reward.getRequirement()) {
player.getPackets().sendGameMessage("You need "+reward.getRequirement()+" dungeoneering to buy this reward.");
return;
}
if (player.dungTokens < reward.getCost()) {
player.getPackets().sendGameMessage("You need "+reward.getCost()+" dungeoneering tokens to buy this reward.");
return;
}
player.getDialogueManager().startDialogue("DungRewardConfirm", reward);
} else {
player.getPackets().sendGameMessage("You must choose a reward before trying to buy something.");
}
}
return;
}
if (componentId == 2) {
DungeonReward reward = DungeonReward.forId(slotId);
if (reward == null) {
player.getPackets().sendGameMessage("That reward is not added yet. "+slotId);
return;
} else {
player.getTemporaryAttributtes().put("dungReward", reward);
player.getPackets().sendGameMessage(reward.getName()+" requires "+ reward.getRequirement() +" dungeoneering and costs "+reward.getCost()+" dungeoneering tokens.");
}
}
}

}
[/CODE]

[CODE]package arrow.system.engine.player.dialogues;

import arrow.system.engine.player.content.dungeoneering.DungeonRewards;
import arrow.system.engine.player.content.dungeoneering.DungeonRewards.DungeonReward;

/**
*
* [MENTION=52317]auth[/MENTION]or Tylerr
* Skype: tylerr.rsps
* RuneLocus: Tylerr
*
*/

public class DungRewardConfirm extends Dialogue {

DungeonReward item;

[MENTION=15855]Over[/MENTION]ride
public void start() {
item = (DungeonReward) parameters[0];
player.getInterfaceManager().sendChatBoxInterface(1183);
player.getPackets().sendIComponentText(1183, 12, "It will cost "+ item.getCost() +" for "+item.getName()+".");
player.getPackets().sendItemOnIComponent(1183, 13, item.getId(), 1);
player.getPackets().sendIComponentText(1183, 7, "Are you sure you want to buy this?");
player.getPackets().sendIComponentText(1183, 22, "Confirm Purchase");
}

[MENTION=15855]Over[/MENTION]ride
public void run(int interfaceId, int componentId) {
player.getPackets().sendGameMessage("COMPONENTID: "+componentId);
if (componentId == 9) {
if (player.getInventory().getFreeSlots() >= 1) {
player.dungTokens -= item.getCost();
player.getInventory().addItem(item.getId(), 1);
DungeonRewards.refresh(player);
} else {
player.getPackets().sendGameMessage("You need more inventory space.");
}
}
end();
}

[MENTION=15855]Over[/MENTION]ride
public void finish() {

}

}
[/CODE]

[CODE]handledDialogues.put("DungRewardConfirm", (Class<Dialogue>) Class.forName(DungRewardConfirm.class.getCanonicalName()));[/CODE]

[CODE]else if (npc.getId() == 9711)
DungeonRewards.openRewardsShop(player);[/CODE]

[CODE]} else if (interfaceId == 940) {
DungeonRewards.handleButtons(player, componentId, slotId, packetId);[/CODE]

[CODE]public int dungTokens;[/CODE]

[img]http://i.imgur.com/Pq4Dnfx.png[/img]
[img]http://i.imgur.com/mpl1RsW.png[/img]
[img]http://i.imgur.com/YeRJJc9.png[/img] Edited by Tylerr

Share this post


Link to post
Share on other sites
The HashMap is a bit unnecessary, but in general it looks pretty good!

Share this post


Link to post
Share on other sites
[quote name='Hope']The HashMap is a bit unnecessary, but in general it looks pretty good![/QUOTE]

Thanks!

Share this post


Link to post
Share on other sites
Nice, does it really send a dialogue in runescape?

Share this post


Link to post
Share on other sites
LOOOOL this is mine? i can give proof that i sold u my source n you scammed me but it will be now released big boy.

Share this post


Link to post
Share on other sites
[quote name='excellent']LOOOOL this is mine? i can give proof that i sold u my source n you scammed me but it will be now released big boy.[/QUOTE]

Even if it is yours, it's practically effortless to make this shop.

Share this post


Link to post
Share on other sites
[quote name='Hope']Even if it is yours, it's practically effortless to make this shop.[/QUOTE]
Hope ive been programming this dung like 2weeks to get ids and other shits so no hate please he just scammed me done.and i coded this shop..

OT:What done is done. but enjoy the release :)

[url]http://www.runelocus.com/forums/showthread.php?96809-Roma-718&p=765527#post765527[/url]

Share this post


Link to post
Share on other sites
[quote name='Tylerr']Dungeoneering Shop based off my Arrow Project. Enjoy.

[CODE]package arrow.system.engine.player.content.dungeoneering;

import java.util.HashMap;
import java.util.Map;

import arrow.system.cache.parser.ItemDefinitions;
import arrow.system.engine.player.Player;
import arrow.system.engine.player.Skills;

/**
*
* [MENTION=52317]auth[/MENTION]or Tylerr
* Skype: tylerr.rsps
* RuneLocus: Tylerr
*
*/

public class DungeonRewards {

public enum DungeonReward {
BONECRUSHER(18337, 0, 21, 34000),
HERBICIDE(19675, 5, 21, 34000),
SCROLL_OF_LIFE(18336, 15, 25, 10000),
SCROLL_OF_CLEANSING(19890, 40, 49, 20000),
SCROLL_OF_EFFICIENCY(19670, 105, 55, 20000),
SCROLL_OF_AUGURY(18344, 150, 77, 153000),
SCROLL_OF_RIGOUR(18839, 145, 74, 140000),
SCROLL_OF_RENEWAL(18343, 125, 65, 107000),
MERCENARY_GLOVES(18347, 140, 73, 48500),
TOME_OF_FROST(18346, 80, 48, 43000),
ARCANE_PULSE_NECKLACE(18333, 20, 30, 6500),
GRAVITE_SHORTBOW(18373, 70, 45, 40000),
GRAVITE_LONGSWORD(18367, 55, 45, 40000),
GRAVITE_RAPIER(18365, 50, 45, 40000),
GRAVITE_STAFF(18371, 65, 45, 40000),
GRAVITE_2H(18369, 60, 45, 40000),
ARCANE_BLAST_NECKLACE(18334, 90, 50, 15500),
RING_OF_VIGOUR(19669, 120, 62, 50000),
ARCANE_STREAM_NECKLACE(18335, 130, 70, 30500),
CHAOTIC_RAPIER(18349, 155, 80, 200000),
CHAOTIC_LONGSWORD(18351, 160, 80, 200000),
CHAOTIC_MAUL(18353, 165, 80, 200000),
CHAOTIC_STAFF(18355, 170, 80, 200000),
CHAOTIC_CROSSBOW(18357, 175, 80, 200000),
CHAOTIC_KITESHIELD(18359, 180, 80, 200000),
EAGLE_EYE_KITESHIELD(18361, 185, 80, 200000),
FARSEER_KITESHIELD(18363, 190, 80, 200000),
SNEAKERPEEPER(19894, 195, 80, 85000),
TWISTEDNECKLACE(19886, 25, 30, 8500),
DRAGONTOOTHNECKLACE(19887, 115, 60, 17000),
DEMONHORNNECKLACE(19888, 200, 90, 35000);

private static Map<Integer, DungeonReward> monsters = new HashMap<Integer, DungeonReward>();

public static DungeonReward forId(int id) {
return monsters.get(id);
}

static {
for (DungeonReward monster : DungeonReward.values())
monsters.put(monster.slotId, monster);
}

private int id;
private int req;
private int cost;
private int slotId;
private String name;

private DungeonReward(int id, int slotId, int req, int cost) {
this.id = id;
this.req = req;
this.cost = cost;
this.slotId = slotId;
this.name = ItemDefinitions.getItemDefinitions(id).getName();
}

public int getId() {
return id;
}

public String getName() {
return name;
}

public int getCost() {
return cost;
}

public int getSlotId() {
return slotId;
}

public int getRequirement() {
return req;
}
}

public static void openRewardsShop(Player player) {
player.getInterfaceManager().sendInterface(940);
player.getPackets().sendIComponentSettings(940, 2, 0, 205, 1278);
refresh(player);
}

public static void refresh(Player player) {
player.getPackets().sendIComponentText(940, 31, ""+player.dungTokens);
}

public static void handleButtons(Player player, int componentId, int slotId, int packetId) {
if (componentId == 64 && packetId == 14) {
if (player.getTemporaryAttributtes().get("dungReward") != null) {
DungeonReward reward = (DungeonReward) player.getTemporaryAttributtes().get("dungReward");
if (reward != null) {
if (player.getSkills().getLevelForXp(Skills.DUNGEONEERING) < reward.getRequirement()) {
player.getPackets().sendGameMessage("You need "+reward.getRequirement()+" dungeoneering to buy this reward.");
return;
}
if (player.dungTokens < reward.getCost()) {
player.getPackets().sendGameMessage("You need "+reward.getCost()+" dungeoneering tokens to buy this reward.");
return;
}
player.getDialogueManager().startDialogue("DungRewardConfirm", reward);
} else {
player.getPackets().sendGameMessage("You must choose a reward before trying to buy something.");
}
}
return;
}
if (componentId == 2) {
DungeonReward reward = DungeonReward.forId(slotId);
if (reward == null) {
player.getPackets().sendGameMessage("That reward is not added yet. "+slotId);
return;
} else {
player.getTemporaryAttributtes().put("dungReward", reward);
player.getPackets().sendGameMessage(reward.getName()+" requires "+ reward.getRequirement() +" dungeoneering and costs "+reward.getCost()+" dungeoneering tokens.");
}
}
}

}
[/CODE]

[CODE]package arrow.system.engine.player.dialogues;

import arrow.system.engine.player.content.dungeoneering.DungeonRewards;
import arrow.system.engine.player.content.dungeoneering.DungeonRewards.DungeonReward;

/**
*
* [MENTION=52317]auth[/MENTION]or Tylerr
* Skype: tylerr.rsps
* RuneLocus: Tylerr
*
*/

public class DungRewardConfirm extends Dialogue {

DungeonReward item;

[MENTION=15855]Over[/MENTION]ride
public void start() {
item = (DungeonReward) parameters[0];
player.getInterfaceManager().sendChatBoxInterface(1183);
player.getPackets().sendIComponentText(1183, 12, "It will cost "+ item.getCost() +" for "+item.getName()+".");
player.getPackets().sendItemOnIComponent(1183, 13, item.getId(), 1);
player.getPackets().sendIComponentText(1183, 7, "Are you sure you want to buy this?");
player.getPackets().sendIComponentText(1183, 22, "Confirm Purchase");
}

[MENTION=15855]Over[/MENTION]ride
public void run(int interfaceId, int componentId) {
player.getPackets().sendGameMessage("COMPONENTID: "+componentId);
if (componentId == 9) {
if (player.getInventory().getFreeSlots() >= 1) {
player.dungTokens -= item.getCost();
player.getInventory().addItem(item.getId(), 1);
DungeonRewards.refresh(player);
} else {
player.getPackets().sendGameMessage("You need more inventory space.");
}
}
end();
}

[MENTION=15855]Over[/MENTION]ride
public void finish() {

}

}
[/CODE]

[CODE]handledDialogues.put("DungRewardConfirm", (Class<Dialogue>) Class.forName(DungRewardConfirm.class.getCanonicalName()));[/CODE]

[CODE]else if (npc.getId() == 9711)
DungeonRewards.openRewardsShop(player);[/CODE]

[CODE]} else if (interfaceId == 940) {
DungeonRewards.handleButtons(player, componentId, slotId, packetId);[/CODE]

[CODE]public int dungTokens;[/CODE]

[img]http://i.imgur.com/Pq4Dnfx.png[/img]
[img]http://i.imgur.com/mpl1RsW.png[/img]
[img]http://i.imgur.com/YeRJJc9.png[/img][/QUOTE]

could you please inform me where the last codes go where you didn't name the file name? thanks

Share this post


Link to post
Share on other sites
nice Release, I'm Sure majority will use this

Share this post


Link to post
Share on other sites
The buying part isnt working for me... Ive tried everything. If someone could help me my skype is : thefatestman

Share this post


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

×