Use .json files, proper init to use files, move cooldown to seed

pull/37/head
bobloy 7 years ago
parent 59d1c97cb3
commit 280c772209

@ -1,5 +1,9 @@
from redbot.core import data_manager
from .planttycoon import PlantTycoon from .planttycoon import PlantTycoon
def setup(bot): def setup(bot):
bot.add_cog(PlantTycoon(bot)) tycoon = PlantTycoon(bot)
data_manager.load_bundled_data(tycoon, __file__)
bot.add_cog(tycoon)

@ -379,7 +379,7 @@
"rarity": "rare", "rarity": "rare",
"image": "http://i.imgur.com/hoh17hp.jpg", "image": "http://i.imgur.com/hoh17hp.jpg",
"health": 100, "health": 100,
"degradation": 1, "degradation": 1.5,
"threshold": 110, "threshold": 110,
"badge": "Sporadic", "badge": "Sporadic",
"reward": 2400 "reward": 2400
@ -391,7 +391,7 @@
"rarity": "rare", "rarity": "rare",
"image": "http://i.imgur.com/lhSjfQY.jpg", "image": "http://i.imgur.com/lhSjfQY.jpg",
"health": 100, "health": 100,
"degradation": 1, "degradation": 1.5,
"threshold": 110, "threshold": 110,
"badge": "Sporadic", "badge": "Sporadic",
"reward": 2400 "reward": 2400
@ -403,7 +403,7 @@
"rarity": "rare", "rarity": "rare",
"image": "http://i.imgur.com/Dhw9ync.jpg", "image": "http://i.imgur.com/Dhw9ync.jpg",
"health": 100, "health": 100,
"degradation": 1, "degradation": 1.5,
"threshold": 110, "threshold": 110,
"badge": "Sporadic", "badge": "Sporadic",
"reward": 2400 "reward": 2400
@ -415,7 +415,7 @@
"rarity": "rare", "rarity": "rare",
"image": "http://i.imgur.com/h4fJo2R.jpg", "image": "http://i.imgur.com/h4fJo2R.jpg",
"health": 100, "health": 100,
"degradation": 1, "degradation": 1.5,
"threshold": 110, "threshold": 110,
"badge": "Sporadic", "badge": "Sporadic",
"reward": 2400 "reward": 2400
@ -427,7 +427,7 @@
"rarity": "rare", "rarity": "rare",
"image": "http://i.imgur.com/NoSdxXh.jpg", "image": "http://i.imgur.com/NoSdxXh.jpg",
"health": 100, "health": 100,
"degradation": 1, "degradation": 1.5,
"threshold": 110, "threshold": 110,
"badge": "Sporadic", "badge": "Sporadic",
"reward": 2400 "reward": 2400
@ -439,7 +439,7 @@
"rarity": "rare", "rarity": "rare",
"image": "http://i.imgur.com/4ArSekX.jpg", "image": "http://i.imgur.com/4ArSekX.jpg",
"health": 100, "health": 100,
"degradation": 1, "degradation": 1.5,
"threshold": 110, "threshold": 110,
"badge": "Sporadic", "badge": "Sporadic",
"reward": 2400 "reward": 2400
@ -451,43 +451,19 @@
"rarity": "super-rare", "rarity": "super-rare",
"image": "http://i.imgur.com/ASZXr7C.png", "image": "http://i.imgur.com/ASZXr7C.png",
"health": 100, "health": 100,
"degradation": 1, "degradation": 2,
"threshold": 110,
"badge": "Odd-pod",
"reward": 3600
},
{
"name": "tba",
"article": "a",
"time": 9000,
"rarity": "super-rare",
"image": "tba",
"health": 100,
"degradation": 1.5,
"threshold": 110, "threshold": 110,
"badge": "Odd-pod", "badge": "Odd-pod",
"reward": 3600 "reward": 3600
}, },
{ {
"name": "Pirahna Plant", "name": "Piranha Plant",
"article": "a", "article": "a",
"time": 9000, "time": 9000,
"rarity": "super-rare", "rarity": "super-rare",
"image": "http://i.imgur.com/c03i9W7.jpg", "image": "http://i.imgur.com/c03i9W7.jpg",
"health": 100, "health": 100,
"degradation": 1.5, "degradation": 2,
"threshold": 110,
"badge": "Odd-pod",
"reward": 3600
},
{
"name": "tba",
"article": "a",
"time": 9000,
"rarity": "super-rare",
"image": "tba",
"health": 100,
"degradation": 1.5,
"threshold": 110, "threshold": 110,
"badge": "Odd-pod", "badge": "Odd-pod",
"reward": 3600 "reward": 3600
@ -499,19 +475,19 @@
"rarity": "super-rare", "rarity": "super-rare",
"image": "https://i.imgur.com/Vo4v2Ry.png", "image": "https://i.imgur.com/Vo4v2Ry.png",
"health": 100, "health": 100,
"degradation": 1.5, "degradation": 2,
"threshold": 110, "threshold": 110,
"badge": "Odd-pod", "badge": "Odd-pod",
"reward": 3600 "reward": 3600
}, },
{ {
"name": "tba", "name": "Eldergleam Tree",
"article": "a", "article": "a",
"time": 10800, "time": 10800,
"rarity": "epic", "rarity": "epic",
"image": "tba", "image": "https://i.imgur.com/pnZYKZc.jpg",
"health": 100, "health": 100,
"degradation": 2, "degradation": 2.5,
"threshold": 110, "threshold": 110,
"badge": "Greenfingers", "badge": "Greenfingers",
"reward": 5400 "reward": 5400
@ -523,7 +499,7 @@
"rarity": "epic", "rarity": "epic",
"image": "http://i.imgur.com/sizf7hE.png", "image": "http://i.imgur.com/sizf7hE.png",
"health": 100, "health": 100,
"degradation": 2, "degradation": 2.5,
"threshold": 110, "threshold": 110,
"badge": "Greenfingers", "badge": "Greenfingers",
"reward": 5400 "reward": 5400
@ -535,7 +511,7 @@
"rarity": "epic", "rarity": "epic",
"image": "http://i.imgur.com/9f5QzaW.jpg", "image": "http://i.imgur.com/9f5QzaW.jpg",
"health": 100, "health": 100,
"degradation": 2, "degradation": 2.5,
"threshold": 110, "threshold": 110,
"badge": "Greenfingers", "badge": "Greenfingers",
"reward": 5400 "reward": 5400
@ -547,7 +523,7 @@
"rarity": "epic", "rarity": "epic",
"image": "https://i.imgur.com/ExqLLHO.png", "image": "https://i.imgur.com/ExqLLHO.png",
"health": 100, "health": 100,
"degradation": 2, "degradation": 2.5,
"threshold": 110, "threshold": 110,
"badge": "Greenfingers", "badge": "Greenfingers",
"reward": 5400 "reward": 5400
@ -559,7 +535,7 @@
"rarity": "epic", "rarity": "epic",
"image": "https://i.imgur.com/tv2B72j.png", "image": "https://i.imgur.com/tv2B72j.png",
"health": 100, "health": 100,
"degradation": 2, "degradation": 2.5,
"threshold": 110, "threshold": 110,
"badge": "Greenfingers", "badge": "Greenfingers",
"reward": 5400 "reward": 5400
@ -571,7 +547,7 @@
"rarity": "legendary", "rarity": "legendary",
"image": "http://i.imgur.com/MIJQDLL.jpg", "image": "http://i.imgur.com/MIJQDLL.jpg",
"health": 100, "health": 100,
"degradation": 3, "degradation": 8,
"threshold": 110, "threshold": 110,
"badge": "Nobel Peas Prize", "badge": "Nobel Peas Prize",
"reward": 10800 "reward": 10800
@ -583,7 +559,7 @@
"rarity": "legendary", "rarity": "legendary",
"image": "http://i.imgur.com/cFSmaHH.png", "image": "http://i.imgur.com/cFSmaHH.png",
"health": 100, "health": 100,
"degradation": 3, "degradation": 8,
"threshold": 110, "threshold": 110,
"badge": "Nobel Peas Prize", "badge": "Nobel Peas Prize",
"reward": 10800 "reward": 10800
@ -595,7 +571,7 @@
"rarity": "legendary", "rarity": "legendary",
"image": "http://i.imgur.com/Ibwm2xY.jpg", "image": "http://i.imgur.com/Ibwm2xY.jpg",
"health": 100, "health": 100,
"degradation": 3, "degradation": 8,
"threshold": 110, "threshold": 110,
"badge": "Nobel Peas Prize", "badge": "Nobel Peas Prize",
"reward": 10800 "reward": 10800

@ -1,13 +1,15 @@
import asyncio import asyncio
import collections import collections
import datetime import datetime
import json
import time import time
from random import choice from random import choice
from typing import Any
import discord import discord
from redbot.core import commands, Config, bank from redbot.core import commands, Config, bank
from redbot.core.bot import Red from redbot.core.bot import Red
from typing import Any from redbot.core.data_manager import bundled_data_path
Cog: Any = getattr(commands, "Cog", object) Cog: Any = getattr(commands, "Cog", object)
@ -98,739 +100,9 @@ class PlantTycoon(Cog):
self.config.register_user(**default_user) self.config.register_user(**default_user)
self.plants = { self.plants = None
"plants": [
{
"name": "Poppy",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/S4hjyUX.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Dandelion",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/emqnQP2.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Daisy",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/lcFq4AB.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Chrysanthemum",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/5jLtqWL.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Pansy",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/f7TgD1b.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Lavender",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/g3OmOSK.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Lily",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/0hzy7lO.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Petunia",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/rJm8ISv.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Sunflower",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/AzgzQK9.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Daffodil",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/pnCCRsH.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Clover",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/jNTgirw.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Tulip",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/kodIFjE.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Rose",
"article": "a",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/sdTNiOH.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Aster",
"article": "an",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/1tN04Hl.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Aloe Vera",
"article": "an",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/WFAYIpx.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Orchid",
"article": "an",
"time": 3600,
"rarity": "common",
"image": "http://i.imgur.com/IQrQYDC.jpg",
"health": 100,
"degradation": 0.625,
"threshold": 110,
"badge": "Flower Power",
"reward": 600,
},
{
"name": "Dragon Fruit Plant",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/pfngpDS.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Mango Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/ybR78Oc.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Lychee Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/w9LkfhX.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Durian Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/jh249fz.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Fig Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/YkhnpEV.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Jack Fruit Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/2D79TlA.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Prickly Pear Plant",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/GrcGAGj.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Pineapple Plant",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/VopYQtr.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Citron Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/zh7Dr23.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Cherimoya Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/H62gQK6.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Mangosteen Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/McNnMqa.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Guava Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/iy8WgPt.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Orange Tree",
"article": "an",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/lwjEJTm.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Apple Tree",
"article": "an",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/QI3UTR3.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Sapodilla Tree",
"article": "a",
"time": 5400,
"rarity": "uncommon",
"image": "http://i.imgur.com/6BvO5Fu.jpg",
"health": 100,
"degradation": 0.75,
"threshold": 110,
"badge": "Fruit Brute",
"reward": 1200,
},
{
"name": "Franklin Tree",
"article": "a",
"time": 7200,
"rarity": "rare",
"image": "http://i.imgur.com/hoh17hp.jpg",
"health": 100,
"degradation": 1.5,
"threshold": 110,
"badge": "Sporadic",
"reward": 2400,
},
{
"name": "Parrot's Beak",
"article": "a",
"time": 7200,
"rarity": "rare",
"image": "http://i.imgur.com/lhSjfQY.jpg",
"health": 100,
"degradation": 1.5,
"threshold": 110,
"badge": "Sporadic",
"reward": 2400,
},
{
"name": "Koki'o",
"article": "a",
"time": 7200,
"rarity": "rare",
"image": "http://i.imgur.com/Dhw9ync.jpg",
"health": 100,
"degradation": 1.5,
"threshold": 110,
"badge": "Sporadic",
"reward": 2400,
},
{
"name": "Jade Vine",
"article": "a",
"time": 7200,
"rarity": "rare",
"image": "http://i.imgur.com/h4fJo2R.jpg",
"health": 100,
"degradation": 1.5,
"threshold": 110,
"badge": "Sporadic",
"reward": 2400,
},
{
"name": "Venus Fly Trap",
"article": "a",
"time": 7200,
"rarity": "rare",
"image": "http://i.imgur.com/NoSdxXh.jpg",
"health": 100,
"degradation": 1.5,
"threshold": 110,
"badge": "Sporadic",
"reward": 2400,
},
{
"name": "Chocolate Cosmos",
"article": "a",
"time": 7200,
"rarity": "rare",
"image": "http://i.imgur.com/4ArSekX.jpg",
"health": 100,
"degradation": 1.5,
"threshold": 110,
"badge": "Sporadic",
"reward": 2400,
},
{
"name": "Pizza Plant",
"article": "a",
"time": 9000,
"rarity": "super-rare",
"image": "http://i.imgur.com/ASZXr7C.png",
"health": 100,
"degradation": 2,
"threshold": 110,
"badge": "Odd-pod",
"reward": 3600,
},
# {
# "name": "tba",
# "article": "a",
# "time": 9000,
# "rarity": "super-rare",
# "image": "tba",
# "health": 100,
# "degradation": 1.5,
# "threshold": 110,
# "badge": "Odd-pod",
# "reward": 3600
# },
{
"name": "Piranha Plant",
"article": "a",
"time": 9000,
"rarity": "super-rare",
"image": "http://i.imgur.com/c03i9W7.jpg",
"health": 100,
"degradation": 2,
"threshold": 110,
"badge": "Odd-pod",
"reward": 3600,
},
# {
# "name": "tba",
# "article": "a",
# "time": 9000,
# "rarity": "super-rare",
# "image": "tba",
# "health": 100,
# "degradation": 1.5,
# "threshold": 110,
# "badge": "Odd-pod",
# "reward": 3600
# },
{
"name": "Peashooter",
"article": "a",
"time": 9000,
"rarity": "super-rare",
"image": "https://i.imgur.com/Vo4v2Ry.png",
"health": 100,
"degradation": 2,
"threshold": 110,
"badge": "Odd-pod",
"reward": 3600,
},
{
"name": "Eldergleam Tree",
"article": "a",
"time": 10800,
"rarity": "epic",
"image": "https://i.imgur.com/pnZYKZc.jpg",
"health": 100,
"degradation": 2.5,
"threshold": 110,
"badge": "Greenfingers",
"reward": 5400,
},
{
"name": "Pikmin",
"article": "a",
"time": 10800,
"rarity": "epic",
"image": "http://i.imgur.com/sizf7hE.png",
"health": 100,
"degradation": 2.5,
"threshold": 110,
"badge": "Greenfingers",
"reward": 5400,
},
{
"name": "Flora Colossus",
"article": "a",
"time": 10800,
"rarity": "epic",
"image": "http://i.imgur.com/9f5QzaW.jpg",
"health": 100,
"degradation": 2.5,
"threshold": 110,
"badge": "Greenfingers",
"reward": 5400,
},
{
"name": "Plantera Bulb",
"article": "a",
"time": 10800,
"rarity": "epic",
"image": "https://i.imgur.com/ExqLLHO.png",
"health": 100,
"degradation": 2.5,
"threshold": 110,
"badge": "Greenfingers",
"reward": 5400,
},
{
"name": "Chorus Tree",
"article": "an",
"time": 10800,
"rarity": "epic",
"image": "https://i.imgur.com/tv2B72j.png",
"health": 100,
"degradation": 2.5,
"threshold": 110,
"badge": "Greenfingers",
"reward": 5400,
},
{
"name": "Money Tree",
"article": "a",
"time": 35400,
"rarity": "legendary",
"image": "http://i.imgur.com/MIJQDLL.jpg",
"health": 100,
"degradation": 8,
"threshold": 110,
"badge": "Nobel Peas Prize",
"reward": 10800,
},
{
"name": "Truffula Tree",
"article": "a",
"time": 35400,
"rarity": "legendary",
"image": "http://i.imgur.com/cFSmaHH.png",
"health": 100,
"degradation": 8,
"threshold": 110,
"badge": "Nobel Peas Prize",
"reward": 10800,
},
{
"name": "Whomping Willow",
"article": "a",
"time": 35400,
"rarity": "legendary",
"image": "http://i.imgur.com/Ibwm2xY.jpg",
"health": 100,
"degradation": 8,
"threshold": 110,
"badge": "Nobel Peas Prize",
"reward": 10800,
},
],
"event": {
"January": {
"name": "Tanabata Tree",
"article": "a",
"time": 70800,
"rarity": "event",
"image": "http://i.imgur.com/FD38JJj.jpg",
"health": 100,
"degradation": 9,
"threshold": 110,
"badge": "Annualsary",
"reward": 21600,
},
"February": {
"name": "Chocolate Rose",
"article": "a",
"time": 70800,
"rarity": "event",
"image": "http://i.imgur.com/Sqg6pcG.jpg",
"health": 100,
"degradation": 9,
"threshold": 110,
"badge": "Annualsary",
"reward": 21600,
},
"March": {
"name": "Shamrock",
"article": "a",
"time": 70800,
"rarity": "event",
"image": "http://i.imgur.com/kVig04M.jpg",
"health": 100,
"degradation": 9,
"threshold": 110,
"badge": "Annualsary",
"reward": 21600,
},
"April": {
"name": "Easter Egg Eggplant",
"article": "an",
"time": 70800,
"rarity": "event",
"image": "http://i.imgur.com/5jltGQa.jpg",
"health": 100,
"degradation": 9,
"threshold": 110,
"badge": "Annualsary",
"reward": 21600,
},
"October": {
"name": "Jack O' Lantern",
"article": "a",
"time": 70800,
"rarity": "event",
"image": "http://i.imgur.com/efApsxG.jpg",
"health": 100,
"degradation": 9,
"threshold": 110,
"badge": "Annualsary",
"reward": 21600,
},
"November": {
"name": "Mayflower",
"article": "a",
"time": 70800,
"rarity": "event",
"image": "http://i.imgur.com/nntNtoL.jpg",
"health": 100,
"degradation": 9,
"threshold": 110,
"badge": "Annualsary",
"reward": 21600,
},
"December": {
"name": "Holly",
"article": "a",
"time": 70800,
"rarity": "event",
"image": "http://i.imgur.com/maDLmJC.jpg",
"health": 100,
"degradation": 9,
"threshold": 110,
"badge": "Annualsary",
"reward": 21600,
},
},
}
self.products = { self.products = None
"water": {
"cost": 5,
"health": 10,
"damage": 45,
"modifier": 0,
"category": "water",
"uses": 1,
},
"manure": {
"cost": 20,
"health": 20,
"damage": 55,
"modifier": -0.035,
"category": "fertilizer",
"uses": 1,
},
"vermicompost": {
"cost": 35,
"health": 30,
"damage": 60,
"modifier": -0.5,
"category": "fertilizer",
"uses": 1,
},
"nitrates": {
"cost": 70,
"health": 60,
"damage": 75,
"modifier": -0.08,
"category": "fertilizer",
"uses": 1,
},
"pruner": {
"cost": 500,
"health": 40,
"damage": 90,
"modifier": -0.065,
"category": "tool",
"uses": 10,
},
}
self.defaults = { self.defaults = {
"points": { "points": {
@ -881,6 +153,15 @@ class PlantTycoon(Cog):
# self.bank = bot.get_cog('Economy').bank # self.bank = bot.get_cog('Economy').bank
async def _load_plants_products(self):
plant_path = bundled_data_path(self) / "plants.json"
product_path = bundled_data_path(self) / "products.json"
with plant_path.open() as json_data:
self.plants = json.load(json_data)
with product_path.open() as json_data:
self.products = json.load(json_data)
async def _gardener(self, user: discord.User) -> Gardener: async def _gardener(self, user: discord.User) -> Gardener:
# #
@ -896,6 +177,8 @@ class PlantTycoon(Cog):
# #
# Calculating the rate of degradation per check_completion() cycle. # Calculating the rate of degradation per check_completion() cycle.
# #
if self.products is None:
await self._load_plants_products()
modifiers = sum( modifiers = sum(
[ [
@ -938,7 +221,8 @@ class PlantTycoon(Cog):
# #
# The function to add health # The function to add health
# #
if self.products is None:
await self._load_plants_products()
product = product.lower() product = product.lower()
product_category = product_category.lower() product_category = product_category.lower()
if product in self.products and self.products[product]["category"] == product_category: if product in self.products and self.products[product]["category"] == product_category:
@ -1020,9 +304,12 @@ class PlantTycoon(Cog):
) )
await ctx.send(embed=em) await ctx.send(embed=em)
@commands.cooldown(1, 60 * 10, commands.BucketType.user)
@_gardening.command(name="seed") @_gardening.command(name="seed")
async def _seed(self, ctx: commands.Context): async def _seed(self, ctx: commands.Context):
"""Plant a seed inside the earth.""" """Plant a seed inside the earth."""
if self.plants is None:
await self._load_plants_products()
author = ctx.author author = ctx.author
# server = context.message.server # server = context.message.server
# if author.id not in self.gardeners: # if author.id not in self.gardeners:
@ -1157,6 +444,8 @@ class PlantTycoon(Cog):
@_gardening.command(name="plants") @_gardening.command(name="plants")
async def _plants(self, ctx): async def _plants(self, ctx):
"""Look at the list of the available plants.""" """Look at the list of the available plants."""
if self.plants is None:
await self._load_plants_products()
tick = "" tick = ""
tock = "" tock = ""
tick_tock = 0 tick_tock = 0
@ -1173,15 +462,18 @@ class PlantTycoon(Cog):
await ctx.send(embed=em) await ctx.send(embed=em)
@_gardening.command(name="plant") @_gardening.command(name="plant")
async def _plant(self, ctx: commands.Context, *plant): async def _plant(self, ctx: commands.Context, *, plantname):
"""Look at the details of a plant.""" """Look at the details of a plant."""
plant = " ".join(plant) if self.plants is None:
await self._load_plants_products()
t = False t = False
plant = None
for p in self.plants["plants"]: for p in self.plants["plants"]:
if p["name"].lower() == plant.lower(): if p["name"].lower() == plantname.lower():
plant = p plant = p
t = True t = True
break break
if t: if t:
em = discord.Embed( em = discord.Embed(
title="Plant statistics of {}".format(plant["name"]), color=discord.Color.green() title="Plant statistics of {}".format(plant["name"]), color=discord.Color.green()
@ -1231,6 +523,9 @@ class PlantTycoon(Cog):
@_gardening.command(name="buy") @_gardening.command(name="buy")
async def _buy(self, ctx, product=None, amount: int = 1): async def _buy(self, ctx, product=None, amount: int = 1):
"""Buy gardening supplies.""" """Buy gardening supplies."""
if self.products is None:
await self._load_plants_products()
author = ctx.author author = ctx.author
if product is None: if product is None:
em = discord.Embed( em = discord.Embed(
@ -1297,7 +592,6 @@ class PlantTycoon(Cog):
em = discord.Embed(description=message, color=discord.Color.green()) em = discord.Embed(description=message, color=discord.Color.green())
await ctx.send(embed=em) await ctx.send(embed=em)
@commands.cooldown(1, 60 * 10, commands.BucketType.user)
@commands.command(name="shovel") @commands.command(name="shovel")
async def _shovel(self, ctx: commands.Context): async def _shovel(self, ctx: commands.Context):
"""Shovel your plant out.""" """Shovel your plant out."""

Loading…
Cancel
Save