Add SetRadiantCrystals() and SetEbonCrystals() to Perl/Lua. (#1159)

- Add $client->SetRadiantCrystals(value) to Perl.
- Add $client->SetEbonCrystals(value) to Perl.
- Add client:SetRadiantCrystals(value) to Lua.
- Add client:SetEbonCrystals(value) to Lua.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
This commit is contained in:
Alex 2020-12-30 15:46:09 -05:00 committed by GitHub
parent c1d7a82307
commit c593ed6a05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 8 deletions

View File

@ -5745,6 +5745,18 @@ void Client::AddCrystals(uint32 Radiant, uint32 Ebon)
SendCrystalCounts();
}
void Client::SetEbonCrystals(uint32 value) {
m_pp.currentEbonCrystals = value;
SaveCurrency();
SendCrystalCounts();
}
void Client::SetRadiantCrystals(uint32 value) {
m_pp.currentRadCrystals = value;
SaveCurrency();
SendCrystalCounts();
}
// Processes a client request to inspect a SoF+ client's equipment.
void Client::ProcessInspectRequest(Client* requestee, Client* requester) {
if(requestee && requester) {

View File

@ -594,9 +594,9 @@ public:
uint32 GetPVPPoints() { return m_pp.PVPCurrentPoints; }
void AddPVPPoints(uint32 Points);
uint32 GetRadiantCrystals() { return m_pp.currentRadCrystals; }
void SetRadiantCrystals(uint32 Crystals) { m_pp.currentRadCrystals = Crystals; }
void SetRadiantCrystals(uint32 value);
uint32 GetEbonCrystals() { return m_pp.currentEbonCrystals; }
void SetEbonCrystals(uint32 Crystals) { m_pp.currentEbonCrystals = Crystals; }
void SetEbonCrystals(uint32 value);
void AddCrystals(uint32 Radiant, uint32 Ebon);
void SendCrystalCounts();

View File

@ -2025,12 +2025,10 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app)
else if (aps->Type == NorrathsKeepersMerchant)
{
SetRadiantCrystals(GetRadiantCrystals() - (int32)item->LDoNPrice);
SendCrystalCounts();
}
else if (aps->Type == DarkReignMerchant)
{
SetEbonCrystals(GetEbonCrystals() - (int32)item->LDoNPrice);
SendCrystalCounts();
}
int16 charges = 1;
if (item->MaxCharges != 0)

View File

@ -7855,14 +7855,10 @@ void command_setcrystals(Client *c, const Seperator *sep)
else if(!strcasecmp(sep->arg[1], "radiant"))
{
t->SetRadiantCrystals(atoi(sep->arg[2]));
t->SendCrystalCounts();
t->SaveCurrency();
}
else if(!strcasecmp(sep->arg[1], "ebon"))
{
t->SetEbonCrystals(atoi(sep->arg[2]));
t->SendCrystalCounts();
t->SaveCurrency();
}
else
{

View File

@ -1040,6 +1040,16 @@ void Lua_Client::AddCrystals(uint32 radiant, uint32 ebon) {
self->AddCrystals(radiant, ebon);
}
void Lua_Client::SetEbonCrystals(uint32 value) {
Lua_Safe_Call_Void();
self->SetEbonCrystals(value);
}
void Lua_Client::SetRadiantCrystals(uint32 value) {
Lua_Safe_Call_Void();
self->SetRadiantCrystals(value);
}
uint32 Lua_Client::GetPVPPoints() {
Lua_Safe_Call_Int();
return self->GetPVPPoints();
@ -1846,6 +1856,8 @@ luabind::scope lua_register_client() {
.def("KeyRingCheck", (bool(Lua_Client::*)(uint32))&Lua_Client::KeyRingCheck)
.def("AddPVPPoints", (void(Lua_Client::*)(uint32))&Lua_Client::AddPVPPoints)
.def("AddCrystals", (void(Lua_Client::*)(uint32,uint32))&Lua_Client::AddCrystals)
.def("SetEbonCrystals", (void(Lua_Client::*)(uint32))&Lua_Client::SetEbonCrystals)
.def("SetRadiantCrystals", (void(Lua_Client::*)(uint32))&Lua_Client::SetRadiantCrystals)
.def("GetPVPPoints", (uint32(Lua_Client::*)(void))&Lua_Client::GetPVPPoints)
.def("GetRadiantCrystals", (uint32(Lua_Client::*)(void))&Lua_Client::GetRadiantCrystals)
.def("GetEbonCrystals", (uint32(Lua_Client::*)(void))&Lua_Client::GetEbonCrystals)

View File

@ -235,6 +235,8 @@ public:
bool KeyRingCheck(uint32 item);
void AddPVPPoints(uint32 points);
void AddCrystals(uint32 radiant, uint32 ebon);
void SetEbonCrystals(uint32 value);
void SetRadiantCrystals(uint32 value);
uint32 GetPVPPoints();
uint32 GetRadiantCrystals();
uint32 GetEbonCrystals();

View File

@ -4707,6 +4707,50 @@ XS(XS_Client_AddCrystals) {
XSRETURN_EMPTY;
}
XS(XS_Client_SetEbonCrystals);
XS(XS_Client_SetEbonCrystals) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Client::SetEbonCrystals(THIS, uint32 value)");
{
Client *THIS;
uint32 value = (uint32) SvUV(ST(1));
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->SetEbonCrystals(value);
}
XSRETURN_EMPTY;
}
XS(XS_Client_SetRadiantCrystals);
XS(XS_Client_SetRadiantCrystals) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Client::SetRadiantCrystals(THIS, uint32 value)");
{
Client *THIS;
uint32 value = (uint32) SvUV(ST(1));
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->SetRadiantCrystals(value);
}
XSRETURN_EMPTY;
}
XS(XS_Client_GetPVPPoints); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_GetPVPPoints) {
dXSARGS;
@ -6942,6 +6986,7 @@ XS(boot_Client) {
newXSproto(strcpy(buf, "SetDeity"), XS_Client_SetDeity, file, "$$");
newXSproto(strcpy(buf, "SetDueling"), XS_Client_SetDueling, file, "$$");
newXSproto(strcpy(buf, "SetDuelTarget"), XS_Client_SetDuelTarget, file, "$$");
newXSproto(strcpy(buf, "SetEbonCrystals"), XS_Client_SetEbonCrystals, file, "$$");
newXSproto(strcpy(buf, "SetEndurance"), XS_Client_SetEndurance, file, "$$");
newXSproto(strcpy(buf, "SetEXP"), XS_Client_SetEXP, file, "$$$;$");
newXSproto(strcpy(buf, "SetFactionLevel"), XS_Client_SetFactionLevel, file, "$$$$$$");
@ -6954,6 +6999,7 @@ XS(boot_Client) {
newXSproto(strcpy(buf, "SetMaterial"), XS_Client_SetMaterial, file, "$$$");
newXSproto(strcpy(buf, "SetPrimaryWeaponOrnamentation"), XS_Client_SetPrimaryWeaponOrnamentation, file, "$$");
newXSproto(strcpy(buf, "SetPVP"), XS_Client_SetPVP, file, "$$");
newXSproto(strcpy(buf, "SetRadiantCrystals"), XS_Client_SetRadiantCrystals, file, "$$");
newXSproto(strcpy(buf, "SetSecondaryWeaponOrnamentation"), XS_Client_SetSecondaryWeaponOrnamentation, file, "$$");
newXSproto(strcpy(buf, "SetSkill"), XS_Client_SetSkill, file, "$$$");
newXSproto(strcpy(buf, "SetSkillPoints"), XS_Client_SetSkillPoints, file, "$$");