cmdgivedroppick.cpp
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:12k
- #include "stdafx.h"
- #include "XMudOS.h"
- #include "CommandCheck.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;
- void CCommandCheck::GiveProc(LPVOID pvPlayer,char *szWho,char * szGoods,char *szAmount,char *Result)
- {
- CBaseMap * lpDataMap;
- CPlayerInfo *lpPlayerInfo,*lpOtherPlayerInfo;
- CNpc * lpNpc;
- CGoods *lpGoods = NULL,*lpGiveGoods=NULL,*lpOppEquip=NULL;
- BOOL bFindOppPlayer = FALSE;
- BOOL bFindOppNPC = FALSE;
- CString szRet;
- CString szStatus;
- int nAmount = 0;
- int nWeight=0;
- POSITION pos,lastpos;
- BOOL bFindGoods = FALSE;
- BOOL bmore = FALSE;
- lpPlayerInfo = (CPlayerInfo*)pvPlayer;
- if (lpPlayerInfo->nStatus != AOS_none) return;
- POSITION pMapPosite = lpPlayerInfo->pMapPosite;
- lpDataMap = maplist.GetAt(lpPlayerInfo->pMapPosite);
- EnterCriticalSection(&myglobs.csMaplist);
- EnterCriticalSection(&myglobs.csPlayerData);
- pos = lpDataMap->listplayer.GetHeadPosition();
- while(pos != NULL){
- lastpos = pos;
- lpOtherPlayerInfo = lpDataMap->listplayer.GetNext(pos);
- if (lpOtherPlayerInfo == NULL) {
- AddRecordMsg("ERROR NULL pointer in GiveProc, lpOtherPlayerInfo");
- lpDataMap->listplayer.RemoveAt(lastpos);
- continue;
- }
- if (strcmp(lpOtherPlayerInfo->szCheck, SZAOBJCHECK)) {
- AddRecordMsg("ERROR Bad data in GiveProc, lpOtherPlayerInfo");
- lpDataMap->listplayer.RemoveAt(lastpos);
- continue;
- }
- if((!strcmp(lpOtherPlayerInfo->szEName,szWho) ||
- !strcmp(lpOtherPlayerInfo->szCName,szWho)) &&
- (lpOtherPlayerInfo->nStatus != AOS_dead)){
- bFindOppPlayer = TRUE;
- break;
- }
- }
- if(!bFindOppPlayer){
- pos = lpDataMap->listNpc.GetHeadPosition();
- while(pos != NULL){
- lpNpc = lpDataMap->listNpc.GetNext(pos);
- if((!strcmp(lpNpc->szEName,szWho) ||
- !strcmp(lpNpc->szCName,szWho))
- && (lpNpc->nStatus!=AOS_dead)){
- bFindOppNPC = TRUE;
- break;
- }
- }
- if(!bFindOppNPC){
- szRet.Format("%s FAIL 癸よ