コード例 #1
0
        public TradeItem(TradeItemInfo item)
        {
            Attributes    = new BsonDocument();
            TID           = item.TID;
            CID           = item.CID;
            CharacterName = item.ChracterName;
            ItemName      = item.ItemClass;//TODO: translate to user friendly name
            Quantity      = item.ItemCount;
            Price         = item.ItemPrice;
            Attribute     = item.AttributeEX;
            AddColor("Color1", item.color1);
            AddColor("Color2", item.color2);
            AddColor("Color3", item.color3);

            Expire = MessagePrinter.CloseDateToDateTime(item.CloseDate);
            Console.WriteLine("Parsing {0}", item.ItemClass);


            ParseAttribute(item.AttributeEX, item.ItemClass);
            if (item.CloseDate > DaysToSeconds(10))
            {
                Listed = DateTime.UtcNow;
            }
            else
            {
                int[] days = { 1, 3, 7, 10 };

                foreach (int day in days)
                {
                    int seconds = DaysToSeconds(day);
                    if (item.CloseDate <= seconds)
                    {
                        Listed = DateTime.UtcNow.AddSeconds(item.CloseDate - seconds);
                        break;
                    }
                }
            }
            Console.WriteLine("Parsed {0}", item.ItemClass);
        }