Skip to content

Commit

Permalink
Merge pull request #496 from SmooKeIsOnlyOne/fragments_horreum_notifi…
Browse files Browse the repository at this point in the history
…cation

forge fixes #494 #495
  • Loading branch information
GramThanos authored Jan 18, 2025
2 parents c611ea7 + 94581bb commit 0922b93
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
6 changes: 6 additions & 0 deletions source/core/resources/style_gca.css
Original file line number Diff line number Diff line change
Expand Up @@ -1754,3 +1754,9 @@
/* Needs cleaning! */
.gca_is_dirty .reportWin, .gca_is_dirty .reportLose {filter: grayscale(100%);}
.gca_is_dirty .tooltips>div::after {content: "*";float: right;color: #2d2d2d;padding: 0px 5px 0px 5px;margin-top: -18px;font-size: 2em;line-height: 18px;border-bottom: 1px solid #474747;border-right: 1px solid #474747;}


/* Gladiatus Fixes - version 6.1.0-r5
-------------------------------------------------- */
#forge_box {min-height: 259px;}
#rent[style*="visibility: hidden"] {display: none;}
23 changes: 14 additions & 9 deletions source/core/source/forge.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ var gca_forge = {
// Load materials data
jQuery.get(gca_getPage.link({'mod':'forge','submod':'storage'}), (content) => {
// Get materials info
var info = content.match(/<input id="remove-resource-amount" type="number" title="[^"]+" min="[^"]+" max="[^"]+" value="[^"]+"\s+data-max="([^"]+)"\s*\/>/i);
var info = content.match(/id="remove-resource-amount" type="number" title="[^"]+" min="[^"]+" max="[^"]+" value="[^"]+"\s+data-max="([^"]+)"\s*\/>/i);
if (!info || !info[1]) {
this.materialAmounts = false;
return;
Expand All @@ -316,9 +316,9 @@ var gca_forge = {
}
}
}

// Get quality translations
info = content.match(/<select id="remove-resource-quality"[^>]*>[^<]*<option value="-1">([^<]*)<\/option>[^<]*<option value="0">([^<]*)<\/option>[^<]*<option value="1">([^<]*)<\/option>[^<]*<option value="2">([^<]*)<\/option>[^<]*<option value="3">([^<]*)<\/option>[^<]*<option value="4">([^<]*)<\/option>[^<]*<\/select>/i);
info = content.match(/<select id="remove-resource-quality"[^>]*>[^<]*<option value="-1"[^>]*>\n([^<]*)<\/option>[^<]*<option value="0"[^>]*>\n([^<]*)<\/option>[^<]*<option value="1"[^>]*>\n([^<]*)<\/option>[^<]*<option value="2"[^>]*>\n([^<]*)<\/option>[^<]*<option value="3"[^>]*>\n([^<]*)<\/option>[^<]*<option value="4"[^>]*>\n([^<]*)<\/option>[^<]*<\/select>/i);
let translations = {};
if (!info) {
for (let i = -1; i <= 4; i++) translations.push('');
Expand All @@ -328,6 +328,7 @@ var gca_forge = {
translations[i] = gca_tools.strings.trim(info[j]);
}
}

this.qualityTranslations = translations;

this.showMaterialsAmounts();
Expand All @@ -345,8 +346,9 @@ var gca_forge = {
// Save selection the on first run
if (!this.selectionsText){
this.selectionsText = [];

for (let i = 0; i <= 5; i++)
this.selectionsText.push(document.getElementById("remove-resource-quality").getElementsByTagName("option")[i].textContent);
this.selectionsText.push(document.getElementById("resource-quality").getElementsByTagName("option")[i].textContent);
}

if (!document.getElementsByClassName("crafting_requirements")[0]) return;
Expand All @@ -357,7 +359,7 @@ var gca_forge = {
materials[0].dataset.amountsLoaded = true;

// Mark that the code has already run
document.getElementById("remove-resource-quality").dataset.amounts = true;
document.getElementById("resource-quality").dataset.amounts = true;

// Check if status
let isCrafting = !document.getElementById('slot-crafting').classList.contains('hidden');
Expand Down Expand Up @@ -409,9 +411,9 @@ var gca_forge = {
});

// Item in slot
if (document.getElementById("remove-resource-quality").parentNode.style.display == "block") {
if (document.getElementById("resource-quality").parentNode.style.display == "block") {
let select = false;
let resource = document.getElementById("remove-resource-quality");
let resource = document.getElementById("resource-quality");
let options = resource.getElementsByTagName("option");
for (let i = 0; i <= 5; i++) {
options[i].textContent = this.selectionsText[i] + "("+qualities[i]+"/"+totalRequired+")";
Expand Down Expand Up @@ -1248,7 +1250,7 @@ var gca_forge = {
let b = {};

// Parse lists
for (let i = 1; i <= 64; i++) {
for (let i = 1; i <= 71; i++) {
a[i] = {'-1' : 0, '0' : 0, '1' : 0, '2' : 0, '3' : 0, '4' : 0};
if (_a[i]) {
for (let j = -1; j <= 4; j++) {
Expand All @@ -1268,7 +1270,7 @@ var gca_forge = {
var removed = [];

// Compare
for (let i = 1; i <= 64; i++) {
for (let i = 1; i <= 71; i++) {
for (let j = -1; j <= 4; j++) {
if (a[i][j] > b[i][j]) {
removed.push([i, j, a[i][j] - b[i][j]]);
Expand Down Expand Up @@ -1402,6 +1404,9 @@ var gca_forge = {
horreum.textContent = completed.length + '× ' + document.getElementById('forge_horreum').textContent;
box.appendChild(horreum);

// Leave margin for the buttons above
document.getElementById('forge_box').style.marginBottom = '65px';

// Make requests
let makeGatherRequests = (type) => {
// Disable button
Expand Down

0 comments on commit 0922b93

Please sign in to comment.