ROAParse.cpp
资源名称:ROA3.40.rar [点击查看]
上传用户:tianheyiqi
上传日期:2010-04-16
资源大小:282k
文件大小:91k
源码类别:
外挂编程
开发平台:
Visual C++
- #include <stdafx.h>
- #define parseFunction(code)
- int parse##code(char *pBuffer, int nLen)
- {
- CString strOutput;
- strOutput.Format("[R] 0x%04X(%d) - %s", 0x##code, nLen, utlPrintHex(pBuffer, nLen));
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- #define parseFunction2(code, state1, state2)
- int parse##code(char *pBuffer, int nLen)
- {
- utlChangeState(state1, state2);
- return(0);
- }
- #define parseDeclare(code)
- int parse##code(char *pBuffer, int nLen)
- parseFunction(006E); // Unknown
- parseFunction(0089); // Unknown
- parseFunction(008F); // Unknown
- parseFunction(0093); // Unknown
- parseFunction(0096); // Unknown
- parseFunction(00A5); // Storage opened(UNRESOLVED)
- parseFunction(00A6); // Storage item(UNRESOLVED)
- parseFunction(00B4);
- parseFunction(00B7);
- parseFunction(00BC);
- parseFunction(00BD); // Your status(UNRESOLVED)
- parseFunction(00BE);
- parseFunction(00C0);
- parseFunction(00C1);
- parseFunction(00C2);
- parseFunction(00C3);
- parseFunction(00C4);
- parseFunction(00C6);
- parseFunction(00C7);
- parseFunction(00CA);
- parseFunction(00CB);
- parseFunction(00D1);
- parseFunction(00D2);
- parseFunction(00D3);
- parseFunction(00D6);
- parseFunction(00D7);
- parseFunction(00D8);
- parseFunction(00DA);
- parseFunction(00DB);
- parseFunction(00DC);
- parseFunction(00DD);
- parseFunction(00DF);
- parseFunction(00E1);
- parseFunction(00E4);
- parseFunction(00E7);
- parseFunction(00E9);
- parseFunction(00EA);
- parseFunction(00EC);
- parseFunction(00EE);
- parseFunction(00F0);
- parseFunction(00F2);
- parseFunction(00F4);
- parseFunction(00F6);
- parseFunction(00F8);
- parseFunction(00FA);
- parseFunction(00FD);
- parseFunction(00FE);
- parseFunction(0100);
- parseFunction(0101);
- parseFunction(0104);
- parseFunction(0105);
- parseFunction(0106);
- parseFunction(0107);
- parseFunction(0109);
- parseFunction(010A);
- parseFunction(010B);
- parseFunction(0110);
- parseFunction(0111);
- parseFunction(0115);
- parseFunction(011C);
- parseFunction(011E);
- parseFunction(0121);
- parseFunction(0125);
- parseFunction(012C);
- parseFunction(012D);
- parseFunction(0131);
- parseFunction(0132);
- parseFunction(0133);
- parseFunction(0135);
- parseFunction(0136);
- parseFunction(0137);
- parseFunction(013A);
- parseFunction(013B);
- parseFunction(0141);
- parseFunction(0145);
- parseFunction(0146);
- parseFunction(0148);
- parseFunction(014B);
- parseFunction(014C);
- parseFunction(014E);
- parseFunction(0150);
- parseFunction(0152);
- parseFunction(0154);
- parseFunction(0156);
- parseFunction(015A);
- parseFunction(015C);
- parseFunction(0160);
- parseFunction(0162);
- parseFunction(0163);
- parseFunction(0166);
- parseFunction(0167);
- parseFunction(0169);
- parseFunction(016A);
- parseFunction(016D);
- parseFunction(016F);
- parseFunction(0171);
- parseFunction(0173);
- parseFunction(0174);
- parseFunction(0177);
- parseFunction(0179);
- parseFunction(017F);
- parseFunction(0180);
- parseFunction(0182);
- parseFunction(0183);
- parseFunction(0187);
- parseFunction(018A);
- parseFunction(018B);
- parseFunction(018E);
- parseFunction(0191);
- parseFunction(0192);
- parseFunction(0193);
- parseFunction(0194);
- parseFunction(0199);
- parseFunction(019B);
- parseFunction(01A0);
- parseFunction(01A2);
- parseFunction(01A4);
- parseFunction(01A6);
- parseFunction(01AA);
- parseFunction(01AC);
- parseFunction(01AD);
- parseFunction(01B3);
- parseFunction(01B5);
- parseFunction(01B6);
- parseFunction(01B9);
- parseFunction(01C4);
- parseFunction(01C9);
- parseFunction(01D2);
- parseFunction(01D3);
- parseFunction(01D4);
- parseFunction(01D5);
- parseFunction(01D6);
- parseFunction(01D7);
- parseFunction(01DB);
- parseFunction(01DC);
- parseFunction(01DD);
- parseFunction(01DF);
- parseFunction(01E1);
- parseFunction(01F4);
- //EPS5.0
- parseFunction(014A);
- parseFunction(0181);
- parseFunction(018C);
- parseFunction(01AB);
- parseFunction(01B1);
- parseFunction(0075); // Unknown
- parseFunction(0077); // Unknown
- parseFunction(007A); // Unknown
- parseFunction(007F); // Sync received
- parseDeclare(0069); // Login master server completed
- parseDeclare(006A); // Login master server failed
- parseDeclare(006B); // Characters received
- parseDeclare(006C); // Login game server failed
- parseDeclare(0071); // Char ID and Map IP received
- parseDeclare(0073); // Your coordinates received
- parseDeclare(0078); // Something exits
- parseDeclare(01D8); // Something exits
- parseDeclare(0079); // Something connected
- parseDeclare(01D9); // Something connected
- parseDeclare(007B); // Something appeared/moved
- parseDeclare(01DA); // Something appeared/moved
- parseDeclare(007C); // Something spawned
- parseDeclare(0080); // Something disappeared
- parseDeclare(0087); // You moved
- parseDeclare(0088); // Long distance attack solution
- parseDeclare(008D); // Chat1
- parseDeclare(008E); // Chat2
- parseDeclare(0091); // Map changing from
- parseDeclare(0092); // Map changing to
- parseDeclare(0095); // Info received
- parseDeclare(0097); // Private message from
- parseDeclare(0098); // Private message sent result
- parseDeclare(009A); // Chat3
- parseDeclare(009C); // Look at
- parseDeclare(009D); // Item exists
- parseDeclare(009E); // Item appeared
- parseDeclare(008A); // Attack1
- parseDeclare(00A0); // Item added to inventory
- parseDeclare(00A1); // Item disappeared
- parseDeclare(00A3); // Inventory(Items) received
- parseDeclare(00A4); // Inventory(Equips) received
- parseDeclare(00A8); // You used item
- parseDeclare(00AA); // You equip
- parseDeclare(00AC); // You unequip
- parseDeclare(00AF); // Inventory(Items) removed
- parseDeclare(00B0); // Status received
- parseDeclare(00B1); // Exp/zenny received
- parseDeclare(00B5); // NPC talk continue
- parseDeclare(00B6); // NPC talk done
- parseDeclare(00E5); // Deal
- parseDeclare(00FB); // Partner info
- parseDeclare(0108); // Weapon changed element
- parseDeclare(010C); // MVP info
- parseDeclare(010E); // Skill used????
- parseDeclare(010F); // Skills received
- parseDeclare(0114); // Attack2
- parseDeclare(01DE); // Attack2
- parseDeclare(0117); // Skill use on loc
- parseDeclare(0119); // Your status(poison etc...)
- parseDeclare(011A); // Skill use on someone
- parseDeclare(011F); // Area effect skill
- parseDeclare(0120); // Area effect skill disappear
- parseDeclare(0122); // Cart (Non-Stackable Items)
- parseDeclare(0123); // Cart (Stackable Items)
- parseDeclare(0124); // Cart add
- parseDeclare(0139); // Remote attack
- parseDeclare(013C); // Arrow equipped
- parseDeclare(013D); // HP/SP gained
- parseDeclare(013E); // Skill cast
- parseDeclare(0147); //
- parseDeclare(016C); // Your guild name
- parseDeclare(0188); // Weapon changed element
- parseDeclare(0195); // Player name received
- parseDeclare(0196); // Two hands quicken
- parseDeclare(01A3); // Inventory
- parseDeclare(01B0); // Monster changed
- parseDeclare(01C8); // Someone use item
- parseDeclare(01D0); // Monk
- parseDeclare(019E);
- parseFunction2(0081, -1, 1);// (UNRESOLVED)
- parseFunction2(00B3, -1, 2);// Unknown
- int parseSendData(char *pBuffer, WORD wLen, BOOL bAi = false)
- {
- WORD wCmd = *((WORD*)pBuffer);
- WORD wCmdLen = *((WORD*)(pBuffer+2));
- BOOL bSend = true;
- char *pPara2;
- WORD wPara1, wPara2;
- DWORD dwPara1, dwPara2, dwPara3;
- BYTE bPara2;
- CString strTemp, strOutput;
- if(bAi)
- {
- if(nConnState < 5 || !bAiEnabled)
- {
- return(0);
- }
- }
- switch(wCmd)
- {
- case 0x0067:
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 0x0067: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0096: //private chat
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 私聊: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x007D: // Map loaded
- utlLogout("[S] 已载入地图", eLogCommon, bAi);
- // utlChangeState(-1, 5);
- break;
- case 0x0089: // Sit/Stand/Attack
- dwPara1 = *((DWORD*)(pBuffer+2));
- bPara2 = *(pBuffer+6);
- switch(bPara2)
- {
- case 2:
- strOutput = "[S] 坐下";
- break;
- case 3:
- strOutput = "[S] 站立";
- break;
- default:
- strOutput.Format("[S] 攻击 %s (模式%d)", utlFindTarget(dwPara1), bPara2);
- break;
- }
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00A7: // Item use
- wPara1 = *((WORD*)(pBuffer+2));
- dwPara2 = *((DWORD*)(pBuffer+4));
- strOutput.Format("[S] 使用 %s", utlFindTargetInventory(wPara1));
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0072: // Map login
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput = "[S] 登录地图服务器: " + strTemp;
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0064: // Master login
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput = "[S] 登录主服务器: ";
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0085: // Move
- strOutput.Format("[S] 移动至: (%d, %d)",
- utlMakeCoords((BYTE*)pBuffer+2).x,
- utlMakeCoords((BYTE*)pBuffer+2).y);
- utlLogout(strOutput, eLogInfo, bAi);
- break;
- case 0x0113: // Skill use
- wPara1 = *((WORD*)(pBuffer+2));
- wPara2 = *((WORD*)(pBuffer+4));
- dwPara3 = *((DWORD*)(pBuffer+6));
- strOutput.Format("[S] 对 %s 使用 %d 级 %s",
- utlFindTarget(dwPara3),
- wPara1,
- mapSkill.FindValue(wPara2, eSkillAlias));
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0116: // Skill use loc
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput = "[S] 对地面使用技能: " + strTemp;
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x007E: // Sync
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput = "[S] 与服务器同步: " + strTemp;
- utlLogout(strOutput, eLogInfo, bAi);
- break;
- case 0x009F: // Take
- dwPara1 = *((DWORD*)(pBuffer+2));
- strOutput.Format("[S] 捡取 %s", utlFindTargetItem(dwPara1));
- utlLogout(strOutput, eLogCommon, bAi);
- if(bAi && (!option.bAutoPickup || you.bSit))
- {
- strOutput.Format("[S] 取消捡取 %s", utlFindTargetItem(dwPara1));
- utlLogout(strOutput, eLogError, true);
- bSend = false;
- }
- break;
- case 0x0094: // Get info
- dwPara1 = *((DWORD*)(pBuffer+2));
- strOutput.Format("[S] 获取信息: %X", dwPara1);
- utlLogout(strOutput, eLogInfo, bAi);
- break;
- case 0x0112: // Add skill point
- wPara1 = *((WORD*)(pBuffer+2));
- strOutput.Format("[S] 添加技能点数: %X", wPara1);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00BB: // Add status point
- wPara1 = *((WORD*)(pBuffer+2));
- strOutput.Format("[S] 添加属性点数: %X", wPara1);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0118: // Attack stop
- strOutput.Format("[S] 停止攻击");
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0066: // Char login
- wPara1 = *(BYTE*)(pBuffer+2);
- if(wPara1 >=0 && wPara1 <= 2)
- {
- nCharSelected = (int)wPara1;
- you = youTemp[nCharSelected];
- strTemp = you.cName;
- utlReadUserProfile();
- bWelcomeSent = false;
- }
- strOutput.Format("[S] 选择%d号人物: %s", wPara1, strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x008C: // Chat
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 公聊: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00DE: // Chat room change
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 聊天室名称变更: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00D5: // Chat room create
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 创建聊天室: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00D9: // Chat room join
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 进入聊天室: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00E2: // Chat room kick
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 聊天室踢人: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00E3: // Chat room leave
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 离开聊天室: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00ED: // Deal cancel
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 取消交易: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00E4: // Deal
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 交易物品确定: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00E6: // Deal accept/cancel
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 交易接受/取消: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00E8: // Deal add item
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 交易中放置物品: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00EB: // Deal finalize
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 结束交易: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00EF: // Deal trade
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 交易确定: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00A2: // Drop
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 扔掉物品/装备: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00BF: // Emotion
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 表情: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00A9: // Equip
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 装备物品(装备): %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0065: // Game login
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 登录游戏服务器: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00C5: // Get store list
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 获得商店列表: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x017E: // Char guild
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 会聊: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0178: // Identify
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 鉴定: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00CF: // Ignore
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 忽略玩家: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00D0: // Ignore all
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 忽略所有玩家: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00D3: // Get ignore list
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 获取忽略玩家列表: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x009B: // Look
- strOutput.Format("[S] 方向: 脸(%d) 身(%d)", *(pBuffer+2), *(pBuffer+4));
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x011D: // Memo
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 记录传送点: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0108: // Party chat
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 队聊: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00FF: // Party join
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 加入队伍: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00FC: // Party join request
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 聊请加入队伍: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0103: // Party kick
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 队伍中踢出: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0100: // Party leave
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 离开队伍: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00F9: // Party organize
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 组队: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0102: // Party share exp
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 组队经验分配方式: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00F3: // Storage add
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 仓库中添加物品: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00F7: // Storage close
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 仓库关闭: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00F5: // Storage get
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 仓库中取出物品: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0090: // Talk
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 与NPC对话(开始): %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00B9: // Talk continue
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 与NPC对话(继续): %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x0146: // Talk cancel
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 与NPC对话(取消): %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00B8: // Talk response
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 与NPC对话(选择): %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00AB: // Unequip
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 卸下物品(装备): %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00C1: // Who
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 查看在线人数: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x00B2: // Respawn
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 回到人物选择画面: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- utlChangeState(-1, 4);
- you.init();
- utlInitMapChangeVars();
- bAiEnabled = false;
- break;
- case 0x018A: // Quit
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 登出游戏: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- utlChangeState(-1, 1);
- you.init();
- utlInitMapChangeVars();
- bAiEnabled = false;
- break;
- case 0x011B: // Teleport
- wPara1 = *((WORD*)(pBuffer+2));
- if(wPara1 == 0x001A)
- {
- pPara2 = pBuffer+4;
- strOutput.Format("[S] 瞬移: %s", pPara2);
- utlLogout(strOutput, eLogCommon, bAi);
- }
- break;
- case 0x0151: // unknown
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 0x0151: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- case 0x019F: // Capture monsters
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 0x019F: %s", strTemp);
- utlLogout(strOutput, eLogCommon, bAi);
- break;
- default: // Default
- strTemp = utlPrintHex(pBuffer, wLen);
- strOutput.Format("[S] 未知封包: %s", strTemp);
- utlLogout(strOutput, eLogError, bAi);
- }
- if(bSend)
- {
- sendToServerByInject(pBuffer, wLen);
- }
- return(wLen);
- }
- #define PARSE(code, LEN)
- case 0x##code:
- if(LEN == 0)
- {
- if(cmdlen != 0)
- nParsed = cmdlen;
- else
- nParsed = 999999;
- }else if(LEN == -1)
- {
- nParsed = -1;
- }else
- {
- nParsed = LEN;
- }
- if(nParsed != 999999 && nParsed <= wPacketLen)
- {
- strTemp.Format(_T("(%d/%d) %s"), wPacketLen, nParsed, utlPrintHex(pBuffer, nParsed));
- utlLogout(strTemp, eLogDebug, false);
- if(nParsed != -1)
- parse##code(pBuffer, nParsed);
- else
- parse##code(pBuffer, wPacketLen);
- }
- break;
- int parseRecvData(char *pBuffer, WORD wPacketLen)
- {
- static nErrorCnt = 0;
- WORD wCmd;
- WORD cmdlen = 0;
- CString strTemp;
- wCmd = *((WORD*)pBuffer);
- if(wPacketLen >= 4)
- cmdlen = *((WORD*)(pBuffer+2));
- // TRACE("Packlen = %d, cmdlen = %d, cmd = 0x%04Xn", wPacketLen, cmdlen, wCmd);
- /* if (wPacketLen >= 4 &&
- *((DWORD*)pBuffer) != dwAccountId &&
- nConnState >= 4 &&
- wLastCmd != wCmd &&
- wPacketLen >= wCmdLen)
- {
- decrypt($msg, $msg);
- }
- */
- int nParsed = -1;
- if( dwAccountId &&
- (*((DWORD*)pBuffer) == dwAccountId) &&
- (nConnState == 4 || nConnState == 2))
- {
- nParsed = 4;
- return(nParsed);
- }
- switch(wCmd)
- {
- PARSE(0069, 0); // Login master server completed
- PARSE(006A, 23); // Login master server failed
- PARSE(006B, -1); // Characters received
- PARSE(006C, -1); // Login game server failed
- PARSE(006E, 2); // Unknown
- PARSE(0071, 28); // Char ID and Map IP received
- PARSE(0073, 11); // Your coordinates received
- PARSE(0075, 11); // Unknown
- PARSE(0077, 4); // Unknown
- PARSE(0078, 54); // Something exits
- PARSE(0079, 53); // Something connected
- PARSE(007A, 4); // Unknown
- PARSE(007B, 60); // Something appeared/moved
- PARSE(007C, 41); // Something spawned
- PARSE(007F, 6); // Sync received
- PARSE(0080, 7); // Something disappeared
- PARSE(0081, 3); // (UNRESOLVED)
- PARSE(0087, 12); // You moved
- PARSE(0088, 10); // Long distance attack solution
- PARSE(0089, 2); // Unknown
- PARSE(008A, 29); // Attack1
- PARSE(008D, 0); // Chat1
- PARSE(008E, 0); // Chat2
- PARSE(008F, 4); // Unknown
- PARSE(0091, 22); // Map changing from
- PARSE(0092, 28); // Map changing to
- PARSE(0093, 2); // Unknown
- PARSE(0095, 30); // Info received
- PARSE(0096, 43); // Unknown
- PARSE(0097, 0); // Private message from
- PARSE(0098, 3); // Private message sent result
- PARSE(009A, 0); // Chat3
- PARSE(009C, 9); // Look at
- PARSE(009D, 17); // Item exists
- PARSE(009E, 17); // Item appeared
- PARSE(00A0, 23); // Item added to inventory
- PARSE(00A1, 6); // Item disappeared
- PARSE(00A3, 0); // Inventory(Items) received
- PARSE(00A4, 0); // Inventory(Equips) received
- PARSE(00A5, 0); // Storage opened(UNRESOLVED)
- PARSE(00A6, 0); // Storage item(UNRESOLVED)
- PARSE(00A8, 7); // You used item
- PARSE(00AA, 7); // You equip
- PARSE(00AC, 7); // You unequip
- PARSE(00AF, 6); // Inventory(Items) removed
- PARSE(00B0, 8); // Status received
- PARSE(00B1, 8); // Exp/zenny received
- PARSE(00B3, 3); // Unknown
- PARSE(00B4, 0); // NPC talk
- PARSE(00B5, 6); // NPC talk to continue
- PARSE(00B6, 6); // NPC done talking
- PARSE(00B7, 0); // NPC response
- PARSE(00BC, 6); // Add stat point
- PARSE(00BD, 44); // Your status(UNRESOLVED)
- PARSE(00BE, 5); // Points need to upgrade stats
- PARSE(00C0, 7); // Emotion
- PARSE(00C1, 4); // Unknown
- PARSE(00C2, 6); // Who
- PARSE(00C3, 8); // Unknown
- PARSE(00C4, 6); // NPC BUY/SELL
- PARSE(00C6, 0);
- PARSE(00C7, 0);
- PARSE(00CA, 3);
- PARSE(00CB, 3);
- PARSE(00D1, 4);
- PARSE(00D2, 4);
- PARSE(00D3, 2);
- PARSE(00D6, 3);
- PARSE(00D7, 0);
- PARSE(00D8, 6);
- PARSE(00DA, 3);
- PARSE(00DB, 0);
- PARSE(00DC, 28);
- PARSE(00DD, 29);
- PARSE(00DF, 0);
- PARSE(00E1, 30);
- PARSE(00E4, 34);
- PARSE(00E5, 26);
- PARSE(00E7, 3);
- PARSE(00E9, 19);
- PARSE(00EA, 5);
- PARSE(00EC, 3);
- PARSE(00EE, 2);
- PARSE(00F0, 3);
- PARSE(00F2, 6);
- PARSE(00F4, 21);
- PARSE(00F6, 8);
- PARSE(00F8, 2);
- PARSE(00FA, 3);
- PARSE(00FB, 0);
- PARSE(00FD, 27);
- PARSE(00FE, 30);
- PARSE(0100, 4);
- PARSE(0101, 6);
- PARSE(0104, 79);
- PARSE(0105, 31);
- PARSE(0106, 10);
- PARSE(0107, 10);
- PARSE(0108, 8);//new
- PARSE(0109, 0);
- PARSE(010A, 4);
- PARSE(010B, 6);
- PARSE(010C, 6);
- PARSE(010E, 11); // Skill used????
- PARSE(010F, 0); // Skills received
- PARSE(0110, 10);
- PARSE(0111, 39);
- PARSE(0114, 31);
- PARSE(0115, 16);
- PARSE(0117, 18);
- PARSE(0119, 13);
- PARSE(011A, 15);
- PARSE(011C, 4);
- PARSE(011E, 3);
- PARSE(011F, 16);
- PARSE(0120, 6);
- PARSE(0121, 14);
- PARSE(0122, 0);
- PARSE(0123, 0);
- PARSE(0124, 21);
- PARSE(0125, 8);
- PARSE(012C, 26);
- PARSE(012D, 4);
- PARSE(0131, 86);
- PARSE(0132, 6);
- PARSE(0133, 0);
- PARSE(0135, 7);
- PARSE(0136, 0);
- PARSE(0137, 6);
- PARSE(0139, 16);
- PARSE(013A, 4);
- PARSE(013B, 4);
- PARSE(013C, 4);
- PARSE(013D, 6);
- PARSE(013E, 24);
- PARSE(0141, 14);
- PARSE(0145, 19);
- PARSE(0147, 39);
- PARSE(0148, 8);
- PARSE(014A, 6); //new
- PARSE(014B, 27);
- PARSE(014C, 0);
- PARSE(014E, 6);
- PARSE(0150, 110);
- PARSE(0152, 0);
- PARSE(0154, 0);
- PARSE(0156, 0);
- PARSE(015A, 66);
- PARSE(015C, 90);
- PARSE(0160, 0);
- PARSE(0162, 0);
- PARSE(0163, 0);
- PARSE(0166, 0);
- PARSE(0167, 3);
- PARSE(0169, 3);
- PARSE(016A, 30);
- PARSE(016C, 43);
- PARSE(016D, 14);
- PARSE(016F, 182);
- PARSE(0171, 30);
- PARSE(0173, 3);
- PARSE(0174, 0);
- PARSE(0177, 0);
- PARSE(0179, 5);
- PARSE(017F, 0);
- PARSE(0180, 11);
- PARSE(0181, 3); //new
- PARSE(0182, 106);
- PARSE(0183, 15);
- PARSE(0187, 6);
- PARSE(0188, 8);
- PARSE(018A, 3);
- PARSE(018B, 4);
- PARSE(018C, 29);
- PARSE(018E, 97);
- PARSE(0191, 86);
- PARSE(0192, 24);
- PARSE(0193, 6);
- PARSE(0194, 30);
- PARSE(0195, 102);
- PARSE(0196, 9);
- PARSE(0199, 4);
- PARSE(019B, 10);
- PARSE(019E, 2);
- PARSE(01A0, 3);
- PARSE(01A2, 35);
- PARSE(01A3, 5);
- PARSE(01A4, 11);
- PARSE(01A6, 0);
- PARSE(01AA, 10);
- PARSE(01AB, 12); //new
- PARSE(01AC, 6);
- PARSE(01AD, 0);
- PARSE(01B0, 11);
- PARSE(01B1, 15); //new
- PARSE(01B3, 67);
- PARSE(01B5, 18);
- PARSE(01B6, 114);
- PARSE(01B9, 6);
- PARSE(01C4, 22);
- PARSE(01C8, 13);
- PARSE(01C9, 97);
- PARSE(01D0, 8); // Monk
- PARSE(01D2, 10);
- PARSE(01D3, 35);
- PARSE(01D4, 6);
- PARSE(01D5, 8);
- PARSE(01D6, 12);
- PARSE(01D7, 11);
- PARSE(01D8, 54);
- PARSE(01D9, 53);
- PARSE(01DA, 60);
- PARSE(01DB, 2);
- PARSE(01DC, 0);
- PARSE(01DD, 47);
- PARSE(01DE, 33);
- PARSE(01DF, 6);
- PARSE(01E1, 19);
- PARSE(01F4, 7);
- default:
- strTemp.Format("(%d/%d) 未知封包: %s", nParsed, wPacketLen, utlPrintHex(pBuffer, wPacketLen));
- utlLogout(strTemp, eLogError, false);
- break;
- }
- return(nParsed);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Login master server completed
- int parse0069(char *pBuffer, int nLen)
- {
- CString strOutput;
- int i;
- utlChangeState(-1, 2);
- dwSessionId = *(DWORD*)(pBuffer+4);
- dwAccountId = *(DWORD*)(pBuffer+8);
- BYTE nSex = *(pBuffer+46);
- strOutput.Format("[R] 登录主服务器成功");
- utlLogout(strOutput, eLogCommon, false);
- strOutput.Format("[R] AID: %8X, SID: %08X, 性别: %s", dwAccountId, dwSessionId, mapSex.FindValue(nSex));
- utlLogout(strOutput, eLogCommon, false);
- strOutput.Format("[R] 游戏服务器列表: ------->");
- utlLogout(strOutput, eLogCommon, false);
- for(i=47; i<nLen; i+=32)
- {
- strOutput.Format(" %s: IP: %d.%d.%d.%d, 端口: %d, 用户数: %d",
- pBuffer+i+6,
- *((BYTE*)(pBuffer+i)),
- *((BYTE*)(pBuffer+i+1)),
- *((BYTE*)(pBuffer+i+2)),
- *((BYTE*)(pBuffer+i+3)),
- *((WORD*)(pBuffer+i+4)),
- *((DWORD*)(pBuffer+i+26)));
- utlLogout(strOutput, eLogCommon, false);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Login master server failed
- int parse006A(char *pBuffer, int nLen)
- {
- CString strOutput;
- BYTE byType;
- byType = *(pBuffer+2);
- strOutput = "[R] 登录主服务器失败: ";
- switch(byType)
- {
- case 0:
- strOutput += "不存在该帐号!";
- break;
- case 1:
- strOutput += "密码错误!";
- break;
- case 3:
- strOutput += "服务器拒绝连接!";
- break;
- case 4:
- strOutput += "帐号已被冻结!";
- break;
- case 5:
- strOutput += "游戏版本不符!";
- break;
- case 6:
- strOutput += "暂时无法与服务器连接!";
- break;
- default:
- strOutput += "未知错误!";
- break;
- }
- utlLogout(strOutput, eLogError, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Characters received
- int parse006B(char *pBuffer, int nLen)
- {
- CString strOutput;
- int i;
- int nIdx = 0;
- DWORD temp;
- utlChangeState(-1, 3);
- strOutput.Format("[R] 人物列表: ------->");
- utlLogout(strOutput, eLogCommon, false);
- int nStartPos = option.bTestServer? 24 : 4;
- for(i=nStartPos; i<nLen; i+=106)
- {
- nIdx = *((BYTE*)(pBuffer+i+104));
- youTemp[nIdx].dwExp = *((DWORD*)(pBuffer+i+4));
- youTemp[nIdx].dwZenny = *((DWORD*)(pBuffer+i+8));
- youTemp[nIdx].dwJobExp = *((DWORD*)(pBuffer+i+12));
- youTemp[nIdx].wJobLevel = *((BYTE*)(pBuffer+i+16));
- youTemp[nIdx].wHp = *((WORD*)(pBuffer+i+42));
- youTemp[nIdx].wHpMax = *((WORD*)(pBuffer+i+44));
- youTemp[nIdx].wSp = *((WORD*)(pBuffer+i+46));
- youTemp[nIdx].wSpMax = *((WORD*)(pBuffer+i+48));
- temp = *((BYTE*)(pBuffer+i+52));
- strcpy(youTemp[nIdx].cJob, mapJob.FindValue(temp));
- youTemp[nIdx].wLevel = *((BYTE*)(pBuffer+i+58));
- strncpy(youTemp[nIdx].cName, (pBuffer+i+74), MAX_NAME_LENGTH);
- // youTemp[nIdx].byStr = *((BYTE*)(pBuffer+i+98));
- // youTemp[nIdx].byAgi = *((BYTE*)(pBuffer+i+99));
- // youTemp[nIdx].byVit = *((BYTE*)(pBuffer+i+100));
- // youTemp[nIdx].byInt = *((BYTE*)(pBuffer+i+101));
- // youTemp[nIdx].byDex = *((BYTE*)(pBuffer+i+102));
- // youTemp[nIdx].byLuk = *((BYTE*)(pBuffer+i+103));
- strOutput.Format(" [%d] %s: 职业: %s, 级别: %d Zenny: %d", nIdx,
- pBuffer+i+74,
- mapJob.FindValue(*((BYTE*)(pBuffer+i+52))),
- *((BYTE*)(pBuffer+i+58)),
- *((DWORD*)(pBuffer+i+8)) );
- utlLogout(strOutput, eLogCommon, false);
- }
- ufAutoSaClassChange(0);
- if(bAutoSearch)
- ufAutoSearchMvp(0);
- utlInitMapChangeVars();
- you.init();
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Login game server failed
- int parse006C(char *pBuffer, int nLen)
- {
- CString strOutput;
- utlChangeState(-1, 1);
- strOutput.Format("[R] 登录游戏服务器失败: 非法人物编号!");
- utlLogout(strOutput, eLogError, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Char ID and Map IP received
- int parse0071(char *pBuffer, int nLen)
- {
- char cMapName[16+1];
- CString strMap, strOutput;
- CString strIP, strPort;
- utlChangeState(-1, 4);
- strOutput.Format("[R] 与地图服务器连接成功");
- utlLogout(strOutput, eLogCommon, false);
- strncpy(cMapName, pBuffer+6, 16);
- strMap = cMapName;
- strMap.TrimRight();
- if(strMap.GetLength() > 4 && strMap.Right(4) == ".gat")
- {
- strMap = strMap.Left(strMap.GetLength()-4);
- }
- CString strTemp = strMap;
- strTemp += ".rsw";
- field.init(strMap, mapMapName.FindValue(strTemp));
- strIP.Format(_T("%d.%d.%d.%d"), (BYTE)pBuffer[22], (BYTE)pBuffer[23], (BYTE)pBuffer[24], (BYTE)pBuffer[25]);
- strPort.Format(_T("%d"), *(WORD*)(pBuffer+26));
- strOutput.Format("[R] 地图名: %s 服务器IP: %s 端口: %s", strMap, strIP, strPort);
- utlLogout(strOutput, eLogCommon, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Your coordinates received
- int parse0073(char *pBuffer, int nLen)
- {
- POINT pnt;
- CString strOutput;
- pnt = utlMakeCoords((BYTE*)(pBuffer+6));
- strOutput.Format("[R] 人物坐标: (%d, %d)", pnt.x, pnt.y);
- utlLogout(strOutput, eLogCommon, false);
- utlLogout("[R] 等待客户端载入地图数据......", eLogCommon, false);
- utlInitMapChangeVars();
- you.pntPos = pnt;
- you.pntTo = pnt;
- bFlyUsed = false;
- dwAutoSearchTick = 0;
- curFunc = NULL;
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Something exits
- int parse0078(char *pBuffer, int nLen)
- {
- DWORD dwId;
- POINT pnt;
- WORD wType;
- BYTE bySex;
- BYTE byPet;
- BYTE bySitting;
- WORD wFrozen;
- CString strOutput, strTemp;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- pnt = utlMakeCoords((BYTE*)(pBuffer+46));
- wType = *((WORD*)(pBuffer+14));
- bySex = *(pBuffer+45);
- byPet = *(pBuffer+16);
- bySitting = *(pBuffer+51);
- wFrozen = *((WORD*)(pBuffer+8));
- int nIndex;
- if(wType >= 1000)
- {
- if(byPet)
- {
- //Pet
- }
- else
- {
- // Monster
- MONSTER mon;
- nIndex = monsters.FindId(dwId);
- if(-1 == nIndex)
- {
- // Appear
- mon.dwId = dwId;
- mon.wType = wType;
- strcpy(mon.cName, mapMonster.FindValue(mon.wType, 0));
- nIndex = monsters.Add(mon);
- }
- else
- {
- mon = monsters.GetAt(nIndex);
- }
- mon.pntPos = pnt;
- mon.pntTo = pnt;
- mon.wFrozen = wFrozen;
- monsters.SetAt(nIndex, mon);
- strOutput.Format("[R] 在 (%d, %d) 发现 %s", pnt.x, pnt.y, mon.cName);
- utlLogout(strOutput, eLogInfo, false);
- if(utlIsMvpMonster(mon))
- {
- if(mode == eModeNormal)
- utlReportMonsterToParty(dwId);
- utlChangeMode(eModeMvp, dwId);
- }
- }
- }
- else
- {
- BOOL bFound;
- mapJob.FindValue(wType, -1, &bFound);
- if(bFound)
- {
- // Player
- PLAYER player;
- nIndex = players.FindId(dwId);
- if(-1 == nIndex)
- {
- player.dwAppearTime = GetTickCount();
- player.dwId = dwId;
- player.wType = wType;
- player.bySex = bySex;
- strcpy(player.cName, "Unknown");
- nIndex = players.Add(player);
- }
- else
- {
- player = players.GetAt(nIndex);
- }
- player.pntPos = pnt;
- player.pntTo = pnt;
- player.bSit = (bySitting > 0);
- players.SetAt(nIndex, player);
- strOutput.Format("[R] 在 (%d, %d) 发现 %s", pnt.x, pnt.y, player.cName);
- utlLogout(strOutput, eLogInfo, false);
- utlCheckForGm(player);
- }
- else
- {
- if(45 == wType)
- {
- // Portal
- PORTAL portal;
- nIndex = portals.FindId(dwId);
- if(-1 == nIndex)
- {
- portal.dwAppearTime = GetTickCount();
- portal.dwId = dwId;
- portal.wType = wType;
- nIndex = portals.Add(portal);
- }
- else
- {
- portal = portals.GetAt(nIndex);
- }
- portal.pntPos = pnt;
- portals.SetAt(nIndex, portal);
- strOutput.Format("[R] 在 (%d, %d) 发现 传送点(0x%08X)", pnt.x, pnt.y, portal.dwId);
- utlLogout(strOutput, eLogInfo, false);
- }
- else
- {
- strOutput.Format("[R] 在 (%d, %d) 发现 NPC(0x%08X)", pnt.x, pnt.y, dwId);
- utlLogout(strOutput, eLogInfo, false);
- }
- }
- }
- return(0);
- }
- int parse01D8(char *pBuffer, int nLen)
- {
- return(parse0078(pBuffer, nLen));
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Something connected
- int parse0079(char *pBuffer, int nLen)
- {
- DWORD dwId;
- POINT pnt;
- WORD wType;
- BYTE bySex;
- CString strOutput, strTemp;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- pnt = utlMakeCoords((BYTE*)(pBuffer+46));
- wType = *((WORD*)(pBuffer+14));
- bySex = *(pBuffer+45);
- int nIndex;
- PLAYER player;
- BOOL bFound;
- mapJob.FindValue(wType, -1, &bFound);
- if(bFound)
- {
- nIndex = players.FindId(dwId);
- if(-1 == nIndex)
- {
- player.dwAppearTime = GetTickCount();
- player.dwId = dwId;
- player.wType = wType;
- player.bySex = bySex;
- strcpy(player.cName, "Unknown");
- nIndex = players.Add(player);
- }
- else
- {
- player = players.GetAt(nIndex);
- }
- player.pntPos = pnt;
- player.pntTo = pnt;
- players.SetAt(nIndex, player);
- strOutput.Format("[R] 在 (%d, %d) 发现 %s 连接", pnt.x, pnt.y, utlFindTarget(dwId));
- utlLogout(strOutput, eLogInfo, false);
- utlCheckForGm(player);
- }
- else
- {
- // Unknown
- }
- return(0);
- }
- // Something connected
- int parse01D9(char *pBuffer, int nLen)
- {
- return(parse0079(pBuffer, nLen));
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Something appeared/moved
- int parse007B(char *pBuffer, int nLen)
- {
- DWORD dwId;
- POINT pntFrom, pntTo;
- WORD wType;
- BYTE byPet;
- BYTE bySex;
- CString strOutput, strTemp;
- LOG_LEVEL logLevel = eLogInfo;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- pntFrom = utlMakeCoords((BYTE*)(pBuffer+50));
- pntTo = utlMakeCoords2((BYTE*)(pBuffer+52));
- wType = *((WORD*)(pBuffer+14));
- byPet = *(pBuffer+16);
- bySex = *(pBuffer+49);
- int nIndex;
- if(wType >= 1000)
- {
- if(byPet)
- {
- ;
- }
- else
- {
- // Monster
- MONSTER mon;
- nIndex = monsters.FindId(dwId);
- if(-1 == nIndex)
- {
- // Appear
- mon.dwId = dwId;
- mon.wType = wType;
- mon.pntPos = pntFrom;
- mon.pntTo = pntTo;
- strcpy(mon.cName, mapMonster.FindValue(mon.wType, 0));
- nIndex = monsters.Add(mon);
- }
- else
- {
- mon = monsters.GetAt(nIndex);
- }
- mon.pntPos = pntFrom;
- mon.pntTo = pntTo;
- monsters.SetAt(nIndex, mon);
- strOutput.Format("[R] %s 从 (%d, %d) 移动至 (%d, %d)",
- utlFindTarget(mon.dwId), pntFrom.x, pntFrom.y, pntTo.x, pntTo.y);
- utlLogout(strOutput, eLogInfo, false);
- if(utlIsMvpMonster(mon))
- {
- if(mode == eModeNormal)
- utlReportMonsterToParty(dwId);
- utlChangeMode(eModeMvp, dwId);
- }
- }
- }
- else
- {
- BOOL bFound;
- mapJob.FindValue(wType, -1, &bFound);
- if(bFound)
- {
- // player
- PLAYER player;
- nIndex = players.FindId(dwId);
- if(-1 == nIndex)
- {
- // Appear
- player.dwAppearTime = GetTickCount();
- player.dwId = dwId;
- player.wType = wType;
- player.bySex = bySex;
- strcpy(player.cName, "Unknown");
- nIndex = players.Add(player);
- }
- else
- {
- player = players.GetAt(nIndex);
- }
- player.pntPos = pntFrom;
- player.pntTo = pntTo;
- players.SetAt(nIndex, player);
- strOutput.Format("[R] %s 从 (%d, %d) 移动至 (%d, %d)", utlFindTarget(dwId), pntFrom.x, pntFrom.y, pntTo.x, pntTo.y);
- utlLogout(strOutput, eLogInfo, false);
- }
- else
- {
- // Unknown
- }
- }
- return(0);
- }
- int parse01DA(char *pBuffer, int nLen)
- {
- return(parse007B(pBuffer, nLen));
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Something spawned
- int parse007C(char *pBuffer, int nLen)
- {
- DWORD dwId;
- POINT pnt;
- WORD wType;
- BYTE bySex;
- CString strOutput, strTemp;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- pnt = utlMakeCoords((BYTE*)(pBuffer+36));
- wType = *((WORD*)(pBuffer+20));
- bySex = *(pBuffer+35);
- int nIndex;
- if(wType >= 1000)
- {
- MONSTER mon;
- // Monster
- nIndex = monsters.FindId(dwId);
- if(-1 == nIndex)
- {
- // Appear
- mon.dwId = dwId;
- mon.wType = wType;
- strcpy(mon.cName, mapMonster.FindValue(mon.wType, 0));
- nIndex = monsters.Add(mon);
- }
- else
- {
- mon = monsters.GetAt(nIndex);
- }
- mon.pntPos = pnt;
- mon.pntTo = pnt;
- monsters.SetAt(nIndex, mon);
- strOutput.Format("[R] 发现 %s", utlFindTarget(dwId), pnt.x, pnt.y);
- utlLogout(strOutput, eLogInfo, false);
- if(utlIsMvpMonster(mon))
- {
- if(mode == eModeNormal)
- utlReportMonsterToParty(dwId);
- utlChangeMode(eModeMvp, dwId);
- }
- }
- else
- {
- BOOL bFound;
- mapJob.FindValue(wType, -1, &bFound);
- if(bFound)
- {
- PLAYER player;
- nIndex = players.FindId(dwId);
- if(-1 == nIndex)
- {
- // Appear
- player.dwAppearTime = GetTickCount();
- player.dwId = dwId;
- player.wType = wType;
- player.bySex = bySex;
- strcpy(player.cName, "Unknown");
- nIndex = players.Add(player);
- }
- else
- {
- player = players.GetAt(nIndex);
- }
- player.pntPos = pnt;
- player.pntTo = pnt;
- players.SetAt(nIndex, player);
- strOutput.Format("[R] 在 (%d, %d) 发现 %s", pnt.x, pnt.y, utlFindTarget(player.dwId));
- utlLogout(strOutput, eLogInfo, false);
- utlCheckForGm(player);
- }
- else
- {
- // Unknown
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // something disappeared
- int parse0080(char *pBuffer, int nLen)
- {
- DWORD dwId;
- BYTE bType;
- int nIndex;
- CString strOutput, strTemp;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- bType = *(pBuffer+6);
- strOutput = "Unknown(0x0080)";
- LOG_LEVEL logLevel = eLogInfo;
- if(dwId == dwAccountId)
- {
- //you died
- strOutput = "[R] 你 死亡了";
- logLevel = eLogError;
- sendChatParty(_T("我挂了55555555,9人哪~~~~~~"));
- strTemp = _T("你已死亡,停止所有AI");
- injectAdminMessage(strTemp);
- you.bDied = true;
- bAiEnabled = false;
- }
- else
- {
- nIndex = monsters.FindId(dwId);
- if(-1 != nIndex)
- {
- // Monster
- MONSTER mon;
- mon = monsters[nIndex];
- CString strTemp;
- switch(bType)
- {
- case 0:
- strOutput.Format("[R] %s 消失了", utlFindTarget(dwId));
- strTemp = _T("消失了");
- break;
- case 1:
- strOutput.Format("[R] %s 死亡了", utlFindTarget(dwId));
- if(utlIsMvpMonster(mon))
- {
- utlShowAttackResult(nIndex);
- utlSetMonsterDiedTime(mon.cName);
- }
- strTemp = _T("死亡了");
- break;
- default:
- strOutput.Format("[R] %s 瞬移了", utlFindTarget(dwId));
- strTemp = _T("瞬移了");
- break;
- }
- if(utlIsMvpMonster(mon))
- {
- CString strMsg;
- CTime time = CTime::GetCurrentTime();
- strMsg.Format(_T("[%d:%d:%d] %s%s..."), time.GetHour(), time.GetMinute(), time.GetSecond(),
- monsters[nIndex].cName, strTemp);
- sendChatParty(strMsg);
- utlChangeMode(eModeNormal, 0);
- }
- monsters.RemoveAt(nIndex);
- damages.RemoveDamage(dwId);
- logLevel = eLogCommon;
- }
- else
- {
- nIndex = players.FindId(dwId);
- if(-1 != nIndex)
- {
- // Player
- PLAYER player;
- player = players[nIndex];
- switch(bType)
- {
- case 0:
- strOutput.Format("[R] %s 消失了", utlFindTarget(dwId));
- break;
- case 1:
- strOutput.Format("[R] %s 死亡了", utlFindTarget(dwId));
- break;
- case 2:
- strOutput.Format("[R] %s 断线了", utlFindTarget(dwId));
- break;
- default:
- strOutput.Format("[R] %s 瞬移了", utlFindTarget(dwId));
- break;
- }
- if(utlCheckForGm(player))
- {
- utlGMDisappeared(player);
- }
- if(bType != 1)
- {
- players.RemoveAt(nIndex);
- damages.RemoveDamage(dwId);
- }
- }
- else
- {
- nIndex = portals.FindId(dwId);
- if(-1 != nIndex)
- {
- // Portal
- PORTAL portal;
- portal = portals[nIndex];
- strOutput.Format("[R] 传送点(0x%08X) 消失了", portal.dwId);
- portals.RemoveAt(nIndex);
- }
- else
- {
- strOutput.Format("[R] NPC(0x%08X) 消失了", dwId);
- }
- }
- }
- }
- utlLogout(strOutput, logLevel, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // You moved
- int parse0087(char *pBuffer, int nLen)
- {
- POINT pntFrom, pntTo;
- CString strOutput;
- pntFrom = utlMakeCoords((BYTE*)(pBuffer+6));
- pntTo = utlMakeCoords2((BYTE*)(pBuffer+8));
- you.pntPos = pntFrom;
- you.pntTo = pntTo;
- strOutput.Format("[R] 你 从 (%d, %d) 移动至 (%d, %d)", pntFrom.x, pntFrom.y, pntTo.x, pntTo.y);
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Long distance attack solution
- int parse0088(char *pBuffer, int nLen)
- {
- POINT pnt;
- DWORD dwId;
- int nIndex;
- CString strOutput = "parse0088";
- dwId = *((DWORD*)(pBuffer+2));
- pnt.x = *(WORD*)(pBuffer+6);
- pnt.y = *(WORD*)(pBuffer+8);
- if(dwId == dwAccountId)
- {
- strOutput.Format("[R] 你 移动至 (%d, %d) [被攻击]", pnt.x, pnt.y);
- you.pntPos = pnt;
- you.pntTo = pnt;
- }
- else
- {
- nIndex = players.FindId(dwId);
- if(-1 != nIndex)
- {
- PLAYER player;
- player = players[nIndex];
- player.pntPos = pnt;
- player.pntTo = pnt;
- players.SetAt(nIndex, player);
- strOutput.Format("[R] %s 移动至 (%d, %d) [被攻击]", utlFindTarget(dwId));
- }
- else
- {
- nIndex = monsters.FindId(dwId);
- if(-1 != nIndex)
- {
- MONSTER monster;
- monster = monsters[nIndex];
- monster.pntPos = pnt;
- monster.pntTo = pnt;
- strOutput.Format("[R] %s 移动至 (%d, %d) [被攻击]", utlFindTarget(dwId));
- }
- }
- }
- utlLogout(strOutput, eLogCommon, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Chat1
- int parse008D(char *pBuffer, int nLen)
- {
- DWORD dwId;
- CString strOutput, strCheck;
- char cChat[MAX_CHAT_MSG+1];
- dwId = *((DWORD*)(pBuffer+4));
- memset(cChat, 0, MAX_CHAT_MSG+1);
- strncpy(cChat, pBuffer+8, (nLen-8>MAX_CHAT_MSG)?MAX_CHAT_MSG:(nLen-8));
- strOutput.Format("[R] 008D(%08X): %s", dwId, cChat);
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Chat2
- int parse008E(char *pBuffer, int nLen)
- {
- CString strOutput;
- char cChat[MAX_CHAT_MSG+1];
- memset(cChat, 0, MAX_CHAT_MSG+1);
- strncpy(cChat, pBuffer+4, (nLen-4)>MAX_CHAT_MSG?MAX_CHAT_MSG:(nLen-4));
- strOutput.Format("[R] 你 发言: %s", cChat);
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Map changing from
- int parse0091(char *pBuffer, int nLen)
- {
- CString strMap, strOutput;
- WORD x, y;
- char cMapName[16+1];
- utlChangeState(-1, 4);
- strncpy(cMapName, pBuffer+2, 16);
- strMap = cMapName;
- strMap.TrimRight();
- x = *((WORD*)(pBuffer+18));
- y = *((WORD*)(pBuffer+20));
- if(strMap.GetLength() > 4 && strMap.Right(4) == ".gat")
- {
- strMap = strMap.Left(strMap.GetLength()-4);
- }
- CString strTemp = strMap;
- strTemp += ".rsw";
- field.init(strMap, mapMapName.FindValue(strTemp));
- strOutput.Format("[R] 准备更换地图: %s(%s)@(%d, %d)", field.m_strAlias, strMap, x, y);
- utlLogout(strOutput, eLogCommon, false);
- utlInitMapChangeVars();
- you.pntPos.x = x;
- you.pntPos.y = y;
- you.pntTo.x = x;
- you.pntTo.y = y;
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Map changing to
- int parse0092(char *pBuffer, int nLen)
- {
- CString strMap, strOutput;
- char cMapName[16+1];
- utlChangeState(-1, 4);
- strncpy(cMapName, pBuffer+2, 16);
- strMap = cMapName;
- strMap.TrimRight();
- if(strMap.GetLength() > 4 && strMap.Right(4) == ".gat")
- {
- strMap = strMap.Left(strMap.GetLength()-4);
- }
- CString strTemp = strMap;
- strTemp += ".rsw";
- field.init(strMap, mapMapName.FindValue(strTemp));
- strOutput.Format("[R] 地图更换至: %s(%s)", field.m_strAlias, strMap);
- utlLogout(strOutput, eLogCommon, false);
- utlInitMapChangeVars();
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Info received
- int parse0095(char *pBuffer, int nLen)
- {
- CString strOutput;
- DWORD dwId;
- CString strName;
- char cName[MAX_NAME_LENGTH+1];
- int nIndex;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- memset(cName, 0, MAX_NAME_LENGTH+1);
- strncpy(cName, pBuffer+6, MAX_NAME_LENGTH);
- strName = cName;
- strName.TrimRight();
- if(dwId != dwAccountId)
- {
- nIndex = players.FindId(dwId);
- if(-1 != nIndex)
- {
- strcpy(players[nIndex].cName, strName);
- if(utlCheckForGmByName(players[nIndex]))
- {
- utlGMAppeared(players[nIndex]);
- }
- }
- else
- {
- nIndex = monsters.FindId(dwId);
- if(-1 != nIndex)
- {
- strcpy(monsters[nIndex].cName, strName);
- }
- }
- }
- strOutput.Format("[R] 收到 %08X 信息: %s", dwId, strName);
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Private message from
- int parse0097(char *pBuffer, int nLen)
- {
- CString strOutput;
- char cFrom[MAX_NAME_LENGTH+1];
- char cMsg[MAX_CHAT_MSG+1];
- CString strCheck;
- utlChangeState(4, 5);
- memset(cFrom, 0, MAX_NAME_LENGTH+1);
- memset(cMsg, 0, MAX_CHAT_MSG+1);
- strncpy(cFrom, pBuffer+4, MAX_NAME_LENGTH);
- strncpy(cMsg, pBuffer+28, (nLen - 29)>MAX_CHAT_MSG?MAX_CHAT_MSG:(nLen - 29));
- strOutput.Format("[R] %s 密 你: %s", cFrom, cMsg);
- utlLogout(strOutput, eLogCommon, false);
- for(int i=0; i<players.GetSize(); i++)
- {
- if(stricmp(players[i].cName, cFrom) == 0)
- {
- if(utlCheckForWanzi(players[i].cGuild))
- {
- sendEmotion(0);
- break;
- }
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Private message sent result
- int parse0098(char *pBuffer, int nLen)
- {
- CString strOutput;
- BYTE byType;
- byType = *(pBuffer+2);
- strOutput = "[R] 密聊信息 ";
- switch(byType)
- {
- case 0:
- strOutput += "已发送";
- break;
- case 1:
- strOutput += "无法发送: 玩家不在线!";
- break;
- case 2:
- strOutput += "无法发送: 你已被忽略!";
- break;
- default:
- strOutput += "无法发送: 未知错误!";
- }
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Chat3
- int parse009A(char *pBuffer, int nLen)
- {
- CString strOutput;
- CString strCheck;
- char cChat[MAX_CHAT_MSG+1];
- memset(cChat, 0, MAX_CHAT_MSG+1);
- strncpy(cChat, pBuffer+4, (nLen-4)>MAX_CHAT_MSG?MAX_CHAT_MSG:(nLen-4));
- strOutput.Format("[R] GM公告: %s", cChat);
- utlLogout(strOutput, eLogCommon, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Look at
- int parse009C(char *pBuffer, int nLen)
- {
- CString strOutput;
- DWORD dwId;
- BYTE byBody, byHead;
- int nIndex;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- byBody = *(pBuffer+8);
- byHead = *(pBuffer+6);
- if(dwId == dwAccountId)
- {
- you.byLookBody = byBody;
- you.byLookHead = byHead;
- strOutput.Format("[R] 你 的方向: 头:%d 身体:%d", byHead, byBody);
- utlLogout(strOutput, eLogCommon, false);
- }
- else
- {
- nIndex = players.FindId(dwId);
- if(-1 != nIndex)
- {
- players[nIndex].byLookBody = byBody;
- players[nIndex].byLookHead = byHead;
- strOutput.Format("[R] %s 的方向: 头:%d 身体:%d ", utlFindTarget(dwId), byHead, byBody);
- utlLogout(strOutput, eLogInfo, false);
- }
- else
- {
- nIndex = monsters.FindId(dwId);
- if(-1 != nIndex)
- {
- monsters[nIndex].byLookBody = byBody;
- monsters[nIndex].byLookHead = byHead;
- strOutput.Format("[R] %s 的方向: 头:%d 身体:%d", utlFindTarget(dwId), byHead, byBody);
- utlLogout(strOutput, eLogInfo, false);
- }
- else
- {
- // Unknown
- }
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Item exists
- int parse009D(char *pBuffer, int nLen)
- {
- DWORD dwId;
- POINT pnt;
- WORD wType;
- WORD wAmount;
- CString strOutput, strTemp;
- int nIndex;
- ITEM item;
- LOG_LEVEL eLogLevel = eLogInfo;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- wType = *((WORD*)(pBuffer+6));
- pnt.x = *((WORD*)(pBuffer+9));
- pnt.y = *((WORD*)(pBuffer+11));
- wAmount = *((WORD*)(pBuffer+13));
- nIndex = items.FindId(dwId);
- if(-1 == nIndex)
- {
- item.dwId = dwId;
- item.dwAppearTime = GetTickCount();
- item.wAmount = wAmount;
- item.wType = wType;
- item.ePriority = (ITEMPRIORITY)atoi(mapItem.FindValue(wType, eItemPriority));
- nIndex = items.Add(item);
- }
- else
- {
- item = items.GetAt(nIndex);
- }
- item.pntPos = pnt;
- items.SetAt(nIndex, item);
- strOutput.Format("[R] 在 (%d,%d) 发现 %s X %d", pnt.x, pnt.y, utlFindTargetItem(dwId), wAmount);
- if(item.ePriority == eIpGrab)
- {
- eLogLevel = eLogError;
- utlLogout4(strOutput);
- }
- else
- {
- items.RemoveAt(nIndex);
- }
- utlLogout(strOutput, eLogLevel, false);
- if(utlDistanceFrom(item.pntPos, you.pntTo) <= option.nPickupDistance && item.ePriority <= eIpPickup)
- {
- sendTake(item.dwId);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Item appeared
- int parse009E(char *pBuffer, int nLen)
- {
- DWORD dwId;
- POINT pnt;
- WORD wType;
- WORD wAmount;
- CString strOutput, strTemp;
- int nIndex;
- ITEM item;
- LOG_LEVEL eLogLevel = eLogInfo;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- wType = *((WORD*)(pBuffer+6));
- pnt.x = *((WORD*)(pBuffer+9));
- pnt.y = *((WORD*)(pBuffer+11));
- wAmount = *((WORD*)(pBuffer+15));
- nIndex = items.FindId(dwId);
- if(-1 == nIndex)
- {
- item.dwId = dwId;
- item.dwAppearTime = GetTickCount();
- item.wAmount = wAmount;
- item.wType = wType;
- item.ePriority = (ITEMPRIORITY)atoi(mapItem.FindValue(wType, eItemPriority));
- nIndex = items.Add(item);
- }
- else
- {
- item = items.GetAt(nIndex);
- }
- item.pntPos = pnt;
- items.SetAt(nIndex, item);
- strOutput.Format("[R] 在 (%d,%d) 发现 %s X %d ", pnt.x, pnt.y, utlFindTargetItem(dwId), wAmount);
- if(item.ePriority <= eIpGrab)
- {
- eLogLevel = eLogError;
- utlLogout4(strOutput);
- }
- else
- {
- items.RemoveAt(nIndex);
- }
- utlLogout(strOutput, eLogLevel, false);
- if(utlDistanceFrom(item.pntPos, you.pntTo) <= option.nPickupDistance && item.ePriority <= eIpPickup)
- {
- sendTake(item.dwId);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Item added to inventory
- int parse00A0(char *pBuffer, int nLen)
- {
- INVENTORY inv;
- CString strTemp;
- BYTE byFail;
- int nIndex;
- WORD wAmount;
- utlChangeState(4, 5);
- utlParseInventory(pBuffer+2, &inv, 0x00A0);
- byFail = *(pBuffer+22);
- wAmount = inv.wAmount;
- switch(byFail)
- {
- case 0:
- nIndex = inventory.FindIndex(inv.dwIndex);
- if(-1 != nIndex)
- {
- inv.wAmount += inventory[nIndex].wAmount;
- inventory.SetAt(nIndex, inv);
- }
- else
- {
- inventory.Add(inv);
- }
- strTemp.Format("[R] 你 取得 %s %d个", utlGetInventoryName(&inv), wAmount);
- utlLogout(strTemp, eLogCommon, false);
- break;
- case 6:
- strTemp.Format("[R] 你 无法取得 %s", utlGetInventoryName(&inv));
- utlLogout(strTemp, eLogError, false);
- if(-1 != items.FindId(inv.dwId))
- {
- // if(items[items.FindId(inv.dwId)].ePriority == eIpGrab)
- items[items.FindId(inv.dwId)].nPickupFailed++;
- }
- break;
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Item disappeared
- int parse00A1(char *pBuffer, int nLen)
- {
- CString strOutput;
- int nIndex;
- DWORD dwId;
- LOG_LEVEL eLogLevel = eLogInfo;
- utlChangeState(4, 5);
- dwId = *((DWORD*)(pBuffer+2));
- nIndex = items.FindId(dwId);
- if(-1 != nIndex)
- {
- strOutput.Format("[R] %s 消失了", utlFindTargetItem(dwId));
- if(items[nIndex].ePriority <= eIpGather)
- eLogLevel = eLogError;
- utlLogout(strOutput, eLogLevel, false);
- items.RemoveAt(nIndex);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Inventory(Items) received
- int parse00A3(char *pBuffer, int nLen)
- {
- INVENTORY item;
- int i;
- CString strTemp;
- int nIndex;
- utlChangeState(4, 5);
- utlLogout("[R] 物品列表: ------->", eLogCommon, false);
- for(i=0; i<nLen-4; i+=10)
- {
- memset(&item, 0, sizeof(INVENTORY));
- item.dwIndex = *((WORD*)(pBuffer+4+i+0));
- item.dwId = *((WORD*)(pBuffer+4+i+2));
- item.wType = *(pBuffer+4+i+4);
- item.wAmount = *((WORD*)(pBuffer+4+i+6));
- nIndex = inventory.FindId(item.dwIndex);
- if(-1 != nIndex)
- inventory.SetAt(nIndex, item);
- else
- inventory.Add(item);
- strTemp.Format(_T(" [%2d] %-20s X %d"),
- item.dwIndex, mapItem.FindValue(item.dwId, eItemName),
- item.wAmount);
- utlLogout(strTemp, eLogCommon, false);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Inventory(Equips) received
- int parse00A4(char *pBuffer, int nLen)
- {
- int i;
- int nIndex;
- CString strTemp;
- utlChangeState(4, 5);
- utlLogout("[R] 装备列表: ------->", eLogCommon, false);
- for(i=0; i<nLen-4; i+=20)
- {
- INVENTORY inv;
- utlParseInventory(pBuffer+4+i, &inv, 0x00A4);
- nIndex = inventory.FindIndex(inv.dwIndex);
- if(-1 != nIndex)
- inventory.SetAt(nIndex, inv);
- else
- inventory.Add(inv);
- strTemp.Format(_T(" [%2d] %-20s | 鉴定: %s | 装备: %s"),
- inv.dwIndex, utlGetInventoryName(&inv),
- (inv.bIdentified?_T("是"):_T("否")),
- (inv.wEquipped?mapEquipType.FindValue(inv.wEquipType):_T("否")));
- utlLogout(strTemp, eLogCommon, false);
- }
- if(bAutoSearch && dwAutoSearchTick == 0)
- {
- dwAutoSearchTick = GetTickCount() + option.nAutoSearchDelay;
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // You used item
- int parse00A8(char *pBuffer, int nLen)
- {
- CString strOutput;
- WORD wIndex;
- BYTE byAmount;
- int i;
- utlChangeState(4, 5);
- wIndex = *((WORD*)(pBuffer+2));
- byAmount = *(pBuffer+6);
- i = inventory.FindIndex(wIndex);
- if(i != -1)
- {
- inventory[i].wAmount -= byAmount;
- if(inventory[i].wAmount <= 0)
- inventory.RemoveAt(i);
- strOutput.Format("[R] 你使用了 %s X %d", utlGetInventoryName(&inventory[i]), byAmount);
- utlLogout(strOutput, eLogCommon, false);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Remove item
- int parse01A3(char *pBuffer, int nLen)
- {
- CString strOutput;
- // WORD wIndex;
- // BYTE byAmount;
- // int i;
- // utlChangeState(4, 5);
- strOutput.Format("[R] 01A3");
- utlLogout(strOutput, eLogError, false);
- /*
- wIndex = *((WORD*)(pBuffer+4));
- byAmount = *(pBuffer+3);
- i = inventory.FindIndex(wIndex);
- if(i != -1)
- {
- strOutput.Format("<<< You used %s X %d",
- mapItem.FindValue(inventory[i].dwId, eItemName),
- byAmount);
- utlLogout(strOutput, eLogError, false);
- inventory[i].wAmount -= byAmount;
- if(inventory[i].wAmount <= 0)
- inventory.RemoveAt(i);
- }
- */
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // You equip
- int parse00AA(char *pBuffer, int nLen)
- {
- CString strOutput;
- WORD wIndex, wType;
- BYTE byFailed;
- int i;
- utlChangeState(4, 5);
- wIndex = *((WORD*)(pBuffer+2));
- wType = *((WORD*)(pBuffer+4));
- byFailed = *(pBuffer+6);
- i = inventory.FindIndex(wIndex);
- if(i != -1)
- {
- if(0 != byFailed)
- {
- inventory[i].wEquipped = wType;
- strOutput.Format("[R] 你 装备了 %s", utlGetInventoryName(&inventory[i]));
- utlLogout(strOutput, eLogCommon, false);
- }
- else
- {
- strOutput.Format("[R] 你无法装备 %s", utlGetInventoryName(&inventory[i]));
- utlLogout(strOutput, eLogError, false);
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // You unequip
- int parse00AC(char *pBuffer, int nLen)
- {
- CString strOutput;
- WORD wIndex, wType;
- BYTE byFailed;
- int i;
- utlChangeState(4, 5);
- wIndex = *((WORD*)(pBuffer+2));
- wType = *((WORD*)(pBuffer+4));
- byFailed = *(pBuffer+6);
- i = inventory.FindIndex(wIndex);
- if(i != -1)
- {
- if(0 == byFailed)
- {
- strOutput.Format("[R] 你 无法卸除 %s", utlGetInventoryName(&inventory[i]));
- utlLogout(strOutput, eLogError, false);
- }
- else
- {
- inventory[i].wEquipped = 0;
- strOutput.Format("[R] 你卸除 %s", utlGetInventoryName(&inventory[i]));
- utlLogout(strOutput, eLogCommon, false);
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Inventory(Items) removed
- int parse00AF(char *pBuffer, int nLen)
- {
- CString strOutput;
- WORD wIndex, wAmount;
- int i;
- utlChangeState(4, 5);
- wIndex = *((WORD*)(pBuffer+2));
- wAmount = *((WORD*)(pBuffer+4));
- i = inventory.FindIndex(wIndex);
- if(i != -1)
- {
- strOutput.Format("[R] 移除 %s X %d", utlGetInventoryName(&inventory[i]), wAmount);
- utlLogout(strOutput, eLogCommon, false);
- inventory[i].wAmount -= wAmount;
- if(inventory[i].wAmount <= 0)
- inventory.RemoveAt(i);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Status received
- int parse00B0(char *pBuffer, int nLen)
- {
- WORD wType, wVal;
- wType = *((WORD*)(pBuffer+2));
- wVal = *((WORD*)(pBuffer+4));
- CString strType, strOutput;
- // utlChangeState(4, 5);
- switch(wType)
- {
- case 5:
- strType = "HP";
- you.wHp = wVal;
- utlCheckForAutoHeal();
- break;
- case 6:
- strType = "HP Max";
- you.wHpMax = wVal;
- break;
- case 7:
- strType = "SP";
- you.wSp = wVal;
- utlCheckForAutoHeal();
- break;
- case 8:
- strType = "SP Max";
- you.wSpMax = wVal;
- break;
- case 9:
- strType = "Status points";
- break;
- case 11:
- strType = "Level";
- you.wLevel = wVal;
- break;
- case 12:
- strType = "Skill points";
- break;
- case 24:
- strType = "Weight";
- you.dwWeight = wVal;
- break;
- case 25:
- strType = "Weight Max";
- you.dwWeightMax = wVal;
- break;
- case 41:
- strType = "Attack";
- break;
- case 42:
- strType = "Attack bonus";
- break;
- case 43:
- strType = "Magic attack min";
- break;
- case 44:
- strType = "Magic attack max";
- break;
- case 45:
- strType = "Defense";
- break;
- case 46:
- strType = "Defense bonus";
- break;
- case 47:
- strType = "Magic defense";
- break;
- case 48:
- strType = "Magic defense bonus";
- break;
- case 49:
- strType = "Hit";
- break;
- case 50:
- strType = "Flee";
- break;
- case 51:
- strType = "Flee bonus";
- break;
- case 52:
- strType = "Critical";
- break;
- case 53:
- strType = "Attack speed";
- break;
- case 54:
- strType = "Job level";
- you.wJobLevel = wVal;
- break;
- default:
- strType.Format("未知(%d)", wType);
- break;
- }
- strOutput.Format("[R] 人物属性 %s: %d", strType, wVal);
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Exp/zenny received
- int parse00B1(char *pBuffer, int nLen)
- {
- WORD wType;
- DWORD dwVal;
- wType = *((WORD*)(pBuffer+2));
- dwVal = *((DWORD*)(pBuffer+4));
- CString strType, strOutput;
- // utlChangeState(4, 5);
- switch(wType)
- {
- case 1:
- strType = "Exp";
- you.dwExp = dwVal;
- break;
- case 2:
- strType = "ExpJob";
- you.dwJobExp = dwVal;
- break;
- case 20:
- strType = "Zenny";
- you.dwZenny = dwVal;
- break;
- case 22:
- strType = "ExpMax";
- you.dwExpMax = dwVal;
- break;
- case 23:
- strType = "ExpJobMax";
- you.dwJobExpMax = dwVal;
- break;
- default:
- strType.Format("Something(%d)", wType);
- break;
- }
- strOutput.Format("[R] 人物信息 %s: %d", strType, dwVal);
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // MVP info
- int parse010C(char *pBuffer, int nLen)
- {
- DWORD dwId;
- CString strOutput;
- dwId = *((DWORD*)(pBuffer+2));
- strOutput.Format(_T("%s 成为MVP啦~~~"), utlFindTarget(dwId));
- utlLogout4(strOutput);
- strOutput.Format(_T("[R] %s 成为MVP啦~~~"), utlFindTarget(dwId));
- utlLogout(strOutput, eLogError, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Skill used
- int parse010E(char *pBuffer, int nLen)
- {
- WORD wId, wLevel;
- CString strOutput;
- wId = *((WORD*)(pBuffer+2));
- wLevel = *((WORD*)(pBuffer+4));
- strOutput.Format("[R] 你 使用了 %d 级 %d", wLevel, mapSkill.FindValue(wId, eSkillAlias));
- utlLogout(strOutput, eLogCommon, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Skills received
- int parse010F(char *pBuffer, int nLen)
- {
- CString strOutput;
- int i, j;
- WORD wId, wLevel;
- char cName[MAX_NAME_LENGTH+1];
- SKILL skill;
- CString strSkillName;
- // utlChangeState(4, 5);
- skills.RemoveAll();
- utlLogout("[R] 技能列表: ------->", eLogCommon, false);
- for(i=4; i<nLen; i+=37)
- {
- wId = *((WORD*)(pBuffer+i));
- memset(cName, 0, MAX_NAME_LENGTH+1);
- strncpy(cName, pBuffer+i+12, MAX_NAME_LENGTH);
- strSkillName = cName;
- wLevel = *((WORD*)(pBuffer+i+6));
- memset(&skill, 0, sizeof(SKILL));
- skill.dwIndex = (i-4)/37;
- for(j=0; j<mapSkill.GetCount(); j++)
- {
- if(0 == strSkillName.CompareNoCase(mapSkill.FindValue(j, eSkillName)))
- {
- skill.dwId = j;
- break;
- }
- }
- if(0 == skill.dwId)
- {
- skill.dwId = wId;
- }
- skill.wLevel = wLevel;
- skills.Add(skill);
- strOutput.Format(_T(" [%2d] %-16s %2d级"), skill.dwIndex,
- mapSkill.FindValue(skill.dwId, eSkillAlias), wLevel);
- utlLogout(strOutput, eLogCommon, false);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Attack1
- int parse008A(char *pBuffer, int nLen)
- {
- CString strOutput, strTemp;
- DWORD dwSource, dwTarget;
- WORD wStanding, wDamage;
- DAMAGE damage;
- LOG_LEVEL logLevel = eLogInfo;
- utlChangeState(4, 5);
- dwSource = *((DWORD*)(pBuffer+2));
- dwTarget = *((DWORD*)(pBuffer+6));
- wStanding = *((WORD*)(pBuffer+26)) - 2;
- wDamage = *((WORD*)(pBuffer+22));
- damage.init();
- if(0 == dwTarget)
- {
- // Sit/stand
- if(dwSource == dwAccountId)
- {
- you.bSit = !wStanding;
- if(you.bSit)
- strOutput = "[R] 你 已坐下";
- else
- strOutput = "[R] 你 已站立";
- logLevel = eLogCommon;
- }
- if(-1 != players.FindId(dwSource))
- {
- players[players.FindId(dwSource)].bSit = !wStanding;
- if(!wStanding)
- strOutput.Format("[R] %s 已坐下", utlFindTarget(dwSource));
- else
- strOutput.Format("[R] %s 已站立", utlFindTarget(dwSource));
- logLevel = eLogInfo;
- }
- }
- else
- {
- if(-1 != items.FindId(dwTarget))
- {
- // Pick item
- strOutput.Format("[R] %s 捡取了 %s", utlFindTarget(dwSource), utlFindTargetItem(dwTarget));
- logLevel = eLogError;
- utlLogout4(strOutput);
- }
- else
- {
- if(dwTarget == dwAccountId)
- {
- you.wHp -= wDamage;
- you.bSit = false;
- utlCheckForAutoHeal();
- }
- utlUpdateDamage(dwSource, dwTarget, wDamage, 0);
- strOutput.Format("[R] %s 攻击 %s 伤害:%s", utlFindTarget(dwSource), utlFindTarget(dwTarget), utlCalculateHits(wDamage));
- if(dwTarget == dwAccountId || dwSource == dwAccountId)
- logLevel = eLogCommon;
- }
- }
- utlLogout(strOutput, logLevel, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Skill cast
- int parse013E(char *pBuffer, int nLen)
- {
- DWORD dwSource, dwTarget;
- WORD x, y;
- WORD wSkillId;
- LOG_LEVEL logLevel = eLogInfo;
- CString strOutput, strSkill;
- WORD wCastTime;
- utlChangeState(4, 5);
- dwSource = *((DWORD*)(pBuffer+2));
- dwTarget = *((DWORD*)(pBuffer+6));
- x = *((WORD*)(pBuffer+10));
- y = *((WORD*)(pBuffer+12));
- wSkillId = *((WORD*)(pBuffer+14));
- wCastTime = *((WORD*)(pBuffer+20));
- BOOL bTarget = false;
- strSkill = mapSkill.FindValue(wSkillId, eSkillAlias);
- for(int i=0; i<monsters.GetSize() && !bTarget; i++)
- {
- if((dwTarget == monsters[i].dwId) || (monsters[i].pntTo.x == x && monsters[i].pntTo.y == y) || (monsters[i].pntPos.x == x && monsters[i].pntPos.y == y))
- {
- monsters[i].nProtecting = wSkillId;
- strOutput.Format(_T("[R] %s 开始对 %s 使用 %s 需要时间: %d ms"), utlFindTarget(dwSource), monsters[i].cName, strSkill, wCastTime);
- bTarget = true;
- }
- }
- for(i=0; i<players.GetSize() && !bTarget; i++)
- {
- if((dwTarget == players[i].dwId) || (players[i].pntTo.x == x && players[i].pntTo.y == y) || (players[i].pntPos.x == x && players[i].pntPos.y == y))
- {
- players[i].nProtecting = wSkillId;
- strOutput.Format(_T("[R] %s 开始对 %s 使用 %s 需要时间: %d ms"), utlFindTarget(dwSource), players[i].cName, strSkill, wCastTime);
- bTarget = true;
- }
- }
- if(dwTarget == dwAccountId && !bTarget)
- {
- you.nProtecting = wSkillId;
- strOutput.Format(_T("[R] %s 开始对 你 使用 %s 需要时间: %d ms"), utlFindTarget(dwSource), strSkill, wCastTime);
- bTarget = true;
- }
- if(!bTarget)
- {
- strOutput.Format(_T("[R] %s 开始对 (%d,%d) 使用 %s 需要时间: %d ms"), utlFindTarget(dwSource), x, y, strSkill, wCastTime);
- bTarget = true;
- }
- if(strSkill.CompareNoCase(_T("光之障壁")) == 0 || strSkill.CompareNoCase(_T("暗之障壁")) == 0)
- utlLogout4(strOutput);
- utlLogout(strOutput, eLogInfo, false);
- if(dwSource == dwAccountId && bAutoSa)
- {
- int nIndex = utlFindSkillByAlias(_T("取消施法"));
- if(nIndex != -1 && you.wSp >= 2)
- {
- sendUseSkill(skills[nIndex].wLevel, (unsigned short)skills[nIndex].dwId, dwAccountId);
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Skill cast on loc
- int parse0117(char *pBuffer, int nLen)
- {
- DWORD dwSource;
- WORD x, y;
- WORD wLevel, wSkillId;
- LOG_LEVEL logLevel = eLogInfo;
- CString strOutput, strSkill;
- utlChangeState(4, 5);
- wSkillId = *((WORD*)(pBuffer+2));
- dwSource = *((DWORD*)(pBuffer+4));
- wLevel = *((WORD*)(pBuffer+8));
- x = *((WORD*)(pBuffer+10));
- y = *((WORD*)(pBuffer+12));
- BOOL bTarget = false;
- strSkill = mapSkill.FindValue(wSkillId, eSkillAlias);
- for(int i=0; i<monsters.GetSize() && !bTarget; i++)
- {
- if((monsters[i].pntTo.x == x && monsters[i].pntTo.y == y) || (monsters[i].pntPos.x == x && monsters[i].pntPos.y == y))
- {
- monsters[i].nProtecting = 0;
- strOutput.Format(_T("[R] %s 对 %s 使用了 %d级%s"), utlFindTarget(dwSource), monsters[i].cName, wLevel, strSkill);
- bTarget = true;
- }
- }
- for(i=0; i<players.GetSize() && !bTarget; i++)
- {
- if((players[i].pntTo.x == x && players[i].pntTo.y == y) || (players[i].pntPos.x == x && players[i].pntPos.y == y))
- {
- players[i].nProtecting = 0;
- strOutput.Format(_T("[R] %s 对 %s 使用了 %d级%s"), utlFindTarget(dwSource), players[i].cName, wLevel,strSkill);
- bTarget = true;
- }
- }
- if(!bTarget)
- {
- strOutput.Format(_T("[R] %s 对 (%d,%d) 使用了 %d级%s"), utlFindTarget(dwSource), x, y, wLevel, strSkill );
- bTarget = true;
- }
- if(strSkill.CompareNoCase(_T("光之障壁")) == 0 || strSkill.CompareNoCase(_T("暗之障壁")) == 0)
- utlLogout4(strOutput);
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Skill cast on someone
- int parse011A(char *pBuffer, int nLen)
- {
- DWORD dwSource, dwTarget;
- WORD wAmount, wSkillId;
- LOG_LEVEL logLevel = eLogInfo;
- CString strOutput, strSkill;
- utlChangeState(4, 5);
- wSkillId = *((WORD*)(pBuffer+2));
- dwSource = *((DWORD*)(pBuffer+10));
- dwTarget = *((DWORD*)(pBuffer+6));
- wAmount = *((WORD*)(pBuffer+4));
- strSkill = mapSkill.FindValue(wSkillId, eSkillAlias);
- strOutput.Format(_T("[R] %s 对 %s 使用了 %d级%s"),
- utlFindTarget(dwSource), utlFindTarget(dwTarget), wAmount, strSkill);
- if(strSkill == "撒水祈福" && dwTarget == dwAccountId)
- {
- injectAdminMessage(strOutput);
- if(mode == eModeMvp && settingmvp.bAntiBless)
- {
- CString strWeapon;
- int nIndex = -1;
- int nWeaponIndex = -1;
- for(int i=0; i<inventory.GetSize(); i++)
- {
- if(inventory[i].wEquipped)
- {
- strWeapon = mapEquipType.FindValue(inventory[i].wEquipType);
- {
- if(strWeapon.CompareNoCase(_T("双手武器")) == 0 || strWeapon.CompareNoCase(_T("单手武器")) == 0)
- {
- nIndex = i;
- nWeaponIndex = inventory[i].dwIndex;
- break;
- }
- }
- }
- }
- if(nIndex != -1)
- {
- WORD wType = inventory[i].wEquipType;
- sendUnequip(nWeaponIndex);
- sendEquip(nWeaponIndex, wType);
- }
- }
- }
- if(strSkill == "复活术")
- {
- if(dwTarget == dwAccountId && you.bDied)
- {
- CString strTemp = _T("你已复活,启动所有AI");
- injectAdminMessage(strTemp);
- you.bDied = false;
- bAiEnabled = true;
- }
- }
- if(dwTarget == dwAccountId || dwSource == dwAccountId)
- utlLogout(strOutput, eLogCommon, false);
- else
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Info received
- int parse0195(char *pBuffer, int nLen)
- {
- CString strOutput;
- DWORD dwId;
- CString strName;
- CString strGuild;
- char cName[MAX_NAME_LENGTH+1];
- int nIndex;
- dwId = *((DWORD*)(pBuffer+2));
- memset(cName, 0, MAX_NAME_LENGTH+1);
- strncpy(cName, pBuffer+6, MAX_NAME_LENGTH);
- strName = cName;
- strName.TrimRight();
- strncpy(cName, pBuffer+54, MAX_NAME_LENGTH);
- strGuild = cName;
- strGuild.TrimRight();
- if(dwId != dwAccountId)
- {
- nIndex = players.FindId(dwId);
- if(-1 != nIndex)
- {
- strcpy(players[nIndex].cName, strName);
- strcpy(players[nIndex].cGuild, strGuild);
- strOutput.Format("[R] 收到 %08X 信息: %s", dwId, strName);
- utlLogout(strOutput, eLogInfo, false);
- if(utlCheckForGmByName(players[nIndex]))
- {
- utlGMAppeared(players[nIndex]);
- }
- if(utlCheckForWanzi(strGuild) && !utlPlayerInParty(dwId) && !utlCheckForWanzi(you.cGuild))
- {
- if(mode != eModeNormal)
- {
- utlChangeMode(eModeNormal, 0);
- }
- // sendEmotion(0);
- // bAiEnabled = false;
- // injectAdminMessage("强行关闭所有AI");
- }
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // STATUS0196
- int parse0196(char *pBuffer, int nLen)
- {
- CString strOutput;
- DWORD dwId = *(DWORD*)(pBuffer+4);
- WORD wType = *(WORD*)(pBuffer+2);
- BYTE byFlag = *(pBuffer+8);
- CString strTemp;
- strOutput.Format(_T("[R] %s 已%s %s 状态"),
- utlFindTarget(dwId),
- byFlag?_T("进入"):_T("解除"),
- mapSkillsst.FindValue(wType));
- utlLogout(strOutput, eLogCommon, false);
- // if(utlPlayerInParty(dwId))
- // injectMessage(strOutput);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Attack2
- int parse01DE(char *pBuffer, int nLen)
- {
- CString strName;
- WORD wSkillId;
- DWORD dwSource, dwTarget;
- WORD wDamage;
- WORD wLevel;
- CString strOutput;
- utlChangeState(4, 5);
- wSkillId = *(WORD*)(pBuffer+2);
- dwSource = *(DWORD*)(pBuffer+4);
- dwTarget = *(DWORD*)(pBuffer+8);
- wDamage = *(WORD*)(pBuffer+24);
- wLevel = *(WORD*)(pBuffer+28);
- if(wDamage != 35536)
- {
- utlUpdateDamage(dwSource, dwTarget, wDamage, wSkillId);
- strOutput.Format("[R] %s 对 %s 使用了 %d 级 %s 伤害: %s",
- utlFindTarget(dwSource),
- utlFindTarget(dwTarget),
- wLevel,
- mapSkill.FindValue(wSkillId, eSkillAlias),
- utlCalculateHits(wDamage));
- }
- else
- {
- strOutput.Format("[R] %s 使用了 %d 级 %s",
- utlFindTarget(dwSource),
- wLevel,
- mapSkill.FindValue(wSkillId, eSkillAlias));
- }
- if(dwSource == dwAccountId || dwTarget == dwAccountId)
- utlLogout(strOutput, eLogCommon, false);
- else
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Attack2
- int parse0114(char *pBuffer, int nLen)
- {
- CString strName;
- WORD wSkillId;
- DWORD dwSource, dwTarget;
- WORD wDamage;
- WORD wLevel;
- CString strOutput;
- utlChangeState(4, 5);
- wSkillId = *(WORD*)(pBuffer+2);
- dwSource = *(DWORD*)(pBuffer+4);
- dwTarget = *(DWORD*)(pBuffer+8);
- wDamage = *(WORD*)(pBuffer+24);
- wLevel = *(WORD*)(pBuffer+28);
- if(wDamage != 35536)
- {
- utlUpdateDamage(dwSource, dwTarget, wDamage, wSkillId);
- strOutput.Format("[R] %s 对 %s 使用了 %d 级 %s 伤害: %s",
- utlFindTarget(dwSource),
- utlFindTarget(dwTarget),
- wLevel,
- mapSkill.FindValue(wSkillId-1, eSkillAlias),
- utlCalculateHits(wDamage));
- }
- else
- {
- strOutput.Format("[R] %s 使用了 %d 级 %s",
- utlFindTarget(dwSource),
- wLevel,
- mapSkill.FindValue(wSkillId-1, eSkillAlias));
- }
- if(dwSource == dwAccountId || dwTarget == dwAccountId)
- utlLogout(strOutput, eLogCommon, false);
- else
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Remote attack
- int parse0139(char *pBuffer, int nLen)
- {
- CString strOutput;
- DWORD dwId;
- POINT pntFrom, pntTo;
- dwId = *(DWORD*)(pBuffer+2);
- pntFrom.x = *(WORD*)(pBuffer+6);
- pntFrom.y = *(WORD*)(pBuffer+8);
- pntTo.x = *(WORD*)(pBuffer+10);
- pntTo.y = *(WORD*)(pBuffer+12);
- if(-1 != monsters.FindId(dwId))
- {
- monsters[monsters.FindId(dwId)].pntTo = pntFrom;
- }
- you.pntPos = pntTo;
- you.pntTo = pntTo;
- strOutput.Format("[R] %s 攻击你 [远程]", utlFindTarget(dwId));
- utlLogout(strOutput, eLogCommon, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Deal
- int parse00E5(char *pBuffer, int nLen)
- {
- CString strOutput;
- strOutput.Format("[R] 00E5");
- utlLogout(strOutput, eLogError, false);
- /* if(misc.bAutoDealCancel)
- {
- strOutput.Format("<<< Someone wants to deal with you, cancelled!");
- utlLogout4(strOutput);
- sendDealCancel();
- }
- */
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse0147(char *pBuffer, int nLen)
- {
- CString strOutput;
- CString strClassChange = _T("变换成boss级魔物");
- CString strTamingMonster = _T("认养宠物");
- WORD wSkillId = *(WORD*)(pBuffer+2);
- WORD wSkillLv = *(WORD*)(pBuffer+4);
- strOutput.Format("[R] 准备使用 %d 级 %s", wSkillLv, mapSkill.FindValue(wSkillId, eSkillAlias));
- utlLogout(strOutput, eLogError, false);
- if(bAutoSa)
- {
- if((strClassChange.CompareNoCase(mapSkill.FindValue(wSkillId, eSkillAlias)) == 0) ||
- (strTamingMonster.CompareNoCase(mapSkill.FindValue(wSkillId, eSkillAlias)) == 0))
- {
- sendChatParty(strOutput);
- injectAdminMessage(strOutput);
- ufAutoSaClassChange(0);
- }
- else
- {
- BOOL bWanzi = false;
- if(!utlCheckForWanzi(you.cGuild))
- {
- for(int i=0; i<players.GetSize(); i++)
- {
- if(utlCheckForWanzi(players[i].cGuild) && !utlPlayerInParty(players[i].dwId))
- {
- bWanzi = true;
- break;
- }
- }
- }
- if(!bWanzi)
- dwAutoSaTick = GetTickCount()+200;
- else
- ufAutoSaClassChange(0);
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse011F(char *pBuffer, int nLen)
- {
- DWORD dwId, dwSourceId;
- int x,y;
- WORD wSkill;
- SPELL spell;
- CString strOutput;
- dwId = *((DWORD*)(pBuffer+2));
- dwSourceId = *((DWORD*)(pBuffer+6));
- x = *((WORD*)(pBuffer+10));
- y = *((WORD*)(pBuffer+12));
- wSkill = *(pBuffer+14);
- spell.dwId = dwId;
- spell.dwSourceId = dwSourceId;
- spell.pntPos.x = x;
- spell.pntPos.y = y;
- spell.wSkill = wSkill;
- strOutput.Format(_T("[R] %s 在(%d, %d)施用了 %s"), utlFindTarget(dwSourceId), x, y, mapStatus011f.FindValue(wSkill));
- spells.Add(spell);
- if(dwSourceId == dwAccountId)
- utlLogout(strOutput, eLogCommon, false);
- else
- utlLogout(strOutput, eLogInfo, false);
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse0120(char *pBuffer, int nLen)
- {
- DWORD dwId;
- int i, nIndex = -1;
- CString strOutput;
- dwId = *((DWORD*)(pBuffer+2));
- for(i=0; i<spells.GetSize(); i++)
- {
- if(spells[i].dwId == dwId)
- {
- nIndex = i;
- break;
- }
- }
- if(nIndex != -1)
- {
- spells.RemoveAt(nIndex);
- strOutput.Format(_T("[R] 在(%d, %d)的 %s 消失了"), spells[i].pntPos.x, spells[i].pntPos.y, mapStatus011f.FindValue(spells[i].wSkill));
- if(spells[i].dwSourceId == dwAccountId)
- utlLogout(strOutput, eLogCommon, false);
- else
- utlLogout(strOutput, eLogInfo, false);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse01C8(char *pBuffer, int nLen)
- {
- CString strOutput;
- WORD wIndex;
- WORD wId;
- WORD wAmount;
- DWORD dwSourceId;
- int i;
- utlChangeState(4, 5);
- wIndex = *((WORD*)(pBuffer+2));
- wId = *((WORD*)(pBuffer+4));
- dwSourceId = *((DWORD*)(pBuffer+6));
- wAmount = *((WORD*)(pBuffer+10));
- if(dwSourceId == dwAccountId)
- {
- i = inventory.FindIndex(wIndex);
- if(i != -1)
- {
- strOutput.Format("[R] 你 使用了 %s X %d",
- mapItem.FindValue(inventory[i].dwId, eItemName),
- inventory[i].wAmount - wAmount);
- utlLogout(strOutput, eLogCommon, false);
- inventory[i].wAmount = wAmount;
- if(inventory[i].wAmount <= 0)
- inventory.RemoveAt(i);
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse0108(char *pBuffer, int nLen)
- {
- CString strOutput;
- WORD wType, wIndex, wEnchant;
- int i;
- wType = *((WORD*)(pBuffer+2));
- wIndex = *((WORD*)(pBuffer+4));
- wEnchant = *((WORD*)(pBuffer+6));
- i = inventory.FindIndex(wIndex);
- if(-1 != i)
- {
- inventory[i].byElement = (BYTE)wEnchant;
- strOutput.Format(_T("[R] 装备 %s 已经变成 %s属性(0108)"), utlGetInventoryName(&inventory[i]), mapElements.FindValue(inventory[i].byElement));
- utlLogout(strOutput, eLogCommon, false);
- injectMessage(strOutput);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse0188(char *pBuffer, int nLen)
- {
- CString strOutput;
- WORD wType, wIndex, wEnchant;
- int i;
- wType = *((WORD*)(pBuffer+2));
- wIndex = *((WORD*)(pBuffer+4));
- wEnchant = *((WORD*)(pBuffer+6));
- i = inventory.FindIndex(wIndex);
- if(-1 != i)
- {
- inventory[i].byRefine = (BYTE)wEnchant;
- strOutput.Format(_T("[R] %s 已经精练至 +%d"), utlGetInventoryName(&inventory[i]), wEnchant);
- utlLogout(strOutput, eLogCommon, false);
- injectMessage(strOutput);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse0119(char *pBuffer, int nLen)
- {
- CString strOutput, strTemp;
- DWORD dwId;
- WORD wStatus1, wStatus2, wStatus3;
- dwId = *((DWORD*)(pBuffer+2));
- wStatus1 = *((WORD*)(pBuffer+6));
- wStatus2 = *((WORD*)(pBuffer+8));
- wStatus3 = *((WORD*)(pBuffer+10));
- if(dwId == dwAccountId)
- {
- you.wStatus0119_01 = wStatus1;
- you.wStatus0119_02 = wStatus2;
- you.wStatus0119_03 = wStatus3;
- }
- else
- {
- int nIndex = players.FindId(dwId);
- if(nIndex != -1)
- {
- players[nIndex].wStatus0119_01 = wStatus1;
- players[nIndex].wStatus0119_02 = wStatus2;
- players[nIndex].wStatus0119_03 = wStatus3;
- }
- }
- if(wStatus1 == 0 && wStatus2 == 0 && wStatus3 == 0)
- {
- strOutput.Format(_T("[R] %s 为正常状态"), utlFindTarget(dwId));
- if(utlPlayerInParty(dwId))
- {
- utlLogout(strOutput, eLogCommon, false);
- // injectMessage(strOutput);
- }
- else
- {
- utlLogout(strOutput, eLogInfo, false);
- }
- }
- else
- {
- if(wStatus1 != 0)
- {
- strTemp.Format(_T("a%d"), wStatus1);
- strOutput.Format(_T("[R] %s 已进入 %s"), utlFindTarget(dwId), mapStatus0119.FindValue(strTemp, -1));
- if(utlPlayerInParty(dwId))
- {
- utlLogout(strOutput, eLogCommon, false);
- // injectMessage(strOutput);
- }
- else
- {
- utlLogout(strOutput, eLogInfo, false);
- }
- }
- if(wStatus2 != 0)
- {
- strTemp.Format(_T("b%d"), wStatus2);
- strOutput.Format(_T("[R] %s 已进入 %s"), utlFindTarget(dwId), mapStatus0119.FindValue(strTemp, -1));
- if(utlPlayerInParty(dwId))
- {
- utlLogout(strOutput, eLogCommon, false);
- // injectMessage(strOutput);
- }
- else
- {
- utlLogout(strOutput, eLogInfo, false);
- }
- }
- if(wStatus3 != 0)
- {
- strTemp.Format(_T("c%d"), wStatus3);
- strOutput.Format(_T("[R] %s %s"), utlFindTarget(dwId), mapStatus0119.FindValue(strTemp, -1));
- if(utlPlayerInParty(dwId))
- {
- utlLogout(strOutput, eLogCommon, false);
- // injectMessage(strOutput);
- }
- else
- {
- utlLogout(strOutput, eLogInfo, false);
- }
- }
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse01D0(char *pBuffer, int nLen)
- {
- CString strOutput;
- DWORD dwId;
- WORD wNumber;
- dwId = *((DWORD*)(pBuffer+2));
- wNumber = *((WORD*)(pBuffer+6));
- strOutput.Format(_T("[R] %s 拥有 %d 个气弹"), utlFindTarget(dwId), wNumber);
- if(utlPlayerInParty(dwId))
- {
- utlLogout(strOutput, eLogCommon, false);
- injectMessage(strOutput);
- }
- else
- {
- utlLogout(strOutput, eLogInfo, false);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse013C(char *pBuffer, int nLen)
- {
- CString strOutput;
- WORD wIndex;
- wIndex = *((WORD*)(pBuffer+2));
- int i = inventory.FindIndex(wIndex);
- if(-1 != i)
- {
- strOutput.Format(_T("[R] 你 已装备 %s"), utlGetInventoryName(&inventory[i]));
- injectMessage(strOutput);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse013D(char *pBuffer, int nLen)
- {
- CString strOutput;
- WORD wType, wAmount;
- wType = *((WORD*)(pBuffer+2));
- wAmount = *((WORD*)(pBuffer+4));
- switch(wType)
- {
- case 5:
- you.wHp += wAmount;
- break;
- case 7:
- you.wSp += wAmount;
- break;
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse00FB(char *pBuffer, int nLen)
- {
- BYTE byNum;
- int i;
- CString strOutput;
- partners.RemoveAll();
- strOutput.Format("[R] 队伍成员列表: ------->");
- utlLogout(strOutput, eLogCommon, false);
- for(i=28; i<nLen; i+=46)
- {
- PLAYER player;
- player.dwId = *((DWORD*)(pBuffer+i));
- strncpy(player.cName, pBuffer+i+4, MAX_NAME_LENGTH);
- byNum = *(pBuffer+i+44);
- partners.Add(player);
- strOutput.Format(" %02d) %s(%08X)", byNum, player.cName, player.dwId);
- utlLogout(strOutput, eLogCommon, false);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse01B0(char *pBuffer, int nLen)
- {
- DWORD dwId;
- WORD wType;
- int i;
- CString strOutput;
- dwId = *((DWORD*)(pBuffer+2));
- wType = *((WORD*)(pBuffer+7));
- i = monsters.FindId(dwId);
- if(-1 != i)
- {
- monsters[i].wType = wType;
- strcpy(monsters[i].cName, mapMonster.FindValue(wType, 0));
- strOutput.Format(_T("[R] 怪物 已变成 %s"), monsters[i].cName);
- utlLogout(strOutput, eLogCommon, false);
- injectMessage(strOutput);
- if(utlIsMvpMonster(monsters[i]))
- {
- utlReportMonsterToParty(dwId);
- }
- }
- return(0);
- }
- int parse019E(char *pBuffer, int nLen)
- {
- /* if(monsters.GetSize() > 0)
- {
- // sendUseSkill(1, 297, monsters[0].dwId);
- for(int i=0; i<10; i++)
- {
- char buffer[6];
- *(WORD*)(buffer) = 0x019F;
- *(DWORD*)(buffer+2) = monsters[0].dwId;
- parseSendData(buffer, 6, true);
- injectAdminMessage(_T("抓宠"));
- }
- }
- */ return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // NPC Talk continue
- int parse00B5(char *pBuffer, int nLen)
- {
- DWORD dwId;
- CString strOutput;
- dwId = *((DWORD*)(pBuffer+2));
- strOutput.Format(_T("[R] NPC(0x%X) 继续对话"), dwId);
- utlLogout(strOutput, eLogCommon, false);
- if(option.bNpcTalkContinue)
- {
- Sleep(100);
- sendTalkContinue(dwId);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // NPC Talk done
- int parse00B6(char *pBuffer, int nLen)
- {
- DWORD dwId;
- CString strOutput;
- dwId = *((DWORD*)(pBuffer+2));
- strOutput.Format(_T("[R] NPC(0x%X) 结束对话"), dwId);
- utlLogout(strOutput, eLogCommon, false);
- /* if(option.bNpcTalkContinue)
- {
- Sleep(100);
- sendTalkCancel(dwId);
- }*/
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- // Your Guild Name received
- int parse016C(char *pBuffer, int nLen)
- {
- CString strOutput;
- CString strGuild;
- char cName[MAX_NAME_LENGTH+1];
- memset(cName, 0, MAX_NAME_LENGTH+1);
- strncpy(cName, pBuffer+19, MAX_NAME_LENGTH);
- strGuild = cName;
- strGuild.TrimRight();
- strcpy(you.cGuild, strGuild);
- strOutput.Format(_T("[R] 工会名称: %s"), strGuild);
- utlLogout(strOutput, eLogCommon, false);
- return(0);
- }
- int parse0122(char *pBuffer, int nLen)
- {
- INVENTORY inv;
- int i;
- CString strTemp;
- int nIndex;
- utlChangeState(4, 5);
- utlLogout("[R] 手推车内装备列表: ------->", eLogCommon, false);
- for(i=4; i<nLen; i+=20)
- {
- memset(&inv, 0, sizeof(INVENTORY));
- utlParseInventory(pBuffer+i, &inv, 0x0122);
- nIndex = cart.FindId(inv.dwIndex);
- if(-1 != nIndex)
- cart.SetAt(nIndex, inv);
- else
- cart.Add(inv);
- strTemp.Format(_T(" [%2d] %-20s X %d"),
- inv.dwIndex, mapItem.FindValue(inv.dwId, eItemName),
- inv.wAmount);
- utlLogout(strTemp, eLogCommon, false);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse0123(char *pBuffer, int nLen)
- {
- INVENTORY item;
- int i;
- CString strTemp;
- int nIndex;
- utlChangeState(4, 5);
- utlLogout("[R] 手推车内物品列表: ------->", eLogCommon, false);
- for(i=0; i<nLen-4; i+=10)
- {
- memset(&item, 0, sizeof(INVENTORY));
- item.dwIndex = *((WORD*)(pBuffer+4+i+0));
- item.dwId = *((WORD*)(pBuffer+4+i+2));
- item.wType = *(pBuffer+4+i+4);
- item.wAmount = *((WORD*)(pBuffer+4+i+6));
- nIndex = cart.FindId(item.dwIndex);
- if(-1 != nIndex)
- cart.SetAt(nIndex, item);
- else
- cart.Add(item);
- strTemp.Format(_T(" [%2d] %-20s X %d"),
- item.dwIndex, mapItem.FindValue(item.dwId, eItemName),
- item.wAmount);
- utlLogout(strTemp, eLogCommon, false);
- }
- return(0);
- }
- //-------------------------------------------------------------------------------------------------------------------------------
- int parse0124(char *pBuffer, int nLen)
- {
- return(0);
- }