2021-06-11 19:24:52 +02:00
|
|
|
// MassBuilderSaveTool
|
|
|
|
// Copyright (C) 2021 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 <cstring>
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
#include <Corrade/Containers/Array.h>
|
|
|
|
#include <Corrade/Utility/Directory.h>
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
#include "../UESaveFile/Types/ArrayProperty.h"
|
|
|
|
#include "../UESaveFile/Types/ColourStructProperty.h"
|
|
|
|
#include "../UESaveFile/Types/FloatProperty.h"
|
|
|
|
#include "../UESaveFile/Types/GenericStructProperty.h"
|
|
|
|
#include "../UESaveFile/Types/IntProperty.h"
|
|
|
|
#include "../UESaveFile/Types/StringProperty.h"
|
2021-08-19 20:33:59 +02:00
|
|
|
|
2021-06-11 19:24:52 +02:00
|
|
|
#include "Mass.h"
|
|
|
|
|
|
|
|
std::string Mass::_lastError;
|
|
|
|
|
2021-08-19 20:33:59 +02:00
|
|
|
Mass::Mass(const std::string& path) {
|
|
|
|
_folder = Utility::Directory::path(path);
|
|
|
|
_filename = Utility::Directory::filename(path);
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-08-28 20:20:09 +02:00
|
|
|
refreshValues();
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Mass::lastError() -> std::string const& {
|
|
|
|
return _lastError;
|
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::getNameFromFile(const std::string& path) -> Containers::Optional<std::string> {
|
2021-08-19 20:33:59 +02:00
|
|
|
if(!Utility::Directory::exists(path)) {
|
|
|
|
_lastError = path + " couldn't be found.";
|
2021-09-27 17:52:47 +02:00
|
|
|
return Containers::NullOpt;
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
UESaveFile mass{path};
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
if(!mass.valid()) {
|
|
|
|
_lastError = "The unit file seems to be corrupt.";
|
|
|
|
return Containers::NullOpt;
|
|
|
|
}
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto unit_data = mass.at<GenericStructProperty>("UnitData");
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
if(!unit_data) {
|
|
|
|
_lastError = "Couldn't find unit data in the file.";
|
|
|
|
return Containers::NullOpt;
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
|
|
|
|
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB");
|
|
|
|
|
|
|
|
if(!name_prop) {
|
|
|
|
_lastError = "Couldn't find the name in the file.";
|
|
|
|
return Containers::NullOpt;
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
return name_prop->value;
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
|
|
|
|
2021-08-28 20:20:09 +02:00
|
|
|
void Mass::refreshValues() {
|
2021-09-27 17:52:47 +02:00
|
|
|
if(!Utility::Directory::exists(Utility::Directory::join(_folder, _filename))) {
|
|
|
|
_state = State::Empty;
|
2021-08-28 20:21:13 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
if(!_mass) {
|
|
|
|
_mass.emplace(Utility::Directory::join(_folder, _filename));
|
|
|
|
if(!_mass->valid()) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return;
|
|
|
|
}
|
2021-08-28 20:21:13 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
else {
|
|
|
|
if(!_mass->reloadData()) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return;
|
|
|
|
}
|
2021-08-28 20:21:13 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
2021-08-28 20:21:13 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
if(!unit_data) {
|
2021-08-28 20:21:13 +02:00
|
|
|
_state = State::Invalid;
|
2021-09-27 17:52:47 +02:00
|
|
|
return;
|
2021-08-28 20:21:13 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB");
|
2021-08-19 20:33:59 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
if(!name_prop) {
|
|
|
|
_name = Containers::NullOpt;
|
|
|
|
_state = State::Invalid;
|
|
|
|
return;
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
_name = name_prop->value;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
|
|
|
{
|
2021-09-27 17:52:47 +02:00
|
|
|
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653");
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
if(!frame_prop) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return;
|
|
|
|
}
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto length = frame_prop->at<FloatProperty>("NeckLength_6_ED6AF79849C27CD1A9D523A09E2BFE58");
|
|
|
|
_frame.joints.neck = (length ? length->value : 0.0f);
|
|
|
|
length = frame_prop->at<FloatProperty>("BodyLength_7_C16287754CBA96C93BAE36A5C154996A");
|
|
|
|
_frame.joints.body = (length ? length->value : 0.0f);
|
|
|
|
length = frame_prop->at<FloatProperty>("ShoulderLength_8_220EDF304F1C1226F0D8D39117FB3883");
|
|
|
|
_frame.joints.shoulders = (length ? length->value : 0.0f);
|
|
|
|
length = frame_prop->at<FloatProperty>("HipLength_14_02AEEEAC4376087B9C51F0AA7CC92818");
|
|
|
|
_frame.joints.hips = (length ? length->value : 0.0f);
|
|
|
|
length = frame_prop->at<FloatProperty>("ArmUpperLength_10_249FDA3E4F3B399E7B9E5C9B7C765EAE");
|
|
|
|
_frame.joints.upperArms = (length ? length->value : 0.0f);
|
|
|
|
length = frame_prop->at<FloatProperty>("ArmLowerLength_12_ACD0F02745C28882619376926292FB36");
|
|
|
|
_frame.joints.lowerArms = (length ? length->value : 0.0f);
|
|
|
|
length = frame_prop->at<FloatProperty>("LegUpperLength_16_A7C4C71249A3776F7A543D96819C0C61");
|
|
|
|
_frame.joints.upperLegs = (length ? length->value : 0.0f);
|
|
|
|
length = frame_prop->at<FloatProperty>("LegLowerLength_18_D2DF39964EA0F2A2129D0491B08A032F");
|
|
|
|
_frame.joints.lowerLegs = (length ? length->value : 0.0f);
|
|
|
|
|
|
|
|
auto frame_styles = frame_prop->at<ArrayProperty>("Styles_32_00A3B3284B37F1E7819458844A20EB48");
|
|
|
|
|
|
|
|
if(!frame_styles) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return;
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
for(UnsignedInt i = 0; i < 4; i++) {
|
|
|
|
_frame.styles[i] = frame_styles->at<IntProperty>(i)->value;
|
|
|
|
}
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto eye_flare_prop = frame_prop->at<ColourStructProperty>("EyeFlareColor_36_AF79999C40FCA0E88A2F9A84488A38CA");
|
|
|
|
if(!eye_flare_prop) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return;
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
|
|
|
|
_frame.eyeFlare = Color4{eye_flare_prop->r, eye_flare_prop->g, eye_flare_prop->b, eye_flare_prop->a};
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto account_prop = _mass->at<StringProperty>("Account");
|
|
|
|
if(!account_prop) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return;
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
_steamId = account_prop->value;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
_state = State::Valid;
|
2021-06-11 19:24:52 +02:00
|
|
|
}
|
2021-08-28 20:20:09 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::filename() -> std::string const&{
|
|
|
|
return _filename;
|
|
|
|
}
|
2021-08-28 20:20:09 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::name() -> Containers::Optional<std::string> const& {
|
|
|
|
return _name;
|
|
|
|
}
|
2021-08-28 20:20:09 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::setName(std::string new_name) -> bool {
|
|
|
|
_name = new_name;
|
2021-08-28 20:20:09 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
2021-08-28 20:20:09 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
if(!unit_data) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
2021-08-28 20:20:09 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
|
|
|
|
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB");
|
|
|
|
|
|
|
|
if(!name_prop) {
|
2021-08-28 20:20:09 +02:00
|
|
|
_state = State::Invalid;
|
2021-09-27 17:52:47 +02:00
|
|
|
return false;
|
2021-08-28 20:20:09 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
|
|
|
|
name_prop->value = std::move(new_name);
|
|
|
|
|
|
|
|
return _mass->saveToFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Mass::state() -> State {
|
|
|
|
return _state;
|
2021-08-28 20:20:09 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::dirty() const -> bool {
|
|
|
|
return _dirty;
|
|
|
|
}
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
void Mass::setDirty(bool dirty) {
|
|
|
|
_dirty = dirty;
|
|
|
|
}
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::jointSliders() const -> Joints const& {
|
|
|
|
return _frame.joints;
|
|
|
|
}
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::setSliders(Joints joints) -> bool {
|
|
|
|
_frame.joints = joints;
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
|
|
|
|
|
|
|
if(!unit_data) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653");
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
if(!frame_prop) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto length = frame_prop->at<FloatProperty>("NeckLength_6_ED6AF79849C27CD1A9D523A09E2BFE58");
|
|
|
|
if(!length && _frame.joints.neck != 0.0f) {
|
|
|
|
length = new FloatProperty;
|
|
|
|
auto length_prop = FloatProperty::ptr{length};
|
|
|
|
length_prop->name.emplace("NeckLength_6_ED6AF79849C27CD1A9D523A09E2BFE58");
|
|
|
|
arrayAppend(frame_prop->properties, std::move(length_prop));
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
if(length) {
|
|
|
|
length->value = _frame.joints.neck;
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
length = frame_prop->at<FloatProperty>("BodyLength_7_C16287754CBA96C93BAE36A5C154996A");
|
|
|
|
if(!length && _frame.joints.body != 0.0f) {
|
|
|
|
length = new FloatProperty;
|
|
|
|
auto length_prop = FloatProperty::ptr{length};
|
|
|
|
length_prop->name.emplace("BodyLength_7_C16287754CBA96C93BAE36A5C154996A");
|
|
|
|
arrayAppend(frame_prop->properties, std::move(length_prop));
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
if(length) {
|
|
|
|
length->value = _frame.joints.body;
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
length = frame_prop->at<FloatProperty>("ShoulderLength_8_220EDF304F1C1226F0D8D39117FB3883");
|
|
|
|
if(!length && _frame.joints.shoulders != 0.0f) {
|
|
|
|
length = new FloatProperty;
|
|
|
|
auto length_prop = FloatProperty::ptr{length};
|
|
|
|
length_prop->name.emplace("ShoulderLength_8_220EDF304F1C1226F0D8D39117FB3883");
|
|
|
|
arrayAppend(frame_prop->properties, std::move(length_prop));
|
|
|
|
}
|
|
|
|
if(length) {
|
|
|
|
length->value = _frame.joints.shoulders;
|
|
|
|
}
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
length = frame_prop->at<FloatProperty>("HipLength_14_02AEEEAC4376087B9C51F0AA7CC92818");
|
|
|
|
if(!length && _frame.joints.hips != 0.0f) {
|
|
|
|
length = new FloatProperty;
|
|
|
|
auto length_prop = FloatProperty::ptr{length};
|
|
|
|
length_prop->name.emplace("HipLength_14_02AEEEAC4376087B9C51F0AA7CC92818");
|
|
|
|
arrayAppend(frame_prop->properties, std::move(length_prop));
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
if(length) {
|
|
|
|
length->value = _frame.joints.hips;
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
length = frame_prop->at<FloatProperty>("ArmUpperLength_10_249FDA3E4F3B399E7B9E5C9B7C765EAE");
|
|
|
|
if(!length && _frame.joints.upperArms != 0.0f) {
|
|
|
|
length = new FloatProperty;
|
|
|
|
auto length_prop = FloatProperty::ptr{length};
|
|
|
|
length_prop->name.emplace("ArmUpperLength_10_249FDA3E4F3B399E7B9E5C9B7C765EAE");
|
|
|
|
arrayAppend(frame_prop->properties, std::move(length_prop));
|
|
|
|
}
|
|
|
|
if(length) {
|
|
|
|
length->value = _frame.joints.upperArms;
|
|
|
|
}
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
length = frame_prop->at<FloatProperty>("ArmLowerLength_12_ACD0F02745C28882619376926292FB36");
|
|
|
|
if(!length && _frame.joints.lowerArms != 0.0f) {
|
|
|
|
length = new FloatProperty;
|
|
|
|
auto length_prop = FloatProperty::ptr{length};
|
|
|
|
length_prop->name.emplace("ArmLowerLength_12_ACD0F02745C28882619376926292FB36");
|
|
|
|
arrayAppend(frame_prop->properties, std::move(length_prop));
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
if(length) {
|
|
|
|
length->value = _frame.joints.lowerArms;
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
length = frame_prop->at<FloatProperty>("LegUpperLength_16_A7C4C71249A3776F7A543D96819C0C61");
|
|
|
|
if(!length && _frame.joints.upperLegs != 0.0f) {
|
|
|
|
length = new FloatProperty;
|
|
|
|
auto length_prop = FloatProperty::ptr{length};
|
|
|
|
length_prop->name.emplace("LegUpperLength_16_A7C4C71249A3776F7A543D96819C0C61");
|
|
|
|
arrayAppend(frame_prop->properties, std::move(length_prop));
|
|
|
|
}
|
|
|
|
if(length) {
|
|
|
|
length->value = _frame.joints.upperLegs;
|
|
|
|
}
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
length = frame_prop->at<FloatProperty>("LegLowerLength_18_D2DF39964EA0F2A2129D0491B08A032F");
|
|
|
|
if(!length && _frame.joints.lowerLegs != 0.0f) {
|
|
|
|
length = new FloatProperty;
|
|
|
|
auto length_prop = FloatProperty::ptr{length};
|
|
|
|
length_prop->name.emplace("LegLowerLength_18_D2DF39964EA0F2A2129D0491B08A032F");
|
|
|
|
arrayAppend(frame_prop->properties, std::move(length_prop));
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
if(length) {
|
|
|
|
length->value = _frame.joints.lowerLegs;
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
return _mass->saveToFile();
|
|
|
|
}
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::frameStyles() -> Containers::StaticArrayView<4, Int> {
|
|
|
|
return _frame.styles;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Mass::setFrameStyle(Int index, Int style_id) -> bool {
|
|
|
|
_frame.styles[index] = style_id;
|
|
|
|
|
|
|
|
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
|
|
|
if(!unit_data) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
|
|
|
|
auto frame = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653");
|
|
|
|
if(!frame) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
|
|
|
|
auto frame_styles = frame->at<ArrayProperty>("Styles_32_00A3B3284B37F1E7819458844A20EB48");
|
|
|
|
if(!frame_styles) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
frame_styles->at<IntProperty>(index)->value = style_id;
|
|
|
|
|
|
|
|
return _mass->saveToFile();
|
2021-09-10 16:13:29 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::eyeFlareColour() const -> const Color4& {
|
|
|
|
return _frame.eyeFlare;
|
|
|
|
}
|
2021-08-28 20:20:09 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::setEyeFlareColour(Color4 new_colour) -> bool {
|
|
|
|
_frame.eyeFlare = new_colour;
|
|
|
|
|
|
|
|
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
|
|
|
if(!unit_data) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
2021-08-28 20:20:09 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto frame = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653");
|
|
|
|
if(!frame) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto eye_flare_prop = frame->at<ColourStructProperty>("EyeFlareColor_36_AF79999C40FCA0E88A2F9A84488A38CA");
|
|
|
|
if(!eye_flare_prop) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
eye_flare_prop->r = new_colour.r();
|
|
|
|
eye_flare_prop->g = new_colour.g();
|
|
|
|
eye_flare_prop->b = new_colour.b();
|
|
|
|
eye_flare_prop->a = new_colour.a();
|
|
|
|
|
|
|
|
return _mass->saveToFile();
|
|
|
|
}
|
2021-08-28 20:20:09 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto Mass::updateSteamId(const std::string& steam_id) -> bool {
|
|
|
|
_steamId = steam_id;
|
2021-08-28 20:20:09 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
|
|
|
if(!unit_data) {
|
|
|
|
_state = State::Invalid;
|
|
|
|
return false;
|
2021-08-28 20:20:09 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
|
|
|
|
auto account_prop = unit_data->at<StringProperty>("Account");
|
|
|
|
if(!account_prop) {
|
2021-08-28 20:20:09 +02:00
|
|
|
_state = State::Invalid;
|
2021-09-27 17:52:47 +02:00
|
|
|
return false;
|
2021-08-28 20:20:09 +02:00
|
|
|
}
|
2021-09-27 17:52:47 +02:00
|
|
|
|
|
|
|
account_prop->value = steam_id;
|
|
|
|
|
|
|
|
return _mass->saveToFile();
|
2021-08-28 20:20:09 +02:00
|
|
|
}
|