cmdemote.cpp
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:16k
- #include "stdafx.h"
- #include "XmudOS.h"
- #include "ActiveObject.h"
- #include "CmdEmote.h"
- #include "skillskillskill.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- static CList<TEmote *, TEmote *> listEmote;
- extern char g_tszPathName[256];
- extern rmfullglobals myglobs;
- extern CList <TClientConData *,TClientConData* >playersocketlist;
- static inline CString GetHe(CActiveObject *he);
- static void ChangeEmote(CString &szEmote, CActiveObject *me, CActiveObject *you);
- static BOOL GetEmote3(TEmote * lpEmote, CActiveObject *me, CActiveObject *you, CString &strRet1, CString &strRet2, CString &strRet3);
- static BOOL GetEmoteSpace(TEmote * lpEmote, CActiveObject *me, CString &strRet1, CString &strRet2);
- static BOOL GetEmoteMe(TEmote * lpEmote, CActiveObject *me, CString &strRet1, CString &strRet2);
- void DeleteEmote()
- {
- POSITION pos;
- TEmote * lpEmote;
- pos = listEmote.GetHeadPosition();
- while(pos != NULL){
- lpEmote = listEmote.GetNext(pos);
- delete lpEmote;
- }
- listEmote.RemoveAll();
- }
- BOOL InitEmote()
- {
- CStdioFile fEmote;
- CString szTmp;
- TEmote * lpEmote;
- szTmp = g_tszPathName;
- szTmp += "\Emoted.dat";
- if(!fEmote.Open(szTmp, CFile::modeRead)){
- AddRecordMsg("ERROR Open Emoted.dat fail");
- return FALSE;
- }else{
- while (fEmote.ReadString(szTmp)){
- lpEmote = new TEmote;
- lpEmote->nKind = szTmp[0]-'0';
- fEmote.ReadString(lpEmote->szCEmote);
- fEmote.ReadString(lpEmote->szEmote);
- fEmote.ReadString(szTmp);
- lpEmote->nType = szTmp[0]-'0';
- if(lpEmote->nType & EMT_HAVE_TARGET){
- fEmote.ReadString(lpEmote->szTarget);
- fEmote.ReadString(lpEmote->szMeTo);
- fEmote.ReadString(lpEmote->szOthersTo);
- }
- if(lpEmote->nType & EMT_HAVE_NONAME)
- {
- fEmote.ReadString(lpEmote->szMe);
- fEmote.ReadString(lpEmote->szOthers);
- }
- if(lpEmote->nType & EMT_HAVE_SELF)
- {
- fEmote.ReadString(lpEmote->szMyself);
- fEmote.ReadString(lpEmote->szOtherself);
- }
- listEmote.AddTail(lpEmote);
- }
- }
- fEmote.Close();
- return TRUE;
- }
- inline CString GetHe(CActiveObject *he)
- {
- return (he->szSex[0] == 'F')?"