예제 #1
0
        public IActionResult QueryShop(QueryShop actRow)
        {
            var     Account = HttpContext.User.Claims.FirstOrDefault(m => m.Type == ClaimTypes.Name).Value;
            JObject jo      = new JObject();
            string  sqlCon  = "where 1 = 1 ";

            try
            {
                if (!string.IsNullOrEmpty(actRow.shopName))
                {
                    sqlCon += "and t.shopName like '%" + actRow.shopName + "%' ";
                }
                strSql.Clear();
                strSql.AppendLine("select t.* ,t1.statusName from C10_shop t ");
                strSql.AppendLine("inner join S00_statusId t1 on t.shopType = t1.statusType and t.shopStatus = t1.statusId ");
                strSql.AppendLine(sqlCon + "and  t.statusId = '10' ");
                DataTable dt = Tools.Db.GetDataTable(Tools.System.getConStr("MyDB"), strSql.ToString());
                jo.Add("shopData", Tools.Db.getJsonForGrid(dt));
                jo.Add("resultCode", resultCode);
            }
            catch (Exception ex)
            {
                resultCode = "01";
                jo.Add("resultCode", resultCode);
                jo.Add("errMsg", ex.Message);
            }
            return(Content(JsonConvert.SerializeObject(jo), "application/json"));
        }
예제 #2
0
        private void OnReload(ReloadEventArgs args)
        {
            Economy.Economy.Products = QueryShop.GetProducts();
            args.Player.SendInfoMessage($"[Economy] Pomyslnie zaladowano {Economy.Economy.Products.Count} produktow.");

            Change.Config = ChangeConfig.Read("powelder/recipes.json");
            if (!File.Exists("powelder/recipes.json"))
            {
                Change.Config.Write("powelder/recipes.json");
            }
            Change.Recipes = new Dictionary <int, Recipe>();
            for (int i = 0; i < Change.Config.Recipes.Count(); i++)
            {
                Change.Recipes.Add(i, Change.Config.Recipes[i]);
            }
        }
예제 #3
0
        private void PostInitialize(EventArgs args)
        {
            IsReload = true;
            Economy.Economy.Products = QueryShop.GetProducts();
            TSPlayer.Server.SendInfoMessage("[Economy Shop] Pomyslnie zaladowano {0} produktow.", global::SurvivalCore.Economy.Economy.Products.Count);
            Goals.ProgressLoad();
            IsReload = false;
            Thread thread = new Thread(OneSecondThread)
            {
                IsBackground = true
            };

            thread.Start();
            Thread thread2 = new Thread(EventThreadRun)
            {
                IsBackground = true
            };

            thread2.Start();
            Thread thread3 = new Thread(SaveThread)
            {
                IsBackground = true
            };

            thread3.Start();
            Thread thread4 = new Thread(PingThread)
            {
                IsBackground = true
            };

            thread4.Start();

            new Thread(GiveOutMoneyThread)
            {
                IsBackground = true
            }.Start(10);

            System.Timers.Timer task = new System.Timers.Timer();
            task.Elapsed += BuffBoostTask;
            task.Interval = 3000;
            task.Enabled  = true;
        }
예제 #4
0
        public static void ShopAdmin(CommandArgs args)
        {
            string text  = null;
            string text2 = null;
            string s     = null;
            string s2    = null;

            if (args.Parameters.Count > 0)
            {
                text = args.Parameters[0].ToLower();
            }
            if (args.Parameters.Count > 1)
            {
                text2 = args.Parameters[1].ToLower();
            }
            if (args.Parameters.Count > 2)
            {
                s = args.Parameters[2].ToLower();
            }
            if (args.Parameters.Count > 3)
            {
                s2 = args.Parameters[3].ToLower();
            }
            switch (text)
            {
            default:
                args.Player.SendMessage("Admin Sklep:", Color.Green);
                args.Player.SendInfoMessage("add <ID/nazwa> <kupno> <sprzedaz>  - Dodawanie produktu");
                args.Player.SendInfoMessage("del <index> - Usuwanie produktu");
                args.Player.SendInfoMessage("edit <index> <kupno> <sprzedaz> - Edycja produktu");
                break;

            case "add":
            {
                List <Item> itemByIdOrName = TShock.Utils.GetItemByIdOrName(text2);
                if (itemByIdOrName.Count == 0)
                {
                    args.Player.SendErrorMessage("Nie znaleziono ani jednego itemu! :C *Płacz* ;C");
                    break;
                }
                if (itemByIdOrName.Count > 1)
                {
                    args.Player.SendMultipleMatchError(itemByIdOrName.Select((Item i) => $"{i.Name}({i.netID})"));
                    break;
                }
                Item item    = itemByIdOrName[0];
                int  result4 = 0;
                int  result5 = 0;
                if (!int.TryParse(s, out result4))
                {
                    args.Player.SendErrorMessage("Wprowadz poprawny Buy.");
                    break;
                }
                if (!int.TryParse(s2, out result5))
                {
                    args.Player.SendErrorMessage("Wprowadz poprawny Sell.");
                    break;
                }
                QueryShop.AddProduct(item.Name, item.type, result4, result5);
                args.Player.SendMessage($"Pomyslnie dodano [i:{item.Name}] ([c/11bb11:K] [c/55bb55:{result4}] ; [c/D42A2A:S] [c/D45A5A:{result5}])", Color.Gray);
                break;
            }

            case "del":
            {
                int result6 = -1;
                if (!int.TryParse(text2, out result6))
                {
                    args.Player.SendErrorMessage("Wprowadz poprawny Index.");
                }
                else if (QueryShop.IsExistIndex(result6))
                {
                    QueryShop.DelProduct(result6);
                    args.Player.SendMessage($"Pomyslnie usunieto.", Color.Gray);
                }
                else
                {
                    args.Player.SendErrorMessage("Nie ma takiego produktu o podanym Indeksie.");
                }
                break;
            }

            case "edit":
            {
                int result  = 0;
                int result2 = 0;
                int result3 = 0;
                if (!int.TryParse(text2, out result))
                {
                    args.Player.SendErrorMessage("Wprowadz poprawny Index.");
                }
                else if (!int.TryParse(s, out result2))
                {
                    args.Player.SendErrorMessage("Wprowadz poprawny Buy.");
                }
                else if (!int.TryParse(s2, out result3))
                {
                    args.Player.SendErrorMessage("Wprowadz poprawny Sell.");
                }
                else if (QueryShop.IsExistIndex(result))
                {
                    QueryShop.UpdateProduct(result, result2, result3);
                    args.Player.SendMessage($"Pomyslnie edytowano.", Color.Gray);
                }
                else
                {
                    args.Player.SendErrorMessage("Nie ma takiego produktu o podanym Indeksie.");
                }
                break;
            }
            }
        }