From: <mg...@us...> - 2007-12-01 14:25:07
|
Revision: 329 http://planeshift.svn.sourceforge.net/planeshift/?rev=329&view=rev Author: mgist Date: 2007-12-01 06:25:11 -0800 (Sat, 01 Dec 2007) Log Message: ----------- - Added basic /marriageinfo GM command. Can be extended further. Modified Paths: -------------- trunk/docs/history.txt trunk/src/server/adminmanager.cpp trunk/src/server/adminmanager.h trunk/src/server/database/mysql/command_access.sql trunk/src/server/psserverchar.cpp trunk/src/server/psserverchar.h Modified: trunk/docs/history.txt =================================================================== --- trunk/docs/history.txt 2007-12-01 11:42:25 UTC (rev 328) +++ trunk/docs/history.txt 2007-12-01 14:25:11 UTC (rev 329) @@ -1,3 +1,6 @@ +*** 2007-12-01 by Michael Gist +- Added basic /marriageinfo GM command. Can be extended further. + *** 2007-12-01 by Andrew Craig - FS#594 - wrong body color (texture) when unwielding torso armor on kran. - Cleaned up some error handling when tutorial not found. Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2007-12-01 11:42:25 UTC (rev 328) +++ trunk/src/server/adminmanager.cpp 2007-12-01 14:25:11 UTC (rev 329) @@ -320,7 +320,8 @@ setting = words[2]; return true; } - else if (command == "/divorce") + else if (command == "/divorce" || + command == "/marriageinfo") { player = words[1]; return true; @@ -1037,8 +1038,12 @@ } else if (data.command == "/divorce") { - Divorce(me, msg, data, client); + Divorce(me, data); } + else if (data.command == "/marriageinfo") + { + ViewMarriage(me, data); + } else if (data.command == "/waypoint") { HandleWaypoint(me, msg, data, client); @@ -1799,7 +1804,7 @@ data.player.GetData(), data.setting.GetData() ); } -void AdminManager::Divorce(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData& data, Client *client) +void AdminManager::Divorce(MsgEntry* me, AdminCmdData& data) { if (!data.player.Length()) { @@ -1842,6 +1847,45 @@ Debug3(LOG_MARRIAGE, me->clientnum, "%s divorced from %s.", data.player.GetData(), spouseName.GetData()); } +void AdminManager::ViewMarriage(MsgEntry* me, AdminCmdData& data) +{ + if (!data.player.Length()) + { + psserver->SendSystemInfo(me->clientnum, "Usage: \"/marriageinfo [character]\""); + return; + } + + Client* player = clients->Find( data.player ); + + // If the player is not online, we can't proceed. + if (!player) + { + psserver->SendSystemInfo(me->clientnum, "The player who's marriage info you wish to check must be online." ); + return; + } + + psCharacter* playerData = player->GetCharacterData(); + + // If the player is not married, there's no info. + if(!playerData->GetIsMarried()) + { + psserver->SendSystemInfo(me->clientnum, "This player is not married."); + return; + } + + csString spouseFullName = playerData->GetSpouseName(); + csString spouseName = spouseFullName.Slice( 0, spouseFullName.FindFirst(' ')); + + if(psserver->GetCharManager()->HasConnected(spouseName)) + { + psserver->SendSystemInfo(me->clientnum, "%s is married to %s, who was last online less than two months ago.", data.player.GetData(), spouseName.GetData()); + } + else + { + psserver->SendSystemInfo(me->clientnum, "%s is married to %s, who was last online more than two months ago.", data.player.GetData(), spouseName.GetData()); + } +} + void AdminManager::Teleport(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData& data, Client *client, gemObject* subject) { if (data.target == "") Modified: trunk/src/server/adminmanager.h =================================================================== --- trunk/src/server/adminmanager.h 2007-12-01 11:42:25 UTC (rev 328) +++ trunk/src/server/adminmanager.h 2007-12-01 14:25:11 UTC (rev 329) @@ -192,9 +192,12 @@ /// Set the label color for char void SetLabelColor(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData& data, Client *client, gemActor * subject); - //Divorce char1 and char2, if char2 hasn't been online in the latest 2 months, or is deleted. - void Divorce( MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData& data, Client *client ); + /// Divorce char1 and char2, if they're married. + void Divorce(MsgEntry* me, AdminCmdData& data); + /// Get the marriage info of a player. + void ViewMarriage(MsgEntry* me, AdminCmdData& data); + /// Add new wp to DB int WaypointCreate(csString& name, csVector3& pos, csString& sectorName, float radius, csString& flags); Modified: trunk/src/server/database/mysql/command_access.sql =================================================================== --- trunk/src/server/database/mysql/command_access.sql 2007-12-01 11:42:25 UTC (rev 328) +++ trunk/src/server/database/mysql/command_access.sql 2007-12-01 14:25:11 UTC (rev 329) @@ -144,6 +144,11 @@ INSERT INTO command_group_assignment VALUES( "/divorce", 25 ); INSERT INTO command_group_assignment VALUES( "/divorce", 24 ); INSERT INTO command_group_assignment VALUES( "/divorce", 23 ); +INSERT INTO command_group_assignment VALUES( "/marriageinfo", 30 ); +INSERT INTO command_group_assignment VALUES( "/marriageinfo", 26 ); +INSERT INTO command_group_assignment VALUES( "/marriageinfo", 25 ); +INSERT INTO command_group_assignment VALUES( "/marriageinfo", 24 ); +INSERT INTO command_group_assignment VALUES( "/marriageinfo", 23 ); # GM2 and above INSERT INTO command_group_assignment VALUES( "/updaterespawn", 30 ); Modified: trunk/src/server/psserverchar.cpp =================================================================== --- trunk/src/server/psserverchar.cpp 2007-12-01 11:42:25 UTC (rev 328) +++ trunk/src/server/psserverchar.cpp 2007-12-01 14:25:11 UTC (rev 329) @@ -605,7 +605,7 @@ } -int psServerCharManager::HasConnected( csString name ) +bool psServerCharManager::HasConnected( csString name ) { int secondsLastLogin; secondsLastLogin = 0; @@ -615,18 +615,18 @@ //There is no character with such a name. if (!result.IsValid() || result.Count() == 0) { - return 1; + return false; } //We check when the char was last online. secondsLastLogin = result[0].GetInt(1); - if ( secondsLastLogin > MAX_DAYS_NO_LOGON )//the result is major than 2 month + if ( secondsLastLogin > MAX_DAYS_NO_LOGON ) // More than 2 months since last login. { - return 2; + return false; } //The char has connected recently. - return 0; + return true; } Modified: trunk/src/server/psserverchar.h =================================================================== --- trunk/src/server/psserverchar.h 2007-12-01 11:42:25 UTC (rev 328) +++ trunk/src/server/psserverchar.h 2007-12-01 14:25:11 UTC (rev 329) @@ -95,7 +95,7 @@ bool IsBanned(const char* name); ///Checked if the character exists still or if it hasn't connected in two months. - int HasConnected( csString name ); + bool HasConnected( csString name ); bool SendContainerContents(Client *client, psItem *item, int containerID = CONTAINER_INVENTORY_BULK); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |