diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index ab0447cb8..fc1c9f9e7 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -30,6 +30,7 @@ static const uint32 BUFF_COUNT = 25; +static const uint32 PET_BUFF_COUNT = 30; static const uint32 MAX_MERC = 100; static const uint32 MAX_MERC_GRADES = 10; static const uint32 MAX_MERC_STANCES = 10; @@ -522,8 +523,8 @@ struct BuffRemoveRequest_Struct struct PetBuff_Struct { /*000*/ uint32 petid; -/*004*/ uint32 spellid[BUFF_COUNT+5]; -/*124*/ int32 ticsremaining[BUFF_COUNT+5]; +/*004*/ uint32 spellid[PET_BUFF_COUNT]; +/*124*/ int32 ticsremaining[PET_BUFF_COUNT]; /*244*/ uint32 buffcount; }; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index b7cde6af8..bee434ec3 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2012,18 +2012,18 @@ namespace RoF __packet->WriteUInt8(1); // 1 indicates all buffs on the pet (0 to add or remove a single buff) __packet->WriteUInt16(emu->buffcount); - for (uint16 i = 0; i < BUFF_COUNT; ++i) + for (uint16 i = 0; i < PET_BUFF_COUNT; ++i) { if (emu->spellid[i]) { __packet->WriteUInt32(i); __packet->WriteUInt32(emu->spellid[i]); __packet->WriteUInt32(emu->ticsremaining[i]); - __packet->WriteUInt32(0); // Unknown + __packet->WriteUInt32(0); // numhits __packet->WriteString(""); } } - __packet->WriteUInt8(0); // Unknown + __packet->WriteUInt8(0); // some sort of type FINISH_ENCODE(); } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 1699eefae..52fdeb02b 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2099,18 +2099,18 @@ namespace RoF2 __packet->WriteUInt8(1); // 1 indicates all buffs on the pet (0 to add or remove a single buff) __packet->WriteUInt16(emu->buffcount); - for (uint16 i = 0; i < BUFF_COUNT; ++i) + for (uint16 i = 0; i < PET_BUFF_COUNT; ++i) { if (emu->spellid[i]) { __packet->WriteUInt32(i); __packet->WriteUInt32(emu->spellid[i]); __packet->WriteUInt32(emu->ticsremaining[i]); - __packet->WriteUInt32(0); // Unknown + __packet->WriteUInt32(0); // num hits __packet->WriteString(""); } } - __packet->WriteUInt8(0); // Unknown + __packet->WriteUInt8(0); // some sort of type FINISH_ENCODE(); } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 52bbdc309..4def89212 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1502,7 +1502,7 @@ namespace SoD VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->petid); VARSTRUCT_ENCODE_TYPE(uint16, Buffer, emu->buffcount); - for (unsigned int i = 0; i < BUFF_COUNT; ++i) + for (unsigned int i = 0; i < PET_BUFF_COUNT; ++i) { if (emu->spellid[i]) { @@ -1513,7 +1513,7 @@ namespace SoD } } - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->buffcount); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->buffcount); // I think this is actually some sort of type delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 4f804bb03..a34e5029a 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1177,9 +1177,9 @@ namespace SoF OUT(petid); OUT(buffcount); - int EQBuffSlot = 0; + int EQBuffSlot = 0; // do we really want to shuffle them around like this? - for (uint32 EmuBuffSlot = 0; EmuBuffSlot < BUFF_COUNT; ++EmuBuffSlot) + for (uint32 EmuBuffSlot = 0; EmuBuffSlot < PET_BUFF_COUNT; ++EmuBuffSlot) { if (emu->spellid[EmuBuffSlot]) { diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 28984a26f..cc10f6487 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -891,9 +891,9 @@ namespace Titanium OUT(petid); OUT(buffcount); - int EQBuffSlot = 0; + int EQBuffSlot = 0; // do we really want to shuffle them around like this? - for (uint32 EmuBuffSlot = 0; EmuBuffSlot < BUFF_COUNT; ++EmuBuffSlot) + for (uint32 EmuBuffSlot = 0; EmuBuffSlot < PET_BUFF_COUNT; ++EmuBuffSlot) { if (emu->spellid[EmuBuffSlot]) { diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 735243f09..3e03c8bb2 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1764,18 +1764,18 @@ namespace UF VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 1); VARSTRUCT_ENCODE_TYPE(uint16, Buffer, emu->buffcount); - for (unsigned int i = 0; i < BUFF_COUNT; ++i) + for (unsigned int i = 0; i < PET_BUFF_COUNT; ++i) { if (emu->spellid[i]) { VARSTRUCT_ENCODE_TYPE(uint32, Buffer, i); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->spellid[i]); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->ticsremaining[i]); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // numhits VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // This is a string. Name of the caster of the buff. } } - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->buffcount); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->buffcount); /// I think this is actually some sort of type delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); diff --git a/common/ruletypes.h b/common/ruletypes.h index 41dbeacd2..1a64b1ebd 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -329,7 +329,7 @@ RULE_INT(Spells, MaxBuffSlotsNPC, 25) RULE_INT(Spells, MaxSongSlotsNPC, 10) RULE_INT(Spells, MaxDiscSlotsNPC, 1) RULE_INT(Spells, MaxTotalSlotsNPC, 36) -RULE_INT(Spells, MaxTotalSlotsPET, 25) // do not set this higher than 25 until the player profile is removed from the blob +RULE_INT(Spells, MaxTotalSlotsPET, 30) // do not set this higher than 25 until the player profile is removed from the blob RULE_BOOL (Spells, EnableBlockedBuffs, true) RULE_INT(Spells, ReflectType, 1) //0 = disabled, 1 = single target player spells only, 2 = all player spells, 3 = all single target spells, 4 = all spells RULE_INT(Spells, VirusSpreadDistance, 30) // The distance a viral spell will jump to its next victim diff --git a/zone/bot.cpp b/zone/bot.cpp index e4c9f0038..14acc9b57 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1709,8 +1709,8 @@ bool Bot::LoadPet() NPC *pet_inst = GetPet()->CastToNPC(); - SpellBuff_Struct pet_buffs[BUFF_COUNT]; - memset(pet_buffs, 0, (sizeof(SpellBuff_Struct) * BUFF_COUNT)); + SpellBuff_Struct pet_buffs[PET_BUFF_COUNT]; + memset(pet_buffs, 0, (sizeof(SpellBuff_Struct) * PET_BUFF_COUNT)); if (!botdb.LoadPetBuffs(GetBotID(), pet_buffs)) bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetBuffs(), GetCleanName()); @@ -1741,11 +1741,11 @@ bool Bot::SavePet() return false; char* pet_name = new char[64]; - SpellBuff_Struct pet_buffs[BUFF_COUNT]; + SpellBuff_Struct pet_buffs[PET_BUFF_COUNT]; uint32 pet_items[EQEmu::legacy::EQUIPMENT_SIZE]; memset(pet_name, 0, 64); - memset(pet_buffs, 0, (sizeof(SpellBuff_Struct) * BUFF_COUNT)); + memset(pet_buffs, 0, (sizeof(SpellBuff_Struct) * PET_BUFF_COUNT)); memset(pet_items, 0, (sizeof(uint32) * EQEmu::legacy::EQUIPMENT_SIZE)); pet_inst->GetPetState(pet_buffs, pet_items, pet_name); diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 300f4c8b4..db9827a8a 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -1472,7 +1472,7 @@ bool BotDatabase::LoadPetBuffs(const uint32 bot_id, SpellBuff_Struct* pet_buffs) return true; int buff_index = 0; - for (auto row = results.begin(); row != results.end() && buff_index < BUFF_COUNT; ++row) { + for (auto row = results.begin(); row != results.end() && buff_index < PET_BUFF_COUNT; ++row) { pet_buffs[buff_index].spellid = atoi(row[0]); pet_buffs[buff_index].level = atoi(row[1]); pet_buffs[buff_index].duration = atoi(row[2]); @@ -1509,7 +1509,7 @@ bool BotDatabase::SavePetBuffs(const uint32 bot_id, const SpellBuff_Struct* pet_ if (!saved_pet_index) return true; - for (int buff_index = 0; buff_index < BUFF_COUNT; ++buff_index) { + for (int buff_index = 0; buff_index < PET_BUFF_COUNT; ++buff_index) { if (!pet_buffs[buff_index].spellid || pet_buffs[buff_index].spellid == SPELL_UNKNOWN) continue; diff --git a/zone/spells.cpp b/zone/spells.cpp index fbda108f0..60837381e 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5368,8 +5368,8 @@ void Mob::SendPetBuffsToClient() int MaxSlots = GetMaxTotalSlots(); - if(MaxSlots > BUFF_COUNT) - MaxSlots = BUFF_COUNT; + if(MaxSlots > PET_BUFF_COUNT) + MaxSlots = PET_BUFF_COUNT; for(int buffslot = 0; buffslot < MaxSlots; buffslot++) { diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index d0c80f37f..7f86f5110 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3178,7 +3178,8 @@ void ZoneDatabase::SavePetInfo(Client *client) query.clear(); // pet buffs! - for (int index = 0; index < RuleI(Spells, MaxTotalSlotsPET); index++) { + int max_slots = RuleI(Spells, MaxTotalSlotsPET); + for (int index = 0; index < max_slots; index++) { if (petinfo->Buffs[index].spellid == SPELL_UNKNOWN || petinfo->Buffs[index].spellid == 0) continue; if (query.length() == 0) diff --git a/zone/zonedb.h b/zone/zonedb.h index ef5a6810d..689f9a82f 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -125,7 +125,7 @@ struct PetInfo { uint32 HP; uint32 Mana; float size; - SpellBuff_Struct Buffs[BUFF_COUNT]; + SpellBuff_Struct Buffs[PET_BUFF_COUNT]; uint32 Items[EQEmu::legacy::EQUIPMENT_SIZE]; char Name[64]; };