mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
Export Getter/Setter alternate currency methods to Perl and Lua.
- GetAlternateCurrencyValue(currency_id) - Returns the amount of the alternate currency you have. - SetAlternateCurrencyValue(currency_id, amount) - Allows you to directly set the amount of an alternate currency.
This commit is contained in:
parent
6fb1d95518
commit
08d197fe15
@ -1210,6 +1210,16 @@ void Lua_Client::AddAlternateCurrencyValue(uint32 currency, int amount) {
|
|||||||
self->AddAlternateCurrencyValue(currency, amount, 1);
|
self->AddAlternateCurrencyValue(currency, amount, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Lua_Client::SetAlternateCurrencyValue(uint32 currency, int amount) {
|
||||||
|
Lua_Safe_Call_Void();
|
||||||
|
self->SetAlternateCurrencyValue(currency, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Lua_Client::GetAlternateCurrencyValue(uint32 currency) {
|
||||||
|
Lua_Safe_Call_Int();
|
||||||
|
return self->GetAlternateCurrencyValue(currency);
|
||||||
|
}
|
||||||
|
|
||||||
void Lua_Client::SendWebLink(const char *site) {
|
void Lua_Client::SendWebLink(const char *site) {
|
||||||
Lua_Safe_Call_Void();
|
Lua_Safe_Call_Void();
|
||||||
self->SendWebLink(site);
|
self->SendWebLink(site);
|
||||||
@ -1760,6 +1770,8 @@ luabind::scope lua_register_client() {
|
|||||||
.def("OpenLFGuildWindow", (void(Lua_Client::*)(void))&Lua_Client::OpenLFGuildWindow)
|
.def("OpenLFGuildWindow", (void(Lua_Client::*)(void))&Lua_Client::OpenLFGuildWindow)
|
||||||
.def("Signal", (void(Lua_Client::*)(uint32))&Lua_Client::Signal)
|
.def("Signal", (void(Lua_Client::*)(uint32))&Lua_Client::Signal)
|
||||||
.def("AddAlternateCurrencyValue", (void(Lua_Client::*)(uint32,int))&Lua_Client::AddAlternateCurrencyValue)
|
.def("AddAlternateCurrencyValue", (void(Lua_Client::*)(uint32,int))&Lua_Client::AddAlternateCurrencyValue)
|
||||||
|
.def("SetAlternateCurrencyValue", (void(Lua_Client::*)(uint32,int))&Lua_Client::SetAlternateCurrencyValue)
|
||||||
|
.def("GetAlternateCurrencyValue", (int(Lua_Client::*)(uint32))&Lua_Client::GetAlternateCurrencyValue)
|
||||||
.def("SendWebLink", (void(Lua_Client::*)(const char *))&Lua_Client::SendWebLink)
|
.def("SendWebLink", (void(Lua_Client::*)(const char *))&Lua_Client::SendWebLink)
|
||||||
.def("HasSpellScribed", (bool(Lua_Client::*)(int))&Lua_Client::HasSpellScribed)
|
.def("HasSpellScribed", (bool(Lua_Client::*)(int))&Lua_Client::HasSpellScribed)
|
||||||
.def("SetAccountFlag", (void(Lua_Client::*)(std::string,std::string))&Lua_Client::SetAccountFlag)
|
.def("SetAccountFlag", (void(Lua_Client::*)(std::string,std::string))&Lua_Client::SetAccountFlag)
|
||||||
|
|||||||
@ -269,6 +269,8 @@ public:
|
|||||||
void OpenLFGuildWindow();
|
void OpenLFGuildWindow();
|
||||||
void Signal(uint32 id);
|
void Signal(uint32 id);
|
||||||
void AddAlternateCurrencyValue(uint32 currency, int amount);
|
void AddAlternateCurrencyValue(uint32 currency, int amount);
|
||||||
|
void SetAlternateCurrencyValue(uint32 currency, int amount);
|
||||||
|
int GetAlternateCurrencyValue(uint32 currency);
|
||||||
void SendWebLink(const char *site);
|
void SendWebLink(const char *site);
|
||||||
bool HasSpellScribed(int spell_id);
|
bool HasSpellScribed(int spell_id);
|
||||||
void SetAccountFlag(std::string flag, std::string val);
|
void SetAccountFlag(std::string flag, std::string val);
|
||||||
|
|||||||
@ -5562,6 +5562,55 @@ XS(XS_Client_AddAlternateCurrencyValue) {
|
|||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XS(XS_Client_SetAlternateCurrencyValue); /* prototype to pass -Wmissing-prototypes */
|
||||||
|
XS(XS_Client_SetAlternateCurrencyValue) {
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 3)
|
||||||
|
Perl_croak(aTHX_ "Usage: Client::SetAlternateCurrencyValue(THIS, uint32 currency_id, int32 amount)");
|
||||||
|
{
|
||||||
|
Client *THIS;
|
||||||
|
uint32 currency_id = (uint32) SvUV(ST(1));
|
||||||
|
int32 amount = (int32) SvUV(ST(2));
|
||||||
|
|
||||||
|
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.");
|
||||||
|
|
||||||
|
THIS->SetAlternateCurrencyValue(currency_id, amount);
|
||||||
|
}
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
XS(XS_Client_GetAlternateCurrencyValue); /* prototype to pass -Wmissing-prototypes */
|
||||||
|
XS(XS_Client_GetAlternateCurrencyValue) {
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 2)
|
||||||
|
Perl_croak(aTHX_ "Usage: Client::GetAlternateCurrencyValue(THIS, uint32 currency_id)");
|
||||||
|
{
|
||||||
|
Client *THIS;
|
||||||
|
uint32 currency_id = (uint32) SvUV(ST(1));
|
||||||
|
int32 RETVAL = 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.");
|
||||||
|
|
||||||
|
RETVAL = THIS->GetAlternateCurrencyValue(currency_id);
|
||||||
|
XSprePUSH;
|
||||||
|
PUSHi((IV) RETVAL);
|
||||||
|
}
|
||||||
|
XSRETURN(1);
|
||||||
|
}
|
||||||
|
|
||||||
XS(XS_Client_SendWebLink); /* prototype to pass -Wmissing-prototypes */
|
XS(XS_Client_SendWebLink); /* prototype to pass -Wmissing-prototypes */
|
||||||
XS(XS_Client_SendWebLink) {
|
XS(XS_Client_SendWebLink) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
@ -6350,6 +6399,7 @@ XS(boot_Client) {
|
|||||||
newXSproto(strcpy(buf, "GetAccountFlag"), XS_Client_GetAccountFlag, file, "$$");
|
newXSproto(strcpy(buf, "GetAccountFlag"), XS_Client_GetAccountFlag, file, "$$");
|
||||||
newXSproto(strcpy(buf, "GetAggroCount"), XS_Client_GetAggroCount, file, "$");
|
newXSproto(strcpy(buf, "GetAggroCount"), XS_Client_GetAggroCount, file, "$");
|
||||||
newXSproto(strcpy(buf, "GetAllMoney"), XS_Client_GetAllMoney, file, "$");
|
newXSproto(strcpy(buf, "GetAllMoney"), XS_Client_GetAllMoney, file, "$");
|
||||||
|
newXSproto(strcpy(buf, "GetAlternateCurrencyValue"), XS_Client_GetAlternateCurrencyValue, file, "$$");
|
||||||
newXSproto(strcpy(buf, "GetAnon"), XS_Client_GetAnon, file, "$");
|
newXSproto(strcpy(buf, "GetAnon"), XS_Client_GetAnon, file, "$");
|
||||||
newXSproto(strcpy(buf, "GetAugmentAt"), XS_Client_GetAugmentAt, file, "$$$");
|
newXSproto(strcpy(buf, "GetAugmentAt"), XS_Client_GetAugmentAt, file, "$$$");
|
||||||
newXSproto(strcpy(buf, "GetAugmentIDAt"), XS_Client_GetAugmentIDAt, file, "$$$");
|
newXSproto(strcpy(buf, "GetAugmentIDAt"), XS_Client_GetAugmentIDAt, file, "$$$");
|
||||||
@ -6487,6 +6537,7 @@ XS(boot_Client) {
|
|||||||
newXSproto(strcpy(buf, "SetAAPoints"), XS_Client_SetAAPoints, file, "$$");
|
newXSproto(strcpy(buf, "SetAAPoints"), XS_Client_SetAAPoints, file, "$$");
|
||||||
newXSproto(strcpy(buf, "SetAATitle"), XS_Client_SetAATitle, file, "$$;$");
|
newXSproto(strcpy(buf, "SetAATitle"), XS_Client_SetAATitle, file, "$$;$");
|
||||||
newXSproto(strcpy(buf, "SetAccountFlag"), XS_Client_SetAccountFlag, file, "$$");
|
newXSproto(strcpy(buf, "SetAccountFlag"), XS_Client_SetAccountFlag, file, "$$");
|
||||||
|
newXSproto(strcpy(buf, "SetAlternateCurrencyValue"), XS_Client_SetAlternateCurrencyValue, file, "$$$");
|
||||||
newXSproto(strcpy(buf, "SetBaseClass"), XS_Client_SetBaseClass, file, "$$");
|
newXSproto(strcpy(buf, "SetBaseClass"), XS_Client_SetBaseClass, file, "$$");
|
||||||
newXSproto(strcpy(buf, "SetBaseGender"), XS_Client_SetBaseGender, file, "$$");
|
newXSproto(strcpy(buf, "SetBaseGender"), XS_Client_SetBaseGender, file, "$$");
|
||||||
newXSproto(strcpy(buf, "SetBaseRace"), XS_Client_SetBaseRace, file, "$$");
|
newXSproto(strcpy(buf, "SetBaseRace"), XS_Client_SetBaseRace, file, "$$");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user