import sys import MySQLdb import random import math import re sys.path.insert(0, '/home/bouncer/sassbot/modules/') import BotUtils sys.path.insert(0, '/home/bouncer/sassbot/modules/artifact2-0/') import Items import PlayerStats import PlayerCreate import Resting import Combat import LevelUp import PlayerDeath import Enemy import LevelUp def adventurersinc(phenny, input): if input.sender.lower() == "#fromsteamland" or input.sender.lower() == "#artifact": #Variables strInputGroup = input.group().split(" ") try: strCmd1 = strInputGroup[1] except: strCmd1 = "" try: strCmd2 = strInputGroup[2] except: strCmd2 = "" strPlayerState="debug" parameters = {} parameters['LiveDB'] = 'Artifact2.0' parameters['LiveVersion'] = '2.0' parameters['Nick'] = input.nick playerStats = PlayerStats.RefreshStats(phenny, parameters) #Global Commands if strCmd1 == "git": phenny.say("Artifact v2 git: http://www.blatech.co.uk/JasonFS/Artifact-v2") elif strCmd1 == "version": phenny.say("Artifact v2 - alpha 0.1") else: #Actions based on player state if playerStats == {}: #Do not use strCmd1 here, input.group(2) allows for spaces in a Clan name strOutput = PlayerCreate.PickCharacterClan(phenny, parameters, input.group(2)) elif playerStats["State"] == "CreationName": strOutput = PlayerCreate.PickCharacterName(phenny, parameters, playerStats, strCmd1) elif playerStats["State"] == "CreationRace": strOutput = PlayerCreate.PickCharacterRace(phenny, parameters, playerStats, strCmd1) elif playerStats["State"] == "Rest" and playerStats['AttributePoints'] > 0: strOutput = LevelUp.LevelUpAttributes(phenny, parameters, strCmd1, strCmd2) elif playerStats["State"] == "Rest" and playerStats['AttributePoints'] == 0: strOutput = Resting.PlayerResting(phenny, parameters, playerStats, strCmd1, strCmd2) elif playerStats["State"] == "Combat": strOutput = Combat.PlayerInCombat(phenny, parameters, playerStats, strCmd1, strCmd2) #elif strPlayerState == "debug": #phenny.say(str(input.group(2))) #NewItem = Items.GenerateEquipment(phenny, parameters, input.group(2)) #phenny.say(strOutputNick + ": " + str(NewItem)) #phenny.say(strOutputNick + ": " + NewItem["RarityColor"] + NewItem["EquipmentName"] + "\x0399 = " + str(NewItem['Cost']) ) #Items.AddToShop(phenny, parameters, NewItem) if strOutput is not None: strOutputNick = BotUtils.BotifyFilter(phenny, input.nick, input.nick) phenny.say(strOutputNick + ": " + str(strOutput)) adventurersinc.commands = ['a'] adventurersinc.priority = 'high' def ArtifactAuto(phenny, input): bitChatOutput = True if input.sender.lower() == '#artifact' and not input.group().startswith("!") and bitChatOutput == True: phenny.write(('NOTICE', input.nick), "Message output to #artifact-chat") phenny.msg('#artifact-chat', BotUtils.BotifyFilter(phenny, input.nick, input.nick + ": " + input.group())) ArtifactAuto.rule = r'(.*)' ArtifactAuto.priority = 'medium' #https://stackoverflow.com/questions/4340793/how-to-find-gaps-in-sequential-numbering-in-mysql