Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 169 additions & 1 deletion resources/[qb]/qb-core/shared/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4633,6 +4633,174 @@ QBShared.Items = {
["description"] = "Le ciel est la limite ! Woohoo !",
["illustrator"] = ".LeakFlood",
},
["parachute_rainbow"] = {
["name"] = "parachute_rainbow",
["label"] = "Parachute Arc-en-ciel",
["weight"] = 3000,
["type"] = "item",
["unique"] = true,
["useable"] = false,
["shouldClose"] = true,
["combinable"] = nil,
["description"] = "Le ciel est la limite ! Woohoo !",
["illustrator"] = ".Azylium",
},
["parachute_red"] = {
["name"] = "parachute_red",
["label"] = "Parachute Rouge",
["weight"] = 3000,
["type"] = "item",
["unique"] = true,
["useable"] = false,
["shouldClose"] = true,
["combinable"] = nil,
["description"] = "Le ciel est la limite ! Woohoo !",
["illustrator"] = ".Azylium",
},
["parachute_seasidestripes"] = {
["name"] = "parachute_seasidestripes",
["label"] = "Parachute Rayures de bord de mer",
["weight"] = 3000,
["type"] = "item",
["unique"] = true,
["useable"] = false,
["shouldClose"] = true,
["combinable"] = nil,
["description"] = "Le ciel est la limite ! Woohoo !",
["illustrator"] = ".Azylium",
},
["parachute_widowmaker"] = {
["name"] = "parachute_widowmaker",
["label"] = "Parachute Veuve noire",
["weight"] = 3000,
["type"] = "item",
["unique"] = true,
["useable"] = false,
["shouldClose"] = true,
["combinable"] = nil,
["description"] = "Le ciel est la limite ! Woohoo !",
["illustrator"] = ".Azylium",
},
["parachute_patriot"] = {
["name"] = "parachute_patriot",
["label"] = "Parachute Patriot",
["weight"] = 3000,
["type"] = "item",
["unique"] = true,
["useable"] = false,
["shouldClose"] = true,
["combinable"] = nil,
["description"] = "Le ciel est la limite ! Woohoo !",
["illustrator"] = ".Azylium",
},
["parachute_blue"] = {
["name"] = "parachute_blue",
["label"] = "Parachute Bleu",
["weight"] = 3000,
["type"] = "item",
["unique"] = true,
["useable"] = false,
["shouldClose"] = true,
["combinable"] = nil,
["description"] = "Le ciel est la limite ! Woohoo !",
["illustrator"] = ".Azylium",
},
["parachute_black"] = {
["name"] = "parachute_black",
["label"] = "Parachute Noir",
["weight"] = 3000,
["type"] = "item",
["unique"] = true,
["useable"] = false,
["shouldClose"] = true,
["combinable"] = nil,
["description"] = "Le ciel est la limite ! Woohoo !",
["illustrator"] = ".Azylium",
},
["parachute_hornet"] = {
["name"] = "parachute_hornet",
["label"] = "Parachute Frelon",
["weight"] = 3000,
["type"] = "item",
["unique"] = true,
["useable"] = false,
["shouldClose"] = true,
["combinable"] = nil,
["description"] = "Le ciel est la limite ! Woohoo !",
["illustrator"] = ".Azylium",
},
-- ["parachute_airforce"] = {
-- ["name"] = "parachute_airforce",
-- ["label"] = "Parachute Air Force",
-- ["weight"] = 3000,
-- ["type"] = "item",
-- ["unique"] = true,
-- ["useable"] = false,
-- ["shouldClose"] = true,
-- ["combinable"] = nil,
-- ["description"] = "Le ciel est la limite ! Woohoo !",
-- ["illustrator"] = ".Azylium",
-- },
-- ["parachute_desert"] = {
-- ["name"] = "parachute_desert",
-- ["label"] = "Parachute Désert",
-- ["weight"] = 3000,
-- ["type"] = "item",
-- ["unique"] = true,
-- ["useable"] = false,
-- ["shouldClose"] = true,
-- ["combinable"] = nil,
-- ["description"] = "Le ciel est la limite ! Woohoo !",
-- ["illustrator"] = ".Azylium",
-- },
-- ["parachute_shadow"] = {
-- ["name"] = "parachute_shadow",
-- ["label"] = "Parachute Ombre",
-- ["weight"] = 3000,
-- ["type"] = "item",
-- ["unique"] = true,
-- ["useable"] = false,
-- ["shouldClose"] = true,
-- ["combinable"] = nil,
-- ["description"] = "Le ciel est la limite ! Woohoo !",
-- ["illustrator"] = ".Azylium",
-- },
-- ["parachute_highaltitude"] = {
-- ["name"] = "parachute_highaltitude",
-- ["label"] = "Parachute Haute altitude",
-- ["weight"] = 3000,
-- ["type"] = "item",
-- ["unique"] = true,
-- ["useable"] = false,
-- ["shouldClose"] = true,
-- ["combinable"] = nil,
-- ["description"] = "Le ciel est la limite ! Woohoo !",
-- ["illustrator"] = ".Azylium",
-- },
-- ["parachute_airbone"] = {
-- ["name"] = "parachute_airbone",
-- ["label"] = "Parachute Airborne",
-- ["weight"] = 3000,
-- ["type"] = "item",
-- ["unique"] = true,
-- ["useable"] = false,
-- ["shouldClose"] = true,
-- ["combinable"] = nil,
-- ["description"] = "Le ciel est la limite ! Woohoo !",
-- ["illustrator"] = ".Azylium",
-- },
-- ["parachute_sunrise"] = {
-- ["name"] = "parachute_sunrise",
-- ["label"] = "Parachute Lever du soleil",
-- ["weight"] = 3000,
-- ["type"] = "item",
-- ["unique"] = true,
-- ["useable"] = false,
-- ["shouldClose"] = true,
-- ["combinable"] = nil,
-- ["description"] = "Le ciel est la limite ! Woohoo !",
-- ["illustrator"] = ".Azylium",
-- },
["binoculars"] = {
["name"] = "binoculars",
["label"] = "Jumelles",
Expand Down Expand Up @@ -12452,7 +12620,7 @@ QBShared.Items = {
["description"] = "Une carte magnétique qui doit surement servir à accéder à un ordinateur si on trouve la seconde...",
["illustrator"] = ".Sniteur",
},

["weapon_crate"] = {
["name"] = "weapon_crate",
["label"] = "Caisse d'armes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,68 @@ import { Provider } from '../../core/decorators/provider';
import { ServerEvent } from '../../shared/event/server';
import { InventoryItem } from '../../shared/inventory';

const parachuteTints: Record<string, number> = {
rainbow: 0,
red: 1,
seasidestripes: 2,
widowmaker: 3,
patriot: 4,
blue: 5,
black: 6,
hornet: 7,
// airfocce: 8,
// desert: 9,
// shadow: 10,
// highaltitude: 11,
// airbone: 12,
// sunrise: 13,
};

@Provider()
export class ItemParachuteProvider {
private hasConsumedParachute = false;
private lastParachuteName: string | null = null;

@PlayerInventoryUpdate()
public onPlayerUpdate(items: Record<number, InventoryItem>) {
const ped = PlayerPedId();
const parachuteWeapon = GetHashKey('GADGET_PARACHUTE');
this.lastParachuteName = null;

for (const item of Object.values(items)) {
if (item.name == 'parachute') {
if (item.name.startsWith('parachute')) {
if (!HasPedGotWeapon(ped, parachuteWeapon, false)) {
GiveWeaponToPed(ped, parachuteWeapon, 1, false, false);
}
const parts = item.name.split('_');
const tintName = parts[1] || 'rainbow';
const tintIndex = parachuteTints[tintName.toLowerCase()] ?? 0;
SetPedParachuteTintIndex(ped, tintIndex);
this.lastParachuteName = item.name;
return;
}
}

if (HasPedGotWeapon(ped, parachuteWeapon, false)) {
RemoveWeaponFromPed(ped, parachuteWeapon);
}
this.lastParachuteName = null;
}

@Tick(100)
public onParachuteTick() {
const playerPed = PlayerPedId();
if (!this.hasConsumedParachute && GetPedParachuteState(playerPed) == 1) {
TriggerServerEvent(ServerEvent.INVENTORY_REMOVE_PLAYER_ITEM, 'parachute', 1);
if (
!this.hasConsumedParachute &&
GetPedParachuteState(playerPed) == 1 &&
this.lastParachuteName
) {
TriggerServerEvent(ServerEvent.INVENTORY_REMOVE_PLAYER_ITEM, this.lastParachuteName, 1);
this.hasConsumedParachute = true;
} else if (this.hasConsumedParachute && [0, 3].includes(GetPedParachuteState(playerPed))) {
} else if (
this.hasConsumedParachute &&
[0, 3].includes(GetPedParachuteState(playerPed))
) {
this.hasConsumedParachute = false;
}
}
Expand Down
45 changes: 12 additions & 33 deletions resources/[soz]/soz-core/src/client/shop/superette.shop.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,52 +46,31 @@ export class SuperetteShopProvider {
private logger: Logger;

public openShop(brand: ShopBrand | NoZoneShopBrand, shop: string, shopLabel: string = 'Boutique') {
if (brand != ShopBrand.Ammunation) {
const superetteContent: ShopItem[] = [];
const licences = this.playerService.getPlayer().metadata.licences;
for (let i = 0; i < ShopsContent[brand].length; i++) {
const sharedItem = {
...this.itemService.getItem(ShopsContent[brand][i].id),
price: ShopsContent[brand][i].price,
metadata: ShopsContent[brand][i].metadata,
} as ShopItem;
superetteContent.push(sharedItem);
const product = ShopsContent[brand][i];
if (!product.requiredLicense || licences[product.requiredLicense]) {
const sharedItem = {
...this.itemService.getItem(ShopsContent[brand][i].id),
price: ShopsContent[brand][i].price,
metadata: ShopsContent[brand][i].metadata,
} as ShopItem;
superetteContent.push(sharedItem);
}
}

let taxes = null;
if (brand === ShopBrand.Zkea) {
taxes = TaxType.SERVICE;
} else if (brand === ShopBrand.Ammunation) {
taxes = TaxType.WEAPON
} else if (SOUVENIR_BRAND.includes(brand)) {
taxes = TaxType.SUPPLY;
} else if (brand !== ShopBrand.Supermarket247Cayo) {
taxes = TaxType.FOOD;
}
this.inventoryManager.openShopInventory(superetteContent, shopLabel, taxes);
} else {
// Ammunation are handled by soz-core here
const licences = this.playerService.getPlayer().metadata.licences;
const products = ShopsContent[brand]
.filter(product => !product.requiredLicense || licences[product.requiredLicense])
.map(product => ({
...product,
item: this.itemService.getItem(product.id),
}));

if (!products) {
this.logger.error(`Shop ${brand} not found`);
return;
}

this.nuiMenu.openMenu(
MenuType.SuperetteShop,
{ brand, products },
{
position: {
position: ShopsConfig[shop].location as Vector4,
distance: 6.0,
},
}
);
}
}

@OnNuiEvent(NuiEvent.SuperetteShopBuy)
Expand Down
16 changes: 15 additions & 1 deletion resources/[soz]/soz-core/src/shared/shop/superette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,21 @@ const SuperetteContent: ShopContent = [
];

const AmmunationContent: ShopContent = [
{ id: 'parachute', type: 'item', price: 225 },
// { id: 'parachute', type: 'item', price: 225 },
{ id: 'parachute_rainbow', type: 'item', price: 225 },
{ id: 'parachute_red', type: 'item', price: 225 },
{ id: 'parachute_seasidestripes', type: 'item', price: 225 },
{ id: 'parachute_widowmaker', type: 'item', price: 225 },
{ id: 'parachute_patriot', type: 'item', price: 225 },
{ id: 'parachute_blue', type: 'item', price: 225 },
{ id: 'parachute_black', type: 'item', price: 225 },
{ id: 'parachute_hornet', type: 'item', price: 225 },
// { id: 'parachute_airforce', type: 'item', price: 225 },
// { id: 'parachute_desert', type: 'item', price: 225 },
// { id: 'parachute_shadow', type: 'item', price: 225 },
// { id: 'parachute_highaltitude', type: 'item', price: 225 },
// { id: 'parachute_airbone', type: 'item', price: 225 },
// { id: 'parachute_sunrise', type: 'item', price: 225 },
{ id: 'weapon_bat', type: 'weapon', price: 162 },
{ id: 'weapon_golfclub', type: 'weapon', price: 405 },
{ id: 'weapon_knuckle', type: 'weapon', price: 90 },
Expand Down