fixed bug and added SpendExperience()
This commit is contained in:
parent
c0c8fe1bcd
commit
3595392937
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Lua binding: AllToLua
|
** Lua binding: AllToLua
|
||||||
** Generated automatically by tolua++-1.0.92 on 11/16/13 02:20:34.
|
** Generated automatically by tolua++-1.0.92 on 11/16/13 21:19:32.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
@ -7650,9 +7650,9 @@ static int tolua_AllToLua_cEntity_IsInvisible00(lua_State* tolua_S)
|
|||||||
}
|
}
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
/* method: SetExperience of class cPlayer */
|
/* method: SetCurrentExperience of class cPlayer */
|
||||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetExperience00
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetCurrentExperience00
|
||||||
static int tolua_AllToLua_cPlayer_SetExperience00(lua_State* tolua_S)
|
static int tolua_AllToLua_cPlayer_SetCurrentExperience00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
@ -7668,17 +7668,17 @@ static int tolua_AllToLua_cPlayer_SetExperience00(lua_State* tolua_S)
|
|||||||
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
||||||
short a_XpTotal = ((short) tolua_tonumber(tolua_S,2,0));
|
short a_XpTotal = ((short) tolua_tonumber(tolua_S,2,0));
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetExperience'", NULL);
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetCurrentExperience'", NULL);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
bool tolua_ret = (bool) self->SetExperience(a_XpTotal);
|
bool tolua_ret = (bool) self->SetCurrentExperience(a_XpTotal);
|
||||||
tolua_pushboolean(tolua_S,(bool)tolua_ret);
|
tolua_pushboolean(tolua_S,(bool)tolua_ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_lerror:
|
tolua_lerror:
|
||||||
tolua_error(tolua_S,"#ferror in function 'SetExperience'.",&tolua_err);
|
tolua_error(tolua_S,"#ferror in function 'SetCurrentExperience'.",&tolua_err);
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -7718,41 +7718,43 @@ static int tolua_AllToLua_cPlayer_AddExperience00(lua_State* tolua_S)
|
|||||||
}
|
}
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
/* method: XpGetTotal of class cPlayer */
|
/* method: SpendExperience of class cPlayer */
|
||||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_XpGetTotal00
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SpendExperience00
|
||||||
static int tolua_AllToLua_cPlayer_XpGetTotal00(lua_State* tolua_S)
|
static int tolua_AllToLua_cPlayer_SpendExperience00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
if (
|
if (
|
||||||
!tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
|
!tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
|
||||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
|
||||||
|
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||||
)
|
)
|
||||||
goto tolua_lerror;
|
goto tolua_lerror;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
||||||
|
short a_Xp_delta = ((short) tolua_tonumber(tolua_S,2,0));
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'XpGetTotal'", NULL);
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpendExperience'", NULL);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
short tolua_ret = (short) self->XpGetTotal();
|
short tolua_ret = (short) self->SpendExperience(a_Xp_delta);
|
||||||
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_lerror:
|
tolua_lerror:
|
||||||
tolua_error(tolua_S,"#ferror in function 'XpGetTotal'.",&tolua_err);
|
tolua_error(tolua_S,"#ferror in function 'SpendExperience'.",&tolua_err);
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
/* method: XpGetLevel of class cPlayer */
|
/* method: GetXpLifetimeTotal of class cPlayer */
|
||||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_XpGetLevel00
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpLifetimeTotal00
|
||||||
static int tolua_AllToLua_cPlayer_XpGetLevel00(lua_State* tolua_S)
|
static int tolua_AllToLua_cPlayer_GetXpLifetimeTotal00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
@ -7766,25 +7768,25 @@ static int tolua_AllToLua_cPlayer_XpGetLevel00(lua_State* tolua_S)
|
|||||||
{
|
{
|
||||||
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'XpGetLevel'", NULL);
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpLifetimeTotal'", NULL);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
short tolua_ret = (short) self->XpGetLevel();
|
short tolua_ret = (short) self->GetXpLifetimeTotal();
|
||||||
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_lerror:
|
tolua_lerror:
|
||||||
tolua_error(tolua_S,"#ferror in function 'XpGetLevel'.",&tolua_err);
|
tolua_error(tolua_S,"#ferror in function 'GetXpLifetimeTotal'.",&tolua_err);
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
/* method: XpGetPercentage of class cPlayer */
|
/* method: GetCurrentXp of class cPlayer */
|
||||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_XpGetPercentage00
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetCurrentXp00
|
||||||
static int tolua_AllToLua_cPlayer_XpGetPercentage00(lua_State* tolua_S)
|
static int tolua_AllToLua_cPlayer_GetCurrentXp00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
@ -7798,17 +7800,81 @@ static int tolua_AllToLua_cPlayer_XpGetPercentage00(lua_State* tolua_S)
|
|||||||
{
|
{
|
||||||
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'XpGetPercentage'", NULL);
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCurrentXp'", NULL);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
float tolua_ret = (float) self->XpGetPercentage();
|
short tolua_ret = (short) self->GetCurrentXp();
|
||||||
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_lerror:
|
tolua_lerror:
|
||||||
tolua_error(tolua_S,"#ferror in function 'XpGetPercentage'.",&tolua_err);
|
tolua_error(tolua_S,"#ferror in function 'GetCurrentXp'.",&tolua_err);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
|
/* method: GetXpLevel of class cPlayer */
|
||||||
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpLevel00
|
||||||
|
static int tolua_AllToLua_cPlayer_GetXpLevel00(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
if (
|
||||||
|
!tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
|
||||||
|
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||||
|
)
|
||||||
|
goto tolua_lerror;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpLevel'", NULL);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
short tolua_ret = (short) self->GetXpLevel();
|
||||||
|
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'GetXpLevel'.",&tolua_err);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
|
/* method: GetXpPercentage of class cPlayer */
|
||||||
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpPercentage00
|
||||||
|
static int tolua_AllToLua_cPlayer_GetXpPercentage00(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
if (
|
||||||
|
!tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
|
||||||
|
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||||
|
)
|
||||||
|
goto tolua_lerror;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpPercentage'", NULL);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
float tolua_ret = (float) self->GetXpPercentage();
|
||||||
|
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'GetXpPercentage'.",&tolua_err);
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -30417,11 +30483,14 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||||||
tolua_constant(tolua_S,"EATING_TICKS",cPlayer::EATING_TICKS);
|
tolua_constant(tolua_S,"EATING_TICKS",cPlayer::EATING_TICKS);
|
||||||
tolua_constant(tolua_S,"MAX_AIR_LEVEL",cPlayer::MAX_AIR_LEVEL);
|
tolua_constant(tolua_S,"MAX_AIR_LEVEL",cPlayer::MAX_AIR_LEVEL);
|
||||||
tolua_constant(tolua_S,"DROWNING_TICKS",cPlayer::DROWNING_TICKS);
|
tolua_constant(tolua_S,"DROWNING_TICKS",cPlayer::DROWNING_TICKS);
|
||||||
tolua_function(tolua_S,"SetExperience",tolua_AllToLua_cPlayer_SetExperience00);
|
tolua_constant(tolua_S,"MIN_EXPERIENCE",cPlayer::MIN_EXPERIENCE);
|
||||||
|
tolua_function(tolua_S,"SetCurrentExperience",tolua_AllToLua_cPlayer_SetCurrentExperience00);
|
||||||
tolua_function(tolua_S,"AddExperience",tolua_AllToLua_cPlayer_AddExperience00);
|
tolua_function(tolua_S,"AddExperience",tolua_AllToLua_cPlayer_AddExperience00);
|
||||||
tolua_function(tolua_S,"XpGetTotal",tolua_AllToLua_cPlayer_XpGetTotal00);
|
tolua_function(tolua_S,"SpendExperience",tolua_AllToLua_cPlayer_SpendExperience00);
|
||||||
tolua_function(tolua_S,"XpGetLevel",tolua_AllToLua_cPlayer_XpGetLevel00);
|
tolua_function(tolua_S,"GetXpLifetimeTotal",tolua_AllToLua_cPlayer_GetXpLifetimeTotal00);
|
||||||
tolua_function(tolua_S,"XpGetPercentage",tolua_AllToLua_cPlayer_XpGetPercentage00);
|
tolua_function(tolua_S,"GetCurrentXp",tolua_AllToLua_cPlayer_GetCurrentXp00);
|
||||||
|
tolua_function(tolua_S,"GetXpLevel",tolua_AllToLua_cPlayer_GetXpLevel00);
|
||||||
|
tolua_function(tolua_S,"GetXpPercentage",tolua_AllToLua_cPlayer_GetXpPercentage00);
|
||||||
tolua_function(tolua_S,"GetEyeHeight",tolua_AllToLua_cPlayer_GetEyeHeight00);
|
tolua_function(tolua_S,"GetEyeHeight",tolua_AllToLua_cPlayer_GetEyeHeight00);
|
||||||
tolua_function(tolua_S,"GetEyePosition",tolua_AllToLua_cPlayer_GetEyePosition00);
|
tolua_function(tolua_S,"GetEyePosition",tolua_AllToLua_cPlayer_GetEyePosition00);
|
||||||
tolua_function(tolua_S,"IsOnGround",tolua_AllToLua_cPlayer_IsOnGround00);
|
tolua_function(tolua_S,"IsOnGround",tolua_AllToLua_cPlayer_IsOnGround00);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Lua binding: AllToLua
|
** Lua binding: AllToLua
|
||||||
** Generated automatically by tolua++-1.0.92 on 11/16/13 02:20:35.
|
** Generated automatically by tolua++-1.0.92 on 11/16/13 21:19:33.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Exported function */
|
/* Exported function */
|
||||||
|
@ -66,8 +66,9 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
|
|||||||
, m_EatingFinishTick(-1)
|
, m_EatingFinishTick(-1)
|
||||||
, m_IsChargingBow(false)
|
, m_IsChargingBow(false)
|
||||||
, m_BowCharge(0)
|
, m_BowCharge(0)
|
||||||
, m_XpTotal(0)
|
, m_CurrentXp(0)
|
||||||
, m_IsExperienceDirty(false)
|
, m_LifetimeTotalXp(0)
|
||||||
|
, m_bDirtyExperience(false)
|
||||||
{
|
{
|
||||||
LOGD("Created a player object for \"%s\" @ \"%s\" at %p, ID %d",
|
LOGD("Created a player object for \"%s\" @ \"%s\" at %p, ID %d",
|
||||||
a_PlayerName.c_str(), a_Client->GetIPString().c_str(),
|
a_PlayerName.c_str(), a_Client->GetIPString().c_str(),
|
||||||
@ -383,6 +384,31 @@ short cPlayer::AddExperience(short a_Xp_delta)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
short cPlayer::SpendExperience(short a_Xp_delta)
|
||||||
|
{
|
||||||
|
if(a_Xp_delta < 0)
|
||||||
|
{
|
||||||
|
// Value was negative, abort and report
|
||||||
|
LOGWARNING("Attempt was made to decrement Xp by %d, must be positive",
|
||||||
|
a_Xp_delta);
|
||||||
|
return -1; // Should we instead just return the current Xp?
|
||||||
|
}
|
||||||
|
|
||||||
|
m_CurrentXp -= a_Xp_delta;
|
||||||
|
|
||||||
|
LOGD("Player \"%s\" spent %d experience, total is now: %d",
|
||||||
|
m_PlayerName.c_str(), a_Xp_delta, m_XpTotal);
|
||||||
|
|
||||||
|
// Set experience to be updated
|
||||||
|
m_bDirtyExperience = true;
|
||||||
|
|
||||||
|
return m_CurrentXp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cPlayer::StartChargingBow(void)
|
void cPlayer::StartChargingBow(void)
|
||||||
{
|
{
|
||||||
LOGD("Player \"%s\" started charging their bow", m_PlayerName.c_str());
|
LOGD("Player \"%s\" started charging their bow", m_PlayerName.c_str());
|
||||||
@ -791,6 +817,11 @@ void cPlayer::Respawn(void)
|
|||||||
m_FoodLevel = MAX_FOOD_LEVEL;
|
m_FoodLevel = MAX_FOOD_LEVEL;
|
||||||
m_FoodSaturationLevel = 5;
|
m_FoodSaturationLevel = 5;
|
||||||
|
|
||||||
|
// Reset Experience
|
||||||
|
m_CurrentXp = MIN_EXPERIENCE;
|
||||||
|
m_LifetimeTotalXp = MIN_EXPERIENCE;
|
||||||
|
// ToDo: send score to client? How?
|
||||||
|
|
||||||
m_ClientHandle->SendRespawn();
|
m_ClientHandle->SendRespawn();
|
||||||
|
|
||||||
// Extinguish the fire:
|
// Extinguish the fire:
|
||||||
@ -1449,7 +1480,8 @@ bool cPlayer::LoadFromDisk()
|
|||||||
m_FoodSaturationLevel = root.get("foodSaturation", MAX_FOOD_LEVEL).asDouble();
|
m_FoodSaturationLevel = root.get("foodSaturation", MAX_FOOD_LEVEL).asDouble();
|
||||||
m_FoodTickTimer = root.get("foodTickTimer", 0).asInt();
|
m_FoodTickTimer = root.get("foodTickTimer", 0).asInt();
|
||||||
m_FoodExhaustionLevel = root.get("foodExhaustion", 0).asDouble();
|
m_FoodExhaustionLevel = root.get("foodExhaustion", 0).asDouble();
|
||||||
m_XpTotal = (short) root.get("experience", 0).asInt();
|
m_LifetimeTotalXp = (short) root.get("xpTotal", 0).asInt();
|
||||||
|
m_CurrentXp = (short) root.get("xpCurrent", 0).asInt();
|
||||||
|
|
||||||
//SetExperience(root.get("experience", 0).asInt());
|
//SetExperience(root.get("experience", 0).asInt());
|
||||||
|
|
||||||
@ -1493,7 +1525,8 @@ bool cPlayer::SaveToDisk()
|
|||||||
root["rotation"] = JSON_PlayerRotation;
|
root["rotation"] = JSON_PlayerRotation;
|
||||||
root["inventory"] = JSON_Inventory;
|
root["inventory"] = JSON_Inventory;
|
||||||
root["health"] = m_Health;
|
root["health"] = m_Health;
|
||||||
root["experience"] = m_XpTotal;
|
root["xpTotal"] = m_LifetimeTotalXp;
|
||||||
|
root["xpCurrent"] = m_CurrentXp;
|
||||||
root["air"] = m_AirLevel;
|
root["air"] = m_AirLevel;
|
||||||
root["food"] = m_FoodLevel;
|
root["food"] = m_FoodLevel;
|
||||||
root["foodSaturation"] = m_FoodSaturationLevel;
|
root["foodSaturation"] = m_FoodSaturationLevel;
|
||||||
|
@ -32,6 +32,7 @@ public:
|
|||||||
EATING_TICKS = 30, ///< Number of ticks it takes to eat an item
|
EATING_TICKS = 30, ///< Number of ticks it takes to eat an item
|
||||||
MAX_AIR_LEVEL = 300,
|
MAX_AIR_LEVEL = 300,
|
||||||
DROWNING_TICKS = 10, //number of ticks per heart of damage
|
DROWNING_TICKS = 10, //number of ticks per heart of damage
|
||||||
|
MIN_EXPERIENCE = 0,
|
||||||
} ;
|
} ;
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
@ -78,6 +79,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
short AddExperience(short a_Xp_delta);
|
short AddExperience(short a_Xp_delta);
|
||||||
|
|
||||||
|
/// "Spend" some experience - ie on enchanting, returns new currentXp
|
||||||
|
short SpendExperience(short a_Xp_delta);
|
||||||
|
|
||||||
/// Gets the experience total - XpTotal for score on death
|
/// Gets the experience total - XpTotal for score on death
|
||||||
inline short GetXpLifetimeTotal(void) { return m_LifetimeTotalXp; }
|
inline short GetXpLifetimeTotal(void) { return m_LifetimeTotalXp; }
|
||||||
|
|
||||||
|
@ -695,9 +695,9 @@ void cProtocol125::SendExperience(void)
|
|||||||
{
|
{
|
||||||
cCSLock Lock(m_CSPacket);
|
cCSLock Lock(m_CSPacket);
|
||||||
WriteByte (PACKET_EXPERIENCE);
|
WriteByte (PACKET_EXPERIENCE);
|
||||||
WriteFloat (m_Client->GetPlayer()->XpGetPercentage());
|
WriteFloat (m_Client->GetPlayer()->GetXpPercentage());
|
||||||
WriteShort (m_Client->GetPlayer()->XpGetLevel());
|
WriteShort (m_Client->GetPlayer()->GetXpLevel());
|
||||||
WriteShort (m_Client->GetPlayer()->XpGetTotal());
|
WriteShort (m_Client->GetPlayer()->GetCurrentXp());
|
||||||
Flush();
|
Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,9 +600,9 @@ void cProtocol172::SendRespawn(void)
|
|||||||
void cProtocol172::SendExperience (void)
|
void cProtocol172::SendExperience (void)
|
||||||
{
|
{
|
||||||
cPacketizer Pkt(*this, 0x1F); //Experience Packet
|
cPacketizer Pkt(*this, 0x1F); //Experience Packet
|
||||||
Pkt.WriteFloat(m_Client->GetPlayer()->XpGetPercentage());
|
Pkt.WriteFloat(m_Client->GetPlayer()->GetXpPercentage());
|
||||||
Pkt.WriteShort(m_Client->GetPlayer()->XpGetLevel());
|
Pkt.WriteShort(m_Client->GetPlayer()->GetXpLevel());
|
||||||
Pkt.WriteShort(m_Client->GetPlayer()->XpGetTotal());
|
Pkt.WriteShort(m_Client->GetPlayer()->GetCurrentXp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user