summaryrefslogtreecommitdiffstats
path: root/src/UI/SlotArea.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-18 22:30:34 +0200
committerMattes D <github@xoft.cz>2014-05-18 22:30:34 +0200
commitac005681839134018f0162cfb8cb1453e11cbb46 (patch)
tree41cc966732262c0a8f5441932b758344856d6259 /src/UI/SlotArea.cpp
parentMerge pull request #1005 from SphinxC0re/LoadPluginfolder (diff)
parentFixes (diff)
downloadcuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.gz
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.bz2
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.lz
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.xz
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.tar.zst
cuberite-ac005681839134018f0162cfb8cb1453e11cbb46.zip
Diffstat (limited to 'src/UI/SlotArea.cpp')
-rw-r--r--src/UI/SlotArea.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 8833a767a..507b45833 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -496,6 +496,8 @@ void cSlotAreaCrafting::ClickedResult(cPlayer & a_Player)
DraggingItem = Result;
Recipe.ConsumeIngredients(Grid);
Grid.CopyToItems(PlayerSlots);
+
+ HandleCraftItem(Result, a_Player);
}
else if (DraggingItem.IsEqual(Result))
{
@@ -505,6 +507,8 @@ void cSlotAreaCrafting::ClickedResult(cPlayer & a_Player)
DraggingItem.m_ItemCount += Result.m_ItemCount;
Recipe.ConsumeIngredients(Grid);
Grid.CopyToItems(PlayerSlots);
+
+ HandleCraftItem(Result, a_Player);
}
}
@@ -594,6 +598,27 @@ cCraftingRecipe & cSlotAreaCrafting::GetRecipeForPlayer(cPlayer & a_Player)
+void cSlotAreaCrafting::HandleCraftItem(const cItem & a_Result, cPlayer & a_Player)
+{
+ switch (a_Result.m_ItemType)
+ {
+ case E_BLOCK_WORKBENCH: a_Player.AwardAchievement(achCraftWorkbench); break;
+ case E_BLOCK_FURNACE: a_Player.AwardAchievement(achCraftFurnace); break;
+ case E_BLOCK_CAKE: a_Player.AwardAchievement(achBakeCake); break;
+ case E_BLOCK_ENCHANTMENT_TABLE: a_Player.AwardAchievement(achCraftEnchantTable); break;
+ case E_BLOCK_BOOKCASE: a_Player.AwardAchievement(achBookshelf); break;
+ case E_ITEM_WOODEN_PICKAXE: a_Player.AwardAchievement(achCraftPickaxe); break;
+ case E_ITEM_WOODEN_SWORD: a_Player.AwardAchievement(achCraftSword); break;
+ case E_ITEM_STONE_PICKAXE: a_Player.AwardAchievement(achCraftBetterPick); break;
+ case E_ITEM_WOODEN_HOE: a_Player.AwardAchievement(achCraftHoe); break;
+ case E_ITEM_BREAD: a_Player.AwardAchievement(achMakeBread); break;
+ default: break;
+ }
+}
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cSlotAreaAnvil:
@@ -1393,7 +1418,7 @@ void cSlotAreaFurnace::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
{
// Something has changed in the window, broadcast the entire window to all clients
ASSERT(a_ItemGrid == &(m_Furnace->GetContents()));
-
+
m_ParentWindow.BroadcastWholeWindow();
}
@@ -1401,6 +1426,21 @@ void cSlotAreaFurnace::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
+void cSlotAreaFurnace::HandleSmeltItem(const cItem & a_Result, cPlayer & a_Player)
+{
+ /** TODO 2014-05-12 xdot: Figure out when to call this method. */
+ switch (a_Result.m_ItemType)
+ {
+ case E_ITEM_IRON: a_Player.AwardAchievement(achAcquireIron); break;
+ case E_ITEM_COOKED_FISH: a_Player.AwardAchievement(achCookFish); break;
+ default: break;
+ }
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cSlotAreaInventoryBase: