Beispiel #1
0
        /// <summary>
        /// Vendor has validated the transactions and sent a list of items for processing.
        /// </summary>
        public void FinalizeBuyTransaction(Vendor vendor, List <WorldObject> uqlist, List <WorldObject> genlist, bool valid, uint goldcost)
        {
            // todo research packets more for both buy and sell. ripley thinks buy is update..
            // vendor accepted the transaction
            if (valid)
            {
                if (SpendCurrency(goldcost, WeenieType.Coin) != null)
                {
                    foreach (WorldObject wo in uqlist)
                    {
                        TryCreateInInventoryWithNetworking(wo);
                    }

                    foreach (var gen in genlist)
                    {
                        TryCreateInInventoryWithNetworking(gen);
                    }
                }
                else // not enough cash.
                {
                    valid = false;
                }
            }

            vendor.BuyItemsFinalTransaction(this, uqlist, valid);
        }
Beispiel #2
0
        /// <summary>
        /// Vendor has validated the transactions and sent a list of items for processing.
        /// </summary>
        public void FinalizeBuyTransaction(Vendor vendor, List <WorldObject> uqlist, List <WorldObject> genlist, bool valid, uint goldcost)
        {
            // todo research packets more for both buy and sell. ripley thinks buy is update..
            // vendor accepted the transaction
            if (valid)
            {
                if (SpendCurrency(goldcost, WeenieType.Coin))
                {
                    foreach (WorldObject wo in uqlist)
                    {
                        wo.ContainerId       = Guid.Full;
                        wo.PlacementPosition = 0;
                        AddToInventory(wo);
                        Session.Network.EnqueueSend(new GameMessageCreateObject(wo));
                        Session.Network.EnqueueSend(new GameMessagePutObjectInContainer(Session, Guid, wo, 0));
                        Session.Network.EnqueueSend(new GameMessageUpdateInstanceId(Guid, wo.Guid, PropertyInstanceId.Container));
                    }
                    AddNewWorldObjectsToInventory(genlist);
                }
                else // not enough cash.
                {
                    valid = false;
                }
            }

            vendor.BuyItemsFinalTransaction(this, uqlist, valid);
        }