ObjectPlayerAdminSaid.cpp
上传用户:tt_chan
上传日期:2009-12-03
资源大小:4523k
文件大小:8k
源码类别:
模拟服务器
开发平台:
Visual C++
- #include "stdafx.h"
- #define _MAX_ADMINCOMMAND_LIST (IDS_COMMAND_HAIRSTYLE - IDS_COMMAND_MONGEN + 1)
- void InitAdminCommandList()
- {
- TCHAR szCommand[64];
- int nLen;
- HINSTANCE hInstance = LoadLibrary(_T("AdminCmd.DLL"));
- if (hInstance)
- {
- for (int i = 0; i < _MAX_ADMINCOMMAND_LIST; i++)
- {
- LoadString(hInstance, IDS_COMMAND_MONGEN + i, szCommand, sizeof(szCommand)/sizeof(TCHAR));
- nLen = lstrlen(szCommand) * sizeof(TCHAR) + 1;
- char *pszAdminCommand = new char[nLen];
- if (pszAdminCommand)
- {
- WideCharToMultiByte(CP_ACP, 0, szCommand, -1, pszAdminCommand, nLen, NULL, NULL);
- g_xAdminCommandList.AddNewNode(pszAdminCommand);
- }
- }
- InsertLogMsgParam(IDS_LOAD_ADMINCOMMAND, &i, LOGPARAM_INT);
- FreeLibrary(hInstance);
- }
- }
- void UnInitAdminCommandList()
- {
- PLISTNODE pListNode = g_xAdminCommandList.GetHead();
- while (pListNode)
- {
- delete [] g_xAdminCommandList.GetData(pListNode);
- pListNode = g_xAdminCommandList.RemoveNode(pListNode);
- }
- }
- BOOL CPlayerObject::ProcessForAdminSaid(char *pszMsg)
- {
- if (pszMsg[0] == '@')
- {
- PLISTNODE pListNode = g_xAdminCommandList.GetHead();
- int nCommand = 0;
- char *pszParam1 = NULL, *pszParam2 = NULL, *pszParam3 = NULL, *pszParam4 = NULL;
- if ((pszParam1 = strchr(&pszMsg[1], ' ')))
- {
- *pszParam1 = ' ';
- pszParam1++;
- }
- char *pszData;
- while (pListNode)
- {
- pszData = (char *)g_xAdminCommandList.GetData(pListNode);
- if (memcmp(&pszMsg[1], pszData, memlen(pszData)) == 0)
- break;
- nCommand++;
- pListNode = g_xAdminCommandList.GetNext(pListNode);
- }
- if (nCommand >= _MAX_ADMINCOMMAND_LIST) return FALSE;
- if (pszParam1)
- {
- if (pszParam2 = strchr(pszParam1, ' '))
- {
- *pszParam2 = ' ';
- pszParam2++;
- if (pszParam3 = strchr(pszParam2, ' '))
- {
- *pszParam3 = ' ';
- pszParam3++;
- if (pszParam4 = strchr(pszParam3, ' '))
- {
- *pszParam4 = ' ';
- pszParam4++;
- }
- }
- }
- }
- switch (IDS_COMMAND_MONGEN + nCommand)
- {
- case IDS_COMMAND_MONGEN: //"各哩"
- if (pszParam1 && pszParam2)
- CmdCallMakeMonster(pszParam1, pszParam2);
- break;
- case IDS_COMMAND_INSPECTOR: //"皑矫磊"
- {
- TCHAR wszMsg[64];
- char szMsg[64];
- m_fInspector = ~m_fInspector;
- if (m_fInspector)
- LoadString(g_hInst, IDS_INSPECTOR_ON, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
- else
- LoadString(g_hInst, IDS_INSPECTOR_OFF, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
- WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szMsg, sizeof(szMsg), NULL, NULL);
- SysMsg(szMsg, 1);
- break;
- }
- case IDS_COMMAND_ADMIN: //"款康磊"
- break;
- case IDS_COMMAND_INVINCIBILITY: //"公利"
- {
- TCHAR wszMsg[64];
- char szMsg[64];
- m_fIsNeverDie = ~m_fIsNeverDie;
- if (m_fIsNeverDie)
- LoadString(g_hInst, IDS_NEVERDIE_ON, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
- else
- LoadString(g_hInst, IDS_NEVERDIE_OFF, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
- WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szMsg, sizeof(szMsg), NULL, NULL);
- SysMsg(szMsg, 1);
- break;
- }
- case IDS_COMMAND_ATTACK: //"傍拜"
- break;
- case IDS_COMMAND_MOVE: //"捞悼"
- if (pszParam1)
- CmdRandomSpaceMove(pszParam1);
- break;
- case IDS_COMMAND_CHANGELEVEL: //"饭骇炼沥"
- {
- if (pszParam1)
- {
- m_Ability.Level = m_pUserInfo->m_THumanRcd.szLevel = _MIN(40, AnsiStrToVal(pszParam1));
- HasLevelUp(1);
- }
- break;
- }
- case IDS_COMMAND_MOVEFREESTYLE: //"磊蜡捞悼"
- if (pszParam1 && pszParam2 && pszParam3)
- CmdFreeSpaceMove(pszParam1, pszParam2, pszParam3);
- break;
- case IDS_COMMAND_MAP: //"甘"
- {
- char szMsg[64];
- memcpy(szMsg, "MAP : ", 6);
- memcpy(&szMsg[6], m_pMap->m_szMapTextName, memlen(m_pMap->m_szMapTextName));
- SysMsg(szMsg, 0);
- break;
- }
- case IDS_COMMAND_LEVEL: //"肪"
- break;
- case IDS_COMMAND_MONLEVEL: //"各肪"
- CmdSendMonsterLevelInfos();
- break;
- case IDS_COMMAND_RECALL: //"家券"
- break;
- case IDS_COMMAND_NUMOFMON: //"各荐"
- break;
- case IDS_COMMAND_NUMOFHUMAN: //"荤恩荐"
- break;
- case IDS_COMMAND_SABUKMONEY: //"荤合己捣"
- break;
- case IDS_COMMAND_KICK: //"Kick"
- break;
- case IDS_COMMAND_KICK2: //"疟"
- break;
- case IDS_COMMAND_TING: //"泼"
- break;
- case IDS_COMMAND_KINGTING: //"空泼"
- break;
- case IDS_COMMAND_LUCKYVALUE: //"青款蔼"
- break;
- case IDS_COMMANT_SHUTUP: //"盲陛"
- break;
- case IDS_COMMAND_TALK: //"盲陛秦力"
- break;
- case IDS_COMMAND_SHUTUPMAN: //"盲陛磊"
- break;
- case IDS_COMMAND_RELOADADMIN: //"ReloadAdmin"
- break;
- case IDS_COMMAND_RELOADABUSIVE: //"垮汲沥焊佬扁"
- break;
- case IDS_COMMAND_MOOTAEBO: //"公怕焊"
- break;
- case IDS_COMMAND_BACKWALK: //"缔吧澜"
- break;
- case IDS_COMMAND_GAIN: //"积魂"
- if (pszParam1 && pszParam2)
- CmdMakeItem(pszParam1, pszParam2);
- break;
- case IDS_COMMAND_DELGOLD: //"捣昏力"
- break;
- case IDS_COMMAND_ADDGOLD: //"捣眠啊"
- break;
- case IDS_COMMAND_GOOD: //"拱扒"
- break;
- case IDS_COMMAND_OTHERDELGOLD: //"鸥牢捣昏力"
- break;
- case IDS_COMMAND_OTHERADDGOLD: //"鸥牢捣眠啊"
- break;
- case IDS_COMMAND_OTHERLEVELUP: //"鸥牢饭骇炼沥"
- break;
- case IDS_COMMAND_OTHEREXPUP: //"鸥牢版氰摹炼沥"
- break;
- case IDS_COMMAND_WEAPONDUR: //"公扁郴备炼沥"
- break;
- case IDS_COMMAND_PARDON: //"搁了"
- break;
- case IDS_COMMAND_PKPOINT: //"乔纳捞痢荐"
- break;
- case IDS_COMMAND_PKPOINTUP: //"乔纳捞痢荐刘啊"
- break;
- case IDS_COMMAND_CHANGELUCKY: //"青款函版"
- break;
- case IDS_COMMAND_SKILLUP: //"公傍荐访"
- if (pszParam1 && pszParam2)
- CmdMakeFullSkill(pszParam1, pszParam2);
- break;
- case IDS_COMMAND_OTHERSKILLUP: //"鸥牢公傍荐访"
- break;
- case IDS_COMMAND_DELSKILL: //"公傍昏力窍扁"
- break;
- case IDS_COMMAND_OTHERDELSKILL: //"鸥牢公傍昏力窍扁"
- break;
- case IDS_COMMAND_CHGJOB: //"傈诀"
- {
- if (pszParam1)
- {
- if (CmdChangeJob(pszParam1))
- HasLevelUp(1);
- }
- break;
- }
- case IDS_COMMAND_CHGGENDER: //"飘罚胶哩歹"
- {
- if (m_pUserInfo->m_THumanRcd.btGender == 0) m_pUserInfo->m_THumanRcd.btGender = m_tFeature.btGender = 1;
- else m_pUserInfo->m_THumanRcd.btGender = m_tFeature.btGender = 0;
- SysMsg(pszData, 1);
- break;
- }
- case IDS_COMMAND_COLOR: //"祸"
- break;
- case IDS_COMMAND_MONRECALL: //"各家券"
- {
- if (pszParam1 && pszParam2)
- CmdCallMakeSlaveMonster(pszParam1, pszParam2);
- break;
- }
- case IDS_COMMAND_MISSION: //"固记"
- break;
- case IDS_COMMAND_GENPOS: //"哩镑"
- {
- if (pszParam1 && pszParam2 && pszParam3 && pszParam4)
- CmdCallMakeMonsterXY(pszParam1, pszParam2, pszParam3, pszParam4);
- break;
- }
- case IDS_COMMAND_TRANSPARENCY: //"捧疙"
- break;
- case IDS_COMMAND_CIVILWAR: //"碍力傍己傈"
- break;
- case IDS_COMMAND_DYEINGHAIR:
- if (pszParam1)
- CmdDyeingHair(pszParam1);
- break;
- case IDS_COMMAND_DYEINGWEAR:
- if (pszParam1)
- CmdDyeingWear(pszParam1);
- break;
- case IDS_COMMAND_HAIRSTYLE:
- if (pszParam1)
- CmdHairStyle(pszParam1);
- break;
- case IDS_COMMAND_RESERVED3: // 酒捞袍捞抚
- if (pszParam1 && pszParam2)
- CmdChangeItemPrefix(pszParam1, pszParam2);
- break;
- case IDS_COMMAND_RESERVED4: // 哎公府
- {
- TCHAR wszMsg[64];
- char szMsg[64];
- m_fIsCapture = ~m_fIsCapture;
- if (m_fIsCapture)
- {
- LoadString(g_hInst, IDS_CAPTURE_ON, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
- m_hCaptureFile = fopen("capture.txt", "w+");
- }
- else
- {
- LoadString(g_hInst, IDS_CAPTURE_OFF, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
- fclose(m_hCaptureFile);
- }
- WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szMsg, sizeof(szMsg), NULL, NULL);
- SysMsg(szMsg, 1);
- break;
- }
- case IDS_COMMAND_RESERVED5:
- {
- int nX, nY;
- CScripterObject* pScripter = new CScripterObject;
- if (pScripter)
- {
- GetFrontPosition(nX, nY);
- pScripter->Create(nX, nY, m_pMap);
- g_xScripterList.AddNewNode(pScripter);
- }
- break;
- }
- }
- }
- return FALSE;
- }