Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import executable,argv
- from os import execl,getcwd,chdir,path,stat,SEEK_END
- from random import randrange as rr
- from random import seed as rs
- from pickle import dump,load
- from re import search
- from inspect import getframeinfo, currentframe
- from locale import setlocale,LC_ALL,getlocale
- from mdl_magic import magic,Colors
- from mdl_herosave import *
- class travel:
- def __init__(self):
- heroStat() #mdl_herosave
- self.heroHealth = heroStat.heroHealth
- self.heroPunch = heroStat.heroPunch
- self.heroCurse = heroStat.heroCurse
- self.heroMeetingUnusually = heroStat.heroMeetingUnusually
- self.heroCurrentLocation = heroStat.heroCurrentLocation
- self.heroLevel = heroStat.heroLevel
- self.heroHelmet = heroStat.heroHelmet
- self.heroArmor = heroStat.heroArmor
- self.heroPants = heroStat.heroPants
- self.heroBoots = heroStat.heroBoots
- self.heroHealthMiddle = heroStat.heroHealthMiddle
- self.heroHealthButtle = heroStat.heroHealthButtle
- self.heroHealthButtleHPP = heroStat.heroHealthButtleHPP
- self.locN = []
- self.locS = []
- self.locE = []
- self.locW = []
- self.north = "module/loc_north.lsv"
- self.south = "module/loc_south.lsv"
- self.east = "module/loc_east.lsv"
- self.west = "module/loc_west.lsv"
- self.debug = []
- self.walk()
- def restart(self):
- python = executable
- execl(python, python, * argv)
- def writeLI(self,fileName,listName, locName,locID,locLVL):
- listName.append((locName,locID,locLVL))
- listName = list(set(listName))
- with open(fileName,"wb") as locFile:
- dump(listName, locFile)
- def readLI(self,fileName):
- with open(fileName,"rb") as locFile:
- self.returnedData = load(locFile)
- def walk(self):
- if ( stat(self.north).st_size == 0 ):
- self.writeLI(self.north,self.locN,"Оборонительный пост 'Старый волк'",1000,1)
- self.writeLI(self.south,self.locS,"Ворота в деревню",2000,1)
- self.writeLI(self.west,self.locW, "Лодочная пристань",3000,1)
- self.writeLI(self.west,self.locW,"Бар 'Пьяная устрица'",3001,1)
- self.writeLI(self.east,self.locE,"Деревня 'Слеза девы'",4000,1)
- self.readLI(self.north)
- #restart()
- setlocale(LC_ALL, '')
- self.debug.append(("sf:full",str(getlocale()) ))
- magic.Clear()
- while ( True ):
- print(self.debug)
- self.readLI(self.north)
- self.readLI(self.south)
- self.readLI(self.west)
- self.readLI(self.east)
- print("\n[ Локация:",self.heroCurrentLocation,"]\n[ Здоровье: (",self.heroHealth,") ]\n[ ? -- Справка ]\n")
- action = input("Ваше действие: ").upper()
- if ( action == "?" ):
- print('''
- \r=======================================
- \r1 - отправиться на север
- \r2 - отправиться на юг
- \r3 - отправиться на восток
- \r4 - отправиться на запад
- \r5 - карта мира
- \r6 - очистить экран
- \r7 - спать (в часах)
- \r8 - открыть инвентарь
- \r9 - статистика
- \r0 - сохраниться
- \rE - выход
- \rD - Debug Menu
- \r=======================================''')
- elif ( action == "1" ):
- print("Отправляемся в северные дали! Выберите одну из локаций: ")
- self.writeLI(self.north,self.locN,"Фаруко",1001,1)
- self.writeLI(self.north,self.locN,"Старый лес",1002,1)
- self.readLI(self.north)
- locFile = self.returnedData
- showLocFile = [ value[0] for value in locFile ]
- for i in range(len(showLocFile)):
- print(i+1,"/",locFile[i][0])
- for j in range(1):
- #print(i+1,"/",locFile[i][0])
- chooseLocation = int(input("\n--------------\nВыбор локации: "))
- self.heroCurrentLocation = locFile[chooseLocation-1][0]
- print(self.heroCurrentLocation)
- elif ( action == "6" ):
- magic.Clear()
- elif ( action == "E" ):
- exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement