cProtocol add SendExperience() and debugging
This commit is contained in:
parent
ea778c7027
commit
f6e16ce150
@ -44,6 +44,7 @@ function Initialize(Plugin)
|
||||
PluginManager:BindCommand("/fs", "debuggers", HandleFoodStatsCmd, "- Turns regular foodstats message on or off");
|
||||
PluginManager:BindCommand("/arr", "debuggers", HandleArrowCmd, "- Creates an arrow going away from the player");
|
||||
PluginManager:BindCommand("/fb", "debuggers", HandleFireballCmd, "- Creates a ghast fireball as if shot by the player");
|
||||
PluginManager:BindCommand("/xpa", "debuggers", HandleAddExperience, "- Adds 200 experience to the player");
|
||||
|
||||
-- Enable the following line for BlockArea / Generator interface testing:
|
||||
-- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
|
||||
@ -839,3 +840,8 @@ end
|
||||
|
||||
|
||||
|
||||
function HandleAddExperience(a_Split, a_Player)
|
||||
a_Player->AddExperience(200);
|
||||
|
||||
return true;
|
||||
end
|
@ -22,9 +22,9 @@ class cWindow;
|
||||
class cInventory;
|
||||
class cPawn;
|
||||
class cPickup;
|
||||
class cWorld;
|
||||
class cMonster;
|
||||
class cChunkDataSerializer;
|
||||
class cWorld;
|
||||
class cFallingBlock;
|
||||
|
||||
|
||||
@ -85,6 +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 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;
|
||||
|
@ -72,6 +72,7 @@ enum
|
||||
PACKET_ENT_STATUS = 0x26,
|
||||
PACKET_ATTACH_ENTITY = 0x27,
|
||||
PACKET_METADATA = 0x28,
|
||||
PACKET_EXPERIENCE = 0x2b,
|
||||
PACKET_PRE_CHUNK = 0x32,
|
||||
PACKET_MAP_CHUNK = 0x33,
|
||||
PACKET_MULTI_BLOCK = 0x34,
|
||||
@ -690,6 +691,20 @@ void cProtocol125::SendRespawn(void)
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendSetExperience(void)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
WriteByte (PACKET_EXPERIENCE);
|
||||
WriteFloat (m_Client->GetPlayer()->XpGetPercentage());
|
||||
WriteShort (m_Client->GetPlayer()->XpGetLevel());
|
||||
WriteShort (m_Client->GetPlayer()->XpGetTotal());
|
||||
Flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch)
|
||||
{
|
||||
// Not needed in this protocol version
|
||||
|
@ -62,6 +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 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;
|
||||
|
@ -597,6 +597,18 @@ void cProtocol172::SendRespawn(void)
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendSetExperience (void)
|
||||
{
|
||||
cPacketizer Pkt(*this, 0x1F); //Experience Packet
|
||||
Pkt.WriteFloat(m_Client->GetPlayer()->XpGetPercentage());
|
||||
Pkt.WriteShort(m_Client->GetPlayer()->XpGetLevel());
|
||||
Pkt.WriteShort(m_Client->GetPlayer()->XpGetTotal());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::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
|
||||
{
|
||||
cPacketizer Pkt(*this, 0x29); // Sound Effect packet
|
||||
|
@ -72,6 +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 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;
|
||||
|
@ -466,6 +466,16 @@ void cProtocolRecognizer::SendRespawn(void)
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendSetExperience(void)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendSetExperience();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
|
@ -97,6 +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 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;
|
||||
|
Loading…
Reference in New Issue
Block a user