Spells via shared memory work, removal of blah, general fixes

This commit is contained in:
KimLS
2013-02-19 22:20:30 -08:00
parent acecff23f4
commit f8bae86082
17 changed files with 25 additions and 570 deletions
-1
View File
@@ -91,7 +91,6 @@ SET(zone_headers
AA.h
basic_functions.h
beacon.h
blah.h
bot.h
botStructs.h
client.h
-9
View File
@@ -1,9 +0,0 @@
#endif
#ifndef Client #include "client.h"
#endif
#include "Object.h"
#include "groups.h"
#include "doors.h"
//This file looks important
-1
View File
@@ -20,7 +20,6 @@
using namespace std;
extern bool spells_loaded;
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
-1
View File
@@ -44,7 +44,6 @@ using namespace std;
#endif
extern volatile bool RunLoops;
extern bool spells_loaded;
#include "features.h"
#include "masterentity.h"
+1 -2
View File
@@ -79,7 +79,6 @@ using namespace std;
extern Zone* zone;
extern volatile bool ZoneLoaded;
extern WorldServer worldserver;
extern bool spells_loaded;
extern PetitionList petition_list;
extern EntityList entity_list;
extern DBAsyncFinishedQueue MTdbafq;
@@ -8991,7 +8990,7 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
}
if (spells_loaded)
if(SPDAT_RECORDS > 0)
{
for(uint32 z=0;z<MAX_PP_MEMSPELL;z++)
{
-1
View File
@@ -73,7 +73,6 @@ using namespace std;
extern Zone* zone;
extern volatile bool ZoneLoaded;
extern WorldServer worldserver;
extern bool spells_loaded;
extern PetitionList petition_list;
extern EntityList entity_list;
+5 -6
View File
@@ -65,7 +65,6 @@
// these should be in the headers...
extern WorldServer worldserver;
extern bool spells_loaded;
extern TaskManager *taskmanager;
void CatchSignal(int sig_num);
@@ -1149,7 +1148,7 @@ void command_showpetspell(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == 0)
c->Message(0, "Usage: #ShowPetSpells [spellid | searchstring]");
else if (!spells_loaded)
else if (SPDAT_RECORDS <= 0)
c->Message(0, "Spells not loaded");
else if (Seperator::IsNumber(sep->argplus[1]))
{
@@ -2584,7 +2583,7 @@ void command_findspell(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == 0)
c->Message(0, "Usage: #FindSpell [spellname]");
else if (!spells_loaded)
else if (SPDAT_RECORDS <= 0)
c->Message(0, "Spells not loaded");
else if (Seperator::IsNumber(sep->argplus[1])) {
int spellid = atoi(sep->argplus[1]);
@@ -3657,12 +3656,12 @@ void command_listpetition(Client *c, const Seperator *sep)
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
int blahloopcount=0;
bool header = false;
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT petid, charname, accountname from petitions order by petid"), errbuf, &result)) {
LogFile->write(EQEMuLog::Normal,"Petition list requested by %s", c->GetName());
while ((row = mysql_fetch_row(result))) {
if (blahloopcount==0) {
blahloopcount=1;
if(!header) {
header = true;
c->Message(13," ID : Character Name , Account Name");
}
c->Message(15, " %s: %s , %s ",row[0],row[1],row[2]);
-1
View File
@@ -62,7 +62,6 @@ extern volatile bool ZoneLoaded;
extern WorldServer worldserver;
extern NetConnection net;
extern uint32 numclients;
extern bool spells_loaded;
extern PetitionList petition_list;
extern DBAsync *dbasync;
+2 -3
View File
@@ -27,7 +27,6 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include <limits.h>
extern EntityList entity_list;
extern bool spells_loaded;
extern Zone* zone;
extern WorldServer worldserver;
@@ -1221,7 +1220,7 @@ void Mob::DoAnim(const int animnum, int type, bool ackreq, eqFilterType filter)
}
void Mob::ShowBuffs(Client* client) {
if (!spells_loaded)
if(SPDAT_RECORDS <= 0)
return;
client->Message(0, "Buffs on: %s", this->GetName());
uint32 i;
@@ -1254,7 +1253,7 @@ void Mob::ShowBuffs(Client* client) {
}
void Mob::ShowBuffList(Client* client) {
if (!spells_loaded)
if(SPDAT_RECORDS <= 0)
return;
client->Message(0, "Buffs on: %s", this->GetCleanName());
+7 -5
View File
@@ -43,7 +43,6 @@ using namespace std;
#define strcasecmp _stricmp
#endif
bool spells_loaded = false;
volatile bool RunLoops = true;
extern volatile bool ZoneLoaded;
#ifdef SHAREMEM
@@ -123,7 +122,7 @@ TaskManager *taskmanager = 0;
QuestParserCollection *parse = 0;
const SPDat_Spell_Struct* spells;
void LoadSPDat(EQEmu::MemoryMappedFile **mmf);
void LoadSpells(EQEmu::MemoryMappedFile **mmf);
int32 SPDAT_RECORDS = -1;
#ifdef _WINDOWS
@@ -260,7 +259,7 @@ int main(int argc, char** argv) {
}
_log(ZONE__INIT, "Loading spells");
EQEmu::MemoryMappedFile *mmf = NULL;
LoadSPDat(&mmf);
LoadSpells(&mmf);
_log(ZONE__INIT, "Loading guilds");
guild_mgr.LoadGuilds();
@@ -610,20 +609,23 @@ bool chrcmpI(const char* a, const char* b) {
return true;
}
void LoadSPDat(EQEmu::MemoryMappedFile **mmf) {
void LoadSpells(EQEmu::MemoryMappedFile **mmf) {
int records = database.GetMaxSpellID() + 1;
try {
EQEmu::IPCMutex mutex("spells");
mutex.Lock();
*mmf = new EQEmu::MemoryMappedFile("shared/spells");
if((*mmf)->Size() != records * sizeof(SPDat_Spell_Struct)) {
uint32 size = (*mmf)->Size();
if(size != (records * sizeof(SPDat_Spell_Struct))) {
EQ_EXCEPT("zone", "Unable to load spells: (*mmf)->Size() != records * sizeof(SPDat_Spell_Struct)");
}
spells = reinterpret_cast<SPDat_Spell_Struct*>((*mmf)->Get());
mutex.Unlock();
} catch(std::exception &ex) {
LogFile->write(EQEMuLog::Error, "Error loading spells: %s", ex.what());
return;
}
SPDAT_RECORDS = records;
-3
View File
@@ -38,10 +38,7 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org)
extern Zone* zone;
extern volatile bool ZoneLoaded;
extern bool spells_loaded;
extern WorldServer worldserver;
//uchar blah[]={0x0D,0x00,0x00,0x00,0x01,0x00,0x00,0x00};
//uchar blah2[]={0x12,0x00,0x00,0x00,0x16,0x01,0x00,0x00};
// the spell can still fail here, if the buff can't stack
-4
View File
@@ -99,11 +99,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
extern Zone* zone;
extern volatile bool ZoneLoaded;
extern bool spells_loaded;
extern WorldServer worldserver;
uchar blah[]={0x0D,0x00,0x00,0x00,0x01,0x00,0x00,0x00};
uchar blah2[]={0x12,0x00,0x00,0x00,0x16,0x01,0x00,0x00};
// this is run constantly for every mob
void Mob::SpellProcess()
+7 -7
View File
@@ -118,21 +118,21 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
//int char_num = 0;
//unsigned long* lengths;
if (database.GetVariable("loglevel",tmp, 9)) {
int blah[4];
int log_levels[4];
if (atoi(tmp)>9){ //Server is using the new code
for(int i=0;i<4;i++){
if (((int)tmp[i]>=48) && ((int)tmp[i]<=57))
blah[i]=(int)tmp[i]-48; //get the value to convert it to an int from the ascii value
log_levels[i]=(int)tmp[i]-48; //get the value to convert it to an int from the ascii value
else
blah[i]=0; //set to zero on a bogue char
log_levels[i]=0; //set to zero on a bogue char
}
zone->loglevelvar = blah[0];
zone->loglevelvar = log_levels[0];
LogFile->write(EQEMuLog::Status, "General logging level: %i", zone->loglevelvar);
zone->merchantvar = blah[1];
zone->merchantvar = log_levels[1];
LogFile->write(EQEMuLog::Status, "Merchant logging level: %i", zone->merchantvar);
zone->tradevar = blah[2];
zone->tradevar = log_levels[2];
LogFile->write(EQEMuLog::Status, "Trade logging level: %i", zone->tradevar);
zone->lootvar = blah[3];
zone->lootvar = log_levels[3];
LogFile->write(EQEMuLog::Status, "Loot logging level: %i", zone->lootvar);
}
else {