Jump to content

[C++] Sistema de lider de guild


F-Caneiras

Recommended Posts

Boas 

Venho trazer um sistema que coloca outro membro da guild como sublider mostrando o nome sublider no membro

Vamos lá


Codificação: ONURSTEEL
Data: 6.04.2017, 22:30

Propriedades do sistema;

Instantaneamente, o líder da guilda ou general da guilda mostrará sua tag com o nome da guild.

EX. [Guild Lideri] - nome personagem, [Guild Generali] - nome personagem,

image.png

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Spoiler


//Client/UserInterface/InstanceBaseEffect.cpp abrir e procurar;
CPythonTextTail::Instance().RegisterCharacterTextTail(m_dwGuildID, dwVID, s_kD3DXClrTextTail, fTextTailHeight);

//troca;
CPythonTextTail::Instance().RegisterCharacterTextTail(m_dwGuildID, m_dwNewIsGuildName, dwVID, s_kD3DXClrTextTail, fTextTailHeight);

//Client/UserInterface/InstanceBase.cpp abrir e procurar;
DWORD CInstanceBase::GetGuildID()
{
    return m_dwGuildID;
}

//Diciona a cima;
BYTE CInstanceBase::GetNewIsGuildName()
{
    return m_dwNewIsGuildName;
}

//Procurar;
if (GetInstanceType() == CActorInstance::TYPE_ENEMY)
    m_dwLevel = CPythonNonPlayer::Instance().GetMobLevel(GetRace());
else
    m_dwLevel = c_rkCreateData.m_dwLevel;
m_dwGuildID = c_rkCreateData.m_dwGuildID;
m_dwEmpireID = c_rkCreateData.m_dwEmpireID;

//Diciona a cima;
m_dwNewIsGuildName = c_rkCreateData.m_dwNewIsGuildName;

//Procurar;
void CInstanceBase::ChangeGuild(DWORD dwGuildID)
{
    m_dwGuildID=dwGuildID;

    DetachTextTail();
    AttachTextTail();
    RefreshTextTail();
}

//Trocar todo o codigo por este.
void CInstanceBase::ChangeGuild(DWORD dwGuildID, DWORD dwNewIsGuildName)
{
    m_dwGuildID=dwGuildID;
    m_dwNewIsGuildName=dwNewIsGuildName;

    DetachTextTail();
    AttachTextTail();
    RefreshTextTail();
}

//Procurar;
m_dwGuildID = 0;

//Diciona a cima;
m_dwNewIsGuildName = 0;

//Client/UserInterface/InstanceBase.h abrir e procurar;
DWORD    m_dwMountVnum;

//Diciona a cima;
BYTE    m_dwNewIsGuildName;

//Procurar;
void                    ChangeGuild(DWORD dwGuildID);

//troca;
void                    ChangeGuild(DWORD dwGuildID, DWORD dwNewIsGuildName);

//Procurar;
DWORD                    m_dwGuildID;

//Diciona a cima;
BYTE                    m_dwNewIsGuildName;

//Procurar;
DWORD                    GetGuildID();

//Diciona a cima ;
BYTE                    GetNewIsGuildName();

//Client/UserInterface/PythonCharacterManager.cpp abrir e procurar;
pInstance->ChangeGuild(pInstance->GetGuildID();

//troca;
pInstance->ChangeGuild(pInstance->GetGuildID(), pInstance->GetNewIsGuildName());

//Client/UserInterface/PythonTextTail.cpp abrir e procurar;
std::string strGuildName;

if (!CPythonGuild::Instance().GetGuildName(dwGuildID, &strGuildName))
    strGuildName = "Noname";

//troca;
std::string strGuildName;
if (!CPythonGuild::Instance().GetGuildName(dwGuildID, &strGuildName))
    strGuildName = "Noname";
        
if (dwNewIsGuildName == 3)
    strGuildName.insert(0, "[Lonca Lideri] - ");
else if (dwNewIsGuildName == 2)
    strGuildName.insert(0, "[Lonca Generali] - ");

void CPythonTextTail::RegisterCharacterTextTail(DWORD dwGuildID, DWORD dwVirtualID, const D3DXCOLOR & c_rColor, float fAddHeight)

//troca;
void CPythonTextTail::RegisterCharacterTextTail(DWORD dwGuildID, BYTE dwNewIsGuildName, DWORD dwVirtualID, const D3DXCOLOR & c_rColor, float fAddHeight)

//Client/UserInterface/PythonTextTail.h abrir e procurar;
void RegisterCharacterTextTail(DWORD dwGuildID, DWORD dwVirtualID, const D3DXCOLOR & c_rColor, float fAddHeight=10.0f);

//troca;
void RegisterCharacterTextTail(DWORD dwGuildID, BYTE m_dwNewIsGuildName, DWORD dwVirtualID, const D3DXCOLOR & c_rColor, float fAddHeight=10.0f);

//Client/UserInterface/PythonTextTailModule.cpp abrir e procurar;
PyObject * textTailRegisterCharacterTextTail(PyObject * poSelf, PyObject * poArgs)

//Trocar todo o codigo por este;
PyObject * textTailRegisterCharacterTextTail(PyObject * poSelf, PyObject * poArgs)
{
    int iGuildID;
    if (!PyTuple_GetInteger(poArgs, 0, &iGuildID))
        return Py_BuildException();
    int iNewIsGuildName;
    if (!PyTuple_GetInteger(poArgs, 1, &iNewIsGuildName))
        return Py_BuildException();
    int iVirtualID;
    if (!PyTuple_GetInteger(poArgs, 2, &iVirtualID))
        return Py_BuildException();

    CPythonTextTail::Instance().RegisterCharacterTextTail(iGuildID, iVirtualID, iNewIsGuildName, D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f));

    return Py_BuildNone();
}

//Client/UserInterface/NetworkActorManager.cpp abrir e procurar;
m_dwGuildID = src.m_dwGuildID;

//Diciona a cima;
m_dwNewIsGuildName = src.m_dwNewIsGuildName;

//Procurar;
kCreateData.m_dwMountVnum=rkNetActorData.m_dwMountVnum;

//Diciona a cima;
kCreateData.m_dwNewIsGuildName=rkNetActorData.m_dwNewIsGuildName;

//Procurar;
pkInstFind->ChangeGuild(c_rkNetUpdateActorData.m_dwGuildID);

//troca;
pkInstFind->ChangeGuild(c_rkNetUpdateActorData.m_dwGuildID, c_rkNetUpdateActorData.m_dwNewIsGuildName);

//Procurar;
rkNetActorData.m_dwGuildID=c_rkNetUpdateActorData.m_dwGuildID;

//Diciona a cima;
rkNetActorData.m_dwNewIsGuildName=c_rkNetUpdateActorData.m_dwNewIsGuildName;

//Client/UserInterface/NetworkActorManager.h abrir e procurar;
DWORD    m_dwGuildID;

//Diciona a cima;
BYTE    m_dwNewIsGuildName;

//Procurar;
DWORD m_dwMountVnum;

//Diciona a cima;
DWORD m_dwNewIsGuildName;

//Procurar;
m_dwMountVnum=0;

//Diciona a cima;
m_dwNewIsGuildName=0;

//Client/UserInterface/PythonNetworkStreamPhaseGameActor.cpp abrir e procurar;
kNetActorData.m_dwMountVnum=0;

//Diciona a cima;
kNetActorData.m_dwNewIsGuildName=0;

//Procurar;
kNetActorData.m_dwMountVnum=chrInfoPacket.dwMountVnum;

//Diciona a cima;
kNetActorData.m_dwNewIsGuildName=chrInfoPacket.dwNewIsGuildName;

//Procurar;
kNetUpdateActorData.m_dwMountVnum=chrUpdatePacket.dwMountVnum;

//Diciona a cima;
kNetUpdateActorData.m_dwNewIsGuildName=chrUpdatePacket.dwNewIsGuildName;

//Procurar;
kNetActorData.m_dwMountVnum=chrAddPacket.dwMountVnum;

//Diciona a cima;
kNetActorData.m_dwNewIsGuildName=chrAddPacket.dwNewIsGuildName;

//Procurar;
kNetUpdateActorData.m_dwMountVnum=chrUpdatePacket.dwMountVnum;

//Diciona a cima;
kNetUpdateActorData.m_dwNewIsGuildName=chrUpdatePacket.dwNewIsGuildName;

//Client/UserInterface/Packet.h abrir e procurar;
TPacketGCCharacterAdditionalInfo

//Adicionar ao topo;
BYTE    dwNewIsGuildName;

//Procurar;
TPacketGCCharacterAdd2

//Adicionar ao topo;
BYTE        dwNewIsGuildName;

//Procurar;
TPacketGCCharacterUpdate

//Adicionar ao topo;
BYTE        dwNewIsGuildName;

//Procurar;
TPacketGCCharacterUpdate2

//Adicionar ao topo;
BYTE        dwNewIsGuildName;

//Game/src/Char.cpp abrir e procurar;
if (GetGuild() != NULL)

//Trocar todo o codigo por este;
if (GetGuild() != NULL)
{    
    addPacket.dwGuildID = GetGuild()->GetID();
    CGuild* pGuild = this->GetGuild();
    if (pGuild->GetMasterPID() == GetPlayerID())
        addPacket.dwNewIsGuildName = 3;

    else if (pGuild->NewIsGuildGeneral(GetPlayerID()) == true)
        addPacket.dwNewIsGuildName = 2;

    else
        addPacket.dwNewIsGuildName = 1;
}
else
{
    addPacket.dwGuildID = 0;
    addPacket.dwNewIsGuildName = 0;
}

//Procurar;
pack.dwMountVnum    = GetMountVnum();

//Diciona a cima;
    CGuild* pGuild = this->GetGuild();
    if (pGuild)
    {
        if (pGuild->GetMasterPID() == GetPlayerID())
            pack.dwNewIsGuildName = 3;
        else if (pGuild->NewIsGuildGeneral(GetPlayerID()) == true)
            pack.dwNewIsGuildName = 2;
        else
            pack.dwNewIsGuildName = 1;
    }
    else
    {
        pack.dwNewIsGuildName = 0;
    }

//Game/src/Packet.h abrir e procurar;
TPacketGCCharacterAdditionalInfo

//Adicionar ao topo;
BYTE    dwNewIsGuildName;

//Procurar;
TPacketGCCharacterUpdate

//Adicionar ao topo;
BYTE    dwNewIsGuildName;

//Game/src/Guild.cpp abrir e procurar;
DWORD CGuild::GetMemberPID(const std::string& strName)
{
    for ( TGuildMemberContainer::iterator iter = m_member.begin();
            iter != m_member.end(); iter++ )
    {
        if ( iter->second.name == strName ) return iter->first;
    }

    return 0;
}

//Diciona a cima;
BYTE CGuild::NewIsGuildGeneral(DWORD pid)
{
    for ( TGuildMemberContainer::iterator iter = m_member.begin(); iter != m_member.end(); iter++ )
    {
        if ( iter->first == pid )
            return iter->second.is_general;
    }
    return 0;
}

//Game/src/Guild.h abrir e procurar;
DWORD            GetMemberPID(const std::string& strName);

//Diciona a cima;
BYTE            NewIsGuildGeneral(DWORD pid);

Ficheiro original

link

Fonte Freakgamers

tradução google e eu 

 

 

 

 

Edited by Caneiras
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...