diff options
Diffstat (limited to '')
-rw-r--r-- | source/Bindings.cpp | 2 | ||||
-rw-r--r-- | source/Bindings.h | 2 | ||||
-rw-r--r-- | source/ClientHandle.cpp | 7 | ||||
-rw-r--r-- | source/ClientHandle.h | 2 | ||||
-rw-r--r-- | source/Entities/Player.cpp | 19 | ||||
-rw-r--r-- | source/Entities/Player.h | 2 | ||||
-rw-r--r-- | source/Protocol/Protocol.h | 2 | ||||
-rw-r--r-- | source/Protocol/Protocol125.cpp | 2 | ||||
-rw-r--r-- | source/Protocol/Protocol125.h | 2 | ||||
-rw-r--r-- | source/Protocol/Protocol17x.cpp | 2 | ||||
-rw-r--r-- | source/Protocol/Protocol17x.h | 2 | ||||
-rw-r--r-- | source/Protocol/ProtocolRecognizer.cpp | 4 | ||||
-rw-r--r-- | source/Protocol/ProtocolRecognizer.h | 2 |
13 files changed, 34 insertions, 16 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp index a2dcc58c6..be0bbd8af 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/15/13 10:14:19. +** Generated automatically by tolua++-1.0.92 on 11/16/13 02:20:34. */ #ifndef __cplusplus diff --git a/source/Bindings.h b/source/Bindings.h index 13f398a4d..42c158096 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/15/13 10:14:20. +** Generated automatically by tolua++-1.0.92 on 11/16/13 02:20:35. */ /* Exported function */ diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp index 73852b886..daf09d4ea 100644 --- a/source/ClientHandle.cpp +++ b/source/ClientHandle.cpp @@ -260,6 +260,9 @@ void cClientHandle::Authenticate(void) // Send health m_Player->SendHealth(); + + // Send experience + m_Player->SendExperience(); // Send gamemode (1.6.1 movementSpeed): SendGameMode(m_Player->GetGameMode()); @@ -1873,9 +1876,9 @@ void cClientHandle::SendRespawn(void) -void cClientHandle::SendSetExperience(void) +void cClientHandle::SendExperience(void) { - m_Protocol->SendSetExperience(); + m_Protocol->SendExperience(); } diff --git a/source/ClientHandle.h b/source/ClientHandle.h index 4b37d39b5..d3e257aee 100644 --- a/source/ClientHandle.h +++ b/source/ClientHandle.h @@ -120,7 +120,7 @@ public: void SendPlayerPosition (void); void SendPlayerSpawn (const cPlayer & a_Player); void SendRespawn (void); - void SendSetExperience (void); + void SendExperience (void); void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch); // a_Src coords are Block * 8 void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data); void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock); diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp index 00c2ea76c..651a0b2a6 100644 --- a/source/Entities/Player.cpp +++ b/source/Entities/Player.cpp @@ -339,7 +339,7 @@ bool cPlayer::SetExperience(short int a_XpTotal) m_XpTotal = a_XpTotal; //send details to client - m_ClientHandle->SendSetExperience(); + SendExperience(); return true; } @@ -363,7 +363,7 @@ short cPlayer::AddExperience(short a_Xp_delta) m_XpTotal += a_Xp_delta; //send details to client - m_ClientHandle->SendSetExperience(); + SendExperience(); return m_XpTotal; } @@ -615,6 +615,18 @@ void cPlayer::SendHealth(void) +void cPlayer::SendExperience(void) +{ + if (m_ClientHandle != NULL) + { + m_ClientHandle->SendExperience(); + } +} + + + + + void cPlayer::ClearInventoryPaintSlots(void) { // Clear the list of slots that are being inventory-painted. Used by cWindow only @@ -1419,12 +1431,13 @@ bool cPlayer::LoadFromDisk() SetRoll ((float)JSON_PlayerRotation[(unsigned int)2].asDouble()); } - m_Health = root.get("health", 0).asInt(); + m_Health = root.get("health", 0).asInt(); m_AirLevel = root.get("air", MAX_AIR_LEVEL).asInt(); m_FoodLevel = root.get("food", MAX_FOOD_LEVEL).asInt(); m_FoodSaturationLevel = root.get("foodSaturation", MAX_FOOD_LEVEL).asDouble(); m_FoodTickTimer = root.get("foodTickTimer", 0).asInt(); m_FoodExhaustionLevel = root.get("foodExhaustion", 0).asDouble(); + m_XpTotal = root.get("experience", 0).asInt(); //SetExperience(root.get("experience", 0).asInt()); diff --git a/source/Entities/Player.h b/source/Entities/Player.h index 1e43dd954..aeec9f361 100644 --- a/source/Entities/Player.h +++ b/source/Entities/Player.h @@ -269,6 +269,8 @@ public: void UseEquippedItem(void); void SendHealth(void); + + void SendExperience(void); // In UI windows, the item that the player is dragging: bool IsDraggingItem(void) const { return !m_DraggingItem.IsEmpty(); } diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h index c00c3cad4..98eeec789 100644 --- a/source/Protocol/Protocol.h +++ b/source/Protocol/Protocol.h @@ -85,7 +85,7 @@ public: virtual void SendPlayerPosition (void) = 0; virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0; virtual void SendRespawn (void) = 0; - virtual void SendSetExperience (void) = 0; + virtual void SendExperience (void) = 0; virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) = 0; // a_Src coords are Block * 8 virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) = 0; virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) = 0; diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp index 08a2b8656..c2dc1c9ce 100644 --- a/source/Protocol/Protocol125.cpp +++ b/source/Protocol/Protocol125.cpp @@ -691,7 +691,7 @@ void cProtocol125::SendRespawn(void) -void cProtocol125::SendSetExperience(void) +void cProtocol125::SendExperience(void) { cCSLock Lock(m_CSPacket); WriteByte (PACKET_EXPERIENCE); diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h index 48309a961..cd208eaba 100644 --- a/source/Protocol/Protocol125.h +++ b/source/Protocol/Protocol125.h @@ -62,7 +62,7 @@ public: virtual void SendPlayerPosition (void) override; virtual void SendPlayerSpawn (const cPlayer & a_Player) override; virtual void SendRespawn (void) override; - virtual void SendSetExperience (void) override; + virtual void SendExperience (void) override; virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8 virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; diff --git a/source/Protocol/Protocol17x.cpp b/source/Protocol/Protocol17x.cpp index b14c52cba..7ff2b54b1 100644 --- a/source/Protocol/Protocol17x.cpp +++ b/source/Protocol/Protocol17x.cpp @@ -597,7 +597,7 @@ void cProtocol172::SendRespawn(void) -void cProtocol172::SendSetExperience (void) +void cProtocol172::SendExperience (void) { cPacketizer Pkt(*this, 0x1F); //Experience Packet Pkt.WriteFloat(m_Client->GetPlayer()->XpGetPercentage()); diff --git a/source/Protocol/Protocol17x.h b/source/Protocol/Protocol17x.h index 99ae3a087..6e8574d98 100644 --- a/source/Protocol/Protocol17x.h +++ b/source/Protocol/Protocol17x.h @@ -72,7 +72,7 @@ public: virtual void SendPlayerSpawn (const cPlayer & a_Player) override; virtual void SendRespawn (void) override; virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8 - virtual void SendSetExperience (void) override; + virtual void SendExperience (void) override; virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; virtual void SendSpawnMob (const cMonster & a_Mob) override; diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp index 283c20811..64bd83075 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/source/Protocol/ProtocolRecognizer.cpp @@ -466,10 +466,10 @@ void cProtocolRecognizer::SendRespawn(void) -void cProtocolRecognizer::SendSetExperience(void) +void cProtocolRecognizer::SendExperience(void) { ASSERT(m_Protocol != NULL); - m_Protocol->SendSetExperience(); + m_Protocol->SendExperience(); } diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h index a32772282..c2beb2014 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/source/Protocol/ProtocolRecognizer.h @@ -97,7 +97,7 @@ public: virtual void SendPlayerPosition (void) override; virtual void SendPlayerSpawn (const cPlayer & a_Player) override; virtual void SendRespawn (void) override; - virtual void SendSetExperience (void) override; + virtual void SendExperience (void) override; virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; |