From 61aec683b5bbded472ec1953955961b9b94e86c9 Mon Sep 17 00:00:00 2001 From: Emagi Date: Fri, 21 Mar 2025 11:21:31 -0400 Subject: [PATCH] revert SendShowBook to fix /spawn details and other use of the book pages --- source/WorldServer/Bots/BotCommands.cpp | 4 ++-- source/WorldServer/Commands/Commands.cpp | 2 +- source/WorldServer/client.cpp | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/WorldServer/Bots/BotCommands.cpp b/source/WorldServer/Bots/BotCommands.cpp index 2fa9281..10934bb 100644 --- a/source/WorldServer/Bots/BotCommands.cpp +++ b/source/WorldServer/Bots/BotCommands.cpp @@ -767,7 +767,7 @@ void Commands::Command_Bot_Help(Client* client, Seperator* sep) { details += "18\tSarnak\n"; details += "19\tVampire\n"; details += "20\tAerakyn\n"; - client->SendShowBook(client->GetPlayer(), title, 0, 1, details.c_str()); + client->SendShowBook(client->GetPlayer(), title, 0, 1, details); return; } else if (strncasecmp("class", sep->arg[0], 5) == 0) { @@ -822,7 +822,7 @@ void Commands::Command_Bot_Help(Client* client, Seperator* sep) { details3 += "43\tSHAPER\n"; details3 += "44\tCHANNELER\n"; - client->SendShowBook(client->GetPlayer(), title, 0, 3, details.c_str(), details2.c_str(), details3.c_str()); + client->SendShowBook(client->GetPlayer(), title, 0, 3, details, details2, details3); return; } } diff --git a/source/WorldServer/Commands/Commands.cpp b/source/WorldServer/Commands/Commands.cpp index 3efb5a8..f50d124 100644 --- a/source/WorldServer/Commands/Commands.cpp +++ b/source/WorldServer/Commands/Commands.cpp @@ -4974,7 +4974,7 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie details4 += "\nSpawnScript: " + std::string(spawnScriptMsg) + "\n"; string title = string(spawn->GetName()) + "(" + to_string(spawn->GetDatabaseID()) + ")"; - client->SendShowBook(client->GetPlayer(), title, 0, 4, details.c_str(), details2.c_str(), details3.c_str(), details4.c_str()); + client->SendShowBook(client->GetPlayer(), title, 0, 4, details, details2, details3, details4); } else { client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn details (radius)"); diff --git a/source/WorldServer/client.cpp b/source/WorldServer/client.cpp index ef13469..708415c 100644 --- a/source/WorldServer/client.cpp +++ b/source/WorldServer/client.cpp @@ -12339,7 +12339,7 @@ void Client::SendShowBook(Spawn* sender, string title, int8 language, int8 num_p { if (!sender) { - LogWrite(CCLIENT__ERROR, 0, "Client", "SendShowBook missing sender for Player %s, book title %s", GetPlayer()->GetName(), title.c_str()); + LogWrite(CCLIENT__ERROR, 0, "Client", "SendShowBook missing sender for Player %s, book title %s", GetPlayer()->GetName(), title); return; } @@ -12365,14 +12365,14 @@ void Client::SendShowBook(Spawn* sender, string title, int8 language, int8 num_p std::string endString(""); for (int8 p = 0; p < num_pages; p++) { - const char* pageChars = va_arg(args, const char*); + std::string page = va_arg(args, string); switch (GetVersion()) { // release client case 283: case 373: // trial isle client { - endString.append(pageChars); + endString.append(page); break; } // DoF trial @@ -12380,15 +12380,15 @@ void Client::SendShowBook(Spawn* sender, string title, int8 language, int8 num_p case 561: { if (p == 0) - packet->setDataByName("cover_page", pageChars); + packet->setDataByName("cover_page", page.c_str()); else - packet->setArrayDataByName("page_text", pageChars, p - 1); + packet->setArrayDataByName("page_text", page.c_str(), p - 1); break; } // all other clients default: { - packet->setArrayDataByName("page_text", pageChars, p); + packet->setArrayDataByName("page_text", page.c_str(), p); break; } } @@ -12409,7 +12409,7 @@ void Client::SendShowBook(Spawn* sender, string title, int8 language, vectorGetName(), title.c_str()); + LogWrite(CCLIENT__ERROR, 0, "Client", "SendShowBook missing sender for Player %s, book title %s", GetPlayer()->GetName(), title); return; }