dirk-cfx-react 1.0.35 → 1.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.cjs +16 -16
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +4 -7
- package/dist/components/index.d.ts +4 -7
- package/dist/components/index.js +18 -17
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs +4 -3
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +4 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +496 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +491 -34
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +27 -4
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +1 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.js +27 -4
- package/dist/providers/index.js.map +1 -1
- package/dist/utils/index.cjs +480 -17
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +48 -17
- package/dist/utils/index.d.ts +48 -17
- package/dist/utils/index.js +474 -16
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
2
|
-
import { createTheme, Flex, Text, Image, MantineProvider, BackgroundImage, useMantineTheme } from '@mantine/core';
|
|
2
|
+
import { createTheme, Flex, Text, Image, MantineProvider, BackgroundImage, useMantineTheme, alpha } from '@mantine/core';
|
|
3
3
|
import { createContext, useRef, useEffect, useMemo, useState, useContext } from 'react';
|
|
4
4
|
import '@mantine/core/styles.css';
|
|
5
5
|
import '@mantine/notifications/styles.css';
|
|
@@ -163,11 +163,11 @@ var colorNames = {
|
|
|
163
163
|
Yellow: { r: 255, g: 255, b: 0 },
|
|
164
164
|
YellowGreen: { r: 154, g: 205, b: 50 }
|
|
165
165
|
};
|
|
166
|
-
function colorWithAlpha(color,
|
|
166
|
+
function colorWithAlpha(color, alpha2) {
|
|
167
167
|
const lowerCasedColor = color.toLowerCase();
|
|
168
168
|
if (colorNames[lowerCasedColor]) {
|
|
169
169
|
const rgb = colorNames[lowerCasedColor];
|
|
170
|
-
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${
|
|
170
|
+
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha2})`;
|
|
171
171
|
}
|
|
172
172
|
if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
|
|
173
173
|
const hex = color.slice(1);
|
|
@@ -175,12 +175,12 @@ function colorWithAlpha(color, alpha) {
|
|
|
175
175
|
const r = bigint >> 16 & 255;
|
|
176
176
|
const g = bigint >> 8 & 255;
|
|
177
177
|
const b = bigint & 255;
|
|
178
|
-
return `rgba(${r}, ${g}, ${b}, ${
|
|
178
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha2})`;
|
|
179
179
|
}
|
|
180
180
|
if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
|
|
181
181
|
const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
|
|
182
182
|
if (result) {
|
|
183
|
-
return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${
|
|
183
|
+
return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha2})`;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
return color;
|
|
@@ -234,8 +234,6 @@ var useNuiEvent = (action, handler) => {
|
|
|
234
234
|
return () => window.removeEventListener("message", eventListener);
|
|
235
235
|
}, [action]);
|
|
236
236
|
};
|
|
237
|
-
|
|
238
|
-
// src/utils/fetchNui.ts
|
|
239
237
|
async function fetchNui(eventName, data, mockData) {
|
|
240
238
|
const options = {
|
|
241
239
|
method: "post",
|
|
@@ -244,8 +242,9 @@ async function fetchNui(eventName, data, mockData) {
|
|
|
244
242
|
},
|
|
245
243
|
body: JSON.stringify(data)
|
|
246
244
|
};
|
|
247
|
-
|
|
248
|
-
if (isEnvBrowser())
|
|
245
|
+
console.log(mockData);
|
|
246
|
+
if (isEnvBrowser() && mockData) return mockData;
|
|
247
|
+
if (isEnvBrowser() && mockData === void 0) {
|
|
249
248
|
console.warn(
|
|
250
249
|
`[fetchNui] Called fetchNui for event "${eventName}" in browser environment without mockData. Returning empty object.`
|
|
251
250
|
);
|
|
@@ -253,20 +252,31 @@ async function fetchNui(eventName, data, mockData) {
|
|
|
253
252
|
}
|
|
254
253
|
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
|
|
255
254
|
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
256
|
-
|
|
257
|
-
return respFormatted;
|
|
255
|
+
return await resp.json();
|
|
258
256
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
var initialFetches = {};
|
|
258
|
+
async function registerInitialFetch(eventName, data, mockData) {
|
|
259
|
+
const fetcher = () => fetchNui(eventName, data, mockData);
|
|
260
|
+
initialFetches[eventName] = fetcher;
|
|
261
|
+
return fetcher();
|
|
264
262
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
263
|
+
async function runFetches() {
|
|
264
|
+
return Promise.all(
|
|
265
|
+
Object.entries(initialFetches).map(async ([eventName, fetcher]) => {
|
|
266
|
+
const data = await fetcher();
|
|
267
|
+
return { eventName, data };
|
|
268
|
+
})
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
var useAutoFetcher = () => {
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
if (isEnvBrowser()) return;
|
|
274
|
+
const run = async () => {
|
|
275
|
+
const results = await runFetches();
|
|
276
|
+
console.log("[useAutoFetcher] Fetched initial data:", results);
|
|
277
|
+
};
|
|
278
|
+
run();
|
|
279
|
+
}, []);
|
|
270
280
|
};
|
|
271
281
|
|
|
272
282
|
// src/utils/internalEvent.ts
|
|
@@ -302,9 +312,454 @@ var localeStore = create((set, get) => {
|
|
|
302
312
|
};
|
|
303
313
|
});
|
|
304
314
|
var locale = localeStore.getState().locale;
|
|
305
|
-
|
|
315
|
+
registerInitialFetch("GET_LOCALES", void 0).then((data) => {
|
|
306
316
|
localeStore.setState({ locales: data });
|
|
307
317
|
});
|
|
318
|
+
var useProfanityStore = create(() => [
|
|
319
|
+
"ars3",
|
|
320
|
+
"a55",
|
|
321
|
+
"a55hole",
|
|
322
|
+
"ahole",
|
|
323
|
+
"anus",
|
|
324
|
+
"ash0le",
|
|
325
|
+
"ash0les",
|
|
326
|
+
"asholes",
|
|
327
|
+
"4r5e",
|
|
328
|
+
"5h1t",
|
|
329
|
+
"5hit",
|
|
330
|
+
"a55",
|
|
331
|
+
"anal",
|
|
332
|
+
"anus",
|
|
333
|
+
"ar5e",
|
|
334
|
+
"arrse",
|
|
335
|
+
"arse",
|
|
336
|
+
"ass",
|
|
337
|
+
"ass-fucker",
|
|
338
|
+
"asses",
|
|
339
|
+
"assfucker",
|
|
340
|
+
"assfukka",
|
|
341
|
+
"asshole",
|
|
342
|
+
"assholes",
|
|
343
|
+
"asswhole",
|
|
344
|
+
"a_s_s",
|
|
345
|
+
"b!tch",
|
|
346
|
+
"b00bs",
|
|
347
|
+
"b17ch",
|
|
348
|
+
"b1tch",
|
|
349
|
+
"ballsack",
|
|
350
|
+
"beastial",
|
|
351
|
+
"beastiality",
|
|
352
|
+
"bestial",
|
|
353
|
+
"bestiality",
|
|
354
|
+
"bi+ch",
|
|
355
|
+
"biatch",
|
|
356
|
+
"bitch",
|
|
357
|
+
"bitcher",
|
|
358
|
+
"bitchers",
|
|
359
|
+
"bitches",
|
|
360
|
+
"bitchin",
|
|
361
|
+
"bitching",
|
|
362
|
+
"blow job",
|
|
363
|
+
"blowjob",
|
|
364
|
+
"blowjobs",
|
|
365
|
+
"boiolas",
|
|
366
|
+
"bollock",
|
|
367
|
+
"bollok",
|
|
368
|
+
"boner",
|
|
369
|
+
"boob",
|
|
370
|
+
"boobs",
|
|
371
|
+
"booobs",
|
|
372
|
+
"boooobs",
|
|
373
|
+
"booooobs",
|
|
374
|
+
"booooooobs",
|
|
375
|
+
"breasts",
|
|
376
|
+
"buceta",
|
|
377
|
+
"bunny fucker",
|
|
378
|
+
"butthole",
|
|
379
|
+
"buttmuch",
|
|
380
|
+
"buttplug",
|
|
381
|
+
"c0ck",
|
|
382
|
+
"c0cksucker",
|
|
383
|
+
"carpet muncher",
|
|
384
|
+
"chink",
|
|
385
|
+
"cipa",
|
|
386
|
+
"cl1t",
|
|
387
|
+
"clit",
|
|
388
|
+
"clitoris",
|
|
389
|
+
"clits",
|
|
390
|
+
"cnut",
|
|
391
|
+
"cock",
|
|
392
|
+
"cock-sucker",
|
|
393
|
+
"cockface",
|
|
394
|
+
"cockhead",
|
|
395
|
+
"cockmunch",
|
|
396
|
+
"cockmuncher",
|
|
397
|
+
"cocks",
|
|
398
|
+
"cocksuck",
|
|
399
|
+
"cocksucked",
|
|
400
|
+
"cocksucker",
|
|
401
|
+
"cocksucking",
|
|
402
|
+
"cocksucks",
|
|
403
|
+
"cocksuka",
|
|
404
|
+
"cocksukka",
|
|
405
|
+
"cokmuncher",
|
|
406
|
+
"coksucka",
|
|
407
|
+
"coon",
|
|
408
|
+
"cum",
|
|
409
|
+
"cummer",
|
|
410
|
+
"cumming",
|
|
411
|
+
"cums",
|
|
412
|
+
"cumshot",
|
|
413
|
+
"cunilingus",
|
|
414
|
+
"cunillingus",
|
|
415
|
+
"cunnilingus",
|
|
416
|
+
"cunt",
|
|
417
|
+
"cuntlick",
|
|
418
|
+
"cuntlicker",
|
|
419
|
+
"cuntlicking",
|
|
420
|
+
"cunts",
|
|
421
|
+
"cyalis",
|
|
422
|
+
"cyberfuc",
|
|
423
|
+
"cyberfuck",
|
|
424
|
+
"cyberfucked",
|
|
425
|
+
"cyberfucker",
|
|
426
|
+
"cyberfuckers",
|
|
427
|
+
"cyberfucking",
|
|
428
|
+
"d1ck",
|
|
429
|
+
"dlck",
|
|
430
|
+
"dog-fucker",
|
|
431
|
+
"doggin",
|
|
432
|
+
"dogging",
|
|
433
|
+
"donkeyribber",
|
|
434
|
+
"dyke",
|
|
435
|
+
"ejaculate",
|
|
436
|
+
"ejaculated",
|
|
437
|
+
"ejaculates",
|
|
438
|
+
"ejaculating",
|
|
439
|
+
"ejaculatings",
|
|
440
|
+
"ejaculation",
|
|
441
|
+
"ejakulate",
|
|
442
|
+
"f u c k",
|
|
443
|
+
"f u c k e r",
|
|
444
|
+
"f4nny",
|
|
445
|
+
"fag",
|
|
446
|
+
"fagging",
|
|
447
|
+
"faggitt",
|
|
448
|
+
"faggot",
|
|
449
|
+
"faggs",
|
|
450
|
+
"fagot",
|
|
451
|
+
"fagots",
|
|
452
|
+
"fags",
|
|
453
|
+
"fannyflaps",
|
|
454
|
+
"fannyfucker",
|
|
455
|
+
"fatass",
|
|
456
|
+
"fcuk",
|
|
457
|
+
"fcuker",
|
|
458
|
+
"fcuking",
|
|
459
|
+
"feck",
|
|
460
|
+
"fecker",
|
|
461
|
+
"felching",
|
|
462
|
+
"fellate",
|
|
463
|
+
"fellatio",
|
|
464
|
+
"fingerfuck",
|
|
465
|
+
"fingerfucked",
|
|
466
|
+
"fingerfucker",
|
|
467
|
+
"fingerfuckers",
|
|
468
|
+
"fingerfucking",
|
|
469
|
+
"fingerfucks",
|
|
470
|
+
"fistfuck",
|
|
471
|
+
"fistfucked",
|
|
472
|
+
"fistfucker",
|
|
473
|
+
"fistfuckers",
|
|
474
|
+
"fistfucking",
|
|
475
|
+
"fistfuckings",
|
|
476
|
+
"fistfucks",
|
|
477
|
+
"fuck",
|
|
478
|
+
"fucka",
|
|
479
|
+
"fucked",
|
|
480
|
+
"fucker",
|
|
481
|
+
"fuckers",
|
|
482
|
+
"fuckhead",
|
|
483
|
+
"fuckheads",
|
|
484
|
+
"fuckin",
|
|
485
|
+
"fucking",
|
|
486
|
+
"fuckings",
|
|
487
|
+
"fuckingshitmotherfucker",
|
|
488
|
+
"fuckme",
|
|
489
|
+
"fucks",
|
|
490
|
+
"fuckwhit",
|
|
491
|
+
"fuckwit",
|
|
492
|
+
"fudge packer",
|
|
493
|
+
"fudgepacker",
|
|
494
|
+
"fuk",
|
|
495
|
+
"fuker",
|
|
496
|
+
"fukker",
|
|
497
|
+
"fukkin",
|
|
498
|
+
"fuks",
|
|
499
|
+
"fukwhit",
|
|
500
|
+
"fukwit",
|
|
501
|
+
"fux",
|
|
502
|
+
"fux0r",
|
|
503
|
+
"f_u_c_k",
|
|
504
|
+
"gangbang",
|
|
505
|
+
"gangbanged",
|
|
506
|
+
"gangbangs",
|
|
507
|
+
"gaysex",
|
|
508
|
+
"God",
|
|
509
|
+
"god-dam",
|
|
510
|
+
"god-damned",
|
|
511
|
+
"goddamn",
|
|
512
|
+
"goddamned",
|
|
513
|
+
"homo",
|
|
514
|
+
"jack-off",
|
|
515
|
+
"jerk-off",
|
|
516
|
+
"l3i+ch",
|
|
517
|
+
"l3itch",
|
|
518
|
+
"labia",
|
|
519
|
+
"lusting",
|
|
520
|
+
"m0f0",
|
|
521
|
+
"m0fo",
|
|
522
|
+
"m45terbate",
|
|
523
|
+
"ma5terb8",
|
|
524
|
+
"ma5terbate",
|
|
525
|
+
"masochist",
|
|
526
|
+
"master-bate",
|
|
527
|
+
"masterb8",
|
|
528
|
+
"masterbat*",
|
|
529
|
+
"masterbat3",
|
|
530
|
+
"masterbate",
|
|
531
|
+
"masterbation",
|
|
532
|
+
"masterbations",
|
|
533
|
+
"masturbate",
|
|
534
|
+
"mo-fo",
|
|
535
|
+
"mof0",
|
|
536
|
+
"mothafuck",
|
|
537
|
+
"mothafucka",
|
|
538
|
+
"mothafuckas",
|
|
539
|
+
"mothafuckaz",
|
|
540
|
+
"mothafucked",
|
|
541
|
+
"mothafucker",
|
|
542
|
+
"mothafuckers",
|
|
543
|
+
"mothafuckin",
|
|
544
|
+
"mothafucking",
|
|
545
|
+
"mothafuckings",
|
|
546
|
+
"mothafucks",
|
|
547
|
+
"mother fucker",
|
|
548
|
+
"motherfuck",
|
|
549
|
+
"motherfucked",
|
|
550
|
+
"motherfucker",
|
|
551
|
+
"motherfuckers",
|
|
552
|
+
"motherfuckin",
|
|
553
|
+
"motherfucking",
|
|
554
|
+
"motherfuckings",
|
|
555
|
+
"motherfuckka",
|
|
556
|
+
"motherfucks",
|
|
557
|
+
"muthafecker",
|
|
558
|
+
"muthafuckker",
|
|
559
|
+
"mutherfucker",
|
|
560
|
+
"n1gga",
|
|
561
|
+
"n1gger",
|
|
562
|
+
"nazi",
|
|
563
|
+
"nigg3r",
|
|
564
|
+
"nigg4h",
|
|
565
|
+
"nigga",
|
|
566
|
+
"niggah",
|
|
567
|
+
"niggas",
|
|
568
|
+
"niggaz",
|
|
569
|
+
"nigger",
|
|
570
|
+
"niggers",
|
|
571
|
+
"nob jokey",
|
|
572
|
+
"nobjocky",
|
|
573
|
+
"nobjokey",
|
|
574
|
+
"orgasim",
|
|
575
|
+
"orgasims",
|
|
576
|
+
"orgasm",
|
|
577
|
+
"orgasms",
|
|
578
|
+
"p0rn",
|
|
579
|
+
"penis",
|
|
580
|
+
"penisfucker",
|
|
581
|
+
"phonesex",
|
|
582
|
+
"phuck",
|
|
583
|
+
"phuked",
|
|
584
|
+
"phuking",
|
|
585
|
+
"phukked",
|
|
586
|
+
"phukking",
|
|
587
|
+
"phuks",
|
|
588
|
+
"phuq",
|
|
589
|
+
"pigfucker",
|
|
590
|
+
"pimpis",
|
|
591
|
+
"piss",
|
|
592
|
+
"pissed",
|
|
593
|
+
"pisser",
|
|
594
|
+
"pissers",
|
|
595
|
+
"pisses",
|
|
596
|
+
"pissflaps",
|
|
597
|
+
"pissin",
|
|
598
|
+
"pissing",
|
|
599
|
+
"pissoff",
|
|
600
|
+
"poop",
|
|
601
|
+
"porn",
|
|
602
|
+
"porno",
|
|
603
|
+
"pornography",
|
|
604
|
+
"pornos",
|
|
605
|
+
"prick",
|
|
606
|
+
"pricks",
|
|
607
|
+
"pron",
|
|
608
|
+
"pube",
|
|
609
|
+
"pusse",
|
|
610
|
+
"pussi",
|
|
611
|
+
"pussies",
|
|
612
|
+
"pussy",
|
|
613
|
+
"pussys",
|
|
614
|
+
"rectum",
|
|
615
|
+
"retard",
|
|
616
|
+
"rimjaw",
|
|
617
|
+
"rimming",
|
|
618
|
+
"s hit",
|
|
619
|
+
"s.o.b.",
|
|
620
|
+
"scroat",
|
|
621
|
+
"scrote",
|
|
622
|
+
"scrotum",
|
|
623
|
+
"semen",
|
|
624
|
+
"sex",
|
|
625
|
+
"sh!+",
|
|
626
|
+
"sh!t",
|
|
627
|
+
"sh1t",
|
|
628
|
+
"shemale",
|
|
629
|
+
"shit",
|
|
630
|
+
"shitdick",
|
|
631
|
+
"shite",
|
|
632
|
+
"shited",
|
|
633
|
+
"shitey",
|
|
634
|
+
"shitfuck",
|
|
635
|
+
"shitfull",
|
|
636
|
+
"shithead",
|
|
637
|
+
"shiting",
|
|
638
|
+
"shitings",
|
|
639
|
+
"shits",
|
|
640
|
+
"shitted",
|
|
641
|
+
"shitter",
|
|
642
|
+
"shitters",
|
|
643
|
+
"shitting",
|
|
644
|
+
"shittings",
|
|
645
|
+
"shitty",
|
|
646
|
+
"skank",
|
|
647
|
+
"slut",
|
|
648
|
+
"sluts",
|
|
649
|
+
"smegma",
|
|
650
|
+
"smut",
|
|
651
|
+
"son-of-a-bitch",
|
|
652
|
+
"spac",
|
|
653
|
+
"s_h_i_t",
|
|
654
|
+
"t1tt1e5",
|
|
655
|
+
"t1tties",
|
|
656
|
+
"teets",
|
|
657
|
+
"teez",
|
|
658
|
+
"testical",
|
|
659
|
+
"testicle",
|
|
660
|
+
"titfuck",
|
|
661
|
+
"tits",
|
|
662
|
+
"titt",
|
|
663
|
+
"tittie5",
|
|
664
|
+
"tittiefucker",
|
|
665
|
+
"titties",
|
|
666
|
+
"tittyfuck",
|
|
667
|
+
"tittywank",
|
|
668
|
+
"titwank",
|
|
669
|
+
"tosser",
|
|
670
|
+
"tw4t",
|
|
671
|
+
"twat",
|
|
672
|
+
"twathead",
|
|
673
|
+
"twatty",
|
|
674
|
+
"twunt",
|
|
675
|
+
"twunter",
|
|
676
|
+
"v14gra",
|
|
677
|
+
"v1gra",
|
|
678
|
+
"vagina",
|
|
679
|
+
"viagra",
|
|
680
|
+
"vulva",
|
|
681
|
+
"w00se",
|
|
682
|
+
"whoar",
|
|
683
|
+
"whore",
|
|
684
|
+
"xrated"
|
|
685
|
+
]);
|
|
686
|
+
var isProfanity = (word) => {
|
|
687
|
+
const all = useProfanityStore.getState();
|
|
688
|
+
const profanityArray = Array.isArray(all) ? all : typeof all === "object" && all !== null ? Object.values(all) : [];
|
|
689
|
+
return profanityArray.includes(word);
|
|
690
|
+
};
|
|
691
|
+
function calculateXPForLevel(level, settings) {
|
|
692
|
+
if (level < settings.baseLevel) return 0;
|
|
693
|
+
if (level === 1) return 0;
|
|
694
|
+
if (level === 2) return settings.baseXP;
|
|
695
|
+
let totalXP = settings.baseXP;
|
|
696
|
+
for (let i = 2; i <= level - 1; i++) {
|
|
697
|
+
const baseRuneScapeXP = Math.floor((i + 300 * 2 ** (i / 7)) / 4);
|
|
698
|
+
totalXP += baseRuneScapeXP * settings.modifier;
|
|
699
|
+
}
|
|
700
|
+
return Math.floor(totalXP);
|
|
701
|
+
}
|
|
702
|
+
function generateLevelMap(settings) {
|
|
703
|
+
const levelMap = {};
|
|
704
|
+
for (let level = settings.baseLevel; level <= settings.maxLevel; level++) {
|
|
705
|
+
levelMap[level.toString()] = calculateXPForLevel(level, settings);
|
|
706
|
+
}
|
|
707
|
+
return levelMap;
|
|
708
|
+
}
|
|
709
|
+
function getLevelFromXP(xp, levelMap, settings) {
|
|
710
|
+
for (let level = settings.baseLevel; level <= settings.maxLevel; level++) {
|
|
711
|
+
const xpForLevel = levelMap[level.toString()];
|
|
712
|
+
if (xpForLevel > xp) return level - 1;
|
|
713
|
+
}
|
|
714
|
+
return settings.maxLevel;
|
|
715
|
+
}
|
|
716
|
+
function createSkill(defaultSettings) {
|
|
717
|
+
const useStore2 = create((set) => ({
|
|
718
|
+
settings: defaultSettings,
|
|
719
|
+
levelMap: generateLevelMap(defaultSettings),
|
|
720
|
+
setSettings: (updater) => set((state) => {
|
|
721
|
+
const newSettings = typeof updater === "function" ? updater(state.settings) : updater;
|
|
722
|
+
return {
|
|
723
|
+
settings: newSettings,
|
|
724
|
+
levelMap: generateLevelMap(newSettings)
|
|
725
|
+
};
|
|
726
|
+
})
|
|
727
|
+
}));
|
|
728
|
+
const useSkill = (xp) => {
|
|
729
|
+
const { settings, levelMap } = useStore2();
|
|
730
|
+
return useMemo(() => {
|
|
731
|
+
const currentLevel = getLevelFromXP(xp, levelMap, settings);
|
|
732
|
+
const nextLevel = Math.min(currentLevel + 1, settings.maxLevel);
|
|
733
|
+
const currentLevelXP = levelMap[currentLevel.toString()] || 0;
|
|
734
|
+
const nextLevelXP = levelMap[nextLevel.toString()] || 0;
|
|
735
|
+
const xpInCurrentLevel = xp - currentLevelXP;
|
|
736
|
+
const xpRequiredForLevel = nextLevelXP - currentLevelXP;
|
|
737
|
+
const progressToLevel = xpRequiredForLevel > 0 ? xpInCurrentLevel / xpRequiredForLevel * 100 : 100;
|
|
738
|
+
const xpToNextLevel = Math.max(0, nextLevelXP - xp);
|
|
739
|
+
return {
|
|
740
|
+
currentLevel,
|
|
741
|
+
nextLevel,
|
|
742
|
+
currentLevelXP,
|
|
743
|
+
nextLevelXP,
|
|
744
|
+
progressToLevel: Math.min(100, Math.max(0, progressToLevel)),
|
|
745
|
+
xpToNextLevel
|
|
746
|
+
};
|
|
747
|
+
}, [xp, levelMap, settings]);
|
|
748
|
+
};
|
|
749
|
+
const skill = {
|
|
750
|
+
get settings() {
|
|
751
|
+
return useStore2.getState().settings;
|
|
752
|
+
},
|
|
753
|
+
setSettings: (updater) => {
|
|
754
|
+
useStore2.getState().setSettings(updater);
|
|
755
|
+
},
|
|
756
|
+
useSettings: () => useStore2((state) => state.settings)
|
|
757
|
+
};
|
|
758
|
+
return {
|
|
759
|
+
skill,
|
|
760
|
+
useSkill
|
|
761
|
+
};
|
|
762
|
+
}
|
|
308
763
|
var theme = createTheme({
|
|
309
764
|
primaryColor: "dirk",
|
|
310
765
|
primaryShade: 9,
|
|
@@ -424,9 +879,10 @@ var theme = createTheme({
|
|
|
424
879
|
var theme_default = theme;
|
|
425
880
|
library.add(fas, far, fab);
|
|
426
881
|
var useSettings = create((set) => ({
|
|
427
|
-
game: "
|
|
428
|
-
primaryColor: "
|
|
429
|
-
primaryShade:
|
|
882
|
+
game: "fivem",
|
|
883
|
+
primaryColor: "dirk",
|
|
884
|
+
primaryShade: 9,
|
|
885
|
+
itemImgPath: "https://assets.dirkcfx.com/items/",
|
|
430
886
|
customTheme: {}
|
|
431
887
|
}));
|
|
432
888
|
function DirkProvider(props) {
|
|
@@ -450,6 +906,7 @@ function DirkProvider(props) {
|
|
|
450
906
|
console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
|
|
451
907
|
});
|
|
452
908
|
}, [game]);
|
|
909
|
+
useAutoFetcher();
|
|
453
910
|
return /* @__PURE__ */ jsx(MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsx(Wrapper, { children: props.children }) });
|
|
454
911
|
}
|
|
455
912
|
function Wrapper({ children }) {
|
|
@@ -957,7 +1414,7 @@ function SegmentedControl(props) {
|
|
|
957
1414
|
bg: "rgba(33, 33, 33, 0.6)",
|
|
958
1415
|
w: props.w || "fit-content",
|
|
959
1416
|
style: {
|
|
960
|
-
borderRadius: theme2.radius.xs,
|
|
1417
|
+
borderRadius: props.enableRadius !== false ? theme2.radius.xs : 0,
|
|
961
1418
|
overflow: "hidden"
|
|
962
1419
|
},
|
|
963
1420
|
...props,
|
|
@@ -981,6 +1438,7 @@ function SegmentedControl(props) {
|
|
|
981
1438
|
icon: item.icon,
|
|
982
1439
|
rightSection: item.rightSection,
|
|
983
1440
|
fz: props.fz,
|
|
1441
|
+
color: props.color,
|
|
984
1442
|
selected: !props.multi ? props.value === item.value : Array.isArray(props.value) && props.value.includes(item.value),
|
|
985
1443
|
onClick: () => {
|
|
986
1444
|
if (props.multi) {
|
|
@@ -1009,7 +1467,7 @@ function Segment(props) {
|
|
|
1009
1467
|
direction: "column",
|
|
1010
1468
|
align: "center",
|
|
1011
1469
|
h: "100%",
|
|
1012
|
-
bg: props.selected ? colorWithAlpha(theme2.colors[theme2.primaryColor][theme2.primaryShade], 0.2) : "transparent",
|
|
1470
|
+
bg: props.selected ? props.color ? alpha(props.color, 0.2) : colorWithAlpha(theme2.colors[theme2.primaryColor][theme2.primaryShade], 0.2) : "transparent",
|
|
1013
1471
|
pos: "relative",
|
|
1014
1472
|
style: {
|
|
1015
1473
|
// position: "relative",
|
|
@@ -1031,10 +1489,10 @@ function Segment(props) {
|
|
|
1031
1489
|
{
|
|
1032
1490
|
icon: props.icon,
|
|
1033
1491
|
initial: {
|
|
1034
|
-
color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1492
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1035
1493
|
},
|
|
1036
1494
|
animate: {
|
|
1037
|
-
color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1495
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1038
1496
|
},
|
|
1039
1497
|
exit: {
|
|
1040
1498
|
color: "inherit"
|
|
@@ -1050,10 +1508,10 @@ function Segment(props) {
|
|
|
1050
1508
|
{
|
|
1051
1509
|
size: props.fz || "xs",
|
|
1052
1510
|
initial: {
|
|
1053
|
-
color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1511
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1054
1512
|
},
|
|
1055
1513
|
animate: {
|
|
1056
|
-
color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1514
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1057
1515
|
},
|
|
1058
1516
|
exit: {
|
|
1059
1517
|
color: "inherit"
|
|
@@ -1089,7 +1547,7 @@ function Segment(props) {
|
|
|
1089
1547
|
left: 0,
|
|
1090
1548
|
right: 0,
|
|
1091
1549
|
height: "0.2vh",
|
|
1092
|
-
backgroundColor: theme2.colors[theme2.primaryColor][5],
|
|
1550
|
+
backgroundColor: props.color || theme2.colors[theme2.primaryColor][5],
|
|
1093
1551
|
transformOrigin: "center"
|
|
1094
1552
|
}
|
|
1095
1553
|
}
|
|
@@ -1219,7 +1677,6 @@ function Title(props) {
|
|
|
1219
1677
|
return /* @__PURE__ */ jsx(
|
|
1220
1678
|
Flex,
|
|
1221
1679
|
{
|
|
1222
|
-
mt: props.mt,
|
|
1223
1680
|
direction: "column",
|
|
1224
1681
|
bg: props.bg || "transparent",
|
|
1225
1682
|
gap: "xs",
|
|
@@ -1293,6 +1750,6 @@ function Title(props) {
|
|
|
1293
1750
|
);
|
|
1294
1751
|
}
|
|
1295
1752
|
|
|
1296
|
-
export { BorderedIcon, Counter, DirkProvider, FloatingParticles, InfoBox, InputContainer, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider,
|
|
1753
|
+
export { BorderedIcon, Counter, DirkProvider, FloatingParticles, InfoBox, InputContainer, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, SegmentedControl, SegmentedProgress, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
|
|
1297
1754
|
//# sourceMappingURL=index.js.map
|
|
1298
1755
|
//# sourceMappingURL=index.js.map
|