Repository reorganisation
Unified kotlin and java into just src/main Unified the rs09 and core packages Took all content out of the core package, and placed it into the new content package Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
@@ -0,0 +1,526 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a building hotspot.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
public enum BuildHotspot {
|
||||
|
||||
/**
|
||||
* Low level garden hotspots.
|
||||
*/
|
||||
CENTREPIECE_1(15361, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.PORTAL, Decoration.ROCK, Decoration.POND, Decoration.IMP_STATUE, Decoration.SMALL_OBELISK, Decoration.DUNGEON_ENTRANCE),
|
||||
BIG_TREE_1(15362, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.BIG_DEAD_TREE, Decoration.BIG_TREE, Decoration.BIG_OAK_TREE, Decoration.BIG_WILLOW_TREE, Decoration.BIG_MAPLE_TREE, Decoration.BIG_YEW_TREE, Decoration.BIG_MAGIC_TREE),
|
||||
TREE_1(15363, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.DEAD_TREE, Decoration.TREE, Decoration.OAK_TREE, Decoration.WILLOW_TREE, Decoration.MAPLE_TREE, Decoration.YEW_TREE, Decoration.MAGIC_TREE),
|
||||
BIG_PLANT_1(15364, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.FERN, Decoration.BUSH, Decoration.TALL_PLANT),
|
||||
BIG_PLANT_2(15365, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.SHORT_PLANT, Decoration.LARGE_LEAF_PLANT, Decoration.HUGE_PLANT),
|
||||
SMALL_PLANT_1(15366, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.PLANT, Decoration.SMALL_FERN, Decoration.FERN_SP),
|
||||
SMALL_PLANT_2(15367, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.DOCK_LEAF, Decoration.THISTLE, Decoration.REEDS),
|
||||
|
||||
/**
|
||||
* Low level Parlor hotspots.
|
||||
*/
|
||||
CHAIRS_1(15410, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CRUDE_CHAIR,Decoration.WOODEN_CHAIR, Decoration.ROCKING_CHAIR, Decoration.OAK_CHAIR, Decoration.OAK_ARMCHAIR, Decoration.TEAK_ARMCHAIR, Decoration.MAHOGANY_ARMCHAIR),
|
||||
CHAIRS_2(15411, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CRUDE_CHAIR, Decoration.WOODEN_CHAIR,Decoration.ROCKING_CHAIR, Decoration.OAK_CHAIR, Decoration.OAK_ARMCHAIR, Decoration.TEAK_ARMCHAIR, Decoration.MAHOGANY_ARMCHAIR),
|
||||
CHAIRS_3(15412, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CRUDE_CHAIR, Decoration.WOODEN_CHAIR,Decoration.ROCKING_CHAIR, Decoration.OAK_CHAIR, Decoration.OAK_ARMCHAIR, Decoration.TEAK_ARMCHAIR, Decoration.MAHOGANY_ARMCHAIR),
|
||||
FIREPLACE(15418, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CLAY_FIREPLACE, Decoration.STONE_FIREPLACE,Decoration.MARBLE_FIREPLACE),
|
||||
FIREPLACE2(15267, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CLAY_FIREPLACE, Decoration.STONE_FIREPLACE,Decoration.MARBLE_FIREPLACE),
|
||||
CURTAINS(15419, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_MID_ANIM, Decoration.TORN_CURTAINS, Decoration.CURTAINS, Decoration.OPULENT_CURTAINS),
|
||||
BOOKCASE(15416, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.WOODEN_BOOKCASE, Decoration.OAK_BOOKCASE, Decoration.MAHOGANY_BOOKCASE),
|
||||
RUG(15415, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_CORNER, Decoration.RED_RUG_CORNER, Decoration.OPULENT_RUG_CORNER),
|
||||
RUG2(15414, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_END, Decoration.RED_RUG_END, Decoration.OPULENT_RUG_END),
|
||||
RUG3(15413, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_CENTER, Decoration.RED_RUG_CENTER, Decoration.OPULENT_RUG_CENTER),
|
||||
|
||||
/**
|
||||
* Low level Kitchen hotspots.
|
||||
*/
|
||||
LARDER(15403, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.WOODEN_LARDER, Decoration.OAK_LARDER,Decoration.TEAK_LARDER),
|
||||
SINK(15404, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.PUMP_AND_DRAIN, Decoration.PUMP_AND_TUB, Decoration.SINK),
|
||||
KITCHEN_TABLE(15405, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.KITCHEN_WOODEN_TABLE,Decoration.KITCHEN_OAK_TABLE, Decoration.KITCHEN_TEAK_TABLE),
|
||||
CAT_BLANKET(15402, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CAT_BLANKET, Decoration.CAT_BASKET,Decoration.CAST_BASKET_CUSHIONED),
|
||||
STOVE(15398, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.BASIC_FIREPIT, Decoration.FIREPIT_WITH_HOOK, Decoration.FIREPIT_WITH_POT, Decoration.SMALL_OVEN, Decoration.LARGE_OVEN, Decoration.BASIC_RANGE, Decoration.FANCY_RANGE),
|
||||
SHELVES(15400, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.WOODEN_SHELVES_1,Decoration.WOODEN_SHELVES_2, Decoration.WOODEN_SHELVES_3,Decoration.OAK_SHELVES_1, Decoration.OAK_SHELVES_2, Decoration.TEAK_SHELVES_1, Decoration.TEAK_SHELVES_2),
|
||||
SHELVES_2(15399, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.WOODEN_SHELVES_1,Decoration.WOODEN_SHELVES_2, Decoration.WOODEN_SHELVES_3,Decoration.OAK_SHELVES_1, Decoration.OAK_SHELVES_2,Decoration.TEAK_SHELVES_1, Decoration.TEAK_SHELVES_2),
|
||||
BARRELS(15401, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.BASIC_BEER_BARREL, Decoration.CIDER_BARREL,Decoration.ASGARNIAN_ALE_BARREL, Decoration.GREENMANS_ALE_BARREL,Decoration.DRAGON_BITTER_BARREL, Decoration.CHEFS_DELIGHT_BARREL),
|
||||
|
||||
/**
|
||||
* Low-level Dining hotspots.
|
||||
*/
|
||||
FIREPLACE_DINING(15301, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CLAY_FIREPLACE, Decoration.STONE_FIREPLACE, Decoration.MARBLE_FIREPLACE),
|
||||
DINING_TABLE(15298, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.DINING_TABLE_WOOD, Decoration.DINING_TABLE_OAK, Decoration.DINING_TABLE_CARVED_OAK, Decoration.DINING_TABLE_TEAK,Decoration.DINING_TABLE_CARVED_TEAK, Decoration.DINING_TABLE_MAHOGANY,Decoration.DINING_TABLE_OPULENT),
|
||||
DINING_CURTAINS(15302, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_MID_ANIM, Decoration.TORN_CURTAINS, Decoration.CURTAINS, Decoration.OPULENT_CURTAINS),
|
||||
DINING_BENCH_1(15300, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_MID_ANIM, Decoration.BENCH_WOODEN, Decoration.BENCH_OAK, Decoration.BENCH_CARVED_OAK, Decoration.BENCH_TEAK, Decoration.BENCH_CARVED_TEAK, Decoration.BENCH_MAHOGANY, Decoration.BENCH_GILDED),
|
||||
DINING_BENCH_2(15299, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_MID_ANIM, Decoration.BENCH_WOODEN, Decoration.BENCH_OAK, Decoration.BENCH_CARVED_OAK, Decoration.BENCH_TEAK, Decoration.BENCH_CARVED_TEAK, Decoration.BENCH_MAHOGANY,Decoration.BENCH_GILDED),
|
||||
ROPE_BELL_PULL(15304, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.ROPE_PULL, Decoration.BELL_PULL, Decoration.FANCY_BELL_PULL),
|
||||
WALL_DECORATION(15303, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_DECORATION, Decoration.TEAK_DECORATION, Decoration.GILDED_DECORATION),
|
||||
|
||||
/**
|
||||
* Low-level Work shop hotspots.
|
||||
*/
|
||||
REPAIR(15448, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.REPAIR_BENCH, Decoration.WHETSTONE, Decoration.ARMOUR_STAND),
|
||||
WORKBENCH(15439, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.WORKBENCH_WOODEN, Decoration.WORKBENCH_OAK,Decoration.WORKBENCH_STEEL_FRAME, Decoration.WORKBENCH_WITH_VICE,Decoration.WORKBENCH_WITH_LATHE),
|
||||
CRAFTING(15441, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CRAFTING_TABLE_1, Decoration.CRAFTING_TABLE_2,Decoration.CRAFTING_TABLE_3, Decoration.CRAFTING_TABLE_4),
|
||||
TOOL1(15443, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.TOOL_STORE_1, Decoration.TOOL_STORE_2, Decoration.TOOL_STORE_3, Decoration.TOOL_STORE_4, Decoration.TOOL_STORE_5),
|
||||
TOOL2(15444, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.TOOL_STORE_1, Decoration.TOOL_STORE_2,Decoration.TOOL_STORE_3, Decoration.TOOL_STORE_4,Decoration.TOOL_STORE_5),
|
||||
TOOL3(15445, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.TOOL_STORE_1, Decoration.TOOL_STORE_2,Decoration.TOOL_STORE_3, Decoration.TOOL_STORE_4,Decoration.TOOL_STORE_5),
|
||||
TOOL4(15446, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.TOOL_STORE_1, Decoration.TOOL_STORE_2,Decoration.TOOL_STORE_3, Decoration.TOOL_STORE_4,Decoration.TOOL_STORE_5),
|
||||
TOOL5(15447, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.TOOL_STORE_1, Decoration.TOOL_STORE_2,Decoration.TOOL_STORE_3, Decoration.TOOL_STORE_4,Decoration.TOOL_STORE_5),
|
||||
HERALDRY(15450, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.PLUMING_STAND, Decoration.SHIELD_EASEL,Decoration.BANNER_EASEL),
|
||||
|
||||
/**
|
||||
* Bedroom hotspots.
|
||||
*/
|
||||
BED(15260, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.WOODEN_BED, Decoration.OAK_BED, Decoration.LARGE_OAK_BED, Decoration.TEAK_BED, Decoration.LARGE_TEAK_BED, Decoration.FOUR_POSTER, Decoration.GILDED_FOUR_POSTER),
|
||||
CLOCK(15268, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_CLOCK, Decoration.TEAK_CLOCK, Decoration.GILDED_CLOCK),
|
||||
DRESSER(15262, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.SHAVING_STAND, Decoration.OAK_SHAVING_STAND, Decoration.OAK_DRESSER, Decoration.TEAK_DRESSER, Decoration.FANCY_TEAK_DRESSER, Decoration.MAHOGANY_DRESSER, Decoration.GILDED_DRESSER),
|
||||
DRAWERS(15261, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.SHOE_BOX, Decoration.OAK_DRAWERS, Decoration.OAK_WARDROBE, Decoration.TEAK_DRAWERS, Decoration.TEAK_WARDROBE, Decoration.MAHOGANY_WARDROBE, Decoration.GILDED_WARDROBE),
|
||||
BEDROOM_CURTAINS(15263, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_MID_ANIM, Decoration.TORN_CURTAINS, Decoration.CURTAINS, Decoration.OPULENT_CURTAINS),
|
||||
BEDROOM_RUG(15264, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_CENTER, Decoration.RED_RUG_CENTER, Decoration.OPULENT_RUG_CENTER),
|
||||
BEDROOM_RUG2(15265, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_END, Decoration.RED_RUG_END, Decoration.OPULENT_RUG_END),
|
||||
BEDROOM_RUG3(15266, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_CORNER, Decoration.RED_RUG_CORNER, Decoration.OPULENT_RUG_CORNER),
|
||||
|
||||
/**
|
||||
* Skill hall hotspots.
|
||||
*/
|
||||
ARMOUR_SPACE(15385, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.MITHRIL_ARMOUR, Decoration.ADAMANT_ARMOUR, Decoration.RUNE_ARMOUR),
|
||||
ARMOUR_SPACE2(15384, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.MITHRIL_ARMOUR, Decoration.ADAMANT_ARMOUR, Decoration.RUNE_ARMOUR),
|
||||
HEAD_TROPHY(15382, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.CRAWLING_HAND, Decoration.COCKATRICE_HEAD, Decoration.BASILISK_HEAD, Decoration.KURASK_HEAD, Decoration.ABYSSAL_DEMON_HEAD, Decoration.KBD_HEAD, Decoration.KQ_HEAD),
|
||||
RUNE_CASE(15386, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.RUNE_CASE1, Decoration.RUNE_CASE2),
|
||||
FISHING_TROPHY(15383, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.MOUNTED_BASS, Decoration.MOUNTED_SWORDFISH, Decoration.MOUNTED_SHARK),
|
||||
HALL_RUG(15377, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_CENTER, Decoration.RED_RUG_CENTER, Decoration.OPULENT_RUG_CENTER),
|
||||
HALL_RUG2(15378, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_END, Decoration.RED_RUG_END, Decoration.OPULENT_RUG_END),
|
||||
HALL_RUG3(15379, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_CORNER, Decoration.RED_RUG_CORNER, Decoration.OPULENT_RUG_CORNER),
|
||||
|
||||
/**
|
||||
* Games room hotspots.
|
||||
*/
|
||||
RANGING_GAME(15346, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.HOOP_AND_STICK, Decoration.DARTBOARD, Decoration.ARCHERY_TARGET),
|
||||
ATTACK_STONE(15344, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CLAY_STONE, Decoration.LIMESTONE_STONE, Decoration.MARBLE_STONE),
|
||||
PRIZE_CHEST(15343, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_CHEST, Decoration.TEAK_CHEST, Decoration.MAHOGANY_CHEST),
|
||||
ELEMENTAL_BALANCE(15345, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.BALANCE_1, Decoration.BALANCE_2, Decoration.BALANCE_3),
|
||||
GAME_SPACE(15342, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.JESTER, Decoration.TREASURE_HUNT, Decoration.HANGMAN),
|
||||
|
||||
/**
|
||||
* Portal room hotspots.
|
||||
*/
|
||||
TELEPORT_FOCUS(15409, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.TELEPORT_FOCUS, Decoration.GREATER_TELEPORT_FOCUS, Decoration.SCRYING_POOL),
|
||||
PORTAL1(15406, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.TEAK_PORTAL, Decoration.MAHOGANY_PORTAL, Decoration.MARBLE_PORTAL,
|
||||
Decoration.TEAK_VARROCK_PORTAL,
|
||||
Decoration.MAHOGANY_VARROCK_PORTAL,
|
||||
Decoration.MARBLE_VARROCK_PORTAL,
|
||||
Decoration.TEAK_LUMBRIDGE_PORTAL,
|
||||
Decoration.MAHOGANY_LUMBRIDGE_PORTAL,
|
||||
Decoration.MARBLE_LUMBRIDGE_PORTAL,
|
||||
Decoration.TEAK_FALADOR_PORTAL,
|
||||
Decoration.MAHOGANY_FALADOR_PORTAL,
|
||||
Decoration.MARBLE_FALADOR_PORTAL,
|
||||
Decoration.TEAK_CAMELOT_PORTAL,
|
||||
Decoration.MAHOGANY_CAMELOT_PORTAL,
|
||||
Decoration.MARBLE_CAMELOT_PORTAL,
|
||||
Decoration.TEAK_ARDOUGNE_PORTAL,
|
||||
Decoration.MAHOGANY_ARDOUGNE_PORTAL,
|
||||
Decoration.MARBLE_ARDOUGNE_PORTAL,
|
||||
Decoration.TEAK_YANILLE_PORTAL,
|
||||
Decoration.MAHOGANY_YANILLE_PORTAL,
|
||||
Decoration.MARBLE_YANILLE_PORTAL,
|
||||
Decoration.TEAK_KHARYRLL_PORTAL,
|
||||
Decoration.MAHOGANY_KHARYRLL_PORTAL,
|
||||
Decoration.MARBLE_KHARYRLL_PORTAL),
|
||||
PORTAL2(15407, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.TEAK_PORTAL, Decoration.MAHOGANY_PORTAL, Decoration.MARBLE_PORTAL,
|
||||
Decoration.TEAK_VARROCK_PORTAL,
|
||||
Decoration.MAHOGANY_VARROCK_PORTAL,
|
||||
Decoration.MARBLE_VARROCK_PORTAL,
|
||||
Decoration.TEAK_LUMBRIDGE_PORTAL,
|
||||
Decoration.MAHOGANY_LUMBRIDGE_PORTAL,
|
||||
Decoration.MARBLE_LUMBRIDGE_PORTAL,
|
||||
Decoration.TEAK_FALADOR_PORTAL,
|
||||
Decoration.MAHOGANY_FALADOR_PORTAL,
|
||||
Decoration.MARBLE_FALADOR_PORTAL,
|
||||
Decoration.TEAK_CAMELOT_PORTAL,
|
||||
Decoration.MAHOGANY_CAMELOT_PORTAL,
|
||||
Decoration.MARBLE_CAMELOT_PORTAL,
|
||||
Decoration.TEAK_ARDOUGNE_PORTAL,
|
||||
Decoration.MAHOGANY_ARDOUGNE_PORTAL,
|
||||
Decoration.MARBLE_ARDOUGNE_PORTAL,
|
||||
Decoration.TEAK_YANILLE_PORTAL,
|
||||
Decoration.MAHOGANY_YANILLE_PORTAL,
|
||||
Decoration.MARBLE_YANILLE_PORTAL,
|
||||
Decoration.TEAK_KHARYRLL_PORTAL,
|
||||
Decoration.MAHOGANY_KHARYRLL_PORTAL,
|
||||
Decoration.MARBLE_KHARYRLL_PORTAL),
|
||||
PORTAL3(15408, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.TEAK_PORTAL, Decoration.MAHOGANY_PORTAL, Decoration.MARBLE_PORTAL,
|
||||
Decoration.TEAK_VARROCK_PORTAL,
|
||||
Decoration.MAHOGANY_VARROCK_PORTAL,
|
||||
Decoration.MARBLE_VARROCK_PORTAL,
|
||||
Decoration.TEAK_LUMBRIDGE_PORTAL,
|
||||
Decoration.MAHOGANY_LUMBRIDGE_PORTAL,
|
||||
Decoration.MARBLE_LUMBRIDGE_PORTAL,
|
||||
Decoration.TEAK_FALADOR_PORTAL,
|
||||
Decoration.MAHOGANY_FALADOR_PORTAL,
|
||||
Decoration.MARBLE_FALADOR_PORTAL,
|
||||
Decoration.TEAK_CAMELOT_PORTAL,
|
||||
Decoration.MAHOGANY_CAMELOT_PORTAL,
|
||||
Decoration.MARBLE_CAMELOT_PORTAL,
|
||||
Decoration.TEAK_ARDOUGNE_PORTAL,
|
||||
Decoration.MAHOGANY_ARDOUGNE_PORTAL,
|
||||
Decoration.MARBLE_ARDOUGNE_PORTAL,
|
||||
Decoration.TEAK_YANILLE_PORTAL,
|
||||
Decoration.MAHOGANY_YANILLE_PORTAL,
|
||||
Decoration.MARBLE_YANILLE_PORTAL,
|
||||
Decoration.TEAK_KHARYRLL_PORTAL,
|
||||
Decoration.MAHOGANY_KHARYRLL_PORTAL,
|
||||
Decoration.MARBLE_KHARYRLL_PORTAL),
|
||||
|
||||
/**
|
||||
* Quest Hall hotspots.
|
||||
*/
|
||||
GUILD_TROPHY(15394, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.ANTIDRAGON_SHIELD, Decoration.AMULET_OF_GLORY, Decoration.CAPE_OF_LEGENDS),
|
||||
PORTRAIT(15392, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.KING_ARTHUR, Decoration.ELENA, Decoration.GIANT_DWARF, Decoration.MISCELLANIANS),
|
||||
LANDSCAPE(15393, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.LUMBRIDGE, Decoration.THE_DESERT, Decoration.MORYTANIA, Decoration.KARAMJA, Decoration.ISAFDAR),
|
||||
SWORD(15395, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.SILVERLIGHT, Decoration.EXCALIBUR, Decoration.DARKLIGHT),
|
||||
MAP(15396, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.SMALL_MAP, Decoration.MEDIUM_MAP, Decoration.LARGE_MAP),
|
||||
BOOKCASE2(15397, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.WOODEN_BOOKCASE, Decoration.OAK_BOOKCASE, Decoration.MAHOGANY_BOOKCASE),
|
||||
|
||||
/**
|
||||
* Manegerie Hotspots
|
||||
*/
|
||||
OBELISK(44911, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.MINI_OBELISK),
|
||||
PET_FEEDER(44910, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_PET_FEEDER, Decoration.TEAK_PET_FEEDER, Decoration.MAHOGANY_PET_FEEDER),
|
||||
PET_HOUSE(44909, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_PET_HOUSE, Decoration.TEAK_PET_HOUSE, Decoration.MAHOGANY_PET_HOUSE, Decoration.CONSECRATED_PET_HOUSE, Decoration.DESECRATED_PET_HOUSE, Decoration.NATURAL_PET_HOUSE),
|
||||
HABITAT_1(44907, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.GARDEN_HABITAT, Decoration.JUNGLE_HABITAT, Decoration.DESERT_HABITAT, Decoration.POLAR_HABITAT, Decoration.VOLCANIC_HABITAT),
|
||||
HABITAT_2(44908, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.GARDEN_HABITAT, Decoration.JUNGLE_HABITAT, Decoration.DESERT_HABITAT, Decoration.POLAR_HABITAT, Decoration.VOLCANIC_HABITAT),
|
||||
|
||||
|
||||
/**
|
||||
* Combat room hotspots.
|
||||
*/
|
||||
WALL_DECORATION2(15297, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_DECORATION, Decoration.TEAK_DECORATION, Decoration.GILDED_DECORATION),
|
||||
STORAGE_SPACE(15296, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.GLOVE_RACK, Decoration.WEAPONS_RACK, Decoration.EXTRA_WEAPONS_RACK),
|
||||
CR_RING(15277, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_RING, Decoration.FENCING_RING, Decoration.COMBAT_RING, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_CORNER(15278, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_RING, Decoration.FENCING_RING, Decoration.COMBAT_RING, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_CORNER2(15279, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_RING, Decoration.FENCING_RING, Decoration.COMBAT_RING, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_RING3(15280, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_RING, Decoration.FENCING_RING, Decoration.COMBAT_RING, Decoration.NOTHING, Decoration.MAGIC_BARRIER),
|
||||
CR_CORNER3(15281, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_RING, Decoration.FENCING_RING, Decoration.COMBAT_RING, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_CORNER4(15282, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_RING, Decoration.FENCING_RING, Decoration.COMBAT_RING, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_INVISIBLE_WALL(15283, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.INVISIBLE_WALL, Decoration.INVISIBLE_WALL, Decoration.INVISIBLE_WALL, Decoration.INVISIBLE_WALL, Decoration.MAGIC_BARRIER),
|
||||
CR_INVISIBLE_WALL2(15284, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.INVISIBLE_WALL2, Decoration.INVISIBLE_WALL2, Decoration.INVISIBLE_WALL2, Decoration.INVISIBLE_WALL2, Decoration.MAGIC_BARRIER),
|
||||
CR_INVISIBLE_WALL3(15285, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.INVISIBLE_WALL3, Decoration.INVISIBLE_WALL3, Decoration.INVISIBLE_WALL3, Decoration.INVISIBLE_WALL3, Decoration.MAGIC_BARRIER),
|
||||
CR_RING4(15286, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_RING, Decoration.FENCING_RING, Decoration.COMBAT_RING, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_RING2(15287, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_RING, Decoration.FENCING_RING, Decoration.COMBAT_RING, Decoration.NOTHING, Decoration.MAGIC_BARRIER),
|
||||
CR_FLOOR(15288, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_MAT_SIDE, Decoration.FENCING_MAT_SIDE, Decoration.COMBAT_MAT_SIDE, Decoration.BALANCE_BEAM_CENTER, Decoration.NOTHING2),
|
||||
CR_FLOOR2(15289, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_MAT_CORNER, Decoration.FENCING_MAT_CORNER, Decoration.COMBAT_MAT_CORNER, Decoration.BALANCE_BEAM_RIGHT, Decoration.NOTHING2),
|
||||
CR_FLOOR3(15290, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_MAT_CORNER, Decoration.FENCING_MAT_CORNER, Decoration.COMBAT_MAT_CORNER, Decoration.BALANCE_BEAM_LEFT, Decoration.RANGING_PEDESTALS),
|
||||
CR_FLOOR4(15291, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_MAT_SIDE, Decoration.FENCING_MAT_SIDE, Decoration.COMBAT_MAT_SIDE, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_FLOOR5(15292, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_MAT, Decoration.FENCING_MAT, Decoration.COMBAT_MAT, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_FLOOR6(15293, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_MAT_SIDE, Decoration.FENCING_MAT_SIDE, Decoration.COMBAT_MAT_SIDE, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_FLOOR7(15294, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_MAT_CORNER, Decoration.FENCING_MAT_CORNER, Decoration.COMBAT_MAT_CORNER, Decoration.NOTHING, Decoration.NOTHING2),
|
||||
CR_FLOOR8(15295, BuildHotspotType.LINKED, BuildingUtils.BUILD_MID_ANIM, Decoration.BOXING_MAT_CORNER, Decoration.FENCING_MAT_CORNER, Decoration.COMBAT_MAT_CORNER, Decoration.NOTHING, Decoration.RANGING_PEDESTALS),
|
||||
|
||||
/**
|
||||
* Quest hall hotspots.
|
||||
*/
|
||||
Q_HALL_RUG(15387, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_CENTER, Decoration.RED_RUG_CENTER, Decoration.OPULENT_RUG_CENTER),
|
||||
Q_HALL_RUG2(15388, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_END, Decoration.RED_RUG_END, Decoration.OPULENT_RUG_END),
|
||||
Q_HALL_RUG3(15389, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_CORNER, Decoration.RED_RUG_CORNER, Decoration.OPULENT_RUG_CORNER),
|
||||
|
||||
|
||||
/**
|
||||
* Study hotspots.
|
||||
*/
|
||||
GLOBE(15421, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.GLOBE, Decoration.ORNAMENTAL_GLOBE, Decoration.LUNAR_GLOBE, Decoration.CELESTIAL_GLOBE, Decoration.ARMILLARY_SPHERE, Decoration.SMALL_ORREY, Decoration.LARGE_ORREY),
|
||||
LECTERN(15420, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_LECTERN, Decoration.EAGLE_LECTERN, Decoration.DEMON_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN),
|
||||
CRYSTAL_BALL(15422, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.CRYSTAL_BALL, Decoration.ELEMENTAL_SPHERE, Decoration.CRYSTAL_OF_POWER),
|
||||
BOOKCASE3(15425, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.WOODEN_BOOKCASE, Decoration.OAK_BOOKCASE, Decoration.MAHOGANY_BOOKCASE),
|
||||
WALL_CHART(15423, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.ALCHEMICAL_CHART, Decoration.ASTRONOMICAL_CHART, Decoration.INFERNAL_CHART),
|
||||
TELESCOPE(15424, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.TELESCOPE1, Decoration.TELESCOPE2, Decoration.TELESCOPE3),
|
||||
|
||||
/**
|
||||
* Costume room hotspots.
|
||||
*/
|
||||
TREASURE_CHEST(18813, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_TREASURE_CHEST, Decoration.TEAK_TREASURE_CHEST, Decoration.MAHOGANY_TREASURE_CHEST),
|
||||
ARMOUR_CASE(18815, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_ARMOUR_CASE, Decoration.TEAK_ARMOUR_CASE, Decoration.MGANY_ARMOUR_CASE),
|
||||
MAGIC_WARDROBE(18811, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_MAGIC_WARDROBE, Decoration.C_OAK_MAGIC_WARDROBE, Decoration.TEAK_MAGIC_WARDROBE, Decoration.C_TEAK_MAGIC_WARDROBE, Decoration.MGANY_MAGIC_WARDROBE, Decoration.GILDED_MAGIC_WARDROBE, Decoration.MARBLE_MAGIC_WARDROBE),
|
||||
CAPE_RACK(18810, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_CAPE_RACK, Decoration.TEAK_CAPE_RACK, Decoration.MGANY_CAPE_RACK, Decoration.GILDED_CAPE_RACK, Decoration.MARBLE_CAPE_RACK, Decoration.MAGIC_CAPE_RACK),
|
||||
TOY_BOX(18812, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_TOY_BOX, Decoration.TEAK_TOY_BOX, Decoration.MAHOGANY_TOY_BOX),
|
||||
COSTUME_BOX(18814, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_COSTUME_BOX, Decoration.TEAK_COSTUME_BOX, Decoration.MAHOGANY_COSTUME_BOX),
|
||||
|
||||
/**
|
||||
* Chapel hotspots.
|
||||
*/
|
||||
ALTAR(15270, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_ALTAR, Decoration.TEAK_ALTAR, Decoration.CLOTH_ALTAR, Decoration.MAHOGANY_ALTAR, Decoration.LIMESTONE_ALTAR, Decoration.MARBLE_ALTAR, Decoration.GILDED_ALTAR),
|
||||
STATUE(15275, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.SMALL_STATUE, Decoration.MEDIUM_STATUE, Decoration.LARGE_STATUE),
|
||||
MUSICAL(15276, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.WINDCHIMES, Decoration.BELLS, Decoration.ORGAN),
|
||||
ICON(15269, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.SARADOMIN_SYMBOL, Decoration.ZAMORAK_SYMBOL, Decoration.GUTHIX_SYMBOL, Decoration.SARADOMIN_ICON, Decoration.ZAMORAK_ICON, Decoration.GUTHIX_ICON, Decoration.ICON_OF_BOB),
|
||||
BURNERS(15271, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_MID_ANIM, Decoration.STEEL_TORCHES, Decoration.WOODEN_TORCHES, Decoration.STEEL_CANDLESTICKS, Decoration.GOLD_CANDLESTICKS, Decoration.INCENSE_BURNERS, Decoration.MAHOGANY_BURNERS, Decoration.MARBLE_BURNERS),
|
||||
CHAPEL_WINDOW(new int[] { 13730, 13728, 13732, 13729, 13733, 13731}, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_HIGH_ANIM, Decoration.SHUTTERED_WINDOW, Decoration.DECORATIVE_WINDOW, Decoration.STAINED_GLASS),
|
||||
CHAPEL_RUG(15273, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_END, Decoration.RED_RUG_END, Decoration.OPULENT_RUG_END),
|
||||
CHAPEL_RUG2(15274, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.BROWN_RUG_CORNER, Decoration.RED_RUG_CORNER, Decoration.OPULENT_RUG_CORNER),
|
||||
|
||||
/**
|
||||
* Formal garden hotspots.
|
||||
*/
|
||||
CENTREPIECE_2(15368, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.PORTAL, Decoration.GAZEBO, Decoration.DUNGEON_ENTRANCE, Decoration.SMALL_FOUNTAIN, Decoration.LARGE_FOUNTAIN, Decoration.POSH_FOUNTAIN),
|
||||
FENCING(15369, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_HIGH_ANIM, Decoration.BOUNDARY_STONES, Decoration.WOODEN_FENCE, Decoration.STONE_WALL, Decoration.IRON_RAILINGS, Decoration.PICKET_FENCE, Decoration.GARDEN_FENCE, Decoration.MARBLE_WALL),
|
||||
SMALL_PLANT1(15375, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.SUNFLOWER, Decoration.MARIGOLDS, Decoration.ROSES),
|
||||
BIG_PLANT1(15373, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.SUNFLOWER_BIG, Decoration.MARIGOLDS_BIG, Decoration.ROSES_BIG),
|
||||
SMALL_PLANT2(15376, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.ROSEMARY, Decoration.DAFFODILS, Decoration.BLUEBELLS),
|
||||
BIG_PLANT2(15374, BuildHotspotType.INDIVIDUAL, BuildingUtils.PLANT_ANIM, Decoration.ROSEMARY_BIG, Decoration.DAFFODILS_BIG, Decoration.BLUEBELLS_BIG),
|
||||
HEDGE1(15370, BuildHotspotType.LINKED, BuildingUtils.PLANT_ANIM, Decoration.THORNY_HEDGE1, Decoration.NICE_HEDGE1, Decoration.SMALL_BOX_HEDGE1, Decoration.TOPIARY_HEDGE1, Decoration.FANCY_HEDGE1, Decoration.TALL_FANCY_HEDGE1, Decoration.TALL_BOX_HEDGE1),
|
||||
HEDGE2(15371, BuildHotspotType.LINKED, BuildingUtils.PLANT_ANIM, Decoration.THORNY_HEDGE2, Decoration.NICE_HEDGE2, Decoration.SMALL_BOX_HEDGE2, Decoration.TOPIARY_HEDGE2, Decoration.FANCY_HEDGE2, Decoration.TALL_FANCY_HEDGE2, Decoration.TALL_BOX_HEDGE2),
|
||||
HEDGE3(15372, BuildHotspotType.LINKED, BuildingUtils.PLANT_ANIM, Decoration.THORNY_HEDGE3, Decoration.NICE_HEDGE3, Decoration.SMALL_BOX_HEDGE3, Decoration.TOPIARY_HEDGE3, Decoration.FANCY_HEDGE3, Decoration.TALL_FANCY_HEDGE3, Decoration.TALL_BOX_HEDGE3),
|
||||
|
||||
/**
|
||||
* Throne room hotspots.
|
||||
*/
|
||||
THRONE(15426, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_THRONE, Decoration.TEAK_THRONE, Decoration.MAHOGANY_THRONE, Decoration.GILDED_THRONE, Decoration.SKELETON_THRONE, Decoration.CRYSTAL_THRONE, Decoration.DEMONIC_THRONE),
|
||||
LEVER(15435, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.OAK_LEVER, Decoration.TEAK_LEVER, Decoration.MAHOGANY_LEVER),
|
||||
FLOOR(new int[] { 15427, 15428, 15429, 15430, 15431, 15432 }, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_LOW_ANIM, Decoration.FLOOR_DECORATION, Decoration.STEEL_CAGE, Decoration.FLOOR_TRAP, Decoration.MAGIC_CIRCLE, Decoration.MAGIC_CAGE),
|
||||
SEATING1(15436, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_MID_ANIM, Decoration.CARVED_TEAK_BENCH, Decoration.MAHOGANY_BENCH, Decoration.GILDED_BENCH),
|
||||
SEATING2(15437, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_MID_ANIM, Decoration.CARVED_TEAK_BENCH, Decoration.MAHOGANY_BENCH, Decoration.GILDED_BENCH),
|
||||
TRAPDOOR(15438, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_LOW_ANIM, Decoration.OAK_TRAPDOOR, Decoration.TEAK_TRAPDOOR, Decoration.MAHOGANY_TRAPDOOR),
|
||||
DECORATION(15434, BuildHotspotType.CREST, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_DECO, Decoration.TEAK_DECO, Decoration.GILDED_DECO, Decoration.ROUND_SHIELD, Decoration.SQUARE_SHIELD, Decoration.KITE_SHIELD),
|
||||
|
||||
/**
|
||||
* Oubliette hotspots.
|
||||
*/
|
||||
FLOOR_MID(15347, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.SPIKES_MID, Decoration.TENTACLE_MID, Decoration.FP_FLOOR_MID, Decoration.ROCNAR_FLOOR_MID),
|
||||
FLOOR_SIDE(15348, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.SPIKES_SIDE, Decoration.TENTACLE_SIDE, Decoration.FP_FLOOR_SIDE, Decoration.ROCNAR_FLOOR_SIDE),
|
||||
FLOOR_CORNER(15349, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.SPIKES_CORNER, Decoration.TENTACLE_CORNER, Decoration.FP_FLOOR_CORNER, Decoration.ROCNAR_FLOOR_CORNER),
|
||||
OUBLIETTE_FLOOR(15350, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.SPIKES_FL, Decoration.TENTACLE_FL, Decoration.FLAME_PIT, Decoration.ROCNAR_FL),
|
||||
OUBLIETTE_FLOOR_1(15351, BuildHotspotType.LINKED, BuildingUtils.BUILD_LOW_ANIM, Decoration.SPIKES_FL, Decoration.TENTACLE_FL, Decoration.FLAME_PIT, Decoration.ROCNAR),
|
||||
PRISON(15352, BuildHotspotType.LINKED, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_CAGE, Decoration.OAK_STEEL_CAGE, Decoration.STEEL_CAGE_OU, Decoration.SPIKED_CAGE, Decoration.BONE_CAGE),
|
||||
PRISON_DOOR(15353, BuildHotspotType.LINKED, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_CAGE_DOOR, Decoration.OAK_STEEL_CAGE_DOOR, Decoration.STEEL_CAGE_DOOR, Decoration.SPIKED_CAGE_DOOR, Decoration.BONE_CAGE_DOOR),
|
||||
GUARD(15354, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.SKELETON_GUARD, Decoration.GUARD_DOG, Decoration.HOBGOBLIN, Decoration.BABY_RED_DRAGON, Decoration.HUGE_SPIDER, Decoration.TROLL, Decoration.HELLHOUND),
|
||||
LADDER(15356, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_LADDER, Decoration.TEAK_LADDER, Decoration.MAHOGANY_LADDER),
|
||||
OUBLIETTE_LIGHT(15355, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_HIGH_ANIM, Decoration.CANDLE, Decoration.TORCH, Decoration.SKULL_TORCH),
|
||||
|
||||
/**
|
||||
* Corridor, junction, stairs, TODO: pit trap
|
||||
*/
|
||||
DUNGEON_DOOR_LEFT(15328, BuildHotspotType.LINKED, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_DOOR_LEFT, Decoration.STEEL_DOOR_LEFT, Decoration.MARBLE_DOOR_LEFT),
|
||||
DUNGEON_DOOR_RIGHT(15329, BuildHotspotType.LINKED, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_DOOR_RIGHT, Decoration.STEEL_DOOR_RIGHT, Decoration.MARBLE_DOOR_RIGHT),
|
||||
DUNGEON_DOOR_LEFT2(15326, BuildHotspotType.LINKED, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_DOOR_LEFT, Decoration.STEEL_DOOR_LEFT, Decoration.MARBLE_DOOR_LEFT),
|
||||
DUNGEON_DOOR_RIGHT2(15327, BuildHotspotType.LINKED, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_DOOR_RIGHT, Decoration.STEEL_DOOR_RIGHT, Decoration.MARBLE_DOOR_RIGHT),
|
||||
DUNGEON_DOOR_LEFT3(36672, BuildHotspotType.LINKED, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_DOOR_LEFT, Decoration.STEEL_DOOR_LEFT, Decoration.MARBLE_DOOR_LEFT),
|
||||
DUNGEON_DOOR_RIGHT3(36675, BuildHotspotType.LINKED, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_DOOR_RIGHT, Decoration.STEEL_DOOR_RIGHT, Decoration.MARBLE_DOOR_RIGHT),
|
||||
DUNGEON_TRAP(15324, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_LOW_ANIM, Decoration.SPIKE_TRAP, Decoration.MAN_TRAP, Decoration.TANGLE_TRAP, Decoration.MARBLE_TRAP, Decoration.TELEPORT_TRAP),
|
||||
DUNGEON_TRAP2(15325, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_LOW_ANIM, Decoration.SPIKE_TRAP, Decoration.MAN_TRAP, Decoration.TANGLE_TRAP, Decoration.MARBLE_TRAP, Decoration.TELEPORT_TRAP),
|
||||
DUNGEON_LIGHT(15330, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_HIGH_ANIM, Decoration.CANDLE, Decoration.TORCH, Decoration.SKULL_TORCH),
|
||||
DUNGEON_DECO(15331, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_HIGH_ANIM, Decoration.DECORATIVE_BLOOD, Decoration.DECORATIVE_PIPE, Decoration.HANGING_SKELETON),
|
||||
DUNGEON_GUARD(15323, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.SKELETON_GUARD, Decoration.GUARD_DOG, Decoration.HOBGOBLIN, Decoration.BABY_RED_DRAGON, Decoration.HUGE_SPIDER, Decoration.TROLL, Decoration.HELLHOUND),
|
||||
DUNGEON_GUARD2(15336, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.SKELETON_GUARD, Decoration.GUARD_DOG, Decoration.HOBGOBLIN, Decoration.BABY_RED_DRAGON, Decoration.HUGE_SPIDER, Decoration.TROLL, Decoration.HELLHOUND),
|
||||
DUNGEON_GUARD3(15337, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.SKELETON_GUARD, Decoration.GUARD_DOG, Decoration.HOBGOBLIN, Decoration.BABY_RED_DRAGON, Decoration.HUGE_SPIDER, Decoration.TROLL, Decoration.HELLHOUND),
|
||||
DUNGEON_LIGHT2(34138, BuildHotspotType.RECURSIVE, BuildingUtils.BUILD_HIGH_ANIM, Decoration.CANDLE, Decoration.TORCH, Decoration.SKULL_TORCH),
|
||||
DUNGEON_PIT_GUARD(36676, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.PIT_DOG, Decoration.PIT_OGRE, Decoration.PIT_ROCK_PROTECTOR, Decoration.PIT_SCABARITE, Decoration.PIT_BLACK_DEMON, Decoration.PIT_IRON_DRAGON),
|
||||
|
||||
/**
|
||||
* Treasure room
|
||||
*/
|
||||
MONSTER(15257, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.DEMON, Decoration.KALPHITE_SOLDIER, Decoration.TOK_XIL, Decoration.DAGANNOTH, Decoration.STEEL_DRAGON),
|
||||
TREASURE_CHEST1(15256, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_MID_ANIM, Decoration.WOODEN_CRATE, Decoration.OAK_T_CHEST, Decoration.TEAK_T_CHEST, Decoration.MGANY_T_CHEST, Decoration.MAGIC_CHEST),
|
||||
WALL_DECORATION1(15259, BuildHotspotType.CREST, BuildingUtils.BUILD_HIGH_ANIM, Decoration.ROUND_SHIELD, Decoration.SQUARE_SHIELD, Decoration.KITE_SHIELD),
|
||||
|
||||
/**
|
||||
* Stairways.
|
||||
*/
|
||||
STAIRWAYS(15380, BuildHotspotType.STAIRCASE, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_STAIRCASE, Decoration.TEAK_STAIRCASE, Decoration.SPIRAL_STAIRCASE, Decoration.MARBLE_STAIRCASE, Decoration.MARBLE_SPIRAL),
|
||||
QUEST_STAIRWAYS(15390, BuildHotspotType.STAIRCASE, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_STAIRCASE, Decoration.TEAK_STAIRCASE, Decoration.SPIRAL_STAIRCASE, Decoration.MARBLE_STAIRCASE, Decoration.MARBLE_SPIRAL),
|
||||
STAIRWAYS_DUNGEON(new int[] { 15380, 15380, 15380, 15380, 15390, 15390}, BuildHotspotType.STAIRCASE, BuildingUtils.BUILD_HIGH_ANIM, Decoration.OAK_STAIRCASE, Decoration.TEAK_STAIRCASE, Decoration.SPIRAL_STAIRCASE, Decoration.MARBLE_STAIRCASE, Decoration.MARBLE_SPIRAL),
|
||||
|
||||
/**
|
||||
* Stairways.
|
||||
*/
|
||||
STAIRS_DOWN(15381, BuildHotspotType.STAIRCASE, BuildingUtils.BUILD_LOW_ANIM, Decoration.OAK_STAIRS_DOWN, Decoration.TEAK_STAIRS_DOWN, Decoration.SPIRAL_STAIRS_DOWN, Decoration.MARBLE_STAIRS_DOWN, Decoration.MARBLE_SPIRAL_DOWN),
|
||||
STAIRS_DOWN2(15391, BuildHotspotType.STAIRCASE, BuildingUtils.BUILD_LOW_ANIM, Decoration.OAK_STAIRS_DOWN, Decoration.TEAK_STAIRS_DOWN, Decoration.SPIRAL_STAIRS_DOWN, Decoration.MARBLE_STAIRS_DOWN, Decoration.MARBLE_SPIRAL_DOWN),
|
||||
|
||||
|
||||
/**
|
||||
* Window hotspots.
|
||||
*/
|
||||
WINDOW(13830, BuildHotspotType.INDIVIDUAL, BuildingUtils.BUILD_HIGH_ANIM, Decoration.BASIC_WOOD_WINDOW, Decoration.BASIC_STONE_WINDOW, Decoration.WHITEWASHED_STONE_WINDOW, Decoration.FREMENNIK_WINDOW, Decoration.TROPICAL_WOOD_WINDOW, Decoration.FANCY_STONE_WINDOW),
|
||||
;
|
||||
|
||||
/**
|
||||
* The object id.
|
||||
*/
|
||||
private final int objectId;
|
||||
|
||||
/**
|
||||
* The object ids.
|
||||
*/
|
||||
private final int[] objectIds;
|
||||
|
||||
/**
|
||||
* The decorations to build on this hotspot.
|
||||
*/
|
||||
private final Decoration[] decorations;
|
||||
|
||||
/**
|
||||
* The hotspot type.
|
||||
*/
|
||||
private final BuildHotspotType type;
|
||||
|
||||
/**
|
||||
* The building animation.
|
||||
*/
|
||||
private final Animation buildingAnimation;
|
||||
|
||||
/**
|
||||
* The linked hotspots
|
||||
*/
|
||||
private static final List<BuildHotspot[]> linkedHotspots = new ArrayList<BuildHotspot[]>();
|
||||
|
||||
/**
|
||||
* Configures hotspots.
|
||||
*/
|
||||
static {
|
||||
linkedHotspots.add(new BuildHotspot[] { RUG, RUG2, RUG3 });
|
||||
linkedHotspots.add(new BuildHotspot[] { BEDROOM_RUG, BEDROOM_RUG2, BEDROOM_RUG3 });
|
||||
linkedHotspots.add(new BuildHotspot[] { HALL_RUG, HALL_RUG2, HALL_RUG3 });
|
||||
linkedHotspots.add(new BuildHotspot[] { CR_CORNER, CR_CORNER2, CR_CORNER3, CR_CORNER4, CR_RING,
|
||||
CR_RING2, CR_RING3, CR_RING4, CR_FLOOR, CR_FLOOR2, CR_FLOOR3, CR_FLOOR4, CR_FLOOR5,
|
||||
CR_FLOOR6, CR_FLOOR7, CR_FLOOR8, CR_INVISIBLE_WALL, CR_INVISIBLE_WALL2, CR_INVISIBLE_WALL3});
|
||||
linkedHotspots.add(new BuildHotspot[] { Q_HALL_RUG, Q_HALL_RUG2, Q_HALL_RUG3 });
|
||||
linkedHotspots.add(new BuildHotspot[] { CHAPEL_RUG, CHAPEL_RUG2 });
|
||||
linkedHotspots.add(new BuildHotspot[] { HEDGE1, HEDGE2, HEDGE3 });
|
||||
linkedHotspots.add(new BuildHotspot[] { FLOOR_MID, FLOOR_SIDE, FLOOR_CORNER, OUBLIETTE_FLOOR, OUBLIETTE_FLOOR_1 });
|
||||
linkedHotspots.add(new BuildHotspot[] { PRISON, PRISON_DOOR });
|
||||
linkedHotspots.add(new BuildHotspot[] { DUNGEON_DOOR_LEFT, DUNGEON_DOOR_RIGHT });
|
||||
linkedHotspots.add(new BuildHotspot[] { DUNGEON_DOOR_LEFT2, DUNGEON_DOOR_RIGHT2 });
|
||||
linkedHotspots.add(new BuildHotspot[] { HABITAT_1, HABITAT_2 });
|
||||
linkedHotspots.add(new BuildHotspot[] { SMALL_PLANT_1, SMALL_PLANT1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BuildHotspot} {@code Object}.
|
||||
* @param objectId The object id.
|
||||
* @param buildingAnimation The building animation.
|
||||
* @param decorations The decoration.
|
||||
*/
|
||||
private BuildHotspot(int objectId, BuildHotspotType type, Animation buildingAnimation, Decoration... decorations) {
|
||||
this.objectId = objectId;
|
||||
this.objectIds = null;
|
||||
this.type = type;
|
||||
this.buildingAnimation = buildingAnimation;
|
||||
this.decorations = decorations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BuildHotspot} {@code Object}.
|
||||
* @param objectIds The objects ids.
|
||||
* @param buildingAnimation The building animation.
|
||||
* @param decorations The decoration.
|
||||
*/
|
||||
private BuildHotspot(int[] objectIds, BuildHotspotType type, Animation buildingAnimation, Decoration... decorations) {
|
||||
this.objectId = objectIds[0];
|
||||
this.objectIds = objectIds;
|
||||
this.type = type;
|
||||
this.buildingAnimation = buildingAnimation;
|
||||
this.decorations = decorations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the building hotspot for the given object id.
|
||||
* @param id The object id.
|
||||
* @param style The housing style.
|
||||
* @return The building hotspot.
|
||||
*/
|
||||
public static BuildHotspot forId(int id, HousingStyle style) {
|
||||
for (BuildHotspot spot : values()) {
|
||||
if (spot.getObjectId(style) == id) {
|
||||
return spot;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the linked hotspots (if any)
|
||||
* @param b - the buildhotspot to find linked hotspots
|
||||
* @return BuildHotspot[] or null
|
||||
*/
|
||||
public static BuildHotspot[] getLinkedHotspots(BuildHotspot b) {
|
||||
for (BuildHotspot[] list : linkedHotspots) {
|
||||
for (BuildHotspot bh : list) {
|
||||
if (bh == b) {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the decoration index.
|
||||
* @param deco The decoration.
|
||||
* @return The index.
|
||||
*/
|
||||
public int getDecorationIndex(Decoration deco) {
|
||||
for (int i = 0; i < decorations.length; i++) {
|
||||
if (decorations[i] == deco) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the objectId.
|
||||
* @param style The current housing style.
|
||||
* @return The objectId.
|
||||
*/
|
||||
public int getObjectId(HousingStyle style) {
|
||||
if (objectIds != null) {
|
||||
return objectIds[style.ordinal()];
|
||||
}
|
||||
return objectId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the objectId.
|
||||
* @return The objectId.
|
||||
*/
|
||||
public int getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type
|
||||
* @return type
|
||||
*/
|
||||
public BuildHotspotType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the decorations.
|
||||
* @return The decorations.
|
||||
*/
|
||||
public Decoration[] getDecorations() {
|
||||
return decorations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the objectIds value.
|
||||
* @return The objectIds.
|
||||
*/
|
||||
public int[] getObjectIds() {
|
||||
return objectIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the buildingAnimation value.
|
||||
* @return The buildingAnimation.
|
||||
*/
|
||||
public Animation getBuildingAnimation() {
|
||||
return buildingAnimation;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
/**
|
||||
* BuiltHotspotType
|
||||
* @author Clayton Williams
|
||||
* @date Jul 26, 2015
|
||||
*/
|
||||
public enum BuildHotspotType {
|
||||
|
||||
INDIVIDUAL,
|
||||
RECURSIVE,
|
||||
LINKED,
|
||||
CREST,
|
||||
STAIRCASE;
|
||||
|
||||
BuildHotspotType() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
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.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.SystemLogger;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
/**
|
||||
* The build option handling plugin.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class BuildOptionPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.setOptionHandler("build", this);
|
||||
SceneryDefinition.setOptionHandler("remove", this);
|
||||
ClassScanner.definePlugin(new RemoveDialogue());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
if (!player.getHouseManager().isBuildingMode()) {
|
||||
player.getPacketDispatch().sendMessage("You have to be in building mode to do this.");
|
||||
return true;
|
||||
}
|
||||
Scenery object = ((Scenery) node);
|
||||
if (option.equals("remove")) {
|
||||
Decoration decoration = Decoration.getDecoration(player, object);
|
||||
if (decoration == null || !object.isActive()) {
|
||||
return false;
|
||||
}
|
||||
player.getDialogueInterpreter().open("con:removedec", object);
|
||||
return true;
|
||||
}
|
||||
player.setAttribute("con:hsobject", node);
|
||||
if (BuildingUtils.isDoorHotspot(object)) {
|
||||
int[] pos = BuildingUtils.roomExists(player, object);
|
||||
if (pos != null) {
|
||||
player.getDialogueInterpreter().open("con:remove", "room", pos);
|
||||
return true;
|
||||
}
|
||||
if (player.getHouseManager().getRoomAmount() < player.getHouseManager().getMaximumRooms(player)) {
|
||||
player.getInterfaceManager().open(new Component(402));
|
||||
|
||||
|
||||
} else {
|
||||
player.getPacketDispatch().sendMessage("You currently have the maximum amount of rooms available.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Hotspot hotspot = player.getHouseManager().getHotspot(object);
|
||||
if (hotspot == null || !isBuildable(player, object, hotspot)) {
|
||||
System.out.println(hotspot == null);
|
||||
SystemLogger.logErr(this.getClass(), "Construction (building): " + hotspot + " : " + object + " chunkX = " + object.getLocation().getChunkX() + ", chunkY = " + object.getLocation().getChunkY());
|
||||
return true;
|
||||
}
|
||||
|
||||
player.setAttribute("con:hotspot", hotspot);
|
||||
BuildingUtils.openBuildInterface(player, hotspot.getHotspot());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the hotspot can be used.
|
||||
* @param player The player.
|
||||
* @param hotspot The hotspot.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
private static boolean isBuildable(Player player, Scenery object, Hotspot hotspot) {
|
||||
Room room = player.getHouseManager().getRoom(object.getLocation());
|
||||
if (room == null) {
|
||||
return false;
|
||||
}
|
||||
switch (hotspot.getHotspot()) {
|
||||
case STAIRWAYS:
|
||||
case STAIRS_DOWN:
|
||||
case STAIRWAYS_DUNGEON:
|
||||
if (room.isBuilt(BuildHotspot.HALL_RUG)) {
|
||||
player.getPacketDispatch().sendMessage("You can't build a staircase on a rug.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case HALL_RUG:
|
||||
case HALL_RUG2:
|
||||
case HALL_RUG3:
|
||||
if (room.isBuilt(BuildHotspot.STAIRWAYS) || room.isBuilt(BuildHotspot.STAIRS_DOWN) || room.isBuilt(BuildHotspot.STAIRWAYS_DUNGEON)) {
|
||||
player.getPacketDispatch().sendMessage("You can't build a rug under a staircase.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case QUEST_STAIRWAYS:
|
||||
case STAIRS_DOWN2:
|
||||
if (room.isBuilt(BuildHotspot.Q_HALL_RUG)) {
|
||||
player.getPacketDispatch().sendMessage("You can't build a staircase on a rug.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case Q_HALL_RUG:
|
||||
case Q_HALL_RUG2:
|
||||
case Q_HALL_RUG3:
|
||||
if (room.isBuilt(BuildHotspot.QUEST_STAIRWAYS) || room.isBuilt(BuildHotspot.STAIRS_DOWN2)) {
|
||||
player.getPacketDispatch().sendMessage("You can't build a rug under a staircase.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the removing a decoration dialogue.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
private static class RemoveDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* The object.
|
||||
*/
|
||||
private Scenery object;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code RemoveDialogue} {@code Object}.
|
||||
*/
|
||||
public RemoveDialogue() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code RemoveDialogue} {@code Object}.
|
||||
* @param player The player.
|
||||
*/
|
||||
public RemoveDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new RemoveDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
interpreter.sendOptions("Really remove it?", "Yes", "No");
|
||||
object = (Scenery) args[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
BuildingUtils.removeDecoration(player, object);
|
||||
break;
|
||||
}
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DialogueInterpreter.getDialogueKey("con:removedec") };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.node.scenery.SceneryBuilder;
|
||||
import core.game.world.map.Direction;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.map.RegionChunk;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles the building a room dialogue.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class BuildRoomDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* The door hotspot.
|
||||
*/
|
||||
private Scenery door;
|
||||
|
||||
/**
|
||||
* The direction.
|
||||
*/
|
||||
private Direction[] directions;
|
||||
|
||||
/**
|
||||
* The room exits.
|
||||
*/
|
||||
private boolean[] exits;
|
||||
|
||||
/**
|
||||
* The rotation index.
|
||||
*/
|
||||
private int index;
|
||||
|
||||
/**
|
||||
* The boundaries of the room to build.
|
||||
*/
|
||||
private List<Scenery> boundaries = new ArrayList<>(20);
|
||||
|
||||
/**
|
||||
* The room we're building.
|
||||
*/
|
||||
private Room room;
|
||||
|
||||
/**
|
||||
* The room x-coordinate.
|
||||
*/
|
||||
private int roomX;
|
||||
|
||||
/**
|
||||
* The room y-coordinate.
|
||||
*/
|
||||
private int roomY;
|
||||
|
||||
/**
|
||||
* The room z-coordinate (3 for dungeon).
|
||||
*/
|
||||
private int roomZ;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BuildRoomDialogue} {@code Object}
|
||||
*/
|
||||
public BuildRoomDialogue() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BuildRoomDialogue} {@code Object}
|
||||
* @param player The player.
|
||||
*/
|
||||
public BuildRoomDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new BuildRoomDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
player.getInterfaceManager().close();
|
||||
RoomProperties props = (RoomProperties) args[0];
|
||||
if (player.getSkills().getStaticLevel(Skills.CONSTRUCTION) < props.getLevel()) {
|
||||
interpreter.sendPlainMessage(false, "You need a Construction level of " + props.getLevel() + " to buy this room.");
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
if (!player.getInventory().contains(995, props.getCost())) {
|
||||
interpreter.sendPlainMessage(false, "You need " + props.getCost() + " coins to buy this room.");
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
this.door = (Scenery) player.getAttribute("con:hsobject");
|
||||
int[] pos = BuildingUtils.getRoomPosition(player, door);
|
||||
roomX = pos[0];
|
||||
roomY = pos[1];
|
||||
if (!inBounds()) {
|
||||
interpreter.sendPlainMessage(false, "Your house is too large. TODO: correct message");
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
roomZ = player.getLocation().getZ();
|
||||
if (roomZ != 0) {
|
||||
Room r = player.getHouseManager().getRooms()[roomZ - 1][roomX][roomY];
|
||||
if (r == null || r.getProperties().isLand()) {
|
||||
interpreter.sendPlainMessage(false, "You can't build a room here, you need a room to build on.");
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (HouseManager.isInDungeon(player)) {
|
||||
if (props.isLand()) {
|
||||
interpreter.sendPlainMessage(false, "You can't build this room inside your dungeon.");
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
roomZ = 3;
|
||||
}
|
||||
else if (props.isDungeon()) {
|
||||
interpreter.sendPlainMessage(false, "You can only build this room in your dungeon.");
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
if (props.isLand() && roomZ != 0) {
|
||||
interpreter.sendPlainMessage(false, "A garden can only be on ground floor.");
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
this.room = Room.create(player, props);
|
||||
this.exits = room.getExits(Direction.NORTH);
|
||||
this.index = 0;
|
||||
this.directions = BuildingUtils.getAvailableRotations(player, exits, roomZ, roomX, roomY);
|
||||
while (directions[index] == null) {
|
||||
if (++index == directions.length) {
|
||||
interpreter.sendPlainMessage(false, "There's no space to build this room.");
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
options("Rotate clockwise", "Rotate anticlockwise", "Build", "Cancel");
|
||||
stage = 1;
|
||||
drawGhostRoom();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the room to be built is in the available boundaries of the house.
|
||||
* @return The boundaries.
|
||||
*/
|
||||
private boolean inBounds() {
|
||||
Rectangle bounds = player.getHouseManager().getBoundaries();
|
||||
int max = player.getHouseManager().getMaximumDimension(player);
|
||||
if ((roomX < bounds.x || roomX >= bounds.x + bounds.width) && bounds.width >= max) {
|
||||
return false;
|
||||
}
|
||||
if ((roomY < bounds.y || roomY >= bounds.y + bounds.height) && bounds.height >= max) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean close() {
|
||||
for (Scenery object : boundaries) {
|
||||
SceneryBuilder.remove(object);
|
||||
}
|
||||
boundaries.clear();
|
||||
return super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 1:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
case 2:
|
||||
rotate(buttonId == 2);
|
||||
options("Rotate clockwise", "Rotate anticlockwise", "Build", "Cancel");
|
||||
return true;
|
||||
case 3:
|
||||
if (player.getInventory().remove(new Item(995, room.getProperties().getCost()))) {
|
||||
room.setRotation(directions[index]);
|
||||
boolean[] exit = new boolean[exits.length];
|
||||
for (int i = 0; i < exit.length; i++) {
|
||||
exit[(i + index) % exit.length] = exits[i];
|
||||
}
|
||||
BuildingUtils.buildRoom(player, room, roomZ, roomX, roomY, exit, true);
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
interpreter.sendPlainMessage(false, "You need " + room.getProperties().getCost() + " coins to buy this room.");
|
||||
stage = 2;
|
||||
return true;
|
||||
case 4:
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates the room.
|
||||
* @param counter If we're rotating counter clockwise.
|
||||
*/
|
||||
private void rotate(boolean counter) {
|
||||
Direction direction = null;
|
||||
while ((direction = directions[index = (index + (counter ? 3 : 1)) % 4]) == null) {
|
||||
|
||||
}
|
||||
room.setRotation(direction);
|
||||
drawGhostRoom();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the current boundaries of the room to build.
|
||||
*/
|
||||
private void drawGhostRoom() {
|
||||
for (Scenery object : boundaries) {
|
||||
SceneryBuilder.remove(object);
|
||||
}
|
||||
int rotation = directions[index].toInteger();
|
||||
boundaries.clear();
|
||||
Location base = player.getViewport().getRegion().getBaseLocation().transform(roomX << 3, roomY << 3, player.getLocation().getZ());
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
Scenery[] objects = room.getChunk().getObjects(x, y);
|
||||
for (Scenery object : objects) {
|
||||
if (object != null && object.getDefinition().hasAction("build")) {
|
||||
int[] pos = RegionChunk.getRotatedPosition(x, y, object.getDefinition().getSizeX(), object.getDefinition().getSizeY(), object.getRotation(), rotation);
|
||||
Scenery obj = object.transform(object.getId(), (object.getRotation() + rotation) % 4, base.transform(pos[0], pos[1], 0));
|
||||
boundaries.add(SceneryBuilder.add(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DialogueInterpreter.getDialogueKey("con:room") };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,700 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.node.scenery.SceneryBuilder;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.map.BuildRegionChunk;
|
||||
import core.game.world.map.Direction;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.map.Region;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.net.packet.PacketRepository;
|
||||
import core.net.packet.context.ContainerContext;
|
||||
import core.net.packet.out.ContainerPacket;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Utility class for building.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
public final class BuildingUtils {
|
||||
|
||||
/**
|
||||
* The directions array.
|
||||
*/
|
||||
public static final Direction[] DIRECTIONS = {
|
||||
Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST
|
||||
};
|
||||
|
||||
/**
|
||||
* The building a decoration animation.
|
||||
*/
|
||||
public static final Animation BUILD_LOW_ANIM = Animation.create(3683);
|
||||
|
||||
/**
|
||||
* The building a decoration animation.
|
||||
*/
|
||||
public static final Animation BUILD_MID_ANIM = Animation.create(3676);
|
||||
|
||||
/**
|
||||
* The building a decoration animation.
|
||||
*/
|
||||
public static final Animation BUILD_HIGH_ANIM = Animation.create(3684);
|
||||
|
||||
/**
|
||||
* The planting animation.
|
||||
*/
|
||||
public static final Animation PLANT_ANIM = Animation.create(3691);
|
||||
|
||||
/**
|
||||
* The removing a decoration animation.
|
||||
*/
|
||||
private static final Animation REMOVE_ANIMATION = Animation.create(3685);
|
||||
|
||||
/**
|
||||
* The plank item.
|
||||
*/
|
||||
public static final Item PLANK = new Item(960);
|
||||
|
||||
/**
|
||||
* The watering can(8) item id.
|
||||
*/
|
||||
public static final int WATERING_CAN = 5340;
|
||||
|
||||
private static final int[] BUILD_INDEXES = { 0, 2, 4, 6, 1, 3, 5 };
|
||||
|
||||
/**
|
||||
* Opens the building furniture interface.
|
||||
* @param player The player.
|
||||
* @param hotspot The hotspot.
|
||||
*/
|
||||
public static void openBuildInterface(Player player, BuildHotspot hotspot) {
|
||||
player.getInterfaceManager().open(new Component(396));
|
||||
Item[] items = new Item[7];
|
||||
|
||||
int c261Value = 0;
|
||||
|
||||
for (int menuIndex = 0; menuIndex < 7; menuIndex++) {
|
||||
int itemsStringOffset = 97 + (menuIndex * 5);
|
||||
|
||||
//97 +
|
||||
if (menuIndex >= hotspot.getDecorations().length || (hotspot.getDecorations()[menuIndex] != null && hotspot.getDecorations()[menuIndex].isInvisibleNode())) {
|
||||
for (int j = 0; j < 5; j++) {
|
||||
player.getPacketDispatch().sendString("", 396, itemsStringOffset + j);
|
||||
}
|
||||
player.getPacketDispatch().sendString("", 396, 140 + menuIndex);
|
||||
c261Value += (1 << (menuIndex + 1));
|
||||
continue;
|
||||
}
|
||||
|
||||
Decoration decoration = hotspot.getDecorations()[menuIndex];
|
||||
items[BUILD_INDEXES[menuIndex]] = new Item(decoration.getInterfaceItem());
|
||||
player.getPacketDispatch().sendString(ItemDefinition.forId(decoration.getInterfaceItem()).getName(), 396, itemsStringOffset);
|
||||
boolean hasRequirements = player.getSkills().getLevel(Skills.CONSTRUCTION) >= decoration.getLevel();
|
||||
for (int j = 0; j < 4; j++) {
|
||||
if (j >= decoration.getItems().length) {
|
||||
if (j == decoration.getItems().length && decoration.getNailAmount() > 0) {
|
||||
player.getPacketDispatch().sendString("Nails: " + decoration.getNailAmount(), 396, (itemsStringOffset + 1) + j);
|
||||
} else {
|
||||
player.getPacketDispatch().sendString("", 396, (itemsStringOffset + 1) + j);
|
||||
}
|
||||
} else {
|
||||
Item item = decoration.getItems()[j];
|
||||
if (!player.getInventory().containsItem(item)) {
|
||||
hasRequirements = false;
|
||||
}
|
||||
String s = item.getName() + ": " + item.getAmount();
|
||||
/*if (j > 1 && (decoration == Decoration.RUNE_CASE1 || decoration == Decoration.RUNE_CASE2)) {
|
||||
if (j == 3) {
|
||||
offset--;
|
||||
item = decoration.getItems()[++j];
|
||||
s = item.getName() + ": " + item.getAmount();
|
||||
}
|
||||
item = decoration.getItems()[j + 1];
|
||||
s += ", " + item.getName() + ": " + item.getAmount();
|
||||
player.getPacketDispatch().sendString(s, 396, 15 + offset + j);
|
||||
continue;
|
||||
}*/
|
||||
player.getPacketDispatch().sendString(s, 396, (itemsStringOffset + 1) + j);
|
||||
}
|
||||
}
|
||||
if (hasRequirements) {
|
||||
c261Value += (1 << (menuIndex + 1));
|
||||
}
|
||||
player.getConfigManager().set(1485 + menuIndex, hasRequirements || player.isStaff() ? 1 : 0);
|
||||
player.getPacketDispatch().sendString("Level " + decoration.getLevel(), 396, 140 + menuIndex);
|
||||
//player.getPacketDispatch().sendItemZoomOnInterface(items[i].protocol(), 50000, 396, 49 + i);
|
||||
}
|
||||
System.out.println(c261Value);
|
||||
player.getConfigManager().set(261, c261Value);
|
||||
PacketRepository.send(ContainerPacket.class, new ContainerContext(player, 396, 132, 8, items, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the object is a door hotspot.
|
||||
* @param object The object.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public static boolean isDoorHotspot(Scenery object) {
|
||||
return object.getId() >= 15305 && object.getId() <= 15322;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a decoration object.
|
||||
* @param player The player.
|
||||
* @param deco The decoration.
|
||||
* @param object The object.
|
||||
*/
|
||||
public static void buildDecoration(final Player player, final Hotspot hotspot, final Decoration deco, final Scenery object) {
|
||||
final int nailAmount = deco.getNailAmount();
|
||||
final NailType type = nailAmount > 0 ? NailType.get(player, nailAmount) : null;
|
||||
if (nailAmount > 0 && type == null) {
|
||||
player.getPacketDispatch().sendMessage("You don't have the right materials.");
|
||||
return;
|
||||
}
|
||||
int roomX = object.getLocation().getChunkX();
|
||||
int roomY = object.getLocation().getChunkY();
|
||||
int z = object.getLocation().getZ();
|
||||
Region region = player.getHouseManager().getHouseRegion();
|
||||
if (HouseManager.isInDungeon(player)) {
|
||||
region = player.getHouseManager().getDungeonRegion();
|
||||
z = 3;
|
||||
}
|
||||
final Room room = player.getHouseManager().getRooms()[z][roomX][roomY];
|
||||
if (!canBuildDecoration(player, room, deco, object)) {
|
||||
return;
|
||||
}
|
||||
player.lock(3);
|
||||
player.animate(hotspot.getHotspot().getBuildingAnimation());
|
||||
final Region r = region;
|
||||
player.getPulseManager().run(new Pulse(3, player, object) {
|
||||
int nails = nailAmount;
|
||||
NailType nail = type;
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (nails > 0) {
|
||||
if (!type.isBend()) {
|
||||
player.getPacketDispatch().sendMessage("You use a nail.");
|
||||
nails--;
|
||||
} else {
|
||||
player.getPacketDispatch().sendMessage("You accidently bend a nail.");
|
||||
}
|
||||
player.animate(hotspot.getHotspot().getBuildingAnimation());
|
||||
if (!player.getInventory().remove(new Item(nail.getItemId(), 1))) {
|
||||
return true;
|
||||
}
|
||||
if (nails > 0) {
|
||||
player.lock(4);
|
||||
return false;
|
||||
}
|
||||
} else if (deco.getTools()[0] == WATERING_CAN) {
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
Item can = player.getInventory().getItem(new Item(WATERING_CAN - i, 1));
|
||||
if (can != null && can.getSlot() > -1) {
|
||||
System.out.println("Can index " + (i == 7 ? i + 2 : i + 1) + ".");
|
||||
player.getInventory().replace(new Item(WATERING_CAN - (i == 7 ? i + 2 : i + 1), 1), can.getSlot());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player.getInventory().remove(deco.getItems()) || player.isAdmin()) {
|
||||
setDecoration(player, r, room, hotspot, object, deco);
|
||||
player.getSkills().addExperience(Skills.CONSTRUCTION, deco.getExperience(), true);
|
||||
|
||||
if (getObjectIdsThatGiveFarmingExperience().contains(deco.getObjectId())) {
|
||||
player.getSkills().addExperience(Skills.FARMING, deco.getExperience(), true);
|
||||
}
|
||||
player.unlock();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ArrayList<Integer> getObjectIdsThatGiveFarmingExperience() {
|
||||
return new ArrayList<>(
|
||||
// Garden big tree decorations.
|
||||
Arrays.asList(13411, 13412, 13413, 13414, 13415, 13416, 13417,
|
||||
// Garden tree decorations.
|
||||
13418, 13419, 13420, 13421, 13422, 13423, 13424,
|
||||
// Garden big plant 1 decorations.
|
||||
13425, 13426, 13427,
|
||||
// Garden big plant 2 decorations.
|
||||
13428, 13429, 13430,
|
||||
// Garden small plant 1 decorations.
|
||||
13431, 13432, 13433,
|
||||
// Garden small plant 2 decorations.
|
||||
13434, 13435, 13436));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a decoration for the given hotspot.
|
||||
* @param player The player.
|
||||
* @param region The region.
|
||||
* @param room The room.
|
||||
* @param hotspot The hotspot to set the decoration for.
|
||||
* @param object The object representing the hotspot.
|
||||
* @param deco The decoration to set.
|
||||
*/
|
||||
private static void setDecoration(Player player, Region region, Room room, Hotspot hotspot, Scenery object, Decoration deco) {
|
||||
Location l = object.getLocation();
|
||||
HousingStyle style = player.getHouseManager().getStyle();
|
||||
int decIndex = hotspot.getHotspot().getDecorationIndex(deco);
|
||||
switch(hotspot.getHotspot().getType()) {
|
||||
case STAIRCASE:
|
||||
int z = l.getZ();
|
||||
if (region == player.getHouseManager().getDungeonRegion()) {
|
||||
z = 3;
|
||||
}
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
int plane = (z + (i == -1 ? 3 : i)) % 4;
|
||||
Room r = player.getHouseManager().getRooms()[plane][l.getChunkX()][l.getChunkY()];
|
||||
if (r != null && r.getRotation() == room.getRotation() && !r.getProperties().isLand()) {
|
||||
Hotspot h = r.getStairs();
|
||||
if (h != null) {
|
||||
h.setDecorationIndex(decIndex);
|
||||
Region reg = plane == 3 ? player.getHouseManager().getDungeonRegion() : player.getHouseManager().getHouseRegion();
|
||||
if (reg == null) {
|
||||
continue;
|
||||
}
|
||||
BuildRegionChunk chunk = (BuildRegionChunk) reg.getPlanes()[plane % 3].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||
Scenery[] objects = chunk.getObjects(h.getCurrentX(), h.getCurrentY());
|
||||
for (Scenery o : objects) {
|
||||
if (o != null && o.getType() == object.getType()) {
|
||||
SceneryBuilder.replace(o, o.transform(h.getHotspot().getDecorations()[decIndex].getObjectId(style)));
|
||||
if (plane == 1) {
|
||||
if (r.getProperties() == RoomProperties.SKILL_HALL) {
|
||||
r.updateProperties(player, RoomProperties.SKILL_HALL_2);
|
||||
} else if (r.getProperties() == RoomProperties.QUEST_HALL) {
|
||||
r.updateProperties(player, RoomProperties.QUEST_HALL_2);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
player.getHouseManager().reload(player, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SystemLogger.logErr(BuildingUtils.class, "Couldn't find stairs! " + plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CREST:
|
||||
SceneryBuilder.replace(object, object.transform(deco.getObjectId(style) + player.getHouseManager().getCrest().ordinal()));
|
||||
hotspot.setDecorationIndex(decIndex);
|
||||
break;
|
||||
case INDIVIDUAL:
|
||||
SceneryBuilder.replace(object, object.transform(deco.getObjectId(style)));
|
||||
hotspot.setDecorationIndex(decIndex);
|
||||
break;
|
||||
case RECURSIVE:
|
||||
BuildRegionChunk chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
Hotspot h = room.getHotspot(hotspot.getHotspot(), x, y);
|
||||
if (h != null) {
|
||||
h.setDecorationIndex(decIndex);
|
||||
int objectId = hotspot.getHotspot().getObjectId(style);
|
||||
Scenery o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
||||
if (o != null && objectId == o.getId()) {
|
||||
SceneryBuilder.replace(o, o.transform(hotspot.getHotspot().getDecorations()[decIndex].getObjectId(style)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LINKED:
|
||||
BuildHotspot[] linkedHotspots = BuildHotspot.getLinkedHotspots(hotspot.getHotspot());
|
||||
chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
for (BuildHotspot bh : linkedHotspots) {
|
||||
Hotspot h = room.getHotspot(bh, x, y);
|
||||
if (h != null) {
|
||||
h.setDecorationIndex(decIndex);
|
||||
int objectId = bh.getObjectId(style);
|
||||
Scenery o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
||||
if (o != null && objectId == o.getId()) {
|
||||
SceneryBuilder.replace(o, o.transform(bh.getDecorations()[decIndex].getObjectId(style)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the decoration
|
||||
* @param player the player
|
||||
* @param object the object to remove
|
||||
*/
|
||||
public static void removeDecoration(Player player, Scenery object) {
|
||||
if (object.getId() == Decoration.PORTAL.getObjectId() && player.getHouseManager().getPortalAmount() <= 1) {
|
||||
player.getPacketDispatch().sendMessage("You need atleast one portal, how else would you leave your house?");
|
||||
return;
|
||||
}
|
||||
Location l = object.getLocation();
|
||||
Room room = player.getHouseManager().getRooms()[l.getZ()][l.getChunkX()][l.getChunkY()];
|
||||
Region region = player.getHouseManager().getHouseRegion();
|
||||
if (HouseManager.isInDungeon(player)) {
|
||||
region = player.getHouseManager().getDungeonRegion();
|
||||
room = player.getHouseManager().getRooms()[3][l.getChunkX()][l.getChunkY()];
|
||||
}
|
||||
HousingStyle style = player.getHouseManager().getStyle();
|
||||
for (int i = 0; i < room.getHotspots().length; i++) {
|
||||
Hotspot hotspot = room.getHotspots()[i];
|
||||
int objectId = hotspot.getDecorationIndex() < 0 ? -1 : hotspot.getHotspot().getDecorations()[hotspot.getDecorationIndex()].getObjectId(style);
|
||||
if (hotspot.getHotspot().getType() == BuildHotspotType.CREST) {
|
||||
objectId += player.getHouseManager().getCrest().ordinal();
|
||||
}
|
||||
if (objectId == object.getId() && hotspot.getCurrentX() == l.getChunkOffsetX() && hotspot.getCurrentY() == l.getChunkOffsetY()) {
|
||||
player.animate(REMOVE_ANIMATION);
|
||||
removeDecoration(player, region, room, hotspot, object, style);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the decoration.
|
||||
* @param player The player.
|
||||
* @param region The region.
|
||||
* @param room The room.
|
||||
* @param hotspot The hotspot to remove the decoration from.
|
||||
* @param object The object.
|
||||
* @param style The housing style.
|
||||
*/
|
||||
private static void removeDecoration(Player player, Region region, Room room, Hotspot hotspot, Scenery object, HousingStyle style) {
|
||||
Location l = object.getLocation();
|
||||
switch (hotspot.getHotspot().getType()) {
|
||||
case STAIRCASE:
|
||||
int z = l.getZ();
|
||||
if (region == player.getHouseManager().getDungeonRegion()) {
|
||||
z = 3;
|
||||
}
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
int plane = (z + (i == -1 ? 3 : i)) % 4;
|
||||
Room r = player.getHouseManager().getRooms()[plane][l.getChunkX()][l.getChunkY()];
|
||||
if (r != null && r.getRotation() == room.getRotation()) {
|
||||
Hotspot h = r.getStairs();
|
||||
if (h != null) {
|
||||
h.setDecorationIndex(-1);
|
||||
Region reg = plane == 3 ? player.getHouseManager().getDungeonRegion() : player.getHouseManager().getHouseRegion();
|
||||
if (reg == null) {
|
||||
continue;
|
||||
}
|
||||
BuildRegionChunk chunk = (BuildRegionChunk) reg.getPlanes()[plane % 3].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||
Scenery[] objects = chunk.getObjects(h.getCurrentX(), h.getCurrentY());
|
||||
for (Scenery o : objects) {
|
||||
if (o != null && o.getType() == object.getType()) {
|
||||
SceneryBuilder.replace(o, o.transform(h.getHotspot().getObjectId(style)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SystemLogger.logErr(BuildingUtils.class, "Couldn't find stairs! " + plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l.getZ() == 1) {
|
||||
if (room.getProperties() == RoomProperties.SKILL_HALL_2) {
|
||||
room.updateProperties(player, RoomProperties.SKILL_HALL);
|
||||
}
|
||||
else if (room.getProperties() == RoomProperties.QUEST_HALL_2) {
|
||||
room.updateProperties(player, RoomProperties.QUEST_HALL);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
player.getHouseManager().reload(player, true);
|
||||
}
|
||||
break;
|
||||
case INDIVIDUAL:
|
||||
case CREST:
|
||||
SceneryBuilder.replace(object, object.transform(hotspot.getHotspot().getObjectId(style)));
|
||||
hotspot.setDecorationIndex(-1);
|
||||
break;
|
||||
case RECURSIVE:
|
||||
BuildRegionChunk chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
Hotspot h = room.getHotspot(hotspot.getHotspot(), x, y);
|
||||
if (h != null) {
|
||||
int objectId = hotspot.getHotspot().getDecorations()[h.getDecorationIndex()].getObjectId(style);
|
||||
Scenery o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
||||
h.setDecorationIndex(-1);
|
||||
if (o != null && objectId == o.getId()) {
|
||||
SceneryBuilder.replace(o, o.transform(hotspot.getHotspot().getObjectId(style)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LINKED:
|
||||
BuildHotspot[] linkedHotspots = BuildHotspot.getLinkedHotspots(hotspot.getHotspot());
|
||||
chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
for (BuildHotspot bh : linkedHotspots) {
|
||||
Hotspot h = room.getHotspot(bh, x, y);
|
||||
if (h != null) {
|
||||
int objectId = bh.getDecorations()[h.getDecorationIndex()].getObjectId(style);
|
||||
Scenery o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
||||
h.setDecorationIndex(-1);
|
||||
if (o != null && objectId == o.getId()) {
|
||||
SceneryBuilder.replace(o, o.transform(bh.getObjectId(style)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the decoration can be built.
|
||||
* @param player The player.
|
||||
* @param deco The decoration.
|
||||
* @param object The object.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
private static boolean canBuildDecoration(Player player, Room room, Decoration deco, Scenery object) {
|
||||
switch (deco) {
|
||||
case TENTACLE_MID:
|
||||
case TENTACLE_SIDE:
|
||||
case TENTACLE_CORNER:
|
||||
case TENTACLE_FL:
|
||||
if (!room.isBuilt(BuildHotspot.PRISON)) {
|
||||
player.getPacketDispatch().sendMessage("You can't build a tentacle pool without a cage.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the decoration can be built.
|
||||
* @param player The player.
|
||||
* @param hotspot The hotspot.
|
||||
* @param object The object.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private static boolean setLinkedHotspot(Player player, Room room, Hotspot hotspot, int decorationIndex, Scenery object) {
|
||||
Location l = object.getLocation();
|
||||
int z = l.getZ();
|
||||
switch (hotspot.getHotspot()) {
|
||||
case STAIRWAYS:
|
||||
case QUEST_STAIRWAYS:
|
||||
case STAIRWAYS_DUNGEON:
|
||||
BuildHotspot[] stairs = { BuildHotspot.STAIRS_DOWN, BuildHotspot.STAIRS_DOWN2, BuildHotspot.STAIRWAYS, BuildHotspot.QUEST_STAIRWAYS, BuildHotspot.STAIRWAYS_DUNGEON };
|
||||
for (int i = 0; i < 2; i++) {
|
||||
int plane = (z + 1 + (i * 2)) % 4;
|
||||
Room r = player.getHouseManager().getRooms()[plane][l.getChunkX()][l.getChunkY()];
|
||||
if (r != null) {
|
||||
for (BuildHotspot h : stairs) {
|
||||
Hotspot hs = r.getHotspot(h, hotspot.getCurrentX(), hotspot.getCurrentY());
|
||||
if (hs != null) {
|
||||
hs.setDecorationIndex(decorationIndex);
|
||||
SceneryBuilder.replace(object, object.transform(h.getDecorations()[decorationIndex].getObjectId(player.getHouseManager().getStyle())));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a room.
|
||||
* @param player The player.
|
||||
* @param room The room to build.
|
||||
* @param reload
|
||||
*/
|
||||
public static void buildRoom(Player player, Room room, int z, int x, int y, boolean[] exits, boolean reload) {
|
||||
player.getHouseManager().getRooms()[z][x][y] = room;
|
||||
player.getPacketDispatch().sendMessage("Building room " + room.getProperties() + ".");
|
||||
if (z == 3) {
|
||||
player.getHouseManager().setHasDungeon(true);
|
||||
}
|
||||
if (room.getProperties().isChamber() && z < 2) {
|
||||
int count = 0;
|
||||
int index = 0;
|
||||
for (int i = 0; i < exits.length; i++) {
|
||||
if (exits[i]) {
|
||||
count++;
|
||||
} else {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
//(0=east, 1=south, 2=west, 3=north).
|
||||
// System.out.println("Roof information: index=" + index + ", exit count=" + count + "; array=" + Arrays.toString(exits));
|
||||
if (count == 4) {
|
||||
room = Room.create(player, RoomProperties.ROOF_4_EXIT);
|
||||
}
|
||||
else if (count == 3) {
|
||||
room = Room.create(player, RoomProperties.ROOF_3_EXIT);
|
||||
room.setRotation(DIRECTIONS[(index + 2) % 4]);
|
||||
}
|
||||
else if ((exits[0] != exits[2]) || (exits[1] != exits[3])) {
|
||||
room = Room.create(player, RoomProperties.ROOF_3_EXIT);
|
||||
if (exits[2]) {
|
||||
room.setRotation(DIRECTIONS[exits[3] ? 3 : 1]);
|
||||
}
|
||||
} else {
|
||||
room = Room.create(player, RoomProperties.ROOF_2_EXIT);
|
||||
if (exits[0] || exits[2]) {
|
||||
room.setRotation(DIRECTIONS[1]);
|
||||
}
|
||||
}
|
||||
player.getHouseManager().getRooms()[z + 1][x][y] = room;
|
||||
}
|
||||
if (reload) {
|
||||
player.getHouseManager().reload(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks of a room exists.
|
||||
* @param player the player
|
||||
* @param door the door hotspot the player is trying to build at
|
||||
* @return true if the room is built already
|
||||
*/
|
||||
public static int[] roomExists(Player player, Scenery door) {
|
||||
int[] location = getRoomPosition(player, door);
|
||||
int z = player.getLocation().getZ();
|
||||
if (HouseManager.isInDungeon(player)) {
|
||||
z = 3;
|
||||
}
|
||||
if (player.getHouseManager().hasRoomAt(z, location[0], location[1])) {
|
||||
return location;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the room offset.
|
||||
* @param door The door.
|
||||
* @return The room offset [x, y].
|
||||
*/
|
||||
public static int[] getRoomPosition(Player player, Scenery door) {
|
||||
Location l = door.getLocation();
|
||||
int rotation = door.getRotation();
|
||||
if (player.getLocation().getChunkX() != l.getLocation().getChunkX()
|
||||
|| player.getLocation().getChunkY() != l.getLocation().getChunkY()) {
|
||||
return new int[] { l.getChunkX(), l.getChunkY() };
|
||||
}
|
||||
switch (rotation) {
|
||||
case 0: //West
|
||||
return new int[] { l.getChunkX() - 1, l.getChunkY() };
|
||||
case 1: //North
|
||||
return new int[] { l.getChunkX(), l.getChunkY() + 1};
|
||||
case 2: //East
|
||||
return new int[] { l.getChunkX() + 1, l.getChunkY() };
|
||||
case 3: //South
|
||||
return new int[] { l.getChunkX(), l.getChunkY() - 1};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the available rotations of the room to build.
|
||||
* @param exits The exits of the room.
|
||||
* @param z The plane
|
||||
* @param roomX The room x-coordinate.
|
||||
* @param roomY The room y-coordinate.
|
||||
* @return The available rotations for the room [NORTH, EAST, SOUTH, WEST].
|
||||
*/
|
||||
public static Direction[] getAvailableRotations(Player player, boolean[] exits, int z, int roomX, int roomY) {
|
||||
Direction[] directions = new Direction[4];
|
||||
boolean[] exit = Arrays.copyOf(exits, exits.length); //(0=east, 1=south, 2=west, 3=north)
|
||||
int[] info = getExitRequirements(player, z, roomX, roomY);//(0=west, 1=north, 2=east, 3=south)
|
||||
// SystemLogger.logErr(BuildingUtils.class, "Available exits - [east=" + exit[0] + ", south=" + exit[1] + ", west=" + exit[2] + ", north=" + exit[3] + "]!");
|
||||
// SystemLogger.logErr(BuildingUtils.class, "Required exits - [east=" + info[0] + ", south=" + info[1] + ", west=" + info[2] + ", north=" + info[3] + "]!");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
boolean success = true;
|
||||
for (int j = 0; j < 4; j++) {
|
||||
if ((info[j] == 1 && !exit[j]) || (info[j] == -1 && exit[j])) {
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (success) {
|
||||
directions[i] = DIRECTIONS[i];
|
||||
}
|
||||
for (int j = 0; j < exit.length; j++) {
|
||||
exit[(j + i + 1) % exit.length] = exits[j];
|
||||
}
|
||||
}
|
||||
return directions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the exit requirements for the given room.
|
||||
* @param roomX The room x-coordinate.
|
||||
* @param roomY The room y-coordinate.
|
||||
* @return The disabled exit indexes.
|
||||
*/
|
||||
private static int[] getExitRequirements(Player player, int z, int roomX, int roomY) {
|
||||
int[] exits = new int[4];
|
||||
if (roomX == 0) {
|
||||
exits[2] = -1;
|
||||
}
|
||||
else if (player.getHouseManager().hasExit(z, roomX - 1, roomY, Direction.EAST)) {
|
||||
exits[2] = 1;
|
||||
}
|
||||
else if (player.getHouseManager().hasRoomAt(z, roomX - 1, roomY)) {
|
||||
exits[2] = -1;
|
||||
}
|
||||
if (roomY == 7) {
|
||||
exits[3] = -1;
|
||||
}
|
||||
else if (player.getHouseManager().hasExit(z, roomX, roomY + 1, Direction.SOUTH)) {
|
||||
exits[3] = 1;
|
||||
}
|
||||
else if (player.getHouseManager().hasRoomAt(z, roomX, roomY + 1)) {
|
||||
exits[3] = -1;
|
||||
}
|
||||
if (roomX == 7) {
|
||||
exits[0] = -1;
|
||||
}
|
||||
else if (player.getHouseManager().hasExit(z, roomX + 1, roomY, Direction.WEST)) {
|
||||
exits[0] = 1;
|
||||
}
|
||||
else if (player.getHouseManager().hasRoomAt(z, roomX + 1, roomY)) {
|
||||
exits[0] = -1;
|
||||
}
|
||||
if (roomY == 0) {
|
||||
exits[1] = -1;
|
||||
}
|
||||
else if (player.getHouseManager().hasExit(z, roomX, roomY - 1, Direction.NORTH)) {
|
||||
exits[1] = 1;
|
||||
}
|
||||
else if (player.getHouseManager().hasRoomAt(z, roomX, roomY - 1)) {
|
||||
exits[1] = -1;
|
||||
}
|
||||
return exits;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.game.dialogue.book.Book;
|
||||
import core.game.dialogue.book.Page;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.GameWorld;
|
||||
import core.plugin.Initializable;
|
||||
|
||||
/**
|
||||
* Handles the construction guide book.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public class ConstructionGuideBook extends Book {
|
||||
|
||||
/**
|
||||
* The resources used in beta.
|
||||
*/
|
||||
private static final Item[] RESOURCES = {
|
||||
new Item(8794),
|
||||
new Item(2347),
|
||||
new Item(4819, 500000),
|
||||
new Item(4820, 500000),
|
||||
new Item(1539, 500000),
|
||||
new Item(4821, 500000),
|
||||
new Item(4822, 500000),
|
||||
new Item(4823, 500000),
|
||||
new Item(4824, 500000),
|
||||
new Item(961, 500000),
|
||||
new Item(8779, 500000),
|
||||
new Item(8781, 500000),
|
||||
new Item(8783, 500000),
|
||||
new Item(8791, 500000),
|
||||
new Item(8785, 500000),
|
||||
new Item(8787, 500000),
|
||||
new Item(8789, 500000), //16
|
||||
new Item(8418, 500000),
|
||||
new Item(8420, 500000),
|
||||
new Item(8422, 500000),
|
||||
new Item(8424, 500000),
|
||||
new Item(8426, 500000),
|
||||
new Item(8428, 500000),
|
||||
new Item(8430, 500000),
|
||||
new Item(8432, 500000),
|
||||
new Item(8434, 500000),
|
||||
new Item(8436, 500000),
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ConstructionGuideBook} {@code Object}.
|
||||
*/
|
||||
public ConstructionGuideBook() {
|
||||
/*
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ConstructionGuideBook} {@code Object}.
|
||||
* @param player
|
||||
*/
|
||||
public ConstructionGuideBook(Player player) {
|
||||
super(player, "Construction guide book", DialogueInterpreter.getDialogueKey("book:conguide"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(final Player player) {
|
||||
if (GameWorld.getSettings().isDevMode() && GameWorld.getSettings().isBeta()) {
|
||||
for (Item item : RESOURCES) {
|
||||
if (!player.getInventory().contains(item.getId(), item.getAmount())) {
|
||||
player.getInventory().add(item, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
interpreter.sendPlainMessage(false, "Upon reading the book you discover you're supposed to", "use these resources to test out construction.", "Report all bugs on the forums.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(Page[] set) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new ConstructionGuideBook(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DialogueInterpreter.getDialogueKey("book:conguide") };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
/**
|
||||
* Handles the creating of a decoration object.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class ConstructionInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) {
|
||||
ComponentDefinition.put(396, this);
|
||||
ComponentDefinition.put(398, this);
|
||||
ComponentDefinition.put(402, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
switch (component.getId()) {
|
||||
case 396:
|
||||
switch (button) {
|
||||
case 132:
|
||||
player.getInterfaceManager().close();
|
||||
Hotspot hotspot = player.getAttribute("con:hotspot");
|
||||
Scenery object = player.getAttribute("con:hsobject");
|
||||
if (hotspot == null || object == null) {
|
||||
SystemLogger.logErr(this.getClass(), "Failed building decoration " + hotspot + " : " + object);
|
||||
break;
|
||||
}
|
||||
slot = ((slot % 2 != 0) ? 4 : 0) + (slot >> 1);
|
||||
if (slot >= hotspot.getHotspot().getDecorations().length) {
|
||||
SystemLogger.logErr(this.getClass(), "Failed building decoration " + slot + "/" + hotspot.getHotspot().getDecorations().length);
|
||||
break;
|
||||
}
|
||||
boolean debug = player.isStaff();
|
||||
Decoration deco = hotspot.getHotspot().getDecorations()[slot];
|
||||
if (!debug) {
|
||||
if (player.getSkills().getLevel(Skills.CONSTRUCTION) < deco.getLevel()) {
|
||||
player.sendMessage("You need to have a Construction level of " + deco.getLevel() + " to build that.");
|
||||
return true;
|
||||
}
|
||||
if (!player.getInventory().containsItems(deco.getItems())) {
|
||||
player.sendMessage("You don't have the right materials.");
|
||||
return true;
|
||||
}
|
||||
for (int tool : deco.getTools()) {
|
||||
if (tool == BuildingUtils.WATERING_CAN) {
|
||||
boolean hasWateringCan = false;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (player.getInventory().contains(tool - i, 1)) {
|
||||
hasWateringCan = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasWateringCan) {
|
||||
player.sendMessage("You need a watering can to plant this.");
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!player.getInventory().contains(tool, 1)) {
|
||||
player.sendMessage("You need a " + ItemDefinition.forId(tool).getName() + " to build this.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
BuildingUtils.buildDecoration(player, hotspot, deco, object);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 398:
|
||||
switch (button) {
|
||||
case 14:
|
||||
player.getHouseManager().toggleBuildingMode(player, true);
|
||||
return true;
|
||||
case 1:
|
||||
player.getHouseManager().toggleBuildingMode(player, false);
|
||||
return true;
|
||||
case 15:
|
||||
player.getHouseManager().expelGuests(player);
|
||||
return true;
|
||||
case 13:
|
||||
if (!player.getHouseManager().isInHouse(player)) {
|
||||
player.sendMessage("You can't do this outside of your house.");
|
||||
return true;
|
||||
}
|
||||
HouseManager.leave(player);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 402:
|
||||
int index = button - 160;
|
||||
SystemLogger.logErr(this.getClass(), "BuildRoom Interface Index: " + index);
|
||||
if (index > -1 && index < RoomProperties.values().length) {
|
||||
player.getDialogueInterpreter().open("con:room", RoomProperties.values()[index]);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
/**
|
||||
* Family crest types.
|
||||
*
|
||||
* @author Emperor
|
||||
* >ORDINAL BOUND<
|
||||
*/
|
||||
public enum CrestType implements CrestRequirement {
|
||||
|
||||
ARRAV("the Shield of Arrav symbol") { // requires Shield of Arrav
|
||||
|
||||
@Override
|
||||
public boolean eligible(Player player) {
|
||||
return player.getQuestRepository().isComplete("Shield of Arrav");
|
||||
}
|
||||
},
|
||||
ASGARNIA("the symbol of Asgarnia"), // no requirements
|
||||
DORGESHUUN("the Dorgeshuun brooch") { // requires The Lost Tribe
|
||||
|
||||
@Override
|
||||
public boolean eligible(Player player) {
|
||||
return player.getQuestRepository().isComplete("The Lost Tribe");
|
||||
}
|
||||
},
|
||||
DRAGON("a dragon") { // requires Dragon Slayer
|
||||
|
||||
@Override
|
||||
public boolean eligible(Player player) {
|
||||
return player.getQuestRepository().isComplete("Dragon Slayer");
|
||||
}
|
||||
},
|
||||
FAIRY("a fairy") { // requries Lost City
|
||||
|
||||
@Override
|
||||
public boolean eligible(Player player) {
|
||||
return player.getQuestRepository().isComplete("Lost City");
|
||||
}
|
||||
},
|
||||
GUTHIX("the symbol of Guthix") { // Requires 70+ Prayer
|
||||
|
||||
@Override
|
||||
public boolean eligible(Player player) {
|
||||
return player.getSkills().hasLevel(Skills.PRAYER, 70);
|
||||
}
|
||||
},
|
||||
HAM("the symbol of the HAM cult."), // no requirements
|
||||
HORSE("a horse") { // requires Toy Horsey in inventory
|
||||
|
||||
@Override
|
||||
public boolean eligible(Player player) {
|
||||
return player.getInventory().containsAtLeastOneItem(new int[]{
|
||||
Items.TOY_HORSEY_2524,
|
||||
Items.TOY_HORSEY_2520,
|
||||
Items.TOY_HORSEY_2526,
|
||||
Items.TOY_HORSEY_2522
|
||||
});
|
||||
}
|
||||
},
|
||||
JOGRE("Jiggig"), // no requirements
|
||||
KANDARIN("the symbol of Kandarin"), // no requirements
|
||||
MISTHALIN("the symbol of Misthalin"), // no requirements
|
||||
MONEY("a bag of money", 500000), // Costs 500k
|
||||
SARADOMIN("the symbol of Saradomin") { // Requires 70+ Prayer
|
||||
|
||||
@Override
|
||||
public boolean eligible(Player player) {
|
||||
return player.getSkills().hasLevel(Skills.PRAYER, 70);
|
||||
}
|
||||
},
|
||||
SKULL("a skull") { // requires Skulled while talking to Herald
|
||||
|
||||
@Override
|
||||
public boolean eligible(Player player) {
|
||||
return player.getSkullManager().isSkulled();
|
||||
}
|
||||
},
|
||||
VARROCK("the symbol of Varrock"), // no requirements
|
||||
ZAMORAK("the symbol of Zamorak") { // Requires 70+ Prayer
|
||||
|
||||
@Override
|
||||
public boolean eligible(Player player) {
|
||||
return player.getSkills().hasLevel(Skills.PRAYER, 70);
|
||||
}
|
||||
};
|
||||
|
||||
private String name;
|
||||
private int cost;
|
||||
|
||||
CrestType(String name, int cost) {
|
||||
this.name = name;
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
CrestType(String name) {
|
||||
this(name, 5000);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return this.cost;
|
||||
}
|
||||
}
|
||||
|
||||
interface CrestRequirement {
|
||||
default boolean eligible(Player player) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,466 @@
|
||||
package content.global.skill.construction
|
||||
|
||||
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.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.Items
|
||||
import core.game.world.GameWorld.settings
|
||||
import core.tools.END_DIALOGUE
|
||||
import core.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
* Represents the estate agent dialogue.
|
||||
*
|
||||
* @author Woah
|
||||
*/
|
||||
@Initializable
|
||||
class EstateAgentDialogue : core.game.dialogue.DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Constructs a new `EstateAgentDialogue` `Object`.
|
||||
*/
|
||||
constructor() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new `EstateAgentDialogue` `Object`.
|
||||
*
|
||||
* @param player the player.
|
||||
*/
|
||||
constructor(player: Player?) : super(player)
|
||||
|
||||
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin {
|
||||
return EstateAgentDialogue(player)
|
||||
}
|
||||
|
||||
override fun open(vararg args: Any): Boolean {
|
||||
npc = args[0] as NPC
|
||||
npc("Hello. Welcome to the " + settings!!.name + " Housing Agency! What", "can I do for you?")
|
||||
stage = START_DIALOGUE
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
|
||||
START_DIALOGUE -> {
|
||||
if (player.houseManager.hasHouse()) {
|
||||
options(
|
||||
"Can you move my house please?",
|
||||
"Can you redecorate my house please?",
|
||||
"Could I have a Construction guidebook?",
|
||||
"Tell me about houses.",
|
||||
"Tell me about that skillcape you're wearing.")
|
||||
stage = 1
|
||||
} else {
|
||||
options("How can I get a house?", "Tell me about houses.")
|
||||
stage = 2
|
||||
}
|
||||
}
|
||||
|
||||
1 -> when (buttonId) {
|
||||
1 -> {
|
||||
player("Can you move my house please?")
|
||||
stage = 10
|
||||
}
|
||||
2 -> {
|
||||
player("Can you redecorate my house please?")
|
||||
stage = 30
|
||||
}
|
||||
3 -> {
|
||||
player("Could I have a Construction guidebook?")
|
||||
stage = 50
|
||||
}
|
||||
4 -> {
|
||||
player("Tell me about houses!")
|
||||
stage = 60
|
||||
}
|
||||
5 -> {
|
||||
player("Tell me about that skillcape you're wearing!")
|
||||
stage = if (core.game.global.Skillcape.isMaster(player, Skills.CONSTRUCTION)) 102 else 100
|
||||
}
|
||||
}
|
||||
|
||||
2 -> when (buttonId) {
|
||||
1 -> {
|
||||
player("How can I get a house?")
|
||||
stage = 3
|
||||
}
|
||||
2 -> {
|
||||
player("Tell me about houses.")
|
||||
stage = 60
|
||||
}
|
||||
}
|
||||
|
||||
3 -> {
|
||||
npc(
|
||||
"I can sell you a starting house in Rimmington for",
|
||||
"1000 coins. As you increase your construction skill you",
|
||||
"will be able to have your house moved to other areas",
|
||||
"and redecorated in other styles."
|
||||
)
|
||||
stage++
|
||||
}
|
||||
|
||||
4 -> {
|
||||
npc("Do you want to buy a starter house?")
|
||||
stage++
|
||||
}
|
||||
|
||||
5 -> {
|
||||
options("Yes please!", "No thanks.")
|
||||
stage++
|
||||
}
|
||||
|
||||
6 -> when (buttonId) {
|
||||
1 -> {
|
||||
player("Yes please!")
|
||||
stage = 7
|
||||
}
|
||||
2 -> {
|
||||
player("No thanks.")
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
}
|
||||
|
||||
7 -> {
|
||||
if (player.inventory.contains(995, 1000)) {
|
||||
player.inventory.remove(Item(995, 1000))
|
||||
player.houseManager.createNewHouseAt(HouseLocation.RIMMINGTON)
|
||||
npc(
|
||||
"Thank you. Go through the Rimmington house portal",
|
||||
"and you will find your house ready for you to start",
|
||||
"building in it."
|
||||
)
|
||||
} else {
|
||||
npc("You don't have enough money to buy a house,", "come back when you can afford one.")
|
||||
}
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
|
||||
10 -> {
|
||||
npc("Certainly. Where would you like it moved to?")
|
||||
stage++
|
||||
}
|
||||
|
||||
11 -> {
|
||||
options(
|
||||
"Rimmington (5,000)",
|
||||
"Taverley (5,000)",
|
||||
"Pollnivneach (7,500)",
|
||||
"Rellekka (10,000)",
|
||||
"More..." )
|
||||
stage++
|
||||
}
|
||||
|
||||
12 -> when (buttonId) {
|
||||
1 -> {
|
||||
player("To Rimmington please!")
|
||||
stage = 15
|
||||
}
|
||||
2 -> {
|
||||
player("To Taverly please!")
|
||||
stage = 16
|
||||
}
|
||||
3 -> {
|
||||
player("To Pollnivneach please!")
|
||||
stage = 17
|
||||
}
|
||||
4 -> {
|
||||
player("To Rellekka please!")
|
||||
stage = 18
|
||||
}
|
||||
5 -> {
|
||||
options("Brimhaven (15,000)", "Yanille (25,000)", "...Previous", "Back")
|
||||
stage = 13
|
||||
}
|
||||
}
|
||||
|
||||
13 -> when (buttonId) {
|
||||
1 -> {
|
||||
player("To Brimhaven please!")
|
||||
stage = 19
|
||||
}
|
||||
2 -> {
|
||||
player("To Yanille please!")
|
||||
stage = 20
|
||||
}
|
||||
3 -> {
|
||||
options(
|
||||
"Rimmington (5,000)",
|
||||
"Taverley (5,000)",
|
||||
"Pollnivneach (7,500)",
|
||||
"Rellekka (10,000)",
|
||||
"More..."
|
||||
)
|
||||
stage = 12
|
||||
}
|
||||
}
|
||||
|
||||
15 -> configureMove(HouseLocation.RIMMINGTON)
|
||||
16 -> configureMove(HouseLocation.TAVERLY)
|
||||
17 -> configureMove(HouseLocation.POLLNIVNEACH)
|
||||
18 -> configureMove(HouseLocation.RELLEKKA)
|
||||
19 -> configureMove(HouseLocation.BRIMHAVEN)
|
||||
20 -> configureMove(HouseLocation.YANILLE)
|
||||
30 -> {
|
||||
npc(
|
||||
"Certainly. My magic can rebuild the house in a",
|
||||
"completely new style! What style would you like?" )
|
||||
stage++
|
||||
}
|
||||
31 -> {
|
||||
options(
|
||||
"Basic wood (5,000)",
|
||||
"Basic stone (5,000)",
|
||||
"Whitewashed stone (7,500)",
|
||||
"Fremennik-style wood (10,000)",
|
||||
"More..."
|
||||
)
|
||||
stage++
|
||||
}
|
||||
32 -> when (buttonId) {
|
||||
1 -> {
|
||||
player("Basic wood please!")
|
||||
stage = 35
|
||||
}
|
||||
2 -> {
|
||||
player("Basic stone please!")
|
||||
stage = 36
|
||||
}
|
||||
3 -> {
|
||||
player("Whitewashed stone please!")
|
||||
stage = 37
|
||||
}
|
||||
4 -> {
|
||||
player("Fremennik-style wood please!")
|
||||
stage = 38
|
||||
}
|
||||
5 -> {
|
||||
options("Tropical wood (15,000)", "Fancy stone (25,000)", "Previous...", "Back")
|
||||
stage = 33
|
||||
}
|
||||
}
|
||||
33 -> when (buttonId) {
|
||||
1 -> {
|
||||
player("Tropical wood please!")
|
||||
stage = 39
|
||||
}
|
||||
2 -> {
|
||||
player("Fancy stone please!")
|
||||
stage = 40
|
||||
}
|
||||
3 -> {
|
||||
options(
|
||||
"Basic wood (5,000)",
|
||||
"Basic stone (5,000)",
|
||||
"Whitewashed stone (7,500)",
|
||||
"Fremennik-style wood (10,000)",
|
||||
"More..."
|
||||
)
|
||||
stage = 32
|
||||
}
|
||||
}
|
||||
|
||||
35 -> redecorate(HousingStyle.BASIC_WOOD)
|
||||
36 -> redecorate(HousingStyle.BASIC_STONE)
|
||||
37 -> redecorate(HousingStyle.WHITEWASHED_STONE)
|
||||
38 -> redecorate(HousingStyle.FREMENNIK_STYLE_WOOD)
|
||||
39 -> redecorate(HousingStyle.TROPICAL_WOOD)
|
||||
40 -> redecorate(HousingStyle.FANCY_STONE)
|
||||
|
||||
50 -> {
|
||||
if (player.hasItem(CONSTRUCTION_GUIDE_8463)) {
|
||||
npc("You've already got one!")
|
||||
} else {
|
||||
npc("Certainly.")
|
||||
player.inventory.add(CONSTRUCTION_GUIDE_8463)
|
||||
}
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
60 -> {
|
||||
npc(
|
||||
"It all came out of the wizards' experiments. They found",
|
||||
"a way to fold space, so that they could pack many",
|
||||
"acres of land into an area only a foot across."
|
||||
)
|
||||
stage++
|
||||
}
|
||||
61 -> {
|
||||
npc(
|
||||
"They created several folded-space regions across",
|
||||
"" + settings!!.name + ". Each one contains hundreds of small plots",
|
||||
"where people can build houses."
|
||||
)
|
||||
stage++
|
||||
}
|
||||
62 -> {
|
||||
player("Ah, so that's how everyone can have a house without", "them cluttering up the world!")
|
||||
stage++
|
||||
}
|
||||
63 -> {
|
||||
npc(
|
||||
"Quite. The wizards didn't want to get bogged down",
|
||||
"in the business side of things so they ",
|
||||
"hired me to sell the houses."
|
||||
)
|
||||
stage++
|
||||
}
|
||||
64 -> {
|
||||
npc(
|
||||
"There are various other people across " + settings!!.name + " who can",
|
||||
"help you furnish your house. You should start buying",
|
||||
"planks from the sawmill operator in Varrock."
|
||||
)
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
100 -> {
|
||||
npc(
|
||||
"As you may know, skillcapes are only available to masters",
|
||||
"in a skill. I have spent my entire life building houses and",
|
||||
"now I spend my time selling them! As a sign of my abilites",
|
||||
"I wear this Skillcape of Construction. If you ever have"
|
||||
)
|
||||
stage = 101
|
||||
}
|
||||
101 -> {
|
||||
npc(
|
||||
"enough skill to build a demonic throne, come and talk to",
|
||||
"me and I'll sell you a skillcape like mine."
|
||||
)
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
102 -> {
|
||||
interpreter.sendDialogues(
|
||||
npc,
|
||||
core.game.dialogue.FacialExpression.JOLLY,
|
||||
"I see you have recently achieved 99 construction.",
|
||||
"Would you like to buy a cape for 99,0000 gp?"
|
||||
)
|
||||
stage++
|
||||
}
|
||||
103 -> {
|
||||
options("Yes, I'll pay the 99k", "No thanks, maybe later.")
|
||||
stage++
|
||||
}
|
||||
104 -> when (buttonId) {
|
||||
1 -> {
|
||||
if (core.game.global.Skillcape.purchase(player, Skills.CONSTRUCTION)) {
|
||||
npc("Here you go lad, enjoy!")
|
||||
}
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
2 -> {
|
||||
player("No thanks, maybe later.")
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
}
|
||||
END_DIALOGUE -> end()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the move.
|
||||
*
|
||||
* @param location The house location.
|
||||
*/
|
||||
private fun configureMove(location: HouseLocation) {
|
||||
//Achievement completion checks
|
||||
val completedVarrockHouseMove = player.achievementDiaryManager.hasCompletedTask(DiaryType.VARROCK,0,11)
|
||||
when {
|
||||
//Player does not have required construction level
|
||||
!location.hasLevel(player) -> {
|
||||
npc(
|
||||
"I'm afraid you don't have a high enough construction",
|
||||
"level to move there. You need to have level " + location.levelRequirement + "." )
|
||||
stage = 11
|
||||
return
|
||||
}
|
||||
//Player's house location is already where they selected
|
||||
location == player.houseManager.location -> {
|
||||
npc("Your house is already there!")
|
||||
stage = 11
|
||||
return
|
||||
}
|
||||
//Player does not have enough coins to buy a house move
|
||||
!player.inventory.contains(Items.COINS_995, location.cost) -> {
|
||||
npc("Hmph. Come back when you have " + location.cost + " coins.")
|
||||
stage = END_DIALOGUE
|
||||
return
|
||||
}
|
||||
//Player meets all above requirements + check for achievement unlocks
|
||||
else -> {
|
||||
player.inventory.remove(Item(Items.COINS_995, location.cost))
|
||||
player.houseManager.location = location
|
||||
npc("Your house has been moved to " + location.getName() + ".")
|
||||
|
||||
if (player.location.isInRegion(REGION_VARROCK_NE) && !completedVarrockHouseMove) {
|
||||
|
||||
player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 0, 11)
|
||||
}
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redecorates the player's house.
|
||||
*
|
||||
* @param style The house style.
|
||||
*/
|
||||
private fun redecorate(style: HousingStyle) {
|
||||
//Achievement completion checks
|
||||
val completedVarrockHouseRedecorate = player.achievementDiaryManager.hasCompletedTask(DiaryType.VARROCK,2,7)
|
||||
when {
|
||||
//Player does not have required construction level
|
||||
!style.hasLevel(player) -> {
|
||||
npc("You need a Construction level of " + style.level + " to buy this style.")
|
||||
stage = 31
|
||||
return
|
||||
}
|
||||
//Player's house location is already where they selected
|
||||
style == player.houseManager.style -> {
|
||||
npc("Your house is already in that style!")
|
||||
stage = 31
|
||||
return
|
||||
}
|
||||
|
||||
//Player does not have enough coins to buy a house move
|
||||
!player.inventory.contains(Items.COINS_995, style.cost) -> {
|
||||
npc("Hmph. Come back when you have " + style.cost + " coins.")
|
||||
stage = END_DIALOGUE
|
||||
return
|
||||
}
|
||||
|
||||
//Player meets all above requirements + check for achievement unlocks
|
||||
else -> {
|
||||
player.inventory.remove(Item(Items.COINS_995, style.cost))
|
||||
player.houseManager.redecorate(style)
|
||||
npc("Your house has been redecorated.")
|
||||
|
||||
// Give your player-owned house a fancy stone or tropical wood<br><br>finish at the Varrock estate agent's
|
||||
if (player.location.isInRegion(REGION_VARROCK_NE) && !completedVarrockHouseRedecorate) {
|
||||
player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 2, 7)
|
||||
}
|
||||
stage = END_DIALOGUE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(4247)
|
||||
}
|
||||
|
||||
//Items
|
||||
private val CONSTRUCTION_GUIDE_8463 = Item(Items.CONSTRUCTION_GUIDE_8463, 1)
|
||||
|
||||
//Region to check
|
||||
private val REGION_VARROCK_NE = 12854
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package content.global.skill.construction
|
||||
|
||||
import content.global.skill.construction.BuildHotspot
|
||||
|
||||
/**
|
||||
* Represents a hotspot.
|
||||
* @author Emperor
|
||||
*/
|
||||
class Hotspot (val hotspot: BuildHotspot, val chunkX: Int, val chunkY: Int, var chunkX2: Int, var chunkY2: Int) {
|
||||
|
||||
constructor(hotspot: BuildHotspot, chunkX: Int, chunkY: Int) : this(hotspot,chunkX,chunkY,-1,-1)
|
||||
|
||||
/**
|
||||
* The current chunk x coordinate.
|
||||
*/
|
||||
var currentX: Int
|
||||
/**
|
||||
* Gets the currentY value.
|
||||
* @return The currentY.
|
||||
*/
|
||||
/**
|
||||
* Sets the currentY value.
|
||||
* @param currentY The currentY to set.
|
||||
*/
|
||||
/**
|
||||
* The chunk y coordinate.
|
||||
*/
|
||||
var currentY: Int
|
||||
/**
|
||||
* Gets the decorationIndex.
|
||||
* @return The decorationIndex.
|
||||
*/
|
||||
/**
|
||||
* Sets the decorationIndex.
|
||||
* @param decorationIndex The decorationIndex to set.
|
||||
*/
|
||||
/**
|
||||
* The current decoration index.
|
||||
*/
|
||||
var decorationIndex = -1
|
||||
|
||||
/**
|
||||
* Copies the hotspot.
|
||||
* @return The hotspot.
|
||||
*/
|
||||
fun copy(): Hotspot {
|
||||
return Hotspot(hotspot, chunkX, chunkY, chunkX2, chunkY2)
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new `Hotspot` `Object`.
|
||||
* @param hotspot The hotspot.
|
||||
* @param chunkX The chunk x-coordinate.
|
||||
* @param chunkY The chunk y-coordinate.
|
||||
*/
|
||||
init {
|
||||
currentX = chunkX
|
||||
currentY = chunkY
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.map.Location;
|
||||
import core.tools.StringUtils;
|
||||
|
||||
/**
|
||||
* The house locations.
|
||||
* @author Emperor
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public enum HouseLocation {
|
||||
|
||||
//Nowhere is used for players who do not have a house
|
||||
NOWHERE(-1, null, 0, 0),
|
||||
|
||||
RIMMINGTON(15478, Location.create(2953, 3224, 0), 5000, 1),
|
||||
|
||||
TAVERLY(15477, Location.create(2893, 3465, 0), 5000, 10),
|
||||
|
||||
POLLNIVNEACH(15479, Location.create(3340, 3003, 0), 7500, 20),
|
||||
|
||||
RELLEKKA(15480, Location.create(2670, 3631, 0), 10000, 30),
|
||||
|
||||
BRIMHAVEN(15481, Location.create(2757, 3178, 0), 15000, 40),
|
||||
|
||||
YANILLE(15482, Location.create(2544, 3096, 0), 25000, 50);
|
||||
|
||||
//custom island thing that previous source users had.
|
||||
//WHITERIDGE(43832, Location.create(3965, 3546, 0), 100_000, 60);
|
||||
|
||||
/**
|
||||
* The portal object id for this location.
|
||||
*/
|
||||
private final int portalId;
|
||||
|
||||
/**
|
||||
* The exit location.
|
||||
*/
|
||||
private final Location exitLocation;
|
||||
|
||||
/**
|
||||
* The cost to move
|
||||
*/
|
||||
private final int cost;
|
||||
|
||||
/**
|
||||
* Level requirement
|
||||
*/
|
||||
private final int levelRequirement;
|
||||
|
||||
/**
|
||||
* The house options
|
||||
*/
|
||||
//public static TabbedOption HOUSE_OPTIONS = new TabbedOption("House Locations", "Select an Option");
|
||||
|
||||
/**
|
||||
* Sets up a page action tabbed option
|
||||
*/
|
||||
static {
|
||||
/*int index = 0;
|
||||
PageAction[] pageActions = new PageAction[5];
|
||||
for (HouseLocation hl : values()) {
|
||||
if (hl == HouseLocation.NOWHERE || (hl == HouseLocation.WHITERIDGE && GameWorld.getSettings().isDeadmanMode()))
|
||||
continue;
|
||||
if (index > 4) {
|
||||
index = 0;
|
||||
HOUSE_OPTIONS.addPage(new Page(pageActions));
|
||||
pageActions = new PageAction[5];
|
||||
}
|
||||
pageActions[index++] = new PageAction(hl.name() + " - " + hl.cost + "gp") {
|
||||
@Override
|
||||
public boolean run(Player player) {
|
||||
if (player.getHouseManager().getLocation() == hl) {
|
||||
player.sendMessage("<col=FF0000>Your house already resides in " + hl.name() + "!");
|
||||
return true;
|
||||
}
|
||||
if (player.getSkills().hasLevel(Skills.CONSTRUCTION, hl.levelRequirement)) {
|
||||
if (player.getInventory().contains(995, hl.cost)) {
|
||||
player.getInventory().remove(new Item(995, hl.cost));
|
||||
player.getHouseManager().setLocation(hl);
|
||||
player.sendMessage("<col=006600>You have changed your house location to " + hl.name() + "!");
|
||||
} else {
|
||||
player.sendMessage("<col=FF0000>You need " + hl.cost + "gp in order to move there!");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage("<col=FF0000>You need a construction level of " + hl.levelRequirement + " to move there!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
if (pageActions[0] != null) {
|
||||
HOUSE_OPTIONS.addPage(new Page(pageActions));
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has the level.
|
||||
*
|
||||
* @param player the player.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasLevel(Player player) {
|
||||
return player.getSkills().getStaticLevel(Skills.CONSTRUCTION) >= levelRequirement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code HouseLocation} {@code Object}
|
||||
* @param portalId The portal id.
|
||||
* @param exitLocation The exit location.
|
||||
*/
|
||||
private HouseLocation(int portalId, Location exitLocation, int cost, int levelRequirement) {
|
||||
this.portalId = portalId;
|
||||
this.exitLocation = exitLocation;
|
||||
this.cost = cost;
|
||||
this.levelRequirement = levelRequirement;
|
||||
}
|
||||
/**
|
||||
* Gets the name formatted.
|
||||
*
|
||||
* @return the formatted name.
|
||||
*/
|
||||
public String getName() {
|
||||
return StringUtils.formatDisplayName(name().toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the portalId.
|
||||
* @return the portalId
|
||||
*/
|
||||
public int getPortalId() {
|
||||
return portalId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the exitLocation.
|
||||
* @return the exitLocation
|
||||
*/
|
||||
public Location getExitLocation() {
|
||||
return exitLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cost to move to here
|
||||
* @return the cost
|
||||
*/
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level requirement to move to here
|
||||
* @return the level requirement
|
||||
*/
|
||||
public int getLevelRequirement() {
|
||||
return levelRequirement;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,892 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
//import org.arios.game.content.global.DeadmanTimedAction;
|
||||
//import org.arios.game.node.entity.player.info.login.SavingModule;
|
||||
|
||||
import core.api.regionspec.RegionSpecification;
|
||||
import core.api.regionspec.contracts.FillChunkContract;
|
||||
import core.game.dialogue.FacialExpression;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.map.*;
|
||||
import core.game.world.map.build.DynamicRegion;
|
||||
import core.game.world.map.zone.ZoneBorders;
|
||||
import core.game.world.map.zone.ZoneBuilder;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import core.tools.SystemLogger;
|
||||
import core.game.world.GameWorld;
|
||||
|
||||
import java.awt.*;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static core.api.regionspec.RegionSpecificationKt.fillWith;
|
||||
import static core.api.regionspec.RegionSpecificationKt.using;
|
||||
|
||||
|
||||
/**
|
||||
* Manages the player's house.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
public final class HouseManager {
|
||||
|
||||
/**
|
||||
* The current region.
|
||||
*/
|
||||
private DynamicRegion houseRegion;
|
||||
|
||||
/**
|
||||
* The current region.
|
||||
*/
|
||||
private DynamicRegion dungeonRegion;
|
||||
|
||||
/**
|
||||
* The house location.
|
||||
*/
|
||||
private HouseLocation location = HouseLocation.NOWHERE;
|
||||
|
||||
/**
|
||||
* The house style.
|
||||
*/
|
||||
private HousingStyle style = HousingStyle.BASIC_WOOD;
|
||||
|
||||
/**
|
||||
* The house zone.
|
||||
*/
|
||||
private final HouseZone zone = new HouseZone(this);
|
||||
|
||||
/**
|
||||
* The player's house rooms.
|
||||
*/
|
||||
private final Room[][][] rooms = new Room[4][8][8];
|
||||
|
||||
/**
|
||||
* If building mode is enabled.
|
||||
*/
|
||||
private boolean buildingMode;
|
||||
|
||||
/**
|
||||
* If the player has used the portal to lock their house.
|
||||
*/
|
||||
private boolean locked;
|
||||
|
||||
/**
|
||||
* The player's servant.
|
||||
*/
|
||||
private Servant servant;
|
||||
|
||||
/**
|
||||
* If the house has a dungeon.
|
||||
*/
|
||||
private boolean hasDungeon;
|
||||
|
||||
/**
|
||||
* The player's crest.
|
||||
*/
|
||||
private CrestType crest = CrestType.ASGARNIA;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code HouseManager} {@code Object}.
|
||||
*/
|
||||
public HouseManager() {
|
||||
/*
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public void save(ByteBuffer buffer) {
|
||||
buffer.put((byte) location.ordinal());
|
||||
buffer.put((byte) style.ordinal());
|
||||
if (hasServant()) {
|
||||
servant.save(buffer);
|
||||
} else {
|
||||
buffer.put((byte) -1);
|
||||
}
|
||||
for (int z = 0; z < 4; z++) {
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
Room room = rooms[z][x][y];
|
||||
if (room != null) {
|
||||
buffer.put((byte) z).put((byte) x).put((byte) y);
|
||||
buffer.put((byte) room.getProperties().ordinal());
|
||||
buffer.put((byte) room.getRotation().toInteger());
|
||||
for (int i = 0; i < room.getHotspots().length; i++) {
|
||||
if (room.getHotspots()[i].getDecorationIndex() > -1) {
|
||||
buffer.put((byte) i);
|
||||
buffer.put((byte) room.getHotspots()[i].getDecorationIndex());
|
||||
}
|
||||
}
|
||||
buffer.put((byte) -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
buffer.put((byte) -1);//Eof
|
||||
}
|
||||
|
||||
public void parse(JSONObject data){
|
||||
location = HouseLocation.values()[Integer.parseInt( data.get("location").toString())];
|
||||
style = HousingStyle.values()[Integer.parseInt( data.get("style").toString())];
|
||||
Object servRaw = data.get("servant");
|
||||
if(servRaw != null){
|
||||
servant = Servant.parse((JSONObject) servRaw);
|
||||
}
|
||||
JSONArray rArray = (JSONArray) data.get("rooms");
|
||||
for(int i = 0; i < rArray.size(); i++){
|
||||
JSONObject rm = (JSONObject) rArray.get(i);
|
||||
int z = Integer.parseInt(rm.get("z").toString());
|
||||
int x = Integer.parseInt(rm.get("x").toString());
|
||||
int y = Integer.parseInt(rm.get("y").toString());
|
||||
if(z == 3)
|
||||
hasDungeon = true;
|
||||
Room room = rooms[z][x][y] = new Room(RoomProperties.values()[Integer.parseInt(rm.get("properties").toString())]);
|
||||
room.configure(style);
|
||||
room.setRotation(Direction.get(Integer.parseInt(rm.get("rotation").toString())));
|
||||
JSONArray hotspots = (JSONArray) rm.get("hotspots");
|
||||
for(int j = 0; j < hotspots.size(); j++){
|
||||
JSONObject spot = (JSONObject) hotspots.get(j);
|
||||
room.getHotspots()[Integer.parseInt(spot.get("hotspotIndex").toString())].setDecorationIndex(Integer.parseInt(spot.get("decorationIndex").toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void parse(ByteBuffer buffer) {
|
||||
location = HouseLocation.values()[buffer.get() & 0xFF];
|
||||
style = HousingStyle.values()[buffer.get() & 0xFF];
|
||||
servant = Servant.parse(buffer);
|
||||
int z = 0;
|
||||
while ((z = buffer.get()) != -1) {
|
||||
if (z == 3) {
|
||||
hasDungeon = true;
|
||||
}
|
||||
int x = buffer.get();
|
||||
int y = buffer.get();
|
||||
Room room = rooms[z][x][y] = new Room(RoomProperties.values()[buffer.get() & 0xFF]);
|
||||
room.configure(style);
|
||||
room.setRotation(Direction.get(buffer.get() & 0xFF));
|
||||
int spot = 0;
|
||||
while ((spot = buffer.get()) != -1) {
|
||||
room.getHotspots()[spot].setDecorationIndex(buffer.get() & 0xFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter's the player's house.
|
||||
* @param player
|
||||
* @param buildingMode
|
||||
*/
|
||||
public void enter(final Player player, boolean buildingMode) {
|
||||
if (this.buildingMode != buildingMode || !isLoaded()) {
|
||||
this.buildingMode = buildingMode;
|
||||
construct();
|
||||
}
|
||||
player.setAttribute("poh_entry", HouseManager.this);
|
||||
player.lock(1);
|
||||
player.sendMessage("House location: " + houseRegion.getBaseLocation() + ", entry: " + getEnterLocation());
|
||||
player.getProperties().setTeleportLocation(getEnterLocation());
|
||||
openLoadInterface(player);
|
||||
checkForAndSpawnServant(player);
|
||||
updateVarbits(player, buildingMode);
|
||||
unlockMusicTrack(player);
|
||||
}
|
||||
|
||||
private void openLoadInterface(Player player) {
|
||||
player.getInterfaceManager().openComponent(399);
|
||||
player.getAudioManager().send(new Audio(984));
|
||||
submitCloseLoadInterfacePulse(player);
|
||||
}
|
||||
|
||||
private void submitCloseLoadInterfacePulse(Player player) {
|
||||
GameWorld.getPulser().submit(new Pulse(1, player) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
player.getInterfaceManager().close();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkForAndSpawnServant(Player player) {
|
||||
if(!hasServant()) return;
|
||||
|
||||
GameWorld.getPulser().submit(new Pulse(1, player) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
spawnServant();
|
||||
if (servant.isGreet()){
|
||||
player.getDialogueInterpreter().sendDialogues(servant.getType().getId(), servant.getType().getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Welcome.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateVarbits(Player player, boolean build) {
|
||||
player.varpManager.get(261).setVarbit(0, build ? 1 : 0);
|
||||
player.varpManager.get(262).setVarbit(0, getRoomAmount());
|
||||
}
|
||||
|
||||
private void unlockMusicTrack(Player player) {
|
||||
player.getMusicPlayer().unlock(454, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Leaves this house.
|
||||
* @param player The player leaving.
|
||||
*/
|
||||
public static void leave(Player player) {
|
||||
HouseManager house = player.getAttribute("poh_entry", player.getHouseManager());
|
||||
if (house.getHouseRegion() == null){
|
||||
return;
|
||||
}
|
||||
if (house.isInHouse(player)) {
|
||||
player.animate(Animation.RESET);
|
||||
player.setLocation(house.location.getExitLocation());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the building mode.
|
||||
* @param player The house owner.
|
||||
* @param enable If the building mode should be enabled.
|
||||
*/
|
||||
public void toggleBuildingMode(Player player, boolean enable) {
|
||||
if (!isInHouse(player)) {
|
||||
player.getPacketDispatch().sendMessage("Building mode really only helps if you're in a house.");
|
||||
return;
|
||||
}
|
||||
if (buildingMode != enable) {
|
||||
if (enable) {
|
||||
expelGuests(player);
|
||||
}
|
||||
buildingMode = enable;
|
||||
reload(player, enable);
|
||||
player.getPacketDispatch().sendMessage("Building mode is now " + (buildingMode ? "on." : "off."));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the house.
|
||||
* @param player The player.
|
||||
* @param buildingMode If building mode should be enabled.
|
||||
*/
|
||||
public void reload(Player player, boolean buildingMode) {
|
||||
int diffX = player.getLocation().getLocalX();
|
||||
int diffY = player.getLocation().getLocalY();
|
||||
int diffZ = player.getLocation().getZ();
|
||||
boolean inDungeon = player.getViewport().getRegion() == dungeonRegion;
|
||||
this.buildingMode = buildingMode;
|
||||
construct();
|
||||
Location newLoc = (dungeonRegion == null ? houseRegion : (inDungeon ? dungeonRegion : houseRegion)).getBaseLocation().transform(diffX,diffY,diffZ);
|
||||
player.getProperties().setTeleportLocation(newLoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expels the guests from the house.
|
||||
* @param player The house owner.
|
||||
*/
|
||||
public void expelGuests(Player player) {
|
||||
if (isLoaded()) {
|
||||
for (RegionPlane plane : houseRegion.getPlanes()) {
|
||||
for (Player p : plane.getPlayers()) {
|
||||
if (p != player) {
|
||||
leave(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dungeonRegion != null) {
|
||||
for (RegionPlane plane : dungeonRegion.getPlanes()) {
|
||||
for (Player p : plane.getPlayers()) {
|
||||
if (p != player) {
|
||||
leave(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entering location.
|
||||
* @return The entering location.
|
||||
*/
|
||||
public Location getEnterLocation() {
|
||||
if (houseRegion == null) {
|
||||
SystemLogger.logErr(this.getClass(), "House wasn't constructed yet!");
|
||||
return null;
|
||||
}
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
Room room = rooms[0][x][y];
|
||||
if (room != null && (room.getProperties() == RoomProperties.GARDEN || room.getProperties() == RoomProperties.FORMAL_GARDEN)) {
|
||||
for (Hotspot h : room.getHotspots()) {
|
||||
if (h.getDecorationIndex() > -1) {
|
||||
Decoration d = h.getHotspot().getDecorations()[h.getDecorationIndex()];
|
||||
if (d == Decoration.PORTAL) {
|
||||
return houseRegion.getBaseLocation().transform(x * 8 + h.getChunkX(), y * 8 + h.getChunkY() + 2, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redecorates the house.
|
||||
* @param style The new style.
|
||||
*/
|
||||
public void redecorate(HousingStyle style) {
|
||||
this.style = style;
|
||||
for (int z = 0; z < 4; z++) {
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
Room room = rooms[z][x][y];
|
||||
if (room != null) {
|
||||
room.decorate(style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all the rooms (<b>Including portal room!</b>).
|
||||
*/
|
||||
@Deprecated
|
||||
public void clearRooms() {
|
||||
for (int z = 0; z < 4; z++) {
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
rooms[z][x][y] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the default house.
|
||||
* @param location The house location.
|
||||
*/
|
||||
public void createNewHouseAt(HouseLocation location) {
|
||||
clearRooms();
|
||||
Room room = rooms[0][4][3] = new Room(RoomProperties.GARDEN);
|
||||
room.configure(style);
|
||||
room.getHotspots()[0].setDecorationIndex(0);
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the dynamic region for the house.
|
||||
* @return The region.
|
||||
*/
|
||||
public DynamicRegion construct() {
|
||||
houseRegion = getPreparedRegion();
|
||||
configureRoofs();
|
||||
prepareHouseChunks(style, houseRegion, buildingMode, rooms);
|
||||
|
||||
if (hasDungeon()) {
|
||||
dungeonRegion = getPreparedRegion();
|
||||
prepareDungeonChunks(style, dungeonRegion, houseRegion, buildingMode, rooms[3]);
|
||||
}
|
||||
|
||||
ZoneBuilder.configure(zone);
|
||||
return houseRegion;
|
||||
}
|
||||
|
||||
private DynamicRegion getPreparedRegion() {
|
||||
ZoneBorders borders = DynamicRegion.reserveArea(8,8);
|
||||
DynamicRegion region = new DynamicRegion(-1, borders.getSouthWestX() >> 6, borders.getSouthWestY() >> 6);
|
||||
region.setBorders(borders);
|
||||
region.setUpdateAllPlanes(true);
|
||||
RegionManager.addRegion(region.getId(), region);
|
||||
return region;
|
||||
}
|
||||
|
||||
private class RoomLoadContract extends FillChunkContract {
|
||||
Room[][][] rooms;
|
||||
HouseManager manager;
|
||||
boolean buildingMode;
|
||||
|
||||
public RoomLoadContract(HouseManager manager, boolean buildingMode, Room[][][] rooms) {
|
||||
this.rooms = rooms;
|
||||
this.manager = manager;
|
||||
this.buildingMode = buildingMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuildRegionChunk getChunk(int x, int y, int plane, @NotNull DynamicRegion dyn) {
|
||||
BuildRegionChunk chunk = rooms[plane][x][y].getChunk().copy(dyn.getPlanes()[plane]);
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSetting(@Nullable BuildRegionChunk chunk, int x, int y, int plane, @NotNull DynamicRegion dyn) {
|
||||
rooms[plane][x][y].loadDecorations(dyn != manager.dungeonRegion ? plane : 3, chunk, manager);
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareHouseChunks(HousingStyle style, DynamicRegion target, boolean buildingMode, Room[][][] rooms) {
|
||||
Region from = RegionManager.forId(style.getRegionId());
|
||||
Region.load(from, true);
|
||||
RegionChunk defaultChunk = from.getPlanes()[style.getPlane()].getRegionChunk(1, 0);
|
||||
RegionChunk defaultSkyChunk = from.getPlanes()[1].getRegionChunk(0,0);
|
||||
|
||||
RoomLoadContract loadRooms = new RoomLoadContract(this, buildingMode, rooms);
|
||||
RegionSpecification spec = new RegionSpecification(
|
||||
using(target),
|
||||
fillWith(defaultChunk)
|
||||
.from(from)
|
||||
.onPlanes(0)
|
||||
.onCondition((destX, destY, plane) -> rooms[plane][destX][destY] == null),
|
||||
fillWith((RegionChunk) null)
|
||||
.from(from)
|
||||
.onPlanes(1,2)
|
||||
.onCondition((destX, destY, plane) -> rooms[plane][destX][destY] == null),
|
||||
fillWith(defaultSkyChunk)
|
||||
.from(from)
|
||||
.onPlanes(3),
|
||||
loadRooms
|
||||
.from(from)
|
||||
.onPlanes(0,1,2)
|
||||
.onCondition((destX,destY,plane) -> rooms[plane][destX][destY] != null)
|
||||
);
|
||||
|
||||
spec.build();
|
||||
}
|
||||
|
||||
private void prepareDungeonChunks(HousingStyle style, DynamicRegion target, DynamicRegion house, boolean buildingMode, Room[][] rooms) {
|
||||
Region from = RegionManager.forId(style.getRegionId());
|
||||
Region.load(from, true);
|
||||
RegionChunk defaultChunk = from.getPlanes()[style.getPlane()].getRegionChunk(3, 0);
|
||||
|
||||
RoomLoadContract loadRooms = new RoomLoadContract(this, buildingMode, new Room[][][]{rooms});
|
||||
RegionSpecification spec = new RegionSpecification(
|
||||
using(target),
|
||||
fillWith((x,y,plane,region) -> buildingMode ? null : defaultChunk)
|
||||
.from(from)
|
||||
.onPlanes(0)
|
||||
.onCondition((destX, destY, plane) -> rooms[destX][destY] == null),
|
||||
loadRooms
|
||||
.from(from)
|
||||
.onPlanes(0)
|
||||
.onCondition((destX, destY, plane) -> rooms[destX][destY] != null)
|
||||
);
|
||||
|
||||
spec.build();
|
||||
house.link(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the rooftops.
|
||||
*/
|
||||
public void configureRoofs() {
|
||||
// boolean[][][] roofs = new boolean[2][8][8];
|
||||
// for (int x = 0; x < 8; x++) {
|
||||
// for (int y = 0; y < 8; y++) {
|
||||
// Room room = rooms[0][x][y];
|
||||
// if (room != null && room.getProperties().isChamber()) {
|
||||
// room = rooms[1][x][y];
|
||||
// int z = 1;
|
||||
// if (room != null && room.getProperties().isChamber()) {
|
||||
// z = 2;
|
||||
// }
|
||||
// if (x > 0 )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current room plane.
|
||||
* @param l The location.
|
||||
* @return The plane of the room.
|
||||
*/
|
||||
public Room getRoom(Location l) {
|
||||
int z = l.getZ();
|
||||
if (dungeonRegion != null && l.getRegionId() == dungeonRegion.getId()) {
|
||||
z = 3;
|
||||
}
|
||||
return rooms[z][l.getChunkX()][l.getChunkY()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hotspot for the given object.
|
||||
* @param object The object.
|
||||
* @return The hotspot.
|
||||
*/
|
||||
public Hotspot getHotspot(Scenery object) {
|
||||
Room room = getRoom(object.getLocation());
|
||||
if (room == null) {
|
||||
return null;
|
||||
}
|
||||
int chunkX = object.getLocation().getChunkOffsetX();
|
||||
int chunkY = object.getLocation().getChunkOffsetY();
|
||||
switch(room.getRotation()){
|
||||
case WEST: {
|
||||
int tempChunk = chunkY;
|
||||
chunkY = 7 - chunkX;
|
||||
chunkX = tempChunk;
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
//x = y, y = x, x = 7 - y
|
||||
int tempChunk = chunkX;
|
||||
chunkX = 7 - chunkY;
|
||||
chunkY = tempChunk;
|
||||
break;
|
||||
}
|
||||
case SOUTH: {
|
||||
chunkY = 7 - chunkY;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
}
|
||||
}
|
||||
for (Hotspot h : room.getHotspots()) {
|
||||
if ((h.getChunkX() == chunkX || h.getChunkX2() == chunkX) && (h.getChunkY() == chunkY || h.getChunkY2() == chunkY) && h.getHotspot().getObjectId(style) == object.getId()) {
|
||||
return h;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a room exists on the given location.
|
||||
* @param z The plane.
|
||||
* @param roomX The room x-coordinate.
|
||||
* @param roomY The room y-coordinate.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasRoomAt(int z, int roomX, int roomY) {
|
||||
Room room = rooms[z][roomX][roomY];
|
||||
return room != null && !room.getProperties().isRoof();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters the dungeon.
|
||||
* @param player The player.
|
||||
*/
|
||||
public void enterDungeon(Player player) {
|
||||
if (!hasDungeon()) {
|
||||
return;
|
||||
}
|
||||
int diffX = player.getLocation().getLocalX();
|
||||
int diffY = player.getLocation().getLocalY();
|
||||
player.getProperties().setTeleportLocation(dungeonRegion.getBaseLocation().transform(diffX, diffY, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an exit exists on the given room.
|
||||
* @param roomX The x-coordinate of the room.
|
||||
* @param roomY The y-coordinate of the room.
|
||||
* @param direction The exit direction.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasExit(int z, int roomX, int roomY, Direction direction) {
|
||||
Room room = rooms[z][roomX][roomY];
|
||||
int index = (direction.toInteger() + 3) % 4;
|
||||
return room != null && room.getExits()[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of rooms.
|
||||
* @return The amount of rooms.
|
||||
*/
|
||||
public int getRoomAmount() {
|
||||
int count = 0;
|
||||
for (int z = 0; z < 4; z++) {
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
Room r = rooms[z][x][y];
|
||||
if (r != null && !r.getProperties().isRoof()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of portals available.
|
||||
* @return The amount of portals.
|
||||
*/
|
||||
public int getPortalAmount() {
|
||||
int count = 0;
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
Room room = rooms[0][x][y];
|
||||
if (room != null && (room.getProperties() == RoomProperties.GARDEN
|
||||
|| room.getProperties() == RoomProperties.FORMAL_GARDEN) && room.getHotspots()[0].getDecorationIndex() == 0) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current house boundaries.
|
||||
* @return The boundaries.
|
||||
*/
|
||||
public Rectangle getBoundaries() {
|
||||
int startX = 99;
|
||||
int startY = 99;
|
||||
int endX = 0;
|
||||
int endY = 0;
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
if (rooms[0][x][y] != null) {
|
||||
if (x < startX) startX = x;
|
||||
if (y < startY) startY = y;
|
||||
if (x > endX) endX = x;
|
||||
if (y > endY) endY = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Rectangle(startX, startY, (endX - startX) + 1, (endY - startY) + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum dimension for the house boundaries.
|
||||
* @param player The player.
|
||||
* @return The dimension value (value X value = dimension)
|
||||
*/
|
||||
public int getMaximumDimension(Player player) {
|
||||
int level = player.getSkills().getStaticLevel(Skills.CONSTRUCTION);
|
||||
if (level >= 60) {
|
||||
return 7;
|
||||
}
|
||||
if (level >= 45) {
|
||||
return 6;
|
||||
}
|
||||
if (level >= 30) {
|
||||
return 5;
|
||||
}
|
||||
if (level >= 15) {
|
||||
return 4;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum amount of rooms available for the player.
|
||||
* @param player The player.
|
||||
* @return The maximum amount of rooms.
|
||||
*/
|
||||
public int getMaximumRooms(Player player) {
|
||||
int level = player.getSkills().getStaticLevel(Skills.CONSTRUCTION);
|
||||
if (level >= 99) return 30;
|
||||
if (level >= 96) return 29;
|
||||
if (level >= 92) return 28;
|
||||
if (level >= 86) return 27;
|
||||
if (level >= 80) return 26;
|
||||
if (level >= 74) return 25;
|
||||
if (level >= 68) return 24;
|
||||
if (level >= 62) return 23;
|
||||
if (level >= 56) return 22;
|
||||
if (level >= 50) return 21;
|
||||
return 20;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns the servant inside the player's home.
|
||||
*/
|
||||
private void spawnServant(){
|
||||
servant.setLocation(getEnterLocation());
|
||||
servant.setWalkRadius(getRoomAmount() * 2);
|
||||
servant.setWalks(true);
|
||||
servant.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has a servant.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasServant() {
|
||||
return servant != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player is in his own house (or dungeon).
|
||||
* @param player The player.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean isInHouse(Player player) {
|
||||
return isLoaded() && (player.getViewport().getRegion() == houseRegion || player.getViewport().getRegion() == dungeonRegion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player is in his dungeon.
|
||||
* @param player The player.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public static boolean isInDungeon(Player player) {
|
||||
return player.getViewport().getRegion() == player.getHouseManager().dungeonRegion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the house region was constructed and active.
|
||||
* @return {@code True} if an active region for the house exists.
|
||||
*/
|
||||
public boolean isLoaded() {
|
||||
return (houseRegion != null) || (dungeonRegion != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hasHouse.
|
||||
* @return The hasHouse.
|
||||
*/
|
||||
public boolean hasHouse() {
|
||||
return location != HouseLocation.NOWHERE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the house has a dungeon.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasDungeon() {
|
||||
return hasDungeon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the has dungeon value.
|
||||
* @param hasDungeon If the house has a dungeon.
|
||||
*/
|
||||
public void setHasDungeon(boolean hasDungeon) {
|
||||
this.hasDungeon = hasDungeon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the rooms.
|
||||
* @return The rooms.
|
||||
*/
|
||||
public Room[][][] getRooms() {
|
||||
return rooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location.
|
||||
* @return The location.
|
||||
*/
|
||||
public HouseLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location.
|
||||
* @param location The location to set.
|
||||
*/
|
||||
public void setLocation(HouseLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the building mode is enabled.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean isBuildingMode() {
|
||||
return buildingMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has locked their house.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean isLocked() {
|
||||
return locked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the house to locked.
|
||||
* @param locked true or false
|
||||
*/
|
||||
public void setLocked(boolean locked) {
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the region.
|
||||
* @return The region.
|
||||
*/
|
||||
public DynamicRegion getHouseRegion() {
|
||||
return houseRegion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dungeon region.
|
||||
* @return The dungeon region.
|
||||
*/
|
||||
public Region getDungeonRegion() {
|
||||
return dungeonRegion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the style.
|
||||
* @return the style
|
||||
*/
|
||||
public HousingStyle getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the style.
|
||||
* @param style the style to set.
|
||||
*/
|
||||
public void setStyle(HousingStyle style) {
|
||||
this.style = style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player's servant
|
||||
* @return the servant.
|
||||
*/
|
||||
public Servant getServant(){
|
||||
return servant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the player's servant
|
||||
* @param servant The servant to set.
|
||||
*/
|
||||
public void setServant(Servant servant){
|
||||
this.servant = servant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the crest value.
|
||||
* @return The crest.
|
||||
*/
|
||||
public CrestType getCrest() {
|
||||
return crest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the crest value.
|
||||
* @param crest The crest to set.
|
||||
*/
|
||||
public void setCrest(CrestType crest) {
|
||||
this.crest = crest;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the zone
|
||||
*/
|
||||
public HouseZone getZone() {
|
||||
return zone;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.map.zone.MapZone;
|
||||
import core.game.world.map.zone.ZoneRestriction;
|
||||
|
||||
/**
|
||||
* Handles the player owned house zone.
|
||||
*
|
||||
* @author Emperor
|
||||
*/
|
||||
public final class HouseZone extends MapZone {
|
||||
|
||||
/**
|
||||
* The house manager.
|
||||
*/
|
||||
private HouseManager house;
|
||||
|
||||
/**
|
||||
* The previous house region id.
|
||||
*/
|
||||
private int previousRegion = -1;
|
||||
|
||||
/**
|
||||
* The previous dungeon region id.
|
||||
*/
|
||||
private int previousDungeon = -1;
|
||||
|
||||
/**
|
||||
* Constructs the house zone object.
|
||||
*/
|
||||
public HouseZone(HouseManager house) {
|
||||
super("poh-zone" + house, true, ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.FOLLOWERS);
|
||||
this.house = house;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() {
|
||||
if (previousRegion != -1) {
|
||||
unregisterRegion(previousRegion);
|
||||
}
|
||||
if (previousDungeon != -1) {
|
||||
unregisterRegion(previousDungeon);
|
||||
}
|
||||
registerRegion(house.getHouseRegion().getId());
|
||||
if (house.getDungeonRegion() != null) {
|
||||
registerRegion(house.getHouseRegion().getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enter(Entity e) {
|
||||
return super.enter(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean death(Entity e, Entity killer) {
|
||||
if (e instanceof Player) {
|
||||
Player p = (Player) e;
|
||||
HouseManager.leave(p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leave(Entity e, boolean logout) {
|
||||
if (logout) {
|
||||
if (e instanceof Player) {
|
||||
Player p = (Player) e;
|
||||
HouseManager.leave(p);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
/**
|
||||
* The styles of houses.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
public enum HousingStyle {
|
||||
|
||||
BASIC_WOOD (1, 5000, 7503, 0, 13100, 13101, 13098, Decoration.BASIC_WOOD_WINDOW),
|
||||
BASIC_STONE (10, 5000, 7503, 1, 13094, 13096, 1902, Decoration.BASIC_STONE_WINDOW),
|
||||
WHITEWASHED_STONE (20, 7500, 7503, 2, 13006, 13007, 1415, Decoration.WHITEWASHED_STONE_WINDOW),
|
||||
FREMENNIK_STYLE_WOOD(30, 10000, 7503, 3, 13109, 13107, 13111, Decoration.FREMENNIK_WINDOW),
|
||||
TROPICAL_WOOD (40, 15000, 7759, 0, 13016, 13015, 13011, Decoration.TROPICAL_WOOD_WINDOW),
|
||||
FANCY_STONE (50, 25000, 7759, 1, 13119, 13118, 13116, Decoration.FANCY_STONE_WINDOW);
|
||||
|
||||
/**
|
||||
* The level required.
|
||||
*/
|
||||
private final int levelRequirement;
|
||||
|
||||
/**
|
||||
* The cost.
|
||||
*/
|
||||
private final int cost;
|
||||
|
||||
/**
|
||||
* The region id.
|
||||
*/
|
||||
private final int regionId;
|
||||
|
||||
/**
|
||||
* The plane.
|
||||
*/
|
||||
private final int plane;
|
||||
|
||||
/**
|
||||
* The door id.
|
||||
*/
|
||||
private final int doorId;
|
||||
|
||||
/**
|
||||
* The second door id.
|
||||
*/
|
||||
private final int secondDoorId;
|
||||
|
||||
/**
|
||||
* The wall id.
|
||||
*/
|
||||
private final int wallId;
|
||||
|
||||
/**
|
||||
* The window style
|
||||
*/
|
||||
private final Decoration window;
|
||||
|
||||
/**
|
||||
* Checks if the player has the level.
|
||||
*
|
||||
* @param player the player.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasLevel(Player player) {
|
||||
return player.getSkills().getStaticLevel(Skills.CONSTRUCTION) >= levelRequirement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code HousingStyle} {@code Object}
|
||||
* @param level The level required.
|
||||
* @param cost The cost of the style.
|
||||
* @param regionId The region id for this style.
|
||||
* @param plane The plane for this style.
|
||||
* @param doorId The door object id used in this style.
|
||||
*/
|
||||
private HousingStyle(int level, int cost, int regionId, int plane, int doorId, int secondDoorId, int wallId, Decoration window) {
|
||||
this.levelRequirement = level;
|
||||
this.cost = cost;
|
||||
this.regionId = regionId;
|
||||
this.plane = plane;
|
||||
this.doorId = doorId;
|
||||
this.secondDoorId = secondDoorId;
|
||||
this.wallId = wallId;
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level.
|
||||
* @return the level
|
||||
*/
|
||||
public int getLevel() {
|
||||
return levelRequirement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cost.
|
||||
* @return the cost
|
||||
*/
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the regionId.
|
||||
* @return the regionId
|
||||
*/
|
||||
public int getRegionId() {
|
||||
return regionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the plane.
|
||||
* @return the plane
|
||||
*/
|
||||
public int getPlane() {
|
||||
return plane;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the door used in this style.
|
||||
* @return The door object id.
|
||||
*/
|
||||
public int getDoorId() {
|
||||
return doorId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the wall used in this style.
|
||||
* @return The wall object id.
|
||||
*/
|
||||
public int getWallId() {
|
||||
return wallId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the window id for this style of house
|
||||
* @return The windows object id
|
||||
*/
|
||||
public Decoration getWindowStyle() {
|
||||
return window;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the secondDoorId value.
|
||||
* @return The secondDoorId.
|
||||
*/
|
||||
public int getSecondDoorId() {
|
||||
return secondDoorId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Holds information of all nail types.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
public enum NailType {
|
||||
|
||||
BRONZE(4819, 5),
|
||||
IRON(4820, 7),
|
||||
STEEL(1539, 10),
|
||||
MITHRIL(4822, 13),
|
||||
ADAMANT(4823, 15),
|
||||
RUNE(4824, 20)
|
||||
;
|
||||
|
||||
/**
|
||||
* The nail item id.
|
||||
*/
|
||||
private final int itemId;
|
||||
|
||||
/**
|
||||
* The bend rate.
|
||||
*/
|
||||
private final int bendRate;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code NailType} {@code Object}.
|
||||
* @param itemId The item id.
|
||||
* @param bendRate The bending rate.
|
||||
*/
|
||||
private NailType(int itemId, int bendRate) {
|
||||
this.itemId = itemId;
|
||||
this.bendRate = bendRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the nail will bend.
|
||||
* @return {@code True} if Random.nextInt(bendRate) equals 0.
|
||||
*/
|
||||
public boolean isBend() {
|
||||
return RandomFunction.getRandom(bendRate) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nail type used by the player.
|
||||
* @param player The player.
|
||||
* @param amount The nails required.
|
||||
* @return The nail type used, or null if the player didn't have the nails.
|
||||
*/
|
||||
public static NailType get(Player player, int amount) {
|
||||
for (int i = values().length - 1; i >= 0; i--) {
|
||||
NailType type = values()[i];
|
||||
if (player.getInventory().contains(type.itemId, amount)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the itemId value.
|
||||
* @return The itemId.
|
||||
*/
|
||||
public int getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bendRate value.
|
||||
* @return The bendRate.
|
||||
*/
|
||||
public int getBendRate() {
|
||||
return bendRate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
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.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.PluginManifest;
|
||||
import core.plugin.PluginType;
|
||||
import kotlin.Unit;
|
||||
import core.game.world.repository.Repository;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
/**
|
||||
* Handles the house portal options.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class PortalOptionPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (HouseLocation hl : HouseLocation.values()) {
|
||||
SceneryDefinition.forId(hl.getPortalId()).getHandlers().put("option:enter", this);
|
||||
}
|
||||
SceneryDefinition.forId(13405).getHandlers().put("option:lock", this);
|
||||
SceneryDefinition.forId(13405).getHandlers().put("option:enter", this);
|
||||
ClassScanner.definePlugin(new PortalDialogue());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
Scenery object = node.asScenery();
|
||||
if (object.getId() == 13405 && option.equals("enter")) {
|
||||
HouseManager.leave(player);
|
||||
return true;
|
||||
}
|
||||
if (option.equals("lock")) {
|
||||
if (player.getHouseManager().isInHouse(player)) {
|
||||
player.getHouseManager().setLocked(player.getHouseManager().isLocked() ? false : true);
|
||||
player.sendMessage("Your house is now "+(player.getHouseManager().isLocked() ? "locked." : "unlocked." ));
|
||||
return true;
|
||||
}
|
||||
player.sendMessage("This is not your house.");
|
||||
return true;
|
||||
}
|
||||
player.setAttribute("con:portal", object.getId());
|
||||
player.getDialogueInterpreter().open("con:portal");
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the portal dialogue.
|
||||
* @author Emperor
|
||||
*/
|
||||
@PluginManifest(type= PluginType.DIALOGUE)
|
||||
private class PortalDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code PortalDialogue} {@code Object}
|
||||
*/
|
||||
public PortalDialogue() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code PortalDialogue} {@code Object}
|
||||
* @param player The player.
|
||||
*/
|
||||
public PortalDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new PortalDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
|
||||
|
||||
|
||||
|
||||
options("Go to your house", "Go to your house (building mode)", "Go to a friend's house", "Never mind");
|
||||
stage = 1;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
end();
|
||||
switch (stage) {
|
||||
case 1:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
case 2:
|
||||
//If the player does not have a house
|
||||
if (!player.getHouseManager().hasHouse()) {
|
||||
player.getPacketDispatch().sendMessage("<col=FF0000>You don't have a house, talk to an estate agent to purchase a house.");
|
||||
break;
|
||||
}
|
||||
//If the Player has a house, but does not have their house moved to the portal they are interacting with
|
||||
if (player.getHouseManager().getLocation().getPortalId() != player.getAttribute("con:portal", -1)) {
|
||||
player.getPacketDispatch().sendMessage("<col=FF0000>Your house is in " + player.getHouseManager().getLocation().getName() + ".");
|
||||
player.sendMessage("<col=FF0000>Speak with an estate agent to change your house location.");
|
||||
break;
|
||||
}
|
||||
player.getHouseManager().enter(player, buttonId == 2);
|
||||
break;
|
||||
case 3:
|
||||
if(player.getIronmanManager().isIronman()){
|
||||
end();
|
||||
sendMessage(player, "You can't do that as an ironman.");
|
||||
return true;
|
||||
}
|
||||
sendInputDialogue(player, false, "Enter friend's name:", (value) -> {
|
||||
Player p = Repository.getPlayerByName((String) value);
|
||||
if (p == null || !p.isActive()) {
|
||||
player.getPacketDispatch().sendMessage("This player is not online.");
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
if (p.getUsername().equals(player.getUsername())) {
|
||||
player.getPacketDispatch().sendMessage("You aren't a friend of yourself!");
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
if (!p.getHouseManager().isLoaded()) {
|
||||
player.getPacketDispatch().sendMessage("This player is not at home right now.");
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
if (p.getHouseManager().isBuildingMode()) {
|
||||
player.getPacketDispatch().sendMessage("This player is in building mode.");
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
if (p.getHouseManager().isLocked()) {
|
||||
player.getPacketDispatch().sendMessage("The other player has locked their house.");
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
p.setAttribute("poh_owner", (String) value);
|
||||
p.getHouseManager().enter(player, false);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DialogueInterpreter.getDialogueKey("con:portal") };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Initializable;
|
||||
|
||||
/**
|
||||
* Removal dialogue for room & decorations in construction
|
||||
* @author Clayton Williams
|
||||
* @author Emperor
|
||||
* @date Jun-30-2015
|
||||
*/
|
||||
@Initializable
|
||||
public final class RemovalDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* The room position.
|
||||
*/
|
||||
private int[] pos;
|
||||
|
||||
/**
|
||||
* The plane.
|
||||
*/
|
||||
private int plane;
|
||||
|
||||
/**
|
||||
* The room to remove.
|
||||
*/
|
||||
private Room room;
|
||||
|
||||
/**
|
||||
* Removal Dialogue
|
||||
*/
|
||||
public RemovalDialogue() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removal Dialogue
|
||||
* @param player
|
||||
*/
|
||||
public RemovalDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new RemovalDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
pos = (int[]) args[1];
|
||||
plane = player.getLocation().getZ();
|
||||
if (HouseManager.isInDungeon(player)) {
|
||||
plane = 3;
|
||||
}
|
||||
room = player.getHouseManager().getRooms()[plane][pos[0]][pos[1]];
|
||||
player.getDialogueInterpreter().sendOptions("Remove the " + (room != null ? room.getProperties().getName() : "room") + "?", "Yes", "No");
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
if (stage == 0) {
|
||||
if (buttonId == 1) {
|
||||
if (plane == 0 && player.getHouseManager().hasRoomAt(1, pos[0], pos[1])) {
|
||||
interpreter.sendPlainMessage(false, "You can't remove a room supporting another room.");
|
||||
stage = 1;
|
||||
return true;
|
||||
}
|
||||
if (room != null && room.getProperties().isLand()) {
|
||||
Hotspot h = room.getHotspots()[0];
|
||||
if (h != null && h.getDecorationIndex() == 0 && player.getHouseManager().getPortalAmount() <= 1) {
|
||||
interpreter.sendPlainMessage(false, "You can't remove the garden with your portal in it.");
|
||||
stage = 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.getHouseManager().getRooms()[plane][pos[0]][pos[1]] = null;
|
||||
for (int i = plane; i < 3; i++) {
|
||||
Room r = player.getHouseManager().getRooms()[i][pos[0]][pos[1]];
|
||||
if (r != null && r.getProperties().isRoof()) {
|
||||
player.getHouseManager().getRooms()[i][pos[0]][pos[1]] = null;
|
||||
}
|
||||
}
|
||||
player.getHouseManager().reload(player, true);
|
||||
}
|
||||
}
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[]{ DialogueInterpreter.getDialogueKey("con:remove") };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.node.scenery.SceneryBuilder;
|
||||
import core.game.world.map.*;
|
||||
|
||||
/**
|
||||
* Represents a room.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
public final class Room {
|
||||
|
||||
/**
|
||||
* The default room type.
|
||||
*/
|
||||
public static final int CHAMBER = 0x0;
|
||||
|
||||
/**
|
||||
* The rooftop room type.
|
||||
*/
|
||||
public static final int ROOF = 0x1;
|
||||
|
||||
/**
|
||||
* The dungeon room type.
|
||||
*/
|
||||
public static final int DUNGEON = 0x2;
|
||||
|
||||
/**
|
||||
* The dungeon room type.
|
||||
*/
|
||||
public static final int LAND = 0x4;
|
||||
|
||||
/**
|
||||
* The room properties.
|
||||
*/
|
||||
private RoomProperties properties;
|
||||
|
||||
/**
|
||||
* The region chunk.
|
||||
*/
|
||||
private RegionChunk chunk;
|
||||
|
||||
/**
|
||||
* The hotspots.
|
||||
*/
|
||||
private Hotspot[] hotspots;
|
||||
|
||||
/**
|
||||
* The current rotation of the room.
|
||||
*/
|
||||
private Direction rotation = Direction.NORTH;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code Room} {@code Object}.
|
||||
* @param properties The room properties.
|
||||
*/
|
||||
public Room(RoomProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new room.
|
||||
* @param player The player.
|
||||
* @param properties The room properties.
|
||||
* @return The room.
|
||||
*/
|
||||
public static Room create(Player player, RoomProperties properties) {
|
||||
Room room = new Room(properties);
|
||||
room.configure(player.getHouseManager().getStyle());
|
||||
return room;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the room.
|
||||
*/
|
||||
public void configure(HousingStyle style) {
|
||||
this.hotspots = new Hotspot[properties.getHotspots().length];
|
||||
for (int i = 0; i < hotspots.length; i++) {
|
||||
hotspots[i] = properties.getHotspots()[i].copy();
|
||||
}
|
||||
decorate(style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redecorates the room.
|
||||
* @param style The house style.
|
||||
*/
|
||||
public void decorate(HousingStyle style) {
|
||||
Region region = RegionManager.forId(style.getRegionId());
|
||||
Region.load(region, true);
|
||||
chunk = region.getPlanes()[style.getPlane()].getRegionChunk(properties.getChunkX(), properties.getChunkY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hotspot object for the given hotspot type.
|
||||
* @param hotspot The hotspot type.
|
||||
* @return The hotspot.
|
||||
*/
|
||||
public Hotspot getHotspot(BuildHotspot hotspot) {
|
||||
for (Hotspot h : hotspots) {
|
||||
if (h.getHotspot() == hotspot) {
|
||||
return h;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the building hotspot has been built.
|
||||
* @param hotspot The building hotspot.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean isBuilt(BuildHotspot hotspot) {
|
||||
Hotspot h = getHotspot(hotspot);
|
||||
return h != null && h.getDecorationIndex() > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all the decorations.
|
||||
* @param housePlane The plane.
|
||||
* @param chunk The chunk used in the dynamic region.
|
||||
*/
|
||||
public void loadDecorations(int housePlane, BuildRegionChunk chunk, HouseManager house) {
|
||||
for (int i = 0; i < hotspots.length; i++) {
|
||||
Hotspot spot = hotspots[i];
|
||||
int x = spot.getChunkX();
|
||||
int y = spot.getChunkY();
|
||||
if (spot.getHotspot() == null) {
|
||||
continue;
|
||||
}
|
||||
int index = chunk.getIndex(x, y, spot.getHotspot().getObjectId(house.getStyle()));
|
||||
Scenery[][] objects = chunk.getObjects(index);
|
||||
Scenery object = objects[x][y];
|
||||
if (object != null && object.getId() == spot.getHotspot().getObjectId(house.getStyle())) {
|
||||
if (spot.getDecorationIndex() > -1 && spot.getDecorationIndex() < spot.getHotspot().getDecorations().length) {
|
||||
int id = spot.getHotspot().getDecorations()[spot.getDecorationIndex()].getObjectId(house.getStyle());
|
||||
if (spot.getHotspot().getType() == BuildHotspotType.CREST) {
|
||||
id += house.getCrest().ordinal();
|
||||
}
|
||||
SceneryBuilder.replace(object, object.transform(id, object.getRotation(), chunk.getCurrentBase().transform(x, y, 0)));
|
||||
}
|
||||
else if (object.getId() == BuildHotspot.WINDOW.getObjectId(house.getStyle()) || (!house.isBuildingMode() && object.getId() == BuildHotspot.CHAPEL_WINDOW.getObjectId(house.getStyle()))) {
|
||||
chunk.add(object.transform(house.getStyle().getWindowStyle().getObjectId(house.getStyle()), object.getRotation(), object.getType()));
|
||||
}
|
||||
int[] pos = RegionChunk.getRotatedPosition(x, y, object.getSizeX(), object.getSizeY(), 0, rotation.toInteger());
|
||||
spot.setCurrentX(pos[0]);
|
||||
spot.setCurrentY(pos[1]);
|
||||
}
|
||||
}
|
||||
if (rotation != Direction.NORTH && chunk.getRotation() == 0) {
|
||||
chunk.rotate(rotation);
|
||||
}
|
||||
if (!house.isBuildingMode()) {
|
||||
removeHotspots(housePlane, house, chunk);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the building hotspots from the room.
|
||||
* @param housePlane The room's plane in house.
|
||||
* @param house The house manager.
|
||||
* @param chunk The region chunk used.
|
||||
*/
|
||||
private void removeHotspots(int housePlane, HouseManager house, BuildRegionChunk chunk) {
|
||||
for (int i = 0; i < BuildRegionChunk.ARRAY_SIZE; i++) {
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (int y = 0; y < 8; y++) {
|
||||
Scenery object = chunk.get(x, y, i);
|
||||
if (object != null && object.getDefinition().hasAction("Build")) {
|
||||
if (properties.isChamber() && BuildingUtils.isDoorHotspot(object)) {
|
||||
if (!placeDoors(house, chunk, object, housePlane, x, y, rotation)) {
|
||||
chunk.remove(object);
|
||||
}
|
||||
} else {
|
||||
chunk.remove(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Places the doors when needed.
|
||||
* @param chunk The chunk.
|
||||
* @param object The object.
|
||||
* @param x The x-coordinate of the object.
|
||||
* @param y The y-coordinate of the object.
|
||||
*/
|
||||
private boolean placeDoors(HouseManager house, BuildRegionChunk chunk, Scenery object, int z, int x, int y, Direction rotation) {
|
||||
int doorX;
|
||||
int doorY;
|
||||
switch (rotation) {
|
||||
case EAST:
|
||||
doorX = y;
|
||||
doorY = 7 - x;
|
||||
break;
|
||||
case SOUTH:
|
||||
doorX = 7 - x;
|
||||
doorY = 7 - y;
|
||||
break;
|
||||
case WEST:
|
||||
doorX = 7 - y;
|
||||
doorY = x;
|
||||
break;
|
||||
default:
|
||||
doorX = x;
|
||||
doorY = y;
|
||||
break;
|
||||
}
|
||||
int chunkX = chunk.getCurrentBase().getChunkX();
|
||||
int chunkY = chunk.getCurrentBase().getChunkY();
|
||||
boolean houseExit = true;
|
||||
Room r;
|
||||
if (doorX == 0 && chunkX > 0 && (r = house.getRooms()[z][chunkX - 1][chunkY]) != null && r.getProperties().isChamber()) {
|
||||
houseExit = false;
|
||||
}
|
||||
else if (doorX == 7 && chunkX < 7 && (r = house.getRooms()[z][chunkX + 1][chunkY]) != null && r.getProperties().isChamber()) {
|
||||
houseExit = false;
|
||||
}
|
||||
else if (doorY == 0 && chunkY > 0 && (r = house.getRooms()[z][chunkX][chunkY - 1]) != null && r.getProperties().isChamber()) {
|
||||
houseExit = false;
|
||||
}
|
||||
else if (doorY == 7 && chunkY < 7 && (r = house.getRooms()[z][chunkX][chunkY + 1]) != null && r.getProperties().isChamber()) {
|
||||
houseExit = false;
|
||||
}
|
||||
int replaceId = object.getId() % 2 != 0 ? house.getStyle().getDoorId() : house.getStyle().getSecondDoorId();
|
||||
houseExit = false;
|
||||
if (z != 0 && houseExit) {
|
||||
r = house.getRooms()[z][chunkX][chunkY];
|
||||
if (r.getProperties().isDungeon()) {
|
||||
replaceId = 13065;
|
||||
} else {
|
||||
replaceId = house.getStyle().getWallId();
|
||||
}
|
||||
}
|
||||
else if (!houseExit) {
|
||||
return false;
|
||||
}
|
||||
return SceneryBuilder.replace(object, object.transform(replaceId, object.getRotation(), chunk.getCurrentBase().transform(x, y, 0)), true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the decoration index for a group of object ids
|
||||
* @param index The index.
|
||||
* @param hs The building hotspot.
|
||||
*/
|
||||
public void setAllDecorationIndex(int index, BuildHotspot hs) {
|
||||
for (int i = 0; i < hotspots.length; i++) {
|
||||
Hotspot h = hotspots[i];
|
||||
if (h.getHotspot() == hs) {
|
||||
h.setDecorationIndex(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the stairs hotspot for this room (or null if no stairs are available).
|
||||
* @return The stairs.
|
||||
*/
|
||||
public Hotspot getStairs() {
|
||||
for (Hotspot h : hotspots) {
|
||||
if (h.getHotspot().getType() == BuildHotspotType.STAIRCASE
|
||||
|| h.getHotspot() == BuildHotspot.LADDER || h.getHotspot() == BuildHotspot.TRAPDOOR
|
||||
|| (h.getHotspot() == BuildHotspot.CENTREPIECE_1 && h.getDecorationIndex() == 4)
|
||||
|| (h.getHotspot() == BuildHotspot.CENTREPIECE_2 && h.getDecorationIndex() == 2)) {
|
||||
return h;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the exit directions
|
||||
* @return The exits information.
|
||||
*/
|
||||
public boolean[] getExits() {
|
||||
return getExits(rotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the exit directions.
|
||||
* @return The directions at which you can exit the room (0=east, 1=south, 2=west, 3=north).
|
||||
*/
|
||||
public boolean[] getExits(Direction rotation) {
|
||||
boolean[] exits = properties.getExits();
|
||||
if (chunk.getRotation() != rotation.toInteger()) {
|
||||
boolean[] exit = new boolean[exits.length];
|
||||
int offset = rotation.toInteger() - chunk.getRotation();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
exit[(i + offset) % 4] = exits[i];
|
||||
}
|
||||
return exit;
|
||||
}
|
||||
return exits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hotspot for the given coordinates.
|
||||
* @param build The build hotspot.
|
||||
* @param x The x-coordinate.
|
||||
* @param y The y-coordinate.
|
||||
* @return The hotspot.
|
||||
*/
|
||||
public Hotspot getHotspot(BuildHotspot build, int x, int y) {
|
||||
for (int i = 0; i < getHotspots().length; i++) {
|
||||
Hotspot h = getHotspots()[i];
|
||||
if (h.getCurrentX() == x && h.getCurrentY() == y && h.getHotspot() == build) {
|
||||
return h;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the properties.
|
||||
* @param properties The properties.
|
||||
*/
|
||||
public void updateProperties(Player player, RoomProperties properties) {
|
||||
this.properties = properties;
|
||||
decorate(player.getHouseManager().getStyle());
|
||||
if (hotspots.length != properties.getHotspots().length) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < hotspots.length; i++) {
|
||||
Hotspot h = hotspots[i];
|
||||
Hotspot hs = hotspots[i] = properties.getHotspots()[i].copy();
|
||||
hs.setCurrentX(h.getCurrentX());
|
||||
hs.setCurrentY(h.getCurrentY());
|
||||
hs.setDecorationIndex(h.getDecorationIndex());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the chunk.
|
||||
* @return The chunk.
|
||||
*/
|
||||
public RegionChunk getChunk() {
|
||||
return chunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the chunk.
|
||||
* @param chunk The chunk to set.
|
||||
*/
|
||||
public void setChunk(RegionChunk chunk) {
|
||||
this.chunk = chunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hotspots.
|
||||
* @return The hotspots.
|
||||
*/
|
||||
public Hotspot[] getHotspots() {
|
||||
return hotspots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the hotspots.
|
||||
* @param hotspots The hotspots to set.
|
||||
*/
|
||||
public void setHotspots(Hotspot[] hotspots) {
|
||||
this.hotspots = hotspots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the properties.
|
||||
* @return The properties.
|
||||
*/
|
||||
public RoomProperties getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the room rotation.
|
||||
* @param rotation The rotation.
|
||||
*/
|
||||
public void setRotation(Direction rotation) {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the rotation.
|
||||
* @return The rotation.
|
||||
*/
|
||||
public Direction getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
package content.global.skill.construction
|
||||
|
||||
import content.global.skill.construction.RoomProperties
|
||||
|
||||
class RoomTemplate(properties: RoomProperties) {
|
||||
var hotspots: MutableList<Hotspot> = ArrayList<Hotspot>()
|
||||
|
||||
init {
|
||||
for(property in properties.hotspots){
|
||||
hotspots.add(Hotspot(property.hotspot,property.chunkX,property.chunkY,property.chunkX2,property.chunkY2))
|
||||
}
|
||||
}
|
||||
|
||||
fun rotate(clockwise: Boolean){
|
||||
hotspots = hotspots.map{
|
||||
if(!clockwise) {
|
||||
val newChunkX = it.chunkY
|
||||
val newChunkY = 7 - it.chunkX
|
||||
val newChunkX2 = it.chunkY2
|
||||
val newChunkY2 = 7 - it.chunkX2
|
||||
Hotspot(it.hotspot,newChunkX,newChunkY,newChunkX2,newChunkY2)
|
||||
} else {
|
||||
val newChunkY = it.chunkX
|
||||
val newChunkX = 7 - it.chunkY
|
||||
val newChunkY2 = it.chunkX2
|
||||
val newChunkX2 = 7 - it.chunkY2
|
||||
Hotspot(it.hotspot,newChunkX,newChunkY,newChunkX2,newChunkY2)
|
||||
}
|
||||
}.toMutableList()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.item.Item;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* Represents a player's servant.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
public final class Servant extends NPC {
|
||||
|
||||
/**
|
||||
* The servant type.
|
||||
*/
|
||||
private final ServantType type;
|
||||
|
||||
/**
|
||||
* The item the servant is carrying.
|
||||
*/
|
||||
private Item item;
|
||||
|
||||
/**
|
||||
* The amount this servant has been used.
|
||||
*/
|
||||
private int uses;
|
||||
|
||||
/**
|
||||
* If the servant is greeting players entering the house.
|
||||
*/
|
||||
private boolean greet;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code Servant} {@code Object}.
|
||||
* @param type The servant type.
|
||||
*/
|
||||
public Servant(ServantType type) {
|
||||
super(type.getId());
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the servant details.
|
||||
* @param buffer The buffer to write on.
|
||||
*/
|
||||
public void save(ByteBuffer buffer) {
|
||||
buffer.put((byte) type.ordinal());
|
||||
buffer.putShort((byte) uses);
|
||||
if (item == null) {
|
||||
buffer.putShort((short) -1);
|
||||
} else {
|
||||
buffer.putShort((short) item.getId());
|
||||
buffer.putInt(item.getAmount());
|
||||
}
|
||||
buffer.put((byte) (greet ? 1 : 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the servant from the buffer.
|
||||
* @return The servant.
|
||||
*/
|
||||
|
||||
public static Servant parse(JSONObject data){
|
||||
int type = Integer.parseInt( data.get("type").toString());
|
||||
Servant servant = new Servant(ServantType.values()[type]);
|
||||
servant.uses = Integer.parseInt( data.get("uses").toString());
|
||||
Object itemRaw = data.get("item");
|
||||
if(itemRaw != null){
|
||||
JSONObject item = (JSONObject) itemRaw;
|
||||
servant.item = new Item(Integer.parseInt(item.get("id").toString()),Integer.parseInt(item.get("amount").toString()));
|
||||
}
|
||||
servant.greet = (boolean) data.get("greet");
|
||||
return servant;
|
||||
}
|
||||
|
||||
public static Servant parse(ByteBuffer buffer) {
|
||||
int type = buffer.get();
|
||||
if (type == -1) {
|
||||
return null;
|
||||
}
|
||||
Servant servant = new Servant(ServantType.values()[type]);
|
||||
servant.uses = buffer.getShort() & 0xFFFF;
|
||||
int itemId = buffer.getShort() & 0xFFFF;
|
||||
if ((short) itemId != -1) {
|
||||
servant.item = new Item(itemId, buffer.getInt());
|
||||
}
|
||||
servant.greet = buffer.get() == 1;
|
||||
return servant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item value.
|
||||
* @return The item.
|
||||
*/
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the item value.
|
||||
* @param item The item to set.
|
||||
*/
|
||||
public void setItem(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the uses value.
|
||||
* @return The uses.
|
||||
*/
|
||||
public int getUses() {
|
||||
return uses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the uses value.
|
||||
* @param uses The uses to set.
|
||||
*/
|
||||
public void setUses(int uses) {
|
||||
this.uses = uses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the greet value.
|
||||
* @return The greet.
|
||||
*/
|
||||
public boolean isGreet() {
|
||||
return greet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the greet value.
|
||||
* @param greet The greet to set.
|
||||
*/
|
||||
public void setGreet(boolean greet) {
|
||||
this.greet = greet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type value.
|
||||
* @return The type.
|
||||
*/
|
||||
public ServantType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package content.global.skill.construction;
|
||||
|
||||
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a type of servant
|
||||
* @author Splinter
|
||||
* @version 1.1
|
||||
*/
|
||||
public enum ServantType {
|
||||
NONE(-1, -1, -1, -1, -1),
|
||||
RICK(4235, 500, 6, 20, 60),
|
||||
MAID(4237, 1000, 10, 25, 50, new Item(2003)),
|
||||
COOK(4239, 3000, 16, 30, 17, new Item(2301), new Item(712)),
|
||||
BUTLER(4241, 5000, 20, 40, 12, new Item(1897), new Item(712)),
|
||||
DEMON_BUTLER(4243, 10000, 26, 50, 7, new Item(2011))
|
||||
;
|
||||
|
||||
/**
|
||||
* The ID of the npc.
|
||||
*/
|
||||
private int npcId;
|
||||
|
||||
/**
|
||||
* How much this servant costs.
|
||||
*/
|
||||
private int cost;
|
||||
|
||||
/**
|
||||
* How much this servant is able to bring back.
|
||||
*/
|
||||
private int capacity;
|
||||
|
||||
/**
|
||||
* The level the player must have before recruiting this servant.
|
||||
*/
|
||||
private int level;
|
||||
|
||||
/**
|
||||
* How long it takes this servant to return from their duties.
|
||||
*/
|
||||
private int timer;
|
||||
|
||||
/**
|
||||
* The food items the servant can cook.
|
||||
*/
|
||||
private Item[] food;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
private ServantType(int npcId, int cost, int capacity, int level, int timer, Item... food) {
|
||||
this.npcId = npcId;
|
||||
this.cost = cost;
|
||||
this.capacity = capacity;
|
||||
this.level = level;
|
||||
this.timer = timer;
|
||||
this.food = food;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a servant for the NPC id
|
||||
* @param id The NPC id.
|
||||
* @return The servant type.
|
||||
*/
|
||||
public static ServantType forId(int id){
|
||||
for (ServantType s : ServantType.values()){
|
||||
if (s.getId() == id){
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the NPC's id
|
||||
* @return
|
||||
*/
|
||||
public int getId(){
|
||||
return npcId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the initial cost
|
||||
* @return
|
||||
*/
|
||||
public int getCost(){
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the NPC's capacity
|
||||
* @return
|
||||
*/
|
||||
public int getCapacity(){
|
||||
return capacity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level
|
||||
* @return
|
||||
*/
|
||||
public int getLevel(){
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the timer
|
||||
* @return
|
||||
*/
|
||||
public int getTimer(){
|
||||
return timer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the food the servant can cook
|
||||
* @return
|
||||
*/
|
||||
public Item[] getFood(){
|
||||
return food;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package content.global.skill.construction.decoration;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the Construction beer barrels.
|
||||
* @author Splinter
|
||||
*/
|
||||
@Initializable
|
||||
public class BeerBarrelPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* The object ids
|
||||
*/
|
||||
private static final int[] OBJECTS = new int[] {
|
||||
13568, 13569, 13570, 13571, 13572, 13573
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a new {@Code BeerBarrelPlugin} {@Code Object}
|
||||
*/
|
||||
public BeerBarrelPlugin() {
|
||||
super(1919);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (int id : OBJECTS) {
|
||||
addHandler(id, OBJECT_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
final Scenery object = (Scenery) event.getUsedWith();
|
||||
|
||||
if (player.getInventory().remove(new Item(1919))) {
|
||||
player.animate(Animation.create(833));
|
||||
player.sendMessage("You fill up your glass.");
|
||||
player.getInventory().add(new Item(getReward(object.getId()), 1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the beer reward based on the interaced barrel.
|
||||
* @return the item to give.
|
||||
*/
|
||||
public int getReward(int barrelId) {
|
||||
switch (barrelId) {
|
||||
case 13568:
|
||||
return 1917;
|
||||
case 13569:
|
||||
return 5763;
|
||||
case 13570:
|
||||
return 1905;
|
||||
case 13571:
|
||||
return 1909;
|
||||
case 13572:
|
||||
return 1911;
|
||||
case 13573:
|
||||
return 5755;
|
||||
}
|
||||
return 1917;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package content.global.skill.construction.decoration;
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import content.global.skill.construction.Decoration;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.impl.ForceMovement;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles chair and bench options.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class ChairBenchPlugin extends OptionHandler {
|
||||
|
||||
/**
|
||||
* The decorations that can be seated on.
|
||||
*/
|
||||
private static final Object[][] CHAIRS = {
|
||||
{Decoration.CRUDE_CHAIR, 4073, 4103},
|
||||
{Decoration.WOODEN_CHAIR, 4075, 4103},
|
||||
{Decoration.ROCKING_CHAIR, 4079, 4103},
|
||||
{Decoration.OAK_CHAIR, 4081, 4103},
|
||||
{Decoration.OAK_ARMCHAIR, 4083, 4103},
|
||||
{Decoration.TEAK_ARMCHAIR, 4085, 4103},
|
||||
{Decoration.MAHOGANY_ARMCHAIR, 4087, 4103},
|
||||
{Decoration.BENCH_WOODEN, 4089, 4104},
|
||||
{Decoration.BENCH_OAK, 4091, 4104},
|
||||
{Decoration.BENCH_CARVED_OAK, 4093, 4104},
|
||||
{Decoration.BENCH_TEAK, 4095, 4104},
|
||||
{Decoration.BENCH_CARVED_TEAK, 4097, 4104},
|
||||
{Decoration.BENCH_MAHOGANY, 4099, 4104},
|
||||
{Decoration.BENCH_GILDED, 4101, 4104},
|
||||
{Decoration.CARVED_TEAK_BENCH, 4097, 4104},
|
||||
{Decoration.MAHOGANY_BENCH, 4099, 4104},
|
||||
{Decoration.GILDED_BENCH, 4101, 4104},
|
||||
{Decoration.OAK_THRONE, 4111, 4103},
|
||||
{Decoration.TEAK_THRONE, 4112, 4103},
|
||||
{Decoration.MAHOGANY_THRONE, 4113, 4103},
|
||||
{Decoration.GILDED_THRONE, 4114, 4103},
|
||||
{Decoration.SKELETON_THRONE, 4115, 4103},
|
||||
{Decoration.CRYSTAL_THRONE, 4116, 4103},
|
||||
{Decoration.DEMONIC_THRONE, 4117, 4103},
|
||||
};
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (Object[] data : CHAIRS) {
|
||||
SceneryDefinition.forId(((Decoration) data[0]).getObjectId()).getHandlers().put("option:sit-on", this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, Node node, String option) {
|
||||
Scenery object = (Scenery) node;
|
||||
int animId = -1;
|
||||
int sitAnimId = -1;
|
||||
for (Object[] data : CHAIRS) {
|
||||
if (((Decoration) data[0]).getObjectId() == object.getId()) {
|
||||
animId = (Integer) data[1];
|
||||
sitAnimId = (Integer) data[2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (object.getType() == 11) {
|
||||
animId++;
|
||||
}
|
||||
final int animation = animId;
|
||||
final int sitAnimation = sitAnimId;
|
||||
ForceMovement.run(player, player.getLocation(), node.getLocation(), ForceMovement.WALK_ANIMATION, Animation.create(sitAnimation), object.getDirection().getOpposite(), ForceMovement.WALKING_SPEED, ForceMovement.WALKING_SPEED);
|
||||
player.getLocks().lockInteractions(600000);
|
||||
player.getPulseManager().run(new Pulse(2) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
player.animate(Animation.create(animation));
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
super.stop();
|
||||
player.getLocks().unlockInteraction();
|
||||
player.animate(Animation.create(sitAnimation + 2));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package content.global.skill.construction.decoration
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.global.action.DoorActionHandler
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.game.node.Node
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.node.entity.player.Player
|
||||
import content.global.skill.construction.BuildHotspot
|
||||
import content.global.skill.construction.HousingStyle
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
|
||||
/**
|
||||
* Handles Construction related doors.
|
||||
* @author Emperor
|
||||
*/
|
||||
@Initializable
|
||||
class ConstructionDoorPlugin : OptionHandler() {
|
||||
|
||||
@Throws(Throwable::class)
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
for (style in HousingStyle.values()) {
|
||||
SceneryDefinition.forId(style.doorId).handlers["option:open"] = this
|
||||
SceneryDefinition.forId(style.secondDoorId).handlers["option:open"] = this
|
||||
}
|
||||
for (deco in BuildHotspot.DUNGEON_DOOR_LEFT.decorations) {
|
||||
SceneryDefinition.forId(deco.objectId).handlers["option:open"] = this
|
||||
SceneryDefinition.forId(deco.objectId).handlers["option:pick-lock"] = this
|
||||
SceneryDefinition.forId(deco.objectId).handlers["option:force"] = this
|
||||
}
|
||||
for (deco in BuildHotspot.DUNGEON_DOOR_RIGHT.decorations) {
|
||||
SceneryDefinition.forId(deco.objectId).handlers["option:open"] = this
|
||||
SceneryDefinition.forId(deco.objectId).handlers["option:pick-lock"] = this
|
||||
SceneryDefinition.forId(deco.objectId).handlers["option:force"] = this
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(player: Player, node: Node, option: String): Boolean {
|
||||
val `object` = node as Scenery
|
||||
val second = core.game.global.action.DoorActionHandler.getSecondDoor(`object`, player)
|
||||
when (option) {
|
||||
"pick-lock", "force" -> return false //TODO
|
||||
}
|
||||
core.game.global.action.DoorActionHandler.open(`object`, second, getReplaceId(`object`), getReplaceId(second), true, 500, false)
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the replace id for the door.
|
||||
* @param object The door.
|
||||
* @return The replace object id.
|
||||
*/
|
||||
private fun getReplaceId(`object`: Scenery): Int {
|
||||
for (data in REPLACEMENT) {
|
||||
if (`object`.id == data[0]) {
|
||||
return data[1]
|
||||
}
|
||||
}
|
||||
return `object`.id + 6
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* The replacement ids.
|
||||
*/
|
||||
val REPLACEMENT = arrayOf(
|
||||
intArrayOf(13100, 13102),
|
||||
intArrayOf(13101, 13103),
|
||||
intArrayOf(13006, 13008),
|
||||
intArrayOf(13007, 13008),
|
||||
intArrayOf(13015, 13017),
|
||||
intArrayOf(13016, 13018),
|
||||
intArrayOf(13094, 13095),
|
||||
intArrayOf(13096, 13097),
|
||||
intArrayOf(13109, 13110),
|
||||
intArrayOf(13107, 13108),
|
||||
intArrayOf(13118, 13120),
|
||||
intArrayOf(13119, 13121)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package content.global.skill.construction.decoration;
|
||||
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.node.scenery.SceneryBuilder;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the various fireplaces that you may light in Construction.
|
||||
* @author Splinter
|
||||
* @author Emperor
|
||||
*/
|
||||
@Initializable
|
||||
public final class FireplacePlugin extends OptionHandler {
|
||||
|
||||
/**
|
||||
* The animation.
|
||||
*/
|
||||
private static final Animation ANIMATION = Animation.create(3658);
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.forId(13609).getHandlers().put("option:light", this);
|
||||
SceneryDefinition.forId(13611).getHandlers().put("option:light", this);
|
||||
SceneryDefinition.forId(13613).getHandlers().put("option:light", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, Node node, String option) {
|
||||
if (!player.getInventory().contains(1511, 1) || !player.getInventory().contains(590, 1)) {
|
||||
player.sendMessage("You need some logs and a tinderbox in order to light the fireplace.");
|
||||
return true;
|
||||
}
|
||||
final Scenery obj = (Scenery) node.asScenery();
|
||||
player.lock(2);
|
||||
player.animate(ANIMATION);
|
||||
GameWorld.getPulser().submit(new Pulse(2, player) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (!obj.isActive()) {
|
||||
return true;
|
||||
}
|
||||
player.getInventory().remove(new Item(1511));
|
||||
player.getSkills().addExperience(Skills.FIREMAKING, 80);
|
||||
SceneryBuilder.replace(new Scenery(obj.getId(), obj.getLocation()), new Scenery(obj.getId() + 1, obj.getLocation(), obj.getRotation()), 1000);
|
||||
player.sendMessage("You light the fireplace.");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,439 @@
|
||||
package content.global.skill.construction.decoration;
|
||||
|
||||
import content.global.skill.construction.*;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
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.game.node.scenery.SceneryBuilder;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.map.Direction;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.game.world.GameWorld;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
/**
|
||||
* Handles construction staircases.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class StaircasePlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ClassScanner.definePlugin(new BuildDialogue());
|
||||
ClassScanner.definePlugin(new ClimbPohLadder());
|
||||
for (int i = 13497; i < 13507; i++) {
|
||||
SceneryDefinition.forId(i).getHandlers().put("option:climb", this);
|
||||
SceneryDefinition.forId(i).getHandlers().put("option:climb-up", this);
|
||||
SceneryDefinition.forId(i).getHandlers().put("option:climb-down", this);
|
||||
SceneryDefinition.forId(i).getHandlers().put("option:remove-room", this);
|
||||
}
|
||||
SceneryDefinition.forId(13409).getHandlers().put("option:enter", this);
|
||||
SceneryDefinition.forId(13409).getHandlers().put("option:remove-room", this);
|
||||
for (int id = 13328; id < 13331; id++) {
|
||||
SceneryDefinition.forId(id).getHandlers().put("option:climb", this);
|
||||
SceneryDefinition.forId(id).getHandlers().put("option:remove-room", this);
|
||||
}
|
||||
for (int id = 13675; id <= 13680; id++) {
|
||||
if (id < 13678) {
|
||||
SceneryDefinition.forId(id).getHandlers().put("option:open", this);
|
||||
} else {
|
||||
SceneryDefinition.forId(id).getHandlers().put("option:go-down", this);
|
||||
SceneryDefinition.forId(id).getHandlers().put("option:close", this);
|
||||
}
|
||||
SceneryDefinition.forId(id).getHandlers().put("option:remove-room", this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
HouseManager house = player.getAttribute("poh_entry", null);
|
||||
if (house == null) {
|
||||
player.getPacketDispatch().sendMessage("You're not in your house right now (REPORT).");
|
||||
return true;
|
||||
}
|
||||
Scenery object = (Scenery) node;
|
||||
switch (option) {
|
||||
case "open":
|
||||
SceneryBuilder.replace(object, object.transform(object.getId() + 3), 200);
|
||||
return true;
|
||||
case "close":
|
||||
SceneryBuilder.replace(object, object.transform(object.getId() - 3));
|
||||
return true;
|
||||
case "remove-room":
|
||||
if (player.getLocation().getZ() != 0) {
|
||||
player.getPacketDispatch().sendMessage("The room below is supporting this room!");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case "climb":
|
||||
if (house.getDungeonRegion() == player.getViewport().getRegion()) {
|
||||
climb(player, 1, house, object);
|
||||
return true;
|
||||
}
|
||||
if (object.getLocation().getZ() > 0) {
|
||||
climb(player, -1, house, object);
|
||||
return true;
|
||||
}
|
||||
player.getDialogueInterpreter().open("con:climbdial", house, object);
|
||||
return true;
|
||||
case "climb-up":
|
||||
climb(player, 1, house, object);
|
||||
return true;
|
||||
case "enter":
|
||||
case "climb-down":
|
||||
case "go-down":
|
||||
climb(player, -1, house, object);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Climbs the staircase.
|
||||
* @param player The player.
|
||||
* @param z The plane difference.
|
||||
* @param house The house the player is currently in.
|
||||
* @param object The object.
|
||||
*/
|
||||
private static void climb(Player player, int z, HouseManager house, Scenery object) {
|
||||
Location l = player.getLocation();
|
||||
int plane = l.getZ() + z;
|
||||
int roomX = l.getChunkX();
|
||||
int roomY = l.getChunkY();
|
||||
Room current = house.getRooms()[l.getZ()][roomX][roomY];
|
||||
if (plane < 0) { //Dungeon
|
||||
plane = 3;
|
||||
}
|
||||
else if (player.getViewport().getRegion() == house.getDungeonRegion() && plane == 1) {//going up
|
||||
plane = 0;
|
||||
}
|
||||
Room room = house.getRooms()[plane][roomX][roomY];
|
||||
// boolean stairs = room != null && room.getStairs() != null || room.get;
|
||||
if (room == null || room.getProperties().isRoof()) {
|
||||
if (player.getHouseManager().isInHouse(player) && player.getHouseManager().isBuildingMode()) {
|
||||
player.getDialogueInterpreter().open("con:nfroom", plane, roomX, roomY, current, object);
|
||||
}
|
||||
else {
|
||||
player.getPacketDispatch().sendMessage("This doesn't seem to lead anywhere.");
|
||||
}
|
||||
} else {
|
||||
Location destination = l.transform(0, 0, z);
|
||||
if (player.getViewport().getRegion() == house.getDungeonRegion()) {
|
||||
destination = house.getHouseRegion().getBaseLocation().transform(l.getLocalX(), l.getLocalY(), 0);
|
||||
}
|
||||
else if (plane == 3) {
|
||||
destination = house.getDungeonRegion().getBaseLocation().transform(l.getLocalX(), l.getLocalY(), 0);
|
||||
}
|
||||
Room r = house.getRoom(destination);
|
||||
Hotspot h = r.getStairs();
|
||||
if (h != null && h.getDecorationIndex() > -1) {
|
||||
player.getProperties().setTeleportLocation(destination);
|
||||
} else {
|
||||
player.getPacketDispatch().sendMessage("This doesn't seem to lead anywhere.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the climbing dialogue.
|
||||
* @author Emperor
|
||||
*/
|
||||
static final class ClimbPohLadder extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Represents the object to use.
|
||||
*/
|
||||
private HouseManager house;
|
||||
|
||||
/**
|
||||
* The ladder.
|
||||
*/
|
||||
private Scenery ladder;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ClimbPohLadder} {@code Object}.
|
||||
*/
|
||||
public ClimbPohLadder() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ClimbPohLadder} {@code Object}.
|
||||
* @param player the player.
|
||||
*/
|
||||
public ClimbPohLadder(final Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new ClimbPohLadder(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
house = (HouseManager) args[0];
|
||||
ladder = (Scenery) args[1];
|
||||
interpreter.sendOptions("What would you like to do?", "Climb Up.", "Climb Down.");
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 0:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
player.lock(1);
|
||||
GameWorld.getPulser().submit(new Pulse(1) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
climb(player, 1, house, ladder);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
end();
|
||||
break;
|
||||
case 2:
|
||||
player.lock(1);
|
||||
GameWorld.getPulser().submit(new Pulse(1) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
climb(player, -1, house, ladder);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
end();
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DialogueInterpreter.getDialogueKey("con:climbdial") };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the creating a room on different floor dialogue.
|
||||
* @author Emperor
|
||||
*/
|
||||
static final class BuildDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* The plane of the room to build.
|
||||
*/
|
||||
private int plane;
|
||||
|
||||
/**
|
||||
* The room x-coordinate.
|
||||
*/
|
||||
private int roomX;
|
||||
|
||||
/**
|
||||
* The room y-coordinate.
|
||||
*/
|
||||
private int roomY;
|
||||
|
||||
/**
|
||||
* The room we're building on.
|
||||
*/
|
||||
private Room room;
|
||||
|
||||
/**
|
||||
* The stairs object.
|
||||
*/
|
||||
private Scenery stairs;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BuildDialogue} {@code Object}.
|
||||
*/
|
||||
public BuildDialogue() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BuildDialogue} {@code Object}.
|
||||
* @param player the player.
|
||||
*/
|
||||
public BuildDialogue(final Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new BuildDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
plane = (Integer) args[0];
|
||||
roomX = (Integer) args[1];
|
||||
roomY = (Integer) args[2];
|
||||
room = (Room) args[3];
|
||||
stairs = (Scenery) args[4];
|
||||
stage = 0;
|
||||
if (stairs.getId() >= 13328 && stairs.getId() <= 13330) {
|
||||
interpreter.sendPlainMessage(false, "These stairs don't seem to lead anywhere. Do you", "want to build a throne room upstairs?");
|
||||
stage = 5;
|
||||
return true;
|
||||
}
|
||||
if (plane == 3) {
|
||||
if (room.getProperties() == RoomProperties.THRONE_ROOM) {
|
||||
interpreter.sendPlainMessage(false, "These stairs don't seem to lead anywhere. Do you", "want to build an Oubilette?");
|
||||
} else {
|
||||
interpreter.sendPlainMessage(false, "These stairs don't seem to lead anywhere. Do you", "want to build a dungeon room?");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
interpreter.sendPlainMessage(false, "These stairs don't seem to lead anywhere. Do you", "want to build a room at the top?");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
boolean dungeon = plane == 3;
|
||||
switch (stage) {
|
||||
case 0:
|
||||
interpreter.sendOptions("Select an option", "Yes", "No");
|
||||
stage = 1;
|
||||
break;
|
||||
case 1:
|
||||
switch (buttonId) {
|
||||
case 1: //yes
|
||||
if (room.getProperties() == RoomProperties.THRONE_ROOM) {
|
||||
Room r = Room.create(player, RoomProperties.OUBILETTE);
|
||||
Direction[] dirs = BuildingUtils.getAvailableRotations(player, r.getExits(), plane, roomX, roomY);
|
||||
for (Direction d : dirs) {
|
||||
if (d == room.getRotation()) {
|
||||
r.setRotation(d);
|
||||
Hotspot stairs = room.getStairs();
|
||||
int index = stairs != null ? stairs.getDecorationIndex() : -1;
|
||||
BuildingUtils.buildRoom(player, r, plane, roomX, roomY, r.getExits(), true);
|
||||
r.getStairs().setDecorationIndex(index);
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
interpreter.sendPlainMessage(false, "The room you're trying to build doesn't fit.");
|
||||
stage = 4;
|
||||
return true;
|
||||
}
|
||||
if (dungeon) {
|
||||
interpreter.sendOptions("Select an option", "Skill Hall", "Quest Hall", "Dungeon Stairs");
|
||||
} else {
|
||||
interpreter.sendOptions("Select an option", "Skill Hall", "Quest Hall");
|
||||
}
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
end();
|
||||
return true;
|
||||
case 2:
|
||||
if (dungeon && buttonId == 3) {
|
||||
stage = 3;
|
||||
return handle(interfaceId, 1);
|
||||
}
|
||||
RoomProperties props = buttonId == 2 ? RoomProperties.QUEST_HALL_2 : RoomProperties.SKILL_HALL_2;
|
||||
if (plane == 3) {
|
||||
props = buttonId == 2 ? RoomProperties.QUEST_HALL : RoomProperties.SKILL_HALL;
|
||||
}
|
||||
Room r = Room.create(player, props);
|
||||
Direction[] dirs = BuildingUtils.getAvailableRotations(player, r.getExits(), plane, roomX, roomY);
|
||||
for (Direction d : dirs) {
|
||||
if (d == room.getRotation()) {
|
||||
r.setRotation(d);
|
||||
Hotspot stairs = room.getStairs();
|
||||
int index = stairs != null ? stairs.getDecorationIndex() : -1;
|
||||
r.getStairs().setDecorationIndex(index);
|
||||
BuildingUtils.buildRoom(player, r, plane, roomX, roomY, r.getExits(), true);
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
interpreter.sendPlainMessage(false, "The room you're trying to build doesn't seem to fit.");
|
||||
stage = 4;
|
||||
return true;
|
||||
case 3:
|
||||
switch (buttonId) {
|
||||
case 1: //yes
|
||||
r = Room.create(player, RoomProperties.DUNGEON_STAIRS);
|
||||
dirs = BuildingUtils.getAvailableRotations(player, r.getExits(), plane, roomX, roomY);
|
||||
for (Direction d : dirs) {
|
||||
if (d == room.getRotation()) {
|
||||
r.setRotation(d);
|
||||
Hotspot stairs = room.getStairs();
|
||||
int index = stairs != null ? stairs.getDecorationIndex() : -1;
|
||||
BuildingUtils.buildRoom(player, r, plane, roomX, roomY, r.getExits(), true);
|
||||
r.getStairs().setDecorationIndex(index);
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
interpreter.sendPlainMessage(false, "The room you're trying to build doesn't fit.");
|
||||
stage = 4;
|
||||
return true;
|
||||
case 2:
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
case 4:
|
||||
end();
|
||||
return true;
|
||||
case 5:
|
||||
interpreter.sendOptions("Select an option", "Yes", "No");
|
||||
stage = 6;
|
||||
return true;
|
||||
case 6:
|
||||
switch (buttonId) {
|
||||
case 1: //yes
|
||||
r = Room.create(player, RoomProperties.THRONE_ROOM);
|
||||
dirs = BuildingUtils.getAvailableRotations(player, r.getExits(), plane, roomX, roomY);
|
||||
for (Direction d : dirs) {
|
||||
if (d == room.getRotation()) {
|
||||
r.setRotation(d);
|
||||
Hotspot stairs = room.getStairs();
|
||||
int index = stairs != null ? stairs.getDecorationIndex() : -1;
|
||||
BuildingUtils.buildRoom(player, r, plane, roomX, roomY, r.getExits(), true);
|
||||
r.getStairs().setDecorationIndex(index);
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
interpreter.sendPlainMessage(false, "The room you're trying to build doesn't fit.");
|
||||
stage = 4;
|
||||
return true;
|
||||
case 2:
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DialogueInterpreter.getDialogueKey("con:nfroom") };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package content.global.skill.construction.decoration.bedroom;
|
||||
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
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.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* ClockPlugin.java
|
||||
* @author Clayton Williams (hope)
|
||||
* @date Oct 26, 2015
|
||||
*/
|
||||
@Initializable
|
||||
public class ClockPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.forId(13169).getHandlers().put("option:read", this);
|
||||
SceneryDefinition.forId(13170).getHandlers().put("option:read", this);
|
||||
SceneryDefinition.forId(13171).getHandlers().put("option:read", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
Scenery object = node.asScenery();
|
||||
SimpleDateFormat format = new SimpleDateFormat("mm");
|
||||
int minuteDisplay = Integer.parseInt(format.format(Calendar.getInstance().getTime()));
|
||||
StringBuilder sb = new StringBuilder("It's ");
|
||||
if (minuteDisplay == 0) {
|
||||
sb.append("Rune o'clock.");
|
||||
} else if (minuteDisplay == 15) {
|
||||
sb.append("a quarter past Rune.");
|
||||
} else if (minuteDisplay > 0 && minuteDisplay < 30) {
|
||||
sb.append(minuteDisplay + " past Rune.");
|
||||
} else if (minuteDisplay == 45) {
|
||||
sb.append("a quarter till Rune.");
|
||||
} else {
|
||||
sb.append((60 - minuteDisplay) + " till Rune.");
|
||||
}
|
||||
player.getDialogueInterpreter().sendItemMessage(object.getId() - 5117, sb.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package content.global.skill.construction.decoration.bedroom
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.component.Component
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
|
||||
@Initializable
|
||||
class ShavingStandHandler : OptionHandler() {
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
SceneryDefinition.forId(13162).handlers["option:preen"] = this
|
||||
SceneryDefinition.forId(13163).handlers["option:preen"] = this
|
||||
SceneryDefinition.forId(13168).handlers["option:preen"] = this
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(player: Player?, node: Node?, option: String?): Boolean {
|
||||
player ?: return false
|
||||
node ?: return false
|
||||
if(player.appearance.isMale){
|
||||
player.interfaceManager.open(Component(596))
|
||||
} else {
|
||||
player.interfaceManager.open(Component(592))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package content.global.skill.construction.decoration.bedroom
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.component.Component
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
|
||||
@Initializable
|
||||
class WardrobeHandler : OptionHandler() {
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
SceneryDefinition.forId(13155).handlers["option:change-clothes"] = this
|
||||
SceneryDefinition.forId(13156).handlers["option:change-clothes"] = this
|
||||
SceneryDefinition.forId(13161).handlers["option:change-clothes"] = this
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(player: Player?, node: Node?, option: String?): Boolean {
|
||||
player ?: return false
|
||||
node ?: return false
|
||||
if(player.appearance.isMale){
|
||||
player.interfaceManager.open(Component(591))
|
||||
} else {
|
||||
player.interfaceManager.open(Component(594))
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
package content.global.skill.construction.decoration.chapel;
|
||||
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import content.global.skill.prayer.Bones;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.map.RegionManager;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the offering of bones on an altar.
|
||||
* @author Splinter
|
||||
*/
|
||||
@Initializable
|
||||
public class BoneOfferPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* The offer GFX.
|
||||
*/
|
||||
private final Graphics GFX = new Graphics(624);
|
||||
|
||||
/**
|
||||
* The offer Animation.
|
||||
*/
|
||||
private final Animation ANIM = new Animation(896);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public BoneOfferPlugin() {
|
||||
super(526, 2859, 528, 3183, 3179, 530, 532, 3125, 4812, 3123, 534, 6812, 536, 4830, 4832, 6729, 4834, 14693);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(13185, OBJECT_TYPE, this);
|
||||
addHandler(13188, OBJECT_TYPE, this);
|
||||
addHandler(13191, OBJECT_TYPE, this);
|
||||
addHandler(13194, OBJECT_TYPE, this);
|
||||
addHandler(13197, OBJECT_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Scenery left = null;
|
||||
Scenery right = null;
|
||||
if (event.getUsedWith().asScenery().getRotation() % 2 == 0) {
|
||||
left = RegionManager.getObject(event.getUsedWith().getLocation().getZ(), event.getUsedWith().getLocation().getX() + 3, event.getUsedWith().getLocation().getY());
|
||||
right = RegionManager.getObject(event.getUsedWith().getLocation().getZ(), event.getUsedWith().getLocation().getX() - 2, event.getUsedWith().getLocation().getY());
|
||||
} else {
|
||||
left = RegionManager.getObject(event.getUsedWith().getLocation().getZ(), event.getUsedWith().getLocation().getX(), event.getUsedWith().getLocation().getY() + 3);
|
||||
right = RegionManager.getObject(event.getUsedWith().getLocation().getZ(), event.getUsedWith().getLocation().getX(), event.getUsedWith().getLocation().getY() - 2);
|
||||
}
|
||||
Bones b = Bones.forId(event.getUsedItem().getId());
|
||||
if (b != null) {
|
||||
worship(player, event.getUsedWith().asScenery(), left, right, b);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Worships the altar.
|
||||
* @param player the player
|
||||
* @param altar the altar object
|
||||
* @param left the left brazier
|
||||
* @param right the right brazier
|
||||
* @param b the bone used
|
||||
*/
|
||||
private void worship(final Player player, final Scenery altar, final Scenery left, final Scenery right, final Bones b) {
|
||||
if (player.getIronmanManager().isIronman() && !player.getHouseManager().isInHouse(player)) {
|
||||
player.sendMessage("You cannot do this on someone else's altar.");
|
||||
return;
|
||||
}
|
||||
final Location start = player.getLocation();
|
||||
|
||||
Location gfxLoc = player.getLocation().transform(player.getDirection(), 1);
|
||||
|
||||
submitIndividualPulse(player, new Pulse(1) {
|
||||
int counter = 0;
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
counter++;
|
||||
if (counter == 1 || counter % 5 == 0) {
|
||||
if (player.getInventory().remove(new Item(b.getItemId()))) {
|
||||
player.animate(ANIM);
|
||||
player.getAudioManager().send(new Audio(958));
|
||||
player.getPacketDispatch().sendPositionedGraphics(GFX, gfxLoc);
|
||||
player.sendMessage(getMessage(isLit(left), isLit(right)));
|
||||
player.getSkills().addExperience(Skills.PRAYER, b.getExperience() * getMod(altar, isLit(left), isLit(right)));
|
||||
}
|
||||
}
|
||||
return !player.getLocation().equals(start) || !player.getInventory().containsItem(new Item(b.getItemId()));
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the burner is lit.
|
||||
* @param obj the object.
|
||||
*/
|
||||
private boolean isLit(Scenery obj) {
|
||||
return obj != null && obj.getId() != 15271 && SceneryDefinition.forId(obj.getId()).getOptions() != null && !SceneryDefinition.forId(obj.getId()).hasAction("Light");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base modifier of the altar.
|
||||
* @param altar the altar object
|
||||
* @return the base bonus.
|
||||
*/
|
||||
private double getBase(Scenery altar) {
|
||||
double base = 150.0;
|
||||
if (altar == null) {
|
||||
return base;
|
||||
}
|
||||
switch (altar.getId()) {
|
||||
case 13182:
|
||||
base = 110.0;
|
||||
break;
|
||||
case 13185:
|
||||
base = 125.0;
|
||||
break;
|
||||
case 13188:
|
||||
base = 150.0;
|
||||
break;
|
||||
case 13191:
|
||||
base = 175.0;
|
||||
break;
|
||||
case 13194:
|
||||
base = 200.0;
|
||||
break;
|
||||
case 13197:
|
||||
base = 250.0;
|
||||
break;
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total experience modifier.
|
||||
* @param isLeft if the left is lit.
|
||||
* @param isRight if the right is lit.
|
||||
* @return the mod.
|
||||
*/
|
||||
private double getMod(Scenery altar, boolean isLeft, boolean isRight) {
|
||||
double total = getBase(altar);
|
||||
if (isLeft) {
|
||||
total += 50.0;
|
||||
}
|
||||
if (isRight) {
|
||||
total += 50.0;
|
||||
}
|
||||
return (total / 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the proper message.
|
||||
* @return the message.
|
||||
*/
|
||||
private String getMessage(boolean isLeft, boolean isRight) {
|
||||
return isLeft && isRight ? "The gods are very pleased with your offering." : isLeft || isRight ? "The gods are pleased with your offering." : "The gods accept your offering.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package content.global.skill.construction.decoration.chapel
|
||||
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.node.scenery.SceneryBuilder
|
||||
import core.game.node.item.Item
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.tools.RandomFunction
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
|
||||
/**
|
||||
* Handles the lighting of the torches of the Chapel.
|
||||
* @author Splinter
|
||||
*/
|
||||
class BurnerListener : InteractionListener {
|
||||
|
||||
val IDs = intArrayOf(13202,13203,13204,13205,13206,13207,13208,13209,13210,13211,13212,13213)
|
||||
|
||||
override fun defineListeners() {
|
||||
on(IDs, IntType.SCENERY, "light"){ player, node ->
|
||||
if (player.ironmanManager.checkRestriction() && !player.houseManager.isInHouse(player)) {
|
||||
return@on true
|
||||
}
|
||||
if (!player.inventory.containsItem(Item(590)) || !player.inventory.containsItem(Item(251))) {
|
||||
player.dialogueInterpreter.sendDialogue(
|
||||
"You'll need a tinderbox and a clean marrentill herb in order to",
|
||||
"light the burner."
|
||||
)
|
||||
return@on true
|
||||
}
|
||||
if (player.inventory.remove(Item(251))) {
|
||||
player.lock(1)
|
||||
player.animate(Animation.create(3687))
|
||||
player.sendMessage("You burn some marrentill in the incense burner.")
|
||||
SceneryBuilder.replace(
|
||||
node.asScenery(),
|
||||
Scenery(node.asScenery().id + 1, node.location),
|
||||
RandomFunction.random(100, 175)
|
||||
)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package content.global.skill.construction.decoration.chapel
|
||||
|
||||
import core.game.interaction.NodeUsageEvent
|
||||
import core.game.interaction.UseWithHandler
|
||||
import core.game.node.entity.player.link.audio.Audio
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import org.rs09.consts.Items
|
||||
|
||||
const val HOLY_ELIXER = 13754
|
||||
const val SPIRIT_SHIELD = 13734
|
||||
@Initializable
|
||||
/**
|
||||
* Blesses shields
|
||||
* @author Ceikry
|
||||
*/
|
||||
class ShieldBlessingPlugin : UseWithHandler(HOLY_ELIXER, SPIRIT_SHIELD) {
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
for(i in arrayOf(13185, 13188, 13191, 13194, 13197)){
|
||||
addHandler(i, OBJECT_TYPE,this)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(event: NodeUsageEvent?): Boolean {
|
||||
val player = event?.player
|
||||
player ?: return false
|
||||
if (player.ironmanManager.isIronman && !player.houseManager.isInHouse(player)) {
|
||||
player.sendMessage("You cannot do this on someone else's altar.")
|
||||
return true
|
||||
}
|
||||
if(player.skills.getLevel(Skills.PRAYER) < 85){
|
||||
player.sendMessage("You need 85 prayer to do this.")
|
||||
return true
|
||||
}
|
||||
|
||||
player.animator.animate(Animation(896))
|
||||
player.audioManager.send(Audio(958))
|
||||
|
||||
if(player.inventory.remove(Item(HOLY_ELIXER)) && player.inventory.remove(Item(SPIRIT_SHIELD)))
|
||||
player.inventory.add(Item(Items.BLESSED_SPIRIT_SHIELD_13736))
|
||||
return true
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package content.global.skill.construction.decoration.combatroom;
|
||||
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the combat ring.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class CombatRing extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.forId(13129).getHandlers().put("option:climb-over", this); //Boxing ring
|
||||
SceneryDefinition.forId(13133).getHandlers().put("option:climb-over", this); //Fencing ring
|
||||
SceneryDefinition.forId(13137).getHandlers().put("option:climb-over", this); //Combat ring
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package content.global.skill.construction.decoration.costume
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.interaction.OptionHandler
|
||||
import content.global.handlers.item.toys.DiangoReclaimInterface
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
|
||||
/**
|
||||
* Handles the Toy Box POH
|
||||
* ToyBoxPlugin.java
|
||||
* @author Lee
|
||||
* @date 10/2/2017
|
||||
*/
|
||||
@Initializable
|
||||
class ToyBoxPlugin : OptionHandler() {
|
||||
@Throws(Throwable::class)
|
||||
override fun newInstance(arg: Any?): Plugin<Any?> {
|
||||
SceneryDefinition.forId(18802).handlers["option:open"] = this
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(player: Player, node: Node, option: String): Boolean {
|
||||
DiangoReclaimInterface.open(player)
|
||||
return true
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package content.global.skill.construction.decoration.kitchen;
|
||||
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the Construction beer barrels.
|
||||
* @author Splinter
|
||||
*/
|
||||
@Initializable
|
||||
public class BeerBarrelPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* The object ids
|
||||
*/
|
||||
private static final int[] OBJECTS = new int[] {
|
||||
13568, 13569, 13570, 13571, 13572, 13573
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a new {@Code BeerBarrelPlugin} {@Code Object}
|
||||
*/
|
||||
public BeerBarrelPlugin() {
|
||||
super(1919);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (int id : OBJECTS) {
|
||||
addHandler(id, OBJECT_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
final Scenery object = (Scenery) event.getUsedWith();
|
||||
|
||||
if (player.getInventory().remove(new Item(1919))) {
|
||||
player.animate(Animation.create(3661 + (object.getId() - 13569)));
|
||||
player.sendMessage("You fill up your glass with " + object.getName().toLowerCase().replace("barrel", "").trim() + ".");
|
||||
player.getInventory().add(new Item(getReward(object.getId()), 1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the beer reward based on the interacted barrel.
|
||||
* @return the item to give.
|
||||
*/
|
||||
public int getReward(int barrelId) {
|
||||
switch (barrelId) {
|
||||
case 13568:
|
||||
return 1917;
|
||||
case 13569:
|
||||
return 5763;
|
||||
case 13570:
|
||||
return 1905;
|
||||
case 13571:
|
||||
return 1909;
|
||||
case 13572:
|
||||
return 1911;
|
||||
case 13573:
|
||||
return 5755;
|
||||
}
|
||||
return 1917;
|
||||
}
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
package content.global.skill.construction.decoration.kitchen;
|
||||
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
/**
|
||||
* Handles the interactions for the three Larders.
|
||||
* @author Splinter
|
||||
*/
|
||||
@Initializable
|
||||
public final class LarderPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ClassScanner.definePlugin(new LarderDialogue());
|
||||
SceneryDefinition.forId(13565).getHandlers().put("option:search", this);
|
||||
SceneryDefinition.forId(13566).getHandlers().put("option:search", this);
|
||||
SceneryDefinition.forId(13567).getHandlers().put("option:search", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
player.getDialogueInterpreter().open(42048, node.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dialogue options for the Larders.
|
||||
* @author Splinter
|
||||
* @version 1.0
|
||||
*/
|
||||
public final class LarderDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code LarderDialogue} {@code Object}.
|
||||
*/
|
||||
public LarderDialogue() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code LarderDialogue} {@code Object}.
|
||||
*
|
||||
* @param player
|
||||
* the player.
|
||||
*/
|
||||
public LarderDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new LarderDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
int id = (int) args[0];
|
||||
switch (id) {
|
||||
case 13565:
|
||||
interpreter.sendOptions("Select an Option", "Tea Leaves", "Bucket of Milk");
|
||||
stage = 1;
|
||||
break;
|
||||
case 13566:
|
||||
interpreter.sendOptions("Select an Option", "Tea Leaves", "Bucket of Milk", "Eggs", "Pot of Flour");
|
||||
stage = 1;
|
||||
break;
|
||||
case 13567:
|
||||
interpreter.sendOptions("Select an Option", "Tea Leaves", "Bucket of Milk", "Eggs", "Pot of Flour", "More Options");
|
||||
stage = 1;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
if (player.getInventory().freeSlots() < 1) {
|
||||
player.sendMessage("You need at least one free inventory space to take from the larder.");
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
switch (stage) {
|
||||
case 1:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
player.getInventory().add(new Item(7738, 1));
|
||||
end();
|
||||
break;
|
||||
case 2:
|
||||
player.getInventory().add(new Item(1927, 1));
|
||||
end();
|
||||
break;
|
||||
case 3:
|
||||
player.getInventory().add(new Item(1944, 1));
|
||||
end();
|
||||
break;
|
||||
case 4:
|
||||
player.getInventory().add(new Item(1933, 1));
|
||||
end();
|
||||
break;
|
||||
case 5:
|
||||
player.getDialogueInterpreter().sendOptions(
|
||||
"Select an Option", "Potatoes", "Garlic", "Onions", "Cheese");
|
||||
stage = 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
player.getInventory().add(new Item(1942, 1));
|
||||
end();
|
||||
break;
|
||||
case 2:
|
||||
player.getInventory().add(new Item(1550, 1));
|
||||
end();
|
||||
break;
|
||||
case 3:
|
||||
player.getInventory().add(new Item(1957, 1));
|
||||
end();
|
||||
break;
|
||||
case 4:
|
||||
player.getInventory().add(new Item(1985, 1));
|
||||
end();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 42048 };
|
||||
}
|
||||
}
|
||||
}
|
||||
+238
@@ -0,0 +1,238 @@
|
||||
package content.global.skill.construction.decoration.kitchen;
|
||||
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
/**
|
||||
* Handles the shelves in the kitchen room.
|
||||
* @author Splinter
|
||||
*/
|
||||
@Initializable
|
||||
public final class ShelfPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ClassScanner.definePlugin(new ShelfDialogue());
|
||||
for (int i = 13545; i < 13552; i++) {
|
||||
SceneryDefinition.forId(i).getHandlers().put("option:search", this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
player.getDialogueInterpreter().open(778341, node.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dialogue options for the shelves, what a mess!
|
||||
* @author Splinter
|
||||
* @version 1.0
|
||||
*/
|
||||
public final class ShelfDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ShelfDialogue} {@code Object}.
|
||||
*/
|
||||
public ShelfDialogue() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ShelfDialogue} {@code Object}.
|
||||
* @param player the player.
|
||||
*/
|
||||
public ShelfDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new ShelfDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
int id = (int) args[0];
|
||||
switch (id) {
|
||||
case 13545:// wood 1
|
||||
interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup");
|
||||
stage = 1;
|
||||
break;
|
||||
case 13546:// wood 2
|
||||
interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass");
|
||||
stage = 1;
|
||||
break;
|
||||
case 13547:// wood 3
|
||||
interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass", "Cake tin");
|
||||
stage = 1;
|
||||
break;
|
||||
case 13548:// oak 1
|
||||
interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass", "Bowl");
|
||||
stage = 2;
|
||||
break;
|
||||
case 13549:// oak 2
|
||||
interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Porcelain cup", "Empty beer glass", "More Options");
|
||||
stage = 3;
|
||||
break;
|
||||
case 13550:// teak 1
|
||||
case 13551:
|
||||
interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Porcelain cup", "Empty beer glass", "More Options");
|
||||
stage = 5;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
if (player.getInventory().freeSlots() < 1) {
|
||||
player.sendMessage("You need at least one free inventory space to take from the shelves.");
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
switch (stage) {
|
||||
case 1:// all wood shelves
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
end();
|
||||
player.getInventory().add(new Item(7688, 1));
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
player.getInventory().add(new Item(7702, 1));
|
||||
break;
|
||||
case 3:
|
||||
end();
|
||||
player.getInventory().add(new Item(7728, 1));
|
||||
break;
|
||||
case 4:
|
||||
end();
|
||||
player.getInventory().add(new Item(1919, 1));
|
||||
break;
|
||||
case 5:
|
||||
end();
|
||||
player.getInventory().add(new Item(1887, 1));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:// Oak shelf #1
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
end();
|
||||
player.getInventory().add(new Item(7688, 1));
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
player.getInventory().add(new Item(7702, 1));
|
||||
break;
|
||||
case 3:
|
||||
end();
|
||||
player.getInventory().add(new Item(7728, 1));
|
||||
break;
|
||||
case 4:
|
||||
end();
|
||||
player.getInventory().add(new Item(1919, 1));
|
||||
break;
|
||||
case 5:
|
||||
end();
|
||||
player.getInventory().add(new Item(1923, 1));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:// Oak shelves #2 only
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
end();
|
||||
player.getInventory().add(new Item(7688, 1));
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
player.getInventory().add(new Item(7702, 1));
|
||||
break;
|
||||
case 3:
|
||||
end();
|
||||
player.getInventory().add(new Item(4244, 1));
|
||||
break;
|
||||
case 4:
|
||||
end();
|
||||
player.getInventory().add(new Item(1919, 1));
|
||||
break;
|
||||
case 5:
|
||||
interpreter.sendOptions("Select an Option", "Bowl", "Cake tin");
|
||||
stage = 4;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:// Oak shelves #2 only
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
end();
|
||||
player.getInventory().add(new Item(1923, 1));
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
player.getInventory().add(new Item(1887, 1));
|
||||
break;
|
||||
}
|
||||
case 5:// teak shelves
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
end();
|
||||
player.getInventory().add(new Item(7688, 1));
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
player.getInventory().add(new Item(7702, 1));
|
||||
break;
|
||||
case 3:
|
||||
end();
|
||||
player.getInventory().add(new Item(7735, 1));
|
||||
break;
|
||||
case 4:
|
||||
end();
|
||||
player.getInventory().add(new Item(1919, 1));
|
||||
break;
|
||||
case 5:
|
||||
interpreter.sendOptions("Select an Option", "Bowl", "Pie dish", "Empty pot");
|
||||
stage = 6;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 6:// teak shelves
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
end();
|
||||
player.getInventory().add(new Item(1923, 1));
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
player.getInventory().add(new Item(2313, 1));
|
||||
break;
|
||||
case 3:
|
||||
end();
|
||||
player.getInventory().add(new Item(1931, 1));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 778341 };
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package content.global.skill.construction.decoration.portalchamber
|
||||
|
||||
import core.game.dialogue.DialoguePlugin
|
||||
import core.game.node.entity.player.Player
|
||||
import content.global.skill.construction.decoration.portalchamber.PortalChamberPlugin
|
||||
import core.plugin.Initializable
|
||||
|
||||
/**
|
||||
* Portal Chamber Dialogue go brrrrrr
|
||||
* @author Ceikry
|
||||
*/
|
||||
@Initializable
|
||||
class PortalChamberDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
|
||||
var portal = "none"
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> when(buttonId){
|
||||
1 -> directPortal("varrock")
|
||||
2 -> directPortal("lumbridge")
|
||||
3 -> directPortal("falador")
|
||||
4 -> options("Camelot Portal","Ardougne Portal","Yanille Portal","Kharyll Portal").also { stage++ }
|
||||
}
|
||||
1 -> when(buttonId){
|
||||
1 -> directPortal("camelot")
|
||||
2 -> directPortal("ardougne")
|
||||
3 -> directPortal("yanille")
|
||||
4 -> directPortal("kharyrll")
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun directPortal(portal: String){
|
||||
PortalChamberPlugin.direct(player,portal.toUpperCase())
|
||||
end()
|
||||
}
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
player.dialogueInterpreter.sendOptions("Select one.","Varrock Portal","Lumbridge Portal","Falador Portal","More...")
|
||||
stage = 0
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
|
||||
return PortalChamberDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(394857)
|
||||
}
|
||||
}
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
package content.global.skill.construction.decoration.portalchamber;
|
||||
|
||||
|
||||
import content.global.skill.construction.Hotspot;
|
||||
import content.global.skill.runecrafting.Rune;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import content.global.skill.construction.Decoration;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
/**
|
||||
* PortalChamberPlugin
|
||||
* @author Clayton Williams
|
||||
* @date Jan 2, 2016
|
||||
*/
|
||||
@Initializable
|
||||
public class PortalChamberPlugin extends OptionHandler {
|
||||
|
||||
/**
|
||||
* Locations
|
||||
* @author Clayton Williams
|
||||
* @date Jan 3, 2016
|
||||
*/
|
||||
private static enum Locations {
|
||||
|
||||
VARROCK(Location.create(3213, 3428, 0), new Item(Rune.FIRE.getRune().getId(), 100), new Item(Rune.AIR.getRune().getId(), 300), new Item(Rune.LAW.getRune().getId(), 100)),
|
||||
LUMBRIDGE(Location.create(3222, 3217, 0), new Item(Rune.EARTH.getRune().getId(), 100), new Item(Rune.AIR.getRune().getId(), 300), new Item(Rune.LAW.getRune().getId(), 100)),
|
||||
FALADOR(Location.create(2965, 3380, 0), new Item(Rune.WATER.getRune().getId(), 100), new Item(Rune.AIR.getRune().getId(), 300), new Item(Rune.LAW.getRune().getId(), 100)),
|
||||
CAMELOT(Location.create(2730, 3485, 0), new Item(Rune.AIR.getRune().getId(), 500), new Item(Rune.LAW.getRune().getId(), 100)),
|
||||
ARDOUGNE(Location.create(2663, 3305, 0), new Item(Rune.WATER.getRune().getId(), 200), new Item(Rune.LAW.getRune().getId(), 200)),
|
||||
YANILLE(Location.create(2554, 3114, 0), new Item(Rune.EARTH.getRune().getId(), 200), new Item(Rune.LAW.getRune().getId(), 200)),
|
||||
KHARYRLL(Location.create(3493, 3474, 0), new Item(Rune.BLOOD.getRune().getId(), 100), new Item(Rune.LAW.getRune().getId(), 200));
|
||||
|
||||
/**
|
||||
* The location to teleport to
|
||||
*/
|
||||
private Location location;
|
||||
|
||||
/**
|
||||
* The rune requirements
|
||||
*/
|
||||
private Item[] runes;
|
||||
|
||||
/**
|
||||
* Locations
|
||||
* @param location
|
||||
* @param runes
|
||||
*/
|
||||
Locations(Location location, Item... runes) {
|
||||
this.location = location;
|
||||
this.runes = runes;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Directs a portal
|
||||
* @param player
|
||||
* @param identifier
|
||||
*/
|
||||
public static void direct(Player player, String identifier) {
|
||||
player.getInterfaceManager().closeSingleTab();
|
||||
int dpId = player.getAttribute("con:dp-id", 1);
|
||||
Hotspot[] hotspots = player.getHouseManager().getRoom(player.getLocation()).getHotspots();
|
||||
for (int i = 0; i < hotspots.length; i++) {
|
||||
Hotspot h = hotspots[i];
|
||||
if (h.getHotspot().name().equalsIgnoreCase("PORTAL" + dpId)) {
|
||||
if (h.getDecorationIndex() == -1) {
|
||||
player.sendMessage("You must build a portal frame first!");
|
||||
return;
|
||||
}
|
||||
Decoration previous = h.getHotspot().getDecorations()[h.getDecorationIndex()];
|
||||
String name = previous.name();
|
||||
String prefix = "TEAK";
|
||||
if (name.toLowerCase().contains("mahogany")) {
|
||||
prefix = "MAHOGANY";
|
||||
} else if (name.toLowerCase().contains("marble")) {
|
||||
prefix = "MARBLE";
|
||||
}
|
||||
for (Locations l : Locations.values()) {
|
||||
if (l.name().contains(identifier)) {
|
||||
Item[] runes = l.runes;
|
||||
if (!player.getInventory().containsItems(runes)) {
|
||||
player.sendMessage("You do not have the required runes to build this portal");
|
||||
return;
|
||||
}
|
||||
player.getInventory().remove(runes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
h.setDecorationIndex(h.getHotspot().getDecorationIndex(Decoration.forName(prefix + "_" + identifier + "_" + "PORTAL")));
|
||||
player.getHouseManager().reload(player, player.getHouseManager().isBuildingMode()); //TODO replace object live instead?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.forId(13639).getHandlers().put("option:direct-portal", this);
|
||||
SceneryDefinition.forId(13639).getHandlers().put("option:scry", this);
|
||||
SceneryDefinition.forId(13640).getHandlers().put("option:direct-portal", this);
|
||||
SceneryDefinition.forId(13641).getHandlers().put("option:direct-portal", this);
|
||||
for (int i = 13615; i <= 13635; i++) {
|
||||
SceneryDefinition.forId(i).getHandlers().put("option:enter", this);
|
||||
}
|
||||
ClassScanner.definePlugin(new DirectPortalDialogue());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
Scenery object = node.asScenery();
|
||||
switch (option) {
|
||||
case "direct-portal":
|
||||
if (!player.getHouseManager().isBuildingMode()) {
|
||||
player.sendMessage("You can currently only do this in building mode.");
|
||||
return true;
|
||||
}
|
||||
player.getDialogueInterpreter().open(DialogueInterpreter.getDialogueKey("con:directportal"));
|
||||
return true;
|
||||
case "enter":
|
||||
String objectName = object.getName();
|
||||
for (Locations l : Locations.values()) {
|
||||
if (objectName.toLowerCase().contains(l.name().toLowerCase())) {
|
||||
player.teleport(l.location);
|
||||
if (player.getHouseManager().isInHouse(player) && node.getId() == 13635) {
|
||||
//player.getAchievementDiaryManager().getDiary(DiaryType.MORYTANIA).updateTask(player, 2, 0, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case "scry":
|
||||
//wtf
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* DirectPortalDialogue.java
|
||||
* @author Clayton Williams
|
||||
* @date Jan 2, 2016
|
||||
*/
|
||||
private static final class DirectPortalDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* DirectPortalDialogue
|
||||
*/
|
||||
public DirectPortalDialogue() {
|
||||
/**
|
||||
* Empty
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* DirectPortalDialogue
|
||||
* @param player
|
||||
*/
|
||||
public DirectPortalDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new DirectPortalDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
interpreter.sendOptions("Select a portal", "Portal 1", "Portal 2", "Portal 3");
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
player.setAttribute("con:dp-id", buttonId);
|
||||
end();
|
||||
player.getDialogueInterpreter().open(394857);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[]{DialogueInterpreter.getDialogueKey("con:directportal")};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The direct options build
|
||||
*/
|
||||
/*private final static TabbedOption DIRECT_OPTIONS = new TabbedOption("Direct Portal", "Select an option",
|
||||
new Page(
|
||||
new PageAction("Varrock Portal") {
|
||||
@Override
|
||||
public boolean run(Player player) {
|
||||
PortalChamberPlugin.direct(player, "VARROCK");
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new PageAction("Lumbridge Portal") {
|
||||
@Override
|
||||
public boolean run(Player player) {
|
||||
PortalChamberPlugin.direct(player, "LUMBRIDGE");
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new PageAction("Falador Portal") {
|
||||
@Override
|
||||
public boolean run(Player player) {
|
||||
PortalChamberPlugin.direct(player, "FALADOR");
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new PageAction("Camelot Portal") {
|
||||
@Override
|
||||
public boolean run(Player player) {
|
||||
PortalChamberPlugin.direct(player, "CAMELOT");
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new PageAction("Ardougne Portal") {
|
||||
@Override
|
||||
public boolean run(Player player) {
|
||||
PortalChamberPlugin.direct(player, "ARDOUGNE");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
), new Page(
|
||||
new PageAction("Yanille Portal") {
|
||||
@Override
|
||||
public boolean run(Player player) {
|
||||
PortalChamberPlugin.direct(player, "YANILLE");
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new PageAction("Kharyrll Portal") {
|
||||
@Override
|
||||
public boolean run(Player player) {
|
||||
PortalChamberPlugin.direct(player, "KHARYRLL");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
)
|
||||
);*/
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package content.global.skill.construction.decoration.questhall
|
||||
|
||||
import core.api.teleport
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.game.world.update.flag.context.Graphics
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class MountedGlory : InteractionListener {
|
||||
|
||||
val MOUNTED_GLORY = 13523
|
||||
|
||||
val TELEPORTS = arrayOf(
|
||||
Location.create(3087, 3495, 0),
|
||||
Location.create(2919, 3175, 0),
|
||||
Location.create(3104, 3249, 0),
|
||||
Location.create(3304, 3124, 0)
|
||||
)
|
||||
|
||||
override fun defineListeners() {
|
||||
on(MOUNTED_GLORY, IntType.SCENERY, "Edgeville") { player, _ ->
|
||||
mountedGloryTeleport(player,0)
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(MOUNTED_GLORY, IntType.SCENERY, "Karamja") { player, _ ->
|
||||
mountedGloryTeleport(player,1)
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(MOUNTED_GLORY, IntType.SCENERY, "Draynor Village") { player, _ ->
|
||||
mountedGloryTeleport(player,2)
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(MOUNTED_GLORY, IntType.SCENERY, "Al Kharid") { player, _ ->
|
||||
mountedGloryTeleport(player,3)
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
private fun mountedGloryTeleport(player : Player, int : Int) {
|
||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
||||
player.pulseManager.run(object : Pulse() {
|
||||
var counter = 0
|
||||
override fun pulse(): Boolean {
|
||||
when (counter++) {
|
||||
1 -> {
|
||||
player.lock(5)
|
||||
player.visualize(Animation(714), Graphics(308, 100, 50))
|
||||
player.getAudioManager().send(Audio(200), true);
|
||||
}
|
||||
4 -> player.animator.reset().also { teleport(player, TELEPORTS[int]) }
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
}, 0, TimeUnit.SECONDS)
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package content.global.skill.construction.decoration.questhall;
|
||||
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.dialogue.DialogueAction;
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the POH Mounted Glory.
|
||||
* @author Splinter
|
||||
*/
|
||||
@Initializable
|
||||
public class MountedGloryPlugin extends OptionHandler {
|
||||
|
||||
/**
|
||||
* Represents the teleport animation.
|
||||
*/
|
||||
private static final Animation ANIMATION = new Animation(714);
|
||||
|
||||
/**
|
||||
* Represents the graphics to use.
|
||||
*/
|
||||
private static final Graphics GRAPHICS = new Graphics(308, 100, 50);
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.forId(13523).getHandlers().put("option:rub", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
DialogueInterpreter interpreter = player.getDialogueInterpreter();
|
||||
interpreter.sendOptions("Select a location.", "Edgeville", "Karamja", "Draynor Village", "Al-Kharid", "Nowhere.");
|
||||
interpreter.addAction(new DialogueAction() {
|
||||
|
||||
@Override
|
||||
public void handle(Player player, int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 2:
|
||||
teleport(player, Location.create(3087, 3495, 0));
|
||||
break;
|
||||
case 3:
|
||||
teleport(player, Location.create(2919, 3175, 0));
|
||||
break;
|
||||
case 4:
|
||||
teleport(player, Location.create(3081, 3250, 0));
|
||||
break;
|
||||
case 5:
|
||||
teleport(player, Location.create(3304, 3124, 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to teleport to a location.
|
||||
* @param player the player.
|
||||
* @param location the location.
|
||||
*/
|
||||
private boolean teleport(final Player player, final Location location) {
|
||||
if (player.isTeleBlocked()) {
|
||||
player.sendMessage("A magical force has stopped you from teleporting.");
|
||||
return false;
|
||||
}
|
||||
player.lock();
|
||||
player.visualize(ANIMATION, GRAPHICS);
|
||||
player.getAudioManager().send(new Audio(200), true);
|
||||
player.getImpactHandler().setDisabledTicks(4);
|
||||
GameWorld.getPulser().submit(new Pulse(4, player) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
player.unlock();
|
||||
player.getProperties().setTeleportLocation(location);
|
||||
player.getAnimator().reset();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package content.global.skill.construction.decoration.study
|
||||
|
||||
import core.api.*
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.component.Component
|
||||
import core.game.interaction.OptionHandler
|
||||
import content.global.handlers.item.TeleTabsOptionPlugin
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.node.entity.skill.Skills
|
||||
import content.global.skill.construction.Decoration
|
||||
import core.game.node.entity.combat.spell.MagicStaff
|
||||
import core.game.node.item.Item
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import core.game.world.GameWorld
|
||||
import core.game.interaction.InterfaceListener
|
||||
|
||||
/**
|
||||
* Handles the lectern
|
||||
* LecternPlugin
|
||||
* @author Ceikry
|
||||
*/
|
||||
@Initializable
|
||||
class LecternPlugin : OptionHandler() {
|
||||
/**
|
||||
* TeleTabButton
|
||||
*/
|
||||
private enum class TeleTabButton(
|
||||
/**
|
||||
* The button id
|
||||
*/
|
||||
val buttonId: Int,
|
||||
/**
|
||||
* The level and xp
|
||||
*/
|
||||
val level: Int,
|
||||
val xp: Double,
|
||||
/**
|
||||
* The item
|
||||
*/
|
||||
val tabItem: Item,
|
||||
/**
|
||||
* The required decoration (lectern)
|
||||
*/
|
||||
private val requiredDecorations: Array<Decoration>, vararg requiredItems: Item) {
|
||||
ARDOUGNE(2, 51, 61.0, Item(TeleTabsOptionPlugin.TeleTabs.ADDOUGNE_TELEPORT.item), arrayOf<Decoration>(Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563, 2), Item(555, 2)),
|
||||
BONES_TO_BANANNAS(3, 15, 25.0, Item(8014), arrayOf<Decoration>(Decoration.DEMON_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(561, 1), Item(557, 2), Item(555, 2)),
|
||||
BONES_TO_PEACHES(4, 60, 35.5, Item(8015), arrayOf<Decoration>(Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(561, 2), Item(557, 4), Item(555, 4)),
|
||||
CAMELOT(5, 45, 55.5, Item(TeleTabsOptionPlugin.TeleTabs.CAMELOT_TELEPORT.item), arrayOf<Decoration>(Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(556, 5)),
|
||||
ENCHANT_DIAMOND(6, 57, 67.0, Item(8019), arrayOf<Decoration>(Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(557, 10)),
|
||||
ENCHANT_DRAGONSTONE(7, 68, 78.0, Item(8020), arrayOf<Decoration>(Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(557, 15), Item(555, 15)),
|
||||
ENCHANT_EMERALD(8, 27, 37.0, Item(8017), arrayOf<Decoration>(Decoration.DEMON_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(556, 3)),
|
||||
ENCHANT_ONYX(9, 87, 97.0, Item(8021), arrayOf<Decoration>(Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(557, 20), Item(554, 20)),
|
||||
ENCHANT_RUBY(10, 49, 59.0, Item(8018), arrayOf<Decoration>(Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(554, 5)),
|
||||
ENCHANT_SAPPHIRE(11, 7, 17.5, Item(8016), arrayOf<Decoration>(Decoration.OAK_LECTERN, Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN, Decoration.DEMON_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(555)),
|
||||
FALADOR(12, 37, 48.0, Item(TeleTabsOptionPlugin.TeleTabs.FALADOR_TELEPORT.item), arrayOf<Decoration>(Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(555), Item(556, 3)),
|
||||
LUMBRIDGE(13, 31, 41.0, Item(TeleTabsOptionPlugin.TeleTabs.LUMBRIDGE_TELEPORT.item), arrayOf<Decoration>(Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(557), Item(556, 3)),
|
||||
HOUSE(14, 40, 30.0, Item(8013), arrayOf<Decoration>(Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(557), Item(556)),
|
||||
VARROCK(15, 25, 35.0, Item(TeleTabsOptionPlugin.TeleTabs.VARROCK_TELEPORT.item), arrayOf<Decoration>(Decoration.OAK_LECTERN, Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN, Decoration.DEMON_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(563), Item(554), Item(556, 3)),
|
||||
WATCHTOWER(16, 58, 68.0, Item(TeleTabsOptionPlugin.TeleTabs.WATCH_TOWER_TELEPORT.item), arrayOf<Decoration>(Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563, 2), Item(557, 2));
|
||||
|
||||
/**
|
||||
* The required items
|
||||
*/
|
||||
val requiredItems: ArrayList<Item> = arrayListOf(*requiredItems)
|
||||
|
||||
/**
|
||||
* Checks if the player can make this tab
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
fun canMake(player: Player): Boolean {
|
||||
val objectId = player.getAttribute<Int>("ttb:objectid")
|
||||
if (player.skills.getLevel(Skills.MAGIC) < level && player.spellBookManager.spellBook == 192) {
|
||||
player.sendMessage("You need a magic level of $level to make that!")
|
||||
return false
|
||||
}
|
||||
if (this == BONES_TO_PEACHES && !player.savedData.activityData.isBonesToPeaches) {
|
||||
player.sendMessages("You need the Bones to Peaches ability purchased from MTA before making these.", "This requirement doesn't apply to actually using the tabs.")
|
||||
return false
|
||||
}
|
||||
var found = false
|
||||
for (d in requiredDecorations) if (d.objectId == objectId) found = true
|
||||
if (!found) {
|
||||
player.sendMessage("You're unable to make this tab on this specific lectern.")
|
||||
return false
|
||||
}
|
||||
for (item in requiredItems) {
|
||||
val staff = MagicStaff.forId(item.id)
|
||||
if (staff != null && player.equipment.containsAtLeastOneItem(staff.staves)) {
|
||||
continue;
|
||||
}
|
||||
if (!player.inventory.containsItem(item)) {
|
||||
//TODO staffs
|
||||
player.sendMessage("You don't have enough materials.")
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Gets the button for the id
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
fun forId(id: Int): TeleTabButton? {
|
||||
for (ttb in values()) {
|
||||
if (ttb.buttonId == id) return ttb
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Throws(Throwable::class)
|
||||
override fun newInstance(arg: Any?): Plugin<Any>? {
|
||||
for (i in 13642..13648) {
|
||||
SceneryDefinition.forId(i).handlers["option:study"] = this
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(player: Player, node: Node, option: String): Boolean {
|
||||
val id = node.asScenery().id
|
||||
player.setAttribute("ttb:objectid", id)
|
||||
GameWorld.Pulser.submit(object : Pulse(){
|
||||
var counter = 0
|
||||
override fun pulse(): Boolean {
|
||||
when(counter++){
|
||||
0 -> player.animator.animate(Animation(1894)).also { player.lock() }
|
||||
1 -> player.interfaceManager.open(Component(400)).also { player.unlock(); return true }
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* TeleTabInterface
|
||||
* @author Ceikry
|
||||
*/
|
||||
class TeleTabInterface : InterfaceListener {
|
||||
val decorationVarps = hashMapOf(
|
||||
Decoration.OAK_LECTERN to Pair(0, 0),
|
||||
Decoration.EAGLE_LECTERN to Pair(1, 0),
|
||||
Decoration.DEMON_LECTERN to Pair(0, 1),
|
||||
Decoration.TEAK_EAGLE_LECTERN to Pair(2, 0),
|
||||
Decoration.TEAK_DEMON_LECTERN to Pair(0, 2),
|
||||
Decoration.MAHOGANY_EAGLE_LECTERN to Pair(3, 0),
|
||||
Decoration.MAHOGANY_DEMON_LECTERN to Pair(0, 3),
|
||||
)
|
||||
override fun defineInterfaceListeners() {
|
||||
onOpen(400) { player, component ->
|
||||
val id = player.getAttribute("ttb:objectid", 0)
|
||||
val deco = Decoration.forObjectId(id)
|
||||
val values = decorationVarps[deco] ?: Pair(0, 0)
|
||||
player.varpManager.get(261).setVarbit(0, values.first).send(player)
|
||||
player.varpManager.get(262).setVarbit(0, values.second).send(player)
|
||||
return@onOpen true
|
||||
}
|
||||
on(400) { player, _, _, buttonID, _, _ ->
|
||||
val ttb = TeleTabButton.forId(buttonID)
|
||||
if (ttb != null && ttb.canMake(player)) {
|
||||
player.interfaceManager.close()
|
||||
var requiredItemsCountingStaves = ttb.requiredItems.filter({ item ->
|
||||
val staff = MagicStaff.forId(item.id);
|
||||
!(staff != null && player.equipment.containsAtLeastOneItem(staff.staves))
|
||||
}).toTypedArray()
|
||||
player.pulseManager.run(object : Pulse(1) {
|
||||
var counter = 0
|
||||
override fun pulse(): Boolean {
|
||||
when(counter++) {
|
||||
0 -> {
|
||||
if (!ttb.canMake(player)) {
|
||||
return true
|
||||
}
|
||||
//TODO Add correct lectern animation (should look like raising arms progressively higher 3 times).
|
||||
player.animate(Animation(782))
|
||||
}
|
||||
2 -> {
|
||||
if (player.inventory.remove(*requiredItemsCountingStaves)) {
|
||||
// Should never drop, since soft clay was successfully removed
|
||||
addItemOrDrop(player, ttb.tabItem.id)
|
||||
player.skills.addExperience(Skills.MAGIC, ttb.xp, true)
|
||||
if (ttb == TeleTabButton.VARROCK
|
||||
&& (player.getAttribute("ttb:objectid", 0) == Decoration.MAHOGANY_EAGLE_LECTERN.objectId
|
||||
|| player.getAttribute("ttb:objectid", 0) == Decoration.MAHOGANY_DEMON_LECTERN.objectId)) {
|
||||
player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 2, 8)
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
counter %= 6
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
player.animate(Animation(-1))
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Soft clay
|
||||
*/
|
||||
private val SOFT_CLAY = Item(1761, 1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package content.global.skill.construction.decoration.study
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.component.Component
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.game.node.Node
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import core.tools.RandomFunction
|
||||
import content.global.activity.shootingstar.ShootingStarPlugin
|
||||
import core.game.world.GameWorld.Pulser
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@Initializable
|
||||
class TelescopePlugin : OptionHandler() {
|
||||
@Throws(Throwable::class)
|
||||
override fun newInstance(arg: Any?): Plugin<Any?>? {
|
||||
SceneryDefinition.forId(13656).handlers["option:observe"] = this
|
||||
SceneryDefinition.forId(13657).handlers["option:observe"] = this
|
||||
SceneryDefinition.forId(13658).handlers["option:observe"] = this
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(player: Player?, node: Node?, option: String?): Boolean {
|
||||
val star = ShootingStarPlugin.getStar()
|
||||
val delay: Int = 25000 + (25000 / 3)
|
||||
val timeLeft = delay - star.ticks
|
||||
val fakeTimeLeftBecauseFuckPlayers = TimeUnit.MILLISECONDS.toMinutes(timeLeft * 600L) + if(RandomFunction.random(0,100) % 2 == 0) 2 else -2
|
||||
val obj = node?.asScenery() as Scenery
|
||||
player?.lock()
|
||||
player?.animate(ANIMATION)
|
||||
player?.interfaceManager?.open(Component(782)).also { player?.unlock()
|
||||
Pulser.submit(object : Pulse(2, player) {
|
||||
override fun pulse(): Boolean {
|
||||
if (obj.isActive) {
|
||||
player?.dialogueInterpreter?.sendDialogue("You see a shooting star! The star looks like it will land","in about $fakeTimeLeftBecauseFuckPlayers minutes!")
|
||||
return true
|
||||
}
|
||||
return true
|
||||
}
|
||||
})
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val ANIMATION = Animation.create(3649)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package content.global.skill.construction.decoration.workshop
|
||||
|
||||
import core.game.dialogue.DialoguePlugin
|
||||
import content.data.RepairItem
|
||||
import core.game.interaction.NodeUsageEvent
|
||||
import core.game.interaction.UseWithHandler
|
||||
import content.region.misthalin.lumbridge.dialogue.BobDialogue.BarrowsEquipment
|
||||
import content.region.misthalin.lumbridge.dialogue.BobDialogue.BarrowsEquipment.BarrowsFullEquipment
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import kotlin.math.ceil
|
||||
|
||||
@Initializable
|
||||
class ArmourStand : UseWithHandler(494, 468, 496, 470, 498, 472, 500, 502, 474, 504, 476, 506, 478, 6741, 4856, 4857, 4858, 4859, 4860, 4862, 4863, 4864, 4865, 4866, 4868, 4869, 4870, 4871, 4872, 4874, 4875, 4876, 4877, 4878, 4880, 4881, 4882, 4883, 4884, 4886, 4887, 4888, 4889, 4890, 4892, 4893, 4894, 4895, 4896, 4898, 4899, 4900, 4901, 4902, 4904, 4905, 4906, 4907, 4908, 4910, 4911, 4912, 4913, 4914, 4916, 4917, 4918, 4919, 4920, 4922, 4923, 4924, 4925, 4926, 4928, 4929, 4930, 4931, 4932, 4934, 4935, 4936, 4937, 4938, 4940, 4941, 4942, 4943, 4944, 4946, 4947, 4948, 4949, 4950, 4952, 4953, 4954, 4955, 4956, 4958, 4959, 4960, 4961, 4962, 4964, 4965, 4966, 4967, 4968, 4970, 4971, 4972, 4973, 4974, 4976, 4977, 4978, 4979, 4980, 4982, 4983, 4984, 4985, 4986, 4988, 4989, 4990, 4991, 4992, 4994, 4995, 4996, 4997, 4998){
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
addHandler(13715, OBJECT_TYPE, this)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(event: NodeUsageEvent?): Boolean {
|
||||
event ?: return false
|
||||
val player = event.player
|
||||
val repairItem = RepairItem.forId(event.used.id)
|
||||
|
||||
var baseCost = 0.0
|
||||
var product: Item? = null
|
||||
|
||||
if(repairItem != null){
|
||||
baseCost = repairItem.cost * 1.0
|
||||
product = repairItem.product
|
||||
} else if(BarrowsEquipment.isBarrowsItem(event.used.id)){
|
||||
//Begin terrible code thanks to Vexia
|
||||
val type = BarrowsEquipment.formatedName(event.used.id)
|
||||
val single = BarrowsEquipment.getSingleName(type)
|
||||
val equipment = BarrowsEquipment.getEquipmentType(type)
|
||||
val newString = type.toLowerCase().replace(single, "").trim { it <= ' ' }.replace("'s", "")
|
||||
val newewString = StringBuilder()
|
||||
newewString.append(newString).append(" $equipment")
|
||||
val fullequip = BarrowsFullEquipment.forName(newewString.toString())
|
||||
baseCost = BarrowsEquipment.getFormatedCost(equipment,event.used.asItem()) * 1.0
|
||||
product = fullequip.full
|
||||
//End terrible code thanks to Vexia
|
||||
}
|
||||
|
||||
if((repairItem == null && baseCost == 0.0)){
|
||||
player.sendMessage("That item can't be repaired.")
|
||||
return true
|
||||
}
|
||||
|
||||
val cost: Int = ceil(((100.0 - (player.skills.getLevel(Skills.SMITHING) / 2.0) ) / 100.0) * baseCost).toInt()
|
||||
|
||||
player.dialogueInterpreter.open(58824213,event.used,cost,product)
|
||||
|
||||
return true
|
||||
}
|
||||
@Initializable
|
||||
class RepairDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){
|
||||
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
|
||||
return RepairDialogue(player)
|
||||
}
|
||||
var item: Item? = null
|
||||
var cost: Int = 0
|
||||
var product: Item? = null
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
item = args[0] as Item
|
||||
cost = args[1] as Int
|
||||
product = args[2] as Item
|
||||
player.dialogueInterpreter.sendDialogue("Would you like to repair your ${(item as Item).name.toLowerCase()}","for $cost gp?")
|
||||
stage = 0
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
item ?: return false
|
||||
product ?: return false
|
||||
when(stage){
|
||||
0 -> options("Yes, please","No, thanks").also{stage++}
|
||||
1 -> when(buttonId){
|
||||
1 -> exchangeItems(item as Item,cost,product as Item).also { end() }
|
||||
2 -> end()
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun exchangeItems(item: Item, cost: Int, product: Item) {
|
||||
val coins = Item(995, cost)
|
||||
if (player.inventory.containsItem(coins) && player.inventory.containsItem(item)) {
|
||||
player.inventory.remove(item, coins)
|
||||
player.inventory.add(product)
|
||||
player.sendMessage("You repair your ${product.name.toLowerCase()} for $cost.")
|
||||
} else {
|
||||
player.sendMessage("You can't afford that.")
|
||||
}
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(58824213)
|
||||
}
|
||||
}
|
||||
}
|
||||
+235
@@ -0,0 +1,235 @@
|
||||
package content.global.skill.construction.decoration.workshop;
|
||||
|
||||
|
||||
import content.global.skill.construction.BuildingUtils;
|
||||
import content.global.skill.construction.Decoration;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
/**
|
||||
* Handles the clockmakers bench in the workshop
|
||||
* ClockmakersBenchPlugin.java
|
||||
* @author Clayton Williams (hope)
|
||||
* @date Oct 29, 2015
|
||||
*/
|
||||
@Initializable
|
||||
public class ClockmakersBenchPlugin extends OptionHandler {
|
||||
|
||||
/**
|
||||
* Stores data for things created by the clockmakers bench
|
||||
* ClockmakersBenchPlugin.java
|
||||
* @author Clayton Williams
|
||||
* @date Oct 30, 2015
|
||||
*/
|
||||
private enum Craftable {
|
||||
|
||||
TOY_HORSEY(2520, 10, BuildingUtils.PLANK),
|
||||
CLOCKWORK(8792, 8, new Item(2353)),
|
||||
TOY_SOLDIER(7759, 13, BuildingUtils.PLANK, new Item(8792)),
|
||||
TOY_DOLL(7763, 18, BuildingUtils.PLANK, new Item(8792)),
|
||||
TOY_MOUSE(7767, 33, BuildingUtils.PLANK, new Item(8792)),
|
||||
TOY_CAT(7771, 85, BuildingUtils.PLANK, new Item(8792)),
|
||||
WATCH(2575, 28, new Item(8792), new Item(2353)),
|
||||
SEXTANT(2574, 23, new Item(2353));
|
||||
|
||||
/**
|
||||
* The itemId to give after making this
|
||||
*/
|
||||
private int itemId;
|
||||
|
||||
/**
|
||||
* The materials needed to make this
|
||||
*/
|
||||
private Item[] materials;
|
||||
|
||||
/**
|
||||
* The crafting level required to make this
|
||||
*/
|
||||
private int craftingLevel;
|
||||
|
||||
/**
|
||||
* Craftable
|
||||
* @param itemId
|
||||
* @param craftingLevel
|
||||
* @param materials
|
||||
*/
|
||||
Craftable(int itemId, int craftingLevel, Item... materials) {
|
||||
this.itemId = itemId;
|
||||
this.craftingLevel = craftingLevel;
|
||||
this.materials = materials;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.forId(13709).getHandlers().put("option:craft", this);
|
||||
SceneryDefinition.forId(13710).getHandlers().put("option:craft", this);
|
||||
SceneryDefinition.forId(13711).getHandlers().put("option:craft", this);
|
||||
SceneryDefinition.forId(13712).getHandlers().put("option:craft", this);
|
||||
ClassScanner.definePlugin(new ClockmakerBenchDialogue());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
player.getDialogueInterpreter().open(DialogueInterpreter.getDialogueKey("con:clockbench"), node.asScenery());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the dialogue for clock bench
|
||||
* @author Clayton Williams
|
||||
* @date Oct 29, 2015
|
||||
*/
|
||||
private final class ClockmakerBenchDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* The crafting table decoration
|
||||
*/
|
||||
Decoration decoration;
|
||||
|
||||
/**
|
||||
* ClockmakerBenchDialogue
|
||||
*/
|
||||
public ClockmakerBenchDialogue() {
|
||||
/**
|
||||
* Empty
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* ClockmakerBenchDialogue
|
||||
* @param player
|
||||
*/
|
||||
public ClockmakerBenchDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new ClockmakerBenchDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
Scenery object = (Scenery) args[0];
|
||||
decoration = Decoration.forObjectId(object.getId());
|
||||
if (decoration != null) {
|
||||
switch (decoration) {
|
||||
case CRAFTING_TABLE_1:
|
||||
interpreter.sendOptions("Select an Option", "Toy Horsey", "Nevermind");
|
||||
break;
|
||||
case CRAFTING_TABLE_2:
|
||||
interpreter.sendOptions("Select an Option", "Toy Horsey", "Clockwork Mechanism");
|
||||
break;
|
||||
case CRAFTING_TABLE_3:
|
||||
interpreter.sendOptions("Select an Option", "Toy Horsey", "Clockwork Mechanism", "Clockwork Devices");
|
||||
break;
|
||||
case CRAFTING_TABLE_4:
|
||||
interpreter.sendOptions("Select an Option", "Toy Horsey", "Clockwork Mechanism", "Clockwork Devices", "Watch", "Sextant");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
stage = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 1:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
case 2:
|
||||
if (decoration == Decoration.CRAFTING_TABLE_1 && buttonId == 2) {
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
craftItem(buttonId == 1 ? Craftable.TOY_HORSEY : Craftable.CLOCKWORK);
|
||||
stage = 3;
|
||||
break;
|
||||
case 3:
|
||||
if (decoration == Decoration.CRAFTING_TABLE_3) {
|
||||
interpreter.sendOptions("Select an Option", "Clockwork Soldier", "Clockwork Doll");
|
||||
} else if (decoration == Decoration.CRAFTING_TABLE_4) {
|
||||
interpreter.sendOptions("Select an Option", "Clockwork Soldier", "Clockwork Doll", "Clockwork Mouse", "Clockwork Cat");
|
||||
}
|
||||
stage = 2;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
craftItem(buttonId == 4 ? Craftable.WATCH : Craftable.SEXTANT);
|
||||
stage = 3;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
craftItem(Craftable.TOY_SOLDIER);
|
||||
break;
|
||||
case 2:
|
||||
craftItem(Craftable.TOY_DOLL);
|
||||
break;
|
||||
case 3:
|
||||
craftItem(Craftable.TOY_MOUSE);
|
||||
break;
|
||||
case 4:
|
||||
craftItem(Craftable.TOY_CAT);
|
||||
break;
|
||||
}
|
||||
stage = 3;
|
||||
break;
|
||||
case 3:
|
||||
end();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to craft an item
|
||||
* @param c - the craftable to make
|
||||
*/
|
||||
private void craftItem(Craftable c) {
|
||||
if (c != null) {
|
||||
if (player.getSkills().getLevel(Skills.CRAFTING) < c.craftingLevel) {
|
||||
interpreter.sendDialogue("You need level " + c.craftingLevel + " crafting to make that.");
|
||||
return;
|
||||
}
|
||||
for (Item n : c.materials) {
|
||||
if (!player.getInventory().containsItem(n)) {
|
||||
interpreter.sendDialogue("You need a " + ItemDefinition.forId(n.getId()).getName() + " to make that!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (Item n : c.materials) {
|
||||
n.setAmount(1);
|
||||
player.getInventory().remove(n);
|
||||
}
|
||||
player.getSkills().addExperience(Skills.CRAFTING, 15);
|
||||
player.getInventory().add(new Item(c.itemId, 1));
|
||||
player.animate(BuildingUtils.BUILD_MID_ANIM);
|
||||
interpreter.sendDialogue("You made a " + ItemDefinition.forId(c.itemId).getName() + "!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DialogueInterpreter.getDialogueKey("con:clockbench") };
|
||||
}
|
||||
}
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
package content.global.skill.construction.decoration.workshop;
|
||||
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.dialogue.DialogueInterpreter;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles the 5 types of tool stores
|
||||
* ToolsPlugin.java
|
||||
* @author Clayton Williams
|
||||
* @date Oct 29, 2015
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public class ToolsPlugin extends OptionHandler {
|
||||
|
||||
/**
|
||||
* The different tool stores
|
||||
* @author Clayton Williams
|
||||
* @date Oct 29, 2015
|
||||
*/
|
||||
private enum ToolStore {
|
||||
|
||||
TOOLSTORE_1(13699, 8794, 1755, 2347, 1735),
|
||||
TOOLSTORE_2(13700, 1925, 952, 590),
|
||||
TOOLSTORE_3(13701, 1757, 1785, 1733),
|
||||
TOOLSTORE_4(13702, 1595, 1597, 1592, 1599, 5523),
|
||||
TOOLSTORE_5(13703, 5341, 952, 676, 5343, 5331);
|
||||
|
||||
/**
|
||||
* The object id of the tool store
|
||||
*/
|
||||
private int objectId;
|
||||
|
||||
/**
|
||||
* The tools included
|
||||
*/
|
||||
private int[] tools;
|
||||
|
||||
/**
|
||||
* ToolStore
|
||||
* @param objectId
|
||||
* @param tools
|
||||
*/
|
||||
ToolStore(int objectId, int... tools) {
|
||||
this.objectId = objectId;
|
||||
this.tools = tools;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the toolstore from an object id
|
||||
* @param objectId - the object id
|
||||
* @return
|
||||
*/
|
||||
private static ToolStore forId(int objectId) {
|
||||
for (ToolStore t : ToolStore.values()) {
|
||||
if (t.objectId == objectId) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (ToolStore t : ToolStore.values()) {
|
||||
SceneryDefinition.forId(t.objectId).getHandlers().put("option:search", this);
|
||||
}
|
||||
ClassScanner.definePlugin(new ToolDialogue());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
Scenery object = node.asScenery();
|
||||
ToolStore ts = ToolStore.forId(object.getId());
|
||||
if (ts != null) {
|
||||
player.getDialogueInterpreter().open(DialogueInterpreter.getDialogueKey("con:tools"), ts);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the tool dialogue
|
||||
* @author Clayton Williams
|
||||
* @date Oct 29, 2015
|
||||
*/
|
||||
private final class ToolDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* The tool store being used
|
||||
*/
|
||||
private ToolStore toolStore;
|
||||
|
||||
/**
|
||||
* ToolDialogue
|
||||
*/
|
||||
private ToolDialogue() {
|
||||
/**
|
||||
* Empty
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* ToolDialogue
|
||||
* @param player
|
||||
*/
|
||||
public ToolDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new ToolDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
toolStore = (ToolStore) args[0];
|
||||
List<String> itemNames = new ArrayList<String>();
|
||||
for(int itemId : toolStore.tools) {
|
||||
ItemDefinition n = ItemDefinition.forId(itemId);
|
||||
itemNames.add(n.getName());
|
||||
}
|
||||
interpreter.sendOptions("Select a Tool", itemNames.toArray(new String[itemNames.size()]));
|
||||
stage = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 1:
|
||||
Item item = new Item(toolStore.tools[buttonId - 1], 1);
|
||||
if (player.getInventory().freeSlots() <= 0) {
|
||||
interpreter.sendDialogue("You have no space in your inventory.");
|
||||
stage = 2;
|
||||
return true;
|
||||
}
|
||||
player.getInventory().add(item);
|
||||
end();
|
||||
return true;
|
||||
case 2:
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DialogueInterpreter.getDialogueKey("con:tools") };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,568 @@
|
||||
package content.global.skill.construction.npc;
|
||||
|
||||
|
||||
import content.global.skill.construction.HouseManager;
|
||||
import content.global.skill.construction.ServantType;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.game.dialogue.FacialExpression;
|
||||
import core.game.node.entity.impl.PulseType;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.construction.Servant;
|
||||
import core.game.interaction.MovementPulse;
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.IronmanMode;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.map.path.Pathfinder;
|
||||
import content.global.handlers.iface.SawmillPlankInterface.Plank;
|
||||
|
||||
/**
|
||||
* Handles the Servant's dialogues.
|
||||
* @author Splinter
|
||||
* @date 9/23/2015
|
||||
* @version 0.98 (TODO: Missing a few dialogues)
|
||||
*/
|
||||
public class HouseServantDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* If using the sawmill.
|
||||
*/
|
||||
private boolean sawmill;
|
||||
|
||||
/**
|
||||
* The logs
|
||||
*/
|
||||
private Item logs;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ServantDialogue} {@code Object}.
|
||||
*/
|
||||
public HouseServantDialogue() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ServantDialogue} {@code Object}.
|
||||
* @param player the player.
|
||||
*/
|
||||
public HouseServantDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new HouseServantDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
npc = (NPC) args[0];
|
||||
HouseManager manager = player.getHouseManager();
|
||||
boolean inHouse = manager.isInHouse(player);
|
||||
if (args.length > 1) { //Parse options from our "use-with" handler
|
||||
sawmill = (boolean) args[1];
|
||||
logs = (Item) args[2];
|
||||
}
|
||||
if (player.getIronmanManager().checkRestriction(IronmanMode.ULTIMATE)) {
|
||||
player.sendMessage("Ultimate Ironmen cannot hire butlers.");
|
||||
return true;
|
||||
}
|
||||
if (!manager.hasHouse() && inHouse) {
|
||||
interpreter.sendDialogues(npc, npc.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You don't have a house that I can work in.", "I'll be waiting here if you decide to buy a house.");
|
||||
stage = 100;
|
||||
return true;
|
||||
}
|
||||
if (!manager.hasServant()) {
|
||||
ServantType type = ServantType.forId(npc.getId());
|
||||
if(player.getSkills().getLevel(Skills.CONSTRUCTION) >= type.getLevel()){
|
||||
interpreter.sendDialogues(npc, npc.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You're not aristocracy, but I suppose you'd do. Do you", "want a good cook for " + type.getCost() + " coins?");
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
interpreter.sendDialogues(npc, npc.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You need a Construction level of " + type.getLevel() + " and you must not", "currently have another person working for you", "in order to hire me.");
|
||||
stage = 100;
|
||||
return true;
|
||||
} else {
|
||||
Servant servant = manager.getServant();
|
||||
if(servant.getItem() == null){
|
||||
servant.setItem(new Item(0, 0));
|
||||
}
|
||||
if (inHouse) {
|
||||
follow(player, servant);
|
||||
if (sawmill) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Very well, I will take these logs to the mill and", "have them converted into planks.");
|
||||
stage = 110;
|
||||
return true;
|
||||
}
|
||||
if (servant.getItem().getAmount() > 0) {
|
||||
if(player.getInventory().freeSlots() < 1){
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I have returned with what you asked me to", "retrieve. As I see your inventory is full, I shall wait", "with these " + servant.getItem().getAmount()+" items until you are ready.");
|
||||
stage = 100;
|
||||
return true;
|
||||
}
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I have returned with what you asked me to", "retrieve.");
|
||||
stage = 150;
|
||||
return true;
|
||||
}
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Yes, " + (player.getAppearance().isMale() ? "sir" : "ma'am") + "?", "You have " + (8 - servant.getUses()) + " uses of my services remaining.");
|
||||
stage = 50;
|
||||
} else if(npc.getId() != servant.getId()){
|
||||
interpreter.sendDialogues(npc, npc.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You already have someone working for you.", "Fire them first before hiring me.");
|
||||
stage = 100;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
HouseManager manager = player.getHouseManager();
|
||||
Servant servant = manager.getServant();
|
||||
ServantType type = ServantType.forId(npc.getId());
|
||||
switch(stage) {
|
||||
case 0:
|
||||
options("What can you do?", "Tell me about your previous jobs.", "You're hired!");
|
||||
stage++;
|
||||
break;
|
||||
case 1:
|
||||
switch(buttonId) {
|
||||
case 1: //TODO:
|
||||
break;
|
||||
case 2: //TODO:
|
||||
break;
|
||||
case 3:
|
||||
player("You're hired!");
|
||||
stage = 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendDialogues(npc, npc.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Alright, " + (player.getAppearance().isMale() ? "sir" : "ma'am") + ". I can start work immediately.");
|
||||
stage++;
|
||||
break;
|
||||
case 3:
|
||||
if (type != null && player.getInventory().getAmount(995) >= type.getCost() && player.getInventory().remove(new Item(995, type.getCost()))) {
|
||||
manager.setServant(new Servant(type));
|
||||
interpreter.sendDialogue("The servant heads to your house.");
|
||||
stage = 100;
|
||||
break;
|
||||
}
|
||||
interpreter.sendDialogue("You don't have enough money to pay the servant's hiring fee.");
|
||||
stage = 100;
|
||||
break;
|
||||
case 50:
|
||||
options("Go to the bank/sawmill...", "Misc...", "Stop following me.", "You're fired!");
|
||||
stage++;
|
||||
break;
|
||||
case 51:
|
||||
type = servant.getType();
|
||||
switch(buttonId) {
|
||||
case 1:
|
||||
options(!servant.getAttributes().containsKey("con:lastfetch") ? "Repeat last fetch task" : "Fetch another " + (type.getCapacity() + " x " + ((Item) servant.getAttribute("con:lastfetch")).getName().toLowerCase()) + " (" + (servant.getAttribute("con:lastfetchtype")) + ")", "Go to the bank", "Go to the sawmill", "Pay wages (" + servant.getUses()+"/8 uses)");
|
||||
stage++;
|
||||
break;
|
||||
case 2:
|
||||
options("Greet guests", "Cook me something");
|
||||
stage = 56;
|
||||
break;
|
||||
case 3:
|
||||
player("Stop following me.");
|
||||
if (servant.getPulseManager().isMovingPulse()) {
|
||||
servant.getPulseManager().clear(PulseType.STANDARD);
|
||||
}
|
||||
stage = 100;
|
||||
break;
|
||||
case 4:
|
||||
player("You're fired!");
|
||||
stage = 75;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 52:
|
||||
switch(buttonId){
|
||||
case 1:
|
||||
if (!servant.getAttributes().containsKey("con:lastfetch")) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I haven't recently fetched anything from the bank or", "sawmill for you.");
|
||||
stage = 50;
|
||||
break;
|
||||
} else {
|
||||
if (servant.getAttribute("con:lastfetchtype") == "bank") {
|
||||
bankFetch(player, (Item) servant.getAttribute("con:lastfetch"));
|
||||
return true;
|
||||
}
|
||||
end();
|
||||
sawmillRun(player, (Item) servant.getAttribute("con:lastfetch"));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
options("Planks", "Oak planks", "Teak planks", "Mahogany planks", "More options");
|
||||
stage = 60;
|
||||
break;
|
||||
case 3:
|
||||
if (type == ServantType.MAID || type == ServantType.RICK) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I am unable to travel to the sawmill for you.");
|
||||
stage = 100;
|
||||
break;
|
||||
}
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Hand the logs to me and I will take them to the", "sawmill for you.");
|
||||
stage = 100;
|
||||
break;
|
||||
case 4:
|
||||
stage = 100;
|
||||
if (servant.getUses() < 1) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You have no need to pay me yet, I haven't performed", "any of my services for you.");
|
||||
break;
|
||||
}
|
||||
if (!player.getInventory().containsItem(new Item(995, type.getCost()))) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Thanks for the kind gesture, but you don't have enough", "money to pay me. I require " + type.getCost() + " coins every eight uses", "of my services.");
|
||||
break;
|
||||
}
|
||||
if (player.getInventory().remove(new Item(995, type.getCost()))) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Thank you very much.");
|
||||
servant.setUses(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 56:
|
||||
switch(buttonId) {
|
||||
case 1:
|
||||
servant.setGreet(!servant.isGreet());
|
||||
player("Please " + (servant.isGreet() ? "greet" : "do not greet") + " all new guests upon arrival.");
|
||||
stage++;
|
||||
break;
|
||||
case 2:
|
||||
if (type.getFood() == null) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I don't know any recipes.");
|
||||
stage = 100;
|
||||
break;
|
||||
}
|
||||
if (type.getFood().length > 1) {
|
||||
options(type.getFood()[0].getName(), type.getFood()[1].getName(), "Nevermind.");
|
||||
stage = 58;
|
||||
} else {
|
||||
options(type.getFood()[0].getName(), "Nevermind.");
|
||||
stage = 59;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 57:
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Whatever you command.");
|
||||
stage = 50;
|
||||
break;
|
||||
case 58:
|
||||
if (player.getInventory().freeSlots() < 1) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I would love to share my fine cooking with you,", "but your hands are currently full.");
|
||||
stage = 100;
|
||||
break;
|
||||
}
|
||||
if (!prereqs(player, null, false)) {
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
switch(buttonId) {
|
||||
case 1:
|
||||
player.getInventory().add(type.getFood()[0]);
|
||||
stage = 50;
|
||||
break;
|
||||
case 2:
|
||||
player.getInventory().add(type.getFood()[1]);
|
||||
stage = 50;
|
||||
break;
|
||||
case 3:
|
||||
player("Nevermind.");
|
||||
stage = 100;
|
||||
return true;
|
||||
}
|
||||
servant.setUses(servant.getUses() + 1);
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Luckily for you, I already have some made. Here you", "go.");
|
||||
stage = 50;
|
||||
break;
|
||||
case 59:
|
||||
if (player.getInventory().freeSlots() < 1) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I would love to share my fine cooking with", "you, but you have no space to take anything.");
|
||||
stage = 50;
|
||||
break;
|
||||
}
|
||||
if (!prereqs(player, null, false)) {
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
switch(buttonId) {
|
||||
case 1:
|
||||
player.getInventory().add(type.getFood()[0]);
|
||||
stage = 100;
|
||||
break;
|
||||
case 2:
|
||||
player("Nevermind.");
|
||||
stage = 100;
|
||||
return true;
|
||||
}
|
||||
servant.setUses(servant.getUses() + 1);
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Luckily for you, I already have some made. Here you", "go.");
|
||||
stage = 100;
|
||||
break;
|
||||
case 60:
|
||||
switch(buttonId) {
|
||||
case 1: //planks
|
||||
bankFetch(player, new Item(960));
|
||||
stage = 100;
|
||||
break;
|
||||
case 2: //oak
|
||||
bankFetch(player, new Item(8778));
|
||||
stage = 100;
|
||||
break;
|
||||
case 3: //teak
|
||||
bankFetch(player, new Item(8780));
|
||||
break;
|
||||
case 4: //mahog
|
||||
bankFetch(player, new Item(8782));
|
||||
break;
|
||||
case 5:
|
||||
options("Soft clay", "Limestone bricks", "Steel bars", "Cloth", "More options");
|
||||
stage++;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 61:
|
||||
switch(buttonId) {
|
||||
case 1: //clay
|
||||
bankFetch(player, new Item(1761));
|
||||
break;
|
||||
case 2: //lime
|
||||
bankFetch(player, new Item(3420));
|
||||
break;
|
||||
case 3: //steel bars
|
||||
bankFetch(player, new Item(2353));
|
||||
break;
|
||||
case 4: //cloth
|
||||
bankFetch(player, new Item(8790));
|
||||
break;
|
||||
case 5:
|
||||
options("Gold leaves", "Marble blocks", "Magic stones");
|
||||
stage++;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 62:
|
||||
switch(buttonId) {
|
||||
case 1: //leaves
|
||||
bankFetch(player, new Item(4692));
|
||||
break;
|
||||
case 2: //marble
|
||||
bankFetch(player, new Item(8786));
|
||||
break;
|
||||
case 3: //magic stones
|
||||
bankFetch(player, new Item(4703));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 75:
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Very well. I will return to the Guild of the Servants", "in Ardougne if you wish to re-hire me.");
|
||||
stage++;
|
||||
break;
|
||||
case 76:
|
||||
end();
|
||||
servant.getItem().setAmount(0);
|
||||
servant.setUses(0);
|
||||
servant.clear();
|
||||
servant.setLocation(new Location(0, 0));
|
||||
manager.setServant(null);
|
||||
break;
|
||||
case 100:
|
||||
end();
|
||||
break;
|
||||
case 110:
|
||||
end();
|
||||
sawmillRun(player, logs);
|
||||
break;
|
||||
case 150:
|
||||
if (servant.getItem()== null) {
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
int amtLeft = servant.getItem().getAmount();
|
||||
boolean flag = false;
|
||||
if (amtLeft < 1 || servant.getItem() == null) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I don't have any items left.");
|
||||
stage = 100;
|
||||
break;
|
||||
}
|
||||
if (amtLeft > player.getInventory().freeSlots()) {
|
||||
amtLeft = player.getInventory().freeSlots();
|
||||
flag = true;
|
||||
}
|
||||
servant.getItem().setAmount(servant.getItem().getAmount() - amtLeft);
|
||||
player.getInventory().add(new Item(servant.getItem().getId(), amtLeft));
|
||||
if (flag) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I still have " + servant.getItem().getAmount() + " left for you to take from me.");
|
||||
stage = 100;
|
||||
} else{
|
||||
end();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 4235, 4237, 4239, 4241, 4243 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the pre-reqs for a sawmill run or a bank run.
|
||||
* @param player
|
||||
* @param item
|
||||
* @return true or false if they have the requirements to use the servant.
|
||||
*/
|
||||
private boolean prereqs(final Player player, final Item item, boolean sawmill) {
|
||||
HouseManager manager = player.getHouseManager();
|
||||
Servant servant = manager.getServant();
|
||||
if (!sawmill && player.getInventory().freeSlots() < 1) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You don't have any space in your inventory.");
|
||||
stage = 100;
|
||||
return false;
|
||||
}
|
||||
if (servant.getUses() >= 8) {
|
||||
player.sendMessage("<col=CC0000>The servant has left your service due to a lack of payment.</col>");
|
||||
servant.getItem().setAmount(0);
|
||||
servant.setUses(0);
|
||||
servant.clear();
|
||||
servant.setLocation(new Location(0, 0));
|
||||
manager.setServant(null);
|
||||
end();
|
||||
return false;
|
||||
}
|
||||
if (servant.getItem().getAmount() > 0) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You can't send me off again, I'm still holding some of", "your previous items.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Goes to the sawmill.
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
private void sawmillRun(final Player player, final Item item) {
|
||||
HouseManager manager = player.getHouseManager();
|
||||
final Servant servant = manager.getServant();
|
||||
final ServantType type = manager.getServant().getType();
|
||||
if (servant == null || item == null || !prereqs(player, item, true)) {
|
||||
return;
|
||||
}
|
||||
if (type == ServantType.MAID || type == ServantType.RICK) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I am unable to take planks to the sawmill.");
|
||||
return;
|
||||
}
|
||||
int amt = player.getInventory().getAmount(item);
|
||||
if (amt < 1) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You don't have any more of that type of log.");
|
||||
return;
|
||||
}
|
||||
for (Plank plank : Plank.values()) {
|
||||
if (plank.getLog().getId() == item.getId()) {
|
||||
if (amt > type.getCapacity()) {
|
||||
amt = type.getCapacity();
|
||||
}
|
||||
if (!player.getInventory().contains(995, plank.getPrice() * amt)) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You don't have enough coins for me to do that.", "I can hold " + type.getCapacity() + " logs and each of this type of log", "costs " + plank.getPrice() + " coins each to convert into plank form.");
|
||||
return;
|
||||
}
|
||||
end();
|
||||
if (player.getInventory().remove(new Item(item.getId(), amt)) && player.getInventory().remove(new Item(995, amt * plank.getPrice()))) {
|
||||
manager.getServant().setItem(new Item(plank.getPlank().getId(), amt));
|
||||
servant.setInvisible(true);
|
||||
servant.getLocks().lockMovement(100);
|
||||
GameWorld.getPulser().submit(new Pulse((int) (type.getTimer() / 0.6)){
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
servant.setInvisible(false);
|
||||
servant.getLocks().unlockMovement();
|
||||
servant.setAttribute("con:lastfetch", new Item(item.getId(), 1));
|
||||
servant.setAttribute("con:lastfetchtype", "sawmill");
|
||||
interpreter.open(servant.getId(), servant);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets items from the player's bank.
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
private void bankFetch(final Player player, final Item item) {
|
||||
final HouseManager manager = player.getHouseManager();
|
||||
final Servant servant = manager.getServant();
|
||||
final ServantType type = manager.getServant().getType();
|
||||
if (servant == null || item == null || !prereqs(player, item, false)) {
|
||||
return;
|
||||
}
|
||||
if (!player.getBank().containsItem(item)) {
|
||||
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You don't seem to have any of those in the bank.");
|
||||
stage = 100;
|
||||
return;
|
||||
}
|
||||
end();
|
||||
servant.setInvisible(true);
|
||||
servant.getLocks().lockMovement(100);
|
||||
GameWorld.getPulser().submit(new Pulse((int) (type.getTimer() / 0.6)) {
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (player == null || player.getHouseManager().getHouseRegion() != player.getViewport().getRegion()) { //TODO: Check if in dungeon?
|
||||
return true;
|
||||
}
|
||||
int amt = player.getBank().getAmount(item.getId());
|
||||
if (amt < 1) {
|
||||
return true;
|
||||
}
|
||||
if (amt > type.getCapacity()) {
|
||||
amt = type.getCapacity();
|
||||
}
|
||||
servant.setInvisible(false);
|
||||
servant.getLocks().unlockMovement();
|
||||
Item fetch = new Item(item.getId(), amt);
|
||||
if (player.getBank().remove(fetch)) {
|
||||
manager.getServant().setItem(fetch);
|
||||
interpreter.open(servant.getId(), servant);
|
||||
}
|
||||
servant.setAttribute("con:lastfetch", new Item(fetch.getId(), 1));
|
||||
servant.setAttribute("con:lastfetchtype", "bank");
|
||||
manager.getServant().setUses(manager.getServant().getUses() + 1);
|
||||
follow(player, servant);
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Follows the person who is talking to them.
|
||||
* @param player
|
||||
* @param npc
|
||||
*/
|
||||
private void follow(Player player, NPC npc) {
|
||||
npc.getPulseManager().run(new MovementPulse(npc, player, Pathfinder.SMART) {
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
return false;
|
||||
}
|
||||
}, PulseType.STANDARD);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package content.global.skill.construction.npc;
|
||||
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
/**
|
||||
* Handles interaction with the house servant.
|
||||
* @author Splinter
|
||||
* @date 9/24/2015
|
||||
* @version 0.1
|
||||
*
|
||||
* @see {@link HouseServantDialogue}
|
||||
* For the other associated classes that deal with house servants.
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public class HouseServantPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* The item IDS to use.
|
||||
*/
|
||||
final static int[] IDS = { 1511, 1521, 6333, 6332 };
|
||||
|
||||
/**
|
||||
* Constructs a new {@code HouseServantPlugin} {@code Object}.
|
||||
*/
|
||||
public HouseServantPlugin() {
|
||||
super(IDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(4235, NPC_TYPE, this);
|
||||
addHandler(4237, NPC_TYPE, this);
|
||||
addHandler(4239, NPC_TYPE, this);
|
||||
addHandler(4241, NPC_TYPE, this);
|
||||
addHandler(4243, NPC_TYPE, this);
|
||||
ClassScanner.definePlugin(new HouseServantDialogue());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
if (event.getUsedItem() == null || event.getUsedWith() == null) {
|
||||
return true;
|
||||
}
|
||||
event.getPlayer().getDialogueInterpreter().open(event.getUsedWith().asNpc().getId(), event.getUsedWith().asNpc(), true, event.getUsedItem());
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package content.global.skill.construction.npc;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the Keldagrim Stonemason.
|
||||
* @author Splinter
|
||||
*/
|
||||
@Initializable
|
||||
public class StonemasonPlugin extends OptionHandler {
|
||||
/*
|
||||
*//**
|
||||
* The store that sells supplies.
|
||||
*//*
|
||||
private static final SupplyStore STORE = new SupplyStore();*/
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
NPCDefinition.forId(4248).getHandlers().put("option:trade", this);
|
||||
NPCDefinition.forId(4248).getHandlers().put("option:talk-to", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
switch (option) {
|
||||
case "trade":
|
||||
case "talk-to":
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
*//**
|
||||
* Stonemason's store.
|
||||
* @author Splinter
|
||||
*//*
|
||||
public static class SupplyStore extends Shop {
|
||||
|
||||
*//**
|
||||
* Constructs a new {@Code SupplyStore} {@Code Object}
|
||||
*//*
|
||||
public SupplyStore() {
|
||||
super("Keldagrim Stonemason", new Item[] { new Item(3420, 1000), new Item(8786, 20), new Item(8784, 20), new Item(8788, 10) }, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSell(Player player, Item item, ItemDefinition def) {
|
||||
player.sendMessage("You cannot sell items to this store.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBuyPrice(Item item, Player player) {
|
||||
switch (item.getId()) {
|
||||
case 3420:
|
||||
return 26;
|
||||
case 8786:
|
||||
return 325_000;
|
||||
case 8784:
|
||||
return 130_000;
|
||||
case 8788:
|
||||
return 975_000;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user