CmdAsk.cpp
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:3k
- #include "stdafx.h"
- #include "XMudClient.h"
- #include "CommandCheck.h"
- #include "MenuCreateNew.h"
- #include "CommunicateMsg.h"
- #include "midi.h"
- #include "faceplate.h"
- #include "CmdFunction.h"
- #include "FileFunctionItem.h"
- #include "D3DRMScreen.h"
- #include "MapInfo.h"
- #include "NpcInfo.h"
- #include "MainScreen.h"
- extern CMainScreen m_MainScreen;
- extern CList <CNpcAskInfo *, CNpcAskInfo* >npcAsklist;
- extern rmfullglobals myglobs;
- extern int g_nGameState;
- extern CMenuCreateNew m_MenuCreateNew;
- extern SOCKET hLCltForRSvrSock;
- extern BOOL g_bGetInputMessage;
- extern CStringList g_strlistChannel;
- extern CStringList g_strlistSelfMsg;
- extern CStringList g_strlistMesssage;
- extern CStringList g_strlistPlayerOnline;
- extern CList<CPlayerInfo*,CPlayerInfo*>playerlist;
- extern CList<CEquipInfo*,CEquipInfo*>equiplist;
- extern CList<CEquipInfo*,CEquipInfo*>equiprentlist;
- extern CList<CItemInfo *, CItemInfo *> itemlist;
- extern CRITICAL_SECTION csAnimation;
- extern CList <animationCallbackArgs *, animationCallbackArgs *> animationlist;
- extern CRITICAL_SECTION csMaplist;
- extern CList <CMapInfo *, CMapInfo *> maplist;
- extern CList <CNpcInfo *,CNpcInfo *> npclist;
- extern char g_tszPathName[256];
- BOOL GetNpcAskInfo(CStringList * strComList)
- {
- npcAsklist.RemoveAll();
- CNpcAskInfo *lpNpcAskInfo;
- int i,j;
- CStringList strls;
- CString strtmp,parm;
- LPTSTR lpsz;
- char *ps;
- BOOL bFindHead=FALSE;
- strtmp = strComList->GetHead();
- lpsz = strtmp.GetBuffer(strtmp.GetLength()+1);
- parm=CString(",");
- ps=strtok(lpsz,(const char*)parm);
- ps=strtok(NULL,(const char*)parm);
- strls.AddTail(ps);
- for(;;)
- {
- ps=strtok(NULL,(const char*)parm);
- if(ps==NULL)break;
- strls.AddTail(ps);
- }
- j = strls.GetCount();
- for(i=0;i<j;i++)
- {
- if(!bFindHead)
- {
- strtmp = strls.GetAt( strls.FindIndex(i));
- if(!lstrcmp("'NPCASK'",strtmp) )
- bFindHead = TRUE;
- }
- else
- {
- strtmp = strls.GetAt( strls.FindIndex(i));
- if(lstrcmp("'RC'",strtmp))return FALSE;
- if( i+2 > j)
- return FALSE;
- strtmp = strls.GetAt( strls.FindIndex(i+2));
- if(lstrcmp("'RCEND'",strtmp))return FALSE;
- lpNpcAskInfo = new CNpcAskInfo;
- if(!lpNpcAskInfo)return FALSE;
- strtmp = strls.GetAt( strls.FindIndex(i+1));
- lpNpcAskInfo->m_sCNAME = strtmp = strtmp.Mid(1,strtmp.GetLength()-2);
- lpNpcAskInfo->m_iSHOW = 0;
- lpNpcAskInfo->m_sENAME = "";
- strtmp = strls.GetAt( strls.FindIndex(i+3));
- if(!lstrcmp("'NPCASKEND'",strtmp))
- {
- npcAsklist.AddTail(lpNpcAskInfo);
- break;
- }
- i = i+2;
- npcAsklist.AddTail(lpNpcAskInfo);
- }
- }
- strls.RemoveAll();
- return TRUE;
- }
- void SrvCmdAsk(CStringList * strComList)
- {
- CString sztmp;
- CString szOK = strComList->GetAt(strComList->FindIndex(1));
- if(szOK == "FAIL")
- sztmp = szGreenLow;
- else
- sztmp = szGreenHigt;
- sztmp += strComList->GetAt(strComList->FindIndex(2));
- sztmp.SetAt(sztmp.Find(",",0),0);
- AddSelfMsg((char*)(LPCSTR)sztmp);
- strComList->RemoveHead();
- strComList->RemoveHead();
- GetNpcAskInfo(strComList);
- m_MainScreen.mFirstFD.nShowState = SHOWNPCASK;
- m_MainScreen.mFirstFD.bReDraw[0] = TRUE;
- m_MainScreen.mFirstFD.bReDraw[1] = TRUE;
- m_MainScreen.mFirstFD.ResetCount();
- }
- void SrvCmdLook(CStringList * strComList)
- {
- CString sztmp;
- CString szOK = strComList->GetAt(strComList->FindIndex(1));
- if(szOK == "FAIL")
- sztmp = szGreenLow;
- else
- sztmp = szGreenHigt;
- sztmp += strComList->GetAt(strComList->FindIndex(2));
- AddSelfMsg((char*)(LPCSTR)sztmp);
- }