Display cross-conversion carousel items in the inventory sidebar #2

Merged
audrey merged 2 commits from dot_sent/fallen_london_scripts:master into master 2021-10-06 23:27:51 +02:00

View File

@ -8,7 +8,7 @@
// @name FallenLondon Enhancer
// @namespace https://forge.chapril.org/audrey/
// @require https://forge.chapril.org/audrey/fallen_london_scripts/raw/branch/master/jquery/jquery-3.6.0.min.js
// @version 0.1-rc2
// @version 0.1-rc3
// ==/UserScript==
"use strict";
@ -46,6 +46,33 @@ function display_items_total_value() {
items_total_value_displayed = true;
}
function update_third_tier_counts() {
const t3_qualities = {
'0' : { id: '525', src: '//images.fallenlondon.com/icons/bookpurplesmall.png' }, // Journal of Infamy
'1' : { id: '932', src: '//images.fallenlondon.com/icons/scrawl1small.png' }, // Correspondence Plaque
'2' : { id: '827', src: '//images.fallenlondon.com/icons/sunsetsmall.png' }, // Vision of the Surface
'3' : { id: '587', src: '//images.fallenlondon.com/icons/mountainglowsmall.png' }, // Mystery of the Elder Continent
'4' : { id: '659', src: '//images.fallenlondon.com/icons/conversationsmall.png' }, // Scrap of Incendiary Gossip
'5' : { id: '825', src: '//images.fallenlondon.com/icons/wakesmall.png' }, // Memory of Distant Shores
'6' : { id: '668', src: '//images.fallenlondon.com/icons/bottledsoulbluesmall.png' }, // Brilliant Soul
'7' : { id: '828', src: '//images.fallenlondon.com/icons/scaryeyesmall.png' }, // A Tale of Terror!!
'8' : { id: '830', src: '//images.fallenlondon.com/icons/papers3small.png' }, // Compromising Document
'9' : { id: '589', src: '//images.fallenlondon.com/icons/mirrorsmall.png' }, // Memory of Light
'A' : { id: '831', src: '//images.fallenlondon.com/icons/waves3small.png' }, // Zee-Ztory
'B' : { id: '822', src: '//images.fallenlondon.com/icons/bottlewillowsmall.png' }, // Bottle of Stranngling Willow Absinthe
'C' : { id: '915', src: '//images.fallenlondon.com/icons/scrap2small.png' }, // Whisper-Satin Scrap
};
$('div#FLE-ccc').remove();
let html = '<div id="FLE-ccc" style="text-align:left;">';
$.each(t3_qualities, function(order, quality) {
let quality_id = quality.id;
let image_src = quality.src;
let elem = $('div [data-quality-id="' + quality_id + '"]');
let quantity = elem.length == 1 ? elem.find('.js-item-value').html() : 0;
html += '<div class="icon icon--inventory" style="margin:1px; margin-bottom:5px;"><img src="' + image_src + '"><span class="icon__value" style="font-size:12px; bottom:-7px; right:-7px; padding:1px 3px; background-color: ' + (quantity > 49 ? '#457c46' : 'black') + ';">' + quantity + '</span></div>';
});
$(html + '</div>').insertAfter('div#FLE-quirks');
}
////////////
// MYSELF //
@ -157,6 +184,7 @@ function possessions() {
update_advantage_bar();
update_quirks_bar();
update_contacts_bar();
update_third_tier_counts();
}