mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Fixed mercenary memleaks in AI_Start and Unsuspend.
This commit is contained in:
parent
4ab7786828
commit
cabf8631d4
@ -18,6 +18,77 @@ IF(NOT CMAKE_BUILD_TYPE)
|
|||||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
||||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
SET(VLD_FOUND FALSE)
|
||||||
|
|
||||||
|
## VLD works only in Microsoft Visual Studio on Windows:
|
||||||
|
IF(WIN32)
|
||||||
|
IF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
|
||||||
|
|
||||||
|
FIND_PATH(VLD_INCLUDE_DIR vld.h
|
||||||
|
$ENV{VLD_HOME}/include
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/include"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_INCLUDE_DIR=${VLD_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
## this is just required for runtim enabling/disabling:
|
||||||
|
FIND_PATH(VLD_INCLUDE_DIR_API vldapi.h
|
||||||
|
$ENV{VLD_HOME}/include
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/include"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_INCLUDE_DIR_API=${VLD_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
FIND_LIBRARY(VLD_LIBRARY_VLD
|
||||||
|
NAMES vld
|
||||||
|
PATHS
|
||||||
|
$ENV{VLD_HOME}/lib
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/lib"
|
||||||
|
DOC "Visual Leak Debugger multithreaded library"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_LIBRARY_VLD=${VLD_LIBRARY_VLD}")
|
||||||
|
|
||||||
|
FIND_LIBRARY(VLD_LIBRARY_VLDMT
|
||||||
|
NAMES vldmt
|
||||||
|
PATHS
|
||||||
|
$ENV{VLD_HOME}/lib
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/lib"
|
||||||
|
DOC "Visual Leak Debugger multithreaded library"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_LIBRARY_VLDMT=${VLD_LIBRARY_VLDMT}")
|
||||||
|
|
||||||
|
FIND_LIBRARY(VLD_LIBRARY_VLDMTDLL
|
||||||
|
NAMES vldmtdll
|
||||||
|
PATHS
|
||||||
|
$ENV{VLD_HOME}/lib
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/lib"
|
||||||
|
DOC "Visual Leak Debugger multithreaded library"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_LIBRARY_VLDMTDLL=${VLD_LIBRARY_VLDMTDLL}")
|
||||||
|
|
||||||
|
IF(VLD_INCLUDE_DIR)
|
||||||
|
IF (VLD_LIBRARY_VLD OR VLD_LIBRARY_VLDMT OR VLD_LIBRARY_VLDMTDLL)
|
||||||
|
## do NOT add LIBRARIES because dependencies are handled through pragmas.
|
||||||
|
SET(VLD_FOUND TRUE)
|
||||||
|
# MESSAGE("found VLD.")
|
||||||
|
ENDIF (VLD_LIBRARY_VLD OR VLD_LIBRARY_VLDMT OR VLD_LIBRARY_VLDMTDLL)
|
||||||
|
ENDIF(VLD_INCLUDE_DIR)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
VLD_INCLUDE_DIR
|
||||||
|
VLD_INCLUDE_DIR_API
|
||||||
|
VLD_LIBRARY_VLD
|
||||||
|
VLD_LIBRARY_VLDMT
|
||||||
|
VLD_LIBRARY_VLDMTDLL
|
||||||
|
VLD_LIBRARIES
|
||||||
|
)
|
||||||
|
|
||||||
|
ENDIF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
#Add our various windows definitions
|
#Add our various windows definitions
|
||||||
IF(MSVC OR MINGW)
|
IF(MSVC OR MINGW)
|
||||||
ADD_DEFINITIONS(-D_WINDOWS)
|
ADD_DEFINITIONS(-D_WINDOWS)
|
||||||
@ -139,7 +210,7 @@ ADD_DEFINITIONS(-DMAP_DIR="./Maps")
|
|||||||
FIND_PACKAGE(ZLIB REQUIRED)
|
FIND_PACKAGE(ZLIB REQUIRED)
|
||||||
FIND_PACKAGE(MySQL REQUIRED)
|
FIND_PACKAGE(MySQL REQUIRED)
|
||||||
FIND_PACKAGE(PerlLibs REQUIRED)
|
FIND_PACKAGE(PerlLibs REQUIRED)
|
||||||
INCLUDE_DIRECTORIES("${ZLIB_INCLUDE_DIRS}" "${PERL_INCLUDE_PATH}" "${MySQL_INCLUDE_DIR}")
|
INCLUDE_DIRECTORIES("${ZLIB_INCLUDE_DIRS}" "${PERL_INCLUDE_PATH}" "${MySQL_INCLUDE_DIR}" "${VLD_INCLUDE_DIR}")
|
||||||
|
|
||||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
||||||
ADD_SUBDIRECTORY(common)
|
ADD_SUBDIRECTORY(common)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ SET(eqlaunch_headers
|
|||||||
|
|
||||||
ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
|
ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE})
|
TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,6 @@ void WorldServer::Process() {
|
|||||||
|
|
||||||
default: {
|
default: {
|
||||||
_log(LAUNCHER__NET, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size);
|
_log(LAUNCHER__NET, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size);
|
||||||
//DumpPacket(pack->pBuffer, pack->size);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ ADD_EXECUTABLE(queryserv ${qserv_sources} ${qserv_headers})
|
|||||||
|
|
||||||
ADD_DEFINITIONS(-DQSERV)
|
ADD_DEFINITIONS(-DQSERV)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE})
|
TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ SET(shared_memory_headers
|
|||||||
|
|
||||||
ADD_EXECUTABLE(shared_memory ${shared_memory_sources} ${shared_memory_headers})
|
ADD_EXECUTABLE(shared_memory ${shared_memory_sources} ${shared_memory_headers})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(shared_memory Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE})
|
TARGET_LINK_LIBRARIES(shared_memory Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(shared_memory PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
SET_TARGET_PROPERTIES(shared_memory PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||||
|
|||||||
@ -21,7 +21,7 @@ ADD_EXECUTABLE(ucs ${ucs_sources} ${ucs_headers})
|
|||||||
|
|
||||||
ADD_DEFINITIONS(-DUCS)
|
ADD_DEFINITIONS(-DUCS)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE})
|
TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ ADD_EXECUTABLE(world ${world_sources} ${world_headers})
|
|||||||
|
|
||||||
ADD_DEFINITIONS(-DWORLD)
|
ADD_DEFINITIONS(-DWORLD)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(world Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE})
|
TARGET_LINK_LIBRARIES(world Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
|
|
||||||
|
|||||||
@ -155,12 +155,82 @@ ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers})
|
|||||||
|
|
||||||
ADD_DEFINITIONS(-DZONE)
|
ADD_DEFINITIONS(-DZONE)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(zone Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE})
|
TARGET_LINK_LIBRARIES(zone Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} ${VLD_LIBRARY_VLD})
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(zone PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
SET_TARGET_PROPERTIES(zone PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||||
TARGET_LINK_LIBRARIES(zone "Ws2_32.lib")
|
TARGET_LINK_LIBRARIES(zone "Ws2_32.lib")
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
|
SET(VLD_FOUND FALSE)
|
||||||
|
|
||||||
|
## VLD works only in Microsoft Visual Studio on Windows:
|
||||||
|
IF(WIN32)
|
||||||
|
IF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
|
||||||
|
|
||||||
|
FIND_PATH(VLD_INCLUDE_DIR vld.h
|
||||||
|
$ENV{VLD_HOME}/include
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/include"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_INCLUDE_DIR=${VLD_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
## this is just required for runtim enabling/disabling:
|
||||||
|
FIND_PATH(VLD_INCLUDE_DIR_API vldapi.h
|
||||||
|
$ENV{VLD_HOME}/include
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/include"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_INCLUDE_DIR_API=${VLD_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
FIND_LIBRARY(VLD_LIBRARY_VLD
|
||||||
|
NAMES vld
|
||||||
|
PATHS
|
||||||
|
$ENV{VLD_HOME}/lib
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/lib"
|
||||||
|
DOC "Visual Leak Debugger multithreaded library"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_LIBRARY_VLD=${VLD_LIBRARY_VLD}")
|
||||||
|
|
||||||
|
FIND_LIBRARY(VLD_LIBRARY_VLDMT
|
||||||
|
NAMES vldmt
|
||||||
|
PATHS
|
||||||
|
$ENV{VLD_HOME}/lib
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/lib"
|
||||||
|
DOC "Visual Leak Debugger multithreaded library"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_LIBRARY_VLDMT=${VLD_LIBRARY_VLDMT}")
|
||||||
|
|
||||||
|
FIND_LIBRARY(VLD_LIBRARY_VLDMTDLL
|
||||||
|
NAMES vldmtdll
|
||||||
|
PATHS
|
||||||
|
$ENV{VLD_HOME}/lib
|
||||||
|
$ENV{VLD_HOME}
|
||||||
|
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET 2003/Vc7/lib"
|
||||||
|
DOC "Visual Leak Debugger multithreaded library"
|
||||||
|
)
|
||||||
|
#MESSAGE("VLD_LIBRARY_VLDMTDLL=${VLD_LIBRARY_VLDMTDLL}")
|
||||||
|
|
||||||
|
IF(VLD_INCLUDE_DIR)
|
||||||
|
IF (VLD_LIBRARY_VLD OR VLD_LIBRARY_VLDMT OR VLD_LIBRARY_VLDMTDLL)
|
||||||
|
## do NOT add LIBRARIES because dependencies are handled through pragmas.
|
||||||
|
SET(VLD_FOUND TRUE)
|
||||||
|
# MESSAGE("found VLD.")
|
||||||
|
ENDIF (VLD_LIBRARY_VLD OR VLD_LIBRARY_VLDMT OR VLD_LIBRARY_VLDMTDLL)
|
||||||
|
ENDIF(VLD_INCLUDE_DIR)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
VLD_INCLUDE_DIR
|
||||||
|
VLD_INCLUDE_DIR_API
|
||||||
|
VLD_LIBRARY_VLD
|
||||||
|
VLD_LIBRARY_VLDMT
|
||||||
|
VLD_LIBRARY_VLDMTDLL
|
||||||
|
VLD_LIBRARIES
|
||||||
|
)
|
||||||
|
|
||||||
|
ENDIF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
IF(MINGW)
|
IF(MINGW)
|
||||||
TARGET_LINK_LIBRARIES(zone "WS2_32")
|
TARGET_LINK_LIBRARIES(zone "WS2_32")
|
||||||
@ -175,4 +245,6 @@ IF(UNIX)
|
|||||||
ADD_DEFINITIONS(-fPIC)
|
ADD_DEFINITIONS(-fPIC)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${VLD_INCLUDE_DIR})
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
||||||
|
|||||||
@ -3540,7 +3540,6 @@ void Client::Handle_OP_WearChange(const EQApplicationPacket *app)
|
|||||||
{
|
{
|
||||||
if (app->size != sizeof(WearChange_Struct)) {
|
if (app->size != sizeof(WearChange_Struct)) {
|
||||||
cout << "Wrong size: OP_WearChange, size=" << app->size << ", expected " << sizeof(WearChange_Struct) << endl;
|
cout << "Wrong size: OP_WearChange, size=" << app->size << ", expected " << sizeof(WearChange_Struct) << endl;
|
||||||
DumpPacket(app);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3595,7 +3594,6 @@ void Client::Handle_OP_WhoAllRequest(const EQApplicationPacket *app)
|
|||||||
{
|
{
|
||||||
if (app->size != sizeof(Who_All_Struct)) {
|
if (app->size != sizeof(Who_All_Struct)) {
|
||||||
cout << "Wrong size on OP_WhoAll. Got: " << app->size << ", Expected: " << sizeof(Who_All_Struct) << endl;
|
cout << "Wrong size on OP_WhoAll. Got: " << app->size << ", Expected: " << sizeof(Who_All_Struct) << endl;
|
||||||
DumpPacket(app);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Who_All_Struct* whoall = (Who_All_Struct*) app->pBuffer;
|
Who_All_Struct* whoall = (Who_All_Struct*) app->pBuffer;
|
||||||
@ -7385,6 +7383,24 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app)
|
|||||||
memcpy(out->message, name, len_name);
|
memcpy(out->message, name, len_name);
|
||||||
memcpy(&out->message[len_name], in->message, len_msg);
|
memcpy(&out->message[len_name], in->message, len_msg);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (target && target->IsClient()) {
|
||||||
|
entity_list.QueueCloseClients(this, outapp, false, 100, target);
|
||||||
|
|
||||||
|
cptr = outapp->pBuffer + 2;
|
||||||
|
|
||||||
|
// not sure if live does this or not. thought it was a nice feature, but would take a lot to
|
||||||
|
// clean up grammatical and other errors. Maybe with a regex parser...
|
||||||
|
replacestr((char *)cptr, target->GetName(), "you");
|
||||||
|
replacestr((char *)cptr, " he", " you");
|
||||||
|
replacestr((char *)cptr, " she", " you");
|
||||||
|
replacestr((char *)cptr, " him", " you");
|
||||||
|
replacestr((char *)cptr, " her", " you");
|
||||||
|
target->CastToClient()->QueuePacket(outapp);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*/
|
||||||
entity_list.QueueCloseClients(this, outapp, true, 100,0,true,FilterSocials);
|
entity_list.QueueCloseClients(this, outapp, true, 100,0,true,FilterSocials);
|
||||||
|
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
@ -13580,6 +13596,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app)
|
|||||||
uint32 merchant_id = mmrq->MercMerchantID;
|
uint32 merchant_id = mmrq->MercMerchantID;
|
||||||
uint32 merc_unk1 = mmrq->MercUnk01;
|
uint32 merc_unk1 = mmrq->MercUnk01;
|
||||||
uint32 merc_unk2 = mmrq->MercUnk02;
|
uint32 merc_unk2 = mmrq->MercUnk02;
|
||||||
|
|
||||||
if(MERC_DEBUG > 0)
|
if(MERC_DEBUG > 0)
|
||||||
Message(7, "Mercenary Debug: Template ID (%i), Merchant ID (%i), Unknown1 (%i), Unknown2 (%i)", merc_template_id, merchant_id, merc_unk1, merc_unk2);
|
Message(7, "Mercenary Debug: Template ID (%i), Merchant ID (%i), Unknown1 (%i), Unknown2 (%i)", merc_template_id, merchant_id, merc_unk1, merc_unk2);
|
||||||
|
|
||||||
@ -13641,7 +13658,6 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app)
|
|||||||
SuspendMercenary_Struct* sm = (SuspendMercenary_Struct*) app->pBuffer;
|
SuspendMercenary_Struct* sm = (SuspendMercenary_Struct*) app->pBuffer;
|
||||||
uint32 merc_suspend = sm->SuspendMerc; // Seen 30 for suspending or unsuspending
|
uint32 merc_suspend = sm->SuspendMerc; // Seen 30 for suspending or unsuspending
|
||||||
|
|
||||||
|
|
||||||
if(MERC_DEBUG > 0)
|
if(MERC_DEBUG > 0)
|
||||||
Message(7, "Mercenary Debug: Suspend ( %i ) received.", merc_suspend);
|
Message(7, "Mercenary Debug: Suspend ( %i ) received.", merc_suspend);
|
||||||
|
|
||||||
@ -13666,7 +13682,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app)
|
|||||||
uint32 merc_command = mc->MercCommand; // Seen 0 (zone in with no merc or suspended), 1 (dismiss merc), 5 (normal state), 20 (unknown), 36 (zone in with merc)
|
uint32 merc_command = mc->MercCommand; // Seen 0 (zone in with no merc or suspended), 1 (dismiss merc), 5 (normal state), 20 (unknown), 36 (zone in with merc)
|
||||||
int32 option = mc->Option; // Seen -1 (zone in with no merc), 0 (setting to passive stance), 1 (normal or setting to balanced stance)
|
int32 option = mc->Option; // Seen -1 (zone in with no merc), 0 (setting to passive stance), 1 (normal or setting to balanced stance)
|
||||||
|
|
||||||
if(MERC_DEBUG > 0)
|
if(MERC_DEBUG > 0)
|
||||||
Message(7, "Mercenary Debug: Command %i, Option %i received.", merc_command, option);
|
Message(7, "Mercenary Debug: Command %i, Option %i received.", merc_command, option);
|
||||||
|
|
||||||
if(!RuleB(Mercs, AllowMercs))
|
if(!RuleB(Mercs, AllowMercs))
|
||||||
|
|||||||
@ -148,7 +148,6 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
|
|||||||
|
|
||||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
||||||
MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer;
|
MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer;
|
||||||
|
|
||||||
md->doorid = door_id;
|
md->doorid = door_id;
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
//used_pawn: Locked doors! Rogue friendly too =)
|
//used_pawn: Locked doors! Rogue friendly too =)
|
||||||
|
|||||||
@ -71,6 +71,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Merc::~Merc() {
|
Merc::~Merc() {
|
||||||
|
AI_Stop();
|
||||||
safe_delete(ourNPCData); //Since mercs are dynamically alloc'd we should probably safe_delete the data they were made from. I'm not entirely sure this is safe to delete a const.
|
safe_delete(ourNPCData); //Since mercs are dynamically alloc'd we should probably safe_delete the data they were made from. I'm not entirely sure this is safe to delete a const.
|
||||||
entity_list.RemoveMerc(this->GetID());
|
entity_list.RemoveMerc(this->GetID());
|
||||||
UninitializeBuffSlots();
|
UninitializeBuffSlots();
|
||||||
@ -1911,15 +1912,16 @@ void Merc::AI_Process() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Merc::AI_Start(int32 iMoveDelay) {
|
void Merc::AI_Start(int32 iMoveDelay) {
|
||||||
Mob::AI_Start(iMoveDelay);
|
NPC::AI_Start(iMoveDelay);
|
||||||
|
|
||||||
if (!pAIControlled)
|
if (!pAIControlled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (merc_spells.size() == 0) {
|
if (merc_spells.size() == 0) {
|
||||||
AIautocastspell_timer = new Timer(1000);
|
AIautocastspell_timer->SetTimer(1000);
|
||||||
AIautocastspell_timer->Disable();
|
AIautocastspell_timer->Disable();
|
||||||
} else {
|
} else {
|
||||||
AIautocastspell_timer = new Timer(750);
|
AIautocastspell_timer->SetTimer(750);
|
||||||
AIautocastspell_timer->Start(RandomTimer(0, 2000), false);
|
AIautocastspell_timer->Start(RandomTimer(0, 2000), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5572,10 +5574,6 @@ bool Merc::Suspend() {
|
|||||||
|
|
||||||
SetSuspended(true);
|
SetSuspended(true);
|
||||||
|
|
||||||
if(HasGroup()) {
|
|
||||||
RemoveMercFromGroup(this, GetGroup());
|
|
||||||
}
|
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
|
|
||||||
mercOwner->GetMercInfo().IsSuspended = true;
|
mercOwner->GetMercInfo().IsSuspended = true;
|
||||||
@ -5623,31 +5621,43 @@ bool Merc::Unsuspend(bool setMaxStats) {
|
|||||||
mercOwner->GetPTimers().Clear(&database, pTimerMercSuspend);
|
mercOwner->GetPTimers().Clear(&database, pTimerMercSuspend);
|
||||||
|
|
||||||
mercOwner->SendMercPersonalInfo();
|
mercOwner->SendMercPersonalInfo();
|
||||||
|
Group* g = entity_list.GetGroupByClient(mercOwner);
|
||||||
|
|
||||||
if(!mercOwner->IsGrouped())
|
if(!g)
|
||||||
{
|
{ //nobody from our group is here... start a new group
|
||||||
Group *g = new Group(mercOwner);
|
g = new Group(mercOwner);
|
||||||
if(g && AddMercToGroup(this, g))
|
|
||||||
|
if(!g)
|
||||||
{
|
{
|
||||||
entity_list.AddGroup(g);
|
delete g;
|
||||||
|
g = NULL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
entity_list.AddGroup(g);
|
||||||
|
|
||||||
|
if(g->GetID() == 0) {
|
||||||
|
delete g;
|
||||||
|
g = NULL;
|
||||||
|
Message(13, "Unable to get new group id. Cannot create group.");
|
||||||
|
mercOwner->Message(13, "Unable to get new group id. Cannot create group.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(AddMercToGroup(this, g))
|
||||||
|
{
|
||||||
|
entity_list.AddGroup(g, g->GetID());
|
||||||
database.SetGroupLeaderName(g->GetID(), mercOwner->GetName());
|
database.SetGroupLeaderName(g->GetID(), mercOwner->GetName());
|
||||||
database.SetGroupID(mercOwner->GetName(), g->GetID(), mercOwner->CharacterID());
|
database.SetGroupID(mercOwner->GetName(), g->GetID(), mercOwner->CharacterID());
|
||||||
database.SetGroupID(this->GetName(), g->GetID(), mercOwner->CharacterID(), true);
|
database.SetGroupID(this->GetName(), g->GetID(), mercOwner->CharacterID(), true);
|
||||||
database.RefreshGroupFromDB(mercOwner);
|
database.RefreshGroupFromDB(mercOwner);
|
||||||
g->SaveGroupLeaderAA();
|
g->SaveGroupLeaderAA();
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(MERC_DEBUG > 0)
|
g->DisbandGroup();
|
||||||
mercOwner->Message(7, "Mercenary failed to join the group - Suspending");
|
|
||||||
|
|
||||||
Suspend();
|
|
||||||
safe_delete(g);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
} //else, somebody from our group is already here...
|
||||||
else if (AddMercToGroup(this, mercOwner->GetGroup()))
|
else if (AddMercToGroup(this, mercOwner->GetGroup()))
|
||||||
{
|
{
|
||||||
database.SetGroupID(GetName(), mercOwner->GetGroup()->GetID(), mercOwner->CharacterID(), true);
|
database.SetGroupID(GetName(), mercOwner->GetGroup()->GetID(), mercOwner->CharacterID(), true);
|
||||||
|
|||||||
@ -20,6 +20,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
|||||||
#include "../common/features.h"
|
#include "../common/features.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
#include <vld.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@ -248,6 +248,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
|||||||
|
|
||||||
npc_aggro = d->npc_aggro;
|
npc_aggro = d->npc_aggro;
|
||||||
|
|
||||||
|
if(!IsMerc()) //memleak fix, this really shouldn't be here
|
||||||
AI_Start();
|
AI_Start();
|
||||||
|
|
||||||
d_meele_texture1 = d->d_meele_texture1;
|
d_meele_texture1 = d->d_meele_texture1;
|
||||||
|
|||||||
@ -2559,7 +2559,6 @@ void Client::SendTaskFailed(int TaskID, int TaskIndex) {
|
|||||||
tac->unknown5 = 0; // 0 for task complete or failed.
|
tac->unknown5 = 0; // 0 for task complete or failed.
|
||||||
|
|
||||||
_log(TASKS__UPDATE, "TaskFailed");
|
_log(TASKS__UPDATE, "TaskFailed");
|
||||||
|
|
||||||
_pkt(TASKS__PACKETS, outapp);
|
_pkt(TASKS__PACKETS, outapp);
|
||||||
|
|
||||||
QueuePacket(outapp);
|
QueuePacket(outapp);
|
||||||
|
|||||||
@ -517,7 +517,6 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
|
|||||||
outp->reply_code = 0x00000000; //success for finding it...
|
outp->reply_code = 0x00000000; //success for finding it...
|
||||||
|
|
||||||
user->QueuePacket(outapp);
|
user->QueuePacket(outapp);
|
||||||
|
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
|
|
||||||
|
|
||||||
@ -664,7 +663,6 @@ void Client::TradeskillSearchResults(const char *query, unsigned long qlen,
|
|||||||
reply->recipe_id = recipe;
|
reply->recipe_id = recipe;
|
||||||
reply->trivial = trivial;
|
reply->trivial = trivial;
|
||||||
strn0cpy(reply->recipe_name, name, sizeof(reply->recipe_name));
|
strn0cpy(reply->recipe_name, name, sizeof(reply->recipe_name));
|
||||||
|
|
||||||
FastQueuePacket(&outapp);
|
FastQueuePacket(&outapp);
|
||||||
}
|
}
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user