Merge and a few cleanup / bug fixes

This commit is contained in:
KimLS 2013-05-23 12:35:00 -07:00
commit efe7092995
26 changed files with 107 additions and 112 deletions

View File

@ -1,4 +1,4 @@
The server code and utilities are released under GPL. The server code and utilities are released under GPLv3.
We also include some small libraries for convienence that may be under different licensing: We also include some small libraries for convienence that may be under different licensing:
@ -9,3 +9,4 @@ ZLib - ZLib License
MySQL - GPL MySQL - GPL
Perl - GPL / ActiveState (under the assumption that this is a free project). Perl - GPL / ActiveState (under the assumption that this is a free project).
CPPUnit - GLP CPPUnit - GLP
StringUtilities - Apache

View File

@ -315,7 +315,6 @@ INCLUDE_DIRECTORIES(Patches SocketLib StackWalker TinyXML)
ADD_LIBRARY(Common ${common_sources} ${common_headers}) ADD_LIBRARY(Common ${common_sources} ${common_headers})
IF(UNIX) IF(UNIX)
ADD_DEFINITIONS(-fPIC) ADD_DEFINITIONS(-fPIC)
SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0) SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)

View File

@ -20,7 +20,6 @@
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <time.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef _WINDOWS #ifdef _WINDOWS
#include <time.h> #include <time.h>

View File

@ -39,16 +39,16 @@ void MakeUpperString(const char *source, char *target);
void MakeLowerString(const char *source, char *target); void MakeLowerString(const char *source, char *target);
int MakeAnyLenString(char** ret, const char* format, ...); int MakeAnyLenString(char** ret, const char* format, ...);
uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...); uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...);
uint32 hextoi(char* num); uint32 hextoi(char* num);
uint64 hextoi64(char* num); uint64 hextoi64(char* num);
bool atobool(char* iBool); bool atobool(char* iBool);
char* strn0cpy(char* dest, const char* source, uint32 size); char* strn0cpy(char* dest, const char* source, uint32 size);
// return value =true if entire string(source) fit, false if it was truncated // return value =true if entire string(source) fit, false if it was truncated
bool strn0cpyt(char* dest, const char* source, uint32 size); bool strn0cpyt(char* dest, const char* source, uint32 size);
char *CleanMobName(const char *in, char *out); char *CleanMobName(const char *in, char *out);

View File

@ -1,5 +1,3 @@
#include "debug.h"
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <cstdarg> #include <cstdarg>
@ -12,16 +10,18 @@
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#define strcasecmp _stricmp #define strcasecmp _stricmp
#else #else
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "../common/StringUtil.h" #include "debug.h"
#include "../common/MiscFunctions.h" #include "StringUtil.h"
#include "../common/platform.h" #include "MiscFunctions.h"
#include "platform.h"
#ifndef va_copy #ifndef va_copy
#define va_copy(d,s) ((d) = (s)) #define va_copy(d,s) ((d) = (s))
@ -75,7 +75,6 @@ EQEMuLog::~EQEMuLog() {
} }
bool EQEMuLog::open(LogIDs id) { bool EQEMuLog::open(LogIDs id) {
if (!logFileValid) { if (!logFileValid) {
return false; return false;
} }
@ -91,40 +90,36 @@ bool EQEMuLog::open(LogIDs id) {
return true; return true;
} }
std::string filename = FileNames[id]; char exename[200] = "";
const EQEmuExePlatform &platform = GetExecutablePlatform(); const EQEmuExePlatform &platform = GetExecutablePlatform();
if(platform == ExePlatformWorld) { if(platform == ExePlatformWorld) {
filename.append("_world"); snprintf(exename, sizeof(exename), "_world");
} else if(platform == ExePlatformZone) { } else if(platform == ExePlatformZone) {
filename.append("_zone"); snprintf(exename, sizeof(exename), "_zone");
} else if(platform == ExePlatformLaunch) { } else if(platform == ExePlatformLaunch) {
filename.append("_launch"); snprintf(exename, sizeof(exename), "_launch");
} else if(platform == ExePlatformUCS) { } else if(platform == ExePlatformUCS) {
filename.append("_ucs"); snprintf(exename, sizeof(exename), "_ucs");
} else if(platform == ExePlatformQueryServ) { } else if(platform == ExePlatformQueryServ) {
filename.append("_queryserv"); snprintf(exename, sizeof(exename), "_queryserv");
} else if(platform == ExePlatformSharedMemory) { } else if(platform == ExePlatformSharedMemory) {
filename.append("_shared_memory"); snprintf(exename, sizeof(exename), "_shared_memory");
} }
char filename[200];
#ifndef NO_PIDLOG #ifndef NO_PIDLOG
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx snprintf(filename, sizeof(filename), "%s%s_%04i.log", FileNames[id], exename, getpid());
// Visual Studio 2010 doesn't have std::to_string(int) but it does have one for #else
// long long. Oh well, it works fine and formats perfectly acceptably. snprintf(filename, sizeof(filename), "%s%s.log", FileNames[id], exename);
filename.append(std::to_string((long long)getpid()));
#endif #endif
filename.append(".log"); fp[id] = fopen(filename, "a");
fp[id] = fopen(filename.c_str(), "a");
if (!fp[id]) { if (!fp[id]) {
std::cerr << "Failed to open log file: " << filename << std::endl; std::cerr << "Failed to open log file: " << filename << std::endl;
pLogStatus[id] |= 4; // set file state to error pLogStatus[id] |= 4; // set file state to error
return false; return false;
} }
fputs("---------------------------------------------\n",fp[id]); fputs("---------------------------------------------\n",fp[id]);
write(id, "Starting Log: %s", filename.c_str()); write(id, "Starting Log: %s", filename);
return true; return true;
} }
@ -151,54 +146,44 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
time( &aclock ); /* Get time in seconds */ time( &aclock ); /* Get time in seconds */
newtime = localtime( &aclock ); /* Convert time to struct */ newtime = localtime( &aclock ); /* Convert time to struct */
if (dofile) { if (dofile)
#ifndef NO_PIDLOG #ifndef NO_PIDLOG
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#else #else
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#endif #endif
}
va_list argptr,tmpargptr; va_list argptr, tmpargptr;
va_start(argptr, fmt);
if (dofile) { if (dofile) {
va_start(argptr, fmt); va_copy(tmpargptr, argptr);
va_copy(tmpargptr,argptr);
vfprintf( fp[id], fmt, tmpargptr ); vfprintf( fp[id], fmt, tmpargptr );
va_end(tmpargptr);
} }
if(logCallbackFmt[id]) { if(logCallbackFmt[id]) {
msgCallbackFmt p = logCallbackFmt[id]; msgCallbackFmt p = logCallbackFmt[id];
va_start(argptr, fmt); va_copy(tmpargptr, argptr);
va_copy(tmpargptr,argptr);
p(id, fmt, tmpargptr ); p(id, fmt, tmpargptr );
va_end(tmpargptr);
} }
std::string outputMessage;
va_start(argptr, fmt);
va_copy(tmpargptr,argptr);
vStringFormat(outputMessage, fmt, tmpargptr);
va_end(tmpargptr);
if (pLogStatus[id] & 2) { if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) { if (pLogStatus[id] & 8) {
fprintf(stderr, "[%s] ", LogNames[id]);
std::cerr << "[" << LogNames[id] << "] "; vfprintf( stderr, fmt, argptr );
std::cerr << outputMessage;
} }
else { else {
std::cout << "[" << LogNames[id] << "] "; fprintf(stdout, "[%s] ", LogNames[id]);
std::cout << outputMessage; vfprintf( stdout, fmt, argptr );
} }
} }
va_end(argptr);
if (dofile) if (dofile)
fprintf(fp[id], "\n"); fprintf(fp[id], "\n");
if (pLogStatus[id] & 2) { if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) { if (pLogStatus[id] & 8) {
std::cerr << std::endl; fprintf(stderr, "\n");
fflush(stderr);
} else { } else {
std::cout << std::endl; fprintf(stdout, "\n");
fflush(stdout);
} }
} }
if(dofile) if(dofile)
@ -462,3 +447,4 @@ void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) {
SetCallback((LogIDs)r, proc); SetCallback((LogIDs)r, proc);
} }
} }

View File

@ -58,7 +58,7 @@ RDTSC_Timer::RDTSC_Timer(bool start_it) {
} }
int64 RDTSC_Timer::rdtsc() { int64 RDTSC_Timer::rdtsc() {
int64 res; int64 res = 0;
#ifdef USE_RDTSC #ifdef USE_RDTSC
#ifndef WIN64 #ifndef WIN64
#ifdef WIN32 #ifdef WIN32

View File

@ -16,7 +16,6 @@ ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
IF(MSVC) IF(MSVC)
SET_TARGET_PROPERTIES(eqlaunch PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") SET_TARGET_PROPERTIES(eqlaunch PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(eqlaunch "Ws2_32.lib") TARGET_LINK_LIBRARIES(eqlaunch "Ws2_32.lib")
ENDIF(MSVC) ENDIF(MSVC)

View File

@ -13,6 +13,7 @@ SET(eqlogin_sources
) )
IF(MSVC OR MINGW) IF(MSVC OR MINGW)
ADD_DEFINITIONS(-DNOMINMAX)
SET(eqlogin_sources ${eqlogin_sources} Encryption.cpp) SET(eqlogin_sources ${eqlogin_sources} Encryption.cpp)
ENDIF(MSVC OR MINGW) ENDIF(MSVC OR MINGW)
@ -43,7 +44,6 @@ ADD_EXECUTABLE(loginserver ${eqlogin_sources} ${eqlogin_headers})
TARGET_LINK_LIBRARIES(loginserver Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE}) TARGET_LINK_LIBRARIES(loginserver Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE})
IF(MSVC) IF(MSVC)
SET_TARGET_PROPERTIES(loginserver PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") SET_TARGET_PROPERTIES(loginserver PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(loginserver "Ws2_32.lib") TARGET_LINK_LIBRARIES(loginserver "Ws2_32.lib")
ENDIF(MSVC) ENDIF(MSVC)

View File

@ -18,6 +18,7 @@
#include "../common/debug.h" #include "../common/debug.h"
#include "Encryption.h" #include "Encryption.h"
#include "ErrorLog.h" #include "ErrorLog.h"
#include <string>
extern ErrorLog *server_log; extern ErrorLog *server_log;

View File

@ -22,7 +22,6 @@ ADD_DEFINITIONS(-DQSERV)
TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
IF(MSVC) IF(MSVC)
SET_TARGET_PROPERTIES(queryserv PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") SET_TARGET_PROPERTIES(queryserv PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(queryserv "Ws2_32.lib") TARGET_LINK_LIBRARIES(queryserv "Ws2_32.lib")
ENDIF(MSVC) ENDIF(MSVC)

View File

@ -24,7 +24,6 @@ ADD_DEFINITIONS(-DUCS)
TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
IF(MSVC) IF(MSVC)
SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(ucs "Ws2_32.lib") TARGET_LINK_LIBRARIES(ucs "Ws2_32.lib")
ENDIF(MSVC) ENDIF(MSVC)

View File

@ -70,7 +70,6 @@ ADD_DEFINITIONS(-DWORLD)
TARGET_LINK_LIBRARIES(world Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) TARGET_LINK_LIBRARIES(world Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
IF(MSVC) IF(MSVC)
SET_TARGET_PROPERTIES(world PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") SET_TARGET_PROPERTIES(world PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(world "Ws2_32.lib") TARGET_LINK_LIBRARIES(world "Ws2_32.lib")
ENDIF(MSVC) ENDIF(MSVC)

View File

@ -28,6 +28,7 @@
#include "../common/moremath.h" #include "../common/moremath.h"
#include "parser.h" #include "parser.h"
#include "StringIDs.h" #include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "../common/features.h" #include "../common/features.h"

View File

@ -24,6 +24,7 @@
#include "zonedb.h" #include "zonedb.h"
#include "../common/packet_functions.h" #include "../common/packet_functions.h"
#include "../common/packet_dump.h" #include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
#include "../common/features.h" #include "../common/features.h"
#include "StringIDs.h" #include "StringIDs.h"

View File

@ -1576,7 +1576,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
return; return;
} }
for (map<uint32, AA_Ability>::const_iterator iter = aa_effects[aaid].begin(); iter != aa_effects[aaid].end(); ++iter) { for (std::map<uint32, AA_Ability>::const_iterator iter = aa_effects[aaid].begin(); iter != aa_effects[aaid].end(); ++iter) {
effect = iter->second.skill_id; effect = iter->second.skill_id;
base1 = iter->second.base1; base1 = iter->second.base1;
base2 = iter->second.base2; base2 = iter->second.base2;
@ -4779,7 +4779,7 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) {
std::list<uint32> ActiveBots = Bot::GetGroupedBotsByGroupId(botOwner->GetGroup()->GetID(), &errorMessage); std::list<uint32> ActiveBots = Bot::GetGroupedBotsByGroupId(botOwner->GetGroup()->GetID(), &errorMessage);
if(errorMessage.empty() && !ActiveBots.empty()) { if(errorMessage.empty() && !ActiveBots.empty()) {
for(list<uint32>::iterator itr = ActiveBots.begin(); itr != ActiveBots.end(); itr++) { for(std::list<uint32>::iterator itr = ActiveBots.begin(); itr != ActiveBots.end(); itr++) {
Bot* activeBot = Bot::LoadBot(*itr, &errorMessage); Bot* activeBot = Bot::LoadBot(*itr, &errorMessage);
if(!errorMessage.empty()) { if(!errorMessage.empty()) {
@ -6701,7 +6701,7 @@ int16 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id)
return 0; return 0;
} }
for (map<uint32, AA_Ability>::const_iterator iter = aa_effects[aa_ID].begin(); iter != aa_effects[aa_ID].end(); ++iter) for (std::map<uint32, AA_Ability>::const_iterator iter = aa_effects[aa_ID].begin(); iter != aa_effects[aa_ID].end(); ++iter)
{ {
effect = iter->second.skill_id; effect = iter->second.skill_id;
base1 = iter->second.base1; base1 = iter->second.base1;
@ -11136,7 +11136,7 @@ int32 Bot::CalcBaseEndurance()
int BonusUpto800 = int( at_most_800 / 4 ) ; int BonusUpto800 = int( at_most_800 / 4 ) ;
if(Stats > 400) { if(Stats > 400) {
Bonus400to800 = int( (at_most_800 - 400) / 4 ); Bonus400to800 = int( (at_most_800 - 400) / 4 );
HalfBonus400to800 = int( max( ( at_most_800 - 400 ), 0 ) / 8 ); HalfBonus400to800 = int( std::max( ( at_most_800 - 400 ), 0 ) / 8 );
if(Stats > 800) { if(Stats > 800) {
Bonus800plus = int( (Stats - 800) / 8 ) * 2; Bonus800plus = int( (Stats - 800) / 8 ) * 2;
@ -11598,7 +11598,7 @@ void Bot::ProcessClientZoneChange(Client* botOwner) {
if(botOwner) { if(botOwner) {
std::list<Bot*> BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CharacterID()); std::list<Bot*> BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CharacterID());
for(list<Bot*>::iterator itr = BotList.begin(); itr != BotList.end(); itr++) { for(std::list<Bot*>::iterator itr = BotList.begin(); itr != BotList.end(); itr++) {
Bot* tempBot = *itr; Bot* tempBot = *itr;
if(tempBot) { if(tempBot) {
@ -12322,7 +12322,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(std::string(sep->arg[2]).compare("all") == 0) if(std::string(sep->arg[2]).compare("all") == 0)
listAll = true; listAll = true;
else { else {
string botName = std::string(sep->arg[2]); std::string botName = std::string(sep->arg[2]);
Bot* tempBot = entity_list.GetBotByBotName(botName); Bot* tempBot = entity_list.GetBotByBotName(botName);
@ -15981,12 +15981,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
Bot* leaderBot = *botListItr; Bot* leaderBot = *botListItr;
if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) { if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) {
//start all heal rotations //start all heal rotations
list<Bot*> rotationMemberList; std::list<Bot*> rotationMemberList;
int index = 0; int index = 0;
rotationMemberList = GetBotsInHealRotation(leaderBot); rotationMemberList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) { for(std::list<Bot*>::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) {
Bot* tempBot = *rotationMemberItr; Bot* tempBot = *rotationMemberItr;
if(tempBot) { if(tempBot) {
@ -16014,7 +16014,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
if(leaderBot) { if(leaderBot) {
list<Bot*> botList; std::list<Bot*> botList;
int index = 0; int index = 0;
if (leaderBot->GetBotOwner() != c) { if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own."); c->Message(13, "You must target a bot that you own.");
@ -16023,7 +16023,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
botList = GetBotsInHealRotation(leaderBot); botList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot) { if(tempBot) {
@ -16058,11 +16058,11 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
Bot* leaderBot = *botListItr; Bot* leaderBot = *botListItr;
if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) { if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) {
//start all heal rotations //start all heal rotations
list<Bot*> rotationMemberList; std::list<Bot*> rotationMemberList;
rotationMemberList = GetBotsInHealRotation(leaderBot); rotationMemberList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) { for(std::list<Bot*>::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) {
Bot* tempBot = *rotationMemberItr; Bot* tempBot = *rotationMemberItr;
if(tempBot) { if(tempBot) {
@ -16087,7 +16087,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
if(leaderBot) { if(leaderBot) {
list<Bot*> botList; std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) { if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own."); c->Message(13, "You must target a bot that you own.");
return; return;
@ -16095,7 +16095,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
botList = GetBotsInHealRotation(leaderBot); botList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) { if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) {
@ -16146,7 +16146,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
if(leaderBot) { if(leaderBot) {
list<Bot*> botList; std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) { if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own."); c->Message(13, "You must target a bot that you own.");
return; return;
@ -16158,7 +16158,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(0, "Bot Heal Rotation- Leader: %s", leaderBot->GetCleanName()); c->Message(0, "Bot Heal Rotation- Leader: %s", leaderBot->GetCleanName());
c->Message(0, "Bot Heal Rotation- Timer: %1.1f", ((float)leaderBot->GetHealRotationTimer()/1000.0f)); c->Message(0, "Bot Heal Rotation- Timer: %1.1f", ((float)leaderBot->GetHealRotationTimer()/1000.0f));
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) { if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) {
@ -16208,7 +16208,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
if(leaderBot) { if(leaderBot) {
list<Bot*> botList; std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) { if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own."); c->Message(13, "You must target a bot that you own.");
return; return;
@ -16216,7 +16216,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
botList = GetBotsInHealRotation(leaderBot); botList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID())
@ -16248,7 +16248,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(leaderBot) { if(leaderBot) {
bool fastHeals = false; bool fastHeals = false;
list<Bot*> botList; std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) { if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own."); c->Message(13, "You must target a bot that you own.");
return; return;
@ -16264,7 +16264,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
botList = GetBotsInHealRotation(leaderBot); botList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID())
@ -16548,7 +16548,7 @@ Bot* EntityList::GetBotByBotID(uint32 botID) {
Bot* Result = 0; Bot* Result = 0;
if(botID > 0) { if(botID > 0) {
for(list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotID() == botID) { if(tempBot && tempBot->GetBotID() == botID) {
@ -16565,7 +16565,7 @@ Bot* EntityList::GetBotByBotName(std::string botName) {
Bot* Result = 0; Bot* Result = 0;
if(!botName.empty()) { if(!botName.empty()) {
for(list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot && std::string(tempBot->GetName()) == botName) { if(tempBot && std::string(tempBot->GetName()) == botName) {
@ -16609,11 +16609,11 @@ void EntityList::AddBot(Bot *newBot, bool SendSpawnPacket, bool dontqueue) {
} }
} }
list<Bot*> EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) { std::list<Bot*> EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) {
list<Bot*> Result; std::list<Bot*> Result;
if(botOwnerCharacterID > 0) { if(botOwnerCharacterID > 0) {
for(list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == botOwnerCharacterID) if(tempBot && tempBot->GetBotOwnerCharacterID() == botOwnerCharacterID)
@ -16676,7 +16676,7 @@ bool EntityList::RemoveBot(uint16 entityID) {
bool Result = false; bool Result = false;
if(entityID > 0) { if(entityID > 0) {
for(list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) for(std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++)
{ {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
@ -16695,7 +16695,7 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) {
const char *WindowTitle = "Bot Tracking Window"; const char *WindowTitle = "Bot Tracking Window";
string WindowText; std::string WindowText;
int LastCon = -1; int LastCon = -1;
int CurrentCon = 0; int CurrentCon = 0;
@ -17228,9 +17228,9 @@ bool Bot::AddHealRotationMember( Bot* healer ) {
//update leader's previous member (end of list) to new member and update rotation data //update leader's previous member (end of list) to new member and update rotation data
SetPrevHealRotationMember(healer); SetPrevHealRotationMember(healer);
list<Bot*> botList = GetBotsInHealRotation(this); std::list<Bot*> botList = GetBotsInHealRotation(this);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot) if(tempBot)
@ -17276,9 +17276,9 @@ bool Bot::RemoveHealRotationMember( Bot* healer ) {
} }
//update rotation data //update rotation data
list<Bot*> botList = GetBotsInHealRotation(leader); std::list<Bot*> botList = GetBotsInHealRotation(leader);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot) { if(tempBot) {
@ -17349,11 +17349,11 @@ bool Bot::AddHealRotationTarget( Mob* target ) {
if (_healRotationTargets[i] == 0) if (_healRotationTargets[i] == 0)
{ {
list<Bot*> botList = GetBotsInHealRotation(this); std::list<Bot*> botList = GetBotsInHealRotation(this);
_healRotationTargets[i] = target->GetID(); _healRotationTargets[i] = target->GetID();
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot && tempBot != this) { if(tempBot && tempBot != this) {
@ -17386,12 +17386,12 @@ bool Bot::RemoveHealRotationTarget( Mob* target ) {
//notify all heal rotation members to remove target //notify all heal rotation members to remove target
for(int i=0; i<MaxHealRotationTargets; i++){ for(int i=0; i<MaxHealRotationTargets; i++){
if(_healRotationTargets[i] == target->GetID()) { if(_healRotationTargets[i] == target->GetID()) {
list<Bot*> botList = GetBotsInHealRotation(this); std::list<Bot*> botList = GetBotsInHealRotation(this);
_healRotationTargets[i] = 0; _healRotationTargets[i] = 0;
index = i; index = i;
removed = true; removed = true;
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr; Bot* tempBot = *botListItr;
if(tempBot) if(tempBot)
@ -17499,8 +17499,8 @@ Mob* Bot::GetHealRotationTarget( uint8 index ) {
return target; return target;
} }
list<Bot*> Bot::GetBotsInHealRotation(Bot* rotationLeader) { std::list<Bot*> Bot::GetBotsInHealRotation(Bot* rotationLeader) {
list<Bot*> Result; std::list<Bot*> Result;
if(rotationLeader != nullptr) { if(rotationLeader != nullptr) {
Result.push_back(rotationLeader); Result.push_back(rotationLeader);

View File

@ -559,7 +559,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
std::list<BotSpell> inCombatBuffList = GetBotSpellsBySpellType(this, SpellType_InCombatBuff); std::list<BotSpell> inCombatBuffList = GetBotSpellsBySpellType(this, SpellType_InCombatBuff);
for(list<BotSpell>::iterator itr = inCombatBuffList.begin(); itr != inCombatBuffList.end(); itr++) { for(std::list<BotSpell>::iterator itr = inCombatBuffList.begin(); itr != inCombatBuffList.end(); itr++) {
BotSpell selectedBotSpell = *itr; BotSpell selectedBotSpell = *itr;
if(selectedBotSpell.SpellId == 0) if(selectedBotSpell.SpellId == 0)
@ -646,7 +646,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
const int maxDotSelect = 5; const int maxDotSelect = 5;
int dotSelectCounter = 0; int dotSelectCounter = 0;
for(list<BotSpell>::iterator itr = dotList.begin(); itr != dotList.end(); itr++) { for(std::list<BotSpell>::iterator itr = dotList.begin(); itr != dotList.end(); itr++) {
BotSpell selectedBotSpell = *itr; BotSpell selectedBotSpell = *itr;
if(selectedBotSpell.SpellId == 0) if(selectedBotSpell.SpellId == 0)
@ -2049,7 +2049,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
//Check for group cure first //Check for group cure first
if(countNeedsCured > 2) { if(countNeedsCured > 2) {
for(list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) { for(std::list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
BotSpell selectedBotSpell = *itr; BotSpell selectedBotSpell = *itr;
if(IsGroupSpell(itr->SpellId) && CheckSpellRecastTimers(botCaster, itr->SpellIndex)) { if(IsGroupSpell(itr->SpellId) && CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {
@ -2086,7 +2086,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
//no group cure for target- try to find single target spell //no group cure for target- try to find single target spell
if(!spellSelected) { if(!spellSelected) {
for(list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) { for(std::list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
BotSpell selectedBotSpell = *itr; BotSpell selectedBotSpell = *itr;
if(CheckSpellRecastTimers(botCaster, itr->SpellIndex)) { if(CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {

View File

@ -19,6 +19,8 @@
#define CLIENT_H #define CLIENT_H
class Client; class Client;
#include "../common/timer.h" #include "../common/timer.h"
#include "../common/ptimer.h" #include "../common/ptimer.h"
#include "../common/emu_opcodes.h" #include "../common/emu_opcodes.h"
@ -49,6 +51,7 @@ class Client;
#include "../common/item_struct.h" #include "../common/item_struct.h"
#include "../common/clientversions.h" #include "../common/clientversions.h"
#include "QGlobals.h" #include "QGlobals.h"
#include <algorithm>
#define CLIENT_TIMEOUT 90000 #define CLIENT_TIMEOUT 90000
#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing #define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing
@ -1101,7 +1104,7 @@ public:
void DuplicateLoreMessage(uint32 ItemID); void DuplicateLoreMessage(uint32 ItemID);
void GarbleMessage(char *, uint8); void GarbleMessage(char *, uint8);
void TickItemCheck(); void TickItemCheck();
void TryItemTick(int slot); void TryItemTick(int slot);
int16 GetActSTR() { return( std::min(GetMaxSTR(), GetSTR()) ); } int16 GetActSTR() { return( std::min(GetMaxSTR(), GetSTR()) ); }
int16 GetActSTA() { return( std::min(GetMaxSTA(), GetSTA()) ); } int16 GetActSTA() { return( std::min(GetMaxSTA(), GetSTA()) ); }
@ -1110,9 +1113,9 @@ public:
int16 GetActINT() { return( std::min(GetMaxINT(), GetINT()) ); } int16 GetActINT() { return( std::min(GetMaxINT(), GetINT()) ); }
int16 GetActWIS() { return( std::min(GetMaxWIS(), GetWIS()) ); } int16 GetActWIS() { return( std::min(GetMaxWIS(), GetWIS()) ); }
int16 GetActCHA() { return( std::min(GetMaxCHA(), GetCHA()) ); } int16 GetActCHA() { return( std::min(GetMaxCHA(), GetCHA()) ); }
void LoadAccountFlags(); void LoadAccountFlags();
void SetAccountFlag(std::string flag, std::string val); void SetAccountFlag(std::string flag, std::string val);
std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillType); std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillType);
int mod_client_damage(int damage, SkillType skillinuse, int hand, ItemInst* weapon, Mob* other); int mod_client_damage(int damage, SkillType skillinuse, int hand, ItemInst* weapon, Mob* other);
bool mod_client_message(char* message, uint8 chan_num); bool mod_client_message(char* message, uint8 chan_num);
bool mod_can_increase_skill(SkillType skillid, Mob* against_who); bool mod_can_increase_skill(SkillType skillid, Mob* against_who);
@ -1431,9 +1434,9 @@ private:
uint8 MaxXTargets; uint8 MaxXTargets;
bool XTargetAutoAddHaters; bool XTargetAutoAddHaters;
struct XTarget_Struct XTargets[XTARGET_HARDCAP]; struct XTarget_Struct XTargets[XTARGET_HARDCAP];
Timer ItemTickTimer; Timer ItemTickTimer;
std::map<std::string,std::string> accountflags; std::map<std::string,std::string> accountflags;
}; };

View File

@ -30,6 +30,7 @@
#include "questmgr.h" #include "questmgr.h"
#include "command.h" #include "command.h"
#include "../common/seperator.h" #include "../common/seperator.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
#include "QGlobals.h" #include "QGlobals.h"
#include "zone.h" #include "zone.h"

View File

@ -441,7 +441,7 @@ private:
Mob* GetMobByBotID(uint32 botID); Mob* GetMobByBotID(uint32 botID);
Bot* GetBotByBotID(uint32 botID); Bot* GetBotByBotID(uint32 botID);
Bot* GetBotByBotName(std::string botName); Bot* GetBotByBotName(std::string botName);
list<Bot*> GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID); std::list<Bot*> GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID);
bool Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint16 iSpellTypes); // TODO: Evaluate this closesly in hopes to eliminate bool Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint16 iSpellTypes); // TODO: Evaluate this closesly in hopes to eliminate
void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff

View File

@ -31,6 +31,7 @@
#include "watermap.h" #include "watermap.h"
#include "titles.h" #include "titles.h"
#include "StringIDs.h" #include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"

View File

@ -8,6 +8,7 @@
#include "../common/spdat.h" #include "../common/spdat.h"
#include "zone.h" #include "zone.h"
#include "StringIDs.h" #include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "QuestParserCollection.h" #include "QuestParserCollection.h"

View File

@ -40,6 +40,7 @@
#include "../common/spdat.h" #include "../common/spdat.h"
#include "../common/bodytypes.h" #include "../common/bodytypes.h"
#include "spawngroup.h" #include "spawngroup.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "StringIDs.h" #include "StringIDs.h"

View File

@ -27,6 +27,7 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
#define strcasecmp _stricmp #define strcasecmp _stricmp
#endif #endif
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "masterentity.h" #include "masterentity.h"

View File

@ -30,6 +30,7 @@
#include "../common/packet_dump.h" #include "../common/packet_dump.h"
#include "titles.h" #include "titles.h"
#include "StringIDs.h" #include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "QuestParserCollection.h" #include "QuestParserCollection.h"

View File

@ -20,6 +20,7 @@
#include "entity.h" #include "entity.h"
#include "masterentity.h" #include "masterentity.h"
#include "../common/spdat.h" #include "../common/spdat.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
/* /*

View File

@ -30,6 +30,7 @@
#include "../common/moremath.h" #include "../common/moremath.h"
#include "parser.h" #include "parser.h"
#include "StringIDs.h" #include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h" #include "../common/StringUtil.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "../common/features.h" #include "../common/features.h"