mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
Added packed stats handler to the stats Lua class. (#2460)
This commit is contained in:
parent
2a81e3eeef
commit
847a729918
@ -297,4 +297,50 @@ boolean = stats.set_masked_int(stat_hash, new_value, bit_start, bit_size)
|
||||
boolean = stats.set_masked_int(stat_name, new_value, bit_start, bit_size)
|
||||
```
|
||||
|
||||
### `get_packed_stat_bool(index)`
|
||||
|
||||
- **Parameters:**
|
||||
- `index` (int): packed stat's index.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: Value of the stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
local pstat_value = stats.get_packed_stat_bool(index)
|
||||
```
|
||||
|
||||
### `set_packed_stat_bool(index, value)`
|
||||
|
||||
- **Parameters:**
|
||||
- `index` (int): packed stat's index.
|
||||
- `value` (bool): value to set the packed stat to.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
stats.set_packed_stat_bool(index, value)
|
||||
```
|
||||
|
||||
### `get_packed_stat_int(index)`
|
||||
|
||||
- **Parameters:**
|
||||
- `index` (int): packed stat's index
|
||||
|
||||
- **Returns:**
|
||||
- `int`: Value of the stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
local pstat_value = stats.get_packed_stat_int(index)
|
||||
```
|
||||
|
||||
### `set_packed_stat_int(index, value)`
|
||||
|
||||
- **Parameters:**
|
||||
- `index` (int): packed stat's index.
|
||||
- `value` (int): value to set the packed stat to.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
stats.set_packed_stat_int(index, value)
|
||||
```
|
@ -273,6 +273,46 @@ namespace lua::stats
|
||||
return set_masked_int_hash(stat_text_to_hash(stat_name), new_value, bit_start, bit_size);
|
||||
}
|
||||
|
||||
// Lua API: Function
|
||||
// Table: stats
|
||||
// Name: get_packed_stat_bool
|
||||
// Param: index: int: packed stat's index
|
||||
// Returns: boolean: Value of the stat.
|
||||
static bool get_packed_stat_bool(int index)
|
||||
{
|
||||
return STATS::GET_PACKED_STAT_BOOL_CODE(index, get_character_index());
|
||||
}
|
||||
|
||||
// Lua API: Function
|
||||
// Table: stats
|
||||
// Name: set_packed_stat_bool
|
||||
// Param: index: int: packed stat's index.
|
||||
// Param: value: bool: value to set the packed stat to.
|
||||
static void set_packed_stat_bool(int index, bool value)
|
||||
{
|
||||
STATS::SET_PACKED_STAT_BOOL_CODE(index, value, get_character_index());
|
||||
}
|
||||
|
||||
// Lua API: Function
|
||||
// Table: stats
|
||||
// Name: get_packed_stat_int
|
||||
// Param: index: int: packed stat's index.
|
||||
// Returns: int: Value of the stat.
|
||||
static int get_packed_stat_int(int index)
|
||||
{
|
||||
return STATS::GET_PACKED_STAT_INT_CODE(index, get_character_index());
|
||||
}
|
||||
|
||||
// Lua API: Function
|
||||
// Table: stats
|
||||
// Name: set_packed_stat_int
|
||||
// Param: index: int: packed stat's index.
|
||||
// Param: value: int: value to set the packed stat to.
|
||||
static void set_packed_stat_int(int index, int value)
|
||||
{
|
||||
STATS::SET_PACKED_STAT_INT_CODE(index, value, get_character_index());
|
||||
}
|
||||
|
||||
void bind(sol::state& state)
|
||||
{
|
||||
auto ns = state["stats"].get_or_create<sol::table>();
|
||||
@ -284,11 +324,15 @@ namespace lua::stats
|
||||
ns["get_float"] = sol::overload(get_float_hash, get_float_name);
|
||||
ns["get_int"] = sol::overload(get_int_hash, get_int_name);
|
||||
ns["get_masked_int"] = sol::overload(get_masked_int_hash, get_masked_int_name);
|
||||
ns["get_packed_stat_bool"] = get_packed_stat_bool;
|
||||
ns["get_packed_stat_int"] = get_packed_stat_int;
|
||||
|
||||
ns["set_bool"] = sol::overload(set_bool_hash, set_bool_name);
|
||||
ns["set_bool_masked"] = sol::overload(set_bool_masked_hash, set_bool_masked_name);
|
||||
ns["set_float"] = sol::overload(set_float_hash, set_float_name);
|
||||
ns["set_int"] = sol::overload(set_int_hash, set_int_name);
|
||||
ns["set_masked_int"] = sol::overload(set_masked_int_hash, set_masked_int_name);
|
||||
ns["set_packed_stat_bool"] = set_packed_stat_bool;
|
||||
ns["set_packed_stat_int"] = set_packed_stat_int;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user