cmdkillproc.cpp
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:19k
- #include "stdafx.h"
- #include "XMudOS.h"
- #include "CommandCheck.h"
- #include "fight.h"
- #include "CmdPlayerLogon.h"
- #include "mapMapInfo.h"
- #include "npcNpc.h"
- #include "common.h"
- #include "hash.h"
- extern rmfullglobals myglobs;
- extern CList <TClientConData *,TClientConData* >playersocketlist;
- extern CList <CBaseMap*,CBaseMap*>maplist;
- extern CList <CFight*,CFight*>killlist;
- extern CList <CFight*,CFight*>fightlist;
- void RemoveFight(CActiveObject *lpAObj)
- {
- POSITION pos, opos, lastpos;
- CFight *lpFight;
- CActiveObject *lpOpp;
- pos = fightlist.GetHeadPosition();
- while (pos != NULL) {
- lastpos = pos;
- lpFight = fightlist.GetNext(pos);
- if (lpFight == NULL) {
- AddRecordMsg("ERROR NULL pointer in RemoveFight, lpFight");
- fightlist.RemoveAt(lastpos);
- continue;
- }
- if (lpFight->lpActiveObject == NULL) {
- AddRecordMsg("ERROR NULL pointer in RemoveFight, lpFight->lpActiveObject");
- fightlist.RemoveAt(lastpos);
- delete lpFight;
- continue;
- }
- if (strcmp(lpFight->lpActiveObject->szCheck,SZAOBJCHECK)) {
- AddRecordMsg("ERROR Bad data in RemoveFight, lpFight->lpActiveObject");
- fightlist.RemoveAt(lastpos);
- delete lpFight;
- continue;
- }
- if ((lpFight->lpActiveObject->szEName == lpAObj->szEName)
- && (lpFight->lpActiveObject->szCName == lpAObj->szCName)) {
- fightlist.RemoveAt(lastpos);
- delete lpFight;
- break;
- }
- }
- pos = lpAObj->listfightopp.GetHeadPosition();
- while (pos != NULL) {
- lpOpp = lpAObj->listfightopp.GetNext(pos);
- lpOpp->listfightopp.RemoveAll();
- lpOpp->nStatus = AOS_none;
- opos = fightlist.GetHeadPosition();
- while (opos != NULL) {
- lastpos = opos;
- lpFight = fightlist.GetNext(opos);
- if ((lpFight->lpActiveObject->szEName == lpOpp->szEName) &&
- (lpFight->lpActiveObject->szCName == lpOpp->szCName)) {
- fightlist.RemoveAt(lastpos);
- break;
- }
- }
- }
- lpAObj->listfightopp.RemoveAll();
- }
- void CCommandCheck::KillProc(LPVOID pvPlayer,char *playerName,char * szKillOpp,char *Result)
- {
- CFight *lpFight;
- CBaseMap * lpDataMap;
- CPlayerInfo *lpPlayerInfo,*lpOtherPlayerInfo;
- CActiveObject *lpOpp;
- CNpc * lpNpc;
- BOOL bFindOppPlayer = FALSE;
- BOOL bFindOppNPC = FALSE;
- CString szRet;
- POSITION pos, lastpos, pos2;
- CString msg, szOppName, szOppEName, szOppSName;
- CStringList listMsg;
- CList <CNpc*, CNpc*> listOpp;
- CCommandCheck m_CommandCheck;
- lpPlayerInfo = (CPlayerInfo*)pvPlayer;
- lpPlayerInfo->nOther = 0;
-
- int bGM = m_CommandCheck.CheckGM((char*)(LPCSTR)lpPlayerInfo->szUserName);
- if (lpPlayerInfo->nStatus != AOS_none) return;
- if(myglobs.bNoKill && !bGM) {
- sprintf(Result,"%s 硂