Opened 8 years ago

Last modified 3 years ago

#4180 new defect

[PATCH] Add "Requires X." tooltip to aura tooltips automatically.

Reported by: fatherbushido Owned by:
Priority: Nice to Have Milestone: Backlog
Component: UI – In-game Keywords: patch, simple
Cc: Patch:

Description (last modified by Freagarach)

Now we have auras wich can requires a technology (see for example the 2nd wonder aura) and there is an explicit "Requires X." in the aura tooltip (aura description). We should generate that tooltip automatically.

The files to look at are simulation/components/GuiInterface.js, globalscripts/Templates.js and gui/common/tooltips.js. You can look for auraName and auraDescription and add that requirement.

Attachments (3)

4180_aura_reqtech_tooltip.patch (2.9 KB ) - added by Matias Lavik 8 years ago.
change: modified second Wonder's auraDescription
4180_aura_reqtech_tooltip_v2.patch (3.5 KB ) - added by Matias Lavik 8 years ago.
Added getTechnologyName(id) to global scritps. Found no similar function available from both inside and outside sessions.
4180_aura_reqtech_tooltip_v3.patch (3.5 KB ) - added by Matias Lavik 8 years ago.
fatherbushido: is the new function getTechnologyName(id) useful to have in global scripts, or should we move it to /gui/common/functions_utility.js?

Download all attachments as: .zip

Change History (18)

comment:1 by Matias Lavik, 8 years ago

  • Added required tech in parenthesis
  • Removed required tech from second Wonder's auraDescription

comment:2 by fatherbushido, 8 years ago

Thanks for working on it (so quickly).

  • Don't forget to remove the description.
  • I forgot to mention in ticket description to modify gui/structree/helper.js (to load the aura template for the structure tree). You could then check in the structure tree.

comment:3 by fatherbushido, 8 years ago

Keywords: rfc added

comment:4 by fatherbushido, 8 years ago

Keywords: patch added
Summary: Add "Requires X." tooltip to aura tooltips automatically.[PATCH] Add "Requires X." tooltip to aura tooltips automatically.

in reply to:  2 comment:5 by Matias Lavik, 8 years ago

Replying to fatherbushido:

Thanks for working on it (so quickly).

  • Don't forget to remove the description.
  • I forgot to mention in ticket description to modify gui/structree/helper.js (to load the aura template for the structure tree). You could then check in the structure tree.

Sorry, I forgot to upload the xml where I removed the tech from the description. Thanks for reminding me! What do you want me to do in helper.js? Since requiredTechnology is an ID and not a name, I suppose it should not be translated with translateObjectKeys()?

by Matias Lavik, 8 years ago

change: modified second Wonder's auraDescription

comment:6 by fatherbushido, 8 years ago

Anyway there is something to check with the structure tree. I look at your tooltip, in fact you use GetTechnologyData but this is a session function which is i guess not accesible from the structure tree.

So i got that error:

ERROR: JavaScript error: gui/common/tooltips.js line 539
ReferenceError: GetTechnologyData is not defined
  getAurasTooltip/tooltips<@gui/common/tooltips.js:539:1
  getAurasTooltip@gui/common/tooltips.js:531:6
  assembleTooltip/<@gui/structree/draw.js:387:40
  assembleTooltip@gui/structree/draw.js:387:2
  draw@gui/structree/draw.js:63:1
  selectCiv@gui/structree/structree.js:303:2
  __eventhandler38 (selectionchange)@civSelection selectionchange:0:1
  init@gui/structree/structree.js:38:3
  __eventhandler8 (press)@menuStrucTreeButton press:2:8

in reply to:  6 comment:7 by Matias Lavik, 8 years ago

Ah, right! Sorry, I didn't realise the aura's tooltip is used in the structree. It works in-game, but fails in the structree (as you showed). I will fix that.

by Matias Lavik, 8 years ago

Added getTechnologyName(id) to global scritps. Found no similar function available from both inside and outside sessions.

by Matias Lavik, 8 years ago

fatherbushido: is the new function getTechnologyName(id) useful to have in global scripts, or should we move it to /gui/common/functions_utility.js?

comment:8 by elexis, 7 years ago

Milestone: BacklogWork In Progress

Moving to the new WIP milestone.

comment:9 by fatherbushido, 7 years ago

that new function is not desired you must use the existing function in session and structure tree to get the tech name (those functions use a cache wich is needed to not load stuff from json everytime). Add your name to the contributors file too.

Last edited 7 years ago by Stan (previous) (diff)

comment:10 by fatherbushido, 7 years ago

Keywords: rfc removed

comment:11 by Imarok, 5 years ago

Component: UI & SimulationIn-game UI

Move tickets to In-game UI as UI & Simulation got some sub components.

comment:12 by Freagarach, 4 years ago

Description: modified (diff)
Milestone: Work In ProgressBacklog
Priority: If Time PermitsNice to Have

Patch is outdated and no work on it since long time, but nice to have since one can easily change requirements whilst keeping translations.

comment:13 by Freagarach, 4 years ago

Refs. #3670.

comment:14 by Silier, 3 years ago

Keywords: simple removed
severity: simple

comment:15 by Silier, 3 years ago

Keywords: simple added
Note: See TracTickets for help on using tickets.