Batch #1675 by ragnarok-clanker: 2 byte-identical, 45 confirmed by peer review. - fn_10839 UIButton::Slot25: logic confirmed by peer review - fn_10852 UIButton::Slot31: logic confirmed by peer review - fn_10868 UIButton::Slot27: logic confirmed by peer review - fn_10930 UIStaticBitmap::SetBitmap: logic confirmed by peer review - fn_10931 UIBitmapButton::SetBitmap: logic confirmed by peer review - fn_11320 UIComboBoxEx2::Slot15: logic confirmed by peer review - fn_11326 UIListBox::Slot15: logic confirmed by peer review - fn_11327 UIListBoxEx::Slot15: logic confirmed by peer review - fn_11381 UIScrollBar::Paint: logic confirmed by peer review - fn_11383 UIScrollBar_Navi::Paint: logic confirmed by peer review - fn_11425 UIScrollBar::Slot25: logic confirmed by peer review - fn_11440 UIScrollBar::Slot31: logic confirmed by peer review - fn_11445 UITextButton::Slot31: logic confirmed by peer review - fn_11468 UIScrollBar::Slot27: logic confirmed by peer review - fn_11471 UITextButton::Slot27: logic confirmed by peer review - fn_11494 UITextButton::Slot33: logic confirmed by peer review - fn_11779 UIFrameWnd::Slot25: logic confirmed by peer review - fn_11781 UIFrameWnd::Slot31: logic confirmed by peer review - fn_11786 UIFrameWnd::Slot27: logic confirmed by peer review - fn_12610 CSession::GetOption: logic confirmed by peer review - fn_12689 ActivateShortcut: logic confirmed by peer review - fn_12711 ShortcutTooltip::Hover: logic confirmed by peer review - fn_12724 ShortcutDetails::Open: logic confirmed by peer review (already on main) - fn_12760 UIShortCutWnd::SendMsg: logic confirmed by peer review - fn_17144 UIWindowMgr::RemoveOrder: logic confirmed by peer review - fn_17158 UIWindowMgr::Capture: byte-identical - fn_17180 UIWindowMgr::BringToFront: logic confirmed by peer review - fn_17192 UIWindowMgr::IsOrderFixed: logic confirmed by peer review - fn_17232 UIWindowMgr::ReleaseCapture: byte-identical - fn_17255 UIWindowMgr::SetCapture: logic confirmed by peer review - fn_20382 CConnection::CConnection: logic confirmed by peer review - fn_20383 CRagConnection::CRagConnection: logic confirmed by peer review - fn_20384 CConnection::~CConnection: logic confirmed by peer review (already on main) - fn_20389 CConnection::Connect: logic confirmed by peer review - fn_20390 CConnection::Close: logic confirmed by peer review - fn_20409 GetRagConnection: logic confirmed by peer review - fn_21406 AutomaticSkills::Complete: logic confirmed by peer review - fn_03927 CCharacterLinkedUserDataMgr::CompleteLoad: logic confirmed by peer review - fn_03933 CCharacterLinkedUserDataMgr::Save: logic confirmed by peer review - fn_03937 CSession::SetOption: logic confirmed by peer review - fn_11073 UIScrollBar::UIScrollBar: logic confirmed by peer review - fn_11102 UIComboBoxEx2::~UIComboBoxEx2: logic confirmed by peer review (already on main) - fn_09150 AutomaticSkills::DisableAll: logic confirmed by peer review - fn_09153 AutomaticSkills::Use: logic confirmed by peer review - fn_10689 UIBitmapButton::~UIBitmapButton: logic confirmed by peer review (already on main) - fn_10795 UIBitmapButton::Paint: logic confirmed by peer review - fn_10817 UIStaticBitmap::Paint: logic confirmed by peer review Reviewed-by: ragnarok-clanker
112 lines
3.3 KiB
C++
112 lines
3.3 KiB
C++
#include "Client/Session.h"
|
|
#include "Contents/Hotkeys/HotkeyInfo.h"
|
|
#include "UI/Shortcuts/ShortcutTooltip.h"
|
|
#include "UI/Buttons/UIButton.h"
|
|
#include "UI/Window/UIWindow.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
namespace {
|
|
// INLINED
|
|
void ToScreen(const UIWindow& window, int& x, int& y) {
|
|
x = (x + window.geometry.x);
|
|
y = (y + window.geometry.y);
|
|
|
|
for (const UIWindow* node = window.parent; node; node = node->parent) {
|
|
x = (x + node->geometry.x);
|
|
y = (y + node->geometry.y);
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00932050
|
|
// FUNCTION: fn_12711
|
|
void ShortcutTooltip::Hover(UIWindow& window, ShortcutGrid& grid, int x, int y, const NormalItemSlot* const* slots, const NormalItemSlot* const* itemSlots) {
|
|
const int column = grid.HitTest(x, y, this->itemSlotActive, this->currentRow);
|
|
if (column != grid.hovered) {
|
|
grid.hovered = column;
|
|
window.Invalidate();
|
|
}
|
|
|
|
if (grid.hovered == -1 || grid.row == -1) {
|
|
return;
|
|
}
|
|
|
|
const int index = (grid.hovered + 9 * grid.row);
|
|
int tooltipX = 29 * ((x - 15) / 29) + 15;
|
|
int tooltipY = -17;
|
|
|
|
if (9 * grid.rows <= index) {
|
|
if (!this->itemSlotActive) {
|
|
return;
|
|
}
|
|
|
|
const NormalItemSlot& slot = *itemSlots[grid.hovered];
|
|
if (slot.itemId == 0) {
|
|
return;
|
|
}
|
|
|
|
ItemInfo item = LookupClientItem(this->inventory, static_cast<int>(slot.itemId), 1);
|
|
if (item.unknown_0000[1] == 0) {
|
|
return;
|
|
}
|
|
|
|
const std::string name = this->naming.DisplayName(item, 0);
|
|
char text[4096];
|
|
_snprintf_s(text, sizeof(text), _TRUNCATE, this->naming.Message(183), name.c_str(), item.unknown_0000[1]);
|
|
ToScreen(window, tooltipX, tooltipY);
|
|
|
|
if (this->services) {
|
|
this->services->Tooltip(text, tooltipX, tooltipY, -1, false, true);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
HotkeyInfo hotkey;
|
|
const int bank = g_session.GetOption(10);
|
|
if (bank == 0) {
|
|
hotkey = GetHotkeyInfo(this->script, 0, index);
|
|
} else if (bank == 1) {
|
|
hotkey = GetHotkeyInfo(this->script, 3, index);
|
|
}
|
|
|
|
std::string shortcut;
|
|
if (!hotkey.description.empty()) {
|
|
shortcut = std::move(hotkey.text);
|
|
}
|
|
|
|
ToScreen(window, tooltipX, tooltipY);
|
|
std::string text;
|
|
const NormalItemSlot& slot = *slots[index];
|
|
|
|
if (slot.itemId == 0) {
|
|
text = shortcut;
|
|
} else if (slot.unknown_0000 != 0) {
|
|
CSkillInfo skill = this->skills.Lookup(slot.itemId);
|
|
if (!skill.MatchesShortcut(&slot)) {
|
|
text = shortcut;
|
|
} else {
|
|
int level = slot.unknown_0005;
|
|
if ((skill.id == 6579 || skill.id == 6580) && skill.level < level) {
|
|
level = skill.level;
|
|
}
|
|
|
|
const int sp = skill.UseSpAmount(this->script, level);
|
|
const int ap = skill.UseApAmount(this->script, level);
|
|
text = SkillTooltip(shortcut.c_str(), skill.DisplayName(this->script), level, sp, ap, SkillUsesPercentSp(static_cast<int>(skill.id)));
|
|
}
|
|
} else {
|
|
ItemInfo item = LookupClientItem(this->inventory, static_cast<int>(slot.itemId), 1);
|
|
if (item.unknown_0000[1] == 0) {
|
|
text = shortcut;
|
|
} else {
|
|
const std::string name = this->naming.DisplayName(item, 0);
|
|
char formatted[4096];
|
|
_snprintf_s(formatted, sizeof(formatted), _TRUNCATE, this->naming.Message(184), shortcut.c_str(), name.c_str(), item.unknown_0000[1]);
|
|
text = formatted;
|
|
}
|
|
}
|
|
|
|
this->services->Tooltip(text.c_str(), tooltipX, tooltipY, -1, false, true);
|
|
}
|