装备连接的数据处理

uint32_t UniqueID = packet->Read<uint32_t>();
uint8_t hasLinkedItem = packet->Read<uint8_t>();

//如果带装备连接
if (hasLinkedItem)
{

  //创建一个临时封包(0xB034)
  auto temporaryPacket = new CMsgStreamBuffer(0xB034);
  for (size_t i = 0; i < (packet->GetLength() - 15 - MessageA.length()); i++)
  {

    //从服务器传来的byte数组(标识位、类型6/7、装备信息等)
    auto byte = packet->Read<uint8_t>();
    temporaryPacket->Write<uint8_t>(byte);
  }

  //创建并填充全体聊天对象:chat
  GlobalChat chat;
  chat.index = 0;
  chat.msg = (wchar_t*)MessageW.c_str();
  chat.completed = false;
  chat.buffer = temporaryPacket;

  //将chat添加到GlobalChatLog列表中
  g_GlobalDataMgr->GlobalChatLog.push_back(chat);
}

//获取发送连接的玩家的CICPlayer指针
auto Sender = g_CICPlayer->GetCICPlayerByUniqueID(UniqueID);
if (Sender)
{
  //将连接信息发送到聊天窗口中
  g_CGInterface->SendColoredMsg(type, MessageW, color);
  auto splitted = g_StringHelper->wsplit(MessageW, L':');
  w_string_last string = w_string_last(splitted[1]);
  //在发送连接的玩家的头顶显示消息(对于其它玩家,也是一样可以看到渲染的。)
  Sender->ShowMessageAbove(&string, color);
}
else
  g_CGInterface->SendColoredMsg(type, MessageW, color);

 

posted @ 2022-10-13 12:01  tetrachloroethylene  阅读(35)  评论(0)    收藏  举报