mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 02:11:30 +00:00
Add DyeArmorBySlot(slot, red, green, blue, use_tint) to Perl/Lua.
This commit is contained in:
parent
f32126faac
commit
eed1fd8a43
@ -276,6 +276,7 @@ public:
|
||||
GetItems_Struct* GetTraderItems();
|
||||
void SendBazaarWelcome();
|
||||
void DyeArmor(EQ::TintProfile* dye);
|
||||
void DyeArmorBySlot(uint8 slot, uint8 red, uint8 green, uint8 blue, uint8 use_tint = 0x00);
|
||||
uint8 SlotConvert(uint8 slot,bool bracer=false);
|
||||
void MessageString(uint32 type, uint32 string_id, uint32 distance = 0);
|
||||
void MessageString(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
||||
|
||||
@ -2228,6 +2228,22 @@ void Client::DyeArmor(EQ::TintProfile* dye){
|
||||
|
||||
}
|
||||
|
||||
void Client::DyeArmorBySlot(uint8 slot, uint8 red, uint8 green, uint8 blue, uint8 use_tint) {
|
||||
uint8 item_slot = SlotConvert(slot);
|
||||
EQ::ItemInstance* item_instance = this->m_inv.GetItem(item_slot);
|
||||
if (item_instance) {
|
||||
uint32 armor_color = ((uint32)red << 16) | ((uint32)green << 8) | ((uint32)blue);
|
||||
item_instance->SetColor(armor_color);
|
||||
database.SaveCharacterMaterialColor(this->CharacterID(), slot, armor_color);
|
||||
database.SaveInventory(CharacterID(), item_instance, item_slot);
|
||||
m_pp.item_tint.Slot[slot].UseTint = (use_tint ? 0xFF : 0x00);
|
||||
}
|
||||
m_pp.item_tint.Slot[slot].Red = red;
|
||||
m_pp.item_tint.Slot[slot].Green = green;
|
||||
m_pp.item_tint.Slot[slot].Blue = blue;
|
||||
SendWearChange(slot);
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool Client::DecreaseByItemType(uint32 type, uint8 amt) {
|
||||
const ItemData* TempItem = 0;
|
||||
|
||||
@ -75,6 +75,16 @@ void Lua_Client::Duck() {
|
||||
self->Duck();
|
||||
}
|
||||
|
||||
void Lua_Client::DyeArmorBySlot(uint8 slot, uint8 red, uint8 green, uint8 blue) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->DyeArmorBySlot(slot, red, green, blue);
|
||||
}
|
||||
|
||||
void Lua_Client::DyeArmorBySlot(uint8 slot, uint8 red, uint8 green, uint8 blue, uint8 use_tint) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->DyeArmorBySlot(slot, red, green, blue, use_tint);
|
||||
}
|
||||
|
||||
void Lua_Client::Stand() {
|
||||
Lua_Safe_Call_Void();
|
||||
self->Stand();
|
||||
@ -1622,6 +1632,8 @@ luabind::scope lua_register_client() {
|
||||
.def("SendToGuildHall", (void(Lua_Client::*)(void))&Lua_Client::SendToGuildHall)
|
||||
.def("GetAnon", (bool(Lua_Client::*)(void))&Lua_Client::GetAnon)
|
||||
.def("Duck", (void(Lua_Client::*)(void))&Lua_Client::Duck)
|
||||
.def("DyeArmorBySlot", (void(Lua_Client::*)(uint8,uint8,uint8,uint8))&Lua_Client::DyeArmorBySlot)
|
||||
.def("DyeArmorBySlot", (void(Lua_Client::*)(uint8,uint8,uint8,uint8,uint8))&Lua_Client::DyeArmorBySlot)
|
||||
.def("Stand", (void(Lua_Client::*)(void))&Lua_Client::Stand)
|
||||
.def("SetGM", (void(Lua_Client::*)(bool))&Lua_Client::SetGM)
|
||||
.def("SetPVP", (void(Lua_Client::*)(bool))&Lua_Client::SetPVP)
|
||||
|
||||
@ -42,6 +42,8 @@ public:
|
||||
void SendToGuildHall();
|
||||
bool GetAnon();
|
||||
void Duck();
|
||||
void DyeArmorBySlot(uint8 slot, uint8 red, uint8 green, uint8 blue);
|
||||
void DyeArmorBySlot(uint8 slot, uint8 red, uint8 green, uint8 blue, uint8 use_tint);
|
||||
void Stand();
|
||||
void SetGM(bool v);
|
||||
void SetPVP(bool v);
|
||||
|
||||
@ -312,6 +312,34 @@ XS(XS_Client_Duck) {
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_DyeArmorBySlot); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_DyeArmorBySlot) {
|
||||
dXSARGS;
|
||||
if (items != 5 && items != 6)
|
||||
Perl_croak(aTHX_ "Usage: Client::DyeArmorBySlot(THIS, uint8 slot, uint8 red, uint8 green, uint8 blue, [uint8 use_tint = 0x00])");
|
||||
{
|
||||
Client *THIS;
|
||||
uint8 slot = (uint8) SvUV(ST(1));
|
||||
uint8 red = (uint8) SvUV(ST(2));
|
||||
uint8 green = (uint8) SvUV(ST(3));
|
||||
uint8 blue = (uint8) SvUV(ST(4));
|
||||
uint8 use_tint = 0x00;
|
||||
if (items == 6) {
|
||||
use_tint = (uint8) SvUV(ST(5));
|
||||
}
|
||||
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->DyeArmorBySlot(slot, red, green, blue, use_tint);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_Stand); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_Stand) {
|
||||
dXSARGS;
|
||||
@ -6585,6 +6613,7 @@ XS(boot_Client) {
|
||||
newXSproto(strcpy(buf, "Disconnect"), XS_Client_Disconnect, file, "$");
|
||||
newXSproto(strcpy(buf, "DropItem"), XS_Client_DropItem, file, "$$");
|
||||
newXSproto(strcpy(buf, "Duck"), XS_Client_Duck, file, "$");
|
||||
newXSproto(strcpy(buf, "DyeArmorBySlot"), XS_Client_DyeArmorBySlot, file, "$$$$$;$");
|
||||
newXSproto(strcpy(buf, "Escape"), XS_Client_Escape, file, "$");
|
||||
newXSproto(strcpy(buf, "ExpeditionMessage"), XS_Client_ExpeditionMessage, file, "$$$");
|
||||
newXSproto(strcpy(buf, "FailTask"), XS_Client_FailTask, file, "$$");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user