mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-28 11:50:53 +00:00
Fixed: #1364 Only transfer bonus item infos when context help string is used for tooltip
This commit is contained in:
parent
1391070537
commit
616519f04e
4 changed files with 45 additions and 27 deletions
|
@ -68,6 +68,8 @@ public:
|
|||
|
||||
/// Get the ContextHelp for this control. Default is to return _ContextHelp
|
||||
virtual void getContextHelp(ucstring &help) const {help= _ContextHelp;}
|
||||
/// Get the ContextHelp for this control, with tooltip specific code. Default behaviour is identical to getContextHelp.
|
||||
virtual void getContextHelpToolTip(ucstring &help) const { getContextHelp(help); }
|
||||
// Get the name of the context help window. Default to "context_help"
|
||||
virtual std::string getContextHelpWindowName() const;
|
||||
/// Get the ContextHelp ActionHandler. If "", noop
|
||||
|
|
|
@ -2975,32 +2975,9 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const
|
|||
}
|
||||
else if(getType() == CCtrlSheetInfo::SheetType_Item)
|
||||
{
|
||||
const CItemSheet *item= asItemSheet();
|
||||
if(item)
|
||||
{
|
||||
if (item->Family == ITEMFAMILY::CRYSTALLIZED_SPELL || item->Family == ITEMFAMILY::JEWELRY || item->Family == ITEMFAMILY::ARMOR)
|
||||
{
|
||||
string luaMethodName = ( (item->Family == ITEMFAMILY::CRYSTALLIZED_SPELL) ? "updateCrystallizedSpellTooltip" : "updateBuffItemTooltip");
|
||||
CDBCtrlSheet *ctrlSheet = const_cast<CDBCtrlSheet*>(this);
|
||||
if ( ! getInventory().isItemInfoUpToDate(getInventory().getItemSlotId(ctrlSheet)))
|
||||
{
|
||||
// Prepare the waiter
|
||||
ControlSheetTooltipUpdater.ItemSheet= ctrlSheet->getSheetId();
|
||||
ControlSheetTooltipUpdater.LuaMethodName = luaMethodName;
|
||||
ControlSheetTooltipUpdater.ItemSlotId= getInventory().getItemSlotId(ctrlSheet);
|
||||
ControlSheetTooltipUpdater.CtrlSheet = ctrlSheet;
|
||||
|
||||
// Add the waiter
|
||||
getInventory().addItemInfoWaiter(&ControlSheetTooltipUpdater);
|
||||
}
|
||||
|
||||
help = ControlSheetTooltipUpdater.infoValidated(ctrlSheet, luaMethodName);
|
||||
|
||||
}
|
||||
else
|
||||
help= getItemActualName();
|
||||
|
||||
}
|
||||
const CItemSheet *item = asItemSheet();
|
||||
if (item)
|
||||
help = getItemActualName();
|
||||
else
|
||||
help= _ContextHelp;
|
||||
}
|
||||
|
@ -3106,6 +3083,42 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const
|
|||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBCtrlSheet::getContextHelpToolTip(ucstring &help) const
|
||||
{
|
||||
// Special case for buff items and spell crystals, only for tooltips
|
||||
if (getType() == CCtrlSheetInfo::SheetType_Item)
|
||||
{
|
||||
const CItemSheet *item = asItemSheet();
|
||||
if (item)
|
||||
{
|
||||
if (item->Family == ITEMFAMILY::CRYSTALLIZED_SPELL
|
||||
|| item->Family == ITEMFAMILY::JEWELRY || item->Family == ITEMFAMILY::ARMOR)
|
||||
{
|
||||
string luaMethodName = (item->Family == ITEMFAMILY::CRYSTALLIZED_SPELL) ? "updateCrystallizedSpellTooltip" : "updateBuffItemTooltip";
|
||||
CDBCtrlSheet *ctrlSheet = const_cast<CDBCtrlSheet*>(this);
|
||||
if ( ! getInventory().isItemInfoUpToDate(getInventory().getItemSlotId(ctrlSheet)))
|
||||
{
|
||||
// Prepare the waiter
|
||||
ControlSheetTooltipUpdater.ItemSheet= ctrlSheet->getSheetId();
|
||||
ControlSheetTooltipUpdater.LuaMethodName = luaMethodName;
|
||||
ControlSheetTooltipUpdater.ItemSlotId= getInventory().getItemSlotId(ctrlSheet);
|
||||
ControlSheetTooltipUpdater.CtrlSheet = ctrlSheet;
|
||||
|
||||
// Add the waiter
|
||||
getInventory().addItemInfoWaiter(&ControlSheetTooltipUpdater);
|
||||
}
|
||||
|
||||
help = ControlSheetTooltipUpdater.infoValidated(ctrlSheet, luaMethodName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default
|
||||
getContextHelp(help);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDBCtrlSheet::canDropItem(CDBCtrlSheet *src) const
|
||||
{
|
||||
|
|
|
@ -355,6 +355,9 @@ public:
|
|||
/// Special ContextHelp for ctrl sheet.
|
||||
virtual void getContextHelp(ucstring &help) const;
|
||||
|
||||
/// Special ContextHelp for ctrl sheet.
|
||||
virtual void getContextHelpToolTip(ucstring &help) const;
|
||||
|
||||
/** true if an item of another ctrlSheet can be dropped on this slot.
|
||||
* also return true if src is 0, or if _ItemSlot==UNDEFINED
|
||||
*/
|
||||
|
|
|
@ -2372,7 +2372,7 @@ void CInterfaceManager::drawContextHelp ()
|
|||
if(newCtrl)
|
||||
{
|
||||
// get the text
|
||||
newCtrl->getContextHelp(_ContextHelpText);
|
||||
newCtrl->getContextHelpToolTip(_ContextHelpText);
|
||||
// UserDefined context help
|
||||
if( !newCtrl->getContextHelpActionHandler().empty() )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue