Example #1
0
 public static void Reset()
 {
     set4p = 0;
     ShopAllList.Clear();
     ShopBuyableList.Clear();
     ShopUniqueList.Clear();
     ShopDataMt1.Clear();
     ShopDataMt2.Clear();
     ShopDataGoods.Clear();
     ShopDataItems.Clear();
     TotalGoods     = 0;
     TotalItems     = 0;
     TotalMatching1 = 0;
     TotalMatching2 = 0;
 }
Example #2
0
        public static void Load(int type)
        {
            try
            {
                using (NpgsqlConnection connection = SQLjec.getInstance().conn())
                {
                    connection.Open();
                    NpgsqlCommand command = connection.CreateCommand();
                    command.CommandText = "SELECT * FROM shop";
                    command.CommandType = CommandType.Text;
                    NpgsqlDataReader data = command.ExecuteReader();
                    while (data.Read())
                    {
                        GoodItem good = new GoodItem
                        {
                            id         = data.GetInt32(0),
                            price_gold = data.GetInt32(3),
                            price_cash = data.GetInt32(4),
                            auth_type  = data.GetInt16(6),
                            buy_type2  = data.GetInt16(7),
                            buy_type3  = data.GetInt16(8),
                            tag        = data.GetInt16(9),
                            title      = data.GetInt16(10),
                            visibility = data.GetInt16(11)
                        };

                        good._item.SetItemId(data.GetInt32(1));
                        good._item._name  = data.GetString(2);
                        good._item._count = (UInt32)data.GetInt32(5);
                        int Static = ComDiv.getIdStatics(good._item._id, 1);
                        if (type == 1 || type == 2 && Static == 12)
                        {
                            ShopAllList.Add(good);
                            if (good.visibility != 2 && good.visibility != 4)
                            {
                                ShopBuyableList.Add(good);
                            }
                            if (!ShopUniqueList.ContainsKey(good._item._id) && good.auth_type > 0)
                            {
                                ShopUniqueList.Add(good._item._id, good);
                                if (good.visibility == 4)
                                {
                                    set4p++;
                                }
                            }
                        }
                    }
                    if (type == 1)
                    {
                        LoadDataMatching1Goods(0);
                        LoadDataMatching2(1);
                        LoadDataItems();
                    }
                    command.Dispose();
                    data.Close();
                    connection.Dispose();
                    connection.Close();
                }
                if (set4p > 0)
                {
                    Printf.warning("[Aviso] Existem " + set4p + " itens na loja invisíveis, porém com os ícones liberados.");
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[ShopManager.Load] Erro fatal!");
            }
        }