void GJPCharacterListRequestCS(SDHP_GETCHARLIST_RECV *lpMsg, int aIndex){ DGAccountInfoSend(lpMsg->Index, lpMsg->Account); BYTE Buffer[520]; SDHP_CHARLISTCOUNT_SEND pMsg; int size = sizeof(pMsg); pMsg.header.set(0x01, size); memcpy(pMsg.AccountId, lpMsg->Account, sizeof(pMsg.AccountId)); pMsg.GenerableClass = 0; pMsg.Count = 0; pMsg.Index = lpMsg->Index; if (gAccountCharDBSet.GetAccountId(lpMsg->Account) == false && gAccountCharDBSet.CreateAccountCharacter(lpMsg->Account) == false) { memcpy(Buffer, &pMsg, sizeof(pMsg)); gSocketManagerDataServer.DataSend(aIndex, Buffer, size); return; } BYTE btSlotCount = 0; if (gAccountCharDBSet.GetCharacterSlotCount(lpMsg->Account, &btSlotCount) == true) { pMsg.CharacterSlotCount = btSlotCount; } BYTE btAddExtendedWarehouseCount = 0; if (gAccountCharDBSet.GetCharacterExtendedWarehouseCount(lpMsg->Account, &btAddExtendedWarehouseCount) == true) { pMsg.ExtendedWarehouseCount = btAddExtendedWarehouseCount; } AccountCharacterInfo ACInfo; memset(&ACInfo, 0, sizeof(ACInfo)); if (gAccountCharDBSet.GetAccountInfo(lpMsg->Account, &ACInfo) == false) { memcpy(Buffer, &pMsg, sizeof(pMsg)); gSocketManagerDataServer.DataSend(aIndex, Buffer, size); return; } char Names[MAX_CHARACTER][11]; memcpy(Names[0], ACInfo.GameID1, sizeof(ACInfo.GameID1)); memcpy(Names[1], ACInfo.GameID2, sizeof(ACInfo.GameID2)); memcpy(Names[2], ACInfo.GameID3, sizeof(ACInfo.GameID3)); memcpy(Names[3], ACInfo.GameID4, sizeof(ACInfo.GameID4)); memcpy(Names[4], ACInfo.GameID5, sizeof(ACInfo.GameID5)); pMsg.MoveCnt = ACInfo.MoveCnt; SDHP_CHARLIST info; for (int i = 0; i < MAX_CHARACTER; ++i) { int Len = strlen(Names[i]); if (Len <= 0 || Len > 10) { continue; } BYTE _ctlcode = 0; BYTE _dbverstion = 0; BYTE _pkLevel = 0; BYTE _btGuildStatus = -1; int _level = 0; int _class = 0; BYTE Inventory[3800]; memset(Inventory, 0xFF, sizeof(Inventory)); if (gCharPreviewDBSet.GetChar(Names[i], lpMsg->Account, &_level, &_class, Inventory, &_ctlcode, &_dbverstion, &_pkLevel, &_btGuildStatus) == false) { continue; } info.Index = i; info.Level = _level; info.Class = _class; info.CtlCode = _ctlcode; info.DbVersion = _dbverstion; // Cambiar a una funcion la migracion del SpeedServer if (_pkLevel & 0x80) { LogAdd(LOG_BLACK, "Speed server migration [Account:%s][Name:%s][level:%d]", lpMsg->Account, Names[i], _level); _pkLevel &= 0x7F; WORD MasterLevel = 0; MLP_ANS_MASTERLEVEL_INFO_SEND MasterInfo; if (_level >= 400 && gMasterLevelSystemDBSet.DSDB_QueryMasterLevelSystemLoad(Names[i], &MasterInfo) == false) { MasterLevel = MasterInfo.nMLevel; } BYTE ClassType = 4 * gClassdef.GetCharacterClassByDBClass(_class); if (ClassType == CLASS_NONE) { continue; } BYTE InventoryData[(MAX_ITEM_SECTION - 1)*INVENTORY_WEAR_SIZE]; memset(InventoryData, -1, sizeof(InventoryData)); if ((MasterLevel + _level) >= 600) { gItem.ItemByteConvert16(InventoryData, gClassdef.JumpingEquipment[ClassType + 3], INVENTORY_EXT4_SIZE); } else if ((MasterLevel + _level) >= 500) { gItem.ItemByteConvert16(InventoryData, gClassdef.JumpingEquipment[ClassType + 1], INVENTORY_EXT4_SIZE); } else if (_level >= 400) { gItem.ItemByteConvert16(InventoryData, gClassdef.JumpingEquipment[ClassType], INVENTORY_EXT4_SIZE); } else if (_level >= 380) { gItem.ItemByteConvert16(InventoryData, gClassdef.JumpingEquipment[ClassType + 2], INVENTORY_EXT4_SIZE); } else { CItem ItemInfo[(INVENTORY_WEAR_SIZE + 1)]; for (int k = 0; k < (INVENTORY_WEAR_SIZE + 1); ++k) { ItemInfo[k].Clear(); } WORD type = gItem.ItemGetNumberMake(14, 286); ItemInfo[12].Convert(type, 0, 0, 0, 0, 0, 3); gItem.ItemByteConvert16(InventoryData, ItemInfo, (INVENTORY_WEAR_SIZE + 1)); } gCharDBSet.RewardJumpingItem(Names[i], InventoryData); } // ----------- info.PK_Level = _pkLevel; info.btGuildStatus = _btGuildStatus; memcpy(info.UnityBFOfRealName, "", sizeof(info.UnityBFOfRealName)); info.ServerCodeOfHomeWorld = 0; gCharPreviewDBSet.GetRealNameAndServerCode(Names[i], info.UnityBFOfRealName, &info.ServerCodeOfHomeWorld, lpMsg->IsUnityBattleFiledServer); memcpy(info.Name, Names[i], sizeof(info.Name)); if ((_ctlcode & 0x80) == 0 && _level >= 150) { if (_level < 200 && pMsg.GenerableClass < 2) { pMsg.GenerableClass = 1; } else if (_level >= 200 && pMsg.GenerableClass < 3) { pMsg.GenerableClass = 2; } else if (_level >= 220 && pMsg.GenerableClass < 4) { pMsg.GenerableClass = 3; } else if (_level >= 250 && pMsg.GenerableClass < 5) { pMsg.GenerableClass = 4; } else if (_level >= 400) { pMsg.GenerableClass = 5; } } for (int n = 0; n < INVENTORY_WEAR_SIZE; ++n) { switch (_dbverstion) { case 0x00: memcpy(&info.dbInventory[2 * n], &Inventory[7 * n], sizeof(WORD)); continue; case 0x01: case 0x02: memcpy(&info.dbInventory[3 * n], &Inventory[10 * n], sizeof(WORD)); info.dbInventory[3 * n + 2] = Inventory[10 * n + 7]; continue; case 0x03: memcpy(&info.dbInventory[4 * n], &Inventory[16 * n], sizeof(WORD)); info.dbInventory[4 * n + 2] = Inventory[16 * n + 7]; info.dbInventory[4 * n + 3] = Inventory[16 * n + 9]; continue; } } memcpy(&Buffer[size], &info, sizeof(info)); size += sizeof(info); pMsg.Count++; } pMsg.header.size[0] = SET_NUMBERHB(size); pMsg.header.size[1] = SET_NUMBERLB(size); memcpy(Buffer, &pMsg, sizeof(pMsg)); gSocketManagerDataServer.DataSend(aIndex, Buffer, size);}