mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 16:10:49 +01:00
Core: Some cleanup in AddonHandler.
--HG-- branch : trunk
This commit is contained in:
@@ -131,13 +131,6 @@ bool AddonHandler::BuildAddonPacket(WorldPacket *Source, WorldPacket *Target)
|
||||
|
||||
uint32 count = 0;
|
||||
*Target << uint32(count);
|
||||
/*for(uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
uint32
|
||||
string (16 bytes)
|
||||
string (16 bytes)
|
||||
uint32
|
||||
}*/
|
||||
|
||||
if(AddOnPacked.rpos() != AddOnPacked.size())
|
||||
sLog.outDebug("packet under read!");
|
||||
@@ -149,81 +142,3 @@ bool AddonHandler::BuildAddonPacket(WorldPacket *Source, WorldPacket *Target)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Code use in 1.10.2 when client not ignore ban state sended for addons. Saved for reference if client switch to use server ban state information
|
||||
void AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target, uint32 Packetoffset)
|
||||
{
|
||||
ByteBuffer AddOnPacked;
|
||||
uLongf AddonRealSize;
|
||||
uint32 CurrentPosition;
|
||||
uint32 TempValue;
|
||||
|
||||
*Source >> TempValue; //get real size of the packed structure
|
||||
|
||||
AddonRealSize = TempValue; //temp value becouse ZLIB only excepts uLongf
|
||||
|
||||
CurrentPosition = Source->rpos(); //get the position of the pointer in the structure
|
||||
|
||||
AddOnPacked.resize(AddonRealSize); //resize target for zlib action
|
||||
|
||||
if (!uncompress((uint8*)AddOnPacked.contents(), &AddonRealSize, (uint8*)(*Source).contents() + CurrentPosition, (*Source).size() - CurrentPosition)!= Z_OK)
|
||||
{
|
||||
bool* AddonAllowed = new bool; //handle addon check and enable-ing
|
||||
|
||||
uint32 Unknown1;
|
||||
uint8 Unknown0;
|
||||
|
||||
AddOnPacked >> Unknown0;
|
||||
AddOnPacked >> Unknown1;
|
||||
|
||||
Target->Initialize(SMSG_ADDON_INFO);
|
||||
|
||||
uint32 i = 5; //offset for addon extraction
|
||||
while(i != AddOnPacked.size())
|
||||
{
|
||||
std::string AddonNames;
|
||||
AddOns* Addonstr = new AddOns;
|
||||
uint8 unk6;
|
||||
uint64 CRCCHECK;
|
||||
AddOnPacked >> AddonNames >> CRCCHECK >> unk6;
|
||||
|
||||
//sLog.outDebug("ADDON: Name:%s CRC:%x Unknown:%x",AddonNames.c_str(), CRCCHECK,unk6);
|
||||
|
||||
Addonstr->Name = AddonNames;
|
||||
Addonstr->CRC = CRCCHECK;
|
||||
|
||||
//if not allowed but unknown added to list
|
||||
if (GetAddonStatus(Addonstr, AddonAllowed)) // If addon is new
|
||||
{
|
||||
Addonstr->Enabled = m_Addon_Default; // by default new addons are set from Config file
|
||||
*AddonAllowed = m_Addon_Default; // Set addon allowed on default value
|
||||
_AddAddon(Addonstr);
|
||||
sLog.outDetail("Found new Addon, Name:%s CRC:%x Unknown:%x",AddonNames.c_str(), CRCCHECK, unk6);
|
||||
}
|
||||
|
||||
if (CRCCHECK == 0x4C1C776D01LL) //If addon is Standard addon CRC
|
||||
{
|
||||
//value's standard Addons
|
||||
*Target << uint8(0) << uint8(2) << uint8(1) << uint8(0) << uint32(0);
|
||||
}
|
||||
else if (*AddonAllowed) //if addon is Custom addons
|
||||
//value's enable addon
|
||||
*Target << uint8(0x00) << uint8(0x01) << uint8(0x00) << uint8(0x01);
|
||||
else
|
||||
//value's disable addom
|
||||
*Target << uint8(0x00) << uint8(0x0) << uint8(0x00) << uint8(0x0);
|
||||
|
||||
i += AddonNames.size() + 10;
|
||||
}
|
||||
*Target << uint8(0x0);
|
||||
|
||||
//delete mem allocation
|
||||
delete AddonAllowed;
|
||||
}
|
||||
else
|
||||
{
|
||||
//handle uncompress error
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user