rodecomp/Source/UI/UILapineBoxWnd.cpp
ragnarok-clanker ca690786a0 Maintenance: Name the SlotNN virtuals (all 6 families: skill actions, effects, actors, UI extension classes, UIWindow). 191 slots nam
Batch #14874 by ragnarok-clanker: no function's compiled code changes; checked with 651 compiled unit(s), including every includer of Source/Client/Mode/CGameMode.h, Source/Client/Mode/CLoginMode.h, Source/Client/Mode/CMode.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/GrannyGameActor.h, Source/Contents/Actors/Npc.h, Source/Contents/Actors/Pc.h, Source/Contents/Actors/RenderObject.h, Source/Contents/Camera/Camera.h, Source/Contents/EffectResourceSwitcher.h, Source/Contents/Effects/AMachineEffect.h, Source/Contents/Effects/AcidifiedThrow.h, Source/Contents/Effects/AnimatedEmitterEffect.h, Source/Contents/Effects/AstralStrikeEffect.h, Source/Contents/Effects/AxeBoomerang.h, Source/Contents/Effects/Bash.h, Source/Contents/Effects/BezierArcThrowEffect.h, Source/Contents/Effects/BindTrapEffect.h, Source/Contents/Effects/BlastForge.h, Source/Contents/Effects/CaneOfEvilEyeEffect.h, Source/Contents/Effects/CartCannon.h, Source/Contents/Effects/CellRangeEffect.h, Source/Contents/Effects/ChangeSizeEffect.h, Source/Contents/Effects/CharacterParticleBundle.h, Source/Contents/Effects/ChargingPierceEffect.h, Source/Contents/Effects/CherryBlossomEffect.h, Source/Contents/Effects/ClimaxEffect.h, Source/Contents/Effects/CloudEffect.h, Source/Contents/Effects/CloudKillEffect.h, Source/Contents/Effects/CommonFloorEffect.h, Source/Contents/Effects/Competentia.h, Source/Contents/Effects/CresciveBolt.h, Source/Contents/Effects/EZ2STREffect.h, Source/Contents/Effects/EZ2STREffectEx.h, Source/Contents/Effects/Effect.h, Source/Contents/Effects/ElectricEffect.h, Source/Contents/Effects/EmitterEffect.h, Source/Contents/Effects/EnergyOrbEffect.h, Source/Contents/Effects/EvilLandEffect.h, Source/Contents/Effects/EvilsPawEffect.h, Source/Contents/Effects/FlowerCastingEffect.h, Source/Contents/Effects/FortuneKissEffect.h, Source/Contents/Effects/FriggSongEffect.h, Source/Contents/Effects/FuumaShouakuEffect.h, Source/Contents/Effects/GlassWallEffect.h, Source/Contents/Effects/GravityControlEffect.h, Source/Contents/Effects/HealEffect.h, Source/Contents/Effects/HealSpEffect.h, Source/Contents/Effects/HitLineEffect.h, Source/Contents/Effects/JupitelThunderStormEffect.h, Source/Contents/Effects/Level150Effect.h, Source/Contents/Effects/Level99Effect.h, Source/Contents/Effects/Level99Orb1Effect.h, Source/Contents/Effects/Level99Orb2Effect.h, Source/Contents/Effects/LightSphereEffect.h, Source/Contents/Effects/MagicFloorEffect.h, Source/Contents/Effects/MagnumBreak.h, Source/Contents/Effects/MapChainEffect.h, Source/Contents/Effects/MapMagicZoneEffect.h, Source/Contents/Effects/MappillarEffect.h, Source/Contents/Effects/MonsterSkillEffects.h, Source/Contents/Effects/NyanggrassEffect.h, Source/Contents/Effects/Particle.h, Source/Contents/Effects/PokJukEffect.h, Source/Contents/Effects/PowderingEffect.h, Source/Contents/Effects/RagEffect.h, Source/Contents/Effects/RainbowEffect.h, Source/Contents/Effects/RectUpEffect.h, Source/Contents/Effects/RedLineEffect.h, Source/Contents/Effects/RichManKim.h, Source/Contents/Effects/RotateBgEffect.h, Source/Contents/Effects/RotateItemEffect.h, Source/Contents/Effects/RotateLineEffect.h, Source/Contents/Effects/SaintCastingEffect.h, Source/Contents/Effects/ScatterEffect.h, Source/Contents/Effects/ShadowExceedEffect.h, Source/Contents/Effects/SkillEffects.h, Source/Contents/Effects/SmokeEffect.h, Source/Contents/Effects/SoulCollectEffect.h, Source/Contents/Effects/SoulUnityEffect.h, Source/Contents/Effects/SphereWind2Effect.h, Source/Contents/Effects/SphereWindEffect.h, Source/Contents/Effects/SpriteEffect.h, Source/Contents/Effects/SquareRangeEffect.h, Source/Contents/Effects/StarEffect.h, Source/Contents/Effects/StarEmperorEffect.h, Source/Contents/Effects/StealEffect.h, Source/Contents/Effects/StormCannonEffect.h, Source/Contents/Effects/StormGustEffect.h, Source/Contents/Effects/StormKickEffect.h, Source/Contents/Effects/SunStanceEffect.h, Source/Contents/Effects/TalismanMarkEffect.h, Source/Contents/Effects/TetraBallEffect.h, Source/Contents/Effects/ThrowEffects.h, Source/Contents/Effects/TriangleShotArrow.h, Source/Contents/Effects/ViolentQuakeEffect.h, Source/Contents/Effects/WindEffect.h, Source/Contents/Ground/GroundGeometry.h, Source/Contents/Messenger/MessengerWindows.h, Source/Contents/SignBoard/SignBoard.h, Source/Contents/Skills/SkillInfo.h, Source/Resource/EmblemResource.h, Source/Resource/GifResource.h, Source/Resource/Resource.h, Source/UI/Acceptance/UIAutoMessageWnd.h, Source/UI/Acceptance/UIJoinPartyAcceptWnd.h, Source/UI/AdventureGuide/UIAdventureGuide.h, Source/UI/Buttons/UIBitmapButton2.h, Source/UI/Buttons/UIBmpRadioBtn.h, Source/UI/Buttons/UIButton.h, Source/UI/Buttons/UICashEmotionSprBtn.h, Source/UI/Buttons/UICheckBox.h, Source/UI/Buttons/UIDescriptRace.h, Source/UI/Buttons/UIItemMoveInfo.h, Source/UI/Buttons/UIItemTagButton.h, Source/UI/Buttons/UIJobSlotButton.h, Source/UI/Buttons/UINaviLinkButton.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/Buttons/UITextureButton.h, Source/UI/CashEmotion/UICashEmotionListWnd.h, Source/UI/CashEmotion/UICashEmotionMiniWnd.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/UINewChatWnd.h, Source/UI/Chat/UISubChatHisWnd.h, Source/UI/Chat/UISubChatMiniWnd.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/UIEditctrlWnd.h, Source/UI/Dialogs/UIEmailAddressWnd.h, Source/UI/Dialogs/UIGraffiStrboxWnd.h, Source/UI/Dialogs/UILoadingWnd.h, Source/UI/Dialogs/UIMemorialDunWnd.h, Source/UI/Dialogs/UIMenuWnd.h, Source/UI/Dialogs/UIMiniMapWnd.h, Source/UI/Dialogs/UIMinimapZoomWnd.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/Emotion/UIEmotionWnd.h, Source/UI/Enchant/EnchantUI.h, Source/UI/EntryQueue/UIEntryQueueWnd.h, Source/UI/Exchange/UIExchangeUI.h, Source/UI/FrameSkin.h, Source/UI/GameSettings/GameSettingsUI.h, Source/UI/Gauges/UIPcGage.h, Source/UI/Guild/UIAgitWnd.h, Source/UI/Guild/UIGuildHelperWnd.h, Source/UI/Guild/UIGuildWnd.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/Item/UIParaItemShopWnd.h, Source/UI/Items/MergeItemWnd.h, Source/UI/Items/UICardItemIllustWnd.h, Source/UI/Items/UIEquipWnd.h, Source/UI/Items/UIExchangeWnd.h, Source/UI/Items/UIGameItem.h, Source/UI/Items/UIIllustWnd.h, Source/UI/Items/UIItemCollectionWnd.h, Source/UI/Items/UIItemIdentifyWnd.h, Source/UI/Items/UIItemParamChangeDisplayWnd.h, Source/UI/Items/UIItemRepairWnd.h, Source/UI/Items/UIMakeTargetListWnd.h, Source/UI/Items/UIMakeTargetProcessWnd.h, Source/UI/Items/UIMakeTargetResultWnd.h, Source/UI/Items/UINotifyItemObtainWnd.h, Source/UI/Items/UISwapEquipmentWnd.h, Source/UI/Items/UIWeaponRefineWnd.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/UIImgMenu.h, Source/UI/Lists/UIItemStoreComboBox.h, Source/UI/Lists/UIListBox.h, Source/UI/Lists/UIListBoxEx.h, Source/UI/Lists/UIListBoxID.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/UITabControl.h, Source/UI/Lists/UITagListBox.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/ProbabilityTable/UIProbabilityTable.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/Rodex/UIRodexInboxWnd.h, Source/UI/RuneSystem/UIRuneSystemWindows.h, Source/UI/RuneSystem/UIRuneSystemWnd.h, Source/UI/SelectPackageItemBox/SelectPackageItemBox.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/UIMerchantShopMakeWnd.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/Shortcuts/UIShortCutWnd.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/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/UIMacroReport.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/UIBitmapTab.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/UIEmblemWnd.h, Source/UI/Window/UIEscOptionWnd.h, Source/UI/Window/UIFrameWnd.h, Source/UI/Window/UIHomunInfoWnd.h, Source/UI/Window/UIHotKeyWnd.h, Source/UI/Window/UIJobListWnd.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/UIMileageWnd.h, Source/UI/Window/UIMiniBtnWnd.h, Source/UI/Window/UIMonsterDisplayWnd.h, Source/UI/Window/UIMonsterInfoWnd.h, Source/UI/Window/UINavigationHelpWnd.h, Source/UI/Window/UINavigationWnd.h, Source/UI/Window/UINewMakeCharWnd.h, Source/UI/Window/UINewSelectCharWnd.h, Source/UI/Window/UINewSkillListWnd.h, Source/UI/Window/UINoteWnd.h, Source/UI/Window/UINoticeWnd.h, Source/UI/Window/UIOpenMailBoxWnd.h, Source/UI/Window/UIOpenRoulletteWnd.h, Source/UI/Window/UIPartyBookingHelpWnd.h, Source/UI/Window/UIPetEvolutionWnd.h, Source/UI/Window/UIPetInfoWnd.h, Source/UI/Window/UIRebirthWnd.h, Source/UI/Window/UIReplayControlWnd.h, Source/UI/Window/UIReplayRECControlWnd.h, Source/UI/Window/UIResizer.h, Source/UI/Window/UIRoMapWnd.h, Source/UI/Window/UIRodexContentsWnd.h, Source/UI/Window/UIRoulletteWnd.h, Source/UI/Window/UISecondCostumeWnd.h, Source/UI/Window/UISeekPartyListWnd.h, Source/UI/Window/UISeekPartyMBWnd.h, Source/UI/Window/UISeekPartyWnd.h, Source/UI/Window/UISelCharForUServerWnd.h, Source/UI/Window/UISelectReplayDataWnd.h, Source/UI/Window/UISelectServerWnd.h, Source/UI/Window/UISerachStoreInfoWnd.h, Source/UI/Window/UIShowWarpWnd.h, Source/UI/Window/UITab.h, Source/UI/Window/UITalkboxTrapInputWnd.h, Source/UI/Window/UITransMenuWnd.h, Source/UI/Window/UIVideoWnd.h, Source/UI/Window/UIViewCameraInfoWnd.h, Source/UI/Window/UIWindow.h, Source/UI/Window/UIWordDisplayWnd.h.
2026-11-07 21:38:02 +00:00

599 lines
No EOL
18 KiB
C++

#include "UI/UILapineScrollBar.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/ModeMgr.h"
#include "Client/Session.h"
#include "Contents/Items/ItemDescription.h"
#include "Contents/Items/ItemInfo.h"
#include "Contents/Items/ItemNaming.h"
#include "Contents/MessageTable.h"
#include "Network/Connection/Connection.h"
#include "Network/Packets/PacketId.h"
#include "Script/LuaScript.h"
#include "UI/Buttons/UIBitmapButton.h"
#include "UI/UIIngredientInfoWnd.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/WindowManagerWindows.h"
#include "Utility/Text/FormatString.h"
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <new>
#include <utility>
#include <vector>
#include <windows.h>
#include <timeapi.h>
namespace {
struct RandomCombineItemPacket {
std::int16_t id;
std::int16_t length;
std::int32_t ingredientId;
};
}
// OFFSET: 0x005FEFF0
// FUNCTION: fn_04140
UILapineBoxWnd::UILapineBoxWnd()
: UIFrameWnd(0), cancelButton(nullptr), makeButton(nullptr),
moveButton(nullptr), ingredientList(nullptr), unknown_00C4(0), noticeTick(0), noticeDuration(3000), waiting(0) {
}
// OFFSET: 0x006006D0
// FUNCTION: fn_04160
void UIIngredientInfoWnd::OnLBtnDblClk(int, int) {
if (this->insufficient == 1) {
static_cast<UILapineBox_IngredientListWnd*>(this->parent)->CanUseIngredient(this->item.unknown_0000[1]);
return;
}
const int id = this->item.unknown_0000[1];
if (id == 0) {
return;
}
UILapineBox_IngredientListWnd* list = static_cast<UILapineBox_IngredientListWnd*>(this->parent);
UILapineBoxWnd* box = static_cast<UILapineBoxWnd*>(list->parent);
if (box->items.size() < static_cast<std::size_t>(box->maxItems)) {
if (list->SendMsg(list, 0x68, id, 0, 0, 0) >= 0) {
box->AddIngredient(id, this->quantity);
}
}
}
// OFFSET: 0x00600830
// FUNCTION: fn_04162
void UIIngredientInfoWnd::OnLBtnDown(int x, int y) {
if (this->insufficient != 1 && this->item.unknown_0000[1] > 0) {
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->drag.BeginItem(g_windowMgr, 27, this->item, this->quantity, -1);
}
}
// OFFSET: 0x00600940
// FUNCTION: fn_04164
void UIIngredientInfoWnd::OnLBtnUp(int, int) {
if (this->insufficient != 1) {
this->selected = 1;
this->Invalidate();
if (this->parent) {
this->parent->SendMsg(this, 6, 0, 0, 0, 0);
}
}
}
// OFFSET: 0x00600980
// FUNCTION: fn_04165
void UIIngredientInfoWnd::OnMouseHover(int x, int y) {
this->OnMouseMove(x, y);
if (this->tooltip.size() > 0) {
int tipX = 0;
int tipY = -20;
this->ToScreen(tipX, tipY);
g_modeMgr.gameMode->ShowTooltip(this->tooltip.c_str(), tipX, tipY, -1, 0, 1);
}
}
// OFFSET: 0x00600770
// FUNCTION: fn_04161
void UILapineBoxWnd::OnLBtnDblClk(int x, int y) {
alignas(ITEM_INFO) unsigned char storage[sizeof(ITEM_INFO)];
ITEM_INFO& item = *reinterpret_cast<ITEM_INFO*>(storage);
this->ReadMaterial(&item, x, y);
if (item.unknown_0000[1] != 0) {
if (this->ingredientList->AddIngredient(item.unknown_0000[1]) == 1) {
this->SendMsg(this, 0x68, item.unknown_0000[1], 0, 0, 0);
}
}
item.~ITEM_INFO();
}
// OFFSET: 0x00600870
// FUNCTION: fn_04163
void UILapineBoxWnd::OnLBtnDown(int x, int y) {
if (y < 0x11) {
UIFrameWnd::OnLBtnDown(x, y);
}
alignas(ITEM_INFO) unsigned char storage[sizeof(ITEM_INFO)];
ITEM_INFO& item = *reinterpret_cast<ITEM_INFO*>(storage);
this->ReadMaterial(&item, x, y);
if (item.unknown_0000[1] != 0) {
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->drag.BeginItem(g_windowMgr, 0x1A, item, item.quantity, -1);
}
item.~ITEM_INFO();
}
// OFFSET: 0x006009F0
// FUNCTION: fn_04166
void UILapineBoxWnd::OnMouseHover(int x, int y) {
this->OnMouseMove(x, y);
alignas(ITEM_INFO) unsigned char storage[sizeof(ITEM_INFO)];
ITEM_INFO& item = *reinterpret_cast<ITEM_INFO*>(storage);
this->ReadMaterial(&item, x, y);
if (item.unknown_0000[1] != 0) {
int tipX = 0;
int tipY = -20;
const int count = static_cast<int>(this->items.size());
for (int index = 0; index < count; ++index) {
if (this->items[index].unknown_0000[1] == item.unknown_0000[1]) {
int position[2] = {0, 0};
this->MaterialPosition(position, index);
tipX = position[0];
tipY = position[1] - 0x14;
break;
}
}
this->ToScreen(tipX, tipY);
g_modeMgr.gameMode->ShowTooltip(item.unknown_0044.c_str(), tipX, tipY, -1, 0, 1);
}
item.~ITEM_INFO();
}
// OFFSET: 0x00600B60
// FUNCTION: fn_04167
void UILapineBoxWnd::OnProcess() {
if (this->waiting == 0) {
const int count = static_cast<int>(this->items.size());
if (this->maxItems == count) {
if (this->makeButton->Disabled() == 1) {
auto* const button = this->makeButton;
button->SetDisabled(0);
button->Invalidate();
this->Invalidate();
}
} else if (this->makeButton->Disabled() == 0) {
auto* const button = this->makeButton;
button->SetDisabled(1);
button->Invalidate();
this->Invalidate();
}
}
if (this->noticeTick + this->noticeDuration < timeGetTime()) {
this->notice = "";
}
}
// OFFSET: 0x00600C00
// FUNCTION: fn_04168
void UIIngredientInfoWnd::OnRBtnDown(int, int) {
if (this->item.unknown_0000[1] > 0) {
UIWindow* window = g_windowMgr.EnsureWindow(12);
window->SendMsg(this, 0x18, reinterpret_cast<std::intptr_t>(&this->item), 0, 0, 0);
}
}
// OFFSET: 0x006024F0
// FUNCTION: fn_04181
__declspec(noinline) void UILapineBoxWnd::MaterialPosition(int* out, int index) {
if (index >= 0) {
const unsigned int count = this->items.size();
if (static_cast<unsigned int>(index) <= count) {
int left = count > 5 ? 0x19 : 0x21;
int top = count > 5 ? 0x98 : 0xA2;
if (index >= 5) {
left = 0x2A;
top = 0xB7;
}
out[1] = top;
out[0] = left + static_cast<unsigned int>(index) % 5 * 0x22;
return;
}
}
out[0] = 0;
out[1] = 0;
}
// OFFSET: 0x00602410
// FUNCTION: fn_04180
__declspec(noinline) void UILapineBoxWnd::ReadMaterial(ITEM_INFO* out, int x, int y) {
const unsigned int count = this->items.size();
for (unsigned int index = 0; index < count; ++index) {
int position[2];
this->MaterialPosition(position, index);
if (x >= position[0] && x <= position[0] + 0x18 && y >= position[1] && y <= position[1] + 0x18) {
new (out) ITEM_INFO(this->items[index]);
return;
}
}
new (out) ITEM_INFO(0);
}
// OFFSET: 0x00602620
// FUNCTION: fn_04182
bool UILapineBox_IngredientListWnd::CanUseIngredient(std::uint32_t identity) {
std::vector<UIIngredientInfoWnd*>::iterator entryIt;
for (entryIt = this->items.begin(); entryIt != this->items.end(); ++entryIt) {
if ((*entryIt)->item.unknown_0000[1] == identity) {
break;
}
}
if (entryIt == this->items.end()) {
return false;
}
const ITEM_INFO& item = (*entryIt)->item;
std::vector<ITEM_INFO>::iterator material;
const std::vector<ITEM_INFO>::iterator end = this->materials.end();
for (material = this->materials.begin(); material != end; ++material) {
ITEM_INFO copy(*material);
if (std::atoi(item.itemId.c_str()) == std::atoi(copy.itemId.c_str())) {
break;
}
}
if (material == this->materials.end()) {
return false;
}
const int required = material->quantity;
if (required > item.quantity) {
this->parent->SendMsg(this, 0x6F, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(0xB52), required).c_str()), 0, 0, 0);
return false;
}
if (this->minRefine > item.unknown_0060) {
this->parent->SendMsg(this, 0x6F, reinterpret_cast<std::intptr_t>(LookupMessage(0xB53)), 0, 0, 0);
return false;
}
if (this->maxRefine < item.unknown_0060) {
this->parent->SendMsg(this, 0x6F, reinterpret_cast<std::intptr_t>(LookupMessage(0xE3C)), 0, 0, 0);
return false;
}
if (this->minRefine != 0 && this->minRefine < item.unknown_0060) {
this->parent->SendMsg(this, 0x6F, reinterpret_cast<std::intptr_t>(LookupMessage(0xE3D)), 0, 0, 0);
}
if (Equipment(item) && !item.IsApprenticeItem() && !item.HasSpecialCard()) {
const int* cards = reinterpret_cast<const int*>(item.unknown_001C);
for (int index = 0; index < ItemSlotsCount(item); ++index) {
if (index < 4 && cards[index] > 0) {
this->parent->SendMsg(this, 0x6F, reinterpret_cast<std::intptr_t>(LookupMessage(0xE3E)), 0, 0, 0);
return true;
}
}
}
return true;
}
// OFFSET: 0x00602AC0
// FUNCTION: fn_04184
void UILapineBoxWnd::SetWaiting(unsigned char waiting) {
UIBitmapButton* button = this->makeButton;
this->waiting = waiting;
button->SetDisabled(waiting);
button->Invalidate();
this->Invalidate();
}
// OFFSET: 0x00600C40
// FUNCTION: fn_04169
void UILapineBoxWnd::OnRBtnDown(int x, int y) {
alignas(ITEM_INFO) unsigned char storage[sizeof(ITEM_INFO)];
ITEM_INFO& item = *reinterpret_cast<ITEM_INFO*>(storage);
this->ReadMaterial(&item, x, y);
if (static_cast<unsigned>(item.unknown_0000[1]) > 0) {
UIWindow* window = g_windowMgr.EnsureWindow(12);
window->SendMsg(nullptr, 0x18, reinterpret_cast<std::intptr_t>(&item), 0, 0, 0);
}
item.~ITEM_INFO();
}
// OFFSET: 0x00600D00
// FUNCTION: fn_04170
void UIIngredientInfoWnd::OnWheel(int argument) {
if (this->parent) {
this->parent->OnWheel(argument);
}
}
// OFFSET: 0x00600D20
// FUNCTION: fn_04171
void UILapineBox_IngredientListWnd::OnWheel(int argument) {
if (this->wheelScroll == 1) {
if (argument < 0) {
this->SendMsg(this->scrollBar, 7, 15, 0, 0, 0);
} else {
this->SendMsg(this->scrollBar, 7, -15, 0, 0, 0);
}
}
}
// OFFSET: 0x00600D60
// FUNCTION: fn_04172
int UILapineBoxWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
switch (message) {
case 6:
switch (a) {
case 0xC9:
g_windowMgr.CloseWindow(0x122);
break;
case 0x1F7: {
RandomCombineItemPacket* packet = new (std::nothrow) RandomCombineItemPacket;
packet->id = ID_CZ_REQ_RANDOM_COMBINE_ITEM;
const std::int16_t materialsLength = static_cast<std::int16_t>(this->items.size() * 4);
packet->length = materialsLength + 8;
packet->ingredientId = this->unknown_00C4;
char* payload = new (std::nothrow) char[materialsLength + 8];
memcpy_s(payload, packet->length, packet, 8);
for (std::size_t index = 0; index < this->items.size(); ++index) {
const ITEM_INFO& item = this->items[index];
const std::uint16_t material[2] = {static_cast<std::uint16_t>(item.unknown_0000[1]), static_cast<std::uint16_t>(item.quantity)};
memcpy_s(payload + 8 + index * 4, packet->length, material, sizeof(material));
}
GetRagConnection().Send(packet->length, payload);
this->waiting = 1;
this->makeButton->SetDisabled(1);
this->makeButton->Invalidate();
this->Invalidate();
delete packet;
delete[] payload;
break;
}
case 0x1F9: {
const std::vector<UIIngredientInfoWnd*>& entries = this->ingredientList->items;
const auto selected = std::find_if(entries.begin(), entries.end(), [](UIIngredientInfoWnd* entry) {
return entry->selected == 1;
});
if (selected != entries.end()) {
UIIngredientInfoWnd* entry = *selected;
if (entry != nullptr && entry->insufficient != 1 && this->ingredientList->SendMsg(this, 0x68, entry->item.unknown_0000[1], 0, 0, 0) >= 0) {
this->AddIngredient(entry->item.unknown_0000[1], entry->quantity);
}
}
break;
}
}
break;
case 0x68: {
const auto found = std::find_if(this->items.begin(), this->items.end(), [a](ITEM_INFO item) { return a == item.unknown_0000[1]; });
if (found != this->items.end()) {
this->items.erase(found);
if (this->items.size() < static_cast<std::size_t>(this->maxItems)) {
this->moveButton->SetDisabled(0);
this->moveButton->Invalidate();
}
this->Invalidate();
}
break;
}
case 0x6F:
this->noticeTick = timeGetTime();
this->notice = reinterpret_cast<const char*>(a);
this->Invalidate();
break;
default:
return UIFrameWnd::SendMsg(sender, message, a, b, c, d);
}
return 0;
}
// OFFSET: 0x006011E0
// FUNCTION: fn_04173
int UILapineBox_IngredientListWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c,
std::intptr_t d) {
switch (message) {
case 0x17:
for (std::vector<ITEM_INFO>::iterator material = this->materials.begin(); material != this->materials.end(); ++material) {
std::vector<int> ids = g_session.FindInventoryIndicesByItemId(std::atoi(material->itemId.c_str()), 1);
for (std::vector<int>::iterator id = ids.begin(); id != ids.end(); ++id) {
this->AddIngredient(*id);
}
}
for (std::vector<UIIngredientInfoWnd*>::iterator it = this->items.begin(); it != this->items.end(); ++it) {
ITEM_INFO owned = LookupClientItemByIdentity(g_session.m_inventoryItems, (*it)->item.unknown_0000[1]);
if (owned.unknown_0000[1] == 0) {
(*it)->Show(0);
}
}
this->SendMsg(this, 0x57, 0, 0, 0, 0);
break;
case 6:
for (std::vector<UIIngredientInfoWnd*>::iterator it = this->items.begin(); it != this->items.end(); ++it) {
UIIngredientInfoWnd* entry = *it;
if (sender != entry) {
entry->selected = 0;
entry->Invalidate();
}
}
this->Invalidate();
break;
case 0x68: {
std::vector<UIIngredientInfoWnd*>::iterator it;
for (it = this->items.begin(); it != this->items.end(); ++it) {
if (static_cast<std::uint32_t>(a) == (*it)->item.unknown_0000[1]) {
break;
}
}
if (it == this->items.end()) {
break;
}
UIIngredientInfoWnd* selected = *it;
std::vector<ITEM_INFO>::iterator found = this->materials.begin();
const std::vector<ITEM_INFO>::iterator end = this->materials.end();
for (; found != end; ++found) {
ITEM_INFO copy(*found);
if (std::atoi(selected->item.itemId.c_str()) == std::atoi(copy.itemId.c_str())) {
break;
}
}
if (found == this->materials.end()) {
break;
}
const int need = found->quantity;
if (selected->item.quantity < need) {
this->parent->SendMsg(this, 0x6F, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(0xB52), need).c_str()), 0, 0, 0);
return -1;
}
if (selected->item.unknown_0060 < found->unknown_0060) {
this->parent->SendMsg(this, 0x6F, reinterpret_cast<std::intptr_t>(LookupMessage(0xB53)), 0, 0, 0);
return -1;
}
selected->item.quantity -= need;
if (selected->item.quantity <= 0) {
(*it)->Show(0);
} else {
(*it)->insufficient = 1;
(*it)->Invalidate();
}
this->SendMsg(this, 0x57, 0, 0, 0, 0);
break;
}
case 0x57: {
int y = 7;
for (std::vector<UIIngredientInfoWnd*>::iterator it = this->items.begin(); it != this->items.end();) {
UIIngredientInfoWnd* entry = *it;
if (entry->geometry.visible == 0) {
entry->Invalidate();
it = this->items.erase(it);
} else {
this->MoveScrollChild(entry, 0, y);
(*it)->Invalidate();
++it;
y += 0x1E;
}
}
this->UpdateScrollRange();
this->Invalidate();
break;
}
default:
break;
}
return UIScrollWnd::SendMsg(sender, message, a, b, c, d);
}
// OFFSET: 0x006016C0
// FUNCTION: fn_04174
void UILapineBoxWnd::SetIngredient(int id) {
this->unknown_00C4 = id;
{
ITEM_INFO item;
item.SetItemId(id);
char name[0x104];
std::memset(name, 0, sizeof(name));
int capacity = 0x104;
item.GetIdDisplayName(name, capacity, 0);
this->title.assign(name, std::strlen(name));
}
g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "set_resource_item_list", "d", id);
int minRefine = 0;
g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "get_min_need_refine", "d>d", id, &minRefine);
this->ingredientList->minRefine = minRefine;
int maxRefine = 0;
g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "get_max_need_refine", "d>d", id, &maxRefine);
this->ingredientList->maxRefine = maxRefine;
this->ingredientList->SendMsg(this, 0x17, 0, 0, 0, 0);
g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "get_need_item_count", "d>d", id, &this->maxItems);
const char* source = nullptr;
g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "get_need_source_string", "d>s", id, &source);
this->description.assign(source, std::strlen(source));
}
// OFFSET: 0x00601BC0
// FUNCTION: fn_04176
void UILapineBoxWnd::AddMaterial(int id, int quantity) {
std::vector<ITEM_INFO>& materials = this->ingredientList->materials;
std::vector<ITEM_INFO>::iterator it;
const std::vector<ITEM_INFO>::iterator end = materials.end();
for (it = materials.begin(); it != end; ++it) {
ITEM_INFO copy(*it);
if (std::atoi(copy.itemId.c_str()) == id) {
break;
}
}
if (it == end) {
ITEM_INFO material;
material.SetItemId(id);
material.quantity = quantity;
materials.push_back(material);
}
}
// OFFSET: 0x006028C0
// FUNCTION: fn_04183
void UIIngredientInfoWnd::SetIngredientItem(std::uint32_t id) {
this->item = LookupClientItemByIdentity(g_session.m_inventoryItems, id);
std::vector<char*> breaks;
char name[260];
std::memset(name, 0, sizeof(name));
char* highlight = nullptr;
std::size_t remaining = sizeof(name);
char* cursor = name;
int highlightColor;
this->BuildItemName(&this->item, &highlightColor, &breaks, &cursor, &remaining, &highlight, 1, 0);
if (this->item.identified == 1) {
const int count = this->item.unknown_0098;
if (count != 0) {
sprintf_s(name, sizeof(name), LookupMessage(2600), name, count);
}
}
this->item.SetName(name);
this->tooltip = name;
this->Invalidate();
}