summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemFishingRod.h
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-07-29 22:04:00 +0200
committerarchshift <admin@archshift.com>2014-07-29 22:04:00 +0200
commita9b597087b56b4526a3f6447789ba141568575a1 (patch)
treea08542d77b5668a25ca5e00492577ed6f4d61a9a /src/Items/ItemFishingRod.h
parentSpacing fixes and a few more BLOCK_META constants. (diff)
parentSlight cleanup after portals (diff)
downloadcuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.gz
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.bz2
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.lz
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.xz
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.zst
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.zip
Diffstat (limited to 'src/Items/ItemFishingRod.h')
-rw-r--r--src/Items/ItemFishingRod.h39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h
index 0431b88b7..6350a38ba 100644
--- a/src/Items/ItemFishingRod.h
+++ b/src/Items/ItemFishingRod.h
@@ -17,13 +17,15 @@
-/////////////////////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////////////////
// cFloaterCallback
class cFloaterCallback :
public cEntityCallback
{
public:
- cFloaterCallback(void) :
+ cFloaterCallback(void) :
m_CanPickup(false),
m_AttachedMobID(-1)
{
@@ -49,14 +51,19 @@ protected:
Vector3d m_Pos;
} ;
-////////////////////////////////////////////////////////////////////////////
-// cSweepEntityCallback
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// cSweepEntityCallback:
+
class cSweepEntityCallback :
public cEntityCallback
{
public:
cSweepEntityCallback(Vector3d a_PlayerPos) :
- m_PlayerPos(a_PlayerPos)
+ m_PlayerPos(a_PlayerPos)
{
}
@@ -73,6 +80,8 @@ protected:
+
+
class cItemFishingRodHandler :
public cItemHandler
{
@@ -106,19 +115,19 @@ public:
{
cItems Drops;
int ItemCategory = a_World->GetTickRandomNumber(99);
- if (ItemCategory <= 4) // Treasures 5%
+ if (ItemCategory <= 4) // Treasures 5%
{
int Treasure = a_World->GetTickRandomNumber(5);
switch (Treasure)
{
case 0:
{
- Drops.Add(cItem(E_ITEM_BOW)); // TODO: Enchantments
+ Drops.Add(cItem(E_ITEM_BOW)); // TODO: Enchantments
break;
}
case 1:
{
- Drops.Add(cItem(E_ITEM_BOOK)); // TODO: Enchanted book
+ Drops.Add(cItem(E_ITEM_BOOK)); // TODO: Enchanted book
break;
}
case 2:
@@ -142,6 +151,8 @@ public:
break;
}
}
+
+ a_Player->GetStatManager().AddValue(statTreasureFished, 1);
}
else if (ItemCategory <= 14) // Junk 10%
{
@@ -190,6 +201,8 @@ public:
{
Drops.Add(cItem(E_BLOCK_TRIPWIRE_HOOK));
}
+
+ a_Player->GetStatManager().AddValue(statJunkFished, 1);
}
else // Fish
{
@@ -197,7 +210,7 @@ public:
if (FishType <= 1) // Clownfish has a 2% chance of spawning
{
Drops.Add(cItem(E_ITEM_RAW_FISH, 1, E_META_RAW_FISH_CLOWNFISH));
- }
+ }
else if (FishType <= 12) // Pufferfish has a 13% chance of spawning
{
Drops.Add(cItem(E_ITEM_RAW_FISH, 1, E_META_RAW_FISH_CLOWNFISH));
@@ -210,6 +223,8 @@ public:
{
Drops.Add(cItem(E_ITEM_RAW_FISH, 1, E_META_RAW_FISH_FISH));
}
+
+ a_Player->GetStatManager().AddValue(statFishCaught, 1);
}
if (cRoot::Get()->GetPluginManager()->CallHookPlayerFishing(*a_Player, Drops))
@@ -225,9 +240,13 @@ public:
else
{
cFloater * Floater = new cFloater(a_Player->GetPosX(), a_Player->GetStance(), a_Player->GetPosZ(), a_Player->GetLookVector() * 15, a_Player->GetUniqueID(), 100 + a_World->GetTickRandomNumber(800) - (a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchLure) * 100));
- Floater->Initialize(a_World);
+ Floater->Initialize(*a_World);
a_Player->SetIsFishing(true, Floater->GetUniqueID());
}
return true;
}
} ;
+
+
+
+