Add GetClassBitmask(), GetClassName(), GetRaceBitmask(), and GetRaceName() to Perl/Lua.

This commit is contained in:
Kinglykrab
2021-01-16 17:59:38 -05:00
parent 0f5a7e1317
commit 7e1e1651e4
6 changed files with 139 additions and 1 deletions
+54
View File
@@ -7086,6 +7086,58 @@ XS(XS_Client_Fling) {
XSRETURN_EMPTY;
}
XS(XS_Client_GetClassBitmask);
XS(XS_Client_GetClassBitmask) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Client::GetClassBitmask(THIS)");
{
Client* THIS;
int client_bitmask = 0;
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.");
client_bitmask = GetPlayerClassBit(THIS->GetClass());
XSprePUSH;
PUSHu((UV) client_bitmask);
}
XSRETURN(1);
}
XS(XS_Client_GetRaceBitmask);
XS(XS_Client_GetRaceBitmask) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Client::GetRaceBitmask(THIS)");
{
Client* THIS;
int client_bitmask = 0;
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.");
client_bitmask = GetPlayerRaceBit(THIS->GetBaseRace());
XSprePUSH;
PUSHu((UV) client_bitmask);
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
@@ -7174,6 +7226,7 @@ XS(boot_Client) {
newXSproto(strcpy(buf, "GetBindZoneID"), XS_Client_GetBindZoneID, file, "$$");
newXSproto(strcpy(buf, "GetCarriedMoney"), XS_Client_GetCarriedMoney, file, "$");
newXSproto(strcpy(buf, "GetCharacterFactionLevel"), XS_Client_GetCharacterFactionLevel, file, "$$");
newXSproto(strcpy(buf, "GetClassBitmask"), XS_Client_GetClassBitmask, file, "$");
newXSproto(strcpy(buf, "GetClientMaxLevel"), XS_Client_GetClientMaxLevel, file, "$");
newXSproto(strcpy(buf, "GetClientVersion"), XS_Client_GetClientVersion, file, "$");
newXSproto(strcpy(buf, "GetClientVersionBit"), XS_Client_GetClientVersionBit, file, "$");
@@ -7218,6 +7271,7 @@ XS(boot_Client) {
newXSproto(strcpy(buf, "GetMoney"), XS_Client_GetMoney, file, "$$$");
newXSproto(strcpy(buf, "GetPVP"), XS_Client_GetPVP, file, "$");
newXSproto(strcpy(buf, "GetPVPPoints"), XS_Client_GetPVPPoints, file, "$");
newXSproto(strcpy(buf, "GetRaceBitmask"), XS_Client_GetRaceBitmask, file, "$");
newXSproto(strcpy(buf, "GetRadiantCrystals"), XS_Client_GetRadiantCrystals, file, "$");
newXSproto(strcpy(buf, "GetRaid"), XS_Client_GetRaid, file, "$");
newXSproto(strcpy(buf, "GetRaidPoints"), XS_Client_GetRaidPoints, file, "$");