[Quest API] Add Bandolier Methods (#4635)

This commit is contained in:
Alex King 2025-02-03 05:03:27 -05:00 committed by GitHub
parent f466964db8
commit 1cf7709c9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 108 additions and 0 deletions

View File

@ -13450,3 +13450,48 @@ std::string Client::GetAccountBucketRemaining(std::string bucket_name)
return DataBucket::GetDataRemaining(k);
}
std::string Client::GetBandolierName(uint8 bandolier_slot)
{
if (!EQ::ValueWithin(bandolier_slot, 0, 3)) {
return std::string();
}
return GetPP().bandoliers[bandolier_slot].Name;
}
uint32 Client::GetBandolierItemIcon(uint8 bandolier_slot, uint8 slot_id)
{
if (
!EQ::ValueWithin(bandolier_slot, 0, 3) ||
!EQ::ValueWithin(slot_id, 0, 3)
) {
return 0;
}
return GetPP().bandoliers[bandolier_slot].Items[slot_id].Icon;
}
uint32 Client::GetBandolierItemID(uint8 bandolier_slot, uint8 slot_id)
{
if (
!EQ::ValueWithin(bandolier_slot, 0, 3) ||
!EQ::ValueWithin(slot_id, 0, 3)
) {
return 0;
}
return GetPP().bandoliers[bandolier_slot].Items[slot_id].ID;
}
std::string Client::GetBandolierItemName(uint8 bandolier_slot, uint8 slot_id)
{
if (
!EQ::ValueWithin(bandolier_slot, 0, 3) ||
!EQ::ValueWithin(slot_id, 0, 3)
) {
return std::string();
}
return GetPP().bandoliers[bandolier_slot].Items[slot_id].Name;
}

View File

@ -1863,6 +1863,11 @@ public:
std::string GetAccountBucketExpires(std::string bucket_name);
std::string GetAccountBucketRemaining(std::string bucket_name);
std::string GetBandolierName(uint8 bandolier_slot);
uint32 GetBandolierItemIcon(uint8 bandolier_slot, uint8 slot_id);
uint32 GetBandolierItemID(uint8 bandolier_slot, uint8 slot_id);
std::string GetBandolierItemName(uint8 bandolier_slot, uint8 slot_id);
protected:
friend class Mob;
void CalcEdibleBonuses(StatBonuses* newbon);

View File

@ -3247,12 +3247,14 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
LogInventory("Char: [{}] adding item [{}] to slot [{}]", GetName(),BaseItem->Name, WeaponSlot);
m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = BaseItem->ID;
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = BaseItem->Icon;
strncpy(m_pp.bandoliers[bs->Number].Items[BandolierSlot].Name, BaseItem->Name, sizeof(m_pp.bandoliers[bs->Number].Items[BandolierSlot].Name));
database.SaveCharacterBandolier(CharacterID(), bs->Number, BandolierSlot, m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID, m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon, bs->Name);
}
else {
LogInventory("Char: [{}] no item in slot [{}]", GetName(), WeaponSlot);
m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = 0;
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = 0;
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Name[0] = '\0';
}
}
}

View File

@ -3506,6 +3506,30 @@ std::string Lua_Client::GetAccountBucketRemaining(std::string bucket_name)
return self->GetAccountBucketRemaining(bucket_name);
}
std::string Lua_Client::GetBandolierName(uint8 bandolier_slot)
{
Lua_Safe_Call_String();
return self->GetBandolierName(bandolier_slot);
}
uint32 Lua_Client::GetBandolierItemIcon(uint8 bandolier_slot, uint8 slot_id)
{
Lua_Safe_Call_Int();
return self->GetBandolierItemIcon(bandolier_slot, slot_id);
}
uint32 Lua_Client::GetBandolierItemID(uint8 bandolier_slot, uint8 slot_id)
{
Lua_Safe_Call_Int();
return self->GetBandolierItemID(bandolier_slot, slot_id);
}
std::string Lua_Client::GetBandolierItemName(uint8 bandolier_slot, uint8 slot_id)
{
Lua_Safe_Call_String();
return self->GetBandolierItemName(bandolier_slot, slot_id);
}
luabind::scope lua_register_client() {
return luabind::class_<Lua_Client, Lua_Mob>("Client")
.def(luabind::constructor<>())
@ -3650,6 +3674,10 @@ luabind::scope lua_register_client() {
.def("GetAugmentIDAt", (int(Lua_Client::*)(int,int))&Lua_Client::GetAugmentIDAt)
.def("GetAugmentIDsBySlotID", (luabind::object(Lua_Client::*)(lua_State* L,int16))&Lua_Client::GetAugmentIDsBySlotID)
.def("GetAutoLoginCharacterName", (std::string(Lua_Client::*)(void))&Lua_Client::GetAutoLoginCharacterName)
.def("GetBandolierItemIcon", (uint32(Lua_Client::*)(uint8,uint8))&Lua_Client::GetBandolierItemIcon)
.def("GetBandolierItemID", (uint32(Lua_Client::*)(uint8,uint8))&Lua_Client::GetBandolierItemID)
.def("GetBandolierItemName", (std::string(Lua_Client::*)(uint8,uint8))&Lua_Client::GetBandolierItemName)
.def("GetBandolierName", (std::string(Lua_Client::*)(uint8))&Lua_Client::GetBandolierName)
.def("GetBaseAGI", (int(Lua_Client::*)(void))&Lua_Client::GetBaseAGI)
.def("GetBaseCHA", (int(Lua_Client::*)(void))&Lua_Client::GetBaseCHA)
.def("GetBaseDEX", (int(Lua_Client::*)(void))&Lua_Client::GetBaseDEX)

View File

@ -511,6 +511,10 @@ public:
void AreaTaunt(float range, int bonus_hate);
luabind::object GetInventorySlots(lua_State* L);
void SetAAEXPPercentage(uint8 percentage);
std::string GetBandolierName(uint8 bandolier_slot);
uint32 GetBandolierItemIcon(uint8 bandolier_slot, uint8 slot_id);
uint32 GetBandolierItemID(uint8 bandolier_slot, uint8 slot_id);
std::string GetBandolierItemName(uint8 bandolier_slot, uint8 slot_id);
// account data buckets
void SetAccountBucket(std::string bucket_name, std::string bucket_value);

View File

@ -3269,6 +3269,26 @@ std::string Perl_Client_GetAccountBucketRemaining(Client* self, std::string buck
return self->GetAccountBucketRemaining(bucket_name);
}
std::string Perl_Client_GetBandolierName(Client* self, uint8 bandolier_slot)
{
return self->GetBandolierName(bandolier_slot);
}
uint32 Perl_Client_GetBandolierItemIcon(Client* self, uint8 bandolier_slot, uint8 slot_id)
{
return self->GetBandolierItemIcon(bandolier_slot, slot_id);
}
uint32 Perl_Client_GetBandolierItemID(Client* self, uint8 bandolier_slot, uint8 slot_id)
{
return self->GetBandolierItemID(bandolier_slot, slot_id);
}
std::string Perl_Client_GetBandolierItemName(Client* self, uint8 bandolier_slot, uint8 slot_id)
{
return self->GetBandolierItemName(bandolier_slot, slot_id);
}
void perl_register_client()
{
perl::interpreter perl(PERL_GET_THX);
@ -3412,6 +3432,10 @@ void perl_register_client()
package.add("GetAugmentIDAt", &Perl_Client_GetAugmentIDAt);
package.add("GetAugmentIDsBySlotID", &Perl_Client_GetAugmentIDsBySlotID);
package.add("GetAutoLoginCharacterName", &Perl_Client_GetAutoLoginCharacterName);
package.add("GetBandolierItemIcon", &Perl_Client_GetBandolierItemIcon);
package.add("GetBandolierItemID", &Perl_Client_GetBandolierItemID);
package.add("GetBandolierItemName", &Perl_Client_GetBandolierItemName);
package.add("GetBandolierName", &Perl_Client_GetBandolierName);
package.add("GetBaseAGI", &Perl_Client_GetBaseAGI);
package.add("GetBaseCHA", &Perl_Client_GetBaseCHA);
package.add("GetBaseDEX", &Perl_Client_GetBaseDEX);