예제 #1
0
def loadProfile(name):
    fileName = roplus.getWorkingDirectory(
    ) + "\\Profiles\\" + name + ".grinder"
    file = open(fileName, "r")
    result = json.loads(file.read())
    file.close()
    return result
예제 #2
0
def getProfiles():
    result = []
    profilesPattern = roplus.getWorkingDirectory() + "\\Profiles"
    for file in os.listdir(profilesPattern):
        if file.endswith(".grinder"):
            result.append(file[:-8])
    return result
예제 #3
0
파일: settings.py 프로젝트: BragiOk/Release
def loadSettings(name):
    try:
        fileName = roplus.getWorkingDirectory() + "\\Settings\\" + name + ".json"
        file = open(fileName, "r")
        result = json.loads(file.read())
        file.close()
        return result
    except Exception:
        return defaultSettings()
예제 #4
0
def reloadCombatModules():
    global LOADED_COMBATS
    LOADED_COMBATS = {}
    dir_path = roplus.getWorkingDirectory() + "\\Combats"
    for file in os.listdir(dir_path):
        if file.endswith(".py") and not file.startswith("__"):
            filePath = os.path.join(dir_path, file)
            mod_name = "Combats." + file
            try:
                combatmod = imp.load_source(mod_name, filePath)
                if combatmod and hasattr(combatmod, "Combat"):
                    try:
                        combat_inst = combatmod.Combat()
                        LOADED_COMBATS[combat_inst.name] = combat_inst
                        roplus.log("Combat script loaded : {0} ({1})".format(
                            combat_inst.name, combat_inst.author))
                    except:
                        roplus.log(
                            "Unable to create Combat() class from file : " +
                            file)
            except:
                roplus.log("Unable to load file : " + file)
예제 #5
0
def saveProfile(profile):
    fileName = roplus.getWorkingDirectory(
    ) + "\\Profiles\\" + profile["name"] + ".grinder"
    file = open(fileName, "w")
    file.write(json.dumps(profile, indent=4))
    file.close()
예제 #6
0
def saveSettings(s, name):
    fileName = roplus.getWorkingDirectory() + "\\Settings\\" + name + ".json"
    file = open(fileName, "w")
    file.write(json.dumps(s, indent=4))
    file.close()