[Feature] Add opcodes for Cast and Scribe book buttons (#3578)

This is just the packet framework for the Scribe button on recipe books
and the Cast Spell button on books that allow casting spells on
targets. It will need to be hooked up to a content implementation
This commit is contained in:
hg
2023-09-17 14:14:38 -04:00
committed by GitHub
parent bab16771aa
commit 604c7ad4ab
21 changed files with 180 additions and 52 deletions
+23
View File
@@ -145,6 +145,7 @@ void MapOpcodes()
ConnectedOpcodes[OP_Bind_Wound] = &Client::Handle_OP_Bind_Wound;
ConnectedOpcodes[OP_BlockedBuffs] = &Client::Handle_OP_BlockedBuffs;
ConnectedOpcodes[OP_BoardBoat] = &Client::Handle_OP_BoardBoat;
ConnectedOpcodes[OP_BookButton] = &Client::Handle_OP_BookButton;
ConnectedOpcodes[OP_Buff] = &Client::Handle_OP_Buff;
ConnectedOpcodes[OP_BuffRemoveRequest] = &Client::Handle_OP_BuffRemoveRequest;
ConnectedOpcodes[OP_Bug] = &Client::Handle_OP_Bug;
@@ -4130,6 +4131,28 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app)
return;
}
void Client::Handle_OP_BookButton(const EQApplicationPacket* app)
{
if (app->size != sizeof(BookButton_Struct))
{
LogError("Size mismatch in OP_BookButton. expected [{}] got [{}]", sizeof(BookButton_Struct), app->size);
DumpPacket(app);
return;
}
BookButton_Struct* book = reinterpret_cast<BookButton_Struct*>(app->pBuffer);
const EQ::ItemInstance* const inst = GetInv().GetItem(book->invslot);
if (inst && inst->GetItem()->Book)
{
// todo: if scribe book learn recipes and delete book from inventory
// todo: if cast book use its spell on target and delete book from inventory (unless reusable?)
}
EQApplicationPacket outapp(OP_FinishWindow, 0);
QueuePacket(&outapp);
}
void Client::Handle_OP_Buff(const EQApplicationPacket *app)
{
/*