Merge branch 'master' of https://github.com/EQEmu/Server into EQEmu-master

Conflicts:
	zone/client.h
	zone/mod_functions.cpp
	zone/mod_functions_base.cpp
This commit is contained in:
root
2013-06-01 19:17:23 -05:00
231 changed files with 2955 additions and 3061 deletions
+4 -4
View File
@@ -34,14 +34,14 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
#include "../common/classes.h"
#include "../common/eq_packet_structs.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/logsys.h"
#include "zonedb.h"
#include "StringIDs.h"
//static data arrays, really not big enough to warrant shared mem.
AA_DBAction AA_Actions[aaHighestID][MAX_AA_ACTION_RANKS]; //[aaid][rank]
map<uint32,SendAA_Struct*>aas_send;
std::map<uint32,SendAA_Struct*>aas_send;
std::map<uint32, std::map<uint32, AA_Ability> > aa_effects; //stores the effects from the aa_effects table in memory
std::map<uint32, AALevelCost_Struct> AARequiredLevelAndCost;
@@ -1396,7 +1396,7 @@ void Client::SendAAList(){
}
uint32 Client::GetAA(uint32 aa_id) const {
map<uint32,uint8>::const_iterator res;
std::map<uint32,uint8>::const_iterator res;
res = aa_points.find(aa_id);
if(res != aa_points.end()) {
return(res->second);
@@ -1500,7 +1500,7 @@ void Client::ResetAA(){
aa[i]->AA = 0;
aa[i]->value = 0;
}
map<uint32,uint8>::iterator itr;
std::map<uint32,uint8>::iterator itr;
for(itr=aa_points.begin();itr!=aa_points.end();itr++)
aa_points[itr->first] = 0;
+2 -5
View File
@@ -6,10 +6,7 @@
#define MANA_BURN 664
#include <map>
using namespace std;
#define MAX_SWARM_PETS 12 //this can change as long as you make more coords (swarm_pet_x/swarm_pet_y)
@@ -2140,11 +2137,11 @@ struct AALevelCost_Struct
//assumes that no activatable AA has more than 5 ranks
#define MAX_AA_ACTION_RANKS 20
extern AA_DBAction AA_Actions[aaHighestID][MAX_AA_ACTION_RANKS]; //[aaid][rank]
extern map<uint16, AA_SwarmPet> AA_SwarmPets; //key=spell_id
extern std::map<uint16, AA_SwarmPet> AA_SwarmPets; //key=spell_id
#define AA_Choose3(val, v1, v2, v3) (val==1?v1:(val==2?v2:v3))
extern map<uint32,SendAA_Struct*>aas_send;
extern std::map<uint32,SendAA_Struct*>aas_send;
extern std::map<uint32, std::map<uint32, AA_Ability> > aa_effects;
extern std::map<uint32, AALevelCost_Struct> AARequiredLevelAndCost;
+2
View File
@@ -154,6 +154,8 @@ SET(zone_headers
ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers})
INSTALL(TARGETS zone RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
ADD_DEFINITIONS(-DZONE)
TARGET_LINK_LIBRARIES(zone Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
+1 -1
View File
@@ -1018,7 +1018,7 @@ float Map::FindClosestZ(VERTEX p ) const
float ClosestZ = -999999;
for(list<float>::iterator Iterator = ZSet.begin(); Iterator != ZSet.end(); ++Iterator)
for(std::list<float>::iterator Iterator = ZSet.begin(); Iterator != ZSet.end(); ++Iterator)
{
if(ABS(p.z - (*Iterator)) < ABS(p.z - ClosestZ))
ClosestZ = (*Iterator);
+16 -17
View File
@@ -17,9 +17,7 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <iomanip>
using namespace std;
#include <stdlib.h>
#include <math.h>
#include <algorithm>
@@ -31,6 +29,7 @@ using namespace std;
#include "parser.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "../common/features.h"
#include "QuestParserCollection.h"
@@ -102,12 +101,12 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
) {
#if MobAI_DEBUG_Spells >= 21
cout << "Mob::AICastSpell: Casting: spellid=" << AIspells[i].spellid
std::cout << "Mob::AICastSpell: Casting: spellid=" << AIspells[i].spellid
<< ", tar=" << tar->GetName()
<< ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range *spells[AIspells[i].spellid].range
<< ", mana_cost[" << mana_cost << "]<=" << GetMana()
<< ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime()
<< ", type=" << AIspells[i].type << endl;
<< ", type=" << AIspells[i].type << std::endl;
#endif
switch (AIspells[i].type) {
@@ -310,14 +309,14 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
break;
}
default: {
cout<<"Error: Unknown spell type in AICastSpell. caster:"<<this->GetName()<<" type:"<<AIspells[i].type<<" slot:"<<i<<endl;
std::cout << "Error: Unknown spell type in AICastSpell. caster:" << this->GetName() << " type:" << AIspells[i].type << " slot:" << i << std::endl;
break;
}
}
}
#if MobAI_DEBUG_Spells >= 21
else {
cout << "Mob::AICastSpell: NotCasting: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range << ", mana_cost[" << mana_cost << "]<=" << GetMana() << ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime() << endl;
std::cout << "Mob::AICastSpell: NotCasting: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range << ", mana_cost[" << mana_cost << "]<=" << GetMana() << ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime() << std::endl;
}
#endif
}
@@ -327,7 +326,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore) {
#if MobAI_DEBUG_Spells >= 1
cout << "Mob::AIDoSpellCast: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", mana=" << mana_cost << ", Name: " << spells[AIspells[i].spellid].name << endl;
std::cout << "Mob::AIDoSpellCast: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", mana=" << mana_cost << ", Name: " << spells[AIspells[i].spellid].name << std::endl;
#endif
casting_spell_AIindex = i;
@@ -1845,7 +1844,7 @@ bool NPC::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) {
_ZP(Mob_AI_Process_autocast);
#if MobAI_DEBUG_Spells >= 25
cout << "Non-Engaged autocast check triggered: " << this->GetName() << endl;
std::cout << "Non-Engaged autocast check triggered: " << this->GetName() << std::endl;
#endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
if (!AICastSpell(this, 100, SpellType_Heal | SpellType_Buff | SpellType_Pet)) {
@@ -2206,20 +2205,20 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
DBnpcspells_Struct* parentlist = database.GetNPCSpells(spell_list->parent_list);
uint32 i;
#if MobAI_DEBUG_Spells >= 10
cout << "Loading NPCSpells onto " << this->GetName() << ": dbspellsid=" << iDBSpellsID;
std::cout << "Loading NPCSpells onto " << this->GetName() << ": dbspellsid=" << iDBSpellsID;
if (spell_list) {
cout << " (found, " << spell_list->numentries << "), parentlist=" << spell_list->parent_list;
std::cout << " (found, " << spell_list->numentries << "), parentlist=" << spell_list->parent_list;
if (spell_list->parent_list) {
if (parentlist) {
cout << " (found, " << parentlist->numentries << ")";
std::cout << " (found, " << parentlist->numentries << ")";
}
else
cout << " (not found)";
std::cout << " (not found)";
}
}
else
cout << " (not found)";
cout << endl;
std::cout << " (not found)";
std::cout << std::endl;
#endif
int16 attack_proc_spell = -1;
int8 proc_chance = 3;
@@ -2379,7 +2378,7 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) {
return npc_spells_cache[iDBSpellsID];
}
else {
cerr << "Error in AddNPCSpells query1 '" << query << "' " << errbuf << endl;
std::cerr << "Error in AddNPCSpells query1 '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
@@ -2389,7 +2388,7 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) {
}
}
else {
cerr << "Error in AddNPCSpells query1 '" << query << "' " << errbuf << endl;
std::cerr << "Error in AddNPCSpells query1 '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
@@ -2418,7 +2417,7 @@ uint32 ZoneDatabase::GetMaxNPCSpellsID() {
mysql_free_result(result);
}
else {
cerr << "Error in GetMaxNPCSpellsID query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetMaxNPCSpellsID query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
+2 -2
View File
@@ -25,9 +25,9 @@
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/features.h"
#include "StringIDs.h"
using namespace std;
#include "QuestParserCollection.h"
@@ -664,7 +664,7 @@ Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Gro
mysql_free_result(result);
}
else {
cerr << "Error in LoadGroundSpawns query '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadGroundSpawns query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return gs;
+40 -42
View File
@@ -26,18 +26,16 @@ Child of the Mob class.
#include <math.h>
#include <iostream>
#include <sstream>
using namespace std;
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
#include "masterentity.h"
#include "../common/packet_functions.h"
#include "../common/StringUtil.h"
#include "../common/crc32.h"
#include "StringIDs.h"
#include "worldserver.h"
@@ -617,7 +615,7 @@ bool Corpse::Save() {
dbid = database.UpdatePlayerCorpse(dbid, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), (uchar*) dbpc, tmpsize, x_pos, y_pos, z_pos, heading,Rezzed());
safe_delete_array(dbpc);
if (dbid == 0) {
cout << "Error: Failed to save player corpse '" << this->GetName() << "'" << endl;
std::cout << "Error: Failed to save player corpse '" << this->GetName() << "'" << std::endl;
return false;
}
return true;
@@ -890,7 +888,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if(IsPlayerCorpse() && dbid == 0) {
// SendLootReqErrorPacket(client, 0);
client->Message(13, "Warning: Corpse's dbid = 0! Corpse will not survive zone shutdown!");
cout << "Error: PlayerCorpse::MakeLootRequestPackets: dbid = 0!" << endl;
std::cout << "Error: PlayerCorpse::MakeLootRequestPackets: dbid = 0!" << std::endl;
// return;
}
@@ -1456,12 +1454,12 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in DeleteGraveyard query " << errbuf << endl;
std::cerr << "Error1 in DeleteGraveyard query " << errbuf << std::endl;
return false;
}
if (affected_rows == 0) {
cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << endl;
std::cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << std::endl;
return false;
}
@@ -1469,13 +1467,13 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error3 in DeleteGraveyard query " << errbuf << endl;
std::cerr << "Error3 in DeleteGraveyard query " << errbuf << std::endl;
return false;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << endl;
std::cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << std::endl;
return false;
}
@@ -1491,13 +1489,13 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << endl;
std::cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in AddGraveyardIDToZone query: affected_rows = 0" << endl;
std::cerr << "Error2 in AddGraveyardIDToZone query: affected_rows = 0" << std::endl;
return 0;
}
@@ -1514,18 +1512,18 @@ uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &new_graveyard_id)) {
safe_delete_array(query);
cerr << "Error1 in NewGraveyardRecord query " << errbuf << endl;
std::cerr << "Error1 in NewGraveyardRecord query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in NewGraveyardRecord query: affected_rows = 0" << endl;
std::cerr << "Error2 in NewGraveyardRecord query: affected_rows = 0" << std::endl;
return 0;
}
if(new_graveyard_id <= 0) {
cerr << "Error3 in NewGraveyardRecord query: new_graveyard_id <= 0" << endl;
std::cerr << "Error3 in NewGraveyardRecord query: new_graveyard_id <= 0" << std::endl;
return 0;
}
@@ -1542,13 +1540,13 @@ uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 in
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << endl;
std::cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in GraveyardPlayerCorpse query: affected_rows = 0" << endl;
std::cerr << "Error2 in GraveyardPlayerCorpse query: affected_rows = 0" << std::endl;
return 0;
}
return dbid;
@@ -1567,18 +1565,18 @@ uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char*
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << endl;
std::cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in UpdatePlayerCorpse query: affected_rows = 0" << endl;
std::cerr << "Error2 in UpdatePlayerCorpse query: affected_rows = 0" << std::endl;
return 0;
}
if(rezzed){
if (!RunQuery(query, MakeAnyLenString(&query, "update player_corpses set rezzed = 1 WHERE id=%d",dbid), errbuf)) {
cerr << "Error in UpdatePlayerCorpse/Rezzed query: " << errbuf << endl;
std::cerr << "Error in UpdatePlayerCorpse/Rezzed query: " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -1614,18 +1612,18 @@ uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uin
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &last_insert_id)) {
safe_delete_array(query);
cerr << "Error1 in CreatePlayerCorpse query " << errbuf << endl;
std::cerr << "Error1 in CreatePlayerCorpse query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in CreatePlayerCorpse query: affected_rows = 0" << endl;
std::cerr << "Error2 in CreatePlayerCorpse query: affected_rows = 0" << std::endl;
return 0;
}
if (last_insert_id == 0) {
cerr << "Error3 in CreatePlayerCorpse query: last_insert_id = 0" << endl;
std::cerr << "Error3 in CreatePlayerCorpse query: last_insert_id = 0" << std::endl;
return 0;
}
@@ -1653,15 +1651,15 @@ bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const ch
if (affected_rows == 1)
result = true;
else
cerr << "Error in CreatePlayerCorpseBackup query: affected_rows != 1" << endl;
std::cerr << "Error in CreatePlayerCorpseBackup query: affected_rows != 1" << std::endl;
}
else
cerr << "Error in CreatePlayerCorpseBackup query " << errbuf << endl;
std::cerr << "Error in CreatePlayerCorpseBackup query " << errbuf << std::endl;
}
safe_delete_array(query);
}
else {
cerr << "Error in CreatePlayerCorpseBackup: dbid = 0" << endl;
std::cerr << "Error in CreatePlayerCorpseBackup: dbid = 0" << std::endl;
}
return result;
}
@@ -1679,7 +1677,7 @@ uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) {
mysql_free_result(result);
}
else {
cerr << "Error in GetPlayerBurriedCorpseCount query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetPlayerBurriedCorpseCount query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1700,7 +1698,7 @@ uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) {
mysql_free_result(result);
}
else {
cerr << "Error in GetPlayerCorpseCount query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetPlayerCorpseCount query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1723,7 +1721,7 @@ uint32 ZoneDatabase::GetPlayerCorpseID(uint32 char_id, uint8 corpse) {
mysql_free_result(result);
}
else {
cerr << "Error in GetPlayerCorpseID query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetPlayerCorpseID query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1769,7 +1767,7 @@ Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zone
mysql_free_result(result);
}
else {
cerr << "Error in SummonBurriedPlayerCorpse query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SummonBurriedPlayerCorpse query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1836,10 +1834,10 @@ bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new
if (affected_rows == 1)
Result = true;
else
cerr << "Error2 in UnburyPlayerCorpse query: affected_rows NOT EQUAL to 1, as expected." << endl;
std::cerr << "Error2 in UnburyPlayerCorpse query: affected_rows NOT EQUAL to 1, as expected." << std::endl;
}
else
cerr << "Error1 in UnburyPlayerCorpse query " << errbuf << endl;
std::cerr << "Error1 in UnburyPlayerCorpse query " << errbuf << std::endl;
safe_delete_array(query);
@@ -1865,8 +1863,8 @@ Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
mysql_free_result(result);
}
else {
cerr << "Error in LoadPlayerCorpse query '" << query << "' " << errbuf << endl;
cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n";
std::cerr << "Error in LoadPlayerCorpse query '" << query << "' " << errbuf << std::endl;
std::cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n";
}
safe_delete_array(query);
@@ -1897,8 +1895,8 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
mysql_free_result(result);
}
else {
cerr << "Error in LoadPlayerCorpses query '" << query << "' " << errbuf << endl;
cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n";
std::cerr << "Error in LoadPlayerCorpses query '" << query << "' " << errbuf << std::endl;
std::cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n";
safe_delete_array(query);
return false;
}
@@ -1922,7 +1920,7 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
}
}
else {
cerr << "Error in GetFirstCorpseID query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetFirstCorpseID query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
@@ -1936,7 +1934,7 @@ bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) {
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE id=%d", dbid), errbuf)) {
cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << endl;
std::cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -1950,7 +1948,7 @@ bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) {
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE charid=%d", charid), errbuf)) {
cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << endl;
std::cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -1964,7 +1962,7 @@ bool ZoneDatabase::DeletePlayerCorpse(uint32 dbid) {
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where id=%d", dbid), errbuf)) {
cerr << "Error in DeletePlayerCorpse query '" << query << "' " << errbuf << endl;
std::cerr << "Error in DeletePlayerCorpse query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
+78 -3
View File
@@ -1,6 +1,8 @@
#include "../common/debug.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "QGlobals.h"
#include "masterentity.h"
#include "zone.h"
#include "zonedb.h"
void QGlobalCache::AddGlobal(uint32 id, QGlobal global)
@@ -16,7 +18,9 @@ void QGlobalCache::RemoveGlobal(std::string name, uint32 npcID, uint32 charID, u
{
if(name.compare((*iter).name) == 0)
{
if((npcID == (*iter).npc_id || (*iter).npc_id == 0) && (charID == (*iter).char_id || (*iter).char_id == 0) && (zoneID == (*iter).zone_id || (*iter).zone_id == 0))
if((npcID == (*iter).npc_id || (*iter).npc_id == 0) &&
(charID == (*iter).char_id || (*iter).char_id == 0) &&
(zoneID == (*iter).zone_id || (*iter).zone_id == 0))
{
qGlobalBucket.erase(iter);
return;
@@ -33,7 +37,8 @@ void QGlobalCache::Combine(std::list<QGlobal> &cacheA, std::list<QGlobal> cacheB
{
QGlobal cur = (*iter);
if((cur.npc_id == npcID || cur.npc_id == 0) && (cur.char_id == charID || cur.char_id == 0) && (cur.zone_id == zoneID || cur.zone_id == 0))
if((cur.npc_id == npcID || cur.npc_id == 0) && (cur.char_id == charID || cur.char_id == 0) &&
(cur.zone_id == zoneID || cur.zone_id == 0))
{
if(Timer::GetTimeSeconds() < cur.expdate)
{
@@ -44,6 +49,76 @@ void QGlobalCache::Combine(std::list<QGlobal> &cacheA, std::list<QGlobal> cacheB
}
}
void QGlobalCache::GetQGlobals(std::list<QGlobal> &globals, NPC *n, Client *c, Zone *z) {
globals.clear();
QGlobalCache *npc_c = nullptr;
QGlobalCache *char_c = nullptr;
QGlobalCache *zone_c = nullptr;
uint32 npc_id = 0;
uint32 char_id = 0;
uint32 zone_id = 0;
if(n) {
npc_id = n->GetNPCTypeID();
npc_c = n->GetQGlobals();
}
if(c) {
char_id = c->CharacterID();
char_c = c->GetQGlobals();
}
if(z) {
zone_id = z->GetZoneID();
zone_c = z->GetQGlobals();
}
if(!npc_c && n) {
npc_c = n->CreateQGlobals();
npc_c->LoadByNPCID(npc_id);
}
if(!char_c && c) {
char_c = c->CreateQGlobals();
char_c->LoadByCharID(char_id);
}
if(!zone_c && z) {
zone_c = z->CreateQGlobals();
zone_c->LoadByZoneID(zone_id);
zone_c->LoadByGlobalContext();
}
if(npc_c) {
QGlobalCache::Combine(globals, npc_c->GetBucket(), npc_id, char_id, zone_id);
}
if(char_c) {
QGlobalCache::Combine(globals, char_c->GetBucket(), npc_id, char_id, zone_id);
}
if(zone_c) {
QGlobalCache::Combine(globals, zone_c->GetBucket(), npc_id, char_id, zone_id);
}
}
bool QGlobalCache::GetQGlobal(QGlobal &g, std::string name, NPC *n, Client *c, Zone *z) {
std::list<QGlobal> globals;
QGlobalCache::GetQGlobals(globals, n, c, z);
auto iter = globals.begin();
while(iter != globals.end()) {
if(iter->name.compare(name) == 0) {
g = (*iter);
return true;
}
++iter;
}
return false;
}
void QGlobalCache::PurgeExpiredGlobals()
{
if(!qGlobalBucket.size())
+6
View File
@@ -6,6 +6,10 @@
#include <stdlib.h>
#include "../common/timer.h"
class NPC;
class Client;
class Zone;
struct QGlobal
{
QGlobal() { }
@@ -29,6 +33,8 @@ public:
//assumes cacheA is already a valid or empty list and doesn't check for valid items.
static void Combine(std::list<QGlobal> &cacheA, std::list<QGlobal> cacheB, uint32 npcID, uint32 charID, uint32 zoneID);
static void GetQGlobals(std::list<QGlobal> &globals, NPC *n, Client *c, Zone *z);
static bool GetQGlobal(QGlobal &g, std::string name, NPC *n, Client *c, Zone *z);
void PurgeExpiredGlobals();
void LoadByNPCID(uint32 npcID); //npc
+1 -1
View File
@@ -23,7 +23,7 @@
class ZoneConfig : public EQEmuConfig {
public:
uint16 ZonePort;
string ZoneAddress;
std::string ZoneAddress;
private:
+1 -1
View File
@@ -187,7 +187,7 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
char namebuf[256];
if(!database.GetFactionName(mob_primary, namebuf, sizeof(namebuf)))
strcpy(namebuf, "(Unknown)");
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list.begin();
end = faction_list.end();
bool res = false;
+8 -9
View File
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <math.h>
#include <iostream>
using namespace std;
#include <assert.h>
#include "masterentity.h"
@@ -38,7 +37,7 @@ using namespace std;
#include "../common/spdat.h"
#include "zone.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
#include "watermap.h"
@@ -1425,7 +1424,7 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_
if(dead)
return; //cant die more than once...
int exploss;
int exploss = 0;
mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill);
@@ -1477,7 +1476,7 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_
if (killerMob != nullptr)
{
if (killerMob->IsNPC()) {
parse->EventNPC(EVENT_SLAY, killerMob->CastToNPC(), this, "", 0);
parse->EventNPC(EVENT_SLAY, killerMob->CastToNPC(), this, "", 0);
mod_client_death_npc(killerMob);
@@ -2128,7 +2127,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
/* Send the EVENT_KILLED_MERIT event for all raid members */
for (int i = 0; i < MAX_RAID_MEMBERS; i++) {
if (kr->members[i].member != nullptr) { // If Group Member is Client
parse->EventNPC(EVENT_KILLED_MERIT, this, kr->members[i].member, "killed", 0);
parse->EventNPC(EVENT_KILLED_MERIT, this, kr->members[i].member, "killed", 0);
mod_npc_killed_merit(kr->members[i].member);
@@ -2171,7 +2170,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
for (int i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (kg->members[i] != nullptr && kg->members[i]->IsClient()) { // If Group Member is Client
Client *c = kg->members[i]->CastToClient();
parse->EventNPC(EVENT_KILLED_MERIT, this, c, "killed", 0);
parse->EventNPC(EVENT_KILLED_MERIT, this, c, "killed", 0);
mod_npc_killed_merit(c);
@@ -2218,7 +2217,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
}
}
/* Send the EVENT_KILLED_MERIT event */
parse->EventNPC(EVENT_KILLED_MERIT, this, give_exp_client, "killed", 0);
parse->EventNPC(EVENT_KILLED_MERIT, this, give_exp_client, "killed", 0);
mod_npc_killed_merit(give_exp_client);
@@ -2351,7 +2350,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
// Parse quests even if we're killed by an NPC
if(killerMob) {
Mob *oos = killerMob->GetOwnerOrSelf();
parse->EventNPC(EVENT_DEATH, this, oos, "", 0);
parse->EventNPC(EVENT_DEATH, this, oos, "", 0);
mod_npc_killed(oos);
@@ -4238,7 +4237,7 @@ void Mob::ApplyMeleeDamageBonus(uint16 skill, int32 &damage){
if(!RuleB(Combat, UseIntervalAC)){
if(IsNPC()){ //across the board NPC damage bonuses.
//only account for STR here, assume their base STR was factored into their DB damages
//only account for STR here, assume their base STR was factored into their DB damages
int dmgbonusmod = 0;
dmgbonusmod += (100*(itembonuses.STR + spellbonuses.STR))/3;
dmgbonusmod += (100*(spellbonuses.ATK + itembonuses.ATK))/5;
+5 -6
View File
@@ -24,13 +24,12 @@ target to center around.
*/
#include "../common/debug.h"
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
#include "masterentity.h"
+1 -1
View File
@@ -615,7 +615,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
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;
base1 = iter->second.base1;
base2 = iter->second.base2;
+38 -37
View File
@@ -4,6 +4,7 @@
#include "object.h"
#include "doors.h"
#include "QuestParserCollection.h"
#include "../common/StringUtil.h"
extern volatile bool ZoneLoaded;
@@ -1575,7 +1576,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
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;
base1 = iter->second.base1;
base2 = iter->second.base2;
@@ -4778,7 +4779,7 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) {
std::list<uint32> ActiveBots = Bot::GetGroupedBotsByGroupId(botOwner->GetGroup()->GetID(), &errorMessage);
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);
if(!errorMessage.empty()) {
@@ -6700,7 +6701,7 @@ int16 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id)
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;
base1 = iter->second.base1;
@@ -11135,7 +11136,7 @@ int32 Bot::CalcBaseEndurance()
int BonusUpto800 = int( at_most_800 / 4 ) ;
if(Stats > 400) {
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) {
Bonus800plus = int( (Stats - 800) / 8 ) * 2;
@@ -11597,7 +11598,7 @@ void Bot::ProcessClientZoneChange(Client* botOwner) {
if(botOwner) {
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;
if(tempBot) {
@@ -12321,7 +12322,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(std::string(sep->arg[2]).compare("all") == 0)
listAll = true;
else {
string botName = std::string(sep->arg[2]);
std::string botName = std::string(sep->arg[2]);
Bot* tempBot = entity_list.GetBotByBotName(botName);
@@ -15980,12 +15981,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
Bot* leaderBot = *botListItr;
if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) {
//start all heal rotations
list<Bot*> rotationMemberList;
std::list<Bot*> rotationMemberList;
int index = 0;
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;
if(tempBot) {
@@ -16013,7 +16014,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
if(leaderBot) {
list<Bot*> botList;
std::list<Bot*> botList;
int index = 0;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
@@ -16022,7 +16023,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
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;
if(tempBot) {
@@ -16057,11 +16058,11 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
Bot* leaderBot = *botListItr;
if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) {
//start all heal rotations
list<Bot*> rotationMemberList;
std::list<Bot*> rotationMemberList;
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;
if(tempBot) {
@@ -16086,7 +16087,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
if(leaderBot) {
list<Bot*> botList;
std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
return;
@@ -16094,7 +16095,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
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;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) {
@@ -16145,7 +16146,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
if(leaderBot) {
list<Bot*> botList;
std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
return;
@@ -16157,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- 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;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) {
@@ -16207,7 +16208,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
if(leaderBot) {
list<Bot*> botList;
std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
return;
@@ -16215,7 +16216,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
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;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID())
@@ -16247,7 +16248,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(leaderBot) {
bool fastHeals = false;
list<Bot*> botList;
std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
return;
@@ -16263,7 +16264,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
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;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID())
@@ -16547,7 +16548,7 @@ Bot* EntityList::GetBotByBotID(uint32 botID) {
Bot* Result = 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;
if(tempBot && tempBot->GetBotID() == botID) {
@@ -16564,7 +16565,7 @@ Bot* EntityList::GetBotByBotName(std::string botName) {
Bot* Result = 0;
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;
if(tempBot && std::string(tempBot->GetName()) == botName) {
@@ -16608,11 +16609,11 @@ void EntityList::AddBot(Bot *newBot, bool SendSpawnPacket, bool dontqueue) {
}
}
list<Bot*> EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) {
list<Bot*> Result;
std::list<Bot*> EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) {
std::list<Bot*> Result;
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;
if(tempBot && tempBot->GetBotOwnerCharacterID() == botOwnerCharacterID)
@@ -16675,7 +16676,7 @@ bool EntityList::RemoveBot(uint16 entityID) {
bool Result = false;
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;
@@ -16694,7 +16695,7 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) {
const char *WindowTitle = "Bot Tracking Window";
string WindowText;
std::string WindowText;
int LastCon = -1;
int CurrentCon = 0;
@@ -17227,9 +17228,9 @@ bool Bot::AddHealRotationMember( Bot* healer ) {
//update leader's previous member (end of list) to new member and update rotation data
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;
if(tempBot)
@@ -17275,9 +17276,9 @@ bool Bot::RemoveHealRotationMember( Bot* healer ) {
}
//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;
if(tempBot) {
@@ -17348,11 +17349,11 @@ bool Bot::AddHealRotationTarget( Mob* target ) {
if (_healRotationTargets[i] == 0)
{
list<Bot*> botList = GetBotsInHealRotation(this);
std::list<Bot*> botList = GetBotsInHealRotation(this);
_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;
if(tempBot && tempBot != this) {
@@ -17385,12 +17386,12 @@ bool Bot::RemoveHealRotationTarget( Mob* target ) {
//notify all heal rotation members to remove target
for(int i=0; i<MaxHealRotationTargets; i++){
if(_healRotationTargets[i] == target->GetID()) {
list<Bot*> botList = GetBotsInHealRotation(this);
std::list<Bot*> botList = GetBotsInHealRotation(this);
_healRotationTargets[i] = 0;
index = i;
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;
if(tempBot)
@@ -17498,8 +17499,8 @@ Mob* Bot::GetHealRotationTarget( uint8 index ) {
return target;
}
list<Bot*> Bot::GetBotsInHealRotation(Bot* rotationLeader) {
list<Bot*> Result;
std::list<Bot*> Bot::GetBotsInHealRotation(Bot* rotationLeader) {
std::list<Bot*> Result;
if(rotationLeader != nullptr) {
Result.push_back(rotationLeader);
-2
View File
@@ -18,8 +18,6 @@
#include <sstream>
using namespace std;
extern WorldServer worldserver;
const int BotAISpellRange = 100; // TODO: Write a method that calcs what the bot's spell range is based on spell, equipment, AA, whatever and replace this
-2
View File
@@ -7,8 +7,6 @@
#include <sstream>
using namespace std;
struct BotsAvailableList {
uint32 BotID;
char BotName[64];
+5 -4
View File
@@ -1,6 +1,7 @@
#ifdef BOTS
#include "bot.h"
#include "../common/StringUtil.h"
bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
_ZP(Bot_AICastSpell);
@@ -558,7 +559,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
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;
if(selectedBotSpell.SpellId == 0)
@@ -645,7 +646,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
const int maxDotSelect = 5;
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;
if(selectedBotSpell.SpellId == 0)
@@ -2048,7 +2049,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
//Check for group cure first
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;
if(IsGroupSpell(itr->SpellId) && CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {
@@ -2085,7 +2086,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
//no group cure for target- try to find single target spell
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;
if(CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {
+39 -45
View File
@@ -17,9 +17,7 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <iomanip>
using namespace std;
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -28,19 +26,13 @@ using namespace std;
// for windows compile
#ifdef _WINDOWS
#define abs64 _abs64
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define abs64 _abs64
#else
#include <stdarg.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "../common/unix.h"
#define abs64 abs
#include <stdarg.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "../common/unix.h"
#define abs64 abs
#endif
extern volatile bool RunLoops;
@@ -61,7 +53,7 @@ extern volatile bool RunLoops;
#include "../common/guilds.h"
#include "../common/breakdowns.h"
#include "../common/rulesys.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "forage.h"
#include "command.h"
#include "StringIDs.h"
@@ -603,7 +595,7 @@ bool Client::Save(uint8 iCommitNow) {
p_timers.Store(&database);
// printf("Dumping inventory on save:\n");
// m_inv.dumpInventory();
// m_inv.dumpEntireInventory();
SaveTaskState();
if (iCommitNow <= 1) {
@@ -628,7 +620,7 @@ bool Client::Save(uint8 iCommitNow) {
SaveBackup();
}
else {
cerr << "Failed to update player profile" << endl;
std::cerr << "Failed to update player profile" << std::endl;
return false;
}
@@ -2043,7 +2035,7 @@ void Client::ReadBook(BookRequest_Struct *book) {
return;
}
string booktxt2 = database.GetBook(txtfile);
std::string booktxt2 = database.GetBook(txtfile);
int length = booktxt2.length();
if (booktxt2[0] != '\0') {
@@ -2075,7 +2067,7 @@ void Client::ReadBook(BookRequest_Struct *book) {
}
void Client::QuestReadBook(const char* text, uint8 type) {
string booktxt2 = text;
std::string booktxt2 = text;
int length = booktxt2.length();
if (booktxt2[0] != '\0') {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct));
@@ -2576,7 +2568,7 @@ void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32
if(!player || !merchant || !item)
return;
string LogText = "Qty: ";
std::string LogText = "Qty: ";
char Buffer[255];
memset(Buffer, 0, sizeof(Buffer));
@@ -3871,7 +3863,7 @@ void Client::KeyRingLoad()
}
mysql_free_result(result);
}else {
cerr << "Error in Client::KeyRingLoad query '" << query << "' " << errbuf << endl;
std::cerr << "Error in Client::KeyRingLoad query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return;
}
@@ -3894,7 +3886,7 @@ void Client::KeyRingAdd(uint32 item_id)
}
else
{
cerr << "Error in Doors::HandleClick query '" << query << "' " << errbuf << endl;
std::cerr << "Error in Doors::HandleClick query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return;
}
@@ -3947,7 +3939,7 @@ bool Client::IsDiscovered(uint32 itemid) {
}
else
{
cerr << "Error in IsDiscovered query '" << query << "' " << errbuf << endl;
std::cerr << "Error in IsDiscovered query '" << query << "' " << errbuf << std::endl;
}
mysql_free_result(result);
safe_delete_array(query);
@@ -4736,10 +4728,10 @@ uint32 Client::GetStartZone()
void Client::ShowSkillsWindow()
{
const char *WindowTitle = "Skills";
string WindowText;
std::string WindowText;
// using a map for easy alphabetizing of the skills list
map<string, SkillType> Skills;
map<string, SkillType>::iterator it;
std::map<std::string, SkillType> Skills;
std::map<std::string, SkillType>::iterator it;
// this list of names must keep the same order as that in common/skills.h
const char* SkillName[] = {"1H Blunt","1H Slashing","2H Blunt","2H Slashing","Abjuration","Alteration","Apply Poison","Archery",
@@ -5141,7 +5133,7 @@ void Client::SendRewards()
InternalVeteranReward *ivr = (InternalVeteranReward*)data;
ivr->claim_id = rewards[i].id;
ivr->number_available = rewards[i].amount;
list<InternalVeteranReward>::iterator iter = zone->VeteranRewards.begin();
std::list<InternalVeteranReward>::iterator iter = zone->VeteranRewards.begin();
while(iter != zone->VeteranRewards.end())
{
if((*iter).claim_id == rewards[i].id)
@@ -5231,7 +5223,7 @@ bool Client::TryReward(uint32 claim_id)
return false;
}
list<InternalVeteranReward>::iterator iter = zone->VeteranRewards.begin();
std::list<InternalVeteranReward>::iterator iter = zone->VeteranRewards.begin();
while(iter != zone->VeteranRewards.end())
{
if((*iter).claim_id == claim_id)
@@ -6050,7 +6042,7 @@ void Client::NPCSpawn(NPC *target_npc, const char *identifier, uint32 extra)
bool Client::IsDraggingCorpse(const char *CorpseName)
{
for(std::list<string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
for(std::list<std::string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
{
if(!strcasecmp((*Iterator).c_str(), CorpseName))
return true;
@@ -6061,7 +6053,7 @@ bool Client::IsDraggingCorpse(const char *CorpseName)
void Client::DragCorpses()
{
for(std::list<string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
for(std::list<std::string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
{
Mob* corpse = entity_list.GetMob((*Iterator).c_str());
@@ -6716,7 +6708,7 @@ void Client::SendAltCurrencies() {
altc->count = count;
uint32 i = 0;
list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
std::list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
while(iter != zone->AlternateCurrencies.end()) {
const Item_Struct* item = database.GetItem((*iter).item_id);
altc->entries[i].currency_number = (*iter).id;
@@ -6771,7 +6763,7 @@ void Client::AddAlternateCurrencyValue(uint32 currency_id, int32 amount)
void Client::SendAlternateCurrencyValues()
{
list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
std::list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
while(iter != zone->AlternateCurrencies.end()) {
SendAlternateCurrencyValue((*iter).id, false);
iter++;
@@ -7138,23 +7130,23 @@ void Client::SendWebLink(const char *website)
{
if(website != 0)
{
string str = website;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weblink, sizeof(Weblink_Struct) + str.length() + 1);
Weblink_Struct *wl = (Weblink_Struct*)outapp->pBuffer;
memcpy(wl->weblink, str.c_str(), str.length() + 1);
wl->weblink[str.length() + 1] = '\0';
std::string str = website;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weblink, sizeof(Weblink_Struct) + str.length() + 1);
Weblink_Struct *wl = (Weblink_Struct*)outapp->pBuffer;
memcpy(wl->weblink, str.c_str(), str.length() + 1);
wl->weblink[str.length() + 1] = '\0';
FastQueuePacket(&outapp);
FastQueuePacket(&outapp);
}
}
void Client::SendMercPersonalInfo()
{
uint32 mercTypeCount = 1;
uint32 mercCount = 1; //TODO: Un-hardcode this and support multiple mercs like in later clients than SoD.
//uint32 packetSize = 0;
uint32 i=0;
uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs!
uint32 mercTypeCount = 1;
uint32 mercCount = 1; //TODO: Un-hardcode this and support multiple mercs like in later clients than SoD.
//uint32 packetSize = 0;
uint32 i=0;
uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs!
if (GetClientVersion() >= EQClientRoF)
{
@@ -7197,7 +7189,7 @@ void Client::SendMercPersonalInfo()
uint32 stanceindex = 0;
if (mdus->MercData[i].StanceCount != 0)
{
list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
while(iter != zone->merc_stance_list[mercData->MercTemplateID].end())
{
mdus->MercData[i].Stances[stanceindex].StanceIndex = stanceindex;
@@ -7263,7 +7255,7 @@ void Client::SendMercPersonalInfo()
int stanceindex = 0;
if(mml->Mercs[i].StanceCount != 0)
{
list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
while(iter != zone->merc_stance_list[mercData->MercTemplateID].end())
{
mml->Mercs[i].Stances[stanceindex].StanceIndex = stanceindex;
@@ -7383,10 +7375,12 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra
if (IsInvisible(tnpc))
return FACTION_INDIFFERENT;
if (tnpc && tnpc->GetOwnerID() != 0) // pets con amiably to owner and indiff to rest
{
if (char_id == tnpc->GetOwner()->CastToClient()->CharacterID())
return FACTION_AMIABLE;
else
return FACTION_INDIFFERENT;
}
//First get the NPC's Primary faction
if(pFaction > 0)
+38 -27
View File
@@ -28,27 +28,38 @@ class Client;
#include "../common/EQPacket.h"
#include "../common/linked_list.h"
#include "../common/extprofile.h"
#include "zonedb.h"
#include "errno.h"
#include "../common/classes.h"
#include "../common/races.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 "npc.h"
#include "merc.h"
#include "zone.h"
#include "AA.h"
#include "../common/seperator.h"
#include "../common/Item.h"
#include "updatemgr.h"
#include "../common/guilds.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 <set>
#include <string>
#include "../common/item_struct.h"
#include "../common/clientversions.h"
#include "QGlobals.h"
#include <algorithm>
#define CLIENT_TIMEOUT 90000
#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing
@@ -708,7 +719,7 @@ public:
void ChangeTributeSettings(TributeInfo_Struct *t);
void SendTributeTimer();
void ToggleTribute(bool enabled);
void SendPathPacket(vector<FindPerson_Point> &path);
void SendPathPacket(std::vector<FindPerson_Point> &path);
inline PTimerList &GetPTimers() { return(p_timers); }
@@ -863,7 +874,7 @@ public:
bool PendingTranslocate;
time_t TranslocateTime;
bool PendingSacrifice;
string SacrificeCaster;
std::string SacrificeCaster;
struct Translocate_Struct PendingTranslocateData;
void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID);
@@ -1101,18 +1112,18 @@ public:
void DuplicateLoreMessage(uint32 ItemID);
void GarbleMessage(char *, uint8);
void TickItemCheck();
void TickItemCheck();
void TryItemTick(int slot);
int16 GetActSTR() { return( min(GetMaxSTR(), GetSTR()) ); }
int16 GetActSTA() { return( min(GetMaxSTA(), GetSTA()) ); }
int16 GetActDEX() { return( min(GetMaxDEX(), GetDEX()) ); }
int16 GetActAGI() { return( min(GetMaxAGI(), GetAGI()) ); }
int16 GetActINT() { return( min(GetMaxINT(), GetINT()) ); }
int16 GetActWIS() { return( min(GetMaxWIS(), GetWIS()) ); }
int16 GetActCHA() { return( min(GetMaxCHA(), GetCHA()) ); }
void LoadAccountFlags();
void SetAccountFlag(std::string flag, std::string val);
std::string GetAccountFlag(std::string flag);
int16 GetActSTR() { return( std::min(GetMaxSTR(), GetSTR()) ); }
int16 GetActSTA() { return( std::min(GetMaxSTA(), GetSTA()) ); }
int16 GetActDEX() { return( std::min(GetMaxDEX(), GetDEX()) ); }
int16 GetActAGI() { return( std::min(GetMaxAGI(), GetAGI()) ); }
int16 GetActINT() { return( std::min(GetMaxINT(), GetINT()) ); }
int16 GetActWIS() { return( std::min(GetMaxWIS(), GetWIS()) ); }
int16 GetActCHA() { return( std::min(GetMaxCHA(), GetCHA()) ); }
void LoadAccountFlags();
void SetAccountFlag(std::string flag, std::string val);
std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillType);
int mod_client_damage(int damage, SkillType skillinuse, int hand, const ItemInst* weapon, Mob* other);
bool mod_client_message(char* message, uint8 chan_num);
bool mod_can_increase_skill(SkillType skillid, Mob* against_who);
@@ -1272,7 +1283,7 @@ private:
uint8 mercSlot; // selected merc slot
bool Trader;
bool Buyer;
string BuyerWelcomeMessage;
std::string BuyerWelcomeMessage;
bool AbilityTimer;
int Haste; //precalced value
@@ -1364,7 +1375,7 @@ private:
uint32 max_AAXP;
uint32 staminacount;
AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile
map<uint32,uint8> aa_points;
std::map<uint32,uint8> aa_points;
bool npcflag;
uint8 npclevel;
bool feigned;
@@ -1380,7 +1391,7 @@ private:
unsigned int RestRegenMana;
unsigned int RestRegenEndurance;
set<uint32> zone_flags;
std::set<uint32> zone_flags;
ClientTaskState *taskstate;
int TotalSecondsPlayed;
@@ -1429,14 +1440,14 @@ private:
std::set<uint32> PlayerBlockedBuffs;
std::set<uint32> PetBlockedBuffs;
std::list<string> DraggedCorpses;
std::list<std::string> DraggedCorpses;
uint8 MaxXTargets;
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;
};
+4 -4
View File
@@ -35,7 +35,7 @@ void ClientLogs::subscribe(EQEMuLog::LogIDs id, Client *c) {
//make sure they arnt allready subscribed.
vector<Client *>::iterator cur,end;
std::vector<Client *>::iterator cur,end;
cur = entries[id].begin();
end = entries[id].end();
for(; cur != end; cur++) {
@@ -55,7 +55,7 @@ void ClientLogs::unsubscribe(EQEMuLog::LogIDs id, Client *c) {
if(c == nullptr)
return;
vector<Client *>::iterator cur,end;
std::vector<Client *>::iterator cur,end;
cur = entries[id].begin();
end = entries[id].end();
for(; cur != end; cur++) {
@@ -94,7 +94,7 @@ void ClientLogs::clear() {
void ClientLogs::msg(EQEMuLog::LogIDs id, const char *buf) {
if(id >= EQEMuLog::MaxLogID)
return;
vector<Client *>::iterator cur,end;
std::vector<Client *>::iterator cur,end;
cur = entries[id].begin();
end = entries[id].end();
for(; cur != end; cur++) {
@@ -128,7 +128,7 @@ void ClientLogs::EQEmuIO_pva(EQEMuLog::LogIDs id, const char *prefix, const char
if(fmt[0] == '\n' || fmt[0] == '\r')
return; //skip new lines...
char *buf = _buffer;
int plen = snprintf(buf, MAX_CLIENT_LOG_MESSAGE_LENGTH, prefix);
int plen = snprintf(buf, MAX_CLIENT_LOG_MESSAGE_LENGTH, "%s", prefix);
buf += plen;
vsnprintf(buf, MAX_CLIENT_LOG_MESSAGE_LENGTH-plen, fmt, ap);
_buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH] = '\0';
+1 -2
View File
@@ -30,7 +30,6 @@
#define MAX_CLIENT_LOG_MESSAGE_LENGTH 512
#include <vector>
using namespace std;
class Client;
@@ -50,7 +49,7 @@ public:
protected:
vector<Client *> entries[EQEMuLog::MaxLogID];
std::vector<Client *> entries[EQEMuLog::MaxLogID];
static char _buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH+1];
};
+7 -5
View File
@@ -15,19 +15,21 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <algorithm>
#include "../common/debug.h"
#include "masterentity.h"
#include "worldserver.h"
#include "zonedb.h"
#include "../common/spdat.h"
#include "../common/packet_dump.h"
#include "../common/packet_functions.h"
#include "petitions.h"
#include "../common/serverinfo.h"
#include "../common/ZoneNumbers.h"
#include "../common/moremath.h"
#include "../common/guilds.h"
#include "../common/logsys.h"
#include "masterentity.h"
#include "worldserver.h"
#include "zonedb.h"
#include "petitions.h"
#include "StringIDs.h"
#include "NpcAI.h"
@@ -1999,7 +2001,7 @@ int32 Client::CalcBaseEndurance()
int BonusUpto800 = int( at_most_800 / 4 ) ;
if(Stats > 400) {
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) {
Bonus800plus = int( (Stats - 800) / 8 ) * 2;
+73 -78
View File
@@ -29,9 +29,6 @@
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
@@ -48,7 +45,7 @@
#include "worldserver.h"
#include "../common/rdtsc.h"
#include "../common/packet_dump_file.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/breakdowns.h"
#include "../common/guilds.h"
#include "../common/rulesys.h"
@@ -73,9 +70,6 @@
#include "../common/ZoneNumbers.h"
#include "QuestParserCollection.h"
using namespace std;
extern Zone* zone;
extern volatile bool ZoneLoaded;
extern WorldServer worldserver;
@@ -87,7 +81,7 @@ extern DBAsync *dbasync;
typedef void (Client::*ClientPacketProc)(const EQApplicationPacket *app);
//Use a map for connecting opcodes since it dosent get used a lot and is sparse
map<uint32, ClientPacketProc> ConnectingOpcodes;
std::map<uint32, ClientPacketProc> ConnectingOpcodes;
//Use a static array for connected, for speed
ClientPacketProc ConnectedOpcodes[_maxEmuOpcode];
@@ -411,14 +405,14 @@ int Client::HandlePacket(const EQApplicationPacket *app)
}
#if EQDEBUG >= 9
cout << "Received 0x" << hex << setw(4) << setfill('0') << opcode << ", size=" << dec << app->size << endl;
std::cout << "Received 0x" << hex << setw(4) << setfill('0') << opcode << ", size=" << dec << app->size << std::endl;
#endif
#ifdef SOLAR
if(0 && opcode != OP_ClientUpdate)
{
LogFile->write(EQEMuLog::Debug,"HandlePacket() OPCODE debug enabled client %s", GetName());
cerr << "OPCODE: " << hex << setw(4) << setfill('0') << opcode << dec << ", size: " << app->size << endl;
std::cerr << "OPCODE: " << hex << setw(4) << setfill('0') << opcode << dec << ", size: " << app->size << std::endl;
DumpPacket(app);
}
#endif
@@ -429,7 +423,7 @@ int Client::HandlePacket(const EQApplicationPacket *app)
//TODO: replace this 0 with the EQ opcode
LogFile->write(EQEMuLog::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode: %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size);
#if EQDEBUG >= 9
cout << "Unexpected packet during CLIENT_CONNECTING: OpCode: 0x" << hex << setw(4) << setfill('0') << opcode << dec << ", size: " << app->size << endl;
std::cout << "Unexpected packet during CLIENT_CONNECTING: OpCode: 0x" << hex << setw(4) << setfill('0') << opcode << dec << ", size: " << app->size << std::endl;
DumpPacket(app);
#endif
break;
@@ -458,7 +452,7 @@ int Client::HandlePacket(const EQApplicationPacket *app)
if(app->size<1000)
DumpPacket(app->pBuffer, app->size);
else{
cout << "Dump limited to 1000 characters:\n";
std::cout << "Dump limited to 1000 characters:\n";
DumpPacket(app->pBuffer, 1000);
}
break;
@@ -2993,7 +2987,7 @@ void Client::Handle_OP_RequestDuel(const EQApplicationPacket *app)
void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
{
if (app->size != sizeof(SpawnAppearance_Struct)) {
cout << "Wrong size on OP_SpawnAppearance. Got: " << app->size << ", Expected: " << sizeof(SpawnAppearance_Struct) << endl;
std::cout << "Wrong size on OP_SpawnAppearance. Got: " << app->size << ", Expected: " << sizeof(SpawnAppearance_Struct) << std::endl;
return;
}
SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer;
@@ -3068,7 +3062,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
}
*/
else {
cerr << "Client " << name << " unknown apperance " << (int)sa->parameter << endl;
std::cerr << "Client " << name << " unknown apperance " << (int)sa->parameter << std::endl;
return;
}
@@ -3086,7 +3080,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
m_pp.anon = 0;
}
else {
cerr << "Client " << name << " unknown Anon/Roleplay Switch " << (int)sa->parameter << endl;
std::cerr << "Client " << name << " unknown Anon/Roleplay Switch " << (int)sa->parameter << std::endl;
return;
}
entity_list.QueueClients(this, app, true);
@@ -3139,8 +3133,8 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
entity_list.QueueClients(this, app, true);
}
else {
cout << "Unknown SpawnAppearance type: 0x" << hex << setw(4) << setfill('0') << sa->type << dec
<< " value: 0x" << hex << setw(8) << setfill('0') << sa->parameter << dec << endl;
std::cout << "Unknown SpawnAppearance type: 0x" << std::hex << std::setw(4) << std::setfill('0') << sa->type << std::dec
<< " value: 0x" << std::hex << std::setw(8) << std::setfill('0') << sa->parameter << std::dec << std::endl;
}
return;
}
@@ -3220,7 +3214,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
if (!item) {
if (ivrs->item_id > 500000)
{
string response = "";
std::string response = "";
int sayid = ivrs->item_id - 500000;
bool silentsaylink = false;
@@ -3584,7 +3578,7 @@ void Client::Handle_OP_ChannelMessage(const EQApplicationPacket *app)
ChannelMessage_Struct* cm=(ChannelMessage_Struct*)app->pBuffer;
if (app->size < sizeof(ChannelMessage_Struct)) {
cout << "Wrong size " << app->size << ", should be " << sizeof(ChannelMessage_Struct) << "+ on 0x" << hex << setfill('0') << setw(4) << app->GetOpcode() << dec << endl;
std::cout << "Wrong size " << app->size << ", should be " << sizeof(ChannelMessage_Struct) << "+ on 0x" << std::hex << std::setfill('0') << std::setw(4) << app->GetOpcode() << std::dec << std::endl;
return;
}
if (IsAIControlled()) {
@@ -3599,7 +3593,7 @@ void Client::Handle_OP_ChannelMessage(const EQApplicationPacket *app)
void Client::Handle_OP_WearChange(const EQApplicationPacket *app)
{
if (app->size != sizeof(WearChange_Struct)) {
cout << "Wrong size: OP_WearChange, size=" << app->size << ", expected " << sizeof(WearChange_Struct) << endl;
std::cout << "Wrong size: OP_WearChange, size=" << app->size << ", expected " << sizeof(WearChange_Struct) << std::endl;
return;
}
@@ -3653,7 +3647,7 @@ void Client::Handle_OP_Save(const EQApplicationPacket *app)
void Client::Handle_OP_WhoAllRequest(const EQApplicationPacket *app)
{
if (app->size != sizeof(Who_All_Struct)) {
cout << "Wrong size on OP_WhoAll. Got: " << app->size << ", Expected: " << sizeof(Who_All_Struct) << endl;
std::cout << "Wrong size on OP_WhoAll. Got: " << app->size << ", Expected: " << sizeof(Who_All_Struct) << std::endl;
return;
}
Who_All_Struct* whoall = (Who_All_Struct*) app->pBuffer;
@@ -3675,7 +3669,7 @@ void Client::Handle_OP_FriendsWho(const EQApplicationPacket *app)
void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMZoneRequest_Struct)) {
cout << "Wrong size on OP_GMZoneRequest. Got: " << app->size << ", Expected: " << sizeof(GMZoneRequest_Struct) << endl;
std::cout << "Wrong size on OP_GMZoneRequest. Got: " << app->size << ", Expected: " << sizeof(GMZoneRequest_Struct) << std::endl;
return;
}
if (this->Admin() < minStatusToBeGM) {
@@ -3715,7 +3709,7 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
if (tarzone[0] != 0 && admin >= minstatus && GetLevel() >= minlevel)
gmzr2->success = 1;
else {
cout << "GetZoneSafeCoords failed. zoneid = " << gmzr->zone_id << "; czone = " << zone->GetZoneID() << endl;
std::cout << "GetZoneSafeCoords failed. zoneid = " << gmzr->zone_id << "; czone = " << zone->GetZoneID() << std::endl;
gmzr2->success = 0;
}
@@ -3744,7 +3738,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app)
void Client::Handle_OP_EndLootRequest(const EQApplicationPacket *app)
{
if (app->size != sizeof(uint32)) {
cout << "Wrong size: OP_EndLootRequest, size=" << app->size << ", expected " << sizeof(uint32) << endl;
std::cout << "Wrong size: OP_EndLootRequest, size=" << app->size << ", expected " << sizeof(uint32) << std::endl;
return;
}
@@ -3773,7 +3767,7 @@ void Client::Handle_OP_EndLootRequest(const EQApplicationPacket *app)
void Client::Handle_OP_LootRequest(const EQApplicationPacket *app)
{
if (app->size != sizeof(uint32)) {
cout << "Wrong size: OP_LootRequest, size=" << app->size << ", expected " << sizeof(uint32) << endl;
std::cout << "Wrong size: OP_LootRequest, size=" << app->size << ", expected " << sizeof(uint32) << std::endl;
return;
}
@@ -3824,7 +3818,7 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app)
return;
}
else {
cout << "npc == 0 LOOTING FOOKED3" << endl;
std::cout << "npc == 0 LOOTING FOOKED3" << std::endl;
Message(13, "Error: OP_LootRequest: Corpse not a corpse?");
Corpse::SendLootReqErrorPacket(this);
}
@@ -3905,7 +3899,7 @@ void Client::Handle_OP_LDoNInspect(const EQApplicationPacket *app)
void Client::Handle_OP_Dye(const EQApplicationPacket *app)
{
if(app->size!=sizeof(DyeStruct))
printf("Wrong size of DyeStruct, Got: %i, Expected: %lu\n",app->size,sizeof(DyeStruct));
printf("Wrong size of DyeStruct, Got: %i, Expected: %i\n",app->size,sizeof(DyeStruct));
else{
DyeStruct* dye = (DyeStruct*)app->pBuffer;
DyeArmor(dye);
@@ -3976,7 +3970,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app)
if (app->size < sizeof(GuildUpdate_PublicNote)) {
// client calls for a motd on login even if they arent in a guild
printf("Error: app size of %i < size of OP_GuildPublicNote of %lu\n",app->size,sizeof(GuildUpdate_PublicNote));
printf("Error: app size of %i < size of OP_GuildPublicNote of %i\n",app->size,sizeof(GuildUpdate_PublicNote));
return;
}
GuildUpdate_PublicNote* gpn=(GuildUpdate_PublicNote*)app->pBuffer;
@@ -4034,7 +4028,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app)
if (app->size != sizeof(GuildMOTD_Struct)) {
// client calls for a motd on login even if they arent in a guild
printf("Error: app size of %i != size of GuildMOTD_Struct of %lu\n",app->size,sizeof(GuildMOTD_Struct));
printf("Error: app size of %i != size of GuildMOTD_Struct of %i\n",app->size,sizeof(GuildMOTD_Struct));
return;
}
if(!IsInAGuild()) {
@@ -4252,7 +4246,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app)
mpkt(GUILDS__IN_PACKET_TRACE, app);
if (app->size != sizeof(GuildCommand_Struct)) {
cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << endl;
std::cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl;
return;
}
@@ -4379,7 +4373,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app)
mpkt(GUILDS__IN_PACKET_TRACE, app);
if (app->size != sizeof(GuildCommand_Struct)) {
cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << endl;
std::cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl;
return;
}
GuildCommand_Struct* gc = (GuildCommand_Struct*) app->pBuffer;
@@ -4450,7 +4444,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app)
SetPendingGuildInvitation(false);
if (app->size != sizeof(GuildInviteAccept_Struct)) {
cout << "Wrong size: OP_GuildInviteAccept, size=" << app->size << ", expected " << sizeof(GuildJoin_Struct) << endl;
std::cout << "Wrong size: OP_GuildInviteAccept, size=" << app->size << ", expected " << sizeof(GuildJoin_Struct) << std::endl;
return;
}
@@ -4542,7 +4536,7 @@ void Client::Handle_OP_MemorizeSpell(const EQApplicationPacket *app)
void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app)
{
if (app->size != sizeof(SwapSpell_Struct)) {
cout << "Wrong size on OP_SwapSpell. Got: " << app->size << ", Expected: " << sizeof(SwapSpell_Struct) << endl;
std::cout << "Wrong size on OP_SwapSpell. Got: " << app->size << ", Expected: " << sizeof(SwapSpell_Struct) << std::endl;
return;
}
const SwapSpell_Struct* swapspell = (const SwapSpell_Struct*) app->pBuffer;
@@ -4562,7 +4556,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app)
void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
{
if (app->size != sizeof(CastSpell_Struct)) {
cout << "Wrong size: OP_CastSpell, size=" << app->size << ", expected " << sizeof(CastSpell_Struct) << endl;
std::cout << "Wrong size: OP_CastSpell, size=" << app->size << ", expected " << sizeof(CastSpell_Struct) << std::endl;
return;
}
if (IsAIControlled()) {
@@ -4746,7 +4740,7 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app)
{
if (app->size != sizeof(DeleteItem_Struct)) {
cout << "Wrong size on OP_DeleteItem. Got: " << app->size << ", Expected: " << sizeof(DeleteItem_Struct) << endl;
std::cout << "Wrong size on OP_DeleteItem. Got: " << app->size << ", Expected: " << sizeof(DeleteItem_Struct) << std::endl;
return;
}
@@ -4780,7 +4774,7 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app)
void Client::Handle_OP_CombatAbility(const EQApplicationPacket *app)
{
if (app->size != sizeof(CombatAbility_Struct)) {
cout << "Wrong size on OP_CombatAbility. Got: " << app->size << ", Expected: " << sizeof(CombatAbility_Struct) << endl;
std::cout << "Wrong size on OP_CombatAbility. Got: " << app->size << ", Expected: " << sizeof(CombatAbility_Struct) << std::endl;
return;
}
OPCombatAbility(app);
@@ -4790,7 +4784,7 @@ void Client::Handle_OP_CombatAbility(const EQApplicationPacket *app)
void Client::Handle_OP_Taunt(const EQApplicationPacket *app)
{
if (app->size != sizeof(ClientTarget_Struct)) {
cout << "Wrong size on OP_Taunt. Got: " << app->size << ", Expected: "<< sizeof(ClientTarget_Struct) << endl;
std::cout << "Wrong size on OP_Taunt. Got: " << app->size << ", Expected: "<< sizeof(ClientTarget_Struct) << std::endl;
return;
}
@@ -4849,7 +4843,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app)
void Client::Handle_OP_GMSummon(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMSummon_Struct)) {
cout << "Wrong size on OP_GMSummon. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << endl;
std::cout << "Wrong size on OP_GMSummon. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << std::endl;
return;
}
OPGMSummon(app);
@@ -5013,7 +5007,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
EQApplicationPacket* outapp = new EQApplicationPacket(OP_FinishTrade, 0);
QueuePacket(outapp);
safe_delete(outapp);
if(with->IsNPC())
if(with->IsNPC()) {
// Audit trade to database for player trade stream
if(RuleB(QueryServ, PlayerLogHandins)) {
uint16 handin_count = 0;
@@ -5033,6 +5027,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
else {
FinishTrade(with->CastToNPC());
}
}
#ifdef BOTS
else if(with->IsBot())
with->CastToBot()->FinishTrade(this, Bot::BotTradeClientNormal);
@@ -5249,7 +5244,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app)
void Client::Handle_OP_GMLastName(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMLastName_Struct)) {
cout << "Wrong size on OP_GMLastName. Got: " << app->size << ", Expected: " << sizeof(GMLastName_Struct) << endl;
std::cout << "Wrong size on OP_GMLastName. Got: " << app->size << ", Expected: " << sizeof(GMLastName_Struct) << std::endl;
return;
}
GMLastName_Struct* gmln = (GMLastName_Struct*) app->pBuffer;
@@ -5283,7 +5278,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app)
void Client::Handle_OP_GMToggle(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMToggle_Struct)) {
cout << "Wrong size on OP_GMToggle. Got: " << app->size << ", Expected: " << sizeof(GMToggle_Struct) << endl;
std::cout << "Wrong size on OP_GMToggle. Got: " << app->size << ", Expected: " << sizeof(GMToggle_Struct) << std::endl;
return;
}
if (this->Admin() < minStatusToUseGMCommands) {
@@ -5312,7 +5307,7 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app)
void Client::Handle_OP_LFGCommand(const EQApplicationPacket *app)
{
if (app->size != sizeof(LFG_Struct)) {
cout << "Wrong size on OP_LFGCommand. Got: " << app->size << ", Expected: " << sizeof(LFG_Struct) << endl;
std::cout << "Wrong size on OP_LFGCommand. Got: " << app->size << ", Expected: " << sizeof(LFG_Struct) << std::endl;
DumpPacket(app);
return;
}
@@ -5358,7 +5353,7 @@ void Client::Handle_OP_LFGCommand(const EQApplicationPacket *app)
void Client::Handle_OP_GMGoto(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMSummon_Struct)) {
cout << "Wrong size on OP_GMGoto. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << endl;
std::cout << "Wrong size on OP_GMGoto. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << std::endl;
return;
}
if (this->Admin() < minStatusToUseGMCommands) {
@@ -5728,7 +5723,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
return;
}
string packet;
std::string packet;
if(mp->quantity==1 && item->MaxCharges>0 && item->MaxCharges<255)
mp->quantity=item->MaxCharges;
@@ -5810,7 +5805,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
}
t1.stop();
cout << "At 1: " << t1.getDuration() << endl;
std::cout << "At 1: " << t1.getDuration() << std::endl;
return;
}
@@ -5955,7 +5950,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
t1.start();
Save(1);
t1.stop();
cout << "Save took: " << t1.getDuration() << endl;
std::cout << "Save took: " << t1.getDuration() << std::endl;
return;
}
@@ -6941,7 +6936,7 @@ void Client::Handle_OP_DeleteSpell(const EQApplicationPacket *app)
void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
{
if(app->size!=sizeof(LoadSpellSet_Struct)) {
printf("Wrong size of LoadSpellSet_Struct! Expected: %lu, Got: %i\n",sizeof(LoadSpellSet_Struct),app->size);
printf("Wrong size of LoadSpellSet_Struct! Expected: %i, Got: %i\n",sizeof(LoadSpellSet_Struct),app->size);
return;
}
int i;
@@ -6956,7 +6951,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app)
{
if(app->size!=sizeof(PetitionBug_Struct))
printf("Wrong size of BugStruct! Expected: %lu, Got: %i\n",sizeof(PetitionBug_Struct),app->size);
printf("Wrong size of BugStruct! Expected: %i, Got: %i\n",sizeof(PetitionBug_Struct),app->size);
else{
Message(0, "Petition Bugs are not supported, please use /bug.");
}
@@ -6966,7 +6961,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app)
void Client::Handle_OP_Bug(const EQApplicationPacket *app)
{
if(app->size!=sizeof(BugStruct))
printf("Wrong size of BugStruct got %d expected %lu!\n", app->size, sizeof(BugStruct));
printf("Wrong size of BugStruct got %d expected %i!\n", app->size, sizeof(BugStruct));
else{
BugStruct* bug=(BugStruct*)app->pBuffer;
database.UpdateBug(bug);
@@ -7057,7 +7052,7 @@ void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app)
FastQueuePacket(&outapp);
if (petition_list.DeletePetition(pet->petnumber) == -1)
cout << "Something is borked with: " << pet->petnumber << endl;
std::cout << "Something is borked with: " << pet->petnumber << std::endl;
petition_list.ClearPetitions();
petition_list.UpdateGMQueue();
petition_list.ReadDatabase();
@@ -7339,7 +7334,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
void Client::Handle_OP_PetitionUnCheckout(const EQApplicationPacket *app)
{
if (app->size != sizeof(uint32)) {
cout << "Wrong size: OP_PetitionUnCheckout, size=" << app->size << ", expected " << sizeof(uint32) << endl;
std::cout << "Wrong size: OP_PetitionUnCheckout, size=" << app->size << ", expected " << sizeof(uint32) << std::endl;
return;
}
if (!worldserver.Connected())
@@ -7381,7 +7376,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app)
void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app)
{
if (app->size != sizeof(uint32)) {
cout << "Wrong size: OP_PetitionCheckout, size=" << app->size << ", expected " << sizeof(uint32) << endl;
std::cout << "Wrong size: OP_PetitionCheckout, size=" << app->size << ", expected " << sizeof(uint32) << std::endl;
return;
}
if (!worldserver.Connected())
@@ -7525,7 +7520,7 @@ void Client::Handle_OP_GMDelCorpse(const EQApplicationPacket *app)
return;
}
corpse->CastToCorpse()->Delete();
cout << name << " deleted corpse " << dc->corpsename << endl;
std::cout << name << " deleted corpse " << dc->corpsename << std::endl;
Message(13, "Corpse %s deleted.", dc->corpsename);
return;
}
@@ -8362,7 +8357,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app)
_pkt(TRIBUTE__IN, app);
if(app->size != sizeof(StartTribute_Struct))
printf("Error in OP_OpenTributeMaster. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
printf("Error in OP_OpenTributeMaster. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
else {
//Opens the tribute master window
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
@@ -8387,7 +8382,7 @@ void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app)
_pkt(TRIBUTE__IN, app);
if(app->size != sizeof(StartTribute_Struct))
printf("Error in OP_OpenGuildTributeMaster. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
printf("Error in OP_OpenGuildTributeMaster. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
else {
//Opens the guild tribute master window
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
@@ -8413,7 +8408,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app)
//player donates an item...
if(app->size != sizeof(TributeItem_Struct))
printf("Error in OP_TributeItem. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
printf("Error in OP_TributeItem. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
else {
TributeItem_Struct* t = (TributeItem_Struct*)app->pBuffer;
@@ -8442,7 +8437,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app)
//player donates money
if(app->size != sizeof(TributeMoney_Struct))
printf("Error in OP_TributeMoney. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
printf("Error in OP_TributeMoney. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
else {
TributeMoney_Struct* t = (TributeMoney_Struct*)app->pBuffer;
@@ -8590,11 +8585,11 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app)
void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
{
if(app->size != sizeof(FindPersonRequest_Struct))
printf("Error in FindPersonRequest_Struct. Expected size of: %lu, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size);
printf("Error in FindPersonRequest_Struct. Expected size of: %i, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size);
else {
FindPersonRequest_Struct* t = (FindPersonRequest_Struct*)app->pBuffer;
vector<FindPerson_Point> points;
std::vector<FindPerson_Point> points;
Message(13, "Searched for NPC ID: %d\n", t->npc_id);
Mob* target = entity_list.GetMob(t->npc_id);
@@ -8645,7 +8640,7 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
}
else
{
list<int> pathlist = zone->pathing->FindRoute(Start, End);
std::list<int> pathlist = zone->pathing->FindRoute(Start, End);
if(pathlist.size() == 0)
{
@@ -8684,7 +8679,7 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
p.z = GetZ();
points.push_back(p);
for(list<int>::iterator Iterator = pathlist.begin(); Iterator != pathlist.end(); ++Iterator)
for(std::list<int>::iterator Iterator = pathlist.begin(); Iterator != pathlist.end(); ++Iterator)
{
if((*Iterator) == -1) // Teleporter
{
@@ -8735,7 +8730,7 @@ void Client::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) {
}
}
else {
cout << "Async client save failed. '" << errbuf << "'" << endl;
std::cout << "Async client save failed. '" << errbuf << "'" << std::endl;
Message(13, "Error: Asyncronous save of your character failed.");
if (Admin() >= 200)
Message(13, "errbuf: %s", errbuf);
@@ -8744,7 +8739,7 @@ void Client::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) {
break;
}
default: {
cout << "Error: Client::DBAWComplete(): Unknown workpt_b1" << endl;
std::cout << "Error: Client::DBAWComplete(): Unknown workpt_b1" << std::endl;
break;
}
}
@@ -8762,11 +8757,11 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
for (i=1; i<=3; i++) {
dbaq = dbaw->PopAnswer();
if (!dbaq) {
cout << "Error in FinishConnState2(): dbaq==0" << endl;
std::cout << "Error in FinishConnState2(): dbaq==0" << std::endl;
return false;
}
if (!dbaq->GetAnswer(errbuf, &result)) {
cout << "Error in FinishConnState2(): !dbaq[" << dbaq->QPT() << "]->GetAnswer(): " << errbuf << endl;
std::cout << "Error in FinishConnState2(): !dbaq[" << dbaq->QPT() << "]->GetAnswer(): " << errbuf << std::endl;
return false;
}
if (dbaq->QPT() == 1) {
@@ -8784,7 +8779,7 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
database.LoadFactionValues_result(result, factionvalues);
}
else {
cout << "Error in FinishConnState2(): dbaq->PQT() unknown" << endl;
std::cout << "Error in FinishConnState2(): dbaq->PQT() unknown" << std::endl;
return false;
}
}
@@ -9198,7 +9193,7 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
#ifdef _EQDEBUG
printf("Dumping inventory on load:\n");
m_inv.dumpInventory();
m_inv.dumpEntireInventory();
#endif
//lost in current PP
@@ -9793,7 +9788,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app)
SetTitle_Struct *sts = (SetTitle_Struct *)app->pBuffer;
string Title;
std::string Title;
if(!sts->is_suffix)
{
@@ -11604,8 +11599,8 @@ void Client::Handle_OP_Report(const EQApplicationPacket *app)
uint32 size = app->size;
uint32 current_point = 0;
string reported, reporter;
string current_string;
std::string reported, reporter;
std::string current_string;
int mode = 0;
while(current_point < size)
@@ -11742,7 +11737,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
char CharName[64], TimeOfDeath[20], Buffer[512];
string PopupText = "<table><tr><td>Name</td><td>Zone</td><td>X</td><td>Y</td><td>Z</td><td>Date</td><td>"
std::string PopupText = "<table><tr><td>Name</td><td>Zone</td><td>X</td><td>Y</td><td>Z</td><td>Date</td><td>"
"Rezzed</td><td>Buried</td></tr><tr><td>&nbsp</td><td></td><td></td><td></td><td></td><td>"
"</td><td></td><td></td></tr>";
@@ -12490,7 +12485,7 @@ void Client::Handle_OP_CorpseDrop(const EQApplicationPacket *app)
return;
}
for(std::list<string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
for(std::list<std::string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
{
if(!strcasecmp((*Iterator).c_str(), (const char *)app->pBuffer))
{
@@ -12616,7 +12611,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app
return;
}
list<AltCurrencyDefinition_Struct>::iterator altc_iter = zone->AlternateCurrencies.begin();
std::list<AltCurrencyDefinition_Struct>::iterator altc_iter = zone->AlternateCurrencies.begin();
bool found = false;
while(altc_iter != zone->AlternateCurrencies.end()) {
if((*altc_iter).id == alt_cur_id) {
@@ -12825,7 +12820,7 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app) {
VERIFY_PACKET_LENGTH(OP_AltCurrencyReclaim, app, AltCurrencyReclaim_Struct);
AltCurrencyReclaim_Struct *reclaim = (AltCurrencyReclaim_Struct*)app->pBuffer;
uint32 item_id = 0;
list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
std::list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
while(iter != zone->AlternateCurrencies.end()) {
if((*iter).id == reclaim->currency_id) {
item_id = (*iter).item_id;
@@ -13579,7 +13574,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
for(std::list<MercData>::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); mercListItr++)
{
list<MercStanceInfo>::iterator siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin();
for(siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin(); siter != zone->merc_stance_list[mercListItr->MercTemplateID].end(); siter++)
{
StanceCount++;
@@ -13618,7 +13613,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
mml->Mercs[i].MerchantSlot = i + 1;
mml->Mercs[i].MercUnk02 = 1;
int mercStanceCount = 0;
list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin();
for(iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); iter != zone->merc_stance_list[mercListIter->MercTemplateID].end(); iter++)
{
mercStanceCount++;
@@ -13630,7 +13625,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
int stanceindex = 0;
if(mercStanceCount > 0)
{
list<MercStanceInfo>::iterator iter2 = zone->merc_stance_list[mercListIter->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator iter2 = zone->merc_stance_list[mercListIter->MercTemplateID].begin();
while(iter2 != zone->merc_stance_list[mercListIter->MercTemplateID].end())
{
mml->Mercs[i].Stances[stanceindex].StanceIndex = stanceindex;
@@ -13768,7 +13763,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app)
//get number of available stances for the current merc
std::list<MercStanceInfo> mercStanceList = zone->merc_stance_list[merc->GetMercTemplateID()];
list<MercStanceInfo>::iterator iter = mercStanceList.begin();
std::list<MercStanceInfo>::iterator iter = mercStanceList.begin();
while(iter != mercStanceList.end()) {
numStances++;
iter++;
+13 -19
View File
@@ -32,9 +32,6 @@
#include <windows.h>
#include <winsock.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
@@ -50,7 +47,7 @@
#include "../common/packet_dump.h"
#include "worldserver.h"
#include "../common/packet_dump_file.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/spdat.h"
#include "petitions.h"
#include "NpcAI.h"
@@ -67,9 +64,6 @@
#include <string>
#include "QuestParserCollection.h"
using namespace std;
extern Zone* zone;
extern volatile bool ZoneLoaded;
extern WorldServer worldserver;
@@ -656,26 +650,26 @@ bool Client::Process() {
if (client_state == CLIENT_KICKED) {
Save();
OnDisconnect(true);
cout << "Client disconnected (cs=k): " << GetName() << endl;
std::cout << "Client disconnected (cs=k): " << GetName() << std::endl;
return false;
}
if (client_state == DISCONNECTED) {
OnDisconnect(true);
cout << "Client disconnected (cs=d): " << GetName() << endl;
std::cout << "Client disconnected (cs=d): " << GetName() << std::endl;
database.SetMQDetectionFlag(this->AccountName(), GetName(), "/MQInstantCamp: Possible instant camp disconnect.", zone->GetShortName());
return false;
}
if (client_state == CLIENT_ERROR) {
OnDisconnect(true);
cout << "Client disconnected (cs=e): " << GetName() << endl;
std::cout << "Client disconnected (cs=e): " << GetName() << std::endl;
return false;
}
if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) {
OnDisconnect(true);
cout << "Client linkdead: " << name << endl;
std::cout << "Client linkdead: " << name << std::endl;
if (GetGM()) {
if (GetMerc())
@@ -879,14 +873,14 @@ void Client::BulkSendInventoryItems() {
uint32 size = 0;
uint16 i = 0;
map<uint16, string> ser_items;
map<uint16, string>::iterator itr;
std::map<uint16, std::string> ser_items;
std::map<uint16, std::string>::iterator itr;
//Inventory items
for(slot_id = 0; slot_id <= 30; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst) {
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
ser_items[i++] = packet;
size += packet.length();
}
@@ -896,7 +890,7 @@ void Client::BulkSendInventoryItems() {
if(GetClientVersion() >= EQClientSoF) {
const ItemInst* inst = m_inv[9999];
if(inst) {
string packet = inst->Serialize(9999);
std::string packet = inst->Serialize(9999);
ser_items[i++] = packet;
size += packet.length();
}
@@ -906,7 +900,7 @@ void Client::BulkSendInventoryItems() {
for(slot_id = 2000; slot_id <= 2023; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst) {
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
ser_items[i++] = packet;
size += packet.length();
}
@@ -916,7 +910,7 @@ void Client::BulkSendInventoryItems() {
for(slot_id = 2500; slot_id <= 2501; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst) {
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
ser_items[i++] = packet;
size += packet.length();
}
@@ -1693,7 +1687,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
// languages go here
if (gmskill->skill_id > 25)
{
cout << "Wrong Training Skill (languages)" << endl;
std::cout << "Wrong Training Skill (languages)" << std::endl;
DumpPacket(app);
return;
}
@@ -1708,7 +1702,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
// normal skills go here
if (gmskill->skill_id > HIGHEST_SKILL)
{
cout << "Wrong Training Skill (abilities)" << endl;
std::cout << "Wrong Training Skill (abilities)" << std::endl;
DumpPacket(app);
return;
}
+22 -20
View File
@@ -50,7 +50,7 @@
#include "../common/EQPacket.h"
#include "../common/guilds.h"
#include "../common/rulesys.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
//#include "../common/servertalk.h" // for oocmute and revoke
#include "worldserver.h"
#include "masterentity.h"
@@ -85,7 +85,7 @@ int (*command_dispatch)(Client *,char const *)=command_notavail;
void command_bestz(Client *c, const Seperator *message);
void command_pf(Client *c, const Seperator *message);
map<string, CommandRecord *> commandlist;
std::map<std::string, CommandRecord *> commandlist;
//All allocated CommandRecords get put in here so they get deleted on shutdown
LinkedList<CommandRecord *> cleanup_commandlist;
@@ -460,11 +460,11 @@ int command_init(void) {
return -1;
}
map<string, CommandRecord *>::iterator cur,end;
std::map<std::string, CommandRecord *>::iterator cur,end;
cur = commandlist.begin();
end = commandlist.end();
map<string,uint8> command_settings;
map<string,uint8>::iterator itr;
std::map<std::string,uint8> command_settings;
std::map<std::string,uint8>::iterator itr;
database.GetCommandSettings(command_settings);
for(; cur != end; cur++) {
if ((itr=command_settings.find(cur->first))!=command_settings.end())
@@ -526,7 +526,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun
if(function == nullptr)
return(-1);
string cstr(command_string);
std::string cstr(command_string);
if(commandlist.count(cstr) != 0) {
LogFile->write(EQEMuLog::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string);
@@ -534,7 +534,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun
}
//look for aliases...
map<string, CommandRecord *>::iterator cur,end,del;
std::map<std::string, CommandRecord *>::iterator cur,end,del;
cur = commandlist.begin();
end = commandlist.end();
for(; cur != end; cur++) {
@@ -578,7 +578,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun
*
*/
int command_add_perl(const char *command_string, const char *desc, int access) {
string cstr(command_string);
std::string cstr(command_string);
if(commandlist.count(cstr) != 0) {
#ifdef COMMANDS_PERL_OVERRIDE
@@ -607,7 +607,7 @@ int command_add_perl(const char *command_string, const char *desc, int access) {
//clear out any perl commands.
//should restore any overridden C++ commands, but thats a lot of work.
void command_clear_perl() {
map<string, CommandRecord *>::iterator cur,end,del;
std::map<std::string, CommandRecord *>::iterator cur,end,del;
cur = commandlist.begin();
end = commandlist.end();
for(; cur != end;) {
@@ -644,7 +644,7 @@ int command_realdispatch(Client *c, const char *message)
command_logcommand(c, message);
string cstr(sep.arg[0]+1);
std::string cstr(sep.arg[0]+1);
if(commandlist.count(cstr) != 1) {
return(-2);
@@ -917,13 +917,13 @@ void command_help(Client *c, const Seperator *sep)
c->Message(0, "Available EQEMu commands:");
map<string, CommandRecord *>::iterator cur,end;
std::map<std::string, CommandRecord *>::iterator cur,end;
cur = commandlist.begin();
end = commandlist.end();
for(; cur != end; cur++) {
if(sep->arg[1][0]) {
if(cur->first.find(sep->arg[1]) == string::npos) {
if(cur->first.find(sep->arg[1]) == std::string::npos) {
continue;
}
}
@@ -1759,10 +1759,12 @@ void command_timezone(Client *c, const Seperator *sep)
c->Message(13, "Current timezone is: %ih %im", zone->zone_time.getEQTimeZoneHr(), zone->zone_time.getEQTimeZoneMin());
}
else {
if(sep->arg[2]=="")
strcpy(sep->arg[2], "0");
c->Message(13, "Setting timezone to %s h %s m", sep->arg[1], sep->arg[2]);
uint32 ntz=(atoi(sep->arg[1])*60)+atoi(sep->arg[2]);
uint8 hours = atoi(sep->arg[1]);
uint8 minutes = atoi(sep->arg[2]);
if(!sep->IsNumber(2))
minutes = 0;
c->Message(13, "Setting timezone to %i h %i m", hours, minutes);
uint32 ntz=(hours*60)+minutes;
zone->zone_time.setEQTimeZone(ntz);
database.SetZoneTZ(zone->GetZoneID(), zone->GetInstanceVersion(), ntz);
@@ -3897,7 +3899,7 @@ void command_fixmob(Client *c, const Seperator *sep)
{
uint32 Adjustment = 1; // Previous or Next
char codeMove;
char codeMove = 0;
if (sep->arg[2])
{
@@ -6763,7 +6765,7 @@ void command_timers(Client *c, const Seperator *sep) {
}
Client *them = c->GetTarget()->CastToClient();
vector< pair<pTimerType, PersistentTimer *> > res;
std::vector< std::pair<pTimerType, PersistentTimer *> > res;
them->GetPTimers().ToVector(res);
c->Message(0,"Timers for target:");
@@ -8286,8 +8288,8 @@ void command_mlog(Client *c, const Seperator *sep) {
return;
}
bool onoff;
string on("on");
string off("off");
std::string on("on");
std::string off("off");
if(!strcasecmp(sep->arg[1], "target")) {
if(on == sep->arg[2]) onoff = true;
+7 -8
View File
@@ -19,14 +19,13 @@
#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;
#include "masterentity.h"
#include "worldserver.h"
#include "StringIDs.h"
#include "zonedb.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "guild_mgr.h"
#define OPEN_DOOR 0x02
@@ -243,7 +242,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
{ // guild doors
if((guild_id > 0) && !sender->GetGM())
{
string tmp;
std::string tmp;
char tmpmsg[240]; // guild doors msgs
if(guild_mgr.GetGuildNameByID(guild_id, tmp))
{
@@ -594,7 +593,7 @@ int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 v
mysql_free_result(result);
}
else {
cerr << "Error in GetDoorsCount query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetDoorsCount query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
}
@@ -625,7 +624,7 @@ int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) {
mysql_free_result(result);
}
else {
cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
}
@@ -656,7 +655,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version)
mysql_free_result(result);
}
else {
cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
}
@@ -681,7 +680,7 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name
int32 r;
for(r = 0; (row = mysql_fetch_row(result)); r++) {
if(r >= iDoorCount) {
cerr << "Error, Door Count of " << iDoorCount << " exceeded." << endl;
std::cerr << "Error, Door Count of " << iDoorCount << " exceeded." << std::endl;
break;
}
memset(&into[r], 0, sizeof(Door));
@@ -717,7 +716,7 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name
}
else
{
cerr << "Error in DBLoadDoors query '" << query << "' " << errbuf << endl;
std::cerr << "Error in DBLoadDoors query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
+28 -27
View File
@@ -31,6 +31,7 @@
#include "command.h"
#include "../common/seperator.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "QGlobals.h"
#include "zone.h"
@@ -131,7 +132,7 @@ void PerlembParser::ExportVar(const char * pkgprefix, const char * varname, cons
}
// Exports key-value pairs to a hash named pkgprefix::hashname
void PerlembParser::ExportHash(const char *pkgprefix, const char *hashname, std::map<string,string> &vals)
void PerlembParser::ExportHash(const char *pkgprefix, const char *hashname, std::map<std::string,std::string> &vals)
{
if (!perl)
return;
@@ -271,7 +272,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
}
string packagename;
std::string packagename;
if(!isPlayerQuest && !isGlobalPlayerQuest && !isItemQuest && !isSpellQuest){
if(global){
@@ -370,7 +371,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
//only export for npcs that are global enabled.
if(npcmob && npcmob->GetQglobal())
{
map<string, string> globhash;
std::map<std::string, std::string> globhash;
QGlobalCache *npc_c = nullptr;
QGlobalCache *char_c = nullptr;
QGlobalCache *zone_c = nullptr;
@@ -431,7 +432,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
else
{
map<string, string> globhash;
std::map<std::string, std::string> globhash;
QGlobalCache *char_c = nullptr;
QGlobalCache *zone_c = nullptr;
@@ -553,7 +554,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
if(mob && mob->IsClient())
{
string hashname = packagename + std::string("::hasitem");
std::string hashname = packagename + std::string("::hasitem");
#if EQDEBUG >= 7
LogFile->write(EQEMuLog::Debug, "starting hasitem, on : %s",hashname.c_str() );
#endif
@@ -579,7 +580,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
// $oncursor
if(mob && mob->IsClient()) {
string hashname = packagename + std::string("::oncursor");
std::string hashname = packagename + std::string("::oncursor");
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
char *hi_decl = nullptr;
int itemid = mob->CastToClient()->GetItemIDAt(30);
@@ -622,7 +623,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
ExportVar(packagename.c_str(), "silver", GetVar("silver", objid).c_str());
ExportVar(packagename.c_str(), "gold", GetVar("gold", objid).c_str());
ExportVar(packagename.c_str(), "platinum", GetVar("platinum", objid).c_str());
string hashname = packagename + std::string("::itemcount");
std::string hashname = packagename + std::string("::itemcount");
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
perl->eval(std::string("++$").append(hashname).append("{$").append(packagename).append("::item1};").c_str());
perl->eval(std::string("++$").append(hashname).append("{$").append(packagename).append("::item2};").c_str());
@@ -936,7 +937,7 @@ int PerlembParser::LoadScript(int npcid, const char * zone, Mob* activater)
return(1);
}
string filename = "quests/", packagename = GetPkgPrefix(npcid);
std::string filename = "quests/", packagename = GetPkgPrefix(npcid);
//each package name is of the form qstxxxx where xxxx = npcid (since numbers alone are not valid package names)
questMode curmode = questDefault;
FILE *tmpf;
@@ -953,7 +954,7 @@ int PerlembParser::LoadScript(int npcid, const char * zone, Mob* activater)
filename += zone;
filename += "/";
#ifdef QUEST_SCRIPTS_BYNAME
string bnfilename = filename;
std::string bnfilename = filename;
#endif
filename += itoa(npcid);
filename += ".pl";
@@ -1193,10 +1194,10 @@ int PerlembParser::LoadGlobalNPCScript()
return 1;
}
string filename = "quests/";
std::string filename = "quests/";
filename += QUEST_TEMPLATES_DIRECTORY;
filename += "/global_npc.pl";
string packagename = "global_npc";
std::string packagename = "global_npc";
try {
perl->eval_file(packagename.c_str(), filename.c_str());
@@ -1225,12 +1226,12 @@ int PerlembParser::LoadPlayerScript(const char *zone_name)
return 1;
}
string filename= "quests/";
std::string filename= "quests/";
filename += zone_name;
filename += "/player_v";
filename += itoa(zone->GetInstanceVersion());
filename += ".pl";
string packagename = "player";
std::string packagename = "player";
packagename += "_";
packagename += zone_name;
@@ -1297,10 +1298,10 @@ int PerlembParser::LoadGlobalPlayerScript()
return 1;
}
string filename = "quests/";
std::string filename = "quests/";
filename += QUEST_TEMPLATES_DIRECTORY;
filename += "/global_player.pl";
string packagename = "global_player";
std::string packagename = "global_player";
try {
perl->eval_file(packagename.c_str(), filename.c_str());
@@ -1317,7 +1318,7 @@ int PerlembParser::LoadGlobalPlayerScript()
return 1;
}
int PerlembParser::LoadItemScript(ItemInst* iteminst, string packagename, itemQuestMode Qtype) {
int PerlembParser::LoadItemScript(ItemInst* iteminst, std::string packagename, itemQuestMode Qtype) {
if(!perl)
return 0;
@@ -1330,7 +1331,7 @@ int PerlembParser::LoadItemScript(ItemInst* iteminst, string packagename, itemQu
if(itemQuestLoaded.count(packagename) == 1)
return 1;
string filename = "quests/items/";
std::string filename = "quests/items/";
if(Qtype == itemQuestScale)
filename += packagename;
else if(Qtype == itemQuestLore) {
@@ -1376,8 +1377,8 @@ int PerlembParser::LoadSpellScript(uint32 id)
if(spellQuestLoaded.count(id) == 1)
return 1;
string filename = "quests/spells/";
string packagename = "spell_effect_";
std::string filename = "quests/spells/";
std::string packagename = "spell_effect_";
filename += itoa(id);
packagename += itoa(id);
filename += ".pl";
@@ -1444,7 +1445,7 @@ bool PerlembParser::HasQuestSub(uint32 npcid, const char *subname) {
}
}
string packagename = GetPkgPrefix(npcid);
std::string packagename = GetPkgPrefix(npcid);
return(perl->SubExists(packagename.c_str(), subname));
}
@@ -1454,20 +1455,20 @@ bool PerlembParser::HasGlobalQuestSub(const char *subname) {
return(false);
}
string packagename = "global_npc";
std::string packagename = "global_npc";
return(perl->SubExists(packagename.c_str(), subname));
}
bool PerlembParser::PlayerHasQuestSub(const char *subname) {
string packagename = "player_";
std::string packagename = "player_";
packagename += zone->GetShortName();
if(playerQuestLoaded.count(zone->GetShortName()) == 0)
LoadPlayerScript(zone->GetShortName());
if(subname == "EVENT_CAST")
if(strcmp("EVENT_CAST",subname) == 0)
return (playerQuestLoaded[zone->GetShortName()] == pQuestEventCast);
return(perl->SubExists(packagename.c_str(), subname));
@@ -1475,12 +1476,12 @@ bool PerlembParser::PlayerHasQuestSub(const char *subname) {
bool PerlembParser::GlobalPlayerHasQuestSub(const char *subname) {
string packagename = "global_player";
std::string packagename = "global_player";
if(globalPlayerQuestLoaded == pQuestReadyToLoad)
LoadGlobalPlayerScript();
if(subname == "EVENT_CAST")
if(strcmp("EVENT_CAST",subname) == 0)
return (globalPlayerQuestLoaded == pQuestEventCast);
return(perl->SubExists(packagename.c_str(), subname));
@@ -1488,7 +1489,7 @@ bool PerlembParser::GlobalPlayerHasQuestSub(const char *subname) {
bool PerlembParser::SpellHasQuestSub(uint32 id, const char *subname)
{
string packagename = "spell_effect_";
std::string packagename = "spell_effect_";
packagename += itoa(id);
if(spellQuestLoaded.count(id) == 0)
@@ -1499,7 +1500,7 @@ bool PerlembParser::SpellHasQuestSub(uint32 id, const char *subname)
bool PerlembParser::ItemHasQuestSub(ItemInst *itm, const char *subname)
{
string packagename;
std::string packagename;
const Item_Struct* item = itm->GetItem();
if(!item)
return false;
+8 -9
View File
@@ -16,7 +16,6 @@
#include <string>
#include <map>
#include <queue>
using namespace std;
class Seperator;
@@ -60,7 +59,7 @@ typedef enum {
struct EventRecord {
QuestEventID event;
uint32 objid;
string data;
std::string data;
NPC* npcmob;
ItemInst* iteminst;
Mob* mob;
@@ -75,14 +74,14 @@ protected:
//could prolly get rid of this map now, since I check for the
//actual subroutine in the quest package as opposed to just seeing
//if they do not have a quest or the default.
map<uint32, questMode> hasQuests; //npcid -> questMode
map<std::string, playerQuestMode> playerQuestLoaded; //zone shortname -> playerQuestMode
std::map<uint32, questMode> hasQuests; //npcid -> questMode
std::map<std::string, playerQuestMode> playerQuestLoaded; //zone shortname -> playerQuestMode
playerQuestMode globalPlayerQuestLoaded;
GlobalNPCQuestMode globalNPCQuestLoaded;
map<std::string, itemQuestMode> itemQuestLoaded; // package name - > itemQuestMode
map<uint32, spellQuestMode> spellQuestLoaded;
std::map<std::string, itemQuestMode> itemQuestLoaded; // package name - > itemQuestMode
std::map<uint32, spellQuestMode> spellQuestLoaded;
queue<EventRecord> eventQueue; //for events that happen when perl is in use.
std::queue<EventRecord> eventQueue; //for events that happen when perl is in use.
bool eventQueueProcessing;
void HandleQueue();
@@ -122,13 +121,13 @@ public:
int LoadGlobalNPCScript();
int LoadPlayerScript(const char *zone);
int LoadGlobalPlayerScript();
int LoadItemScript(ItemInst* iteminst, string packagename, itemQuestMode Qtype);
int LoadItemScript(ItemInst* iteminst, std::string packagename, itemQuestMode Qtype);
int LoadSpellScript(uint32 id);
//expose a var to the script (probably parallels addvar))
//i.e. exportvar("qst1234", "name", "somemob");
//would expose the variable $name='somemob' to the script that handles npc1234
void ExportHash(const char *pkgprefix, const char *hashname, std::map<string,string> &vals);
void ExportHash(const char *pkgprefix, const char *hashname, std::map<std::string,std::string> &vals);
void ExportVar(const char * pkgprefix, const char * varname, const char * value) const;
void ExportVar(const char * pkgprefix, const char * varname, int value) const;
void ExportVar(const char * pkgprefix, const char * varname, unsigned int value) const;
+51 -56
View File
@@ -22,7 +22,6 @@
#include <ctype.h>
#include <string.h>
#include <iostream>
using namespace std;
#ifdef _WINDOWS
#include <process.h>
@@ -49,12 +48,9 @@ using namespace std;
#include "QuestParserCollection.h"
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
extern Zone* zone;
@@ -83,13 +79,13 @@ void Entity::SetID(uint16 set_id) {
Client* Entity::CastToClient() {
if(this==0x00){
cout << "CastToClient error (nullptr)" << endl;
std::cout << "CastToClient error (nullptr)" << std::endl;
DebugBreak();
return 0;
}
#ifdef _EQDEBUG
if(!IsClient()) {
cout << "CastToClient error (not client?)" << endl;
std::cout << "CastToClient error (not client?)" << std::endl;
DebugBreak();
return 0;
}
@@ -100,7 +96,7 @@ Client* Entity::CastToClient() {
NPC* Entity::CastToNPC() {
#ifdef _EQDEBUG
if(!IsNPC()) {
cout << "CastToNPC error" << endl;
std::cout << "CastToNPC error" << std::endl;
DebugBreak();
return 0;
}
@@ -111,7 +107,7 @@ NPC* Entity::CastToNPC() {
Mob* Entity::CastToMob() {
#ifdef _EQDEBUG
if(!IsMob()) {
cout << "CastToMob error" << endl;
std::cout << "CastToMob error" << std::endl;
DebugBreak();
return 0;
}
@@ -122,7 +118,7 @@ Mob* Entity::CastToMob() {
Merc* Entity::CastToMerc() {
#ifdef _EQDEBUG
if(!IsMerc()) {
cout << "CastToMerc error" << endl;
std::cout << "CastToMerc error" << std::endl;
DebugBreak();
return 0;
}
@@ -146,7 +142,7 @@ Trap* Entity::CastToTrap()
Corpse* Entity::CastToCorpse() {
#ifdef _EQDEBUG
if(!IsCorpse()) {
cout << "CastToCorpse error" << endl;
std::cout << "CastToCorpse error" << std::endl;
DebugBreak();
return 0;
}
@@ -156,7 +152,7 @@ Corpse* Entity::CastToCorpse() {
Object* Entity::CastToObject() {
#ifdef _EQDEBUG
if(!IsObject()) {
cout << "CastToObject error" << endl;
std::cout << "CastToObject error" << std::endl;
DebugBreak();
return 0;
}
@@ -183,18 +179,15 @@ Beacon* Entity::CastToBeacon() {
return static_cast<Beacon*>(this);
}
const Client* Entity::CastToClient() const {
if(this==0x00){
cout << "CastToClient error (nullptr)" << endl;
std::cout << "CastToClient error (nullptr)" << std::endl;
DebugBreak();
return 0;
}
#ifdef _EQDEBUG
if(!IsClient()) {
cout << "CastToClient error (not client?)" << endl;
std::cout << "CastToClient error (not client?)" << std::endl;
DebugBreak();
return 0;
}
@@ -205,7 +198,7 @@ const Client* Entity::CastToClient() const {
const NPC* Entity::CastToNPC() const {
#ifdef _EQDEBUG
if(!IsNPC()) {
cout << "CastToNPC error" << endl;
std::cout << "CastToNPC error" << std::endl;
DebugBreak();
return 0;
}
@@ -216,7 +209,7 @@ const NPC* Entity::CastToNPC() const {
const Mob* Entity::CastToMob() const {
#ifdef _EQDEBUG
if(!IsMob()) {
cout << "CastToMob error" << endl;
std::cout << "CastToMob error" << std::endl;
DebugBreak();
return 0;
}
@@ -227,7 +220,7 @@ const Mob* Entity::CastToMob() const {
const Merc* Entity::CastToMerc() const {
#ifdef _EQDEBUG
if(!IsMerc()) {
cout << "CastToMerc error" << endl;
std::cout << "CastToMerc error" << std::endl;
DebugBreak();
return 0;
}
@@ -249,7 +242,7 @@ const Trap* Entity::CastToTrap() const {
const Corpse* Entity::CastToCorpse() const {
#ifdef _EQDEBUG
if(!IsCorpse()) {
cout << "CastToCorpse error" << endl;
std::cout << "CastToCorpse error" << std::endl;
DebugBreak();
return 0;
}
@@ -260,7 +253,7 @@ const Corpse* Entity::CastToCorpse() const {
const Object* Entity::CastToObject() const {
#ifdef _EQDEBUG
if(!IsObject()) {
cout << "CastToObject error" << endl;
std::cout << "CastToObject error" << std::endl;
DebugBreak();
return 0;
}
@@ -280,7 +273,7 @@ const Beacon* Entity::CastToBeacon() const {
Bot* Entity::CastToBot() {
#ifdef _EQDEBUG
if(!IsBot()) {
cout << "CastToBot error" << endl;
std::cout << "CastToBot error" << std::endl;
DebugBreak();
return 0;
}
@@ -355,7 +348,7 @@ void EntityList::TrapProcess() {
// to track down bugs.
void EntityList::CheckGroupList (const char *fname, const int fline)
{
list<Group *>::iterator it;
std::list<Group *>::iterator it;
for (it = group_list.begin(); it != group_list.end(); it++)
{
@@ -367,7 +360,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline)
}
void EntityList::GroupProcess() {
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
uint32 count = 0;
if(numclients < 1)
@@ -399,7 +392,7 @@ void EntityList::GroupProcess() {
void EntityList::QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app)
{
list<Group *>::iterator iterator = group_list.begin();
std::list<Group *>::iterator iterator = group_list.begin();
_ZP(EntityList_QueueToGroupsForNPCHealthAA);
@@ -411,7 +404,7 @@ void EntityList::QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPac
}
void EntityList::RaidProcess() {
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
uint32 count = 0;
if(numclients < 1)
@@ -518,7 +511,7 @@ void EntityList::MobProcess() {
#ifdef _WINDOWS
struct in_addr in;
in.s_addr = mob->CastToClient()->GetIP();
cout << "Dropping client: Process=false, ip=" << inet_ntoa(in) << ", port=" << mob->CastToClient()->GetPort() << endl;
std::cout << "Dropping client: Process=false, ip=" << inet_ntoa(in) << ", port=" << mob->CastToClient()->GetPort() << std::endl;
#endif
zone->StartShutdownTimer();
Group *g = GetGroupByMob(mob);
@@ -1493,11 +1486,13 @@ void EntityList::RemoveFromTargets(Mob* mob, bool RemoveFromXTargets)
m->RemoveFromHateList(mob);
if(RemoveFromXTargets)
{
if(m->IsClient())
m->CastToClient()->RemoveXTarget(mob, false);
// FadingMemories calls this function passing the client.
else if(mob->IsClient())
mob->CastToClient()->RemoveXTarget(m, false);
}
}
}
@@ -1952,7 +1947,7 @@ Client* EntityList::GetClientByWID(uint32 iWID) {
Client* EntityList::GetRandomClient(float x, float y, float z, float Distance, Client* ExcludeClient)
{
vector<Client*> ClientsInRange;
std::vector<Client*> ClientsInRange;
LinkedListIterator<Client*> iterator(client_list);
@@ -2093,7 +2088,7 @@ int EntityList::RezzAllCorpsesByCharID(uint32 charid)
Group* EntityList::GetGroupByMob(Mob* mob)
{
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2111,7 +2106,7 @@ Group* EntityList::GetGroupByMob(Mob* mob)
}
Group* EntityList::GetGroupByLeaderName(char* leader){
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2128,7 +2123,7 @@ Group* EntityList::GetGroupByLeaderName(char* leader){
return 0;
}
Group* EntityList::GetGroupByID(uint32 group_id){
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2146,7 +2141,7 @@ Group* EntityList::GetGroupByID(uint32 group_id){
}
Group* EntityList::GetGroupByClient(Client* client)
{
list <Group *>::iterator iterator;
std::list <Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2164,7 +2159,7 @@ Group* EntityList::GetGroupByClient(Client* client)
}
Raid* EntityList::GetRaidByLeaderName(const char *leader){
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -2180,7 +2175,7 @@ Raid* EntityList::GetRaidByLeaderName(const char *leader){
return 0;
}
Raid* EntityList::GetRaidByID(uint32 id){
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -2196,7 +2191,7 @@ Raid* EntityList::GetRaidByID(uint32 id){
Raid* EntityList::GetRaidByClient(Client* client)
{
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -2215,7 +2210,7 @@ Raid* EntityList::GetRaidByClient(Client* client)
}
Raid* EntityList::GetRaidByMob(Mob* mob) {
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -2658,7 +2653,7 @@ bool EntityList::RemoveCorpse(uint16 delete_id){
return false;
}
bool EntityList::RemoveGroup(uint32 delete_id){
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2680,7 +2675,7 @@ bool EntityList::RemoveGroup(uint32 delete_id){
}
bool EntityList::RemoveRaid(uint32 delete_id){
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -3124,7 +3119,7 @@ void EntityList::FindPathsToAllNPCs()
{
VERTEX Node0 = zone->pathing->GetPathNodeCoordinates(0, false);
VERTEX Dest(Iterator.GetData()->GetX(), Iterator.GetData()->GetY(), Iterator.GetData()->GetZ());
list<int> Route = zone->pathing->FindRoute(Node0, Dest);
std::list<int> Route = zone->pathing->FindRoute(Node0, Dest);
if(Route.size() == 0)
printf("Unable to find a route to %s\n", Iterator.GetData()->GetName());
else
@@ -3254,7 +3249,7 @@ void EntityList::WriteEntityIDs() {
iterator.Reset();
while(iterator.MoreElements())
{
cout << "ID: " << iterator.GetData()->GetID() << " Name: " << iterator.GetData()->GetName() << endl;
std::cout << "ID: " << iterator.GetData()->GetID() << " Name: " << iterator.GetData()->GetName() << std::endl;
iterator.Advance();
}
}
@@ -3892,7 +3887,7 @@ bool EntityList::LimitCheckType(uint32 npc_type, int count) {
if(count < 1)
return(true);
map<uint16, SpawnLimitRecord>::iterator cur,end;
std::map<uint16, SpawnLimitRecord>::iterator cur,end;
cur = npc_limit_list.begin();
end = npc_limit_list.end();
@@ -3913,7 +3908,7 @@ bool EntityList::LimitCheckGroup(uint32 spawngroup_id, int count) {
if(count < 1)
return(true);
map<uint16, SpawnLimitRecord>::iterator cur,end;
std::map<uint16, SpawnLimitRecord>::iterator cur,end;
cur = npc_limit_list.begin();
end = npc_limit_list.end();
@@ -3935,7 +3930,7 @@ bool EntityList::LimitCheckBoth(uint32 npc_type, uint32 spawngroup_id, int group
if(group_count < 1 && type_count < 1)
return(true);
map<uint16, SpawnLimitRecord>::iterator cur,end;
std::map<uint16, SpawnLimitRecord>::iterator cur,end;
cur = npc_limit_list.begin();
end = npc_limit_list.end();
@@ -4543,7 +4538,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) {
strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength))
continue;
string GuildName;
std::string GuildName;
if((ClientEntry->GuildID() != GUILD_NONE) && (ClientEntry->GuildID() > 0)) {
@@ -4749,7 +4744,7 @@ void EntityList::SignalAllClients(uint32 data)
}
}
void EntityList::GetMobList(list<Mob*> &m_list)
void EntityList::GetMobList(std::list<Mob*> &m_list)
{
m_list.clear();
LinkedListIterator<Mob*> iterator(mob_list);
@@ -4762,7 +4757,7 @@ void EntityList::GetMobList(list<Mob*> &m_list)
}
}
void EntityList::GetNPCList(list<NPC*> &n_list)
void EntityList::GetNPCList(std::list<NPC*> &n_list)
{
n_list.clear();
LinkedListIterator<NPC*> iterator(npc_list);
@@ -4775,7 +4770,7 @@ void EntityList::GetNPCList(list<NPC*> &n_list)
}
}
void EntityList::GetClientList(list<Client*> &c_list)
void EntityList::GetClientList(std::list<Client*> &c_list)
{
c_list.clear();
LinkedListIterator<Client*> iterator(client_list);
@@ -4788,7 +4783,7 @@ void EntityList::GetClientList(list<Client*> &c_list)
}
}
void EntityList::GetCorpseList(list<Corpse*> &c_list)
void EntityList::GetCorpseList(std::list<Corpse*> &c_list)
{
c_list.clear();
LinkedListIterator<Corpse*> iterator(corpse_list);
@@ -4801,7 +4796,7 @@ void EntityList::GetCorpseList(list<Corpse*> &c_list)
}
}
void EntityList::GetObjectList(list<Object*> &o_list)
void EntityList::GetObjectList(std::list<Object*> &o_list)
{
o_list.clear();
LinkedListIterator<Object*> iterator(object_list);
@@ -4814,7 +4809,7 @@ void EntityList::GetObjectList(list<Object*> &o_list)
}
}
void EntityList::GetDoorsList(list<Doors*> &o_list)
void EntityList::GetDoorsList(std::list<Doors*> &o_list)
{
o_list.clear();
LinkedListIterator<Doors*> iterator(door_list);
@@ -5083,7 +5078,7 @@ void EntityList::AddLootToNPCS(uint32 item_id, uint32 count)
while(count > 0)
{
vector<int> selection;
std::vector<int> selection;
selection.reserve(npc_count);
for(int j = 0; j < npc_count; ++j)
{
@@ -5206,7 +5201,7 @@ Mob* EntityList::GetClosestMobByBodyType(Mob* sender, bodyType BodyType)
return ClosestMob;
}
void EntityList::GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, list<Mob*> &m_list)
void EntityList::GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, std::list<Mob*> &m_list)
{
LinkedListIterator<Mob*> iterator(mob_list);
iterator.Reset();
@@ -5259,7 +5254,7 @@ Mob* EntityList::GetTargetForVirus(Mob* spreader)
{
int max_spread_range = RuleI(Spells, VirusSpreadDistance);
vector<Mob*> TargetsInRange;
std::vector<Mob*> TargetsInRange;
LinkedListIterator<Mob*> iterator(mob_list);
iterator.Reset();
+17 -16
View File
@@ -20,12 +20,13 @@
#include "../common/types.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/bodytypes.h"
#include "../common/eq_constants.h"
#include "zonedb.h"
#include "zonedump.h"
#include "zonedbasync.h"
#include "QGlobals.h"
// max number of newspawns to send per bulk packet
@@ -387,14 +388,14 @@ public:
void UpdateFindableNPCState(NPC *n, bool Remove);
void HideCorpses(Client *c, uint8 CurrentMode, uint8 NewMode);
void GetMobList(list<Mob*> &m_list);
void GetNPCList(list<NPC*> &n_list);
void GetMercList(list<Merc*> &n_list);
void GetClientList(list<Client*> &c_list);
void GetCorpseList(list<Corpse*> &c_list);
void GetObjectList(list<Object*> &o_list);
void GetDoorsList(list<Doors*> &d_list);
void GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, list<Mob*> &m_list);
void GetMobList(std::list<Mob*> &m_list);
void GetNPCList(std::list<NPC*> &n_list);
void GetMercList(std::list<Merc*> &n_list);
void GetClientList(std::list<Client*> &c_list);
void GetCorpseList(std::list<Corpse*> &c_list);
void GetObjectList(std::list<Object*> &o_list);
void GetDoorsList(std::list<Doors*> &d_list);
void GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, std::list<Mob*> &m_list);
void DepopAll(int NPCTypeID, bool StartSpawnTimer = true);
@@ -412,7 +413,7 @@ private:
//used for limiting spawns
class SpawnLimitRecord { public: uint32 spawngroup_id; uint32 npc_type; };
map<uint16, SpawnLimitRecord> npc_limit_list; //entity id -> npc type
std::map<uint16, SpawnLimitRecord> npc_limit_list; //entity id -> npc type
uint32 tsFirstSpawnOnQueue; // timestamp that the top spawn on the spawnqueue was added, should be 0xFFFFFFFF if queue is empty
uint32 NumSpawnsOnQueue;
@@ -422,14 +423,14 @@ private:
LinkedList<Mob*> mob_list;
LinkedList<NPC*> npc_list;
LinkedList<Merc *> merc_list;
list<Group*> group_list;
std::list<Group*> group_list;
LinkedList<Corpse*> corpse_list;
LinkedList<Object*> object_list;
LinkedList<Doors*> door_list;
LinkedList<Trap*> trap_list;
LinkedList<Beacon*> beacon_list;
LinkedList<NPC *> proximity_list;
list<Raid *> raid_list;
std::list<Raid *> raid_list;
uint16 last_insert_id;
// Please Do Not Declare Any EntityList Class Members After This Comment
@@ -441,7 +442,7 @@ private:
Mob* GetMobByBotID(uint32 botID);
Bot* GetBotByBotID(uint32 botID);
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
void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff
+1 -1
View File
@@ -19,7 +19,7 @@
#include "../common/features.h"
#include "masterentity.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
+1 -1
View File
@@ -159,7 +159,7 @@ void Mob::CalculateNewFearpoint()
VERTEX CurrentPosition(GetX(), GetY(), GetZ());
list<int> Route = zone->pathing->FindRoute(CurrentPosition, Loc);
std::list<int> Route = zone->pathing->FindRoute(CurrentPosition, Loc);
if(Route.size() > 0)
{
+2 -2
View File
@@ -17,7 +17,6 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <stdlib.h>
#include <math.h>
@@ -33,6 +32,7 @@ using namespace std;
#include "titles.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "zonedb.h"
@@ -177,7 +177,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
mysql_free_result(result);
}
else {
cerr << "Error in Fishing query '" << query << "' " << errbuf << endl;
std::cerr << "Error in Fishing query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
+2 -2
View File
@@ -20,7 +20,7 @@
#include "NpcAI.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "worldserver.h"
extern EntityList entity_list;
extern WorldServer worldserver;
@@ -158,7 +158,7 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu
char buf[128];
buf[63] = '\0';
string msg = "You receive";
std::string msg = "You receive";
bool one = false;
if(ppsplit > 0) {
+4 -4
View File
@@ -141,10 +141,10 @@ public:
private:
Mob* leader;
GroupLeadershipAA_Struct LeaderAbilities;
string MainTankName;
string MainAssistName;
string PullerName;
string NPCMarkerName;
std::string MainTankName;
std::string MainAssistName;
std::string PullerName;
std::string NPCMarkerName;
uint16 NPCMarkerID;
uint16 AssistTargetID;
uint16 TankTargetID;
+1 -1
View File
@@ -28,7 +28,7 @@
#include "../common/ZoneNumbers.h"
#include "../common/moremath.h"
#include "../common/guilds.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "guild_mgr.h"
#include "StringIDs.h"
#include "NpcAI.h"
+7 -8
View File
@@ -20,6 +20,7 @@
#include "zonedb.h"
#include "worldserver.h"
#include "../common/servertalk.h"
#include "../common/StringUtil.h"
#include "client.h"
#include "entity.h"
@@ -164,13 +165,13 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na
return(retbuffer);
}
vector<CharGuildInfo *> members;
std::vector<CharGuildInfo *> members;
if(!GetEntireGuild(guild_id, members))
return(nullptr);
//figure out the actual packet length.
uint32 fixed_length = sizeof(Internal_GuildMembers_Struct) + members.size()*sizeof(Internal_GuildMemberEntry_Struct);
vector<CharGuildInfo *>::iterator cur, end;
std::vector<CharGuildInfo *>::iterator cur, end;
CharGuildInfo *ci;
cur = members.begin();
end = members.end();
@@ -242,7 +243,7 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na
void ZoneGuildManager::ListGuilds(Client *c) const {
c->Message(0, "Listing guilds on the server:");
char leadername[64];
map<uint32, GuildInfo *>::const_iterator cur, end;
std::map<uint32, GuildInfo *>::const_iterator cur, end;
cur = m_guilds.begin();
end = m_guilds.end();
int r = 0;
@@ -260,7 +261,7 @@ void ZoneGuildManager::ListGuilds(Client *c) const {
void ZoneGuildManager::DescribeGuild(Client *c, uint32 guild_id) const {
map<uint32, GuildInfo *>::const_iterator res;
std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id);
if(res == m_guilds.end()) {
c->Message(0, "Guild %d not found.", guild_id);
@@ -292,11 +293,11 @@ void ZoneGuildManager::DescribeGuild(Client *c, uint32 guild_id) const {
//in theory, we could get a pile of unused entries in this array, but only if
//we had a malicious client sending controlled packets, plus its like 10 bytes per entry.
void ZoneGuildManager::RecordInvite(uint32 char_id, uint32 guild_id, uint8 rank) {
m_inviteQueue[char_id] = pair<uint32, uint8>(guild_id, rank);
m_inviteQueue[char_id] = std::pair<uint32, uint8>(guild_id, rank);
}
bool ZoneGuildManager::VerifyAndClearInvite(uint32 char_id, uint32 guild_id, uint8 rank) {
map<uint32, pair<uint32, uint8> >::iterator res;
std::map<uint32, std::pair<uint32, uint8> >::iterator res;
res = m_inviteQueue.find(char_id);
if(res == m_inviteQueue.end())
return(false); //no entry...
@@ -308,8 +309,6 @@ bool ZoneGuildManager::VerifyAndClearInvite(uint32 char_id, uint32 guild_id, uin
return(valid);
}
void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
switch(pack->opcode) {
case ServerOP_RefreshGuild: {
+2 -2
View File
@@ -20,12 +20,12 @@
#include "masterentity.h"
#include "../common/Item.h"
#include "../common/linked_list.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include <math.h>
#include <assert.h>
#include "worldserver.h"
map<uint16, const NPCType *> Horse::horse_types;
std::map<uint16, const NPCType *> Horse::horse_types;
LinkedList<NPCType *> horses_auto_delete;
Horse::Horse(Client *_owner, uint16 spell_id, float x, float y, float z, float heading)
+1 -2
View File
@@ -22,7 +22,6 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "npc.h"
#include <map>
using namespace std;
class Horse : public NPC {
public:
@@ -36,7 +35,7 @@ protected:
Client *owner;
//generate npc type records for horses
static map<uint16, const NPCType *> horse_types;
static std::map<uint16, const NPCType *> horse_types;
static const NPCType *GetHorseType(uint16 spell_id);
static const NPCType *BuildHorseType(uint16 spell_id);
};
+12 -11
View File
@@ -29,6 +29,7 @@
#include "../common/moremath.h"
#include "../common/guilds.h"
#include "../common/logsys.h"
#include "../common/StringUtil.h"
#include "StringIDs.h"
#include "NpcAI.h"
extern WorldServer worldserver;
@@ -337,7 +338,7 @@ void Client::DropItem(int16 slot_id)
// Save client inventory change to database
if (slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(CharacterID(), s, e);
} else
database.SaveInventory(CharacterID(), nullptr, slot_id);
@@ -469,7 +470,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
const ItemInst* inst=nullptr;
if (slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
if(update_db)
database.SaveCursor(character_id, s, e);
}
@@ -523,7 +524,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update)
SendItemPacket(SLOT_CURSOR, &inst, ItemPacketSummonItem);
}
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
return database.SaveCursor(CharacterID(), s, e);
}
@@ -542,7 +543,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client
}
if (slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
return database.SaveCursor(this->CharacterID(), s, e);
} else
return database.SaveInventory(this->CharacterID(), &inst, slot_id);
@@ -558,7 +559,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
SendLootItemInPacket(&inst, slot_id);
if (slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(this->CharacterID(), s, e);
} else
database.SaveInventory(this->CharacterID(), &inst, slot_id);
@@ -712,7 +713,7 @@ void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type)
from.SetCharges(from.GetCharges() - charges_to_move);
SendLootItemInPacket(tmp_inst, to_slot);
if (to_slot==SLOT_CURSOR){
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(this->CharacterID(), s, e);
} else
database.SaveInventory(this->CharacterID(), tmp_inst, to_slot);
@@ -1207,7 +1208,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
safe_delete(world_inst);
if (src_slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(character_id, s, e);
} else
database.SaveInventory(character_id, m_inv[src_slot_id], src_slot_id);
@@ -1332,12 +1333,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Step 7: Save change to the database
if (src_slot_id==SLOT_CURSOR){
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(character_id, s, e);
} else
database.SaveInventory(character_id, m_inv.GetItem(src_slot_id), src_slot_id);
if (dst_slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(character_id, s, e);
} else
database.SaveInventory(character_id, m_inv.GetItem(dst_slot_id), dst_slot_id);
@@ -1964,7 +1965,7 @@ void Client::SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType
return;
// Serialize item into |-delimited string
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
EmuOpcode opcode = OP_Unknown;
EQApplicationPacket* outapp = nullptr;
@@ -1989,7 +1990,7 @@ EQApplicationPacket* Client::ReturnItemPacket(int16 slot_id, const ItemInst* ins
return 0;
// Serialize item into |-delimited string
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
EmuOpcode opcode = OP_Unknown;
EQApplicationPacket* outapp = nullptr;
+1 -2
View File
@@ -18,7 +18,6 @@
#include "../common/debug.h"
#include <stdio.h>
#include <iostream>
using namespace std;
#include <stdlib.h>
#include "npc.h"
#include "masterentity.h"
@@ -45,7 +44,7 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite
// do coin
if (lts->mincash > lts->maxcash) {
cerr << "Error in loottable #" << loottable_id << ": mincash > maxcash" << endl;
std::cerr << "Error in loottable #" << loottable_id << ": mincash > maxcash" << std::endl;
}
else if (lts->maxcash != 0) {
uint32 cash = 0;
+7 -6
View File
@@ -9,6 +9,7 @@
#include "zone.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
#include "watermap.h"
@@ -1122,7 +1123,7 @@ int32 Merc::CalcBaseEndurance()
int BonusUpto800 = int( at_most_800 / 4 ) ;
if(Stats > 400) {
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) {
Bonus800plus = int( (Stats - 800) / 8 ) * 2;
@@ -1928,7 +1929,7 @@ bool Merc::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) {
_ZP(Merc_AI_IdleCastCheck);
#if MobAI_DEBUG_Spells >= 25
cout << "Non-Engaged autocast check triggered: " << this->GetCleanName() << endl;
std::cout << "Non-Engaged autocast check triggered: " << this->GetCleanName() << std::endl;
#endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
@@ -3774,7 +3775,7 @@ MercSpell Merc::GetBestMercSpellForCure(Merc* caster, Mob *tar) {
//Check for group cure first
if(countNeedsCured > 2) {
for(list<MercSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
for(std::list<MercSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
MercSpell selectedMercSpell = *itr;
if(IsGroupSpell(itr->spellid) && CheckSpellRecastTimers(caster, itr->spellid)) {
@@ -3814,7 +3815,7 @@ MercSpell Merc::GetBestMercSpellForCure(Merc* caster, Mob *tar) {
//no group cure for target- try to find single target spell
if(!spellSelected) {
for(list<MercSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
for(std::list<MercSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
MercSpell selectedMercSpell = *itr;
if(CheckSpellRecastTimers(caster, itr->spellid)) {
@@ -5062,7 +5063,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id,
snprintf(c->GetEPP().merc_name, 64, "%s", c->GetMercInfo().merc_name);
snprintf(npc_type->name, 64, "%s", c->GetMercInfo().merc_name);
}
uint8 gender;
uint8 gender = 0;
if(merchant_id > 0) {
NPC* tar = entity_list.GetNPCByID(merchant_id);
if(tar) {
@@ -5586,7 +5587,7 @@ bool Merc::Suspend() {
}
bool Merc::Unsuspend(bool setMaxStats) {
Client* mercOwner;
Client* mercOwner = nullptr;
bool loaded = false;
if(GetMercOwner()) {
-1
View File
@@ -3,7 +3,6 @@
#include "mob.h"
#include "zonedb.h"
#include "npc.h"
using namespace std;
#define MAXMERCS 1
#define MERC_DEBUG 0
+11 -10
View File
@@ -21,6 +21,7 @@
#include "StringIDs.h"
#include "worldserver.h"
#include "QuestParserCollection.h"
#include "../common/StringUtil.h"
#include <sstream>
#include <math.h>
@@ -91,13 +92,13 @@ Mob::Mob(const char* in_name,
mana_timer(2000),
spellend_timer(0),
rewind_timer(30000), //Timer used for determining amount of time between actual player position updates for /rewind.
bindwound_timer(10000),
stunned_timer(0),
spun_timer(0),
bardsong_timer(6000),
flee_timer(FLEE_CHECK_TIMER),
bindwound_timer(10000),
gravity_timer(1000),
viral_timer(0)
viral_timer(0),
flee_timer(FLEE_CHECK_TIMER)
{
targeted = 0;
@@ -878,7 +879,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
// Changing the first string made it vanish, so it has some significance.
if(lastname)
sprintf(ns->spawn.DestructibleModel, lastname);
sprintf(ns->spawn.DestructibleModel, "%s", lastname);
// Changing the second string made no visible difference
sprintf(ns->spawn.DestructibleName2, "%s", ns->spawn.name);
// Putting a string in the final one that was previously empty had no visible effect.
@@ -3782,7 +3783,7 @@ void Mob::InsertQuestGlobal(int charid, int npcid, int zoneid, const char *varna
char errbuf[MYSQL_ERRMSG_SIZE];
// Make duration string either "unix_timestamp(now()) + xxx" or "NULL"
stringstream duration_ss;
std::stringstream duration_ss;
if (duration == INT_MAX)
{
@@ -4487,7 +4488,7 @@ bool Mob::PassLimitToSkill(uint16 spell_id, uint16 skill) {
// Faction Mods for Alliance type spells
void Mob::AddFactionBonus(uint32 pFactionID,int32 bonus) {
map <uint32, int32> :: const_iterator faction_bonus;
std::map <uint32, int32> :: const_iterator faction_bonus;
typedef std::pair <uint32, int32> NewFactionBonus;
faction_bonus = faction_bonuses.find(pFactionID);
@@ -4507,7 +4508,7 @@ void Mob::AddFactionBonus(uint32 pFactionID,int32 bonus) {
// Faction Mods from items
void Mob::AddItemFactionBonus(uint32 pFactionID,int32 bonus) {
map <uint32, int32> :: const_iterator faction_bonus;
std::map <uint32, int32> :: const_iterator faction_bonus;
typedef std::pair <uint32, int32> NewFactionBonus;
faction_bonus = item_faction_bonuses.find(pFactionID);
@@ -4526,7 +4527,7 @@ void Mob::AddItemFactionBonus(uint32 pFactionID,int32 bonus) {
}
int32 Mob::GetFactionBonus(uint32 pFactionID) {
map <uint32, int32> :: const_iterator faction_bonus;
std::map <uint32, int32> :: const_iterator faction_bonus;
faction_bonus = faction_bonuses.find(pFactionID);
if(faction_bonus != faction_bonuses.end())
{
@@ -4536,7 +4537,7 @@ int32 Mob::GetFactionBonus(uint32 pFactionID) {
}
int32 Mob::GetItemFactionBonus(uint32 pFactionID) {
map <uint32, int32> :: const_iterator faction_bonus;
std::map <uint32, int32> :: const_iterator faction_bonus;
faction_bonus = item_faction_bonuses.find(pFactionID);
if(faction_bonus != item_faction_bonuses.end())
{
@@ -4546,7 +4547,7 @@ int32 Mob::GetItemFactionBonus(uint32 pFactionID) {
}
void Mob::ClearItemFactionBonuses() {
map <uint32, int32> :: iterator itr;
std::map <uint32, int32> :: iterator itr;
for(itr = item_faction_bonuses.begin(); itr != item_faction_bonuses.end(); itr++)
{
item_faction_bonuses.erase(itr->first);
+10 -9
View File
@@ -970,11 +970,6 @@ protected:
Timer tic_timer;
Timer mana_timer;
float rewind_x;
float rewind_y;
float rewind_z;
Timer rewind_timer;
//spell casting vars
Timer spellend_timer;
uint16 casting_spell_id;
@@ -993,6 +988,11 @@ protected:
uint8 bardsong_slot;
uint32 bardsong_target_id;
float rewind_x;
float rewind_y;
float rewind_z;
Timer rewind_timer;
// Currently 3 max nimbus particle effects at a time
uint32 nimbus_effect1;
uint32 nimbus_effect2;
@@ -1027,6 +1027,10 @@ protected:
int16 rooted_mod; //Modifier to root break chance, defined when root is cast on a target.
bool offhand;
// Bind wound
Timer bindwound_timer;
Mob* bindwound_target;
Timer stunned_timer;
Timer spun_timer;
Timer bardsong_timer;
@@ -1094,7 +1098,7 @@ protected:
VERTEX PathingLastPosition;
int PathingLoopCount;
int PathingLastNodeVisited;
list<int> Route;
std::list<int> Route;
LOSType PathingLOSState;
Timer *PathingLOSCheckTimer;
Timer *PathingRouteUpdateTimerShort;
@@ -1109,9 +1113,6 @@ protected:
uint32 pDontSnareMeBefore;
uint32 pDontCureMeBefore;
// Bind wound
Timer bindwound_timer;
Mob* bindwound_target;
// hp event
int nexthpevent;
int nextinchpevent;
+33 -38
View File
@@ -1,4 +1,3 @@
#define DONT_SHARED_OPCODES
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
@@ -16,36 +15,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define DONT_SHARED_OPCODES
#include "../common/debug.h"
#include "../common/features.h"
#include <iostream>
using namespace std;
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#ifdef _CRTDBG_MAP_ALLOC
#undef new
#endif
#include <fstream>
#ifdef _CRTDBG_MAP_ALLOC
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
using namespace std;
#ifdef _WINDOWS
#include <conio.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
volatile bool RunLoops = true;
extern volatile bool ZoneLoaded;
#include "../common/queue.h"
#include "../common/timer.h"
#include "../common/EQStream.h"
@@ -54,7 +28,6 @@ extern volatile bool ZoneLoaded;
#include "../common/Mutex.h"
#include "../common/version.h"
#include "../common/EQEMuError.h"
#include "ZoneConfig.h"
#include "../common/packet_dump_file.h"
#include "../common/opcodemgr.h"
#include "../common/guilds.h"
@@ -62,16 +35,18 @@ extern volatile bool ZoneLoaded;
#include "../common/patches/patches.h"
#include "../common/rulesys.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/platform.h"
#include "../common/crash.h"
#include "../common/ipc_mutex.h"
#include "../common/memory_mapped_file.h"
#include "../common/eqemu_exception.h"
#include "../common/spdat.h"
#include "ZoneConfig.h"
#include "masterentity.h"
#include "worldserver.h"
#include "net.h"
#include "../common/spdat.h"
#include "zone.h"
#include "command.h"
#include "parser.h"
@@ -84,6 +59,33 @@ extern volatile bool ZoneLoaded;
#include "tasks.h"
#include "QuestParserCollection.h"
#include <iostream>
#include <string>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#ifdef _CRTDBG_MAP_ALLOC
#undef new
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#ifdef _WINDOWS
#include <conio.h>
#include <process.h>
#else
#include <pthread.h>
#include "../common/unix.h"
#endif
volatile bool RunLoops = true;
extern volatile bool ZoneLoaded;
TimeoutManager timeout_manager;
NetConnection net;
EntityList entity_list;
@@ -104,13 +106,6 @@ const SPDat_Spell_Struct* spells;
void LoadSpells(EQEmu::MemoryMappedFile **mmf);
int32 SPDAT_RECORDS = -1;
#ifdef _WINDOWS
#include <process.h>
#else
#include <pthread.h>
#include "../common/unix.h"
#endif
void Shutdown();
extern void MapOpcodes();
+9 -9
View File
@@ -19,7 +19,6 @@
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
#include <math.h>
#include "../common/moremath.h"
#include <stdio.h>
@@ -42,6 +41,7 @@ using namespace std;
#include "../common/bodytypes.h"
#include "spawngroup.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "StringIDs.h"
@@ -110,10 +110,10 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
classattack_timer(1000),
knightattack_timer(1000),
assist_timer(AIassistcheck_delay),
qglobal_purge_timer(30000),
sendhpupdate_timer(1000),
enraged_timer(1000),
taunt_timer(TauntReuseTime * 1000),
qglobal_purge_timer(30000)
taunt_timer(TauntReuseTime * 1000)
{
//What is the point of this, since the names get mangled..
Mob* mob = entity_list.GetMob(name);
@@ -383,7 +383,7 @@ NPC::~NPC()
}
{
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list.begin();
end = faction_list.end();
for(; cur != end; cur++) {
@@ -463,7 +463,7 @@ void NPC::CheckMinMaxLevel(Mob *them)
uint16 themlevel = them->GetLevel();
uint8 material;
list<ServerLootItem_Struct*>::iterator cur = itemlist.begin();
std::list<ServerLootItem_Struct*>::iterator cur = itemlist.begin();
while(cur != itemlist.end())
{
if(!(*cur))
@@ -2395,7 +2395,7 @@ FACTION_VALUE NPC::GetReverseFactionCon(Mob* iOther) {
//Look through our faction list and return a faction con based
//on the npc_value for the other person's primary faction in our list.
FACTION_VALUE NPC::CheckNPCFactionAlly(int32 other_faction) {
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list.begin();
end = faction_list.end();
for(; cur != end; cur++) {
@@ -2418,7 +2418,7 @@ bool NPC::IsFactionListAlly(uint32 other_faction) {
int NPC::GetScore()
{
int lv = min(70, (int)GetLevel());
int lv = std::min(70, (int)GetLevel());
int basedmg = (lv*2)*(1+(lv / 100)) - (lv / 2);
int minx = 0;
int basehp = 0;
@@ -2471,8 +2471,8 @@ int NPC::GetScore()
}
final = minx + hpcontrib + dmgcontrib + spccontrib;
final = max(1, final);
final = min(100, final);
final = std::max(1, final);
final = std::min(100, final);
return(final);
}
+4 -5
View File
@@ -25,7 +25,6 @@ class NPC;
#include <list>
#include <deque>
using namespace std;
#include "spawn2.h"
#include "../common/loottable.h"
@@ -256,7 +255,7 @@ public:
void ResumeWandering();
void PauseWandering(int pausetime);
void MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot);
void GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float m_y, float m_z);
void GetClosestWaypoint(std::list<wplist> &wp_list, int count, float m_x, float m_y, float m_z);
uint32 GetEquipment(uint8 material_slot) const; // returns item id
int32 GetEquipmentMaterial(uint8 material_slot) const;
@@ -467,7 +466,7 @@ protected:
NPCType* NPCTypedata_ours; //special case for npcs with uniquely created data.
friend class EntityList;
list<struct NPCFaction*> faction_list;
std::list<struct NPCFaction*> faction_list;
uint32 copper;
uint32 silver;
uint32 gold;
@@ -516,10 +515,10 @@ protected:
bool npc_aggro;
deque<int> signal_q;
std::deque<int> signal_q;
//waypoint crap:
vector<wplist> Waypoints;
std::vector<wplist> Waypoints;
void _ClearWaypints();
int max_wp;
int save_wp;
+99 -101
View File
@@ -4,14 +4,11 @@
#include <iostream>
#include <ctype.h>
using namespace std;
#include <fstream>
using namespace std;
#include <string>
#include <list>
#include <algorithm>
using namespace std;
#include "../common/debug.h"
#include "entity.h"
#include "masterentity.h"
@@ -24,6 +21,7 @@ using namespace std;
#include "zonedb.h"
#include "../common/spdat.h"
#include "../common/packet_functions.h"
#include "../common/StringUtil.h"
#include "spawn2.h"
#include "zone.h"
#include "event_codes.h"
@@ -45,18 +43,18 @@ int mindex1 = 0;
const char * charIn3 = "`~1234567890-=!@#$%^&*_+qwertyuiop[]asdfghjkl'zxcvbnm,./QWERTYUIOP|ASDFGHJKL:ZXCVBNM<>?\"\\";
// MYRA - restore missing commands for qst type files & add itemlink
string cmds("if 0|break 1|spawn 6|spawn2 7|settimer 2|stoptimer 1|rebind 4|echo 1|summonitem 1|selfcast 1|zone 1|castspell 2|say 1|emote 1|shout 1|shout2 1|depop 1|exp 1|level 1|safemove 1|rain 1|snow 1|givecash 4|pvp 1|doanim 1|addskill 2|flagcheck 1|me 1|write 2|settarget 2|follow 1|sfollow 1|save 1|setallskill 1|faction 2|settime 2|setguild 2|setsky 1|setstat 2|movepc 5|gmmove 3|movegrp 4|signal 1|attack 1|itemlink 1|setglobal 4|delglobal 1|targlobal 6|setskill 2|setlanguage 2|stop 0|resume 0|start 1|moveto 3|pause 1|addldonpoints 2|");
std::string cmds("if 0|break 1|spawn 6|spawn2 7|settimer 2|stoptimer 1|rebind 4|echo 1|summonitem 1|selfcast 1|zone 1|castspell 2|say 1|emote 1|shout 1|shout2 1|depop 1|exp 1|level 1|safemove 1|rain 1|snow 1|givecash 4|pvp 1|doanim 1|addskill 2|flagcheck 1|me 1|write 2|settarget 2|follow 1|sfollow 1|save 1|setallskill 1|faction 2|settime 2|setguild 2|setsky 1|setstat 2|movepc 5|gmmove 3|movegrp 4|signal 1|attack 1|itemlink 1|setglobal 4|delglobal 1|targlobal 6|setskill 2|setlanguage 2|stop 0|resume 0|start 1|moveto 3|pause 1|addldonpoints 2|");
//end Myra
int GetArgs(string command)
int GetArgs(std::string command)
{
string::iterator iterator = cmds.begin();
string buffer;
string cmd;
string argnum;
std::string::iterator iterator = cmds.begin();
std::string buffer;
std::string cmd;
std::string argnum;
while (*iterator) {
if (*iterator == ' ')
{
@@ -84,11 +82,11 @@ int GetArgs(string command)
return -1;
}
int calc(string calc)
int calc(std::string calc)
{
string::iterator iterator = calc.begin();
string buffer;
string integer1;
std::string::iterator iterator = calc.begin();
std::string buffer;
std::string integer1;
char op = 0;
int returnvalue = 0;
@@ -156,19 +154,19 @@ int Parser::numtok(const char *text, char character) {
return returnvalue;
}
string strlwr(string tmp) {
string res;
std::string strlwr(std::string tmp) {
std::string res;
transform(tmp.begin(), tmp.end(), res.begin(), (int(*)(int))tolower);
return(res);
}
int strcmp(const string &com, const string &com2) {
int strcmp(const std::string &com, const std::string &com2) {
return strcmp(com.c_str(),com2.c_str());
}
string gettok(const char *text, char character, int index)
std::string gettok(const char *text, char character, int index)
{
string buffer;
std::string buffer;
int find=0;
for(; *text != '\0'; *text++)
{
@@ -184,20 +182,20 @@ string gettok(const char *text, char character, int index)
return buffer;
}
void Parser::MakeVars(string text, uint32 npcid) {
string buffer;
string temp;
void Parser::MakeVars(std::string text, uint32 npcid) {
std::string buffer;
std::string temp;
int pos = numtok(text.c_str(),' ')+1;
for(int i=0;i<pos;i++)
{
buffer = gettok(text.c_str(),' ',i).c_str();
temp = (string)itoa(i+1); temp += "."; temp += (string)itoa(npcid);
temp = (std::string)itoa(i+1); temp += "."; temp += (std::string)itoa(npcid);
#if Parser_DEBUG>10
printf("Buffer: %s, temp: %s\n",buffer.c_str(),temp.c_str());
#endif
AddVar(temp,buffer);
temp="";
temp=(string)itoa(i+1) + "-." + (string)itoa(npcid);
temp=(std::string)itoa(i+1) + "-." + (std::string)itoa(npcid);
AddVar(temp,strstr(text.c_str(),buffer.c_str()));
buffer="";
}
@@ -273,13 +271,13 @@ void Parser::MakeParms(const char * str, uint32 npcid) {
}
}
int Parser::GetItemCount(string itemid, uint32 npcid)
int Parser::GetItemCount(std::string itemid, uint32 npcid)
{
string temp;
std::string temp;
int a=0;
for (int i=1;i<5;i++)
{
temp = (string)"item" + (string)itoa(i);
temp = (std::string)"item" + (std::string)itoa(i);
if (!GetVar(temp,npcid).compare(itemid))
a++;
temp="";
@@ -381,10 +379,10 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
fac = client->GetFactionLevel(client->GetID(), npcmob->GetID(), client->GetRace(), client->GetClass(), DEITY_AGNOSTIC, npc->GetPrimaryFaction(), npcmob);
}
else if (!client) {
cerr << "WARNING: cast failure on mob->CastToClient()" << endl;
std::cerr << "WARNING: cast failure on mob->CastToClient()" << std::endl;
}
else if (!npc) {
cerr << "WARNING: cast failure on npcmob->CastToNPC()" << endl;
std::cerr << "WARNING: cast failure on npcmob->CastToNPC()" << std::endl;
}
}
if (mob) {
@@ -410,7 +408,7 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
AddVar("zonesn.g",zone->GetShortName());
}
string temp;
std::string temp;
#if Parser_DEBUG>10
printf("Data: %s,Id: %i\n",data,npcid);
#endif
@@ -455,13 +453,13 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
break;
}
case EVENT_WAYPOINT_ARRIVE: {
temp = "wp." + (string)itoa(npcid);
temp = "wp." + (std::string)itoa(npcid);
AddVar(temp,data);
SendCommands("event_waypoint_arrive", qstID, npcmob, mob);
break;
}
case EVENT_WAYPOINT_DEPART: {
temp = "wp." + (string)itoa(npcid);
temp = "wp." + (std::string)itoa(npcid);
AddVar(temp,data);
SendCommands("event_waypoint_depart", qstID, npcmob, mob);
break;
@@ -559,7 +557,7 @@ int32 Parser::GetNPCqstID(uint32 iNPCID) {
void Parser::ClearCache() {
#if Parser_DEBUG >= 2
cout << "Parser::ClearCache" << endl;
std::cout << "Parser::ClearCache" << std::endl;
#endif
//for (uint32 i=0; i<pMaxNPCID+1; i++)
// pNPCqstID[i] = -1;
@@ -667,7 +665,7 @@ void Parser::scanformat(char *string, const char *format, char arg[10][1024])
}
void Parser::ClearEventsByNPCID(uint32 iNPCID) {
list<Events*>::iterator iterator = MainList.begin();
std::list<Events*>::iterator iterator = MainList.begin();
Events* p;
while (iterator != MainList.end())
{
@@ -692,7 +690,7 @@ void Parser::ClearAliasesByNPCID(uint32 iNPCID) {
}*/
}
void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npcid, Mob* other, Mob* mob )
void Parser::ExCommands(std::string o_command, std::string parms, int argnums, uint32 npcid, Mob* other, Mob* mob )
{
char arglist[10][1024];
//Work out the argument list, if there needs to be one
@@ -700,8 +698,8 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
printf("Parms: %s\n", parms.c_str());
#endif
if (argnums > 1) {
string buffer;
string::iterator iterator = parms.begin();
std::string buffer;
std::string::iterator iterator = parms.begin();
int quote=0,alist=0,ignore=0;
while (1) {
if (*iterator == '"') {
@@ -727,11 +725,11 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
}
}
else {
string::iterator iterator = parms.begin();
std::string::iterator iterator = parms.begin();
if (*iterator == '"')
{
int quote=0,ignore=0; //once=0
string tmp;
std::string tmp;
while (iterator != parms.end())
{
if (*iterator == '"')
@@ -1040,14 +1038,14 @@ int Parser::LoadScript(int npcid, const char * zone, Mob* activater)
ClearAliasesByNPCID(npcid);
//string strnpcid = ("default");
string strnpcid = (DEFAULT_QUEST_PREFIX);
std::string strnpcid = (DEFAULT_QUEST_PREFIX);
if (npcid)
strnpcid = itoa(npcid);
string filename;
filename = "./quests/" + (string)zone + "/" + (string)strnpcid + ".qst";
string line,buffer,temp;
ifstream file( filename.c_str() );
std::string filename;
filename = "./quests/" + (std::string)zone + "/" + (std::string)strnpcid + ".qst";
std::string line,buffer,temp;
std::ifstream file( filename.c_str() );
if (!file)
{
if (npcid) {
@@ -1063,8 +1061,8 @@ int Parser::LoadScript(int npcid, const char * zone, Mob* activater)
Events * NewEventList = new Events;
while (file && !file.eof())
{
getline(file,line);
string::iterator iterator = line.begin();
std::getline(file,line);
std::string::iterator iterator = line.begin();
while (*iterator)
{
if (iterator[0] == '/' && iterator[1] == '/') break;
@@ -1122,22 +1120,22 @@ int Parser::LoadScript(int npcid, const char * zone, Mob* activater)
}
void Parser::Replace(string& string1, string repstr, string rep, int all) {
while (string1.find(repstr.c_str()) != string::npos) {
void Parser::Replace(std::string& string1, std::string repstr, std::string rep, int all) {
while (string1.find(repstr.c_str()) != std::string::npos) {
string1.replace(string1.find(repstr.c_str()),repstr.length(),rep.c_str());
if (!all)
break;
}
}
string Parser::GetVar(string varname, uint32 npcid)
std::string Parser::GetVar(std::string varname, uint32 npcid)
{
list<vars*>::iterator iterator = varlist.begin();
std::list<vars*>::iterator iterator = varlist.begin();
vars * p;
string checkfirst;
string checksecond;
checkfirst = varname + (string)"." + (string)itoa(npcid);
checksecond = varname + (string)".g";
std::string checkfirst;
std::string checksecond;
checkfirst = varname + (std::string)"." + (std::string)itoa(npcid);
checksecond = varname + (std::string)".g";
while(iterator != varlist.end())
{
@@ -1154,9 +1152,9 @@ printf("GetVar(%s) = '%s'\n", varname.c_str(), p->value.c_str());
return checkfirst;
}
void Parser::DeleteVar(string name)
void Parser::DeleteVar(std::string name)
{
list<vars*>::iterator iterator = varlist.begin();
std::list<vars*>::iterator iterator = varlist.begin();
vars* p;
while(iterator != varlist.end())
{
@@ -1173,27 +1171,27 @@ void Parser::DeleteVar(string name)
void Parser::DelChatAndItemVars(uint32 npcid)
{
// MyListItem <vars> * Ptr;
string temp;
std::string temp;
int i=0;
for (i=0;i<10;i++)
{
temp = (string)itoa(i) + "." + (string)itoa(npcid);
temp = (std::string)itoa(i) + "." + (std::string)itoa(npcid);
DeleteVar(temp);
temp = (string)itoa(i) + "-." + (string)itoa(npcid);
temp = (std::string)itoa(i) + "-." + (std::string)itoa(npcid);
DeleteVar(temp);
}
for (i=1;i<5;i++)
{
temp = "item"+(string)itoa(i) + "." + (string)itoa(npcid);
temp = "item"+(std::string)itoa(i) + "." + (std::string)itoa(npcid);
DeleteVar(temp);
temp = "item"+(string)itoa(i) + ".stack." + (string)itoa(npcid);
temp = "item"+(std::string)itoa(i) + ".stack." + (std::string)itoa(npcid);
DeleteVar(temp);
}
}
void Parser::AddVar(string varname, string varval)
void Parser::AddVar(std::string varname, std::string varval)
{
list<vars*>::iterator iterator = varlist.begin();
std::list<vars*>::iterator iterator = varlist.begin();
vars* p;
while(iterator != varlist.end())
{
@@ -1212,13 +1210,13 @@ void Parser::AddVar(string varname, string varval)
varlist.push_back(newvar);
}
void Parser::HandleVars(string varname, string varparms, string& origstring, string format, uint32 npcid, Mob* mob)
void Parser::HandleVars(std::string varname, std::string varparms, std::string& origstring, std::string format, uint32 npcid, Mob* mob)
{
string tempvar;
std::string tempvar;
tempvar = GetVar(varname,npcid);
char arglist[10][1024];
string::iterator iterator = varparms.begin();
string buffer;
std::string::iterator iterator = varparms.begin();
std::string buffer;
int quote=0;
int alist=0;
while (*iterator)
@@ -1243,9 +1241,9 @@ void Parser::HandleVars(string varname, string varparms, string& origstring, str
int pos=0;
int one = atoi(arglist[1]);
int two = atoi(arglist[2]);
string buffer2;
string find = arglist[0];
string::iterator iterator = find.begin();
std::string buffer2;
std::string find = arglist[0];
std::string::iterator iterator = find.begin();
while (*iterator)
{
pos++;
@@ -1258,21 +1256,21 @@ void Parser::HandleVars(string varname, string varparms, string& origstring, str
Replace(origstring,format,buffer2.c_str());
}
else if (!strcmp(strlwr((const char*)varname.c_str()),"+")) {
string temp;
temp = (string)" "+format+(string)" ";
std::string temp;
temp = (std::string)" "+format+(std::string)" ";
Replace(origstring, temp, " REPLACETHISSHIT ",1);
}
else if (!strcmp(strlwr((const char*)varname.c_str()),"replace")) {
string temp;
temp = (string)arglist[0];
std::string temp;
temp = (std::string)arglist[0];
Replace(temp, arglist[1], arglist[2],1);
Replace(origstring, format, temp);
}
else if (!strcmp(strlwr(varname.c_str()),"itemcount")) {
string temp;
std::string temp;
int o=0;
o = GetItemCount(varparms,npcid);
temp = (string)itoa(o);
temp = (std::string)itoa(o);
Replace(origstring,format,temp,1);
}
else if (!strcmp(strlwr(varname.c_str()),"calc")) {
@@ -1294,10 +1292,10 @@ void Parser::HandleVars(string varname, string varparms, string& origstring, str
Replace(origstring,format,"false");
}
else if (!strcmp(strlwr((const char*)varname.c_str()),"read")) {
ifstream file(arglist[0]);
std::ifstream file(arglist[0]);
if (file)
{
string line;
std::string line;
int index=0,stop=atoi(arglist[1]);
while (!file.eof())
{
@@ -1344,19 +1342,19 @@ void Parser::HandleVars(string varname, string varparms, string& origstring, str
gClient = 0;
}
void Parser::ParseVars(string& text, uint32 npcid, Mob* mob)
void Parser::ParseVars(std::string& text, uint32 npcid, Mob* mob)
{
if (text.find("$") == string::npos && text.find("%") == string::npos)
if (text.find("$") == std::string::npos && text.find("%") == std::string::npos)
return;
string buffer2;
string fname;
string parms;
while (text.find("%") != string::npos)
std::string buffer2;
std::string fname;
std::string parms;
while (text.find("%") != std::string::npos)
{
string temp;
temp = (string)text.substr(text.find("%")).c_str();
string::iterator iterator = temp.begin();
string buffer;
std::string temp;
temp = (std::string)text.substr(text.find("%")).c_str();
std::string::iterator iterator = temp.begin();
std::string buffer;
while (*iterator)
{
if (!strrchr(notin,*iterator))
@@ -1370,14 +1368,14 @@ void Parser::ParseVars(string& text, uint32 npcid, Mob* mob)
iterator++;
}
}
while (text.find("$") != string::npos)
while (text.find("$") != std::string::npos)
{
string temp;
temp = (string)text.substr(text.rfind("$")).c_str();
string::iterator iterator = temp.begin();
std::string temp;
temp = (std::string)text.substr(text.rfind("$")).c_str();
std::string::iterator iterator = temp.begin();
int paren=0;
int fin=0;
string buffer;
std::string buffer;
while (iterator != temp.end())
{
if (!strrchr(notin,*iterator) || paren)
@@ -1449,7 +1447,7 @@ char * fixstring(char * string)
return tmp2;
}*/
int DoCompare(string compare1, string sign, string compare2)
int DoCompare(std::string compare1, std::string sign, std::string compare2)
{
#if Parser_DEBUG>10
printf("compare1: %s,sign: %s, compare2: %s\n",compare1.c_str(),sign.c_str(),compare2.c_str());
@@ -1489,10 +1487,10 @@ int DoCompare(string compare1, string sign, string compare2)
return 1;
}
int Parser::ParseIf(string text)
int Parser::ParseIf(std::string text)
{
string::iterator iterator = text.begin();
string com1,com2,sign,next,buffer;
std::string::iterator iterator = text.begin();
std::string com1,com2,sign,next,buffer;
while (*iterator)
{
if (!strchr(notin,*iterator))
@@ -1547,13 +1545,13 @@ int Parser::ParseIf(string text)
return 1;
}
int Parser::ParseCommands(string text, int line, int justcheck, uint32 npcid, Mob* other, Mob* mob, std::string filename)
int Parser::ParseCommands(std::string text, int line, int justcheck, uint32 npcid, Mob* other, Mob* mob, std::string filename)
{
string buffer,command,parms,temp,temp2;
std::string buffer,command,parms,temp,temp2;
temp2 = text;
ParseVars(temp2,npcid,mob);
int bracket=0,paren=0,lastif=0,last_finished=0,quote=0,escape=0,ignore=0,argnums=0,argit=1;
string::iterator iterator = temp2.begin();
std::string::iterator iterator = temp2.begin();
while (iterator != temp2.end())
{
if (*iterator == '\\' && !escape) {
@@ -1681,8 +1679,8 @@ int Parser::ParseCommands(string text, int line, int justcheck, uint32 npcid, Mo
}
if (last_finished)
{
if(mob && mob->IsClient())
mob->CastToClient()->Message(10,"Line: %d,File: %s | error C0008: syntax error : missing ';' before '}'", line, filename.c_str() );
if(mob && mob->IsClient())
mob->CastToClient()->Message(10,"Line: %d,File: %s | error C0008: syntax error : missing ';' before '}'", line, filename.c_str() );
return 0;
}
return 1;
+3 -3
View File
@@ -45,8 +45,8 @@ public:
int mindex;
const std::string DEFAULT_QUEST_PREFIX;
typedef list<Events*>::iterator iter_events;
typedef list<EventList*>::iterator iter_eventlist;
typedef std::list<Events*>::iterator iter_events;
typedef std::list<EventList*>::iterator iter_eventlist;
std::list<Events*> MainList;
std::list<vars*> varlist;
std::list<Alias*> AliasList;
@@ -81,7 +81,7 @@ public:
int numtok(const char *text, char character);
int ParseCommands(std::string text, int line, int justcheck, uint32 npcid, Mob* other, Mob* mob, std::string filename=string("none"));
int ParseCommands(std::string text, int line, int justcheck, uint32 npcid, Mob* other, Mob* mob, std::string filename=std::string("none"));
int ParseIf(std::string text);
int pcalc(const char * string);
void ParseVars(std::string& text, uint32 npcid, Mob* mob);
+23 -23
View File
@@ -209,7 +209,7 @@ VERTEX PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ)
}
list<int> PathManager::FindRoute(int startID, int endID)
std::list<int> PathManager::FindRoute(int startID, int endID)
{
_ZP(Pathing_FindRoute_FromNodes);
@@ -217,9 +217,9 @@ list<int> PathManager::FindRoute(int startID, int endID)
memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount);
list<AStarNode> OpenList, ClosedList;
std::list<AStarNode> OpenList, ClosedList;
list<int>Route;
std::list<int>Route;
AStarNode AStarEntry, CurrentNode;
@@ -257,7 +257,7 @@ list<int> PathManager::FindRoute(int startID, int endID)
Route.push_back(endID);
list<AStarNode>::iterator RouteIterator;
std::list<AStarNode>::iterator RouteIterator;
while(CurrentNode.PathNodeID != startID)
{
@@ -306,7 +306,7 @@ list<int> PathManager::FindRoute(int startID, int endID)
bool AlreadyInOpenList = false;
list<AStarNode>::iterator OpenListIterator, InsertionPoint = OpenList.end();
std::list<AStarNode>::iterator OpenListIterator, InsertionPoint = OpenList.end();
for(OpenListIterator = OpenList.begin(); OpenListIterator != OpenList.end(); ++OpenListIterator)
{
@@ -356,14 +356,14 @@ bool SortPathNodesByDistance(PathNodeSortStruct n1, PathNodeSortStruct n2)
return n1.Distance < n2.Distance;
}
list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
std::list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
{
_ZP(Pathing_FindRoute_FromVertices);
_log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z);
list<int> noderoute;
std::list<int> noderoute;
float CandidateNodeRangeXY = RuleR(Pathing, CandidateNodeRangeXY);
@@ -374,7 +374,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
//
int ClosestPathNodeToStart = -1;
list<PathNodeSortStruct> SortedByDistance;
std::list<PathNodeSortStruct> SortedByDistance;
PathNodeSortStruct TempNode;
@@ -393,7 +393,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
SortedByDistance.sort(SortPathNodesByDistance);
for(list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
for(std::list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{
_log(PATHING__DEBUG, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
@@ -431,7 +431,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
SortedByDistance.sort(SortPathNodesByDistance);
for(list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
for(std::list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{
_log(PATHING__DEBUG, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id);
_log(PATHING__DEBUG, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)",
@@ -465,7 +465,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
{
int CulledNodes = 0;
list<int>::iterator First, Second;
std::list<int>::iterator First, Second;
while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull))
{
@@ -496,7 +496,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
{
int CulledNodes = 0;
list<int>::iterator First, Second;
std::list<int>::iterator First, Second;
while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull))
{
@@ -620,7 +620,7 @@ void PathManager::MeshTest()
if(j == i)
continue;
list<int> Route = FindRoute(PathNodes[i].id, PathNodes[j].id);
std::list<int> Route = FindRoute(PathNodes[i].id, PathNodes[j].id);
if(Route.size() == 0)
{
@@ -647,7 +647,7 @@ void PathManager::SimpleMeshTest()
for(uint32 j = 1; j < Head.PathNodeCount; ++j)
{
list<int> Route = FindRoute(PathNodes[0].id, PathNodes[j].id);
std::list<int> Route = FindRoute(PathNodes[0].id, PathNodes[j].id);
if(Route.size() == 0)
{
@@ -1114,7 +1114,7 @@ int PathManager::FindNearestPathNode(VERTEX Position)
int ClosestPathNodeToStart = -1;
list<PathNodeSortStruct> SortedByDistance;
std::list<PathNodeSortStruct> SortedByDistance;
PathNodeSortStruct TempNode;
@@ -1133,7 +1133,7 @@ int PathManager::FindNearestPathNode(VERTEX Position)
SortedByDistance.sort(SortPathNodesByDistance);
for(list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
for(std::list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{
_log(PATHING__DEBUG, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
@@ -1280,7 +1280,7 @@ void Mob::PrintRoute()
printf("Route is : ");
list<int>::iterator Iterator;
std::list<int>::iterator Iterator;
for(Iterator = Route.begin(); Iterator !=Route.end(); ++Iterator)
{
@@ -1324,7 +1324,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho)
//this assumes that the first point in the list is the player's
//current position, I dont know how well it works if its not.
void Client::SendPathPacket(vector<FindPerson_Point> &points) {
void Client::SendPathPacket(std::vector<FindPerson_Point> &points) {
if(points.size() < 2) {
//empty length packet == not found.
EQApplicationPacket outapp(OP_FindPersonReply, 0);
@@ -1336,7 +1336,7 @@ void Client::SendPathPacket(vector<FindPerson_Point> &points) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_FindPersonReply, len);
FindPersonResult_Struct* fpr=(FindPersonResult_Struct*)outapp->pBuffer;
vector<FindPerson_Point>::iterator cur, end;
std::vector<FindPerson_Point>::iterator cur, end;
cur = points.begin();
end = points.end();
unsigned int r;
@@ -1473,10 +1473,10 @@ void PathManager::NodeInfo(Client *c)
return;
}
void PathManager::DumpPath(string filename)
void PathManager::DumpPath(std::string filename)
{
ofstream o_file;
o_file.open(filename.c_str(), ios_base::binary | ios_base::trunc | ios_base::out);
std::ofstream o_file;
o_file.open(filename.c_str(), std::ios_base::binary | std::ios_base::trunc | std::ios_base::out);
o_file.write("EQEMUPATH", 9);
o_file.write((const char*)&Head, sizeof(Head));
o_file.write((const char*)PathNodes, (sizeof(PathNode)*Head.PathNodeCount));
@@ -2114,7 +2114,7 @@ bool PathManager::CheckLosFN(VERTEX a, VERTEX b)
return true;
}
void PathManager::ProcessNodesAndSave(string filename)
void PathManager::ProcessNodesAndSave(std::string filename)
{
if(zone->zonemap)
{
+4 -6
View File
@@ -7,8 +7,6 @@
#include <vector>
#include <algorithm>
using namespace std;
class Client;
#define PATHNODENEIGHBOURS 50
@@ -63,8 +61,8 @@ public:
static PathManager *LoadPathFile(const char *ZoneName);
bool loadPaths(FILE *fp);
void PrintPathing();
list<int> FindRoute(VERTEX Start, VERTEX End);
list<int> FindRoute(int startID, int endID);
std::list<int> FindRoute(VERTEX Start, VERTEX End);
std::list<int> FindRoute(int startID, int endID);
VERTEX GetPathNodeCoordinates(int NodeNumber, bool BestZ = true);
bool CheckLosFN(VERTEX a, VERTEX b);
@@ -93,8 +91,8 @@ public:
void MoveNode(Client *c);
void DisconnectAll(Client *c);
bool NodesConnected(PathNode *a, PathNode *b);
void DumpPath(string filename);
void ProcessNodesAndSave(string filename);
void DumpPath(std::string filename);
void ProcessNodesAndSave(std::string filename);
void ResortConnections();
void QuickConnect(Client *c, bool set = false);
void SortNodes();
-1
View File
@@ -20,7 +20,6 @@
#include <string>
#include <vector>
using namespace std;
#include "../common/emu_opcodes.h"
+5 -7
View File
@@ -28,13 +28,11 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#endif
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
#include "../common/StringUtil.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/packet_dump_file.h"
@@ -300,7 +298,7 @@ void ZoneDatabase::RefreshPetitionsFromDB()
newpet->SetUnavails(atoi(row[11]));
newpet->SetSentTime2(atol(row[13]));
newpet->SetGMText(row[14]);
cout << "Petition " << row[0] << " pettime = " << newpet->GetSentTime() << endl;
std::cout << "Petition " << row[0] << " pettime = " << newpet->GetSentTime() << std::endl;
if (atoi(row[12]) == 1) newpet->SetCheckedOut(true);
else newpet->SetCheckedOut(false);
petition_list.AddPetition(newpet);
+1 -1
View File
@@ -26,7 +26,7 @@
#include "../common/skills.h"
#include "../common/bodytypes.h"
#include "../common/classes.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "pets.h"
#include <math.h>
#include <assert.h>
+15 -16
View File
@@ -58,7 +58,6 @@ And then at then end of embparser.cpp, add:
#include <sstream>
#include <iostream>
#include <list>
using namespace std;
#include "worldserver.h"
#include "net.h"
@@ -68,7 +67,7 @@ using namespace std;
#include "zonedb.h"
#include "../common/spdat.h"
#include "../common/packet_functions.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "spawn2.h"
#include "zone.h"
#include "parser.h"
@@ -101,7 +100,7 @@ QuestManager::~QuestManager() {
}
void QuestManager::Process() {
list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
end = QTimerList.end();
while (cur != end) {
@@ -130,7 +129,7 @@ void QuestManager::Process() {
cur++;
}
list<SignalTimer>::iterator curS, endS, tmpS;
std::list<SignalTimer>::iterator curS, endS, tmpS;
curS = STimerList.begin();
endS = STimerList.end();
@@ -169,7 +168,7 @@ void QuestManager::EndQuest() {
if(depop_npc && owner->IsNPC()) {
//clear out any timers for them...
list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
end = QTimerList.end();
while (cur != end) {
@@ -190,7 +189,7 @@ void QuestManager::EndQuest() {
void QuestManager::ClearAllTimers() {
list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
end = QTimerList.end();
while (cur != end)
@@ -453,7 +452,7 @@ void QuestManager::Zone(const char *zone_name) {
void QuestManager::settimer(const char *timer_name, int seconds) {
list<QuestTimer>::iterator cur = QTimerList.begin(), end;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
end = QTimerList.end();
while (cur != end) {
@@ -472,7 +471,7 @@ void QuestManager::settimer(const char *timer_name, int seconds) {
void QuestManager::settimerMS(const char *timer_name, int milliseconds) {
list<QuestTimer>::iterator cur = QTimerList.begin(), end;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
end = QTimerList.end();
while (cur != end) {
@@ -491,7 +490,7 @@ void QuestManager::settimerMS(const char *timer_name, int milliseconds) {
void QuestManager::stoptimer(const char *timer_name) {
list<QuestTimer>::iterator cur = QTimerList.begin(), end;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
end = QTimerList.end();
while (cur != end)
@@ -507,7 +506,7 @@ void QuestManager::stoptimer(const char *timer_name) {
void QuestManager::stopalltimers() {
list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
end = QTimerList.end();
while (cur != end)
@@ -924,7 +923,7 @@ void QuestManager::givecash(int copper, int silver, int gold, int platinum) {
{
initiator->AddMoneyToPP(copper, silver, gold, platinum, true);
string tmp;
std::string tmp;
if (platinum > 0)
{
tmp = "You receive ";
@@ -1220,7 +1219,7 @@ void QuestManager::setglobal(const char *varname, const char *newvalue, int opti
}
if (options < 0 || options > 7)
{
cerr << "Invalid options for global var " << varname << " using defaults" << endl;
std::cerr << "Invalid options for global var " << varname << " using defaults" << std::endl;
} // default = 0 (only this npcid,player and zone)
else
{
@@ -1245,7 +1244,7 @@ int QuestManager::InsertQuestGlobal(
char errbuf[MYSQL_ERRMSG_SIZE];
// Make duration string either "unix_timestamp(now()) + xxx" or "NULL"
stringstream duration_ss;
std::stringstream duration_ss;
if (duration == INT_MAX)
{
duration_ss << "NULL";
@@ -1264,7 +1263,7 @@ int QuestManager::InsertQuestGlobal(
charid, npcid, zoneid, varname, varvalue, duration_ss.str().c_str()
), errbuf, nullptr, nullptr, &last_id))
{
cerr << "setglobal error inserting " << varname << " : " << errbuf << endl;
std::cerr << "setglobal error inserting " << varname << " : " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1350,7 +1349,7 @@ void QuestManager::delglobal(const char *varname) {
" && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)",
varname,qgNpcid,qgCharid,qgZoneid),errbuf))
{
cerr << "delglobal error deleting " << varname << " : " << errbuf << endl;
std::cerr << "delglobal error deleting " << varname << " : " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1569,7 +1568,7 @@ void QuestManager::showgrid(int grid) {
MYSQL_ROW row;
FindPerson_Point pt;
vector<FindPerson_Point> pts;
std::vector<FindPerson_Point> pts;
pt.x = initiator->GetX();
pt.y = initiator->GetY();
+4 -5
View File
@@ -24,7 +24,6 @@
#include <string>
#include <list>
using namespace std;
class NPC;
class Client;
@@ -274,9 +273,9 @@ protected:
class QuestTimer {
public:
inline QuestTimer(int duration, Mob *_mob, string _name) : mob(_mob), name(_name), Timer_(duration) { Timer_.Start(duration, false); }
inline QuestTimer(int duration, Mob *_mob, std::string _name) : mob(_mob), name(_name), Timer_(duration) { Timer_.Start(duration, false); }
Mob* mob;
string name;
std::string name;
Timer Timer_;
};
class SignalTimer {
@@ -286,8 +285,8 @@ protected:
int signal_id;
Timer Timer_;
};
list<QuestTimer> QTimerList;
list<SignalTimer> STimerList;
std::list<QuestTimer> QTimerList;
std::list<SignalTimer> STimerList;
};
+2 -2
View File
@@ -20,7 +20,7 @@
#include "NpcAI.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "worldserver.h"
extern EntityList entity_list;
extern WorldServer worldserver;
@@ -612,7 +612,7 @@ void Raid::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum
char buf[128];
buf[63] = '\0';
string msg = "You receive";
std::string msg = "You receive";
bool one = false;
if(ppsplit > 0) {
-2
View File
@@ -28,8 +28,6 @@
class Client;
class EQApplicationPacket;
using namespace std;
enum { //raid packet types:
raidAdd = 0,
raidRemove2 = 1, //parameter=0
+16 -15
View File
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/StringUtil.h"
#include <stdlib.h>
#include "spawn2.h"
#include "entity.h"
@@ -599,7 +600,7 @@ void SpawnConditionManager::Process() {
return;
//at least one event should get triggered,
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
for(; cur != end; cur++) {
@@ -614,7 +615,7 @@ void SpawnConditionManager::Process() {
ExecEvent(cevent, true);
//add the period of the event to the trigger time
EQTime::AddMinutes(cevent.period, &cevent.next);
string t;
std::string t;
EQTime::ToString(&cevent.next, t);
_log(SPAWNS__CONDITIONS, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str());
//save the next event time in the DB
@@ -631,7 +632,7 @@ void SpawnConditionManager::Process() {
}
void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(event.condition_id);
if(condi == spawn_conditions.end()) {
_log(SPAWNS__CONDITIONS, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id);
@@ -712,7 +713,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst
safe_delete_array(query);
}
bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, string &zone_name) {
bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std::string &zone_name) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
@@ -742,7 +743,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, stri
event.argument = atoi(row[10]);
zone_name = row[11];
string t;
std::string t;
EQTime::ToString(&event.next, t);
_log(SPAWNS__CONDITIONS, "Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d. Will trigger at %s",
event.enabled?"enabled":"disabled", event.id, event.condition_id, event.period, event.action, event.argument, t.c_str());
@@ -859,7 +860,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
TimeOfDay_Struct tod;
zone->zone_time.getEQTimeOfDay(&tod);
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
bool ran;
@@ -907,7 +908,7 @@ void SpawnConditionManager::FindNearestEvent() {
//set a huge year which should never get reached normally
next_event.year = 0xFFFFFF;
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
int next_id = -1;
@@ -935,7 +936,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
//this is an update coming from another zone, they
//have allready updated the DB, just need to update our
//memory, and check for condition changes
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end()) {
_log(SPAWNS__CONDITIONS, "Condition update received from world for %d, but we do not have that conditon.", condition_id);
@@ -962,7 +963,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
{
//this is a local spawn condition, we need to update the DB,
//our memory, then notify spawn points of the change.
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end()) {
_log(SPAWNS__CONDITIONS, "Local Condition update requested for %d, but we do not have that conditon.", condition_id);
@@ -1011,12 +1012,12 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
}
void SpawnConditionManager::ReloadEvent(uint32 event_id) {
string zone_short_name;
std::string zone_short_name;
_log(SPAWNS__CONDITIONS, "Requested to reload event %d from the database.", event_id);
//first look for the event in our local event list
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
for(; cur != end; cur++) {
@@ -1059,7 +1060,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese
_log(SPAWNS__CONDITIONS, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without ");
//first look for the event in our local event list
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
for(; cur != end; cur++) {
@@ -1102,7 +1103,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese
//is up or not. The message to the zone will just tell it to
//update its in-memory event list
SpawnEvent e;
string zone_short_name;
std::string zone_short_name;
if(!LoadDBEvent(event_id, e, zone_short_name)) {
_log(SPAWNS__CONDITIONS, "Unable to find spawn event %d in the database.", event_id);
//unable to find the event in the database...
@@ -1142,7 +1143,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
if(!strcasecmp(zone_short, zone->GetShortName()) && instance_id == zone->GetInstanceID())
{
//this is a local spawn condition
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end())
{
@@ -1185,7 +1186,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
}
bool SpawnConditionManager::Check(uint16 condition, int16 min_value) {
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition);
if(condi == spawn_conditions.end())
return(false); //unable to find the spawn condition
+4 -5
View File
@@ -22,7 +22,6 @@
#include "npc.h"
#include <string>
using namespace std;
#define SC_AlwaysEnabled 0
@@ -129,7 +128,7 @@ public:
uint32 id;
uint16 condition_id;
string zone_name;
std::string zone_name;
bool enabled;
Action action;
@@ -153,12 +152,12 @@ public:
void ReloadEvent(uint32 event_id);
protected:
map<uint16, SpawnCondition> spawn_conditions;
vector<SpawnEvent> spawn_events;
std::map<uint16, SpawnCondition> spawn_conditions;
std::vector<SpawnEvent> spawn_events;
void ExecEvent(SpawnEvent &e, bool send_update);
void UpdateDBEvent(SpawnEvent &e);
bool LoadDBEvent(uint32 event_id, SpawnEvent &e, string &zone_name);
bool LoadDBEvent(uint32 event_id, SpawnEvent &e, std::string &zone_name);
void UpdateDBCondition(const char* zone_name, uint32 instance_id, uint16 cond_id, int16 value);
void FindNearestEvent();
+12 -12
View File
@@ -21,10 +21,10 @@
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
#include "../common/types.h"
#include "zonedb.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
extern EntityList entity_list;
@@ -60,8 +60,8 @@ uint32 SpawnGroup::GetNPCType() {
if(!entity_list.LimitCheckGroup(id, group_spawn_limit))
return(0);
list<SpawnEntry*>::iterator cur,end;
list<SpawnEntry*> possible;
std::list<SpawnEntry*>::iterator cur,end;
std::list<SpawnEntry*> possible;
cur = list_.begin();
end = list_.end();
for(; cur != end; cur++) {
@@ -101,7 +101,7 @@ void SpawnGroup::AddSpawnEntry( SpawnEntry* newEntry ) {
}
SpawnGroup::~SpawnGroup() {
list<SpawnEntry*>::iterator cur,end;
std::list<SpawnEntry*>::iterator cur,end;
cur = list_.begin();
end = list_.end();
for(; cur != end; cur++) {
@@ -112,7 +112,7 @@ SpawnGroup::~SpawnGroup() {
}
SpawnGroupList::~SpawnGroupList() {
map<uint32, SpawnGroup*>::iterator cur,end;
std::map<uint32, SpawnGroup*>::iterator cur,end;
cur = groups.begin();
end = groups.end();
for(; cur != end; cur++) {
@@ -130,7 +130,7 @@ void SpawnGroupList::AddSpawnGroup(SpawnGroup* newGroup) {
SpawnGroup* SpawnGroupList::GetSpawnGroup(uint32 in_id) {
if(groups.count(in_id) != 1)
return(false);
return nullptr;
return(groups[in_id]);
}
@@ -161,7 +161,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
}
else
{
cerr << "Error2 in PopulateZoneLists query '" << query << "' " << errbuf << endl;
std::cerr << "Error2 in PopulateZoneLists query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -181,13 +181,13 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
if (sg)
sg->AddSpawnEntry(newSpawnEntry);
else
cout << "Error in SpawngroupID: " << row[0] << endl;
std::cout << "Error in SpawngroupID: " << row[0] << std::endl;
}
mysql_free_result(result);
}
else
{
cerr << "Error3 in PopulateZoneLists query '" << query << "' " << errbuf << endl;
std::cerr << "Error3 in PopulateZoneLists query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -216,7 +216,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g
}
else
{
cerr << "Error2 in PopulateZoneLists query '" << query << "' " << errbuf << endl;
std::cerr << "Error2 in PopulateZoneLists query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -232,13 +232,13 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g
if (sg)
sg->AddSpawnEntry(newSpawnEntry);
else
cout << "Error in SpawngroupID: " << row[0] << endl;
std::cout << "Error in SpawngroupID: " << row[0] << std::endl;
}
mysql_free_result(result);
}
else
{
cerr << "Error3 in PopulateZoneLists query '" << query << "' " << errbuf << endl;
std::cerr << "Error3 in PopulateZoneLists query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
+2 -3
View File
@@ -23,7 +23,6 @@
#include <map>
#include <list>
using namespace std;
class SpawnEntry
{
@@ -52,7 +51,7 @@ public:
uint32 despawn_timer;
private:
char name_[120];
list<SpawnEntry*> list_;
std::list<SpawnEntry*> list_;
uint8 group_spawn_limit; //max # of this entry which can be spawned by this group
};
@@ -67,7 +66,7 @@ public:
bool RemoveSpawnGroup(uint32 in_id);
private:
//LinkedList<SpawnGroup*> list_;
map<uint32, SpawnGroup*> groups;
std::map<uint32, SpawnGroup*> groups;
};
#endif
+6 -3
View File
@@ -75,17 +75,20 @@ void Mob::ApplySpecialAttackMod(SkillType skill, int32 &dmg, int32 &mindmg) {
case ROUND_KICK:
case KICK:
item_slot = SLOT_FEET;
break;
break;
case BASH:
item_slot = SLOT_SECONDARY;
break;
break;
case DRAGON_PUNCH:
case EAGLE_STRIKE:
case TIGER_CLAW:
item_slot = SLOT_HANDS;
break;
break;
default:
break;
}
if (item_slot >= 0){
+5 -4
View File
@@ -3759,7 +3759,7 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id)
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;
base1 = iter->second.base1;
@@ -4488,12 +4488,13 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
case SE_TriggerOnCast:
{
if(type == focusTriggerOnCast)
{
if(MakeRandomInt(0, 100) <= focus_spell.base[i])
value = focus_spell.base2[i];
else
value = 0;
}
break;
}
@@ -4642,7 +4643,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
uint8 SizeProcList = 0;
uint8 MAX_SYMPATHETIC = 10;
vector<int> SympatheticProcList;
std::vector<int> SympatheticProcList;
//item focus
if (itembonuses.FocusEffects[type]){
@@ -5106,7 +5107,7 @@ bool Mob::TryDivineSave()
{
SetHP(1);
uint16 EffectsToTry[] =
int16 EffectsToTry[] =
{
aabonuses.DivineSaveChance[1],
itembonuses.DivineSaveChance[1],
+9 -7
View File
@@ -83,13 +83,15 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "../common/bodytypes.h"
#include "../common/classes.h"
#include "../common/rulesys.h"
#include "../common/StringUtil.h"
#include <math.h>
#include <assert.h>
#ifndef WIN32
// #include <pthread.h>
#include <stdlib.h>
#include "../common/unix.h"
#include <stdlib.h>
#include "../common/unix.h"
#endif
#ifdef _GOTFRAGS
#include "../common/packet_dump_file.h"
#endif
@@ -1955,8 +1957,8 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
while(angle_end > 360.0f)
angle_end -= 360.0f;
list<Mob*> targets_in_range;
list<Mob*>::iterator iter;
std::list<Mob*> targets_in_range;
std::list<Mob*>::iterator iter;
entity_list.GetTargetsForConeArea(this, spells[spell_id].aoerange, spells[spell_id].aoerange / 2, targets_in_range);
iter = targets_in_range.begin();
@@ -2719,7 +2721,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
int buffslot, ret, caster_level, emptyslot = -1;
bool will_overwrite = false;
vector<int> overwrite_slots;
std::vector<int> overwrite_slots;
if(level_override > 0)
caster_level = level_override;
@@ -2829,7 +2831,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
// to remove some other buffs already worn if will_overwrite is true
if(will_overwrite)
{
vector<int>::iterator cur, end;
std::vector<int>::iterator cur, end;
cur = overwrite_slots.begin();
end = overwrite_slots.end();
for(; cur != end; cur++) {
+21 -23
View File
@@ -28,6 +28,7 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
#endif
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "masterentity.h"
#include "../common/features.h"
@@ -381,7 +382,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
}
int UpdatedActivityCount = 0;
string UpdateActivityQuery = ActivityQuery;
std::string UpdateActivityQuery = ActivityQuery;
char *buf = 0;
for(int Activity=0; Activity<Tasks[TaskID]->ActivityCount; Activity++) {
@@ -812,8 +813,8 @@ void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) {
// Check if the Task is already enabled for this client
//
vector<int> TasksEnabled;
vector<int>::iterator Iterator;
std::vector<int> TasksEnabled;
std::vector<int>::iterator Iterator;
for(int i=0; i<TaskCount; i++) {
Iterator = EnabledTasks.begin();
@@ -843,7 +844,7 @@ void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) {
if(TasksEnabled.size() == 0 ) return;
string TaskQuery="REPLACE INTO character_enabledtasks (charid, taskid) VALUES ";
std::string TaskQuery="REPLACE INTO character_enabledtasks (charid, taskid) VALUES ";
const char *ERR_MYSQLERROR = "[TASKS]Error in ClientTaskState::EnableTask %s %s";
@@ -876,8 +877,8 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) {
// Check if the Task is enabled for this client
//
vector<int> TasksDisabled;
vector<int>::iterator Iterator;
std::vector<int> TasksDisabled;
std::vector<int>::iterator Iterator;
for(int i=0; i<TaskCount; i++) {
Iterator = EnabledTasks.begin();
@@ -903,7 +904,7 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) {
if(TasksDisabled.size() == 0) return;
string TaskQuery="DELETE FROM character_enabledtasks WHERE ";
std::string TaskQuery="DELETE FROM character_enabledtasks WHERE ";
const char *ERR_MYSQLERROR = "[TASKS]Error in ClientTaskState::DisableTask %s %s";
@@ -939,7 +940,7 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) {
bool ClientTaskState::IsTaskEnabled(int TaskID) {
vector<int>::iterator Iterator;
std::vector<int>::iterator Iterator;
Iterator = EnabledTasks.begin();
@@ -1015,7 +1016,7 @@ int TaskManager::FirstTaskInSet(int TaskSetID) {
if(TaskSets[TaskSetID].size() == 0) return 0;
vector<int>::iterator Iterator = TaskSets[TaskSetID].begin();
std::vector<int>::iterator Iterator = TaskSets[TaskSetID].begin();
while(Iterator != TaskSets[TaskSetID].end()) {
if((*Iterator) > 0)
@@ -1079,7 +1080,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i
if(TaskSets[TaskSetID][0] == 0) {
_log(TASKS__UPDATE, "TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID);
vector<int>::iterator Iterator = TaskSets[TaskSetID].begin();
std::vector<int>::iterator Iterator = TaskSets[TaskSetID].begin();
while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) {
if(AppropriateLevel((*Iterator), PlayerLevel) && !state->IsTaskActive((*Iterator)) &&
@@ -1487,7 +1488,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) {
if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) {
_log(TASKS__UPDATE, "KeepOneRecord enabled");
vector<CompletedTaskInformation>::iterator Iterator = CompletedTasks.begin();
std::vector<CompletedTaskInformation>::iterator Iterator = CompletedTasks.begin();
int ErasedElements = 0;
while(Iterator != CompletedTasks.end()) {
int TaskID = (*Iterator).TaskID;
@@ -1560,7 +1561,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
// the same task again, erase the previous completed entry for this task.
if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) {
_log(TASKS__UPDATE, "KeepOneRecord enabled");
vector<CompletedTaskInformation>::iterator Iterator = CompletedTasks.begin();
std::vector<CompletedTaskInformation>::iterator Iterator = CompletedTasks.begin();
int ErasedElements = 0;
while(Iterator != CompletedTasks.end()) {
int TaskID = (*Iterator).TaskID;
@@ -2025,7 +2026,7 @@ void ClientTaskState::RewardTask(Client *c, TaskInformation *Task) {
if(!Task || !c) return;
const Item_Struct* Item;
vector<int> RewardList;
std::vector<int> RewardList;
switch(Task->RewardMethod) {
@@ -2069,7 +2070,7 @@ void ClientTaskState::RewardTask(Client *c, TaskInformation *Task) {
Silver = Copper / 10;
Copper = Copper - (Silver * 10);
string CashMessage;
std::string CashMessage;
if (Plat>0){
CashMessage = "You receive ";
@@ -2482,10 +2483,8 @@ void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) {
thd1 = (TaskHistoryReplyData1_Struct*)Ptr;
thd1->ActivityType = Task->Activity[i].Type;
Ptr = (char *)thd1 + sizeof(TaskHistoryReplyData1_Struct);
sprintf(Ptr, Task->Activity[i].Text1);
Ptr = Ptr + strlen(Ptr) + 1;
sprintf(Ptr, Task->Activity[i].Text2);
Ptr = Ptr + strlen(Ptr) + 1;
VARSTRUCT_ENCODE_STRING(Ptr, Task->Activity[i].Text1);
VARSTRUCT_ENCODE_STRING(Ptr, Task->Activity[i].Text2);
thd2 = (TaskHistoryReplyData2_Struct*)Ptr;
thd2->GoalCount = Task->Activity[i].GoalCount;
thd2->unknown04 = 0xffffffff;
@@ -2493,8 +2492,7 @@ void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) {
thd2->ZoneID = Task->Activity[i].ZoneID;
thd2->unknown16 = 0x00000000;
Ptr = (char *)thd2 + sizeof(TaskHistoryReplyData2_Struct);
sprintf(Ptr, Task->Activity[i].Text3);
Ptr = Ptr + strlen(Ptr) + 1;
VARSTRUCT_ENCODE_STRING(Ptr, Task->Activity[i].Text3);
}
}
@@ -2908,7 +2906,7 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN
+ sizeof(TaskDescriptionData1_Struct) + strlen(Tasks[TaskID]->Description) + 1
+ sizeof(TaskDescriptionData2_Struct) + 1 + sizeof(TaskDescriptionTrailer_Struct);
string RewardText;
std::string RewardText;
int ItemID = 0;
// If there is an item make the Reward text into a link to the item (only the first item if a list
@@ -3427,9 +3425,9 @@ int TaskGoalListManager::GetFirstEntry(int ListID) {
return TaskGoalLists[ListIndex].GoalItemEntries[0];
}
vector<int> TaskGoalListManager::GetListContents(int ListID) {
std::vector<int> TaskGoalListManager::GetListContents(int ListID) {
vector<int> ListContents;
std::vector<int> ListContents;
int ListIndex = GetListByID(ListID);
+5 -8
View File
@@ -25,9 +25,6 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
#include <vector>
#include <queue>
using namespace std;
#define MAXTASKS 10000
#define MAXTASKSETS 1000
// The Client has a hard cap of 19 active tasks
@@ -68,7 +65,7 @@ public:
int GetListByID(int ListID);
bool IsInList(int ListID, int Entry);
int GetFirstEntry(int ListID);
vector<int> GetListContents(int ListIndex);
std::vector<int> GetListContents(int ListIndex);
private:
@@ -91,7 +88,7 @@ public:
int CheckProximities(float X, float Y, float Z);
private:
vector<TaskProximity> TaskProximities;
std::vector<TaskProximity> TaskProximities;
};
typedef enum { METHODSINGLEID = 0, METHODLIST = 1, METHODQUEST = 2 } TaskMethodType;
@@ -210,8 +207,8 @@ private:
void IncrementDoneCount(Client *c, TaskInformation *Task, int TaskIndex, int ActivityID, int Count=1);
int ActiveTaskCount;
ClientTaskInformation ActiveTasks[MAXACTIVETASKS];
vector<int>EnabledTasks;
vector<CompletedTaskInformation> CompletedTasks;
std::vector<int>EnabledTasks;
std::vector<CompletedTaskInformation> CompletedTasks;
int LastCompletedTaskLoaded;
bool CheckedTouchActivities;
};
@@ -254,7 +251,7 @@ private:
TaskGoalListManager GoalListManager;
TaskProximityManager ProximityManager;
TaskInformation* Tasks[MAXTASKS];
vector<int> TaskSets[MAXTASKSETS];
std::vector<int> TaskSets[MAXTASKSETS];
void SendActiveTaskDescription(Client *c, int TaskID, int SequenceNumber, int StartTime, int Duration, bool BringUpTaskJournal=false);
};
+11 -11
View File
@@ -19,7 +19,7 @@
#include "../common/eq_packet_structs.h"
#include "masterentity.h"
#include "titles.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "worldserver.h"
extern WorldServer worldserver;
@@ -73,9 +73,9 @@ bool TitleManager::LoadTitles()
EQApplicationPacket *TitleManager::MakeTitlesPacket(Client *c)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
vector<TitleEntry> AvailableTitles;
std::vector<TitleEntry> AvailableTitles;
uint32 Length = 4;
@@ -122,7 +122,7 @@ int TitleManager::NumberOfAvailableTitles(Client *c)
{
int Count = 0;
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
@@ -137,9 +137,9 @@ int TitleManager::NumberOfAvailableTitles(Client *c)
return Count;
}
string TitleManager::GetPrefix(int TitleID)
std::string TitleManager::GetPrefix(int TitleID)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
@@ -154,9 +154,9 @@ string TitleManager::GetPrefix(int TitleID)
return "";
}
string TitleManager::GetSuffix(int TitleID)
std::string TitleManager::GetSuffix(int TitleID)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
@@ -171,7 +171,7 @@ string TitleManager::GetSuffix(int TitleID)
return "";
}
bool TitleManager::IsClientEligibleForTitle(Client *c, vector<TitleEntry>::iterator Title)
bool TitleManager::IsClientEligibleForTitle(Client *c, std::vector<TitleEntry>::iterator Title)
{
if((Title->CharID >= 0) && (c->CharacterID() != static_cast<uint32>(Title->CharID)))
return false;
@@ -212,7 +212,7 @@ bool TitleManager::IsClientEligibleForTitle(Client *c, vector<TitleEntry>::itera
bool TitleManager::IsNewAATitleAvailable(int AAPoints, int Class)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
@@ -229,7 +229,7 @@ bool TitleManager::IsNewAATitleAvailable(int AAPoints, int Class)
bool TitleManager::IsNewTradeSkillTitleAvailable(int SkillID, int SkillValue)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
+6 -8
View File
@@ -25,8 +25,6 @@
class Client;
class EQApplicationPacket;
using namespace std;
struct TitleEntry
{
int TitleID;
@@ -40,8 +38,8 @@ struct TitleEntry
int CharID;
int Status;
int ItemID;
string Prefix;
string Suffix;
std::string Prefix;
std::string Suffix;
int TitleSet;
};
@@ -53,17 +51,17 @@ public:
bool LoadTitles();
EQApplicationPacket *MakeTitlesPacket(Client *c);
string GetPrefix(int TitleID);
string GetSuffix(int TitleID);
std::string GetPrefix(int TitleID);
std::string GetSuffix(int TitleID);
int NumberOfAvailableTitles(Client *c);
bool IsClientEligibleForTitle(Client *c, vector<TitleEntry>::iterator Title);
bool IsClientEligibleForTitle(Client *c, std::vector<TitleEntry>::iterator Title);
bool IsNewAATitleAvailable(int AAPoints, int Class);
bool IsNewTradeSkillTitleAvailable(int SkillID, int SkillValue);
void CreateNewPlayerTitle(Client *c, const char *Title);
void CreateNewPlayerSuffix(Client *c, const char *Suffix);
protected:
vector<TitleEntry> Titles;
std::vector<TitleEntry> Titles;
};
extern TitleManager title_manager;
+5 -4
View File
@@ -31,6 +31,7 @@
#include "titles.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
@@ -843,7 +844,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
int16 higher_from_int_wis = (GetINT() > GetWIS()) ? GetINT() : GetWIS();
int16 bonusstat = (higher_from_int_wis > thirdstat) ? higher_from_int_wis : thirdstat;
vector< pair<uint32,uint8> >::iterator itr;
std::vector< std::pair<uint32,uint8> >::iterator itr;
//calculate the base success chance
@@ -1401,7 +1402,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
row = mysql_fetch_row(result);
uint32 item = (uint32)atoi(row[0]);
uint8 num = (uint8) atoi(row[1]);
spec->onsuccess.push_back(pair<uint32,uint8>(item, num));
spec->onsuccess.push_back(std::pair<uint32,uint8>(item, num));
}
mysql_free_result(result);
@@ -1418,7 +1419,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
row = mysql_fetch_row(result);
uint32 item = (uint32)atoi(row[0]);
uint8 num = (uint8) atoi(row[1]);
spec->onfail.push_back(pair<uint32,uint8>(item, num));
spec->onfail.push_back(std::pair<uint32,uint8>(item, num));
}
mysql_free_result(result);
}
@@ -1435,7 +1436,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
row = mysql_fetch_row(result);
uint32 item = (uint32)atoi(row[0]);
uint8 num = (uint8)atoi(row[1]);
spec->salvage.push_back(pair<uint32,uint8>(item, num));
spec->salvage.push_back(std::pair<uint32,uint8>(item, num));
}
mysql_free_result(result);
}
+8 -8
View File
@@ -18,7 +18,7 @@
#include "../common/debug.h"
#include "masterentity.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
#include "worldserver.h"
@@ -859,7 +859,7 @@ void Client::Trader_EndTrader() {
void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) {
string Packet;
std::string Packet;
int16 FreeSlotID=0;
const Item_Struct* item = database.GetItem(ItemID);
@@ -1384,7 +1384,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
char errbuf[MYSQL_ERRMSG_SIZE];
char* Query = 0;
string Search, Values;
std::string Search, Values;
MYSQL_RES *Result;
MYSQL_ROW Row;
char Tmp[100] = {0};
@@ -1402,7 +1402,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
}
}
string SearchrResults;
std::string SearchrResults;
if(MinPrice != 0){
sprintf(Tmp, " and trader.item_cost>=%i", MinPrice);
@@ -2020,7 +2020,7 @@ void Client::SendBuyerResults(char* SearchString, uint32 SearchID) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* Query = 0;
char ItemName[64];
string Search, Values;
std::string Search, Values;
MYSQL_RES *Result;
MYSQL_ROW Row;
@@ -2144,7 +2144,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) {
// This packet produces the SoandSo is browsing your Buy Lines message
bb->Action = Barter_SellerBrowsing;
sprintf(bb->PlayerName, GetName());
sprintf(bb->PlayerName, "%s", GetName());
Buyer->QueuePacket(outapp);
@@ -2153,7 +2153,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* Query = 0;
char ItemName[64];
string Search, Values;
std::string Search, Values;
MYSQL_RES *Result;
MYSQL_ROW Row;
@@ -2710,7 +2710,7 @@ void Client::BuyerItemSearch(const EQApplicationPacket *app) {
pdest = strstr(Name, Criteria);
if (pdest != nullptr) {
sprintf(bisr->Results[Count].ItemName, item->Name);
sprintf(bisr->Results[Count].ItemName, "%s", item->Name);
bisr->Results[Count].ItemID = item->ID;
bisr->Results[Count].Unknown068 = item->Icon;
bisr->Results[Count].Unknown072 = 0x00000000;
+1
View File
@@ -21,6 +21,7 @@
#include "masterentity.h"
#include "../common/spdat.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
/*
+15 -20
View File
@@ -24,24 +24,19 @@
#include <string>
#include <map>
using namespace std;
#ifdef _WINDOWS
#include <windows.h>
#include <winsock.h>
#include <process.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#include <windows.h>
#include <winsock.h>
#include <process.h>
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
#include <stdarg.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "../common/unix.h"
#include <stdarg.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "../common/unix.h"
#endif
/*
@@ -58,12 +53,12 @@ public:
TributeLevel_Struct tiers[MAX_TRIBUTE_TIERS];
uint8 tier_count;
uint32 unknown;
string name;
string description;
std::string name;
std::string description;
bool is_guild; //is a guild tribute item
};
map<uint32, TributeData> tribute_list;
std::map<uint32, TributeData> tribute_list;
void Client::ToggleTribute(bool enabled) {
if(enabled) {
@@ -309,7 +304,7 @@ void Client::AddTributePoints(int32 ammount) {
void Client::SendTributes() {
map<uint32, TributeData>::iterator cur,end;
std::map<uint32, TributeData>::iterator cur,end;
cur = tribute_list.begin();
end = tribute_list.end();
@@ -343,7 +338,7 @@ void Client::SendTributes() {
void Client::SendGuildTributes() {
map<uint32, TributeData>::iterator cur,end;
std::map<uint32, TributeData>::iterator cur,end;
cur = tribute_list.begin();
end = tribute_list.end();
+1 -2
View File
@@ -23,7 +23,6 @@
#include "../common/timer.h"
#include <map>
using namespace std;
/*typedef enum {
updateMobPOS = 1,
@@ -55,7 +54,7 @@ public:
bool ack;
};
typedef map<uint32, UMType > UMMap;
typedef std::map<uint32, UMType > UMMap;
class UpdateManager {
protected:
+2 -1
View File
@@ -23,7 +23,8 @@
#include <float.h>
#include "watermap.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#ifdef _WINDOWS
#define snprintf _snprintf
#endif
+10 -10
View File
@@ -18,7 +18,6 @@
#include "../common/debug.h"
#ifdef _EQDEBUG
#include <iostream>
using namespace std;
#endif
//#include <iomanip>
#include <stdlib.h>
@@ -32,6 +31,7 @@ using namespace std;
#include "parser.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "../common/features.h"
#include "QuestParserCollection.h"
@@ -71,7 +71,7 @@ void NPC::DisplayWaypointInfo(Client *c) {
GetMaxWp() );
vector<wplist>::iterator cur, end;
std::vector<wplist>::iterator cur, end;
cur = Waypoints.begin();
end = Waypoints.end();
for(; cur != end; cur++) {
@@ -217,7 +217,7 @@ void NPC::UpdateWaypoint(int wp_index)
mlog(AI__WAYPOINTS, "Update to waypoint %d failed. Not found.", wp_index);
return;
}
vector<wplist>::iterator cur;
std::vector<wplist>::iterator cur;
cur = Waypoints.begin();
cur += wp_index;
@@ -268,9 +268,9 @@ void NPC::CalculateNewWaypoint()
}
case 1: //10 closest
{
list<wplist> closest;
std::list<wplist> closest;
GetClosestWaypoint(closest, 10, GetX(), GetY(), GetZ());
list<wplist>::iterator iter = closest.begin();
std::list<wplist>::iterator iter = closest.begin();
if(closest.size() != 0)
{
int idx = MakeRandomInt(0, closest.size() - 1);
@@ -328,10 +328,10 @@ void NPC::CalculateNewWaypoint()
}
case 5: //pick random closest 5 and pick one that's in sight
{
list<wplist> closest;
std::list<wplist> closest;
GetClosestWaypoint(closest, 5, GetX(), GetY(), GetZ());
list<wplist>::iterator iter = closest.begin();
std::list<wplist>::iterator iter = closest.begin();
while(iter != closest.end())
{
if(CheckLosFN((*iter).x, (*iter).y, (*iter).z, GetSize()))
@@ -374,7 +374,7 @@ bool wp_distance_pred(const wp_distance& left, const wp_distance& right)
return left.dist < right.dist;
}
void NPC::GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float m_y, float m_z)
void NPC::GetClosestWaypoint(std::list<wplist> &wp_list, int count, float m_x, float m_y, float m_z)
{
wp_list.clear();
if(Waypoints.size() <= count)
@@ -386,7 +386,7 @@ void NPC::GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float
return;
}
list<wp_distance> distances;
std::list<wp_distance> distances;
for(int i = 0; i < Waypoints.size(); ++i)
{
float cur_x = (Waypoints[i].x - m_x);
@@ -403,7 +403,7 @@ void NPC::GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float
}
distances.sort(wp_distance_pred);
list<wp_distance>::iterator iter = distances.begin();
std::list<wp_distance>::iterator iter = distances.begin();
for(int i = 0; i < count; ++i)
{
wp_list.push_back(Waypoints[(*iter).index]);
+17 -21
View File
@@ -17,7 +17,6 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <string.h>
#include <stdio.h>
#include <iomanip>
@@ -29,9 +28,6 @@ using namespace std;
#include <process.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
@@ -168,7 +164,7 @@ void WorldServer::Process() {
break;
}
case ServerOP_ZAAuthFailed: {
cout << "World server responded 'Not Authorized', disabling reconnect" << endl;
std::cout << "World server responded 'Not Authorized', disabling reconnect" << std::endl;
pTryReconnect = false;
Disconnect();
break;
@@ -454,7 +450,7 @@ void WorldServer::Process() {
}
case ServerOP_ZoneShutdown: {
if (pack->size != sizeof(ServerZoneStateChange_struct)) {
cout << "Wrong size on ServerOP_ZoneShutdown. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneStateChange_struct) << endl;
std::cout << "Wrong size on ServerOP_ZoneShutdown. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneStateChange_struct) << std::endl;
break;
}
// Annouce the change to the world
@@ -465,14 +461,14 @@ void WorldServer::Process() {
SendEmoteMessage(0, 0, 15, "Zone shutdown: %s", zone->GetLongName());
ServerZoneStateChange_struct* zst = (ServerZoneStateChange_struct *) pack->pBuffer;
cout << "Zone shutdown by " << zst->adminname << endl;
std::cout << "Zone shutdown by " << zst->adminname << std::endl;
Zone::Shutdown();
}
break;
}
case ServerOP_ZoneBootup: {
if (pack->size != sizeof(ServerZoneStateChange_struct)) {
cout << "Wrong size on ServerOP_ZoneBootup. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneStateChange_struct) << endl;
std::cout << "Wrong size on ServerOP_ZoneBootup. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneStateChange_struct) << std::endl;
break;
}
ServerZoneStateChange_struct* zst = (ServerZoneStateChange_struct *) pack->pBuffer;
@@ -489,7 +485,7 @@ void WorldServer::Process() {
}
if (zst->adminname[0] != 0)
cout << "Zone bootup by " << zst->adminname << endl;
std::cout << "Zone bootup by " << zst->adminname << std::endl;
if (!(Zone::Bootup(zst->zoneid, zst->instanceid, zst->makestatic))) {
SendChannelMessage(0, 0, 10, 0, 0, "%s:%i Zone::Bootup failed: %s", net.GetZoneAddress(), net.GetZonePort(), database.GetZoneName(zst->zoneid));
@@ -501,7 +497,7 @@ void WorldServer::Process() {
}
case ServerOP_ZoneIncClient: {
if (pack->size != sizeof(ServerZoneIncommingClient_Struct)) {
cout << "Wrong size on ServerOP_ZoneIncClient. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneIncommingClient_Struct) << endl;
std::cout << "Wrong size on ServerOP_ZoneIncClient. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneIncommingClient_Struct) << std::endl;
break;
}
ServerZoneIncommingClient_Struct* szic = (ServerZoneIncommingClient_Struct*) pack->pBuffer;
@@ -595,7 +591,7 @@ void WorldServer::Process() {
}
case ServerOP_GMGoto: {
if (pack->size != sizeof(ServerGMGoto_Struct)) {
cout << "Wrong size on ServerOP_GMGoto. Got: " << pack->size << ", Expected: " << sizeof(ServerGMGoto_Struct) << endl;
std::cout << "Wrong size on ServerOP_GMGoto. Got: " << pack->size << ", Expected: " << sizeof(ServerGMGoto_Struct) << std::endl;
break;
}
if (!ZoneLoaded)
@@ -634,7 +630,7 @@ void WorldServer::Process() {
}
case ServerOP_Uptime: {
if (pack->size != sizeof(ServerUptime_Struct)) {
cout << "Wrong size on ServerOP_Uptime. Got: " << pack->size << ", Expected: " << sizeof(ServerUptime_Struct) << endl;
std::cout << "Wrong size on ServerOP_Uptime. Got: " << pack->size << ", Expected: " << sizeof(ServerUptime_Struct) << std::endl;
break;
}
ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer;
@@ -654,7 +650,7 @@ void WorldServer::Process() {
this->SendEmoteMessage(sus->adminname, 0, 0, "Zone #%i Uptime: %02im %02is", sus->zoneserverid, m, s);
}
case ServerOP_Petition: {
cout << "Got Server Requested Petition List Refresh" << endl;
std::cout << "Got Server Requested Petition List Refresh" << std::endl;
ServerPetitionUpdate_Struct* sus = (ServerPetitionUpdate_Struct*) pack->pBuffer;
// solar: this was typoed to = instead of ==, not that it acts any different now though..
if (sus->status == 0) petition_list.ReadDatabase();
@@ -723,7 +719,7 @@ void WorldServer::Process() {
break;
}
case ServerOP_ZoneReboot: {
cout << "Got Server Requested Zone reboot" << endl;
std::cout << "Got Server Requested Zone reboot" << std::endl;
ServerZoneReboot_Struct* zb = (ServerZoneReboot_Struct*) pack->pBuffer;
// printf("%i\n",zb->zoneid);
struct in_addr in;
@@ -733,12 +729,12 @@ void WorldServer::Process() {
snprintf(buffer,200,". %s %i %s",zb->ip2, zb->port, inet_ntoa(in));
if(zb->zoneid != 0) {
snprintf(buffer,200,"%s %s %i %s",database.GetZoneName(zb->zoneid),zb->ip2, zb->port ,inet_ntoa(in));
cout << "executing: " << buffer;
std::cout << "executing: " << buffer;
ShellExecute(0,"Open",net.GetZoneFileName(), buffer, 0, SW_SHOWDEFAULT);
}
else
{
cout << "executing: " << net.GetZoneFileName() << " " << buffer;
std::cout << "executing: " << net.GetZoneFileName() << " " << buffer;
ShellExecute(0,"Open",net.GetZoneFileName(), buffer, 0, SW_SHOWDEFAULT);
}
#else
@@ -753,7 +749,7 @@ void WorldServer::Process() {
}
case ServerOP_SyncWorldTime: {
if(zone!=0) {
cout << "Received Message SyncWorldTime" << endl;
std::cout << "Received Message SyncWorldTime" << std::endl;
eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer;
zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime);
EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));
@@ -774,7 +770,7 @@ void WorldServer::Process() {
eqTime.minute,
(eqTime.hour >= 13) ? "pm" : "am"
);
cout << "Time Broadcast Packet: " << timeMessage << endl;
std::cout << "Time Broadcast Packet: " << timeMessage << std::endl;
zone->GotCurTime(true);
//}
//Test
@@ -783,7 +779,7 @@ void WorldServer::Process() {
}
case ServerOP_ChangeWID: {
if (pack->size != sizeof(ServerChangeWID_Struct)) {
cout << "Wrong size on ServerChangeWID_Struct. Got: " << pack->size << ", Expected: " << sizeof(ServerChangeWID_Struct) << endl;
std::cout << "Wrong size on ServerChangeWID_Struct. Got: " << pack->size << ", Expected: " << sizeof(ServerChangeWID_Struct) << std::endl;
break;
}
ServerChangeWID_Struct* scw = (ServerChangeWID_Struct*) pack->pBuffer;
@@ -1819,8 +1815,8 @@ void WorldServer::Process() {
break;
}
default: {
cout << " Unknown ZSopcode:" << (int)pack->opcode;
cout << " size:" << pack->size << endl;
std::cout << " Unknown ZSopcode:" << (int)pack->opcode;
std::cout << " size:" << pack->size << std::endl;
break;
}
}
+27 -28
View File
@@ -17,7 +17,6 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -46,7 +45,7 @@ using namespace std;
#include "../common/packet_dump_file.h"
#include "../common/EQStreamFactory.h"
#include "../common/EQStream.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "ZoneConfig.h"
#include "../common/breakdowns.h"
#include "map.h"
@@ -92,7 +91,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
if (iZoneID == 0 || zonename == 0)
return false;
if (zone != 0 || ZoneLoaded) {
cerr << "Error: Zone::Bootup call when zone already booted!" << endl;
std::cerr << "Error: Zone::Bootup call when zone already booted!" << std::endl;
worldserver.SetZone(0);
return false;
}
@@ -105,7 +104,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
//init the zone, loads all the data, etc
if (!zone->Init(iStaticZone)) {
safe_delete(zone);
cerr << "Zone->Init failed" << endl;
std::cerr << "Zone->Init failed" << std::endl;
worldserver.SetZone(0);
return false;
}
@@ -1154,7 +1153,7 @@ bool Zone::Init(bool iStaticZone) {
if(RuleManager::Instance()->GetActiveRulesetID() != default_ruleset)
{
string r_name = RuleManager::Instance()->GetRulesetName(&database, default_ruleset);
std::string r_name = RuleManager::Instance()->GetRulesetName(&database, default_ruleset);
if(r_name.size() > 0)
{
RuleManager::Instance()->LoadRules(&database, r_name.c_str());
@@ -1719,7 +1718,7 @@ bool ZoneDatabase::LoadStaticZonePoints(LinkedList<ZonePoint*>* zone_point_list,
}
else
{
cerr << "Error1 in LoadStaticZonePoints query '" << query << "' " << errbuf << endl;
std::cerr << "Error1 in LoadStaticZonePoints query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -1731,7 +1730,7 @@ bool ZoneDatabase::DumpZoneState() {
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "DELETE FROM zone_state_dump WHERE zonename='%s'", zone->GetShortName()), errbuf)) {
cerr << "Error in DumpZoneState query '" << query << "' " << errbuf << endl;
std::cerr << "Error in DumpZoneState query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -1745,7 +1744,7 @@ bool ZoneDatabase::DumpZoneState() {
uint32 gmspawntype_count = 0;
entity_list.CountNPC(&npc_count, &npcloot_count, &gmspawntype_count);
cout << "DEBUG: spawn2count=" << spawn2_count << ", npc_count=" << npc_count << ", npcloot_count=" << npcloot_count << ", gmspawntype_count=" << gmspawntype_count << endl;
std::cout << "DEBUG: spawn2count=" << spawn2_count << ", npc_count=" << npc_count << ", npcloot_count=" << npcloot_count << ", gmspawntype_count=" << gmspawntype_count << std::endl;
ZSDump_Spawn2* spawn2_dump = 0;
ZSDump_NPC* npc_dump = 0;
@@ -1812,13 +1811,13 @@ bool ZoneDatabase::DumpZoneState() {
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
// if (DoEscapeString(query, (unsigned int) (end - query))) {
safe_delete_array(query);
cerr << "Error in ZoneDump query " << errbuf << endl;
std::cerr << "Error in ZoneDump query " << errbuf << std::endl;
return false;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Zone dump failed. (affected rows = 0)" << endl;
std::cerr << "Zone dump failed. (affected rows = 0)" << std::endl;
return false;
}
return true;
@@ -1848,13 +1847,13 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
safe_delete_array(query);
if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result);
cout << "Elapsed time: " << row[8] << endl;
std::cout << "Elapsed time: " << row[8] << std::endl;
elapsedtime = atoi(row[8]) * 1000;
lengths = mysql_fetch_lengths(result);
spawn2_count = atoi(row[0]);
cout << "Spawn2count: " << spawn2_count << endl;
std::cout << "Spawn2count: " << spawn2_count << std::endl;
if (lengths[4] != (sizeof(ZSDump_Spawn2) * spawn2_count)) {
cerr << "Error in LoadZoneState: spawn2_dump length mismatch l=" << lengths[4] << ", e=" << (sizeof(ZSDump_Spawn2) * spawn2_count) << endl;
std::cerr << "Error in LoadZoneState: spawn2_dump length mismatch l=" << lengths[4] << ", e=" << (sizeof(ZSDump_Spawn2) * spawn2_count) << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1870,7 +1869,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
else
spawn2_loaded[i] = LoadSpawn2(spawn2_list, spawn2_dump[i].spawn2_id, spawn2_dump[i].time_left - elapsedtime);
if (spawn2_loaded[i] == 0) {
cerr << "Error in LoadZoneState: spawn2_loaded[" << i << "] == 0" << endl;
std::cerr << "Error in LoadZoneState: spawn2_loaded[" << i << "] == 0" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
@@ -1879,9 +1878,9 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
gmspawntype_count = atoi(row[3]);
cout << "gmspawntype_count: " << gmspawntype_count << endl;
std::cout << "gmspawntype_count: " << gmspawntype_count << std::endl;
if (lengths[7] != (sizeof(NPCType) * gmspawntype_count)) {
cerr << "Error in LoadZoneState: gmspawntype_dump length mismatch l=" << lengths[7] << ", e=" << (sizeof(NPCType) * gmspawntype_count) << endl;
std::cerr << "Error in LoadZoneState: gmspawntype_dump length mismatch l=" << lengths[7] << ", e=" << (sizeof(NPCType) * gmspawntype_count) << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1891,9 +1890,9 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
npc_count = atoi(row[1]);
cout << "npc_count: " << npc_count << endl;
std::cout << "npc_count: " << npc_count << std::endl;
if (lengths[5] != (sizeof(ZSDump_NPC) * npc_count)) {
cerr << "Error in LoadZoneState: npc_dump length mismatch l=" << lengths[5] << ", e=" << (sizeof(ZSDump_NPC) * npc_count) << endl;
std::cerr << "Error in LoadZoneState: npc_dump length mismatch l=" << lengths[5] << ", e=" << (sizeof(ZSDump_NPC) * npc_count) << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1906,14 +1905,14 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
memcpy(npc_dump, row[5], lengths[5]);
for (i=0; i < npc_count; i++) {
if (npc_loaded[i] != 0) {
cerr << "Error in LoadZoneState: npc_loaded[" << i << "] != 0" << endl;
std::cerr << "Error in LoadZoneState: npc_loaded[" << i << "] != 0" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
Spawn2* tmp = 0;
if (!npc_dump[i].corpse && npc_dump[i].spawn2_dump_index != 0xFFFFFFFF) {
if (spawn2_loaded == 0 || npc_dump[i].spawn2_dump_index >= spawn2_count) {
cerr << "Error in LoadZoneState: (spawn2_loaded == 0 || index >= count) && npc_dump[" << i << "].spawn2_dump_index != 0xFFFFFFFF" << endl;
std::cerr << "Error in LoadZoneState: (spawn2_loaded == 0 || index >= count) && npc_dump[" << i << "].spawn2_dump_index != 0xFFFFFFFF" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1922,7 +1921,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
if (npc_dump[i].npctype_id == 0) {
if (npc_dump[i].gmspawntype_index == 0xFFFFFFFF) {
cerr << "Error in LoadZoneState: gmspawntype index invalid" << endl;
std::cerr << "Error in LoadZoneState: gmspawntype index invalid" << std::endl;
safe_delete(tmp);
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
@@ -1930,7 +1929,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
else {
if (gmspawntype_dump == 0 || npc_dump[i].gmspawntype_index >= gmspawntype_count) {
cerr << "Error in LoadZoneState: (gmspawntype_dump == 0 || index >= count) && npc_dump[" << i << "].npctype_id == 0" << endl;
std::cerr << "Error in LoadZoneState: (gmspawntype_dump == 0 || index >= count) && npc_dump[" << i << "].npctype_id == 0" << std::endl;
safe_delete(tmp);
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
@@ -1944,7 +1943,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
if (crap != 0)
npc_loaded[i] = new NPC(crap, tmp, npc_dump[i].x, npc_dump[i].y, npc_dump[i].z, npc_dump[i].heading, FlyMode3, npc_dump[i].corpse);
else {
cerr << "Error in LoadZoneState: Unknown npctype_id: " << npc_dump[i].npctype_id << endl;
std::cerr << "Error in LoadZoneState: Unknown npctype_id: " << npc_dump[i].npctype_id << std::endl;
safe_delete(tmp);
}
}
@@ -1962,15 +1961,15 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
npcloot_count = atoi(row[2]);
cout << "npcloot_count: " << npcloot_count << endl;
std::cout << "npcloot_count: " << npcloot_count << std::endl;
if (lengths[6] != (sizeof(ZSDump_NPC_Loot) * npcloot_count)) {
cerr << "Error in LoadZoneState: npcloot_dump length mismatch l=" << lengths[6] << ", e=" << (sizeof(ZSDump_NPC_Loot) * npcloot_count) << endl;
std::cerr << "Error in LoadZoneState: npcloot_dump length mismatch l=" << lengths[6] << ", e=" << (sizeof(ZSDump_NPC_Loot) * npcloot_count) << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
else if (npcloot_count > 0) {
if (npc_loaded == 0) {
cerr << "Error in LoadZoneState: npcloot_count > 0 && npc_loaded == 0" << endl;
std::cerr << "Error in LoadZoneState: npcloot_count > 0 && npc_loaded == 0" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1978,7 +1977,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
memcpy(npcloot_dump, row[6], lengths[6]);
for (i=0; i < npcloot_count; i++) {
if (npcloot_dump[i].npc_dump_index >= npc_count) {
cerr << "Error in LoadZoneState: npcloot_dump[" << i << "].npc_dump_index >= npc_count" << endl;
std::cerr << "Error in LoadZoneState: npcloot_dump[" << i << "].npc_dump_index >= npc_count" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1996,7 +1995,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
}
else {
cerr << "Error in LoadZoneState query '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadZoneState query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
+14 -14
View File
@@ -185,19 +185,19 @@ public:
void LoadLDoNTrapEntries();
void LoadAdventureFlavor();
map<uint32,NPCType *> npctable;
map<uint32,NPCType *> merctable;
map<uint32,std::list<MerchantList> > merchanttable;
map<uint32,std::list<TempMerchantList> > tmpmerchanttable;
map<uint32,std::string> adventure_entry_list_flavor;
map<uint32,LDoNTrapTemplate*> ldon_trap_list;
map<uint32,std::list<LDoNTrapTemplate*> > ldon_trap_entry_list;
map<uint32,std::list<MercStanceInfo> > merc_stance_list;
map<uint32, MercTemplate> merc_templates;
map<uint32,std::list<MercSpellEntry> > merc_spells_list;
map<uint32, ZoneEXPModInfo> level_exp_mod;
list<InternalVeteranReward> VeteranRewards;
list<AltCurrencyDefinition_Struct> AlternateCurrencies;
std::map<uint32,NPCType *> npctable;
std::map<uint32,NPCType *> merctable;
std::map<uint32,std::list<MerchantList> > merchanttable;
std::map<uint32,std::list<TempMerchantList> > tmpmerchanttable;
std::map<uint32,std::string> adventure_entry_list_flavor;
std::map<uint32,LDoNTrapTemplate*> ldon_trap_list;
std::map<uint32,std::list<LDoNTrapTemplate*> > ldon_trap_entry_list;
std::map<uint32,std::list<MercStanceInfo> > merc_stance_list;
std::map<uint32, MercTemplate> merc_templates;
std::map<uint32,std::list<MercSpellEntry> > merc_spells_list;
std::map<uint32, ZoneEXPModInfo> level_exp_mod;
std::list<InternalVeteranReward> VeteranRewards;
std::list<AltCurrencyDefinition_Struct> AlternateCurrencies;
char *adv_data;
bool did_adventure_actions;
@@ -265,7 +265,7 @@ public:
void LoadTickItems();
uint32 GetSpawnKillCount(uint32 in_spawnid);
void UpdateHotzone();
unordered_map<int, item_tick_struct> tick_items;
std::unordered_map<int, item_tick_struct> tick_items;
//MODDING HOOKS
void mod_init();
+2 -4
View File
@@ -42,8 +42,6 @@
#include <vector>
#include <algorithm>
using namespace std;
#ifdef COMMON_PROFILE
CommonProfiler _cp;
#endif
@@ -248,7 +246,7 @@ void DumpZoneProfile() {
newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec,
__DZP_timer.getTotalDuration());
vector<_DZP_Data> data;
std::vector<_DZP_Data> data;
int r;
@@ -268,7 +266,7 @@ void DumpZoneProfile() {
sort(data.begin(), data.end());
vector<_DZP_Data>::iterator cur,end;
std::vector<_DZP_Data>::iterator cur,end;
cur = data.begin();
end = data.end();
+37 -39
View File
@@ -1,7 +1,7 @@
#include "zonedb.h"
#include "../common/Item.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/extprofile.h"
#include "../common/guilds.h"
#include "../common/rulesys.h"
@@ -14,8 +14,6 @@
#include <string>
#include <sstream>
using namespace std;
extern Zone* zone;
ZoneDatabase database;
@@ -272,7 +270,7 @@ bool ZoneDatabase::logevents(const char* accountname,uint32 accountid,uint8 stat
DoEscapeString(descriptiontext, description, len);
DoEscapeString(targetarr, target, len2);
if (!RunQuery(query, MakeAnyLenString(&query, "Insert into eventlog (accountname,accountid,status,charname,target,descriptiontype,description,event_nid) values('%s',%i,%i,'%s','%s','%s','%s','%i')", accountname,accountid,status,charname,targetarr,descriptiontype,descriptiontext,event_nid), errbuf)) {
cerr << "Error in logevents" << query << "' " << errbuf << endl;
std::cerr << "Error in logevents" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -320,7 +318,7 @@ void ZoneDatabase::UpdateBug(BugStruct* bug){
"values('%s', '%s', '%s', '%.2f', '%.2f', '%.2f', '%s', %d, '%s', '%s', CURDATE())", zone->GetShortName(), bug->name,
uitext==nullptr?"":uitext, bug->y, bug->x, bug->z, bug->chartype, bug->type, targettext==nullptr?"Unknown Target":targettext,
bugtext==nullptr?"":bugtext), errbuf)) {
cerr << "Error in UpdateBug" << query << "' " << errbuf << endl;
std::cerr << "Error in UpdateBug" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
safe_delete_array(bugtext);
@@ -336,7 +334,7 @@ void ZoneDatabase::UpdateBug(PetitionBug_Struct* bug){
memset(bugtext, 0, 2*len+1);
DoEscapeString(bugtext, bug->text, len);
if (!RunQuery(query, MakeAnyLenString(&query, "Insert into bugs (type,name,bugtext,flag) values('%s','%s','%s',%i)","Petition",bug->name,bugtext,25), errbuf)) {
cerr << "Error in UpdateBug" << query << "' " << errbuf << endl;
std::cerr << "Error in UpdateBug" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
safe_delete_array(bugtext);
@@ -988,7 +986,7 @@ bool ZoneDatabase::NoRentExpired(const char* name){
*/
const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
const NPCType *npc=nullptr;
map<uint32,NPCType *>::iterator itr;
std::map<uint32,NPCType *>::iterator itr;
// If NPC is already in tree, return it.
if((itr = zone->npctable.find(id)) != zone->npctable.end())
@@ -1267,7 +1265,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
// free item we attempted to add.
if (zone->npctable.find(tmpNPCType->npc_id) != zone->npctable.end())
{
cerr << "Error loading duplicate NPC " << tmpNPCType->npc_id << endl;
std::cerr << "Error loading duplicate NPC " << tmpNPCType->npc_id << std::endl;
delete tmpNPCType;
npc = nullptr;
} else {
@@ -1282,7 +1280,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
mysql_free_result(result);
}
} else
cerr << "Error loading NPCs from database. Bad query: " << errbuf << endl;
std::cerr << "Error loading NPCs from database. Bad query: " << errbuf << std::endl;
safe_delete_array(query);
return npc;
@@ -1291,7 +1289,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 clientlevel) {
const NPCType *npc=nullptr;
map<uint32,NPCType *>::iterator itr;
std::map<uint32,NPCType *>::iterator itr;
//need to save based on merc_npc_type & client level
uint32 merc_type_id = id * 100 + clientlevel;
@@ -1592,7 +1590,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
mysql_free_result(result);
}
} else
cerr << "Error loading NPCs from database. Bad query: " << errbuf << endl;
std::cerr << "Error loading NPCs from database. Bad query: " << errbuf << std::endl;
safe_delete_array(query);
return npc;
@@ -1985,7 +1983,7 @@ uint8 ZoneDatabase::GetGridType(uint32 grid, uint32 zoneid ) {
}
mysql_free_result(result);
} else {
cerr << "Error in GetGridType query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetGridType query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return type;
@@ -1998,7 +1996,7 @@ void ZoneDatabase::SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "replace into merchantlist_temp (npcid,slot,itemid,charges) values(%d,%d,%d,%d)", npcid, slot, item, charges), errbuf)) {
cerr << "Error in SaveMerchantTemp query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SaveMerchantTemp query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -2007,7 +2005,7 @@ void ZoneDatabase::DeleteMerchantTemp(uint32 npcid, uint32 slot){
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "delete from merchantlist_temp where npcid=%d and slot=%d", npcid, slot), errbuf)) {
cerr << "Error in DeleteMerchantTemp query '" << query << "' " << errbuf << endl;
std::cerr << "Error in DeleteMerchantTemp query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -2059,7 +2057,7 @@ uint8 ZoneDatabase::GetUseCFGSafeCoords()
else
{
cerr << "Error in GetUseCFGSafeCoords query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetUseCFGSafeCoords query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2088,7 +2086,7 @@ uint32 ZoneDatabase::GetServerFilters(char* name, ServerSideFilters_Struct *ssfs
memcpy(ssfs, row[0], sizeof(ServerSideFilters_Struct));
}
else {
cerr << "Player profile length mismatch in ServerSideFilters" << endl;
std::cerr << "Player profile length mismatch in ServerSideFilters" << std::endl;
mysql_free_result(result);
return 0;
}
@@ -2103,7 +2101,7 @@ uint32 ZoneDatabase::GetServerFilters(char* name, ServerSideFilters_Struct *ssfs
return len;
}
else {
cerr << "Error in ServerSideFilters query '" << query << "' " << errbuf << endl;
std::cerr << "Error in ServerSideFilters query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
@@ -2136,7 +2134,7 @@ bool ZoneDatabase::SetServerFilters(char* name, ServerSideFilters_Struct *ssfs)
uint32 affected_rows = 0;
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
cerr << "Error in SetServerSideFilters query " << errbuf << endl;
std::cerr << "Error in SetServerSideFilters query " << errbuf << std::endl;
return false;
}
@@ -2167,7 +2165,7 @@ uint32 ZoneDatabase::GetZoneTZ(uint32 zoneid, uint32 version) {
mysql_free_result(result);
}
else {
cerr << "Error in GetZoneTZ query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetZoneTZ query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return 0;
@@ -2187,7 +2185,7 @@ bool ZoneDatabase::SetZoneTZ(uint32 zoneid, uint32 version, uint32 tz) {
return false;
}
else {
cerr << "Error in SetZoneTZ query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SetZoneTZ query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2217,7 +2215,7 @@ uint8 ZoneDatabase::GetZoneWeather(uint32 zoneid, uint32 version) {
}
else {
cerr << "Error in GetZoneWeather query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetZoneWeather query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return 0;
@@ -2236,7 +2234,7 @@ bool ZoneDatabase::SetZoneWeather(uint32 zoneid, uint32 version, uint8 w) {
return false;
}
else {
cerr << "Error in SetZoneWeather query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SetZoneWeather query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2262,7 +2260,7 @@ bool ZoneDatabase::GetAccountInfoForLogin(uint32 account_id, int16* admin, char*
}
else
{
cerr << "Error in GetAccountInfoForLogin query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetAccountInfoForLogin query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2384,7 +2382,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid)
mysql_free_result(result);
}
else {
cerr << "Error in GetBlockedSpellsCount query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetBlockedSpellsCount query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
}
@@ -2408,7 +2406,7 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked
int32 r;
for(r = 0; (row = mysql_fetch_row(result)); r++) {
if(r >= blockedSpellsCount) {
cerr << "Error, Blocked Spells Count of " << blockedSpellsCount << " exceeded." << endl;
std::cerr << "Error, Blocked Spells Count of " << blockedSpellsCount << " exceeded." << std::endl;
break;
}
memset(&into[r], 0, sizeof(ZoneSpellsBlocked));
@@ -2428,7 +2426,7 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked
}
else
{
cerr << "Error in LoadBlockedSpells query '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadBlockedSpells query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2453,14 +2451,14 @@ int ZoneDatabase::getZoneShutDownDelay(uint32 zoneID, uint32 version)
return (retVal);
}
else {
cerr << "Error in getZoneShutDownDelay no result '" << query << "' " << errbuf << endl;
std::cerr << "Error in getZoneShutDownDelay no result '" << query << "' " << errbuf << std::endl;
mysql_free_result(result);
safe_delete_array(query);
return (RuleI(Zone, AutoShutdownDelay));
}
}
else {
cerr << "Error in getZoneShutDownDelay query '" << query << "' " << errbuf << endl;
std::cerr << "Error in getZoneShutDownDelay query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return (RuleI(Zone, AutoShutdownDelay));
@@ -2500,7 +2498,7 @@ void ZoneDatabase::UpdateKarma(uint32 acct_id, uint32 amount)
if (RunQuery(query, MakeAnyLenString(&query, "UPDATE account set karma=%i where id=%i", amount, acct_id), errbuf, 0, &affected_rows)){
safe_delete_array(query);}
else {
cerr << "Error in UpdateKarma query '" << query << "' " << errbuf << endl;
std::cerr << "Error in UpdateKarma query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
}
@@ -2552,7 +2550,7 @@ void ZoneDatabase::InsertDoor(uint32 ddoordbid, uint16 ddoorid, const char* ddoo
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "replace into doors (id, doorid,zone,version,name,pos_x,pos_y,pos_z,heading,opentype,guild,lockpick,keyitem,door_param,invert_state,incline,size) values('%i','%i','%s','%i', '%s','%f','%f','%f','%f','%i','%i','%i', '%i','%i','%i','%i','%i')", ddoordbid ,ddoorid ,zone->GetShortName(), zone->GetInstanceVersion(), ddoor_name, dxpos, dypos, dzpos, dheading, dopentype, dguildid, dlockpick, dkeyitem, ddoor_param, dinvert, dincline, dsize), errbuf)) {
cerr << "Error in InsertDoor" << query << "' " << errbuf << endl;
std::cerr << "Error in InsertDoor" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -2820,7 +2818,7 @@ void ZoneDatabase::RemoveTempFactions(Client *c){
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "DELETE FROM faction_values WHERE temp = 1 AND char_id=%u", c->CharacterID()), errbuf)) {
cerr << "Error in RemoveTempFactions query '" << query << "' " << errbuf << endl;
std::cerr << "Error in RemoveTempFactions query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -3015,7 +3013,7 @@ bool ZoneDatabase::LoadFactionValues(uint32 char_id, faction_map & val_list) {
return ret;
}
else {
cerr << "Error in LoadFactionValues query '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadFactionValues query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return false;
@@ -3083,7 +3081,7 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in
if (!RunQuery(query, MakeAnyLenString(&query,
"DELETE FROM faction_values WHERE char_id=%i AND faction_id = %i",
char_id, faction_id), errbuf)) {
cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -3103,7 +3101,7 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in
if (!RunQuery(query, MakeAnyLenString(&query,
"INSERT INTO faction_values (char_id,faction_id,current_value,temp) VALUES (%i,%i,%i,%i)",
char_id, faction_id,value,temp), errbuf, 0, &affected_rows)) {
cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -3169,7 +3167,7 @@ bool ZoneDatabase::LoadFactionData()
mysql_free_result(result);
}
else {
cerr << "Error in LoadFactionData '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadFactionData '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -3179,16 +3177,16 @@ bool ZoneDatabase::LoadFactionData()
}
}
else {
cerr << "Error in LoadFactionData '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadFactionData '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
return true;
}
bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, list<struct NPCFaction*> *faction_list, int32* primary_faction) {
bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFaction*> *faction_list, int32* primary_faction) {
if (nfl_id <= 0) {
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list->begin();
end = faction_list->end();
for(; cur != end; cur++) {
@@ -3207,7 +3205,7 @@ bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, list<struct NPCFaction*> *
if (primary_faction)
*primary_faction = nfl->primaryfaction;
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list->begin();
end = faction_list->end();
for(; cur != end; cur++) {
+6 -6
View File
@@ -44,10 +44,10 @@ struct DBTradeskillRecipe_Struct {
uint16 trivial;
bool nofail;
bool replace_container;
vector< pair<uint32,uint8> > onsuccess;
vector< pair<uint32,uint8> > onfail;
vector< pair<uint32,uint8> > salvage;
string name;
std::vector< std::pair<uint32,uint8> > onsuccess;
std::vector< std::pair<uint32,uint8> > onfail;
std::vector< std::pair<uint32,uint8> > salvage;
std::string name;
uint8 must_learn;
bool has_learnt;
uint32 madecount;
@@ -172,7 +172,7 @@ struct LootTable_Struct;
class ZoneDatabase : public SharedDatabase {
typedef list<ServerLootItem_Struct*> ItemList;
typedef std::list<ServerLootItem_Struct*> ItemList;
public:
ZoneDatabase();
ZoneDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
@@ -272,7 +272,7 @@ public:
bool GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction = 0);
bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //rembrant, needed for factions Dec, 16 2001
bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // rembrant, needed for factions Dec, 16 2001
bool GetFactionIdsForNPC(uint32 nfl_id, list<struct NPCFaction*> *faction_list, int32* primary_faction = 0); // neotokyo: improve faction handling
bool GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFaction*> *faction_list, int32* primary_faction = 0); // neotokyo: improve faction handling
bool SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list); // rembrant, needed for factions Dec, 16 2001
bool LoadFactionData();
bool LoadFactionValues(uint32 char_id, faction_map & val_list);
+3 -4
View File
@@ -1,9 +1,8 @@
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include "entity.h"
#include "masterentity.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/breakdowns.h"
#include <stdlib.h>
@@ -45,7 +44,7 @@ void DispatchFinishedDBAsync(DBAsyncWork* dbaw) {
break;
}
default: {
cout << "Error: DispatchFinishedDBAsync(): Unknown workpt.b4: " << (int) workpt.b4() << ", workpt=" << workpt << endl;
std::cout << "Error: DispatchFinishedDBAsync(): Unknown workpt.b4: " << (int) workpt.b4() << ", workpt=" << workpt << std::endl;
break;
}
}
@@ -112,7 +111,7 @@ bool DBAsyncCB_CharacterBackup(DBAsyncWork* iWork) { // return true means delete
"Insert Delayed into character_backup (charid, account_id, name, profile, level, class, x, y, z, zoneid) "
"select id, account_id, name, profile, level, class, x, y, z, zoneid "
"from character_ where id=%u", iWork->WPT()), errbuf)) {
cout << "Error in DBAsyncCB_CharacterBackup query3 '" << query << "' " << errbuf << endl;
std::cout << "Error in DBAsyncCB_CharacterBackup query3 '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return true;
}
+6 -1
View File
@@ -22,6 +22,7 @@
#include "masterentity.h"
#include "../common/packet_dump.h"
#include "../common/rulesys.h"
#include "../common/StringUtil.h"
#include "StringIDs.h"
#include "QuestParserCollection.h"
@@ -93,6 +94,8 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
return;
}
break;
default:
break;
};
}
else {
@@ -246,6 +249,8 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
LogFile->write(EQEMuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name);
SendZoneCancel(zc);
return;
default:
break;
};
//OK, now we should know where were going...
@@ -787,7 +792,7 @@ void Client::SendZoneFlagInfo(Client *to) const {
return;
}
set<uint32>::const_iterator cur, end;
std::set<uint32>::const_iterator cur, end;
cur = zone_flags.begin();
end = zone_flags.end();
char empty[1] = { '\0' };