' +
+ '';
+ window.ESX_MENU = {};
+ ESX_MENU.ResourceName = 'esx_menu_list';
+ ESX_MENU.opened = {};
+ ESX_MENU.focus = [];
+ ESX_MENU.data = {};
+
+ ESX_MENU.open = function(namespace, name, data) {
+ if (typeof ESX_MENU.opened[namespace] === 'undefined') {
+ ESX_MENU.opened[namespace] = {};
+ }
+
+ if (typeof ESX_MENU.opened[namespace][name] != 'undefined') {
+ ESX_MENU.close(namespace, name);
+ }
+
+ data._namespace = namespace;
+ data._name = name;
+
+ ESX_MENU.opened[namespace][name] = data;
+
+ ESX_MENU.focus.push({
+ namespace: namespace,
+ name: name,
+ });
+
+ ESX_MENU.render();
+ };
+
+ ESX_MENU.close = function(namespace, name) {
+ delete ESX_MENU.opened[namespace][name];
+
+ for (let i = 0; i < ESX_MENU.focus.length; i++) {
+ if (ESX_MENU.focus[i].namespace === namespace && ESX_MENU.focus[i].name === name) {
+ ESX_MENU.focus.splice(i, 1);
+ break;
+ }
+ }
+
+ ESX_MENU.render();
+ };
+
+ ESX_MENU.render = function() {
+ const menuContainer = document.getElementById('menus');
+ const focused = ESX_MENU.getFocused();
+ menuContainer.innerHTML = '';
+
+ $(menuContainer).hide();
+
+ for (const namespace in ESX_MENU.opened) {
+ if (typeof ESX_MENU.data[namespace] === 'undefined') {
+ ESX_MENU.data[namespace] = {};
+ }
+
+ for (const name in ESX_MENU.opened[namespace]) {
+ ESX_MENU.data[namespace][name] = [];
+
+ const menuData = ESX_MENU.opened[namespace][name];
+ const view = {
+ _namespace: menuData._namespace,
+ _name: menuData._name,
+ head: [],
+ rows: [],
+ };
+
+ for (let i = 0; i < menuData.head.length; i++) {
+ const item = { content: menuData.head[i] };
+ view.head.push(item);
+ }
+
+ for (let i = 0; i < menuData.rows.length; i++) {
+ const row = menuData.rows[i];
+ const data = row.data;
+
+ ESX_MENU.data[namespace][name].push(data);
+
+ view.rows.push({ cols: [] });
+
+ for (let j = 0; j < row.cols.length; j++) {
+ let col = menuData.rows[i].cols[j];
+ const regex = /\{\{(.*?)\|(.*?)\}\}/g;
+ const matches = [];
+ let match;
+
+ while ((match = regex.exec(col)) != null) {
+ matches.push(match);
+ }
+
+ for (let k = 0; k < matches.length; k++) {
+ col = col.replace('{{' + matches[k][1] + '|' + matches[k][2] + '}}', '');
+ }
+
+ view.rows[i].cols.push({ data: data, content: col });
+ }
+ }
+
+ const menu = $(Mustache.render(MenuTpl, view));
+
+ menu.find('button[data-namespace][data-name]').click(function() {
+ ESX_MENU.data[$(this).data('namespace')][$(this).data('name')][parseInt($(this).data('id'))].currentRow = parseInt($(this).data('id')) + 1;
+ ESX_MENU.submit($(this).data('namespace'), $(this).data('name'), {
+ data: ESX_MENU.data[$(this).data('namespace')][$(this).data('name')][parseInt($(this).data('id'))],
+ value: $(this).data('value'),
+ });
+ });
+
+ menu.hide();
+
+ menuContainer.appendChild(menu[0]);
+ }
+ }
+
+ if (typeof focused != 'undefined') {
+ $('#menu_' + focused.namespace + '_' + focused.name).show();
+ }
+
+ $(menuContainer).show();
+ };
+
+ ESX_MENU.submit = function(namespace, name, data) {
+ $.post(
+ 'http://' + ESX_MENU.ResourceName + '/menu_submit',
+ JSON.stringify({
+ _namespace: namespace,
+ _name: name,
+ data: data.data,
+ value: data.value,
+ }),
+ );
+ };
+
+ ESX_MENU.cancel = function(namespace, name) {
+ $.post(
+ 'http://' + ESX_MENU.ResourceName + '/menu_cancel',
+ JSON.stringify({
+ _namespace: namespace,
+ _name: name,
+ }),
+ );
+ };
+
+ ESX_MENU.getFocused = function() {
+ return ESX_MENU.focus[ESX_MENU.focus.length - 1];
+ };
+
+ window.onData = (data) => {
+ switch (data.action) {
+ case 'openMenu': {
+ ESX_MENU.open(data.namespace, data.name, data.data);
+ break;
+ }
+
+ case 'closeMenu': {
+ ESX_MENU.close(data.namespace, data.name);
+ break;
+ }
+ }
+ };
+
+ window.onload = function() {
+ window.addEventListener('message', (event) => {
+ onData(event.data);
+ });
+ };
+
+ document.onkeyup = function(data) {
+ if (data.which === 27) {
+ const focused = ESX_MENU.getFocused();
+ ESX_MENU.cancel(focused.namespace, focused.name);
+ }
+ };
})();
diff --git a/server-data/resources/[esx]/esx_menu_list/html/js/mustache.min.js b/server-data/resources/[esx]/esx_menu_list/html/js/mustache.min.js
index f36565977..049f60333 100644
--- a/server-data/resources/[esx]/esx_menu_list/html/js/mustache.min.js
+++ b/server-data/resources/[esx]/esx_menu_list/html/js/mustache.min.js
@@ -1,347 +1,364 @@
(function defineMustache(global, factory) {
- if (typeof exports === "object" && exports && typeof exports.nodeName !== "string") {
- factory(exports);
- } else if (typeof define === "function" && define.amd) {
- define(["exports"], factory);
- } else {
- global.Mustache = {};
- factory(global.Mustache);
- }
+ if (typeof exports === 'object' && exports && typeof exports.nodeName !== 'string') {
+ factory(exports);
+ }
+ else if (typeof define === 'function' && define.amd) {
+ define(['exports'], factory);
+ }
+ else {
+ global.Mustache = {};
+ factory(global.Mustache);
+ }
})(this, function mustacheFactory(mustache) {
- var objectToString = Object.prototype.toString;
- var isArray =
+ const objectToString = Object.prototype.toString;
+ const isArray =
Array.isArray ||
function isArrayPolyfill(object) {
- return objectToString.call(object) === "[object Array]";
+ return objectToString.call(object) === '[object Array]';
};
- function isFunction(object) {
- return typeof object === "function";
- }
- function typeStr(obj) {
- return isArray(obj) ? "array" : typeof obj;
- }
- function escapeRegExp(string) {
- return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
- }
- function hasProperty(obj, propName) {
- return obj != null && typeof obj === "object" && propName in obj;
- }
- var regExpTest = RegExp.prototype.test;
- function testRegExp(re, string) {
- return regExpTest.call(re, string);
- }
- var nonSpaceRe = /\S/;
- function isWhitespace(string) {
- return !testRegExp(nonSpaceRe, string);
- }
- var entityMap = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", "/": "/", "`": "`", "=": "=" };
- function escapeHtml(string) {
- return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap(s) {
- return entityMap[s];
- });
- }
- var whiteRe = /\s*/;
- var spaceRe = /\s+/;
- var equalsRe = /\s*=/;
- var curlyRe = /\s*\}/;
- var tagRe = /#|\^|\/|>|\{|&|=|!/;
- function parseTemplate(template, tags) {
- if (!template) return [];
- var sections = [];
- var tokens = [];
- var spaces = [];
- var hasTag = false;
- var nonSpace = false;
- function stripSpace() {
- if (hasTag && !nonSpace) {
- while (spaces.length) delete tokens[spaces.pop()];
- } else {
- spaces = [];
- }
- hasTag = false;
- nonSpace = false;
- }
- var openingTagRe, closingTagRe, closingCurlyRe;
- function compileTags(tagsToCompile) {
- if (typeof tagsToCompile === "string") tagsToCompile = tagsToCompile.split(spaceRe, 2);
- if (!isArray(tagsToCompile) || tagsToCompile.length !== 2) throw new Error("Invalid tags: " + tagsToCompile);
- openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + "\\s*");
- closingTagRe = new RegExp("\\s*" + escapeRegExp(tagsToCompile[1]));
- closingCurlyRe = new RegExp("\\s*" + escapeRegExp("}" + tagsToCompile[1]));
- }
- compileTags(tags || mustache.tags);
- var scanner = new Scanner(template);
- var start, type, value, chr, token, openSection;
- while (!scanner.eos()) {
- start = scanner.pos;
- value = scanner.scanUntil(openingTagRe);
- if (value) {
- for (var i = 0, valueLength = value.length; i < valueLength; ++i) {
- chr = value.charAt(i);
- if (isWhitespace(chr)) {
- spaces.push(tokens.length);
- } else {
- nonSpace = true;
- }
- tokens.push(["text", chr, start, start + 1]);
- start += 1;
- if (chr === "\n") stripSpace();
- }
- }
- if (!scanner.scan(openingTagRe)) break;
- hasTag = true;
- type = scanner.scan(tagRe) || "name";
- scanner.scan(whiteRe);
- if (type === "=") {
- value = scanner.scanUntil(equalsRe);
- scanner.scan(equalsRe);
- scanner.scanUntil(closingTagRe);
- } else if (type === "{") {
- value = scanner.scanUntil(closingCurlyRe);
- scanner.scan(curlyRe);
- scanner.scanUntil(closingTagRe);
- type = "&";
- } else {
- value = scanner.scanUntil(closingTagRe);
- }
- if (!scanner.scan(closingTagRe)) throw new Error("Unclosed tag at " + scanner.pos);
- token = [type, value, start, scanner.pos];
- tokens.push(token);
- if (type === "#" || type === "^") {
- sections.push(token);
- } else if (type === "/") {
- openSection = sections.pop();
- if (!openSection) throw new Error('Unopened section "' + value + '" at ' + start);
- if (openSection[1] !== value) throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
- } else if (type === "name" || type === "{" || type === "&") {
- nonSpace = true;
- } else if (type === "=") {
- compileTags(value);
- }
- }
- openSection = sections.pop();
- if (openSection) throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
- return nestTokens(squashTokens(tokens));
- }
- function squashTokens(tokens) {
- var squashedTokens = [];
- var token, lastToken;
- for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
- token = tokens[i];
- if (token) {
- if (token[0] === "text" && lastToken && lastToken[0] === "text") {
- lastToken[1] += token[1];
- lastToken[3] = token[3];
- } else {
- squashedTokens.push(token);
- lastToken = token;
- }
- }
- }
- return squashedTokens;
- }
- function nestTokens(tokens) {
- var nestedTokens = [];
- var collector = nestedTokens;
- var sections = [];
- var token, section;
- for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
- token = tokens[i];
- switch (token[0]) {
- case "#":
- case "^":
- collector.push(token);
- sections.push(token);
- collector = token[4] = [];
- break;
- case "/":
- section = sections.pop();
- section[5] = token[2];
- collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
- break;
- default:
- collector.push(token);
- }
- }
- return nestedTokens;
- }
- function Scanner(string) {
- this.string = string;
- this.tail = string;
- this.pos = 0;
- }
- Scanner.prototype.eos = function eos() {
- return this.tail === "";
- };
- Scanner.prototype.scan = function scan(re) {
- var match = this.tail.match(re);
- if (!match || match.index !== 0) return "";
- var string = match[0];
- this.tail = this.tail.substring(string.length);
- this.pos += string.length;
- return string;
- };
- Scanner.prototype.scanUntil = function scanUntil(re) {
- var index = this.tail.search(re),
- match;
- switch (index) {
- case -1:
- match = this.tail;
- this.tail = "";
- break;
- case 0:
- match = "";
- break;
- default:
- match = this.tail.substring(0, index);
- this.tail = this.tail.substring(index);
- }
- this.pos += match.length;
- return match;
- };
- function Context(view, parentContext) {
- this.view = view;
- this.cache = { ".": this.view };
- this.parent = parentContext;
- }
- Context.prototype.push = function push(view) {
- return new Context(view, this);
- };
- Context.prototype.lookup = function lookup(name) {
- var cache = this.cache;
- var value;
- if (cache.hasOwnProperty(name)) {
- value = cache[name];
- } else {
- var context = this,
- names,
- index,
- lookupHit = false;
- while (context) {
- if (name.indexOf(".") > 0) {
- value = context.view;
- names = name.split(".");
- index = 0;
- while (value != null && index < names.length) {
- if (index === names.length - 1) lookupHit = hasProperty(value, names[index]);
- value = value[names[index++]];
- }
- } else {
- value = context.view[name];
- lookupHit = hasProperty(context.view, name);
- }
- if (lookupHit) break;
- context = context.parent;
- }
- cache[name] = value;
- }
- if (isFunction(value)) value = value.call(this.view);
- return value;
- };
- function Writer() {
- this.cache = {};
- }
- Writer.prototype.clearCache = function clearCache() {
- this.cache = {};
- };
- Writer.prototype.parse = function parse(template, tags) {
- var cache = this.cache;
- var tokens = cache[template];
- if (tokens == null) tokens = cache[template] = parseTemplate(template, tags);
- return tokens;
- };
- Writer.prototype.render = function render(template, view, partials) {
- var tokens = this.parse(template);
- var context = view instanceof Context ? view : new Context(view);
- return this.renderTokens(tokens, context, partials, template);
- };
- Writer.prototype.renderTokens = function renderTokens(tokens, context, partials, originalTemplate) {
- var buffer = "";
- var token, symbol, value;
- for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
- value = undefined;
- token = tokens[i];
- symbol = token[0];
- if (symbol === "#") value = this.renderSection(token, context, partials, originalTemplate);
- else if (symbol === "^") value = this.renderInverted(token, context, partials, originalTemplate);
- else if (symbol === ">") value = this.renderPartial(token, context, partials, originalTemplate);
- else if (symbol === "&") value = this.unescapedValue(token, context);
- else if (symbol === "name") value = this.escapedValue(token, context);
- else if (symbol === "text") value = this.rawValue(token);
- if (value !== undefined) buffer += value;
- }
- return buffer;
- };
- Writer.prototype.renderSection = function renderSection(token, context, partials, originalTemplate) {
- var self = this;
- var buffer = "";
- var value = context.lookup(token[1]);
- function subRender(template) {
- return self.render(template, context, partials);
- }
- if (!value) return;
- if (isArray(value)) {
- for (var j = 0, valueLength = value.length; j < valueLength; ++j) {
- buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate);
- }
- } else if (typeof value === "object" || typeof value === "string" || typeof value === "number") {
- buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate);
- } else if (isFunction(value)) {
- if (typeof originalTemplate !== "string") throw new Error("Cannot use higher-order sections without the original template");
- value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);
- if (value != null) buffer += value;
- } else {
- buffer += this.renderTokens(token[4], context, partials, originalTemplate);
- }
- return buffer;
- };
- Writer.prototype.renderInverted = function renderInverted(token, context, partials, originalTemplate) {
- var value = context.lookup(token[1]);
- if (!value || (isArray(value) && value.length === 0)) return this.renderTokens(token[4], context, partials, originalTemplate);
- };
- Writer.prototype.renderPartial = function renderPartial(token, context, partials) {
- if (!partials) return;
- var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
- if (value != null) return this.renderTokens(this.parse(value), context, partials, value);
- };
- Writer.prototype.unescapedValue = function unescapedValue(token, context) {
- var value = context.lookup(token[1]);
- if (value != null) return value;
- };
- Writer.prototype.escapedValue = function escapedValue(token, context) {
- var value = context.lookup(token[1]);
- if (value != null) return mustache.escape(value);
- };
- Writer.prototype.rawValue = function rawValue(token) {
- return token[1];
- };
- mustache.name = "mustache.js";
- mustache.version = "2.3.0";
- mustache.tags = ["{{", "}}"];
- var defaultWriter = new Writer();
- mustache.clearCache = function clearCache() {
- return defaultWriter.clearCache();
- };
- mustache.parse = function parse(template, tags) {
- return defaultWriter.parse(template, tags);
- };
- mustache.render = function render(template, view, partials) {
- if (typeof template !== "string") {
- throw new TypeError('Invalid template! Template should be a "string" ' + 'but "' + typeStr(template) + '" was given as the first ' + "argument for mustache#render(template, view, partials)");
- }
- return defaultWriter.render(template, view, partials);
- };
- mustache.to_html = function to_html(template, view, partials, send) {
- var result = mustache.render(template, view, partials);
- if (isFunction(send)) {
- send(result);
- } else {
- return result;
- }
- };
- mustache.escape = escapeHtml;
- mustache.Scanner = Scanner;
- mustache.Context = Context;
- mustache.Writer = Writer;
- return mustache;
+ function isFunction(object) {
+ return typeof object === 'function';
+ }
+ function typeStr(obj) {
+ return isArray(obj) ? 'array' : typeof obj;
+ }
+ function escapeRegExp(string) {
+ return string.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
+ }
+ function hasProperty(obj, propName) {
+ return obj != null && typeof obj === 'object' && propName in obj;
+ }
+ const regExpTest = RegExp.prototype.test;
+ function testRegExp(re, string) {
+ return regExpTest.call(re, string);
+ }
+ const nonSpaceRe = /\S/;
+ function isWhitespace(string) {
+ return !testRegExp(nonSpaceRe, string);
+ }
+ const entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''', '/': '/', '`': '`', '=': '=' };
+ function escapeHtml(string) {
+ return String(string).replace(/[&<>"'`=/]/g, function fromEntityMap(s) {
+ return entityMap[s];
+ });
+ }
+ const whiteRe = /\s*/;
+ const spaceRe = /\s+/;
+ const equalsRe = /\s*=/;
+ const curlyRe = /\s*\}/;
+ const tagRe = /#|\^|\/|>|\{|&|=|!/;
+ function parseTemplate(template, tags) {
+ if (!template) return [];
+ const sections = [];
+ const tokens = [];
+ let spaces = [];
+ let hasTag = false;
+ let nonSpace = false;
+ function stripSpace() {
+ if (hasTag && !nonSpace) {
+ while (spaces.length) delete tokens[spaces.pop()];
+ }
+ else {
+ spaces = [];
+ }
+ hasTag = false;
+ nonSpace = false;
+ }
+ let openingTagRe, closingTagRe, closingCurlyRe;
+ function compileTags(tagsToCompile) {
+ if (typeof tagsToCompile === 'string') tagsToCompile = tagsToCompile.split(spaceRe, 2);
+ if (!isArray(tagsToCompile) || tagsToCompile.length !== 2) throw new Error('Invalid tags: ' + tagsToCompile);
+ openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + '\\s*');
+ closingTagRe = new RegExp('\\s*' + escapeRegExp(tagsToCompile[1]));
+ closingCurlyRe = new RegExp('\\s*' + escapeRegExp('}' + tagsToCompile[1]));
+ }
+ compileTags(tags || mustache.tags);
+ const scanner = new Scanner(template);
+ let start, type, value, chr, token, openSection;
+ while (!scanner.eos()) {
+ start = scanner.pos;
+ value = scanner.scanUntil(openingTagRe);
+ if (value) {
+ for (let i = 0, valueLength = value.length; i < valueLength; ++i) {
+ chr = value.charAt(i);
+ if (isWhitespace(chr)) {
+ spaces.push(tokens.length);
+ }
+ else {
+ nonSpace = true;
+ }
+ tokens.push(['text', chr, start, start + 1]);
+ start += 1;
+ if (chr === '\n') stripSpace();
+ }
+ }
+ if (!scanner.scan(openingTagRe)) break;
+ hasTag = true;
+ type = scanner.scan(tagRe) || 'name';
+ scanner.scan(whiteRe);
+ if (type === '=') {
+ value = scanner.scanUntil(equalsRe);
+ scanner.scan(equalsRe);
+ scanner.scanUntil(closingTagRe);
+ }
+ else if (type === '{') {
+ value = scanner.scanUntil(closingCurlyRe);
+ scanner.scan(curlyRe);
+ scanner.scanUntil(closingTagRe);
+ type = '&';
+ }
+ else {
+ value = scanner.scanUntil(closingTagRe);
+ }
+ if (!scanner.scan(closingTagRe)) throw new Error('Unclosed tag at ' + scanner.pos);
+ token = [type, value, start, scanner.pos];
+ tokens.push(token);
+ if (type === '#' || type === '^') {
+ sections.push(token);
+ }
+ else if (type === '/') {
+ openSection = sections.pop();
+ if (!openSection) throw new Error('Unopened section "' + value + '" at ' + start);
+ if (openSection[1] !== value) throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
+ }
+ else if (type === 'name' || type === '{' || type === '&') {
+ nonSpace = true;
+ }
+ else if (type === '=') {
+ compileTags(value);
+ }
+ }
+ openSection = sections.pop();
+ if (openSection) throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
+ return nestTokens(squashTokens(tokens));
+ }
+ function squashTokens(tokens) {
+ const squashedTokens = [];
+ let token, lastToken;
+ for (let i = 0, numTokens = tokens.length; i < numTokens; ++i) {
+ token = tokens[i];
+ if (token) {
+ if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
+ lastToken[1] += token[1];
+ lastToken[3] = token[3];
+ }
+ else {
+ squashedTokens.push(token);
+ lastToken = token;
+ }
+ }
+ }
+ return squashedTokens;
+ }
+ function nestTokens(tokens) {
+ const nestedTokens = [];
+ let collector = nestedTokens;
+ const sections = [];
+ let token, section;
+ for (let i = 0, numTokens = tokens.length; i < numTokens; ++i) {
+ token = tokens[i];
+ switch (token[0]) {
+ case '#':
+ case '^':
+ collector.push(token);
+ sections.push(token);
+ collector = token[4] = [];
+ break;
+ case '/':
+ section = sections.pop();
+ section[5] = token[2];
+ collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
+ break;
+ default:
+ collector.push(token);
+ }
+ }
+ return nestedTokens;
+ }
+ function Scanner(string) {
+ this.string = string;
+ this.tail = string;
+ this.pos = 0;
+ }
+ Scanner.prototype.eos = function eos() {
+ return this.tail === '';
+ };
+ Scanner.prototype.scan = function scan(re) {
+ const match = this.tail.match(re);
+ if (!match || match.index !== 0) return '';
+ const string = match[0];
+ this.tail = this.tail.substring(string.length);
+ this.pos += string.length;
+ return string;
+ };
+ Scanner.prototype.scanUntil = function scanUntil(re) {
+ // eslint-disable-next-line prefer-const
+ let index = this.tail.search(re),
+ match;
+ switch (index) {
+ case -1:
+ match = this.tail;
+ this.tail = '';
+ break;
+ case 0:
+ match = '';
+ break;
+ default:
+ match = this.tail.substring(0, index);
+ this.tail = this.tail.substring(index);
+ }
+ this.pos += match.length;
+ return match;
+ };
+ function Context(view, parentContext) {
+ this.view = view;
+ this.cache = { '.': this.view };
+ this.parent = parentContext;
+ }
+ Context.prototype.push = function push(view) {
+ return new Context(view, this);
+ };
+ Context.prototype.lookup = function lookup(name) {
+ const cache = this.cache;
+ let value;
+ if (Object.prototype.hasOwnProperty.call(cache, name)) {
+ value = cache[name];
+ }
+ else {
+ let context = this,
+ names,
+ index,
+ lookupHit = false;
+ while (context) {
+ if (name.indexOf('.') > 0) {
+ value = context.view;
+ names = name.split('.');
+ index = 0;
+ while (value != null && index < names.length) {
+ if (index === names.length - 1) lookupHit = hasProperty(value, names[index]);
+ value = value[names[index++]];
+ }
+ }
+ else {
+ value = context.view[name];
+ lookupHit = hasProperty(context.view, name);
+ }
+ if (lookupHit) break;
+ context = context.parent;
+ }
+ cache[name] = value;
+ }
+ if (isFunction(value)) value = value.call(this.view);
+ return value;
+ };
+ function Writer() {
+ this.cache = {};
+ }
+ Writer.prototype.clearCache = function clearCache() {
+ this.cache = {};
+ };
+ Writer.prototype.parse = function parse(template, tags) {
+ const cache = this.cache;
+ let tokens = cache[template];
+ if (tokens == null) tokens = cache[template] = parseTemplate(template, tags);
+ return tokens;
+ };
+ Writer.prototype.render = function render(template, view, partials) {
+ const tokens = this.parse(template);
+ const context = view instanceof Context ? view : new Context(view);
+ return this.renderTokens(tokens, context, partials, template);
+ };
+ Writer.prototype.renderTokens = function renderTokens(tokens, context, partials, originalTemplate) {
+ let buffer = '';
+ let token, symbol, value;
+ for (let i = 0, numTokens = tokens.length; i < numTokens; ++i) {
+ value = undefined;
+ token = tokens[i];
+ symbol = token[0];
+ if (symbol === '#') value = this.renderSection(token, context, partials, originalTemplate);
+ else if (symbol === '^') value = this.renderInverted(token, context, partials, originalTemplate);
+ else if (symbol === '>') value = this.renderPartial(token, context, partials, originalTemplate);
+ else if (symbol === '&') value = this.unescapedValue(token, context);
+ else if (symbol === 'name') value = this.escapedValue(token, context);
+ else if (symbol === 'text') value = this.rawValue(token);
+ if (value !== undefined) buffer += value;
+ }
+ return buffer;
+ };
+ Writer.prototype.renderSection = function renderSection(token, context, partials, originalTemplate) {
+ const self = this;
+ let buffer = '';
+ let value = context.lookup(token[1]);
+ function subRender(template) {
+ return self.render(template, context, partials);
+ }
+ if (!value) return;
+ if (isArray(value)) {
+ for (let j = 0, valueLength = value.length; j < valueLength; ++j) {
+ buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate);
+ }
+ }
+ else if (typeof value === 'object' || typeof value === 'string' || typeof value === 'number') {
+ buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate);
+ }
+ else if (isFunction(value)) {
+ if (typeof originalTemplate !== 'string') throw new Error('Cannot use higher-order sections without the original template');
+ value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);
+ if (value != null) buffer += value;
+ }
+ else {
+ buffer += this.renderTokens(token[4], context, partials, originalTemplate);
+ }
+ return buffer;
+ };
+ Writer.prototype.renderInverted = function renderInverted(token, context, partials, originalTemplate) {
+ const value = context.lookup(token[1]);
+ if (!value || (isArray(value) && value.length === 0)) return this.renderTokens(token[4], context, partials, originalTemplate);
+ };
+ Writer.prototype.renderPartial = function renderPartial(token, context, partials) {
+ if (!partials) return;
+ const value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
+ if (value != null) return this.renderTokens(this.parse(value), context, partials, value);
+ };
+ Writer.prototype.unescapedValue = function unescapedValue(token, context) {
+ const value = context.lookup(token[1]);
+ if (value != null) return value;
+ };
+ Writer.prototype.escapedValue = function escapedValue(token, context) {
+ const value = context.lookup(token[1]);
+ if (value != null) return mustache.escape(value);
+ };
+ Writer.prototype.rawValue = function rawValue(token) {
+ return token[1];
+ };
+ mustache.name = 'mustache.js';
+ mustache.version = '2.3.0';
+ mustache.tags = ['{{', '}}'];
+ const defaultWriter = new Writer();
+ mustache.clearCache = function clearCache() {
+ return defaultWriter.clearCache();
+ };
+ mustache.parse = function parse(template, tags) {
+ return defaultWriter.parse(template, tags);
+ };
+ mustache.render = function render(template, view, partials) {
+ if (typeof template !== 'string') {
+ throw new TypeError('Invalid template! Template should be a "string" ' + 'but "' + typeStr(template) + '" was given as the first ' + 'argument for mustache#render(template, view, partials)');
+ }
+ return defaultWriter.render(template, view, partials);
+ };
+ mustache.to_html = function to_html(template, view, partials, send) {
+ const result = mustache.render(template, view, partials);
+ if (isFunction(send)) {
+ send(result);
+ }
+ else {
+ return result;
+ }
+ };
+ mustache.escape = escapeHtml;
+ mustache.Scanner = Scanner;
+ mustache.Context = Context;
+ mustache.Writer = Writer;
+ return mustache;
});
diff --git a/server-data/resources/[esx]/esx_society/client/main.lua b/server-data/resources/[esx]/esx_society/client/main.lua
index 3bbd79f8f..a5a9d61c9 100644
--- a/server-data/resources/[esx]/esx_society/client/main.lua
+++ b/server-data/resources/[esx]/esx_society/client/main.lua
@@ -1,483 +1,467 @@
RegisterNetEvent("esx:setJob")
AddEventHandler("esx:setJob", function(job)
- ESX.PlayerData.job = job
- RefreshBussHUD()
+ ESX.PlayerData.job = job
+ RefreshBussHUD()
end)
RegisterNetEvent("esx:playerLoaded")
AddEventHandler("esx:playerLoaded", function(xPlayer)
- ESX.PlayerData = xPlayer
- ESX.PlayerLoaded = true
- RefreshBussHUD()
+ ESX.PlayerData = xPlayer
+ ESX.PlayerLoaded = true
+ RefreshBussHUD()
end)
function RefreshBussHUD()
- DisableSocietyMoneyHUDElement()
+ DisableSocietyMoneyHUDElement()
- if ESX.PlayerData.job.grade_name == "boss" then
- EnableSocietyMoneyHUDElement()
+ if ESX.PlayerData.job.grade_name == "boss" then
+ EnableSocietyMoneyHUDElement()
- ESX.TriggerServerCallback("esx_society:getSocietyMoney", function(money)
- UpdateSocietyMoneyHUDElement(money)
- end, ESX.PlayerData.job.name)
- end
+ ESX.TriggerServerCallback("esx_society:getSocietyMoney", function(money)
+ UpdateSocietyMoneyHUDElement(money)
+ end, ESX.PlayerData.job.name)
+ end
end
RegisterNetEvent("bpt_addonaccount:setMoney")
AddEventHandler("bpt_addonaccount:setMoney", function(society, money)
- if
- ESX.PlayerData.job
- and ESX.PlayerData.job.grade_name == "boss"
- and "society_" .. ESX.PlayerData.job.name == society
- then
- UpdateSocietyMoneyHUDElement(money)
- end
+ if ESX.PlayerData.job and ESX.PlayerData.job.grade_name == "boss" and "society_" .. ESX.PlayerData.job.name == society then
+ UpdateSocietyMoneyHUDElement(money)
+ end
end)
function EnableSocietyMoneyHUDElement()
- TriggerEvent("esx_society:toggleSocietyHud", true)
+ TriggerEvent("esx_society:toggleSocietyHud", true)
end
function DisableSocietyMoneyHUDElement()
- TriggerEvent("esx_society:toggleSocietyHud", false)
+ TriggerEvent("esx_society:toggleSocietyHud", false)
end
function UpdateSocietyMoneyHUDElement(money)
- TriggerEvent("esx_society:setSocietyMoney", money)
+ TriggerEvent("esx_society:setSocietyMoney", money)
end
function OpenBossMenu(society, _, options)
- options = options or {}
- local elements = {
- { unselectable = true, icon = "fas fa-user", title = _U("boss_menu") },
- }
-
- ESX.TriggerServerCallback("esx_society:isBoss", function(isBoss)
- if isBoss then
- local defaultOptions = {
- checkBal = true,
- withdraw = true,
- deposit = true,
- wash = true,
- employees = true,
- salary = true,
- grades = true,
- }
-
- for k, v in pairs(defaultOptions) do
- if options[k] == nil then
- options[k] = v
- end
- end
-
- if options.checkBal then
- elements[#elements + 1] =
- { icon = "fas fa-wallet", title = _U("check_society_balance"), value = "check_society_balance" }
- end
- if options.withdraw then
- elements[#elements + 1] =
- { icon = "fas fa-wallet", title = _U("withdraw_society_money"), value = "withdraw_society_money" }
- end
- if options.deposit then
- elements[#elements + 1] =
- { icon = "fas fa-wallet", title = _U("deposit_society_money"), value = "deposit_money" }
- end
- if options.wash then
- elements[#elements + 1] = { icon = "fas fa-wallet", title = _U("wash_money"), value = "wash_money" }
- end
- if options.employees then
- elements[#elements + 1] =
- { icon = "fas fa-users", title = _U("employee_management"), value = "manage_employees" }
- end
- if options.salary then
- elements[#elements + 1] =
- { icon = "fas fa-wallet", title = _U("salary_management"), value = "manage_salary" }
- end
- if options.grades then
- elements[#elements + 1] =
- { icon = "fas fa-scroll", title = _U("grade_management"), value = "manage_grades" }
- end
-
- ESX.OpenContext("right", elements, function(menu, element)
- if element.value == "check_society_balance" then
- TriggerServerEvent("esx_society:checkSocietyBalance", society)
- elseif element.value == "withdraw_society_money" then
- local elements = {
- {
- unselectable = true,
- icon = "fas fa-wallet",
- title = _U("withdraw_amount"),
- description = "Withdraw money from the society account",
- },
- {
- icon = "fas fa-wallet",
- title = "Amount",
- input = true,
- inputType = "number",
- inputPlaceholder = "Amount to withdraw..",
- inputMin = 1,
- inputMax = 250000,
- name = "withdraw",
- },
- { icon = "fas fa-check", title = "Confirm", value = "confirm" },
- { icon = "fas fa-arrow-left", title = "Return", value = "return" },
- }
- ESX.RefreshContext(elements)
- elseif element.value == "confirm" then
- local amount = tonumber(menu.eles[2].inputValue)
- if amount == nil then
- ESX.ShowNotification(_U("invalid_amount"))
- else
- TriggerServerEvent("esx_society:withdrawMoney", society, amount)
- ESX.CloseContext()
- end
- elseif element.value == "deposit_money" then
- local elements = {
- {
- unselectable = true,
- icon = "fas fa-wallet",
- title = _U("deposit_amount"),
- description = "Deposit some money into the society account",
- },
- {
- icon = "fas fa-wallet",
- title = "Amount",
- input = true,
- inputType = "number",
- inputPlaceholder = "Amount to deposit..",
- inputMin = 1,
- inputMax = 250000,
- name = "deposit",
- },
- { icon = "fas fa-check", title = "Confirm", value = "confirm2" },
- { icon = "fas fa-arrow-left", title = "Return", value = "return" },
- }
- ESX.RefreshContext(elements)
- elseif element.value == "confirm2" then
- local amount = tonumber(menu.eles[2].inputValue)
- if amount == nil then
- ESX.ShowNotification(_U("invalid_amount"))
- else
- TriggerServerEvent("esx_society:depositMoney", society, amount)
- ESX.CloseContext()
- end
- elseif element.value == "wash_money" then
- local elements = {
- {
- unselectable = true,
- icon = "fas fa-wallet",
- title = _U("wash_money_amount"),
- description = "Deposit some money into the money wash",
- },
- {
- icon = "fas fa-wallet",
- title = "Amount",
- input = true,
- inputType = "number",
- inputPlaceholder = "Amount to wash..",
- inputMin = 1,
- inputMax = 250000,
- name = "wash",
- },
- { icon = "fas fa-check", title = "Confirm", value = "confirm3" },
- { icon = "fas fa-arrow-left", title = "Return", value = "return" },
- }
- ESX.RefreshContext(elements)
- elseif element.value == "confirm3" then
- local amount = tonumber(menu.eles[2].inputValue)
- if amount == nil then
- ESX.ShowNotification(_U("invalid_amount"))
- else
- TriggerServerEvent("esx_society:washMoney", society, amount)
- ESX.CloseContext()
- end
- elseif element.value == "manage_employees" then
- OpenManageEmployeesMenu(society, options)
- elseif element.value == "manage_salary" then
- OpenManageSalaryMenu(society, options)
- elseif element.value == "manage_grades" then
- OpenManageGradesMenu(society, options)
- elseif element.value == "return" then
- OpenBossMenu(society, nil, options)
- end
- end)
- end
- end, society)
+ options = options or {}
+ local elements = {
+ { unselectable = true, icon = "fas fa-user", title = TranslateCap("boss_menu") },
+ }
+
+ ESX.TriggerServerCallback("esx_society:isBoss", function(isBoss)
+ if isBoss then
+ local defaultOptions = {
+ checkBal = true,
+ withdraw = true,
+ deposit = true,
+ wash = true,
+ employees = true,
+ salary = true,
+ grades = true,
+ }
+
+ for k, v in pairs(defaultOptions) do
+ if options[k] == nil then
+ options[k] = v
+ end
+ end
+
+ if options.checkBal then
+ elements[#elements + 1] = { icon = "fas fa-wallet", title = TranslateCap("check_society_balance"), value = "check_society_balance" }
+ end
+ if options.withdraw then
+ elements[#elements + 1] = { icon = "fas fa-wallet", title = TranslateCap("withdraw_society_money"), value = "withdraw_society_money" }
+ end
+ if options.deposit then
+ elements[#elements + 1] = { icon = "fas fa-wallet", title = TranslateCap("deposit_society_money"), value = "deposit_money" }
+ end
+ if options.wash then
+ elements[#elements + 1] = { icon = "fas fa-wallet", title = TranslateCap("wash_money"), value = "wash_money" }
+ end
+ if options.employees then
+ elements[#elements + 1] = { icon = "fas fa-users", title = TranslateCap("employee_management"), value = "manage_employees" }
+ end
+ if options.salary then
+ elements[#elements + 1] = { icon = "fas fa-wallet", title = TranslateCap("salary_management"), value = "manage_salary" }
+ end
+ if options.grades then
+ elements[#elements + 1] = { icon = "fas fa-scroll", title = TranslateCap("grade_management"), value = "manage_grades" }
+ end
+
+ ESX.OpenContext("right", elements, function(menu, element)
+ if element.value == "check_society_balance" then
+ TriggerServerEvent("esx_society:checkSocietyBalance", society)
+ elseif element.value == "withdraw_society_money" then
+ local elements = {
+ {
+ unselectable = true,
+ icon = "fas fa-wallet",
+ title = TranslateCap("withdraw_amount"),
+ description = "Withdraw money from the society account",
+ },
+ {
+ icon = "fas fa-wallet",
+ title = "Amount",
+ input = true,
+ inputType = "number",
+ inputPlaceholder = "Amount to withdraw..",
+ inputMin = 1,
+ inputMax = 250000,
+ name = "withdraw",
+ },
+ { icon = "fas fa-check", title = "Confirm", value = "confirm" },
+ { icon = "fas fa-arrow-left", title = "Return", value = "return" },
+ }
+ ESX.RefreshContext(elements)
+ elseif element.value == "confirm" then
+ local amount = tonumber(menu.eles[2].inputValue)
+ if amount == nil then
+ ESX.ShowNotification(TranslateCap("invalid_amount"))
+ else
+ TriggerServerEvent("esx_society:withdrawMoney", society, amount)
+ ESX.CloseContext()
+ end
+ elseif element.value == "deposit_money" then
+ local elements = {
+ {
+ unselectable = true,
+ icon = "fas fa-wallet",
+ title = TranslateCap("deposit_amount"),
+ description = "Deposit some money into the society account",
+ },
+ {
+ icon = "fas fa-wallet",
+ title = "Amount",
+ input = true,
+ inputType = "number",
+ inputPlaceholder = "Amount to deposit..",
+ inputMin = 1,
+ inputMax = 250000,
+ name = "deposit",
+ },
+ { icon = "fas fa-check", title = "Confirm", value = "confirm2" },
+ { icon = "fas fa-arrow-left", title = "Return", value = "return" },
+ }
+ ESX.RefreshContext(elements)
+ elseif element.value == "confirm2" then
+ local amount = tonumber(menu.eles[2].inputValue)
+ if amount == nil then
+ ESX.ShowNotification(TranslateCap("invalid_amount"))
+ else
+ TriggerServerEvent("esx_society:depositMoney", society, amount)
+ ESX.CloseContext()
+ end
+ elseif element.value == "wash_money" then
+ local elements = {
+ {
+ unselectable = true,
+ icon = "fas fa-wallet",
+ title = TranslateCap("wash_money_amount"),
+ description = "Deposit some money into the money wash",
+ },
+ {
+ icon = "fas fa-wallet",
+ title = "Amount",
+ input = true,
+ inputType = "number",
+ inputPlaceholder = "Amount to wash..",
+ inputMin = 1,
+ inputMax = 250000,
+ name = "wash",
+ },
+ { icon = "fas fa-check", title = "Confirm", value = "confirm3" },
+ { icon = "fas fa-arrow-left", title = "Return", value = "return" },
+ }
+ ESX.RefreshContext(elements)
+ elseif element.value == "confirm3" then
+ local amount = tonumber(menu.eles[2].inputValue)
+ if amount == nil then
+ ESX.ShowNotification(TranslateCap("invalid_amount"))
+ else
+ TriggerServerEvent("esx_society:washMoney", society, amount)
+ ESX.CloseContext()
+ end
+ elseif element.value == "manage_employees" then
+ OpenManageEmployeesMenu(society, options)
+ elseif element.value == "manage_salary" then
+ OpenManageSalaryMenu(society, options)
+ elseif element.value == "manage_grades" then
+ OpenManageGradesMenu(society, options)
+ elseif element.value == "return" then
+ OpenBossMenu(society, nil, options)
+ end
+ end)
+ end
+ end, society)
end
function OpenManageEmployeesMenu(society, options)
- local elements = {
- { unselectable = true, icon = "fas fa-users", title = _U("employee_management") },
- { icon = "fas fa-users", title = _U("employee_list"), value = "employee_list" },
- { icon = "fas fa-users", title = _U("recruit"), value = "recruit" },
- }
-
- elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
-
- ESX.OpenContext("right", elements, function(_, element)
- if element.value == "employee_list" then
- OpenEmployeeList(society, options)
- elseif element.value == "recruit" then
- OpenRecruitMenu(society, options)
- elseif element.value == "return" then
- OpenBossMenu(society, nil, options)
- end
- end)
+ local elements = {
+ { unselectable = true, icon = "fas fa-users", title = TranslateCap("employee_management") },
+ { icon = "fas fa-users", title = TranslateCap("employee_list"), value = "employee_list" },
+ { icon = "fas fa-users", title = TranslateCap("recruit"), value = "recruit" },
+ }
+
+ elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
+
+ ESX.OpenContext("right", elements, function(_, element)
+ if element.value == "employee_list" then
+ OpenEmployeeList(society, options)
+ elseif element.value == "recruit" then
+ OpenRecruitMenu(society, options)
+ elseif element.value == "return" then
+ OpenBossMenu(society, nil, options)
+ end
+ end)
end
function OpenEmployeeList(society, options)
- ESX.TriggerServerCallback("esx_society:getEmployees", function(employees)
- local elements = {
- { unselectable = true, icon = "fas fa-user", title = "Employees" },
- }
-
- for i = 1, #employees, 1 do
- local gradeLabel = (
- employees[i].job.grade_label == "" and employees[i].job.label or employees[i].job.grade_label
- )
-
- elements[#elements + 1] = {
- icon = "fas fa-user",
- title = employees[i].name .. " | " .. gradeLabel,
- gradeLabel = gradeLabel,
- data = employees[i],
- }
- end
-
- elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
-
- ESX.OpenContext("right", elements, function(_, element)
- if element.value == "return" then
- OpenManageEmployeesMenu(society, options)
- else
- local elements2 = {
- { unselectable = true, icon = "fas fa-user", title = element.title },
- { icon = "fas fa-user", title = "Promote", value = "promote" },
- { icon = "fas fa-user", title = "Fire", value = "fire" },
- { icon = "fas fa-arrow-left", title = "Return", value = "return" },
- }
- ESX.OpenContext("right", elements2, function(_, element2)
- local employee = element.data
- if element2.value == "promote" then
- ESX.CloseContext()
- OpenPromoteMenu(society, employee, options)
- elseif element2.value == "fire" then
- ESX.ShowNotification(_U("you_have_fired", employee.name))
-
- ESX.TriggerServerCallback("esx_society:setJob", function()
- OpenEmployeeList(society, options)
- end, employee.identifier, "unemployed", 0, "fire")
- elseif element2.value == "return" then
- OpenEmployeeList(society, options)
- end
- end)
- end
- end)
- end, society)
+ ESX.TriggerServerCallback("esx_society:getEmployees", function(employees)
+ local elements = {
+ { unselectable = true, icon = "fas fa-user", title = "Employees" },
+ }
+
+ for i = 1, #employees, 1 do
+ local gradeLabel = (employees[i].job.grade_label == "" and employees[i].job.label or employees[i].job.grade_label)
+
+ elements[#elements + 1] = {
+ icon = "fas fa-user",
+ title = employees[i].name .. " | " .. gradeLabel,
+ gradeLabel = gradeLabel,
+ data = employees[i],
+ }
+ end
+
+ elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
+
+ ESX.OpenContext("right", elements, function(_, element)
+ if element.value == "return" then
+ OpenManageEmployeesMenu(society, options)
+ else
+ local elements2 = {
+ { unselectable = true, icon = "fas fa-user", title = element.title },
+ { icon = "fas fa-user", title = "Promote", value = "promote" },
+ { icon = "fas fa-user", title = "Fire", value = "fire" },
+ { icon = "fas fa-arrow-left", title = "Return", value = "return" },
+ }
+ ESX.OpenContext("right", elements2, function(_, element2)
+ local employee = element.data
+ if element2.value == "promote" then
+ ESX.CloseContext()
+ OpenPromoteMenu(society, employee, options)
+ elseif element2.value == "fire" then
+ ESX.ShowNotification(TranslateCap("you_have_fired", employee.name))
+
+ ESX.TriggerServerCallback("esx_society:setJob", function()
+ OpenEmployeeList(society, options)
+ end, employee.identifier, "unemployed", 0, "fire")
+ elseif element2.value == "return" then
+ OpenEmployeeList(society, options)
+ end
+ end)
+ end
+ end)
+ end, society)
end
function OpenRecruitMenu(society, options)
- ESX.TriggerServerCallback("esx_society:getOnlinePlayers", function(players)
- local elements = {
- { unselectable = true, icon = "fas fa-user", title = _U("recruiting") },
- }
-
- for i = 1, #players, 1 do
- if players[i].job.name ~= society then
- elements[#elements + 1] = {
- icon = "fas fa-user",
- title = players[i].name,
- value = players[i].source,
- name = players[i].name,
- identifier = players[i].identifier,
- }
- end
- end
-
- elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
-
- ESX.OpenContext("right", elements, function(_, element)
- if element.value == "return" then
- OpenManageEmployeesMenu(society, options)
- else
- local elements2 = {
- { unselectable = true, icon = "fas fa-user", title = "Confirm" },
- { icon = "fas fa-times", title = _U("no"), value = "no" },
- { icon = "fas fa-check", title = _U("yes"), value = "yes" },
- }
- ESX.OpenContext("right", elements2, function(_, element2)
- if element2.value == "yes" then
- ESX.ShowNotification(_U("you_have_hired", element.name))
-
- ESX.TriggerServerCallback("esx_society:setJob", function()
- OpenRecruitMenu(society, options)
- end, element.identifier, society, 0, "hire")
- end
- end)
- end
- end)
- end)
+ ESX.TriggerServerCallback("esx_society:getOnlinePlayers", function(players)
+ local elements = {
+ { unselectable = true, icon = "fas fa-user", title = TranslateCap("recruiting") },
+ }
+
+ for i = 1, #players, 1 do
+ if players[i].job.name ~= society then
+ elements[#elements + 1] = {
+ icon = "fas fa-user",
+ title = players[i].name,
+ value = players[i].source,
+ name = players[i].name,
+ identifier = players[i].identifier,
+ }
+ end
+ end
+
+ elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
+
+ ESX.OpenContext("right", elements, function(_, element)
+ if element.value == "return" then
+ OpenManageEmployeesMenu(society, options)
+ else
+ local elements2 = {
+ { unselectable = true, icon = "fas fa-user", title = "Confirm" },
+ { icon = "fas fa-times", title = TranslateCap("no"), value = "no" },
+ { icon = "fas fa-check", title = TranslateCap("yes"), value = "yes" },
+ }
+ ESX.OpenContext("right", elements2, function(_, element2)
+ if element2.value == "yes" then
+ ESX.ShowNotification(TranslateCap("you_have_hired", element.name))
+
+ ESX.TriggerServerCallback("esx_society:setJob", function()
+ OpenRecruitMenu(society, options)
+ end, element.identifier, society, 0, "hire")
+ end
+ end)
+ end
+ end)
+ end)
end
function OpenPromoteMenu(society, employee, options)
- ESX.TriggerServerCallback("esx_society:getJob", function(job)
- local elements = {
- { unselectable = true, icon = "fas fa-user", title = _U("promote_employee", employee.name) },
- }
-
- for i = 1, #job.grades, 1 do
- local gradeLabel = (job.grades[i].label == "" and job.label or job.grades[i].label)
-
- elements[#elements + 1] = {
- icon = "fas fa-user",
- title = gradeLabel,
- value = job.grades[i].grade,
- selected = (employee.job.grade == job.grades[i].grade),
- }
- end
-
- elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
-
- ESX.OpenContext("right", elements, function(_, element)
- if element.value == "return" then
- OpenEmployeeList(society, options)
- else
- ESX.ShowNotification(_U("you_have_promoted", employee.name, element.title))
-
- ESX.TriggerServerCallback("esx_society:setJob", function()
- OpenEmployeeList(society, options)
- end, employee.identifier, society, element.value, "promote")
- end
- end, function()
- OpenEmployeeList(society, options)
- end)
- end, society)
+ ESX.TriggerServerCallback("esx_society:getJob", function(job)
+ local elements = {
+ { unselectable = true, icon = "fas fa-user", title = TranslateCap("promote_employee", employee.name) },
+ }
+
+ for i = 1, #job.grades, 1 do
+ local gradeLabel = (job.grades[i].label == "" and job.label or job.grades[i].label)
+
+ elements[#elements + 1] = {
+ icon = "fas fa-user",
+ title = gradeLabel,
+ value = job.grades[i].grade,
+ selected = (employee.job.grade == job.grades[i].grade),
+ }
+ end
+
+ elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
+
+ ESX.OpenContext("right", elements, function(_, element)
+ if element.value == "return" then
+ OpenEmployeeList(society, options)
+ else
+ ESX.ShowNotification(TranslateCap("you_have_promoted", employee.name, element.title))
+
+ ESX.TriggerServerCallback("esx_society:setJob", function()
+ OpenEmployeeList(society, options)
+ end, employee.identifier, society, element.value, "promote")
+ end
+ end, function()
+ OpenEmployeeList(society, options)
+ end)
+ end, society)
end
function OpenManageSalaryMenu(society, options)
- ESX.TriggerServerCallback("esx_society:getJob", function(job)
- local elements = {
- { unselectable = true, icon = "fas fa-wallet", title = _U("salary_management") },
- }
-
- for i = 1, #job.grades, 1 do
- local gradeLabel = (job.grades[i].label == "" and job.label or job.grades[i].label)
-
- elements[#elements + 1] = {
- icon = "fas fa-wallet",
- title = ('%s - %s'):format(
- gradeLabel,
- _U("money_generic", ESX.Math.GroupDigits(job.grades[i].salary))
- ),
- value = job.grades[i].grade,
- }
- end
-
- elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
-
- ESX.OpenContext("right", elements, function(menu, element)
- local elements = {
- {
- unselectable = true,
- icon = "fas fa-wallet",
- title = element.title,
- description = "Change a grade salary amount",
- value = element.value,
- },
- {
- icon = "fas fa-wallet",
- title = "Amount",
- input = true,
- inputType = "number",
- inputPlaceholder = "Amount to change grade salary..",
- inputMin = 1,
- inputMax = Config.MaxSalary,
- name = "gradesalary",
- },
- { icon = "fas fa-check", title = "Confirm", value = "confirm" },
- }
-
- ESX.RefreshContext(elements)
- if element.value == "confirm" then
- local amount = tonumber(menu.eles[2].inputValue)
-
- if amount == nil then
- ESX.ShowNotification(_U("invalid_value_nochanges"))
- OpenManageSalaryMenu(society, options)
- elseif amount > Config.MaxSalary then
- ESX.ShowNotification(_U("invalid_amount_max"))
- OpenManageSalaryMenu(society, options)
- else
- ESX.CloseContext()
- ESX.TriggerServerCallback("esx_society:setJobSalary", function()
- OpenManageSalaryMenu(society, options)
- end, society, menu.eles[1].value, amount)
- end
- elseif element.value == "return" then
- OpenBossMenu(society, nil, options)
- end
- end)
- end, society)
+ ESX.TriggerServerCallback("esx_society:getJob", function(job)
+ local elements = {
+ { unselectable = true, icon = "fas fa-wallet", title = TranslateCap("salary_management") },
+ }
+
+ for i = 1, #job.grades, 1 do
+ local gradeLabel = (job.grades[i].label == "" and job.label or job.grades[i].label)
+
+ elements[#elements + 1] = {
+ icon = "fas fa-wallet",
+ title = ('%s - %s'):format(gradeLabel, TranslateCap("money_generic", ESX.Math.GroupDigits(job.grades[i].salary))),
+ value = job.grades[i].grade,
+ }
+ end
+
+ elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
+
+ ESX.OpenContext("right", elements, function(menu, element)
+ local elements = {
+ {
+ unselectable = true,
+ icon = "fas fa-wallet",
+ title = element.title,
+ description = "Change a grade salary amount",
+ value = element.value,
+ },
+ {
+ icon = "fas fa-wallet",
+ title = "Amount",
+ input = true,
+ inputType = "number",
+ inputPlaceholder = "Amount to change grade salary..",
+ inputMin = 1,
+ inputMax = Config.MaxSalary,
+ name = "gradesalary",
+ },
+ { icon = "fas fa-check", title = "Confirm", value = "confirm" },
+ }
+
+ ESX.RefreshContext(elements)
+ if element.value == "confirm" then
+ local amount = tonumber(menu.eles[2].inputValue)
+
+ if amount == nil then
+ ESX.ShowNotification(TranslateCap("invalid_value_nochanges"))
+ OpenManageSalaryMenu(society, options)
+ elseif amount > Config.MaxSalary then
+ ESX.ShowNotification(TranslateCap("invalid_amount_max"))
+ OpenManageSalaryMenu(society, options)
+ else
+ ESX.CloseContext()
+ ESX.TriggerServerCallback("esx_society:setJobSalary", function()
+ OpenManageSalaryMenu(society, options)
+ end, society, menu.eles[1].value, amount)
+ end
+ elseif element.value == "return" then
+ OpenBossMenu(society, nil, options)
+ end
+ end)
+ end, society)
end
function OpenManageGradesMenu(society, options)
- ESX.TriggerServerCallback("esx_society:getJob", function(job)
- local elements = {
- { unselectable = true, icon = "fas fa-wallet", title = _U("grade_management") },
- }
-
- for i = 1, #job.grades, 1 do
- local gradeLabel = (job.grades[i].label == "" and job.label or job.grades[i].label)
-
- elements[#elements + 1] =
- { icon = "fas fa-wallet", title = ("%s"):format(gradeLabel), value = job.grades[i].grade }
- end
-
- elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
-
- ESX.OpenContext("right", elements, function(menu, element)
- local elements = {
- {
- unselectable = true,
- icon = "fas fa-wallet",
- title = element.title,
- description = "Change a grade label",
- value = element.value,
- },
- {
- icon = "fas fa-wallet",
- title = "Label",
- input = true,
- inputType = "text",
- inputPlaceholder = "Label to change job grade label..",
- name = "gradelabel",
- },
- { icon = "fas fa-check", title = "Confirm", value = "confirm" },
- }
-
- ESX.RefreshContext(elements)
- if element.value == "confirm" then
- if menu.eles[2].inputValue then
- local label = tostring(menu.eles[2].inputValue)
-
- ESX.TriggerServerCallback("esx_society:setJobLabel", function()
- OpenManageGradesMenu(society, options)
- end, society, menu.eles[1].value, label)
- else
- ESX.ShowNotification(_U("invalid_value_nochanges"))
- OpenManageGradesMenu(society, options)
- end
- elseif element.value == "return" then
- OpenBossMenu(society, nil, options)
- end
- end)
- end, society)
+ ESX.TriggerServerCallback("esx_society:getJob", function(job)
+ local elements = {
+ { unselectable = true, icon = "fas fa-wallet", title = TranslateCap("grade_management") },
+ }
+
+ for i = 1, #job.grades, 1 do
+ local gradeLabel = (job.grades[i].label == "" and job.label or job.grades[i].label)
+
+ elements[#elements + 1] = { icon = "fas fa-wallet", title = ("%s"):format(gradeLabel), value = job.grades[i].grade }
+ end
+
+ elements[#elements + 1] = { icon = "fas fa-arrow-left", title = "Return", value = "return" }
+
+ ESX.OpenContext("right", elements, function(menu, element)
+ local elements = {
+ {
+ unselectable = true,
+ icon = "fas fa-wallet",
+ title = element.title,
+ description = "Change a grade label",
+ value = element.value,
+ },
+ {
+ icon = "fas fa-wallet",
+ title = "Label",
+ input = true,
+ inputType = "text",
+ inputPlaceholder = "Label to change job grade label..",
+ name = "gradelabel",
+ },
+ { icon = "fas fa-check", title = "Confirm", value = "confirm" },
+ }
+
+ ESX.RefreshContext(elements)
+ if element.value == "confirm" then
+ if menu.eles[2].inputValue then
+ local label = tostring(menu.eles[2].inputValue)
+
+ ESX.TriggerServerCallback("esx_society:setJobLabel", function()
+ OpenManageGradesMenu(society, options)
+ end, society, menu.eles[1].value, label)
+ else
+ ESX.ShowNotification(TranslateCap("invalid_value_nochanges"))
+ OpenManageGradesMenu(society, options)
+ end
+ elseif element.value == "return" then
+ OpenBossMenu(society, nil, options)
+ end
+ end)
+ end, society)
end
AddEventHandler("esx_society:openBossMenu", function(society, close, options)
- OpenBossMenu(society, close, options)
+ OpenBossMenu(society, close, options)
end)
if ESX.PlayerLoaded then
- RefreshBussHUD()
+ RefreshBussHUD()
end
diff --git a/server-data/resources/[esx]/esx_society/server/main.lua b/server-data/resources/[esx]/esx_society/server/main.lua
index 0374b9934..5042493e9 100644
--- a/server-data/resources/[esx]/esx_society/server/main.lua
+++ b/server-data/resources/[esx]/esx_society/server/main.lua
@@ -69,7 +69,7 @@ AddEventHandler("esx_society:checkSocietyBalance", function(society)
end
TriggerEvent("bpt_addonaccount:getSharedAccount", society.account, function(account)
- TriggerClientEvent("esx:showNotification", xPlayer.source, _U("check_balance", ESX.Math.GroupDigits(account.money)))
+ TriggerClientEvent("esx:showNotification", xPlayer.source, TranslateCap("check_balance", ESX.Math.GroupDigits(account.money)))
end)
end)
@@ -88,9 +88,9 @@ AddEventHandler("esx_society:withdrawMoney", function(societyName, amount)
if amount > 0 and account.money >= amount then
account.removeMoney(amount)
xPlayer.addMoney(amount, "Society Withdraw")
- xPlayer.showNotification(_U("have_withdrawn", ESX.Math.GroupDigits(amount)))
+ xPlayer.showNotification(TranslateCap("have_withdrawn", ESX.Math.GroupDigits(amount)))
else
- xPlayer.showNotification(_U("invalid_amount"))
+ xPlayer.showNotification(TranslateCap("invalid_amount"))
end
end)
else
@@ -113,11 +113,11 @@ AddEventHandler("esx_society:depositMoney", function(societyName, amount)
if amount > 0 and xPlayer.getMoney() >= amount then
TriggerEvent("bpt_addonaccount:getSharedAccount", society.account, function(account)
xPlayer.removeMoney(amount, "Society Deposit")
- xPlayer.showNotification(_U("have_deposited", ESX.Math.GroupDigits(amount)))
+ xPlayer.showNotification(TranslateCap("have_deposited", ESX.Math.GroupDigits(amount)))
account.addMoney(amount)
end)
else
- xPlayer.showNotification(_U("invalid_amount"))
+ xPlayer.showNotification(TranslateCap("invalid_amount"))
end
else
print(("[^3WARNING^7] Player ^5%s^7 attempted to deposit to society - ^5%s^7!"):format(source, society.name))
@@ -136,10 +136,10 @@ AddEventHandler("esx_society:washMoney", function(society, amount)
xPlayer.removeAccountMoney("black_money", amount, "Washing")
MySQL.insert("INSERT INTO society_moneywash (identifier, society, amount) VALUES (?, ?, ?)", { xPlayer.identifier, society, amount }, function()
- xPlayer.showNotification(_U("you_have", ESX.Math.GroupDigits(amount)))
+ xPlayer.showNotification(TranslateCap("you_have", ESX.Math.GroupDigits(amount)))
end)
else
- xPlayer.showNotification(_U("invalid_amount"))
+ xPlayer.showNotification(TranslateCap("invalid_amount"))
end
else
print(("[^3WARNING^7] Player ^5%s^7 attempted to wash money in society - ^5%s^7!"):format(source, society))
@@ -294,14 +294,14 @@ ESX.RegisterServerCallback("esx_society:setJob", function(source, cb, identifier
xTarget.setJob(job, grade)
if type == "hire" then
- xTarget.showNotification(_U("you_have_been_hired", job))
- xPlayer.showNotification(_U("you_have_hired", xTarget.getName()))
+ xTarget.showNotification(TranslateCap("you_have_been_hired", job))
+ xPlayer.showNotification(TranslateCap("you_have_hired", xTarget.getName()))
elseif type == "promote" then
- xTarget.showNotification(_U("you_have_been_promoted"))
- xPlayer.showNotification(_U("you_have_promoted", xTarget.getName()))
+ xTarget.showNotification(TranslateCap("you_have_been_promoted"))
+ xPlayer.showNotification(TranslateCap("you_have_promoted", xTarget.getName()))
elseif type == "fire" then
- xTarget.showNotification(_U("you_have_been_fired", xTarget.getJob().label))
- xPlayer.showNotification(_U("you_have_fired", xTarget.getName()))
+ xTarget.showNotification(TranslateCap("you_have_been_fired", xTarget.getJob().label))
+ xPlayer.showNotification(TranslateCap("you_have_fired", xTarget.getName()))
end
cb()
@@ -432,7 +432,7 @@ function WashMoneyCRON()
-- send notification if player is online
if xPlayer then
- xPlayer.showNotification(_U("you_have_laundered", ESX.Math.GroupDigits(result[i].amount)))
+ xPlayer.showNotification(TranslateCap("you_have_laundered", ESX.Math.GroupDigits(result[i].amount)))
end
end
MySQL.update("DELETE FROM society_moneywash")
diff --git a/server-data/resources/[esx]/esx_textui/TextUI.lua b/server-data/resources/[esx]/esx_textui/TextUI.lua
index d5c8beee0..de603ebe7 100644
--- a/server-data/resources/[esx]/esx_textui/TextUI.lua
+++ b/server-data/resources/[esx]/esx_textui/TextUI.lua
@@ -3,22 +3,22 @@ local isShowing = false
---@param message string
---@param typ string
local function TextUI(message, typ)
- isShowing = true
- SendNUIMessage({
- action = "show",
- message = message and message or "ESX-TextUI",
- type = type(typ) == "string" and typ or "info",
- })
+ isShowing = true
+ SendNUIMessage({
+ action = "show",
+ message = message and message or "ESX-TextUI",
+ type = type(typ) == "string" and typ or "info",
+ })
end
local function HideUI()
- if not isShowing then
- return
- end
- isShowing = false
- SendNUIMessage({
- action = "hide",
- })
+ if not isShowing then
+ return
+ end
+ isShowing = false
+ SendNUIMessage({
+ action = "hide",
+ })
end
exports("TextUI", TextUI)
@@ -27,19 +27,19 @@ RegisterNetEvent("ESX:TextUI", TextUI)
RegisterNetEvent("ESX:HideUI", HideUI)
if Debug then
- RegisterCommand("textui:error", function()
- ESX.TextUI("i ~r~love~s~ donuts", "error")
- end)
+ RegisterCommand("textui:error", function()
+ ESX.TextUI("i ~r~love~s~ donuts", "error")
+ end)
- RegisterCommand("textui:success", function()
- ESX.TextUI("i ~g~love~s~ donuts", "success")
- end)
+ RegisterCommand("textui:success", function()
+ ESX.TextUI("i ~g~love~s~ donuts", "success")
+ end)
- RegisterCommand("textui:info", function()
- ESX.TextUI("i ~b~love~s~ donuts", "info")
- end)
+ RegisterCommand("textui:info", function()
+ ESX.TextUI("i ~b~love~s~ donuts", "info")
+ end)
- RegisterCommand("textui:hide", function()
- ESX.HideUI()
- end)
+ RegisterCommand("textui:hide", function()
+ ESX.HideUI()
+ end)
end
diff --git a/server-data/resources/[esx]/esx_textui/fxmanifest.lua b/server-data/resources/[esx]/esx_textui/fxmanifest.lua
index 9d140ea7a..21afa470d 100644
--- a/server-data/resources/[esx]/esx_textui/fxmanifest.lua
+++ b/server-data/resources/[esx]/esx_textui/fxmanifest.lua
@@ -11,7 +11,7 @@ shared_script("@es_extended/imports.lua")
ui_page("nui/index.html")
files({
- "nui/index.html",
- "nui/js/*.js",
- "nui/css/*.css",
+ "nui/index.html",
+ "nui/js/*.js",
+ "nui/css/*.css",
})
diff --git a/server-data/resources/[esx]/mythic_notify/fxmanifest.lua b/server-data/resources/[esx]/mythic_notify/fxmanifest.lua
index 5458c9a6c..0473d8237 100644
--- a/server-data/resources/[esx]/mythic_notify/fxmanifest.lua
+++ b/server-data/resources/[esx]/mythic_notify/fxmanifest.lua
@@ -5,21 +5,21 @@ name("Mythic Framework Notification System")
version("1.0.1")
ui_page({
- "html/ui.html",
+ "html/ui.html",
})
files({
- "html/ui.html",
- "html/js/app.js",
- "html/css/style.css",
+ "html/ui.html",
+ "html/js/app.js",
+ "html/css/style.css",
})
client_scripts({
- "client/main.lua",
+ "client/main.lua",
})
exports({
- "SendAlert",
- "SendUniqueAlert",
- "PersistentAlert",
+ "SendAlert",
+ "SendUniqueAlert",
+ "PersistentAlert",
})
diff --git a/server-data/resources/[esx]/mythic_notify/html/js/app.js b/server-data/resources/[esx]/mythic_notify/html/js/app.js
index be5afbaa0..6aef2e72c 100644
--- a/server-data/resources/[esx]/mythic_notify/html/js/app.js
+++ b/server-data/resources/[esx]/mythic_notify/html/js/app.js
@@ -1,93 +1,97 @@
-var notifs = {}
+const notifs = {};
-window.addEventListener('message', function (event) {
- ShowNotif(event.data);
+window.addEventListener('message', function(event) {
+ ShowNotif(event.data);
});
function CreateNotification(data) {
- let $notification = $(document.createElement('div'));
- $notification.addClass('notification').addClass(data.type);
- $notification.html(data.text);
- $notification.fadeIn();
- if (data.style !== undefined) {
- Object.keys(data.style).forEach(function (css) {
- $notification.css(css, data.style[css])
- });
- }
+ const $notification = $(document.createElement('div'));
+ $notification.addClass('notification').addClass(data.type);
+ $notification.html(data.text);
+ $notification.fadeIn();
+ if (data.style !== undefined) {
+ Object.keys(data.style).forEach(function(css) {
+ $notification.css(css, data.style[css]);
+ });
+ }
- return $notification;
+ return $notification;
}
function UpdateNotification(data) {
- let $notification = $(notifs[data.id])
- $notification.addClass('notification').addClass(data.type);
- $notification.html(data.text);
+ const $notification = $(notifs[data.id]);
+ $notification.addClass('notification').addClass(data.type);
+ $notification.html(data.text);
- if (data.style !== undefined) {
- Object.keys(data.style).forEach(function (css) {
- $notification.css(css, data.style[css])
- });
- }
+ if (data.style !== undefined) {
+ Object.keys(data.style).forEach(function(css) {
+ $notification.css(css, data.style[css]);
+ });
+ }
}
function ShowNotif(data) {
- if (data.persist != null) {
- if (data.persist.toUpperCase() == 'START') {
- if (notifs[data.id] === undefined) {
- let $notification = CreateNotification(data);
- $('.notif-container').append($notification);
- notifs[data.id] = {
- notif: $notification
- };
- } else {
- UpdateNotification(data);
- }
- } else if (data.persist.toUpperCase() == 'END') {
- if (notifs[data.id] != null) {
- let $notification = $(notifs[data.id].notif);
- $.when($notification.fadeOut()).done(function () {
- $notification.remove();
- delete notifs[data.id];
- });
- }
- }
- } else {
- if (data.id != null) {
- if (notifs[data.id] === undefined) {
- let $notification = CreateNotification(data);
- $('.notif-container').append($notification);
- notifs[data.id] = {
- notif: $notification,
- timer: setTimeout(function () {
- let $notification = notifs[data.id].notif;
- $.when($notification.fadeOut()).done(function () {
- $notification.remove();
- clearTimeout(notifs[data.id].timer);
- delete notifs[data.id];
- });
- }, data.length != null ? data.length : 2500)
- };
- } else {
- clearTimeout(notifs[data.id].timer);
- UpdateNotification(data);
+ if (data.persist != null) {
+ if (data.persist.toUpperCase() == 'START') {
+ if (notifs[data.id] === undefined) {
+ const $notification = CreateNotification(data);
+ $('.notif-container').append($notification);
+ notifs[data.id] = {
+ notif: $notification,
+ };
+ }
+ else {
+ UpdateNotification(data);
+ }
+ }
+ else if (data.persist.toUpperCase() == 'END') {
+ if (notifs[data.id] != null) {
+ const $notification = $(notifs[data.id].notif);
+ $.when($notification.fadeOut()).done(function() {
+ $notification.remove();
+ delete notifs[data.id];
+ });
+ }
+ }
+ }
+ else if (data.id != null) {
+ if (notifs[data.id] === undefined) {
+ const $notification = CreateNotification(data);
+ $('.notif-container').append($notification);
+ notifs[data.id] = {
+ notif: $notification,
+ timer: setTimeout(function() {
+ // eslint-disable-next-line no-shadow
+ const $notification = notifs[data.id].notif;
+ $.when($notification.fadeOut()).done(function() {
+ $notification.remove();
+ clearTimeout(notifs[data.id].timer);
+ delete notifs[data.id];
+ });
+ }, data.length != null ? data.length : 2500),
+ };
+ }
+ else {
+ clearTimeout(notifs[data.id].timer);
+ UpdateNotification(data);
- notifs[data.id].timer = setTimeout(function () {
- let $notification = notifs[data.id].notif;
- $.when($notification.fadeOut()).done(function () {
- $notification.remove();
- clearTimeout(notifs[data.id].timer);
- delete notifs[data.id];
- });
- }, data.length != null ? data.length : 2500)
- }
- } else {
- let $notification = CreateNotification(data);
- $('.notif-container').append($notification);
- setTimeout(function () {
- $.when($notification.fadeOut()).done(function () {
- $notification.remove()
- });
- }, data.length != null ? data.length : 2500);
- }
- }
+ notifs[data.id].timer = setTimeout(function() {
+ const $notification = notifs[data.id].notif;
+ $.when($notification.fadeOut()).done(function() {
+ $notification.remove();
+ clearTimeout(notifs[data.id].timer);
+ delete notifs[data.id];
+ });
+ }, data.length != null ? data.length : 2500);
+ }
+ }
+ else {
+ const $notification = CreateNotification(data);
+ $('.notif-container').append($notification);
+ setTimeout(function() {
+ $.when($notification.fadeOut()).done(function() {
+ $notification.remove();
+ });
+ }, data.length != null ? data.length : 2500);
+ }
}
\ No newline at end of file
diff --git a/server-data/resources/[esx_addons]/esx_garage/nui/js/app.js b/server-data/resources/[esx_addons]/esx_garage/nui/js/app.js
index 104a5cbec..65656e83b 100644
--- a/server-data/resources/[esx_addons]/esx_garage/nui/js/app.js
+++ b/server-data/resources/[esx_addons]/esx_garage/nui/js/app.js
@@ -1,230 +1,235 @@
-$(window).ready(function () {
- window.addEventListener("message", function (event) {
- let data = event.data;
-
- if (data.showMenu) {
- $("#container").fadeIn();
- $("#menu").fadeIn();
-
- if (data.type === "impound") {
- $("#header ul").hide();
- } else {
- $("#header ul").show();
- }
-
- if (data.vehiclesList != undefined) {
- $("#container").data("spawnpoint", data.spawnPoint);
- if (data.poundCost) $("#container").data("poundcost", data.poundCost);
-
- if (data.poundCost != undefined) {
- $(".content .vehicle-list").html(
- getVehicles(data.locales, data.vehiclesList, data.poundCost)
- );
- } else {
- $(".content .vehicle-list").html(
- getVehicles(data.locales, data.vehiclesList)
- );
- }
-
- $(".content h2").hide();
- } else {
- $(".content h2").show();
- $(".content .vehicle-list").empty();
- }
-
- if (data.vehiclesImpoundedList != undefined) {
- $(".impounded_content").data("poundName", data.poundName);
- $(".impounded_content").data("poundSpawnPoint", data.poundSpawnPoint);
-
- if (data.poundCost) $("#container").data("poundcost", data.poundCost);
-
- $(".impounded_content .vehicle-list").html(
- getImpoundedVehicles(data.locales, data.vehiclesImpoundedList)
- );
- $(".impounded_content h2").hide();
- } else {
- $(".impounded_content h2").show();
- $(".impounded_content .vehicle-list").empty();
- }
-
- // Locales
-
- // needs a rework
- // $(".content h2").html(function (i, text) {
- // return text.replace("No vehicle in this garage.", data.locales.no_veh_parking);
- // });
-
- // $(".impounded_content h2").html(function (i, text) {
- // return text.replace("No vehicle impounded.", data.locales.no_veh_impounded);
- // });
-
- $(".vehicle-listing").html(function (i, text) {
- return text.replace("Model", data.locales.veh_model);
- });
- $(".vehicle-listing").html(function (i, text) {
- return text.replace("Plate", data.locales.veh_plate);
- });
- $(".vehicle-listing").html(function (i, text) {
- return text.replace("Condition", data.locales.veh_condition);
- });
- } else if (data.hideAll) {
- $("#container").fadeOut();
- }
- });
-
- $("#container").hide();
-
- $(".close").click(function (event) {
- $("#container").hide();
- $.post("https://esx_garage/escape", "{}");
-
- $(".impounded_content").hide();
- $(".content").show();
- $('li[data-page="garage"]').addClass("selected");
- $('li[data-page="impounded"]').removeClass("selected");
- });
-
- document.onkeyup = function (data) {
- if (data.which == 27) {
- $.post("https://esx_garage/escape", "{}");
-
- $(".impounded_content").hide();
- $(".content").show();
- $('li[data-page="garage"]').addClass("selected");
- $('li[data-page="impounded"]').removeClass("selected");
- }
- };
-
- function getVehicles(locale, vehicle, amount = null) {
- let html = "";
- let vehicleData = JSON.parse(vehicle);
- let bodyHealth = 1000;
- let engineHealth = 1000;
- let tankHealth = 1000;
- let vehicleDamagePercent = "";
-
- for (let i = 0; i < vehicleData.length; i++) {
- bodyHealth = (vehicleData[i].props.bodyHealth / 1000) * 100;
- engineHealth = (vehicleData[i].props.engineHealth / 1000) * 100;
- tankHealth = (vehicleData[i].props.tankHealth / 1000) * 100;
-
- vehicleDamagePercent =
+$(window).ready(function() {
+ window.addEventListener('message', function(event) {
+ const data = event.data;
+
+ if (data.showMenu) {
+ $('#container').fadeIn();
+ $('#menu').fadeIn();
+
+ if (data.type === 'impound') {
+ $('#header ul').hide();
+ }
+ else {
+ $('#header ul').show();
+ }
+
+ if (data.vehiclesList != undefined) {
+ $('#container').data('spawnpoint', data.spawnPoint);
+ if (data.poundCost) $('#container').data('poundcost', data.poundCost);
+
+ if (data.poundCost != undefined) {
+ $('.content .vehicle-list').html(
+ getVehicles(data.locales, data.vehiclesList, data.poundCost),
+ );
+ }
+ else {
+ $('.content .vehicle-list').html(
+ getVehicles(data.locales, data.vehiclesList),
+ );
+ }
+
+ $('.content h2').hide();
+ }
+ else {
+ $('.content h2').show();
+ $('.content .vehicle-list').empty();
+ }
+
+ if (data.vehiclesImpoundedList != undefined) {
+ $('.impounded_content').data('poundName', data.poundName);
+ $('.impounded_content').data('poundSpawnPoint', data.poundSpawnPoint);
+
+ if (data.poundCost) $('#container').data('poundcost', data.poundCost);
+
+ $('.impounded_content .vehicle-list').html(
+ getImpoundedVehicles(data.locales, data.vehiclesImpoundedList),
+ );
+ $('.impounded_content h2').hide();
+ }
+ else {
+ $('.impounded_content h2').show();
+ $('.impounded_content .vehicle-list').empty();
+ }
+
+ // Locales
+
+ // needs a rework
+ // $(".content h2").html(function (i, text) {
+ // return text.replace("No vehicle in this garage.", data.locales.no_veh_parking);
+ // });
+
+ // $(".impounded_content h2").html(function (i, text) {
+ // return text.replace("No vehicle impounded.", data.locales.no_veh_impounded);
+ // });
+
+ $('.vehicle-listing').html(function(_i, text) {
+ return text.replace('Model', data.locales.veh_model);
+ });
+ $('.vehicle-listing').html(function(_i, text) {
+ return text.replace('Plate', data.locales.veh_plate);
+ });
+ $('.vehicle-listing').html(function(_i, text) {
+ return text.replace('Condition', data.locales.veh_condition);
+ });
+ }
+ else if (data.hideAll) {
+ $('#container').fadeOut();
+ }
+ });
+
+ $('#container').hide();
+
+ $('.close').click(function() {
+ $('#container').hide();
+ $.post('https://esx_garage/escape', '{}');
+
+ $('.impounded_content').hide();
+ $('.content').show();
+ $('li[data-page="garage"]').addClass('selected');
+ $('li[data-page="impounded"]').removeClass('selected');
+ });
+
+ document.onkeyup = function(data) {
+ if (data.which == 27) {
+ $.post('https://esx_garage/escape', '{}');
+
+ $('.impounded_content').hide();
+ $('.content').show();
+ $('li[data-page="garage"]').addClass('selected');
+ $('li[data-page="impounded"]').removeClass('selected');
+ }
+ };
+
+ function getVehicles(locale, vehicle, amount = null) {
+ let html = '';
+ const vehicleData = JSON.parse(vehicle);
+ let bodyHealth = 1000;
+ let engineHealth = 1000;
+ let tankHealth = 1000;
+ let vehicleDamagePercent = '';
+
+ for (let i = 0; i < vehicleData.length; i++) {
+ bodyHealth = (vehicleData[i].props.bodyHealth / 1000) * 100;
+ engineHealth = (vehicleData[i].props.engineHealth / 1000) * 100;
+ tankHealth = (vehicleData[i].props.tankHealth / 1000) * 100;
+
+ vehicleDamagePercent =
Math.round(((bodyHealth + engineHealth + tankHealth) / 300) * 100) +
- "%";
-
- html += "
";
- html += "
Model: " + vehicleData[i].model + "
";
- html += "
Plate: " + vehicleData[i].plate + "
";
- html +=
- "
Condition: " + vehicleDamagePercent + "
";
- html +=
- "
";
- }
-
- return html;
- }
-
- function getImpoundedVehicles(locale, vehicle) {
- let html = "";
- let vehicleData = JSON.parse(vehicle);
- let bodyHealth = 1000;
- let engineHealth = 1000;
- let tankHealth = 1000;
- let vehicleDamagePercent = "";
-
- for (let i = 0; i < vehicleData.length; i++) {
- bodyHealth = (vehicleData[i].props.bodyHealth / 1000) * 100;
- engineHealth = (vehicleData[i].props.engineHealth / 1000) * 100;
- tankHealth = (vehicleData[i].props.tankHealth / 1000) * 100;
-
- vehicleDamagePercent =
+ (amount ? ' ($' + amount + ')' : '') +
+ '';
+ html += '';
+ }
+
+ return html;
+ }
+
+ function getImpoundedVehicles(locale, vehicle) {
+ let html = '';
+ const vehicleData = JSON.parse(vehicle);
+ let bodyHealth = 1000;
+ let engineHealth = 1000;
+ let tankHealth = 1000;
+ let vehicleDamagePercent = '';
+
+ for (let i = 0; i < vehicleData.length; i++) {
+ bodyHealth = (vehicleData[i].props.bodyHealth / 1000) * 100;
+ engineHealth = (vehicleData[i].props.engineHealth / 1000) * 100;
+ tankHealth = (vehicleData[i].props.tankHealth / 1000) * 100;
+
+ vehicleDamagePercent =
Math.round(((bodyHealth + engineHealth + tankHealth) / 300) * 100) +
- "%";
-
- html += "
";
- html += "
Model: " + vehicleData[i].model + "
";
- html += "
Plate: " + vehicleData[i].plate + "
";
- html +=
- "
Condition: " + vehicleDamagePercent + "
";
- html +=
- "';
+ html += '
Model: ' + vehicleData[i].model + '
';
+ html += '
Plate: ' + vehicleData[i].plate + '
';
+ html +=
+ '
Condition: ' + vehicleDamagePercent + '
';
+ html +=
+ '" +
+ '\'>' +
locale.impound_action +
- "";
- html += "
";
- }
-
- return html;
- }
-
- $('li[data-page="garage"]').click(function (event) {
- $(".impounded_content").hide();
- $(".content").show();
- $('li[data-page="garage"]').addClass("selected");
- $('li[data-page="impounded"]').removeClass("selected");
- });
-
- $('li[data-page="impounded"]').click(function (event) {
- $(".content").hide();
- $(".impounded_content").show();
- $('li[data-page="impounded"]').addClass("selected");
- $('li[data-page="garage"]').removeClass("selected");
- });
-
- $(document).on(
- "click",
- "button[data-button='spawn'].vehicle-action",
- function (event) {
- let spawnPoint = $("#container").data("spawnpoint");
- let poundCost = $("#container").data("poundcost");
- let vehicleProps = $(this).data("vehprops");
-
- // prevent empty cost
- if (poundCost === undefined) poundCost = 0;
-
- $.post(
- "https://esx_garage/spawnVehicle",
- JSON.stringify({
- vehicleProps: vehicleProps,
- spawnPoint: spawnPoint,
- exitVehicleCost: poundCost,
- })
- );
-
- $(".impounded_content").hide();
- $(".content").show();
- $('li[data-page="garage"]').addClass("selected");
- $('li[data-page="impounded"]').removeClass("selected");
- }
- );
-
- $(document).on(
- "click",
- "button[data-button='impounded'].vehicle-action",
- function (event) {
- let vehicleProps = $(this).data("vehprops");
- let poundName = $(".impounded_content").data("poundName");
- let poundSpawnPoint = $(".impounded_content").data("poundSpawnPoint");
- $.post(
- "https://esx_garage/impound",
- JSON.stringify({
- vehicleProps: vehicleProps,
- poundName: poundName,
- poundSpawnPoint: poundSpawnPoint,
- })
- );
-
- $(".impounded_content").hide();
- $(".content").show();
- $('li[data-page="garage"]').addClass("selected");
- $('li[data-page="impounded"]').removeClass("selected");
- }
- );
+ '';
+ html += '';
+ }
+
+ return html;
+ }
+
+ $('li[data-page="garage"]').click(function() {
+ $('.impounded_content').hide();
+ $('.content').show();
+ $('li[data-page="garage"]').addClass('selected');
+ $('li[data-page="impounded"]').removeClass('selected');
+ });
+
+ $('li[data-page="impounded"]').click(function() {
+ $('.content').hide();
+ $('.impounded_content').show();
+ $('li[data-page="impounded"]').addClass('selected');
+ $('li[data-page="garage"]').removeClass('selected');
+ });
+
+ $(document).on(
+ 'click',
+ 'button[data-button=\'spawn\'].vehicle-action',
+ function() {
+ const spawnPoint = $('#container').data('spawnpoint');
+ let poundCost = $('#container').data('poundcost');
+ const vehicleProps = $(this).data('vehprops');
+
+ // prevent empty cost
+ if (poundCost === undefined) poundCost = 0;
+
+ $.post(
+ 'https://esx_garage/spawnVehicle',
+ JSON.stringify({
+ vehicleProps: vehicleProps,
+ spawnPoint: spawnPoint,
+ exitVehicleCost: poundCost,
+ }),
+ );
+
+ $('.impounded_content').hide();
+ $('.content').show();
+ $('li[data-page="garage"]').addClass('selected');
+ $('li[data-page="impounded"]').removeClass('selected');
+ },
+ );
+
+ $(document).on(
+ 'click',
+ 'button[data-button=\'impounded\'].vehicle-action',
+ function() {
+ const vehicleProps = $(this).data('vehprops');
+ const poundName = $('.impounded_content').data('poundName');
+ const poundSpawnPoint = $('.impounded_content').data('poundSpawnPoint');
+ $.post(
+ 'https://esx_garage/impound',
+ JSON.stringify({
+ vehicleProps: vehicleProps,
+ poundName: poundName,
+ poundSpawnPoint: poundSpawnPoint,
+ }),
+ );
+
+ $('.impounded_content').hide();
+ $('.content').show();
+ $('li[data-page="garage"]').addClass('selected');
+ $('li[data-page="impounded"]').removeClass('selected');
+ },
+ );
});
diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua
index 6d1f7e64f..6ef416b97 100644
--- a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua
+++ b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua
@@ -176,7 +176,6 @@ function OpenMobileMechanicActionsMenu()
{ icon = "fas fa-gear", title = TranslateCap("clean"), value = "clean_vehicle" },
{ icon = "fas fa-gear", title = TranslateCap("imp_veh"), value = "del_vehicle" },
{ icon = "fas fa-gear", title = TranslateCap("tow"), value = "dep_vehicle" },
- { icon = "fas fa-gear", title = TranslateCap("place_objects"), value = "object_spawner" },
}
ESX.OpenContext("right", elements, function(_, element)
@@ -371,37 +370,11 @@ function OpenMobileMechanicActionsMenu()
else
ESX.ShowNotification(TranslateCap("imp_flatbed"))
end
- elseif element.value == "object_spawner" then
- local playerPed = PlayerPedId()
if IsPedSittingInAnyVehicle(playerPed) then
ESX.ShowNotification(TranslateCap("inside_vehicle"))
return
end
-
- local elements2 = {
- { unselectable = true, icon = "fas fa-object", title = TranslateCap("objects") },
- { icon = "fas fa-object", title = TranslateCap("roadcone"), value = "prop_roadcone02a" },
- { icon = "fas fa-object", title = TranslateCap("toolbox"), value = "prop_toolchest_01" },
- }
-
- ESX.OpenContext("right", elements2, function(_, elementObj)
- local model = elementObj.value
- local coords = GetEntityCoords(playerPed)
- local forward = GetEntityForwardVector(playerPed)
- local x, y, z = table.unpack(coords + forward * 1.0)
-
- if model == "prop_roadcone02a" then
- z = z - 2.0
- elseif model == "prop_toolchest_01" then
- z = z - 2.0
- end
-
- ESX.Game.SpawnObject(model, { x = x, y = y, z = z }, function(obj)
- SetEntityHeading(obj, GetEntityHeading(playerPed))
- PlaceObjectOnGroundProperly(obj)
- end)
- end)
end
end)
end
@@ -590,7 +563,27 @@ AddEventHandler("esx_mechanicjob:hasEnteredMarker", function(zone)
CurrentActionData = { vehicle = vehicle }
end
end
- ESX.TextUI(CurrentActionMsg)
+
+ if zone ~= "VehicleSpawnPoint" then
+ ESX.TextUI(CurrentActionMsg)
+ end
+end)
+
+AddEventHandler("esx_mechanicjob:hasExitedMarker", function(zone)
+ if zone == "VehicleDelivery" then
+ NPCTargetDeleterZone = false
+ end
+ CurrentAction = nil
+ ESX.CloseContext()
+ ESX.HideUI()
+end)
+
+AddEventHandler("esx_mechanicjob:hasExitedEntityZone", function(entity)
+ if CurrentAction == "remove_entity" then
+ CurrentAction = nil
+ end
+ ESX.CloseContext()
+ ESX.HideUI()
end)
-- Pop NPC mission vehicle when inside area
@@ -758,5 +751,4 @@ RegisterKeyMapping("mechanicMenu", "Open Mechanic Menu", "keyboard", Config.Cont
RegisterKeyMapping("mechanicjob", "Togggle NPC Job", "keyboard", Config.Controls.toggleNPCJob)
AddEventHandler("esx:onPlayerDeath", function() end)
-
AddEventHandler("esx:onPlayerSpawn", function() end)
diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/config.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/config.lua
index 78dde6a07..6fc49929b 100644
--- a/server-data/resources/[esx_addons]/esx_mechanicjob/config.lua
+++ b/server-data/resources/[esx_addons]/esx_mechanicjob/config.lua
@@ -36,13 +36,6 @@ Config.Zones = {
Type = 21,
},
- Garage = {
- Pos = vector3(-97.5, 6496.1, 31.4),
- Size = { x = 1.0, y = 1.0, z = 1.0 },
- Color = { r = 50, g = 200, b = 50 },
- Type = 21,
- },
-
VehicleSpawnPoint = {
Pos = vector3(-366.354, -110.766, 37.696),
Size = { x = 1.5, y = 1.5, z = 1.0 },
diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua
index 11f4d57a3..331a0bf17 100644
--- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua
+++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua
@@ -22,7 +22,6 @@ Locales["en"] = {
["repair"] = "repair",
["clean"] = "clean",
["imp_veh"] = "impound",
- ["place_objects"] = "place Objects",
["invoice_amount"] = "invoice Amount",
["amount_invalid"] = "invalid amount",
["no_players_nearby"] = "there is no nearby player",
diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua
index a9219587b..862f35114 100644
--- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua
+++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua
@@ -22,7 +22,6 @@ Locales["it"] = {
["repair"] = "riparazione",
["clean"] = "pulito",
["imp_veh"] = "sequestrato",
- ["place_objects"] = "posiziona oggetti",
["invoice_amount"] = "importo fattura",
["amount_invalid"] = "importo non valido",
["no_players_nearby"] = "nessun giocatore nelle vicinanze",
diff --git a/server-data/resources/[ox]/ox_inventory/client.lua b/server-data/resources/[ox]/ox_inventory/client.lua
index 48ec5c55a..e8578c92e 100644
--- a/server-data/resources/[ox]/ox_inventory/client.lua
+++ b/server-data/resources/[ox]/ox_inventory/client.lua
@@ -109,7 +109,6 @@ local function closeTrunk()
end
end
-local CraftingBenches = require 'modules.crafting.client'
local Vehicles = lib.load('data.vehicles')
local Inventory = require 'modules.inventory.client'
@@ -189,39 +188,6 @@ function client.openInventory(inv, data)
end
left, right, accessError = lib.callback.await('ox_inventory:openShop', 200, data)
- elseif inv == 'crafting' then
- if cache.vehicle then
- return lib.notify({ id = 'cannot_perform', type = 'error', description = locale('cannot_perform') })
- end
-
- left, right, accessError = lib.callback.await('ox_inventory:openCraftingBench', 200, data.id, data.index)
-
- if left then
- right = CraftingBenches[data.id]
-
- if not right?.items then return end
-
- local coords, distance
-
- if not right.zones and not right.points then
- coords = GetEntityCoords(cache.ped)
- distance = 2
- else
- coords = shared.target and right.zones and right.zones[data.index].coords or right.points and right.points[data.index]
- distance = coords and shared.target and right.zones[data.index].distance or 2
- end
-
- right = {
- type = 'crafting',
- id = data.id,
- label = right.label or locale('crafting_bench'),
- index = data.index,
- slots = right.slots,
- items = right.items,
- coords = coords,
- distance = distance
- }
- end
elseif invOpen ~= nil then
if inv == 'policeevidence' then
if not data then
@@ -769,9 +735,7 @@ local function registerCommands()
local closest = lib.points.getClosestPoint()
if closest and closest.currentDistance < 1.2 and (not closest.instance or closest.instance == currentInstance) then
- if closest.inv == 'crafting' then
- return client.openInventory('crafting', { id = closest.id, index = closest.index })
- elseif closest.inv ~= 'license' and closest.inv ~= 'policeevidence' then
+ if closest.inv ~= 'license' and closest.inv ~= 'policeevidence' then
return client.openInventory(closest.inv or 'drop', { id = closest.invId, type = closest.type })
end
end
@@ -1738,24 +1702,6 @@ RegisterNUICallback('exit', function(_, cb)
cb(1)
end)
-lib.callback.register('ox_inventory:startCrafting', function(id, recipe)
- recipe = CraftingBenches[id].items[recipe]
-
- return lib.progressCircle({
- label = locale('crafting_item', recipe.metadata?.label or Items[recipe.name].label),
- duration = recipe.duration or 3000,
- canCancel = true,
- disable = {
- move = true,
- combat = true,
- },
- anim = {
- dict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
- clip = 'machinic_loop_mechandplayer',
- }
- })
-end)
-
local swapActive = false
---Synchronise and validate all item movement between the NUI and server.
@@ -1859,25 +1805,6 @@ RegisterNUICallback('buyItem', function(data, cb)
cb(response)
end)
-RegisterNUICallback('craftItem', function(data, cb)
- cb(true)
-
- local id, index = currentInventory.id, currentInventory.index
-
- for i = 1, data.count do
- local success, response = lib.callback.await('ox_inventory:craftItem', 200, id, index, data.fromSlot, data.toSlot)
-
- if not success then
- if response then lib.notify({ type = 'error', description = locale(response or 'cannot_perform') }) end
- break
- end
- end
-
- if not currentInventory or currentInventory.type ~= 'crafting' then
- client.openInventory('crafting', { id = id, index = index })
- end
-end)
-
lib.callback.register('ox_inventory:getVehicleData', function(netid)
local entity = NetworkGetEntityFromNetworkId(netid)
diff --git a/server-data/resources/[ox]/ox_inventory/locales/cs.json b/server-data/resources/[ox]/ox_inventory/locales/cs.json
index 43fb9df0d..32d4dd34f 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/cs.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/cs.json
@@ -85,9 +85,6 @@
"cannot_give": "Této osobě nemůžete dát %s %s",
"evidence_cannot_take": "Nejste dostatečně kvalifikovaný pro přístup",
"dumpster": "Popelnice",
- "crafting_item": "Vyrábíš %s",
- "crafting_bench": "Pracovní stůl",
- "open_crafting_bench": "Otevřít pracovní stůl",
"not_enough_durability": "%s je příliš poškozený",
"storage": "Úložný prostor"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/de.json b/server-data/resources/[ox]/ox_inventory/locales/de.json
index a5654fe17..2b7f54240 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/de.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/de.json
@@ -85,9 +85,6 @@
"cannot_give": "%s %s kann nicht übergeben werden",
"evidence_cannot_take": "Dein Rang ist hierfür zu niedrig",
"dumpster": "Mülleimer",
- "crafting_item": "%s herstellen",
- "crafting_bench": "Werkbank",
- "open_crafting_bench": "Werkbank öffnen",
"not_enough_durability": "Haltbarkeit von %s reicht nicht mehr aus",
"storage": "Kofferraum"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/en.json b/server-data/resources/[ox]/ox_inventory/locales/en.json
index 1e9c0e8a5..4f461997d 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/en.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/en.json
@@ -85,9 +85,6 @@
"cannot_give": "Unable to give %s %s to the target",
"evidence_cannot_take": "You are not authorised to withdraw evidence",
"dumpster": "Dumpster",
- "crafting_item": "Crafting %s",
- "crafting_bench": "Crafting Bench",
- "open_crafting_bench": "Open Crafting Bench",
"not_enough_durability": "%s does not have enough durability",
"storage": "Storage"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/es.json b/server-data/resources/[ox]/ox_inventory/locales/es.json
index e3093681f..2a0077b5a 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/es.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/es.json
@@ -84,9 +84,6 @@
"cannot_give": "No se puede dar %s %s al objetivo",
"evidence_cannot_take": "No estás autorizado a retirar pruebas",
"dumpster": "Contenedor de basura",
- "crafting_item": "Creando %s",
- "crafting_bench": "Banco de trabajo",
- "open_crafting_bench": "Abrir banco de trabajo",
"not_enough_durability": "%s no tiene suficiente durabilidad",
- "storage": "Maletero",
+ "storage": "Maletero"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/et.json b/server-data/resources/[ox]/ox_inventory/locales/et.json
index 92823e345..119ac24f4 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/et.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/et.json
@@ -85,9 +85,6 @@
"cannot_give": "%s %s ei saa antud isikule anda",
"evidence_cannot_take": "Pole piisavalt kõrge auaste, et tõendeid võtta",
"dumpster": "Prügikast",
- "crafting_item": "Meisterdamine %s",
- "crafting_bench": "Meisterdamispink",
- "open_crafting_bench": "Ava meisterdamispink",
"not_enough_durability": "Esemel %s pole piisavalt vastupidavust",
"storage": "Hoidla"
}
\ No newline at end of file
diff --git a/server-data/resources/[ox]/ox_inventory/locales/fi.json b/server-data/resources/[ox]/ox_inventory/locales/fi.json
index 2b197a199..8db62bb36 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/fi.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/fi.json
@@ -85,8 +85,5 @@
"cannot_give": "Ei voida antaa %s %s kohteelle",
"evidence_cannot_take": "Et ole tarpeeksi korkea-arvoinen, että voisit ottaa tavaraa todistusaineista",
"dumpster": "Roskis",
- "crafting_item": "Valmistetaan %s",
- "crafting_bench": "Työkalupenkki",
- "open_crafting_bench": "Avaa työkalupenkki",
"not_enough_durability": "%s on liian huonossa kunnossa"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/fr.json b/server-data/resources/[ox]/ox_inventory/locales/fr.json
index 7469d2f6b..53583bcf0 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/fr.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/fr.json
@@ -85,8 +85,5 @@
"cannot_give": "Impossible de donner %s %s à cet inventaire",
"evidence_cannot_take": "Votre grade ne vous permet pas de récupérer des preuves",
"dumpster": "Poubelle",
- "crafting_item": "Fabrication %s",
- "crafting_bench": "Table de fabrication",
- "open_crafting_bench": "Ouvrir la table de fabrication",
"not_enough_durability": "%s n'a pas assez de durabilité"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/hu.json b/server-data/resources/[ox]/ox_inventory/locales/hu.json
index 67e78bb2f..b74b22ce8 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/hu.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/hu.json
@@ -85,9 +85,6 @@
"cannot_give": "%s %s nem adható meg a célnak",
"evidence_cannot_take": "Nem elég magas a rangod a bizonyítékok kezeléséhez",
"dumpster": "Szemetes",
- "crafting_item": "%s barkácsolása ",
- "crafting_bench": "Barkácsasztal",
- "open_crafting_bench": "Barkácsasztal megnyitása",
"not_enough_durability": "%s elhasználodott!",
"storage": "Tároló"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/id.json b/server-data/resources/[ox]/ox_inventory/locales/id.json
index 9ac4f3a03..ae665ff9c 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/id.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/id.json
@@ -82,7 +82,5 @@
"cannot_give": "Tidak dapat memberikan %s %s ke target",
"evidence_cannot_take": "Anda tidak berwenang untuk mengambil barang bukti",
"dumpster": "Tempat Sampah",
- "crafting_item": "Membuat %s",
- "crafting_bench": "Bangku Kerajinan",
"not_enough_durability": "%s tidak memiliki daya tahan yang cukup"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/it.json b/server-data/resources/[ox]/ox_inventory/locales/it.json
index 6897ee2dd..ad10ebbb7 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/it.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/it.json
@@ -82,7 +82,5 @@
"cannot_give": "Impossibile dare %s %s al giocatore selezionato",
"evidence_cannot_take": "Il tuo grado non può prendere oggetti dal deposito",
"dumpster": "Cassonetto",
- "crafting_item": "Craftando %s",
- "crafting_bench": "Banco da lavoro",
"not_enough_durability": "%s non ha abbastanza durabilità"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/lt.json b/server-data/resources/[ox]/ox_inventory/locales/lt.json
index 140cd27a1..e7c60cf5d 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/lt.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/lt.json
@@ -84,8 +84,5 @@
"cannot_give": "Nepavyko paduoti %s %s",
"evidence_cannot_take": "Negalite paimti įkalčių",
"dumpster": "Konteineris",
-"crafting_item": "Gaminti %s",
-"crafting_bench": "Gamybos stalas",
-"open_crafting_bench": "Atidaryti Gamybos stalą",
"not_enough_durability": "%s nėra pakankamai patvarus"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/nl.json b/server-data/resources/[ox]/ox_inventory/locales/nl.json
index e6fb57bc5..03e8ca5db 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/nl.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/nl.json
@@ -82,8 +82,5 @@
"cannot_give": "Niet in staat om %s %s te geven aan het doel",
"evidence_cannot_take": "Je rang is niet hoog genoeg om van de bewijskluis te pakken",
"dumpster": "Afvalcontainer",
- "crafting_item": "%s aan het maken",
- "crafting_bench": "Werkbank",
- "open_crafting_bench": "Open Werkbank",
"not_enough_durability": "%s heeft niet genoeg levensduur."
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/no.json b/server-data/resources/[ox]/ox_inventory/locales/no.json
index 0e6ff1f07..33a964574 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/no.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/no.json
@@ -1,93 +1,89 @@
{
- "ui_use": "Bruk",
- "ui_give": "Gi",
- "ui_close": "Lukk",
- "ui_drop": "Slipp",
- "ui_removeattachments": "Fjern vedlegg",
- "ui_copy": "Kopier serienummer",
- "ui_durability": "Holdbarhet",
- "ui_ammo": "Ammunisjon",
- "ui_serial": "Serienummer",
- "ui_components": "Komponenter",
- "ui_tint": "Fargetone",
- "ui_usefulcontrols": "Nyttige kontroller",
- "ui_rmb": "Åpne elementkontekstmeny",
- "ui_ctrl_lmb": "Flytt en stabel med elementer raskt til en annen inventar",
- "ui_shift_drag": "Del antall elementer i to",
- "ui_ctrl_shift_lmb": "Flytt halvparten av en stabel med elementer raskt til en annen inventar",
- "ui_alt_lmb": "Bruk et element raskt",
- "ui_ctrl_c": "Når du svever over et våpen, kopierer du serienummeret",
- "ui_remove_ammo": "Fjern ammunisjon",
- "ammo_type": "Ammunisjonstype",
- "$": "$",
- "male": "Mann",
- "female": "Kvinne",
- "used": "Brukt",
- "ui_removed": "Fjernet",
- "ui_added": " Lagt til",
- "ui_holstered": "Lagt tilbake",
- "ui_equipped": "Utstyrt",
- "using": "Bruker %s",
- "inventory_setup": "Inventar er klart til bruk",
- "inventory_player_access": "Du kan ikke åpne inventaret ditt akkurat nå",
- "inventory_right_access": "Du har ikke tilgang til å åpne dette inventaret",
- "inventory_lost_access": "Kan ikke lenger få tilgang til dette inventaret",
- "wrong_ammo": "Du kan ikke lade %s med %s ammunisjon",
- "license": "%s lisens",
- "already_have": "Du har allerede en %s",
- "have_purchased": "Du har kjøpt en %s",
- "can_not_afford": "Du har ikke råd til en %s",
- "purchase_license": "Kjøp en %s-lisens",
- "interact_prompt": "Interager med [%s]",
- "weapon_unregistered": "%s er ikke registrert til noen",
- "weapon_registered": "%s (%s) er registrert til %s",
- "weapon_broken": "Dette våpenet er ødelagt",
- "vehicle_locked": "Kjøretøyet er låst",
- "nobody_nearby": "Det er ingen i nærheten",
- "give_amount": "Du må angi et beløp å gi",
- "buy_amount": "Du må angi et beløp å kjøpe",
- "component_has": "Dette våpenet har allerede en %s",
- "component_invalid": "Dette våpenet er ikke kompatibelt med %s",
- "component_slot_occupied": "Dette våpenets %s-plass er allerede opptatt",
- "cannot_perform": "Du kan ikke utføre denne handlingen",
- "cannot_carry": "Du kan ikke bære så mye",
- "cannot_carry_other": "Mål-inventaret kan ikke holde så mye",
- "cannot_carry_limit": "Du kan ikke bære mer enn %s %s",
- "cannot_carry_limit_other": "Målet kan ikke bære mer enn %s %s",
- "items_confiscated": "Dine gjenstander har blitt konfiskert",
- "items_returned": "Dine gjenstander har blitt returnert",
- "item_unauthorised": "Du har ikke tillatelse til å kjøpe denne gjenstanden",
- "item_unlicensed": "Du har ikke lisens til å kjøpe denne gjenstanden",
- "item_not_enough": "Du har ikke nok %s",
- "cannot_afford": "Du har ikke råd til det (mangler %s)",
- "stash_lowgrade": "Du har ikke tillatelse til å ta denne gjenstanden",
- "cannot_use": "Kan ikke bruke %s",
- "shop_nostock": "Gjenstanden er utsolgt",
- "identification": "Kjønn: %s \nFødselsdato: %s",
- "search_dumpster": "Søk i søppelkassen",
- "open_label": "Åpne %s",
- "purchased_for": "Kjøpt %s %s for %s%s",
- "unable_stack_items": "Du kan ikke stable disse gjenstandene",
- "police_evidence": "Bevis lager",
- "open_police_evidence": "Åpne bevis lager",
- "open_stash": "Åpne lager",
- "locker_number": "Låsenummer",
- "locker_no_value": "Må inneholde verdi for å åpne låsen",
- "locker_must_number": "Låsen må være et tall",
- "weapon_hand_required": "Du må ha et våpen i hånden",
- "weapon_hand_wrong": "Feil våpen i hånden",
- "open_player_inventory": "Åpne spillers inventar~",
- "open_secondary_inventory": "Åpne sekundært inventar~",
- "disable_hotbar": "Vis inventar-hotbar~",
- "reload_weapon": "Lad våpenet~",
- "use_hotbar": "Bruk hotbar-objekt %s~",
- "no_durability": "%s holdbarhet er brukt opp",
- "cannot_give": "Kan ikke gi %s %s til målet",
- "evidence_cannot_take": "Du er ikke autorisert til å trekke ut bevis",
- "dumpster": "Søppelkasse",
- "crafting_item": "Lager %s",
- "crafting_bench": "Lagebenk",
- "open_crafting_bench": "Åpne lagebenk",
- "not_enough_durability": "%s har ikke nok holdbarhet"
- }
-
\ No newline at end of file
+ "ui_use": "Bruk",
+ "ui_give": "Gi",
+ "ui_close": "Lukk",
+ "ui_drop": "Slipp",
+ "ui_removeattachments": "Fjern vedlegg",
+ "ui_copy": "Kopier serienummer",
+ "ui_durability": "Holdbarhet",
+ "ui_ammo": "Ammunisjon",
+ "ui_serial": "Serienummer",
+ "ui_components": "Komponenter",
+ "ui_tint": "Fargetone",
+ "ui_usefulcontrols": "Nyttige kontroller",
+ "ui_rmb": "Åpne elementkontekstmeny",
+ "ui_ctrl_lmb": "Flytt en stabel med elementer raskt til en annen inventar",
+ "ui_shift_drag": "Del antall elementer i to",
+ "ui_ctrl_shift_lmb": "Flytt halvparten av en stabel med elementer raskt til en annen inventar",
+ "ui_alt_lmb": "Bruk et element raskt",
+ "ui_ctrl_c": "Når du svever over et våpen, kopierer du serienummeret",
+ "ui_remove_ammo": "Fjern ammunisjon",
+ "ammo_type": "Ammunisjonstype",
+ "$": "$",
+ "male": "Mann",
+ "female": "Kvinne",
+ "used": "Brukt",
+ "ui_removed": "Fjernet",
+ "ui_added": " Lagt til",
+ "ui_holstered": "Lagt tilbake",
+ "ui_equipped": "Utstyrt",
+ "using": "Bruker %s",
+ "inventory_setup": "Inventar er klart til bruk",
+ "inventory_player_access": "Du kan ikke åpne inventaret ditt akkurat nå",
+ "inventory_right_access": "Du har ikke tilgang til å åpne dette inventaret",
+ "inventory_lost_access": "Kan ikke lenger få tilgang til dette inventaret",
+ "wrong_ammo": "Du kan ikke lade %s med %s ammunisjon",
+ "license": "%s lisens",
+ "already_have": "Du har allerede en %s",
+ "have_purchased": "Du har kjøpt en %s",
+ "can_not_afford": "Du har ikke råd til en %s",
+ "purchase_license": "Kjøp en %s-lisens",
+ "interact_prompt": "Interager med [%s]",
+ "weapon_unregistered": "%s er ikke registrert til noen",
+ "weapon_registered": "%s (%s) er registrert til %s",
+ "weapon_broken": "Dette våpenet er ødelagt",
+ "vehicle_locked": "Kjøretøyet er låst",
+ "nobody_nearby": "Det er ingen i nærheten",
+ "give_amount": "Du må angi et beløp å gi",
+ "buy_amount": "Du må angi et beløp å kjøpe",
+ "component_has": "Dette våpenet har allerede en %s",
+ "component_invalid": "Dette våpenet er ikke kompatibelt med %s",
+ "component_slot_occupied": "Dette våpenets %s-plass er allerede opptatt",
+ "cannot_perform": "Du kan ikke utføre denne handlingen",
+ "cannot_carry": "Du kan ikke bære så mye",
+ "cannot_carry_other": "Mål-inventaret kan ikke holde så mye",
+ "cannot_carry_limit": "Du kan ikke bære mer enn %s %s",
+ "cannot_carry_limit_other": "Målet kan ikke bære mer enn %s %s",
+ "items_confiscated": "Dine gjenstander har blitt konfiskert",
+ "items_returned": "Dine gjenstander har blitt returnert",
+ "item_unauthorised": "Du har ikke tillatelse til å kjøpe denne gjenstanden",
+ "item_unlicensed": "Du har ikke lisens til å kjøpe denne gjenstanden",
+ "item_not_enough": "Du har ikke nok %s",
+ "cannot_afford": "Du har ikke råd til det (mangler %s)",
+ "stash_lowgrade": "Du har ikke tillatelse til å ta denne gjenstanden",
+ "cannot_use": "Kan ikke bruke %s",
+ "shop_nostock": "Gjenstanden er utsolgt",
+ "identification": "Kjønn: %s \nFødselsdato: %s",
+ "search_dumpster": "Søk i søppelkassen",
+ "open_label": "Åpne %s",
+ "purchased_for": "Kjøpt %s %s for %s%s",
+ "unable_stack_items": "Du kan ikke stable disse gjenstandene",
+ "police_evidence": "Bevis lager",
+ "open_police_evidence": "Åpne bevis lager",
+ "open_stash": "Åpne lager",
+ "locker_number": "Låsenummer",
+ "locker_no_value": "Må inneholde verdi for å åpne låsen",
+ "locker_must_number": "Låsen må være et tall",
+ "weapon_hand_required": "Du må ha et våpen i hånden",
+ "weapon_hand_wrong": "Feil våpen i hånden",
+ "open_player_inventory": "Åpne spillers inventar~",
+ "open_secondary_inventory": "Åpne sekundært inventar~",
+ "disable_hotbar": "Vis inventar-hotbar~",
+ "reload_weapon": "Lad våpenet~",
+ "use_hotbar": "Bruk hotbar-objekt %s~",
+ "no_durability": "%s holdbarhet er brukt opp",
+ "cannot_give": "Kan ikke gi %s %s til målet",
+ "evidence_cannot_take": "Du er ikke autorisert til å trekke ut bevis",
+ "dumpster": "Søppelkasse",
+ "not_enough_durability": "%s har ikke nok holdbarhet"
+}
\ No newline at end of file
diff --git a/server-data/resources/[ox]/ox_inventory/locales/pl.json b/server-data/resources/[ox]/ox_inventory/locales/pl.json
index 2bbccddac..e6c2ba4e1 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/pl.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/pl.json
@@ -85,9 +85,6 @@
"cannot_give": "Nie można przekazać %s %s",
"evidence_cannot_take": "Nie posiadasz autoryzacji do zabrania dowodu",
"dumpster": "Śmietnik",
- "crafting_item": "Wytwórz %s",
- "crafting_bench": "Stół do wytwarzania",
- "open_crafting_bench": "Otwórz stół do wytwarzania",
"not_enough_durability": "%s nie posiada wystarczająco wytrzymałości",
"storage": "Magazyn"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/pt.json b/server-data/resources/[ox]/ox_inventory/locales/pt.json
index 0cf66e344..08e2dca4b 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/pt.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/pt.json
@@ -85,9 +85,6 @@
"cannot_give": "Não foi possível dar %s %s ao alvo",
"evidence_cannot_take": "Não estás autorizado(a) a retirar provas",
"dumpster": "Contentor de Lixo",
- "crafting_item": "A fabricar %s",
- "crafting_bench": "Bancada de Fabrico",
- "open_crafting_bench": "Abrir Bancada de Fabrico",
"not_enough_durability": "%s não tem durabilidade suficiente",
"storage": "Armazenamento"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/sr.json b/server-data/resources/[ox]/ox_inventory/locales/sr.json
index cca9e20b2..31c383d71 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/sr.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/sr.json
@@ -86,8 +86,5 @@
"cannot_give": "Nemoguce dati %s %s osobi",
"evidence_cannot_take": "Niste autorizovani da uzmete dokaz",
"dumpster": "Kontejner",
- "crafting_item": "Kraftovanje %s",
- "crafting_bench": "Sto za Kraftovanje",
- "open_crafting_bench": "Otvori sto za kraftovanje",
"not_enough_durability": "%s nema dovoljno izdrzljivosti"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/tr.json b/server-data/resources/[ox]/ox_inventory/locales/tr.json
index 480ab86e7..f28642c40 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/tr.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/tr.json
@@ -85,8 +85,5 @@
"cannot_give": "Hedefe %s %s verilmedi",
"evidence_cannot_take": "Kanıtlara erişebilmek için yeterli rütbede değilsiniz",
"dumpster": "Çöplük",
- "crafting_item": "Üretiliyor %s",
- "crafting_bench": "Üretim Tezgahı",
- "open_crafting_bench": "Üretim Tezgahını Aç",
"not_enough_durability": "%s Yeterli dayanıklılığa sahip değil"
}
diff --git a/server-data/resources/[ox]/ox_inventory/locales/zh-cn.json b/server-data/resources/[ox]/ox_inventory/locales/zh-cn.json
index f1c88c0a2..0db6e829a 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/zh-cn.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/zh-cn.json
@@ -85,9 +85,6 @@
"cannot_give": "无法将 %s %s 交给目标",
"evidence_cannot_take": "您无权撤回证据",
"dumpster": "垃圾箱",
- "crafting_item": "制作 %s",
- "crafting_bench": "工作台",
- "open_crafting_bench": "打开工作台",
"not_enough_durability": "%s 没有足够的耐久度",
"storage": "储物柜"
}
\ No newline at end of file
diff --git a/server-data/resources/[ox]/ox_inventory/locales/zh-tw.json b/server-data/resources/[ox]/ox_inventory/locales/zh-tw.json
index bbe58060f..e11dcf023 100644
--- a/server-data/resources/[ox]/ox_inventory/locales/zh-tw.json
+++ b/server-data/resources/[ox]/ox_inventory/locales/zh-tw.json
@@ -85,9 +85,6 @@
"cannot_give": "無法將 %s %s 給予目標 ",
"evidence_cannot_take": "階級不夠,無法拿取證物",
"dumpster": "垃圾桶",
- "crafting_item": "製作 %s",
- "crafting_bench": "工作台",
- "open_crafting_bench": "打開工作台",
"not_enough_durability": "%s 沒有足夠的耐久度",
"storage": "儲櫃"
}
diff --git a/server-data/resources/[ox]/ox_inventory/modules/crafting/client.lua b/server-data/resources/[ox]/ox_inventory/modules/crafting/client.lua
deleted file mode 100644
index ea3793ee9..000000000
--- a/server-data/resources/[ox]/ox_inventory/modules/crafting/client.lua
+++ /dev/null
@@ -1,103 +0,0 @@
-if not lib then
- return
-end
-
-local CraftingBenches = {}
-local Items = require("modules.items.client")
-local createBlip = require("modules.utils.client").CreateBlip
-local Utils = require("modules.utils.client")
-local markerColour = { 150, 150, 30 }
-local prompt = {
- options = { icon = "fa-wrench" },
- message = ("**%s** \n%s"):format(locale("open_crafting_bench"), locale("interact_prompt", GetControlInstructionalButton(0, 38, true):sub(3))),
-}
-
----@param id number
----@param data table
-local function createCraftingBench(id, data)
- CraftingBenches[id] = {}
- local recipes = data.items
-
- if recipes then
- data.slots = #recipes
-
- for i = 1, data.slots do
- local recipe = recipes[i]
- local item = Items[recipe.name]
-
- if item then
- recipe.weight = item.weight
- recipe.slot = i
- else
- warn(('failed to setup crafting recipe (bench: %s, slot: %s) - item "%s" does not exist'):format(id, i, recipe.name))
- end
- end
-
- local blip = data.blip
-
- if blip then
- blip.name = blip.name or ("ox_crafting_%s"):format(data.label and id or 0)
- AddTextEntry(blip.name, data.label or locale("crafting_bench"))
- end
-
- if shared.target then
- data.points = nil
- if data.zones then
- for i = 1, #data.zones do
- local zone = data.zones[i]
- zone.name = ("craftingbench_%s:%s"):format(id, i)
- zone.id = id
- zone.index = i
- zone.options = {
- {
- label = zone.label or locale("open_crafting_bench"),
- canInteract = data.groups and function()
- return client.hasGroup(data.groups)
- end or nil,
- onSelect = function()
- client.openInventory("crafting", { id = id, index = i })
- end,
- distance = zone.distance or 2.0,
- icon = zone.icon or "fas fa-wrench",
- },
- }
-
- exports.ox_target:addBoxZone(zone)
-
- if blip then
- createBlip(blip, zone.coords)
- end
- end
- end
- elseif data.points then
- data.zones = nil
-
- for i = 1, #data.points do
- local coords = data.points[i]
-
- lib.points.new({
- coords = coords,
- distance = 16,
- benchid = id,
- index = i,
- inv = "crafting",
- prompt = prompt,
- marker = markerColour,
- nearby = Utils.nearbyMarker,
- })
-
- if blip then
- createBlip(blip, coords)
- end
- end
- end
-
- CraftingBenches[id] = data
- end
-end
-
-for id, data in pairs(lib.load("data.crafting")) do
- createCraftingBench(id, data)
-end
-
-return CraftingBenches
diff --git a/server-data/resources/[ox]/ox_inventory/modules/crafting/server.lua b/server-data/resources/[ox]/ox_inventory/modules/crafting/server.lua
deleted file mode 100644
index f0cbb9249..000000000
--- a/server-data/resources/[ox]/ox_inventory/modules/crafting/server.lua
+++ /dev/null
@@ -1,230 +0,0 @@
-if not lib then return end
-
-local CraftingBenches = {}
-local Items = require 'modules.items.server'
-local Inventory = require 'modules.inventory.server'
-
----@param id number
----@param data table
-local function createCraftingBench(id, data)
- CraftingBenches[id] = {}
- local recipes = data.items
-
- if recipes then
- for i = 1, #recipes do
- local recipe = recipes[i]
- local item = Items(recipe.name)
-
- if item then
- recipe.weight = item.weight
- recipe.slot = i
- else
- warn(('failed to setup crafting recipe (bench: %s, slot: %s) - item "%s" does not exist'):format(id, i, recipe.name))
- end
-
- for ingredient, needs in pairs(recipe.ingredients) do
- if needs < 1 then
- item = Items(ingredient)
-
- if item and not item.durability then
- item.durability = true
- end
- end
- end
- end
-
- if shared.target then
- data.points = nil
- else
- data.zones = nil
- end
-
- CraftingBenches[id] = data
- end
-end
-
-for id, data in pairs(lib.load('data.crafting')) do createCraftingBench(id, data) end
-
----falls back to player coords if zones and points are both nil
----@param source number
----@param bench table
----@param index number
----@return vector3
-local function getCraftingCoords(source, bench, index)
- if not bench.zones and not bench.points then
- return GetEntityCoords(GetPlayerPed(source))
- else
- return shared.target and bench.zones[index].coords or bench.points[index]
- end
-end
-
-lib.callback.register('ox_inventory:openCraftingBench', function(source, id, index)
- local left, bench = Inventory(source), CraftingBenches[id]
-
- if not left then return end
-
- if bench then
- local groups = bench.groups
- local coords = getCraftingCoords(source, bench, index)
-
- if not coords then return end
-
- if groups and not server.hasGroup(left, groups) then return end
- if #(GetEntityCoords(GetPlayerPed(source)) - coords) > 10 then return end
-
- if left.open and left.open ~= source then
- local inv = Inventory(left.open) --[[@as OxInventory]]
-
- -- Why would the player inventory open with an invalid target? Can't repro but whatever.
- if inv?.player then
- inv:closeInventory()
- end
- end
-
- left:openInventory(left)
- end
-
- return { label = left.label, type = left.type, slots = left.slots, weight = left.weight, maxWeight = left.maxWeight }
-end)
-
-local TriggerEventHooks = require 'modules.hooks.server'
-
-lib.callback.register('ox_inventory:craftItem', function(source, id, index, recipeId, toSlot)
- local left, bench = Inventory(source), CraftingBenches[id]
-
- if not left then return end
-
- if bench then
- local groups = bench.groups
- local coords = getCraftingCoords(source, bench, index)
-
- if groups and not server.hasGroup(left, groups) then return end
- if #(GetEntityCoords(GetPlayerPed(source)) - coords) > 10 then return end
-
- local recipe = bench.items[recipeId]
-
- if recipe then
- local tbl, num = {}, 0
-
- for name in pairs(recipe.ingredients) do
- num += 1
- tbl[num] = name
- end
-
- local craftedItem = Items(recipe.name)
- local craftCount = (type(recipe.count) == 'number' and recipe.count) or (table.type(recipe.count) == 'array' and math.random(recipe.count[1], recipe.count[2])) or 1
- local newWeight = left.weight + (craftedItem.weight + (recipe.metadata?.weight or 0)) * craftCount
- ---@todo new iterator or something to accept a map
- local items = Inventory.Search(left, 'slots', tbl) or {}
- table.wipe(tbl)
-
- for name, needs in pairs(recipe.ingredients) do
- local slots = items[name] or items
-
- for i = 1, #slots do
- local slot = slots[i]
-
- if needs == 0 then
- if not slot.metadata.durability or slot.metadata.durability > 0 then
- break
- end
- elseif needs < 1 then
- local item = Items(name)
- local durability = slot.metadata.durability
-
- if durability and durability >= needs * 100 then
- if durability > 100 then
- local degrade = (slot.metadata.degrade or item.degrade) * 60
- local percentage = ((durability - os.time()) * 100) / degrade
-
- if percentage >= needs * 100 then
- tbl[slot.slot] = needs
- break
- end
- else
- tbl[slot.slot] = needs
- break
- end
- end
- elseif needs <= slot.count then
- local itemWeight = slot.weight / slot.count
- newWeight = (newWeight - slot.weight) + (slot.count - needs) * itemWeight
- tbl[slot.slot] = needs
- break
- else
- tbl[slot.slot] = slot.count
- newWeight -= slot.weight
- needs -= slot.count
- end
-
- if needs == 0 then break end
- -- Player does not have enough items (ui should prevent crafting if lacking items, so this shouldn't trigger)
- if needs > 0 and i == #slots then return end
- end
- end
-
- if newWeight > left.maxWeight then
- return false, 'cannot_carry'
- end
-
- if not TriggerEventHooks('craftItem', {
- source = source,
- benchId = id,
- benchIndex = index,
- recipe = recipe,
- toInventory = left.id,
- toSlot = toSlot,
- }) then return false end
-
- local success = lib.callback.await('ox_inventory:startCrafting', source, id, recipeId)
-
- if success then
- for name, needs in pairs(recipe.ingredients) do
- if Inventory.GetItemCount(left, name) < needs then return end
- end
-
- for slot, count in pairs(tbl) do
- local invSlot = left.items[slot]
-
- if not invSlot then return end
-
- if count < 1 then
- local item = Items(invSlot.name)
- local durability = invSlot.metadata.durability or 100
-
- if durability > 100 then
- local degrade = (invSlot.metadata.degrade or item.degrade) * 60
- durability -= degrade * count
- else
- durability -= count * 100
- end
-
- if invSlot.count > 1 then
- local emptySlot = Inventory.GetEmptySlot(left)
-
- if emptySlot then
- local newItem = Inventory.SetSlot(left, item, 1, table.deepclone(invSlot.metadata), emptySlot)
-
- if newItem then
- Items.UpdateDurability(left, newItem, item, durability < 0 and 0 or durability)
- end
- end
-
- invSlot.count -= 1
- else
- Items.UpdateDurability(left, invSlot, item, durability < 0 and 0 or durability)
- end
- else
- local removed = invSlot and Inventory.RemoveItem(left, invSlot.name, count, nil, slot)
- -- Failed to remove item (inventory state unexpectedly changed?)
- if not removed then return end
- end
- end
-
- Inventory.AddItem(left, craftedItem, craftCount, recipe.metadata or {}, craftedItem.stack and toSlot or nil)
- end
-
- return success
- end
- end
-end)
diff --git a/server-data/resources/[ox]/ox_inventory/modules/utils/client.lua b/server-data/resources/[ox]/ox_inventory/modules/utils/client.lua
index 3e7f031b9..8e15d05f8 100644
--- a/server-data/resources/[ox]/ox_inventory/modules/utils/client.lua
+++ b/server-data/resources/[ox]/ox_inventory/modules/utils/client.lua
@@ -220,8 +220,6 @@ function Utils.nearbyMarker(point)
CreateThread(function()
if point.inv == "policeevidence" then
client.openInventory("policeevidence")
- elseif point.inv == "crafting" then
- client.openInventory("crafting", { id = point.benchid, index = point.index })
else
client.openInventory(point.inv or "drop", { id = point.invId, type = point.type })
end
diff --git a/server-data/resources/[ox]/ox_inventory/server.lua b/server-data/resources/[ox]/ox_inventory/server.lua
index 00dc3e5b0..f470ad2b4 100644
--- a/server-data/resources/[ox]/ox_inventory/server.lua
+++ b/server-data/resources/[ox]/ox_inventory/server.lua
@@ -9,7 +9,6 @@ local db = require 'modules.mysql.server'
local Items = require 'modules.items.server'
local Inventory = require 'modules.inventory.server'
-require 'modules.crafting.server'
require 'modules.shops.server'
require 'modules.pefcl.server'
require 'modules.bridge.server'
diff --git a/server-data/resources/[ox]/ox_inventory/web/build/assets/index-9aba2ab3.css b/server-data/resources/[ox]/ox_inventory/web/build/assets/index-9aba2ab3.css
index b1ec75e8e..f7f40d176 100644
--- a/server-data/resources/[ox]/ox_inventory/web/build/assets/index-9aba2ab3.css
+++ b/server-data/resources/[ox]/ox_inventory/web/build/assets/index-9aba2ab3.css
@@ -408,21 +408,6 @@ button:active {
font-weight: 400
}
-.tooltip-crafting-duration {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center
-}
-
-.tooltip-crafting-duration svg {
- padding-right: 3px
-}
-
-.tooltip-crafting-duration p {
- font-size: 14px
-}
-
.tooltip-ingredients {
padding-top: 5px
}
diff --git a/server-data/resources/[wasabi]/wasabi_oxshops/configuration/config.lua b/server-data/resources/[wasabi]/wasabi_oxshops/configuration/config.lua
index 2ad7f86e9..f0874e8d1 100644
--- a/server-data/resources/[wasabi]/wasabi_oxshops/configuration/config.lua
+++ b/server-data/resources/[wasabi]/wasabi_oxshops/configuration/config.lua
@@ -47,4 +47,28 @@ Config.Shops = {
},
},
},
+
+ ["mechanic"] = {
+ label = "Mechanic Shop",
+ blip = {
+ enabled = true,
+ coords = vec3(811.147278, -2157.349365, 29.616821),
+ sprite = 61,
+ color = 8,
+ scale = 0.7,
+ string = "mechanic",
+ },
+ locations = {
+ stash = {
+ string = "[E] - Access Inventory",
+ coords = vec3(-319.410980, -131.907684, 38.968506),
+ range = 3.0,
+ },
+ shop = {
+ string = "[E] - Access Shop",
+ coords = vec3(-344.149445, -139.951645, 39.002197),
+ range = 4.0,
+ },
+ },
+ },
}