Compare commits

..

4 Commits

Author SHA1 Message Date
redvalley b2060cfbb2 feat(qb-core): import 153 items din qs-inventory preload + fix duplicates
- Adaugat 153 iteme noi din qs-inventory preload in qb-core/shared/items.lua
- Categorii: haine, medicale, weapon tints, minerit, casino, trading cards, burger crafting, telefoane colorate
- Eliminat 19 iteme duplicate pre-existente (materiale: steel, copper, glass, plastic, rubber + cryptostick)
- Total final: 552 iteme unice, zero duplicate
- rv-maphold: HasItem foloseste QBCore.Functions.GetPlayerData() nativ
- qs-inventory mutat din [core] in [addons] (ensure dupa qb-core)
- Creat docs/qs-inventory-custom-modifications.md
2026-04-01 23:10:15 +03:00
redvalley 1ee53356fc feat(qb-core): import 153 items din qs-inventory preload update 2026-04-01 22:53:27 +03:00
redvalley ddc4d116db fix(rv-maphold): foloseste QBCore nativ pt HasItem, fara export qb-inventory 2026-04-01 22:42:06 +03:00
redvalley 6112500590 docs: qs-inventory custom modifications + fix map label Harta 2026-04-01 22:33:35 +03:00
710 changed files with 3049 additions and 150 deletions
+3
View File
@@ -10,3 +10,6 @@ cache/
nui-simulator/node_modules/ nui-simulator/node_modules/
resources/luxu_admin/logs/ resources/luxu_admin/logs/
cache/files/17mov_JobCenter/resource.rpf cache/files/17mov_JobCenter/resource.rpf
_fix_dupes.py
_check_dupes.py
_find_dupes.py
+30
View File
@@ -0,0 +1,30 @@
import re, os
def extract_items(path):
with open(path, 'r', encoding='utf-8', errors='ignore') as f:
content = f.read()
return set(re.findall(r"\['([a-zA-Z0-9_]+)'\]\s*=\s*\{\s*\['name'\]", content))
preload_path = r'E:\FiveMserver\server\_preLoad\qs-inventory\[inventory]\qs-inventory\shared\items.lua'
qbcore_path = r'E:\FiveMserver\server\resources\[framework]\[core]\qb-core\shared\items.lua'
if not os.path.exists(preload_path):
print(f'PRELOAD NOT FOUND: {preload_path}')
else:
pi = extract_items(preload_path)
qi = extract_items(qbcore_path)
only_preload = sorted(pi - qi)
only_qbcore = sorted(qi - pi)
print(f'Preload items: {len(pi)}')
print(f'QBCore items: {len(qi)}')
print(f'Common: {len(pi & qi)}')
print()
print(f'=== ONLY IN PRELOAD ({len(only_preload)}) ===')
for item in only_preload:
print(f' + {item}')
print()
print(f'=== ONLY IN QBCORE ({len(only_qbcore)}) ===')
for item in only_qbcore:
print(f' - {item}')
+95
View File
@@ -0,0 +1,95 @@
import re, os
def extract_items_with_defs(path):
"""Extract item keys and their full definitions from a lua items file."""
with open(path, 'r', encoding='utf-8', errors='ignore') as f:
content = f.read()
items = {}
# Match multi-line item blocks: ['key'] = { ... },
pattern = r"\['([a-zA-Z0-9_]+)'\]\s*=\s*\{([^}]+)\}"
for match in re.finditer(pattern, content):
key = match.group(1)
body = match.group(2)
# Only count items that have ['name'] inside
if "['name']" in body:
items[key] = body.strip()
return items
def extract_field(body, field):
"""Extract a field value from item body."""
m = re.search(r"\['" + field + r"'\]\s*=\s*(.+?)(?:,\s*$|,\s*\[)", body, re.MULTILINE)
if m:
return m.group(1).strip().rstrip(',')
# try simpler
m = re.search(r"\['" + field + r"'\]\s*=\s*([^,]+)", body)
if m:
return m.group(1).strip()
return None
def to_qbcore_line(key, body):
"""Convert a qs-inventory item block to a qb-core single-line format."""
fields = ['name', 'label', 'weight', 'type', 'image', 'unique', 'useable', 'shouldClose', 'combinable', 'description']
vals = {}
for f in fields:
v = extract_field(body, f)
if v is not None:
vals[f] = v
# Build the line in qb-core style
# Pad the key to align
padded_key = f"['{key}']"
padded_key = padded_key.ljust(40)
parts = []
for f in fields:
if f in vals:
padded_f = f"['{f}']"
parts.append(f"{padded_f} = {vals[f]}")
line = f" {padded_key} = {{{', '.join(parts)}}},"
return line
# Paths
preload_path = r'E:\FiveMserver\server\_preLoad\qs-inventory\[inventory]\qs-inventory\shared\items.lua'
qbcore_path = r'E:\FiveMserver\server\resources\[framework]\[core]\qb-core\shared\items.lua'
# Extract items from both
preload_items = extract_items_with_defs(preload_path)
qbcore_items = extract_items_with_defs(qbcore_path)
# Find items only in preload
only_preload = sorted(set(preload_items.keys()) - set(qbcore_items.keys()))
print(f"Items to add: {len(only_preload)}")
# Generate qb-core lines
new_lines = []
new_lines.append("")
new_lines.append(" -- ═══════════════════════════════════════════════════")
new_lines.append(" -- ITEMS IMPORTATE DIN QS-INVENTORY (preLoad update)")
new_lines.append(" -- ═══════════════════════════════════════════════════")
new_lines.append("")
for key in only_preload:
body = preload_items[key]
line = to_qbcore_line(key, body)
new_lines.append(line)
# Read qb-core file
with open(qbcore_path, 'r', encoding='utf-8', errors='ignore') as f:
qb_content = f.read()
# Find the last } that closes QBShared.Items
# Insert before the last }
last_brace = qb_content.rfind('}')
if last_brace == -1:
print("ERROR: Could not find closing brace")
else:
new_content = qb_content[:last_brace] + '\n'.join(new_lines) + '\n' + qb_content[last_brace:]
with open(qbcore_path, 'w', encoding='utf-8') as f:
f.write(new_content)
print(f"SUCCESS: Added {len(only_preload)} items to qb-core items.lua")
print("First 5 items added:")
for k in only_preload[:5]:
print(f" + {k}")
print(f" ... and {len(only_preload)-5} more")
+2750 -115
View File
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Some files were not shown because too many files have changed in this diff Show More