mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Feature] Add Support for Item Previews (#4599)
* [Feature] Add Support for Item Previews * Update client_packet.cpp
This commit is contained in:
parent
37a7b7fc41
commit
75698a809f
@ -290,6 +290,7 @@ N(OP_ItemLinkText),
|
||||
N(OP_ItemName),
|
||||
N(OP_ItemPacket),
|
||||
N(OP_ItemPreview),
|
||||
N(OP_ItemPreviewRequest),
|
||||
N(OP_ItemRecastDelay),
|
||||
N(OP_ItemVerifyReply),
|
||||
N(OP_ItemVerifyRequest),
|
||||
|
||||
@ -5188,7 +5188,14 @@ namespace RoF
|
||||
|
||||
//sprintf(hdr.unknown000, "06e0002Y1W00");
|
||||
|
||||
snprintf(hdr.unknown000, sizeof(hdr.unknown000), "%016d", item->ID);
|
||||
strn0cpy(
|
||||
hdr.unknown000,
|
||||
fmt::format(
|
||||
"{:016}\0",
|
||||
packet_type == ItemPacketInvalid ? 0 : inst->GetSerialNumber()
|
||||
).c_str(),
|
||||
sizeof(hdr.unknown000)
|
||||
);
|
||||
|
||||
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 1000) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
|
||||
hdr.unknown004 = 0;
|
||||
|
||||
@ -2105,6 +2105,33 @@ namespace RoF2
|
||||
}
|
||||
}
|
||||
|
||||
ENCODE(OP_ItemPreviewRequest)
|
||||
{
|
||||
EQApplicationPacket* in = *p;
|
||||
*p = nullptr;
|
||||
|
||||
uchar* in_buf = in->pBuffer;
|
||||
|
||||
auto int_item = (EQ::InternalSerializedItem_Struct*) in_buf;
|
||||
|
||||
EQ::OutBuffer buf;
|
||||
EQ::OutBuffer::pos_type last_pos = buf.tellp();
|
||||
|
||||
SerializeItem(buf, (const EQ::ItemInstance*) int_item->inst, int_item->slot_id, 0, ItemPacketInvalid);
|
||||
if (buf.tellp() == last_pos) {
|
||||
LogNetcode("RoF2::ENCODE(OP_ItemPreviewRequest) Serialization failed");
|
||||
safe_delete_array(in_buf);
|
||||
safe_delete(in);
|
||||
return;
|
||||
}
|
||||
|
||||
in->size = buf.size();
|
||||
in->pBuffer = buf.detach();
|
||||
|
||||
safe_delete_array(in_buf);
|
||||
dest->FastQueuePacket(&in, ack_req);
|
||||
}
|
||||
|
||||
ENCODE(OP_ItemVerifyReply)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct);
|
||||
@ -6857,12 +6884,13 @@ namespace RoF2
|
||||
iqbs.Heirloom = 0;
|
||||
iqbs.Placeable = 0;
|
||||
iqbs.unknown28 = -1;
|
||||
iqbs.unknown29 = packet_type == ItemPacketInvalid ? 0xFF : 0;
|
||||
iqbs.unknown30 = -1;
|
||||
iqbs.NoZone = 0;
|
||||
iqbs.NoGround = 0;
|
||||
iqbs.unknown37a = 0; // (guessed position) New to RoF2
|
||||
iqbs.unknown38 = 0;
|
||||
iqbs.unknown39 = 1;
|
||||
iqbs.unknown39 = packet_type == ItemPacketInvalid ? 0 : 1;;
|
||||
|
||||
ob.write((const char*)&iqbs, sizeof(RoF2::structs::ItemQuaternaryBodyStruct));
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -92,6 +92,7 @@ E(OP_InspectBuffs)
|
||||
E(OP_InspectRequest)
|
||||
E(OP_ItemLinkResponse)
|
||||
E(OP_ItemPacket)
|
||||
E(OP_ItemPreviewRequest)
|
||||
E(OP_ItemVerifyReply)
|
||||
E(OP_LeadershipExpUpdate)
|
||||
E(OP_LogServer)
|
||||
|
||||
@ -261,6 +261,7 @@ OP_ItemPacket=0x368e
|
||||
OP_ItemLinkResponse=0x70c0
|
||||
OP_ItemLinkClick=0x4cef
|
||||
OP_ItemPreview=0x6b5c
|
||||
OP_ItemPreviewRequest=0x7f80
|
||||
OP_NewSpawn=0x6097
|
||||
OP_Track=0x17e5
|
||||
OP_TrackTarget=0x695e
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -283,6 +283,7 @@ void MapOpcodes()
|
||||
ConnectedOpcodes[OP_ItemLinkResponse] = &Client::Handle_OP_ItemLinkResponse;
|
||||
ConnectedOpcodes[OP_ItemName] = &Client::Handle_OP_ItemName;
|
||||
ConnectedOpcodes[OP_ItemPreview] = &Client::Handle_OP_ItemPreview;
|
||||
ConnectedOpcodes[OP_ItemPreviewRequest] = &Client::Handle_OP_ItemPreviewRequest;
|
||||
ConnectedOpcodes[OP_ItemVerifyRequest] = &Client::Handle_OP_ItemVerifyRequest;
|
||||
ConnectedOpcodes[OP_ItemViewUnknown] = &Client::Handle_OP_Ignore;
|
||||
ConnectedOpcodes[OP_Jump] = &Client::Handle_OP_Jump;
|
||||
@ -9300,6 +9301,30 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_ItemPreviewRequest(const EQApplicationPacket* app)
|
||||
{
|
||||
VERIFY_PACKET_LENGTH(OP_ItemPreviewRequest, app, ItemPreview_Struct);
|
||||
auto ips = (ItemPreview_Struct*) app->pBuffer;
|
||||
const EQ::ItemData* item = database.GetItem(ips->itemid);
|
||||
|
||||
if (item) {
|
||||
EQ::ItemInstance* inst = database.CreateItem(item);
|
||||
if (inst) {
|
||||
std::string packet = inst->Serialize(-1);
|
||||
auto outapp = new EQApplicationPacket(OP_ItemPreviewRequest, packet.length());
|
||||
memcpy(outapp->pBuffer, packet.c_str(), packet.length());
|
||||
|
||||
#if EQDEBUG >= 9
|
||||
DumpPacket(outapp);
|
||||
#endif
|
||||
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
safe_delete(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
||||
{
|
||||
using EQ::spells::CastingSlot;
|
||||
|
||||
@ -189,6 +189,7 @@
|
||||
void Handle_OP_ItemLinkResponse(const EQApplicationPacket *app);
|
||||
void Handle_OP_ItemName(const EQApplicationPacket *app);
|
||||
void Handle_OP_ItemPreview(const EQApplicationPacket *app);
|
||||
void Handle_OP_ItemPreviewRequest(const EQApplicationPacket *app);
|
||||
void Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app);
|
||||
void Handle_OP_Jump(const EQApplicationPacket *app);
|
||||
void Handle_OP_KeyRing(const EQApplicationPacket *app);
|
||||
|
||||
@ -896,6 +896,7 @@ luabind::scope lua_register_packet_opcodes() {
|
||||
luabind::value("Weblink", static_cast<int>(OP_Weblink)),
|
||||
luabind::value("InspectMessageUpdate", static_cast<int>(OP_InspectMessageUpdate)),
|
||||
luabind::value("ItemPreview", static_cast<int>(OP_ItemPreview)),
|
||||
luabind::value("ItemPreviewRequest", static_cast<int>(OP_ItemPreviewRequest)),
|
||||
luabind::value("MercenaryDataRequest", static_cast<int>(OP_MercenaryDataRequest)),
|
||||
luabind::value("MercenaryDataResponse", static_cast<int>(OP_MercenaryDataResponse)),
|
||||
luabind::value("MercenaryHire", static_cast<int>(OP_MercenaryHire)),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user