Exemplo n.º 1
0
        public void CacheDefinitions()
        {
            Definitions = new Dictionary<uint, furniture>();
            DateTime Start = DateTime.Now;

            DataTable Data = Engine.dbManager.ReadTable("SELECT * FROM furniture");
            var RowEnum = Data.Rows.GetEnumerator();

            while (RowEnum.MoveNext())
            {
                DataRow Row = (DataRow)RowEnum.Current;

                furniture furni = new furniture()
                {
                    id = (uint)Row["id"],
                    sprite_id = (int)Row["sprite_id"],
                    type = Row["type"].ToString()
                };

                Definitions.Add(furni.id, furni);
            }

            DateTime End = DateTime.Now;
            TimeSpan Expired = (End - Start);
            Engine.Logging.WriteTagLine("Cache", "Loaded {0} Item Definitions in {1} s and {2} ms", Definitions.Count, Expired.Seconds, Expired.Milliseconds);
        }
Exemplo n.º 2
0
        internal void Serialize(ServerMessage fuseResponse)
        {
            fuseResponse.Append <int>(id);
            fuseResponse.Append <string>(productname);
            fuseResponse.Append <int>(credits);
            fuseResponse.Append <int>(activitypoints);
            fuseResponse.Append <int>(activitypointtype);
            fuseResponse.Append <bool>(true);
            fuseResponse.Append <int>(items.Count());

            for (int i = 0; i < items.Count(); i++)
            {
                furniture furni = Engine.GetHabboHotel.getItemDefinitions.Definitions[uint.Parse(items[i])];

                fuseResponse.Append <string>(furni.type);
                fuseResponse.Append <int>(furni.sprite_id);
                fuseResponse.Append <string>("");
                fuseResponse.Append <int>(int.Parse(amounts[i]));
                fuseResponse.Append <int>(-1);
                fuseResponse.Append <bool>(false);
            }

            fuseResponse.Append <int>(vipneed);
            fuseResponse.Append <bool>((items.Count() < 2));
        }