diff --git a/zone/client.cpp b/zone/client.cpp index 1c577c08d2..f1c5cd23c0 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -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; +} diff --git a/zone/client.h b/zone/client.h index 5ce9df4d89..955bd1dbc5 100644 --- a/zone/client.h +++ b/zone/client.h @@ -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); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index e031d52089..07c2296cc7 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -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'; } } } diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 83e2a3fb3e..2dd71864e1 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -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_("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) diff --git a/zone/lua_client.h b/zone/lua_client.h index ed02e65927..3e2f332907 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -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); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 3cf1ad0d75..e74c1e59f3 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -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);