RuneHive-Game
Loading...
Searching...
No Matches
RingOfDueling.java
Go to the documentation of this file.
1//package com.runehive.content.itemaction.impl;
2//
3//import com.runehive.net.packet.out.SendMessage;
4//import com.runehive.net.packet.out.SendMessage.MessageColor;
5//import com.runehive.game.world.entity.mob.player.Player;
6//import com.runehive.content.itemaction.ItemAction;
7//import com.runehive.content.itemaction.ItemActionType;
8//import com.runehive.content.skill.impl.magic.teleport.Teleportation;
9//import com.runehive.game.world.items.Item;
10//import com.runehive.game.world.location.Position;
11//import com.runehive.util.Utility;
12//
13///**
14// * Handles the ring of dueling action.
15// *
16// * @author Daniel
17// */
18//public class RingOfDueling extends ItemAction {
19//
20// @Override
21// public String name() {
22// return "ring of dueling";
23// }
24//
25// @Override
26// public String message(Item item) {
27// return "You rub the ring...";
28// }
29//
30// @Override
31// public int delay() {
32// return 1;
33// }
34//
35// @Override
36// public void execute(Player player, Item item, ItemActionType type, int opcode) {
37// player.attributes.set("ITEM_ACTION_KEY", charges(item));
38// player.dialogueFactory.sendOption("Al Kahrid Duel Arena.", () -> {
39// teleport(player, item, new Position(3314, 3235), type);
40// }, "Castle Wars Arena.", () -> {
41// teleport(player, item, new Position(2441, 3088), type);
42// }, "Clan Wars Arena", () -> {
43// teleport(player, item, new Position(3390, 3162), type);
44// }, "Nowhere.", () -> {
45// player.interfaceManager.close();
46// }).execute();
47// }
48//
49// public Item[] items() {
50// return new Item[] { new Item(2566), new Item(2564), new Item(2562), new Item(2560), new Item(2558), new Item(2556), new Item(2554), new Item(2552) };
51// };
52//
53// public int charges(Item item) {
54// int charge = 0;
55// for (int index = 0; index < items().length; index++) {
56// if (item.getId() == items()[index].getId()) {
57// charge = index;
58// break;
59// }
60// }
61// return charge;
62// }
63//
64// public void teleport(Player player, Item item, Position position, ItemActionType type) {
65// int charge = (player.attributes.get("ITEM_ACTION_KEY", Integer.class)) - 1;
66//
67// if (type == ItemActionType.EQUIPMENT) {
68// if (charges(item) == 0) {
69// player.equipment.remove(item);
70// } else {
71// player.equipment.replace(item.getId(), items()[charge].getId(), true);
72// }
73// } else if (type == ItemActionType.INVENTORY) {
74// if (charges(item) == 0) {
75// player.inventory.remove(item);
76// } else {
77// player.inventory.replace(item.getId(), items()[charge].getId(), true);
78// }
79// }
80//
81// Teleportation.teleport(player, position);
82// player.send(new SendMessage(charge == 0 || charge == -1 ? "Your " + name() + " crumbles to dust." : "Your " + name() + " has " + Utility.convertWord(charge).toLowerCase() + "charge" + (charge == 1 ? "" : "s") + " remaining.", MessageColor.DARK_PURPLE));
83// }
84//}