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

游戏引擎

开发平台:

Visual C++

  1. #include "stdafx.h"
  2. #include "XMudOS.h"
  3. #include "CommandCheck.h"
  4. #include "fight.h"
  5. #include "CmdPlayerLogon.h"
  6. #include "mapMapInfo.h"
  7. #include "npcNpc.h"
  8. #include "common.h"
  9. #include "hash.h"
  10. extern rmfullglobals myglobs;
  11. extern CList <TClientConData *,TClientConData* >playersocketlist;
  12. extern CList <CBaseMap*,CBaseMap*>maplist;
  13. extern CList <CFight*,CFight*>killlist;
  14. extern CList <CFight*,CFight*>fightlist;
  15. void RemoveFight(CActiveObject *lpAObj)
  16. {
  17. POSITION pos, opos, lastpos;
  18. CFight *lpFight;
  19. CActiveObject *lpOpp;
  20. pos = fightlist.GetHeadPosition();
  21. while (pos != NULL) {
  22. lastpos = pos;
  23. lpFight = fightlist.GetNext(pos);
  24. if (lpFight == NULL) {
  25. AddRecordMsg("ERROR NULL pointer in RemoveFight, lpFight");
  26. fightlist.RemoveAt(lastpos);
  27. continue;
  28. }
  29. if (lpFight->lpActiveObject == NULL) {
  30. AddRecordMsg("ERROR NULL pointer in RemoveFight, lpFight->lpActiveObject");
  31. fightlist.RemoveAt(lastpos);
  32. delete lpFight;
  33. continue;
  34. }
  35. if (strcmp(lpFight->lpActiveObject->szCheck,SZAOBJCHECK)) {
  36. AddRecordMsg("ERROR Bad data in RemoveFight, lpFight->lpActiveObject");
  37. fightlist.RemoveAt(lastpos);
  38. delete lpFight;
  39. continue;
  40. }
  41. if ((lpFight->lpActiveObject->szEName == lpAObj->szEName)
  42. && (lpFight->lpActiveObject->szCName == lpAObj->szCName)) {
  43. fightlist.RemoveAt(lastpos);
  44. delete lpFight;
  45. break;
  46. }
  47. }
  48. pos = lpAObj->listfightopp.GetHeadPosition();
  49. while (pos != NULL) {
  50. lpOpp = lpAObj->listfightopp.GetNext(pos);
  51. lpOpp->listfightopp.RemoveAll();
  52. lpOpp->nStatus = AOS_none;
  53. opos = fightlist.GetHeadPosition();
  54. while (opos != NULL) {
  55. lastpos = opos;
  56. lpFight = fightlist.GetNext(opos);
  57. if ((lpFight->lpActiveObject->szEName == lpOpp->szEName) &&
  58. (lpFight->lpActiveObject->szCName == lpOpp->szCName)) {
  59. fightlist.RemoveAt(lastpos);
  60. break;
  61. }
  62. }
  63. }
  64. lpAObj->listfightopp.RemoveAll();
  65. }
  66. void CCommandCheck::KillProc(LPVOID pvPlayer,char *playerName,char * szKillOpp,char *Result)
  67. {
  68. CFight *lpFight;
  69. CBaseMap * lpDataMap;
  70. CPlayerInfo *lpPlayerInfo,*lpOtherPlayerInfo;
  71. CActiveObject *lpOpp;
  72. CNpc * lpNpc;
  73. BOOL bFindOppPlayer = FALSE;
  74. BOOL bFindOppNPC = FALSE;
  75. CString szRet;
  76. POSITION pos, lastpos, pos2;
  77. CString msg, szOppName, szOppEName, szOppSName;
  78. CStringList listMsg;
  79. CList <CNpc*, CNpc*> listOpp;
  80. CCommandCheck m_CommandCheck;
  81. lpPlayerInfo = (CPlayerInfo*)pvPlayer;
  82. lpPlayerInfo->nOther = 0;
  83. int bGM = m_CommandCheck.CheckGM((char*)(LPCSTR)lpPlayerInfo->szUserName);
  84. if (lpPlayerInfo->nStatus != AOS_none) return;
  85. if(myglobs.bNoKill && !bGM) {
  86. sprintf(Result,"%s 硂