Implemented functionality where user can search for traps in some chests (#534)

* Initial commit

* Implemented cooldown timer and added ardougne castle chest

* Refactoring

* Removing unused variable
This commit is contained in:
AugustasK
2023-01-20 18:48:45 +02:00
committed by GitHub
parent 9fd4b470c8
commit f56402845b
7 changed files with 229 additions and 96 deletions
@@ -22,28 +22,19 @@ import com.rs2.game.content.skills.prayer.Ectofuntus;
import com.rs2.game.content.skills.runecrafting.AbyssalHandler;
import com.rs2.game.content.skills.runecrafting.RuneCraftingActions;
import com.rs2.game.content.skills.smithing.Smelting;
import com.rs2.game.content.skills.thieving.SearchForTraps;
import com.rs2.game.content.skills.thieving.Stalls;
import com.rs2.game.content.skills.thieving.ThieveOther;
import com.rs2.game.content.skills.woodcutting.Woodcutting;
import com.rs2.game.content.traveling.DesertCactus;
import com.rs2.game.globalworldobjects.ClimbOther;
import com.rs2.game.globalworldobjects.PassDoor;
import com.rs2.game.globalworldobjects.ClimbOther.ClimbData;
import com.rs2.game.globalworldobjects.PassDoor;
import com.rs2.game.items.ItemAssistant;
import com.rs2.game.items.impl.LightSources;
import com.rs2.game.npcs.NpcHandler;
import com.rs2.game.npcs.impl.MilkCow;
import com.rs2.game.objects.impl.AxeInLog;
import com.rs2.game.objects.impl.BrimhavenVines;
import com.rs2.game.objects.impl.Climbing;
import com.rs2.game.objects.impl.FlourMill;
import com.rs2.game.objects.impl.Levers;
import com.rs2.game.objects.impl.OpenObject;
import com.rs2.game.objects.impl.OtherObjects;
import com.rs2.game.objects.impl.Pickable;
import com.rs2.game.objects.impl.Searching;
import com.rs2.game.objects.impl.UseOther;
import com.rs2.game.objects.impl.Webs;
import com.rs2.game.objects.impl.*;
import com.rs2.game.players.Player;
import com.rs2.game.players.Position;
import com.rs2.util.Misc;
@@ -2817,10 +2808,21 @@ public class ObjectsActions {
case 2550:
ThieveOther.pickLock(player, 1, 3.5, 2674, 3306, 1, false);
break;
case 2551:
ThieveOther.pickLock(player, 14, 15, 2674, 3303, 2, false);
break;
case 2566:
SearchForTraps.searchForTraps(player, 2566); // uzdeti 28 thv
break;
case 2568:
SearchForTraps.searchForTraps(player, 2568);
break;
case 2567:
SearchForTraps.searchForTraps(player, 2567);
break;
case 2570:
SearchForTraps.searchForTraps(player, 2570);
break;
case 2272:
player.getPacketSender().object(2271, 2984, 3336, 1, 10);
player.getPacketSender().sendMessage("You close the cupboard.");
@@ -11,7 +11,8 @@ public class Searching {
BOOKCASE(new int[] {380, 381, 4617, 4671, 9611}, "The bookcase is empty."),
WARDROBE(new int[] {389}, "The wardrobe is empty."),
DRAWER(new int[] {348, 350, 5618}, "The drawer is empty."),
CHEST(new int[] {378}, "The chest is empty.");
CHEST(new int[] {378}, "The chest is empty."),
CHEST_WITH_TRAP(new int[] {2566, 2567, 2568, 2570}, "You have activated a trap on the chest.");
private final int[] objectId;
private final String searchText;
@@ -33,6 +34,9 @@ public class Searching {
for (SearchData s: SearchData.values()) {
for (int i = 0; i < s.getObjectId().length; i++) {
if (objectType == s.getObjectId()[i]) {
if (s == SearchData.CHEST_WITH_TRAP) {
player.dealDamage(2);
}
player.searchObjectDelay = System.currentTimeMillis();
player.getPacketSender().sendMessage(s.getObjectText());
}