예제 #1
0
        internal void LateInitialize(string id, ICoreAPI api, EntityTrader traderEntity)
        {
            base.LateInitialize(id, api);
            this.traderEntity = traderEntity;

            if (traderEntity?.TradeProps != null)
            {
                for (int slotId = 0; slotId < slots.Length; slotId++)
                {
                    if (!(slots[slotId] is ItemSlotTrade) || slots[slotId].Empty)
                    {
                        continue;
                    }

                    string name = (slots[slotId] as ItemSlotTrade).TradeItem?.Name;

                    if (slotId < 20)
                    {
                        (slots[slotId] as ItemSlotTrade).TradeItem = GetTradeItemByName(name, traderEntity.TradeProps.Selling);
                    }
                    else
                    {
                        (slots[slotId] as ItemSlotTrade).TradeItem = GetTradeItemByName(name, traderEntity.TradeProps.Buying);
                    }
                }
            }
        }
예제 #2
0
        internal void LateInitialize(string id, ICoreAPI api, EntityTrader traderEntity)
        {
            base.LateInitialize(id, api);
            this.traderEntity = traderEntity;

            // Never gets executed because trade slots are always empty at this point. What is this code good for?

            /*if (traderEntity?.TradeProps != null)
             * {
             *  for (int slotId = 0; slotId < slots.Length; slotId++)
             *  {
             *      if (!(slots[slotId] is ItemSlotTrade) || slots[slotId].Empty) continue;
             *
             *      string name = (slots[slotId] as ItemSlotTrade).TradeItem?.Name;
             *
             *      ItemSlotTrade tradeSlot = (slots[slotId] as ItemSlotTrade);
             *
             *      if (tradeSlot.TradeItem != null) continue;
             *
             *      tradeSlot.TradeItem = GetTradeItemByName(name, slotId < 20 ? traderEntity.TradeProps.Selling : traderEntity.TradeProps.Buying);
             *  }
             * }*/
        }