import os

import json

from serializable import Serializable

class Saves: #Only partially implemembted- only works for PlayerCharacters

	#Because we want the user to be able to play on whatever world they want with whatever character
	#they want, characters have to be stored independently of everything else
	#We need to implement an aspect of this for things like the map, item locations, npc locations, 
	#And everything that has to do with the world state in a different location.

	@staticmethod
	def store(obj): #Currently only works for player characters
		serialization = obj.serialize()
		if obj.__class__.__name__ == "PlayerCharacter":
			with open(os.path.join("characters", obj.name), 'w') as f:
				json.dump(serialization, f)
		else:
			pass #Needs to be implemented for saving the map and world state

	@staticmethod
	def unstore(name, path): #Currently only works for player characters
		if os.path.isfile(os.path.join(path, name)):
			with open(os.path.join(path, name), 'r') as f:
				saved = json.load(f)
			return Serializable.deserialize(saved)
		return None
@@ -642,16 +642,85 @@
 acter%22:%0A
+%09%09%09if not os.path.isdir(%22characters%22):%0A%09%09%09%09os.makedirs(%22characters%22)%0A
 %09%09%09with 
@@ -764,16 +764,17 @@
 ame), 'w
++
 ') as f:

Fix for non-existent character folder bug