FIX: Muun Bug Visual y de Desaparición (GameServer & Cliente) (Base Pike 4.3) - Source Mu - Mu Server Files
 

FIX: Muun Bug Visual y de Desaparición (GameServer & Cliente) (Base Pike 4.3)

Publicado por Dakosmu, Nov 06, 2025, 03:49 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Dakosmu

FIX: Muun Bug Visual y de Desaparición (GameServer & Cliente) (Base Pike 4.3)

Descripción

Esta guía aborda la implementación de lógica tanto en el GameServer como en el cliente (main.dll) para corregir posibles *bugs* visuales y de persistencia con los Muun y Pets, asegurando que solo el pet/muun correcto aparezca y desaparezca.

---
Modificaciones en GameServer.cpp

En el archivo GameServer.cpp, ubica la función para enviar información de cambio de Pet/Muun (similar a la que se encuentra en NewUIMyInventory.cpp del lado del servidor) y reemplaza su contenido con el siguiente código:

void CNewUIMyInventory::GCPetItemChangeSend(int aIndex, BYTE slot) // OK
{
#if(GAMESERVER_UPDATE>=603)

   LPOBJ lpObj = &gObj[aIndex];

   PMSG_PET_ITEM_CHANGE_SEND pMsg;

   pMsg.header.set(0x4E, 0x0D, sizeof(pMsg));

   pMsg.index[0] = SET_NUMBERHB(aIndex);
   pMsg.index[1] = SET_NUMBERLB(aIndex);

   gItemManager.ItemByteConvert(pMsg.ItemInfo, lpObj->EquipInventory[slot]);

   pMsg.ItemInfo[1] = slot * 16;
   pMsg.ItemInfo[1] |= ((lpObj->EquipInventory[slot].m_Level - 1) / 2) & 0x0F;

   MsgSendV2(lpObj, (BYTE*)&pMsg, pMsg.header.size);

#endif
}

---
Modificaciones en Cliente (main.dll) - NewUIMyInventory.h

En el archivo NewUIMyInventory.h (lado del cliente), agrega las siguientes declaraciones de funciones y defines. Estos son necesarios para las funciones de verificación y eliminación de *bugs* que se agregarán en el archivo .cpp:

void g_DeleteMuunBug(OBJECT* Owner, int Index);
bool g_CheckBugLive(OBJECT* Owner, int Index);

#define CreateBug              ((void (__cdecl*)(int Type, vec3_t Position, OBJECT *Owner, int SubType, int LinkBone)) 0x00501700)

#define MODEL_FENRIR_BLACK            384
#define MODEL_FENRIR_RED              385
#define MODEL_FENRIR_BLUE             386
#define MODEL_FENRIR_GOLD             387
#define MODEL_DARK_HORSE              226
#define MODEL_PEGASUS                 323
#define MODEL_UNICON                  233
#define MODEL_BUTTERFLY01             176

---
Modificaciones en Cliente (main.dll) - NewUIMyInventory.cpp

En el archivo NewUIMyInventory.cpp (lado del cliente):

A. Agrega las siguientes funciones:

bool g_CheckBugLive(OBJECT* Owner, int Index)
{
   BYTE* Butterfles = (BYTE*)0x8791550;

   for (int i = 0; i < 10; i++)
   {
      OBJECT* o = (OBJECT*)&Butterfles[648 * i];

      if (o->Owner == Owner && o->Type == Index)
      {
         if (o->Live)
         {
            return true;
         }
      }
   }
   return false;
}

void g_DeleteMuunBug(OBJECT* Owner, int Index)
{
   BYTE* Butterfles = (BYTE*)0x8791550;

   for (int i = 0; i < 10; i++)
   {
      OBJECT* o = (OBJECT*)&Butterfles[648 * i];
      int type = g_CustomPet.GetInfoPetType(o->Type - 1171);

      if (o->Owner == Owner &&
         (o->Type != Index &&
            o->Type != MODEL_FENRIR_BLACK &&
            o->Type != MODEL_FENRIR_RED &&
            o->Type != MODEL_FENRIR_BLUE &&
            o->Type != MODEL_FENRIR_GOLD &&
            o->Type != MODEL_DARK_HORSE &&
            o->Type != MODEL_PEGASUS &&
            o->Type != MODEL_UNICON &&
            o->Type != MODEL_BUTTERFLY01 &&
            (type == 4 && type > -1)))
      {
         o->Live = false;
      }
   }
}

B. Reemplaza la función de recepción de cambio de ítem:

Reemplaza la función CNewUIMyInventory::ReceiveItemChange con este código para integrar la lógica de comprobación y eliminación de *bug* de Muun/Pet:

void CNewUIMyInventory::ReceiveItemChange(PMSG_NEWINV_ITEM_CHANGE_RECV* lpMsg) // AQUI É AONDE APARECE PRO OUTRO
{
   int TempEquip; // [sp+1Dh] [bp-3h]@2
   int IndexUser;
   int g_HeroPlayer;

   IndexUser = FindCharacterIndex(lpMsg->index[1] + (lpMsg->index[0] << 8));

   g_HeroPlayer = CharactersClient(CList(), IndexUser);

   if (g_HeroPlayer)
   {
      OBJECT* pHeroObject = &*(OBJECT*)(g_HeroPlayer + 776);
      TempEquip = sub_58AA80((DWORD)lpMsg->ItemInfo);

      switch ((signed int)lpMsg->ItemInfo[1] >> 4)
      {

         if (InChaosCastle(World) == true)
         {
            return;
         }

      case 12:
         if (TempEquip == 0x1FFF)
         {
            g_DeleteMuunBug(pHeroObject, *(WORD*)(g_HeroPlayer + 556));
         }
         else
         {
            if (!g_CheckBugLive(pHeroObject, TempEquip + 1171))
            {
               CreateBug(TempEquip + 1171, pHeroObject->Position, pHeroObject, 0, 0);
            }
         }
      }
   }
}

---
Modificaciones en protocol.h

En el archivo protocol.h, justo antes de `typedef struct //-- Get Item Modify`, agrega la definición del nuevo paquete de recepción de cambio de ítem:

struct PMSG_NEWINV_ITEM_CHANGE_RECV
{
   PSBMSG_HEAD header; // C1:4E:06
   BYTE index[2];
   BYTE ItemInfo[12];
};

---
Modificaciones en protocol.cpp

En el archivo protocol.cpp, asegúrate de que la función de recepción para el paquete de cambio de ítem (cabeza `0x4E:06`) llame a la función del cliente. Reemplaza la llamada existente a `ReceiveItemChange` con la siguiente:

g_pMyInventory.ReceiveItemChange((PMSG_NEWINV_ITEM_CHANGE_RECV*)lpMsg);

---

Toda la información solicitada ha sido formateada dentro de los bloques `` y siguiendo el formato BBCode que pediste.

¿Necesitas que prepare alguna otra publicación o tienes otra pieza de código que quieras formatear?
Bon Dia

🡱 🡳
Real Time Web Analytics