Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CURSED_CHESTS_VERSION = "1.1.1"
- local CURSED_CHESTS_SKULL_DEFAULT = SKULL_WHITE
- local CURSED_CHESTS_SKULL_BOSS = SKULL_BLACK
- CURSED_CHESTS_TIER_COMMON = 1
- CURSED_CHESTS_TIER_RARE = 2
- CURSED_CHESTS_TIER_EPIC = 3
- CURSED_CHESTS_TIER_LEGENDARY = 4
- CURSED_CHESTS_TIERS = {
- {
- tier = CURSED_CHESTS_TIER_COMMON,
- chance = 70,
- text = "Common Cursed Chest",
- item = 12664,
- monstersPerWave = 5,
- reqLevel = 25
- },
- {
- tier = CURSED_CHESTS_TIER_RARE,
- chance = 45,
- text = "Rare Cursed Chest",
- item = 12664,
- monstersPerWave = 7,
- reqLevel = 50
- },
- {
- tier = CURSED_CHESTS_TIER_EPIC,
- chance = 25,
- text = "Epic Cursed Chest",
- item = 12664,
- monstersPerWave = 9,
- reqLevel = 80
- },
- {
- tier = CURSED_CHESTS_TIER_LEGENDARY,
- chance = 10,
- text = "Legendary Cursed Chest",
- item = 12664,
- monstersPerWave = 11,
- reqLevel = 120
- }
- }
- CURSED_CHESTS_CONFIG = {
- [1] = {
- message = "Prepare to defend against 5 waves of demon type monsters and a boss at the end.",
- rewards = {
- [CURSED_CHESTS_TIER_COMMON] = {
- {
- -- Platinum Coins
- chance = 100,
- item = 2152,
- random = true,
- amount = 100
- },
- {
- -- Platinum Coins
- chance = 80,
- item = 2152,
- random = true,
- amount = 100
- },
- {
- -- crystal coins
- chance = 100,
- item = 2160,
- random = true,
- amount = 7
- },
- {
- -- crystal coins
- chance = 40,
- item = 2160,
- random = true,
- amount = 3
- },
- {
- -- Strong Health Potion
- chance = 100,
- item = 7588,
- random = true,
- amount = 100
- },
- {
- -- Strong Health Potion
- chance = 100,
- item = 7588,
- random = true,
- amount = 100
- },
- {
- -- Strong Mana Potion
- chance = 100,
- item = 7589,
- random = true,
- amount = 100
- },
- {
- -- Strong Mana Potion
- chance = 100,
- item = 7589,
- random = true,
- amount = 100
- },
- {
- -- Mana Potion
- chance = 100,
- item = 7620,
- random = true,
- amount = 100
- },
- {
- -- Mana Potion
- chance = 100,
- item = 7620,
- random = true,
- amount = 100
- },
- {
- -- Gold Token
- chance = 100,
- item = 25377,
- amount = 1
- },
- {
- -- Gold Token
- chance = 40,
- item = 25377,
- amount = 1
- },
- {
- -- Blue Crystal Splinter
- chance = 100,
- item = 18418,
- random = true,
- amount = 25
- },
- {
- -- Brown Crystal Splinter
- chance = 100,
- item = 18417,
- random = true,
- amount = 25
- },
- {
- -- Green Crystal Splinter
- chance = 100,
- item = 18416,
- random = true,
- amount = 25
- },
- {
- -- Small Amethyst
- chance = 100,
- item = 2150,
- random = true,
- amount = 25
- },
- {
- -- Small Emerald
- chance = 100,
- item = 2149,
- random = true,
- amount = 25
- },
- {
- -- Small Ruby
- chance = 100,
- item = 2147,
- random = true,
- amount = 25
- },
- {
- -- Small Sapphire
- chance = 100,
- item = 2146,
- random = true,
- amount = 25
- },
- {
- -- Candy
- chance = 80,
- item = 6569,
- random = true,
- amount = 40
- },
- {
- -- Talon
- chance = 60,
- item = 2151,
- random = true,
- amount = 15
- },
- {
- -- Vampire Teeth
- chance = 50,
- item = 10602,
- random = true,
- amount = 5
- },
- {
- -- Rope Belt
- chance = 50,
- item = 12448,
- random = true,
- amount = 5
- },
- {
- -- Batwing Hat
- chance = 20,
- item = 10016,
- amount = 1
- },
- {
- -- Crown Helmet
- chance = 45,
- item = 2491,
- amount = 1
- },
- {
- -- Crown Helmet
- chance = 45,
- item = 2491,
- amount = 1
- },
- {
- -- Crown Armor
- chance = 20,
- item = 2487,
- amount = 1
- },
- {
- -- Crown Armor
- chance = 20,
- item = 2487,
- amount = 1
- },
- {
- -- Crown Legs
- chance = 20,
- item = 2488,
- amount = 1
- },
- {
- -- Crown Legs
- chance = 20,
- item = 2488,
- amount = 1
- },
- {
- -- Crystalline armor
- chance = 15,
- item = 8878,
- amount = 1
- },
- {
- -- Zaoan armor
- chance = 20,
- item = 11301,
- amount = 1
- },
- {
- -- Dragon scale mail
- chance = 10,
- item = 2492,
- amount = 1
- },
- {
- -- Spellbook of warding
- chance = 20,
- item = 8901,
- amount = 1
- },
- {
- -- Dragon shield
- chance = 25,
- item = 2516,
- amount = 1
- },
- {
- -- Crown shield
- chance = 25,
- item = 2519,
- amount = 1
- },
- {
- -- Crown shield
- chance = 25,
- item = 2519,
- amount = 1
- },
- {
- -- Goo Shell
- chance = 1,
- item = 21706,
- amount = 1
- },
- {
- -- Albino Plate
- chance = 1,
- item = 21692,
- amount = 1
- },
- {
- -- Lavos Armor
- chance = 2,
- item = 8877,
- amount = 1
- },
- {
- -- Ancient Tiara
- chance = 1,
- item = 2139,
- amount = 1
- },
- {
- -- Djinn Blade
- chance = 2,
- item = 2451,
- amount = 1
- },
- {
- -- Twin Axe
- chance = 1,
- item = 2447,
- amount = 1
- },
- {
- -- Bag of Apple Slices
- chance = 10,
- item = 13537,
- amount = 1
- },
- {
- -- Bamboo Leaves
- chance = 10,
- item = 13538,
- amount = 1
- },
- },
- [CURSED_CHESTS_TIER_RARE] = {
- {
- -- Platinum Coins
- chance = 100,
- item = 2152,
- amount = 100
- },
- {
- -- Platinum Coins
- chance = 80,
- item = 2152,
- random = true,
- amount = 100
- },
- {
- -- Platinum Coins
- chance = 60,
- item = 2152,
- random = true,
- amount = 100
- },
- {
- -- crystal coins
- chance = 100,
- item = 2160,
- random = true,
- amount = 15
- },
- {
- -- crystal coins
- chance = 40,
- item = 2160,
- random = true,
- amount = 7
- },
- {
- -- Ultimate Health Potion
- chance = 100,
- item = 8473,
- random = true,
- amount = 100
- },
- {
- -- Ultimate Health Potion
- chance = 100,
- item = 8473,
- random = true,
- amount = 100
- },
- {
- -- Great Mana Potion
- chance = 100,
- item = 7590,
- random = true,
- amount = 100
- },
- {
- -- Great Mana Potion
- chance = 100,
- item = 7590,
- random = true,
- amount = 100
- },
- {
- -- Mana Potion
- chance = 100,
- item = 7620,
- random = true,
- amount = 100
- },
- {
- -- Mana Potion
- chance = 100,
- item = 7620,
- random = true,
- amount = 100
- },
- {
- -- Mana Potion
- chance = 100,
- item = 7620,
- random = true,
- amount = 100
- },
- {
- -- Gold Token
- chance = 100,
- item = 25377,
- amount = 2
- },
- {
- -- Gold Token
- chance = 40,
- item = 25377,
- random = true,
- amount = 2
- },
- {
- -- Cyan Crystal Fragment
- chance = 100,
- item = 18419,
- random = true,
- amount = 35
- },
- {
- -- Green Crystal Fragment
- chance = 100,
- item = 18421,
- random = true,
- amount = 35
- },
- {
- -- Red Crystal Fragment
- chance = 100,
- item = 18420,
- random = true,
- amount = 35
- },
- {
- -- Small Amethyst
- chance = 100,
- item = 2150,
- random = true,
- amount = 50
- },
- {
- -- Small Emerald
- chance = 100,
- item = 2149,
- random = true,
- amount = 50
- },
- {
- -- Small Ruby
- chance = 100,
- item = 2147,
- random = true,
- amount = 50
- },
- {
- -- Small Sapphire
- chance = 100,
- item = 2146,
- random = true,
- amount = 50
- },
- {
- -- Talon
- chance = 60,
- item = 2151,
- random = true,
- amount = 25
- },
- {
- -- Blood herb
- chance = 100,
- item = 2798,
- amount = 2
- },
- {
- -- Blood herbs
- chance = 45,
- item = 2798,
- random = true,
- amount = 2
- },
- {
- -- Vampire Teeth
- chance = 100,
- item = 10602,
- random = true,
- amount = 7
- },
- {
- -- Vampire Teeth
- chance = 50,
- item = 10602,
- random = true,
- amount = 4
- },
- {
- -- Bloody Pincers
- chance = 100,
- item = 10550,
- random = true,
- amount = 4
- },
- {
- -- Bloody Pincers
- chance = 50,
- item = 10550,
- random = true,
- amount = 2
- },
- {
- -- Rope Belt
- chance = 100,
- item = 12448,
- random = true,
- amount = 7
- },
- {
- -- Rope Belt
- chance = 50,
- item = 12448,
- random = true,
- amount = 4
- },
- {
- -- Silencer Claws
- chance = 50,
- item = 22534,
- random = true,
- amount = 7
- },
- {
- -- Silencer Claws
- chance = 50,
- item = 22534,
- random = true,
- amount = 4
- },
- {
- -- Hat of the Mad
- chance = 20,
- item = 2323,
- amount = 1
- },
- {
- -- Warrior Helmet
- chance = 45,
- item = 2475,
- amount = 1
- },
- {
- -- Golden Armor
- chance = 20,
- item = 2466,
- amount = 1
- },
- {
- -- Golden Armor
- chance = 20,
- item = 2466,
- amount = 1
- },
- {
- -- Blue Robe
- chance = 20,
- item = 2656,
- amount = 1
- },
- {
- -- Blue Robe
- chance = 20,
- item = 2656,
- amount = 1
- },
- {
- -- Paladin Armor
- chance = 40,
- item = 8891,
- amount = 1
- },
- {
- -- Paladin Armor
- chance = 40,
- item = 8891,
- amount = 1
- },
- {
- -- Blue legs
- chance = 20,
- item = 7730,
- amount = 1
- },
- {
- -- Crown Legs
- chance = 40,
- item = 2488,
- amount = 1
- },
- {
- -- Crown Legs
- chance = 40,
- item = 2488,
- amount = 1
- },
- {
- -- Medusa shield
- chance = 40,
- item = 2536,
- amount = 1
- },
- {
- -- Medusa shield
- chance = 40,
- item = 2536,
- amount = 1
- },
- {
- -- Vampire shield
- chance = 20,
- item = 2534,
- amount = 1
- },
- {
- -- Vampire shield
- chance = 20,
- item = 2534,
- amount = 1
- },
- {
- -- Demon shield
- chance = 15,
- item = 2520,
- amount = 1
- },
- {
- -- Spellbook of Mind Control
- chance = 50,
- item = 8902,
- amount = 1
- },
- {
- -- Spellbook of Lost souls
- chance = 20,
- item = 8903,
- amount = 1
- },
- {
- -- Blade of corruption
- chance = 15,
- item = 12649,
- amount = 1
- },
- {
- -- Demonrage sword
- chance = 30,
- item = 7382,
- amount = 1
- },
- {
- -- Dragon Lance
- chance = 40,
- item = 2414,
- amount = 1
- },
- {
- -- Demonbone
- chance = 15,
- item = 7431,
- amount = 1
- },
- {
- -- Mythril Axe
- chance = 15,
- item = 7455,
- amount = 1
- },
- {
- -- Earthborn Titan Armor
- chance = 2,
- item = 8882,
- amount = 1
- },
- {
- -- Windborn Colossus Armor
- chance = 2,
- item = 8883,
- amount = 1
- },
- {
- -- Voltage Armor
- chance = 1,
- item = 8879,
- amount = 1
- },
- {
- -- Ceremonial Mask
- chance = 0.75,
- item = 2501,
- amount = 1
- },
- {
- -- Fur Cap
- chance = 1,
- item = 7458,
- amount = 1
- },
- {
- -- Pair of Soft Boots
- chance = 7,
- item = 6132,
- amount = 1
- },
- {
- -- Pharaoh Sword
- chance = 1,
- item = 2446,
- amount = 1
- },
- {
- -- Holy Falcon
- chance = 1,
- item = 3141,
- amount = 1
- },
- {
- -- Slingshot
- chance = 7,
- item = 5907,
- amount = 1
- },
- {
- -- Diapason
- chance = 4,
- item = 13536,
- amount = 1
- },
- {
- -- Golden Fir Cone
- chance = 4,
- item = 13539,
- amount = 1
- }
- },
- [CURSED_CHESTS_TIER_EPIC] = {
- {
- -- crystal coins
- chance = 100,
- item = 2160,
- random = true,
- amount = 25
- },
- {
- -- crystal coins
- chance = 40,
- item = 2160,
- random = true,
- amount = 8
- },
- {
- -- Supreme Health Potion
- chance = 100,
- item = 26031,
- random = true,
- amount = 100
- },
- {
- -- Supreme Health Potion
- chance = 100,
- item = 26031,
- random = true,
- amount = 100
- },
- {
- -- Ultimate Mana Potion
- chance = 100,
- item = 26029,
- random = true,
- amount = 100
- },
- {
- -- Ultimate Mana Potion
- chance = 100,
- item = 26029,
- random = true,
- amount = 100
- },
- {
- -- Ultimate Spirit Potion
- chance = 100,
- item = 26030,
- random = true,
- amount = 100
- },
- {
- -- Ultimate Spirit Potion
- chance = 100,
- item = 26030,
- random = true,
- amount = 100
- },
- {
- -- Gold Token
- chance = 100,
- item = 25377,
- amount = 3
- },
- {
- -- Gold Token
- chance = 40,
- item = 25377,
- random = true,
- amount = 3
- },
- {
- -- Green Crystal Shard
- chance = 100,
- item = 18415,
- random = true,
- amount = 50
- },
- {
- -- Blue Crystal Shard
- chance = 100,
- item = 18413,
- random = true,
- amount = 50
- },
- {
- -- Violet Crystal Fragment
- chance = 100,
- item = 18414,
- random = true,
- amount = 50
- },
- {
- -- Small Amethyst
- chance = 100,
- item = 2150,
- random = true,
- amount = 75
- },
- {
- -- Small Emerald
- chance = 100,
- item = 2149,
- random = true,
- amount = 75
- },
- {
- -- Small Ruby
- chance = 100,
- item = 2147,
- random = true,
- amount = 75
- },
- {
- -- Small Sapphire
- chance = 100,
- item = 2146,
- random = true,
- amount = 75
- },
- {
- -- Talon
- chance = 60,
- item = 2151,
- random = true,
- amount = 35
- },
- {
- -- Blood herb
- chance = 100,
- item = 2798,
- amount = 3
- },
- {
- -- Blood herbs
- chance = 45,
- item = 2798,
- random = true,
- amount = 3
- },
- {
- -- Vampire Teeth
- chance = 100,
- item = 10602,
- random = true,
- amount = 10
- },
- {
- -- Vampire Teeth
- chance = 50,
- item = 10602,
- random = true,
- amount = 6
- },
- {
- -- Bloody Pincers
- chance = 100,
- item = 10550,
- random = true,
- amount = 6
- },
- {
- -- Bloody Pincers
- chance = 50,
- item = 10550,
- random = true,
- amount = 3
- },
- {
- -- Rope Belt
- chance = 100,
- item = 12448,
- random = true,
- amount = 10
- },
- {
- -- Rope Belt
- chance = 50,
- item = 12448,
- random = true,
- amount = 6
- },
- {
- -- Silencer Claws
- chance = 100,
- item = 22534,
- random = true,
- amount = 10
- },
- {
- -- Silencer Claws
- chance = 50,
- item = 22534,
- random = true,
- amount = 6
- },
- {
- -- Protective Charm
- chance = 100,
- item = 12400,
- random = true,
- amount = 8
- },
- {
- -- Protective Charm
- chance = 50,
- item = 12400,
- random = true,
- amount = 5
- },
- {
- -- Sabretoth
- chance = 100,
- item = 11228,
- random = true,
- amount = 10
- },
- {
- -- Sabretoth
- chance = 100,
- item = 11228,
- random = true,
- amount = 6
- },
- {
- -- Crest of the Deep Seas
- chance = 60,
- item = 24261,
- amount = 1
- },
- {
- -- Royal Helmet
- chance = 45,
- item = 2498,
- amount = 1
- },
- {
- -- Royal Helmet
- chance = 20,
- item = 2498,
- amount = 1
- },
- {
- -- Skull Helmet
- chance = 50,
- item = 5741,
- amount = 1
- },
- {
- -- Zaoan Helmet
- chance = 35,
- item = 5741,
- amount = 1
- },
- {
- -- Demon Helmet
- chance = 8,
- item = 2493,
- amount = 1
- },
- {
- -- Magic Plate Armor
- chance = 30,
- item = 2472,
- amount = 1
- },
- {
- -- Magic Plate Armor
- chance = 10,
- item = 2472,
- amount = 1
- },
- {
- -- Golden Armor
- chance = 40,
- item = 2466,
- amount = 1
- },
- {
- -- Golden Armor
- chance = 20,
- item = 2466,
- amount = 1
- },
- {
- -- Paladin Armor
- chance = 60,
- item = 8891,
- amount = 1
- },
- {
- -- Divine Plate
- chance = 30,
- item = 8885,
- amount = 1
- },
- {
- -- Ornate Chestplate
- chance = 5,
- item = 15406,
- amount = 1
- },
- {
- -- Depth Lorica
- chance = 7,
- item = 15407,
- amount = 1
- },
- {
- -- Ornate Legs
- chance = 3,
- item = 15412,
- amount = 1
- },
- {
- -- Golden Legs
- chance = 30,
- item = 2470,
- amount = 1
- },
- {
- -- Golden Legs
- chance = 15,
- item = 2470,
- amount = 1
- },
- {
- -- Crown Legs
- chance = 60,
- item = 2488,
- amount = 1
- },
- {
- -- Steel Boots
- chance = 35,
- item = 2645,
- amount = 1
- },
- {
- -- Steel Boots
- chance = 25,
- item = 2645,
- amount = 1
- },
- {
- -- Ornate Shield
- chance = 10,
- item = 15413,
- amount = 1
- },
- {
- -- Vampire shield
- chance = 80,
- item = 2534,
- amount = 1
- },
- {
- -- Demon shield
- chance = 45,
- item = 2520,
- amount = 1
- },
- {
- -- Demon shield
- chance = 30,
- item = 2520,
- amount = 1
- },
- {
- -- Mastermind Shield
- chance = 20,
- item = 2514,
- amount = 1
- },
- {
- -- Rift Shield
- chance = 20,
- item = 25382,
- amount = 1
- },
- {
- -- Spellbook Dark Mysteries
- chance = 35,
- item = 8918,
- amount = 1
- },
- {
- -- Rift Lance
- chance = 20,
- item = 25383,
- amount = 1
- },
- {
- -- Demonrage sword
- chance = 30,
- item = 7382,
- amount = 1
- },
- {
- -- Shiny Blade
- chance = 7,
- item = 18465,
- amount = 1
- },
- {
- -- Crystalline axe
- chance = 7,
- item = 18451,
- amount = 1
- },
- {
- -- Mycological Mace
- chance = 7,
- item = 18452,
- amount = 1
- },
- {
- -- Tunic
- chance = 1,
- item = 8875,
- amount = 1
- },
- {
- -- Native Armor
- chance = 2,
- item = 2508,
- amount = 1
- },
- {
- -- Elven Mail
- chance = 2,
- item = 2505,
- amount = 1
- },
- {
- -- Swan Feather Cloak
- chance = 2,
- item = 29079,
- amount = 1
- },
- {
- -- Molten Plate
- chance = 1,
- item = 8886,
- amount = 1
- },
- {
- -- Dwarven Helmet
- chance = 3,
- item = 2502,
- amount = 1
- },
- {
- -- Demon Legs
- chance = 5,
- item = 2495,
- amount = 1
- },
- {
- -- Nightmare shield
- chance = 4,
- item = 6391,
- amount = 1
- },
- {
- -- Necromancer Shield
- chance = 4,
- item = 6433,
- amount = 1
- },
- {
- -- Carrot on a Stick
- chance = 4,
- item = 13298,
- amount = 1
- },
- {
- -- Fist on a Stick
- chance = 4,
- item = 13535,
- amount = 1
- },
- {
- -- Reins
- chance = 4,
- item = 13295,
- amount = 1
- }
- },
- [CURSED_CHESTS_TIER_LEGENDARY] = {
- {
- -- crystal coins
- chance = 100,
- item = 2160,
- random = true,
- amount = 50
- },
- {
- -- crystal coins
- chance = 50,
- item = 2160,
- random = true,
- amount = 50
- },
- {
- -- crystal coins
- chance = 30,
- item = 2160,
- random = true,
- amount = 100
- },
- {
- -- Supreme Health Potion
- chance = 100,
- item = 26031,
- amount = 100
- },
- {
- -- Supreme Health Potion
- chance = 100,
- item = 26031,
- amount = 100
- },
- {
- -- Supreme Health Potion
- chance = 100,
- item = 26031,
- amount = 100
- },
- {
- -- Ultimate Mana Potion
- chance = 100,
- item = 26029,
- amount = 100
- },
- {
- -- Ultimate Mana Potion
- chance = 100,
- item = 26029,
- amount = 100
- },
- {
- -- Ultimate Mana Potion
- chance = 100,
- item = 26029,
- amount = 100
- },
- {
- -- Ultimate Spirit Potion
- chance = 100,
- item = 26030,
- amount = 100
- },
- {
- -- Ultimate Spirit Potion
- chance = 100,
- item = 26030,
- amount = 100
- },
- {
- -- Ultimate Spirit Potion
- chance = 100,
- item = 26030,
- amount = 100
- },
- {
- -- Gold Token
- chance = 100,
- item = 25377,
- amount = 5
- },
- {
- -- Gold Token
- chance = 40,
- item = 25377,
- random = true,
- amount = 5
- },
- {
- -- Giant emerald
- chance = 100,
- item = 34698,
- amount = 1
- },
- {
- -- Giant emerald
- chance = 40,
- item = 34698,
- amount = 1
- },
- {
- -- Giant ruby
- chance = 100,
- item = 34697,
- amount = 1
- },
- {
- -- Giant ruby
- chance = 60,
- item = 34697,
- amount = 1
- },
- {
- -- Giant Sapphire
- chance = 100,
- item = 34699,
- amount = 1
- },
- {
- -- Giant Sapphire
- chance = 100,
- item = 34699,
- amount = 1
- },
- {
- -- Small Amethyst
- chance = 100,
- item = 2150,
- random = true,
- amount = 100
- },
- {
- -- Small Emerald
- chance = 100,
- item = 2149,
- random = true,
- amount = 100
- },
- {
- -- Small Ruby
- chance = 100,
- item = 2147,
- random = true,
- amount = 100
- },
- {
- -- Small Sapphire
- chance = 100,
- item = 2146,
- random = true,
- amount = 100
- },
- {
- -- Talon
- chance = 60,
- item = 2151,
- random = true,
- amount = 50
- },
- {
- -- Blood herb
- chance = 100,
- item = 2798,
- amount = 5
- },
- {
- -- Blood herbs
- chance = 45,
- item = 2798,
- random = true,
- amount = 5
- },
- {
- -- Batwing Hat
- chance = 20,
- item = 10016,
- amount = 1
- },
- {
- -- Skull Helmet
- chance = 100,
- item = 5741,
- amount = 1
- },
- {
- -- Skull Helmet
- chance = 75,
- item = 5741,
- amount = 1
- },
- {
- -- Skull Helmet
- chance = 50,
- item = 5741,
- amount = 1
- },
- {
- -- Prismatic Helmet
- chance = 50,
- item = 18403,
- amount = 1
- },
- {
- -- Royal Helmet
- chance = 100,
- item = 2498,
- amount = 1
- },
- {
- -- Royal Helmet
- chance = 80,
- item = 2498,
- amount = 1
- },
- {
- -- Royal Helmet
- chance = 60,
- item = 2498,
- amount = 1
- },
- {
- -- Magic Plate armor
- chance = 100,
- item = 2472,
- amount = 1
- },
- {
- -- Magic Plate armor
- chance = 70,
- item = 2472,
- amount = 1
- },
- {
- -- Magic Plate armor
- chance = 40,
- item = 2472,
- amount = 1
- },
- {
- -- Dragon Scale Mail
- chance = 100,
- item = 2492,
- amount = 1
- },
- {
- -- Dragon Scale Mail
- chance = 80,
- item = 2492,
- amount = 1
- },
- {
- -- Dragon Scale Mail
- chance = 70,
- item = 2492,
- amount = 1
- },
- {
- -- Golden Legs
- chance = 100,
- item = 2470,
- amount = 1
- },
- {
- -- Golden Legs
- chance = 100,
- item = 2470,
- amount = 1
- },
- {
- -- Prismatic Legs
- chance = 25,
- item = 18405,
- amount = 1
- },
- {
- -- Boots of Haste
- chance = 100,
- item = 2195,
- amount = 1
- },
- {
- -- Boots of Haste
- chance = 75,
- item = 2195,
- amount = 1
- },
- {
- -- Boots of Haste
- chance = 60,
- item = 2195,
- amount = 1
- },
- {
- -- Steel Boots
- chance = 100,
- item = 2645,
- amount = 1
- },
- {
- -- Steel Boots
- chance = 50,
- item = 2645,
- amount = 1
- },
- {
- -- Mastermind shield
- chance = 100,
- item = 2514,
- amount = 1
- },
- {
- -- Mastermind shield
- chance = 60,
- item = 2514,
- amount = 1
- },
- {
- -- Heavy Mace
- chance = 60,
- item = 2452,
- amount = 1
- },
- {
- -- Dragon Scale Helmet
- chance = 0.75,
- item = 2506,
- amount = 1
- },
- {
- -- Gnome Helmet
- chance = 3,
- item = 30882,
- amount = 1
- },
- {
- -- Mage's Cap
- chance = 20,
- item = 13756,
- amount = 1
- },
- {
- -- Furious Frock
- chance = 2,
- item = 21725,
- amount = 1
- },
- {
- -- Gnome Armor
- chance = 4,
- item = 30883,
- amount = 1
- },
- {
- -- White Dress
- chance = 0.75,
- item = 2658,
- amount = 1
- },
- {
- -- Whitchhunter's Cloak
- chance = 1,
- item = 8821,
- amount = 1
- },
- {
- -- Gnome Legs
- chance = 4,
- item = 30884,
- amount = 1
- },
- {
- -- Icy Culottes
- chance = 3,
- item = 21700,
- amount = 1
- },
- {
- -- Golden Boots
- chance = 12,
- item = 2646,
- amount = 1
- },
- {
- -- Dragon Scale Boots
- chance = 6,
- item = 11118,
- amount = 1
- },
- {
- -- Crystal Boots
- chance = 6,
- item = 11117,
- amount = 1
- },
- {
- -- Gnome Shield
- chance = 5,
- item = 30885,
- amount = 1
- },
- {
- -- Hunted Mirror Piece
- chance = 4,
- item = 21707,
- amount = 1
- },
- {
- -- Silver Mace
- chance = 3,
- item = 2424,
- amount = 1
- },
- {
- -- Reaper's Axe
- chance = 3,
- item = 7420,
- amount = 1
- },
- {
- -- Great Axe
- chance = 2,
- item = 2415,
- amount = 1
- },
- {
- -- Elemental Spikes
- chance = 8,
- item = 13940,
- amount = 1
- },
- {
- -- Dream Warden Mask
- chance = 20,
- item = 22610,
- amount = 1
- },
- {
- -- Dream Warden Claw
- chance = 20,
- item = 22611,
- amount = 1
- },
- {
- -- Slug Drug
- chance = 7,
- item = 13508,
- amount = 1
- },
- {
- -- Giant Shrimp
- chance = 5,
- item = 13505,
- amount = 1
- },
- {
- -- Melting Horn
- chance = 4,
- item = 22726,
- amount = 1
- },
- {
- -- Sweet Smelling Bait
- chance = 12,
- item = 13307,
- amount = 1
- },
- {
- -- Leather Whip
- chance = 3,
- item = 13293,
- amount = 1
- },
- {
- -- Nail Case
- chance = 4,
- item = 21452,
- amount = 1
- },
- },
- },
- waves = {
- [CURSED_CHESTS_TIER_COMMON] = {
- {
- -- Wave 1
- "Fire Devil",
- "Gozzler",
- "Nightstalker"
- },
- {
- -- Wave 2
- "Fire Devil",
- "Gozzler",
- "Nightstalker"
- },
- {
- -- Wave 3
- "Fire Devil",
- "Gozzler",
- "Nightstalker"
- },
- {
- -- Wave 4
- "Fire Devil",
- "Gozzler",
- "Nightstalker",
- "Necromancer"
- },
- {
- -- Wave 5
- "Fire Devil",
- "Gozzler",
- "Nightstalker",
- "Necromancer"
- }
- },
- [CURSED_CHESTS_TIER_RARE] = {
- {
- -- Wave 1
- "Vampire",
- "Nightstalker"
- },
- {
- -- Wave 2
- "Vampire",
- "Giant Spider",
- "Dragon"
- },
- {
- -- Wave 3
- "Giant Spider",
- "Dragon",
- "Fire Elemental"
- },
- {
- -- Wave 4
- "Dragon",
- "Blistering Fire Elemental",
- "Giant Spider",
- "NIghtmare"
- },
- {
- -- Wave 5
- "Dragon",
- "Blistering Fire Elemental",
- "Giant Spider",
- "NIghtmare",
- "Diabolic Imp"
- }
- },
- [CURSED_CHESTS_TIER_EPIC] = {
- {
- -- Wave 1
- "Dragon",
- "Nightmare Scion",
- "Braindeath"
- },
- {
- -- Wave 2
- "Nightmare Scion",
- "Dragon Lord",
- "Blazing Fire Elemental",
- "Braindeath"
- },
- {
- -- Wave 3
- "Diabolic Imp",
- "Dragon Lord",
- "Behemoth",
- "Hydra"
- },
- {
- -- Wave 4
- "Dragon Lord",
- "Diabolic Imp",
- "Grim Reaper",
- "Hydra",
- "Behemoth"
- },
- {
- -- Wave 5
- "Destroyer",
- "Diabolic Imp",
- "Grim Reaper",
- "Hellspawn",
- "Lich",
- "Behemoth"
- }
- },
- [CURSED_CHESTS_TIER_LEGENDARY] = {
- {
- -- Wave 1
- "Warlock",
- "Dragon Lord",
- "Hydra",
- "Demon"
- },
- {
- -- Wave 2
- "Demon",
- "Thanatursus",
- "Hellfire Fighter",
- "Diabolic Imp",
- "Grimeleech",
- "Vexclaw"
- },
- {
- -- Wave 3
- "Demon",
- "Thanatursus",
- "Grimeleech",
- "Vexclaw",
- "Phantasm",
- "Hellhound",
- "Undead Dragon"
- },
- {
- -- Wave 4
- "Demon",
- "Vexclaw",
- "Phantasm",
- "Hellhound",
- "Hellfire Fighter",
- "Hellflayer",
- "Juggernaut",
- "Hand of Cursed Faith",
- "Undead Dragon"
- },
- {
- -- Wave 5
- "Demon",
- "Vexclaw",
- "Sight of Surrender",
- "Hellhound",
- "Hellfire Fighter",
- "Hellflayer",
- "Juggernaut",
- "Hand of Cursed Faith",
- "Undead Dragon",
- "Grim Reaper",
- "Ripper Spectre"
- }
- }
- },
- boss = {
- name = "Clone Orshabaal",
- fightDuration = 90,
- message = "Boss incoming! You have 90 seconds to kill Clone Orshabaal!"
- }
- }
- }
- CURSED_CHESTS_DATA = {}
- function CursedChestsLoad()
- print(">> Loaded Cursed Chests v" .. CURSED_CHESTS_VERSION)
- ShowEffects()
- end
- function ShowEffects()
- for _, data in ipairs(CURSED_CHESTS_DATA) do
- local tile = Tile(data.pos)
- if tile then
- for _, item in ipairs(tile:getItems()) do
- if item:getId() == data.rarity.item then
- if data.active == 0 and data.finished == false then
- data.pos:sendMagicEffect(CONST_ME_YALAHARIGHOST)
- data.pos:sendAnimatedText(data.rarity.text)
- elseif data.active == 1 and data.wave > 0 then
- data.pos:sendMagicEffect(CONST_ME_YALAHARIGHOST)
- if data.wave <= #data.chest.waves[data.rarity.tier] and not data.bossWave then
- data.pos:sendAnimatedText(
- string.format("Wave %d / %d\nMonsters Alive: %d", data.wave, #data.chest.waves[data.rarity.tier], #data.monsters)
- )
- elseif data.chest.boss ~= nil and data.bossWave == true then
- data.pos:sendAnimatedText(string.format("Boss Fight\n%s", data.chest.boss.name))
- end
- elseif data.finished == true then
- data.pos:sendMagicEffect(CONST_ME_GIFT_WRAPS)
- data.pos:sendAnimatedText("Get your reward!")
- end
- end
- end
- end
- end
- addEvent(ShowEffects, 3000)
- end
- function CursedChestEvent(data)
- data.wave = data.wave + 1
- local from = Position(data.pos.x - 5, data.pos.y - 5, data.pos.z)
- local to = Position(data.pos.x + 5, data.pos.y + 5, data.pos.z)
- if data.wave <= #data.chest.waves[data.rarity.tier] then
- local mobs = CURSED_CHESTS_TIERS[data.rarity.tier].monstersPerWave * data.wave
- for i = 1, mobs do
- local mobName = data.chest.waves[data.rarity.tier][data.wave][math.random(1, #data.chest.waves[data.rarity.tier][data.wave])]
- local spawnPos = Position(math.random(from.x, to.x), math.random(from.y, to.y), data.pos.z)
- local tile = Tile(spawnPos)
- local spawnTest = 0
- while spawnTest < 100 do
- if data.pos == spawnPos or isBadTile(tile) then
- spawnPos = Position(math.random(from.x, to.x), math.random(from.y, to.y), data.pos.z)
- tile = Tile(spawnPos)
- spawnTest = spawnTest + 1
- else
- break
- end
- end
- if spawnTest < 100 then
- local mob = Game.createMonster(mobName, spawnPos, false, true)
- if mob then
- mob:setSkull(CURSED_CHESTS_SKULL_DEFAULT)
- mob:registerEvent("CursedChestsDeath")
- table.insert(data.monsters, mob:getId())
- end
- end
- end
- elseif data.chest.boss ~= nil then
- data.bossWave = true
- local spawnPos = Position(math.random(from.x, to.x), math.random(from.y, to.y), data.pos.z)
- local tile = Tile(spawnPos)
- local spawnTest = 0
- while spawnTest < 100 do
- if data.pos == spawnPos or isBadTile(tile) then
- spawnPos = Position(math.random(from.x, to.x), math.random(from.y, to.y), data.pos.z)
- tile = Tile(spawnPos)
- spawnTest = spawnTest + 1
- else
- break
- end
- end
- if spawnTest < 100 then
- local mob = Game.createMonster(data.chest.boss.name, spawnPos, false, true)
- if mob then
- mob:setSkull(CURSED_CHESTS_SKULL_BOSS)
- mob:registerEvent("CursedChestsDeath")
- table.insert(data.monsters, mob:getId())
- stopEvent(data.event)
- data.event = addEvent(CursedChestBoss, data.chest.boss.fightDuration * 1000, data)
- end
- end
- end
- end
- function CursedChestBoss(data)
- if #data.monsters == 1 then
- local boss = Monster(data.monsters[1])
- if boss then
- boss:remove()
- stopEvent(data.event)
- for i = 1, #CURSED_CHESTS_DATA do
- if CURSED_CHESTS_DATA[i] == data then
- table.remove(CURSED_CHESTS_DATA, i)
- end
- end
- data.container:getPosition():sendMagicEffect(CONST_ME_POFF)
- data.container:remove()
- CURSED_CHESTS_SPAWNS[data.spawnId].spawned = false
- data.pos:sendAnimatedText("Boss fight is over! You failed!")
- end
- end
- end
- function FinishCursedChestEvent(data)
- if
- data.chest.boss ~= nil and data.bossWave == true and #data.monsters == 0 or
- not data.chest.boss and data.wave == #data.chest.waves[data.rarity.tier] and #data.monsters == 0
- then
- stopEvent(data.event)
- data.finished = true
- data.active = 0
- local loot = "Cursed Chest reward: "
- local items = {}
- for i = 1, #data.chest.rewards[data.rarity.tier] do
- if data.container:getEmptySlots() == 0 then
- break
- end
- local reward = data.chest.rewards[data.rarity.tier][i]
- if reward.chance == 100 then
- local amount = reward.random == true and math.random(1, reward.amount) or reward.amount
- local item = Game.createItem(reward.item, amount)
- data.container:addItemEx(item)
- table.insert(items, item)
- elseif math.random(1, 100) <= reward.chance then
- local amount = reward.random == true and math.random(1, reward.amount) or reward.amount
- local item = Game.createItem(reward.item, amount)
- data.container:addItemEx(item)
- table.insert(items, item)
- end
- end
- for i = #items, 1, -1 do
- if items[i]:getCount() > 1 then
- loot = loot .. items[i]:getCount() .. " "
- loot = loot .. items[i]:getPluralName()
- else
- loot = loot .. items[i]:getName()
- end
- if i > 1 then
- loot = loot .. ", "
- end
- end
- loot = loot .. "."
- local specs = Game.getSpectators(data.pos, false, true, 9, 9, 9, 9)
- if #specs > 0 then
- for i = 1, #specs do
- specs[i]:sendTextMessage(MESSAGE_STATUS_WARNING, loot)
- end
- end
- data.checks = 0
- data.event = addEvent(CursedChestCheck, 1000, data)
- end
- end
- function CursedChestCheck(data)
- data.event = addEvent(CursedChestCheck, 1000, data)
- addEvent(CursedChestDelete, 5 * 60 * 1000, data)
- if data.container:getEmptySlots() == data.container:getCapacity() then
- stopEvent(data.event)
- for i = 1, #CURSED_CHESTS_DATA do
- if CURSED_CHESTS_DATA[i] == data then
- table.remove(CURSED_CHESTS_DATA, i)
- end
- end
- data.container:getPosition():sendMagicEffect(CONST_ME_POFF)
- data.container:remove()
- CURSED_CHESTS_SPAWNS[data.spawnId].spawned = false
- end
- end
- function CursedChestDelete(data)
- for i = 1, #CURSED_CHESTS_DATA do
- if CURSED_CHESTS_DATA[i] == data then
- stopEvent(data.event)
- data.container:getPosition():sendMagicEffect(CONST_ME_POFF)
- data.container:remove()
- CURSED_CHESTS_SPAWNS[data.spawnId].spawned = false
- table.remove(CURSED_CHESTS_DATA, i)
- end
- end
- end
- function CursedChests_onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
- for _, data in ipairs(CURSED_CHESTS_DATA) do
- if data.active == 1 then
- for i = 1, #data.monsters do
- if data.monsters[i] == creature:getId() then
- table.remove(data.monsters, i)
- if data.wave < #data.chest.waves[data.rarity.tier] and #data.monsters == 0 then
- addEvent(CursedChestEvent, 1500, data)
- elseif data.chest.boss ~= nil and not data.bossWave and #data.monsters == 0 then
- killer:getPosition():sendAnimatedText(data.chest.boss.message)
- addEvent(CursedChestEvent, 3000, data)
- end
- if data.wave == #data.chest.waves[data.rarity.tier] and #data.monsters == 0 or data.bossWave == true and #data.monsters == 0 then
- FinishCursedChestEvent(data)
- end
- break
- end
- end
- end
- end
- return true
- end
- function onUse(player, item, fromPosition, target, toPosition, isHotkey)
- for _, data in ipairs(CURSED_CHESTS_DATA) do
- if data.pos == item:getPosition() then
- if data.active == 0 and data.finished == false then
- if CURSED_CHESTS_TIERS[data.rarity.tier].reqLevel > player:getLevel() then
- player:sendTextMessage(
- MESSAGE_STATUS_WARNING,
- "Required level to open this chest is " .. CURSED_CHESTS_TIERS[data.rarity.tier].reqLevel
- )
- return false
- else
- player:getPosition():sendAnimatedText(data.chest.message .. "\nKill all monsters to get awesome rewards!")
- if player:getParty() then
- data.solo = false
- else
- data.solo = true
- end
- data.owner = player:getName()
- data.wave = 0
- data.monsters = {}
- data.active = 1
- data.finished = false
- data.container = item
- data.event = addEvent(CursedChestEvent, 2000, data)
- end
- elseif data.finished == true then
- if data.solo and data.owner == player:getName() then
- return false
- elseif not data.solo then
- local party = player:getParty()
- if not party then
- return true
- end
- if data.owner == player:getName() then
- return false
- end
- local members = party:getMembers()
- for i = 1, #members do
- if members[i]:getName() == player:getName() then
- return false
- end
- end
- end
- return true
- end
- return true
- end
- end
- return false
- end
- function isBadTile(tile)
- return (tile == nil or tile:getGround() == nil or tile:hasProperty(TILESTATE_NONE) or tile:hasProperty(TILESTATE_FLOORCHANGE_EAST) or
- isItem(tile:getThing()) and not isMoveable(tile:getThing()) or
- tile:getTopCreature() or
- tile:hasFlag(TILESTATE_PROTECTIONZONE))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement