Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
alex_good_kaban

Trader покупка товара из контейнера находящегося в инвентаре

Есть артефакты на сервере, у которых прописана трата его HP когда его держишь в руках через CheckArtefact. Чтоб они не тратились когда находятся в персонаже есть определенные контейнеры в которых их переносят. Появился вопрос продажи артефактов именно из контейнера. 
Вот из того что смог накидать .Артефакты после этого начинают продаваться с контейнера, но не удаляются из него. Подскажите что еще нужно дописать, чтоб артефакт удалялся после продажи.
 

modded class TraderMenu extends UIScriptedMenu
{
    override bool isInPlayerInventory(string itemClassname, int amount) // duplicate
    {
        PlayerBase m_Player = g_Game.GetPlayer();
        itemClassname.ToLower();
        
        bool isMagazine = false;
        if (amount == -3)
            isMagazine = true;

        bool isWeapon = false;
        if (amount == -4)
            isWeapon = true;

        bool isSteak = false;
        if (amount == -5)
            isSteak = true;

        array<EntityAI> itemsArray = new array<EntityAI>;        
        m_Player.GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER, itemsArray);
        
        //TraderMessage.PlayerWhite("--------------");

        ItemBase item;        
        for (int i = 0; i < itemsArray.Count(); i++)
        {
            Class.CastTo(item, itemsArray.Get(i));
            string itemPlayerClassname = "";

            if (!item)
                continue;

            if (item.IsRuined())
                continue;

            if ( isAttached(item) && item.!IsInherited(ArtifactBase) )
                continue;

            itemPlayerClassname = item.GetType();
            itemPlayerClassname.ToLower();

            //TraderMessage.PlayerWhite("I: " + itemPlayerClassname + " == " + itemClassname);

            if(itemPlayerClassname == itemClassname && ((getItemAmount(item) >= amount && !isMagazine && !isWeapon && !isSteak) || isMagazine || isWeapon || (isSteak && (getItemAmount(item) >= GetItemMaxQuantity(itemPlayerClassname) * 0.5))))
            {
                return true;
            }
        }
        
        return false;
    }
}
modded class DayZPlayerImplement
{
    override bool isInPlayerInventory(string itemClassname, int amount)
    {
        if ( itemClassname.Contains("art_") )
            return true;
        
        return super.isInPlayerInventory(itemClassname, amount)
    }
}

 

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.