Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Import Modules
- import random
- import time
- #Begin User Commands
- easy='easy'
- medium='medium'
- hard='hard'
- expert='expert'
- rank_guest = "Guest"
- rank_user = "User"
- rank_admin = "Admin"
- cmd_help = "help"
- cmd_games = "games"
- cmd_yes = "yes"
- cmd_y = "y"
- cmd_no = "no"
- cmd_n = "n"
- cmd_admin = "admin"
- cmd_privilages = "privilages"
- cmd_target = 'target'
- acshun_give = "give"
- acshun_remove = "remove"
- acshun_do = "do"
- currentuser_rank=''
- helplist="""\nCommands:
- games - Lists the games you can play. Type the name of a game to play.
- admin - Administrators only: Access the control panel.
- privilages - Shows your current user privilages.
- help - Displays this message.
- """
- gamelist="""
- Text Adventure - Moreoverly a text fighter.
- Guessing Game - Guess 3 numbers and see if one of them equals the randomly generated one.
- """
- play_guessinggame = "guessing game"
- play_textadventure = "text adventure"
- #All the TF preface commands
- cmd_attack = "attack"
- cmd_protect = "protect"
- tf_class_mage='mage'
- tf_class_mage_desc='A wizard of sorts. Weak in melee, strong in mid-range combat.'
- tf_class_elf='elf'
- tf_class_elf_desc='Uses his speed to evade attacks, higher chances of critical hits.'
- tf_class_warrior='warrior'
- tf_class_warrior_desc='Extremely fluent in melee, a hard hitter.'
- tf_player_stats_hp=0
- tf_player_stats_mana=0
- tf_player_stats_mana_limit=200
- tf_player_stats_hp_limit=200
- tf_player_attackstrength=random.randint(40, 60)
- tf_player_attackstrength_str=str(tf_player_attackstrength)
- tf_item_woodsword='Wooden Sword'
- tf_item_woodsword_desc='A starter sword. Low damage, and no critical hits.'
- tf_item_woodsword_dmg=random.randint(10, 15)
- tf_player_inventory=[tf_item_woodsword]
- tf_enemy_outlaw = "Outlaw"
- tf_enemy_outlaw_hp = 50
- tf_enemy_outlaw_hp_str = str(tf_enemy_outlaw_hp)
- tf_enemy_outlaw_attackstrength=random.randint(10, 15)
- tf_enemy_outlaw_attackstrength_str = str(tf_enemy_outlaw_attackstrength)
- tf_enemy_merc_stats = ['HP: '+tf_enemy_outlaw_hp_str, 'Attack Strength: Anywhere between 10 and 15']
- tf_enemy_brute = "Brute"
- tf_enemy_brute_hp = 100
- tf_enemy_brute_hp_str = str(tf_enemy_brute_hp)
- tf_enemy_brute_attackstrength=random.randint(20, 35)
- tf_enemy_brute_attackstrength_str = str(tf_enemy_brute_attackstrength)
- tf_enemy_merc_stats = ['HP: '+tf_enemy_brute_hp_str, 'Attack Strength: Anywhere between 20 and 35']
- tf_enemy_merc = "Mercenary"
- tf_enemy_merc_hp = 300
- tf_enemy_merc_hp_str = str(tf_enemy_merc_hp)
- tf_enemy_merc_attackstrength=random.randint(50, 60)
- tf_enemy_merc_attackstrength_str = str(tf_enemy_merc_attackstrength)
- tf_enemy_merc_stats = ['HP: '+tf_enemy_merc_hp_str, 'Attack Strength: Anywhere between 50 and 60']
- tf_enemy=''
- tf_input=''
- battleinput=''
- tfinput=''
- #End the TF stuff
- adminpriv="""
- Administrators have access to everything, including the code, the admin panel, and the normal commands.\n"""
- userpriv="""
- Users have access to all the games and default commands. Editing the code, creating shortcuts, and accessing the Administrator panel are restricted.\n"""
- guestpriv="""
- Guests have access to basic functions such as some games and simple commands. They are restricted to various commands.\n"""
- #End User Commands
- def target(): #THIS FUNCTION IS A WORK IN PROGRESS AND WILL REMAIN HIDDEN FROM THE USERS TEMPORARILY
- player_target = raw_input('Target: ')
- action_target = raw_input('Give, Do, or Remove: ')
- global username
- player_from = username
- if action_target.lower()==acshun_give.lower():
- action_give = raw_input('Give: ')
- print(player_from + ' gave ' + action_give + ' to ' + player_target + '!')
- usermenu()
- elif action_target.lower()==acshun_do.lower():
- action_do = raw_input('Do: ')
- print(player_from + ' ' + action_do + ' ' + player_target + '!')
- usermenu()
- elif action_target.lower()==acshun_remove.lower():
- action_remove = raw_input('Remove: ')
- print(player_from + ' removed ' + action_remove + ' from ' + player_target + '!')
- usermenu()
- def rankpriv():
- global username
- if username in rank_adminlist:
- print(adminpriv)
- usermenu()
- elif username in rank_userlist:
- print(userpriv)
- usermenu()
- else:
- print(guestpriv)
- usermenu()
- tf_elf_help = """
- help - Displays this message
- attack - Attack the enemy
- protect - Shield yourself against up to 50 attack damage next turn
- inventory - Shows your current inventory
- equip - Equip one of the items in your inventory
- stats - Check your health, current equipped weapons, etc
- """
- def tf_elf_intro():
- print('\nThe streets are empty. You walk the barren road. Only 4 and a half feet tall, you are looking for trouble.')
- print('It is rainy. The mood is dark and dim, as it is dark out; the houses are missing their usual jazz of lights.')
- print('Nobody is out. It seems like they are hiding from you. You think you are alone. But suddenly...')
- tf_elf_battle()
- def tf_elf_battle():
- pickenemy=random.randint(3, 3)
- if pickenemy==3:
- global tf_enemy
- enemy="Mercenary"
- print('A Mercenary steps in front of you. His stats are...')
- print('HP: ' + tf_enemy_merc_hp_str)
- print('Attack Strength: Anywhere between 50 and 60\n')
- tf_elf_battle_merc()
- def attack_merc():
- global tf_enemy
- global tf_enemy_merc_hp
- global tf_player_attack_strength
- global tf_player_attackstrength_str
- tf_player_attackstrength = random.randint(15, 20)
- tf_enemy_merc_hp = tf_enemy_merc_hp - tf_player_attackstrength
- print('You attacked him for ' + str(tf_player_attackstrength) + ' damage. He is now at ' + str(tf_enemy_merc_hp) + 'HP.')
- tf_elf_battle_merc()
- def tf_elf_battle_merc():
- battleinput==raw_input('Elf :: ')
- global cmd_help
- global cmd_attack
- global cmd_protect
- if battleinput.lower()==cmd_attack.lower():
- attack_merc()
- elif battleinput.lower()==cmd_help.lower():
- print(tf_elf_help)
- def textfighterclasspick():
- tf_input=raw_input('TF :: ')
- if tf_input.lower()==tf_class_elf.lower():
- tf_player_stats_hp=100
- tf_player_stats_hp_limit=150
- print('You have chosen the Elf class.\nStarting HP: 100 (out of a 150 maximum)')
- print('Starting Stamina: 100 (out of a 250 maximum)')
- print('No Mana: Elves do not use magic')
- start=raw_input('Ready to start? ')
- if start.lower()==cmd_yes:
- tf_elf_intro()
- else:
- print('Directing you back to the user menu...')
- time.sleep(2)
- usermenu()
- def textfighterintro():
- print('Alright, suit up General '+username+'! Pick your class.\n')
- print('** Warrior:\n'+tf_class_warrior_desc)
- print('** Elf:\n'+tf_class_elf_desc)
- print('** Mage:\n'+tf_class_mage_desc)
- textfighterclasspick()
- def checkrank():
- global username
- if username in rank_adminlist:
- print("You are in the rank of Administrators.")
- elif username in rank_userlist:
- print("You are in the rank of Users.")
- else:
- print('You are in the rank of a Guest.')
- def usermenu():
- um_in=raw_input('Menu :: ')
- #Help Command
- if um_in.lower()==cmd_help.lower():
- print(helplist)
- usermenu()
- #Games Command
- elif um_in.lower()==cmd_games.lower():
- print(gamelist)
- usermenu()
- #Play 'Text Adventure' Command
- elif um_in.lower()==play_textadventure.lower():
- print('Booting up Text Adventure/Fighter...')
- print('You have inserted an SSD for instant load times!') ################ PUT IN THE TIME.SLEEP HERE AGAIN FOR A FEW SECONDS
- textfighterintro()
- #Play 'Guessing Game' Command
- elif um_in.lower()==play_guessinggame.lower():
- print("Booting up Guessing Game...\n")
- time.sleep(2)
- promptguess()
- usermenu()
- #Admin Command
- elif um_in.lower()==cmd_admin.lower():
- print('This command exists - although it is not implemented yet.')
- usermenu()
- #Privilages
- elif um_in.lower()==cmd_privilages.lower():
- global currentuser_rank
- print('\nYour privilages are...')
- rankpriv()
- #Target Fun
- elif um_in.lower()==cmd_target.lower():
- target()
- #Otherwise...
- else:
- print("Invalid. Type 'help' for help.")
- usermenu()
- def playagain():
- gg_again=raw_input('Would you like to play again? ')
- if gg_again.lower()==cmd_yes.lower():
- print('Alright! Restarting...\n')
- time.sleep(0.5)
- promptguess()
- elif gg_again.lower()==cmd_y.lower():
- print('Alright! Restarting...\n')
- time.sleep(0.5)
- promptguess()
- elif gg_again.lower()==cmd_no.lower():
- print('Returning to the Menu...\n')
- time.sleep(0.5)
- usermenu()
- elif gg_again.lower()==cmd_n.lower():
- print('Returning to the Menu...\n')
- time.sleep(0.5)
- usermenu()
- else:
- print("Invalid - returning to the menu...")
- time.sleep(0.5)
- usermenu()
- def guess(g1, g2, g3, difficulty):
- if difficulty.lower()==easy.lower():
- randomint=random.randint(1, 10)
- elif difficulty.lower()==medium.lower():
- randomint=random.randint(1, 30)
- elif difficulty.lower()==hard.lower():
- randomint=random.randint(1, 100)
- elif difficulty.lower()==expert.lower():
- randomint=random.randint(1, 666)
- #Break Line
- randomintstr=str(randomint)
- if g1==randomintstr:
- print('Great job, correct on the first number! ('+g1+')')
- playagain()
- elif g2==randomintstr:
- print('Nice one! The second number was correct. ('+g2+')')
- playagain()
- elif g3==randomintstr:
- print('Excellent! The third number was correct. ('+g3+')')
- playagain()
- else:
- print('Sorry, none were correct. It was '+randomintstr+'.')
- playagain()
- def promptguess():
- print('Easy: Guess 1-10.\nMedium: Guess 1-30.\nHard: Guess 1-100.\nExpert: Guess 1-666.')
- difficulty=raw_input('Easy, Medium, Hard, or Expert? ')
- g1=raw_input('First number: ')
- if g1=="":
- print('You must input a valid number! Restarting...')
- time.sleep(1)
- promptguess()
- g2=raw_input('Second number: ')
- if g2=="":
- print('You must input a valid number! Restarting...')
- time.sleep(1)
- promptguess()
- g3=raw_input('Third number: ')
- if g3=="":
- print('You must input a valid number! Restarting...')
- time.sleep(1)
- promptguess()
- print('Generating results...')
- time.sleep(2)
- guess(g1, g2, g3, difficulty)
- #Some lists...
- users=['JynX', 'McBroColi', 'Deydria', 'Ray.henry', 'Zeke', '9/11Faggot', 'SplodyBitz', 'fartman']
- passes=['drpepper123', 'KY8G3HD', 'K3IEJLD', 'KWU4B9Z', 'K2CO2UI', 'logitechspeaker', 'AKDJASKDJKALU3EIASDMN389UDH9Q8WDH3U2HD38DH2389DH8923DH8923DH3', 'ifartinmymomsmouth']
- rank_adminlist=['McBroColi', 'Deydria', 'Ray.henry', 'Zeke', 'JynX']
- rank_userlist=['9/11Faggot', 'SplodyBitz', 'fartman']
- userlist=set(users)
- passlist=set(passes)
- username=""
- #End lists
- def promptlogin():
- global username
- username=raw_input('Username: ')
- if username in userlist:
- password=raw_input('Passcode: ')
- if password in passlist:
- usergen=random.randint(1, 3)
- if usergen==3:
- print('Howdy, '+username+"!")
- checkrank()
- usermenu()
- elif usergen==2:
- print('Greetings, '+username+"!")
- checkrank()
- usermenu()
- elif usergen==1:
- print('Welcome, '+username+"!")
- checkrank()
- usermenu()
- else:
- print('Invalid Login: Bad Password')
- promptlogin()
- elif username=="Guest":
- print('You have signed in as a Guest.')
- usermenu()
- else:
- print('Invalid Login: Bad Username')
- promptlogin()
- promptlogin()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement