2015-03-10 14:40:53 -04:00
|
|
|
|
|
|
|
// EnchantingWindow.cpp
|
|
|
|
|
|
|
|
// Representing the UI window for the enchanting block
|
|
|
|
|
|
|
|
#include "Globals.h"
|
|
|
|
#include "EnchantingWindow.h"
|
|
|
|
#include "SlotArea.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-17 10:16:20 -04:00
|
|
|
cEnchantingWindow::cEnchantingWindow(Vector3i a_BlockPos, const AString & a_Title) :
|
|
|
|
cWindow(wtEnchantment, a_Title),
|
2015-03-10 14:40:53 -04:00
|
|
|
m_SlotArea(),
|
2020-07-04 17:49:17 -04:00
|
|
|
m_BlockPos(a_BlockPos)
|
2015-03-10 14:40:53 -04:00
|
|
|
{
|
2020-07-04 17:49:17 -04:00
|
|
|
m_SlotArea = new cSlotAreaEnchanting(*this, m_BlockPos);
|
2015-03-10 14:40:53 -04:00
|
|
|
m_SlotAreas.push_back(m_SlotArea);
|
|
|
|
m_SlotAreas.push_back(new cSlotAreaInventory(*this));
|
|
|
|
m_SlotAreas.push_back(new cSlotAreaHotBar(*this));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 09:22:17 -04:00
|
|
|
void cEnchantingWindow::SetProperty(size_t a_Property, short a_Value)
|
2015-03-10 14:40:53 -04:00
|
|
|
{
|
2020-10-02 09:22:17 -04:00
|
|
|
if (a_Property < m_PropertyValue.size())
|
2015-03-10 14:40:53 -04:00
|
|
|
{
|
2020-10-01 17:33:32 -04:00
|
|
|
m_PropertyValue[a_Property] = a_Value;
|
2015-03-10 14:40:53 -04:00
|
|
|
}
|
|
|
|
|
2020-04-13 12:38:06 -04:00
|
|
|
Super::SetProperty(a_Property, a_Value);
|
2015-03-10 14:40:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 09:22:17 -04:00
|
|
|
short cEnchantingWindow::GetProperty(size_t a_Property)
|
2015-03-10 14:40:53 -04:00
|
|
|
{
|
2020-10-02 09:22:17 -04:00
|
|
|
ASSERT(a_Property < m_PropertyValue.size());
|
2015-03-10 14:40:53 -04:00
|
|
|
return m_PropertyValue[a_Property];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cEnchantingWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply)
|
|
|
|
{
|
|
|
|
cSlotAreas AreasInOrder;
|
|
|
|
|
|
|
|
if (a_ClickedArea == m_SlotAreas[0])
|
|
|
|
{
|
|
|
|
// Enchanting Area
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */
|
2020-04-13 12:38:06 -04:00
|
|
|
Super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, true);
|
2015-03-10 14:40:53 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Inventory or Hotbar
|
|
|
|
AreasInOrder.push_back(m_SlotAreas[0]); /* Enchanting */
|
2020-04-13 12:38:06 -04:00
|
|
|
Super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, false);
|
2015-03-10 14:40:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|