From: <are...@us...> - 2008-06-01 07:59:36
|
Revision: 1640 http://planeshift.svn.sourceforge.net/planeshift/?rev=1640&view=rev Author: aresilek Date: 2008-06-01 00:59:44 -0700 (Sun, 01 Jun 2008) Log Message: ----------- - Added /advisor_list command, lists how many advisors are online, with names if called by a GM Modified Paths: -------------- trunk/data/help.xml trunk/docs/history.txt trunk/src/client/cmdusers.cpp trunk/src/server/advicemanager.cpp trunk/src/server/advicemanager.h trunk/src/server/client.cpp Modified: trunk/data/help.xml =================================================================== --- trunk/data/help.xml 2008-06-01 05:58:57 UTC (rev 1639) +++ trunk/data/help.xml 2008-06-01 07:59:44 UTC (rev 1640) @@ -62,6 +62,9 @@ <topic name="/advisor">/advisor message Ask one of the advisors a question. eg. /advisor How do I attack something?. Anything you type in the Help channel of the Chat Window will be sent as an advice request automatically.</topic> + <topic name="/advisor_list">/advisor_list + +Returns how many advisors are online at the moment.</topic> <topic name="/advisormode">/advisormode on/off Turn advisor mode on or off. if you make yourself an advisor, other players will be able to contact you using the /advisor for help. If run with no parameters, will indicate your current advisor status.</topic> @@ -380,6 +383,9 @@ <topic name="/admin">/admin Resets your admin level. Lists and allows you to use various GM/admin commands.</topic> + <topic name="/advisor_list">/advisor_list + +Lists advisors that are online at the moment.</topic> <topic name="/awardexp">/awardexp target value Awards progression points to a player for the completion of a GM run event. (enter a negative value to take away PP)</topic> Modified: trunk/docs/history.txt =================================================================== --- trunk/docs/history.txt 2008-06-01 05:58:57 UTC (rev 1639) +++ trunk/docs/history.txt 2008-06-01 07:59:44 UTC (rev 1640) @@ -3,6 +3,7 @@ - Fixed FS#1405 and FS#1284, patches by phenom_ - Added /ban_advisor and /unban_advisor for GM2+ - DB VER BUMP to 1188 +- Added /advisor_list command, lists how many advisors are online, with names if called by a GM *** 2008-05-31 by Andrew Dai - Fixed mistake in checking for linkdead clients. Modified: trunk/src/client/cmdusers.cpp =================================================================== --- trunk/src/client/cmdusers.cpp 2008-06-01 05:58:57 UTC (rev 1639) +++ trunk/src/client/cmdusers.cpp 2008-06-01 07:59:44 UTC (rev 1640) @@ -94,6 +94,7 @@ cmdsource->Subscribe("/clear", this); cmdsource->Subscribe("/advisormode", this); cmdsource->Subscribe("/list_advice_requests", this); + cmdsource->Subscribe("/advisor_list", this); cmdsource->Subscribe("/advisor", this); cmdsource->Subscribe("/advice", this); cmdsource->Subscribe("/train", this); @@ -162,6 +163,7 @@ cmdsource->Unsubscribe("/clear", this); cmdsource->Unsubscribe("/advisormode", this); cmdsource->Unsubscribe("/list_advice_requests", this); + cmdsource->Unsubscribe("/advisor_list", this); cmdsource->Unsubscribe("/advisor", this); cmdsource->Unsubscribe("/advice", this); cmdsource->Unsubscribe("/train", this); @@ -538,6 +540,15 @@ msgqueue->SendMessage(advice.msg); return NULL; } + else if (words[0] == "/advisor_list" ) + { + csString pPerson; + csString pText; + + psAdviceMessage advice(0,words[0].GetDataSafe(),pPerson.GetDataSafe(), pText.GetDataSafe()); + msgqueue->SendMessage(advice.msg); + return NULL; + } else if (words[0] == "/advisor" ) { csString pPerson; Modified: trunk/src/server/advicemanager.cpp =================================================================== --- trunk/src/server/advicemanager.cpp 2008-06-01 05:58:57 UTC (rev 1639) +++ trunk/src/server/advicemanager.cpp 2008-06-01 07:59:44 UTC (rev 1640) @@ -403,6 +403,10 @@ { HandleAdviceList( client ); } + else if ( msg.sCommand == "/advisor_list" ) + { + HandleListAdvisors( client ); + } else if ( msg.sCommand == "/advisor" ) { if (!client->IsMute()) @@ -497,6 +501,23 @@ } +void AdviceManager::HandleListAdvisors( Client *advisor ) +{ + psserver->SendSystemInfo(advisor->GetClientNum(),"There are %u advisors online.", advisors.GetSize()); + + // If your not a GM that's all you get to know + if ( advisor->GetSecurityLevel() < GM_TESTER || !advisors.GetSize()) + return; + + psserver->SendSystemInfo(advisor->GetClientNum(),"They are:", advisors.GetSize()); + for (size_t i = 0; i < advisors.GetSize(); i++) + { + Client * client = psserver->GetConnections()->Find(advisors[i].id); + psserver->SendSystemInfo(advisor->GetClientNum(),"%s %s", client->GetName(), advisors[i].GM ? "(GM)" : ""); + + } +} + void AdviceManager::HandleAdviceRequest( Client *advisee, csString message ) { CPrintf(CON_DEBUG,"User asked for advice.\n"); Modified: trunk/src/server/advicemanager.h =================================================================== --- trunk/src/server/advicemanager.h 2008-06-01 05:58:57 UTC (rev 1639) +++ trunk/src/server/advicemanager.h 2008-06-01 07:59:44 UTC (rev 1640) @@ -122,6 +122,7 @@ void HandleAdviceResponse( Client *advisee, csString sAdvisee, csString message ); void HandleAdviceList( Client *advisor ); void HandleAdviseeList( Client *advisor ); + void HandleListAdvisors( Client *advisor ); bool FloodControl(csString& newmessage, Client *client); @@ -178,3 +179,4 @@ #endif + Modified: trunk/src/server/client.cpp =================================================================== --- trunk/src/server/client.cpp 2008-06-01 05:58:57 UTC (rev 1639) +++ trunk/src/server/client.cpp 2008-06-01 07:59:44 UTC (rev 1640) @@ -717,7 +717,10 @@ void Client::SetAdvisorBan(bool ban) { db->Command("UPDATE accounts SET advisor_ban = %d WHERE id = %d", (int) ban, GetAccountID()); - psserver->GetAdviceManager()->RemoveAdvisor(clientnum, clientnum); + + if (isAdvisor) + psserver->GetAdviceManager()->RemoveAdvisor(clientnum, clientnum); + psserver->SendSystemError(clientnum, "You have been %s from advising by a GM.", ban ? "banned" : "unbanned"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |