@opfr/services 0.15.1 → 0.16.0

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/index.es.js CHANGED
@@ -2,8 +2,7 @@ var cr = Object.defineProperty;
2
2
  var ur = (t, a, s) => a in t ? cr(t, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[a] = s;
3
3
  var e = (t, a, s) => ur(t, typeof a != "symbol" ? a + "" : a, s);
4
4
  import { Schema as S, models as Y, model as F, isValidObjectId as fr, connect as pr, Types as mr } from "mongoose";
5
- import { findItem as gs, isBackgroundItem as hr, isTitleItem as yr, isChestItem as gr, isBoostItem as _r, isRepairItem as wr, isStoreItem as br, isObjectItem as vr, isCookedMeal as Mr, getAllItemsLimit as _s } from "@opfr/items";
6
- import { EQUIPMENT_SLOT as xr, fromDBToEquipableEquipment as kr, AllPanoplies as Sr, isEquipmentId as ws } from "@opfr/equipments";
5
+ import { findItem as gs, isBackgroundItem as hr, isTitleItem as yr, isChestItem as gr, isBoostItem as _r, isRepairItem as wr, isStoreItem as br, isObjectItem as vr, EQUIPMENT_SLOT as Mr, fromDBToEquipableEquipment as xr, AllPanoplies as kr, isEquipmentId as _s, isCookedMeal as Sr, getAllItemsLimit as ws } from "@opfr/items";
7
6
  import { getComputedCharacteristicValue as Ur } from "@opfr/raids";
8
7
  import { RANKS as o, getCurrentLevel as L, CHARACTERISTICS as Dr, HP_PER_VITALITY as Or, DEFAULT_MAX_HP as Cr, DEFAULT_FACTION as Br } from "@opfr/utils-type";
9
8
  import * as $r from "events";
@@ -7035,15 +7034,15 @@ const Yt = ((ls = Y) == null ? void 0 : ls.UserGames) || F("UserGames", $n), Ta
7035
7034
  intelligence: 0,
7036
7035
  wisdom: 0
7037
7036
  };
7038
- for (const s of xr) {
7037
+ for (const s of Mr) {
7039
7038
  const n = t.equippedItems[s];
7040
7039
  n && (a = Jt(
7041
7040
  a,
7042
- kr(n).characteristics,
7041
+ xr(n).characteristics,
7043
7042
  (r, i) => r + i
7044
7043
  ));
7045
7044
  }
7046
- for (const s of Sr) {
7045
+ for (const s of kr) {
7047
7046
  const n = Jp(t, s);
7048
7047
  n && (a = Jt(a, n, (r, i) => r + i));
7049
7048
  }
@@ -7596,7 +7595,7 @@ const It = ((ds = Y) == null ? void 0 : ds.UserInventory) || F("UserInventory",
7596
7595
  for (const { itemId: c, size: h } of a)
7597
7596
  await In(t, c, h * n);
7598
7597
  const { itemId: i, size: l } = s;
7599
- ws(i) ? await En(t, [{ id: i, seed: r }]) : await Ce(t, i, l * n);
7598
+ _s(i) ? await En(t, [{ id: i, seed: r }]) : await Ce(t, i, l * n);
7600
7599
  }, I0 = async (t, a) => {
7601
7600
  await Me(t, { $addToSet: { recipes: a } });
7602
7601
  }, Eh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -7914,7 +7913,7 @@ const Ue = ((fs = Y) == null ? void 0 : fs.UserQuestMeta) || F("UserQuestMeta",
7914
7913
  }
7915
7914
  });
7916
7915
  }, Z0 = async (t, a, s) => {
7917
- !ws(s) && Mr(gs(s)) && await k(t, {
7916
+ !_s(s) && Sr(gs(s)) && await k(t, {
7918
7917
  $inc: { "crafts.cookedMeal": a }
7919
7918
  }), await k(t, {
7920
7919
  $inc: { "crafts.total": a }
@@ -8134,11 +8133,11 @@ const Nt = ((ps = Y) == null ? void 0 : ps.UserRaid) || F("UserRaid", tr), Be =
8134
8133
  const a = await Nt.findOne({ user: t });
8135
8134
  return a || await ar(t);
8136
8135
  }, Um = (t, a, s) => {
8137
- const n = _s()[a], r = t.limit ? t.limit[a] : void 0;
8136
+ const n = ws()[a], r = t.limit ? t.limit[a] : void 0;
8138
8137
  return t.lastShopId !== s ? !1 : !!(n && r && r >= n);
8139
8138
  }, Dm = (t, a, s, n) => {
8140
8139
  var l;
8141
- const r = _s()[a], i = (l = t.limit) == null ? void 0 : l[a];
8140
+ const r = ws()[a], i = (l = t.limit) == null ? void 0 : l[a];
8142
8141
  return r ? t.lastShopId !== s ? r : i ? r - i : Math.min(r, n) : n;
8143
8142
  }, qh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8144
8143
  __proto__: null,
@@ -8630,6 +8629,107 @@ const ot = ((ys = Y) == null ? void 0 : ys.Warns) || F("Warns", lr), Xm = async
8630
8629
  "success_MYTHIC",
8631
8630
  "xp"
8632
8631
  ], Jm = {
8632
+ background: "<:background:1178465681809887334>",
8633
+ title: "<:title:1178465688915038208>",
8634
+ chest_1: "<:lootbox1:1186689926167810088>",
8635
+ chest_2: "<:lootbox2:1186258728882811051>",
8636
+ chest_3: "<:lootbox3:1243963722259501216>",
8637
+ chest_4: "<:lootbox3:1186259958216523786>",
8638
+ bottle_xp_1: "<:bottle_xp:1186204593667969035>",
8639
+ bottle_xp_2: "<:bottle_xp_2:1243980696083632208>",
8640
+ bottle_xp_3: "<:bottle_xp_3:1243980697773936740>",
8641
+ bottle_xp_4: "<:bottle_xp_4:1243980698927366256>",
8642
+ boost_week: "<:boost_week:1186258728073297971>",
8643
+ boost_day: "<:boost_day:1186258726030680145>",
8644
+ wood_plank: "<:Planchesdebois:1233782418478071930>",
8645
+ nail: "<:Clous:1233782384613261382>",
8646
+ glue: "<:Colle:1233782388497186846>",
8647
+ rope: "<:Corde:1233782392225927168>",
8648
+ repair_kit: "<:Kitderparation:1233782876223570011>",
8649
+ tissue: "<:Tissus:1233784184099573852>",
8650
+ lock: "<:Serrureclef:1233782436068982814>",
8651
+ iron: "<:Ferbrut:1233782399125426207>",
8652
+ clover: "<:Treflesixfeuilles:1233782439503990915> ",
8653
+ glass_bottle: "<:Fioleenverre:1233782402233532496>",
8654
+ pure_water: "<:Eaupure:1233782393572298802>",
8655
+ sea_salt: "<:SelMarin:1233784181696233602>",
8656
+ ebony_poppy: "<:Pavotebene:1233782416879915060>",
8657
+ rose: "<:Roseimmaculee:1233784180215644180>",
8658
+ poppy: "<:Coquelicotecarlate:1233782390099280023>",
8659
+ manganese: "<:Manganesescintillante:1233784177221042196>",
8660
+ cursed_hawthorn: "<:AubpineMaudite:1233782382872629329>",
8661
+ mugwort: "<:Armoiseblanche:1233782381400424519>",
8662
+ mandrake: "<:MandragoreAdulte:1233782409070247946>",
8663
+ obsidian: "<:Obsidiennesombre:1233784178307371110>",
8664
+ saffron: "<:Safranvermeille:1233782430385836124>",
8665
+ edelweiss: "<:Edelweiss:1233782395019329546>",
8666
+ emerald: "<:emeraude:1233782873165791273>",
8667
+ ruby: "<:Rubis:1233782426174619679>",
8668
+ sapphire: "<:Saphir:1233782432004837407>",
8669
+ siren_tear: "<:Larmedesirene:1233782405538517095>",
8670
+ compass: "<:Rosedesvents:1233782421892239360>",
8671
+ dragon_heart: "<:CoeurdeDragon:1233782386580258848>",
8672
+ fairy_wing: "<:Ailedefees:1233782379269722293>",
8673
+ phoenix_feather: "<:PlumedePhoenix:1233784783822127167>",
8674
+ mithril: "<:Mithril:1233782412434214974>",
8675
+ cereal: "<:craft_cereal:1243963641204703405>",
8676
+ cotton: "<:craft_cotton:1243963642567721080>",
8677
+ empty_box: "<:craft_empty_box:1243963643834535966>",
8678
+ enchanted_emerald: "<:craft_enchanted_emerald:1243963645092696105>",
8679
+ enchanted_ruby: "<:craft_enchanted_ruby:1243963647097569330>",
8680
+ enchanted_sapphire: "<:craft_enchanted_sapphire:1243963648486019082>",
8681
+ enchanted_stone: "<:craft_enchanted_stone:1243963650893545637>",
8682
+ flour: "<:craft_flour:1243963651719823451>",
8683
+ hemp: "<:craft_hemp:1243963653238030387>",
8684
+ scrap: "<:craft_scrap:1243963718895669268>",
8685
+ strange_gem: "<:craft_strange_gem:1243963656539078686>",
8686
+ strange_stone: "<:craft_strange_stone:1243963658766123192>",
8687
+ tools: "<:craft_tools:1243963720179122217>",
8688
+ wood: "<:craft_wood:1243963662763298897>",
8689
+ wine: "<:craft_wine:1249242713442746501>",
8690
+ toy: "<:craft_toy:1249242711907893278>",
8691
+ rhum: "<:craft_rhum:1249242707961057361>",
8692
+ milk: "<:craft_milk:1249242706501308488>",
8693
+ fruit: "<:craft_fruit:1249242705612115968>",
8694
+ sugar: "<:craft_sugar:1249242709684785184>",
8695
+ egg: "<:craft_egg:1249242703972007986>",
8696
+ omelet: "<:omelette:1288942044328493179>",
8697
+ cheese: "<:Fromage_Affine:1289695711398596761>",
8698
+ bread: "<:Pain_de_campagne:1289703440163016855>",
8699
+ strawberry_cake: "<:Fraisier:1289707903649058858>",
8700
+ bowl_cereal: "<:craft_bowl_cereal:1249242702462193686>",
8701
+ beer: "<:craft_beer:1249242701300240434>",
8702
+ bowl: "<:craft_bowl:1250116629275082873>",
8703
+ rudder: "<:craft_rudder:1250435943253540895>",
8704
+ rescue_boat: "<:craft_rescue_boat:1250435931635322950>",
8705
+ sailing_boat: "<:craft_sailing_boat:1250435942162894849>",
8706
+ salt_water: "<:craft_salt_water:1250435945216475317>",
8707
+ anchor: "<:craft_anchor:1250435934843834409>",
8708
+ hammock: "<:craft_hammock:1250435933300588687>",
8709
+ leather: "<:craft_leather:1253034980133834752>",
8710
+ ancient_key: "<:craft_ancient_key:1257447843355033742>",
8711
+ iron_ore: "<:craft_iron_ore:1257475847271612497>",
8712
+ map_fragment: "<:map_fragment:1281949667227205663>",
8713
+ scroll_agility: "<:scroll_agility:1254081331365810289>",
8714
+ scroll_chance: "<:scroll_chance:1254081332422639657>",
8715
+ scroll_intelligence: "<:scroll_intelligence:1254081334264070174>",
8716
+ scroll_strength: "<:scroll_strength:1254081335862099980>",
8717
+ scroll_vitality: "<:scroll_vitality:1254081337711919185>",
8718
+ scroll_wisdom: "<:scroll_wisdom:1254081340115259454>",
8719
+ elemental_concentrate_earth: "<:elemental_concentrate_earth:1269073512782499860>",
8720
+ elemental_concentrate_fire: "<:elemental_concentrate_fire:1269073513919156349>",
8721
+ elemental_concentrate_life: "<:elemental_concentrate_life:1269073515315728425>",
8722
+ elemental_concentrate_moon: "<:elemental_concentrate_moon:1269073517044039760>",
8723
+ elemental_concentrate_water: "<:elemental_concentrate_water:1269073518205599776>",
8724
+ elemental_concentrate_wind: "<:elemental_concentrate_wind:1269073510815367189>",
8725
+ essence_earth: "<:essence_earth:1269073149300052034>",
8726
+ essence_fire: "<:essence_fire:1269073150784700416>",
8727
+ essence_life: "<:essence_life:1269073151728287787>",
8728
+ essence_moon: "<:essence_moon:1269073153510998056>",
8729
+ essence_water: "<:essence_water:1269073154333081701>",
8730
+ essence_wind: "<:essence_wind:1269073156241625088>",
8731
+ empty_scroll: "<:empty_scroll:1269074077327298653>"
8732
+ }, Km = {
8633
8733
  d1: "<:d1:1159542168738873455>",
8634
8734
  d2: "<:d2:1159542071049334814>",
8635
8735
  d3: "<:d3:1159542073914032191>",
@@ -8750,10 +8850,11 @@ const ot = ((ys = Y) == null ? void 0 : ys.Warns) || F("Warns", lr), Xm = async
8750
8850
  equipment_adventurer_boots: "<:adventurer_boots:1253041083252867123>",
8751
8851
  equipment_adventurer_helmet: "<:Casque_cuir:1256965718432550953>",
8752
8852
  equipment_adventurer_weapon: "<:Dague_cuir:1256965714141515837>",
8753
- equipment_adventurer_belt: "<:Ceinture_cuir:1256965593333108838>"
8853
+ equipment_adventurer_belt: "<:Ceinture_cuir:1256965593333108838>",
8854
+ items: Jm
8754
8855
  }, oy = (t, a) => {
8755
8856
  const s = t.badge, n = t.isFactionBadge;
8756
- return s ? ea(s) ? s.emojis[s.isProgressive.findIndex((r) => r === t.rank.id)] : s.emojis : n ? Jm.factions[`b_${a}_${t.rank.id}`] : "";
8857
+ return s ? ea(s) ? s.emojis[s.isProgressive.findIndex((r) => r === t.rank.id)] : s.emojis : n ? Km.factions[`b_${a}_${t.rank.id}`] : "";
8757
8858
  }, dy = (t) => {
8758
8859
  const [a, s] = t.split("_"), n = Object.values(p).find((r) => r.id === a);
8759
8860
  if (n)