Hikayeler

Reklam vermek için turkmmo@gmail.com

C++ Moblardan vb. Düşen yanglar envantere.

Metin2 EP, Valorant VP dahil tüm oyun ürünlerini en uygun fiyatlarla bulabilir, Item ve Karakterlerinizi hızlıca satabilirsiniz. HEMEN TIKLA!

paylaşım için teşekkürler

ekleyince grupta iken yanglar sadece kesen kişiye gidiyor
 
C++:
//service.h aç müsait bir yere ekle: #define ENABLE_DROP_GOLD

// char_battle.cpp aç -> Arat: void CHARACTER::RewardGold(LPCHARACTER pkAttacker)
 
// Komple kod bloğunu değiştir:

void CHARACTER::RewardGold(LPCHARACTER pkAttacker)
{
    // ADD_PREMIUM
    bool isAutoLoot =
        (pkAttacker->GetPremiumRemainSeconds(PREMIUM_AUTOLOOT) > 0 ||
            pkAttacker->IsEquipUniqueGroup(UNIQUE_GROUP_AUTOLOOT))
        ? true : false; // 제3의 손
    // END_OF_ADD_PREMIUM

    PIXEL_POSITION pos;

    if (!isAutoLoot)
        if (!SECTREE_MANAGER::instance().GetMovablePosition(GetMapIndex(), GetX(), GetY(), pos))
            return;

    int iTotalGold = 0;
    //
    // --------- 돈 드롭 확률 계산 ----------
    //
    int iGoldPercent = MobRankStats[GetMobRank()].iGoldPercent;

    if (pkAttacker->IsPC())
        iGoldPercent = iGoldPercent * (100 + CPrivManager::instance().GetPriv(pkAttacker, PRIV_GOLD_DROP)) / 100;

    if (pkAttacker->GetPoint(POINT_MALL_GOLDBONUS))
        iGoldPercent += (iGoldPercent * pkAttacker->GetPoint(POINT_MALL_GOLDBONUS) / 100);

    iGoldPercent = iGoldPercent * CHARACTER_MANAGER::instance().GetMobGoldDropRate(pkAttacker) / 100;

    // ADD_PREMIUM
    if (pkAttacker->GetPremiumRemainSeconds(PREMIUM_GOLD) > 0 ||
        pkAttacker->IsEquipUniqueGroup(UNIQUE_GROUP_LUCKY_GOLD))
        iGoldPercent += iGoldPercent;
    // END_OF_ADD_PREMIUM

    if (iGoldPercent > 100)
        iGoldPercent = 100;

    int iPercent;

    if (GetMobRank() >= MOB_RANK_BOSS)
        iPercent = ((iGoldPercent * PERCENT_LVDELTA_BOSS(pkAttacker->GetLevel(), GetLevel())) / 100);
    else
        iPercent = ((iGoldPercent * PERCENT_LVDELTA(pkAttacker->GetLevel(), GetLevel())) / 100);
    //int iPercent = CALCULATE_VALUE_LVDELTA(pkAttacker->GetLevel(), GetLevel(), iGoldPercent);

    if (number(1, 100) > iPercent)
        return;

    int iGoldMultipler = GetGoldMultipler();

    if (1 == number(1, 50000)) // 1/50000 확률로 돈이 10배
        iGoldMultipler *= 10;
    else if (1 == number(1, 10000)) // 1/10000 확률로 돈이 5배
        iGoldMultipler *= 5;

    // 개인 적용
    if (pkAttacker->GetPoint(POINT_GOLD_DOUBLE_BONUS))
        if (number(1, 100) <= pkAttacker->GetPoint(POINT_GOLD_DOUBLE_BONUS))
            iGoldMultipler *= 2;

    //
    // --------- 돈 드롭 배수 결정 ----------
    //
    if (test_server)
        pkAttacker->ChatPacket(CHAT_TYPE_PARTY, "gold_mul %d rate %d", iGoldMultipler, CHARACTER_MANAGER::instance().GetMobGoldAmountRate(pkAttacker));

    //
    // --------- 실제 드롭 처리 -------------
    //
    LPITEM item;

    int iGold10DropPct = 100;
    iGold10DropPct = (iGold10DropPct * 100) / (100 + CPrivManager::instance().GetPriv(pkAttacker, PRIV_GOLD10_DROP));

    // MOB_RANK가 BOSS보다 높으면 무조건 돈폭탄
    if (GetMobRank() >= MOB_RANK_BOSS && !IsStone() && GetMobTable().dwGoldMax != 0)
    {
        if (1 == number(1, iGold10DropPct))
            iGoldMultipler *= 10; // 1% 확률로 돈 10배

        int iSplitCount = number(25, 35);

        for (int i = 0; i < iSplitCount; ++i)
        {
            int iGold = number(GetMobTable().dwGoldMin, GetMobTable().dwGoldMax) / iSplitCount;
            if (test_server)
                sys_log(0, "iGold %d", iGold);
            iGold = iGold * CHARACTER_MANAGER::instance().GetMobGoldAmountRate(pkAttacker) / 100;
            iGold *= iGoldMultipler;

            if (iGold == 0)
            {
                continue;
            }

            if (test_server)
            {
                sys_log(0, "Drop Moeny MobGoldAmountRate %d %d", CHARACTER_MANAGER::instance().GetMobGoldAmountRate(pkAttacker), iGoldMultipler);
                sys_log(0, "Drop Money gold %d GoldMin %d GoldMax %d", iGold, GetMobTable().dwGoldMax, GetMobTable().dwGoldMax);
            }

            // NOTE: 돈 폭탄은 제 3의 손 처리를 하지 않음

#ifdef ENABLE_DROP_GOLD
            pkAttacker->PointChange(POINT_GOLD, iGold, false);
            iTotalGold += iGold; // Total gold
#else
            if ((item = ITEM_MANAGER::instance().CreateItem(1, iGold)))
            {
                pos.x = GetX() + ((number(-14, 14) + number(-14, 14)) * 23);
                pos.y = GetY() + ((number(-14, 14) + number(-14, 14)) * 23);

                item->AddToGround(GetMapIndex(), pos);
                item->StartDestroyEvent();

                iTotalGold += iGold; // Total gold
            }
#endif
        }
    }
    // 1% 확률로 돈을 10개 떨어 뜨린다. (10배 드롭임)
    else if (1 == number(1, iGold10DropPct))
    {
        //
        // 돈 폭탄식 드롭
        //
        for (int i = 0; i < 10; ++i)
        {
            int iGold = number(GetMobTable().dwGoldMin, GetMobTable().dwGoldMax);
            iGold = iGold * CHARACTER_MANAGER::instance().GetMobGoldAmountRate(pkAttacker) / 100;
            iGold *= iGoldMultipler;

            if (iGold == 0)
            {
                continue;
            }

#ifdef ENABLE_DROP_GOLD
            pkAttacker->PointChange(POINT_GOLD, iGold, false);
            iTotalGold += iGold; // Total gold
#else
            // NOTE: 돈 폭탄은 제 3의 손 처리를 하지 않음
            if ((item = ITEM_MANAGER::instance().CreateItem(1, iGold)))
            {
                pos.x = GetX() + (number(-7, 7) * 20);
                pos.y = GetY() + (number(-7, 7) * 20);

                item->AddToGround(GetMapIndex(), pos);
                item->StartDestroyEvent();

                iTotalGold += iGold; // Total gold
            }
#endif
        }
    }
    else
    {
        //
        // 일반적인 방식의 돈 드롭
        //
        int iGold = number(GetMobTable().dwGoldMin, GetMobTable().dwGoldMax);
        iGold = iGold * CHARACTER_MANAGER::instance().GetMobGoldAmountRate(pkAttacker) / 100;
        iGold *= iGoldMultipler;

        int iSplitCount;

        if (iGold >= 3 && !LC_IsYMIR())
            iSplitCount = number(1, 3);
        else if (GetMobRank() >= MOB_RANK_BOSS)
        {
            iSplitCount = number(3, 10);

            if ((iGold / iSplitCount) == 0)
                iSplitCount = 1;
        }
        else
            iSplitCount = 1;

        if (iGold != 0)
        {
            iTotalGold += iGold; // Total gold

            for (int i = 0; i < iSplitCount; ++i)
            {
                if (isAutoLoot)
                {
                    pkAttacker->GiveGold(iGold / iSplitCount);
                }
#ifdef ENABLE_DROP_GOLD
                pkAttacker->PointChange(POINT_GOLD, iGold / iSplitCount, false);
#else
                else if ((item = ITEM_MANAGER::instance().CreateItem(1, iGold / iSplitCount)))
                {
                    pos.x = GetX() + (number(-7, 7) * 20);
                    pos.y = GetY() + (number(-7, 7) * 20);

                    item->AddToGround(GetMapIndex(), pos);
                    item->StartDestroyEvent();
                }
#endif
            }
        }
    }

    DBManager::instance().SendMoneyLog(MONEY_LOG_MONSTER, GetRaceNum(), iTotalGold);
}

Artık kestiğiniz moblardan yanglar direk envanterinize eklenecektir.
Oto yang toplama sisteminiz varsa kaldırın. gerek kalmıyor.

Not: Alıntı değildir.
özlettin kendini torun arasana yeni birşeyler yapıyorum konuşuruz
 
Paylaşım için sağol
 

Şu an konuyu görüntüleyenler (Toplam : 1, Üye: 0, Misafir: 1)

Geri
Üst