mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Merge fix
This commit is contained in:
+45
-16
@@ -30,7 +30,7 @@
|
||||
#include "../eq_packet_structs.h"
|
||||
#include "../misc_functions.h"
|
||||
#include "../string_util.h"
|
||||
#include "../item.h"
|
||||
#include "../item_instance.h"
|
||||
#include "titanium_structs.h"
|
||||
|
||||
#include <sstream>
|
||||
@@ -42,7 +42,7 @@ namespace Titanium
|
||||
static OpcodeManager *opcodes = nullptr;
|
||||
static Strategy struct_strategy;
|
||||
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth);
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth);
|
||||
|
||||
// server to client inventory location converters
|
||||
static inline int16 ServerToTitaniumSlot(uint32 serverSlot);
|
||||
@@ -61,6 +61,9 @@ namespace Titanium
|
||||
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
|
||||
|
||||
static inline int ServerToTitaniumBuffSlot(int index);
|
||||
static inline int TitaniumToServerBuffSlot(int index);
|
||||
|
||||
void Register(EQStreamIdentifier &into)
|
||||
{
|
||||
auto Config = EQEmuConfig::get();
|
||||
@@ -270,7 +273,7 @@ namespace Titanium
|
||||
OUT(buff.duration);
|
||||
OUT(buff.counters);
|
||||
OUT(buff.player_id);
|
||||
OUT(slotid);
|
||||
eq->slotid = ServerToTitaniumBuffSlot(emu->slotid);
|
||||
OUT(bufffade);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -329,7 +332,7 @@ namespace Titanium
|
||||
EQEmu::OutBuffer::pos_type last_pos = ob.tellp();
|
||||
|
||||
for (int r = 0; r < itemcount; r++, eq++) {
|
||||
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
|
||||
if (ob.tellp() == last_pos)
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
|
||||
|
||||
@@ -815,7 +818,7 @@ namespace Titanium
|
||||
|
||||
ob.write((const char*)__emu_buffer, 4);
|
||||
|
||||
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
|
||||
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
|
||||
if (ob.tellp() == last_pos) {
|
||||
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
|
||||
delete in;
|
||||
@@ -981,7 +984,7 @@ namespace Titanium
|
||||
OUT(hairstyle);
|
||||
OUT(beard);
|
||||
// OUT(unknown00178[10]);
|
||||
for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) {
|
||||
for (r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) {
|
||||
OUT(item_material.Slot[r].Material);
|
||||
OUT(item_tint.Slot[r].Color);
|
||||
}
|
||||
@@ -1301,14 +1304,14 @@ namespace Titanium
|
||||
if (eq->Race[char_index] > 473)
|
||||
eq->Race[char_index] = 1;
|
||||
|
||||
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
|
||||
for (int index = 0; index < EQEmu::textures::materialCount; ++index) {
|
||||
eq->CS_Colors[char_index].Slot[index].Color = emu_cse->Equip[index].Color;
|
||||
}
|
||||
|
||||
eq->BeardColor[char_index] = emu_cse->BeardColor;
|
||||
eq->HairStyle[char_index] = emu_cse->HairStyle;
|
||||
|
||||
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
|
||||
for (int index = 0; index < EQEmu::textures::materialCount; ++index) {
|
||||
eq->Equip[char_index].Slot[index].Material = emu_cse->Equip[index].Material;
|
||||
}
|
||||
|
||||
@@ -1338,14 +1341,14 @@ namespace Titanium
|
||||
for (; char_index < 10; ++char_index) {
|
||||
eq->Race[char_index] = 0;
|
||||
|
||||
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
|
||||
for (int index = 0; index < EQEmu::textures::materialCount; ++index) {
|
||||
eq->CS_Colors[char_index].Slot[index].Color = 0;
|
||||
}
|
||||
|
||||
eq->BeardColor[char_index] = 0;
|
||||
eq->HairStyle[char_index] = 0;
|
||||
|
||||
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
|
||||
for (int index = 0; index < EQEmu::textures::materialCount; ++index) {
|
||||
eq->Equip[char_index].Slot[index].Material = 0;
|
||||
}
|
||||
|
||||
@@ -1677,7 +1680,7 @@ namespace Titanium
|
||||
eq->petOwnerId = emu->petOwnerId;
|
||||
eq->guildrank = emu->guildrank;
|
||||
// eq->unknown0194[3] = emu->unknown0194[3];
|
||||
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
|
||||
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) {
|
||||
eq->equipment.Slot[k].Material = emu->equipment.Slot[k].Material;
|
||||
eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color;
|
||||
}
|
||||
@@ -1779,7 +1782,7 @@ namespace Titanium
|
||||
IN(buff.duration);
|
||||
IN(buff.counters);
|
||||
IN(buff.player_id);
|
||||
IN(slotid);
|
||||
emu->slotid = TitaniumToServerBuffSlot(eq->slotid);
|
||||
IN(bufffade);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
@@ -2216,10 +2219,10 @@ namespace Titanium
|
||||
}
|
||||
|
||||
// file scope helper methods
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
|
||||
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
|
||||
{
|
||||
const char* protection = "\\\\\\\\\\";
|
||||
const EQEmu::ItemBase* item = inst->GetUnscaledItem();
|
||||
const EQEmu::ItemData* item = inst->GetUnscaledItem();
|
||||
|
||||
ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For leading quotes (and protection) if a subitem;
|
||||
|
||||
@@ -2437,10 +2440,10 @@ namespace Titanium
|
||||
ob << StringFormat("%.*s\"", depth, protection); // Quotes (and protection, if needed) around static data
|
||||
|
||||
// Sub data
|
||||
for (int index = SUB_INDEX_BEGIN; index < invbag::ItemBagSize; ++index) {
|
||||
for (int index = EQEmu::inventory::containerBegin; index < invbag::ItemBagSize; ++index) {
|
||||
ob << '|';
|
||||
|
||||
ItemInst* sub = inst->GetItem(index);
|
||||
EQEmu::ItemInstance* sub = inst->GetItem(index);
|
||||
if (!sub)
|
||||
continue;
|
||||
|
||||
@@ -2632,4 +2635,30 @@ namespace Titanium
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int ServerToTitaniumBuffSlot(int index)
|
||||
{
|
||||
// we're a disc
|
||||
if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs)
|
||||
return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs +
|
||||
constants::LongBuffs + constants::ShortBuffs;
|
||||
// we're a song
|
||||
if (index >= EQEmu::constants::LongBuffs)
|
||||
return index - EQEmu::constants::LongBuffs + constants::LongBuffs;
|
||||
// we're a normal buff
|
||||
return index; // as long as we guard against bad slots server side, we should be fine
|
||||
}
|
||||
|
||||
static inline int TitaniumToServerBuffSlot(int index)
|
||||
{
|
||||
// we're a disc
|
||||
if (index >= constants::LongBuffs + constants::ShortBuffs)
|
||||
return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs +
|
||||
EQEmu::constants::ShortBuffs;
|
||||
// we're a song
|
||||
if (index >= constants::LongBuffs)
|
||||
return index - constants::LongBuffs + EQEmu::constants::LongBuffs;
|
||||
// we're a normal buff
|
||||
return index; // as long as we guard against bad slots server side, we should be fine
|
||||
}
|
||||
} /*Titanium*/
|
||||
|
||||
Reference in New Issue
Block a user