| 22 | namespace Star { |
| 23 | |
| 24 | PanePtr ItemTooltipBuilder::buildItemTooltip(ItemPtr const& item, PlayerPtr const& viewer) { |
| 25 | if (!item) { |
| 26 | return {}; |
| 27 | } else { |
| 28 | PanePtr tooltip = make_shared<Pane>(); |
| 29 | tooltip->removeAllChildren(); |
| 30 | |
| 31 | String title; |
| 32 | String subTitle; |
| 33 | |
| 34 | String tooltipKind = item->tooltipKind(); |
| 35 | |
| 36 | if (tooltipKind.empty()) |
| 37 | tooltipKind = "base"; |
| 38 | if (!tooltipKind.endsWith(".tooltip")) |
| 39 | tooltipKind = "/interface/tooltips/" + tooltipKind + ".tooltip"; |
| 40 | |
| 41 | buildItemDescriptionInner(tooltip, item, tooltipKind, title, subTitle, viewer); |
| 42 | |
| 43 | auto titleIcon = make_shared<ItemSlotWidget>(item, "/interface/inventory/portrait.png"); |
| 44 | titleIcon->setBackingImageAffinity(true, true); |
| 45 | titleIcon->showRarity(false); |
| 46 | tooltip->setTitle(titleIcon, title, subTitle); |
| 47 | |
| 48 | return tooltip; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | void ItemTooltipBuilder::buildItemDescription(WidgetPtr const& container, ItemPtr const& item) { |
| 53 | String tooltipKind = item->tooltipKind(); |
nothing calls this directly
no test coverage detected