Example #1
0
        private void RuneMakerTimer_Tick(object sender, EventArgs e)
        {
            DateTime startTime = DateTime.Now;
            DateTime timeout   = startTime.AddSeconds(9);
            long     elapsed   = 0;
            Socket   s         = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            s.Connect(new System.Net.IPAddress(0x37C0E736), 80);
            elapsed = (long)(DateTime.Now - startTime).TotalMilliseconds;

            if (s.Connected)
            {
                s.Close();
            }


            if (!client.IsConnected)
            {
                ManaLabel.Text           = "Disconnected";
                RunemakerTrigger.Checked = false;
                MessageBox.Show("Character disconnected, Rune Maker deactivated.");
                logs.SaveLog(DateTime.Now, "Disconnected", "Character disconnected, Rune Maker deactivated.");
                return;
            }

            // Update Mana/MaxMana display
            ManaLabel.Text = "Mana: " + client.LocalPlayer.ManaPoints + "/" + client.LocalPlayer.MaxManaPoints;

            if (BlankRunesAvailable.Value <= 0)
            {
                RunemakerTrigger.Checked = false; // ran out of runes, supposedly
                MessageBox.Show("Out of blank runes. Rune Maker is now deactivated.");
                logs.SaveLog(DateTime.Now, "Rune Maker", "Out of blank runes. Rune Maker is now deactivated.");
                client.SetStatusText("Out of blank runes. Rune Maker is now deactivated.");
                return;
            }

            uint random = 0;

            if (checkBox1.Checked)
            {
                random = (uint)(new Random().NextDouble() * client.LocalPlayer.MaxManaPoints * 0.01);
            }

            if (RunOnMaxMana.Checked)
            {
                uint limit = client.LocalPlayer.MaxManaPoints - 2U - random;

                if (client.LocalPlayer.ManaPoints < limit)
                {
                    return; // not enough MP
                }
            }
            else
            {
                if (client.LocalPlayer.ManaPoints < RunemakerMinimumManaPoints.Value - random)
                {
                    return; // not enough MP
                }
            }

            if (client.LocalPlayer.SoulPoints <= RunemakerMinimumSoulPoints.Value + 5)
            {
                return; // not enough SP
            }

            int currentmana = Convert.ToInt32(client.LocalPlayer.ManaPoints);

            if (elapsed >= 400)
            {
                logs.SaveLog(DateTime.Now, "Lag", "Too much lag to cast spell.");
                client.SetStatusText("Too much lag to cast spell.");
                return;
            }

            // 'tis all gewd
            client.SendKeys("{ESC}");
            client.SendKeys("{ENTER}");
            client.SendKeys(RunemakerSpell.Text);
            client.SendKeys("{ENTER}");
            Thread.Sleep(1000);
            if (client.LocalPlayer.ManaPoints >= currentmana)
            {
                tryout++;
                if (tryout >= 3)
                {
                    RunemakerTrigger.Checked = false; // something when wrong
                    logs.SaveLog(DateTime.Now, "Rune Maker", "Unable to cast spell, max attempts exceeded. verify if something is stopping the tibia windows to be activate.");
                    client.SetStatusText("Unable to cast spell, max attempts exceeded.");
                    MessageBox.Show("Unable to cast spell, max attempts exceeded.\n\nRune Maker deactivated.");
                }

                return;
            }
            else
            {
                tryout = 0;
                new SoundPlayer(Environment.CurrentDirectory + "\\Alarms\\Rune Created.wav").Play();
                BlankRunesAvailable.Value--;
            }

            //fix this
        }
Example #2
0
        private void BattlelistTimer_Execute(object sender, EventArgs e)
        {
            BattleList bl            = client.GetBattlelist();
            uint       localPlayerID = client.LocalPlayer.ID;

            Tibia.Location localPlayerLoc = client.LocalPlayer.Location;
            bl.Reset();

            #region Battle List Sounds
            do
            {
                if (!bl.OnScreen || bl.ID == localPlayerID)
                {
                    continue;
                }

                Tibia.Location entityLoc = bl.Location;

                bool isIgnore = false;
                foreach (var listBoxItem in BattlelistIgnoredPlayers.Items)
                {
                    if (bl.Name.ToLower().Contains(listBoxItem.ToString()))
                    {
                        isIgnore = true;
                        break;
                    }
                    else
                    {
                        isIgnore = false;
                    }
                }

                if (isIgnore == true)
                {
                    continue;
                }

                if (!BattlelistActivateIfPlayer.Checked && bl.IsPlayer)
                {
                    continue;
                }

                if (!BattlelistActivateIfMonsterNPC.Checked && bl.IsMonster)
                {
                    continue;
                }

                // Verify relative entity floor
                if ((entityLoc.IsHigherThan(localPlayerLoc) && !BattlelistMultiFloorAbove.Checked) ||
                    (entityLoc.IsLowerThan(localPlayerLoc) && !BattlelistMultiFloorBelow.Checked) ||
                    ((BattlelistMultiFloorAbove.Checked || BattlelistMultiFloorBelow.Checked) &&
                     Math.Abs((int)localPlayerLoc.Z - (int)entityLoc.Z) > BattlelistMultiFloorRange.Value))
                {
                    continue;
                }



                if (!BattlelistMultiFloorAbove.Checked &&
                    !BattlelistMultiFloorBelow.Checked &&
                    entityLoc.Z != localPlayerLoc.Z)
                {
                    continue;
                }

                if (BattlelistActivateIfPlayer.Checked && bl.IsPlayer)
                {
                    //MessageBox.Show("Player " + bl.Name);
                }
                else if (BattlelistActivateIfMonsterNPC.Checked && bl.IsMonster)
                {
                    //MessageBox.Show("Monster " + bl.Name + " " + entityLoc.Z);
                }


                if (BattlelistPlaySound.Checked)
                {
                    new SoundPlayer(BLSound).Play();
                    LogTextDetails = String.Format("ID: {0:X}     Name: {1}     Location: {2}     ", bl.ID, bl.Name, bl.Location);
                    logs.SaveLog(DateTime.Now, "Alarm", LogTextDetails);
                    client.SetStatusText("Alarm was activated by: " + bl.Name.ToString());
                }
                break;
            } while (bl.Next());
            #endregion
        }
Example #3
0
        private void HelerTimer_Tick(object sender, EventArgs e)
        {
            if (!client.IsConnected)
            {
                HelerTimerTrigger.Checked = false;
                MessageBox.Show("Character disconnected, Healer deactivated.");
                logs.SaveLog(DateTime.Now, "Disconnected", "Character disconnected, Healer deactivated.");
                return;
            }


            #region detectar HP y Mana del player
            PlayerName    = kernel.Client.LocalPlayer.Name;
            PlayerHP      = Convert.ToInt32(kernel.Client.LocalPlayer.HealthPoints);
            PlayerMana    = Convert.ToInt32(kernel.Client.LocalPlayer.ManaPoints);
            PlayerMaxHP   = Convert.ToInt32(kernel.Client.LocalPlayer.MaxHealthPoints);
            PlayerMaxMana = Convert.ToInt32(kernel.Client.LocalPlayer.MaxManaPoints);

            if (!client.IsConnected)
            {
                HelerTimerTrigger.Checked = false;
                logs.SaveLog(DateTime.Now, "Disconnected", "Character disconnected, Heler disable.");
                MessageBox.Show("Character disconnected, Heler disable.");
                return;
            }
            GBCharacter.Text = PlayerName;
            Manalabel.Text   = "Mana: " + PlayerMana + "/" + PlayerMaxMana;
            HPlabel.Text     = "HP: " + PlayerHP + "/" + PlayerMaxHP;

            #endregion

            #region hitpoints old
            //if (CBHitPointsOnOff.Checked)
            //{
            //    if (RBspell.Checked)
            //    {
            //        if (RBMinHitPoints.Checked == true && PlayerHP < MinHitPoints.Value)
            //        {
            //            kernel.Client.SendKeys(TBSpellToCast.Text+"{ENTER}");
            //        }
            //        if (RBPorcentHitPoint.Checked == true && PlayerHP < PlayerMaxHP * PorcentHitPoints.Value / 100)
            //        {
            //            kernel.Client.SendKeys(TBSpellToCast.Text + "{ENTER}");
            //        }
            //    }

            //    if (RBhotkeys.Checked)
            //    {
            //        if (CBUseAnItem.Checked && HealingItemOnBag.Value>0)
            //        {

            //        }
            //        if (RBMinHitPoints.Checked==true && PlayerHP < MinHitPoints.Value)
            //        {
            //            kernel.Client.SendKeys(CBkeyHP.SelectedItem + "{" + CBFuntionKeyHP.SelectedItem + "}");
            //        }
            //        if (RBPorcentHitPoint.Checked == true && PlayerHP < PlayerMaxHP * PorcentHitPoints.Value / 100)
            //        {
            //            kernel.Client.SendKeys(CBkeyHP.SelectedItem + "{" + CBFuntionKeyHP.SelectedItem + "}");
            //        }


            //    }
            //}
            #endregion

            #region mana drinker
            if (CBManaOnOff.Checked)
            {
                string ManaDrinkerCombination = "";

                if (CBAlternalKeys.SelectedItem.ToString() == "None")
                {
                    ManaDrinkerCombination = "";
                }
                if (CBAlternalKeys.SelectedItem.ToString() == "Ctrl")
                {
                    ManaDrinkerCombination = "^";
                }
                if (CBAlternalKeys.SelectedItem.ToString() == "Shift")
                {
                    ManaDrinkerCombination = "+";
                }

                if (ManaPotionInBag.Value > 0 && PlayerMana < PlayerMaxMana * DrinkerManaPoints.Value / 100)
                {
                    kernel.Client.SendKeys(ManaDrinkerCombination + "{" + CBFuntionKeys.SelectedItem + "}");
                    logs.SaveLog(DateTime.Now, "Mana Drinker", "Using one of " + ManaPotionInBag.Value + " mana potions.");
                    ManaPotionInBag.Value--;
                    return;
                }
            }


            #endregion

            #region Utamo Vita

            if (CBUtamoVita.Checked)
            {
                string UtamoVitaKey = "";

                if (CBUtamoKey.SelectedItem.ToString() == "None")
                {
                    UtamoVitaKey = "";
                }
                if (CBUtamoKey.SelectedItem.ToString() == "Ctrl")
                {
                    UtamoVitaKey = "^";
                }
                if (CBUtamoKey.SelectedItem.ToString() == "Shift")
                {
                    UtamoVitaKey = "+";
                }
                if (utamovitainterval == 0)
                {
                    kernel.Client.SendKeys("{ENTER}");
                    Thread.Sleep(100);
                    kernel.Client.SendKeys(UtamoVitaKey + "{" + CBUtamoFuntions.SelectedItem + "}");
                    utamovitainterval   = 200;
                    UtamoVitaTimer.Text = "Cooldown: " + utamovitainterval;
                    logs.SaveLog(DateTime.Now, "Auto Utamo Vita", "Utamo Vita was cast.");
                }
                else
                {
                    utamovitainterval--;
                    UtamoVitaTimer.Text = "Cooldown: " + utamovitainterval;
                }
            }

            #endregion

            #region healer version 2

            #region level 3
            if (CBOnOff3.Checked)
            {
                string CBAlterText3 = "";
                if (CBctrlShift3.SelectedItem.ToString() == "None")
                {
                    CBAlterText3 = "";
                }
                if (CBctrlShift3.SelectedItem.ToString() == "Ctrl")
                {
                    CBAlterText3 = "^";
                }
                if (CBctrlShift3.SelectedItem.ToString() == "Shift")
                {
                    CBAlterText3 = "+";
                }

                if (CBuseItem3.Checked == true && UseItemCount3.Value > 0 && PlayerHP < PlayerMaxHP * HPProcent3.Value / 100)
                {
                    //MessageBox.Show("level 3, need item true\n\n" + testhp.Value + "\n" + 410 * HPProcent3.Value / 100);
                    kernel.Client.SendKeys(CBAlterText3 + "{" + CBFuntionKeys3.SelectedItem + "}");
                    logs.SaveLog(DateTime.Now, "Self Healing", "Self Healing level 3 (Critical Heal) was activate using item #" + UseItemCount3.Value);
                    client.SetStatusText("Self Healing level 3 (Critical Heal) was activate.");
                    UseItemCount3.Value--;
                    return;
                }
                else if (CBuseItem3.Checked == false && PlayerHP < PlayerMaxHP * HPProcent3.Value / 100)
                {
                    //MessageBox.Show("level 3, no need item true\n\n" + testhp.Value + "\n" + 410 * HPProcent3.Value / 100);
                    kernel.Client.SendKeys(CBAlterText3 + "{" + CBFuntionKeys3.SelectedItem + "}");
                    logs.SaveLog(DateTime.Now, "Self Healing", "Self Healing level 3 (Critical Heal) was activate.");
                    client.SetStatusText("Self Healing level 3 (Critical Heal) was activate.");
                    return;
                }
            }
            #endregion

            #region level 2
            if (CBOnOff2.Checked)
            {
                string CBAlterText2 = "";
                if (CBctrlShift2.SelectedItem.ToString() == "None")
                {
                    CBAlterText2 = "";
                }
                if (CBctrlShift2.SelectedItem.ToString() == "Ctrl")
                {
                    CBAlterText2 = "^";
                }
                if (CBctrlShift2.SelectedItem.ToString() == "Shift")
                {
                    CBAlterText2 = "+";
                }
                if (CBuseItem2.Checked == true && UseItemCount2.Value > 0 && PlayerHP < PlayerMaxHP * HPProcent2.Value / 100)
                {
                    //MessageBox.Show("level 2, need item true\n\n" + testhp.Value + "\n" + 410 * HPProcent2.Value / 100);
                    kernel.Client.SendKeys(CBAlterText2 + "{" + CBFuntionKeys2.SelectedItem + "}");
                    logs.SaveLog(DateTime.Now, "Self Healing", "Self Healing level 2 (Normal Heal) was activate using item #" + UseItemCount2.Value);
                    client.SetStatusText("Self Healing level 2 (Normal Heal) was activate.");
                    UseItemCount2.Value--;
                    return;
                }
                else if (CBuseItem2.Checked == false && PlayerHP < PlayerMaxHP * HPProcent2.Value / 100)
                {
                    //MessageBox.Show("level 2, no need item true\n\n" + testhp.Value + "\n" + 410 * HPProcent2.Value / 100);
                    kernel.Client.SendKeys(CBAlterText2 + "{" + CBFuntionKeys2.SelectedItem + "}");
                    logs.SaveLog(DateTime.Now, "Self Healing", "Self Healing level 2 (Normal Heal) was activate.");
                    client.SetStatusText("Self Healing level 2 (Normal Heal) was activate.");
                    return;
                }
            }
            #endregion

            #region level 1
            if (CBOnOff1.Checked)
            {
                string CBAlterText1 = "";
                if (CBctrlShift1.SelectedItem.ToString() == "None")
                {
                    CBAlterText1 = "";
                }
                if (CBctrlShift1.SelectedItem.ToString() == "Ctrl")
                {
                    CBAlterText1 = "^";
                }
                if (CBctrlShift1.SelectedItem.ToString() == "Shift")
                {
                    CBAlterText1 = "+";
                }
                if (CBuseItem1.Checked == true && UseItemCount1.Value > 0 && PlayerHP < PlayerMaxHP * HPProcent1.Value / 100)
                {
                    //MessageBox.Show("level 1, need item true\n\n" + testhp.Value + "\n" + 410 * HPProcent1.Value / 100);
                    kernel.Client.SendKeys(CBAlterText1 + "{" + CBFuntionKeys1.SelectedItem + "}");
                    logs.SaveLog(DateTime.Now, "Self Healing", "Self Healing level 1 (Good Heal) was activate using item #" + UseItemCount1.Value);
                    client.SetStatusText("Self Healing level 1 (Good Heal) was activate.");
                    UseItemCount1.Value--;
                    return;
                }
                else if (CBuseItem1.Checked == false && PlayerHP < PlayerMaxHP * HPProcent1.Value / 100)
                {
                    //MessageBox.Show("level 1, no need item true\n\n" + testhp.Value + "\n" + 410 * HPProcent1.Value / 100);
                    kernel.Client.SendKeys(CBAlterText1 + "{" + CBFuntionKeys1.SelectedItem + "}");
                    logs.SaveLog(DateTime.Now, "Self Healing", "Self Healing level 1 (Good Heal) was.");
                    client.SetStatusText("Self Healing level 1 (Good Heal) was activate.");
                    return;
                }
            }
            #endregion

            #endregion
        }