A terminal-based dungeon crawler game http://pavela.net/DungeonCli/index.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1378 lines
43 KiB

  1. # NOTE: JOIN THE DISCORD: https://discord.gg/eAUqKKe
  2. # DungeonCli is a terminal based program where you get to explore places and
  3. # earn coins. You can spend those coins on various items, have fun!
  4. # Import Libraries here:
  5. #from __future__ import print_function, unicode_literals
  6. #from __future__ import print_function
  7. from colorama import Fore, Back, Style# type: ignore
  8. from PyInquirer import prompt, print_json # type: ignore
  9. import threading
  10. import time
  11. import random
  12. import os
  13. import sys
  14. from src import richPrecense
  15. from src import multiplayer
  16. from Engine import *
  17. # What??? this import fixed my error???
  18. from Engine import DGSave
  19. from Engine import DGUpdate
  20. from sys import stdout
  21. from threading import Lock
  22. # import multiprocessing # DANIEL YOU CUNK :) PLS USE THREADS!!
  23. # ONCE I FIGURE OUT HOW TO END THREADS, XENTHIO!
  24. # You know how hard it is?
  25. # YES I NEEDED TO DO THE SAME THING! BUT YOU KNOW THREADS END AFTER THE FUNCTION FINISHES, RIGHT?
  26. # I CAN'T MAKE A BUILD UNTIL YOU SWITCH TO THREADS...
  27. # I KNOW THAT A THREAD ENDS WHEN THE FUNCTION END,
  28. # BUT I CAN'T END A PLAYSOUND() FUNCTION UNTIL IT FINISHES
  29. # ALSO WHY ARE WE TALKING IN CAPS LOCK?
  30. # AND WHY ARE WE USING THIS TO CHAT? Lol.
  31. # IDK BUT KEEP THIS GIANT BLOCK OF TEXT FOR HISTORICAL PURPOSES, OR ATLEAST UNTIL YOU USE THREADS.
  32. from colorama import init # type: ignore
  33. os.chdir(os.path.dirname(os.path.abspath(__file__)))
  34. # --------------------------
  35. # | Version! |
  36. # --------------------------
  37. version = "Development Version 0.6.4"
  38. # --------------------------
  39. # Define variables here:
  40. all_processes = []
  41. # Used to prevent cheating:
  42. devPassword = "hackerman"
  43. developer = 0
  44. invalidCommands = 0
  45. mainLoop = 1
  46. tempProgressCommand = ["nil"]
  47. # TODO: when 'wizardThatWantsToKillYou' is done, add it here
  48. events = ["store", "store", "store", "randomFight", "none", "none", "bombTrap",
  49. "treasure", "treasure", "unknownCrate"]
  50. CSSOptions = [["Matches", 5], ["Basic Healing Potion", 15],
  51. ["Copper Armour", 75], ["Iron Armour", 125], ["Stone Sword", 60],
  52. ["Iron Sword", 90],
  53. ["Advanced Healing Potion", 60], ["Poison Potion", 20],
  54. ["Lucky Coin", 550]]
  55. # theCombatHasNotFinished! alsoICanTalkInCamelCaseMakesSenseRight?
  56. hasCombatFinished = "no."
  57. hasSeenAStore = False
  58. # Define classes here:
  59. # Some useful stuff
  60. Scene = DGScene
  61. class quest:
  62. quests = []
  63. def add(newQuest):
  64. quest.quests.append(newQuest)
  65. def list():
  66. if len(quest.quests) < 1:
  67. printScan(DGText.error + "You don't have any quests so far")
  68. else:
  69. DGText.printScan(DGText.success + "Your current quests:")
  70. for theQuest in quest.quests:
  71. DGText.printScan(Style.BRIGHT + Fore.CYAN + theQuest)
  72. print(Style.RESET_ALL)
  73. printspeed = 0.013
  74. defprntspd = 0.013
  75. def initRandomRoom():
  76. global DGDialog
  77. # Not my code but what I think it does is
  78. # has a 50% chance of placing coins in the room.
  79. # Also, there would be a 1 in 10 chance of the room not being lit
  80. global Scene
  81. a = random.randint(1,2)
  82. Scene.description = DGDialog.randomDialog.roomDescription()
  83. if a == 2:
  84. Scene.hasCoins == True
  85. Scene.description == Scene.description + " " + DGDialog.randomDialog.coinsOnFloor()
  86. b = random.randint(1,10)
  87. if b == 2:
  88. Scene.surroundingsLit == False
  89. def invalidCommand():
  90. global invalidCommands
  91. invalidCommands = invalidCommands + 1
  92. DGText.printScan(DGText.error + "Invalid command! \n")
  93. if invalidCommands > 3:
  94. DGText.printScan(hint + "if you're stuck on how to progress, simply type 's')\n"
  95. + Style.RESET_ALL)
  96. invalidCommands = 0
  97. def useBrick(): # temp function called when in a specific room
  98. global Scene
  99. if Scene.current == 8:
  100. DGText.printScan(action + "You pull out the brick however, quickly drop it as a massive spider lay on it.")
  101. time.sleep(0.7)
  102. DGText.printScan("You hear a latch go *click!* and the sound of Bricks on Bricks"
  103. " fill the room... A massive door lays upon your sight.\n")
  104. time.sleep(1)
  105. Scene.description = "A massive door is upon your sight. You should probably check it out"
  106. Scene.canProgress = True
  107. else:
  108. DGText.printScan(error + "There are no bricks nearby!\n")
  109. def passwordPrompt():
  110. if developer == 0:
  111. DGText.printScan(Style.BRIGHT + Fore.YELLOW + "This is a developer command!"
  112. " Please input the developer password!" + Style.RESET_ALL)
  113. questions = [
  114. {
  115. 'type': 'password',
  116. 'message': 'Enter the Developer password',
  117. 'name': 'password'
  118. }
  119. ]
  120. answers = prompt(questions)
  121. userInput = answers['password']
  122. if userInput == devPassword:
  123. DGText.printScan(DGText.success + "Access granted!\n" + Style.RESET_ALL)
  124. return "granted"
  125. else:
  126. DGText.printScan(rip + "Incorrect password!\n")
  127. return "denied"
  128. else:
  129. DGText.printScan(DGText.success + "you have already use the dev password, so you're still logged in.")
  130. return "granted"
  131. def removeFromList(list, removal):
  132. index = 0
  133. listLoop = True
  134. while listLoop:
  135. if list[index] == removal:
  136. modifiedList = list
  137. modifiedList.pop(index)
  138. return modifiedList
  139. listLoop = False
  140. else:
  141. index = index + 1
  142. def ask(funcQuestion, answer1, answer2):
  143. askLoop = 1
  144. while askLoop == 1:
  145. # Asks the user a question
  146. userInput = input(question + "{funcQuestion} [{answer1}/{answer2}] "
  147. .format(funcQuestion=funcQuestion, answer1=answer1, answer2=answer2)
  148. + Style.RESET_ALL)
  149. # Checks if it's correct
  150. if userInput == answer1:
  151. askLoop = 0
  152. DGText.printScan("")
  153. return answer1
  154. elif userInput == answer2:
  155. askLoop = 0
  156. DGText.printScan("")
  157. return answer2
  158. else:
  159. DGText.printScan(error + "Answer must be either "
  160. "{answer1} or {answer2}!\n".format(answer1=answer1, answer2=answer2))
  161. def bombTrapScene():
  162. global Scene
  163. global DGDialog
  164. Scene.description = "The room looked very charred after the explosion. you should probably proceed."
  165. DGMain.playSound("Sounds/explosion.ogg", False)
  166. DGText.printScan(rip + "BANG!")
  167. time.sleep(1)
  168. DGText.printScan(DGDialog.randomDialog.bombExplodes())
  169. DGPlayer.damage(random.randint(5, 15) * DGPlayer.Inventory.absorbtion)
  170. time.sleep(1)
  171. # Commands used
  172. def bossBattle():
  173. global Scene
  174. global DGText
  175. endThreads()
  176. DGClear()
  177. DGText.printspeed = 0.05
  178. DGText.printScan(action + "The door behind you closes. There is no escape.")
  179. time.sleep(2)
  180. DGText.printScan(quote + "I've been expecting you. Any last words?\"\n")
  181. time.sleep(2)
  182. DGText.printScan(quote + "Nothing eh? You're too weak to defeat me,"
  183. " and there's nothing that can stop me.\"\n")
  184. DGMain.playSound("Music/bossBattle.ogg", True)
  185. DGText.printspeed = 0.7
  186. print(Style.BRIGHT + Fore.WHITE)
  187. DGText.printScan("\"goodbye.\"\n")
  188. DGText.printspeed = 0.013
  189. Scene.combatOverrideMusic = False
  190. bossLoop = True
  191. while bossLoop == True:
  192. theResult = DGCombat.combat("Boss", 25000, 1000, 1500)
  193. if theResult == "killed":
  194. bossSuccess()
  195. elif theResult == "flee":
  196. DGText.printScan(quote + "You think you can run away from me?\"")
  197. time.sleep(1)
  198. DGText.printScan(quote + "Think again.\"")
  199. time.sleep(1)
  200. endThreads()
  201. DGMain.playSound("Music/bossBattle.ogg", True)
  202. def bossSuccess():
  203. global DGText
  204. endThreads()
  205. DGClear()
  206. DGMain.playSound("Music/endCredits.ogg", False)
  207. message = """
  208. __ __ _ _
  209. \ \ / /__ _ _ __ _(_)_ __ | |
  210. \ V / _ \| | | | \ \ /\ / / | '_ \| |
  211. | | (_) | |_| | \ V V /| | | | |_|
  212. |_|\___/ \__,_| \_/\_/ |_|_| |_(_)
  213. """
  214. DGText.printScan(Fore.GREEN + Style.BRIGHT + message)
  215. DGText.printspeed = 0.020
  216. time.sleep(2.5)
  217. DGText.printScan(Style.BRIGHT + Fore.CYAN + "Once the boss was destroyed,"
  218. " the rebellion was dismantled, letting the town recover!\n" + Style.RESET_ALL)
  219. time.sleep(2.5)
  220. DGText.printspeed = 0.007
  221. creditScreen()
  222. time.sleep(2.5)
  223. DGExit()
  224. def options():
  225. global DGMain
  226. questions = [
  227. {
  228. 'type': 'list',
  229. 'name': 'selection',
  230. 'choices': ['Toggle Music',
  231. 'Exit',],
  232. 'message': 'What options would you like to toggle?',
  233. }
  234. ]
  235. askLoop = 1
  236. while askLoop == 1:
  237. print(Style.RESET_ALL)
  238. answers = prompt(questions)
  239. # DGText.printScan_json(answers)
  240. userInput = answers['selection']
  241. # DGText.printScan(action + "You selected:" + userInput)
  242. if userInput == "Exit":
  243. askLoop = 0
  244. DGText.printScan(action + "You exited the options menu\n")
  245. elif userInput == "Toggle Music":
  246. DGMain.playMusic = not DGMain.playMusic
  247. if DGMain.playMusic is False:
  248. endThreads()
  249. else:
  250. if Scene.current > 2:
  251. DGMain.playSound("Music/quest.ogg", True)
  252. else:
  253. DGMain.playSound("Music/intro.ogg", True)
  254. DGText.printScan("You toggled music to {value}\n".format(value=DGMain.playMusic))
  255. # TODO: Move these into DGPLayer as a player actions class.!
  256. def checkCoins():
  257. global DGPlayer
  258. DGText.printScan(DGText.success + "You have $" + str(DGPlayer.coins) + "!\n")
  259. if DGPlayer.coins == 0:
  260. time.sleep(0.7)
  261. DGText.printScan(Style.BRIGHT + Fore.WHITE + "You have 0 coins? I feel bad, here"
  262. " take 10 coins!")
  263. time.sleep(0.7)
  264. DGMain.addCoins(10)
  265. time.sleep(0.7)
  266. def openInventory():
  267. DGText.printScan(DGText.success + "Inventory:")
  268. DGText.printScan(DGText.success + "Your damage inflicted multipler is {m}x".format(m=DGPlayer.Inventory.damage))
  269. DGText.printScan(DGText.success + "Your damage taken multiplyer is {p}x".format(p=DGPlayer.Inventory.absorbtion))
  270. DGText.printScan(DGText.success + "Your money multiplyer is {p}x\n".format(p=DGPlayer.Inventory.moneyMultiplyer))
  271. count = 0
  272. if DGPlayer.Inventory.matches != 0:
  273. DGText.printScan(str(DGPlayer.Inventory.matches) + " x Matches")
  274. if DGPlayer.Inventory.sticks != 0:
  275. DGText.printScan(str(DGPlayer.Inventory.sticks) + " x Sticks")
  276. if DGPlayer.Inventory.basicHealingPotion != 0:
  277. DGText.printScan(str(DGPlayer.Inventory.basicHealingPotion) + " x Basic Healing Potion")
  278. if DGPlayer.Inventory.advancedHealingPotion !=0:
  279. DGText.printScan(str(DGPlayer.Inventory.advancedHealingPotion) + " x Advanced Healing Potion")
  280. if DGPlayer.Inventory.poisonPotion !=0:
  281. DGText.printScan(str(DGPlayer.Inventory.poisonPotion) + " x Poison Healing Potion")
  282. if DGPlayer.Inventory.sword == 1:
  283. DGText.printScan("Wooden Sword")
  284. if DGPlayer.Inventory.sword == 2:
  285. DGText.printScan("Stone Sword")
  286. if DGPlayer.Inventory.sword == 3:
  287. DGText.printScan("Iron Sword")
  288. elif DGPlayer.Inventory.armour == 1:
  289. DGText.printScan("Copper Armour")
  290. elif DGPlayer.Inventory.armour == 2:
  291. DGText.printScan("Iron Armour")
  292. if DGPlayer.Inventory.secretKey == 1:
  293. DGText.printScan("Random Key?")
  294. # This DGText.printScan just adds some white space
  295. DGText.printScan(" ")
  296. def purchase(storeSelected, id):
  297. global DGPlayer
  298. global absorbtion
  299. global damageMultiplyer
  300. item = storeSelected[id][0]
  301. price = storeSelected[id][1]
  302. if DGPlayer.coins >= price:
  303. if item == "Matches":
  304. DGPlayer.Inventory.matches = DGPlayer.Inventory.matches + 1
  305. elif item == "Basic Healing Potion":
  306. DGPlayer.Inventory.basicHealingPotion = DGPlayer.Inventory.basicHealingPotion + 1
  307. elif item == "Advanced Healing Potion":
  308. DGPlayer.Inventory.advancedHealingPotion = DGPlayer.Inventory.advancedHealingPotion + 1
  309. elif item == "Poison Potion":
  310. DGPlayer.Inventory.poisonPotion = DGPlayer.Inventory.poisonPotion + 1
  311. elif item == "Copper Armour":
  312. if DGPlayer.Inventory.armour == 1:
  313. DGText.printScan(error + "You already have this item!\n")
  314. return "bruh"
  315. else:
  316. DGPlayer.Inventory.armour = 1
  317. DGPlayer.Inventory.absorbtion = 0.8
  318. elif item == "Iron Armour":
  319. if DGPlayer.Inventory.armour == 2:
  320. DGText.printScan(error + "You already have this item!\n")
  321. return "bruh"
  322. else:
  323. DGPlayer.Inventory.armour = 2
  324. DGPlayer.Inventory.absorbtion = 0.6
  325. elif item == "Stone Sword":
  326. if DGPlayer.Inventory.sword == 2:
  327. DGText.printScan(error + "You already have this item!\n")
  328. return "bruh"
  329. else:
  330. DGPlayer.Inventory.sword = 2
  331. DGPlayer.Inventory.damage = 1.4
  332. elif item == "Iron Sword":
  333. if DGPlayer.Inventory.sword == 3:
  334. DGText.printScan(error + "You already have this item!\n")
  335. return "bruh"
  336. else:
  337. DGPlayer.Inventory.sword = 3
  338. DGPlayer.Inventory.damage = 1.7
  339. elif item == "Lucky Coin":
  340. if DGPlayer.Inventory.moneyMultiplyer == 2:
  341. DGText.printScan(error + "You already have this item!\n")
  342. return "bruh"
  343. else:
  344. DGPlayer.Inventory.moneyMultiplyer = 2
  345. DGText.printScan(action + "You purchased {item} for {price} coins!\n"
  346. .format(item=item, price=price))
  347. DGPlayer.coins = DGPlayer.coins - price
  348. else:
  349. DGText.printScan(error + "You do not have enough coins to purchase this item!\n")
  350. def openStore():
  351. initStore()
  352. DGText.printScan("You entered the store!")
  353. global CSSOptions
  354. global DGPlayer
  355. global Scene
  356. DGText.printScan("------------------")
  357. DGText.printScan(" STORE ")
  358. DGText.printScan("------------------")
  359. DGText.printScan(DGText.success + "You have $" + str(DGPlayer.coins))
  360. for i in Scene.storeSelected:
  361. DGText.printScan(Fore.WHITE + "{name} -- {price}".format(name=i[0], price=i[1]))
  362. DGText.printScan("")
  363. questions = [
  364. {
  365. 'type': 'list',
  366. 'name': 'itemChoice',
  367. 'choices': [(Scene.storeSelected[0])[0],
  368. (Scene.storeSelected[1])[0],
  369. (Scene.storeSelected[2])[0], 'Exit'],
  370. 'message': 'Which item would you like to purchase?',
  371. }
  372. ]
  373. askLoop = 1
  374. while askLoop == 1:
  375. print(Style.RESET_ALL)
  376. answers = prompt(questions)
  377. # DGText.printScan_json(answers)
  378. userInput = answers['itemChoice']
  379. # DGText.printScan(action + "You selected:" + userInput)
  380. if userInput == "Exit":
  381. askLoop = 0
  382. DGText.printScan(action + "You left the store.\n")
  383. Scene.storeSelected = []
  384. elif userInput == Scene.storeSelected[0][0]:
  385. purchase(Scene.storeSelected, 0)
  386. elif userInput == Scene.storeSelected[1][0]:
  387. purchase(Scene.storeSelected, 1)
  388. elif userInput == Scene.storeSelected[2][0]:
  389. purchase(Scene.storeSelected, 2)
  390. def useMatch():
  391. global DGPlayer
  392. global surroundingsLit
  393. global Scene
  394. if DGPlayer.Inventory.matches == 0:
  395. DGText.printScan(error + "You don't have any matches!\n")
  396. elif Scene.surroundingsLit == True:
  397. DGPlayer.Inventory.matches = DGPlayer.Inventory.matches - 1
  398. DGMain.playSound("Sounds/matchUse.ogg", False)
  399. time.sleep(0.3)
  400. DGText.printScan("You light a match. it begins to burn away.")
  401. DGText.printScan(rip + "You used up one match. \n")
  402. elif Scene.surroundingsLit == False:
  403. Scene.description = "This place is in ruins, and it's possibly been like that for decades."
  404. DGPlayer.Inventory.matches = DGPlayer.Inventory.matches - 1
  405. Scene.surroundingsLit = True
  406. DGMain.playSound("Sounds/matchUse.ogg", False)
  407. time.sleep(0.3)
  408. DGText.printScan("You Light a match, your surroundings fill up with light. "
  409. "you can now see!")
  410. DGText.printScan(rip + "You used up one match. \n")
  411. if Scene.current == 1:
  412. print("")
  413. time.sleep(1)
  414. start()
  415. def start():
  416. global Scene
  417. global DGPlayer
  418. global DGText
  419. global tempProgressCommand
  420. Scene.storeSelected = []
  421. if Scene.surroundingsLit == False:
  422. DGText.printScan(DGText.action + "You are lying down, the cold, wet floor pressed"
  423. " against your face..." + Style.RESET_ALL + "\nWhere are you?\n")
  424. Scene.description = "It is extremely dark and cold \n(however that could be because of your wet clothes), but despite that you can't see a single thing..."
  425. time.sleep(1)
  426. DGText.printScan(DGText.action + "You get up, your footsteps echo through out the room. It's Extremely dark.")
  427. DGText.printScan(Style.RESET_ALL + "Check your Inventory, you might have something to improve your vision...\n")
  428. time.sleep(1)
  429. if DGPlayer.Inventory.matches < 1:
  430. DGText.printScan(rip + "You don't have any matches left!")
  431. time.sleep(1)
  432. DGText.printScan(rip + "There's no way to light this room.")
  433. time.sleep(1)
  434. DGText.printScan(action + "The only thing you can do is proceed to the next room...\n")
  435. Scene.canProgress == True
  436. else:
  437. if Scene.current == 1:
  438. DGText.printScan(Style.RESET_ALL + "The Light is bright enough to "
  439. "see where you are walking, no walls are nearby.")
  440. DGText.printScan(action + "While being scared, you think it is "
  441. "probably safe enough to \nwander about your surroundings a bit... \n")
  442. tempProgressCommand = ["walk around", "wander", "walk", "wonder"]
  443. elif Scene.current == 2:
  444. DGText.printScan(DGText.action + "You start to take a small wander and look around.")
  445. time.sleep(0.75)
  446. DGText.printScan(DGText.action + "After wandering around for some time, something shiny catches your attention.\n")
  447. time.sleep(0.75)
  448. DGText.printScan(Style.RESET_ALL + "It's a lock, it hangs losely on a chest. It's extremely "
  449. "rusted to the point where the fact that\nit's shine caught your eye is astounding.\n")
  450. tempProgressCommand = ["break lock", "attempt to open", "open",
  451. "open chest", "unlock", "unlock chest", "pick", "pick lock"]
  452. time.sleep(1)
  453. elif Scene.current == 3:
  454. DGText.printScan(DGText.action + "The lock snaps off. you gently lift up the lid and take what is inside.")
  455. DGText.printScan(success + "You pickup a basic healing potion and"
  456. " a wooden sword.")
  457. DGPlayer.Inventory.basicHealingPotion = DGPlayer.Inventory.basicHealingPotion + 1
  458. DGPlayer.Inventory.damage = 1.2
  459. DGPlayer.Inventory.sword = 1
  460. time.sleep(2)
  461. # Add a new line
  462. print("")
  463. elif Scene.current == 4:
  464. DGText.printScan(DGText.action + "You carefully proceed into the next room...")
  465. time.sleep(1)
  466. DGText.printScan(Style.RESET_ALL + "It is completely empty. There is no sound except"
  467. " the water dripping...\n")
  468. time.sleep(1)
  469. DGText.printScan(DGText.rip + "Suddenly, a goblin bursts through"
  470. " the other door!")
  471. time.sleep(0.5)
  472. DGText.printScan(DGText.rip + "There's nothing you can do other than"
  473. " fight!\n")
  474. time.sleep(0.2)
  475. DGCombat.combat("Anomynous Goblin", 20, 3, 5)
  476. elif Scene.current == 5:
  477. DGText.printScan(DGText.action + "You find a small outpost here. There are unknown creatures"
  478. " scattered across the place")
  479. DGText.printScan(Style.RESET_ALL + "The outpost seems to be in ruins,"
  480. " blood scattered across the wall of burned down houses.\n")
  481. time.sleep(1)
  482. DGText.printScan(Style.BRIGHT + Fore.WHITE + "Theres a sign on a dusty wall, it reads,\n")
  483. DGText.printspeed = 0.05
  484. DGText.printScan(DGText.quote +
  485. "It used to be great here,\n"
  486. "But then, the rebellion wiped us clear,\n"
  487. "There's only one way back,\n"
  488. "It's simple yet hard,\n"
  489. "Defeat the guard.\"\n")
  490. DGText.printspeed = 0.013
  491. time.sleep(1)
  492. DGText.printScan(DGText.action + "Suddenly, some sort of 'creature'"
  493. " comes up to you. It can't speak English, but it's pointing towards"
  494. " a trapdoor.")
  495. questions = [
  496. {
  497. 'type': 'confirm',
  498. 'name': 'promptChoice',
  499. 'message': 'Will you climb down onto the trapdoor?',
  500. }
  501. ]
  502. print(Style.RESET_ALL)
  503. theAnswer = prompt(questions)
  504. theSelection = theAnswer['promptChoice']
  505. if theSelection is True:
  506. DGText.printScan(DGText.success + "You climb down onto the trapdoor."
  507. " Once you reach the bottom, you found a key!")
  508. DGText.printScan(DGText.action + "You don't know what this key is for,"
  509. " but you take it anyway.\n")
  510. DGPlayer.Inventory.secretKey = 1
  511. time.sleep(2)
  512. DGText.printScan(Style.RESET_ALL + "As you begin to exit the trapdoor...\n")
  513. bombTrapScene()
  514. else:
  515. DGText.printScan(DGText.action + "You decide it is too risky and"
  516. " prepare to move on.\n")
  517. elif Scene.current == 6:
  518. DGText.printScan(DGText.action + "You open the door. It's a faceless, expresionless figure. Somehow, even with no mouth, it says")
  519. time.sleep(2)
  520. DGText.printScan(DGText.quote + "Install Debian.\"\n")
  521. time.sleep(1)
  522. else:
  523. DGText.printScan(DGText.success + "Thanks for testing DungeonCli!" + Fore.WHITE)
  524. DGText.printScan("We haven't finished this scene.")
  525. DGText.printScan("If you want to help us improve, feel free to send a screenshot or video of you")
  526. DGText.printScan("playing the game, at the discord server:")
  527. DGText.printScan(Style.BRIGHT + Fore.BLUE + "https://discord.gg/eAUqKKe\n")
  528. def randomEvent():
  529. global events
  530. global hasSeenAStore
  531. global Scene
  532. global storeSelected
  533. global DGDialog
  534. randomLoop = True
  535. DGText.printScan(action + "You proceed into the next room...\n")
  536. if len(events) > 0:
  537. selection = random.choice(events)
  538. if selection == "store":
  539. DGText.printScan(DGText.action + "You find a small store setup here")
  540. DGText.printScan(DGText.action + "Maybe they'll have something useful here..\n")
  541. Scene.description = Scene.description + " " + DGDialog.randomDialog.store()
  542. questions = [
  543. {
  544. 'type': 'confirm',
  545. 'name': 'promptChoice',
  546. 'message': 'Will you enter the store?',
  547. }
  548. ]
  549. print(Style.RESET_ALL)
  550. theAnswer = prompt(questions)
  551. theSelection = theAnswer['promptChoice']
  552. if theSelection is True:
  553. theLuck = random.randint(1, 5)
  554. if theLuck == 1:
  555. DGText.printScan(DGText.action + 'You knock on the door and ask to enter...')
  556. time.sleep(2)
  557. DGText.printScan(DGText.action + "Nobody responds...")
  558. time.sleep(0.8)
  559. DGText.printScan(DGText.action + "As you begin to walk away, you hear a slight hissing sound")
  560. time.sleep(0.8)
  561. DGText.printScan(DGText.rip + "A snake is trying to bite you!\n")
  562. time.sleep(0.8)
  563. DGCombat.combat("Snake", 20, 5, 15)
  564. else:
  565. DGText.printScan(DGText.action + 'You knock on the door and ask to enter...')
  566. time.sleep(2)
  567. # DGText.printScan(randomDialog.store(randomDialog))
  568. DGText.printScan(DGText.quote + 'Greetings! This place is in ruins however,'
  569. ' I was able to setup a small store from the remains!"')
  570. time.sleep(0.8)
  571. openStore()
  572. else:
  573. DGText.printScan(DGText.action + "This seems too risky... you prepare to leave...\n")
  574. elif selection == "randomFight":
  575. DGText.printScan(DGText.action + "You hear a movement -- you freeze")
  576. time.sleep(0.6)
  577. DGText.printScan(DGText.action + "Someone is trying to attack you,")
  578. time.sleep(0.6)
  579. DGText.printScan(DGText.action + "It's too late to avoid a fight now!\n")
  580. time.sleep(0.6)
  581. randomEnemy()
  582. elif selection == "none":
  583. DGText.printScan(action + "You find absolutely nothing in this room...\n")
  584. elif selection == "bombTrap":
  585. DGText.printScan(action + "It is odly quiet here... you begin to look around... \n")
  586. time.sleep(2)
  587. bombTrapScene()
  588. elif selection == "wizardThatWantsToKillYou":
  589. #TODO: Finish this!
  590. DGText.printScan(DGText.quote + 'You. You have the information you need.\n'
  591. '')
  592. pass
  593. elif selection == "treasure":
  594. DGText.printScan(DGText.action + "A massive Vault stands in this room.")
  595. time.sleep(1)
  596. DGText.printScan(DGText.action + "Something useful might be in it...")
  597. time.sleep(1)
  598. DGText.printScan(DGText.action + "Perhaps you could try break into it...\n")
  599. time.sleep(1)
  600. questions = [
  601. {
  602. 'type': 'confirm',
  603. 'name': 'promptChoice',
  604. 'message': 'Will you try break into the vault?',
  605. }
  606. ]
  607. print(Style.RESET_ALL)
  608. theAnswer = prompt(questions)
  609. theDecision = theAnswer['promptChoice']
  610. if theDecision is False:
  611. print("")
  612. DGText.printScan(DGText.action + "You think this is too risky and proceed to move on.\n")
  613. else:
  614. Scene.hasVault = True
  615. openVault()
  616. Scene.hasVault = False
  617. elif selection == "unknownCrate":
  618. global DGPlayer
  619. DGText.printScan(DGText.action + "You find a mysterious crate...")
  620. questions = [
  621. {
  622. 'type': 'confirm',
  623. 'name': 'promptChoice',
  624. 'message': 'Will you open it?',
  625. }
  626. ]
  627. print(Style.RESET_ALL)
  628. theAnswer = prompt(questions)
  629. theDecision = theAnswer['promptChoice']
  630. if theDecision is False:
  631. print("")
  632. DGText.printScan(DGText.action + "You think this is too risky and proceed to move on.\n")
  633. else:
  634. areYaLucky = random.randint(1, 5)
  635. if areYaLucky == 1:
  636. # You get free loot
  637. lootGoodies = ["Stone sword", "Iron armour"]
  638. chosenGoodies = random.choice(lootGoodies)
  639. DGText.printScan(DGText.success + "You open the chest and find {item}!"
  640. .format(item=chosenGoodies))
  641. if chosenGoodies == "Stone sword":
  642. if DGPlayer.Inventory.sword >= 3:
  643. DGText.printScan(error + "You already have this item!\n")
  644. else:
  645. DGPlayer.Inventory.sword = 3
  646. DGPlayer.Inventory.damage = 1.7
  647. elif chosenGoodies == "Iron armour":
  648. if DGPlayer.Inventory.armour >= 2:
  649. DGText.printScan(error + "You already have this item!\n")
  650. else:
  651. DGPlayer.Inventory.armour = 2
  652. DGPlayer.Inventory.absorbtion = 0.6
  653. elif areYaLucky == 2:
  654. # You get free gold
  655. DGText.printScan(DGText.success + "You open the chest and you find free gold!")
  656. DGMain.addCoins(random.randint(100, 120))
  657. elif areYaLucky == 3:
  658. # You get nothing
  659. DGText.printScan(DGText.rip + "You open the chest and find nothing.")
  660. DGText.printScan(DGText.action + "You move on...\n")
  661. else:
  662. # It's a bomb!
  663. DGText.printScan(DGText.action + "You open the chest and find nothing.")
  664. DGText.printScan(DGText.action + "You hear a sound...")
  665. bombTrapScene()
  666. events = removeFromList(events, selection)
  667. else:
  668. DGText.printScan("There are no more unvisited events left!")
  669. def openVault():
  670. if Scene.hasVault == True:
  671. theLuck = random.randint(1, 3)
  672. if theLuck == 1:
  673. DGText.printScan(DGText.action + "You spent several minutes trying to unlock the vault...")
  674. time.sleep(2)
  675. DGText.printScan(DGText.success + "You somehow unlock it!\n")
  676. time.sleep(0.6)
  677. DGText.printScan(DGText.action + "You walk into the vault but you are"
  678. " disappointed as it looks like someone has cleared out"
  679. " all the gold.\n")
  680. time.sleep(1)
  681. elif theLuck == 2:
  682. DGText.printScan(DGText.action + "You spent several minutes trying to unlock the vault...")
  683. time.sleep(2)
  684. DGText.printScan(DGText.success + "You somehow unlock it!\n")
  685. time.sleep(0.6)
  686. DGText.printScan(DGText.success + "You walk into the vault and you find"
  687. " hundreds of coins! You pick up as much as you can...")
  688. DGMain.addCoins(50)
  689. elif theLuck == 3:
  690. DGText.printScan(DGText.action + "You spent several minutes trying to unlock the vault...")
  691. time.sleep(2)
  692. DGText.printScan(DGText.action + "You seem to be out of luck, however"
  693. " you've been spotted!\n")
  694. time.sleep(0.6)
  695. DGText.printScan(DGText.quote + 'YOU! STOP RIGHT THERE! YOU THIEF!"')
  696. DGText.printScan(Style.BRIGHT + "The Money Grinch shouted.\n")
  697. time.sleep(0.6)
  698. DGCombat.combat("Money Grinch", 30, 1, 30)
  699. else:
  700. DGText.printScan("There is no vault in this room...")
  701. def initStore():
  702. global Scene
  703. storeOptions = CSSOptions.copy()
  704. i = 0
  705. while i < 3:
  706. i += 1
  707. theChosenOne = random.choice(storeOptions)
  708. Scene.storeSelected.append(theChosenOne)
  709. storeOptions = removeFromList(storeOptions, theChosenOne)
  710. class Enemy:
  711. def __init__(self, name, health, minDamage, maxDamage):
  712. self.health = health
  713. self.name = name
  714. self.minDamage = minDamage
  715. self.maxDamage = maxDamage
  716. def takeDamage(self, damage):
  717. self.health -= damage
  718. if (self.health <= 0):
  719. self.die()
  720. def die(self):
  721. del self
  722. def startBattle(self):
  723. DGCombat.combat(self.name, self.health, self.minDamage, self.maxDamage)
  724. def randomEnemy():
  725. # [Name, Health, Enemy Minimum Damage, Enemy Maximum Damage]
  726. # enemyName, enemyHealth, enemyMinDamage, enemyMaxDamage
  727. # names = [["Unidentified", 25, 5, 10], ["Wizard", 40, 10, 20],
  728. # ["Giant Spider", 25, 5, 15], ["Bob", 100, 1, 1]]
  729. enemies = [Enemy("Unidentified", 25, 5, 10), Enemy("Wizard", 40, 7, 15),
  730. Enemy("Dark Wizard", 5, 25, 40), Enemy("Small Spider", 10, 4, 7)]
  731. enemy = random.choice(enemies)
  732. enemy.startBattle()
  733. #combat(decision[0], decision[1], decision[2], decision[3])
  734. def lookAround():
  735. DGText.printScan(Scene.description + "\n")
  736. def pickCoins():
  737. global Scene
  738. if Scene.hasCoins == True:
  739. amount = random.randint(10, 12)
  740. DGText.printScan(action + DGDialog.randomDialog.collectCoins())
  741. time.sleep(0.8)
  742. DGMain.addCoins(amount)
  743. Scene.hasCoins = False
  744. else:
  745. DGText.printScan(error + "There are no coins to pick up! \n")
  746. def skipIntro():
  747. Scene.current = 3
  748. endThreads()
  749. DGMain.playSound("Music/quest.ogg", True)
  750. DGMain.addCoins(50)
  751. global DGPlayer
  752. Scene.surroundingsLit = True
  753. DGPlayer.Inventory.basicHealingPotion = DGPlayer.Inventory.basicHealingPotion + 1
  754. DGPlayer.Inventory.damage = 1.2
  755. DGPlayer.Inventory.sword = 1
  756. quest.add("Obtain the Great Stone of Knowledge.")
  757. def useSticks():
  758. # i'm gonna make this interesting and do something at some point.
  759. DGText.printScan(info + "These don't seem to do anything right now...\n")
  760. def search():
  761. # i'm gonna make this interesting and do something at some point.
  762. if Scene.hasStore:
  763. DGText.printScan("This room has a store.\n")
  764. if Scene.hasCoins:
  765. DGText.printScan("There are some coins nearby...\n")
  766. else:
  767. DGText.printScan("You find nothing that interests you,\nI'd be better to"
  768. " move on...\n")
  769. def listen():
  770. # i'm gonna make this interesting and do something at some point.
  771. # room specific dialog here maybe...
  772. DGText.printScan("It's extremely quiet, small drops of water reverb around the room...\n")
  773. def endScreen():
  774. # print("╔════════════════════════════════════════════╗")
  775. # print("║ {nameeeee} ║".format(nameeeee=(Style.BRIGHT + Fore.BLUE + "DungeonCli" + Style.RESET_ALL)))
  776. # print("╠════════════════════════════════════════════╣")
  777. # print("║ ║")
  778. # print("║ The classic command line experience ║")
  779. # print("║ ║")
  780. # print("║ Made by some awesome people at ║")
  781. # print("║ pavela.net ║")
  782. # print("║ ║")
  783. # print("╚════════════════════════════════════════════╝")
  784. try:
  785. width = int(os.get_terminal_size().columns)
  786. except:
  787. width = 54
  788. a = int((width - 10) / 2)
  789. b = int(width + 10)
  790. print("".center(a,'-') + Style.BRIGHT + Fore.BLUE + "DungeonCli" + Style.RESET_ALL + "".center(a,'-'))
  791. print(Style.DIM + Fore.WHITE + version.center(width,' ') + Style.RESET_ALL)
  792. print(" ")
  793. print("Simulating the classic command line experience.".center(width,' '))
  794. print(" ")
  795. print("Made by the awesome DungeonCli team!".center(width,' '))
  796. print(("Join the discord! " + Fore.CYAN + "https://discord.gg/eAUqKKe" + Style.RESET_ALL).center(b,' '))
  797. print(" ")
  798. print((Fore.CYAN + "http://pavela.net:3000/Daniel/DungeonCli" + Style.RESET_ALL).center(b - 1,' '))
  799. print(" ")
  800. print("-".center(width,'-'))
  801. print(" ")
  802. DGMain.EndScreen = endScreen # overwrite end screen.
  803. # THIS IS AN EXAMPLE. FEEL FREE TO CHANGE IT!
  804. def creditScreen():
  805. try:
  806. width = int(os.get_terminal_size().columns)
  807. except:
  808. width = 54
  809. a = int((width - 10) / 2)
  810. b = int(width + 10)
  811. print("".center(a,'-') + Style.BRIGHT + Fore.BLUE + "DungeonCli" + Style.RESET_ALL + "".center(a,'-'))
  812. print(Style.DIM + Fore.WHITE + version.center(width,' ') + Style.RESET_ALL)
  813. DGText.printScan(" ")
  814. DGText.printScan("Simulating the classic command line experience.".center(width,' '))
  815. DGText.printScan(" ")
  816. DGText.printScan("Made by the awesome DungeonCli team!".center(width,' '))
  817. time.sleep(1)
  818. print("----".center(width, ' '))
  819. DGText.printScan("Main Programming - Daniel Pavela (Daniel071)".center(width,' '))
  820. DGText.printScan("Main Programming - Ethan \"Xenthio\" Cardwell".center(width,' '))
  821. DGText.printScan("General Programming - Mega27 (MCT32)".center(width,' '))
  822. DGText.printScan("General Programming - Ezray ".center(width,' '))
  823. DGText.printScan("Story - Daniel Pavela (Daniel071)".center(width,' '))
  824. DGText.printScan("Story - Ethan \"Xenthio\" Cardwell".center(width,' '))
  825. DGText.printScan("Sound effects - Ethan \"Xenthio\" Cardwell".center(width,' '))
  826. DGText.printScan("Music - Sine".center(width,' '))
  827. DGText.printScan("Music - AsianPotato77".center(width,' '))
  828. DGText.printScan("Testing - DenidollarSign - Helped bug test the game".center(width,' '))
  829. DGText.printScan("Testing - MuffintehCustodian - Helped bug test the game".center(width,' '))
  830. print("----".center(width, ' '))
  831. DGText.printScan("Developers Note".center(width,' '))
  832. DGText.printScan("Thanks so much Daniel for letting me help on this project!".center(width,' '))
  833. DGText.printScan("it was a blast to make. a great way for me to get back into python".center(width,' '))
  834. DGText.printScan("(I still prefer swift hahaha)".center(width,' '))
  835. DGText.printScan("Thank you so much - Ethan".center(width,' '))
  836. time.sleep(1)
  837. print("----".center(width, ' '))
  838. #DGText.printScan("Self Promotion from Sine:".center(width,' '))
  839. #DGText.printScan(("Youtube: " + Fore.CYAN + "https://www.youtube.com/channel/UCAK1pG_qcgqJd9d7BnayRtg" +
  840. #Style.RESET_ALL).center(b - 1,' ')) # SELF PROMO LOOLLL
  841. #DGText.printScan("Self Promotion from AsianPotato77:".center(b - 1,' '))
  842. #DGText.printScan(("SoundCloud:" + Fore.CYAN + "https://soundcloud.com/s-z-174676229").center(b - 1,' ') + Style.RESET_ALL)
  843. # STOP THE SELF PROMOTIONS! IT LOOKS DUMB! ALSO IM GONNA DO THE STORY CHANGE SOON I KEEP FORGETTING!!
  844. # Daniel - The artists made the song and I think if people are interested
  845. # Daniel - in listening to their music they can visit it,
  846. # Daniel - Also why are we talking in comments?
  847. print("-".center(width,'-'))
  848. DGText.printScan(" ")
  849. time.sleep(1)
  850. def nextScene():
  851. global Scene
  852. if Scene.canProgress == True:
  853. Scene.hasStore = False
  854. Scene.current = Scene.current + 1
  855. start()
  856. else:
  857. DGText.printScan("Progress through where? there are no visible exits!")
  858. DGText.printScan(hint + "maybe try 'look' and see what you find...)\n" + Style.RESET_ALL)
  859. def main():
  860. global DGPlayer
  861. global DGSave
  862. global tempProgressCommand
  863. command = input(DGText.askPrompt + "[Action] " + Style.RESET_ALL)
  864. if command in tempProgressCommand and command != "nil":
  865. richPrecense.present(Scene.current)
  866. tempProgressCommand = ["nil"]
  867. nextScene()
  868. elif command in ("check money", "check coins", "coins", "money", "c"):
  869. checkCoins()
  870. elif command in ("open inventory", "open inv", "inventory", "inv", "i", "check inventory", "check inv", "pockets", "check pocket", "check pockets", "search pockets", "search pocket", "open pockets", "open pocket", "look in pocket", "look in pockets"):
  871. openInventory()
  872. elif command in ("use match", "strike match", "match", "light match", "use matches", "matches", "m"):
  873. useMatch()
  874. elif command in ("h", "help", "umm", "asdfghjkl", "qwertyuiop"):
  875. DGText.printScan(Fore.BLUE + Style.BRIGHT + "Thanks for testing DungeonCli!")
  876. DGText.printScan(Fore.GREEN + "Here are some common commands:")
  877. DGText.printScan(Style.RESET_ALL + "\n--------\n" + Style.BRIGHT)
  878. DGText.printScan(Fore.BLUE + "hp: " + Fore.WHITE + "Checks your current health")
  879. DGText.printScan(Fore.BLUE + "coins: " + Fore.WHITE + "Checks your current balance")
  880. DGText.printScan(Fore.BLUE + "start: " + Fore.WHITE + "Proceeds to next scene")
  881. DGText.printScan(Fore.BLUE + "inventory: " + Fore.WHITE + "Shows your stats in inventory")
  882. DGText.printScan(Fore.BLUE + "potion: " + Fore.WHITE + "Lets you use a healing potion")
  883. DGText.printScan(Fore.BLUE + "hp: " + Fore.WHITE + "Checks your current health")
  884. DGText.printScan(Fore.BLUE + "quests: " + Fore.WHITE + "Shows your current quests")
  885. DGText.printScan(Fore.BLUE + "credits: " + Fore.WHITE + "Info about the developers")
  886. DGText.printScan(Fore.BLUE + "about: " + Fore.WHITE + "About the game")
  887. DGText.printScan(Style.RESET_ALL + "\n--------\n" + Style.BRIGHT)
  888. elif command in ("e", "exit", "close", "alt-f4"):
  889. DGExit()
  890. elif command in ("hp", "health", "health points"):
  891. DGMain.hpCheck()
  892. elif command in ("goto shop", "goto store", "store", "shop"):
  893. openStore()
  894. elif command in ("s", "start", "next", "proceed", "next room", "forth", "enter door", "go through door", "n"):
  895. if tempProgressCommand[0] == "nil":
  896. richPrecense.present(Scene.current)
  897. nextScene()
  898. else:
  899. # FIXME: This may be confusing, but I cant come up with anything better
  900. DGText.printScan(DGText.error + "Try something else...\n")
  901. elif command in ("listen", "listen for sounds"):
  902. listen()
  903. elif command in ("search around", "search", "look for items", "search for items"):
  904. search()
  905. elif command in ("l", "look around", "look", "observe", "observe surroundings", "look at surroundings"):
  906. lookAround()
  907. elif command in ("pickup loose brick", "use loose brick", "use brick", "pickup brick", "brick"):
  908. useBrick()
  909. elif command in ("use sticks to light fire", "light fire with sticks"):
  910. DGText.printScan(error + "You cannot do that! The sticks are too wet...\n")
  911. elif command in ("use sticks", "sticks"):
  912. useSticks()
  913. elif command in ("cl_event", "plsevent"):
  914. # NOTE: This is for only debugging!
  915. if passwordPrompt() == "granted":
  916. randomEvent()
  917. elif command in ("cl_battle", "plsbattle"):
  918. # NOTE: This is for only debugging!
  919. if passwordPrompt() == "granted":
  920. randomEnemy()
  921. elif command in ("version", "ver"):
  922. DGText.printScan(version)
  923. elif command in ("pickup coins", "pick up coins", "pick coins"):
  924. pickCoins()
  925. elif command in ("heal", "potion"):
  926. DGPotion.healingPotion()
  927. elif command in ("cl_store", "plsstore"):
  928. # NOTE: This is for only debugging!
  929. if passwordPrompt() == "granted":
  930. openStore()
  931. elif command in ("cl_rich", "cl_addcoins", "plscoins"):
  932. DGText.printScan("The money grinch steps out of the shadows\n")
  933. time.sleep(1)
  934. DGText.printScan(quote + "In need of coins, eh? I mean i could let you have some of my precious coins, but ya gotta know the secret code.\"")
  935. DGText.printScan(" he said grouchingly\n")
  936. time.sleep(2)
  937. DGText.printScan(quote + "Go ahead. I'm waiting...\" \n")
  938. time.sleep(1)
  939. if passwordPrompt() == "granted":
  940. DGMain.addCoins(2000)
  941. elif command in ("cl_skipintro", "plsnointro"):
  942. if passwordPrompt() == "granted":
  943. skipIntro()
  944. elif command in ("save", "save game"):
  945. DGSave.save()
  946. elif command in ("load", "load game"):
  947. DGSave.load()
  948. elif command in ("plsdie", "plskill"):
  949. if passwordPrompt() == "granted":
  950. DGMain.gameover()
  951. elif command in ("o", "options"):
  952. options()
  953. elif command in ("create torch", "make torch"):
  954. DGText.printScan(error + "You cannot do that! The sticks are too wet...\n")
  955. elif command in ("about", "us", "about us", "info"):
  956. endScreen()
  957. elif command in ("credits", "contributers", "people"):
  958. creditScreen()
  959. elif command in ("open the vault", "vault", "open vault", "use vault", "use the vault" "break in", "try to break in"):
  960. pass
  961. # openVault()
  962. elif command in ("plsop", "please make me OP"):
  963. if passwordPrompt() == "granted":
  964. DGMain.addCoins(1000)
  965. DGPlayer.Inventory.basicHealingPotion = 50
  966. DGPlayer.Inventory.advancedHealingPotion = 50
  967. DGPlayer.Inventory.poisonPotion = 50
  968. DGPlayer.Inventory.sword = 2
  969. DGPlayer.Inventory.damage = 1000.0
  970. DGPlayer.Inventory.armour = 1
  971. DGPlayer.Inventory.absorbtion = 0.01
  972. elif command in ("cls", "clear", "clear screen"):
  973. DGClear()
  974. elif command in ("quest", "check quests", "quests"):
  975. quest.list()
  976. elif command in ("boss battle", "plsboss"):
  977. if passwordPrompt() == "granted":
  978. bossBattle()
  979. elif command in ("success", "plswin"):
  980. if passwordPrompt() == "granted":
  981. bossSuccess()
  982. elif command in ("chat", "multiplayer"):
  983. multiplayer.runMe()
  984. elif command in ("debug", "devDebug"):
  985. print("Current scene:", DGScene.current)
  986. print("Temp Progress Command:", tempProgressCommand)
  987. elif command in ("update", "new"):
  988. DGUpdate.update()
  989. else:
  990. invalidCommand()
  991. operatingsystem = detect_system()
  992. if __name__ == '__main__':
  993. richPrecense.init()
  994. # Play moosic
  995. try:
  996. DGMain.playSound("Music/intro.ogg", True)
  997. except:
  998. DGClear()
  999. DGText.printScan(DGText.error + "You need to have a ffmpeg installed for the music to work!")
  1000. askLoop = True
  1001. questions = [
  1002. {
  1003. 'type': 'list',
  1004. 'name': 'userChoice',
  1005. 'choices': ['Install FFMPEG',
  1006. 'Disable Music',
  1007. 'Exit'],
  1008. 'message': 'What would you like to do?',
  1009. }
  1010. ]
  1011. while askLoop:
  1012. print(Style.RESET_ALL)
  1013. theAnswer = prompt(questions)
  1014. theValue = theAnswer['userChoice']
  1015. if theValue == "Install FFMPEG":
  1016. if operatingsystem == 'windows':
  1017. DGText.printScan("NOTE: This installation requires Administrative priviledges"
  1018. " because it needs to add ffmpeg to the path!\n")
  1019. print(DGText.loading + "Creating directories - 1/3..." + Style.RESET_ALL)
  1020. os.system('md "%userprofile%\\ffmpeg')
  1021. print(" ")
  1022. print(DGText.loading + "Downloading FFMPEG - 2/3..." + Style.RESET_ALL)
  1023. print(DGText.action + "File 1 out of 3..." + Style.RESET_ALL)
  1024. os.system('certutil.exe -urlcache -split -f "https://github.com/daniel071/ffmpeg-builds/releases/download/v1.0.0/ffmpeg.exe" "%userprofile%\\ffmpeg\\ffmpeg.exe"')
  1025. print(" ")
  1026. print(DGText.action + "File 2 out of 3..." + Style.RESET_ALL)
  1027. os.system('certutil.exe -urlcache -split -f "https://github.com/daniel071/ffmpeg-builds/releases/download/v1.0.0/ffplay.exe" "%userprofile%\\ffmpeg\\ffplay.exe"')
  1028. print(" ")
  1029. print(DGText.action + "File 3 out of 3..." + Style.RESET_ALL)
  1030. os.system('certutil.exe -urlcache -split -f "https://github.com/daniel071/ffmpeg-builds/releases/download/v1.0.0/ffprobe.exe" "%userprofile%\\ffmpeg\\ffprobe.exe"')
  1031. print(" ")
  1032. print(DGText.loading + "Adding FFMPEG to Path - 3/3..." + Style.RESET_ALL)
  1033. print(DGText.loading + "Installing dependencies..." + Style.RESET_ALL)
  1034. os.system('python -m pip install pywin32')
  1035. print(DGText.loading + "Adding to path..." + Style.RESET_ALL)
  1036. import win32com.shell.shell as shell
  1037. commands = 'setx path "%path%;%userprofile%\\ffmpeg\\"'
  1038. shell.ShellExecuteEx(lpVerb='runas', lpFile='cmd.exe', lpParameters='/c '+commands)
  1039. DGText.printScan(DGText.success + "Successfully installed FFMPEG!")
  1040. DGText.printScan(Style.BRIGHT + Fore.BLUE + "NOTE: You must restart the command prompt"
  1041. " so that the path would update!")
  1042. else:
  1043. DGText.printScan(DGText.error + "This script is not made for unix systems,"
  1044. " if you have issues with music, please open an issue on gitea.")
  1045. time.sleep(1)
  1046. DGText.printScan(DGText.hint + "MacOS and most linux distros have FFMPEG pre-installed.\n")
  1047. elif theValue == "Disable Music":
  1048. DGMain.playMusic = False
  1049. askLoop = False
  1050. DGText.printScan(DGText.success + "Successfully disabled music.")
  1051. elif theValue == "Exit":
  1052. askLoop = False
  1053. DGExit()
  1054. os._exit(1)
  1055. print("\r")
  1056. DGClear()
  1057. try:
  1058. width = int(os.get_terminal_size().columns)
  1059. except:
  1060. width = 54
  1061. a = int((width - 10) / 2)
  1062. print("".center(a,'-') + Style.BRIGHT + Fore.BLUE + "DungeonCli" + Style.RESET_ALL + "".center(a,'-'))
  1063. print("\r")
  1064. # Introduce the user:
  1065. DGText.printScan(Style.RESET_ALL + Style.BRIGHT + "Welcome to " + Fore.BLUE + "DungeonCli" + Style.RESET_ALL + " ")
  1066. DGText.printScan(Style.DIM + Fore.WHITE + "==> " + version + "" + Style.RESET_ALL)
  1067. print("")
  1068. DGText.printScan("Type 'h' for help or 's' to start!")
  1069. # Run those functions here:
  1070. try:
  1071. while mainLoop == 1:
  1072. main()
  1073. except:
  1074. DGText.printScan(DGText.error + "An error has occured!")
  1075. print(Fore.WHITE)
  1076. time.sleep(0.3)
  1077. DGText.printScan("Please copy this error and open up a new issue on Gitea!")
  1078. time.sleep(0.3)
  1079. DGText.printScan(Fore.BLUE + "Here: http://pavela.net:3000/Daniel/DungeonCli")
  1080. time.sleep(0.3)
  1081. print(Style.RESET_ALL + Fore.RED)
  1082. raise
  1083. # JOIN the discord server! https://discord.gg/eAUqKKe