import type { eAttributeCore } from '../enums/eAttributeCore'; import type { ePedAttribute } from '../enums/ePedAttribute'; import type { Ped } from '../classes/Ped'; import { Vector2 } from '../types/Vector2'; import { Vector3 } from '../types/Vector3'; import { Vector4 } from '../types/Vector4'; import { Color } from '../types/Color'; import { createFromHandle } from '../types/HandleRegistry'; import { inv, rai, raf, ras, rav, pvi, pvf, pvv, pvii, pvfi, _h, f, int, uint, float, Hash, u8, u16, u32, u64, i8, i16, i32, i64 } from '../types/NativeAliases'; export class Attribute { /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @param value * @param makeSound */ static enableAttributeOverpower(ped: Ped, attributeIndex: ePedAttribute, value: float, makeSound: boolean): void { inv('0xF6A7C08DF2E28B28', ped.handle, attributeIndex, f(value), makeSound); } /** * Displays status effects on core icons (includes warnings). * * @param statusEffectType See {@link eUiRpgStatusEffect} */ static setStatusEffectCoreIcon(statusEffectType: int): void { inv('0xA4D3A1C008F250DF', statusEffectType); } /** * Starts core periodic icon. * * @param statusEffectType See {@link eUiRpgStatusEffect} */ static setStatusEffectPeriodicIcon(statusEffectType: int): void { inv('0xFB6E111908502871', statusEffectType); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @param p2 */ static addAttributePoints(ped: Ped, attributeIndex: ePedAttribute, p2: int): void { inv('0x75415EE0CB583760', ped.handle, attributeIndex, p2); } /** * @param modelHash * @param attributeIndex Refer to {@link ePedAttribute} * @param rank * @returns */ static getDefaultAttributePointsNeededForRank(modelHash: string | number, attributeIndex: ePedAttribute, rank: int): int { return inv('0x94A7F191DB49A44D', _h(modelHash), attributeIndex, rank, rai()); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @returns */ static getAttributeRank(ped: Ped, attributeIndex: ePedAttribute): int { return inv('0xA4C8E23E29040DE0', ped.handle, attributeIndex, rai()); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @param newValue */ static setAttributeBonusRank(ped: Ped, attributeIndex: ePedAttribute, newValue: int): void { inv('0x920F9488BD115EFB', ped.handle, attributeIndex, newValue); } /** * @param ped * @param coreIndex Refer to {@link eAttributeCore} * @param value */ static setAttributeCoreValue(ped: Ped, coreIndex: eAttributeCore, value: int): void { inv('0xC6258F41D86676E0', ped.handle, coreIndex, value); } /** * @param ped * @param coreIndex Refer to {@link eAttributeCore} * @returns */ static getAttributeBonusRank(ped: Ped, coreIndex: eAttributeCore): int { return inv('0x0EFA71F4B4330E04', ped.handle, coreIndex, rai()); } /** * Stops periodic icon. * statusEffectType: see 0xA4D3A1C008F250DF * * @param statusEffectType See {@link eUiRpgStatusEffect} */ static stopStatusEffectPeriodicIcon(statusEffectType: int): void { inv('0x3FC4C027FD0936F4', statusEffectType); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} */ static disableAttributeOverpower(ped: Ped, attributeIndex: ePedAttribute): void { inv('0xF8DAC3D85636C241', ped.handle, attributeIndex); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @returns */ static getAttributeBaseRank(ped: Ped, attributeIndex: ePedAttribute): int { return inv('0x147149F2E909323C', ped.handle, attributeIndex, rai()); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @returns */ static getAttributeOverpowerSecondsLeft(ped: Ped, attributeIndex: ePedAttribute): float { return inv('0x4C9F782180712742', ped.handle, attributeIndex, raf()); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @returns */ static isAttributeOverpowered(ped: Ped, attributeIndex: ePedAttribute): boolean { return !!inv('0x103C2F885ABEB00B', ped.handle, attributeIndex, rai()); } static stopItemPreview(): void { inv('0xD962F8579D702DB5'); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @returns */ static getMaxAttributePoints(ped: Ped, attributeIndex: ePedAttribute): int { return inv('0x223BF310F854871C', ped.handle, attributeIndex, rai()); } /** * @param ped * @param coreIndex Refer to {@link eAttributeCore} * @returns */ static isAttributeCoreOverpowered(ped: Ped, coreIndex: eAttributeCore): boolean { return !!inv('0x200373A8DF081F22', ped.handle, coreIndex, rai()); } /** * @param modelHash * @param attributeIndex Refer to {@link ePedAttribute} * @returns */ static getDefaultAttributeRank(modelHash: string | number, attributeIndex: ePedAttribute): int { return inv('0x958DD43D41F89A47', _h(modelHash), attributeIndex, rai()); } /** * @param ped * @param coreIndex Refer to {@link eAttributeCore} * @returns */ static getAttributeCoreOverpowerSecondsLeft(ped: Ped, coreIndex: eAttributeCore): float { return inv('0xB429F58803D285B1', ped.handle, coreIndex, raf()); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @returns */ static getAttributePoints(ped: Ped, attributeIndex: ePedAttribute): int { return inv('0x219DA04BAA9CB065', ped.handle, attributeIndex, rai()); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @param newValue */ static setAttributeBaseRank(ped: Ped, attributeIndex: ePedAttribute, newValue: int): void { inv('0x5DA12E025D47D4E5', ped.handle, attributeIndex, newValue); } /** * Gets the ped's core value on a scale of 0 to 100. * * @param ped * @param coreIndex Refer to {@link eAttributeCore} * @returns */ static getAttributeCoreValue(ped: Ped, coreIndex: eAttributeCore): int { return inv('0x36731AC041289BB1', ped.handle, coreIndex, rai()); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @returns */ static getMaxAttributeRank(ped: Ped, attributeIndex: ePedAttribute): int { return inv('0x704674A0535A471D', ped.handle, attributeIndex, rai()); } /** * Params: p1 is related to satchel_category * * @param p0 * @param p1 */ static startItemPreview(p0: any, p1: int): void { inv('0x7E2C766ADB2C5F1A', p0, p1); } /** * @param ped * @param attributeIndex Refer to {@link ePedAttribute} * @param p2 */ static setAttributePoints(ped: Ped, attributeIndex: ePedAttribute, p2: int): void { inv('0x09A59688C26D88DF', ped.handle, attributeIndex, p2); } /** * @param ped * @param coreIndex Refer to {@link eAttributeCore} * @param value * @param makeSound */ static enableAttributeCoreOverpower(ped: Ped, coreIndex: eAttributeCore, value: float, makeSound: boolean): void { inv('0x4AF5A4C7B9157D14', ped.handle, coreIndex, f(value), makeSound); } /** * @param modelHash * @param attributeIndex Refer to {@link ePedAttribute} * @returns Returns the maximum rank that the specified `ePedAttribute` can be. */ static getDefaultMaxAttributeRank(modelHash: string | number, attributeIndex: ePedAttribute): int { return inv('0x7C059C55AD940CB4', _h(modelHash), attributeIndex, rai()); } }