Exemplo n.º 1
0
    /* Rotation() */
    public void Rotation()
    {
        Logging.Write(name + ": Started.");

        while (_isRunning)
        {
            try
            {
                if (Products.InPause)
                {
                    Lua.LuaDoString(@"dRotationFrame.text:SetText(""dRotation Paused!"")");
                }
                else if (!ObjectManager.Me.IsDeadMe && ObjectManager.Me.Target.IsNotZero())
                {
                    CombatRotation();
                }
                else if (!MyHelpers.haveBuff("Deadly Poison"))
                {
                    DeadlyPoison.Launch();
                }
                else if (!MyHelpers.haveBuff("Crippling Poison"))
                {
                    CripplingPoison.Launch();
                }
            }
            catch (Exception e)
            {
                Logging.WriteError(name + " ERROR: " + e);
            }

            Thread.Sleep(50); // Pause 10 ms to reduce the CPU usage.
        }
        Logging.Write(name + ": Stopped.");
    }
Exemplo n.º 2
0
    private bool doKicks()
    {
        Vector3 lastPos = ObjectManager.Me.Position;

        if (OutlawSettings.CurrentSetting.EnableInterrupt)
        {
            WoWUnit toInterrupt = MyHelpers.InterruptableUnits();
            if (toInterrupt != null)
            {
                ObjectManager.Me.FocusGuid = toInterrupt.Guid;
                if (Kick.IsSpellUsable && Kick.KnownSpell && MyHelpers.getTargetDistance() <= MyHelpers.getMeleeRange())
                {
                    MovementManager.Face(toInterrupt.Position);
                    Kick.Launch(false, false, false, "focus");
                    MovementManager.Face(ObjectManager.Target.Position);
                    Lua.LuaDoString("dRotationFrame.text:SetText(\"Kick " + MyHelpers.getTargetDistance() + " / " + MyHelpers.GetMeleeRangeWithTarget() + "\")");
                    return(true);
                }

                if (Blind.IsSpellUsable && Blind.KnownSpell && MyHelpers.getTargetDistance() <= MyHelpers.getMeleeRange())
                {
                    MovementManager.Face(toInterrupt.Position);
                    Blind.Launch(false, false, false, "focus");
                    MovementManager.Face(ObjectManager.Target.Position);
                    Lua.LuaDoString("dRotationFrame.text:SetText(\"Blind " + MyHelpers.getTargetDistance() + " / " + MyHelpers.GetMeleeRangeWithTarget() + "\")");
                    return(true);
                }
            }
        }
        return(false);
    }
Exemplo n.º 3
0
    private void Rotation()
    {
        Logging.Write(name + ": Started.");

        while (_isRunning)
        {
            try
            {
                if (Products.InPause)
                {
                    Lua.LuaDoString(@"dRotationFrame.text:SetText(""dRotation Paused!"")");
                }
                else if (!ObjectManager.Me.IsDeadMe && !ObjectManager.Me.IsMounted)
                {
                    if (ObjectManager.Me.Target.IsNotZero() && ObjectManager.Target.IsAttackable)
                    {
                        CombatRotation();
                    }
                    else
                    {
                        Lua.LuaDoString(@"dRotationFrame.text:SetText(""searchAttackers!"")");
                        MyHelpers.searchAttackers();
                    }
                }
            }
            catch (Exception e)
            {
                Logging.WriteError(name + " ERROR: " + e);
            }

            Thread.Sleep(100); // Pause 10 ms to reduce the CPU usage.
        }
        Logging.Write(name + ": Stopped.");
    }
Exemplo n.º 4
0
    private bool doBuilders()
    {
        if (OutlawSettings.CurrentSetting.EnablePistolShot &&
            PistolShot.KnownSpell &&
            PistolShot.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= MyHelpers.getDistanceRange() &&
            ((MyHelpers.haveBuff("Opportunity") && MyHelpers.getComboPoint() <= 4) ||
             (MyHelpers.getTargetDistance() > MyHelpers.getMeleeRange() && !(BetweenTheEyes.IsSpellUsable && MyHelpers.getComboPoint() == 6)) ||
             (MyHelpers.haveBuff("Deadshot") && MyHelpers.haveBuff("Seething Rage") && !BetweenTheEyes.IsSpellUsable)
            )
            )
        {
            MyHelpers.castSpell(PistolShot.Name);
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Pistol Shot"")");
            return(true);
        }

        if (OutlawSettings.CurrentSetting.EnableSinisterStrike &&
            SinisterStrike.KnownSpell &&
            SinisterStrike.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= MyHelpers.getMeleeRange() &&
            MyHelpers.getComboPoint() <= 5)
        {
            MyHelpers.castSpell(SinisterStrike.Name);

            Lua.LuaDoString("dRotationFrame.text:SetText(\"Sinister Strike " + MyHelpers.getTargetDistance() + " / " + MyHelpers.GetMeleeRangeWithTarget() + "\")");
            return(true);
        }
        return(false);
    }
Exemplo n.º 5
0
 public bool registerUser(User user)
 {
     user.Password = MyHelpers.HashPassword(user.Password);
     _context.User.Add(user);
     _context.SaveChanges();
     return(true);
 }
Exemplo n.º 6
0
    public static bool rtbReroll()
    {
        int[] reroll = rollTheBonesCount();

        if ((getAttackers(18) < 3 &&
             reroll[0] < 2 &&
             !MyHelpers.haveBuff(MyHelpers.RuthlessPrecision)) ||
            reroll[1] < 5)
        {
            return(true);
        }

        if ((getAttackers(18) >= 3 &&
             reroll[0] < 2 &&
             !MyHelpers.haveBuff(MyHelpers.RuthlessPrecision) &&
             !MyHelpers.haveBuff(MyHelpers.GrandMelee)) ||
            reroll[1] < 5 ||
            (getAttackers(18) > 1 &&
             reroll[0] == 2 &&
             MyHelpers.haveBuff(MyHelpers.SkullAndCrossbones) &&
             (MyHelpers.haveBuff(MyHelpers.TrueBearing) || MyHelpers.haveBuff(MyHelpers.BuriedTreasure))))
        {
            return(true);
        }

        return(false);
    }
Exemplo n.º 7
0
        public ActionResult RegistarFuncionario(string Username, string Nome, string Email)
        {
            string      password    = RandomString(10);
            Funcionario funcionario = new Funcionario();

            funcionario.Username = Username;
            funcionario.Password = MyHelpers.HashPassword(password);
            funcionario.Nome     = Nome;
            funcionario.Email    = Email;
            funcionario.Estado   = true;
            funcionario.Role     = "employee";

            try
            {
                db.Funcionarios.Add(funcionario);
                db.SaveChanges();
                sendEmail(Email, Username, password);
            }
            catch (DbUpdateException ex)
            {
                Console.WriteLine(ex);
                return(RedirectToAction("insucessAction"));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
0
        public HtmlString VratiInfoODokumentu(long idPredmeta, short idDokumenta)
        {
            var korisnik = RuntimeDataHelpers.GetRuntimeData(Request);
            var info     = DMSData.VratiDetaljeDokumenta(korisnik, idPredmeta, idDokumenta);

            return(new HtmlString(MyHelpers.NapraviHoverPopupDokumenti(info, korisnik)));
        }
Exemplo n.º 9
0
    void Update()
    {
        var speedBodyIncrement = (difficulty / 10);

        Debug.Log("Incremente de crecimiento  " + speedBodyIncrement);
        CharacterbodyFat.transform.localScale = new Vector3(CharacterbodyFat.transform.localScale.x + (0.5f + speedBodyIncrement) * Time.deltaTime, CharacterbodyFat.transform.localScale.y, CharacterbodyFat.transform.localScale.z);
        if ((Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) || Input.GetMouseButtonDown(0))
        {
            var mousWorldPos = cam.ScreenToWorldPoint(Input.mousePosition);
            var pos          = new Vector3(mousWorldPos.x, mousWorldPos.y, this.transform.position.z);

            GameObject objectHit = MyHelpers.getRaycastedGameObject(new Vector3(Input.mousePosition.x, Input.mousePosition.y, this.transform.position.z), cam);

            if (objectHit != null)
            {
                if (objectHit.name.Equals("circle(Clone)"))
                {
                    Destroy(objectHit);
                    if (CharacterbodyFat.transform.localScale.x >= 2.575463f)
                    {
                        CharacterbodyFat.transform.localScale = new Vector3(CharacterbodyFat.transform.localScale.x - 0.5f, 5, 5);
                    }
                }
            }
        }
    }
Exemplo n.º 10
0
 public ActionResult Login(LoginViewModel model)
 {
     if (ModelState.IsValid)
     {
         var pass  = MyHelpers.Md5(model.Upass);
         var admin = db.Users.SingleOrDefault(e => e.Uname == model.Uname && e.Upass == pass);
         if (admin != null)
         {
             try
             {
                 FormsAuthentication.SetAuthCookie(model.Uname, false);
                 var    authTicket      = new FormsAuthenticationTicket(1, admin.Uname, DateTime.Now, DateTime.Now.AddDays(1), false, admin.Roles);
                 string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                 var    authCookie      = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                 HttpContext.Response.Cookies.Add(authCookie);
                 return(RedirectToAction("Index", "Manage"));
             }
             catch (Exception e)
             {
                 ModelState.AddModelError("", e.Message);
                 return(View(model));
             }
         }
         ModelState.AddModelError("", "Đăng nhập thất bại!");
     }
     return(View(model));
 }
Exemplo n.º 11
0
        public ActionResult RegisterUser(LoginViewModel model)
        {
            var pass  = MyHelpers.Md5(model.Upass);
            var admin = db.Users.SingleOrDefault(e => e.Uname == model.Uname);

            if (ModelState.IsValid)
            {
                try
                {
                    if (admin == null)
                    {
                        var user = new DAN.Models.User()
                        {
                            Uname = model.Uname, Upass = MyHelpers.Md5(model.Upass), Roles = "0"
                        };
                        db.Users.Add(user);
                        db.SaveChanges();
                        ModelState.AddModelError("", "Đăng ký thành công!");
                        return(View("Login"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Đăng ký thất bại!");
                        return(View("Register"));
                    }
                }catch (Exception e)
                {
                    ModelState.AddModelError("", "Đăng ký thất bại!");
                    return(View("Register"));
                }
            }
            return(View("Index"));
        }
Exemplo n.º 12
0
        public ActionResult EditUser(int itemId, string act)
        {
            switch (act)
            {
            case "edit":
                var user = db.Users.Find(itemId);
                if (user == null)
                {
                    return(RedirectToAction("User"));
                }
                var model = new UserViewModel()
                {
                    Uname = user.Uname,
                    Upass = MyHelpers.Md5(user.Upass)
                };
                return(View(model));

            case "delete":
                var users = db.Users.Find(itemId);
                db.Users.Remove(users);
                db.SaveChanges();
                return(RedirectToAction("User"));

            default:
                Response.StatusCode = 404;
                return(HttpNotFound());
            }
        }
Exemplo n.º 13
0
        public ActionResult AdicionarCliente(string name, int NIF, string Email, int Telemovel, string CP, int Nr, string Ap, string Rua, string password)
        {
            var localidade = (from m in db.CP_Localidade where m.Id == CP select m).ToList().FirstOrDefault();

            Cliente cliente = new Cliente()
            {
                Apartamento   = Ap,
                CP            = CP,
                CP_Localidade = localidade,
                Email         = Email,
                Id            = NIF,
                Nome          = name,
                Nr            = Nr,
                Pass_word     = password,
                Role          = "user",
                Rua           = Rua,
                Telemovel     = Telemovel,
            };

            cliente.setRole();


            if (ModelState.IsValid)
            {
                cliente.Pass_word = MyHelpers.HashPassword(cliente.Pass_word);
                db.Cliente.Add(cliente);
                db.SaveChanges();
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 14
0
    public void Damage()
    {
        if (VampiricTouch.IsSpellUsable && !ObjectManager.Target.HaveBuff(VampiricTouch.Name))
        {
            MyHelpers.castSpell(VampiricTouch.Name);

            return;
        }

        if (VoidEruption.IsSpellUsable)
        {
            MyHelpers.castSpell(VoidEruption.Name);

            return;
        }

        if (ShadowWordVoid.IsSpellUsable)
        {
            MyHelpers.castSpell(ShadowWordVoid.Name);

            return;
        }
        if (Shadowfiend.IsSpellUsable)
        {
            MyHelpers.castSpell(Shadowfiend.Name);

            return;
        }
        if (MindFly.IsSpellUsable && !MyHelpers.isChanneling())
        {
            MyHelpers.castSpell(MindFly.Name);

            return;
        }
    }
Exemplo n.º 15
0
        public IActionResult RegisterUser([Bind] Utilizador user)
        {
            var returnedUser = db.Utilizador.Where(b => b.Email == user.Email).FirstOrDefault();

            if (ModelState.IsValid && returnedUser == null)
            {
                try
                {
                    user.Password = MyHelpers.HashPassword(user.Password);
                    db.Utilizador.Add(user);
                    db.SaveChanges();
                }
                catch (Exception)
                {
                    TempData["Fail"] = "This User ID already exists. Registration Failed.";
                }
                ModelState.Clear();
                TempData["Success"] = "Registration Successful!";
            }
            else
            {
                TempData["Fail"] = "This Email already exists. Registration Failed.";
            }
            return(View());
        }
 public bool RegistarUtilizador(Utilizador u)
 {
     u.password = MyHelpers.HashPassword(u.password);
     _context.utilizadores.Add(u);
     _context.SaveChanges();
     return(true);
 }
Exemplo n.º 17
0
 public bool needAzshara()
 {
     return(!MyHelpers.haveBuff("Latent Arcana") &&
            MyHelpers.itemIsUsable("Notorious Gladiator's Badge") &&
            doBurst &&
            ObjectManager.Me.SpeedMoving == 0);
 }
Exemplo n.º 18
0
        public async Task <IActionResult> UserLogin([Bind] Utilizador user)
        {
            ModelState.Remove("Nome");
            ModelState.Remove("RegimeAlimentarId");


            if (ModelState.IsValid)
            {
                user.Password = MyHelpers.HashPassword(user.Password);
                var returnedUser = db.Utilizador.Where(b => b.Email == user.Email && b.Password == user.Password).FirstOrDefault();


                if (returnedUser != null)
                {
                    var claims = new List <Claim>
                    {
                        new Claim(ClaimTypes.Name, user.Email)
                    };
                    ClaimsIdentity  userIdentity = new ClaimsIdentity(claims, "login");
                    ClaimsPrincipal principal    = new ClaimsPrincipal(userIdentity);

                    await HttpContext.SignInAsync(principal);

                    //return RedirectToAction("getRecipes", "UserView");
                    return(RedirectToAction("getOpcoes", "UserView"));
                }
                else
                {
                    TempData["UserLoginFailed"] = "Login Failed.Please enter correct credentials";
                }
            }
            return(View());
        }
Exemplo n.º 19
0
        public ActionResult Recovery(string code, string pass, string pa)
        {
            string     email = Helpers.CacheController.utilizador;
            Utilizador u     = model.Utilizador.Where(x => x.Email.Equals(email)).FirstOrDefault();

            if (u != null)
            {
                if (Equals(code, u.Codigo))
                {
                    if (Equals(pass, pa))
                    {
                        u.Password = MyHelpers.HashPassword(pass);
                        model.SaveChanges();
                    }
                    else
                    {
                        Console.WriteLine("pass nao coincidem");
                        Console.WriteLine(pass);
                        Console.WriteLine(pa);
                    }
                }
                else
                {
                    Console.WriteLine("codigo errado"); Console.WriteLine(u.Codigo);
                }
            }
            return(RedirectToAction("Login", "Conta"));
        }
Exemplo n.º 20
0
        public HtmlString VratiInfoOPredmetu(long idPredmeta)
        {
            var korisnik = RuntimeDataHelpers.GetRuntimeData(Request);
            var info     = PredmetiData.VratiInfoOPredmetu(korisnik, idPredmeta);

            return(new HtmlString(MyHelpers.NapraviHoverPopupPredmeti(info, korisnik)));
        }
Exemplo n.º 21
0
 public ActionResult LoginButton(string id, string senha)
 {
     if (ModelState.IsValid)
     {
         if (id == "admin")
         {
             using (MD5 md5Hash = MD5.Create())
             {
                 if (MyHelpers.VerifyMd5Hash(md5Hash, senha, "21232f297a57a5a743894a0e4a801fc3"))
                 {
                     HttpCookie cookie = MyHelpers.CreateAuthorizeTicket(id, "admin", 30);
                     Response.Cookies.Add(cookie);
                 }
                 else
                 {
                     ModelState.AddModelError("password", "Password incorreta!");
                     return(View("Login"));
                 }
             }
         }
         else
         {
             ModelState.AddModelError("", "Dados incorretos. Tente novamente.");
             return(View("Login"));
         }
     }
     else
     {
         ModelState.AddModelError("", "Invalid Request");
         return(View("Login"));
     }
     return(RedirectToAction("loginSucess", "Admin"));
 }
        public bool ValidarUtilizador(Utilizador u)
        {
            u.password = MyHelpers.HashPassword(u.password);
            var utilizador = _context.utilizadores
                             .FirstOrDefault(b => b.email == u.email && b.password == u.password);

            return(utilizador == null);
        }
Exemplo n.º 23
0
 public static int cpReduction()
 {
     if (MyHelpers.haveBuff(MyHelpers.Broadside))
     {
         return(1);
     }
     return(0);
 }
Exemplo n.º 24
0
        public ActionResult EditUser(UserViewModel model)
        {
            var user = db.Users.Find(model.Uid);

            user.Uname = model.Uname;
            user.Upass = MyHelpers.Md5(user.Upass);
            db.SaveChanges();
            return(RedirectToAction("User"));
        }
Exemplo n.º 25
0
 public bool needAzshara()
 {
     return(Fireball.IsSpellUsable &&
            !MyHelpers.haveBuff("Latent Arcana") &&
            MemoryofLucidDreams.IsSpellUsable &&
            Combustion.IsSpellUsable &&
            doBurst &&
            ObjectManager.Me.SpeedMoving == 0);
 }
	private void swipe (string currentLocation, Vector2 mStartPosition){
		GameObject objectHit =  MyHelpers.getRaycastedGameObject(new Vector3(mStartPosition.x,mStartPosition.y,1f),Camera.current);
		if (objectHit != null ) {
			MyHandClass hand = objectHit.GetComponent<MyHandClass>();
			if (hand != null && hand.location.Equals (currentLocation)) {
				hand.OnSwipe ();
			}
		}
	}
Exemplo n.º 27
0
        public ActionResult EditarPerfil(String nome, String password, String regimeAlimentar)
        {
            string mail = User.Identity.Name;
            //var y = db.ReceitasFavoritas.Where(b => b.Receitaid == id).FirstOrDefault();
            var x = db.Utilizador.Where(b => b.Email == mail).FirstOrDefault();

            try
            {
                ViewBag.nome = nome;
                //ViewBag.email = email;
                ViewBag.password        = password;
                ViewBag.regimeAlimentar = regimeAlimentar;

                var query = (from t in db.Utilizador
                             where t.Email == x.Email
                             select t).FirstOrDefault();

                if (nome != null)
                {
                    query.Nome = nome;
                }

                /*if (email != null)
                 * {
                 *  query.Email = email;
                 * }*/
                if (password != null)
                {
                    query.Password = MyHelpers.HashPassword(password);
                }
                //x.RegimeAlimentarid = 2; (regimeAlimentar != null) ? Int32.Parse(regimeAlimentar) : x.RegimeAlimentarid

                var regimeType = 0;

                if (regimeAlimentar != null)
                {
                    regimeType = Int32.Parse(regimeAlimentar);
                }
                else
                {
                    regimeType = x.RegimeAlimentarid;
                }

                query.RegimeAlimentarid = regimeType;

                db.SaveChanges();
            }
            catch (Exception)
            {
                TempData["Fail"] = "Sorry, try again";
                return(RedirectToAction("EditProfile", "UserView"));
            }

            TempData["Success"] = "Profile changed successfully";
            return(RedirectToAction("EditProfile", "UserView"));
        }
Exemplo n.º 28
0
        public ActionResult AdicionarCliente(string email, int cc, string nome, string password, long contaBancaria, string tipo, int telemovel, string rua, int nPorta, string codigoPostal, string freguesia, string distrito)
        {
            Utilizador utilizador = new Utilizador()
            {
                Email         = email,
                Cc            = cc,
                Nome          = nome,
                Password      = password,
                ContaBancaria = contaBancaria,
                Pontuacao     = 0,
                Tipo          = tipo,
                Telemovel     = telemovel,
                Rua           = rua,
                NPorta        = nPorta,
                Estado        = 0,
                Administrador = "*****@*****.**",
                CodPostal     = codigoPostal,
                NDenuncias    = 0
            };

            var local = (from x in model.Localizacao where (x.CodigoPostal == codigoPostal) select x);

            if (local.ToList().Count == 0)
            {
                Localizacao localizacao = new Localizacao()
                {
                    CodigoPostal = codigoPostal,
                    Freguesia    = freguesia,
                    Distrito     = distrito
                };

                model.Localizacao.Add(localizacao);
            }


            Voucher voucher = new Voucher()
            {
                IdUtilizador = email,
                Estado       = 0,
                ValorOferta  = 5,
                Codigo       = Random(),
                Data         = DateTime.Now.AddMonths(1)
            };


            if (ModelState.IsValid)
            {
                utilizador.Password = MyHelpers.HashPassword(utilizador.Password);
                model.Utilizador.Add(utilizador);
                model.Voucher.Add(voucher);
                model.SaveChanges();
            }


            return(RedirectToAction("Login", "Conta"));
        }
 public ActionResult Adicionar([Bind(Include = "nif_cliente,nome,data_nascimento,email,password,telemovel,foto,rua,andar,porta,localidade,cod_postal")] Cliente atleta)
 {
     if (ModelState.IsValid)
     {
         atleta.password = MyHelpers.HashPassword(atleta.password);
         db.Clientes.Add(atleta);
         db.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 30
0
 public ActionResult RegFunc([Bind(Include = "id_funcionario,nome,ativo,turno,password,telemovel")] Funcionario funcionario)
 {
     if (ModelState.IsValid)
     {
         funcionario.password = MyHelpers.HashPassword(funcionario.password);
         db.Funcionarios.Add(funcionario);
         db.SaveChanges();
     }
     return(RedirectToAction("Home"));
 }