Created (empty) tooltip for garden plots
This commit is contained in:
@@ -2416,9 +2416,10 @@ CM.Disp.Tooltip = function(type, name) {
|
|||||||
}
|
}
|
||||||
else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps
|
else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps
|
||||||
else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire
|
else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire
|
||||||
|
else if (type == 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots
|
||||||
|
|
||||||
// Adds area for extra tooltip-sections
|
// Adds area for extra tooltip-sections
|
||||||
if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g') {
|
if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g' || type == 'p') {
|
||||||
var area = document.createElement('div');
|
var area = document.createElement('div');
|
||||||
area.id = 'CMTooltipArea';
|
area.id = 'CMTooltipArea';
|
||||||
l('tooltip').appendChild(area);
|
l('tooltip').appendChild(area);
|
||||||
@@ -2583,6 +2584,9 @@ CM.Disp.UpdateTooltip = function() {
|
|||||||
else if (CM.Disp.tooltipType === 'g') {
|
else if (CM.Disp.tooltipType === 'g') {
|
||||||
CM.Disp.UpdateTooltipGrimoire();
|
CM.Disp.UpdateTooltipGrimoire();
|
||||||
}
|
}
|
||||||
|
else if (CM.Disp.tooltipType === 'p') {
|
||||||
|
CM.Disp.UpdateTooltipGardenPlots();
|
||||||
|
}
|
||||||
CM.Disp.UpdateTooltipWarnings();
|
CM.Disp.UpdateTooltipWarnings();
|
||||||
}
|
}
|
||||||
else if (l('CMTooltipArea') == null) { // Remove warnings if its a basic tooltip
|
else if (l('CMTooltipArea') == null) { // Remove warnings if its a basic tooltip
|
||||||
@@ -2779,6 +2783,15 @@ CM.Disp.UpdateTooltipGrimoire = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the Garden plots tooltips
|
||||||
|
* It is called when Garden plots tooltips are created or refreshed by CM.Disp.UpdateTooltip()
|
||||||
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
|
*/
|
||||||
|
CM.Disp.UpdateTooltipGardenPlots = function() {
|
||||||
|
var minigame = Game.Objects['Farm'].minigame;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function updates the warnings section of the building and upgrade tooltips
|
* This function updates the warnings section of the building and upgrade tooltips
|
||||||
* It is called by CM.Disp.UpdateTooltip()
|
* It is called by CM.Disp.UpdateTooltip()
|
||||||
@@ -4335,18 +4348,16 @@ CM.Main.ReplaceTooltipLump = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function replaces the original .onmouseover functions of sugar lumps so that it calls CM.Disp.Tooltip()
|
* This function replaces the original .onmouseover functions of all garden plants so that it calls CM.Disp.Tooltip()
|
||||||
* CM.Disp.Tooltip() sets the tooltip type to '?'
|
* CM.Disp.Tooltip() sets the tooltip type to 'p'
|
||||||
* It is called by CM.Main.ReplaceTooltips()
|
* It is called by CM.Main.ReplaceTooltips()
|
||||||
*/
|
*/
|
||||||
CM.Main.ReplaceTooltipGarden = function() {
|
CM.Main.ReplaceTooltipGarden = function() {
|
||||||
if (Game.Objects['Farm'].minigameLoaded) {
|
if (Game.Objects['Farm'].minigameLoaded) {
|
||||||
CM.Main.TooltipGardenBackup = [];
|
Array.from(l('gardenPlot').children).forEach((child, index) => {
|
||||||
for (var i in Game.Objects['Farm'].minigame.plot) {
|
var coords = child.id.slice(-3,);
|
||||||
for (var j in i) {
|
child.onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('p', [`${coords[0]}`,`${coords[2]}`]);}, 'this'); Game.tooltip.wobble();};
|
||||||
//console.log(j, i)
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
15
src/Disp.js
15
src/Disp.js
@@ -1233,9 +1233,10 @@ CM.Disp.Tooltip = function(type, name) {
|
|||||||
}
|
}
|
||||||
else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps
|
else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps
|
||||||
else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire
|
else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire
|
||||||
|
else if (type == 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots
|
||||||
|
|
||||||
// Adds area for extra tooltip-sections
|
// Adds area for extra tooltip-sections
|
||||||
if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g') {
|
if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g' || type == 'p') {
|
||||||
var area = document.createElement('div');
|
var area = document.createElement('div');
|
||||||
area.id = 'CMTooltipArea';
|
area.id = 'CMTooltipArea';
|
||||||
l('tooltip').appendChild(area);
|
l('tooltip').appendChild(area);
|
||||||
@@ -1400,6 +1401,9 @@ CM.Disp.UpdateTooltip = function() {
|
|||||||
else if (CM.Disp.tooltipType === 'g') {
|
else if (CM.Disp.tooltipType === 'g') {
|
||||||
CM.Disp.UpdateTooltipGrimoire();
|
CM.Disp.UpdateTooltipGrimoire();
|
||||||
}
|
}
|
||||||
|
else if (CM.Disp.tooltipType === 'p') {
|
||||||
|
CM.Disp.UpdateTooltipGardenPlots();
|
||||||
|
}
|
||||||
CM.Disp.UpdateTooltipWarnings();
|
CM.Disp.UpdateTooltipWarnings();
|
||||||
}
|
}
|
||||||
else if (l('CMTooltipArea') == null) { // Remove warnings if its a basic tooltip
|
else if (l('CMTooltipArea') == null) { // Remove warnings if its a basic tooltip
|
||||||
@@ -1596,6 +1600,15 @@ CM.Disp.UpdateTooltipGrimoire = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the Garden plots tooltips
|
||||||
|
* It is called when Garden plots tooltips are created or refreshed by CM.Disp.UpdateTooltip()
|
||||||
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
|
*/
|
||||||
|
CM.Disp.UpdateTooltipGardenPlots = function() {
|
||||||
|
var minigame = Game.Objects['Farm'].minigame;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function updates the warnings section of the building and upgrade tooltips
|
* This function updates the warnings section of the building and upgrade tooltips
|
||||||
* It is called by CM.Disp.UpdateTooltip()
|
* It is called by CM.Disp.UpdateTooltip()
|
||||||
|
|||||||
14
src/Main.js
14
src/Main.js
@@ -323,18 +323,16 @@ CM.Main.ReplaceTooltipLump = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function replaces the original .onmouseover functions of sugar lumps so that it calls CM.Disp.Tooltip()
|
* This function replaces the original .onmouseover functions of all garden plants so that it calls CM.Disp.Tooltip()
|
||||||
* CM.Disp.Tooltip() sets the tooltip type to '?'
|
* CM.Disp.Tooltip() sets the tooltip type to 'p'
|
||||||
* It is called by CM.Main.ReplaceTooltips()
|
* It is called by CM.Main.ReplaceTooltips()
|
||||||
*/
|
*/
|
||||||
CM.Main.ReplaceTooltipGarden = function() {
|
CM.Main.ReplaceTooltipGarden = function() {
|
||||||
if (Game.Objects['Farm'].minigameLoaded) {
|
if (Game.Objects['Farm'].minigameLoaded) {
|
||||||
CM.Main.TooltipGardenBackup = [];
|
Array.from(l('gardenPlot').children).forEach((child, index) => {
|
||||||
for (var i in Game.Objects['Farm'].minigame.plot) {
|
var coords = child.id.slice(-3,);
|
||||||
for (var j in i) {
|
child.onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('p', [`${coords[0]}`,`${coords[2]}`]);}, 'this'); Game.tooltip.wobble();};
|
||||||
//console.log(j, i)
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user