90 lines
2.4 KiB
C++
90 lines
2.4 KiB
C++
#pragma once
|
|
|
|
// MassBuilderSaveTool
|
|
// Copyright (C) 2021-2022 Guillaume Jacquemin
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#include <map>
|
|
|
|
#include <Corrade/Containers/String.h>
|
|
#include <Corrade/Containers/StringView.h>
|
|
|
|
#include "../UESaveFile/UESaveFile.h"
|
|
|
|
#include "ResourceIDs.h"
|
|
|
|
using namespace Corrade;
|
|
|
|
enum class ProfileType: std::uint8_t {
|
|
Demo,
|
|
FullGame
|
|
};
|
|
|
|
class Profile {
|
|
public:
|
|
explicit Profile(Containers::StringView path);
|
|
|
|
bool valid() const;
|
|
|
|
auto lastError() const -> Containers::StringView;
|
|
|
|
auto filename() const -> Containers::StringView;
|
|
|
|
ProfileType type() const;
|
|
bool isDemo() const;
|
|
|
|
auto account() const -> Containers::StringView;
|
|
|
|
void refreshValues();
|
|
|
|
auto companyName() const -> Containers::StringView;
|
|
bool renameCompany(Containers::StringView new_name);
|
|
|
|
std::int32_t activeFrameSlot() const;
|
|
|
|
std::int32_t credits() const;
|
|
bool setCredits(std::int32_t credits);
|
|
|
|
std::int32_t storyProgress() const;
|
|
bool setStoryProgress(std::int32_t progress);
|
|
|
|
std::int32_t lastMissionId() const;
|
|
|
|
std::int32_t material(MaterialID id) const;
|
|
bool setMaterial(MaterialID id, std::int32_t amount);
|
|
|
|
private:
|
|
std::int32_t getResource(Containers::StringView container, MaterialID id);
|
|
|
|
Containers::String _filename;
|
|
|
|
ProfileType _type;
|
|
|
|
UESaveFile _profile;
|
|
|
|
Containers::String _name;
|
|
std::int32_t _activeFrameSlot = 0;
|
|
std::int32_t _credits = 0;
|
|
std::int32_t _storyProgress = 0;
|
|
std::int32_t _lastMissionId = 0;
|
|
|
|
std::map<MaterialID, std::int32_t> _materials;
|
|
|
|
Containers::String _account;
|
|
|
|
bool _valid = false;
|
|
Containers::String _lastError;
|
|
};
|