summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-26 05:22:43 +0200
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-26 05:22:43 +0200
commit459554201bec3a37c4ea7e9b1e5bfbd669436c53 (patch)
tree59c17b5f0f3bc412f4e9ee39e0092f70d1d06b3f
parentchanging port back to default (diff)
downloadcuberite-459554201bec3a37c4ea7e9b1e5bfbd669436c53.tar
cuberite-459554201bec3a37c4ea7e9b1e5bfbd669436c53.tar.gz
cuberite-459554201bec3a37c4ea7e9b1e5bfbd669436c53.tar.bz2
cuberite-459554201bec3a37c4ea7e9b1e5bfbd669436c53.tar.lz
cuberite-459554201bec3a37c4ea7e9b1e5bfbd669436c53.tar.xz
cuberite-459554201bec3a37c4ea7e9b1e5bfbd669436c53.tar.zst
cuberite-459554201bec3a37c4ea7e9b1e5bfbd669436c53.zip
Diffstat (limited to '')
-rw-r--r--source/cClientHandle.cpp73
1 files changed, 70 insertions, 3 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index d2d71a9e5..99b8c040c 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -496,8 +496,75 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
{
if( cRoot::Get()->GetWorld()->DigBlock( PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ, PickupItem ) )
{
- m_Player->GetInventory().GetEquippedItem().m_ItemHealth ++;
- LOG("Health: %i", m_Player->GetInventory().GetEquippedItem().m_ItemHealth);
+ int helditem = m_Player->GetInventory().GetEquippedItem().m_ItemID;
+ bool itemhasdur = false;
+ switch(helditem)
+ {
+ case 256 : itemhasdur = true; break;
+ case 257 : itemhasdur = true; break;
+ case 258 : itemhasdur = true; break;
+ case 267 : itemhasdur = true; break;
+ case 268 : itemhasdur = true; break;
+ case 269 : itemhasdur = true; break;
+ case 270 : itemhasdur = true; break;
+ case 271 : itemhasdur = true; break;
+ case 272 : itemhasdur = true; break;
+ case 273 : itemhasdur = true; break;
+ case 274 : itemhasdur = true; break;
+ case 275 : itemhasdur = true; break;
+ case 276 : itemhasdur = true; break;
+ case 277 : itemhasdur = true; break;
+ case 278 : itemhasdur = true; break;
+ case 279 : itemhasdur = true; break;
+ case 283 : itemhasdur = true; break;
+ case 284 : itemhasdur = true; break;
+ case 285 : itemhasdur = true; break;
+ case 286 : itemhasdur = true; break;
+ case 290 : itemhasdur = true; break;
+ case 291 : itemhasdur = true; break;
+ case 292 : itemhasdur = true; break;
+ case 293 : itemhasdur = true; break;
+ case 294 : itemhasdur = true; break;
+ case 359 : itemhasdur = true; break;
+ }
+ if (itemhasdur) {
+ int maxhelditemdur = 1563;
+ switch(helditem)
+ {
+ case 256 : maxhelditemdur = 251; break;
+ case 257 : maxhelditemdur = 251; break;
+ case 258 : maxhelditemdur = 251; break;
+ case 267 : maxhelditemdur = 251; break;
+ case 268 : maxhelditemdur = 60; break;
+ case 269 : maxhelditemdur = 60; break;
+ case 270 : maxhelditemdur = 60; break;
+ case 271 : maxhelditemdur = 60; break;
+ case 272 : maxhelditemdur = 132; break;
+ case 273 : maxhelditemdur = 132; break;
+ case 274 : maxhelditemdur = 132; break;
+ case 275 : maxhelditemdur = 132; break;
+ case 276 : maxhelditemdur = 1563; break;
+ case 277 : maxhelditemdur = 1563; break;
+ case 278 : maxhelditemdur = 1563; break;
+ case 279 : maxhelditemdur = 1563; break;
+ case 283 : maxhelditemdur = 32; break;
+ case 284 : maxhelditemdur = 32; break;
+ case 285 : maxhelditemdur = 32; break;
+ case 286 : maxhelditemdur = 32; break;
+ case 290 : maxhelditemdur = 60; break;
+ case 291 : maxhelditemdur = 132; break;
+ case 292 : maxhelditemdur = 251; break;
+ case 293 : maxhelditemdur = 1563; break;
+ case 294 : maxhelditemdur = 32; break;
+ case 359 : maxhelditemdur = 251; break;
+ }
+ m_Player->GetInventory().GetEquippedItem().m_ItemHealth ++;
+ LOG("Health: %i", m_Player->GetInventory().GetEquippedItem().m_ItemHealth);
+ if (m_Player->GetInventory().GetEquippedItem().m_ItemHealth >= maxhelditemdur) {
+ LOG("Player %s Broke ID: %i", GetUsername(), m_Player->GetInventory().GetEquippedItem().m_ItemID);
+ m_Player->GetInventory().RemoveItem( m_Player->GetInventory().GetEquippedItem());
+ }
+ }
}
}
}
@@ -1069,4 +1136,4 @@ const char* cClientHandle::GetUsername()
const cSocket & cClientHandle::GetSocket()
{
return m_pState->Socket;
-} \ No newline at end of file
+}