コード例 #1
0
        public void UpdateMicroResource(MaterialCommoditiesMicroResourceList mc)
        {
            foreach (var m in Offered.EmptyIfNull())
            {
                MaterialCommodityMicroResourceType.EnsurePresent(m.Category, m.Name, m.Name_Localised);
                mc.Change(EventTimeUTC, m.Category, m.Name, -m.Count, 0, MicroResource.ShipLocker);
            }

            if ( Received.HasChars())
            {
                MaterialCommodityMicroResourceType.EnsurePresent(Category, Received, Received_Localised);
                mc.Change(EventTimeUTC, Category, Received, Count, 0, MicroResource.ShipLocker);
            }
        }
コード例 #2
0
        public void UpdateMicroResource(MaterialCommoditiesMicroResourceList mc, JournalEntry previous)
        {
            if (previous?.EventTypeID != JournalTypeEnum.ShipLocker)    // if shiplocker is before, its already updated
            {
                System.Diagnostics.Debug.WriteLine("Trade - remove offered");
                foreach (var m in Offered.EmptyIfNull())
                {
                    MaterialCommodityMicroResourceType.EnsurePresent(m.Category, m.Name, m.Name_Localised);
                    mc.Change(EventTimeUTC, m.Category, m.Name, -m.Count, 0, MicroResource.ShipLocker);
                }

                System.Diagnostics.Debug.WriteLine("Trade - add received");
                if (Received.HasChars())
                {
                    MaterialCommodityMicroResourceType.EnsurePresent(Category, Received, Received_Localised);
                    mc.Change(EventTimeUTC, Category, Received, Count, 0, MicroResource.ShipLocker);
                }
            }
        }