Example #1
0
 private static void SetBack(PlayerMobile pm)
 {
     ProTag.Del(pm, "AFK Message");
     ProTag.Del(pm, "AFK Location");
     ProTag.Del(pm, "AFK Time");
     pm.Emote("*Returns to the game*");
 }
Example #2
0
 private static void SetAFK(PlayerMobile pm, string message)
 {
     ProTag.Set(pm, "AFK Message", message);
     ProTag.Set(pm, "AFK Location", pm.Location.ToString());
     ProTag.Set(pm, "AFK Time", DateTime.Now.ToString());
     pm.Emote("*Is now AFK*");
 }
Example #3
0
        private static TimeSpan GetAFKTimeSpan(PlayerMobile pm)
        {
            TimeSpan time;

            try
            {
                time = DateTime.Now - DateTime.Parse(ProTag.Get(pm, "AFK Time"));
            }
            catch
            {
                time = TimeSpan.Zero;
            }

            return(time);
        }
Example #4
0
////////////////////////////DOC ALLOW ONLY IF QUEST DONE///////////////////////////////////////////////////////
        public override bool OnEquip(Mobile from)
        {
            PlayerMobile mobile = (PlayerMobile)from;

            string staff  = ProTag.Get(mobile, "Staff");
            int    result = int.Parse(staff);

            if (result == 1)         //Check to see if bound to a serial.
            {
                return(true);        //player finished quest and can equip it.
            }

            else
            {
                from.SendMessage("You have not completed this quest and cannot equip the Ultimate Staff of Power.");
                return(false);                //Disallow any one else from equiping the item.
            }
        }
        public ActionResult Update(FormCollection f, string id)
        {
            try
            {
                var data = db.Products.First(u => u.id.Equals(id));
                if (data.pro_view == null)
                {
                    data.pro_view = 0;
                }
                data.groupId       = f["cateId"];
                data.proPrice      = int.Parse(f["price"]);
                data.proPrice_sale = int.Parse(f["priceSale"]);
                data.pro_name      = f["proName"];
                data.proCode       = f["proCode"];
                string keyTag = StringClass.NameToTag(data.pro_name.ToLower()).Replace(" ", "");
                var    key    = checkTrungUpdate(keyTag, data.id);
                data.pro_key = key;
                data.proFile = f["proFile"];
                data.brandId = f["brandId"];

                data.proContentTab1 = f["proContentTab1"];
                data.proContentTab2 = f["proContentTab2"];
                data.proContentTab3 = f["proContentTab3"];
                data.proOrder       = int.Parse(f["proOrder"]);
                //check
                var pro_new = f["pro_new"];
                var pro_hot = f["proHot"];
                var active  = f["proStatus"];
                data.pro_new = pro_new == null ? false : true;
                data.pro_hot = pro_hot == null ? false : true;
                data.active  = active == null ? false : true;
                //seo
                data.desSeo   = f["desSeo"];
                data.titleSeo = f["titleSeo"];
                data.keySeo   = f["keySeo"];
                //ảnh
                data.proAvata   = f["proAvata"];
                data.proImages1 = f["proAvata1"];
                data.proImages2 = f["proAvata2"];
                data.proImages3 = f["proAvata3"];
                data.proImages4 = f["proAvata4"];
                data.proImages5 = f["proAvata5"];
                //hết ảnh
                data.updateDate = DateTime.Now;
                #region [giai phap]
                var protag = db.ProTags.Where(u => u.proId.Equals(data.id));
                if (protag.Count() > 0)
                {
                    db.ProTags.RemoveRange(protag);
                }
                string tagId     = "";
                var    Faqnumber = 0;// Convert.ToInt32(f["Tagnumber"]);
                if (Faqnumber > 0)
                {
                    ProTag pros;
                    for (int i = 0; i < Faqnumber; i++)
                    {
                        tagId = f["ckTag_" + i];
                        if (tagId != null)
                        {
                            pros       = new ProTag();
                            pros.idPT  = Guid.NewGuid().ToString();
                            pros.proId = data.id;
                            pros.tagId = f["valueTag_" + i];
                            db.ProTags.Add(pros);
                        }
                    }
                }
                #endregion

                db.SaveChanges();
                Session["ok"] = "Cập nhật sản phẩm thành công!";
                return(Redirect("/Prodcuts/Index"));
            }
            catch (Exception)
            {
                Session["erro"] = "Đã xảy ra lỗi vui lòng thử lại!";
                return(Redirect("/Prodcuts/Update/" + id));
            }
        }
        public ActionResult Add(FormCollection f)
        {
            try
            {
                var     addType = f["addType"];
                Product data    = new Product();
                data.id            = Guid.NewGuid().ToString();
                data.pLang         = lang;
                data.pro_view      = 0;
                data.proPrice      = int.Parse(f["price"]);
                data.proPrice_sale = int.Parse(f["priceSale"]);
                data.groupId       = f["cateId"];
                data.pro_name      = f["proName"];
                data.proCode       = f["proCode"];
                string keyTag = StringClass.NameToTag(data.pro_name.ToLower()).Replace(" ", "");
                var    key    = checkTrung(keyTag);
                data.pro_key = key;
                data.proFile = f["proFile"];
                data.brandId = f["brandId"];

                data.proContentTab1 = f["proContentTab1"];
                data.proContentTab2 = f["proContentTab2"];
                data.proContentTab3 = f["proContentTab3"];
                data.proOrder       = int.Parse(f["proOrder"]);
                //check
                var pro_new = f["pro_new"];
                var pro_hot = f["proHot"];
                var active  = f["proStatus"];
                data.pro_new = pro_new == null ? false : true;
                data.pro_hot = pro_hot == null ? false : true;
                data.active  = active == null ? false : true;
                //seo
                data.desSeo   = f["desSeo"];
                data.titleSeo = f["titleSeo"];
                data.keySeo   = f["keySeo"];
                //ảnh
                data.proAvata   = f["proAvata"];
                data.proImages1 = f["proAvata1"];
                data.proImages2 = f["proAvata2"];
                data.proImages3 = f["proAvata3"];
                data.proImages4 = f["proAvata4"];
                data.proImages5 = f["proAvata5"];
                data.createDate = DateTime.Now;
                data.updateDate = DateTime.Now;
                db.Products.Add(data);

                #region [giai phap]
                string tagId     = "";
                var    Faqnumber = 0;// Convert.ToInt32(f["Tagnumber"]);
                if (Faqnumber > 0)
                {
                    ProTag pros;
                    for (int i = 0; i < Faqnumber; i++)
                    {
                        tagId = f["ckTag_" + i];
                        if (tagId != null)
                        {
                            pros       = new ProTag();
                            pros.idPT  = Guid.NewGuid().ToString();
                            pros.proId = data.id;
                            pros.tagId = f["valueTag_" + i];
                            db.ProTags.Add(pros);
                        }
                    }
                }
                #endregion

                db.SaveChanges();
                Session["ok"] = "Thêm mới sản phẩm thành công!";
                if (addType.Equals("0"))
                {
                    return(Redirect("/Prodcuts/Index"));
                }
                else
                {
                    return(Redirect("/Prodcuts/Add"));
                }
            }
            catch (Exception)
            {
                Session["erro"] = "Đã xảy ra lỗi vui lòng thử lại!";
                return(Redirect("/Prodcuts/Add/"));
            }
        }
Example #7
0
 private static string GetAFKLocation(PlayerMobile pm)
 {
     return(ProTag.Get(pm, "AFK Location"));
 }
Example #8
0
 private static string GetAFKMessage(PlayerMobile pm)
 {
     return(ProTag.Get(pm, "AFK Message"));
 }
Example #9
0
 private static bool isAFK(PlayerMobile pm)
 {
     return(ProTag.Get(pm, "AFK Time") != null);
 }