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 type { Entity } from './Entity'; 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 BaseTask { protected entity: Entity; constructor(entity: Entity) { this.entity = entity; } /** * Returns the entity coverpoint with offset. * * @param offset * @param heading * @param p5 * @param p6 * @param p7 * @param p8 * @returns */ getCoverpointFromEntityWithOffset(offset: Vector3, heading: float, p5: int, p6: int, p7: int, p8: int): any { return inv('0x59872EA4CBD11C56', this.entity.handle, f(offset.x), f(offset.y), f(offset.z), f(heading), p5, p6, p7, p8); } /** * Returns m_eContainerState * * @returns */ get ScenarioContainerOpeningState(): any { return inv('0xB219612B5568E9EC', this.entity.handle); } /** * Returns scenario * * @param scenarioHash * @param pos * @param heading * @param p6 * @param p7 * @param p8 * @returns */ createScenarioPointHashAttachedToEntity(scenarioHash: string | number, pos: Vector3, heading: float, p6: any, p7: any, p8: boolean): int { return inv('0x794AB1379A74064D', this.entity.handle, _h(scenarioHash), f(pos.x), f(pos.y), f(pos.z), f(heading), p6, p7, p8, rai()); } /** * @returns args */ playEntityScriptedAnim(): number { const result = inv('0x77A1EEC547E7FCF1', this.entity.handle, pvi()); return result; } /** * carriableSlot: * 7 > Back of a horse * 6 > Right side of a horse * 5 > Left side of a horse * flags: * 512: enables the prompt being the name of the item when using a generic item * * @param carryConfig * @param carrier * @param carriableSlot * @param flags */ carriable(carryConfig: string | number, carrier: Ped, carriableSlot: int, flags: int): void { inv('0xF0B4F759F35CC7F5', this.entity.handle, _h(carryConfig), carrier.handle, carriableSlot, flags); } /** * @param p1 */ N_0xF3C3503276F4A034(p1: any): void { inv('0xF3C3503276F4A034', this.entity.handle, p1); } /** * @returns */ get IsCarriableEntity(): any { return inv('0x0CCFE72B43C9CF96', this.entity.handle); } /** * @returns This value decreases as items are looted. Before opening, it may return `0` because contents are not always loaded until the container is opened. */ get RansackScenarioContainerRemainingLootCount(): int { return inv('0x01AF8A3729231A43', this.entity.handle, rai()); } /** * @returns Returns the total number of compartments (drawers, lids, etc.) the specific scenarion container has. For example a chest has `1` compartment, while a cabinet with `3` drawers returns `3` */ get RansackScenarioContainerNumCompartments(): int { return inv('0x640A602946A8C972', this.entity.handle, rai()); } /** * @param targetEntity * @param duration * @param firingPattern * @param affectCockedState */ shootAtEntity(targetEntity: Entity, duration: int, firingPattern: string | number, affectCockedState: boolean): void { inv('0x08DA95E8298AE772', this.entity.handle, targetEntity.handle, duration, _h(firingPattern), affectCockedState); } /** * Opens/closes containers: ChestDugUp * * @param open */ set ScenarioContainerOpeningState(open: boolean) { inv('0x188F8071F244B9B8', this.entity.handle, open); } /** * Opens/closes containers: ChestDugUp * * @param open * @returns The instance for method chaining */ setScenarioContainerOpeningState(open: boolean): this { inv('0x188F8071F244B9B8', this.entity.handle, open); return this; } /** * @returns If the container is not cloesable (like a chest or safe that cannt be closed again) it will return `0`. */ get RansackScenarioContainerNumOpenCompartments(): int { return inv('0x849791EBBDBA0362', this.entity.handle, rai()); } /** * @param filterName * @param priority * @param secondary * @returns The instance for method chaining */ setAnimFilter(filterName: string, priority: int, secondary: boolean): this { inv('0x87B66D77D545DB66', this.entity.handle, filterName, priority, secondary); return this; } /** * @param targetEntity * @param duration * @param p3 * @param p4 */ N_0x2416EC2F31F75266(targetEntity: Entity, duration: int, p3: any, p4: any): void { inv('0x2416EC2F31F75266', this.entity.handle, targetEntity.handle, duration, p3, p4); } }