mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-01 07:12:26 +00:00
Merge pull request #446 from KinglyKrab/master
Added $client->GetMoney(type, subtype) to Perl/Lua.
This commit is contained in:
commit
4106251497
@ -8592,3 +8592,79 @@ void Client::SendHPUpdateMarquee(){
|
|||||||
std::string health_update_notification = StringFormat("Health: %u%%", health_percentage);
|
std::string health_update_notification = StringFormat("Health: %u%%", health_percentage);
|
||||||
this->SendMarqueeMessage(15, 510, 0, 3000, 3000, health_update_notification);
|
this->SendMarqueeMessage(15, 510, 0, 3000, 3000, health_update_notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 Client::GetMoney(uint8 type, uint8 subtype) {
|
||||||
|
uint32 value = 0;
|
||||||
|
switch (type) {
|
||||||
|
case 0: {
|
||||||
|
switch (subtype) {
|
||||||
|
case 0:
|
||||||
|
value = static_cast<uint32>(m_pp.copper);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
value = static_cast<uint32>(m_pp.copper_bank);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
value = static_cast<uint32>(m_pp.copper_cursor);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
switch (subtype) {
|
||||||
|
case 0:
|
||||||
|
value = static_cast<uint32>(m_pp.silver);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
value = static_cast<uint32>(m_pp.silver_bank);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
value = static_cast<uint32>(m_pp.silver_cursor);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
switch (subtype) {
|
||||||
|
case 0:
|
||||||
|
value = static_cast<uint32>(m_pp.gold);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
value = static_cast<uint32>(m_pp.gold_bank);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
value = static_cast<uint32>(m_pp.gold_cursor);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
switch (subtype) {
|
||||||
|
case 0:
|
||||||
|
value = static_cast<uint32>(m_pp.platinum);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
value = static_cast<uint32>(m_pp.platinum_bank);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
value = static_cast<uint32>(m_pp.platinum_cursor);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
value = static_cast<uint32>(m_pp.platinum_shared);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
@ -663,6 +663,7 @@ public:
|
|||||||
bool HasMoney(uint64 copper);
|
bool HasMoney(uint64 copper);
|
||||||
uint64 GetCarriedMoney();
|
uint64 GetCarriedMoney();
|
||||||
uint64 GetAllMoney();
|
uint64 GetAllMoney();
|
||||||
|
uint32 GetMoney(uint8 type, uint8 subtype);
|
||||||
|
|
||||||
bool IsDiscovered(uint32 itemid);
|
bool IsDiscovered(uint32 itemid);
|
||||||
void DiscoverItem(uint32 itemid);
|
void DiscoverItem(uint32 itemid);
|
||||||
|
|||||||
@ -1315,6 +1315,11 @@ void Lua_Client::QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint3
|
|||||||
self->QuestReward(target, copper, silver, gold, platinum, itemid, exp, faction);
|
self->QuestReward(target, copper, silver, gold, platinum, itemid, exp, faction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 Lua_Client::GetMoney(uint8 type, uint8 subtype) {
|
||||||
|
Lua_Safe_Call_Int();
|
||||||
|
return self->GetMoney(type, subtype);
|
||||||
|
}
|
||||||
|
|
||||||
luabind::scope lua_register_client() {
|
luabind::scope lua_register_client() {
|
||||||
return luabind::class_<Lua_Client, Lua_Mob>("Client")
|
return luabind::class_<Lua_Client, Lua_Mob>("Client")
|
||||||
.def(luabind::constructor<>())
|
.def(luabind::constructor<>())
|
||||||
@ -1576,7 +1581,8 @@ luabind::scope lua_register_client() {
|
|||||||
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
|
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
|
||||||
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
|
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
|
||||||
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
|
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
|
||||||
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32, bool))&Lua_Client::QuestReward);
|
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32, bool))&Lua_Client::QuestReward)
|
||||||
|
.def("GetMoney", (uint32(Lua_Client::*)(uint8, uint8))&Lua_Client::GetMoney);
|
||||||
}
|
}
|
||||||
|
|
||||||
luabind::scope lua_register_inventory_where() {
|
luabind::scope lua_register_inventory_where() {
|
||||||
|
|||||||
@ -256,6 +256,7 @@ public:
|
|||||||
int GetAggroCount();
|
int GetAggroCount();
|
||||||
uint64 GetCarriedMoney();
|
uint64 GetCarriedMoney();
|
||||||
uint64 GetAllMoney();
|
uint64 GetAllMoney();
|
||||||
|
uint32 GetMoney(uint8 type, uint8 subtype);
|
||||||
void OpenLFGuildWindow();
|
void OpenLFGuildWindow();
|
||||||
void Signal(uint32 id);
|
void Signal(uint32 id);
|
||||||
void AddAlternateCurrencyValue(uint32 currency, int amount);
|
void AddAlternateCurrencyValue(uint32 currency, int amount);
|
||||||
|
|||||||
@ -6280,6 +6280,36 @@ XS(XS_Client_QuestReward)
|
|||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XS(XS_Client_GetMoney);
|
||||||
|
XS(XS_Client_GetMoney)
|
||||||
|
{
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 3)
|
||||||
|
Perl_croak(aTHX_ "Usage: GetMoney(THIS, type, subtype)");
|
||||||
|
{
|
||||||
|
Client* THIS;
|
||||||
|
uint32 RETVAL;
|
||||||
|
uint8 type = (uint8)SvUV(ST(1));
|
||||||
|
uint8 subtype = (uint8)SvUV(ST(2));
|
||||||
|
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->GetMoney(type, subtype);
|
||||||
|
XSprePUSH; PUSHn((uint32)RETVAL);
|
||||||
|
}
|
||||||
|
XSRETURN(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
@ -6527,6 +6557,7 @@ XS(boot_Client)
|
|||||||
newXSproto(strcpy(buf, "GetTargetRingZ"), XS_Client_GetTargetRingZ, file, "$$");
|
newXSproto(strcpy(buf, "GetTargetRingZ"), XS_Client_GetTargetRingZ, file, "$$");
|
||||||
newXSproto(strcpy(buf, "QuestReward"), XS_Client_QuestReward, file, "$$;$$$$$$$");
|
newXSproto(strcpy(buf, "QuestReward"), XS_Client_QuestReward, file, "$$;$$$$$$$");
|
||||||
newXSproto(strcpy(buf, "CalcEXP"), XS_Client_CalcEXP, file, "$");
|
newXSproto(strcpy(buf, "CalcEXP"), XS_Client_CalcEXP, file, "$");
|
||||||
|
newXSproto(strcpy(buf, "GetMoney"), XS_Client_GetMoney, file, "$$$");
|
||||||
XSRETURN_YES;
|
XSRETURN_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user