[cpp] code
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- if (CharName16 == state.character.name) // if the session is equals to this character
- {
- char Size[5000];
- auto pBuffer = MakeStream(Size);
- pBuffer.Write<uint8_t>(0x0F);
- pBuffer.Write<uint8_t>(0x05);
- pBuffer.Write<uint8_t>(0x0);
- if (!state.customs.m_CustomLinkedItemName.empty())
- {
- auto charname = to_wstring(CharName16);
- auto message = to_wstring(Message);
- for (auto &c : state.customs.m_CustomLinkedItemName)
- {
- if (c == L' ')
- c = L'\u00A0';
- }
- auto leftmsg = message.substr(0, state.customs.m_GlobalLinkedItemBegin);
- auto rightmsg = message.substr(leftmsg.length());
- std::wstring wholemsg = leftmsg.append(state.customs.m_CustomLinkedItemName).append(rightmsg);
- pBuffer.WriteUnicode(charname.append(L":").append(wholemsg).c_str());
- }
- else
- pBuffer.WriteUnicode(to_wstring(CharName16.append(":").append(Message)).c_str());
- pBuffer.Write<int8_t>((uint8_t)GameChatType::Global);
- pBuffer.Write<uint32_t>(state.customs.CurrentGlobalColor);
- pBuffer.Write<uint32_t>(state.character.uniqueid);
- //below isnt required :D
- if (state.customs.m_GlobalLinkedItemSlot != 0 && state.character.dbid != 0)
- {
- // give me a minute i will write a proper query without declare k
- const std::lock_guard<std::mutex> lock(g_mssql_lock);
- auto reader = g_mssql.OpenReader(g_mssql.SHARD, "SELECT IT.ID64, IT.RefItemID, IT.OptLevel, ISNULL(IT.Variance, 0), IT.[Data], IT.MagParamNum, ISNULL(IT.MagParam1, 0), ISNULL(IT.MagParam2, 0), ISNULL(IT.MagParam3, 0), ISNULL(IT.MagParam4, 0), ISNULL(IT.MagParam5, 0), ISNULL(IT.MagParam6, 0), ISNULL(IT.MagParam7, 0), ISNULL(IT.MagParam8, 0), ISNULL(IT.MagParam9, 0), ISNULL(IT.MagParam10, 0), ISNULL(IT.MagParam11, 0), ISNULL(IT.MagParam12, 0) FROM SRO_VT_SHARD.dbo._Items IT JOIN SRO_VT_SHARD.dbo._Inventory I ON IT.ID64 = I.ItemID WHERE I.CharID = " + std::to_string(state.character.dbid) + " AND I.Slot = " + std::to_string(state.customs.m_GlobalLinkedItemSlot) + "");
- if (reader.next())
- {
- //printf("found item retrieving its data \n");
- auto ID64 = reader.get<uint64_t>(0);
- auto RefItemID = reader.get<uint32_t>(1);
- auto OptLevel = reader.get<int>(2);
- auto Variance = reader.get<uint64_t>(3);
- auto Data = reader.get<uint32_t>(4);
- auto MagParamNum = reader.get<int>(5);
- std::list<int64_t> MagParamList;
- //printf("found magparamcount %d \n", MagParamNum);
- if (MagParamNum != 0)
- {
- for (size_t i = 0; i < MagParamNum; i++)
- {
- printf("reading magparam %d\n", 6 + i);
- auto value = reader.get<uint64_t>(6+i);
- std::cout << "Magparam val : " << value << std::endl;
- MagParamList.push_back(value);
- }
- }
- uint8_t TypeID1 = 0, TypeID2 = 0, TypeID3 = 0, TypeID4 = 0;
- auto objreader = g_mssql.OpenReader(g_mssql.SHARD, "select top 1 TypeID1,TypeID2,TypeID3,TypeID4 from _RefObjCommon where ID = " + std::to_string(RefItemID) + "");
- if (objreader.next())
- {
- printf("Found TypeIDs\n");
- TypeID1 = (uint8_t)objreader.get<char>(0);
- TypeID2 = (uint8_t)objreader.get<char>(1);
- TypeID3 = (uint8_t)objreader.get<char>(2);
- TypeID4 = (uint8_t)objreader.get<char>(3);
- printf("ID %d, TypeID1 = %d, TypeID2 = %d, TypeID3 = %d, TypeID4 = %d\n", RefItemID, TypeID1, TypeID2, TypeID3, TypeID4);
- }
- else
- {
- printf("TypeIds Not Found!\n");
- goto lb_getridofit;
- }
- printf("passed till now\n");
- //nasrun TypeID1 = 3 and TypeID2 = 1 and TypeID3 = 14 and TypeID4 = 1
- pBuffer.Write<int8_t>(1);//thats a flag for my stuff while reading
- // do u remove that flag or not nope, it fucks the packet no lol look
- if ((TypeID1 == 3 && TypeID2 == 1) || (TypeID1 == 3 && TypeID2 == 3))
- {
- //pBuffer.Write<uint8_t>(1);
- //pBuffer.Write<uint8_t>(6);
- //pBuffer.Write<uint8_t>(0x0D); // slot
- pBuffer.Write<int32_t>(0); // unk rentinfo data
- pBuffer.Write<int32_t>(RefItemID);
- if (TypeID1 == 3)
- {
- if (TypeID2 == 1) //ITEM_EU_CH_AVATAR
- {
- printf("Found an equipment or avatar\n");
- pBuffer.Write<uint8_t>(OptLevel);
- pBuffer.Write<int64_t>(Variance);//wait
- if (Data == -1 && (TypeID1 == 3 && TypeID2 == 1 && TypeID3 == 14 && TypeID4 == 1))//nasruns
- {
- pBuffer.Write<uint8_t>(0);//rent time over.
- pBuffer.Write<uint8_t>(0);//rent time over.
- pBuffer.Write<uint8_t>(0);//rent time over.
- pBuffer.Write<uint8_t>(128);//rent time over.
- }
- else
- pBuffer.Write<int32_t>((int)Data);
- pBuffer.Write<uint8_t>(MagParamNum);
- if (MagParamNum != 0)
- {
- printf("writing magparams count %d\n", MagParamNum);
- for (auto param : MagParamList)
- {
- std::cout << "writing param : " << param << std::endl;
- pBuffer.Write<uint32_t>((param % 4294967296));
- pBuffer.Write<uint32_t>((param / 4294967296));
- }
- }
- std::list<SocketData> m_SocketsList;
- std::list<AdvData> m_AdvList;
- auto bOptTypeReader = g_mssql.OpenReader(g_mssql.SHARD, "SELECT bOptType, nSlot, nOptID, nOptLvl, nOptValue, nParam1, nParam2 FROM _BindingOptionWithItem WHERE (nOptID <> 0) AND (nItemDBID = " + std::to_string(ID64) + ") ORDER BY bOptType, nSlot");
- while (bOptTypeReader.next())
- {
- auto bOptType = bOptTypeReader.get<int>(0);
- auto nSlot = bOptTypeReader.get<int>(1);
- auto nOptID = bOptTypeReader.get<int>(2);
- auto nOptLvl = bOptTypeReader.get<int>(3);
- auto nOptValue = bOptTypeReader.get<int>(4);
- auto nParam1 = bOptTypeReader.get<int>(5);
- auto nParam2 = bOptTypeReader.get<int>(6);
- if (bOptType == 1)
- {
- printf("Found sockets\n");
- SocketData data;
- data.nSlot = nSlot;
- data.nOptID = nOptID;
- data.nOptLvl = nOptLvl;
- data.nParam1 = nParam1;
- data.nParam2 = nParam2;
- m_SocketsList.push_back(data);
- }
- else if (bOptType == 2)
- {
- printf("Found Adv\n");
- AdvData data;
- data.nOptID = nOptID;
- data.nOptValue = nOptValue;
- data.nSlot = nSlot;
- m_AdvList.push_back(data);
- }
- }
- pBuffer.Write<uint8_t>(1); // socket flag
- pBuffer.Write<uint8_t>(m_SocketsList.size());
- for (auto Socket : m_SocketsList)
- {
- printf("writing sockets.\n");
- pBuffer.Write<uint8_t>(Socket.nSlot);
- pBuffer.Write<uint16_t>(Socket.nOptID);
- pBuffer.Write<uint16_t>(Socket.nOptLvl);
- pBuffer.Write<uint16_t>(Socket.nParam1);
- pBuffer.Write<uint16_t>(Socket.nParam2);
- }
- pBuffer.Write<uint8_t>(2); // adv flag
- pBuffer.Write<uint8_t>(m_AdvList.size());
- for (auto Adv : m_AdvList)
- {
- printf("writing advs\n");
- pBuffer.Write<uint8_t>(Adv.nSlot);
- pBuffer.Write<uint32_t>(Adv.nOptID);
- pBuffer.Write<uint32_t>(Adv.nOptValue);
- }
- }
- else if (TypeID2 == 3) // ITEM_ETC
- {
- printf("found item_etc stuff\n");
- pBuffer.Write<uint16_t>((int)Data); // amount
- if (TypeID3 == 11 && (TypeID4 == 1 || TypeID4 == 2)) // magicstone & attrstone
- {
- printf("its stone\n");
- pBuffer.Write<uint16_t>(OptLevel);
- }
- else if (TypeID3 == 14 && TypeID4 == 2) // GACHA_CARD_WIN/LOSE
- {
- printf("its gacha card win/lose\n");
- pBuffer.Write<uint8_t>(MagParamNum);
- if (MagParamNum != 0)
- {
- for (auto param : MagParamList)
- {
- pBuffer.Write<uint32_t>((param % 4294967296));
- pBuffer.Write<uint32_t>((param / 4294967296));
- }
- }
- }
- }
- }
- }
- else
- {
- printf("process over\n");
- goto lb_getridofit;
- }
- }
- else
- {
- printf("process over 2\n");
- goto lb_getridofit;
- }
- }// come team viewer to show you some thing to ask about it
- else
- {
- printf("process over 3\n");
- lb_getridofit:
- pBuffer.Write<uint8_t>(0);
- }
- Communication::SendToAll(Opcodes::SERVER::CUSTOM_RESPONSE, pBuffer);
- if (!state.customs.m_CustomLinkedItemName.empty())
- {
- auto chatReplacedPacket = MakeStream(streamSize);
- chatReplacedPacket.Write<uint8_t>(6);
- chatReplacedPacket.WriteAscii(CharName16);
- auto leftmsg = Message.substr(0, state.customs.m_GlobalLinkedItemBegin);
- auto rightmsg = Message.substr(leftmsg.length());
- std::wstring ItemName;
- for (auto &c : state.customs.m_CustomLinkedItemName)
- {
- std::wstring curchar = std::wstring(1, c);
- if (c != L'\u035F')
- ItemName.append(curchar);
- }
- std::string normalitemname = std::string(ItemName.begin(), ItemName.end());
- for (auto& c : normalitemname)
- {
- if (c == '\u00A0')
- c = ' ';
- }
- auto wholemsg = leftmsg.append(" ").append(normalitemname).append(" ").append(rightmsg);
- chatReplacedPacket.WriteAscii(wholemsg);
- state.customs.m_CustomLinkedItemName = std::wstring();
- state.customs.m_GlobalLinkedItemBegin = 0;
- state.customs.m_GlobalLinkedItemEnd = 0;
- state.customs.m_GlobalLinkedItemSlot = 0;
- Communication::SendToAll(Opcodes::SERVER::CHAT, chatReplacedPacket);
- return PacketResult::Ignore;
- }
- }
Editor
You can edit this paste and save as new: