import pygame as pygame import os import stats import enemies import combat import cave import hallway plat = stats.Player() plat.room = "key" plat.door = 0 #this is the walk screen for THE FIRST CAVE BEFORE THE PUZZLE current_path = os.path.dirname(__file__) image_path = os.path.join(current_path, 'sprites') pygame.init() #setting screen size screen = pygame.display.set_mode((1280, 720)) #setting scenery and static objects background = pygame.image.load(os.path.join(image_path, "keybg.jpg")) screen.blit(background, (0, 0)) ledge = pygame.image.load(os.path.join(image_path, "ledge.png")) x = 250 y = 225 ledge_info = ["ledge", x, y] screen.blit(ledge, (x, y))
# Commands for Text Based Character Sheet Commands = { 'quit' : stats.Player.stop, 'damage' : stats.Player.take_damage, 'heal' : stats.Player.heal_damage, #'status' : stats.Player.status } # Game Loop # ====================== # Instantiating Player as object p = stats.Player("Lentil", 50, 50, True) p.name = Name p.health_max = HP_max p.health = HP_current #Spells["Firebolt"].cast_spell() while(p.quit): p.status() # Always describe player status line = input("> ") args = line.split() # Extracts each individual word (or string of text separated by space) if len(args) > 0: # If you entered anything... commandFound = False for c in Commands.keys(): # Scroll through every Key if args[0] == c[: len(args[0])]: # If first argument is the same as the [I have no clue] #print("Command understood! Beginning Command.")
async def on_message(message): if message.content.startswith('!test'): counter = 0 tmp = await client.send_message(message.channel, 'Calculating messages...') async for log in client.logs_from(message.channel, limit=100): if log.author == message.author: counter += 1 await client.edit_message(tmp, 'You have {} messages.'.format(counter)) elif message.content.startswith('!cleanup'): def isMe(m): return m.author == client.user deleted = await client.purge_from(message.channel, limit=100, check=isMe) await client.send_message(message.channel, 'Deleted {} message(s)'.format(len(deleted))) elif message.content.startswith('!removeMyMessages'): author = message.author def isAuthor(m): return m.author == author deleted = await client.purge_from(message.channel, limit=100, check=isAuthor) await client.send_message(message.channel, 'Deleted {} message(s)'.format(len(deleted))) elif message.content.startswith('!sleep'): await asyncio.sleep(5) await client.send_message(message.channel, 'Done sleeping') elif message.content.lower().startswith('!osrsstats'): tmp = await client.send_message(message.channel, "Processing request...") longOption = False content = message.content player, longOption = tools.parse_osrs_request(content) try: playerObject = stats.Player(player) playerObject = stats.osrs_request_player(player) except: await client.edit_message(tmp, ("Can't find data for " + player)) await asyncio.sleep(waitTime) client.delete_message(tmp) client.delete_message(message) return if (longOption): reply = "```" + playerObject.longMessage() + "```" else: reply = "```" + playerObject.shortMessage() + "```" await client.edit_message(tmp, reply) await asyncio.sleep(waitTime) await client.delete_message(tmp) await client.delete_message(message) elif message.content.lower().startswith('!osrsge'): tmp = await client.send_message(message.channel, "Processing request...") try: ms = ge.message(message.content) except: ms = "No such item or too many hits" ms = '```' + ms + '```' await client.edit_message(tmp, ms) await asyncio.sleep(waitTime) await client.delete_message(tmp) await client.delete_message(message) elif message.content.startswith('!help'): reply = "```Commands : \n" \ + "!help \nDisplays this message \n" \ + "--------\n" \ + "!osrsStats [-l] [playername] \n" \ + "Shows HiScores for given playername \n" \ + "if -l parameter is passed statistics, for all skills are shown \n" \ + "---------\n" \ + "!osrsGE [item] \n" \ + "Finds GE information for objects that match item \n" \ + "----------\n" \ + "All requests and responses are displayed for {} seconds```".format(waitTime) reply = await client.send_message(message.channel, reply) await asyncio.sleep(waitTime) await client.delete_message(message) await client.delete_message(reply)