Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Quest API] Add Bandolier Methods #4635

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions zone/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13305,3 +13305,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;
}
5 changes: 5 additions & 0 deletions zone/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,11 @@ class Client : public Mob
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);
Expand Down
2 changes: 2 additions & 0 deletions zone/inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions zone/lua_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<>())
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions zone/lua_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,10 @@ class Lua_Client : public Lua_Mob
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);
Expand Down
24 changes: 24 additions & 0 deletions zone/perl_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down