Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- from datetime import datetime
- from copy import deepcopy
- from asyncio.tasks import all_tasks
- import emojis
- import asyncio
- import discord
- import math
- from discord.ext import commands, tasks
- from dateutil.relativedelta import relativedelta
- import mysql.connector
- import json
- import cogs._json
- import utils.json_loader
- import utils.mysql_help as conn
- import path
- import discord.utils
- import random
- #async def addExp(self, ctx, member=None ,value=None):
- game_board_url = "http://tinypix.top/images/2021/05/05/fVNtI.png"
- async def getLocation(self, ctx, location_id, game_id, players):
- #---------------------------------------------------------------
- # Find Location, linked locations and Location Instance
- #---------------------------------------------------------------
- #Find Location
- sql = "SELECT * FROM arkopoly_locs WHERE id = %s" % (location_id)
- check= await conn.query(sql)
- check = check[0]
- #Find linked locations
- sql = "SELECT id FROM arkopoly_locs WHERE loc_type = %s" % (check[2])
- linked_check= await conn.query(sql)
- linked_check = linked_check[0]
- #Find location instance
- sql = "SELECT * FROM arkopoly_loc_instance WHERE game_id = %s AND loc_id = %s" % (game_id, location_id)
- instance_check= await conn.query(sql)
- instance_check = instance_check[0]
- owner = players[instance_check[3]-1]
- hotel = "Yes" if instance_check[5] > 0 else "No"
- mortgage = "Yes" if instance_check[6] > 0 else "No"
- #print("Linked locations",linked_check)
- location = {
- "id": check[0],
- "name": check[1],
- "type": check[2],
- "price": check[3],
- "mortgage": check[4],
- "rent": check[5],
- "1house": check[6],
- "2house": check[7],
- "3house": check[8],
- "4house": check[9],
- "hotel": check[10],
- "baseCost": check[11],
- "boardImg": check[12],
- "cardImg": check[13],
- "linked": linked_check,
- "owner": owner,
- "numHouses": instance_check[4],
- "hotel": hotel,
- "mortgaged": mortgage
- }
- #print("return: ",location)
- return(location)
- class opoly(commands.Cog):
- def __init__(self, bot):
- self.bot = bot
- @commands.Cog.listener()
- async def on_ready(self):
- print(f"{self.__class__.__name__} Cog has been loaded\n-----")
- """
- Create a Arkopoly game. Command takes 3 members (plus owner)
- """
- @commands.command(
- name='ArkopolyCreateGame',
- aliases=['acg'],
- description="Create a game of Arkopoly",
- )
- @commands.has_role("Game Player")
- @commands.has_permissions(send_messages=True)
- async def createArkopolyGame(self, ctx, user1: discord.Member, user2: discord.Member, user3: discord.Member):
- now = datetime.now()
- formatted_date = now.strftime('%Y-%m-%d %H:%M:%S')
- #Get guild and game players from command
- guild_id = ctx.guild.id
- p1_id = ctx.author.id
- p2_id = user1.id
- p3_id = user2.id
- p4_id = user3.id
- #print(user)
- #print(user2)
- #print(user3)
- players = [ctx.author,user1, user2, user3]
- print("names: ",ctx.author.display_name, ", ",user1.display_name,", ",user2.display_name,", ",user3.display_name)
- #check game owner is not running more than 1 game
- sql = "SELECT id FROM arkopoly_games WHERE player1 = '%s' and guild_id = %s and STATUS = %s" % (p1_id, guild_id, "started")
- check= await conn.query(sql)
- print(check)
- #check = int(check[0][0])
- #print(len(check))
- sql = "SELECT chips FROM Users WHERE discord_id = '%s' and guild_id = %s" % (p1_id, guild_id)
- chips_check= await conn.query(sql)
- chips_check = chips_check[0][0]
- print(chips_check)
- if check is not None:
- embed = discord.Embed(
- title=f"You have exceeded the maximum number of LIVE games",
- )
- embed.set_thumbnail(url=self.bot.user.avatar_url)
- await ctx.send(embed=embed)
- elif chips_check<10:
- embed = discord.Embed(
- title=f"You need some chips to start a game!",
- )
- embed.set_thumbnail(url=self.bot.user.avatar_url)
- await ctx.send(embed=embed)
- else:
- new_value = chips_check-1
- sql = "UPDATE Users SET chips = %s WHERE discord_id = %s AND guild_id = %s"
- val = (new_value, formatted_date, ctx.author.id, guild_id)
- await conn.upsert(sql,val)
- sql = "SELECT * FROM arkopoly_games WHERE guild_id = %s" % (guild_id)
- gamecheck= await conn.query(sql)
- Game_name = ctx.author.display_name + "s Arkopoly Game"
- category_name = 'Games Manager'
- if len(gamecheck) == 0:
- category_role = discord.utils.get(ctx.guild.roles, name="Game Player")
- overwrites = {
- ctx.guild.default_role: discord.PermissionOverwrite(read_messages=False),
- ctx.guild.me: discord.PermissionOverwrite(read_messages=True),
- category_role: discord.PermissionOverwrite(read_messages=True),
- }
- category = await ctx.guild.create_category(name=category_name, overwrites=overwrites)
- category = discord.utils.get(ctx.guild.categories, name='Games Manager')
- game_role = Game_name
- the_role = await ctx.guild.create_role(name=game_role)
- for i in players:
- user = i
- await user.add_roles(the_role)
- overwrites = {
- ctx.guild.default_role: discord.PermissionOverwrite(read_messages=False),
- ctx.guild.me: discord.PermissionOverwrite(read_messages=True),
- the_role: discord.PermissionOverwrite(read_messages=True),
- }
- channel = await ctx.guild.create_text_channel(
- name=Game_name,
- overwrites=overwrites,
- category=self.bot.get_channel(category.id),
- )
- print("channel id: ",channel.id)
- turn = random.randint(1, 4)
- cash = 15000
- sql = "INSERT INTO arkopoly_games (guild_id, game_name, channel_id, player1, player2, player3, player4, turn, date_started, turn_datetime, credits_p1, credits_p2, credits_p3, credits_p4, pos_p1, pos_p2, pos_p3, pos_p4, STATUS) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
- val = (guild_id, Game_name, channel.id, p1_id, p2_id, p3_id, p4_id, turn, formatted_date, formatted_date, cash, cash, cash, cash, 1, 1, 1, 1, "started")
- await conn.upsert(sql,val)
- sql = "SELECT id FROM arkopoly_games WHERE player1 = '%s' and guild_id = %s and STATUS = '%s'" % (p1_id, guild_id, "started")
- newgamecheck= await conn.query(sql)
- print("new game id: ",newgamecheck)
- game_id = newgamecheck[0][0]
- counter = 1
- loc_id = 1
- while counter < 41:
- sql = "INSERT INTO arkopoly_loc_instance (game_id, loc_id, loc_owner, loc_houses, loc_hotels, loc_mortgaged) VALUES (%s, %s, %s, %s, %s, %s)"
- val = (game_id, loc_id, 0, 0, 0, 0)
- await conn.upsert(sql,val)
- loc_id += 1
- counter += 1
- embed = discord.Embed(
- title=f"**{Game_name}** has started",
- )
- embed.set_thumbnail(url=self.bot.user.avatar_url)
- await ctx.send(embed=embed)
- embed = discord.Embed(
- title=f"Welcome to **{Game_name}**",
- description=f"Game Owner:\n{ctx.author.mention}\n\nOther Players:\n{user1.mention}\n{user2.mention}\n{user3.mention}",
- )
- embed.set_thumbnail(url=self.bot.user.avatar_url)
- await channel.send(embed=embed)
- @commands.command(
- name='ArkopolyEndGame',
- aliases=['aeg'],
- description="End a game of Arkopoly",
- )
- @commands.has_role("Game Player")
- @commands.has_permissions(send_messages=True)
- async def endArkopolyGame(self, ctx):
- channel = ctx.channel
- if str(ctx.channel.category) != "Games Manager":
- embed = discord.Embed(
- title=f"You can only run this command from your game channel!",
- )
- embed.set_thumbnail(url=self.bot.user.avatar_url)
- await channel.send(embed=embed)
- return
- guild_id = ctx.guild.id
- now = datetime.now()
- p1_id = ctx.author.id
- sql = "SELECT * FROM arkopoly_games WHERE player1 = '%s' and guild_id = %s and STATUS = 'started'" % (p1_id, guild_id)
- check= await conn.query(sql)
- #channel_name = ctx.channel.name
- #print (channel)
- print(check)
- if len(check) == 0:
- await channel.send("You do not own any games. Only the game owner can end a game.")
- else:
- check = check[0]
- game_id = check[0]
- game_name = check[2]
- print("Game ID: ", game_id)
- player1 = check[4]
- player2 = check[5]
- player3 = check[6]
- player4 = check[7]
- players = [player1, player2, player3, player4]
- embed = discord.Embed(
- title=f"End Game Confirmation",
- description =f"**Are you sure you want to end {game_name}**",
- )
- m = await channel.send(embed=embed)
- await m.add_reaction("✅")
- await m.add_reaction("🇽")
- try:
- reaction, member = await self.bot.wait_for(
- "reaction_add",
- timeout=60,
- check=lambda reaction, user: user.id == ctx.author.id
- and reaction.message.channel == ctx.channel
- )
- except asyncio.TimeoutError:
- await channel.send("Confirmation Failure. Please try again.")
- return
- if str(reaction.emoji) not in ["✅", "🇽"] or str(reaction.emoji) == "🇽":
- await channel.send("Cancelling attempt to end the game!")
- return
- else:
- print("Confirmation accepted")
- sql = """UPDATE arkopoly_games SET STATUS = %s WHERE id = %s"""
- val = ('ended',game_id)
- await conn.upsert(sql,val)
- print("players: ",players)
- for i in players:
- print("user id: ",i)
- user = ctx.guild.get_member(i)
- print("user to dm: ",user)
- channel = await user.create_dm()
- embed = discord.Embed(
- title=f"End Game Confirmation",
- description =f"**{ctx.author.display_name}** has ended {game_name}",
- )
- m = await channel.send(embed=embed)
- print(ctx.guild.roles)
- #find role object
- role_object = discord.utils.get(ctx.guild.roles, name=game_name)
- print(role_object)
- #delete role
- await role_object.delete()
- #DELETE the channel
- await ctx.channel.delete()
- @commands.command(
- name='ArkopolyMyTurn',
- aliases=['myturnark'],
- description="End a game of Arkopoly",
- )
- @commands.has_role("Game Player")
- @commands.has_permissions(send_messages=True)
- async def ArkopolyMyTurn(self, ctx):
- """
- Process:
- Step 1 options
- 1- properties owned
- 2- buy houses
- - property to build at
- - quantity
- - pay confirmation
- 3- trade
- - property to trade
- - user to trade with
- - credits or property
- - trade confirmation
- 4- mortgage property
- - property to mortgage
- - mortgage confirmation
- 5- roll dice
- 6- buy property
- - buy confirmation
- 7- end turn
- - end turn confirmation
- """
- guild_id = ctx.guild.id
- channel_id = ctx.channel.id
- print("channel id: ",channel_id)
- channel = ctx.channel
- #CATEGORY CHECK
- if str(ctx.channel.category) != "Games Manager":
- embed = discord.Embed(
- title=f"You can only run this command from your game channel!",
- )
- embed.set_thumbnail(url=self.bot.user.avatar_url)
- await channel.send(embed=embed)
- return
- #FIND GAME
- sql = "SELECT * FROM arkopoly_games WHERE channel_id = '%s' and guild_id = %s and STATUS = 'started'" % (ctx.channel.id, guild_id)
- check= await conn.query(sql)
- print("Game Check: ",check)
- #-----------------------------------
- # SET GAME VARIABLES
- #-----------------------------------
- game_info = check[0]
- game_id = game_info[0]
- game_guild_id = game_info[1]
- game_name = game_info[2]
- game_channel_id = game_info[3]
- player1 = ctx.guild.get_member(game_info[4])
- player2 = ctx.guild.get_member(game_info[5])
- player3 = ctx.guild.get_member(game_info[6])
- player4 = ctx.guild.get_member(game_info[7])
- game_turn = game_info[8]-1
- game_startDate = game_info[9]
- game_last_turn_date = game_info[10]
- p1_cash = game_info[11]
- p2_cash = game_info[12]
- p3_cash = game_info[13]
- p4_cash = game_info[14]
- p1_pos = game_info[15]
- p2_pos = game_info[16]
- p3_pos = game_info[17]
- p4_pos = game_info[18]
- players_cash = [p1_cash, p2_cash, p3_cash, p4_cash]
- players = [player1, player2, player3, player4]
- all_players_pos = [p1_pos, p2_pos, p3_pos, p4_pos]
- #----------------------------
- # who is still in game?
- #----------------------------
- still_in_players = []
- still_in_players_cash = []
- still_in_player_pos = []
- for i in players:
- the_list_index = players.index(i)
- if players_cash[the_list_index] > 0:
- still_in_players.append(i)
- still_in_player_pos.append(all_players_pos[the_list_index])
- still_in_players_cash.append(players_cash[the_list_index])
- print("Starting players: ",players)
- print("Starting Cash: ",players_cash)
- print("Starting position: ",all_players_pos)
- print("Still in players: ",still_in_players)
- print("Still in cash: ",still_in_players_cash)
- print("Still in positions: ",still_in_player_pos)
- print("Game Turn: ",game_turn)
- game_status = game_info[19]
- player_turn = still_in_players[game_turn]
- print("Player turn: ",player_turn)
- player_cash_turn = still_in_players_cash[game_turn]
- player_pos_turn = still_in_player_pos[game_turn]
- #player_turn_index = players
- #--------------------------------------------------------
- # FIND WHERE THE PLAYERS ARE ON THE BOARD
- #--------------------------------------------------------
- sql = "SELECT * FROM arkopoly_locs"
- player_pos_info= await conn.query(sql)
- #player_pos_info = player_pos_info[0]
- p1_pos_id = player_pos_info[p1_pos-1][0]
- p1_pos_name = player_pos_info[p1_pos-1][1]
- p1_pos_type = player_pos_info[p1_pos-1][2]
- p2_pos_id = player_pos_info[p2_pos-1][0]
- p2_pos_name = player_pos_info[p2_pos-1][1]
- p2_pos_type = player_pos_info[p2_pos-1][2]
- p3_pos_id = player_pos_info[p3_pos-1][0]
- p3_pos_name = player_pos_info[p3_pos-1][1]
- p3_pos_type = player_pos_info[p3_pos-1][2]
- p4_pos_id = player_pos_info[p4_pos-1][0]
- p4_pos_name = player_pos_info[p4_pos-1][1]
- p4_pos_type = player_pos_info[p4_pos-1][2]
- #------------------------------------------------------
- # CHECK PLAYER IS ABLE TO RUN MYTURNARK COMMAND
- #------------------------------------------------------
- if ctx.author not in still_in_players:
- embed = discord.Embed(
- title=f"You are no longer in this game!",
- )
- embed.set_thumbnail(url=self.bot.user.avatar_url)
- await channel.send(embed=embed)
- return
- if ctx.author != player_turn:
- embed = discord.Embed(
- title=f"It is not your turn yet!\nIt is currently **{player_turn.display_name}'s turn**",
- )
- embed.set_thumbnail(url=self.bot.user.avatar_url)
- await channel.send(embed=embed)
- return
- #------------------------------------
- # CHECK WHO OWNS WHAT
- #------------------------------------
- sql = "SELECT * FROM arkopoly_loc_instance WHERE game_id = %s" % (game_id)
- loc_check= await conn.query(sql)
- #sql = "SELECT loc_id FROM arkopoly_loc_instance WHERE game_id = %s and loc_owner = 0" % (game_id)
- #unowned_loc_check= await conn.query(sql)
- ##create player location lists
- unowned_loc_list = []
- p1_loc_list = []
- p2_loc_list = []
- p3_loc_list = []
- p4_loc_list = []
- p1_loc_id_list =[]
- p2_loc_id_list =[]
- p3_loc_id_list =[]
- p4_loc_id_list =[]
- #NO OWN LIST
- no_own = ['Start', 'Loot Box', 'Supply Crate', 'Trough Refill', 'Green Obelisk', 'Blue Obelisk', 'Red Obelisk','Gen Refill']
- for i in loc_check:
- if i[3] == 1:
- p1_loc_list.append(player_pos_info[i[2]-1][1])
- p1_loc_id_list.append(player_pos_info[i[2]-1][0])
- elif i[3] == 2:
- p2_loc_list.append(player_pos_info[i[2]-1][1])
- p2_loc_id_list.append(player_pos_info[i[2]-1][0])
- elif i[3] == 3:
- p3_loc_list.append(player_pos_info[i[2]-1][1])
- p3_loc_id_list.append(player_pos_info[i[2]-1][0])
- elif i[3] == 4:
- p4_loc_list.append(player_pos_info[i[2]-1][1])
- p4_loc_id_list.append(player_pos_info[i[2]-1][0])
- elif i[3] == 0:
- loc_to_check =player_pos_info[i[2]-1][1]
- if loc_to_check not in no_own:
- unowned_loc_list.append(player_pos_info[i[2]-1][1])
- ##SET LOCATION LISTS TO NONE IF THEY@RE LEN= 0
- if len(p1_loc_list)==0:
- p1_loc_list = "None"
- if len(p2_loc_list)==0:
- p2_loc_list = "None"
- if len(p3_loc_list)==0:
- p3_loc_list = "None"
- if len(p4_loc_list)==0:
- p4_loc_list = "None"
- if len(unowned_loc_list) ==0:
- unowned_loc_list = "None"
- #print("P1 owned locations: ", p1_loc_list)
- #print("P2 owned locations: ", p2_loc_list)
- #print("P3 owned locations: ", p3_loc_list)
- #print("P4 owned locations: ", p4_loc_list)
- ##### GETLocation for the Position on the player_turn
- player_turn_info = await getLocation(self, ctx, player_pos_turn, game_id, players)
- ##### CREATE MENUS EMBEDS FOR PAGINATION
- # EMBED LIST
- embed_list = []
- ##SETUP PAGINATION
- #text = [rewind, Back , Die, House, Hotel, trade, properties, Buy, Forward, Fastforward, ?, pencil]
- buttons = [ u"\u23EA", u"\u25C0", u"\U0001F3B2", u"\U0001F3E0", u"\U0001F3E8", u"\U0001F500", u"\U0001F4DA", u"\U0001F4DD", u"\u25B6", u"\u23E9", u"\U0001F5FA", u"\U0001F4DD"]
- #buttonA pencil, map, die, properties, trade
- buttonA =[u"\U0001F4DD",u"\U0001F46A",u"\U0001F5FA",u"\U0001F3B2",u"\U0001F4DA","\U0001F500",u"\u2753",u"\u274C"]
- #buttonb rewind,back,house,hotel,mortgage,cancel,forward,fastforward
- buttonB =[u"\u23EA", u"\u25C0", u"\u25B6", u"\u23E9", u"\U0001F3B2", u"\U0001F3E0", u"\u2753", u"\U0001F4DC",u"\u274C"]
- buttonC =[u"\u2705", u"\u274C"]
- #family emoji u"\u1F468"
- all_buttons = buttonA + buttonB + buttonC
- #HELP INSTRUCTSION EMBED
- page1 = discord.Embed(
- title=f"Hey {player_turn.display_name}, it is your turn!",
- description =f"Before you roll the dice for your turn you can view your properties, buy bases and admin bases or mortgage the properties you own.\nYou can also trade properties with other players.\n Use the reactions below to choose what you want to do.",
- )
- page1.add_field(
- name="Options",
- value= u"\U0001F4DD"+" - Game Status and your position\n"+u"\U0001F46A"+" - View info on all the players\n"+u"\U0001F5FA"+" - View the Game board\n"+u"\U0001F3B2"+" - Roll Dice (this will end your turn!)\n"+u"\U0001F4DA"+" - View your properties (Build Bases and Admin Bases and Mortgage properties\n"+u"\U0001F500"+" - Setup a trade with another player for a property\n"+u"\u2753"+" - Help\n"+u"\u274C"+" - Exit",
- inline=True
- )
- page1.set_thumbnail(url=self.bot.user.avatar_url)
- #sent = await channel.send(embed=page1)
- embed_list.append(page1)
- #STATUS EMBED
- page2 = discord.Embed(
- title=f"Game Status",
- description =f"**__Game Name:__** {game_name}\n**Started by:** {player1}\n**Started on:** {game_startDate}\n**Players:**\n{player2}\n{player3}\n{player4}\n--------------",
- )
- page2.add_field(
- name=f"**{player_turn.display_name}**",
- value= f"**Cash:** *{player_cash_turn}*\n**Location:** *{player_pos_turn}*\n**Owned Property:** *{p1_loc_list}*\n--------------",
- inline=True
- )
- page2.set_image(url = player_turn_info["boardImg"])
- embed_list.append(page2)
- #sent = await channel.send(embed=page2)
- #OTHER PLAYERS
- page3 = discord.Embed(
- title=f"Other players",
- #description =f"**__Game Name:__** {game_name}\n**Started by:** {player1}\n**Started on:** {game_startDate}\n**Players:**\n{player2}\n{player3}\n{player4}\n--------------",
- )
- page3.add_field(
- name="**Player 2**",
- value= f"**Name:** *{player2.display_name}*\n**Cash:** *{p2_cash}*\n**Location:** *{p2_pos_name}*\n**Owned Property:** *{p2_loc_list}*\n--------------",
- inline=True
- )
- page3.add_field(
- name="**Player 3**",
- value= f"**Name:** *{player3.display_name}*\n**Cash:** *{p3_cash}*\n**Location:** *{p3_pos_name}*\n**Owned Property:** *{p3_loc_list}*\n--------------",
- inline=True
- )
- page3.add_field(
- name="**Player 4**",
- value= f"**Name:** *{player4.display_name}*\n**Cash:** *{p4_cash}*\n**Location:** *{p4_pos_name}*\n**Owned Property:** *{p4_loc_list}*\n--------------",
- inline=True
- )
- page3.add_field(
- name="**Unowned properties**",
- value= f"{unowned_loc_list}\n--------------",
- inline=True
- )
- page3.set_thumbnail(url=self.bot.user.avatar_url)
- embed_list.append(page3)
- #GAME BOARD
- page4 = discord.Embed(
- title=f"Game Board",
- #description =f"**__Game Name:__** {game_name}\n**Started by:** {player1}\n**Started on:** {game_startDate}\n**Players:**\n{player2}\n{player3}\n{player4}\n--------------",
- )
- page4.set_image(url=game_board_url)
- page4.set_thumbnail(url=self.bot.user.avatar_url)
- embed_list.append(page4)
- #Dice Roll
- page5 = discord.Embed(
- title=f"Roll Dice",
- description =f"**Rolling the dice ends your turn. You cannot build bases or an admin bases or mortgage or trade properties once you rolled the dice.\n\nTo roll the dice tap on the **"+u"\u2705"+"\nOr "+u"\u274C"+" to exit.",
- )
- page5.set_image(url="http://tinypix.top/images/2021/05/19/iONK0.gif")
- page5.set_thumbnail(url=self.bot.user.avatar_url)
- embed_list.append(page5)
- #trade
- page6 = discord.Embed(
- title=f"Trade",
- #description =f"**__Game Name:__** {game_name}\n**Started by:** {player1}\n**Started on:** {game_startDate}\n**Players:**\n{player2}\n{player3}\n{player4}\n--------------",
- )
- #page6.set_image(url="http://tinypix.top/images/2021/05/19/iONK0.gif")
- page6.set_thumbnail(url=self.bot.user.avatar_url)
- embed_list.append(page6)
- #PROPERTIES EMBED (FOR LOOP
- sql = "SELECT * FROM arkopoly_locs WHERE loc_type >10"
- All_buyable_locs= await conn.query(sql)
- for location in All_buyable_locs:
- location_id = location[0]
- if location_id in p1_loc_id_list:
- result = await getLocation(self, ctx, location_id, game_id, players)
- embed = discord.Embed(
- title=f"__My Properties__",
- description =f"**{result['name']}**\n**Number of bases: **{result['numHouses']}\n**Admin base:** {result['hotel']}\n**Mortgaged: **{result['mortgaged']}",
- )
- embed.set_image(url=result["cardImg"])
- embed_list.append(embed)
- current = 0
- msg = await ctx.send(embed = embed_list[current])
- for button in buttonA:
- await msg.add_reaction(button)
- while True:
- try:
- reaction, member = await self.bot.wait_for(
- "reaction_add",
- timeout=60,
- check=lambda reaction, user: user == ctx.author
- and reaction.emoji in all_buttons
- )
- except asyncio.TimeoutError:
- embed = embed_list[current]
- embed.set_footer(text="Timed Out.")
- await msg.clear_reactions()
- #buttonA =[u"\U0001F4DD",u"\U0001F5FA",u"\U0001F3B2",u"\U0001F4DA","\U0001F500"]
- # u"\u2753" - help
- #u"\U0001F4DD"+" - Game Status
- #u"\U0001F46A"+" - other players
- #u"\U0001F5FA"+" - Game board
- #u"\U0001F3B2"+" - Roll Dice
- #u"\U0001F4DA"+" - properties
- #u"\U0001F500"+" - Trade
- # buttonB =[u"\u23EA", u"\u25C0", u"\U0001F3B2", u"\U0001F3E0",u"\U0001F4DC",u"\u274C", u"\u25B6", u"\u23E9"]
- else:
- previous_page = current
- #Status
- if reaction.emoji == u"\U0001F4DD":
- current = 1
- #other players
- elif reaction.emoji == u"\U0001F46A":
- current = 2
- #board
- elif reaction.emoji == u"\U0001F5FA":
- current = 3
- #dice
- elif reaction.emoji == u"\U0001F3B2":
- current = 4
- #trade
- elif reaction.emoji == u"\U0001F500":
- current = 5
- #help
- elif reaction.emoji == u"\u2753":
- current = 0
- #properties
- elif reaction.emoji == u"\U0001F4DA":
- current = 6
- #rewind
- elif reaction.emoji == u"\u23EA":
- current = 6
- #back
- elif reaction.emoji == u"\u25C0":
- if current > 6:
- current -= 1
- #forward
- elif reaction.emoji == u"\u25B6":
- if current < len(embed_list)-1:
- current += 1
- #fastforward
- elif reaction.emoji == u"\u23E9":
- current = len(embed_list)-1
- #Dice roll
- #elif reaction.emoji == u"\U0001F3B2":
- # a=5
- for button in all_buttons:
- await msg.remove_reaction(button, ctx.author)
- if current != previous_page:
- await msg.edit(embed = embed_list[current])
- if current == 6:
- await msg.clear_reactions()
- for button in buttonB:
- await msg.add_reaction(button)
- elif current == 0:
- await msg.clear_reactions()
- for button in buttonA:
- await msg.add_reaction(button)
- elif current == 4:
- await msg.clear_reactions()
- for button in buttonC:
- await msg.add_reaction(button)
- #await getLocation(self, ctx, location_id)
- def setup(bot):
- bot.add_cog(opoly(bot))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement