Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Emerson Up27 - how to add party buff icons?  (Visto 357 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline dima0909 Posteado: January 05, 2025, 02:03:35 PM | Modificado: January 10, 2025, 08:16:19 AM by dima0909

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 54
  • Gracias recibida: 3
  • nz
I would like to copy from another source to my files what is visible in the photo (i.e. BUFFs that players in the party have)




in another source... so far I noticed that in Protocol.cpp this piece of code calls these icons


Code: [Select]
            case 0x2E:

            gPartyBuffs.RecvPartyBuffs((PMSG_PARTY_EFFECT_LIST_SEND*)lpMsg);


and I see that I have 2 files: PartyBuffs.h :


Code: [Select]
#pragma once

#include "Protocol.h"

#include <string>


struct PMSG_PARTY_EFFECT_LIST_SEND

{

    PBMSG_HEAD header; // C1:2E

    char name[11];

    BYTE count;

};


struct PMSG_PARTY_EFFECT_LIST

{

    #pragma pack(1)

    BYTE effect;

    DWORD count;

    #pragma pack()

};


struct PARTY_BUFFS

{

    BYTE effect;

    DWORD count;

};


struct PARTY_BUFFS_DATA

{

    char name[11];

    int count;

    PARTY_BUFFS Buffs[16];

    //std::vector<PARTY_BUFFS> Buffs[16];

};


class cPartyBuffs

{

public:

    cPartyBuffs();

    virtual ~cPartyBuffs();

    void Init();

    void RecvPartyBuffs(PMSG_PARTY_EFFECT_LIST_SEND* lpMsg);

    PARTY_BUFFS_DATA* GetInfoByName(char* Name);

    void DrawPartyBuffs(float StartX, float StartY, char* MemberName);

    std::map<std::string,PARTY_BUFFS_DATA> m_PartyBuffsData;

    //PARTY_BUFFS_DATA m_PartyBuffsData[5];

    int m_Loaded;

}; extern cPartyBuffs gPartyBuffs;


and PartyBuffs.cpp :



Code: [Select]
#include "stdafx.h"

#include "PartyBuffs.h"

#include "Offset.h"

#include "Import.h"

#include "Object.h"

#include "Interface.h"

#include "User.h"

#include <string>


cPartyBuffs gPartyBuffs;


cPartyBuffs::cPartyBuffs()

{

    this->m_PartyBuffsData.clear();

}


cPartyBuffs::~cPartyBuffs()

{

 

}


void cPartyBuffs::RecvPartyBuffs(PMSG_PARTY_EFFECT_LIST_SEND* lpMsg)

{

    PARTY_BUFFS_DATA info;


    memcpy(info.name,lpMsg->name,sizeof(info.name));


    info.count = lpMsg->count;


    for(int n=0;n<lpMsg->count;n++)

    {

        PMSG_PARTY_EFFECT_LIST* lpInfo = (PMSG_PARTY_EFFECT_LIST*)(((BYTE*)lpMsg)+sizeof(PMSG_PARTY_EFFECT_LIST_SEND)+(sizeof(PMSG_PARTY_EFFECT_LIST)*n));


        info.Buffs[n].effect = lpInfo->effect;

        info.Buffs[n].count = lpInfo->count;

    }


    std::string Name(lpMsg->name);


    std::map<std::string,PARTY_BUFFS_DATA>::iterator it = this->m_PartyBuffsData.find(Name);


    if(it == this->m_PartyBuffsData.end())

    {

        this->m_PartyBuffsData.insert(std::pair<std::string,PARTY_BUFFS_DATA>(Name,info));

    }

    else

    {

        it->second = info;

    }

}


PARTY_BUFFS_DATA* cPartyBuffs::GetInfoByName(char* Name)

{

    std::map<std::string, PARTY_BUFFS_DATA>::iterator it = this->m_PartyBuffsData.find(Name);


    if(it != this->m_PartyBuffsData.end())

    {

        return &it->second;

    }


    return 0;

}


void cPartyBuffs::DrawPartyBuffs(float StartX, float StartY, char* MemberName)

{

    std::map<std::string, PARTY_BUFFS_DATA>::iterator it = this->m_PartyBuffsData.find(MemberName);


    if(it != this->m_PartyBuffsData.end())

    {

        float Height = (float)(( 28.0f / 100) * 37.5); // ((double)(unsigned int)*(QWORD*)0x0E61E5C / 480.0); //28

        float Width = (float)(( 20.0f / 100) * 37.5); // ((double)(unsigned int)*(QWORD*)0xE61E58 / 640.0); //20

        float RenderW = (float)(( 256.0f / 100) * 37.5); // ((double)(unsigned int)*(QWORD*)0xE61E58 / 640.0);


        float X = StartX;


        for    ( int n = 0 ; n < it->second.count ; n++ )

        {

            if(n > 9)

            {

                X= (double) ( StartX - ( Width * (n - 9)) );

            }

            else

            {

                X= (double) ( StartX + ( Width * n) );

            }


            int EffectValue = (it->second.Buffs[n].effect - 1) % 80;

            float SourceX = (double)(EffectValue % 10) * Width / RenderW;

            float SourceY = (double)(EffectValue / 10) * Height / RenderW;

            float SourceWidth = Width / RenderW;

            float SourceHeight = Height / RenderW;

            RenderBitmap((it->second.Buffs[n].effect - 1) / 80 + 31725, X, StartY, Width, Height, SourceX, SourceY, SourceWidth, SourceHeight, 1, 1, 0);

        }

    }

}


It seems like this might be it - but I don't know how to go about it



I created PartyBuffs.h and PartyBuffs.cpp files, added #include "PartyBuffs.h" in

Central.cpp and Protocol.cpp

added this in Protocol.cpp:


Code: [Select]
 case 0x2E:

            gPartyBuffs.RecvPartyBuffs((PMSG_PARTY_EFFECT_LIST_SEND*)lpMsg);


I compiled (without errors) but the icons do not appear


Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
20 Replies
10196 Views
Last post August 24, 2020, 11:27:29 PM
by ZN00
5 Replies
4383 Views
Last post February 27, 2023, 02:32:58 PM
by cobyzero
12 Replies
5416 Views
Last post July 27, 2023, 08:59:28 PM
by Ryzenn
2 Replies
1159 Views
Last post January 09, 2025, 02:01:32 PM
by dima0909
0 Replies
299 Views
Last post December 30, 2024, 12:16:15 PM
by dima0909