CmdAsk.cpp
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:3k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. #include "stdafx.h"
  2. #include "XMudClient.h"
  3. #include "CommandCheck.h"
  4. #include "MenuCreateNew.h"
  5. #include "CommunicateMsg.h"
  6. #include "midi.h"
  7. #include "faceplate.h"
  8. #include "CmdFunction.h"
  9. #include "FileFunctionItem.h"
  10. #include "D3DRMScreen.h"
  11. #include "MapInfo.h"
  12. #include "NpcInfo.h"
  13. #include "MainScreen.h"
  14. extern CMainScreen m_MainScreen;
  15. extern CList <CNpcAskInfo *, CNpcAskInfo* >npcAsklist;
  16. extern rmfullglobals myglobs;
  17. extern int g_nGameState;
  18. extern CMenuCreateNew m_MenuCreateNew;
  19. extern SOCKET hLCltForRSvrSock;
  20. extern BOOL g_bGetInputMessage;
  21. extern CStringList g_strlistChannel;
  22. extern CStringList g_strlistSelfMsg;
  23. extern CStringList g_strlistMesssage;
  24. extern CStringList g_strlistPlayerOnline;
  25. extern CList<CPlayerInfo*,CPlayerInfo*>playerlist;
  26. extern CList<CEquipInfo*,CEquipInfo*>equiplist;
  27. extern CList<CEquipInfo*,CEquipInfo*>equiprentlist;
  28. extern CList<CItemInfo *, CItemInfo *> itemlist;
  29. extern CRITICAL_SECTION csAnimation;
  30. extern CList <animationCallbackArgs *, animationCallbackArgs *> animationlist;
  31. extern CRITICAL_SECTION csMaplist;
  32. extern CList <CMapInfo *, CMapInfo *> maplist;
  33. extern CList <CNpcInfo *,CNpcInfo *> npclist;
  34. extern char g_tszPathName[256];
  35. BOOL GetNpcAskInfo(CStringList * strComList)
  36. {
  37. npcAsklist.RemoveAll();
  38. CNpcAskInfo *lpNpcAskInfo;
  39. int i,j;
  40. CStringList strls;
  41. CString strtmp,parm;
  42. LPTSTR lpsz;
  43. char *ps;
  44. BOOL bFindHead=FALSE;
  45. strtmp = strComList->GetHead();
  46. lpsz = strtmp.GetBuffer(strtmp.GetLength()+1);
  47. parm=CString(",");
  48. ps=strtok(lpsz,(const char*)parm);
  49. ps=strtok(NULL,(const char*)parm);
  50. strls.AddTail(ps);
  51. for(;;)
  52. {
  53. ps=strtok(NULL,(const char*)parm);
  54. if(ps==NULL)break;
  55. strls.AddTail(ps);
  56. }
  57. j = strls.GetCount();
  58. for(i=0;i<j;i++)
  59. {
  60. if(!bFindHead)
  61. {
  62. strtmp = strls.GetAt( strls.FindIndex(i));
  63. if(!lstrcmp("'NPCASK'",strtmp) )
  64. bFindHead = TRUE;
  65. }
  66. else
  67. {
  68. strtmp = strls.GetAt( strls.FindIndex(i));
  69. if(lstrcmp("'RC'",strtmp))return FALSE;
  70. if( i+2 > j)
  71. return FALSE;
  72. strtmp = strls.GetAt( strls.FindIndex(i+2));
  73. if(lstrcmp("'RCEND'",strtmp))return FALSE;
  74. lpNpcAskInfo = new CNpcAskInfo;
  75. if(!lpNpcAskInfo)return FALSE;
  76. strtmp = strls.GetAt( strls.FindIndex(i+1));
  77. lpNpcAskInfo->m_sCNAME = strtmp = strtmp.Mid(1,strtmp.GetLength()-2);
  78. lpNpcAskInfo->m_iSHOW = 0;
  79. lpNpcAskInfo->m_sENAME = "";
  80. strtmp = strls.GetAt( strls.FindIndex(i+3));
  81. if(!lstrcmp("'NPCASKEND'",strtmp))
  82. {
  83. npcAsklist.AddTail(lpNpcAskInfo);
  84. break;
  85. }
  86. i = i+2;
  87. npcAsklist.AddTail(lpNpcAskInfo);
  88. }
  89. }
  90. strls.RemoveAll();
  91. return TRUE;
  92. }
  93. void SrvCmdAsk(CStringList * strComList)
  94. {
  95. CString sztmp;
  96. CString szOK = strComList->GetAt(strComList->FindIndex(1));
  97. if(szOK == "FAIL")
  98. sztmp = szGreenLow;
  99. else
  100. sztmp = szGreenHigt;
  101. sztmp += strComList->GetAt(strComList->FindIndex(2));
  102. sztmp.SetAt(sztmp.Find(",",0),0);
  103. AddSelfMsg((char*)(LPCSTR)sztmp);
  104. strComList->RemoveHead();
  105. strComList->RemoveHead();
  106. GetNpcAskInfo(strComList);
  107. m_MainScreen.mFirstFD.nShowState = SHOWNPCASK;
  108. m_MainScreen.mFirstFD.bReDraw[0] = TRUE;
  109. m_MainScreen.mFirstFD.bReDraw[1] = TRUE;
  110. m_MainScreen.mFirstFD.ResetCount();
  111. }
  112. void SrvCmdLook(CStringList * strComList)
  113. {
  114. CString sztmp;
  115. CString szOK = strComList->GetAt(strComList->FindIndex(1));
  116. if(szOK == "FAIL")
  117. sztmp = szGreenLow;
  118. else
  119. sztmp = szGreenHigt;
  120. sztmp += strComList->GetAt(strComList->FindIndex(2));
  121. AddSelfMsg((char*)(LPCSTR)sztmp);
  122. }