private IEnumerable <EddnEvent> ConvertMarketEvent(Market e, string commanderName) { if (e.Items == null) { yield break; } var commodities = e.Items .Where(i => i.Category != "NonMarketable") .Where(i => string.IsNullOrEmpty(i.Legality)) .ToArray(); var @event = new CommodityEvent() { Header = CreateHeader(commanderName), Message = new CommodityMessage() { Timestamp = e.Timestamp, MarketId = e.MarketId, StationName = e.StationName, SystemName = e.StarSystem, Commodities = commodities.Select(ConvertCommodity).ToArray() } }; yield return(@event); }
// Transfer data from Server data struction public void UpdateFromServerData(sg.GS2C_Pay_Get_Goods_Res.PayGoodInfo source) { currency = (CurrencyType)source.amountUnit; comType = CommodityType.Recharge; base.ItemID = source.id; BasicData.Name = source.name; BasicData.Description = source.summary; BasicData.Count = 1; BasicData.Icon = source.icon; BasicData.IsFirstDouble = source.isFirstDouble; CommodityStr = source.commodityStr; currPrice = source.rebateAmount; originalPrice = source.amount; buyTime = source.payTime; recvIgnotCnt = source.virtualAmount; foreach (sg.BI_Pay_HandselResources_Mes info in source.handselResourcesArray) { ItemMultData data = new ItemMultData(); data.LogicID = info.handselType; data.ItemCount = info.handselValue; // Just for show the free goods icon freeGoodsList.Add(data); } if (!string.IsNullOrEmpty(source.rebateBeginTime)) { bargainEvent = new CommodityEvent(); bargainEvent.eventId = CommodityEvent.CommodityEventId.Discount; bargainEvent.beginTime = source.rebateBeginTime; bargainEvent.endTime = source.rebateEndTime; } if (!string.IsNullOrEmpty(source.handselBeginTime)) { handselEvent = new CommodityEvent(); handselEvent.eventId = CommodityEvent.CommodityEventId.Handsel; handselEvent.beginTime = source.handselBeginTime; handselEvent.endTime = source.handselEndTime; } }
public void UpdateFromServerData(sg.GS2C_ItemMall_Get_Goods_Res.BuyGoodsInfo source) { currency = CurrencyType.Diamond; comType = CommodityType.GameInner; BasicData.LogicID = source.id; BasicData.FillDataFromConfig(); BasicData.Name = source.name; BasicData.Description = source.summary; BasicData.Icon = source.icon; currPrice = source.rebateAmount; originalPrice = source.amount; buyTime = source.buyTime; if (0 != source.handselItemId || -1 != source.handselItemId) { ItemMultData data = new ItemMultData(); data.LogicID = source.handselItemId; data.ItemCount = source.handselItemNumber; // source.handselBeginTime; // source.handselEndTime; freeGoodsList.Add(data); } if (!string.IsNullOrEmpty(source.rebateBeginTime)) { bargainEvent = new CommodityEvent(); bargainEvent.eventId = CommodityEvent.CommodityEventId.Discount; bargainEvent.beginTime = source.rebateBeginTime; bargainEvent.endTime = source.rebateEndTime; } if (!string.IsNullOrEmpty(source.handselBeginTime)) { handselEvent = new CommodityEvent(); handselEvent.eventId = CommodityEvent.CommodityEventId.Handsel; handselEvent.beginTime = source.handselBeginTime; handselEvent.endTime = source.handselEndTime; } }