Jump to content

karlos

Members
  • Posts

    12
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

karlos's Achievements

Member

Member (2/3)

0

Reputation

  1. It's ok for me. Over 300-350 players and seven hours online now and go on. Thanks False.Genesis
  2. error in debian g++ -DHAVE_CONFIG_H -I. -I../../../src/game -I../.. -I/usr/include/mysql -I../../src/shared -I../../../src/game -I../../../src/game/../../dep/include -I../../../src/game/../framework -I../../../src/game/../shared -I../../../src/game/../shared/vmap -I../../../src/game/../realmd -DSYSCONFDIR=\\"/home/karlos/mangos_test/etc/\\" -DDO_MYSQL -march=native -pipe -g -ggdb -O0 -DFD_SETSIZE=10240 -m64 -msahf -mfpmath=sse -mmmx -mssse3 -MT BattleGroundDS.o -MD -MP -MF .deps/BattleGroundDS.Tpo -c -o BattleGroundDS.o ../../../src/game/BattleGroundDS.cpp In file included from ../../../src/game/BattleGroundDS.cpp:19: ../../../src/game/BattleGround.h:300: error: 'BattleGroundBracketId' does not name a type ../../../src/game/BattleGround.h:572: error: 'BattleGroundBracketId' does not name a type
  3. well, I finish the patch: diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index b887961..d62cf43 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -6299,6 +6299,71 @@ uint32 ObjectMgr::GeneratePetNumber() return ++m_hiPetNumber; } +// Delete characters not asociated to any account +void ObjectMgr::DeleteOrphanCharacters() +{ + // List of accounts present in the login database + QueryResult *result_acc = loginDatabase.PQuery("SELECT id FROM account"); + if(result_acc) + { + std::ostringstream char_sql; + int count = result_acc->GetRowCount() - 1; + + // Build query to detect characters without account + char_sql << "SELECT guid FROM characters WHERE account NOT IN ("; + + for ( int i = 0; i <= count; i++ ) + { + Field *fields = result_acc->Fetch(); + uint32 accid = fields[0].GetUInt32(); + char_sql << accid; + if (i == count) + { + char_sql << ")"; + } + else + { + char_sql << ","; + result_acc->NextRow(); + } + } + + // free result + delete result_acc; + + // List of characters without account + QueryResult *result_char = CharacterDatabase.PQuery("%s", char_sql.str().c_str() ); + if (result_char) + { + barGoLink bar( result_char->GetRowCount() ); + do + { + bar.step(); + + Field *fields = result_char->Fetch(); + uint32 guidlo = fields[0].GetUInt32(); + uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER); + + // kick if player currently + ObjectAccessor::KickPlayer(guid); + Player::DeleteFromDB(guid, 0, false); // no need to update realm characters + } while (result_char->NextRow()); + + sLog.outString(); + sLog.outString("%d Characters deleted due to expired accounts", result_char->GetRowCount() ); + sLog.outString(); + + // free result + delete result_char; + } + else + { + sLog.outString("There's no orphan characters to be deleted"); + sLog.outString(); + } + } +} + void ObjectMgr::LoadCorpses() { uint32 count = 0; diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 4442f56..0f3e58d 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -549,6 +549,8 @@ class ObjectMgr return NULL; } + void DeleteOrphanCharacters(); + void LoadGuilds(); void LoadArenaTeams(); void LoadGroups(); diff --git a/src/game/World.cpp b/src/game/World.cpp index 7516899..a416178 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -892,6 +892,15 @@ void World::SetInitialWorldSettings() uint32 realm_zone = getConfig(CONFIG_UINT32_REALM_ZONE); loginDatabase.PExecute("UPDATE realmlist SET icon = %u, timezone = %u WHERE id = '%d'", server_type, realm_zone, realmID); + ///- Delete characters not asociated to any account + uint8 orphan = sConfig.GetIntDefault( "AccountExpire.DeleteOrphanCharacters", 0 ); + if (orphan != 0) + { + sLog.outString(); + sLog.outString("Removing characters not asociated to any accounts..."); + sObjectMgr.DeleteOrphanCharacters(); + } + ///- Remove the bones after a restart CharacterDatabase.PExecute("DELETE FROM corpse WHERE corpse_type = '0'"); diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 8cfc258..8a56dbd 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -159,6 +159,11 @@ BindIP = "0.0.0.0" # Default: 1 (permit addon channel) # 0 (do not permit addon channel) # +# AccountExpire.DeleteOrphanCharacters +# Delete characters not asociated to any account at server start +# Default: 0 (false) +# 1 (true) +# ################################################################################################################### UseProcessors = 0 @@ -182,6 +187,7 @@ TargetPosRecalculateRange = 1.5 UpdateUptimeInterval = 10 MaxCoreStuckTime = 0 AddonChannel = 1 +AccountExpire.DeleteOrphanCharacters = 0 ################################################################################################################### # SERVER LOGGING diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 84f9ec0..0915810 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -209,11 +209,6 @@ extern int main(int argc, char **argv) return 1; } - // cleanup query - //set expired bans to inactive - loginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); - loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); - h.Add(&authListenSocket); ///- Catch termination signals @@ -275,8 +270,37 @@ extern int main(int argc, char **argv) if( (++loopCounter) == numLoops ) { loopCounter = 0; - sLog.outDetail("Ping MySQL to keep connection alive"); - delete loginDatabase.Query("SELECT 1 FROM realmlist LIMIT 1"); + //sLog.outDetail("Ping MySQL to keep connection alive"); + //delete loginDatabase.Query("SELECT 1 FROM realmlist LIMIT 1"); + sLog.outDetail("Cleanup accounts..."); + // cleanup query + // clean outdated accounts + uint8 acc_age = sConfig.GetIntDefault( "AccountExpire.DaysOld", 0 ); + if (acc_age != 0) + { + uint8 acc_creation = sConfig.GetIntDefault( "AccountExpire.JoindateDiff", 7 ); + sLog.outDetail("Deleting accounts not used for %d days and created more than %d days ago", acc_age, acc_creation ); + + QueryResult *acc_del =loginDatabase.PQuery( "SELECT count(*) FROM account WHERE gmlevel = 0 AND joindate < DATE_SUB(CURDATE(),INTERVAL %d DAY) AND last_login < DATE_SUB(CURDATE(),INTERVAL '%d' DAY)", acc_creation, acc_age ); + + loginDatabase.PQuery( "DELETE FROM account WHERE gmlevel = 0 AND joindate < DATE_SUB(CURDATE(),INTERVAL %d DAY) AND last_login < DATE_SUB(CURDATE(),INTERVAL '%d' DAY)", acc_creation, acc_age ); + loginDatabase.Execute( "DELETE FROM account_banned WHERE id NOT IN (SELECT id FROM account)" ); + loginDatabase.Execute( "DELETE FROM realmcharacters WHERE acctid NOT IN (SELECT id FROM account)" ); + + Field *fields = acc_del->Fetch(); + uint32 acc_count = fields[0].GetUInt32(); + sLog.outDetail("Deleted %d accounts", acc_count ); + delete acc_del; + } + else + { + sLog.outDetail("Old account cleanup deactivated"); + } + //set expired bans to inactive + loginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); + loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); + sLog.outDetail("Cleanup done..."); + } #ifdef WIN32 if (m_ServiceStatus == 0) stopEvent = true; diff --git a/src/realmd/realmd.conf.dist.in b/src/realmd/realmd.conf.dist.in index 217cb15..95d9959 100644 --- a/src/realmd/realmd.conf.dist.in +++ b/src/realmd/realmd.conf.dist.in @@ -94,6 +94,15 @@ ConfVersion=2007062001 # Default: 0 (Ban IP) # 1 (Ban Account) # +# AccountExpireTime +# Delete accounts no used for a period of time in days +# Default: 0 (no delete) +# +# AccountExpire.JoindateDiff +# Number of days to leave recently created accounts +# in the database before can be deleted +# Default: 7 +# ################################################################################################################### LoginDatabaseInfo = "127.0.0.1;3306;root;mangos;realmd" @@ -114,3 +123,5 @@ RealmsStateUpdateDelay = 20 WrongPass.MaxCount = 0 WrongPass.BanTime = 600 WrongPass.BanType = 0 +AccountExpireTime = 0 +AccountExpire.JoindateDiff = 7 \\ No newline at end of file diff --git a/src/shared/Database/Database.h b/src/shared/Database/Database.h index a6dc98d..8ab96e8 100644 --- a/src/shared/Database/Database.h +++ b/src/shared/Database/Database.h @@ -30,7 +30,7 @@ class SqlQueryHolder; typedef UNORDERED_MAP<ACE_Based::Thread* , SqlTransaction*> TransactionQueues; typedef UNORDERED_MAP<ACE_Based::Thread* , SqlResultQueue*> QueryQueues; -#define MAX_QUERY_LEN 32*1024 +#define MAX_QUERY_LEN 64*1024 class MANGOS_DLL_SPEC Database { but I have a doubt. Is there any problem with this? -#define MAX_QUERY_LEN 32*1024 +#define MAX_QUERY_LEN 64*1024 in a db very populated like mine this limit is too short for the second query. How do this limit affect to the rest of code? it works very well in debian 64 but I don't know in other systems. Tested without players online this patch is for rev 9441.
  4. thank you DasBlub, this is the problem. And then how to pass the result of first query select id from account; into the second query ? select guid from characters where account not in (result of the first query); is there any function in mangos that converts the result into a list with commas as second query needs? or needs a bucle for convert the result to a string that I can pass as parameter please be patient with me, I'm trying to understand how mangos work with MySQL
  5. yes I know, but I'm trying to do in the code to learn
  6. Hi all. I'm trying to make a patch to delete accounts not used for a period of time. I have the accounts part done but have a problem with characters without account associated. Is possible to do this query directly in mangos code? select guid from characters.characters where account not in (select id from realmd.account); of course, characters and realmd are the names I've got in my confs files , but I want take it from mangos.conf and not hardcode then in the core. If this is not possible, I suppose I must pass two querys through loginDatabase.PQuery() and charactersDatabase.PQuery() but I don't Know how to process the first result into the second function. My doubt with realmd main function is about this querys //set expired bans to inactive loginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); Are this executed only at start or they run every ping check? if not , is possible to include in the ping loop? I must say i'm not programmer and i trying to learn c++ through mangos project and reading (a lot of... ) manuals as I did to learn about mysql or linux or git .It's my first approach to the code but I use Mangos for more than 3 years. Thanks in advance, I post patch here when its run correctly
  7. Same here, anyone knows the solution? is DB related?
  8. Debian rev. clean 9330 SD2 1571 UDB 387 MANGOS VERSION MaNGOS/0.16.0 (* * Revision 9330 - 8be5731a5c241f99c61fda1d0c5812de81ab1d8a) for Linux_x64 (little-endian) CRASH ON lun feb 8 20:30:58 CET 2010 Using the running image of child Thread 0x434e0950 (LWP 18137). Program stopped at 0xa06203. It stopped with signal SIGSEGV, Segmentation fault. Type "info stack" or "info registers" for more information. BACKTRACE #0 0x0000000000a06203 in Quest::XPValue (this=0x7f5a459c9420, pPlayer=0x4342080) at ../../../src/game/QuestDef.cpp:235 #1 0x0000000000872891 in PlayerMenu::SendQuestGiverOfferReward ( this=0x36250b0, pQuest=0x7f5a459c9420, npcGUID=17379391219553128718, EnableNext=true) at ../../../src/game/GossipDef.cpp:790 #2 0x0000000000b5cc44 in WorldSession::HandleQuestgiverCompleteQuest ( this=0x2322640, recv_data=@0x7f5a3837e600) at ../../../src/game/QuestHandler.cpp:455 #3 0x0000000000aec2e5 in WorldSession::Update (this=0x2322640) at ../../../src/game/WorldSession.cpp:186 #4 0x0000000000ae0392 in World::UpdateSessions (this=0x7f5a60023760, diff=56) at ../../../src/game/World.cpp:2064 #5 0x0000000000ae05cd in World::Update (this=0x7f5a60023760, diff=56) at ../../../src/game/World.cpp:1617 #6 0x000000000078817b in WorldRunnable::run (this=0x7f5a55946bb0) at ../../../src/mangosd/WorldRunnable.cpp:60 #7 0x0000000000b9165a in ACE_Based::Thread::ThreadTask (param=0x7f5a55946bb0) at ../../../src/shared/Threading.cpp:183 #8 0x00007f5a65f07fc7 in start_thread () from /lib/libpthread.so.0 #9 0x00007f5a654d759d in clone () from /lib/libc.so.6 #10 0x0000000000000000 in ?? () BACKTRACE FULL #0 0x0000000000a06203 in Quest::XPValue (this=0x7f5a459c9420, pPlayer=0x4342080) at ../../../src/game/QuestDef.cpp:235 realXP = 0 baseLevel = 0 playerLevel = 80 xpMultiplier = 1 pXPData = (const QuestXPLevel *) 0x0 rawXP = 0 #1 0x0000000000872891 in PlayerMenu::SendQuestGiverOfferReward ( this=0x36250b0, pQuest=0x7f5a459c9420, npcGUID=17379391219553128718, EnableNext=true) at ../../../src/game/GossipDef.cpp:790 Title = {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x7f5a637b8a78 "Llamamiento a las armas: Ojo de la Tormenta"}} OfferRewardText = {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x7f5a459c97e8 "You bring honor to us all, $n. We must show the enemy that we will fight them wherever we find them."}} loc_idx = 0 data = {<ByteBuffer> = {static DEFAULT_SIZE = 4096, _rpos = 0, _wpos = 186, _storage = {<std::_Vector_base<unsigned char, std::allocator<unsigned char> >> = { _M_impl = {<std::allocator<unsigned char>> = {<__gnu_cxx::new_allocator<unsigned char>> = {<No data fields>}, <No data fields>}, _M_start = 0x558b670 "с滢, _M_finish = 0x558b72a "", _M_end_of_storage = 0x558b7a8 "A"}}, <No data fields>}}, m_opcode = 397} EmoteCount = 1 pItem = (const ItemPrototype *) 0x434dfe60 #2 0x0000000000b5cc44 in WorldSession::HandleQuestgiverCompleteQuest ( this=0x2322640, recv_data=@0x7f5a3837e600) at ../../../src/game/QuestHandler.cpp:455 quest = 11341 guid = 17379391219553128718 pQuest = (const Quest *) 0x7f5a459c9420 #3 0x0000000000aec2e5 in WorldSession::Update (this=0x2322640) at ../../../src/game/WorldSession.cpp:186 opHandle = (OpcodeHandler &) @0xfc82c0: { name = 0xc57578 "CMSG_QUESTGIVER_COMPLETE_QUEST", status = STATUS_LOGGEDIN, handler = 0xb5ca82 <WorldSession::HandleQuestgiverCompleteQuest(WorldPacket&)>} packet = (WorldPacket *) 0x7f5a3837e600 currTime = 1129185248 #4 0x0000000000ae0392 in World::UpdateSessions (this=0x7f5a60023760, diff=56) at ../../../src/game/World.cpp:2064 itr = {<std::tr1::__detail::_Hashtable_iterator_base<std::Pair<const unsigned int, WorldSession*>, false>> = {_M_cur_node = 0x7f5a56bdc080, _M_cur_bucket = 0x7f5a3db48bf0}, <No data fields>} next = {<std::tr1::__detail::_Hashtable_iterator_base<std::Pair<const unsigned int, WorldSession*>, false>> = {_M_cur_node = 0x226ed20, _M_cur_bucket = 0x7f5a3db48c00}, <No data fields>} sess = (WorldSession *) 0xad8dbe #5 0x0000000000ae05cd in World::Update (this=0x7f5a60023760, diff=56) at ../../../src/game/World.cpp:1617 No locals. #6 0x000000000078817b in WorldRunnable::run (this=0x7f5a55946bb0) at ../../../src/mangosd/WorldRunnable.cpp:60 diff = 56 realCurrTime = 2937071243 realPrevTime = 2937071187 prevSleepTime = 49 #7 0x0000000000b9165a in ACE_Based::Thread::ThreadTask (param=0x7f5a55946bb0) at ../../../src/shared/Threading.cpp:183 _task = (class ACE_Based::Runnable *) 0x7f5a55946bb0 #8 0x00007f5a65f07fc7 in start_thread () from /lib/libpthread.so.0 No symbol table info available. #9 0x00007f5a654d759d in clone () from /lib/libc.so.6 No symbol table info available. #10 0x0000000000000000 in ?? () No symbol table info available.
  9. Debian. I have a lot of modifications but i think patches are not related to the crash Creature.cpp line 408-409 Im trying now whitout any patch except SD2
  10. we are working on Pbwow too, but I don't kwon exactly how becuase other admin of my server do the modifycations.
  11. I'm using custom profile fields for do that since two years but could be nice if the users doesn't need to introduce game user and pass in the profile.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use