This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
YimMenu/src/services/gta_data/weapon_file.hpp
gir489 6f40a38045
Refactored weapons.bin into weapons.json for extensibility and readability. (#1632)
* Refactored weapons.bin into weapons.json for extensibility and human readability.
Added weapon attachments scraping from the meta files (currently is missing a lot of attachments, more than half, requires RPF reading refactoring to fix.)
Added Ammunation to Self -> Weapons, because it's vital you protect yourself, the patriotic way.

* Fixed weapons.xml not properly populating all the components.
Refactored buttons to use components::button.

* Refactored the Attachments code to implicitly trust that the attachments will be there now.
Added proper versioning to the weapons.json file.
Removed debug logging from gta_data_service.cpp.

* Fixed Ammunation buttons.
Added loading message for the new weapons.json system.
Fixed a bug where two components shared the same name, the user could not select the 2nd component.
Fixed Attachments displaying an attachment from a previous weapon if the user changed weapons.

* Fixed Tint Apply button not using the components::button template.
2023-07-08 00:52:52 +02:00

30 lines
683 B
C++

#pragma once
#include "weapon_item.hpp"
#include "weapon_component.hpp"
namespace big
{
class weapon_file
{
public:
struct version_info
{
std::string m_game_build;
std::string m_online_version;
std::uint32_t m_file_version;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(version_info, m_game_build, m_online_version, m_file_version)
} version_info{};
std::map<std::string, weapon_item> weapon_map;
std::map<std::string, weapon_component> weapon_components;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapon_file, version_info, weapon_map, weapon_components)
bool up_to_date(std::uint32_t file_version) const
{
return file_version == version_info.m_file_version;
}
};
}