1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-19 11:09:29 +08:00
Files
Alas/blcrack/cracker/cracker.hpp

171 lines
4.5 KiB
C++

#ifndef CRACKER_HPP
#define CRACKER_HPP
#include <map>
#include <optional>
#include <vector>
#include <string>
#include <sol/state_view.hpp>
#include <sol/variadic_args.hpp>
#include <vector>
namespace Lua {
using Table = sol::table;
using Object = sol::object;
using Function = sol::function;
using VariadicArgs = sol::variadic_args;
using StateView = sol::state_view;
}
enum {
GLOBAL_SHIP_PROPERTIES_CRACK,
SPECIFIC_SHIP_PROPERTIES_CRACK,
FAST_STAGE_MOVE_CRACK,
REMOVE_HARD_MODE_SHIP_PROPERTIES_LIMIT,
REMOVE_HARD_MODE_SHIP_TYPE_LIMIT,
FAKE_PLAYER_INFO,
NO_BB_ANIMATION,
NO_EMOTION_WARNING,
OPSI_FAST_MOVE,
};
class Cracker {
public:
using FunctionId = int;
using ShipId = int;
using StorageItemId = int;
using StorageItemCount = int;
// -1 means disabled
struct ShipProperties {
double armor = -1;
double speed = -1;
double antiaircraft = -1;
double oxy_recovery_bench = -1;
double torpedo = -1;
double hit = -1;
double sonarRange = -1;
double attack_duration = -1;
double raid_distance = -1;
double oxy_recovery_surface = -1;
double oxy_recovery = -1;
double dodge = -1;
double luck = -1;
double reload = -1;
double oxy_cost = -1;
double durability = -1;
double air = -1;
double oxy_max = -1;
double cannon = -1;
double antisub = -1;
};
struct FakePlayerInfo {
std::string name;
std::string id;
std::string level;
};
struct ShipInfo {
int config_id;
int emotion;
int rarity;
int level;
int exp;
int curr_star;
};
public:
Cracker();
static Cracker& Instance();
int get_coin();
int get_oil();
int get_gems();
int get_level();
int get_exp();
int get_merit();
int get_guild_coin();
int get_design_prt();
int get_core_data();
int get_medal();
int get_pt();
int get_specialized_core();
int get_curr_action_point();
std::map<ShipId, ShipInfo> scan_dock();
std::map<StorageItemId, StorageItemCount> scan_storage();
std::optional<ShipInfo> get_ship_info(ShipId ship_id);
std::optional<StorageItemCount> get_storage_item_count(StorageItemId item_id);
void disable_all();
void enable_opsi_fast_move();
void disable_opsi_fast_move();
void enable_no_emotion_warning();
void disable_no_emotion_warning();
void enable_no_bb_animation();
void disable_no_bb_animation();
void enable_fake_player();
void disable_fake_player();
void update_fake_player_info(const FakePlayerInfo& fake_info);
void enable_remove_hard_mode_ship_type_limit();
void disable_remove_hard_mode_ship_type_limit();
void enable_remove_hard_mode_ship_properties_limit();
void disable_remove_hard_mode_ship_properties_limit();
void enable_fast_stage_move();
void disable_fast_stage_move();
void update_global_ship_properties(const ShipProperties& properties);
void enable_global_ship_properties_crack();
void disable_global_ship_properties_crack();
bool is_enabled(FunctionId id);
bool is_disabled(FunctionId id);
void print_table_field(std::vector<std::string>& path);
private:
void enable_flag(FunctionId id);
void disable_flag(FunctionId id);
static void modify_ship_properties(Lua::Table& properties, const ShipProperties& new_properties);
static void clear_hard_mode_ship_properties_limit(Lua::Table& t);
struct {
Lua::Table player;
Lua::Table world;
Lua::Table dock;
Lua::Table storage;
} m_data_proxy;
std::map<FunctionId, bool> m_functions;
sol::state_view m_state;
struct {
Lua::Function Ship_getShipProperties;
double ChapterConst_ShipStepDuration;
double ChapterConst_ShipStepQuickPlayScale;
Lua::Function WorldFleetSelectLayer_CheckValid;
Lua::Function BossSingleBattleFleetSelectSubPanel_CheckValid;
Lua::Function Chapter_IsEliteFleetLegal;
Lua::Function Chapter_getConfig;
Lua::Function PlayerVitaeDetailPage_UpdateInfo;
Lua::Function ys_Battle_BattleManualWeaponAutoBot_SetActive;
Lua::Function Ship_cosumeEnergy;
Lua::Function Ship_getEnergy;
double WorldConst_BaseMoveDuration;
} m_original;
FakePlayerInfo m_fake_player_info;
ShipProperties m_globle_ship_properties;
std::map<ShipId, ShipProperties> m_specific_ship_properties;
};
#endif //CRACKER_HPP