1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
import configparser
import pymysql
from discord.ext import commands
import discord
import importlib
import utils
from cogs.adv_inc import PlayerStats
from cogs.adv_inc import PlayerCreate
from cogs.adv_inc import LevelUp
from cogs.adv_inc import Resting
from cogs.adv_inc import Combat
importlib.reload(utils)
importlib.reload(PlayerStats)
importlib.reload(PlayerCreate)
importlib.reload(LevelUp)
importlib.reload(Resting)
importlib.reload(Combat)
class AdventurersInc(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def a(self, ctx, *arg):
if "adventurers-inc" in str(ctx.channel):
# Variables
str_input_group = ctx.message.content.split(" ")
try:
str_cmd1 = ctx.message.content.split(" ")[1]
except:
str_cmd1 = ""
try:
str_cmd2 = ctx.message.content.split(" ")[2]
except:
str_cmd2 = ""
# config = configparser.ConfigParser()
# config.read(r'config.ini')
# pgloader mysql://adventure:egg@lexicade.uk:3306/AdventurersInc postgresql://Lexicade:LetMeIn123@localhost:5432/AdventurersInc
# str_player_state = "debug"
# params = {'LiveDB': 'AdventurersInc',
# 'LiveVersion': '1.0',
# 'GameVersion': '1.3.1',
# 'Nick': ctx.author.id,
# "db": '5.135.189.226',
# 'dbuser': 'adventure',
# 'dbpass': 'egg',
# 'cmd1': str_cmd1,
# 'cmd2': str_cmd2,
# 'msg': ctx.message.content[3:]}
params = {'game_version': '1.4',
'nick': ctx.author.id,
'ctx': ctx,
'cmd1': str_cmd1,
'cmd2': str_cmd2,
'msg': ctx.message.content[3:]}
player_stats = await PlayerStats.refresh_stats(params)
# print(player_stats)
str_output = 'Oh hi there... \\_(:o」∠)\\_'
# Global Commands
if str_cmd1 == "git":
str_output = "Adventurers Inc - git: http://www.blatech.co.uk/JasonFS/Artifact-v2"
elif str_cmd1 == "version":
str_output = "Adventurers Inc - alpha 0.1"
else:
# Actions based on player state
if player_stats is None:
print("OH GOD NO")
str_output = await PlayerCreate.pick_character_clan(params)
elif player_stats["player_state"] == "creation_name":
str_output = await PlayerCreate.pick_character_name(params, player_stats)
elif player_stats["player_state"] == "creation_race":
str_output = await PlayerCreate.pick_character_race(params, player_stats)
elif player_stats["player_state"] == "rest" and player_stats['attribute_points'] > 0:
str_output = await LevelUp.level_up_attributes(params)
elif player_stats["player_state"] == "rest" and player_stats['attribute_points'] == 0:
str_output = await Resting.player_resting(params, player_stats)
elif player_stats["player_state"] == "combat":
str_output = await Combat.player_in_combat(params)
if str_output is not None:
if type(str_output) == str or type(str_output) == dict:
await ctx.send(content=f"{ctx.author.mention}: {str_output}")
else:
await ctx.send(content=f"{ctx.author.mention}", embed=str_output)
else:
await ctx.send(content=f"Wrong channel {ctx.channel}")
def setup(bot):
print("INFO: Loading [Adventurers Inc]... ", end="")
bot.add_cog(AdventurersInc(bot))
print("Done!")
def teardown(bot):
print("INFO: Unloading [Adventurers Inc]")
|