ObjectPlayerAdminSaid.cpp
上传用户:tt_chan
上传日期:2009-12-03
资源大小:4523k
文件大小:8k
源码类别:

模拟服务器

开发平台:

Visual C++

  1. #include "stdafx.h"
  2. #define _MAX_ADMINCOMMAND_LIST (IDS_COMMAND_HAIRSTYLE - IDS_COMMAND_MONGEN + 1)
  3. void InitAdminCommandList()
  4. {
  5. TCHAR szCommand[64];
  6. int nLen;
  7. HINSTANCE hInstance = LoadLibrary(_T("AdminCmd.DLL"));
  8. if (hInstance)
  9. {
  10. for (int i = 0; i < _MAX_ADMINCOMMAND_LIST; i++)
  11. {
  12. LoadString(hInstance, IDS_COMMAND_MONGEN + i, szCommand, sizeof(szCommand)/sizeof(TCHAR));
  13. nLen = lstrlen(szCommand) * sizeof(TCHAR) + 1;
  14. char *pszAdminCommand = new char[nLen];
  15. if (pszAdminCommand)
  16. {
  17. WideCharToMultiByte(CP_ACP, 0, szCommand, -1, pszAdminCommand, nLen, NULL, NULL);
  18. g_xAdminCommandList.AddNewNode(pszAdminCommand);
  19. }
  20. }
  21. InsertLogMsgParam(IDS_LOAD_ADMINCOMMAND, &i, LOGPARAM_INT);
  22. FreeLibrary(hInstance);
  23. }
  24. }
  25. void UnInitAdminCommandList()
  26. {
  27. PLISTNODE pListNode = g_xAdminCommandList.GetHead();
  28. while (pListNode)
  29. {
  30. delete [] g_xAdminCommandList.GetData(pListNode);
  31. pListNode = g_xAdminCommandList.RemoveNode(pListNode);
  32. }
  33. }
  34. BOOL CPlayerObject::ProcessForAdminSaid(char *pszMsg)
  35. {
  36. if (pszMsg[0] == '@')
  37. {
  38. PLISTNODE pListNode = g_xAdminCommandList.GetHead();
  39. int nCommand = 0;
  40. char *pszParam1 = NULL, *pszParam2 = NULL, *pszParam3 = NULL, *pszParam4 = NULL;
  41. if ((pszParam1 = strchr(&pszMsg[1], ' ')))
  42. {
  43. *pszParam1 = '';
  44. pszParam1++;
  45. }
  46. char *pszData;
  47. while (pListNode)
  48. {
  49. pszData = (char *)g_xAdminCommandList.GetData(pListNode);
  50. if (memcmp(&pszMsg[1], pszData, memlen(pszData)) == 0)
  51. break;
  52. nCommand++;
  53. pListNode = g_xAdminCommandList.GetNext(pListNode);
  54. }
  55. if (nCommand >= _MAX_ADMINCOMMAND_LIST) return FALSE;
  56. if (pszParam1)
  57. {
  58. if (pszParam2 = strchr(pszParam1, ' '))
  59. {
  60. *pszParam2 = '';
  61. pszParam2++;
  62. if (pszParam3 = strchr(pszParam2, ' '))
  63. {
  64. *pszParam3 = '';
  65. pszParam3++;
  66. if (pszParam4 = strchr(pszParam3, ' '))
  67. {
  68. *pszParam4 = '';
  69. pszParam4++;
  70. }
  71. }
  72. }
  73. }
  74. switch (IDS_COMMAND_MONGEN + nCommand)
  75. {
  76. case IDS_COMMAND_MONGEN: //"各哩"
  77. if (pszParam1 && pszParam2)
  78. CmdCallMakeMonster(pszParam1, pszParam2);
  79. break;
  80. case IDS_COMMAND_INSPECTOR: //"皑矫磊"
  81. {
  82. TCHAR wszMsg[64];
  83. char szMsg[64];
  84. m_fInspector = ~m_fInspector;
  85. if (m_fInspector)
  86. LoadString(g_hInst, IDS_INSPECTOR_ON, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
  87. else
  88. LoadString(g_hInst, IDS_INSPECTOR_OFF, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
  89. WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szMsg, sizeof(szMsg), NULL, NULL);
  90. SysMsg(szMsg, 1);
  91. break;
  92. }
  93. case IDS_COMMAND_ADMIN: //"款康磊"
  94. break;
  95. case IDS_COMMAND_INVINCIBILITY: //"公利"
  96. {
  97. TCHAR wszMsg[64];
  98. char szMsg[64];
  99. m_fIsNeverDie = ~m_fIsNeverDie;
  100. if (m_fIsNeverDie)
  101. LoadString(g_hInst, IDS_NEVERDIE_ON, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
  102. else
  103. LoadString(g_hInst, IDS_NEVERDIE_OFF, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
  104. WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szMsg, sizeof(szMsg), NULL, NULL);
  105. SysMsg(szMsg, 1);
  106. break;
  107. }
  108. case IDS_COMMAND_ATTACK: //"傍拜"
  109. break;
  110. case IDS_COMMAND_MOVE: //"捞悼"
  111. if (pszParam1)
  112. CmdRandomSpaceMove(pszParam1);
  113. break;
  114. case IDS_COMMAND_CHANGELEVEL: //"饭骇炼沥"
  115. {
  116. if (pszParam1)
  117. {
  118. m_Ability.Level = m_pUserInfo->m_THumanRcd.szLevel = _MIN(40, AnsiStrToVal(pszParam1));
  119. HasLevelUp(1);
  120. }
  121. break;
  122. }
  123. case IDS_COMMAND_MOVEFREESTYLE: //"磊蜡捞悼"
  124. if (pszParam1 && pszParam2 && pszParam3)
  125. CmdFreeSpaceMove(pszParam1, pszParam2, pszParam3);
  126. break;
  127. case IDS_COMMAND_MAP: //"甘"
  128. {
  129. char szMsg[64];
  130. memcpy(szMsg, "MAP : ", 6);
  131. memcpy(&szMsg[6], m_pMap->m_szMapTextName, memlen(m_pMap->m_szMapTextName));
  132. SysMsg(szMsg, 0);
  133. break;
  134. }
  135. case IDS_COMMAND_LEVEL: //"肪"
  136. break;
  137. case IDS_COMMAND_MONLEVEL: //"各肪"
  138. CmdSendMonsterLevelInfos();
  139. break;
  140. case IDS_COMMAND_RECALL: //"家券"
  141. break;
  142. case IDS_COMMAND_NUMOFMON: //"各荐"
  143. break;
  144. case IDS_COMMAND_NUMOFHUMAN: //"荤恩荐"
  145. break;
  146. case IDS_COMMAND_SABUKMONEY: //"荤合己捣"
  147. break;
  148. case IDS_COMMAND_KICK: //"Kick"
  149. break;
  150. case IDS_COMMAND_KICK2: //"疟"
  151. break;
  152. case IDS_COMMAND_TING: //"泼"
  153. break;
  154. case IDS_COMMAND_KINGTING: //"空泼"
  155. break;
  156. case IDS_COMMAND_LUCKYVALUE: //"青款蔼"
  157. break;
  158. case IDS_COMMANT_SHUTUP: //"盲陛"
  159. break;
  160. case IDS_COMMAND_TALK: //"盲陛秦力"
  161. break;
  162. case IDS_COMMAND_SHUTUPMAN: //"盲陛磊"
  163. break;
  164. case IDS_COMMAND_RELOADADMIN: //"ReloadAdmin"
  165. break;
  166. case IDS_COMMAND_RELOADABUSIVE: //"垮汲沥焊佬扁"
  167. break;
  168. case IDS_COMMAND_MOOTAEBO: //"公怕焊"
  169. break;
  170. case IDS_COMMAND_BACKWALK: //"缔吧澜"
  171. break;
  172. case IDS_COMMAND_GAIN: //"积魂"
  173. if (pszParam1 && pszParam2)
  174. CmdMakeItem(pszParam1, pszParam2);
  175. break;
  176. case IDS_COMMAND_DELGOLD: //"捣昏力"
  177. break;
  178. case IDS_COMMAND_ADDGOLD: //"捣眠啊"
  179. break;
  180. case IDS_COMMAND_GOOD: //"拱扒"
  181. break;
  182. case IDS_COMMAND_OTHERDELGOLD: //"鸥牢捣昏力"
  183. break;
  184. case IDS_COMMAND_OTHERADDGOLD: //"鸥牢捣眠啊"
  185. break;
  186. case IDS_COMMAND_OTHERLEVELUP: //"鸥牢饭骇炼沥"
  187. break;
  188. case IDS_COMMAND_OTHEREXPUP: //"鸥牢版氰摹炼沥"
  189. break;
  190. case IDS_COMMAND_WEAPONDUR: //"公扁郴备炼沥"
  191. break;
  192. case IDS_COMMAND_PARDON: //"搁了"
  193. break;
  194. case IDS_COMMAND_PKPOINT: //"乔纳捞痢荐"
  195. break;
  196. case IDS_COMMAND_PKPOINTUP: //"乔纳捞痢荐刘啊"
  197. break;
  198. case IDS_COMMAND_CHANGELUCKY: //"青款函版"
  199. break;
  200. case IDS_COMMAND_SKILLUP: //"公傍荐访"
  201. if (pszParam1 && pszParam2)
  202. CmdMakeFullSkill(pszParam1, pszParam2);
  203. break;
  204. case IDS_COMMAND_OTHERSKILLUP: //"鸥牢公傍荐访"
  205. break;
  206. case IDS_COMMAND_DELSKILL: //"公傍昏力窍扁"
  207. break;
  208. case IDS_COMMAND_OTHERDELSKILL: //"鸥牢公傍昏力窍扁"
  209. break;
  210. case IDS_COMMAND_CHGJOB: //"傈诀"
  211. {
  212. if (pszParam1)
  213. {
  214. if (CmdChangeJob(pszParam1))
  215. HasLevelUp(1);
  216. }
  217. break;
  218. }
  219. case IDS_COMMAND_CHGGENDER: //"飘罚胶哩歹"
  220. {
  221. if (m_pUserInfo->m_THumanRcd.btGender == 0) m_pUserInfo->m_THumanRcd.btGender = m_tFeature.btGender = 1;
  222. else m_pUserInfo->m_THumanRcd.btGender = m_tFeature.btGender = 0;
  223. SysMsg(pszData, 1);
  224. break;
  225. }
  226. case IDS_COMMAND_COLOR: //"祸"
  227. break;
  228. case IDS_COMMAND_MONRECALL: //"各家券"
  229. {
  230. if (pszParam1 && pszParam2)
  231. CmdCallMakeSlaveMonster(pszParam1, pszParam2);
  232. break;
  233. }
  234. case IDS_COMMAND_MISSION: //"固记"
  235. break;
  236. case IDS_COMMAND_GENPOS: //"哩镑"
  237. {
  238. if (pszParam1 && pszParam2 && pszParam3 && pszParam4)
  239. CmdCallMakeMonsterXY(pszParam1, pszParam2, pszParam3, pszParam4);
  240. break;
  241. }
  242. case IDS_COMMAND_TRANSPARENCY: //"捧疙"
  243. break;
  244. case IDS_COMMAND_CIVILWAR: //"碍力傍己傈"
  245. break;
  246. case IDS_COMMAND_DYEINGHAIR:
  247. if (pszParam1)
  248. CmdDyeingHair(pszParam1);
  249. break;
  250. case IDS_COMMAND_DYEINGWEAR:
  251. if (pszParam1)
  252. CmdDyeingWear(pszParam1);
  253. break;
  254. case IDS_COMMAND_HAIRSTYLE:
  255. if (pszParam1)
  256. CmdHairStyle(pszParam1);
  257. break;
  258. case IDS_COMMAND_RESERVED3: // 酒捞袍捞抚
  259. if (pszParam1 && pszParam2)
  260. CmdChangeItemPrefix(pszParam1, pszParam2);
  261. break;
  262. case IDS_COMMAND_RESERVED4: // 哎公府
  263. {
  264. TCHAR wszMsg[64];
  265. char szMsg[64];
  266. m_fIsCapture = ~m_fIsCapture;
  267. if (m_fIsCapture)
  268. {
  269. LoadString(g_hInst, IDS_CAPTURE_ON, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
  270. m_hCaptureFile = fopen("capture.txt", "w+");
  271. }
  272. else
  273. {
  274. LoadString(g_hInst, IDS_CAPTURE_OFF, wszMsg, sizeof(wszMsg)/sizeof(TCHAR));
  275. fclose(m_hCaptureFile);
  276. }
  277. WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szMsg, sizeof(szMsg), NULL, NULL);
  278. SysMsg(szMsg, 1);
  279. break;
  280. }
  281. case IDS_COMMAND_RESERVED5:
  282. {
  283. int nX, nY;
  284. CScripterObject* pScripter = new CScripterObject;
  285. if (pScripter)
  286. {
  287. GetFrontPosition(nX, nY);
  288. pScripter->Create(nX, nY, m_pMap);
  289. g_xScripterList.AddNewNode(pScripter);
  290. }
  291. break;
  292. }
  293. }
  294. }
  295. return FALSE;
  296. }