- if(strcasecmp( command, "adver" )==0)
- {
- if ((tmp = strtok(NULL, " ")) == NULL) tmp = 0;
- int adver=atoi(tmp);
- if(adver == 1)
- {
- Config.AdvertiseActive = 1;
- DB->QExecute("UPDATE list_config SET advertise_active = 1");
- Config.AdvertiseTime = clock();
- Advertise();
- Log (MSG_CONSOLE, "Advertise system active" );
- }else
- {
- Config.AdvertiseActive = 0;
- DB->QExecute("UPDATE list_config SET advertise_active = 0");
- Log (MSG_CONSOLE, "Advertise system deactivated" );
- }
- return true;
- }
- else
- if(strcasecmp( command, "loadads" )==0)
- {
- LoadAdverds();
- Log (MSG_CONSOLE, "Adverds loaded");
- return true;
- }
- else
console.cpp
MainProcess.cpp
- if(GServer->Config.AdvertiseActive == 1)
- {
- clock_t lastAdverTime = clock() - GServer->Config.AdvertiseTime;
- if(lastAdverTime >= GServer->Config.AdvertiseClock*1000)
- {
- Advertise();
- GServer->Config.AdvertiseTime = clock();
- }
- }
startup.cpp
- Log( MSG_INFO, "Loading database config" );
- MYSQL_ROW row;
- MYSQL_RES *result = DB->QStore("SELECT exp_rate, drop_rate, zuly_rate, blue_chance, stat_chance, slot_chance, \
- refine_chance, rare_refine, kill_on_fail, player_damage, monster_damage, player_acc, monster_acc, \
- pvp_acc, skill_damage, maxlevel, drop_type, savetime, partygap, maxstat, cfmode, autosave, mapdelay, \
- visualdelay, worlddelay, fairymode, fairystay, fairywait, fairytestmode, osrosever, testgrid, jrose, \
- is_pegasus, monmax, massexport,uwnbplayers,uwside,pc_drop_zuly,drop_rev,advertise_active, advertise_time, item_drop_rate FROM list_config");
worldserver.cpp
- bool Advertise()
- {
- Log(MSG_INFO,"Ad started");
- if(GServer->Config.lastAd < GServer->Config.numAds && GServer->Config.numAds > 0 )
- {
- BEGINPACKET( pak, 0x0784 );
- ADDSTRING( pak, "" );
- ADDBYTE( pak, 0 );
- ADDSTRING( pak, GServer->Config.Adverd[GServer->Config.lastAd].c_str() );
- ADDBYTE( pak, 0 );
- GServer->SendToAll(&pak);
- GServer->Config.lastAd += 1;
- }else if(GServer->Config.numAds > 0)
- {
- GServer->Config.lastAd = 0;
- BEGINPACKET( pak, 0x0784 );
- ADDSTRING( pak, "" );
- ADDBYTE( pak, 0 );
- ADDSTRING( pak, GServer->Config.Adverd[GServer->Config.lastAd].c_str() );
- ADDBYTE( pak, 0 );
- GServer->SendToAll(&pak);
- }
- return true;
- }
- bool LoadAdverds()
- {
- #ifndef ADS
- #define ADS
- ifstream in_ads;
- in_ads.open("ads.dat");
- #endif
- int i = 0;
- if(in_ads.fail())
- {
- GServer->Config.AdvertiseActive = 0;
- Log(MSG_ERROR,"Cant open ads.dat! Ads deactivated for this session!");
- return true;
- }
- while(!in_ads.eof())
- {
- getline(in_ads, GServer->Config.Adverd[i], '\n');
- i++;
- }
- GServer->Config.numAds = i;
- Log(MSG_INFO,"%i Ads loaded!",i);
- //in_ads.close();
- return true;
- }
So I am trying to get this working without having to comment out any of the code. So far here is what I have done, my little change log.
- added advertise_time, advertise_active, item_drop_rate FIELDS into list_config TABLE
- created map_exp TABLE
- added id, map_exp, map_id FIELDS to map_exp TABLE
These changes have gotten rid of all the Advertising System errors preventing me from opening the WorldServer but now I have errors preventing it from opening caused by the WorldServer wanting to choose a "random exp map" I am guessing this is because my mapid FIELD in my map_exp TABLE is empty - this is what I am working on now - any help or input is greatly appreciated.