From 06038dbbdcb752396a9e011c6e7e26c43b72767d Mon Sep 17 00:00:00 2001 From: Oven Bread Date: Sun, 17 Mar 2024 07:53:59 +0000 Subject: [PATCH] Implemented The Dig Site quest --- Server/data/configs/door_configs.json | 12 - Server/data/configs/ground_spawns.json | 8 + Server/data/configs/item_configs.json | 20 +- Server/data/configs/npc_configs.json | 32 + Server/data/configs/npc_spawns.json | 114 ++- Server/data/configs/object_configs.json | 64 +- .../withnpc/ArchaeologicalExpertListener.kt | 50 - .../handlers/scenery/ReadSignPostPlugin.java | 120 --- .../handlers/scenery/SignpostListener.kt | 175 ++++ .../skill/thieving/ThievingListeners.kt | 48 +- .../dialogue/ResearcherDialogue.java | 98 -- ...rchaeologistcalExpertUsedOnDialogueFile.kt | 2 +- .../digsite/dialogue/ChemicalsBook.kt | 5 - .../digsite/dialogue/EdWoodDialogue.kt | 25 + .../digsite/dialogue/ExaminerDialogue.kt | 524 ++++++++++ .../digsite/dialogue/MuseumGuardDialogue.kt | 27 + .../digsite/dialogue/ResearcherDialogue.kt | 41 + .../ArchaeologicalExpertDialogue.kt | 57 ++ .../ArchaeologicalExpertListener.kt | 138 +++ .../thedigsite/DigsiteWorkmanDialogue.kt | 72 ++ .../quest/thedigsite/DougDeepingDialogue.kt | 69 ++ .../quest/thedigsite/PanningGuideDialogue.kt | 112 +++ .../quest/thedigsite/StudentsDialogue.kt | 343 +++++++ .../digsite/quest/thedigsite/TheDigSite.kt | 391 ++++++++ .../quest/thedigsite/TheDigSiteListeners.kt | 934 ++++++++++++++++++ .../CuratorHaigHalenDialogue.java | 74 -- .../shieldofarrav/CuratorHaigHalenDialogue.kt | 84 ++ .../core/game/dialogue/DialogueBuilder.kt | 6 + .../main/core/net/packet/PacketProcessor.kt | 2 +- 29 files changed, 3253 insertions(+), 394 deletions(-) delete mode 100644 Server/src/main/content/global/handlers/item/withnpc/ArchaeologicalExpertListener.kt delete mode 100644 Server/src/main/content/global/handlers/scenery/ReadSignPostPlugin.java create mode 100644 Server/src/main/content/global/handlers/scenery/SignpostListener.kt delete mode 100644 Server/src/main/content/region/misthalin/dialogue/ResearcherDialogue.java create mode 100644 Server/src/main/content/region/misthalin/digsite/dialogue/EdWoodDialogue.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/dialogue/ExaminerDialogue.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/dialogue/MuseumGuardDialogue.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/dialogue/ResearcherDialogue.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/quest/thedigsite/ArchaeologicalExpertDialogue.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/quest/thedigsite/ArchaeologicalExpertListener.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/quest/thedigsite/DigsiteWorkmanDialogue.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/quest/thedigsite/DougDeepingDialogue.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/quest/thedigsite/PanningGuideDialogue.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/quest/thedigsite/StudentsDialogue.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/quest/thedigsite/TheDigSite.kt create mode 100644 Server/src/main/content/region/misthalin/digsite/quest/thedigsite/TheDigSiteListeners.kt delete mode 100644 Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/CuratorHaigHalenDialogue.java create mode 100644 Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/CuratorHaigHalenDialogue.kt diff --git a/Server/data/configs/door_configs.json b/Server/data/configs/door_configs.json index 528a51934..8d6a61db5 100644 --- a/Server/data/configs/door_configs.json +++ b/Server/data/configs/door_configs.json @@ -2187,18 +2187,6 @@ "fence": "false", "metal": "false" }, - { - "id": "24560", - "replaceId": "15515", - "fence": "true", - "metal": "false" - }, - { - "id": "24561", - "replaceId": "15517", - "fence": "true", - "metal": "false" - }, { "id": "24565", "replaceId": "36316", diff --git a/Server/data/configs/ground_spawns.json b/Server/data/configs/ground_spawns.json index 82149a63c..2e49e5d29 100644 --- a/Server/data/configs/ground_spawns.json +++ b/Server/data/configs/ground_spawns.json @@ -187,10 +187,18 @@ "item_id": "590", "loc_data": "{1,2368,3135,0,10485900}-{1,2431,3072,0,10485900}-{1,3112,3369,2,10485900}-{1,3209,3734,0,13107300}" }, + { + "item_id": "677", + "loc_data": "{1,3369,3378,0,11141270}" + }, { "item_id": "687", "loc_data": "{1,2655,3424,0,6553680}-{1,2665,3424,0,6553680}-{1,2669,3423,0,6553680}-{1,2668,3419,0,6553680}-{1,2671,3420,0,6553680}-{1,2677,3423,0,6553680}-{1,2676,3425,0,6553680}-{1,2676,3422,0,6553680}-{1,2679,3424,0,6553680}-{1,2678,3426,0,6553680}-{1,2679,3423,0,6553680}-{1,2680,3424,0,6553680}-{1,2672,3427,0,6553680}-{1,2676,3430,0,6553680}-{1,2673,3428,0,6553680}-{1,2670,3437,0,6553680}-{1,2649,9854,0,6553680}-{1,2643,9853,0,6553680}-{1,2644,9851,0,6553680}" }, + { + "item_id": "708", + "loc_data": "{1,3363,9831,0,5898270}-{1,3370,9826,0,5898270}-{1,3368,9770,0,5898270}-{1,3364,9764,0,5898270}" + }, { "item_id": "712", "loc_data": "{1,2887,3412,0,5898270}-{1,2903,3441,0,5898270}" diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index 6fade0e39..8c2addbd0 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -6539,11 +6539,29 @@ "archery_ticket_price": "0", "id": "704" }, + { + "shop_price": "1", + "examine": "A mixture of strong chemicals.", + "durability": null, + "name": "Mixed chemicals", + "weight": "0.03", + "archery_ticket_price": "0", + "id": "705" + }, + { + "shop_price": "1", + "examine": "A mixture of strong chemicals.", + "durability": null, + "name": "Mixed chemicals", + "weight": "0.035", + "archery_ticket_price": "0", + "id": "706" + }, { "examine": "A mixture of strong chemicals.", "durability": null, "name": "Chemical compound", - "weight": "2", + "weight": "0.035", "archery_ticket_price": "0", "id": "707" }, diff --git a/Server/data/configs/npc_configs.json b/Server/data/configs/npc_configs.json index bfd15fb0b..ddc3e5e9d 100644 --- a/Server/data/configs/npc_configs.json +++ b/Server/data/configs/npc_configs.json @@ -7313,6 +7313,38 @@ "range_level": "1", "attack_level": "1" }, + { + "examine": "A student busy studying the digsite.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Student", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "615", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "A student busy studying the digsite.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Student", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "616", + "range_level": "1", + "attack_level": "1" + }, { "examine": "A student busy studying the digsite.", "melee_animation": "0", diff --git a/Server/data/configs/npc_spawns.json b/Server/data/configs/npc_spawns.json index f31a50502..e6bbbb288 100644 --- a/Server/data/configs/npc_spawns.json +++ b/Server/data/configs/npc_spawns.json @@ -281,7 +281,7 @@ }, { "npc_id": "90", - "loc_data": "{2885,9812,0,1,0}-{2883,9836,0,1,0}-{2925,3254,2,0,3}-{3116,3534,0,0,4}-{3110,3367,0,0,3}-{3110,9909,0,1,4}-{3121,9910,0,1,4}-{3133,9909,0,1,5}-{3133,9904,0,1,6}-{3129,9916,0,1,3}-{3133,9916,0,1,0}-{3141,9875,0,1,6}-{3208,9905,0,1,4}-{2852,9577,0,1,1}-{2865,9567,0,1,3}-{2924,3252,2,1,3}-{2926,3255,2,1,4}-{2932,3255,2,1,3}-{2931,3251,2,1,4}-{3194,5448,0,1,3}-{3183,5447,0,1,3}-{3177,5457,0,1,4}-{3187,5456,0,1,1}-{3011,3590,0,1,0}-{3016,3596,0,1,0}-{3022,3586,0,1,0}-{3072,3531,0,1,0}-{3112,3538,0,1,0}" + "loc_data": "{2885,9812,0,1,0}-{2883,9836,0,1,0}-{2925,3254,2,0,3}-{3116,3534,0,0,4}-{3110,3367,0,0,3}-{3110,9909,0,1,4}-{3121,9910,0,1,4}-{3133,9909,0,1,5}-{3133,9904,0,1,6}-{3129,9916,0,1,3}-{3133,9916,0,1,0}-{3141,9875,0,1,6}-{3208,9905,0,1,4}-{2852,9577,0,1,1}-{2865,9567,0,1,3}-{2924,3252,2,1,3}-{2926,3255,2,1,4}-{2932,3255,2,1,3}-{2931,3251,2,1,4}-{3194,5448,0,1,3}-{3183,5447,0,1,3}-{3177,5457,0,1,4}-{3187,5456,0,1,1}-{3011,3590,0,1,0}-{3016,3596,0,1,0}-{3022,3586,0,1,0}-{3072,3531,0,1,0}-{3112,3538,0,1,0}-{3373,9748,0,1,0}-{3378,9748,0,1,0}-{3382,9753,0,1,0}-{3373,9812,0,1,0}-{3378,9812,0,1,0}-{3382,9817,0,1,0}" }, { "npc_id": "91", @@ -1763,9 +1763,37 @@ "npc_id": "612", "loc_data": "{3028,3510,0,0,0}" }, + { + "npc_id": "613", + "loc_data": "{3362,3416,0,1,6}-{3370,3387,0,1,6}" + }, + { + "npc_id": "614", + "loc_data": "{3351,9820,0,1,1}-{3351,9756,0,1,1}" + }, + { + "npc_id": "615", + "loc_data": "{3363,3397,0,1,3}" + }, + { + "npc_id": "616", + "loc_data": "{3370,3416,0,1,3}" + }, + { + "npc_id": "617", + "loc_data": "{3348,3424,0,1,3}" + }, + { + "npc_id": "618", + "loc_data": "{3364,3342,0,1,3}" + }, { "npc_id": "619", - "loc_data": "{3353,3333,0,1,3}" + "loc_data": "{3355,3333,0,1,3}" + }, + { + "npc_id": "620", + "loc_data": "{3376,3377,0,1,0}" }, { "npc_id": "636", @@ -4319,6 +4347,10 @@ "npc_id": "1905", "loc_data": "{3335,2948,0,1,2}-{3331,2948,0,1,6}-{3333,2950,0,1,0}" }, + { + "npc_id": "1912", + "loc_data": "{3376,3429,0,1,6}" + }, { "npc_id": "1917", "loc_data": "{3177,2987,0,1,6}" @@ -6193,7 +6225,7 @@ }, { "npc_id": "3264", - "loc_data": "{3265,3331,0,1,7}-{3146,3460,0,1,6}-{3115,3414,0,1,3}-{2565,9843,0,1,0}" + "loc_data": "{3259,3338,0,1,7}-{3126,3450,0,1,6}-{3121,3422,0,1,3}-{2565,9843,0,1,0}-{3311,3375,0,1,0}" }, { "npc_id": "3265", @@ -7252,9 +7284,29 @@ "npc_id": "4563", "loc_data": "{3003,9798,0,1,3}" }, + { + "npc_id": "4564", + "loc_data": "{3354,3408,0,1,0}-{3365,3429,0,1,0}-{3373,3418,0,1,0}-{3356,3385,0,1,0}" + }, + { + "npc_id": "4565", + "loc_data": "{3350,3401,0,1,0}-{3362,3408,0,1,0}-{3366,3425,0,1,0}" + }, + { + "npc_id": "4566", + "loc_data": "{3360,3343,0,1,6}" + }, + { + "npc_id": "4567", + "loc_data": "{3364,3339,0,1,6}" + }, { "npc_id": "4568", - "loc_data": "{3364,3338,0,1,6}" + "loc_data": "{3365,3333,0,1,6}" + }, + { + "npc_id": "4569", + "loc_data": "{3381,3379,0,0,0}" }, { "npc_id": "4570", @@ -7336,6 +7388,10 @@ "npc_id": "4611", "loc_data": "{3076,3259,0,0,0}" }, + { + "npc_id": "4648", + "loc_data": "{3376,3373,0,0,0}" + }, { "npc_id": "4649", "loc_data": "{2142,3122,0,1,4}-{2147,3122,0,1,3}" @@ -7996,6 +8052,10 @@ "npc_id": "5202", "loc_data": "{3621,3528,0,1,4}" }, + { + "npc_id": "5249", + "loc_data": "{3321,3431,0,0,1}" + }, { "npc_id": "5258", "loc_data": "{2666,2651,0,0,1}-{2668,2651,0,0,1}" @@ -8070,15 +8130,15 @@ }, { "npc_id": "5332", - "loc_data": "{2887,9822,0,1,0}-{2884,9824,0,1,0}-{3102,3571,0,1,3}-{2855,9571,0,1,0}-{3008,3595,0,1,0}-{3018,3584,0,1,0}-{3022,3595,0,1,0}" + "loc_data": "{2887,9822,0,1,0}-{2884,9824,0,1,0}-{3102,3571,0,1,3}-{2855,9571,0,1,0}-{3008,3595,0,1,0}-{3018,3584,0,1,0}-{3022,3595,0,1,0}-{3368,9748,0,1,0}-{3378,9757,0,1,0}-{3383,9746,0,1,0}-{3368,9812,0,1,0}-{3378,9821,0,1,0}-{3383,9810,0,1,0}" }, { "npc_id": "5333", - "loc_data": "{2886,9816,0,1,0}-{3116,3524,0,1,4}-{3106,3548,0,1,2}-{2860,9571,0,1,7}-{3013,3586,0,1,0}-{3013,3602,0,1,0}-{3025,3597,0,1,0}" + "loc_data": "{2886,9816,0,1,0}-{3116,3524,0,1,4}-{3106,3548,0,1,2}-{2860,9571,0,1,7}-{3013,3586,0,1,0}-{3013,3602,0,1,0}-{3025,3597,0,1,0}-{3376,9751,0,1,0}-{3380,9756,0,1,0}-{3376,9815,0,1,0}-{3380,9820,0,1,0}" }, { "npc_id": "5334", - "loc_data": "{2885,9819,0,1,0}-{3107,3528,0,1,1}-{2859,9572,0,1,6}-{3012,3597,0,1,0}-{3018,3592,0,1,0}-{3018,3599,0,1,0}-{3025,3590,0,1,0}" + "loc_data": "{2885,9819,0,1,0}-{3107,3528,0,1,1}-{2859,9572,0,1,6}-{3012,3597,0,1,0}-{3018,3592,0,1,0}-{3018,3599,0,1,0}-{3025,3590,0,1,0}-{3377,9743,0,1,0}-{3377,9754,0,1,0}-{3377,9807,0,1,0}-{3377,9818,0,1,0}" }, { "npc_id": "5337", @@ -9140,6 +9200,10 @@ "npc_id": "5941", "loc_data": "{3260,3447,0,0,0}" }, + { + "npc_id": "5942", + "loc_data": "{3295,3427,0,0,1}" + }, { "npc_id": "5943", "loc_data": "{3263,3441,0,0,0}" @@ -9156,10 +9220,46 @@ "npc_id": "5947", "loc_data": "{3260,3452,0,1,0}-{3261,3451,2,1,0}-{1735,4950,0,1,4}-{1759, 4948, 0, 1, 4}-{1780, 4960, 0, 1, 4}-{1760, 4974, 0, 1, 5}" }, + { + "npc_id": "5952", + "loc_data": "{3326,3443,0,1,5}" + }, + { + "npc_id": "5954", + "loc_data": "{3310,3425,0,1,5}" + }, { "npc_id": "5956", "loc_data": "{2659,2664,0,1,3}" }, + { + "npc_id": "5958", + "loc_data": "{3357,3415,0,0,3}" + }, + { + "npc_id": "5959", + "loc_data": "{3352,3449,0,0,0}" + }, + { + "npc_id": "5960", + "loc_data": "{3354,3449,0,0,0}" + }, + { + "npc_id": "5961", + "loc_data": "{3352,3446,0,0,0}" + }, + { + "npc_id": "5962", + "loc_data": "{3357,3446,0,0,0}" + }, + { + "npc_id": "5963", + "loc_data": "{3363,3445,0,0,0}" + }, + { + "npc_id": "5964", + "loc_data": "{3324,3445,0,1,7}" + }, { "npc_id": "5984", "loc_data": "{3263,3452,0,1,0}-{1743,4950,0,1,4}-{1770, 4935, 0, 1, 4}-{1772, 4962, 0, 1, 4}-{1771, 4957, 0, 1, 4}-{1777, 4976, 0, 1, 6}" diff --git a/Server/data/configs/object_configs.json b/Server/data/configs/object_configs.json index 6878b0cb9..6c887b349 100644 --- a/Server/data/configs/object_configs.json +++ b/Server/data/configs/object_configs.json @@ -3584,7 +3584,7 @@ "ids": "2375" }, { - "examine": "Soil", + "examine": "Soil. Dug up!", "ids": "2376,2377,2378" }, { @@ -6384,12 +6384,12 @@ "ids": "4131" }, { - "examine": "These doors look very ominous. A sign says 'To the tombs'.", - "ids": "4132,4133" + "examine": "This tells you which way is which.", + "ids": "4132,4133,4134,4135" }, { - "examine": "Large doors set into the hillside.", - "ids": "4134,4135,4136,4137" + "examine": "These doors look very ominous. A sign says 'To the tombs'.", + "ids": "4136,4137" }, { "examine": "Items are for sale here.", @@ -20027,6 +20027,26 @@ "examine": "It seems to have all boiled away.", "ids": "14009" }, + { + "examine": "Stop examining signs! You're in the Wilderness now!", + "ids": "14503" + }, + { + "examine": "Danger, Wilderness up ahead. Last chance to turn back...", + "ids": "14504" + }, + { + "examine": "Danger, Wilderness up ahead. Watch out for the Beast!", + "ids": "14505" + }, + { + "examine": "Danger, Wilderness up ahead. Beware of stray magma.", + "ids": "14506" + }, + { + "examine": "Danger, Wilderness up ahead. Almost certain death!", + "ids": "14507" + }, { "examine": "Home sweet home?", "ids": "15477" @@ -20039,10 +20059,26 @@ "examine": "Home sweet home?", "ids": "15748" }, + { + "examine": "Large urn.", + "ids": "17362" + }, { "examine": "A large fish.", "ids": "18482" }, + { + "examine": "A sign on a cactus.", + "ids": "18876" + }, + { + "examine": "Dead and half-buried.", + "ids": "19996" + }, + { + "examine": "Dead animal head. Lovely.", + "ids": "19997" + }, { "examine": "Might be worth opening?", "ids": "21299" @@ -20147,6 +20183,10 @@ "examine": "Contains traces of summoning energy.", "ids": "29939,29943,29944,29945,29947,29951,29952,29953,29954" }, + { + "examine": "An interesting sign.", + "ids": "31297,31298,31299,31300,31301" + }, { "examine": "I wonder what this spooky contains.", "ids": "37051" @@ -20215,6 +20255,14 @@ "examine": "A wooden crate.", "ids": "15031" }, + { + "examine": "A sealed barrel with a warning sign on it.", + "ids": "17296" + }, + { + "examine": "A barrel with a warning sign on it.", + "ids": "17297" + }, { "examine": "A beautiful landscape.", "ids": "24184" @@ -20317,7 +20365,7 @@ }, { "examine": "A wooden barrel for storage.", - "ids": "31136,36798" + "ids": "17308,31136,36798" }, { "examine": "A home for baby creatures.", @@ -20543,10 +20591,6 @@ "examine": "Popular on sandy beaches where fruity cocktails may be found.", "ids": "18856" }, - { - "examine": "Stop examining signs! You're in the Wilderness now!", - "ids": "14503" - }, { "examine": "Looks like part of the entrance is blocked by rubble.", "ids": "15767" diff --git a/Server/src/main/content/global/handlers/item/withnpc/ArchaeologicalExpertListener.kt b/Server/src/main/content/global/handlers/item/withnpc/ArchaeologicalExpertListener.kt deleted file mode 100644 index b6bfb4851..000000000 --- a/Server/src/main/content/global/handlers/item/withnpc/ArchaeologicalExpertListener.kt +++ /dev/null @@ -1,50 +0,0 @@ -package content.global.handlers.item.withnpc - -import core.api.openDialogue -import org.rs09.consts.Items -import org.rs09.consts.NPCs -import content.region.misthalin.digsite.dialogue.ArchaeologistcalExpertUsedOnDialogueFile -import core.game.interaction.InteractionListener -import core.game.interaction.IntType - -open class ArchaeologicalExpertListener() : InteractionListener { - val staff = Items.ANCIENT_STAFF_4675 - val unidentifiedLiquid = Items.UNIDENTIFIED_LIQUID_702 - val nitroglycerin = Items.NITROGLYCERIN_703 - val ammoniumNitrate = Items.AMMONIUM_NITRATE_701 - val nuggets = Items.NUGGETS_680 - val needle = Items.NEEDLE_1733 - val rottenApple = Items.ROTTEN_APPLE_1984 - val brokenGlass = Items.BROKEN_GLASS_1469 - val brokenArrow = Items.BROKEN_ARROW_687 - val panningTray = Items.PANNING_TRAY_677 - val bones = Items.BONES_526 - val buttons = Items.BUTTONS_688 - val crackedSample = Items.CRACKED_SAMPLE_674 - val oldTooth = Items.OLD_TOOTH_695 - val rustySword = Items.RUSTY_SWORD_686 - val brokenStaff = Items.BROKEN_STAFF_689 - val brokenArmour = Items.BROKEN_ARMOUR_698 - val damagedArmour = Items.DAMAGED_ARMOUR_697 - val ceramicRemains = Items.CERAMIC_REMAINS_694 - val beltBuckle = Items.BELT_BUCKLE_684 - val animalSkull = Items.ANIMAL_SKULL_671 - val specialCup = Items.SPECIAL_CUP_672 - val teddy = Items.TEDDY_673 - val stoneTablet = Items.STONE_TABLET_699 - - val items = intArrayOf(staff, unidentifiedLiquid, nitroglycerin, ammoniumNitrate, nuggets, needle, rottenApple, - brokenGlass, brokenArrow, panningTray, bones, buttons, crackedSample, oldTooth, rustySword, brokenStaff, brokenArmour, - damagedArmour, ceramicRemains, beltBuckle, animalSkull, specialCup, teddy, stoneTablet) - - val archy = NPCs.ARCHAEOLOGICAL_EXPERT_619 - - val lol = arrayOf(Items) - - override fun defineListeners() { - onUseWith(IntType.NPC, items, archy) { - player, used, with -> openDialogue(player, ArchaeologistcalExpertUsedOnDialogueFile(used.id)) - return@onUseWith false - } - } -} \ No newline at end of file diff --git a/Server/src/main/content/global/handlers/scenery/ReadSignPostPlugin.java b/Server/src/main/content/global/handlers/scenery/ReadSignPostPlugin.java deleted file mode 100644 index 7239c140b..000000000 --- a/Server/src/main/content/global/handlers/scenery/ReadSignPostPlugin.java +++ /dev/null @@ -1,120 +0,0 @@ -package content.global.handlers.scenery; - -import core.cache.def.impl.SceneryDefinition; -import core.game.component.CloseEvent; -import core.game.component.Component; -import core.game.interaction.OptionHandler; -import core.game.node.Node; -import core.game.node.entity.player.Player; -import core.game.node.scenery.Scenery; -import core.net.packet.PacketRepository; -import core.net.packet.context.MinimapStateContext; -import core.net.packet.out.MinimapState; -import core.plugin.Initializable; -import core.plugin.Plugin; - -/** - * Handles the reading of a sign post. - * @author 'Vexia - */ -@Initializable -public class ReadSignPostPlugin extends OptionHandler { - - /** - * Represents the areas on the sign. - * @author 'Vexia - */ - public enum Signs { - NEAR_LUMBRIDGE(18493, "North to farms and
Varrock.", "The River Lum lies to
the south.", "West to
Lumbridge.", "East to Al
Kharid - toll
gate; bring some
money."), NEAR_VARROCK(24263, "Sheep lay this way.", "South through farms
to Al Kharid and
Lumbridge", "West to Champion's Guild
and Varrock south
gate.", "East to Al Kharid mine and
follow the path north to
Varrock east gate."); - - public static Signs forId(int id) { - for (Signs sign : Signs.values()) { - if (sign == null) { - continue; - } - if (sign.object == id) { - return sign; - } - } - return null; - } - - /** - * The object id. - */ - private int object; - - /** - * The directions. - */ - private String directions[]; - - /** - * Constructs a new {@code ReadSignPostPlugin.java} {@code Object}. - * @param object the object. - * @param directions the directions. - */ - Signs(int object, String... directions) { - this.object = object; - this.directions = directions; - } - } - - @Override - public boolean handle(Player player, Node node, String option) { - PacketRepository.send(MinimapState.class, new MinimapStateContext(player, 2)); - player.getInterfaceManager().open(new Component(135)).setCloseEvent(new CloseEvent() { - @Override - public boolean close(Player player, Component c) { - PacketRepository.send(MinimapState.class, new MinimapStateContext(player, 0)); - return true; - } - }); - final Scenery object = (Scenery) node; - Signs sign = Signs.forId(object.getId()); - if (sign == null) { - return false; - } - String[] dirs = sign.directions; - if (object.getLocation().getX() == 3107 && object.getLocation().getY() == 3296) { - dirs[0] = "North to Draynor
Manor"; - dirs[1] = "South to Draynor
Village"; - dirs[2] = "West to Port
Sarim"; - dirs[3] = "East to
Lumbridge"; - } - player.getPacketDispatch().sendString(dirs[0], 135, 3); // North - player.getPacketDispatch().sendString(dirs[1], 135, 9); // South - player.getPacketDispatch().sendString(dirs[2], 135, 12); // West - player.getPacketDispatch().sendString(dirs[3], 135, 8); // East - return true; - } - - @Override - public Plugin newInstance(Object arg) throws Throwable { - SceneryDefinition.forId(2366).getHandlers().put("option:read", this); - SceneryDefinition.forId(2367).getHandlers().put("option:read", this); - SceneryDefinition.forId(2368).getHandlers().put("option:read", this); - SceneryDefinition.forId(2369).getHandlers().put("option:read", this); - SceneryDefinition.forId(2370).getHandlers().put("option:read", this); - SceneryDefinition.forId(2371).getHandlers().put("option:read", this); - SceneryDefinition.forId(4132).getHandlers().put("option:read", this); - SceneryDefinition.forId(4133).getHandlers().put("option:read", this); - SceneryDefinition.forId(4134).getHandlers().put("option:read", this); - SceneryDefinition.forId(4135).getHandlers().put("option:read", this); - SceneryDefinition.forId(5164).getHandlers().put("option:read", this); - SceneryDefinition.forId(10090).getHandlers().put("option:read", this); - SceneryDefinition.forId(13873).getHandlers().put("option:read", this); - SceneryDefinition.forId(15522).getHandlers().put("option:read", this); - SceneryDefinition.forId(18493).getHandlers().put("option:read", this); - SceneryDefinition.forId(24263).getHandlers().put("option:read", this); - SceneryDefinition.forId(25397).getHandlers().put("option:read", this); - SceneryDefinition.forId(30039).getHandlers().put("option:read", this); - SceneryDefinition.forId(30040).getHandlers().put("option:read", this); - SceneryDefinition.forId(31296).getHandlers().put("option:read", this); - SceneryDefinition.forId(31298).getHandlers().put("option:read", this); - SceneryDefinition.forId(31299).getHandlers().put("option:read", this); - SceneryDefinition.forId(31300).getHandlers().put("option:read", this); -// ObjectDefinition.forId(31301).getConfigurations().put("option:read", this);//goblin village - return this; - } -} diff --git a/Server/src/main/content/global/handlers/scenery/SignpostListener.kt b/Server/src/main/content/global/handlers/scenery/SignpostListener.kt new file mode 100644 index 000000000..837462159 --- /dev/null +++ b/Server/src/main/content/global/handlers/scenery/SignpostListener.kt @@ -0,0 +1,175 @@ +package content.global.handlers.scenery + +import core.api.* +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.world.map.Location +import org.rs09.consts.Components +import org.rs09.consts.Scenery + +class SignpostListener : InteractionListener { + override fun defineListeners() { + on(Scenery.SIGNPOST_18493, IntType.SCENERY, "read") { player, node -> + if (node.asScenery().location.equals(Location(3235, 3228))) { + setInterfaceText(player, "Head north towards Fred's farm, and the windmill.", 135, 3) // North + setInterfaceText(player, "South to the swamps of Lumbridge.", 135, 9) // South + setInterfaceText(player, "Cross the bridge and head east to Al Kharid or north to Varrock.", 135, 8) // East + setInterfaceText(player, "West to the Lumbridge Castle and Draynor Village. Beware the goblins!", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(3261, 3230))) { + setInterfaceText(player, "North to farms and Varrock.", 135, 3) // North + setInterfaceText(player, "The River Lum lies to the south.", 135, 9) // South + setInterfaceText(player, "East to Al Kharid - toll gate; bring some money.", 135, 8) // East + setInterfaceText(player, "West to Lumbridge.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(2983, 3278))) { + setInterfaceText(player, "North to the glorious White Knights' city of Falador.", 135, 3) // North + setInterfaceText(player, "South to Rimmington.", 135, 9) // South + setInterfaceText(player, "East to Port Sarim and Draynor Village.", 135, 8) // East + setInterfaceText(player, "West to the Crafting Guild.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(3107, 3296))) { + setInterfaceText(player, "North to Draynor Manor.", 135, 3) // North + setInterfaceText(player, "South to Draynor Village and the Wizards' Tower.", 135, 9) // South + setInterfaceText(player, "East to Lumbridge.", 135, 8) // East + setInterfaceText(player, "West to Port Sarim.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else { + setInterfaceText(player, "North to unknown.", 135, 3) // North + setInterfaceText(player, "South to unknown.", 135, 9) // South + setInterfaceText(player, "East to unknown.", 135, 8) // East + setInterfaceText(player, "West to unknown.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } + return@on true + } + on(Scenery.SIGNPOST_24263, IntType.SCENERY, "read") { player, node -> + if (node.asScenery().location.equals(Location(3268, 3332))) { + setInterfaceText(player, "Sheep lay this way.", 135, 3) // North + setInterfaceText(player, "South through farms to Al Kharid and Lumbridge.", 135, 9) // South + setInterfaceText(player, "East to Al Kharid mine and follow the path north to Varrock east gate.", 135, 8) // East + setInterfaceText(player, "West to Champion's Guild and Varrock south gate.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(3283, 3333))) { + setInterfaceText(player, "North to Varrock mine and Varrock east gate.", 135, 3) // North + setInterfaceText(player, "South to large Mining area and Al Kharid.", 135, 9) // South + setInterfaceText(player, "Follow the path east to the Dig Site.", 135, 8) // East + setInterfaceText(player, "West to Champion's Guild and Varrock south gate.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else { + setInterfaceText(player, "North to unknown.", 135, 3) // North + setInterfaceText(player, "South to unknown.", 135, 9) // South + setInterfaceText(player, "East to unknown.", 135, 8) // East + setInterfaceText(player, "West to unknown.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } + return@on true + } + on(Scenery.SIGNPOST_4132, IntType.SCENERY, "read") { player, node -> + if (node.asScenery().location.equals(Location(3166, 3286))) { + setInterfaceText(player, "North to the windmill.", 135, 3) // North + setInterfaceText(player, "South to a fishing pond next to Fred's farm.", 135, 9) // South + setInterfaceText(player, "East to Lumbridge.", 135, 8) // East + setInterfaceText(player, "West to Port Sarim and Draynor Village.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(3285, 3430))) { + setInterfaceText(player, "North to the Lumber Yard.", 135, 3) // North + setInterfaceText(player, "South to Al Kharid and Lumbridge.", 135, 9) // South + setInterfaceText(player, "East to the Dig Site.", 135, 8) // East + setInterfaceText(player, "West to Varrock.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(2734, 3485))) { + setInterfaceText(player, "North to Sinclair Mansion.", 135, 3) // North + setInterfaceText(player, "South to the Courthouse.", 135, 9) // South + setInterfaceText(player, "East to Camelot Castle and Catherby.", 135, 8) // East + setInterfaceText(player, "Follow the path west to Ardougne.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(2604, 3240))) { + setInterfaceText(player, "North to the Ardougne City Zoo.", 135, 3) // North + setInterfaceText(player, "South to the Monastery.", 135, 9) // South + setInterfaceText(player, "East to the Tower of Life.", 135, 8) // East + setInterfaceText(player, "West to the Clocktower.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(2605, 3298))) { + setInterfaceText(player, "North to the Fishing Guild and Hemenster.", 135, 3) // North + setInterfaceText(player, "South to the Ardougne City Zoo.", 135, 9) // South + setInterfaceText(player, "East to Ardougne Market.", 135, 8) // East + setInterfaceText(player, "West to Ardougne Castle and West Ardougne.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(2646, 3404))) { + setInterfaceText(player, "North to the Ranging Guild and Seer's Village.", 135, 3) // North + setInterfaceText(player, "South to the Ardougne City.", 135, 9) // South + setInterfaceText(player, "East to the Sorcerer's Tower.", 135, 8) // East + setInterfaceText(player, "West to the Fishing Guild.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else { + setInterfaceText(player, "North to unknown.", 135, 3) // North + setInterfaceText(player, "South to unknown.", 135, 9) // South + setInterfaceText(player, "East to unknown.", 135, 8) // East + setInterfaceText(player, "West to unknown.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } + return@on true + } + on(Scenery.SIGNPOST_4134, IntType.SCENERY, "read") { player, node -> + if (node.asScenery().location.equals(Location(2651, 3606))) { + setInterfaceText(player, "North to Rellekka.", 135, 3) // North + setInterfaceText(player, "South to Seers' Village.", 135, 9) // South + setInterfaceText(player, "East to Death Plateau.", 135, 8) // East + setInterfaceText(player, "West to the Lighthouse.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else if (node.asScenery().location.equals(Location(3100, 3418))) { + setInterfaceText(player, "North to Edgeville.", 135, 3) // North + setInterfaceText(player, "South to Draynor Manor.", 135, 9) // South + setInterfaceText(player, "East to Varrock west gate.", 135, 8) // East + setInterfaceText(player, "West to Barbarian Village.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } else { + setInterfaceText(player, "North to unknown.", 135, 3) // North + setInterfaceText(player, "South to unknown.", 135, 9) // South + setInterfaceText(player, "East to unknown.", 135, 8) // East + setInterfaceText(player, "West to unknown.", 135, 12) // West + openInterface(player, Components.AIDE_COMPASS_135) + } + return@on true + } + } + /** + * Old handlers of Signpost. Not all should be opening the AIDE_COMPASS. + * + * @Override + * public Plugin newInstance(Object arg) throws Throwable { + * SceneryDefinition.forId(4132).getHandlers().put("option:read", this); + * SceneryDefinition.forId(4133).getHandlers().put("option:read", this); + * SceneryDefinition.forId(4134).getHandlers().put("option:read", this); + * SceneryDefinition.forId(4135).getHandlers().put("option:read", this); + * SceneryDefinition.forId(5164).getHandlers().put("option:read", this); + * SceneryDefinition.forId(10090).getHandlers().put("option:read", this); + * SceneryDefinition.forId(13873).getHandlers().put("option:read", this); + * SceneryDefinition.forId(15522).getHandlers().put("option:read", this); + * SceneryDefinition.forId(25397).getHandlers().put("option:read", this); + * SceneryDefinition.forId(30039).getHandlers().put("option:read", this); + * SceneryDefinition.forId(30040).getHandlers().put("option:read", this); + * SceneryDefinition.forId(31296).getHandlers().put("option:read", this); + * SceneryDefinition.forId(31298).getHandlers().put("option:read", this); + * SceneryDefinition.forId(31299).getHandlers().put("option:read", this); + * SceneryDefinition.forId(31300).getHandlers().put("option:read", this); + * // ObjectDefinition.forId(31301).getConfigurations().put("option:read", this);//goblin village + * return this; + * } + * + * Was technically supposed to hide the map + * @Override + * public boolean handle(Player player, Node node, String option) { + * PacketRepository.send(MinimapState.class, new MinimapStateContext(player, 2)); + * player.getInterfaceManager().open(new Component(135)).setCloseEvent(new CloseEvent() { + * @Override + * public boolean close(Player player, Component c) { + * PacketRepository.send(MinimapState.class, new MinimapStateContext(player, 0)); + * return true; + * } + * }); + * return true; + * } + */ +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/thieving/ThievingListeners.kt b/Server/src/main/content/global/skill/thieving/ThievingListeners.kt index 1ec538ab3..d6123fcda 100644 --- a/Server/src/main/content/global/skill/thieving/ThievingListeners.kt +++ b/Server/src/main/content/global/skill/thieving/ThievingListeners.kt @@ -2,6 +2,7 @@ package content.global.skill.thieving import content.global.skill.skillcapeperks.SkillcapePerks import core.api.* +import core.api.utils.WeightBasedTable import core.game.node.entity.combat.ImpactHandler import core.game.node.entity.impl.Animator import core.game.node.entity.skill.Skills @@ -10,18 +11,44 @@ import core.tools.RandomFunction import org.rs09.consts.Items import core.game.interaction.InteractionListener import core.game.interaction.IntType +import core.game.node.entity.player.Player +import core.game.node.item.Item import org.rs09.consts.Sounds class ThievingListeners : InteractionListener { - private val PICKPOCKET_ANIM = Animation(881,Animator.Priority.HIGH) - private val NPC_ANIM = Animation(422) + companion object { + val PICKPOCKET_ANIM = Animation(881,Animator.Priority.HIGH) + val NPC_ANIM = Animation(422) + + /** Standalone pickpocketing function. For thieving other stuff outside of normal pickpocketing tables. */ + fun pickpocketRoll(player: Player, low: Double, high: Double, table: WeightBasedTable): ArrayList? { + // Able to pickpocket + var successMod = 0.0 + if(SkillcapePerks.isActive(SkillcapePerks.SMOOTH_HANDS, player)) { + successMod += 25 + } + if (player.equipment.contains(Items.GLOVES_OF_SILENCE_10075,1)){ + successMod += 3 + } + + val chance = RandomFunction.randomDouble(1.0, 100.0) + val failThreshold = RandomFunction.getSkillSuccessChance(low, high ,player.skills.getLevel(Skills.THIEVING)) + successMod + + if (chance > failThreshold) { + // Fail Pickpocket + return null // Returns a null, different from an empty table. + } else { + // Success Pickpocket + return table.roll() // You could also successfully pickpocket nothing when the table returns a blank array. + } + } + } override fun defineListeners() { on(IntType.NPC,"pickpocket","pick-pocket"){ player, node -> val pickpocketData = Pickpockets.forID(node.id) ?: return@on false - var successMod = 0.0 if(player.inCombat()){ player.sendMessage("You can't pickpocket while in combat.") @@ -38,18 +65,9 @@ class ThievingListeners : InteractionListener { return@on true } - if(SkillcapePerks.isActive(SkillcapePerks.SMOOTH_HANDS, player)) { - successMod += 25 - } - if (player.equipment.contains(Items.GLOVES_OF_SILENCE_10075,1)){ - successMod += 3 - } - player.animator.animate(PICKPOCKET_ANIM) - val chance = RandomFunction.randomDouble(1.0,100.0) - val failThreshold = pickpocketData.getSuccessChance(player) + successMod - - if(chance > failThreshold){ + val lootTable = pickpocketRoll(player, pickpocketData.low, pickpocketData.high, pickpocketData.table) + if(lootTable == null){ node.asNpc().face(player) node.asNpc().animator.animate(NPC_ANIM) @@ -63,7 +81,7 @@ class ThievingListeners : InteractionListener { } else { playAudio(player, Sounds.PICK_2581) player.lock(2) - pickpocketData.table.roll().forEach { player.inventory.add(it) } + lootTable.forEach { player.inventory.add(it) } player.skills.addExperience(Skills.THIEVING,pickpocketData.experience) } diff --git a/Server/src/main/content/region/misthalin/dialogue/ResearcherDialogue.java b/Server/src/main/content/region/misthalin/dialogue/ResearcherDialogue.java deleted file mode 100644 index fde14e0eb..000000000 --- a/Server/src/main/content/region/misthalin/dialogue/ResearcherDialogue.java +++ /dev/null @@ -1,98 +0,0 @@ -package content.region.misthalin.dialogue; - -import core.game.dialogue.DialoguePlugin; -import core.game.dialogue.FacialExpression; -import core.game.node.entity.npc.NPC; -import core.game.node.entity.player.Player; -import core.plugin.Initializable; -import core.game.world.GameWorld; - -/** - * Represents the dialogue plugin for the new Researcher NPC that sells unobtainable items. - * @author Splinter - * @version 1.0 - */ -@Initializable -public final class ResearcherDialogue extends DialoguePlugin { - - /** - * Constructs a new {@code ResearcherDialogue} {@code Object}. - */ - public ResearcherDialogue() { - /** - * empty. - */ - } - - /** - * Constructs a new {@code ResearcherDialogue} {@code Object}. - * @param player the player. - */ - public ResearcherDialogue(Player player) { - super(player); - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new ResearcherDialogue(player); - } - - @Override - public boolean open(Object... args) { - npc = (NPC) args[0]; - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Hello."); - stage = 0; - return true; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - switch (stage) { - case 0: - player("Hello, are you new around these parts?"); - stage = 1; - break; - case 1: - npc("I am indeed. I am a traveling researcher studying the", "lands of "+GameWorld.getSettings().getName()+"."); - stage = 2; - break; - case 2: - player("That's amazing! Surely you must have collected a few", "trinkets in your travels."); - stage = 3; - break; - case 3: - npc("I have. I suppose I could let you take a look at them","if you're interested."); - stage = 4; - break; - case 4: - interpreter.sendOptions("Select an Option", "Look at wares.", "Decline."); - stage = 5; - break; - case 5: - switch(buttonId){ - case 1: - player("Alright, show me your wares."); - stage = 6; - break; - case 2: - player("On second thought, I really must be going."); - stage = 7; - break; - } - break; - case 6: - end(); - npc.openShop(player); - break; - case 7: - end(); - break; - } - return true; - } - - @Override - public int[] getIds() { - return new int[] { 4568 }; - } -} diff --git a/Server/src/main/content/region/misthalin/digsite/dialogue/ArchaeologistcalExpertUsedOnDialogueFile.kt b/Server/src/main/content/region/misthalin/digsite/dialogue/ArchaeologistcalExpertUsedOnDialogueFile.kt index bd7a3597c..c16b62b2d 100644 --- a/Server/src/main/content/region/misthalin/digsite/dialogue/ArchaeologistcalExpertUsedOnDialogueFile.kt +++ b/Server/src/main/content/region/misthalin/digsite/dialogue/ArchaeologistcalExpertUsedOnDialogueFile.kt @@ -1,6 +1,6 @@ package content.region.misthalin.digsite.dialogue -import content.global.handlers.item.withnpc.ArchaeologicalExpertListener +import content.region.misthalin.digsite.quest.thedigsite.ArchaeologicalExpertListener import core.api.addItemOrDrop import core.api.sendDialogue import core.game.dialogue.FacialExpression diff --git a/Server/src/main/content/region/misthalin/digsite/dialogue/ChemicalsBook.kt b/Server/src/main/content/region/misthalin/digsite/dialogue/ChemicalsBook.kt index b0e51fa1a..a13b7c858 100644 --- a/Server/src/main/content/region/misthalin/digsite/dialogue/ChemicalsBook.kt +++ b/Server/src/main/content/region/misthalin/digsite/dialogue/ChemicalsBook.kt @@ -11,10 +11,6 @@ import core.game.node.entity.player.Player import org.rs09.consts.Items class ChemicalsBook : InteractionListener { - - // Part of The Dig Site quest. It has some information on how to - // make an explosive potion that can be used to destroy some blocks. - companion object { private val TITLE = "Volatile chemicals Experimental Test Notes" private val CONTENTS = arrayOf( @@ -66,7 +62,6 @@ class ChemicalsBook : InteractionListener { ) } - private fun display(player: Player, pageNum: Int, buttonID: Int): Boolean { BookInterface.pageSetup( player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS diff --git a/Server/src/main/content/region/misthalin/digsite/dialogue/EdWoodDialogue.kt b/Server/src/main/content/region/misthalin/digsite/dialogue/EdWoodDialogue.kt new file mode 100644 index 000000000..11c6bb04d --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/dialogue/EdWoodDialogue.kt @@ -0,0 +1,25 @@ +package content.region.misthalin.digsite.dialogue + +import core.api.sendChat +import core.game.dialogue.DialoguePlugin +import core.game.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE +import org.rs09.consts.NPCs + +@Initializable +class EdWoodDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + sendChat(npc, arrayOf("Can't stop. Too busy.", "Wonder when I'll get paid.", "Is it lunch break yet?", "Hey I'm working here. I'm working here.", "This work isn't going to do itself.", "Ouch! That was my finger!").random()) + stage = END_DIALOGUE + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return EdWoodDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.ED_WOOD_5964) + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/digsite/dialogue/ExaminerDialogue.kt b/Server/src/main/content/region/misthalin/digsite/dialogue/ExaminerDialogue.kt new file mode 100644 index 000000000..659f0a7cf --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/dialogue/ExaminerDialogue.kt @@ -0,0 +1,524 @@ +package content.region.misthalin.digsite.dialogue + +import content.region.misthalin.digsite.quest.thedigsite.TheDigSite +import core.api.* +import core.game.dialogue.* +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.Items +import org.rs09.consts.NPCs + +@Initializable +class ExaminerDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + openDialogue(player, ExaminerDialogueFile(), npc) + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return ExaminerDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.EXAMINER_618, NPCs.EXAMINER_4566, NPCs.EXAMINER_4567) + } +} +class ExaminerDialogueFile : DialogueBuilderFile() { + + companion object { + + } + + override fun create(b: DialogueBuilder) { + + b.onQuestStages(TheDigSite.questName, 100) + .npcl(FacialExpression.HAPPY, "Hello there! My colleague tells me you helped to uncover a hidden altar to the god Zaros.") + .npcl(FacialExpression.HAPPY, "A great scholar and archaeologist indeed! Good health and prosperity to you.") + .options().let { optionBuilder -> + optionBuilder.option("Thanks.") + .player(FacialExpression.HAPPY, "Thanks!") + .end() + optionBuilder.option_playerl("I have lost my trowel.") + .npcl("Deary me... That was a good one as well. It's a good job I have another. Here you go...") + .endWith { _, player -> + addItemOrDrop(player, Items.TROWEL_676) + } + } + + b.onQuestStages(TheDigSite.questName, 6,7,8,9,10,11,12) + .npcl(FacialExpression.FRIENDLY, "Well, what are you doing here? Get digging!") + + b.onQuestStages(TheDigSite.questName, 5) + .playerl(FacialExpression.FRIENDLY, "Hello.") + .npcl(FacialExpression.FRIENDLY, "Ah, hello again.") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.option_playerl("I am ready for the last exam...") + .goto(continuePath) + optionBuilder.option_playerl("I am stuck on a question.") + .npcl("Well, well, have you not been doing any studies? I am not giving you the answers, talk to the other students and remember the answers.") + .end() + optionBuilder.option_playerl("Sorry, I didn't mean to disturb you.") + .npcl("Oh, no problem at all.") + .end() + optionBuilder.option_playerl("I have lost my trowel.") + .branch { player -> if(inInventory(player, Items.TROWEL_676)) { 0 } else { 1 } } + .let{ branch -> + branch.onValue(0) + .npcl("Really? Look in your backpack and make sure first.") + .end() + branch.onValue(1) + .npcl("Deary me. That was a good one as well. It's a good job I have another. Here you go...") + .endWith { _, player -> + addItemOrDrop(player, Items.TROWEL_676) + } + } + return@let continuePath.builder() + } + .npcl(FacialExpression.NEUTRAL, "Attention, this is the final part of the Earth Sciences exam: Earth Sciences level 3 - Advanced.") + .npcl(FacialExpression.NEUTRAL, "Question 1 - Sample preparation. Can you tell me how we prepare samples?") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.recordAttribute(TheDigSite.attributeFirstQuestion) + optionBuilder.optionIf("Samples may be mixed together safely.") { + player -> return@optionIf !getAttribute(player, TheDigSite.attributeStudentPurpleExam3ObtainAnswer, false) } + .playerl("Samples may be mixed together safely.") + .goto(continuePath) + optionBuilder.optionIf("Samples cleaned, and carried only in specimen jars.") { + player -> return@optionIf getAttribute(player, TheDigSite.attributeStudentPurpleExam3ObtainAnswer, false) } + .playerl("Samples cleaned, and carried only in specimen jars.") + .goto(continuePath) + optionBuilder.option_playerl("Sample types catalogued and carried by hand only.").goto(continuePath) + optionBuilder.option_playerl("Samples to be spread thickly with mashed banana.").goto(continuePath) + return@let continuePath.builder() + } + .npcl("Okay, next question...") + .npcl(FacialExpression.NEUTRAL, "Earth Sciences level 3, question 2 - Specimen brush use. What is the proper way to use a specimen brush?") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.recordAttribute(TheDigSite.attributeSecondQuestion) + optionBuilder.optionIf("Brush quickly using a wet brush.") { + player -> return@optionIf !getAttribute(player, TheDigSite.attributeStudentGreenExam3ObtainAnswer, false) } + .playerl("Brush quickly using a wet brush.") + .goto(continuePath) + optionBuilder.optionIf("Brush carefully and slowly using short strokes.") { + player -> return@optionIf getAttribute(player, TheDigSite.attributeStudentGreenExam3ObtainAnswer, false) } + .playerl("Brush carefully and slowly using short strokes.") + .goto(continuePath) + optionBuilder.option_playerl("Dipped in glue and stuck to a sheep's back.").goto(continuePath) + optionBuilder.option_playerl("Brush quickly and with force.").goto(continuePath) + return@let continuePath.builder() + } + .npcl("Okay, next question...") + .npcl(FacialExpression.NEUTRAL, "Earth Sciences level 3, question 3 - Advanced techniques. Can you describe the technique for handling bones?") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.recordAttribute(TheDigSite.attributeThirdQuestion) + optionBuilder.optionIf("Bones must not be taken from the site.") { + player -> return@optionIf !getAttribute(player, TheDigSite.attributeStudentBrownExam3ObtainAnswer, false) } + .playerl("Bones must not be taken from the site.") + .goto(continuePath) + optionBuilder.option_playerl("Feed to hungry dogs.").goto(continuePath) + optionBuilder.option_playerl("Bones to be ground and tested for mineral content.").goto(continuePath) + optionBuilder.optionIf("Handle bones very carefully and keep them away from other samples.") { + player -> return@optionIf getAttribute(player, TheDigSite.attributeStudentBrownExam3ObtainAnswer, false) } + .playerl("Handle bones very carefully and keep them away from other samples.") + .goto(continuePath) + return@let continuePath.builder() + } + .npcl("Okay, that concludes the level 3 Earth Sciences exam.") + .npcl(FacialExpression.HAPPY, "Let me add up the results...") + .branch { player -> + var ansCount = 0 + if (getAttribute(player, TheDigSite.attributeFirstQuestion, -1) == 0 && + getAttribute(player, TheDigSite.attributeStudentPurpleExam3ObtainAnswer, false)) { + ansCount++ + } + if (getAttribute(player, TheDigSite.attributeSecondQuestion, -1) == 0 && + getAttribute(player, TheDigSite.attributeStudentGreenExam3ObtainAnswer, false)) { + ansCount++ + } + if (getAttribute(player, TheDigSite.attributeThirdQuestion, -1) == 2 && + getAttribute(player, TheDigSite.attributeStudentBrownExam3ObtainAnswer, false)) { + ansCount++ + } + return@branch ansCount + } + .let { branch -> + + branch.onValue(0) + .npcl(FacialExpression.ANGRY, "I cannot believe this! Absolutely none right at all. I doubt you did any research before you took this exam...") + .playerl(FacialExpression.SAD, "Ah... Yes... Erm.... I think I had better go and revise first!") + .end() + + branch.onValue(1) + .npcl(FacialExpression.FRIENDLY, "You got one question correct. Try harder!") + .playerl(FacialExpression.FRIENDLY, "Oh bother!") + .end() + + branch.onValue(2) + .npcl(FacialExpression.FRIENDLY, "You got two questions correct. A little more study and you will pass it.") + .playerl(FacialExpression.FRIENDLY, "I'm nearly there...") + .end() + + branch.onValue(3) + .npcl(FacialExpression.FRIENDLY, "You got all the questions correct, well done!") + .playerl(FacialExpression.FRIENDLY, "Hooray!") + .betweenStage { _, player, _, _ -> + addItemOrDrop(player, Items.LEVEL_3_CERTIFICATE_693) + } + .npcl(FacialExpression.FRIENDLY, "Congratulations! You have now passed the Earth Sciences level 3 exam. Here is your level 3 certificate.") + .playerl(FacialExpression.FRIENDLY, "I can dig wherever I want now!") + .npcl(FacialExpression.FRIENDLY, "Perhaps you should use your newfound skills to find an artefact on the digsite that will impress the archaeological expert.") + .endWith { _, player -> + if(getQuestStage(player, TheDigSite.questName) == 5) { + setQuestStage(player, TheDigSite.questName, 6) + } + openInterface(player, 444) + setInterfaceText(player, player.name, 444, 5) + } + + } + + b.onQuestStages(TheDigSite.questName, 4) + .playerl(FacialExpression.FRIENDLY, "Hello.") + .npcl(FacialExpression.FRIENDLY, "Hello again.") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.option_playerl("I am ready for the next exam.") + .goto(continuePath) + optionBuilder.option_playerl("I am stuck on a question.") + .npcl("Well, well, have you not been doing any studies? I am not giving you the answers, talk to the other students and remember the answers.") + .end() + optionBuilder.option_playerl("Sorry, I didn't mean to disturb you.") + .npcl("Oh, no problem at all.") + .end() + optionBuilder.option_playerl("I have lost my trowel.") + .branch { player -> if(inInventory(player, Items.TROWEL_676)) { 0 } else { 1 } } + .let{ branch -> + branch.onValue(0) + .npcl("Really? Look in your backpack and make sure first.") + .end() + branch.onValue(1) + .npcl("Deary me. That was a good one as well. It's a good job I have another. Here you go...") + .endWith { _, player -> + addItemOrDrop(player, Items.TROWEL_676) + } + } + return@let continuePath.builder() + } + .npcl(FacialExpression.NEUTRAL, "Okay, this is the next part of the Earth Sciences exam: Earth Sciences level 2 - Intermediate.") + .npcl(FacialExpression.NEUTRAL, "Question 1 - Sample transportation. Can you tell me how we transport samples?") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.recordAttribute(TheDigSite.attributeFirstQuestion) + optionBuilder.optionIf("Samples cut and cleaned before transportation.") { + player -> return@optionIf !getAttribute(player, TheDigSite.attributeStudentBrownExam2ObtainAnswer, false) } + .playerl("Samples cut and cleaned before transportation.") + .goto(continuePath) + optionBuilder.option_playerl("Samples ground and suspended in an acid solution.").goto(continuePath) + optionBuilder.option_playerl("Samples to be given to the melon-collecting monkey. ").goto(continuePath) + optionBuilder.optionIf("Samples taken in rough form; kept only in sealed containers.") { + player -> return@optionIf getAttribute(player, TheDigSite.attributeStudentBrownExam2ObtainAnswer, false) } + .playerl("Samples taken in rough form; kept only in sealed containers.") + .goto(continuePath) + return@let continuePath.builder() + } + .npcl("Okay, next question...") + .npcl(FacialExpression.NEUTRAL, "Earth Sciences level 2, question 2 - Handling of finds. What is the proper way to handle finds?") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.recordAttribute(TheDigSite.attributeSecondQuestion) + optionBuilder.optionIf("Finds must not be handled by anyone.") { + player -> return@optionIf !getAttribute(player, TheDigSite.attributeStudentPurpleExam2ObtainAnswer, false) } + .playerl("Finds must not be handled by anyone.") + .goto(continuePath) + optionBuilder.optionIf("Finds must be carefully handled.") { + player -> return@optionIf getAttribute(player, TheDigSite.attributeStudentPurpleExam2ObtainAnswer, false) } + .playerl("Finds must be carefully handled.") + .goto(continuePath) + optionBuilder.option_playerl("Finds to be given to the site workmen.").goto(continuePath) + optionBuilder.option_playerl("Drop them on the floor and jump on them.").goto(continuePath) + return@let continuePath.builder() + } + .npcl("Okay, next question...") + .npcl(FacialExpression.NEUTRAL, "Earth Sciences level 2, question 3 - Rock pick usage. Can you tell me the proper use for a rock pick?") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.recordAttribute(TheDigSite.attributeThirdQuestion) + optionBuilder.optionIf("Strike rock repeatedly until powdered.") { + player -> return@optionIf !getAttribute(player, TheDigSite.attributeStudentGreenExam2ObtainAnswer, false) } + .playerl("Strike rock repeatedly until powdered.") + .goto(continuePath) + optionBuilder.option_playerl("Rock pick must be used flat and with strong force.").goto(continuePath) + optionBuilder.optionIf("Always handle with care; strike cleanly on its cleaving point.") { + player -> return@optionIf getAttribute(player, TheDigSite.attributeStudentGreenExam2ObtainAnswer, false) } + .playerl("Always handle with care; strike cleanly on its cleaving point.") + .goto(continuePath) + optionBuilder.option_playerl("Protective clothing to be worn; tools kept away from site.").goto(continuePath) + return@let continuePath.builder() + } + .npcl("Okay, that covers the level 2 Earth Sciences exam.") + .npcl(FacialExpression.HAPPY, "Let me add up your total...") + .branch { player -> + var ansCount = 0 + if (getAttribute(player, TheDigSite.attributeFirstQuestion, -1) == 2 && + getAttribute(player, TheDigSite.attributeStudentBrownExam2ObtainAnswer, false)) { + ansCount++ + } + if (getAttribute(player, TheDigSite.attributeSecondQuestion, -1) == 0 && + getAttribute(player, TheDigSite.attributeStudentPurpleExam2ObtainAnswer, false)) { + ansCount++ + } + if (getAttribute(player, TheDigSite.attributeThirdQuestion, -1) == 1 && + getAttribute(player, TheDigSite.attributeStudentGreenExam2ObtainAnswer, false)) { + ansCount++ + } + return@branch ansCount + } + .let { branch -> + + branch.onValue(0) + .npcl(FacialExpression.ANGRY, "No, no, no! This will not do. They are all wrong. Start again!") + .playerl(FacialExpression.SAD, "Oh no!") + .npcl("More studying for you my @g[boy,girl].") + .end() + + branch.onValue(1) + .npcl(FacialExpression.FRIENDLY, "You got one question correct. At least it's a start.") + .playerl(FacialExpression.FRIENDLY, "Oh well..") + .npcl(FacialExpression.FRIENDLY, "Get out and explore the site, talk to people and learn!") + .end() + + branch.onValue(2) + .npcl(FacialExpression.FRIENDLY, "You got two questions correct. Not too bad, but you can do better...") + .playerl(FacialExpression.FRIENDLY, "Nearly got it.") + .end() + + branch.onValue(3) + .npcl(FacialExpression.FRIENDLY, "You got all the questions correct, well done!") + .playerl(FacialExpression.FRIENDLY, "Great, I'm getting good at this.") + .betweenStage { _, player, _, _ -> + addItemOrDrop(player, Items.LEVEL_2_CERTIFICATE_692) + } + .npcl(FacialExpression.FRIENDLY, "You have now passed the Earth Sciences level 2 intermediate exam. Here is your certificate. Of course, you'll want to get studying for your next exam now!") + .endWith { _, player -> + if(getQuestStage(player, TheDigSite.questName) == 4) { + setQuestStage(player, TheDigSite.questName, 5) + } + openInterface(player, 441) + setInterfaceText(player, player.name, 441, 5) + } + + } + + b.onQuestStages(TheDigSite.questName, 1,2,3) + // This is kinda messy due to the dialogue being reused in different stages. + .branch { player -> + if (getQuestStage(player, TheDigSite.questName) == 2 && !inInventory(player, Items.SEALED_LETTER_683)){ + return@branch 1 // Reuse quest stage 1 if sealed letter is not in inventory. + } + return@branch getQuestStage(player, TheDigSite.questName) + } + .let{ branch -> + val continuePath = b.placeholder() + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "Hello.") + .npcl(FacialExpression.FRIENDLY, "Hello again.") + .npcl(FacialExpression.FRIENDLY, "I am still waiting for your letter of recommendation.") + .options().let { optionBuilder -> + optionBuilder.option_playerl("I have lost the letter you gave me.") + .branch { player -> + if (inInventory(player, Items.UNSTAMPED_LETTER_682)){ + return@branch 0 + } else if (inBank(player, Items.UNSTAMPED_LETTER_682)){ + return@branch 1 + } else { + return@branch 2 + } + }.let{ branch -> + branch.onValue(0) + .npcl("Oh now come on. You have it with you!") + .end() + branch.onValue(1) + .npcl("You already have the letter in your bank.") + .end() + branch.onValue(2) + .npcl("That was foolish. Take this one and don't lose it!") + .endWith { _, player -> + addItemOrDrop(player, Items.UNSTAMPED_LETTER_682) + } + return@let branch + } + optionBuilder.option_playerl("Alright I'll try and get it.") + .npcl("I am sure you won't get any problems. Speak to the Curator of Varrock's museum.") + .end() + } + branch.onValue(2) + .playerl(FacialExpression.FRIENDLY, "Hello.") + .npcl(FacialExpression.FRIENDLY, "Hello again.") + .playerl(FacialExpression.FRIENDLY, "Here is the stamped letter you asked for.") + .betweenStage { _, player, _, _ -> + if (inInventory(player, Items.SEALED_LETTER_683)) { + removeItem(player, Items.SEALED_LETTER_683) + } + if(getQuestStage(player, TheDigSite.questName) == 2) { + setQuestStage(player, TheDigSite.questName, 3) + } + } + .npcl(FacialExpression.NEUTRAL, "Good, good. We will begin the exam...") + .goto(continuePath) + branch.onValue(3) + .playerl(FacialExpression.FRIENDLY, "Hello.") + .npcl(FacialExpression.FRIENDLY, "Hello again. Are you ready for another shot at the exam?") + .options().let { optionBuilder -> + val continuePath2 = b.placeholder() + optionBuilder.option_playerl("Yes, I certainly am. ") + .goto(continuePath) // Continue down below. + optionBuilder.option_playerl("No, not at the moment.") + .npcl(FacialExpression.NEUTRAL, "Okay, take your time if you wish.") + .end() + return@let continuePath2.builder() + } + + + return@let continuePath.builder() + } + .npcl(FacialExpression.NEUTRAL, "Okay, we will start with the first exam: Earth Sciences level 1 - Beginner.") + .npcl(FacialExpression.NEUTRAL, "Question 1 - Earth Sciences overview. Can you tell me what Earth Sciences is?") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.recordAttribute(TheDigSite.attributeFirstQuestion) + optionBuilder.optionIf("The study of gardening, planing and fruiting vegetation.") { + player -> return@optionIf !getAttribute(player, TheDigSite.attributeStudentGreenExam1ObtainAnswer, false) } + .playerl("The study of gardening, planing and fruiting vegetation.") + .goto(continuePath) + optionBuilder.optionIf("The study of the earth, its contents and history.") { + player -> return@optionIf getAttribute(player, TheDigSite.attributeStudentGreenExam1ObtainAnswer, false) } + .playerl("The study of the earth, its contents and history.") + .goto(continuePath) + optionBuilder.option_playerl("The study of planets and the history of worlds.").goto(continuePath) + optionBuilder.option_playerl("The combination of archaeology and vegetarianism.").goto(continuePath) + return@let continuePath.builder() + } + .npcl("Okay, next question...") + .npcl(FacialExpression.NEUTRAL, "Earth Sciences level 1, question 2 - Eligibility. Can you tell me which people are allowed to use the digsite?") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.recordAttribute(TheDigSite.attributeSecondQuestion) + optionBuilder.optionIf("Magic users, miners and their escorts.") { + player -> return@optionIf !getAttribute(player, TheDigSite.attributeStudentBrownExam1ObtainAnswer, false) } + .playerl("Magic users, miners and their escorts.") + .goto(continuePath) + optionBuilder.option_playerl("Professors, students and workmen only.").goto(continuePath) + optionBuilder.option_playerl("Local residents, contractors and small pink fish.").goto(continuePath) + optionBuilder.optionIf("All that have passed the appropriate Earth Sciences exam.") { + player -> return@optionIf getAttribute(player, TheDigSite.attributeStudentBrownExam1ObtainAnswer, false) } + .playerl("All that have passed the appropriate Earth Sciences exam.") + .goto(continuePath) + return@let continuePath.builder() + } + .npcl("Okay, next question...") + .npcl(FacialExpression.NEUTRAL, "Earth Sciences level 1, question 3 - Health and safety. Can you tell me the proper safety points when working on a digsite?") + .options().let { optionBuilder -> + val continuePath = b.placeholder() + optionBuilder.recordAttribute(TheDigSite.attributeThirdQuestion) + optionBuilder.optionIf("Heat-resistant clothing to be worn at all times.") { + player -> return@optionIf !getAttribute(player, TheDigSite.attributeStudentPurpleExam1ObtainAnswer, false) } + .playerl("Heat-resistant clothing to be worn at all times.") + .goto(continuePath) + optionBuilder.option_playerl("Rubber chickens to be worn on the head at all times.").goto(continuePath) + optionBuilder.optionIf("Gloves and boots to be warn at all times; proper tools must be used.") { + player -> return@optionIf getAttribute(player, TheDigSite.attributeStudentPurpleExam1ObtainAnswer, false) } + .playerl("Gloves and boots to be warn at all times; proper tools must be used.") + .goto(continuePath) + optionBuilder.option_playerl("Protective clothing to be worn; tools kept away from site.").goto(continuePath) + return@let continuePath.builder() + } + .npcl("Okay, that covers the level 1 Earth Sciences exam.") + .npcl(FacialExpression.HAPPY, "Let's see how you did...") + .branch { player -> + var ansCount = 0 + if (getAttribute(player, TheDigSite.attributeFirstQuestion, -1) == 0 && + getAttribute(player, TheDigSite.attributeStudentGreenExam1ObtainAnswer, false)) { + ansCount++ + } + if (getAttribute(player, TheDigSite.attributeSecondQuestion, -1) == 2 && + getAttribute(player, TheDigSite.attributeStudentBrownExam1ObtainAnswer, false)) { + ansCount++ + } + if (getAttribute(player, TheDigSite.attributeThirdQuestion, -1) == 1 && + getAttribute(player, TheDigSite.attributeStudentPurpleExam1ObtainAnswer, false)) { + ansCount++ + } + return@branch ansCount + } + .let { branch -> + + branch.onValue(0) + .npcl(FacialExpression.ANGRY, "Oh dear me! This is appalling, none correct at all! I suggest you go and study properly.") + .playerl(FacialExpression.SAD, "Oh dear...") + .npcl("Why don't you use the resources here? There are books and the researchers... and you could even ask other students who are also studying for these exams.") + .end() + + branch.onValue(1) + .npcl(FacialExpression.FRIENDLY, "You got one question correct. Better luck next time.") + .playerl(FacialExpression.FRIENDLY, "Oh bother!") + .npcl(FacialExpression.FRIENDLY, "Do some more research. I'm sure other students could help you out.") + .end() + + branch.onValue(2) + .npcl(FacialExpression.FRIENDLY, "You got two questions correct. Not bad, just a little more revision needed.") + .playerl(FacialExpression.FRIENDLY, "Oh well...") + .end() + + branch.onValue(3) + .npcl(FacialExpression.FRIENDLY, "You got all the questions correct. Well done!") + .playerl(FacialExpression.FRIENDLY, "Hey! Excellent!") + .betweenStage { _, player, _, _ -> + addItemOrDrop(player, Items.TROWEL_676) + addItemOrDrop(player, Items.LEVEL_1_CERTIFICATE_691) + } + .npcl(FacialExpression.FRIENDLY, "You have now passed the Earth Sciences level 1 general exam. Here is your certificate to prove it. You also get a decent trowel to dig with. Of course, you'll want to get studying for your next exam now!") + .endWith { _, player -> + // Because of onQuestStages and onPredicate, changing quest stage before the dialogue finishes breaks the flow. + // As every stage, the onQuestStages and onPredicate functions are ran, so changing the values will switch out the stages. + if(getQuestStage(player, TheDigSite.questName) == 3) { + setQuestStage(player, TheDigSite.questName, 4) + } + openInterface(player, 440) + setInterfaceText(player, player.name, 440, 5) + } + + } + + // Fallback dialogue. + b.onPredicate { _ -> true } + .playerl(FacialExpression.FRIENDLY, "Hello.") + .npcl(FacialExpression.FRIENDLY, "Ah hello there! I am the resident lecturer on antiquities and artefacts. I also set the Earth Sciences exams.") + .playerl(FacialExpression.FRIENDLY, "Earth Sciences?") + .npcl(FacialExpression.FRIENDLY, "That is right dear, the world of 2009Scape holds many wonders beneath its surface. Students come to me to take exams so that they may join in on the archaeological dig going on just north of here.") + .playerl(FacialExpression.FRIENDLY, "So if they don't pass the exams they can't dig at all?") + .npcl(FacialExpression.FRIENDLY, "That's right! We have to make sure that students know enough to be able to dig safely and not damage the artefacts.") + .options().let { optionBuilder -> + optionBuilder.option_playerl("Can I take an exam?") + .npcl(FacialExpression.FRIENDLY, "You can if you get this letter stamped by the Curator of Varrock's museum.") + .betweenStage { _, player, _, _ -> + addItemOrDrop(player, Items.UNSTAMPED_LETTER_682) + } + .playerl(FacialExpression.FRIENDLY, "Why's that then?") + .npcl(FacialExpression.FRIENDLY, "Because he is a very knowledgeable man and employs our archaeological expert. I'm sure he knows a lot about your exploits and can judge whether you'd make a good archaeologist or not.") + .npcl(FacialExpression.FRIENDLY, "Besides, the museum contributes funds to the dig.") + .playerl(FacialExpression.FRIENDLY, "But why are you writing the letter? Shouldn't he?") + .npcl(FacialExpression.FRIENDLY, "He's also a very busy man, so I write the letters and he justs stamps them if he approves.") + .playerl(FacialExpression.FRIENDLY, "Oh, I see. I'll ask him if he'll approve me, and bring my stamped letter back here. Thanks.") + .endWith { _, player -> + if(getQuestStage(player, TheDigSite.questName) == 0) { + setQuestStage(player, TheDigSite.questName, 1) + } + } + optionBuilder.option_playerl("Interesting...") + .npcl(FacialExpression.FRIENDLY, "You could gain much with an understanding of the world below.") + .end() + } + + } +} diff --git a/Server/src/main/content/region/misthalin/digsite/dialogue/MuseumGuardDialogue.kt b/Server/src/main/content/region/misthalin/digsite/dialogue/MuseumGuardDialogue.kt new file mode 100644 index 000000000..7d72cee66 --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/dialogue/MuseumGuardDialogue.kt @@ -0,0 +1,27 @@ +package content.region.misthalin.digsite.dialogue + +import core.game.dialogue.DialoguePlugin +import core.game.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE +import org.rs09.consts.NPCs + +@Initializable +class MuseumGuardDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when(stage) { + START_DIALOGUE -> npc(FacialExpression.FRIENDLY, "Hello there! Sorry, I can't stop to talk. I'm guarding this", "workman's gate. I'm afraid you can't come through here -", "you'll need to find another way around.").also { + stage = END_DIALOGUE + } + } + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return MuseumGuardDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.MUSEUM_GUARD_5942) + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/digsite/dialogue/ResearcherDialogue.kt b/Server/src/main/content/region/misthalin/digsite/dialogue/ResearcherDialogue.kt new file mode 100644 index 000000000..43001efaf --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/dialogue/ResearcherDialogue.kt @@ -0,0 +1,41 @@ +package content.region.misthalin.digsite.dialogue + +import content.region.misthalin.digsite.quest.thedigsite.TheDigSite +import core.api.* +import core.game.dialogue.DialoguePlugin +import core.game.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE +import org.rs09.consts.NPCs + +@Initializable +class ResearcherDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + if (isQuestComplete(player, TheDigSite.questName)){ + when (stage) { + START_DIALOGUE -> npcl(FacialExpression.FRIENDLY, "Hello there. What are you doing here?").also { stage++ } + 1 -> playerl(FacialExpression.FRIENDLY, "Just looking around at the moment.").also { stage++ } + 2 -> npcl(FacialExpression.FRIENDLY, "Well, feel free to talk to me should you come across anything you can't figure out.").also { + stage = END_DIALOGUE + } + } + } else { + when (stage) { + START_DIALOGUE -> npcl(FacialExpression.FRIENDLY, "Hello there. What are you doing here?").also { stage++ } + 1 -> playerl(FacialExpression.FRIENDLY, "Just looking around at the moment.").also { stage++ } + 2 -> npcl(FacialExpression.FRIENDLY, "Well, feel free to talk to me should you come across anything you can't figure out.").also { + stage = END_DIALOGUE + } + } + } + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return ResearcherDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.RESEARCHER_4568) + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/ArchaeologicalExpertDialogue.kt b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/ArchaeologicalExpertDialogue.kt new file mode 100644 index 000000000..6672f61aa --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/ArchaeologicalExpertDialogue.kt @@ -0,0 +1,57 @@ +package content.region.misthalin.digsite.quest.thedigsite + +import core.api.* +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile +import org.rs09.consts.NPCs +import core.game.dialogue.DialoguePlugin +import core.game.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable + + +@Initializable +class ArchaeologicalExpertDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + openDialogue(player, ArchaeologicalExpertDialogueFile(), npc) + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return ArchaeologicalExpertDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.ARCHAEOLOGICAL_EXPERT_619) + } +} +class ArchaeologicalExpertDialogueFile : DialogueBuilderFile() { + override fun create(b: DialogueBuilder) { + + // Fallback dialogue. + b.onPredicate { player -> true } + .playerl(FacialExpression.FRIENDLY, "Hello. Who are you?") + .npcl(FacialExpression.FRIENDLY, "Good day to you. My name is Terry Balando, I am an expert archaeologist. I am employed by Varrock Museum to oversee all finds at this site. Anything you find must be reported to me.") + .playerl(FacialExpression.FRIENDLY, "Oh, okay. If I find anything of interest I will bring it here.") + .npcl(FacialExpression.FRIENDLY, "Can I help you at all?") + .options().let { optionBuilder -> + optionBuilder.option_playerl("I have something I need checking out.") + .npcl(FacialExpression.FRIENDLY, "Okay, give it to me and I'll have a look for you.") + .end() + optionBuilder.option_playerl("No thanks.") + .npcl("Good, let me know if you find anything unusual.") + .end() + optionBuilder.option_playerl("Can you tell me anything about the digsite?") + .npcl("Yes, indeed! I am studying the lives of the settlers. During the end of the Third Age, there used to be a great city at the site. Its inhabitants were humans, supporters of the god Saradomin. It's not recorded what happened to the community here. I suspect nobody has lived here for over a millennium!") + .end() + // I lost the letter you gave me. + + optionBuilder.option_playerl("Can you tell me more about the tools an archaeologist uses?") + .npcl(FacialExpression.FRIENDLY, "Of course! Let's see now... Trowels are vital for fine digging work, so you can be careful to not damage or disturb any artefacts. Rock picks are for splitting rocks or scraping away soil.") + .playerl(FacialExpression.FRIENDLY, "What about specimen jars and brushes?") + .npcl(FacialExpression.FRIENDLY, "Those are essential for carefully cleaning and storing smaller samples.") + .playerl(FacialExpression.FRIENDLY, "Where can I get any of these things?") + .npcl(FacialExpression.FRIENDLY, "Well, we've come into a bit more funding of late, so there should be a stock of each of them in the Exam Centre's tools cupboard. We also hand out relevant tools as students complete each level of their Earth Sciences exams.") + .playerl(FacialExpression.FRIENDLY, "Ah, okay, thanks.") + .end() + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/ArchaeologicalExpertListener.kt b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/ArchaeologicalExpertListener.kt new file mode 100644 index 000000000..cec1d1051 --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/ArchaeologicalExpertListener.kt @@ -0,0 +1,138 @@ +package content.region.misthalin.digsite.quest.thedigsite + +import content.region.misthalin.digsite.dialogue.ArchaeologistcalExpertUsedOnDialogueFile +import core.api.* +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile +import core.game.dialogue.DialogueFile +import core.game.dialogue.FacialExpression +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.node.entity.npc.NPC +import core.game.node.entity.player.Player +import core.game.node.item.Item +import org.rs09.consts.Items +import org.rs09.consts.NPCs + +class ArchaeologicalExpertListener : InteractionListener { + + + val staff = Items.ANCIENT_STAFF_4675 + val unidentifiedLiquid = Items.UNIDENTIFIED_LIQUID_702 + val nitroglycerin = Items.NITROGLYCERIN_703 + val chemicalPowder = Items.CHEMICAL_POWDER_700 + val ammoniumNitrate = Items.AMMONIUM_NITRATE_701 + val nuggets = Items.NUGGETS_680 + val needle = Items.NEEDLE_1733 + val rottenApple = Items.ROTTEN_APPLE_1984 + val brokenGlass = Items.BROKEN_GLASS_1469 + val brokenArrow = Items.BROKEN_ARROW_687 + val panningTray = Items.PANNING_TRAY_677 + val bones = Items.BONES_526 + val buttons = Items.BUTTONS_688 + val crackedSample = Items.CRACKED_SAMPLE_674 + val oldTooth = Items.OLD_TOOTH_695 + val rustySword = Items.RUSTY_SWORD_686 + val brokenStaff = Items.BROKEN_STAFF_689 + val brokenArmour = Items.BROKEN_ARMOUR_698 + val damagedArmour = Items.DAMAGED_ARMOUR_697 + val ceramicRemains = Items.CERAMIC_REMAINS_694 + val beltBuckle = Items.BELT_BUCKLE_684 + val animalSkull = Items.ANIMAL_SKULL_671 + val specialCup = Items.SPECIAL_CUP_672 + val teddy = Items.TEDDY_673 + val stoneTablet = Items.STONE_TABLET_699 + + val items = intArrayOf(staff, unidentifiedLiquid, nitroglycerin, chemicalPowder, ammoniumNitrate, nuggets, needle, rottenApple, + brokenGlass, brokenArrow, panningTray, bones, buttons, crackedSample, oldTooth, rustySword, brokenStaff, brokenArmour, + damagedArmour, ceramicRemains, beltBuckle, animalSkull, specialCup, teddy, stoneTablet) + + val archy = NPCs.ARCHAEOLOGICAL_EXPERT_619 + + + override fun defineListeners() { + onUseAnyWith(IntType.NPC, NPCs.ARCHAEOLOGICAL_EXPERT_619) { player, used, with -> + openDialogue(player, ArchaeologicalExpertListenerDialogueFile(used.id), with as NPC) + return@onUseAnyWith false + } + } +} +class ArchaeologicalExpertListenerDialogueFile(val it: Int) : DialogueBuilderFile() { + + companion object { + fun replaceAll(player: Player, originalItem: Int, newItem: Int) { + for (a in 0..amountInInventory(player, originalItem)) { + if (inInventory(player, originalItem)) { + replaceSlot(player, player.inventory.getSlot(Item(originalItem)), Item(newItem)) + } + } + } + } + + override fun create(b: DialogueBuilder) { + + b.onPredicate { _ -> it == Items.UNIDENTIFIED_LIQUID_702 } + .player(FacialExpression.THINKING, "Do you know what this is?") + .npcl(FacialExpression.WORRIED, "Where did you get this?") + .player("From one of the barrels at the digsite.") + .npcl(FacialExpression.WORRIED, "This is a VERY dangerous liquid called nitroglycerin. Be careful how you handle it. Don't drop it or it will explode!") + .endWith { _, player -> + replaceAll(player, Items.UNIDENTIFIED_LIQUID_702, Items.NITROGLYCERIN_703) + } + + b.onPredicate { _ -> it == Items.NITROGLYCERIN_703 } + .player(FacialExpression.THINKING, "Can you tell me any more about this?") + .npcl(FacialExpression.WORRIED, "Nitroglycerin! This is a dangerous substance. This is normally mixed with other chemicals to produce a potent compound.") + .npcl(FacialExpression.WORRIED, "Be sure not to drop it! That stuff is highly volatile...") + .end() + + b.onPredicate { _ -> it == Items.CHEMICAL_POWDER_700 } + .player(FacialExpression.THINKING, "Do you know what this powder is?") + .npcl(FacialExpression.WORRIED, "Really, you do find the most unusual items. I know what this is - it's a strong chemical called ammonium nitrate. Why you want this I'll never know...") + .endWith { _, player -> + replaceAll(player, Items.CHEMICAL_POWDER_700, Items.AMMONIUM_NITRATE_701) + } + + // b.onPredicate { _ -> it == Items.AMMONIUM_NITRATE_701 } From youtu.be/mKTBPLdxRSY at 9:57, once ammonium nitrate is identified, it becomes not of any archaeological significance. + + b.onPredicate { _ -> it == Items.ANCIENT_TALISMAN_681 } + .npcl(FacialExpression.FRIENDLY, "Unusual... This object doesn't appear right...") + .npcl(FacialExpression.FRIENDLY, "Hmmm...") + .npcl(FacialExpression.FRIENDLY, "I wonder... Let me check my guide... Could it be? Surely not!") + .npcl(FacialExpression.FRIENDLY, "From the markings on it, it seems to be a ceremonial ornament to a god named...") + .npcl(FacialExpression.FRIENDLY, "...Zaros? I haven't heard much about him before. This is a great discovery; we know very little of the ancient gods that people worshipped.") + .npcl(FacialExpression.FRIENDLY, "There is some strange writing embossed upon it - it says, 'Zaros will return and wreak his vengeance upon Zamorak the pretender.'") + .npcl(FacialExpression.FRIENDLY, "I wonder what it means by that. Some silly superstition, probably.") + .npcl(FacialExpression.FRIENDLY, "Still, I wonder what this is doing around here. I'll tell you what; as you have found this, I will allow you to use the private dig shafts.") + .npcl(FacialExpression.FRIENDLY, "You obviously have a keen eye. Take this letter and give it to one of the workmen, and they will allow you to use them.") + .endWith { _, player -> + if (removeItem(player, Items.ANCIENT_TALISMAN_681)) { + addItemOrDrop(player, Items.INVITATION_LETTER_696) + } + if(getQuestStage(player, TheDigSite.questName) == 6) { + setQuestStage(player, TheDigSite.questName, 7) + } + } + + b.onPredicate { _ -> it == Items.STONE_TABLET_699 } + .playerl(FacialExpression.FRIENDLY, "I found this in a hidden cavern beneath the site.") + .npcl(FacialExpression.FRIENDLY, "Incredible!") + .playerl(FacialExpression.FRIENDLY, "There is an altar down there. The place is crawling with skeletons!") + .npcl(FacialExpression.FRIENDLY, "Yuck! This is an amazing discovery! All this while we were convinced that no other race had lived here.") + .npcl("It seems the followers of Saradomin have tried to cover up the evidence of this Zaros altar. This whole city must have been built over it!") + .npcl("Thanks for your help; your sharp eyes have spotted what many have missed. Here, take this gold as your reward.") + .item(Items.GOLD_BAR_2357, "The expert gives you two gold bars as payment.") + .endWith { _, player -> + if (removeItem(player, Items.STONE_TABLET_699)) { + if(getQuestStage(player, TheDigSite.questName) == 11) { + finishQuest(player, TheDigSite.questName) + } + } + } + + // Fallback when item isn't recognizable. + b.onPredicate { _ -> true } + .npcl(FacialExpression.FRIENDLY, "I don't think that has any archaeological significance.") + .end() + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/DigsiteWorkmanDialogue.kt b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/DigsiteWorkmanDialogue.kt new file mode 100644 index 000000000..054541082 --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/DigsiteWorkmanDialogue.kt @@ -0,0 +1,72 @@ +package content.region.misthalin.digsite.quest.thedigsite + +import core.api.* +import core.game.dialogue.* +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.node.entity.npc.NPC +import core.game.node.entity.player.Player +import core.plugin.Initializable +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE +import org.rs09.consts.Items +import org.rs09.consts.NPCs + +@Initializable +class DigsiteWorkmanDialogue (player: Player? = null) : DialoguePlugin(player), InteractionListener { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + npc!! + when(stage) { + START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hello!").also { stage++ } + 1 -> npcl(FacialExpression.FRIENDLY, "Why hello there! What can I do you for?").also { stage++ } + 2 -> showTopics( + Topic(FacialExpression.FRIENDLY, "What do you do here?", 3), + Topic(FacialExpression.FRIENDLY, "I'm not sure.", 6), + Topic(FacialExpression.FRIENDLY, "Can I dig around here?", 7), + ) + 3 -> npcl(FacialExpression.FRIENDLY, "Well, my job involved digging for finds, cleaning them and transporting them for identification.").also { stage++ } + 4 -> playerl(FacialExpression.FRIENDLY, "Sounds interesting.").also { stage++ } + 5 -> npcl(FacialExpression.FRIENDLY, "I find it very interesting and very rewarding. So glad to see you're taking an interest in the digsite. Hope to see you out here digging sometime!").also { + stage = END_DIALOGUE + } + 6 -> npcl(FacialExpression.FRIENDLY, "Well, let me know when you are and I'll do my very best to help you!").also { + stage = END_DIALOGUE + } + 7 -> npcl(FacialExpression.FRIENDLY, "You can only use a site you have the appropriate exam level for.").also { stage++ } + 8 -> playerl(FacialExpression.FRIENDLY, "Appropriate exam level?").also { stage++ } + 9 -> npcl(FacialExpression.FRIENDLY, "Oh yes, you need to have been trained in the various techniques before you can be allowed to dig for artefacts.").also { stage++ } + 10 -> playerl(FacialExpression.FRIENDLY, "Ah yes, I understand.").also { + stage = END_DIALOGUE + } + } + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return DigsiteWorkmanDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.DIGSITE_WORKMAN_613, NPCs.DIGSITE_WORKMAN_4564, NPCs.DIGSITE_WORKMAN_4565/*, NPCs.DIGSITE_WORKMAN_5958*/) + } + + override fun defineListeners() { + onUseWith(IntType.NPC, Items.INVITATION_LETTER_696, NPCs.DIGSITE_WORKMAN_613, NPCs.DIGSITE_WORKMAN_4564, NPCs.DIGSITE_WORKMAN_4565) { player, used, with -> + openDialogue(player, DigsiteWorkmanDialogueFile(), with as NPC) + return@onUseWith false + } + } +} +class DigsiteWorkmanDialogueFile : DialogueBuilderFile() { + override fun create(b: DialogueBuilder) { + + // Fallback dialogue. + b.onPredicate { _ -> true } + .playerl(FacialExpression.FRIENDLY, "Here, have a look at this...") + .npc(FacialExpression.FRIENDLY, "I give permission... blah de blah... err. Okay, that's all in", "order, you may use the mineshaft now. I'll hang onto", "this scroll, shall I?") + .endWith { _, player -> + removeItem(player, Items.INVITATION_LETTER_696) + if(getQuestStage(player, TheDigSite.questName) == 7) { + setQuestStage(player, TheDigSite.questName, 8) + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/DougDeepingDialogue.kt b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/DougDeepingDialogue.kt new file mode 100644 index 000000000..07564536f --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/DougDeepingDialogue.kt @@ -0,0 +1,69 @@ +package content.region.misthalin.digsite.quest.thedigsite + +import core.api.* +import core.game.dialogue.* +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.Items +import org.rs09.consts.NPCs + +@Initializable +class DougDeepingDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + openDialogue(player, DougDeepingDialogueFile(), npc) + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return DougDeepingDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.DOUG_DEEPING_614) + } +} + +class DougDeepingDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + b.onPredicate { _ -> true } + .playerl(FacialExpression.FRIENDLY, "Hello.") + .npcl(FacialExpression.FRIENDLY, "Well, well... I have a visitor. What are you doing here?") + .options().let { optionBuilder -> + optionBuilder.option_playerl("I have been invited to research here ") + .npcl(FacialExpression.FRIENDLY, "Indeed, you must be someone special to be allowed down here.") + .options().let { optionBuilder -> + optionBuilder.option_playerl("Do you know where to find a specimen jar?") + .npcl("Hmmm, let me think... Nope, can't help you there, I'm afraid. Try asking at the Exam Centre.") + .end() + optionBuilder.option_playerl("I have things to do...") + .npcl("Of course, don't let me keep you.") + .end() + } + optionBuilder.option_playerl("I'm not really sure.") + .npcl("A miner without a clue - how funny!") + .end() + optionBuilder.option_playerl("I'm here to get rich, rich, rich!") + .npcl("Oh, well, don't forget that wealth and riches aren't everything.") + .end() + optionBuilder.option_playerl("How could I move a large pile of rocks?") + .npcl("There used to be this chap that worked in the other shaft. He was working on an explosive chemical mixture to be used for clearing blocked areas underground.") + .npcl("He left in a hurry one day. Apparently, something in the shaft scared him to death, but he didn't say what.") + .playerl(FacialExpression.FRIENDLY, "Oh?") + .npcl(FacialExpression.FRIENDLY, "Rumour has it he'd been writing a book on his chemical mixture. I'm not sure what was in it, but he left in such a hurry, he probably left something behind in the other dig shaft.") + .npcl("In fact, I still have a chest key he gave me to look after - perhaps it's more useful to you.") + .branch { player -> + if (inInventory(player,Items.CHEST_KEY_709)) { 0 } else { + addItemOrDrop(player, Items.CHEST_KEY_709) + 1 + } + } + .let { branch -> + branch.onValue(0) + .playerl("It's okay, I already have one.") + .end() + branch.onValue(1) + .iteml(Items.CHEST_KEY_709, "Doug hands you a key.") + .end() + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/PanningGuideDialogue.kt b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/PanningGuideDialogue.kt new file mode 100644 index 000000000..c9a7d38eb --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/PanningGuideDialogue.kt @@ -0,0 +1,112 @@ +package content.region.misthalin.digsite.quest.thedigsite + +import core.api.* +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile +import core.game.dialogue.DialoguePlugin +import core.game.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.Items +import org.rs09.consts.NPCs + +@Initializable +class PanningGuideDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + openDialogue(player, PanningGuideDialogueFile(), npc) + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return PanningGuideDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.PANNING_GUIDE_620) + } +} +class PanningGuideDialogueFile : DialogueBuilderFile() { + override fun create(b: DialogueBuilder) { + b.onPredicate { getAttribute(player!!, TheDigSite.attributePanningGuideTea, false) } + .playerl(FacialExpression.FRIENDLY, "Hello, who are you?") + .npcl(FacialExpression.FRIENDLY, "Hello, I am the panning guide. I'm here to teach you how to pan for gold.") + .playerl(FacialExpression.FRIENDLY, "Excellent!") + .npcl(FacialExpression.FRIENDLY, "Let me explain how panning works. First, you need a panning tray. Use the tray in the panning points in the water and then search your tray.") + .npcl("If you find any gold, take it to the archaeological expert up in the museum storage facility. He will calculate its value for you.") + .options() + .let { optionBuilder -> + optionBuilder.option_playerl("Can you tell me more about the tools an archaeologist uses?") + .npcl(FacialExpression.FRIENDLY, "Of course! Let's see now... Rock picks are for splitting rocks or scraping away soil; you can get one from a cupboard in the Exam Centre.") + .playerl(FacialExpression.FRIENDLY, "What about sample jars?") + .npcl(FacialExpression.FRIENDLY, "I think you'll find them scattered about pretty much everywhere, but I know you can get one from a cupboard somewhere in the Exam Centre, just like the rock pick!") + .playerl(FacialExpression.FRIENDLY, "Okay, what about a specimen brush?") + .npcl(FacialExpression.FRIENDLY, "We have a bit of a shortage of those at the moment. You could try borrowing one from a workman on the site... but I don't think they'd give it willingly.") + .playerl(FacialExpression.FRIENDLY, "Sounds like I'll need to be sneaky to get one of those, then... Okay - trowel?") + .npcl(FacialExpression.FRIENDLY, "Ahh... that you must earn by passing your exams! The examiner holds those.") + .playerl(FacialExpression.FRIENDLY, "Anything else?") + .npcl(FacialExpression.FRIENDLY, "If you need something identified or are not sure about something, give it to the archaeological expert in the Exam Centre.") + .playerl(FacialExpression.FRIENDLY, "Ahh, ok thanks.") + .end() + optionBuilder.option_playerl("Thank you!") + .end() + } + + b.onPredicate { _ -> true } + .playerl(FacialExpression.FRIENDLY, "Hello, who are you?") + .npcl(FacialExpression.FRIENDLY, "Hello, I am the panning guide. I teach students how to pan in these waters. They're not permitted to do so until after they've had training and, of course, they must be invited to pan here too.") + .playerl(FacialExpression.FRIENDLY, "So, how do I become invited?") + .npcl(FacialExpression.FRIENDLY, "I'm not supposed to let people pan here unless they have permission. Mind you, I could let you have a go if you're willing to do me a favour...") + .playerl(FacialExpression.FRIENDLY, "What's that?") + .npcl(FacialExpression.FRIENDLY, "Well, to be honest, what I would really like is a nice cup of tea!") + .branch { player -> if (inInventory(player, Items.CUP_OF_TEA_712)) { 1 } else { 0 } } + .let { branch -> + branch.onValue(0) + .playerl(FacialExpression.FRIENDLY, "Tea?") + .npcl(FacialExpression.FRIENDLY, "Absolutely, I'm parched!") + .npcl(FacialExpression.FRIENDLY, "If you could bring me one of those, I would be more than willing to let you pan here. I usually get some from the main campus building, but I'm busy at the moment.") + .end() + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "I've some here that you can have.") + .npcl(FacialExpression.FRIENDLY, "Ah! Lovely! You can't beat a good cuppa! You're free to pan all you want.") + .endWith { _, player -> + if(removeItem(player, Items.CUP_OF_TEA_712)) { + setAttribute(player, TheDigSite.attributePanningGuideTea, true) + } + } + } + } +} +class PanningGuideCannotPanDialogueFile : DialogueBuilderFile() { + override fun create(b: DialogueBuilder) { + b.onPredicate { _ -> true } + .npcl(FacialExpression.ANNOYED, "Hey! You can't pan yet!") + .playerl(FacialExpression.THINKING, "Why not?") + .npcl("We do not allow the uninvited to pan here.") + .options() + .let { optionBuilder -> + optionBuilder.option_playerl("OK, forget it.") + .end() + return@let optionBuilder + } + .option_playerl("So how do I become invited then?") + .npcl(FacialExpression.FRIENDLY, "I'm not supposed to let people pan here unless they have permission. Mind you, I could let you have a go if you're willing to do me a favour.") + .playerl(FacialExpression.FRIENDLY, "What's that?") + .npcl(FacialExpression.FRIENDLY, "Well, to be honest, what I would really like is a nice cup of tea!") + .branch { player -> if (inInventory(player, Items.CUP_OF_TEA_712)) { 1 } else { 0 } } + .let { branch -> + branch.onValue(0) + .playerl(FacialExpression.FRIENDLY, "Tea?") + .npcl(FacialExpression.FRIENDLY, "Absolutely, I'm parched!") + .npcl(FacialExpression.FRIENDLY, "If you could bring me one of those, I would be more than willing to let you pan here. I usually get some from the main campus building, but I'm busy at the moment.") + .end() + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "I've some here that you can have.") + .betweenStage { _, player, _, _ -> + if(removeItem(player, Items.CUP_OF_TEA_712)) { + setAttribute(player, TheDigSite.attributePanningGuideTea, true) + } + } + .npcl(FacialExpression.FRIENDLY, "Ah! Lovely! You can't beat a good cuppa! You're free to pan all you want.") + .end() + } + + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/StudentsDialogue.kt b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/StudentsDialogue.kt new file mode 100644 index 000000000..7e0764190 --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/StudentsDialogue.kt @@ -0,0 +1,343 @@ +package content.region.misthalin.digsite.quest.thedigsite + +import core.api.* +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile +import core.game.dialogue.DialoguePlugin +import core.game.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.Items +import org.rs09.consts.NPCs + +@Initializable +class StudentGreenDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + openDialogue(player, StudentGreenDialogueFile(), npc) + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return StudentGreenDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.STUDENT_615) + } +} +class StudentGreenDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + + + b.onQuestStages(TheDigSite.questName, 6,7,8,9,10,11,12,13,100) + .npcl(FacialExpression.FRIENDLY, " Oh, hi again. News of your find has spread fast; you are quite famous around here now.") + + b.onQuestStages(TheDigSite.questName, 5) + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "How's it going?") + .playerl(FacialExpression.FRIENDLY, "I need more help with the exam.") + .npcl(FacialExpression.FRIENDLY, "Well, okay, this is what I have learned since I last spoke to you...") + .npcl(FacialExpression.FRIENDLY, "Specimen brush use: Brush carefully and slowly using short strokes.") + .playerl(FacialExpression.FRIENDLY, "Okay, I'll remember that. Thanks for all your help.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentGreenExam3ObtainAnswer, true) + } + + b.onQuestStages(TheDigSite.questName, 4) + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "How's it going?") + .playerl(FacialExpression.FRIENDLY, "I need more help with the exam.") + .npcl(FacialExpression.FRIENDLY, "Well, okay, this is what I have learned since I last spoke to you...") + .npcl(FacialExpression.FRIENDLY, "Correct rock pick usage: Always handle with care; strike the rock cleanly on its cleaving point.") + .playerl(FacialExpression.FRIENDLY, "Okay, I'll remember that.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentGreenExam2ObtainAnswer, true) + } + b.onPredicate { player -> getQuestStage(player, TheDigSite.questName) == 3 && getAttribute(player, TheDigSite.attributeStudentGreenExam1ObtainAnswer, false)} + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "How's it going?") + .playerl(FacialExpression.FRIENDLY, "I need more help with the exam.") + .npcl(FacialExpression.FRIENDLY, "Well, okay, this is what I have learned since I last spoke to you...") + .npcl(FacialExpression.FRIENDLY, "The study of Earth Sciences is: The study of the earth, its contents and history.") + .playerl(FacialExpression.FRIENDLY, "Okay, I'll remember that.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentGreenExam1ObtainAnswer, true) + } + b.onPredicate { player -> getQuestStage(player, TheDigSite.questName) == 3 && getAttribute(player, TheDigSite.attributeStudentGreenExam1Talked, false)} + .branch { player -> + return@branch if (inInventory(player, Items.ANIMAL_SKULL_671)) { 1 } else { 0 } + }.let{ branch -> + branch.onValue(0) + .playerl(FacialExpression.FRIENDLY, "Hello there. How's the study going?") + .npcl(FacialExpression.FRIENDLY, "Very well, thanks. Have you found my animal skull yet?") + .playerl(FacialExpression.FRIENDLY, "No, sorry, not yet.") + .npcl(FacialExpression.FRIENDLY, "Oh well, I am sure it's been picked up. Couldn't you try looking through some pockets?") + .end() + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "Hello there. How's the study going?") + .npcl(FacialExpression.FRIENDLY, "Very well, thanks. Have you found my animal skull yet?") + .betweenStage { _, player, _, _ -> + if (inInventory(player, Items.ANIMAL_SKULL_671)){ + removeItem(player, Items.ANIMAL_SKULL_671) + } + } + .npcl("Oh wow! You've found it! Thank you so much. I'll be glad to tell you what I know about the exam. The study of Earth Sciences is: The study of the earth, its contents and history.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentGreenExam1ObtainAnswer, true) + } + return@let branch + } + b.onQuestStages(TheDigSite.questName, 3) + .playerl(FacialExpression.FRIENDLY, "Hello there. Can you help me with the Earth Sciences exams at all?") + .npcl(FacialExpression.FRIENDLY, "Well... Maybe I will if you help me with something.") + .playerl(FacialExpression.FRIENDLY, "What's that?") + .npcl(FacialExpression.FRIENDLY, "I have lost my recent good find.") + .playerl(FacialExpression.FRIENDLY, "What does it look like?") + .npcl(FacialExpression.FRIENDLY, "Err... Like an animal skull!") + .playerl(FacialExpression.FRIENDLY, "Well, that's not too helpful, there are lots of those around here. Can you remember where you last had it?") + .npcl(FacialExpression.FRIENDLY, "It was around here for sure. Maybe one of the workmen picked it up?") + .playerl(FacialExpression.FRIENDLY, "Okay, I'll have a look for you.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentGreenExam1Talked, true) + } + b.onPredicate { _ -> true } + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "Oh, hi. I'm studying hard for an exam.") + .playerl(FacialExpression.FRIENDLY, "What exam is that?") + .npcl(FacialExpression.FRIENDLY, "It's the Earth Sciences exam.") + .playerl(FacialExpression.FRIENDLY, "Interesting....") + .end() + } +} + + +@Initializable +class StudentPurpleDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + openDialogue(player, StudentPurpleDialogueFile(), npc) + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return StudentPurpleDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.STUDENT_617) + } +} +class StudentPurpleDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + + b.onPredicate { player -> getQuestStage(player, TheDigSite.questName) == 5 && getAttribute(player, TheDigSite.attributeStudentPurpleExam3ObtainAnswer, false)} + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "How's it going?") + .playerl(FacialExpression.FRIENDLY, "I am stuck on some more exam questions.") + .npcl(FacialExpression.FRIENDLY, "Okay, I'll tell you my latest notes...") + .npcl(FacialExpression.FRIENDLY, "Sample preparation: Samples cleaned, and carried only in specimen jars.") + .playerl(FacialExpression.FRIENDLY, "Great, thanks for your advice.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentPurpleExam3ObtainAnswer, true) + } + + b.onPredicate { player -> getQuestStage(player, TheDigSite.questName) == 5 && getAttribute(player, TheDigSite.attributeStudentPurpleExam3Talked, false)} + .branch { player -> + return@branch if (inInventory(player, Items.OPAL_1609) || inInventory(player, Items.UNCUT_OPAL_1625)) { 1 } else { 0 } + }.let{ branch -> + branch.onValue(0) + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "Oh, hi again. Did you bring me the opal?") + .playerl(FacialExpression.FRIENDLY, "I haven't found one yet.") + .npcl(FacialExpression.FRIENDLY, "Oh, well, tell me when you do. Remember that they can be found around the site; perhaps try panning the river.") + .end() + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "Oh, hi again. Did you bring me the opal?") + .betweenStage { _, player, _, _ -> + if (inInventory(player, Items.UNCUT_OPAL_1625)){ + removeItem(player, Items.UNCUT_OPAL_1625) + return@betweenStage + } + if (inInventory(player, Items.OPAL_1609)){ + removeItem(player, Items.OPAL_1609) + return@betweenStage + } + } + .playerl(FacialExpression.FRIENDLY, "Would an opal look like this by any chance?") + .npcl(FacialExpression.FRIENDLY, "Wow, great, you've found one. This will look beautiful set in my necklace. Thanks for that; now I'll tell you what I know... Sample preparation: Samples cleaned, and carried only in specimen jars.") + .playerl(FacialExpression.FRIENDLY, "Great, thanks for your advice.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentPurpleExam3ObtainAnswer, true) + } + return@let branch + } + + b.onQuestStages(TheDigSite.questName, 5) + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "What, you want more help?") + .playerl(FacialExpression.FRIENDLY, "Err... Yes please!") + .npcl(FacialExpression.FRIENDLY, "Well... it's going to cost you...") + .playerl(FacialExpression.FRIENDLY, "Oh, well how much?") + .npcl(FacialExpression.FRIENDLY, "I'll tell you what I would like: a precious stone. I don't find many of them. My favorite are opals; they are beautiful. Just like me! Tee hee hee!") + .playerl(FacialExpression.FRIENDLY, "Err... OK I'll see what I can do, but I'm not sure where I'd get one.") + .npcl(FacialExpression.FRIENDLY, "Well, I have seen people get them from panning occasionally.") + .playerl(FacialExpression.FRIENDLY, "OK, I'll see what I can turn up for you.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentPurpleExam3Talked, true) + } + + b.onQuestStages(TheDigSite.questName, 4) + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "How's it going?") + .playerl(FacialExpression.FRIENDLY, "I am stuck on some more exam questions.") + .npcl(FacialExpression.FRIENDLY, "Okay, I'll tell you my latest notes...") + .npcl(FacialExpression.FRIENDLY, "Finds handling: Finds must be carefully handled.") + .playerl(FacialExpression.FRIENDLY, "Great, thanks for your advice.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentPurpleExam2ObtainAnswer, true) + } + b.onPredicate { player -> getQuestStage(player, TheDigSite.questName) == 3 && getAttribute(player, TheDigSite.attributeStudentPurpleExam1ObtainAnswer, false)} + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "How's it going?") + .playerl(FacialExpression.FRIENDLY, "I am stuck on some more exam questions.") + .npcl(FacialExpression.FRIENDLY, "Okay, I'll tell you my latest notes...") + .npcl(FacialExpression.FRIENDLY, "The proper health and safety points are: Leather gloves and boots to be warn at all times; proper tools must be used.") + .playerl(FacialExpression.FRIENDLY, "Great, thanks for your advice.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentPurpleExam1ObtainAnswer, true) + } + b.onPredicate { player -> getQuestStage(player, TheDigSite.questName) == 3 && getAttribute(player, TheDigSite.attributeStudentPurpleExam1Talked, false)} + .branch { player -> + return@branch if (inInventory(player, Items.TEDDY_673)) { 1 } else { 0 } + }.let{ branch -> + branch.onValue(0) + .npcl(FacialExpression.FRIENDLY, "Very well thanks. Have you found my lucky mascot yet?") + .playerl(FacialExpression.FRIENDLY, "No sorry, not yet.") + .npcl(FacialExpression.FRIENDLY, "I'm sure it's just outside the site somewhere...") + .end() + branch.onValue(1) + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .betweenStage { _, player, _, _ -> + if (inInventory(player, Items.TEDDY_673)){ + removeItem(player, Items.TEDDY_673) + } + } + .playerl(FacialExpression.FRIENDLY, "Guess what I found.") + .npcl(FacialExpression.FRIENDLY, "Hey! My lucky mascot! Thanks ever so much. Let me help you with those questions now.") + .npcl(FacialExpression.FRIENDLY, "The proper health and safety points are: Leather gloves and boots to be warn at all times; proper tools must be used.") + .playerl(FacialExpression.FRIENDLY, "Great, thanks for your advice.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentPurpleExam1ObtainAnswer, true) + } + return@let branch + } + b.onQuestStages(TheDigSite.questName, 3) + .playerl(FacialExpression.FRIENDLY, "Hello there. Can you help me with the Earth Sciences exams at all?") + .npcl(FacialExpression.FRIENDLY, "I can if you help me...") + .playerl(FacialExpression.FRIENDLY, "How can I do that?") + .npcl(FacialExpression.FRIENDLY, "I have lost my teddy bear. He was my lucky mascot.") + .playerl(FacialExpression.FRIENDLY, "Do you know where you dropped him?") + .npcl(FacialExpression.FRIENDLY, "Well, I was doing a lot of walking that day... Oh yes, that's right - a few of us were studying that funny looking relic in the centre of the campus. Maybe I lost my lucky mascot around there, perhaps in a bush?") + .playerl(FacialExpression.FRIENDLY, "Leave it to me, I'll find it.") + .npcl(FacialExpression.FRIENDLY, "Oh, great! Thanks!") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentPurpleExam1Talked, true) + } + b.onPredicate { _ -> true } + .playerl("Hello there.") + .npcl("Hi there. I'm studying for the Earth Sciences exam.") + .playerl("Interesting... This exam seems to be a popular one!") + } +} + + +@Initializable +class StudentBrownDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + openDialogue(player, StudentBrownDialogueFile(), npc) + return true + } + override fun newInstance(player: Player): DialoguePlugin { + return StudentBrownDialogue(player) + } + override fun getIds(): IntArray { + return intArrayOf(NPCs.STUDENT_616) + } +} +class StudentBrownDialogueFile : DialogueBuilderFile() { + + override fun create(b: DialogueBuilder) { + + b.onQuestStages(TheDigSite.questName, 5) + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "How's it going?") + .playerl(FacialExpression.FRIENDLY, "There are more exam questions I'm stuck on.") + .npcl(FacialExpression.FRIENDLY, "Hey, I'll tell you what I've learned. That may help.") + .npcl(FacialExpression.FRIENDLY, "The proper technique for handling bones is: Handle bones carefully and keep them away from other samples.") + .playerl(FacialExpression.FRIENDLY, "Thanks for the information.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentBrownExam3ObtainAnswer, true) + } + + b.onQuestStages(TheDigSite.questName, 4) + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "How's it going?") + .playerl(FacialExpression.FRIENDLY, "There are more exam questions I'm stuck on.") + .npcl(FacialExpression.FRIENDLY, "Hey, I'll tell you what I've learned. That may help.") + .npcl(FacialExpression.FRIENDLY, "Correct sample transportation: Samples taken in rough form; kept only in sealed containers.") + .playerl(FacialExpression.FRIENDLY, "Thanks for the information.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentBrownExam2ObtainAnswer, true) + } + b.onPredicate { player -> getQuestStage(player, TheDigSite.questName) == 3 && getAttribute(player, TheDigSite.attributeStudentBrownExam1ObtainAnswer, false)} + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "How's it going?") + .playerl(FacialExpression.FRIENDLY, "There are more exam questions I'm stuck on.") + .npcl(FacialExpression.FRIENDLY, "Hey, I'll tell you what I've learned. That may help.") + .npcl(FacialExpression.FRIENDLY, "Correct sample transportation: Samples taken in rough form; kept only in sealed containers.") + .playerl(FacialExpression.FRIENDLY, "Thanks for the information.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentBrownExam1ObtainAnswer, true) + } + b.onPredicate { player -> getQuestStage(player, TheDigSite.questName) == 3 && getAttribute(player, TheDigSite.attributeStudentBrownExam1Talked, false)} + .playerl(FacialExpression.FRIENDLY, "Hello there. How's the study going?") + .npcl(FacialExpression.FRIENDLY, "I'm getting there. Have you found my special cup yet?") + .branch { player -> + if (inInventory(player, Items.SPECIAL_CUP_672)){ + removeItem(player, Items.SPECIAL_CUP_672) + return@branch 1 + } else { + return@branch 0 + } + }.let{ branch -> + branch.onValue(0) + .playerl(FacialExpression.FRIENDLY, "No, sorry, not yet.") + .npcl(FacialExpression.FRIENDLY, "Oh dear, I hope it didn't fall into the river. I might never find it again.") + .end() + branch.onValue(1) + .npcl("Oh wow! You've found it! Thank you so much. I'll be glad to tell you what I know about the exam. The study of Earth Sciences is: The study of the earth, its contents and history.") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentBrownExam1ObtainAnswer, true) + } + return@let branch + } + b.onQuestStages(TheDigSite.questName, 3) + .playerl(FacialExpression.FRIENDLY, "Hello there. Can you help me with the Earth Sciences exams at all?") + .npcl(FacialExpression.FRIENDLY, "I can't do anything unless I find my special cup.") + .playerl(FacialExpression.FRIENDLY, "Your what?") + .npcl(FacialExpression.FRIENDLY, "My special cup. I won it for a particularly good find last month.") + .playerl(FacialExpression.FRIENDLY, "Oh, right. So if I find it, you'll help me?") + .npcl(FacialExpression.FRIENDLY, "I sure will!") + .playerl(FacialExpression.FRIENDLY, "Any ideas where it may be?") + .npcl(FacialExpression.FRIENDLY, "All I remember is that I was working near the panning area when I lost it.") + .playerl(FacialExpression.FRIENDLY, "Okay, I'll see what I can do.") + .npcl(FacialExpression.FRIENDLY, "Yeah, maybe the panning guide saw it? I hope I didn't lose it in the water!") + .endWith { _, player -> + setAttribute(player, TheDigSite.attributeStudentBrownExam1Talked, true) + } + b.onPredicate { _ -> true } + .playerl(FacialExpression.FRIENDLY, "Hello there.") + .npcl(FacialExpression.FRIENDLY, "Hello there. As you can see, I am a student.") + .playerl(FacialExpression.FRIENDLY, "What are you doing here?") + .npcl(FacialExpression.FRIENDLY, "I'm studying for the Earth Sciences exam.") + .playerl(FacialExpression.FRIENDLY, "Interesting... Perhaps I should study for it as well.") + } +} diff --git a/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/TheDigSite.kt b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/TheDigSite.kt new file mode 100644 index 000000000..a368c031d --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/TheDigSite.kt @@ -0,0 +1,391 @@ +package content.region.misthalin.digsite.quest.thedigsite + +import content.region.morytania.quest.creatureoffenkenstrain.CreatureOfFenkenstrain +import core.api.* +import core.game.node.entity.player.Player +import core.game.node.entity.player.link.quest.Quest +import core.game.node.entity.skill.Skills +import core.plugin.Initializable +import org.rs09.consts.Items + +/** + * The Dig Site Quest + * Funny enough, the crossed out quest log doesn't change into the past tense like other quests do. + * I guess this quest is so old, no one was bothered to change the tenses. + * This is working off the low quality quest log in 2008, which is very much different from the current quest log. + + * 1 - Speak to an examiner to start the quest + * 2 - Talked to the curator at Varrock + * 3 - Passed the signed letter back to the examiner + * 4 - Passed Level 1 Exam + * 5 - Passed Level 2 Exam + * 6 - Passed Level 3 Exam + * 7 - Found ANCIENT_TALISMAN_681 to impress expert + * 8 - Gave expert's recommendation letter to a workman + * 9 - Went down any of the digshafts + * 10 - Talked to Doug Deeping to get a key to open a chest + * 11 - Covered rocks with explosives + * 12 - Blew up the rocks (after this, climbing down a digshaft will end up in a different area) + * 100 - Talked to expert after showing him the STONE_TABLET_699 + */ +@Initializable +class TheDigSite : Quest("The Dig Site", 47, 46, 2, 131, 0, 1, 9) { + companion object { + const val questName = "The Dig Site" + const val attributeStudentGreenExam1Talked = "/save:quest:thedigsite-studentgreenexam1talked" + const val attributeStudentGreenExam1ObtainAnswer = "/save:quest:thedigsite-studentgreenexam1obtainanswer" + const val attributeStudentPurpleExam1Talked = "/save:quest:thedigsite-studentpurpleexam1talked" + const val attributeStudentPurpleExam1ObtainAnswer = "/save:quest:thedigsite-studentpurplexam1obtainanswer" + const val attributeStudentBrownExam1Talked = "/save:quest:thedigsite-studentbrownexam1talked" + const val attributeStudentBrownExam1ObtainAnswer = "/save:quest:thedigsite-studentbrownexam1obtainanswer" + const val attributePanningGuideTea = "/save:quest:thedigsite-panningguidetea" + const val attributeStudentGreenExam2ObtainAnswer = "/save:quest:thedigsite-studentgreenexam2obtainanswer" + const val attributeStudentPurpleExam2ObtainAnswer = "/save:quest:thedigsite-studentpurplexam2obtainanswer" + const val attributeStudentBrownExam2ObtainAnswer = "/save:quest:thedigsite-studentbrownexam2obtainanswer" + const val attributeStudentGreenExam3ObtainAnswer = "/save:quest:thedigsite-studentgreenexam3obtainanswer" + const val attributeStudentPurpleExam3ObtainAnswer = "/save:quest:thedigsite-studentpurplexam3obtainanswer" + const val attributeStudentPurpleExam3Talked = "/save:quest:thedigsite-studentpurpleexam3talked" + const val attributeStudentBrownExam3ObtainAnswer = "/save:quest:thedigsite-studentbrownexam3obtainanswer" + + const val attributeRopeNorthEastWinch = "/save:quest:thedigsite-ropenortheastwinch" + const val attributeRopeWestWinch = "/save:quest:thedigsite-ropewestwinch" + + const val attributeFirstQuestion = "quest:thedigsite-firstquestion" + const val attributeSecondQuestion = "quest:thedigsite-secondquestion" + const val attributeThirdQuestion = "quest:thedigsite-thirdquestion" + + const val barrelVarbit = 2547 + const val tabletVarbit = 2548 + } + + override fun reset(player: Player) { + removeAttribute(player, attributeStudentGreenExam1Talked) + removeAttribute(player, attributeStudentGreenExam1ObtainAnswer) + removeAttribute(player, attributeStudentPurpleExam1Talked) + removeAttribute(player, attributeStudentPurpleExam1ObtainAnswer) + removeAttribute(player, attributeStudentBrownExam1Talked) + removeAttribute(player, attributeStudentBrownExam1ObtainAnswer) + removeAttribute(player, attributePanningGuideTea) + removeAttribute(player, attributeStudentGreenExam2ObtainAnswer) + removeAttribute(player, attributeStudentPurpleExam2ObtainAnswer) + removeAttribute(player, attributeStudentBrownExam2ObtainAnswer) + removeAttribute(player, attributeStudentGreenExam3ObtainAnswer) + removeAttribute(player, attributeStudentPurpleExam3Talked) + removeAttribute(player, attributeStudentPurpleExam3ObtainAnswer) + removeAttribute(player, attributeStudentBrownExam3ObtainAnswer) + + removeAttribute(player, attributeRopeNorthEastWinch) + removeAttribute(player, attributeRopeWestWinch) + } + + override fun drawJournal(player: Player, stage: Int) { + super.drawJournal(player, stage) + var line = 11 + var stage = getStage(player) + + var started = getQuestStage(player, questName) > 0 + + if(!started){ + line++ + line(player, "I can start this quest by speaking to the !!Examiner?? at the", line++, false) + line(player, "!!Digsite Exam Centre.??", line++, false) + line(player, "I need the following skill levels:", line++, false) + line(player, "Level 10 Agility", line++, hasLevelStat(player, Skills.AGILITY, 10)) + line(player, "Level 10 Herblore", line++, hasLevelStat(player, Skills.HERBLORE, 10)) + line(player, "Level 25 Thieving", line++, hasLevelStat(player, Skills.THIEVING, 25)) + } else { + line(player, "I should speak to an examiner about taking Earth Science", line++, true) + line(player, "Exams.", line++, true) + + if (stage >= 2) { + line(player, "I should take the letter the Examiner has given me to the", line++, true) + line(player, "Curator of Varrock Museum, for his approval.", line++, true) + } else if (stage >= 1) { + line(player, "I should take the !!letter?? the !!Examiner?? has given me to the", line++) + line(player, "!!Curator?? of !!Varrock Museum??, for his approval.", line++) + } + + if (stage >= 3) { + line(player, "I need to return the letter of recommendation from the", line++, true) + line(player, "Curator of Varrock Museum to the Examiner at the Exam", line++, true) + line(player, "Centre for inspection.", line++, true) + } else if (stage >= 2) { + line(player, "I need to return the !!letter of recommendation?? from the", line++) + line(player, "!!Curator?? of !!Varrock Museum?? to the !!Examiner?? at the !!Exam??", line++) + line(player, "!!Centre?? for inspection.", line++) + } + if (stage >= 4) { + line(player, "I need to study for my first exam. Perhaps the students", line++, true) + line(player, "on the site can help?", line++, true) + } else if (stage >= 3) { + line(player, "I need to study for my first exam. Perhaps the students", line++) + line(player, "on the site can help?", line++) + } + if (stage >= 4 || getAttribute(player, attributeStudentGreenExam1Talked, false)) { + line(player, "I need to speak to the student in the green top about the", line++, true) + line(player, "exams.", line++, true) + } else if (stage >= 3) { + line(player, "I need to speak to the student in the green top about the", line++) + line(player, "exams.", line++) + } + if (stage >= 4 || getAttribute(player, attributeStudentPurpleExam1Talked, false)) { + line(player, "I need to speak to the student in the purple shirt about", line++, true) + line(player, "the exams.", line++, true) + } else if (stage >= 3) { + line(player, "I need to speak to the student in the purple shirt about", line++) + line(player, "the exams.", line++) + } + if (stage >= 4 || getAttribute(player, attributeStudentBrownExam1Talked, false)) { + line(player, "I need to speak to the student in the brown top about the", line++, true) + line(player, "exams.", line++, true) + } else if (stage >= 3) { + line(player, "I need to speak to the student in the brown top about the", line++) + line(player, "exams.", line++) + } + + if (stage >= 4 || getAttribute(player, attributeStudentGreenExam1ObtainAnswer, false)) { + line(player, "I have agreed to help the student in the green top.", line++, true) + line(player, "He has lost his animal skull and thinks he may have", line++, true) + line(player, "dropped it around the site. I need to find it and return", line++, true) + line(player, "it to him. Maybe one of the workmen has picked it up?", line++, true) + } else if (stage >= 3 && getAttribute(player, attributeStudentGreenExam1Talked, false)) { + line(player, "I have agreed to help the student in the green top.", line++) + line(player, "He has lost his animal skull and thinks he may have", line++) + line(player, "dropped it around the site. I need to find it and return", line++) + line(player, "it to him. Maybe one of the workmen has picked it up?", line++) + } + if (stage >= 4) { + line(player, "I should talk to him to see if he can help with my exams.", line++, true) + line(player, "He gave me an answer to one of the questions on the first", line++, true) + line(player, "exam.", line++, true) + } else if (stage >= 3 && getAttribute(player, attributeStudentGreenExam1ObtainAnswer, false)) { + line(player, "I should talk to him to see if he can help with my exams.", line++) + line(player, "He gave me an answer to one of the questions on the first", line++) + line(player, "exam.", line++) + } + + if (stage >= 4 || getAttribute(player, attributeStudentPurpleExam1ObtainAnswer, false)) { + line(player, "I have agreed to help the student in the purple skirt.", line++, true) + line(player, "She has lost her lucky teddy bear mascot and thinks she", line++, true) + line(player, "may have dropped it by the strange relic at the centre of", line++, true) + line(player, "the campus, maybe in a bush. I need to find it and return", line++, true) + line(player, "it to her.", line++, true) + } else if (stage >= 3 && getAttribute(player, attributeStudentPurpleExam1Talked, false)) { + line(player, "I have agreed to help the student in the purple skirt.", line++) + line(player, "She has lost her lucky teddy bear mascot and thinks she", line++) + line(player, "may have dropped it by the strange relic at the centre of", line++) + line(player, "the campus, maybe in a bush. I need to find it and return", line++) + line(player, "it to her.", line++) + } + if (stage >= 4) { + line(player, "I should talk to her to see if she can help with my exams.", line++, true) + line(player, "She gave me an answer to one of the questions on the first", line++, true) + line(player, "exam.", line++, true) + } else if (stage >= 3 && getAttribute(player, attributeStudentPurpleExam1ObtainAnswer, false)) { + line(player, "I should talk to her to see if she can help with my exams.", line++) + line(player, "She gave me an answer to one of the questions on the first", line++) + line(player, "exam.", line++) + } + + + if (stage >= 4 || getAttribute(player, attributeStudentBrownExam1ObtainAnswer, false)) { + line(player, "I have agreed to help the student in the brown top.", line++, true) + line(player, "He has lost his special cup and thinks he may have dropped", line++, true) + line(player, "it while he was near the panning site, possibly in the", line++, true) + line(player, "water. I need to find it and return it.", line++, true) + } else if (stage >= 3 && getAttribute(player, attributeStudentBrownExam1Talked, false)) { + line(player, "I have agreed to help the student in the brown top.", line++) + line(player, "He has lost his special cup and thinks he may have dropped", line++) + line(player, "it while he was near the panning site, possibly in the", line++) + line(player, "water. I need to find it and return it.", line++) + } + if (stage >= 4) { + line(player, "I should talk to him to see if he can help with my exams.", line++, true) + line(player, "He gave me an answer to one of the questions on the first", line++, true) + line(player, "exam.", line++, true) + } else if (stage >= 3 && getAttribute(player, attributeStudentBrownExam1ObtainAnswer, false)) { + line(player, "I should talk to him to see if he can help with my exams.", line++) + line(player, "He gave me an answer to one of the questions on the first", line++) + line(player, "exam.", line++) + } + + + if (stage >= 4) { + line(player, "I should talk to an examiner to take my first exam. If I", line++, true) + line(player, "have forgotten anything, I can always ask the students", line++, true) + line(player, "again.", line++, true) + line(player, "I have passed my first Earth Science exam.", line++, true) + } else if (stage >= 3 + && getAttribute(player, attributeStudentGreenExam1ObtainAnswer, false) + && getAttribute(player, attributeStudentPurpleExam1ObtainAnswer, false) + && getAttribute(player, attributeStudentBrownExam1ObtainAnswer, false) + ) { + line(player, "I should talk to an examiner to take my first exam. If I", line++) + line(player, "have forgotten anything, I can always ask the students", line++) + line(player, "again.", line++) + } + + if (stage >= 5) { + line(player, "I need to study for my second exam. Perhaps the students", line++, true) + line(player, "on the site can help?", line++, true) + } else if (stage >= 4) { + line(player, "I need to study for my second exam. Perhaps the students", line++) + line(player, "on the site can help?", line++) + } + if (stage >= 5 || getAttribute(player, attributeStudentGreenExam2ObtainAnswer, false)) { + line(player, "I need to speak to the student in the green top about the", line++, true) + line(player, "exams.", line++, true) + } else if (stage >= 4) { + line(player, "I need to speak to the student in the green top about the", line++) + line(player, "exams.", line++) + } + if (stage >= 5 || getAttribute(player, attributeStudentPurpleExam2ObtainAnswer, false)) { + line(player, "I need to speak to the student in the purple skirt about", line++, true) + line(player, "the exams. 2 ", line++, true) + } else if (stage >= 4) { + line(player, "I need to speak to the student in the purple skirt about", line++) + line(player, "the exams.", line++) + } + if (stage >= 5 || getAttribute(player, attributeStudentBrownExam2ObtainAnswer, false)) { + line(player, "I need to speak to the student in the brown top about the", line++, true) + line(player, "exams.", line++, true) + } else if (stage >= 4) { + line(player, "I need to speak to the student in the brown top about the", line++) + line(player, "exams.", line++) + } + if (stage >= 5) { + line(player, "I should talk to an examiner to take my second exam. If I", line++, true) + line(player, "have forgotten anything, I can always ask the students", line++, true) + line(player, "again.", line++, true) + line(player, "I have passed my second Earth Science exam.", line++, true) + } else if (stage >= 4 + && getAttribute(player, attributeStudentGreenExam2ObtainAnswer, false) + && getAttribute(player, attributeStudentPurpleExam2ObtainAnswer, false) + && getAttribute(player, attributeStudentBrownExam2ObtainAnswer, false) + ) { + line(player, "I should talk to an examiner to take my second exam. If I", line++) + line(player, "have forgotten anything, I can always ask the students", line++) + line(player, "again.", line++) + } + + if (stage >= 6) { + line(player, "I need to study for my third exam. Perhaps the students", line++, true) + line(player, "on the site can help?", line++, true) + } else if (stage >= 5) { + line(player, "I need to study for my third exam. Perhaps the students", line++) + line(player, "on the site can help?", line++) + } + if (stage >= 6 || getAttribute(player, attributeStudentGreenExam3ObtainAnswer, false)) { + line(player, "I need to speak to the student in the green top about the", line++, true) + line(player, "exams.", line++, true) + } else if (stage >= 5) { + line(player, "I need to speak to the student in the green top about the", line++) + line(player, "exams.", line++) + } + if (stage >= 6 || getAttribute(player, attributeStudentPurpleExam3Talked, false)) { + line(player, "I need to speak to the student in the purple skirt about", line++, true) + line(player, "the exams. 3", line++, true) + } else if (stage >= 5) { + line(player, "I need to speak to the student in the purple skirt about", line++) + line(player, "the exams.", line++) + } + if (stage >= 6 || getAttribute(player, attributeStudentPurpleExam3ObtainAnswer, false)) { + line(player, "I need to bring her an Opal.", line++, true) // What a cunt + } else if (stage >= 5 && getAttribute(player, attributeStudentPurpleExam3Talked, false)) { + line(player, "I need to bring her an Opal.", line++) + } + if (stage >= 6 || getAttribute(player, attributeStudentBrownExam3ObtainAnswer, false)) { + line(player, "I need to speak to the student in the brown top about the", line++, true) + line(player, "exams.", line++, true) + } else if (stage >= 5) { + line(player, "I need to speak to the student in the brown top about the", line++) + line(player, "exams.", line++) + } + if (stage >= 6) { + line(player, "I should talk to an examiner to take my third exam. If I", line++, true) + line(player, "have forgotten anything, I can always ask the students", line++, true) + line(player, "again.", line++, true) + line(player, "I have passed my third and final Earth Science exam.", line++, true) + } else if (stage >= 5 + && getAttribute(player, attributeStudentPurpleExam3ObtainAnswer, false) + && getAttribute(player, attributeStudentGreenExam3ObtainAnswer, false) + && getAttribute(player, attributeStudentBrownExam3ObtainAnswer, false) + ) { + line(player, "I should talk to an examiner to take my third exam. If I", line++) + line(player, "have forgotten anything, I can always ask the students", line++) + line(player, "again.", line++) + } + + if (stage >= 7) { + line(player, "I need a find from the digsite to impress the Expert.", line++, true) + } else if (stage >= 6) { + line(player, "I need a find from the digsite to impress the Expert.", line++) + } + if (stage >= 8) { + line(player, "I need to take the letter to a workman near a winch.", line++, true) + } else if (stage >= 7) { + line(player, "I need to take the letter to a workman near a winch.", line++) + } + if (stage >= 9) { + line(player, "I need to investigate the dig shafts.", line++, true) + line(player, "I found a secret passageway under the site.", line++, true) + } else if (stage >= 8) { + line(player, "I need to !!investigate the dig shafts??.", line++) + } + if (stage >= 10) { + line(player, "I need to find a way to move the rocks blocking the way in", line++, true) + line(player, "the shaft. Perhaps someone can help me.", line++, true) + line(player, "I covered the rocks in the cave with an explosive", line++, true) + line(player, "compound.", line++, true) + } else if (stage >= 9) { + line(player, "I need to find a way to move the rocks blocking the way in", line++) + line(player, "the shaft. Perhaps someone can help me.", line++) + } + if (stage >= 11) { + line(player, "I need to ignite the explosive compound and blow up the", line++, true) + line(player, "rocks blocking the way.", line++, true) + } else if (stage >= 10) { + line(player, "I need to ignite the explosive compound and blow up the", line++) + line(player, "rocks blocking the way.", line++) + } + if (stage >= 12) { + line(player, "I should look for something interesting in the secret room I", line++, true) + line(player, "found, and show it to the Expert at the Exam Centre.", line++, true) + line(player, "The expert was impressed with the Zarosian tablet that I", line++, true) + line(player, "found, and I also discovered an ancient altar!", line++, true) + line(player, "I was rewarded for my findings.", line++, true) + line(player, "My work here is done.", line++, true) + line(player, "I should also talk to the expert about any other finds.", line++, true) + } else if (stage >= 11) { + line(player, "I should look for something interesting in the secret room I", line++) + line(player, "found, and show it to the !!Expert?? at the Exam Centre.", line++) + } + if (stage >= 100) { + line++ + line(player,"QUEST COMPLETE!", line) + } + } + } + + override fun finish(player: Player) { + var ln = 10 + super.finish(player) + player.packetDispatch.sendString("You have completed Digsite Quest!", 277, 4) + // This image is special since it isn't an item, but a standalone model. + player.packetDispatch.sendModelOnInterface(17343, 277, 5, 0) + player.packetDispatch.sendAngleOnInterface(277, 5, 1020, 0, 0) + + drawReward(player, "2 Quest Points", ln++) + drawReward(player, "15,300 Mining XP", ln++) + drawReward(player, "2,000 Herblore XP", ln++) + drawReward(player, "2 Gold Bars", ln) + + rewardXP(player, Skills.MINING, 15300.0) + rewardXP(player, Skills.HERBLORE, 2000.0) + addItemOrDrop(player, Items.GOLD_BAR_2357, 2) + } + + override fun newInstance(`object`: Any?): Quest { + return this + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/TheDigSiteListeners.kt b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/TheDigSiteListeners.kt new file mode 100644 index 000000000..c6745cf98 --- /dev/null +++ b/Server/src/main/content/region/misthalin/digsite/quest/thedigsite/TheDigSiteListeners.kt @@ -0,0 +1,934 @@ +package content.region.misthalin.digsite.quest.thedigsite + +import content.global.skill.thieving.ThievingListeners +import core.api.* +import core.api.utils.PlayerCamera +import core.api.utils.WeightBasedTable +import core.api.utils.WeightedItem +import core.game.dialogue.DialogueBuilder +import core.game.dialogue.DialogueBuilderFile +import core.game.dialogue.DialogueFile +import core.game.dialogue.FacialExpression +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.interaction.QueueStrength +import core.game.node.entity.Entity +import core.game.node.entity.combat.ImpactHandler +import core.game.node.entity.skill.Skills +import core.game.world.map.Location +import core.game.world.map.zone.ZoneBorders +import core.game.world.update.flag.context.Animation +import core.tools.END_DIALOGUE +import org.rs09.consts.Items +import org.rs09.consts.NPCs +import org.rs09.consts.Scenery + +class TheDigSiteListeners : InteractionListener { + companion object { + val BENDING_DOWN_ANIMATION = Animation(827) + val TROWEL_ANIMATION = Animation(2272) + val PANNING_ANIMATION = Animation(4593) + + + val trainingDigTable = WeightBasedTable.create( + WeightedItem(0, 0, 0, 8.0, false), + WeightedItem(Items.COINS_995, 1, 1, 1.0, false), + WeightedItem(Items.CHARCOAL_973, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_ARROW_687, 1, 1, 1.0, false), + WeightedItem(Items.CRACKED_SAMPLE_674, 1, 1, 1.0, false), + WeightedItem(Items.VASE_710, 1, 1, 1.0, false), + ) + val level1DigTable = WeightBasedTable.create( + WeightedItem(0, 0, 0, 2.0, false), + WeightedItem(Items.BUTTONS_688, 1, 1, 1.0, false), + WeightedItem(Items.VASE_710, 1, 1, 1.0, false), + WeightedItem(Items.COPPER_ORE_436, 1, 1, 1.0, false), + WeightedItem(Items.LEATHER_BOOTS_1061, 1, 1, 1.0, false), + WeightedItem(Items.OPAL_1609, 1, 1, 1.0, false), + WeightedItem(Items.OLD_TOOTH_695, 1, 1, 1.0, false), + WeightedItem(Items.ROTTEN_APPLE_1984, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_GLASS_1469, 1, 1, 1.0, false), + WeightedItem(Items.RUSTY_SWORD_686, 1, 1, 1.0, false), + WeightedItem(Items.BONES_526, 1, 1, 1.0, false), + ) + val level2DigTable = WeightBasedTable.create( + WeightedItem(0, 0, 0, 3.0, false), + WeightedItem(Items.BONES_526, 1, 1, 2.0, false), + WeightedItem(Items.DAMAGED_ARMOUR_697, 1, 1, 1.0, false), + WeightedItem(Items.LEATHER_BOOTS_1061, 1, 1, 1.0, false), + WeightedItem(Items.BOWL_1923, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_STAFF_689, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_ARMOUR_698, 1, 1, 1.0, false), + WeightedItem(Items.UNCUT_JADE_1627, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_GLASS_1469, 1, 1, 1.0, false), + WeightedItem(Items.JUG_1935, 1, 1, 1.0, false), + WeightedItem(Items.EMPTY_POT_1931, 1, 1, 1.0, false), + WeightedItem(Items.CLAY_434, 1, 1, 1.0, false), + WeightedItem(Items.UNCUT_OPAL_1625, 1, 1, 1.0, false), + ) + val level3DigTable = WeightBasedTable.create( + WeightedItem(0, 0, 0, 1.0, false), + WeightedItem(Items.COINS_995, 10, 10, 2.0, false), + WeightedItem(Items.ANCIENT_TALISMAN_681, 1, 1, 1.0, false), // sendItemDialogue "You find a strange talisman." + WeightedItem(Items.BELT_BUCKLE_684, 1, 1, 2.0, false), + WeightedItem(Items.BLACK_MED_HELM_1151, 1, 1, 1.0, false), + WeightedItem(Items.BONES_526, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_ARMOUR_698, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_ARROW_687, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_STAFF_689, 1, 1, 1.0, false), + WeightedItem(Items.BRONZE_SPEAR_1237, 1, 1, 1.0, false), + WeightedItem(Items.BUTTONS_688, 1, 1, 1.0, false), + WeightedItem(Items.CERAMIC_REMAINS_694, 1, 1, 1.0, false), + WeightedItem(Items.CLAY_434, 1, 1, 1.0, false), + WeightedItem(Items.DAMAGED_ARMOUR_697, 1, 1, 1.0, false), + WeightedItem(Items.IRON_KNIFE_863, 1, 1, 1.0, false), + WeightedItem(Items.LEATHER_BOOTS_1061, 1, 1, 1.0, false), + WeightedItem(Items.NEEDLE_1733, 1, 1, 1.0, false), + WeightedItem(Items.OLD_TOOTH_695, 1, 1, 1.0, false), + WeightedItem(Items.PIE_DISH_2313, 1, 1, 1.0, false), + ) + val specimenTrayTable = WeightBasedTable.create( + WeightedItem(0, 0, 0, 2.0, false), + WeightedItem(Items.BONES_526, 1, 1, 2.0, false), + WeightedItem(Items.COINS_995, 1, 1, 1.0, false), + WeightedItem(Items.IRON_DAGGER_1203, 1, 1, 1.0, false), + WeightedItem(Items.CHARCOAL_973, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_ARROW_687, 1, 1, 1.0, false), + WeightedItem(Items.BROKEN_GLASS_1469, 1, 1, 1.0, false), + WeightedItem(Items.CERAMIC_REMAINS_694, 1, 1, 1.0, false), + WeightedItem(Items.CRACKED_SAMPLE_674, 1, 1, 1.0, false), + ) + + val workmanPickpocketingTable = WeightBasedTable.create( + WeightedItem(Items.SPECIMEN_BRUSH_670, 1, 1, 3.0, false), + WeightedItem(Items.ANIMAL_SKULL_671, 1, 1, 3.0, false), + WeightedItem(Items.COINS_995, 10, 10, 1.0, false), + WeightedItem(Items.ROPE_954, 1, 1, 1.0, false), + WeightedItem(Items.BUCKET_1925, 1, 1, 1.0, false), + WeightedItem(Items.LEATHER_GLOVES_1059, 1, 1, 1.0, false), + WeightedItem(Items.SPADE_952, 1, 1, 1.0, false), + ) + + val workmanPostQuestPickpocketingTable = WeightBasedTable.create( + WeightedItem(Items.SPECIMEN_BRUSH_670, 1, 1, 3.0, false), + WeightedItem(Items.COINS_995, 10, 10, 4.0, false), + WeightedItem(Items.ROPE_954, 1, 1, 1.0, false), + WeightedItem(Items.BUCKET_1925, 1, 1, 1.0, false), + WeightedItem(Items.LEATHER_GLOVES_1059, 1, 1, 1.0, false), + WeightedItem(Items.SPADE_952, 1, 1, 1.0, false), + ) + + val panningTable = WeightBasedTable.create( + WeightedItem(0, 0, 0, 20.0, false), + WeightedItem(Items.COINS_995, 1, 1, 4.0, false), + WeightedItem(Items.NUGGETS_680, 1, 1, 4.0, false), + WeightedItem(Items.OYSTER_407, 1, 1, 3.0, false), + WeightedItem(Items.UNCUT_OPAL_1625, 1, 1, 3.0, false), + WeightedItem(Items.UNCUT_JADE_1627, 1, 1, 3.0, false), + WeightedItem(Items.SPECIAL_CUP_672, 1, 1, 3.0, false), + ) + } + + override fun defineListeners() { + + // 3: Certificate Level 1 + on(Items.LEVEL_1_CERTIFICATE_691, ITEM, "look-at") { player, _ -> + openInterface(player, 440) + setInterfaceText(player, player.username, 440, 5) + return@on true + } + // 3: Certificate Level 2 + on(Items.LEVEL_2_CERTIFICATE_692, ITEM, "look-at") { player, _ -> + openInterface(player, 441) + setInterfaceText(player, player.username, 441, 5) + return@on true + } + // 3: Certificate Level 3 + on(Items.LEVEL_3_CERTIFICATE_693, ITEM, "look-at") { player, _ -> + openInterface(player, 444) + setInterfaceText(player, player.username, 444, 5) + return@on true + } + + // 3 Green: Pickpocket Animal Skull from Digsite Workman + on(intArrayOf(NPCs.DIGSITE_WORKMAN_613, NPCs.DIGSITE_WORKMAN_4564, NPCs.DIGSITE_WORKMAN_4565), NPC, "steal-from") { player, node -> + + if(getStatLevel(player, Skills.THIEVING) < 25){ + player.sendMessage("You need a Thieving level of 25 to do that.") + return@on true + } + if(!workmanPickpocketingTable.canRoll(player)){ + player.sendMessage("You don't have enough inventory space to do that.") + return@on true + } + sendMessage(player, "You attempt to pick the workman's pocket...") + if (getQuestStage(player, TheDigSite.questName) == 3) { + player.animator.animate(ThievingListeners.PICKPOCKET_ANIM) + val rollOutcome = ThievingListeners.pickpocketRoll(player, 84.0, 240.0, workmanPickpocketingTable) + if (rollOutcome != null) { + queueScript(player, ThievingListeners.PICKPOCKET_ANIM.duration, QueueStrength.NORMAL) { stage: Int -> + when (stage) { + 0 -> { + if (rollOutcome.size > 0) { + addItemOrDrop(player, rollOutcome[0].id) + when (rollOutcome[0].id){ + Items.ANIMAL_SKULL_671 -> sendItemDialogue(player, Items.ANIMAL_SKULL_671, "You steal an animal skull.") + else -> sendMessage(player, "You steal something.") + } + } else { + sendMessage(player, "You couldn't steal anything.") + } + return@queueScript stopExecuting(player) + } + else -> return@queueScript stopExecuting(player) + } + } + } else { + node.asNpc().face(player) + node.asNpc().animator.animate(ThievingListeners.NPC_ANIM) + sendMessage(player, "You fail to pick the workman's pocket.") + sendChat(node.asNpc(), "What do you think you're doing???") + sendMessage(player, "You have been stunned.") // -1 HP + playHurtAudio(player, 20) + stun(player, 3) + player.impactHandler.manualHit(node.asNpc(), 1, ImpactHandler.HitsplatType.NORMAL) + node.asNpc().face(null) + } + } else { + // When not during quest + player.animator.animate(ThievingListeners.PICKPOCKET_ANIM) + val rollOutcome = ThievingListeners.pickpocketRoll(player, 84.0, 240.0, workmanPostQuestPickpocketingTable) + if (rollOutcome != null) { + queueScript(player, ThievingListeners.PICKPOCKET_ANIM.duration, QueueStrength.NORMAL) { stage: Int -> + when (stage) { + 0 -> { + if (rollOutcome.size > 0) { + addItemOrDrop(player, rollOutcome[0].id) + when (rollOutcome[0].id){ + Items.ANIMAL_SKULL_671 -> sendItemDialogue(player, Items.ANIMAL_SKULL_671, "You steal an animal skull.") + else -> sendMessage(player, "You steal something.") + } + } else { + sendMessage(player, "You couldn't steal anything.") + } + return@queueScript stopExecuting(player) + } + else -> return@queueScript stopExecuting(player) + } + } + } else { + node.asNpc().face(player) + node.asNpc().animator.animate(ThievingListeners.NPC_ANIM) + sendMessage(player, "You fail to pick the workman's pocket.") + sendChat(player, "What do you think you're doing???") + sendMessage(player, "You have been stunned.") // -1 HP + playHurtAudio(player, 20) + stun(player, 3) + player.impactHandler.manualHit(node.asNpc(), 1, ImpactHandler.HitsplatType.NORMAL) + node.asNpc().face(null) + } + } + return@on true + } + + // 3 Purple: Pickpocket student. + on(NPCs.STUDENT_617, NPC, "pickpocket") { player, _ -> + sendDialogue(player, "I don't think I should try to steal from this poor student.") + // Technically you can steal the teddy back from her. But why? + return@on true + } + + // 3 Purple: Search Bush for Teddy Bear (but wrong bushes) + on(Scenery.BUSH_2357, SCENERY, "search") { player, _ -> + sendMessage(player, "You search the bush... You find nothing of interest.") + return@on true + } + // 3 Purple: Search Bush for Teddy Bear (the correct bush) + on(Scenery.BUSH_2358, SCENERY, "search") { player, _ -> + openDialogue(player, object : DialogueFile(){ + override fun handle(componentID: Int, buttonID: Int) { + when(stage){ + 0 -> playerl("Hey, something has been dropped here...").also { + addItemOrDrop(player, Items.TEDDY_673) + stage++ + } + 1 -> sendItemDialogue(player, Items.TEDDY_673, "You find... something.").also { stage = END_DIALOGUE } + } + } + }) + return@on true + } + + + // 8/9: Pouring CHEMICAL_COMPOUND_707 on brick. Transitions to stage 11. + onUseWith(NPC, Items.CUP_OF_TEA_712, NPCs.PANNING_GUIDE_620) { player, used, with -> + if(removeItem(player, used)) { + sendNPCDialogue(player, with.id, "Ah! Lovely! You can't beat a good cuppa! You're free to pan all you want.") + setAttribute(player, TheDigSite.attributePanningGuideTea, true) + } + return@onUseWith true + } + + onUseWith(SCENERY, Items.PANNING_TRAY_677, Scenery.PANNING_POINT_2363) { player, used, with -> + if (getAttribute(player, TheDigSite.attributePanningGuideTea, false)) { + queueScript(player, 0, QueueStrength.NORMAL) { stage: Int -> + when (stage) { + 0 -> { + animate(player, PANNING_ANIMATION) + lock(player, PANNING_ANIMATION.duration) + return@queueScript delayScript(player, PANNING_ANIMATION.duration) + } + + 1 -> { + sendItemDialogue(player, Items.PANNING_TRAY_679, "You lift the full tray from the water") + if (removeItem(player, used)) { + addItemOrDrop(player, Items.PANNING_TRAY_679) + } + return@queueScript stopExecuting(player) + } + + else -> return@queueScript stopExecuting(player) + } + + } + } else { + openDialogue(player, PanningGuideCannotPanDialogueFile(), findNPC(NPCs.PANNING_GUIDE_620)!!) + } + return@onUseWith true + } + // 3 Brown: Search Panning Point for Special Cup + on(Scenery.PANNING_POINT_2363, SCENERY, "pan") { player, _ -> + // + if (getAttribute(player, TheDigSite.attributePanningGuideTea, false)) { + if (inInventory(player, Items.PANNING_TRAY_677)) { + queueScript(player, 0, QueueStrength.NORMAL) { stage: Int -> + when (stage) { + 0 -> { + animate(player, PANNING_ANIMATION) + return@queueScript delayScript(player, PANNING_ANIMATION.duration) + } + + 1 -> { + sendItemDialogue(player, Items.PANNING_TRAY_679, "You lift the full tray from the water.") + if (removeItem(player, Items.PANNING_TRAY_677)) { + addItemOrDrop(player, Items.PANNING_TRAY_679) + } + return@queueScript stopExecuting(player) + } + + else -> return@queueScript stopExecuting(player) + } + } + } else if (inInventory(player, Items.PANNING_TRAY_679)) { + sendPlayerDialogue(player, "I already have a full panning tray; perhaps I should search it first.") + } else { + sendMessage(player, "I need a panning tray to pan the panning point.") + } + } else { + openDialogue(player, PanningGuideCannotPanDialogueFile(), findNPC(NPCs.PANNING_GUIDE_620)!!) + } + return@on true + } + // 3 Brown: Empty tray + on(Items.PANNING_TRAY_677, ITEM, "search") { player, used -> + sendMessage(player, "The panning tray is empty.") + return@on true + } + // 3 Brown: Search Panning Point for Special Cup + on(Items.PANNING_TRAY_679, ITEM, "search") { player, used -> + sendMessage(player, "You search the contents of the tray.") + if(removeItem(player, used)) { + addItemOrDrop(player, Items.PANNING_TRAY_677) + val tableRoll = panningTable.roll() + if (tableRoll.size > 0) { + addItemOrDrop(player, tableRoll[0].id) + when (tableRoll[0].id){ + Items.COINS_995 -> sendItemDialogue(player, Items.COINS_995, "You find some coins within the mud.") + Items.NUGGETS_680 -> sendItemDialogue(player, Items.PANNING_TRAY_678, "You find some gold nuggets within the mud.") + Items.OYSTER_407 -> sendItemDialogue(player, Items.OYSTER_407, "You find an oyster within the mud.") + Items.UNCUT_OPAL_1625 -> sendItemDialogue(player, Items.UNCUT_OPAL_1625, "You find a gem within the mud!") + Items.UNCUT_JADE_1627 -> sendItemDialogue(player, Items.UNCUT_JADE_1627, "You find a gem within the mud!") + Items.SPECIAL_CUP_672 -> sendItemDialogue(player, Items.SPECIAL_CUP_672, "You find a shiny cup covered in mud.") + } + } else { + sendItemDialogue(player, Items.PANNING_TRAY_679, "The tray contains only plain mud.") + } + } + return@on true + } + + // 3-End: Soil trowel digging. Very complex. + onUseWith(SCENERY, Items.TROWEL_676, Scenery.SOIL_2376, Scenery.SOIL_2377, Scenery.SOIL_2378) { player, used, with -> + + val level3DigRight = ZoneBorders(3370, 3437, 3377, 3442) + val level3DigLeft = ZoneBorders(3350, 3404, 3357, 3412) + if (level3DigRight.insideBorder(player.location) || level3DigLeft.insideBorder(player.location)) { + if (getQuestStage(player, TheDigSite.questName) >= 6) { + queueScript(player, 0, QueueStrength.NORMAL) { stage: Int -> + when (stage) { + 0 -> { + sendMessage(player, "You dig through the earth.") + animate(player, TROWEL_ANIMATION) + lock(player, TROWEL_ANIMATION.duration) + return@queueScript delayScript(player, TROWEL_ANIMATION.duration) + } + + 1 -> { + val tableRoll = level3DigTable.roll() + if (tableRoll.size > 0) { + addItemOrDrop(player, tableRoll[0].id) + } + sendMessage(player, "You carefully clean your find with the specimen brush.") + return@queueScript stopExecuting(player) + } + + else -> return@queueScript stopExecuting(player) + } + } + } else { + sendNPCDialogue(player, NPCs.DIGSITE_WORKMAN_613, "Oi! What do you think you're doing? There's fragile specimens around here!", FacialExpression.ANGRY) + } + } + + val level2Dig = ZoneBorders(3350, 3424, 3363, 3430) + if (level2Dig.insideBorder(player.location)) { + if (getQuestStage(player, TheDigSite.questName) >= 5) { + queueScript(player, 0, QueueStrength.NORMAL) { stage: Int -> + when (stage) { + 0 -> { + sendMessage(player, "You dig through the earth.") + animate(player, TROWEL_ANIMATION) + lock(player, TROWEL_ANIMATION.duration) + return@queueScript delayScript(player, TROWEL_ANIMATION.duration) + } + + 1 -> { + val tableRoll = level2DigTable.roll() + if (tableRoll.size > 0) { + addItemOrDrop(player, tableRoll[0].id) + } + sendMessage(player, "You carefully clean your find with the specimen brush.") + return@queueScript stopExecuting(player) + } + + else -> return@queueScript stopExecuting(player) + } + } + } else { + sendNPCDialogue(player, NPCs.DIGSITE_WORKMAN_613, "Oi! What do you think you're doing? There's fragile specimens around here!", FacialExpression.ANGRY) + } + } + + val level1DigCentre = ZoneBorders(3360, 3402, 3363, 3414) + val level1DigRight = ZoneBorders(3367, 3403, 3372, 3414) + if (level1DigCentre.insideBorder(player.location) || level1DigRight.insideBorder(player.location)) { + if (getQuestStage(player, TheDigSite.questName) >= 4) { + queueScript(player, 0, QueueStrength.NORMAL) { stage: Int -> + when (stage) { + 0 -> { + sendMessage(player, "You dig through the earth.") + animate(player, TROWEL_ANIMATION) + lock(player, TROWEL_ANIMATION.duration) + return@queueScript delayScript(player, TROWEL_ANIMATION.duration) + } + + 1 -> { + val tableRoll = level1DigTable.roll() + if (tableRoll.size > 0) { + addItemOrDrop(player, tableRoll[0].id) + } + sendMessage(player, "You carefully clean your find with the specimen brush.") + return@queueScript stopExecuting(player) + } + + else -> return@queueScript stopExecuting(player) + } + } + } else { + sendNPCDialogue(player, NPCs.DIGSITE_WORKMAN_613, "Oi! What do you think you're doing? There's fragile specimens around here!", FacialExpression.ANGRY) + } + } + + val trainingDigLeft = ZoneBorders(3352, 3396, 3357, 3400) + val trainingDigRight = ZoneBorders(3367, 3397, 3372, 3400) + if (trainingDigLeft.insideBorder(player.location) || trainingDigRight.insideBorder(player.location)) { + if (getQuestStage(player, TheDigSite.questName) >= 3) { + queueScript(player, 0, QueueStrength.NORMAL) { stage: Int -> + when (stage) { + 0 -> { + sendMessage(player, "You dig through the earth.") + animate(player, TROWEL_ANIMATION) + lock(player, TROWEL_ANIMATION.duration) + return@queueScript delayScript(player, TROWEL_ANIMATION.duration) + } + + 1 -> { + val tableRoll = trainingDigTable.roll() + if (tableRoll.size > 0) { + addItemOrDrop(player, tableRoll[0].id) + // You find a/an ... + sendMessage(player, "You carefully clean your find with the specimen brush.") + } + return@queueScript stopExecuting(player) + } + + else -> return@queueScript stopExecuting(player) + } + } + } + } + + return@onUseWith true + } + + // 8: North East Winch goes to Doug Deeping + on(Scenery.WINCH_2350, SCENERY, "operate") { player, _ -> + if (getQuestStage(player, TheDigSite.questName) >= 11) { + sendMessage(player, "You try to climb down the rope...") + sendMessage(player, "You lower yourself into the shaft...") + teleport(player, Location(3369, 9763)) + sendMessage(player, "You find yourself in a cavern...") + } else if (getQuestStage(player, TheDigSite.questName) >= 8) { + if (getAttribute(player, TheDigSite.attributeRopeNorthEastWinch, false)) { + sendMessage(player, "You try to climb down the rope...") + sendMessage(player, "You lower yourself into the shaft...") + teleport(player, Location(3369, 9827)) + sendMessage(player, "You find yourself in a cavern...") + } else { + sendMessage(player, "You operate the winch...") + queueScript(player, 2, QueueStrength.NORMAL) { stage: Int -> + sendPlayerDialogue(player, "Hey, I think I could fit down here. I need something to help me get all the way down.") + sendMessage(player, "The bucket descends, but does not reach the bottom.") + return@queueScript stopExecuting(player) + } + } + } else { + openDialogue(player, object : DialogueFile(){ + override fun handle(componentID: Int, buttonID: Int) { + when(stage){ + 0 -> npc(NPCs.DIGSITE_WORKMAN_613, "Sorry; this area is private. The only way you'll get to", "use these is by impressing the archaeological expert up", "at the center.").also {stage++ } + 1 -> npc(NPCs.DIGSITE_WORKMAN_613,"Find something worthwhile and he might let you use the", "winches. Until then, get lost!").also { stage = END_DIALOGUE } + } + } + }) + } + // sendMessage(player, "There is a sign on the winch.") + // sendMessage(player, "Private area - invitation only.") + return@on true + } + + // 8: Tie rope to winch + onUseWith(IntType.SCENERY, Items.ROPE_954, Scenery.WINCH_2350) { player, used, with -> + if (removeItem(player, used)) { + if (getQuestStage(player, TheDigSite.questName) >= 8) { + setAttribute(player, TheDigSite.attributeRopeNorthEastWinch, true) + sendMessage(player, "You tie the rope to the bucket.") + } else { + openDialogue(player, object : DialogueFile(){ + override fun handle(componentID: Int, buttonID: Int) { + when(stage){ + 0 -> npc(NPCs.DIGSITE_WORKMAN_613, "Sorry; this area is private. The only way you'll get to", "use these is by impressing the archaeological expert up", "at the center.").also {stage++ } + 1 -> npc(NPCs.DIGSITE_WORKMAN_613,"Find something worthwhile and he might let you use the", "winches. Until then, get lost!").also { stage = END_DIALOGUE } + } + } + }) + } + } + return@onUseWith true + } + + // 8: Climb back out + on(Scenery.ROPE_2352, SCENERY, "climb-up") { player, _ -> + teleport(player, Location(3370, 3427)) + return@on true + } + + // 8: West Winch goes to Skeletons, Explosion and Stone Tablet + on(Scenery.WINCH_2351, SCENERY, "operate") { player, _ -> + if (getQuestStage(player, TheDigSite.questName) >= 11) { + sendMessage(player, "You try to climb down the rope...") + sendMessage(player, "You lower yourself into the shaft...") + teleport(player, Location(3352, 9753)) + sendMessage(player, "You find yourself in a cavern...") + } else if (getQuestStage(player, TheDigSite.questName) >= 8) { + if (getAttribute(player, TheDigSite.attributeRopeWestWinch, false)) { + sendMessage(player, "You try to climb down the rope...") + sendMessage(player, "You lower yourself into the shaft...") + teleport(player, Location(3352, 9818)) + sendMessage(player, "You find yourself in a cavern...") + } else { + sendMessage(player, "You operate the winch...") + queueScript(player, 2, QueueStrength.NORMAL) { stage: Int -> + sendPlayerDialogue(player, "Hey, I think I could fit down here. I need something to help me get all the way down.") + sendMessage(player, "The bucket descends, but does not reach the bottom.") + return@queueScript stopExecuting(player) + } + } + } else { + openDialogue(player, object : DialogueFile(){ + override fun handle(componentID: Int, buttonID: Int) { + when(stage){ + 0 -> npc(NPCs.DIGSITE_WORKMAN_613, "Sorry; this area is private. The only way you'll get to", "use these is by impressing the archaeological expert up", "at the center.").also {stage++ } + 1 -> npc(NPCs.DIGSITE_WORKMAN_613,"Find something worthwhile and he might let you use the", "winches. Until then, get lost!").also { stage = END_DIALOGUE } + } + } + }) + } + return@on true + } + + + // 8: Tie rope to winch + onUseWith(IntType.SCENERY, Items.ROPE_954, Scenery.WINCH_2351) { player, used, with -> + if (removeItem(player, used)) { + if (getQuestStage(player, TheDigSite.questName) >= 8) { + setAttribute(player, TheDigSite.attributeRopeWestWinch, true) + sendMessage(player, "You tie the rope to the bucket.") + } else { + openDialogue(player, object : DialogueFile(){ + override fun handle(componentID: Int, buttonID: Int) { + when(stage){ + 0 -> npc(NPCs.DIGSITE_WORKMAN_613, "Sorry; this area is private. The only way you'll get to", "use these is by impressing the archaeological expert up", "at the center.").also {stage++ } + 1 -> npc(NPCs.DIGSITE_WORKMAN_613,"Find something worthwhile and he might let you use the", "winches. Until then, get lost!").also { stage = END_DIALOGUE } + } + } + }) + } + } + return@onUseWith true + } + + // 8: Climb back out + on(Scenery.ROPE_2353, SCENERY, "climb-up") { player, _ -> + teleport(player, Location(3354, 3417)) + return@on true + } + + + on(Items.INVITATION_LETTER_696, ITEM, "read") { player, _ -> + sendPlayerDialogue(player, "It says, 'I give permission for the bearer... to use the mine shafts on site. - signed Terrance Balando, Archaeological Expert, City of Varrock.") + // LINE SEPARATED : ("It says, 'I give permission for the bearer... to use the", "mine shafts on site. - signed Terrance Balando,", "Archaeological Expert, City of Varrock.'") + return@on true + } + + + // 8: Investigating brick. Transitions to stage 9. + on(Scenery.BRICK_2362, SCENERY, "search") { player, _ -> + if(getQuestStage(player, TheDigSite.questName) == 8) { + sendPlayerDialogue(player, "Hmmm, there's a room past these bricks. If I could move them out of the way then I could find out what's inside. Maybe there's someone around here who can help...", FacialExpression.THINKING) + setQuestStage(player, TheDigSite.questName, 9) + } + if(getQuestStage(player, TheDigSite.questName) == 9) { + sendPlayerDialogue(player, "Hmmm, there's a room past these bricks. If I could move them out of the way then I could find out what's inside. Maybe there's someone around here who can help...", FacialExpression.THINKING) + } + if(getQuestStage(player, TheDigSite.questName) == 10) { + sendPlayerDialogue(player, "The brick is covered with the chemicals I made.", FacialExpression.THINKING) + } + return@on true + } + + + // 8/9: Chest open + on(Scenery.CHEST_2361, SCENERY, "search") { player, _ -> + sendMessage(player, "The chest is locked.") + return@on true + } + + // 8/9: Chest open with key + onUseWith(IntType.SCENERY, Items.CHEST_KEY_709, Scenery.CHEST_2361) { player, used, with -> + if (!removeItem(player, used)) { + return@onUseWith false + } + sendMessage(player, "You use the key in the chest.") + animate(player, 536) + replaceScenery(with as core.game.node.scenery.Scenery, Scenery.CHEST_2360, 100) + return@onUseWith true + } + + + // 8/9: Specimen tray mainly to find charcoal. No quest stage limit as long as you have a specimen jar. + on(Scenery.SPECIMEN_TRAY_2375, SCENERY, "search") { player, _ -> + if (inInventory(player, Items.SPECIMEN_JAR_669)) { + sendMessage(player, "You sift through the earth in the tray.") + animate(player, BENDING_DOWN_ANIMATION) + val tableRoll = specimenTrayTable.roll() + if (tableRoll.size > 0) { + addItemOrDrop(player, tableRoll[0].id) + } + } else { + sendMessage(player, "You need to have a specimen jar when you are searching the tray.") + // sendMessage(player, "There must be a workman present when you are searching the tray.") <- authentic, but what does this mean... + } + return@on true + } + + on(Scenery.CHEST_2360, SCENERY, "search") { player, _ -> + addItemOrDrop(player, Items.CHEMICAL_POWDER_700) + sendItemDialogue(player, Items.CHEMICAL_POWDER_700, "You find some unusual powder inside...") + return@on true + } + + // 8/9 Getting unidentified liquid (Do not shift this code down. This somehow gets overwritten.) + onUseWith(SCENERY, Items.VIAL_229, Scenery.BARREL_17297) { player, used, with -> + if(removeItem(player, used)) { + addItemOrDrop(player, Items.UNIDENTIFIED_LIQUID_702) + openDialogue(player, object : DialogueBuilderFile() { + override fun create(b: DialogueBuilder) { + b.onPredicate { _ -> true } + .item(Items.UNIDENTIFIED_LIQUID_702, "You fill the vial with the liquid.") + .player("I'm not sure what this stuff is. I had better be VERY", "careful with it; I had better not drop it either...") + } + }) + sendMessage(player, "You put the lid back on the barrel just in case it's dangerous.") + setVarbit(player, TheDigSite.barrelVarbit, 0) + } + return@onUseWith true + } + + // 8/9 Barrel open + on(Scenery.BARREL_17296, SCENERY, "search", "open") { player, _ -> + sendPlayerDialogue(player, "Mmmm... The lid is shut tight; I'll have to find something to lever it off.", FacialExpression.THINKING) + return@on true + } + + // 8/9 Barrel opened with trowel + onUseWith(SCENERY, Items.TROWEL_676, Scenery.BARREL_17296) { player, used, with -> + sendPlayerDialogue(player, "Great! It's opened it.") + setVarbit(player, TheDigSite.barrelVarbit, 1) + return@onUseWith true + } + + // 8/9 Open barrel search + on(Scenery.BARREL_17297, SCENERY, "search") { player, _ -> + sendPlayerDialogue(player, "I can't pick this up with my bare hands! I'll need something to put it in. It looks and smells rather dangerous though, so it'll need to be something small and capable of containing dangerous chemicals.", FacialExpression.THINKING) + return@on true + } + + // 8/9 Mixed chem 1 + onUseWith(ITEM, Items.AMMONIUM_NITRATE_701, Items.NITROGLYCERIN_703) { player, used, with -> + if (getStatLevel(player, Skills.HERBLORE) < 10) { + sendMessage(player, "You need level 10 Herblore to combine the chemicals.") + return@onUseWith true + } + sendMessage(player, "You mix the nitrate powder into the liquid.") + sendMessage(player, "It has produced a foul mixture.") + if(removeItem(player, used) && removeItem(player, with)) { + addItemOrDrop(player, Items.MIXED_CHEMICALS_705) + } + return@onUseWith true + } + + // 8/9 Mixed chem 2 + onUseWith(ITEM, Items.MIXED_CHEMICALS_705, Items.GROUND_CHARCOAL_704) { player, used, with -> + if (getStatLevel(player, Skills.HERBLORE) < 10) { + sendMessage(player, "You need level 10 Herblore to combine the chemicals.") + return@onUseWith true + } + sendMessage(player, "You mix the charcoal into the liquid.") + sendMessage(player, "It has produced an even fouler mixture.") + if(removeItem(player, used) && removeItem(player, with)) { + addItemOrDrop(player, Items.MIXED_CHEMICALS_706) + } + return@onUseWith true + } + + // 8/9 Mixed chem 3 + onUseWith(ITEM, Items.MIXED_CHEMICALS_706, Items.ARCENIA_ROOT_708) { player, used, with -> + if (getStatLevel(player, Skills.HERBLORE) < 10) { + sendMessage(player, "You need level 10 Herblore to combine the chemicals.") + return@onUseWith true + } + sendMessage(player, "You mix the root into the mixture.") + sendMessage(player, "You produce a potentially explosive compound.") + sendPlayerDialogue(player, "Excellent! This looks just right!", FacialExpression.HAPPY) + if(removeItem(player, used) && removeItem(player, with)) { + addItemOrDrop(player, Items.CHEMICAL_COMPOUND_707) + } + return@onUseWith true + } + + // 8/9: Pouring CHEMICAL_COMPOUND_707 on brick. Transitions to stage 10. + onUseWith(SCENERY, Items.CHEMICAL_COMPOUND_707, Scenery.BRICK_2362) { player, used, with -> + if (getQuestStage(player, TheDigSite.questName) == 9) { + if(removeItem(player, used)) { + addItemOrDrop(player, Items.VIAL_229) + sendMessage(player, "You pour the compound over the bricks...") + sendPlayerDialogue(player, "Ok, the mixture is all over the bricks. I need some way to ignite this compound.", FacialExpression.THINKING) + setQuestStage(player, TheDigSite.questName, 10) + } + } + return@onUseWith true + } + + // 10: Lighting brick. Transitions to stage 11. + onUseWith(SCENERY, Items.TINDERBOX_590, Scenery.BRICK_2362) { player, used, with -> + if(getQuestStage(player, TheDigSite.questName) == 10) { + setQuestStage(player, TheDigSite.questName, 11) + lock(player, 15) + queueScript(player, 0, QueueStrength.NORMAL) { stage: Int -> + when (stage) { + 0 -> { + animate(player, BENDING_DOWN_ANIMATION) + sendMessage(player, "You strike the tinderbox...") + return@queueScript delayScript(player, 2) + } + 1 -> { + sendMessage(player, "Fizz..") + sendPlayerDialogue(player, "Woah! This is going to blow! I'd better run!", FacialExpression.EXTREMELY_SHOCKED) + return@queueScript delayScript(player, BENDING_DOWN_ANIMATION.duration) + } + 2 -> { + // forceWalk(player, Location(3366, 9830, 0), "smart") doesn't work when player is locked. + player.walkingQueue.reset() + player.walkingQueue.addPath(3366, 9830) + + return@queueScript delayScript(player, 8) + } + 3 -> { + PlayerCamera(player).shake(0, 20, 8, 128, 40) + return@queueScript delayScript(player, 4) + } + 4 -> { + PlayerCamera(player).reset() + teleport(player, Location(3366, 9766)) + unlock(player) + sendPlayerDialogue(player, "Wow, that was a big explosion! What's that noise I can hear? Sounds like bones moving or something...", FacialExpression.EXTREMELY_SHOCKED) + return@queueScript stopExecuting(player) + } + else -> return@queueScript stopExecuting(player) + } + } + } + return@onUseWith true + } + + // 12: Stone tablet get. + on(Scenery.STONE_TABLET_17367, SCENERY, "take") { player, _ -> + setVarbit(player, TheDigSite.tabletVarbit, 1) + addItemOrDrop(player,Items.STONE_TABLET_699) + sendMessage(player, "You pick the stone tablet up.") + return@on true + } + + on(Items.STONE_TABLET_699, ITEM, "read") { player, _ -> + sendPlayerDialogue(player, "It says: Tremble mortal, before the altar of our dread lord Zaros.") + return@on true + } + + // Dropping Liquids + on(Items.UNIDENTIFIED_LIQUID_702, ITEM, "empty") { player, node -> + if(removeItem(player, node)) { + addItemOrDrop(player, Items.VIAL_229) + } + sendChat(player, "You very carefully empty out the liquid.") + return@on true + } + + on(Items.UNIDENTIFIED_LIQUID_702, ITEM, "drop") { player, node -> + removeItem(player, node) + impact(player, 25) + sendChat(player, "Ow! The liquid exploded!") + sendMessage(player, "You were injured by the burning liquid.") + return@on true + } + + on(Items.NITROGLYCERIN_703, ITEM, "drop") { player, node -> + removeItem(player, node) + impact(player, 35) + sendChat(player, "Ow! The nitroglycerin exploded!") + sendMessage(player, "You were injured by the burning liquid.") + return@on true + } + + on(Items.MIXED_CHEMICALS_705, ITEM, "drop") { player, node -> + removeItem(player, node) + impact(player, 45) + sendChat(player, "Ow! The liquid exploded!") + sendMessage(player, "You were injured by the burning liquid.") + return@on true + } + + on(Items.MIXED_CHEMICALS_706, ITEM, "drop") { player, node -> + removeItem(player, node) + impact(player, 55) + sendChat(player, "Ow! The liquid exploded!") + sendMessage(player, "You were injured by the burning liquid.") + return@on true + } + + on(Items.CHEMICAL_COMPOUND_707, ITEM, "drop") { player, node -> + removeItem(player, node) + impact(player, 65) + sendChat(player, "Ow! The liquid exploded!") + sendMessage(player, "You were injured by the burning liquid.") + return@on true + } + + // Scenery not tied to quest + + on(intArrayOf(Scenery.GATE_24560, Scenery.GATE_24561), IntType.SCENERY, "open") { player, _ -> + // This gate is only openable when you have completed Digsite and have 153 kudos from the museum. + // We can assume, no one is going to reach that until the museum is fully fleshed out. + // So this gate will stay locked. + sendMessage(player, "You can't go through there, it's for Dig Site workmen only.") + sendChat(findNPC(NPCs.MUSEUM_GUARD_5942) as Entity, "Sorry - workman's gate only.") + return@on true + } + + on(Scenery.CUPBOARD_17303, SCENERY, "search") { player, _ -> + sendItemDialogue(player, Items.SPECIMEN_JAR_669, "You find a specimen jar.") + addItemOrDrop(player, Items.SPECIMEN_JAR_669) + return@on true + } + + on(Scenery.CUPBOARD_35223, SCENERY, "search") { player, _ -> + sendItemDialogue(player, Items.ROCK_PICK_675, "You find a rock pick.") + addItemOrDrop(player, Items.ROCK_PICK_675) + return@on true + } + + on(intArrayOf(Scenery.SACKS_2354, Scenery.SACKS_2355, Scenery.SACKS_2356), SCENERY, "search") { player, _ -> + sendItemDialogue(player, Items.SPECIMEN_JAR_669, "You find a specimen jar.") + addItemOrDrop(player, Items.SPECIMEN_JAR_669) + return@on true + } + + on(Scenery.BOOKCASE_35224, SCENERY, "search") { player, _ -> + sendMessage(player, "You search through the bookcase...") + sendItemDialogue(player, Items.BOOK_ON_CHEMICALS_711, "You find a book on chemicals.") + addItemOrDrop(player, Items.BOOK_ON_CHEMICALS_711) + return@on true + } + + on(Scenery.SIGNPOST_2366, SCENERY, "read") { player, _ -> + sendMessage(player, "This site is for training purposes only.") + return@on true + } + + on(Scenery.SIGNPOST_2367, SCENERY, "read") { player, _ -> + sendMessage(player, "Level 1 digs only.") + return@on true + } + + on(Scenery.SIGNPOST_2368, SCENERY, "read") { player, _ -> + sendMessage(player, "Level 2 digs only.") + return@on true + } + + on(Scenery.SIGNPOST_2369, SCENERY, "read") { player, _ -> + sendMessage(player, "Level 3 digs only.") + return@on true + } + + on(Scenery.SIGNPOST_2370, SCENERY, "read") { player, _ -> + sendMessage(player, "Private dig.") + return@on true + } + + on(Scenery.SIGNPOST_2371, SCENERY, "read") { player, _ -> + sendMessage(player, "Digsite educational centre.") + return@on true + } + + } +} \ No newline at end of file diff --git a/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/CuratorHaigHalenDialogue.java b/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/CuratorHaigHalenDialogue.java deleted file mode 100644 index aa8676778..000000000 --- a/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/CuratorHaigHalenDialogue.java +++ /dev/null @@ -1,74 +0,0 @@ -package content.region.misthalin.varrock.quest.shieldofarrav; - -import core.game.dialogue.DialoguePlugin; -import core.game.dialogue.FacialExpression; -import core.game.node.entity.npc.NPC; -import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.diary.DiaryType; -import core.game.dialogue.IfTopic; -import content.region.desert.quest.thegolem.CuratorHaigHalenGolemDialogue; - -/** - * Represents the curator haig halen dialogue. - */ -public final class CuratorHaigHalenDialogue extends DialoguePlugin { - - /** - * Constructs a new {@code CuratorHaigHalenDialogue} {@code Object}. - */ - public CuratorHaigHalenDialogue() { - /** - * empty. - */ - } - - /** - * Constructs a new {@code CuratorHaigHalenDialogue} {@code Object}. - * @param player the player. - */ - public CuratorHaigHalenDialogue(Player player) { - super(player); - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new CuratorHaigHalenDialogue(player); - } - - @Override - public boolean open(Object... args) { - npc = (NPC) args[0]; - interpreter.sendDialogues(npc, FacialExpression.HAPPY, "Welcome to the museum of Varrock."); - if (player.getQuestRepository().getPoints() >= 50 && !player.getAchievementDiaryManager().hasCompletedTask(DiaryType.VARROCK, 0 ,12)) { - player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 0, 12); - } - stage = 0; - return true; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - switch(stage) { - case 0: - boolean fallthrough = showTopics( - new IfTopic("I have the Shield of Arrav", new CuratorHaigHalenSOADialogue(), - player.getQuestRepository().getQuest("Shield of Arrav").getStage(player) == 70 - , false), - new IfTopic("I'm looking for a statuette recovered from the city of Uzer.", new CuratorHaigHalenGolemDialogue(), - player.getQuestRepository().getQuest("The Golem").getStage(player) == 3 - , false) - ); - if(fallthrough) { stage = 1; handle(interfaceId, buttonId); } - break; - case 1: - end(); - break; - } - return true; - } - - @Override - public int[] getIds() { - return new int[] { 646 }; - } -} diff --git a/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/CuratorHaigHalenDialogue.kt b/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/CuratorHaigHalenDialogue.kt new file mode 100644 index 000000000..aa24c2ca2 --- /dev/null +++ b/Server/src/main/content/region/misthalin/varrock/quest/shieldofarrav/CuratorHaigHalenDialogue.kt @@ -0,0 +1,84 @@ +package content.region.misthalin.varrock.quest.shieldofarrav + +import content.region.desert.quest.thegolem.CuratorHaigHalenGolemDialogue +import content.region.misthalin.digsite.quest.thedigsite.TheDigSite +import core.api.* +import core.game.dialogue.* +import core.game.node.entity.player.Player +import core.game.node.entity.player.link.diary.DiaryType +import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE +import org.rs09.consts.Items +import org.rs09.consts.NPCs + +class CuratorHaigHalenDialogue (player: Player? = null) : DialoguePlugin(player) { + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when (stage) { + START_DIALOGUE -> npcl(FacialExpression.NEUTRAL, "Welcome to Varrock Museum!").also { + if (player.getQuestRepository().points >= 50 && !player.achievementDiaryManager.hasCompletedTask(DiaryType.VARROCK, 0, 12)) { + player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 0, 12) + } + if (getQuestStage(player, TheDigSite.questName) == 1 && inInventory(player, Items.UNSTAMPED_LETTER_682) ) { + stage = 11 // Couldn't do a dialogueFile for digsite as it needs to resume the topic after. + } + stage++ + } + 1 -> showTopics( + Topic(FacialExpression.FRIENDLY, "Have you any interesting news?", 2), + Topic(FacialExpression.FRIENDLY, "Do you know where I could find any treasure?", 8), + IfTopic(FacialExpression.FRIENDLY, "I've lost the letter of recommendation.", 18, getQuestStage(player, TheDigSite.questName) == 2 && !inInventory(player, Items.SEALED_LETTER_683)), + IfTopic("I have the Shield of Arrav", CuratorHaigHalenSOADialogue(), + getQuestStage(player, "Shield of Arrav") == 70, false), + IfTopic("I'm looking for a statuette recovered from the city of Uzer.", CuratorHaigHalenGolemDialogue(), + getQuestStage(player, "The Golem") == 3, false) + ) + 2 -> npcl(FacialExpression.FRIENDLY, "Yes, we found a rather interesting island to the north of Morytania. We believe that it may be of archaeological significance.").also { stage++ } + 3 -> playerl(FacialExpression.FRIENDLY, "Oh? That sounds interesting.").also { stage++ } + 4 -> npcl(FacialExpression.FRIENDLY, "Indeed. I suspect we'll be looking for qualified archaeologists once we have constructed our canal and barge.").also { stage++ } + 5 -> playerl(FacialExpression.FRIENDLY, "Would I qualify then?").also { stage++ } + // These three dialogues are based on what he would say depending on what stage of the quest/kudos you have. I'm too lazy to implement this part as the kudos system isn't implemented yet and this is all cosmetic. + // "Unfortunately, you haven't passed your Earth Science", "exams so you aren't qualified to help us on the dig. If" "you're interested, visit the Exam Centre on the Dig Site", "to the east and talk to the examiners there." + // "Unfortunately, you haven't earned enough kudos yet to", "help us on the dig. If you're interested in helping us", "out and getting that Kudos, simply help out around the", "Museum. You can find out more at the information" ANOTHER DIALOGUE "booth." PLAYER "Ok, thanks. + // After 150 kudos I think "Yes indeed. You've helped us a great deal around the", "Museum and you have the necessary qualifications from", "the Earth Sciences exams. When the canal is ready,", "we'll let you know." + 6 -> npcl(FacialExpression.FRIENDLY, "You've certainly done a lot to help out Varrock Museum, so we'd be silly not to ask for your expertise.").also { stage++ } + 7 -> playerl(FacialExpression.FRIENDLY, "Thank you. I'll look forward to it!").also { + stage = END_DIALOGUE + } + 8 -> npcl(FacialExpression.FRIENDLY, "Look around you! This museum is full of treasures!").also { stage++ } + 9 -> playerl(FacialExpression.FRIENDLY, "No, I meant treasures for ME.").also { stage++ } + 10 -> npcl(FacialExpression.FRIENDLY, "Any treasures this museum knows about it goes to great lengths to acquire.").also { + stage = END_DIALOGUE + } + 11 -> player(FacialExpression.FRIENDLY, "I've been given this letter by an examiner at the Dig", "Site. Can you stamp this for me?").also { stage++ } + 12 -> npc(FacialExpression.FRIENDLY, "What have we here? A letter of recommendation", "indeed...").also { stage++ } + // The next two dialogues are supposed to expand based on the player.username length, but I have no time for this shit. + 13 -> npcl(FacialExpression.FRIENDLY, "The letter here says you name is ${player.username}. Well ${player.username}, I wouldn't normally do this for just anyone, but as you did us such a great service with the Shield of Arrav I don't see why not.").also { stage++ } + 14 -> npcl(FacialExpression.FRIENDLY, "Run this letter back to the Examiner to begin your adventure into the world of Earth Sciences. Enjoy your studies, Student!").also { stage++ } + 15 -> npc(FacialExpression.FRIENDLY, "There you go, good luck student... Be sure to come", "back and show me your certificates. I would like to see", "how you get on.").also { + if (removeItem(player, Items.UNSTAMPED_LETTER_682)) { + addItemOrDrop(player, Items.SEALED_LETTER_683) + } + stage++ + } + 16 -> playerl(FacialExpression.FRIENDLY, "Ok, I will. Thanks, see you later.").also { + if(getQuestStage(player, TheDigSite.questName) == 1) { + setQuestStage(player, TheDigSite.questName, 2) + } + stage = 1 + } + 18 -> npc(FacialExpression.FRIENDLY, "Yes, I saw you drop it as you walked off last time. Here it is.").also { + addItemOrDrop(player, Items.SEALED_LETTER_683) + stage = 1 + } + } + return true + } + + override fun newInstance(player: Player): DialoguePlugin { + return CuratorHaigHalenDialogue(player) + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.CURATOR_HAIG_HALEN_646) + } +} diff --git a/Server/src/main/core/game/dialogue/DialogueBuilder.kt b/Server/src/main/core/game/dialogue/DialogueBuilder.kt index f1051e45a..454ea29a5 100644 --- a/Server/src/main/core/game/dialogue/DialogueBuilder.kt +++ b/Server/src/main/core/game/dialogue/DialogueBuilder.kt @@ -407,6 +407,12 @@ class DialogueBuilder(var target: DialogueBuilderFile, var clauseIndex: Int = -1 return DialogueBranchBuilder(target, clauseIndex, branches) } + fun branchStages(f: (Player) -> Int): DialogueBranchBuilder { + var branches = BranchesData(HashMap(), f) + target.data[clauseIndex].nodes.add(BranchNode(branches)) + return DialogueBranchBuilder(target, clauseIndex, branches) + } + fun branchBoolAttribute(attrName: String, defaultVal: Boolean): DialogueBranchBuilder { return branch({ player -> return@branch if(player.getAttribute(attrName, defaultVal)) { 1 } else { 0 } }) } diff --git a/Server/src/main/core/net/packet/PacketProcessor.kt b/Server/src/main/core/net/packet/PacketProcessor.kt index c4b877e1f..78be623b3 100644 --- a/Server/src/main/core/net/packet/PacketProcessor.kt +++ b/Server/src/main/core/net/packet/PacketProcessor.kt @@ -270,7 +270,7 @@ object PacketProcessor { } is Packet.ItemExamine -> { val def = ItemDefinition.forId(pkt.id) ?: return - pkt.player.debug("[ITEM] ID: ${pkt.id} Value: ${def.value}") + pkt.player.debug("[ITEM] ID: ${pkt.id} Value: ${def.value} Model: ${def.interfaceModelId}") pkt.player.sendMessage(def.examine) } is Packet.SceneryExamine -> {