rodecomp/Source/UI/UILapineScrollBar.cpp
ragnarok-clanker 8ba9c6719a Maintenance: [forced, user-approved] Family F2a (first half of UIWindowContext removal; coordinator-approved bridge split because F2
Batch #10217 by ragnarok-clanker: forced by an admin (236 lower score(s), 885 changed function(s)); checked with 558 compiled unit(s), including every includer of Source/Client/Mode/ModeTooltip.h, Source/Contents/SignBoard/SignBoard.h, Source/UI/Acceptance/UIJoinPartyAcceptWnd.h, Source/UI/AdventureGuide/UIAdventureGuide.h, Source/UI/Buttons/UIBasicButton.h, Source/UI/Buttons/UIBitmapButton.h, Source/UI/Buttons/UIBmpRadioBtn.h, Source/UI/Buttons/UIBmpTextButton.h, Source/UI/Buttons/UIBmpTextButton2.h, Source/UI/Buttons/UIButton.h, Source/UI/Buttons/UICashEmotionSprBtn.h, Source/UI/Buttons/UICheckBox.h, Source/UI/Buttons/UIItemMoveInfo.h, Source/UI/Buttons/UIItemTagButton.h, Source/UI/Buttons/UIJobSlotButton.h, Source/UI/Buttons/UINaviLinkButton.h, Source/UI/Buttons/UINoneVisibleButton.h, Source/UI/Buttons/UIRadioBtn.h, Source/UI/Buttons/UIRadioButton.h, Source/UI/Buttons/UIReplayButton.h, Source/UI/Buttons/UISlotBmpButton.h, Source/UI/Buttons/UISpriteButton.h, Source/UI/Buttons/UITVBitmapButton.h, Source/UI/Buttons/UITVTextButton.h, Source/UI/Buttons/UITagButton.h, Source/UI/Buttons/UITextButton.h, Source/UI/CashEmotion/UICashEmotionPack.h, Source/UI/CashEmotion/UICashEmotionPiece.h, Source/UI/CashShop/UICashShopWnd.h, Source/UI/Chat/UIChatRoomMakeWnd.h, Source/UI/Chat/UIChatRoomTitle.h, Source/UI/Chat/UISubChatHisWnd.h, Source/UI/Chat/UIWhisperWnd.h, Source/UI/Clan/UIClanWnd.h, Source/UI/Dialogs/UIBookWnd.h, Source/UI/Dialogs/UIChooseWarpWnd.h, Source/UI/Dialogs/UIChooseWnd.h, Source/UI/Dialogs/UIDisconnectedServerMsgWnd.h, Source/UI/Dialogs/UIEmailAddressWnd.h, Source/UI/Dialogs/UIGraffiStrboxWnd.h, Source/UI/Dialogs/UILoadingWnd.h, Source/UI/Dialogs/UIMenuWnd.h, Source/UI/Dialogs/UINoticeConfirmWnd.h, Source/UI/Dialogs/UINotifyLevelUpWnd.h, Source/UI/Dialogs/UINotifyQuestWnd.h, Source/UI/Dialogs/UINpcEditDialogWnd.h, Source/UI/Dialogs/UIPasswordWnd.h, Source/UI/Dialogs/UIPetTamingDeceiveWnd.h, Source/UI/Dialogs/UIProhibitListWnd.h, Source/UI/Dialogs/UIQuitWnd.h, Source/UI/Dialogs/UIRestartWnd.h, Source/UI/Dialogs/UISayDialogWnd.h, Source/UI/Dialogs/UISelectCartWnd.h, Source/UI/Dialogs/UITipOfTheDayWnd.h, Source/UI/Dialogs/UITipboxWnd.h, Source/UI/Dialogs/UIToolTipWnd.h, Source/UI/Dialogs/UIWaitDBSaveWnd.h, Source/UI/Dialogs/UIWaitWnd.h, Source/UI/Edit/UICandidateWnd.h, Source/UI/Edit/UIEditBoxEx.h, Source/UI/Edit/UIEditCtrl.h, Source/UI/Edit/UIEditCtrl_Currency.h, Source/UI/Enchant/EnchantUI.h, Source/UI/EntryQueue/UIEntryQueueWnd.h, Source/UI/FrameSkin.h, Source/UI/GameSettings/GameSettingsUI.h, Source/UI/Guild/UIGuild_Storage_Log.h, Source/UI/Item/UIEquipmentPropertiesWnd.h, Source/UI/Item/UIItemBaseWnd.h, Source/UI/Item/UIItemPurchaseWnd.h, Source/UI/Item/UIItemSellWnd.h, Source/UI/Item/UIItemSellWnd2.h, Source/UI/Item/UIItemShopWnd.h, Source/UI/Item/UIItemShopWnd2.h, Source/UI/Item/UIItemStoreFindWnd.h, Source/UI/Item/UIItemStoreSubWnd.h, Source/UI/Item/UIItemStoreWnd.h, Source/UI/Item/UIItemWnd.h, Source/UI/Item/UIMerchantItemLogWnd.h, Source/UI/Items/MergeItemWnd.h, Source/UI/Items/UICardItemIllustWnd.h, Source/UI/Items/UIEquipWnd.h, Source/UI/Items/UIGameItem.h, Source/UI/Items/UIIllustWnd.h, Source/UI/Items/UIItemCollectionWnd.h, Source/UI/Items/UIItemIdentifyWnd.h, Source/UI/Items/UINotifyItemObtainWnd.h, Source/UI/Items/UISpellListWnd.h, Source/UI/Items/UISwapEquipmentWnd.h, Source/UI/Lists/TableBox.h, Source/UI/Lists/UIChatHisBox.h, Source/UI/Lists/UIComboBox.h, Source/UI/Lists/UIComboBoxDefWnd.h, Source/UI/Lists/UIComboBoxEx.h, Source/UI/Lists/UIComboBoxV2Wnd.h, Source/UI/Lists/UIComboBoxWnd.h, Source/UI/Lists/UIDropDownBox.h, Source/UI/Lists/UIItemStoreComboBox.h, Source/UI/Lists/UIListBox.h, Source/UI/Lists/UIListBoxEx.h, Source/UI/Lists/UIListBoxNavi.h, Source/UI/Lists/UIListBoxNaviSearch.h, Source/UI/Lists/UIListBoxTemplate.h, Source/UI/Lists/UIMemberListBox.h, Source/UI/Lists/UIPackageBoxNameList.h, Source/UI/Lists/UIReplayListBox.h, Source/UI/Lists/UIScrollBar.h, Source/UI/Lists/UIScrollBarNavi.h, Source/UI/Lists/UIScrollBarVariants.h, Source/UI/Lists/UITabControl.h, Source/UI/Lists/UIThumb.h, Source/UI/Lists/UITreeView.h, Source/UI/Lists/UIVScrollBar.h, Source/UI/Menu/UIMenuIconWnd.h, Source/UI/Navigation/UINavigationV4Wnd.h, Source/UI/Navigation/UIPrivateAirplaneWnd.h, Source/UI/Party/UIAdvenPartyBoardWnd.h, Source/UI/Party/UIApplyForPartyWnd.h, Source/UI/Party/UIMiniPartyWnd.h, Source/UI/Party/UIPartyInfoWnd.h, Source/UI/Party/UIPartySettingWnd.h, Source/UI/Party/UIRegisterPartyWnd.h, Source/UI/Party/UIRequestJoinPartyWnd.h, Source/UI/Quest/UIOngoingQuestInfo.h, Source/UI/Quest/UIQuestDisplay.h, Source/UI/Quest/UIRecommendedQuestInfo.h, Source/UI/Quest/UIRenewQuestUI.h, Source/UI/Quest/UIRenewQuestWnd.h, Source/UI/Rodex/UIRodexComposeWnd.h, Source/UI/RuneSystem/UIRuneSystemWnd.h, Source/UI/Shop/UIMerchantItemMyShopWnd.h, Source/UI/Shop/UIMerchantItemPurchaseMSGWnd.h, Source/UI/Shop/UIMerchantItemPurchaseWnd.h, Source/UI/Shop/UIMerchantItemShopWnd.h, Source/UI/Shop/UIMerchantItemWnd.h, Source/UI/Shop/UIMerchantMirrorItemWnd.h, Source/UI/Shop/UIMerchantShopTitle.h, Source/UI/Shop/UINoticeMessageBox_LockSellItem.h, Source/UI/Shop/UInCash_CallWnd.h, Source/UI/Shortcuts/UIQuickSlotWnd.h, Source/UI/Skill/UISkillDescribeWnd.h, Source/UI/Skill/UISkillListWnd.h, Source/UI/Skill/UISkillNameChangeWnd.h, Source/UI/SkillDelayInfo/SkillDelayInfo.h, Source/UI/Status/UIStatusWnd.h, Source/UI/StylingShop/UIStylingShopWnd.h, Source/UI/Text/UIAchWnd.h, Source/UI/Text/UIBalloonText.h, Source/UI/Text/UICharInfoBalloonText.h, Source/UI/Text/UINameBalloonText.h, Source/UI/Text/UIStaticText.h, Source/UI/Text/UIStaticTextControl.h, Source/UI/Text/UIStaticText_LF.h, Source/UI/Text/UIString.h, Source/UI/Text/UITagTextViewer.h, Source/UI/Text/UITextViewer.h, Source/UI/Text/UITextViewerControl.h, Source/UI/Text/UITransBalloonText.h, Source/UI/UIBarGraph.h, Source/UI/UIBartermarketWnd.h, Source/UI/UIBasicCtrl.h, Source/UI/UIBroadcastBalloon.h, Source/UI/UICaptchaPreviewWnd.h, Source/UI/UICaptchaRegisterWnd.h, Source/UI/UIChangeMaterialWnd.h, Source/UI/UICheckAttendanceWnd.h, Source/UI/UIGradeEnchantWnd.h, Source/UI/UIHotkeyGuideWnd.h, Source/UI/UIIngredientInfoWnd.h, Source/UI/UIItemReformWnd.h, Source/UI/UILapineScrollBar.h, Source/UI/UILapineUpgradeBoxWnd.h, Source/UI/UIMacroBlackListCheckWnd.h, Source/UI/UIMacroDetectorWnd.h, Source/UI/UIMacroUserInfoWnd.h, Source/UI/UIPreviewEquipWnd.h, Source/UI/UIRefiningWnd.h, Source/UI/UIReputeWnd.h, Source/UI/UIRoundBoxTooltipWnd.h, Source/UI/UIScrollWnd.h, Source/UI/UISlotBitmap.h, Source/UI/UIStaticBitmap.h, Source/UI/UIStaticItem.h, Source/UI/Window/UIAccountLimitedToolWnd.h, Source/UI/Window/UIBalloonOpenBtn.h, Source/UI/Window/UIBank_NewWnd.h, Source/UI/Window/UIBasicInfoWnd.h, Source/UI/Window/UIBattleMsgOptionWnd.h, Source/UI/Window/UIChangeNameWnd.h, Source/UI/Window/UIChatRoomWnd.h, Source/UI/Window/UICntWnd.h, Source/UI/Window/UICollectionSystemWnd.h, Source/UI/Window/UIControl.h, Source/UI/Window/UIDebuffRemoveWnd.h, Source/UI/Window/UIFrameWnd.h, Source/UI/Window/UIHomunInfoWnd.h, Source/UI/Window/UIHotKeyWnd.h, Source/UI/Window/UILoginOTPWnd.h, Source/UI/Window/UILoginWnd.h, Source/UI/Window/UIMakeCharWnd.h, Source/UI/Window/UIMerInfoWnd.h, Source/UI/Window/UIMessageBox.h, Source/UI/Window/UIMessageBoxAutoreturn.h, Source/UI/Window/UIMonsterDisplayWnd.h, Source/UI/Window/UIMonsterInfoWnd.h, Source/UI/Window/UINewMakeCharWnd.h, Source/UI/Window/UINormalMB.h, Source/UI/Window/UINoticeWnd.h, Source/UI/Window/UIPadding.h, Source/UI/Window/UIPayConfirmWnd.h, Source/UI/Window/UIPetInfoWnd.h, Source/UI/Window/UIReplayControlWnd.h, Source/UI/Window/UIReplayRECControlWnd.h, Source/UI/Window/UIResizer.h, Source/UI/Window/UISelectReplayDataWnd.h, Source/UI/Window/UISelectServerWnd.h, Source/UI/Window/UITab.h, Source/UI/Window/UITalkboxTrapInputWnd.h, Source/UI/Window/UIWindow.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWordDisplayWnd.h.
2026-11-03 00:23:34 +00:00

397 lines
14 KiB
C++

#include "Render/Text/FontCache.h"
#include "Render/Text/TextContext.h"
#include "UI/UIIngredientInfoWnd.h"
#include "UI/UILapineScrollBar.h"
#include "Client/Mode/CMode.h"
#include "Client/Mode/ModeDragState.h"
#include "Client/Mode/ModeMgr.h"
#include "Client/Session.h"
#include "Contents/Items/ItemDescription.h"
#include "Contents/MessageTable.h"
#include "Network/Connection/Connection.h"
#include "Network/Packets/PacketId.h"
#include "Network/Packets/PacketLengths.h"
#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/TextureNames.h"
#include "UI/Buttons/UIBitmapButton.h"
#include "UI/Shop/ItemDrawing.h"
#include "Utility/Text/FormatString.h"
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <windows.h>
#include <timeapi.h>
// OFFSET: 0x005FF800
// FUNCTION: fn_04148
void UILapineScrollBarNoop() {}
// OFFSET: 0x005FF810
// FUNCTION: fn_04149
void UIIngredientInfoWnd::Slot10(int argument1, int argument2, std::intptr_t argument3) {
this->parent->Slot10(argument1, argument2, argument3);
}
// OFFSET: 0x005FF910
// FUNCTION: fn_04152
void UIIngredientInfoWnd::Move(int x, int y) {
UIWindow::Move(x, y);
}
// OFFSET: 0x00600270
// FUNCTION: fn_04158
void UILapineScrollBar::Paint() {
const auto load = [](const char* name) {
return static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(name)));
};
this->ClearSurface(0xFFFF00FF);
if (this->maximum == 0) {
return;
}
if (this->vertical == 1) {
CBitmapRes* top = load("유저인터페이스\\lapine\\scrollbar_bg_top.bmp");
CBitmapRes* bottom = load("유저인터페이스\\lapine\\scrollbar_bg_btm.bmp");
CBitmapRes* middle = load("유저인터페이스\\lapine\\scrollbar_bg_mid.bmp");
this->DrawBitmap(0, 0, &top->image, true);
const int interior = this->geometry.height - bottom->image.height - top->image.height;
const int count = interior / middle->image.height + (interior % middle->image.height != 0);
for (int index = 0; index < count; ++index) {
this->DrawBitmap(0, middle->image.height * index + top->image.height, &middle->image, true);
}
this->DrawBitmap(0, this->geometry.height - bottom->image.height, &bottom->image, true);
const int travel = this->geometry.height - bottom->image.height - top->image.height;
const int thumbLength = this->visible * travel / this->total;
const int thumbOffset = this->position * travel / this->total;
const char* thumbTop;
const char* thumbBottom;
const char* thumbMiddle;
if (this->state == 0) {
thumbTop = "유저인터페이스\\lapine\\scrollbar_thumb_out_top.bmp";
thumbBottom = "유저인터페이스\\lapine\\scrollbar_thumb_out_btm.bmp";
thumbMiddle = "유저인터페이스\\lapine\\scrollbar_thumb_out_mid.bmp";
} else if (this->state == 3) {
thumbTop = "유저인터페이스\\lapine\\scrollbar_thumb_over_top.bmp";
thumbBottom = "유저인터페이스\\lapine\\scrollbar_thumb_over_btm.bmp";
thumbMiddle = "유저인터페이스\\lapine\\scrollbar_thumb_over_mid.bmp";
} else if (this->state == 6) {
thumbTop = "유저인터페이스\\lapine\\scrollbar_thumb_press_top.bmp";
thumbBottom = "유저인터페이스\\lapine\\scrollbar_thumb_press_btm.bmp";
thumbMiddle = "유저인터페이스\\lapine\\scrollbar_thumb_press_mid.bmp";
} else {
this->minimumThumb = 0;
this->parent->Invalidate();
return;
}
CBitmapRes* capTop = load(thumbTop);
CBitmapRes* capBottom = load(thumbBottom);
CBitmapRes* fill = load(thumbMiddle);
const int span = thumbLength - capBottom->image.height - capTop->image.height;
const int pieces = span / fill->image.height + (span % fill->image.height != 0);
for (int index = 0; index < pieces; ++index) {
this->DrawBitmap(0, fill->image.height * index + thumbOffset + capTop->image.height + top->image.height, &fill->image, true);
}
this->DrawBitmap(0, top->image.height + thumbOffset, &capTop->image, true);
this->DrawBitmap(0, thumbOffset - capBottom->image.height + thumbLength + top->image.height, &capBottom->image, true);
}
this->minimumThumb = 0;
this->parent->Invalidate();
}
// OFFSET: 0x00600260
// FUNCTION: fn_04157
void UILapineBox_IngredientListWnd::Paint() {
this->ClearSurface(0xFFF7F7);
}
// OFFSET: 0x005FF130
// FUNCTION: fn_45447
UILapineBox_IngredientListWnd::UILapineBox_IngredientListWnd(int width, int height)
: UIScrollWnd(width, height, 0), minRefine(0), maxRefine(20) {
this->Resize(width, height);
this->Slot15(width, height);
}
// OFFSET: 0x005FF820
// FUNCTION: fn_04150
void UILapineBoxWnd::Slot10(int, int, std::intptr_t value) {
CMode* mode = g_modeMgr.GetGameMode();
const ModeDragState* drag = reinterpret_cast<const ModeDragState*>(value);
if (this->items.size() < static_cast<unsigned>(this->maxItems) && drag->source == 27) {
const int result = this->ingredientList->SendMsg(this, 104, drag->id, 0, 0, 0);
if (result >= 0) {
this->AddIngredient(drag->id, drag->quantity);
}
}
mode->SendMsg(18, 0, 0, 0, 0);
}
// OFFSET: 0x005FF8B0
// FUNCTION: fn_04151
void UILapineBox_IngredientListWnd::Slot10(int, int, std::intptr_t value) {
CMode* mode = g_modeMgr.GetGameMode();
const ModeDragState* drag = reinterpret_cast<const ModeDragState*>(value);
if (drag->source == 26) {
if (this->AddIngredient(drag->id) == 1) {
this->parent->SendMsg(this, 104, drag->id, 0, 0, 0);
}
}
mode->SendMsg(18, 0, 0, 0, 0);
}
// OFFSET: 0x005FF920
// FUNCTION: fn_04153
void UILapineBoxWnd::Slot15(int, int) {
UIBitmapButton* base = new UIBitmapButton();
base->SetBitmap("유저인터페이스\\basic_interface\\sys_base_off.bmp", 0, 0);
base->SetBitmap("유저인터페이스\\basic_interface\\sys_base_on.bmp", 1, 0);
base->SetBitmap("유저인터페이스\\basic_interface\\sys_base_on.bmp", 2, 0);
base->SetSize(base->BitmapWidth(), base->BitmapHeight());
base->Move(3, 3);
this->AddChild(base);
this->AddCloseButton("", 0);
UILapineBox_IngredientListWnd* list = new UILapineBox_IngredientListWnd(150, 204);
this->ingredientList = list;
list->Move(241, 17);
this->AddChild(list);
UIBitmapButton* cancel = new UIBitmapButton();
this->cancelButton = cancel;
cancel->SetBitmap("유저인터페이스\\lapine\\btn_cancel_out.bmp", 0, 0);
cancel->SetBitmap("유저인터페이스\\lapine\\btn_cancel_over.bmp", 1, 0);
cancel->SetBitmap("유저인터페이스\\lapine\\btn_cancel_press.bmp", 2, 0);
cancel->SetBitmap("유저인터페이스\\lapine\\btn_cancel_dis.bmp", 3, 0);
cancel->SetSize(cancel->BitmapWidth(), cancel->BitmapHeight());
cancel->Move(280, 226);
cancel->SetId(201);
this->AddChild(cancel);
UIBitmapButton* make = new UIBitmapButton();
this->makeButton = make;
make->SetBitmap("유저인터페이스\\lapine\\btn_make_out.bmp", 0, 0);
make->SetBitmap("유저인터페이스\\lapine\\btn_make_over.bmp", 1, 0);
make->SetBitmap("유저인터페이스\\lapine\\btn_make_press.bmp", 2, 0);
make->SetBitmap("유저인터페이스\\lapine\\btn_make_dis.bmp", 3, 0);
make->SetSize(make->BitmapWidth(), make->BitmapHeight());
make->Move(340, 226);
make->SetId(503);
this->AddChild(make);
UIBitmapButton* move = new UIBitmapButton();
this->moveButton = move;
move->SetBitmap("유저인터페이스\\lapine\\btn_moveitem_out.bmp", 0, 0);
move->SetBitmap("유저인터페이스\\lapine\\btn_moveitem_over.bmp", 1, 0);
move->SetBitmap("유저인터페이스\\lapine\\btn_moveitem_press.bmp", 2, 0);
move->SetBitmap("유저인터페이스\\lapine\\btn_moveitem_dis.bmp", 3, 0);
move->SetSize(move->BitmapWidth(), move->BitmapHeight());
move->Move(213, 110);
move->SetId(505);
this->AddChild(move);
}
// OFFSET: 0x005FFCD0
// FUNCTION: fn_04154
void UILapineBox_IngredientListWnd::Slot15(int width, int height) {
this->scrollBarWidth = 9;
if (this->scrollBar != nullptr) {
this->RemoveChild(this->scrollBar, 0);
if (this->scrollBar != nullptr) {
delete this->scrollBar;
}
this->scrollBar = nullptr;
}
UILapineScrollBar* bar = new UILapineScrollBar();
this->scrollBar = bar;
bar->Configure(width - this->scrollBarWidth, 0, 1, height - this->scrollBarHeight);
this->AddChild(this->scrollBar);
}
// OFFSET: 0x005FFDC0
// FUNCTION: fn_04155
void UIIngredientInfoWnd::Paint() {
this->ClearSurface(0xFFF7F7);
if (this->selected == 1) {
CBitmapRes* selected = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\lapine\\list_selected_item.bmp")));
this->DrawBitmap(32, 0, &selected->image, false);
}
std::string name;
name = this->FitDisplayText(100, this->item.unknown_0044.c_str(), 0, 12, 0).c_str();
std::uint32_t color = 0;
if (this->insufficient == 0) {
DrawItemWithQuantity(*this, ResourceMgr::Instance(), 4, 3, this->item, 0, 0);
} else {
DrawItemWithQuantityAuxiliary(*this, 2, 4, 3, this->item, this->item.identified, 0);
color = 0x969696;
}
this->DrawShadowedText(36, 9, name.c_str(), 0, color, 0xE0E0E0, 0, 12, 0);
}
// OFFSET: 0x005FFF90
// FUNCTION: fn_04156
void UILapineBoxWnd::Paint() {
CBitmapRes* background = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\lapine\\bg_lapine.bmp")));
this->DrawBitmap(0, 0, &background->image, true);
if (this->title.size() != 0) {
this->DrawTitleBar(false, this->title.c_str(), 0);
}
this->DrawCenteredText(33, 47, LookupMessage(2896), 160, 0, 11, 0xCD7A51, 0);
this->DrawCenteredText(33, 63, this->description.c_str(), 160, 0, 11, 0x844A42, 0);
const std::string count = FormatOwnedString("%d", static_cast<int>(this->items.size()));
this->DrawCenteredText(98, 76, count.c_str(), 14, 0, 11, 0xFFFFFF, 0);
const std::string maximum = FormatOwnedString("%d", this->maxItems);
this->DrawCenteredText(115, 76, maximum.c_str(), 14, 0, 11, 0xFFFFFF, 0);
const unsigned total = static_cast<unsigned>(this->items.size());
for (unsigned index = 0; index < total; ++index) {
int x = 0;
int y = 0;
if (static_cast<int>(index) >= 0 && index < total) {
int left = 33;
int top = 162;
if (5 < static_cast<int>(total)) {
left = 25;
top = 152;
}
if (static_cast<int>(index) >= 5) {
left = 42;
top = 183;
}
x = left + static_cast<int>(index % 5) * 34;
y = top;
}
CBitmapRes* slot = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\lapine\\shadow_item_off.bmp")));
this->DrawBitmap(x - 4, y + 11, &slot->image, true);
DrawItemWithQuantity(*this, ResourceMgr::Instance(), x, y, this->items[index], 0, 0);
}
if (timeGetTime() < this->noticeTick + this->noticeDuration) {
CBitmapRes* icon = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\lapine\\icon_notify.bmp")));
this->DrawBitmap(6, 229, &icon->image, true);
this->DrawTextAt(25, 230, this->notice.c_str(), 0, 0, 12, 0xFF0000, 0, 0);
}
}
// OFFSET: 0x00601D20
// FUNCTION: fn_04177
int UILapineBoxWnd::AddIngredient(std::uint32_t id, int quantity) {
if (this->items.size() < 10) {
for (const ITEM_INFO& entry : this->items) {
if (entry.unknown_0000[1] == id) {
return 0;
}
}
ITEM_INFO item = LookupClientItemByIdentity(g_session.m_inventoryItems, id);
item.quantity = quantity;
char name[260];
std::memset(name, 0, sizeof(name));
int capacity = 260;
item.sub_6D5810(name, capacity, 1);
if (item.identified == 1 && item.unknown_0098 != 0) {
char formatted[260];
StringFormat(formatted, sizeof(formatted), sizeof(formatted), LookupMessage(2600), name, item.unknown_0098);
item.SetName(formatted);
} else {
item.SetName(name);
}
this->items.push_back(item);
if (static_cast<int>(this->items.size()) == this->maxItems) {
this->moveButton->SetDisabled(1);
this->moveButton->Invalidate();
}
this->Invalidate();
return 1;
}
return 0;
}
// OFFSET: 0x00602030
// FUNCTION: fn_04178
unsigned char UILapineBox_IngredientListWnd::AddIngredient(std::uint32_t id) {
ITEM_INFO owned = LookupClientItemByIdentity(g_session.m_inventoryItems, id);
if (owned.unknown_0000[1] == 0) {
return 0;
}
const int itemId = std::atoi(owned.itemId.c_str());
if (g_session.IsPetEgg(itemId) == 1 && owned.unknown_005D == 1) {
return 0;
}
if (g_session.HasItem61B8(owned.unknown_0000[1]) == 1) {
return 0;
}
auto it = std::find_if(this->materials.begin(), this->materials.end(), [owned](ITEM_INFO mat) {
return std::atoi(owned.itemId.c_str()) == std::atoi(mat.itemId.c_str());
});
if (it == this->materials.end()) {
return 0;
}
for (UIIngredientInfoWnd* itemWnd : this->items) {
if (itemWnd->item.unknown_0000[1] == id) {
itemWnd->item.quantity += it->quantity;
itemWnd->insufficient = 0;
itemWnd->Show(1);
itemWnd->Invalidate();
this->Invalidate();
return 1;
}
}
UILapineBoxWnd* owner = static_cast<UILapineBoxWnd*>(this->parent);
UIIngredientInfoWnd* info = new UIIngredientInfoWnd();
info->SetSize(136, 30);
info->sub_6028C0(id);
info->quantity = it->quantity;
this->AddScrollChild(info);
if (owned.quantity < it->quantity) {
info->insufficient = 1;
}
if (this->minRefine > owned.unknown_0060 || this->maxRefine < owned.unknown_0060) {
info->insufficient = 1;
}
info->Invalidate();
this->items.push_back(info);
this->SendMsg(this, 87, 0, 0, 0, 0);
return 1;
}
// OFFSET: 0x005FF210
// FUNCTION: fn_04141
UILapineScrollBar::UILapineScrollBar() : UIScrollBar() {
this->arrowLength = 0;
}
// OFFSET: 0x005FF370
// FUNCTION: fn_04143
UIIngredientInfoWnd::~UIIngredientInfoWnd() = default;
UILapineBoxWnd::~UILapineBoxWnd() {
this->items.clear();
short packetType = ID_CZ_RANDOM_COMBINE_ITEM_UI_CLOSE;
CRagConnection& connection = GetRagConnection();
connection.Send(reinterpret_cast<const PacketLengths&>(GetRagConnection()).FixedLength(packetType), &packetType);
}