Fixed typos of ReplaceCrateTooltipAchievements

This commit is contained in:
PneuJai
2021-01-26 23:27:31 +08:00
committed by GitHub
parent f450ae98ae
commit 91a2edf348

View File

@@ -1253,17 +1253,17 @@ CM.Disp.ReplaceTooltipLump = function() {
* This function replaces the original Game.crate and Game.crateTooltip functions of stats page * This function replaces the original Game.crate and Game.crateTooltip functions of stats page
*/ */
CM.Disp.ReplaceCrateTooltipAchievements = function() { CM.Disp.ReplaceCrateTooltipAchievements = function() {
CM.Disp.CrateTooltipAchievementsBackup = [Game.crate, Game.crateTooltip];
Game.crate = function(me,context,forceClickStr,id) {
let output;
if (me.type === 'achievement') {
let options = {normal: false, shadow: false}; let options = {normal: false, shadow: false};
switch (CM.ConfigData.MissingAchievements) { switch (CM.Options.MissingAchievements) {
case 0: options.normal = true; options.shadow = false; break; case 0: options.normal = true; options.shadow = false; break;
case 1: options.normal = false; options.shadow = true; break; case 1: options.normal = false; options.shadow = true; break;
case 2: options.normal = true; options.shadow = true; break; case 2: options.normal = true; options.shadow = true; break;
case 3: options.normal = false; options.shadow = false; break; case 3: options.normal = false; options.shadow = false; break;
} }
CM.Disp.CrateTooltipAchievementsBackup = [Game.crate, Game.crateTooltip];
Game.crate = function(me,context,forceClickStr,id) {
let output;
if (me.type === 'achievement') {
let icon = me.icon; let icon = me.icon;
if (options.shadow && me.pool === 'shadow') { if (options.shadow && me.pool === 'shadow') {
me.pool = 'normal'; me.pool = 'normal';
@@ -1283,6 +1283,13 @@ CM.Disp.ReplaceCrateTooltipAchievements = function() {
Game.crateTooltip = function(me,context) { Game.crateTooltip = function(me,context) {
let output; let output;
if (me.type === 'achievement') { if (me.type === 'achievement') {
let options = {normal: false, shadow: false};
switch (CM.Options.MissingAchievements) {
case 0: options.normal = true; options.shadow = false; break;
case 1: options.normal = false; options.shadow = true; break;
case 2: options.normal = true; options.shadow = true; break;
case 3: options.normal = false; options.shadow = false; break;
}
output = CM.Disp.CrateTooltipAchievementsBackup[1](me,context); output = CM.Disp.CrateTooltipAchievementsBackup[1](me,context);
if (options.normal && me.pool === 'normal') { if (options.normal && me.pool === 'normal') {
output = output.replace('<div class="name">???</div>', '<div class="name">'+me.name+'</div>'); output = output.replace('<div class="name">???</div>', '<div class="name">'+me.name+'</div>');