Jump to content
Sign in to follow this  
Kenshi Torres

[C ++] Ws 3-2-1 Go sistema

Recommended Posts

Explicación 

Debes iniciar sesión para ver el contenido del enlace en esta publicación.
: Cuando comienza el duelo, el efecto es 3-2-1 go. Muy agradable. Si está editando archivos tipo ws, le sugiero que lo instale 

 

service.h:

#define ENABLE_3_2_1_GO

pvp.cpp:

 

# buscar

void CPVPManager::Insert(LPCHARACTER pkChr, LPCHARACTER pkVictim)
 
# agregar debajo
 
#ifdef ENABLE_3_2_1_GO
EVENTINFO(start_duel_efect_info)
{
    LPCHARACTER ch1;
    LPCHARACTER ch2;
    CPVP * pkPVP;
    BYTE state;

    start_duel_efect_info()
    : ch1( NULL )
    ,ch2( NULL )
    ,pkPVP( NULL )
    ,state( 0 )
    {
    }
};

EVENTFUNC(start_duel_efect)
{
    start_duel_efect_info * info = dynamic_cast<start_duel_efect_info *>(event->info);

    if ((info == NULL) || (info->ch1 == NULL) || (info->ch2 == NULL) || (info->pkPVP == NULL)) return 0;

    switch (info->state)
    {
        case 0:
        {
            info->ch1->SpecificEffectPacket("d:/ymir work/effect/pvp/3.mse");
            info->ch2->SpecificEffectPacket("d:/ymir work/effect/pvp/3.mse");
            info->state++;
            return PASSES_PER_SEC(1);
            break;
        }
        case 1:
        {
            info->ch1->SpecificEffectPacket("d:/ymir work/effect/pvp/2.mse");
            info->ch2->SpecificEffectPacket("d:/ymir work/effect/pvp/2.mse");
            info->state++;
            return PASSES_PER_SEC(1);
            break;
        }
        case 2:
        {
            info->ch1->SpecificEffectPacket("d:/ymir work/effect/pvp/1.mse");
            info->ch2->SpecificEffectPacket("d:/ymir work/effect/pvp/1.mse");
            info->state++;
            return PASSES_PER_SEC(1);
            break;
        }
        case 3:
    {
        info->ch1->SpecificEffectPacket("d:/ymir work/effect/pvp/go.mse");
        info->ch2->SpecificEffectPacket("d:/ymir work/effect/pvp/go.mse");
        if (info->pkPVP->Agree(info->ch1->GetPlayerID()))
        {
            info->ch2->ChatPacket(CHAT_TYPE_INFO, "Duelul cu: %s a inceput!", info->ch1->GetName());
            info->ch1->ChatPacket(CHAT_TYPE_INFO, "Duelul cu: %s a inceput!", info->ch2->GetName());
        }
        return 0;
        break;
    }
}
    return 0;
}
#endif

# buscar

void CPVPManager::Insert(LPCHARACTER pkChr, LPCHARACTER pkVictim)
 
# Remplazar
 
#ifdef ENABLE_3_2_1_GO
void CPVPManager::Insert(LPCHARACTER pkChr, LPCHARACTER pkVictim)
{
    if (pkChr->IsDead() || pkVictim->IsDead() || pkChr->FindAffect(AFFECT_PVP_START))
        return;

    CPVP kPVP(pkChr->GetPlayerID(), pkVictim->GetPlayerID());

    CPVP * pkPVP;

    if (pkPVP = Find(kPVP.m_dwCRC))
    {
        start_duel_efect_info * info = AllocEventInfo<start_duel_efect_info>();
        info->ch1 = pkChr;
        info->ch2 = pkVictim;
        info->pkPVP = pkPVP;
        info->state = 0;
        pkChr->AddAffect(AFFECT_PVP_START, APPLY_NONE, 0, 0, 5, 0, false);
        event_create(start_duel_efect, info, 0);
        return;
    }

    pkPVP = M2_NEW CPVP(kPVP);

    pkPVP->SetVID(pkChr->GetPlayerID(), pkChr->GetVID());
    pkPVP->SetVID(pkVictim->GetPlayerID(), pkVictim->GetVID());

    m_map_pkPVP.insert(map<DWORD, CPVP *>::value_type(pkPVP->m_dwCRC, pkPVP));

    m_map_pkPVPSetByID[pkChr->GetPlayerID()].insert(pkPVP);
    m_map_pkPVPSetByID[pkVictim->GetPlayerID()].insert(pkPVP);

    pkPVP->Packet();

    char msg[CHAT_MAX_LEN + 1];
    snprintf(msg, sizeof(msg), "Ai fost provocat la duel de: %s.", pkChr->GetName()); //e el

    pkVictim->ChatPacket(CHAT_TYPE_INFO, msg);
    pkChr->ChatPacket(CHAT_TYPE_INFO, "L-ai provocat la duel pe: %s.", pkVictim->GetName()); //is eu

    // NOTIFY_PVP_MESSAGE
    LPDESC pkVictimDesc = pkVictim->GetDesc();
    if (pkVictimDesc)
    {
        TPacketGCWhisper pack;

        int len = MIN(CHAT_MAX_LEN, strlen(msg) + 1);

        pack.bHeader = HEADER_GC_WHISPER;
        pack.wSize = sizeof(TPacketGCWhisper) + len;
        pack.bType = WHISPER_TYPE_SYSTEM;
        strlcpy(pack.szNameFrom, pkChr->GetName(), sizeof(pack.szNameFrom));

        TEMP_BUFFER buf;

        buf.write(&pack, sizeof(TPacketGCWhisper));
        buf.write(msg, len);

        pkVictimDesc->Packet(buf.read_peek(), buf.size());
    }
    // END_OF_NOTIFY_PVP_MESSAGE
}
#else
void CPVPManager::Insert(LPCHARACTER pkChr, LPCHARACTER pkVictim)
{
    if (pkChr->IsDead() || pkVictim->IsDead())
        return;

    CPVP kPVP(pkChr->GetPlayerID(), pkVictim->GetPlayerID());

    CPVP * pkPVP;

    if ((pkPVP = Find(kPVP.m_dwCRC)))
    {
        // ???oC? ?o ?O?c¬c¬e ??!¤I c©I??!
        if (pkPVP->Agree(pkChr->GetPlayerID()))
        {
            pkVictim->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%scYO!Au?C cYe!Aa c©???!"), pkChr->GetName());
            pkChr->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%scYO!Au?C cYe!Aa c©???!"), pkVictim->GetName());
        }
        return;
    }

    pkPVP = M2_NEW CPVP(kPVP);

    pkPVP->SetVID(pkChr->GetPlayerID(), pkChr->GetVID());
    pkPVP->SetVID(pkVictim->GetPlayerID(), pkVictim->GetVID());

    m_map_pkPVP.insert(map<DWORD, CPVP *>::value_type(pkPVP->m_dwCRC, pkPVP));

    m_map_pkPVPSetByID[pkChr->GetPlayerID()].insert(pkPVP);
    m_map_pkPVPSetByID[pkVictim->GetPlayerID()].insert(pkPVP);

    pkPVP->Packet();

    char msg[CHAT_MAX_LEN + 1];
    snprintf(msg, sizeof(msg), LC_TEXT("%scYO?? cYe!Aac©??!í?!í C©¬c©?cY?cY?. c©A©©!iC?!¤Ac¬e cYe!AaYi??Cc¬| C????a."), pkChr->GetName());

    pkVictim->ChatPacket(CHAT_TYPE_INFO, msg);
    pkChr->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s?c§!AO cYe!Aac©??!í?!í C©¬c©?cY?cY?."), pkVictim->GetName());

    // NOTIFY_PVP_MESSAGE
    LPDESC pkVictimDesc = pkVictim->GetDesc();
    if (pkVictimDesc)
    {
        TPacketGCWhisper pack;

        int len = MIN(CHAT_MAX_LEN, strlen(msg) + 1);

        pack.bHeader = HEADER_GC_WHISPER;
        pack.wSize = sizeof(TPacketGCWhisper) + len;
        pack.bType = WHISPER_TYPE_SYSTEM;
        strlcpy(pack.szNameFrom, pkChr->GetName(), sizeof(pack.szNameFrom));

        TEMP_BUFFER buf;

        buf.write(&pack, sizeof(TPacketGCWhisper));
        buf.write(msg, len);

        pkVictimDesc->Packet(buf.read_peek(), buf.size());
    }
    // END_OF_NOTIFY_PVP_MESSAGE
}
#endif

# buscar

bool CPVPManager::Dead(LPCHARACTER pkChr, DWORD dwKillerPID)

# remplazar
 
#ifdef ENABLE_3_2_1_GO
bool CPVPManager::Dead(LPCHARACTER pkChr, DWORD dwKillerPID)
{
    CPVPSetMap::iterator it = m_map_pkPVPSetByID.find(pkChr->GetPlayerID());

    if (it == m_map_pkPVPSetByID.end())
        return false;

    bool found = false;

    sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID());
    TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin();

    while (it2 != it->second.end())
    {
        CPVP * pkPVP = *it2++;

        DWORD dwCompanionPID;

        if (pkPVP->m_players[0].dwPID == pkChr->GetPlayerID())
            dwCompanionPID = pkPVP->m_players[1].dwPID;
        else
            dwCompanionPID = pkPVP->m_players[0].dwPID;

        if (dwCompanionPID == dwKillerPID)
        {
            if (pkPVP->IsFight())
            {
                pkPVP->SetLastFightTime();
                pkPVP->Win(dwKillerPID);
                found = true;
                break;
            }
            else if (get_dword_time() - pkPVP->GetLastFightTime() <= 15000)
            {
                found = true;
                break;
            }
        }
    }

    LPCHARACTER pkChrW = CHARACTER_MANAGER::instance().FindByPID(dwKillerPID);
    pkChrW->SpecificEffectPacket("d:/ymir work/effect/pvp/win.mse");

    return found;
}
#else
bool CPVPManager::Dead(LPCHARACTER pkChr, DWORD dwKillerPID)
{
    CPVPSetMap::iterator it = m_map_pkPVPSetByID.find(pkChr->GetPlayerID());

    if (it == m_map_pkPVPSetByID.end())
        return false;

    bool found = false;

    sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID());
    TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin();

    while (it2 != it->second.end())
    {
        CPVP * pkPVP = *it2++;

        DWORD dwCompanionPID;

        if (pkPVP->m_players[0].dwPID == pkChr->GetPlayerID())
            dwCompanionPID = pkPVP->m_players[1].dwPID;
        else
            dwCompanionPID = pkPVP->m_players[0].dwPID;

        if (dwCompanionPID == dwKillerPID)
        {
            if (pkPVP->IsFight())
            {
                pkPVP->SetLastFightTime();
                pkPVP->Win(dwKillerPID);
                found = true;
                break;
            }
            else if (get_dword_time() - pkPVP->GetLastFightTime() <= 15000)
            {
                found = true;
                break;
            }
        }
    }

    return found;
}
#endif

affect.h:

 

# buscar

AFFECT_DRAGON_SOUL_DECK_1 = 542,

# Agregar debajo

#ifdef ENABLE_3_2_1_GO
    AFFECT_PVP_START = 543,
    AFFECT_PVP_WIN = 544,
#endif

# buscar

AFF_BITS_MAX

# Agregar debajo

#ifdef ENABLE_3_2_1_GO
    AFF_PVP_START,
    AFF_PVP_WIN,
#endif

Finalmente, si desea que los archivos a los que he dado efecto agreguen un índice adicional, tire su paquete y luego tírelo a una carpeta, si desea desactivarlo, tírelo a su paquete actual.

 

 

Debes iniciar sesión para ver el contenido del enlace en esta publicación.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...