From: <ke...@us...> - 2007-11-21 16:39:02
|
Revision: 297 http://planeshift.svn.sourceforge.net/planeshift/?rev=297&view=rev Author: kemedes Date: 2007-11-21 08:38:58 -0800 (Wed, 21 Nov 2007) Log Message: ----------- - Improved the IntroduceResponseOp, Allowing npcs to introduce other npcs, And not just themselves. Modified Paths: -------------- trunk/docs/history.txt trunk/src/server/bulkobjects/dictionary.cpp trunk/src/server/bulkobjects/dictionary.h trunk/src/server/questmanager.cpp Modified: trunk/docs/history.txt =================================================================== --- trunk/docs/history.txt 2007-11-21 16:14:06 UTC (rev 296) +++ trunk/docs/history.txt 2007-11-21 16:38:58 UTC (rev 297) @@ -8,6 +8,8 @@ - NPCs are now also unknown to the player, until they introduce themselves. - Added an IntroduceResponseOp to be used with npcs. +- Improved the IntroduceResponseOp, Allowing npcs to introduce other + npcs, And not just themselves. *** 2007-11-19 by Michael Gist - Removed update checking code from client and server. Modified: trunk/src/server/bulkobjects/dictionary.cpp =================================================================== --- trunk/src/server/bulkobjects/dictionary.cpp 2007-11-21 16:14:06 UTC (rev 296) +++ trunk/src/server/bulkobjects/dictionary.cpp 2007-11-21 16:38:58 UTC (rev 297) @@ -41,6 +41,7 @@ #include "../cachemanager.h" #include "../questionmanager.h" #include "../npcmanager.h" +#include "../adminmanager.h" #include "net/messages.h" #include "pscharacter.h" #include "pscharacterloader.h" @@ -2231,6 +2232,11 @@ bool IntroduceResponseOp::Load(iDocumentNode *node) { + if (node->GetAttributeValue("name")) + targetName = node->GetAttributeValue("name"); + else + targetName = "Me"; + return true; } @@ -2238,6 +2244,7 @@ { psString resp; resp = GetName(); + resp.AppendFmt(" name=\"%s\"",targetName.GetData()); return resp; } @@ -2246,10 +2253,22 @@ psCharacter * character = target->GetCharacterData(); psCharacter * npcChar = who->GetCharacterData(); - psserver->GetIntroductionManager()->Introduce(character->GetCharacterID(), npcChar->GetCharacterID()); - - who->Send(target->GetClientNum(), false, false); - - psserver->SendSystemInfo(target->GetClientNum(), "You now know %s",who->GetName()); + if (targetName != "Me") + { + gemObject* obj = psserver->GetAdminManager()->FindObjectByString(targetName); + if (obj) + { + psserver->GetIntroductionManager()->Introduce(character->GetCharacterID(), ((gemNPC*)obj)->GetCharacterData()->GetCharacterID()); + obj->Send(target->GetClientNum(), false, false); + psserver->SendSystemInfo(target->GetClientNum(), "You now know %s",((gemNPC*)obj)->GetName()); + } + } + else + { + psserver->GetIntroductionManager()->Introduce(character->GetCharacterID(), npcChar->GetCharacterID()); + who->Send(target->GetClientNum(), false, false); + psserver->SendSystemInfo(target->GetClientNum(), "You now know %s",who->GetName()); + } + return true; } Modified: trunk/src/server/bulkobjects/dictionary.h =================================================================== --- trunk/src/server/bulkobjects/dictionary.h 2007-11-21 16:14:06 UTC (rev 296) +++ trunk/src/server/bulkobjects/dictionary.h 2007-11-21 16:38:58 UTC (rev 297) @@ -672,6 +672,8 @@ */ class IntroduceResponseOp : public ResponseOperation { +protected: + csString targetName; public: IntroduceResponseOp() { name = "introduce"; } virtual ~IntroduceResponseOp() {}; Modified: trunk/src/server/questmanager.cpp =================================================================== --- trunk/src/server/questmanager.cpp 2007-11-21 16:14:06 UTC (rev 296) +++ trunk/src/server/questmanager.cpp 2007-11-21 16:38:58 UTC (rev 297) @@ -406,9 +406,13 @@ } op.Append("/>"); } - else if (!strncasecmp(block,"Introduce",10)) + else if (!strncasecmp(block,"Introduce",9)) { - op.Format("<introduce/>" ); + csString charname = block.Slice(10).Trim(); + if (!charname.IsEmpty()) + op.Format("<introduce name=\"%s\"/>", charname.GetData() ); + else + op.Format("<introduce/>"); } else // unknown block { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |