From: <mg...@us...> - 2008-08-03 15:22:16
|
Revision: 1995 http://planeshift.svn.sourceforge.net/planeshift/?rev=1995&view=rev Author: mgist Date: 2008-08-03 15:22:24 +0000 (Sun, 03 Aug 2008) Log Message: ----------- - Merged r1994 from trunk. Modified Paths: -------------- stable/data/help.xml stable/docs/history.txt stable/src/client/gui/pawsgmgui.cpp stable/src/server/adminmanager.cpp stable/src/server/adminmanager.h Property Changed: ---------------- stable/ Property changes on: stable ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:1911,1915-1916,1918-1919,1923-1927,1930,1934,1936,1939,1941,1945-1949,1951-1953,1958,1960-1961,1964,1966,1968,1970-1972,1974,1978-1979,1981-1982,1986-1988,1990-1991 + /trunk:1911,1915-1916,1918-1919,1923-1927,1930,1934,1936,1939,1941,1945-1949,1951-1953,1958,1960-1961,1964,1966,1968,1970-1972,1974,1978-1979,1981-1982,1986-1988,1990-1991,1994 Modified: stable/data/help.xml =================================================================== --- stable/data/help.xml 2008-08-03 14:34:51 UTC (rev 1994) +++ stable/data/help.xml 2008-08-03 15:22:24 UTC (rev 1995) @@ -402,9 +402,9 @@ <topic name="/changeguildname">/changeguildname Change the selected guilds name.</topic> - <topic name="/changename">/changename [name] [unique] [new name] [new last name | no] + <topic name="/changename">/changename name [force|forceall] new name [new lastname] -Changes the player's name to something else. The unique parameter is either no or nothing, if it is no, the name doesn't have to have a unique first and last name (Used for weddings). If the lastname is no the lastname will be removed</topic> +Changes the player's name. If force is given, the lastname doesn't have to be unique. If forceall is given name and lastname doesn't have to be unique. If the lastname is not given the lastname will be preseved. If no is given as lastname, the lastname will be removed.</topic> <topic name="/charlist">/charlist player Informs the GM of the IDs and names of all characters on the same account as the account of the given character.</topic> Modified: stable/docs/history.txt =================================================================== --- stable/docs/history.txt 2008-08-03 14:34:51 UTC (rev 1994) +++ stable/docs/history.txt 2008-08-03 15:22:24 UTC (rev 1995) @@ -1,4 +1,7 @@ *** 2008-08-02 by Andreas Heinchen +- Fixing FS#2045, GMs can now take monster names. "/changename" syntax changed! + +*** 2008-08-02 by Andreas Heinchen - Patch for FS#2048 from Arerano - Patch for FS#2049 to FS#2055 from Arerano - Patch for FS#1283, FS#1731, FS#2045 from weltall Modified: stable/src/client/gui/pawsgmgui.cpp =================================================================== --- stable/src/client/gui/pawsgmgui.cpp 2008-08-03 14:34:51 UTC (rev 1994) +++ stable/src/client/gui/pawsgmgui.cpp 2008-08-03 15:22:24 UTC (rev 1995) @@ -322,7 +322,7 @@ first = NormalizeCharacterName(first); last = NormalizeCharacterName(last); - cmd.Format("/changename %s no %s %s",GetSelectedName(),first.GetData(),last.GetData()); + cmd.Format("/changename %s force %s %s",GetSelectedName(),first.GetData(),last.GetData()); updateAfter = true; break; @@ -999,6 +999,7 @@ csString firstName,lastName; + // TODO Does this make sense? Split the name to concat it? if (place == -1) { firstName = text; @@ -1010,7 +1011,7 @@ } csString cmd; - cmd.Format("/changename %s no %s %s", GetSelectedName(), firstName.GetData(), lastName.GetData()); + cmd.Format("/changename %s force %s %s", GetSelectedName(), firstName.GetData(), lastName.GetData()); psengine->GetCmdHandler()->Execute(cmd); //Need to update our list QueryServer(); Modified: stable/src/server/adminmanager.cpp =================================================================== --- stable/src/server/adminmanager.cpp 2008-08-03 14:34:51 UTC (rev 1994) +++ stable/src/server/adminmanager.cpp 2008-08-03 15:22:24 UTC (rev 1995) @@ -372,13 +372,25 @@ { player = words[1]; - if (words[2] == "no") + int param = 2; + + uniqueName = true; + uniqueFirstName = true; + + if (words[param] == "force") + { uniqueName = false; - else - uniqueName = true; + param++; + } + else if (words[param] == "forceall") + { + uniqueName = false; + uniqueFirstName = false; + param++; + } - newName = words[3]; - newLastName = words[4]; + newName = words[param++]; + newLastName = words[param++]; return true; } @@ -5126,51 +5138,44 @@ void AdminManager::ChangeName(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData& data,Client *client) -{ - WordArray words (msg.cmd, false); - csString pid_str = words[1]; // Player is changed to string so no point in testing that if multiple entites with same name. - +{ if (!data.player.Length() || !data.newName.Length()) { - psserver->SendSystemInfo(me->clientnum,"Syntax: \"/changename <OldName|pid:[id]> <yes|no> <NewName> [NewLastName|No]\""); + psserver->SendSystemInfo(me->clientnum,"Syntax: \"/changename <OldName|pid:[id]> [force|forceall] <NewName> [NewLastName]\""); return; } unsigned int pid = 0; + Client* target = NULL; - if (pid_str.StartsWith("pid:",true) && pid_str.Length() > 4) // Find by player ID + if (data.player.StartsWith("pid:",true) && data.player.Length() > 4) // Find by player ID { - pid = atoi( pid_str.Slice(4).GetData() ); + pid = atoi( data.player.Slice(4).GetData() ); if (!pid) { psserver->SendSystemError(me->clientnum,"Error, bad PID"); return; } - + else + { + target = clients->FindPlayer(pid); + } } + else + { + target = clients->Find(data.player); + } + bool online = (target != NULL); // Fix names data.newName = NormalizeCharacterName(data.newName); data.newLastName = NormalizeCharacterName(data.newLastName); csString name = NormalizeCharacterName(data.player); - bool online; unsigned int id = 0; unsigned int type = 0; unsigned int gid = 0; - Client* target = NULL; - - if (pid) - { - target = clients->FindPlayer(pid); - } - else - { - target = clients->Find(data.player); - } - online = (target != NULL); - csString prevFirstName,prevLastName; // Check the DB if the player isn't online @@ -5194,7 +5199,7 @@ } else if (result.Count() != 1) { - psserver->SendSystemError(me->clientnum,"Multiple characters with same name '%s' use pid.",name.GetData()); + psserver->SendSystemError(me->clientnum,"Multiple characters with same name '%s'. Use pid.",name.GetData()); return; } else @@ -5235,49 +5240,50 @@ checkLast = false; } - if (data.player == data.newName) + if (data.newName == name) checkFirst = false; if (!checkFirst && !checkLast && data.newLastName.Length() != 0) return; - if(checkFirst) + if(checkFirst && !psCharCreationManager::FilterName(data.newName)) { - if (!psCharCreationManager::FilterName(data.newName)) - { - psserver->SendSystemError(me->clientnum,"The name %s is invalid!",data.newName.GetData()); - return; - } + psserver->SendSystemError(me->clientnum,"The name %s is invalid!",data.newName.GetData()); + return; + } + + if(checkLast && !psCharCreationManager::FilterName(data.newLastName)) + { + psserver->SendSystemError(me->clientnum,"The last name %s is invalid!",data.newLastName.GetData()); + return; } - if(checkLast) - { - if (!psCharCreationManager::FilterName(data.newLastName)) - { - psserver->SendSystemError(me->clientnum,"The last name %s is invalid!",data.newLastName.GetData()); - return; - } - } + bool nameUnique = psCharCreationManager::IsUnique(data.newName); // If the first name should be unique, check it - if (data.uniqueName && checkFirst && type == PSCHARACTER_TYPE_PLAYER) + if (checkFirst && data.uniqueFirstName && type == PSCHARACTER_TYPE_PLAYER && !nameUnique) { - if (!psCharCreationManager::IsUnique(data.newName)) - { - psserver->SendSystemError(me->clientnum,"The name %s is not unique!",data.newName.GetData()); - return; - } + psserver->SendSystemError(me->clientnum,"The name %s is not unique!",data.newName.GetData()); + return; } + bool secondNameUnique = psCharCreationManager::IsLastNameUnique(data.newLastName); // If the last name should be unique, check it - if (data.uniqueName && checkLast && data.newLastName.Length()) + if (checkLast && data.uniqueName && data.newLastName.Length() && !secondNameUnique) { - if (!psCharCreationManager::IsLastNameUnique(data.newLastName)) - { - psserver->SendSystemError(me->clientnum,"The last name %s is not unique!",data.newLastName.GetData()); - return; - } + psserver->SendSystemError(me->clientnum,"The last name %s is not unique!",data.newLastName.GetData()); + return; } + + if (checkFirst && !data.uniqueFirstName && type == PSCHARACTER_TYPE_PLAYER && !nameUnique) + { + psserver->SendSystemResult(me->clientnum,"WARNING: Changing despite the name %s is not unique!",data.newName.GetData()); + } + if (checkLast && !data.uniqueName && data.newLastName.Length() && !secondNameUnique) + { + psserver->SendSystemResult(me->clientnum,"Changing despite the last name %s is not unique!",data.newLastName.GetData()); + } + // Apply csString fullName; PS_ID actorId = 0; Modified: stable/src/server/adminmanager.h =================================================================== --- stable/src/server/adminmanager.h 2008-08-03 14:34:51 UTC (rev 1994) +++ stable/src/server/adminmanager.h 2008-08-03 15:22:24 UTC (rev 1995) @@ -128,7 +128,7 @@ int rainDrops, density, fade; unsigned int mins, hours, days; float amt, x, y, z, rot; - bool uniqueName,help,insert; + bool uniqueName, uniqueFirstName,help,insert; float radius, range; unsigned short stackCount; INSTANCE_ID instance; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |