ShowFightMsg.cpp
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:8k
- #include "stdafx.h"
- #include "xmudClient.h"
- #include "MenuCreateNew.h"
- #include "CommandCheck.h"
- #include "D3DRMScreen.h"
- extern char g_tszPathName[256];
- extern rmfullglobals myglobs;
- extern CRITICAL_SECTION csAnimation;
- extern CList <animationCallbackArgs *, animationCallbackArgs *> animationlist;
- extern CList<CPlayerInfo*,CPlayerInfo*>playerlist;
- #define action_msg '1'
- #define dodge_msg '2'
- #define parry_msg '3'
- #define unarmed_parry_msg '4'
- #define fight_status_msg '5'
- #define kill_status_msg '6'
- #define winner_msg '7'
- #define add_force_msg '8'
- #define guard_msg '9'
- #define damage_msg 'a'
- #define catch_hunt_msg 'b'
- CString GetChangedMsg(CString &OrgMsg)
- {
- CStringList strList;
- CString szColor = "$506$";//szGreenHigt
- CString szCur;
- CString parm = ",";
- //だ秆
- char *ps=strtok((char *)(LPCTSTR)OrgMsg, (const char*)parm);
- strList.AddTail(ps);
- for(;;)
- {
- ps=strtok(NULL,(const char*)parm);
- if(ps==NULL)break;
- strList.AddTail(ps);
- }
- // OrgMsg = "[error]";
- OrgMsg = "薄猵ぃМ";
- CStdioFile fMsg;
- CString strFind;
- int nCount,nCur;
- szCur = strList.GetHead();
- switch(szCur[0])
- {
- case action_msg:
- if(strFind.IsEmpty())
- strFind = "[action]";
- case dodge_msg:
- if(strFind.IsEmpty())
- strFind = "[dodge_msg]";
- case parry_msg:
- if(strFind.IsEmpty())
- strFind = "[parry_msg]";
- case unarmed_parry_msg:
- if(strFind.IsEmpty())
- strFind = "[unarmed_parry_msg]";
- if(strList.GetCount() < 3) break;
- szCur = g_tszPathName;
- szCur += "\MudData\Msg\";
- szCur += strList.GetAt(strList.FindIndex(1));
- szCur += ".msg";
- if(!fMsg.Open(szCur, CFile::modeRead))
- {
- OrgMsg.Format("Open File %s error!", szCur);
- break;
- }
- while((fMsg.ReadString(szCur))&&(szCur != strFind));
- if(szCur != strFind) break;
- nCount = atoi(strList.GetAt(strList.FindIndex(2))) + 1;
- while(nCount--)
- fMsg.ReadString(szCur);
- fMsg.Close();
- OrgMsg = szCur;
- break;
- case fight_status_msg:
- if(strFind.IsEmpty())
- strFind = "[fight_status_msg]";
- case kill_status_msg:
- if(strFind.IsEmpty())
- strFind = "[kill_status_msg]";
- case add_force_msg:
- if(strFind.IsEmpty())
- strFind = "[add_force_msg]";
- if(strList.GetCount() < 2) break;
- szCur = g_tszPathName;
- szCur += "\MudData\msg.txt";
- if(!fMsg.Open(szCur, CFile::modeRead))
- {
- OrgMsg.Format("Open File [%s] error!", szCur);
- break;
- }
- while((fMsg.ReadString(szCur))&&(szCur != strFind));
- if(szCur != strFind) break;
- nCount = atoi(strList.GetAt(strList.FindIndex(1)));
- if(nCount <0 ) break;
- do {
- fMsg.ReadString(szCur);
- strList.RemoveAll();
- ps=strtok((char *)(LPCTSTR)szCur, (const char*)parm);
- strList.AddTail(ps);
- for(;;)
- {
- ps=strtok(NULL,(const char*)parm);
- if(ps==NULL)break;
- strList.AddTail(ps);
- }
- nCur = atoi(strList.GetHead());
- }while(nCur > nCount);
- fMsg.Close();
- if(strList.GetCount() < 3) break;
- szColor = strList.GetAt(strList.FindIndex(1));
- OrgMsg = strList.GetAt(strList.FindIndex(2));
- break;
- case winner_msg:
- if(strFind.IsEmpty())
- strFind = "[winner_msg]";
- case catch_hunt_msg:
- if(strFind.IsEmpty())
- strFind = "[catch_hunt_msg]";
- case guard_msg:
- if(strFind.IsEmpty())
- strFind = "[guard_msg]";
- if(strList.GetCount() < 2) break;
- szCur = g_tszPathName;
- szCur += "\MudData\msg.txt";
- if(!fMsg.Open(szCur, CFile::modeRead))
- {
- OrgMsg.Format("Open File [%s] error!", szCur);
- break;
- }
- while((fMsg.ReadString(szCur))&&(szCur != strFind));
- if(szCur != strFind) break;
- nCount = atoi(strList.GetAt(strList.FindIndex(1)))+1;
- if(nCount <=0 ) break;
- while(nCount--)
- fMsg.ReadString(szCur);
- fMsg.Close();
- strList.RemoveAll();
- ps=strtok((char *)(LPCTSTR)szCur, (const char*)parm);
- strList.AddTail(ps);
- for(;;)
- {
- ps=strtok(NULL,(const char*)parm);
- if(ps==NULL)break;
- strList.AddTail(ps);
- }
- if(strList.GetCount() < 2) break;
- szColor = strList.GetAt(strList.FindIndex(0));
- OrgMsg = strList.GetAt(strList.FindIndex(1));
- break;
- case damage_msg:
- if(strList.GetCount() < 3) break;
- szCur = g_tszPathName;
- szCur += "\MudData\msg.txt";
- if(!fMsg.Open(szCur, CFile::modeRead))
- {
- OrgMsg.Format("Open File [%s] error!", szCur);
- break;
- }
- while((fMsg.ReadString(szCur))&&(szCur != "[damage_msg]"));
- if(szCur != "[damage_msg]") break;
- strFind = strList.GetAt(strList.FindIndex(1));
- nCount = atoi(strList.GetAt(strList.FindIndex(2)));
- if(nCount <=0 ) break;
- while((fMsg.ReadString(szCur))&&(szCur != strFind)&&(szCur != "default"));
- if((szCur != strFind)&&(szCur != "default")) break;
- CString szCur2;
- szCur2 = szCur;
- do {
- fMsg.ReadString(szCur);
- strList.RemoveAll();
- ps=strtok((char *)(LPCTSTR)szCur, (const char*)parm);
- strList.AddTail(ps);
- for(;;){
- ps=strtok(NULL,(const char*)parm);
- if(ps==NULL)break;
- strList.AddTail(ps);
- }
- nCur = atoi(strList.GetHead());
- }while(nCur < nCount);
- fMsg.Close();
- if(strList.GetCount() < 2) break;
- OrgMsg = strList.GetAt(strList.FindIndex(1));
- if(szCur2 == "default")
- {
- OrgMsg += strFind;
- OrgMsg += "