C 1
chengdu
xranzei 1
xranzei
zendor2 1
zendor2
Bvural41 1
Bvural41
noisiv 1
noisiv
Manwe Work 1
Manwe Work
Almira2 1
Almira2
romegames 1
romegames
D 1
delimuratt
melankolıa18 1
melankolıa18
shrpnl 1
shrpnl
Hikaye Ekle
Reklam vermek için turkmmo@gmail.com

K Envanteri Shop.cpp Ekleme ?

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Enix Yazılım

#ifdef Enix
Telefon Numarası Onaylanmış Üye TC Kimlik Numarası Doğrulanmış Üye
TM Üye
Üye
Katılım
2 Tem 2011
Konular
52
Mesajlar
932
Çözüm
32
Online süresi
2mo 10d
Reaksiyon Skoru
479
Altın Konu
1
Başarım Puanı
206
MmoLira
12,663
DevLira
6
Ticaret - 100%
0   0   1

ROHAN2 WORLD 1-120 TR TİPİ OFFICIAL YOHARA, BALATHOR VE AMON! 80. GÜNÜNDE! +10.000 ONLİNE! HİLE VE BOT %100 ENGELLİ HEMEN TIKLA!

Merhaba,

Filesim 40K Bir files ve k envanteri eklemek istiyorum ama Shop.cpp İstenilenden Farklı
Örnek ;
Normalde Böyle Olması Gerekirken Farklı Bir Filesin Shop.cpp'den int CShop::Buy Bölümü Normalde Benim Filesimdede Böyle Olması Gerekiyor ;
Kod:
int CShop::Buy(LPCHARACTER ch, BYTE pos, bool isSearchBuy /*= false*/)
{
    if (pos >= m_itemVector.size())
    {
        sys_log(0, "Shop::Buy : invalid position %d : %s", pos, ch->GetName());
        return SHOP_SUBHEADER_GC_INVALID_POS;
    }

    sys_log(0, "Shop::Buy : name %s pos %d", ch->GetName(), pos);
    GuestMapType::iterator it = m_map_guest.find(ch);

    /*if (it == m_map_guest.end())
        return SHOP_SUBHEADER_GC_END;*/
  
    if (!isSearchBuy)
    {
        if (it == m_map_guest.end())
            return SHOP_SUBHEADER_GC_END;

    }

    SHOP_ITEM& r_item = m_itemVector[pos];

    if (r_item.price < 0)
    {
        LogManager::instance().HackLog("SHOP_BUY_GOLD_OVERFLOW", ch);
        return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
    }

    LPITEM pkSelectedItem = ITEM_MANAGER::instance().Find(r_item.itemid);

#ifdef FULL_YANG
    long long dwPrice = r_item.price;
#else
    DWORD dwPrice = r_item.price;
#endif
    long long dwPriceCheque = r_item.price_cheque;
    DWORD dwTax = 0;

    /*if (!isSearchBuy)
    {
        if (it->second &&  raise_empire_prices)    // if other empire, price is triple
            dwPrice *= 3;
    }*/

    int iVal = quest::CQuestManager::instance().GetEventFlag("personal_shop");

    if (0 < iVal)
    {
        if (iVal > 100)
        {
            iVal = 100;
        }

        dwTax = dwPrice * iVal / 100;
        dwPrice = dwPrice - dwTax;
    }
    else
    {
        iVal = 0;
        dwTax = 0;
    }

#ifdef ENABLE_2TH_SHOPEX_SYSTEM
    if (m_pkPC)
    {
        if (ch->GetGold() < (int) dwPrice)
        {
            sys_log(1, "Shop::Buy : Not enough money : %s has %d, price %d", ch->GetName(), ch->GetGold(), dwPrice);
            return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
        }
      
        if (ch->GetCheque() < (int) dwPriceCheque)
        {
            sys_log(1, "Shop::Buy : Not enough money : %s has %d, price %d", ch->GetName(), ch->GetGold(), dwPrice);
            return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
        }
    }
    else
    {
        if (m_sPriceType == 0)
        {
            if (ch->GetGold() < (int) dwPrice)
            {
                sys_log(1, "Shop::Buy : Not enough money : %s has %lld, price %lld", ch->GetName(), ch->GetGold(), dwPrice);
                return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
            }         
        }
        else if (m_sPriceType == 1)
        {
            if (ch->GetDragonCoin() < (int) dwPrice)
            {
                sys_log(1, "Shop::Buy : Not enough dc : %s has %d, price %d", ch->GetName(), ch->GetDragonCoin(), dwPrice);
                return SHOP_SUBHEADER_GC_NOT_ENOUGH_DRAGON_COIN;
            }
        }
        else if (m_sPriceType == 2)
        {
            if (ch->GetDragonMark() < (int) dwPrice)
            {
                sys_log(1, "Shop::Buy : Not enough dm : %s has %d, price %d", ch->GetName(), ch->GetDragonMark(), dwPrice);
                return SHOP_SUBHEADER_GC_NOT_ENOUGH_DRAGON_MARK;
            }
        }
        else if (m_sPriceType == 3)
        {
            if (ch->GetAlignment() < (int) dwPrice*10)
            {
                sys_log(1, "Shop::Buy : Not enough alignment : %s has %d, price %d", ch->GetName(), ch->GetAlignment(), dwPrice*10);
                return SHOP_SUBHEADER_GC_NOT_ENOUGH_ALIGNMENT;
            }
        }
        else if (m_sPriceType == 4)
        {
            if (ch->GetWarPoint() < (int) dwPrice)
            {
                sys_log(1, "Shop::Buy : Not enough warpoint : %s has %d, price %d", ch->GetName(), ch->GetWarPoint(), dwPrice);
                return SHOP_SUBHEADER_GC_NOT_ENOUGH_WARPOINT;
            }
        }
        else if (m_sPriceType == 5)
        {
            if (ch->CountSpecifyItem(25105) < (int) dwPrice)
            {
                sys_log(1, "Shop::Buy : Not enough 10thgold : %s has %d, price %d", ch->GetName(), ch->CountSpecifyItem(25105), dwPrice);
                return SHOP_SUBHEADER_GC_NOT_ENOUGH_10TH_GOLD;
            }
        }
        #if defined(WJ_COMBAT_ZONE)
        else if (m_sPriceType == 6)
        {
            int iCurrentLimitPoints = ch->GetQuestFlag(COMBAT_ZONE_FLAG_LIMIT_POINTS);

            if (iCurrentLimitPoints == COMBAT_ZONE_SHOP_MAX_LIMIT_POINTS)
                return SHOP_SUBHEADER_GC_MAX_LIMIT_POINTS;
          
            if (ch->GetRealCombatZonePoints() < dwPrice)
                return SHOP_SUBHEADER_GC_NOT_ENOUGH_POINTS;

            if ((iCurrentLimitPoints + dwPrice) > COMBAT_ZONE_SHOP_MAX_LIMIT_POINTS)
                return SHOP_SUBHEADER_GC_OVERFLOW_LIMIT_POINTS;
        }
        #endif
    }
#else
    if (ch->GetGold() < (int) dwPrice)
    {
        sys_log(1, "Shop::Buy : Not enough money : %s has %d, price %d", ch->GetName(), ch->GetGold(), dwPrice);
        return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
    }
#endif
  
    LPITEM item;

    if (m_pkPC)
        item = r_item.pkItem;
    else {
        item = ITEM_MANAGER::instance().CreateItem(r_item.vnum, r_item.count);
    }
    if (!item)
        return SHOP_SUBHEADER_GC_SOLD_OUT;
  
    int iEmptyPos;
    if (item->IsDragonSoul())
    {
        iEmptyPos = ch->GetEmptyDragonSoulInventory(item);
    }
#ifdef WJ_SPLIT_INVENTORY_SYSTEM
    else if (item->IsSkillBook())
    {
        iEmptyPos = ch->GetEmptySkillBookInventory(item->GetSize());
    }
    else if (item->IsUpgradeItem())
    {
        iEmptyPos = ch->GetEmptyUpgradeItemsInventory(item->GetSize());
    }
    else if (item->IsStone())
    {
        iEmptyPos = ch->GetEmptyStoneInventory(item->GetSize());
    }
    else if (item->IsGiftBox())
    {
        iEmptyPos = ch->GetEmptyGiftBoxInventory(item->GetSize());
    }
#endif
    else
    {
        iEmptyPos = ch->GetEmptyInventory(item->GetSize());
    }

    if (iEmptyPos < 0)
    {
        if (m_pkPC)
        {
            sys_log(1, "Shop::Buy at PC Shop : Inventory full : %s size %d", ch->GetName(), item->GetSize());
            return SHOP_SUBHEADER_GC_INVENTORY_FULL;
        }
        else
        {
            sys_log(1, "Shop::Buy : Inventory full : %s size %d", ch->GetName(), item->GetSize());
            M2_DESTROY_ITEM(item);
            return SHOP_SUBHEADER_GC_INVENTORY_FULL;
        }
    }

#ifdef ENABLE_2TH_SHOPEX_SYSTEM
    if (m_pkPC)
    {
        ch->PointChange(POINT_GOLD, -dwPrice, false);
        ch->PointChange(POINT_CHEQUE, -dwPriceCheque, false);
    }
    else
    {
        if (m_sPriceType == 0)
        {
            ch->PointChange(POINT_GOLD, -dwPrice, false);
        }
        else if (m_sPriceType == 1)
        {
            ch->SetDragonCoin(ch->GetDragonCoin()-dwPrice);
            if (item->GetVnum() != 80014 || item->GetVnum() != 80015 || item->GetVnum() != 80016 || item->GetVnum() != 80017)
                ch->SetDragonMark(ch->GetDragonMark()+dwPrice);
        }
        else if (m_sPriceType == 2)
        {
            ch->SetDragonMark(ch->GetDragonMark()-dwPrice);
        }
        else if (m_sPriceType == 3)
        {
            ch->UpdateAlignment(-dwPrice*10);
        }
        else if (m_sPriceType == 4)
        {
            ch->SetWarPoint(ch->GetWarPoint()-dwPrice);
        }
        else if (m_sPriceType == 5)
        {
            ch->RemoveSpecifyItem(25105, dwPrice);
        }
        #if defined(WJ_COMBAT_ZONE)
        else if (m_sPriceType == 6)
        {
            ch->SetRealCombatZonePoints(ch->GetRealCombatZonePoints() - dwPrice);
            ch->SetQuestFlag(COMBAT_ZONE_FLAG_LIMIT_POINTS, ch->GetQuestFlag(COMBAT_ZONE_FLAG_LIMIT_POINTS) + dwPrice);
            ch->SetQuestFlag(COMBAT_ZONE_FLAG_BUY_LAST_TIME, get_global_time());

            std::vector<DWORD> m_vec_refreshData;
            m_vec_refreshData.push_back(ch->GetRealCombatZonePoints() - dwPrice);
            m_vec_refreshData.push_back(ch->GetQuestFlag(COMBAT_ZONE_FLAG_LIMIT_POINTS));
            m_vec_refreshData.push_back(COMBAT_ZONE_SHOP_MAX_LIMIT_POINTS);
            m_vec_refreshData.push_back(0);
            CCombatZoneManager::instance().SendCombatZoneInfoPacket(ch, COMBAT_ZONE_SUB_HEADER_REFRESH_SHOP, m_vec_refreshData);
        }
        #endif
    }
#else
    ch->PointChange(POINT_GOLD, -dwPrice, false);
#endif

    // ¡¾?AO ¢©?¢©??? : ??¡¾Y A¢§?o
    if (m_pkPC)
    {
#ifdef ENABLE_NEW_QUICK_SLOT_SYSTEM
        m_pkPC->SyncNewQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 1000);
#endif
        char buf[512];
        DWORD mpid = m_pkPC->GetPlayerID();
        if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007)
        {
            snprintf(buf, sizeof(buf), "%s FROM: %u TO: %u PRICE: %u", item->GetName(), ch->GetPlayerID(), mpid, dwPrice);
            LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), SHOP_BUY, buf);
            LogManager::instance().GoldBarLog(mpid, item->GetID(), SHOP_SELL, buf);
        }
        LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(r_item.vnum, r_item.count);

        if (!item)
            return SHOP_SUBHEADER_GC_SOLD_OUT;

        if (pkNewItem)
        {
            for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
            {
                pkNewItem->SetSocket(i, item->GetSocket(i));
            }
            // ¸ÅÁ÷ ¾ÆÀÌÅÛ ¼³Á¤
            item->CopyAttributeTo(pkNewItem);

            if (pkNewItem->IsDragonSoul())
                pkNewItem->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
#ifdef WJ_SPLIT_INVENTORY_SYSTEM
            else if (pkNewItem->IsSkillBook())
                pkNewItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            else if (pkNewItem->IsUpgradeItem())
                pkNewItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            else if (pkNewItem->IsStone())
                pkNewItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            else if (pkNewItem->IsGiftBox())
                pkNewItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
#endif
            else
                pkNewItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            pkNewItem->SetEvolution(item->GetEvolution());
            pkNewItem->SetTransmutation(item->GetTransmutation());
            item->RemoveFromCharacter();
            M2_DESTROY_ITEM(item);
            ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem);
            std::string szBuy("SHOP_BUY");
            std::string szSell("SHOP_SELL");
#ifdef FULL_YANG
            snprintf(buf, sizeof(buf), "%s %u(%s) %lld %u", pkNewItem->GetName(), mpid, m_pkPC->GetName(), dwPrice, pkNewItem->GetCount());
            LogManager::instance().ItemLog(ch, pkNewItem, szBuy.c_str(), buf);
            snprintf(buf, sizeof(buf), "%s %u(%s) %lld %u", pkNewItem->GetName(), ch->GetPlayerID(), ch->GetName(), dwPrice, pkNewItem->GetCount());
            LogManager::instance().ItemLog(m_pkPC, pkNewItem, szSell.c_str(), buf);
#else
            snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", pkNewItem->GetName(), mpid, m_pkPC->GetName(), dwPrice, pkNewItem->GetCount());
            LogManager::instance().ItemLog(ch, pkNewItem, szBuy.c_str(), buf);
            snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", pkNewItem->GetName(), ch->GetPlayerID(), ch->GetName(), dwPrice, pkNewItem->GetCount());
            LogManager::instance().ItemLog(m_pkPC, pkNewItem, szSell.c_str(), buf);
#endif



            r_item.pkItem = NULL;
            BroadcastUpdateItem(pos);
            //RemoveFromMysql(m_pkPC->GetPlayerID(), pos);
            {
#ifdef FULL_YANG_OWN
                m_pkPC->ChangeGold(dwPrice);
#else
                m_pkPC->PointChange(POINT_GOLD, dwPrice, false);
#endif
                m_pkPC->PointChange(POINT_CHEQUE, dwPriceCheque, false);
                if (iVal > 0)
                {
                    m_pkPC->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÆÇ¸Å±İ¾×ÀÇ %d %% °¡ ¼¼±İÀ¸·Î ³ª°¡°ÔµË´Ï´Ù"), iVal);
                }

            }
            item = pkNewItem;
        }
        else {
            return SHOP_SUBHEADER_GC_INVALID_POS;
        }
    }
    else
    {
        if (item->IsDragonSoul())
            item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
#ifdef WJ_SPLIT_INVENTORY_SYSTEM
            else if (item->IsSkillBook())
                item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            else if (item->IsUpgradeItem())
                item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            else if (item->IsStone())
                item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            else if (item->IsGiftBox())
                item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
#endif
        else
            item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
        if (r_item.alSockets[0] > 0)
        {
            const TItemTable * table;
            table = ITEM_MANAGER::instance().GetTable(item->GetVnum());
          
            for (int i=0 ; i < ITEM_LIMIT_MAX_NUM ; i++)
            {
                if (LIMIT_REAL_TIME == table->aLimits->bType)
                    item->SetSocket(0, time(0) + r_item.alSockets[0]);
                else
                    item->SetSocket(0, r_item.alSockets[0]);
            }
        }
        if (r_item.alSockets[1] > 0)
            item->SetSocket(1, r_item.alSockets[1]);
        if (r_item.alSockets[2] > 0)
            item->SetSocket(2, r_item.alSockets[2]);
        if (r_item.alSockets[3] > 0)
            item->SetSocket(3, r_item.alSockets[3]);
        if (r_item.aAttr[0].bType > 0 && r_item.aAttr[0].sValue > 0)
            item->SetForceAttribute(0, r_item.aAttr[0].bType, r_item.aAttr[0].sValue);
        if (r_item.aAttr[1].bType > 0 && r_item.aAttr[1].sValue > 0)
            item->SetForceAttribute(1, r_item.aAttr[1].bType, r_item.aAttr[1].sValue);
        if (r_item.aAttr[2].bType > 0 && r_item.aAttr[2].sValue > 0)
            item->SetForceAttribute(2, r_item.aAttr[2].bType, r_item.aAttr[2].sValue);
        if (r_item.aAttr[3].bType > 0 && r_item.aAttr[3].sValue > 0)
            item->SetForceAttribute(3, r_item.aAttr[3].bType, r_item.aAttr[3].sValue);
        if (r_item.aAttr[4].bType > 0 && r_item.aAttr[4].sValue > 0)
            item->SetForceAttribute(4, r_item.aAttr[4].bType, r_item.aAttr[4].sValue);
        if (r_item.aAttr[5].bType > 0 && r_item.aAttr[5].sValue > 0)
            item->SetForceAttribute(5, r_item.aAttr[5].bType, r_item.aAttr[5].sValue);
        if (r_item.aAttr[6].bType > 0 && r_item.aAttr[6].sValue > 0)
            item->SetForceAttribute(6, r_item.aAttr[6].bType, r_item.aAttr[6].sValue);
        ITEM_MANAGER::instance().FlushDelayedSave(item);
        LogManager::instance().ItemLog(ch, item, "BUY", item->GetName());

        if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007)
        {
            LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), PERSONAL_SHOP_BUY, "");
        }

        //DBManager::instance().SendMoneyLog(MONEY_LOG_SHOP, item->GetVnum(), -dwPrice);
    }

    if (item)
        sys_log(0, "SHOP: BUY: name %s %s(x %d):%u price %u", ch->GetName(), item->GetName(), item->GetCount(), item->GetID(), dwPrice);
    ch->Save();
    return (SHOP_SUBHEADER_GC_OK);
}


Benim Filesimide Bir Shop.cpp içerisindeki
örneğin editlemem gereken yerler
C++:
pkNewItem->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
bunu aratın altına ;
C++:
#ifdef WJ_SPLIT_INVENTORY_SYSTEM
            else if (pkNewItem->IsSkillBook())
                pkNewItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            else if (pkNewItem->IsUpgradeItem())
                pkNewItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            else if (pkNewItem->IsStone())
                pkNewItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
            else if (pkNewItem->IsSandik())
                pkNewItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
#endif

ekleyin diyor ancak maalesef bende pknewitem ile başlamıyor sadece item-> ile başlıyor ve buna uyarlamaya çalışsamda hata veriyor
ne yapmam gerekiyor yardımcı olun lütfen
 
Son düzenleme:

En Çok Reaksiyon Alan Mesajlar

@Blackniga31 hocam benim filesde 2 tane var sen uyarlayıp verebilirmisin bana shop.cpp yi sana gönderiyim benim shop.cpp yi
 
Ben bi uyarladım deniyorum build olmasını bakalım olmassa göndereceğim skype varmı ? ordan konuşalım
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

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

Geri
Üst