NPCs/Vendors

* show restock time if available
This commit is contained in:
Sarjuuk
2022-03-25 15:24:51 +01:00
parent 32b4c451e4
commit 04e55b5498
9 changed files with 44 additions and 9 deletions

View File

@@ -102,9 +102,9 @@ class ItemList extends BaseType
$itemz = [];
$xCostData = [];
$rawEntries = DB::World()->select('
SELECT nv.item, nv.entry, 0 AS eventId, nv.maxcount, nv.extendedCost FROM npc_vendor nv WHERE {nv.entry IN (?a) AND} nv.item IN (?a)
SELECT nv.item, nv.entry, 0 AS eventId, nv.maxcount, nv.extendedCost, nv.incrtime FROM npc_vendor nv WHERE {nv.entry IN (?a) AND} nv.item IN (?a)
UNION
SELECT genv.item, c.id AS `entry`, ge.eventEntry AS eventId, genv.maxcount, genv.extendedCost FROM game_event_npc_vendor genv LEFT JOIN game_event ge ON genv.eventEntry = ge.eventEntry JOIN creature c ON c.guid = genv.guid WHERE {c.id IN (?a) AND} genv.item IN (?a)',
SELECT genv.item, c.id AS `entry`, ge.eventEntry AS eventId, genv.maxcount, genv.extendedCost, genv.incrtime FROM game_event_npc_vendor genv LEFT JOIN game_event ge ON genv.eventEntry = ge.eventEntry JOIN creature c ON c.guid = genv.guid WHERE {c.id IN (?a) AND} genv.item IN (?a)',
empty($filter[Type::NPC]) || !is_array($filter[Type::NPC]) ? DBSIMPLE_SKIP : $filter[Type::NPC],
array_keys($this->templates),
empty($filter[Type::NPC]) || !is_array($filter[Type::NPC]) ? DBSIMPLE_SKIP : $filter[Type::NPC],
@@ -136,9 +136,10 @@ class ItemList extends BaseType
if (!empty($xCostData[$vInfo['extendedCost']]))
$costs = $xCostData[$vInfo['extendedCost']];
$data = array(
$data = array(
'stock' => $vInfo['maxcount'] ?: -1,
'event' => $vInfo['eventId'],
'restock' => $vInfo['incrtime'],
'reqRating' => $costs ? $costs['reqPersonalRating'] : 0,
'reqBracket' => $costs ? $costs['reqArenaSlot'] : 0
);
@@ -360,9 +361,10 @@ class ItemList extends BaseType
$currency[] = [-$k, $qty];
}
$costArr['stock'] = $entries['stock'];// display as column in lv
$costArr['avail'] = $entries['stock'];// display as number on icon
$costArr['cost'] = [empty($entries[0]) ? 0 : $entries[0]];
$costArr['stock'] = $entries['stock'];// display as column in lv
$costArr['avail'] = $entries['stock'];// display as number on icon
$costArr['cost'] = [empty($entries[0]) ? 0 : $entries[0]];
$costArr['restock'] = $entries['restock'];
if ($entries['event'])
{

View File

@@ -621,12 +621,19 @@ class NpcPage extends GenericPage
$soldItems = new ItemList(array(['id', $sells]));
if (!$soldItems->error)
{
$colAddIn = '';
$extraCols = ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost'];
if ($soldItems->hasSetFields(['condition']))
$extraCols[] = '$Listview.extraCols.condition';
if ($soldItems->hasSetFields(['condition']))
$extraCols[] = '$Listview.extraCols.condition';
$lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [Type::NPC => [$this->typeId]]);
if (array_filter(array_column($lvData, 'restock')))
{
$extraCols[] = '$_';
$colAddIn = 'vendorRestockCol';
}
$sc = Util::getServerConditions(CND_SRC_NPC_VENDOR, $this->typeId);
if (!empty($sc[0]))
{
@@ -645,7 +652,7 @@ class NpcPage extends GenericPage
'name' => '$LANG.tab_sells',
'id' => 'currency-for',
'extraCols' => array_unique($extraCols)
)];
), $colAddIn];
$this->extendGlobalData($soldItems->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}

View File

@@ -4850,6 +4850,8 @@ var LANG = {
guideAuthor: 'Leitfadenautor',
autoresizetextbox: 'Textfeld automatisch anpassen',
restock: 'Nachschub',
descriptionlengthlong_tip: 'Oh nein! Deine Beschreibung ist zu lang bei $1. Es wird wahrscheinlich gekürzt werden.',
descriptionlengthoptimal_tip: 'Ihre Beschreibung hat eine gute Länge. Gut gemacht! Sie können sicher bis zu $1 hinzufügen, wenn nötig.',
descriptionlengthshort_tip: 'Ihre Beschreibung ist zu kurz! $1 fehlen noch ...',

View File

@@ -4898,6 +4898,8 @@ var LANG = {
guideAuthor: 'Guide Author',
autoresizetextbox: 'Auto-Resize Text Box',
restock: 'Restock',
descriptionlengthlong_tip: 'Oh no! Your description is $1 too long! It will most likely be truncated.',
descriptionlengthoptimal_tip: 'Your description is a good length. Good job! You can safely add up to $1 if needed.',
descriptionlengthshort_tip: 'Your description is too short! $1 to go...',

View File

@@ -4853,6 +4853,8 @@ var LANG = {
guideAuthor: '[Guide Author]',
autoresizetextbox: 'Redimensionar automáticamente el cuadro de texto',
restock: '[Restock]',
descriptionlengthlong_tip: '¡Oh, no! Tu descripción es demasido larga por $1. Es muy posible que sea cortada',
descriptionlengthoptimal_tip: 'Tu descripción es de la longitud óptima. ¡Buen trabajo! Si es necesario, puedes agregar hasta $1.',
descriptionlengthshort_tip: '¡Tu descripción es demasiado corta! Te faltan $1...',

View File

@@ -4852,6 +4852,8 @@ var LANG = {
guideAuthor: 'Auteur du guide',
autoresizetextbox: 'Redimensionner automatiquement le champ texte',
restock: '[Restock]',
descriptionlengthlong_tip: 'Fichtre ! Votre description $1 est trop longue ! Elle sera probablement tronquée.',
descriptionlengthoptimal_tip: 'Votre description est de longueur appropriée. Bien joué ! Vous pouvez sans problème ajouter jusqu\'à $1 si besoin.',
descriptionlengthshort_tip: 'Votre description est trop courte ! Encore $1...',

View File

@@ -4854,6 +4854,8 @@ var LANG = {
guideAuthor: 'Автор руководства',
autoresizetextbox: 'Автоматически изменять размер поля с текстом',
restock: '[Restock]',
descriptionlengthlong_tip: 'Не может быть! Ваше описание $1 слишком велико! Вероятнее всего, оно будет сокращено.',
descriptionlengthoptimal_tip: 'Ваше описание имеет оптимальную длину. Отлично! Если необходимо, вы можете добавить ещё $1 символов.',
descriptionlengthshort_tip: 'Ваше описание слишком короткое! $1 чтобы',

View File

@@ -4877,6 +4877,8 @@ var LANG = {
guideAuthor: '[Guide Author]',
autoresizetextbox: '自动缩放文字框',
restock: '[Restock]',
descriptionlengthlong_tip: '欧漏,你的描述超出了$1个字可能会被删减哦。',
descriptionlengthoptimal_tip: '你的注释已经达到了合理的长度。干的漂亮!',
descriptionlengthshort_tip: '你的注释太短了!请再输入$1$个字。',

View File

@@ -0,0 +1,14 @@
var _ = {
id: 'restock',
name: LANG.restock,
width: '10%',
value: 'restock',
after: 'stack',
compute: function(data, td) {
if (data.restock) {
let t = g_formatTimeElapsed(data.restock);
$WH.ae(td, $WH.ct(t));
}
}
};