Merge pull request #553 from KinglyKrab/master

Added GetAAPercent() to Perl and Lua.
This commit is contained in:
Michael Cook (mackal) 2016-09-08 22:08:47 -04:00 committed by GitHub
commit 50469b858b
4 changed files with 35 additions and 0 deletions

View File

@ -796,6 +796,7 @@ public:
void SendClearAA();
inline uint32 GetMaxAAXP(void) const { return max_AAXP; }
inline uint32 GetAAXP() const { return m_pp.expAA; }
inline uint32 GetAAPercent() const { return m_epp.perAA; }
int16 CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id);
void SetAATitle(const char *Title);
void SetTitleSuffix(const char *txt);

View File

@ -185,6 +185,11 @@ uint32 Lua_Client::GetAAExp() {
return self->GetAAXP();
}
uint32 Lua_Client::GetAAPercent() {
Lua_Safe_Call_Int();
return self->GetAAPercent();
}
uint32 Lua_Client::GetTotalSecondsPlayed() {
Lua_Safe_Call_Int();
return self->GetTotalSecondsPlayed();
@ -1377,6 +1382,7 @@ luabind::scope lua_register_client() {
.def("GetWeight", (int(Lua_Client::*)(void))&Lua_Client::GetWeight)
.def("GetEXP", (uint32(Lua_Client::*)(void))&Lua_Client::GetEXP)
.def("GetAAExp", (uint32(Lua_Client::*)(void))&Lua_Client::GetAAExp)
.def("GetAAPercent", (uint32(Lua_Client::*)(void))&Lua_Client::GetAAPercent)
.def("GetTotalSecondsPlayed", (uint32(Lua_Client::*)(void))&Lua_Client::GetTotalSecondsPlayed)
.def("UpdateLDoNPoints", (void(Lua_Client::*)(int,uint32))&Lua_Client::UpdateLDoNPoints)
.def("SetDeity", (void(Lua_Client::*)(int))&Lua_Client::SetDeity)

View File

@ -63,6 +63,7 @@ public:
int GetWeight();
uint32 GetEXP();
uint32 GetAAExp();
uint32 GetAAPercent();
uint32 GetTotalSecondsPlayed();
void UpdateLDoNPoints(int points, uint32 theme);
void SetDeity(int v);

View File

@ -871,6 +871,32 @@ XS(XS_Client_GetAAExp)
XSRETURN(1);
}
XS(XS_Client_GetAAPercent);
XS(XS_Client_GetAAPercent)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Client::GetAAPercent(THIS)");
{
Client* THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Client *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Client");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetAAPercent();
XSprePUSH; PUSHu((UV)RETVAL);
}
XSRETURN(1);
}
XS(XS_Client_GetTotalSecondsPlayed); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_GetTotalSecondsPlayed)
{
@ -6465,6 +6491,7 @@ XS(boot_Client)
newXSproto(strcpy(buf, "GetWeight"), XS_Client_GetWeight, file, "$");
newXSproto(strcpy(buf, "GetEXP"), XS_Client_GetEXP, file, "$");
newXSproto(strcpy(buf, "GetAAExp"), XS_Client_GetAAExp, file, "$");
newXSproto(strcpy(buf, "GetAAPercent"), XS_Client_GetAAPercent, file, "$");
newXSproto(strcpy(buf, "GetTotalSecondsPlayed"), XS_Client_GetTotalSecondsPlayed, file, "$");
newXSproto(strcpy(buf, "UpdateLDoNPoints"), XS_Client_UpdateLDoNPoints, file, "$$$");
newXSproto(strcpy(buf, "SetDeity"), XS_Client_SetDeity, file, "$$");