mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
tabbify and cleaned up std issues and min/max problems.
This commit is contained in:
parent
ac78841e55
commit
b4e65a8840
@ -15,16 +15,36 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "EQPacket.h"
|
||||||
|
#include "EQStream.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#include "Mutex.h"
|
||||||
|
#include "op_codes.h"
|
||||||
|
#include "CRC16.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <time.h>
|
#include <algorithm>
|
||||||
#include <sys/types.h>
|
|
||||||
|
#if defined(ZONE) || defined(WORLD)
|
||||||
|
#define RETRANSMITS
|
||||||
|
#endif
|
||||||
|
#ifdef RETRANSMITS
|
||||||
|
#include "rulesys.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
// have to undefine these since a macro version
|
||||||
|
// is defined in windef.h (which windows includes)
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
#else
|
#else
|
||||||
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@ -33,20 +53,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
#include "EQPacket.h"
|
|
||||||
#include "EQStream.h"
|
|
||||||
//#include "EQStreamFactory.h"
|
|
||||||
#include "misc.h"
|
|
||||||
#include "Mutex.h"
|
|
||||||
#include "op_codes.h"
|
|
||||||
#include "CRC16.h"
|
|
||||||
|
|
||||||
#if defined(ZONE) || defined(WORLD)
|
|
||||||
#define RETRANSMITS
|
|
||||||
#endif
|
|
||||||
#ifdef RETRANSMITS
|
|
||||||
#include "rulesys.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//for logsys
|
//for logsys
|
||||||
#define _L "%s:%d: "
|
#define _L "%s:%d: "
|
||||||
@ -567,7 +573,7 @@ uint32 length;
|
|||||||
|
|
||||||
while (used<length) {
|
while (used<length) {
|
||||||
out=new EQProtocolPacket(OP_Fragment,nullptr,MaxLen-4);
|
out=new EQProtocolPacket(OP_Fragment,nullptr,MaxLen-4);
|
||||||
chunksize=std::min(length-used,MaxLen-6);
|
chunksize= std::min(length-used,MaxLen-6);
|
||||||
memcpy(out->pBuffer+2,tmpbuff+used,chunksize);
|
memcpy(out->pBuffer+2,tmpbuff+used,chunksize);
|
||||||
out->size=chunksize+2;
|
out->size=chunksize+2;
|
||||||
SequencedPush(out);
|
SequencedPush(out);
|
||||||
|
|||||||
@ -16,10 +16,6 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <iostream>
|
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
@ -29,6 +25,11 @@
|
|||||||
#include "shareddb.h"
|
#include "shareddb.h"
|
||||||
#include "classes.h"
|
#include "classes.h"
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
int32 NextItemInstSerialNumber = 1;
|
int32 NextItemInstSerialNumber = 1;
|
||||||
|
|
||||||
static inline int32 GetNextItemInstSerialNumber() {
|
static inline int32 GetNextItemInstSerialNumber() {
|
||||||
@ -43,7 +44,7 @@ static inline int32 GetNextItemInstSerialNumber() {
|
|||||||
// NextItemInstSerialNumber is the next one to hand out.
|
// NextItemInstSerialNumber is the next one to hand out.
|
||||||
//
|
//
|
||||||
// It is very unlikely to reach 2,147,483,647. Maybe we should call abort(), rather than wrapping back to 1.
|
// It is very unlikely to reach 2,147,483,647. Maybe we should call abort(), rather than wrapping back to 1.
|
||||||
if(NextItemInstSerialNumber >= std::numeric_limits<uint32>::max())
|
if(NextItemInstSerialNumber >= INT_MAX)
|
||||||
NextItemInstSerialNumber = 1;
|
NextItemInstSerialNumber = 1;
|
||||||
else
|
else
|
||||||
NextItemInstSerialNumber++;
|
NextItemInstSerialNumber++;
|
||||||
@ -1051,6 +1052,26 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo
|
|||||||
return SLOT_INVALID;
|
return SLOT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Inventory::dumpBagContents(ItemInst *inst, iter_inst *it) {
|
||||||
|
iter_contents itb;
|
||||||
|
|
||||||
|
if (!inst || !inst->IsType(ItemClassContainer))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Go through bag, if bag
|
||||||
|
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||||
|
ItemInst* baginst = itb->second;
|
||||||
|
if(!baginst || !baginst->GetItem())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::string subSlot;
|
||||||
|
StringFormat(subSlot," Slot %d: %s (%d)", Inventory::CalcSlotId((*it)->first, itb->first),
|
||||||
|
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
||||||
|
std::cout << subSlot << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Inventory::dumpItemCollection(const std::map<int16, ItemInst*> &collection) {
|
void Inventory::dumpItemCollection(const std::map<int16, ItemInst*> &collection) {
|
||||||
iter_inst it;
|
iter_inst it;
|
||||||
iter_contents itb;
|
iter_contents itb;
|
||||||
|
|||||||
@ -15,21 +15,25 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "ProcLauncher.h"
|
#include "ProcLauncher.h"
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ProcLauncher ProcLauncher::s_launcher;
|
ProcLauncher ProcLauncher::s_launcher;
|
||||||
@ -165,8 +169,8 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) {
|
|||||||
// Create the child process.
|
// Create the child process.
|
||||||
|
|
||||||
//glue together all the nice command line arguments
|
//glue together all the nice command line arguments
|
||||||
string args(it->program);
|
std::string args(it->program);
|
||||||
vector<string>::iterator cur, end;
|
std::vector<std::string>::iterator cur, end;
|
||||||
cur = it->args.begin();
|
cur = it->args.begin();
|
||||||
end = it->args.end();
|
end = it->args.end();
|
||||||
for(; cur != end; cur++) {
|
for(; cur != end; cur++) {
|
||||||
|
|||||||
@ -19,9 +19,11 @@
|
|||||||
#include "Encryption.h"
|
#include "Encryption.h"
|
||||||
#include "ErrorLog.h"
|
#include "ErrorLog.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
extern ErrorLog *server_log;
|
extern ErrorLog *server_log;
|
||||||
|
|
||||||
bool Encryption::LoadCrypto(string name)
|
bool Encryption::LoadCrypto(std::string name)
|
||||||
{
|
{
|
||||||
if(!Load(name.c_str()))
|
if(!Load(name.c_str()))
|
||||||
{
|
{
|
||||||
|
|||||||
74
zone/bot.cpp
74
zone/bot.cpp
@ -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);
|
||||||
|
|||||||
@ -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)) {
|
||||||
|
|||||||
@ -28,27 +28,38 @@ class Client;
|
|||||||
#include "../common/EQPacket.h"
|
#include "../common/EQPacket.h"
|
||||||
#include "../common/linked_list.h"
|
#include "../common/linked_list.h"
|
||||||
#include "../common/extprofile.h"
|
#include "../common/extprofile.h"
|
||||||
#include "zonedb.h"
|
|
||||||
#include "errno.h"
|
|
||||||
#include "../common/classes.h"
|
#include "../common/classes.h"
|
||||||
#include "../common/races.h"
|
#include "../common/races.h"
|
||||||
#include "../common/deity.h"
|
#include "../common/deity.h"
|
||||||
|
#include "../common/seperator.h"
|
||||||
|
#include "../common/Item.h"
|
||||||
|
#include "../common/guilds.h"
|
||||||
|
#include "../common/item_struct.h"
|
||||||
|
#include "../common/clientversions.h"
|
||||||
|
|
||||||
|
#include "zonedb.h"
|
||||||
|
#include "errno.h"
|
||||||
#include "mob.h"
|
#include "mob.h"
|
||||||
#include "npc.h"
|
#include "npc.h"
|
||||||
#include "merc.h"
|
#include "merc.h"
|
||||||
#include "zone.h"
|
#include "zone.h"
|
||||||
#include "AA.h"
|
#include "AA.h"
|
||||||
#include "../common/seperator.h"
|
|
||||||
#include "../common/Item.h"
|
|
||||||
#include "updatemgr.h"
|
#include "updatemgr.h"
|
||||||
#include "../common/guilds.h"
|
|
||||||
#include "questmgr.h"
|
#include "questmgr.h"
|
||||||
|
#include "QGlobals.h"
|
||||||
|
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
// since windows defines these within windef.h (which windows.h include)
|
||||||
|
// we are required to undefine these to use min and max from <algorithm>
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../common/item_struct.h"
|
#include <algorithm>
|
||||||
#include "../common/clientversions.h"
|
|
||||||
#include "QGlobals.h"
|
|
||||||
|
|
||||||
#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
|
||||||
|
|||||||
@ -15,19 +15,21 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "../common/debug.h"
|
#include "../common/debug.h"
|
||||||
#include "masterentity.h"
|
|
||||||
#include "worldserver.h"
|
|
||||||
#include "zonedb.h"
|
|
||||||
#include "../common/spdat.h"
|
#include "../common/spdat.h"
|
||||||
#include "../common/packet_dump.h"
|
#include "../common/packet_dump.h"
|
||||||
#include "../common/packet_functions.h"
|
#include "../common/packet_functions.h"
|
||||||
#include "petitions.h"
|
|
||||||
#include "../common/serverinfo.h"
|
#include "../common/serverinfo.h"
|
||||||
#include "../common/ZoneNumbers.h"
|
#include "../common/ZoneNumbers.h"
|
||||||
#include "../common/moremath.h"
|
#include "../common/moremath.h"
|
||||||
#include "../common/guilds.h"
|
#include "../common/guilds.h"
|
||||||
#include "../common/logsys.h"
|
#include "../common/logsys.h"
|
||||||
|
#include "masterentity.h"
|
||||||
|
#include "worldserver.h"
|
||||||
|
#include "zonedb.h"
|
||||||
|
#include "petitions.h"
|
||||||
#include "StringIDs.h"
|
#include "StringIDs.h"
|
||||||
#include "NpcAI.h"
|
#include "NpcAI.h"
|
||||||
|
|
||||||
|
|||||||
@ -20,12 +20,13 @@
|
|||||||
|
|
||||||
#include "../common/types.h"
|
#include "../common/types.h"
|
||||||
#include "../common/linked_list.h"
|
#include "../common/linked_list.h"
|
||||||
#include "zonedb.h"
|
|
||||||
#include "../common/eq_constants.h"
|
|
||||||
#include "zonedump.h"
|
|
||||||
#include "zonedbasync.h"
|
|
||||||
#include "../common/servertalk.h"
|
#include "../common/servertalk.h"
|
||||||
#include "../common/bodytypes.h"
|
#include "../common/bodytypes.h"
|
||||||
|
#include "../common/eq_constants.h"
|
||||||
|
|
||||||
|
#include "zonedb.h"
|
||||||
|
#include "zonedump.h"
|
||||||
|
#include "zonedbasync.h"
|
||||||
#include "QGlobals.h"
|
#include "QGlobals.h"
|
||||||
|
|
||||||
// max number of newspawns to send per bulk packet
|
// max number of newspawns to send per bulk packet
|
||||||
@ -441,7 +442,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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user