Example #1
0
        public static void LoadLootTemplates_Fishing()
        {
            Log.outInfo(LogFilter.ServerLoading, "Loading fishing loot templates...");

            uint oldMSTime = Time.GetMSTime();

            List <uint> lootIdSet;
            uint        count = Fishing.LoadAndCollectLootIds(out lootIdSet);

            // remove real entries and check existence loot
            foreach (var areaEntry in CliDB.AreaTableStorage.Values)
            {
                if (lootIdSet.Contains(areaEntry.Id))
                {
                    lootIdSet.Remove(areaEntry.Id);
                }
            }

            // output error for any still listed (not referenced from appropriate table) ids
            Fishing.ReportUnusedIds(lootIdSet);

            if (count != 0)
            {
                Log.outInfo(LogFilter.ServerLoading, "Loaded {0} fishing loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
            }
            else
            {
                Log.outInfo(LogFilter.ServerLoading, "Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
            }
        }
Example #2
0
    public void Initialize()
    {
        try
        {
            Directory.CreateDirectory(Application.StartupPath + "\\Profiles\\Fisherbot\\");
            FisherbotSetting.Load();

            if (string.IsNullOrWhiteSpace(FisherbotSetting.CurrentSetting.FishingPoleName))
            {
                FisherbotSetting.CurrentSetting.FishingPoleName = Fishing.FishingPolesName();
            }
            if (string.IsNullOrWhiteSpace(FisherbotSetting.CurrentSetting.WeaponName))
            {
                FisherbotSetting.CurrentSetting.WeaponName = EquippedItems.GetEquippedItem(WoWInventorySlot.INVTYPE_WEAPONMAINHAND).Name;
                FisherbotSetting.CurrentSetting.ShieldName = EquippedItems.GetEquippedItem(WoWInventorySlot.INVTYPE_SHIELD).Name;
                if (FisherbotSetting.CurrentSetting.WeaponName == FisherbotSetting.CurrentSetting.ShieldName)
                {
                    FisherbotSetting.CurrentSetting.ShieldName = "";
                }
            }

            Others.ProductStatusLog(Products.ProductName, 1);
        }
        catch (Exception e)
        {
            Logging.WriteError("Fisherbot > Main > Initialize(): " + e);
        }
    }
Example #3
0
        /// <summary>
        /// for a user selected cruise and banks add data on the variety and quantity of fish caught
        /// для выбранного пользователем рейса и банки добавить данные о сорте и количестве пойманной рыбы
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btquery8_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.tbBankAttend.Text == String.Empty || this.tbFish.Text == String.Empty ||
                    this.tbWeight.Text == String.Empty || this.tbQual.Text == String.Empty)
                {
                    MessageBox.Show("Введите ID посещения банки, рыбу, вес и качество");
                }
                else
                {
                    var q = new DataClasses1DataContext();
                    var f = new Fishing();

                    f.ID_BANKATTEND = int.Parse(this.tbBankAttend.Text);
                    f.ID_FISH       = //int.Parse(this.tbFish.Text);
                                      (from fish in q.Fish where fish.NAME == this.tbFish.Text select fish.ID).ToList()[0];
                    f.WEIGHT = int.Parse(this.tbWeight.Text);
                    f.ID_Q   = int.Parse(this.tbQual.Text);
                    q.Fishing.InsertOnSubmit(f);
                    q.SubmitChanges();
                    MessageBox.Show("Добавлено");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        public static void LoadLootTemplates_Reference()
        {
            Log.outInfo(LogFilter.ServerLoading, "Loading reference loot templates...");

            uint oldMSTime = Time.GetMSTime();

            List<uint> lootIdSet;
            Reference.LoadAndCollectLootIds(out lootIdSet);

            // check references and remove used
            Creature.CheckLootRefs(lootIdSet);
            Fishing.CheckLootRefs(lootIdSet);
            Gameobject.CheckLootRefs(lootIdSet);
            Items.CheckLootRefs(lootIdSet);
            Milling.CheckLootRefs(lootIdSet);
            Pickpocketing.CheckLootRefs(lootIdSet);
            Skinning.CheckLootRefs(lootIdSet);
            Disenchant.CheckLootRefs(lootIdSet);
            Prospecting.CheckLootRefs(lootIdSet);
            Mail.CheckLootRefs(lootIdSet);
            Reference.CheckLootRefs(lootIdSet);

            // output error for any still listed ids (not referenced from any loot table)
            Reference.ReportUnusedIds(lootIdSet);

            Log.outInfo(LogFilter.ServerLoading, "Loaded refence loot templates in {0} ms", Time.GetMSTimeDiffToNow(oldMSTime));
        }
Example #5
0
 private void OnDestroy()
 {
     // If we were the singleton, then clear the reference as we are being destroyed:
     if (_instance == this)
     {
         _instance = null;
     }
 }
Example #6
0
        public void ThereAreTwoFishesAlive()
        {
            var fishSizes        = new[] { 4, 3, 2, 1, 5 };
            var fishesOrienation = new[] { 0, 1, 0, 0, 0 };
            var alive            = Fishing.GetAliveFishesFromStream(fishSizes, fishesOrienation);

            Assert.AreEqual(2, alive);
        }
 // Constructor
 public JobsManager() : base()
 {
     myHuntingBuilding     = new Hunting();
     myFishingBuilding     = new Fishing();
     myShipBuilderBuilding = new ShipBuilder();
     myMineralBuilding     = new MineralGathering();
     myWoodBuilding        = new WoodGathering();
     myBarrack             = new Barrack();
     nameJob = "";
 }
Example #8
0
    // Start is called before the first frame update
    void Start()
    {
        fishingGame = FindObjectOfType <Fishing>();
        crops       = FindObjectOfType <CropTest>();

        if (feedbackPanel.activeInHierarchy)
        {
            feedbackPanel.SetActive(false);
        }
    }
Example #9
0
        private void TickEvent(List <Events.TickNametagData> nametags)
        {
            // Check if the player is connected
            if (!playerLogged)
            {
                return;
            }

            DateTime dateTime = DateTime.UtcNow;

            if (Vehicles.lastPosition != null)
            {
                // Update the speedometer
                Vehicles.UpdateSpeedometer();
            }

            // Update the player's money each 450ms
            if (dateTime.Ticks - lastTimeChecked.Ticks >= 4500000)
            {
                // Check if the player is loaded
                object money = Player.LocalPlayer.GetSharedData("PLAYER_MONEY");

                if (money != null)
                {
                    playerMoney     = Convert.ToInt32(money) + "$";
                    lastTimeChecked = dateTime;
                }
            }

            if (Fishing.fishingState > 0)
            {
                // Start the fishing minigame
                Fishing.DrawFishingMinigame();
            }

            // Draw the money
            RAGE.NUI.UIResText.Draw(playerMoney, 1900, 60, RAGE.Game.Font.Pricedown, 0.5f, Color.DarkOliveGreen, RAGE.NUI.UIResText.Alignment.Right, true, true, 0);

            // Check if the player
            if (RAGE.Game.Pad.IsControlJustPressed(0, (int)RAGE.Game.Control.VehicleSubPitchDownOnly) && Player.LocalPlayer.Vehicle != null)
            {
                // Check if the player is on a forklift
                Trucker.CheckPlayerStoredCrate();
            }

            // Detect if a key has been pressed
            int key = Keys.DetectPressedKey(dateTime.Ticks);

            if (key >= 0)
            {
                // Fire the event for the pressed key
                Keys.FireKeyPressed(key);
            }
        }
Example #10
0
    // Use this for initialization
    void Start()
    {
        myHuntingBuilding     = new Hunting();
        myFishingBuilding     = new Fishing();
        myShipBuilderBuilding = new ShipBuilder();
        myMineralBuilding     = new MineralGathering();
        myWoodBuilding        = new WoodGathering();

        textDisplay();

        setAllJobPanelInactive();
    }
Example #11
0
    void Start()
    {
        dialogueManager = FindObjectOfType <DialogueManager>();
        dialogueHolder  = FindObjectOfType <DialogueHolder>();
        fishing         = FindObjectOfType <Fishing>();

        //set NPC dialogue to non tutorial dialogue
        dialogueObj[1].GetComponent <DialogueHolder>().option4 = true;
        dialogueObj[3].GetComponent <DialogueHolder>().option3 = true;

        loaded = true;
    }
Example #12
0
 private void Awake()
 {
     // Make sure we will only ever have one of these objects:
     if (_instance == null)
     {
         _instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
 public static void resetAllSkills(Player p)
 {
     Fletching.setFletchItem(p, null);
     Herblore.setHerbloreItem(p, null);
     Cooking.setCookingItem(p, null);
     Mining.resetMining(p);
     Smithing.resetSmithing(p);
     Woodcutting.resetWoodcutting(p);
     Fishing.resetFishing(p);
     Crafting.resetCrafting(p);
     p.removeTemporaryAttribute("harvesting");
 }
Example #14
0
    private void Update()
    {
        if (canInteract)
        {
            if (Input.GetKeyDown(interactKey1) || Input.GetKeyDown(interactKey2))
            {
                if (target == null)
                {
                    return;
                }

                DirtTile dirt = target.GetComponent <DirtTile>();
                if (dirt != null)
                {
                    for (int i = 0; i < tool.seeds.Length; i++)
                    {
                        if (tool.seeds[i].isSelected)
                        {
                            crop = tool.seeds[i].crop;
                        }
                    }
                    dirt.Interact(crop, tool, this);
                    crop = new Crop(null);
                }

                TrashCan trashcan = target.GetComponent <TrashCan>();
                {
                    if (trashcan)
                    {
                        //trashcan.Interact(crop, tool, this);
                    }
                }

                Fishing fishing = target.GetComponent <Fishing>();
                {
                    if (fishing)
                    {
                        fishing.Interact(tool, this);
                    }
                }

                RefillWater refillWater = target.GetComponent <RefillWater>();
                {
                    if (refillWater)
                    {
                        refillWater.Interact(tool, this);
                    }
                }
            }
        }
    }
        public void MainGameLoopTest()
        {
            Fishing fishing = new Fishing();

            skillsController.SkillButtonClicked("Fishing");
            skillsController.SetTrainingMethod(0);

            int days    = 5;
            int seconds = days * 86400;

            skillsController.SkillGameLoop(fishing.trainingMethods[0], fishing, seconds);

            Assert.AreEqual(true, true);
        }
Example #16
0
        private void chbFishing_CheckedChanged(object sender, EventArgs e)
        {
            Fishing.Enabled = chbFishing.Checked;

            if (Fishing.Enabled)
            {
                if (Fishing.FishingPosition.IsEmpty)
                {
                    chbFishing.Checked = false;
                    MessageBox.Show("Fishing position is not set!", "Error");
                    return;
                }
                Task.Run(() => Fishing.StartFishing());
            }
        }
Example #17
0
        private void handleThirdClickNPC(Player player, Packet packet)
        {
            int npcIndex = packet.readShortA();

            if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null)
            {
                return;
            }
            Npc npc = Server.getNpcList()[npcIndex];

            if (npc == null || npc.isDestroyed())
            {
                return;
            }
            Console.WriteLine("Third click NPC " + npc.getId());
            SkillHandler.resetAllSkills(player);
            if (Thieving.wantToThieveNpc(player, npc))
            {
                return;
            }
            else if (Fishing.wantToFish(player, npc, true))
            {
                return;
            }
            else if (AgilityArena.dialogue(player, npc, true))
            {
                return;
            }
            else if (TzHaar.interactTzhaarNPC(player, npc, 2))
            {
                return;
            }
            else if (WarriorGuild.talkToWarriorGuildNPC(player, npc, 2))
            {
                return;
            }
            switch (npc.getId())
            {
            case 553:     // Aubury
                HomeArea.interactWithAubury(player, npc, 2);
                break;

            case 519:     // Bob
                BrokenBarrows.talkToBob(player, npc, -1, 2);
                break;
            }
        }
Example #18
0
        protected override void Perform(SimDescription me, BookData book, bool addToList)
        {
            if (!me.ReadBookDataList.ContainsKey(book.ID))
            {
                base.Perform(me, book, addToList);
            }

            BookFishData data = book as BookFishData;

            if (data != null)
            {
                Fishing skill = me.SkillManager.GetSkill <Fishing>(SkillNames.Fishing);

                foreach (FishType type in data.FishTypes)
                {
                    skill.LearnedAbout(type);
                }
            }
        }
Example #19
0
        private static void LoopFishThread()
        {
            try
            {
                while (true)
                {
                    try
                    {
                        while (_fishBotLaunched)
                        {
                            if (ObjectManager.ObjectManager.Me.InCombat)
                            {
                                StopLoopFish();
                                continue;
                            }
                            Fishing.EquipFishingPoles(_fishingPoleName);
                            if (_useLure)
                            {
                                Fishing.UseLure(_lureName, _automaticallyUseDraenorSecondaryBait);
                            }

                            if (fishingSpell == null)
                            {
                                fishingSpell = new Spell("Fishing");
                            }
                            fishingSpell.Launch(false, false, true);
                            Thread.Sleep(4000);
                            WoWGameObject objBobber =
                                new WoWGameObject(Fishing.SearchBobber());

                            if (objBobber.IsValid)
                            {
                                WoWGameObject node = new WoWGameObject(ObjectManager.ObjectManager.GetObjectByGuid(_guidNode).GetBaseAddress);
                                if (node.Position.DistanceTo2D(objBobber.Position) > distanceBobber && node.IsValid &&
                                    _guidNode > 0 && _precision)
                                {
                                    continue;
                                }

                                while (_fishBotLaunched && ObjectManager.ObjectManager.Me.IsCast && objBobber.IsValid &&
                                       1 != Memory.WowMemory.Memory.ReadShort(objBobber.GetBaseAddress + (uint)Patchables.Addresses.Fishing.BobberHasMoved))
                                {
                                    /*
                                     * BobberHasMoved FINDER
                                     * uint i = 148;
                                     * while (false)
                                     * {
                                     *  short info = Memory.WowMemory.Memory.ReadShort(objBobber.GetBaseAddress + (uint) i);
                                     *  if (info == 1)
                                     *  {
                                     *      Logging.Write("Info is " + info + " with i=" + i);
                                     *  }
                                     *  i += 4;
                                     *  if (i > 350)
                                     *      i = 148;
                                     *  Thread.Sleep(30);
                                     * }
                                     */
                                    Thread.Sleep(250);
                                }
                                if (_fishBotLaunched && ObjectManager.ObjectManager.Me.IsCast && objBobber.IsValid)
                                {
                                    FarmingTask.CountThisLoot = true;
                                    FarmingTask.NodeOrUnit    = true;
                                    Interact.InteractWith(objBobber.GetBaseAddress);
                                    _lastSuccessfullFishing = Environment.TickCount;
                                    Statistics.Farms++;
                                    Thread.Sleep(Usefuls.Latency + 400); // Arround 450
                                    for (int i = 0; i < 10; i++)
                                    {
                                        if (!Others.IsFrameVisible("LootFrame"))
                                        {
                                            break;
                                        }
                                        Thread.Sleep(150); // usually stop at i = 2 for me
                                        // it's like the old 1sec sleep, but can be faster sometimes to recast.
                                        // and this will loot 100% of the time, while if you have high latency, 1sec wont loot everything.
                                    }

                                    /*if (Others.IsFrameVisible("LootFrame"))
                                     * {
                                     *  Logging.WriteDebug("We did not loot all items within < 2 second + latency.");
                                     *  // More of a debug code, no need.
                                     * }*/
                                }
                            }
                        }
                    }
                    catch
                    {
                    }

                    Thread.Sleep(400);
                }
            }
            catch (Exception e)
            {
                Logging.WriteError("FishingTask > LoopFishThread(): " + e);
            }
        }
Example #20
0
    // Update is called once per frame
    void Update()
    {
        if (Time.timeScale == 0)
        {
            return;
        }
        if (openUI && Input.GetKeyDown(KeyCode.Escape))
        {
            ToggleUI();
        }
        //animation for starting fire
        if (playingFireStart)
        {
            if (frameIndex < 12)
            {
                if (timeSinceLastFrame > animationSpeed)
                {
                    animRenderer.sprite = animSprites[frameIndex];
                    timeSinceLastFrame  = 0;
                    frameIndex++;
                }
                else
                {
                    timeSinceLastFrame = timeSinceLastFrame + Time.deltaTime;
                }
            }
            else
            {
                fire           = fireColliderID.gameObject.GetComponent <Fire>();
                fire.fireState = 0;
            }
        }


        Fishing fish = GetComponent <Fishing> ();

        //animation for casting rod
        if (playingCastRod)
        {
            if (frameIndex < 35)
            {
                if (timeSinceLastFrame > animationSpeed)
                {
                    animRenderer.sprite = fishingSprites[frameIndex];
                    timeSinceLastFrame  = 0;
                    frameSkip           = frameSkip == 1 ? 2 : 1;
                    frameIndex         += frameSkip;
                }
                else
                {
                    timeSinceLastFrame = timeSinceLastFrame + Time.deltaTime;
                }
            }
            else
            {
                playingCastRod     = false;
                frameIndex         = 35;
                timeSinceLastFrame = 0;
            }
        }
        else if (fish.isFishing && !fish.minigame && !catchingFish)
        {
            if (timeSinceLastFrame > fishIdleSpeed)
            {
                animRenderer.sprite = fishingSprites[frameIndex];
                fishIdleDirection   = frameIndex >= 40 || frameIndex <= 34 ? !fishIdleDirection : fishIdleDirection;
                frameIndex          = fishIdleDirection ? frameIndex - 1 : frameIndex + 1;
                timeSinceLastFrame  = 0;
            }
            else
            {
                timeSinceLastFrame = timeSinceLastFrame + Time.deltaTime;
            }
        }

        if (catchingFish)
        {
            if (frameIndex > 0)
            {
                if (timeSinceLastFrame > animationSpeed)
                {
                    animRenderer.sprite = fishingSprites[frameIndex];
                    timeSinceLastFrame  = 0;
                    frameSkip           = frameSkip == 1 ? 2 : 1;
                    frameIndex         -= frameSkip;
                }
                else
                {
                    timeSinceLastFrame = timeSinceLastFrame + Time.deltaTime;
                }
            }
            else
            {
                fish.hasCaught   = true;
                catchingFish     = false;
                performingAction = false;
            }
        }

        if (fish.minigame && !catchingFish)
        {
            if (timeSinceLastFrame > reelingAnimationSpeed)
            {
                timeSinceLastFrame  = 0;
                frameIndex          = frameIndex >= 30 ? frameIndex - 1 : frameIndex = frameIndex <= 29 ? frameIndex + 1 : frameIndex;
                reelingSprite       = !reelingSprite;
                animRenderer.sprite = fishingSprites[frameIndex];
            }
            else
            {
                timeSinceLastFrame = timeSinceLastFrame + Time.deltaTime;
            }

            timeToCatch -= Time.deltaTime;
            if (timeToCatch < 0.0f)
            {
                frameIndex        = 39;
                fishIdleDirection = true;
                fish.minigame     = false;
                timeToCatch       = 2.0f;
            }
            else if (Input.GetKeyDown(KeyCode.E))
            {
                timeSinceLastFrame = 0;
                frameIndex         = 35;
                catchingFish       = true;
            }
        }

        OnCollisionUpdate();
        //If player is pressing the interaction key
        if (Input.GetKeyDown(KeyCode.E))
        {
            //Fishing minigame interaction
            if (canFish)
            {
                if (fish.isFishing && !fish.minigame)
                {
                    playingCastRod   = false;
                    performingAction = false;
                    fish.stop();
                }
                else if (!fish.isFishing)
                {
                    //setting up animation values to play
                    timeToCatch = 2.0f;
                    if (openUI)
                    {
                        ToggleUI();
                    }
                    fish.fish();
                    if (fish.isFishing)
                    {
                        performingAction   = true;
                        playingCastRod     = true;
                        timeSinceLastFrame = 0;
                        frameIndex         = 0;
                    }
                }
            }


            //Cooking minigame interaction
            if (atFire && !atUIFlag)
            {
                atUIFlag = true;
                fire     = fireColliderID.gameObject.GetComponent <Fire>();
                switch (fire.fireState)
                {
                //if player hasnt begun to start the fire
                case -1:
                    if (!playingFireStart)
                    {
                        frameIndex         = 1;
                        timeSinceLastFrame = 0;
                        playingFireStart   = true;
                        //getting the position that the player should be at
                        Vector3 pos = fire.transform.position;
                        pos.y += 0.30f;
                        pos.x -= 1f;
                        transform.position = pos;
                    }
                    break;

                //if player is starting the fire
                case 0:
                    //choosing the right animation frame
                    if (frameIndex == 13)
                    {
                        animRenderer.sprite = animSprites[frameIndex];
                        frameIndex--;
                    }
                    else
                    {
                        animRenderer.sprite = animSprites[frameIndex];
                        frameIndex++;
                    }
                    buttonPressed = Time.deltaTime;
                    if (buttonPressed < 0.4)
                    {
                        buttonSmash++;
                    }
                    else
                    {
                        buttonSmash--;
                    }
                    //if they have pressed the button fast enough, enough times
                    if (buttonSmash == 10)
                    {
                        fire.startFire();
                        playingFireStart    = false;
                        animRenderer.sprite = animSprites[0];
                        buttonSmash         = 0;
                    }
                    break;

                //if the fire is started
                default:
                    ToggleUI();
                    //ToggleCookingUI();
                    break;
                }
            }

            if (atFarm && !atUIFlag)
            {
                atUIFlag = true;
                if (openUI)
                {
                    if (!farmUIOpen)
                    {
                        ToggleFarmUI();
                    }
                }
                ToggleUI();
                //ToggleFarmUI();
            }

            if (atWaterPurifier && !atUIFlag)
            {
                atUIFlag = true;
                //Debug.Log("Player entered Farm zone and pressed e");
                if (openUI)
                {
                    if (!waterUIOpen)
                    {
                        ToggleWaterUI();
                    }
                }
                ToggleUI();
                //ToggleWaterUI();
            }

            if (atBarrel && !atUIFlag)
            {
                atUIFlag = true;
                //Debug.Log("Player entered Farm zone and pressed e");
                if (openUI)
                {
                    if (!barrelUIOpen)
                    {
                        ToggleBarrelUI();
                    }
                }
                ToggleUI();
            }

            atUIFlag = false;

            if (switchSwimMode)
            {
                isSwimming = !isSwimming;
                Vector3 pos = transform.position;
                if (isSwimming)
                {
                    Camera.main.GetComponent <BoxCollider2D>().enabled = true;
                    underwater.GetComponent <BoxCollider2D> ().enabled = true;
                    animRenderer.sortingLayerName = "Background";
                    animRenderer.sortingOrder     = -2;
                    animRenderer.flipX            = false;
                    animRenderer.sprite           = Resources.Load <Sprite>("Head");
                    torso.GetComponent <SpriteRenderer>().enabled          = true;
                    torso.GetComponent <SpriteRenderer>().sortingLayerName = "Background";
                    torso.GetComponent <SpriteRenderer>().sortingOrder     = -3;
                    legs.GetComponent <SpriteRenderer>().enabled           = true;
                    legs.GetComponent <SpriteRenderer>().sortingLayerName  = "Background";
                    legs.GetComponent <SpriteRenderer>().sortingOrder      = -4;
                    transform.GetComponent <PolygonCollider2D>().offset    = new Vector2(0, 0.8f);
                    transform.position = new Vector3(-23.15025f, -2.443089f, pos.z);
                }
                else
                {
                    Camera.main.GetComponent <BoxCollider2D>().enabled = false;
                    underwater.GetComponent <BoxCollider2D> ().enabled = false;
                    animRenderer.sprite           = standingSprite;
                    animRenderer.sortingLayerName = "Default";
                    animRenderer.sortingOrder     = 0;
                    transform.rotation            = new Quaternion();
                    torso.GetComponent <SpriteRenderer>().enabled       = false;
                    legs.GetComponent <SpriteRenderer>().enabled        = false;
                    transform.GetComponent <PolygonCollider2D>().offset = new Vector2(0, -0.3f);
                    transform.position = new Vector3(-19.81603f, -0.6278321f, pos.z);
                }
            }
        }


        if (Input.GetKeyDown(KeyCode.Q))
        {
            if (openUI)
            {
                if (!waterUIOpen && atWaterPurifier)
                {
                    ToggleWaterUI();
                }
                if (!fireUIOpen && atFire)
                {
                    ToggleCookingUI();
                }
                if (!farmUIOpen && atFarm)
                {
                    ToggleFarmUI();
                }
                if (!barrelUIOpen && atBarrel)
                {
                    ToggleBarrelUI();
                }
            }
            ToggleUI();
        }
    }
Example #21
0
        private async void tmrUpdateInfo_Tick(object sender, EventArgs e)
        {
            ///
            /// This timer runs in a 350ms interval
            ///
            try
            {
                bool isAttacking = await Character.isAttacking;
                lblCavebotIndex.Text = Cavebot.Index.ToString();

                lblPokeHP.Text = Pokemon.HP.ToString();

                if (Pokemon.HasPokemonSet && Pokemon.AutoRevive && Pokemon.HP <= Pokemon.AutoReviveHP &&
                    Pokemon.AutoReviveHP < Pokemon.AutoReviveHP && Pokemon.Reviving == false &&
                    Character.HP > 0 && Pokemon.ReviveCooldown == false)
                {
                    Pokemon.Revive();
                    if (Pokemon.isOutside() == false)
                    {
                        Pokemon.PutOut();
                    }
                }

                if (Pokemon.HasPokemonSet && Pokemon.AutoRevive && Pokemon.MaxHP > Pokemon.AutoReviveOutOfBattleHP &&
                    Pokemon.Reviving == false && isAttacking == false && Pokemon.HP < Pokemon.AutoReviveOutOfBattleHP)
                {
                    Pokemon.Revive(true);
                    if (Pokemon.isOutside() == false)
                    {
                        Pokemon.PutOut();
                    }
                }

                if (Pokemon.HP > 0 && Pokemon.HP > Pokemon.AutoReviveHP &&
                    (isAttacking || CavebotAttack.Enabled) && Pokemon.isOutside() == false)
                {
                    Pokemon.PutOut();
                }

                lblCharHP.Text  = Character.HP.ToString();
                lblPosX.Text    = Character.X.ToString();
                lblPosY.Text    = Character.Y.ToString();
                lblPosZ.Text    = Character.Z.ToString();
                lblDestinX.Text = Character.DestinX.ToString();
                lblDestinY.Text = Character.DestinY.ToString();

                bool isFishing = await Fishing.isFishing();

                lblIsFishing.Text   = isFishing.ToString();
                lblIsAttacking.Text = isAttacking.ToString();

                if (GUI.isPxgActive())
                {
                    if (chbHotkeys.Checked == true)
                    {
                        if (keyboardHook.IsStarted == false)
                        {
                            keyboardHook.Start();
                        }
                    }
                }
                else
                {
                    if (chbHotkeys.Checked == true)
                    {
                        if (keyboardHook.IsStarted == true)
                        {
                            keyboardHook.Stop();
                        }
                    }
                }

                txtDebug.Text           = Settings.DebugText;
                txtDebug.SelectionStart = txtDebug.Text.Length;
                txtDebug.ScrollToCaret();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: tmrUpdateInfo: " + ex.Message);
            }
        }
Example #22
0
        public override void Run()
        {
            if (!Products.IsStarted || ObjectManager.Me.IsDeadMe || ObjectManager.Me.InCombatBlizzard)
            {
                return;
            }
            if (!FisherbotSetting.CurrentSetting.FishSchool)
            {
                if (_firstRun && FishingTask.IsLaunched)
                {
                    _firstRun = false;
                }
                // If we have a saved position and we don't fish, then go to position
                if (FisherbotSetting.CurrentSetting.FisherbotPosition.IsValid && (!FishingTask.IsLaunched || _beenFighting) && !_firstRun)
                {
                    _beenFighting = false;
                    if (ObjectManager.Me.Position.DistanceTo(FisherbotSetting.CurrentSetting.FisherbotPosition) > 5)
                    {
                        LongMove.LongMoveGo(FisherbotSetting.CurrentSetting.FisherbotPosition);
                    }
                    else if (ObjectManager.Me.Position.DistanceTo(FisherbotSetting.CurrentSetting.FisherbotPosition) > 1.5f)
                    {
                        MovementManager.MoveTo(FisherbotSetting.CurrentSetting.FisherbotPosition);
                    }
                    MovementManager.Face(FisherbotSetting.CurrentSetting.FisherbotRotation);
                }
                // If we don't fish or the timer is null, then start a new timer, save position and fish
                if (timer == null || !FishingTask.IsLaunched)
                {
                    timer = new nManager.Helpful.Timer(10 * 60 * 1000 + 10 * 1000);
                    FisherbotSetting.CurrentSetting.FisherbotPosition = ObjectManager.Me.Position;
                    FisherbotSetting.CurrentSetting.FisherbotRotation = ObjectManager.Me.Rotation;
                    Fishing.EquipFishingPoles(FisherbotSetting.CurrentSetting.FishingPoleName);
                    FishingTask.LoopFish(0, FisherbotSetting.CurrentSetting.UseLure, FisherbotSetting.CurrentSetting.LureName, FisherbotSetting.CurrentSetting.FishingPoleName, false,
                                         FisherbotSetting.AutomaticallyUseDraenorSecondaryBait);
                }
                // If the timer ended, stop fishing, equip weapon, null the timer
                else if (timer.IsReady)
                {
                    FishingTask.StopLoopFish();
                    ItemsManager.EquipItemByName(FisherbotSetting.CurrentSetting.WeaponName);
                    if (!string.IsNullOrEmpty(FisherbotSetting.CurrentSetting.ShieldName))
                    {
                        ItemsManager.EquipItemByName(FisherbotSetting.CurrentSetting.ShieldName);
                    }

                    timer = null;
                }
                // We are in timer, we fish, then save the position
                else
                {
                    if (FishingTask._lastSuccessfullFishing > Environment.TickCount - 5000)
                    {
                        FisherbotSetting.CurrentSetting.FisherbotPosition = ObjectManager.Me.Position;
                        FisherbotSetting.CurrentSetting.FisherbotRotation = ObjectManager.Me.Rotation;
                        // We successfully fished in the last 5 seconds, let's record our position again.
                    }
                    if (FishingTask._lastSuccessfullFishing != 0 && FishingTask._lastSuccessfullFishing < Environment.TickCount - 25000)
                    {
                        // We did not catch a single thing in the last 25 seconds...
                        FishingTask.StopLoopFish();
                        return;
                    }
                    // _lastSuccessfullFishing is fine or we never fished yet, let it load :)
                    Thread.Sleep(500);
                }
                // No more while, we test what we need and return
                return;
            }

            // Nodes fishing code
            if (_node.IsValid)
            {
                FisherbotSetting.CurrentSetting.FisherbotPosition =
                    Bot.Profile.Points[Math.NearestPointOfListPoints(Bot.Profile.Points, _node.Position)];
                Logging.Write("Fish " + _node.Name + " > " + _node.Position);
            }

            if (FisherbotSetting.CurrentSetting.FishSchool)
            {
                Point whereToGo = Fishing.FindTheUltimatePoint(_node.Position);
                if (whereToGo.Type == "invalid")
                {
                    Logging.Write("No valid point found");
                    nManagerSetting.AddBlackList(_node.Guid);
                    return;
                }
                bool         r;
                List <Point> points = PathFinder.FindPath(whereToGo, out r);
                if (points.Count <= 1 || points.Count >= 20)
                {
                    points.Clear();
                    points.Add(ObjectManager.Me.Position);
                    points.Add(whereToGo);
                }
                else
                {
                    for (int i = 0; i < points.Count; i++)
                    {
                        if (points[i].Z < whereToGo.Z)
                        {
                            points[i].Z = whereToGo.Z;
                        }
                    }
                }
                Logging.Write("Going to point > " + whereToGo.X + " ; " + whereToGo.Y + " ; " + whereToGo.Z + " ; " +
                              points[0].Type);
                MovementManager.Go(points);

                timer = new nManager.Helpful.Timer(((int)Math.DistanceListPoint(points) / 3 * 1000) + 4000);
                while ((_node.IsValid || !FisherbotSetting.CurrentSetting.FishSchool) && Products.IsStarted &&
                       !ObjectManager.Me.IsDeadMe &&
                       !ObjectManager.Me.InInevitableCombat &&
                       !timer.IsReady && MovementManager.InMovement)
                {
                    if (ObjectManager.Me.Position.DistanceTo2D(whereToGo) <= 0.2f)
                    {
                        MovementManager.StopMove();
                        break;
                    }
                    Thread.Sleep(50);
                }

                if (timer.IsReady && _node.GetDistance2D > DistanceMax)
                {
                    Logging.Write("Fishing failed - No nearby point found (distance near position = " +
                                  ObjectManager.Me.Position.DistanceTo2D(
                                      FisherbotSetting.CurrentSetting.FisherbotPosition).ToString(CultureInfo.InvariantCulture) + ")");
                    MovementManager.StopMove();
                    nManagerSetting.AddBlackList(_node.Guid);
                    return;
                }
            }

            // Stop move
            MovementManager.StopMove();
            MountTask.DismountMount();

            // Face
            if (_node.IsValid)
            {
                MovementManager.Face(_node);
            }
            else
            {
                MovementManager.Face(FisherbotSetting.CurrentSetting.FisherbotRotation);
            }

            // Ce met a la bonne distance du banc de poisson
            if (_node.IsValid)
            {
                int nbIsSwimming = 0;
                timer = new nManager.Helpful.Timer(1000 * 8);
                while ((Usefuls.IsSwimming || _node.GetDistance > DistanceMax || _node.GetDistance < DistanceMin) &&
                       Products.IsStarted && !ObjectManager.Me.IsDeadMe && !ObjectManager.Me.InCombat && !timer.IsReady)
                {
                    if (nbIsSwimming * 100 > TimeTryFindGoodPos)
                    {
                        FishingTask.StopLoopFish();
                        MovementsAction.MoveBackward(false);
                        MovementsAction.MoveForward(false);
                        Logging.Write("BlackList " + _node.Name);
                        nManagerSetting.AddBlackList(_node.Guid);
                        return;
                    }
                    FishingTask.StopLoopFish();
                    MovementManager.Face(_node);

                    if (Usefuls.IsSwimming || _node.GetDistance < DistanceMin)
                    {
                        MovementsAction.MoveForward(false);
                        MovementsAction.MoveBackward(true);
                    }
                    if (_node.GetDistance > DistanceMax)
                    {
                        MovementsAction.MoveBackward(false);
                        MovementsAction.MoveForward(true);
                    }

                    nbIsSwimming++;
                    Thread.Sleep(100);
                }
                MovementsAction.MoveBackward(false);
                MovementsAction.MoveForward(false);
                if (timer.IsReady)
                {
                    Logging.Write("Fishing failed - Out of range" + timer.IsReady.ToString());
                    MovementManager.StopMove();
                    nManagerSetting.AddBlackList(_node.Guid);
                    return;
                }
            }

            // Fish
            Fishing.EquipFishingPoles(FisherbotSetting.CurrentSetting.FishingPoleName);
            FishingTask.LoopFish(_node.Guid, FisherbotSetting.CurrentSetting.UseLure, FisherbotSetting.CurrentSetting.LureName, FisherbotSetting.CurrentSetting.FishingPoleName,
                                 FisherbotSetting.CurrentSetting.PrecisionMode, FisherbotSetting.AutomaticallyUseDraenorSecondaryBait);

            timer = new nManager.Helpful.Timer(2 * 60 * 1000);
            while ((_node.IsValid || !FisherbotSetting.CurrentSetting.FishSchool) && Products.IsStarted &&
                   !ObjectManager.Me.IsDeadMe &&
                   !ObjectManager.Me.InCombat && !timer.IsReady &&
                   FishingTask.IsLaunched)
            {
                if (ObjectManager.Me.Position.DistanceTo2D(FisherbotSetting.CurrentSetting.FisherbotPosition) > 3.5f &&
                    !FisherbotSetting.CurrentSetting.FishSchool)
                {
                    break;
                }
                Thread.Sleep(300);
            }
            FishingTask.StopLoopFish();
            ItemsManager.EquipItemByName(FisherbotSetting.CurrentSetting.WeaponName);
            if (!string.IsNullOrEmpty(FisherbotSetting.CurrentSetting.ShieldName))
            {
                ItemsManager.EquipItemByName(FisherbotSetting.CurrentSetting.ShieldName);
            }
        }
Example #23
0
        private new void LoopFunc(StateMachineClient smc, Interaction <Sim, Terrain> .LoopData ld)
        {
            try
            {
                WaterTypes waterType = FishingSpot.GetWaterType(Hit.mType);
                EventTracker.SendEvent(new FishingLoopEvent(EventTypeId.kWentFishing, Actor, waterType, ld.mLifeTime));
                Actor.TryGroupTalk();
                //Actor.TrySinging();
                Fishing skill = Actor.SkillManager.GetSkill <Fishing>(SkillNames.Fishing);
                if (mShowTns && (ld.mLifeTime > kTimeToShowFishingTns))
                {
                    string str;
                    if (BaitInUse != null)
                    {
                        str = Common.LocalizeEAString("Gameplay/Objects/Fishing:NoFishWithBait");
                    }
                    else
                    {
                        str = Common.LocalizeEAString("Gameplay/Objects/Fishing:NoFishNoBait");
                    }
                    Actor.ShowTNSIfSelectable(str, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid);
                    if ((mLoopLengthForNextFish - ld.mLifeTime) < kTimeToCatchPostTns)
                    {
                        mLoopLengthForNextFish = ld.mLifeTime + kTimeToCatchPostTns;
                    }
                    mShowTns = false;
                }

                if (ld.mLifeTime > mLoopLengthForNextFish)
                {
                    mLoopLengthForNextFish += mFishingData.GetNextFishTimeLength(mIsAngler, skill.IsFisherman());
                    FishType none     = FishType.None;
                    string   baitUsed = null;
                    if (BaitInUse != null)
                    {
                        baitUsed = BaitInUse.Key;
                    }

                    if (!mShowTns)
                    {
                        none = mFishingData.GetFishCaught(Actor, baitUsed);
                    }

                    if ((mSittingInBoatPosture != null) && (none == FishType.Box))
                    {
                        none = FishType.None;
                    }

                    FishType type3 = none;
                    if (type3 == FishType.None)
                    {
                        bool flag = false;
                        if (Actor.TraitManager.HasElement(TraitNames.Clumsy))
                        {
                            flag = RandomUtil.RandomChance01(kChanceOfPlayingLostFishAnimIfClumsy);
                        }
                        else
                        {
                            flag = RandomUtil.RandomChance01(kChanceOfPlayingLostFishAnim);
                        }
                        if (!flag)
                        {
                            return;
                        }
                        AnimateSim("CatchNothing");
                    }
                    else if (type3 == FishType.Box)
                    {
                        int        num = 0x0;
                        WorldType  currentWorldType = GameUtils.GetCurrentWorldType();
                        WorldName  currentWorld     = GameUtils.GetCurrentWorld();
                        List <int> list             = new List <int>();
                        for (int i = 0x0; i < sBoxData.Count; i++)
                        {
                            BoxData data = sBoxData[i];
                            if (((data.AllowedWorldType == WorldType.Undefined) || (data.AllowedWorldType == currentWorldType)) && (((data.AllowedWorlds == null) || (data.AllowedWorlds.Count == 0x0)) || (data.AllowedWorlds.Contains(currentWorld) || data.AllowedWorlds.Contains(WorldName.Undefined))))
                            {
                                num += sBoxChances[i];
                                list.Add(i);
                            }
                        }
                        int chance = RandomUtil.GetInt(num - 0x1);
                        int num4   = 0x0;
                        foreach (int num5 in list)
                        {
                            num4 = num5;
                            if (chance < sBoxChances[num5])
                            {
                                break;
                            }
                            chance -= sBoxChances[num5];
                        }
                        IGameObject obj2 = GlobalFunctions.CreateObject(sBoxData[num4].ItemName, Vector3.OutOfWorld, 0x1, Vector3.UnitZ);
                        if (obj2 == null)
                        {
                            return;
                        }
                        bool happy = sBoxData[num4].Happy;
                        if (Actor.TraitManager.HasElement(TraitNames.Insane))
                        {
                            happy = !happy;
                        }
                        SetSplashAndDripEffects(EffectSize.Small);
                        if (happy)
                        {
                            AnimateSim("CatchBoxHappy");
                            Actor.Inventory.TryToAdd(obj2, false);
                        }
                        else
                        {
                            AnimateSim("CatchBoxSad");
                            Actor.Inventory.TryToAdd(obj2, false);
                        }
                        Actor.ShowTNSIfSelectable(Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/Fishing:CaughtBox", new object[] { Actor, obj2 }), StyledNotification.NotificationStyle.kGameMessagePositive, obj2.ObjectId, Actor.ObjectId);
                    }
                    else
                    {
                        int    num6;
                        string str3;
                        Fish   actor = Fish.CreateFish(none, Actor, skill, BaitInUse, out num6, out str3);
                        actor.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.InInventory);
                        mNumberFishCaught++;
                        SetActor("fish", actor);
                        SetSplashAndDripEffects(actor.EffectSize);
                        PlayFishCatchAnimation(num6);
                        if (str3 != null)
                        {
                            Actor.ShowTNSIfSelectable(str3, StyledNotification.NotificationStyle.kGameMessagePositive, actor.ObjectId, Actor.ObjectId);
                        }

                        EventTracker.SendEvent(new CaughtFishEvent(EventTypeId.kCaughtFish, Actor, actor, baitUsed));
                        Actor.Inventory.TryToAdd(actor, false);
                        if ((BaitInUse != null) && RandomUtil.RandomChance(kPercentChanceBaitLost))
                        {
                            Actor.Inventory.SetNotInUse(BaitInUse);
                            Actor.Inventory.RemoveByForce(BaitInUse);
                            IFishBait baitInUse = BaitInUse;
                            BaitInUse = FindProperBait(new Fishing.BaitInfo(baitInUse));
                            if (BaitInUse == null)
                            {
                                ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData(baitInUse.GetThoughtBalloonThumbnailKey());
                                bd.mCoolDown = ThoughtBalloonCooldown.Medium;
                                bd.LowAxis   = ThoughtBalloonAxis.kDislike;
                                Actor.ThoughtBalloonManager.ShowBalloon(bd);
                                Actor.InteractionQueue.FireQueueChanged();
                                string message = Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/Fishing:NoMoreBait", new object[] { Actor, baitInUse.GetLocalizedName() });
                                Actor.ShowTNSIfSelectable(message, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, Actor.ObjectId);
                            }
                            baitInUse.Destroy();
                        }
                    }

                    if (!ActiveStage.IsComplete((InteractionInstance)this))
                    {
                        mCurrentStateMachine.SetParameter("skillLevel", skill.GetSkillLevelParameterForJazzGraph());
                        AnimateSim("Fish");
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.DebugException(Actor, Target, e);
            }
        }
Example #24
0
        public override bool Run()
        {
            try
            {
                Vector3 vector4;
                if (Actor.LotCurrent.IsHouseboatLot())
                {
                    mIsHouseboat = true;
                }
                mSittingInBoatPosture = Actor.Posture as SittingInBoat;

                Vector3 mPoint       = Hit.mPoint;
                Vector3 newTargetPos = mPoint;
                if (mSittingInBoatPosture == null)
                {
                    if (!mIsHouseboat)
                    {
                        if (IsNearHiddenIsland(mPoint))
                        {
                            Vector3 invalid = Vector3.Invalid;
                            World.GetNearestSwimmingPoint(Actor.Position, ref invalid, ref mPoint);
                        }

                        if (!RouteToFishingLocation(mPoint, Actor, Hit.mType, Hit.mId))
                        {
                            Actor.PlayRouteFailure(new ThumbnailKey(ResourceKey.CreatePNGKey("w_fishing_skill", ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)), ThumbnailSize.Medium));
                            return(false);
                        }
                    }
                    else if (!RouteToFishingLocationOnHouseboat(Actor, ref mPoint, Actor, Hit.mType, Hit.mId, ref newTargetPos))
                    {
                        return(false);
                    }
                }
                else
                {
                    Boat container = mSittingInBoatPosture.Container as Boat;
                    if (container != null)
                    {
                        mPoint = container.GetFishingPosition(mSittingInBoatPosture);
                        if (World.GetTerrainType(mPoint.x, mPoint.z, container.Level) != 2)
                        {
                            return(false);
                        }

                        RoutingComponent routingComponent = container.RoutingComponent;
                        if ((routingComponent == null) || routingComponent.IsRouting)
                        {
                            return(false);
                        }
                    }
                }

                if (mIsHouseboat && World.GetHouseboatDisplayToWorldPosition(Actor.LotCurrent.LotId, newTargetPos, out vector4))
                {
                    PrepFishing(mPoint, vector4);
                }
                else
                {
                    PrepFishing(mPoint, mPoint);
                }

                WaterTypes waterType = FishingSpot.GetWaterType(Hit.mType);
                Fishing    fishing   = Actor.SkillManager.AddElement(SkillNames.Fishing) as Fishing;
                fishing.TypesOfWaterFishedIn = waterType | fishing.TypesOfWaterFishedIn;
                if (!BaitSelected)
                {
                    BaitInfoSelected = fishing.mBaitInfo;
                }
                if (BaitInfoSelected != null)
                {
                    BaitInUse = FindProperBait(BaitInfoSelected);
                    Actor.InteractionQueue.FireQueueChanged();
                }
                else if (fishing.SkillLevel > kNoBaitUsedLesson)
                {
                    Tutorialette.TriggerLesson(Lessons.FishingSkill, Actor);
                }

                BeginCommodityUpdates();

                bool succeeded = false;

                MotiveDelta delta = null;

                try
                {
                    StartStages();
                    if (Actor.TraitManager.HasElement(TraitNames.Angler))
                    {
                        mIsAngler = true;
                        delta     = AddMotiveDelta(CommodityKind.Fun, kAnglerFunPerHour);
                    }

                    mLoopLengthForNextFish = mFishingData.GetNextFishTimeLength(mIsAngler, fishing.IsFisherman());
                    mShowTns = mFishingData.ShouldShowFishingTns(Actor, BaitInUse);
                    mCurrentStateMachine.SetParameter("skillLevel", fishing.GetSkillLevelParameterForJazzGraph());
                    if (BaitInUse != null)
                    {
                        fishing.mBaitInfo = new Fishing.BaitInfo(BaitInUse);
                    }
                    else
                    {
                        fishing.mBaitInfo = null;
                    }

                    AnimateSim("Fish");
                    Actor.RegisterGroupTalk();

                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new Interaction <Sim, Terrain> .InsideLoopFunction(LoopFunc), mCurrentStateMachine);

                    Actor.UnregisterGroupTalk();
                    if (BaitInUse != null)
                    {
                        Actor.Inventory.SetNotInUse(BaitInUse);
                    }

                    if (mSittingInBoatPosture == null)
                    {
                        AnimateSim("Exit");
                    }
                    else
                    {
                        AnimateSim("ExitFishing");
                        mSittingInBoatPosture.CurrentStateMachine.RequestState("x", "SimIdle");
                    }
                }
                finally
                {
                    StandardExit(false, false);
                    if (mIsAngler)
                    {
                        RemoveMotiveDelta(delta);
                    }

                    EndCommodityUpdates(succeeded);
                }
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #25
0
 //public TileManager tileManager;
 void Awake()
 {
     Instance = this;
 }
Example #26
0
        private void handleSecondClickNPC(Player player, Packet packet)
        {
            int npcIndex = packet.readLEShort();

            if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null)
            {
                return;
            }
            Npc npc = Server.getNpcList()[npcIndex];

            if (npc == null || npc.isDestroyed())
            {
                return;
            }
            Console.WriteLine("Second click NPC " + npc.getId());
            SkillHandler.resetAllSkills(player);
            if (Fishing.wantToFish(player, npc, false))
            {
                return;
            }
            else if (Slayer.talkToMaster(player, npc))
            {
                return;
            }
            else if (AgilityArena.dialogue(player, npc, false))
            {
                return;
            }
            else if (TzHaar.interactTzhaarNPC(player, npc, 1))
            {
                return;
            }
            else if (WarriorGuild.talkToWarriorGuildNPC(player, npc, 1))
            {
                return;
            }
            else if (BoatOptions.interactWithBoatNPC(player, npc))
            {
                return;
            }
            switch (npc.getId())
            {
            case 519:     // Bob
                BrokenBarrows.talkToBob(player, npc, -1, 1);
                break;

            case 553:     // Aubury
                HomeArea.interactWithAubury(player, npc, 1);
                break;

            case 1862: // Ali morisanne
                if (npc.getLocation().inArea(2319, 3177, 2321, 3182))
                {      // Home Ali
                    HomeArea.interactWithAliMorissaae(player, npc);
                    break;
                }
                else if (npc.getLocation().inArea(3311, 3198, 3316, 3199))
                {     // Al Kharid Ali
                    AlKharid.interactWithAliMorissaae(player, npc);
                    break;
                }
                break;
            }
        }
Example #27
0
        internal static bool GatherFishNode(PGameObject node)
        {
            if (_reLure == null)
            {
                _reLure = new Ticker(600000);
                _reLure.ForceReady();
            }
            FlyingEngine.Navigator.Stop();
            var combat = new StateCombat();
            int nearestIndexInPositionList =
                Location.GetClosestPositionInList(FlyingEngine.CurrentProfile.WaypointsNormal, node.Location);
            Location position = FlyingEngine.CurrentProfile.WaypointsNormal[nearestIndexInPositionList];

            if (!ApproachPosFlying.Approach(position, 5))
            {
                return(false);
            }
            node.Location.Face();
            if (Bobber() != null)
            {
                Logging.Write("Someone is fishing, break");
                return(false);
            }
            if (!CheckMobs(node))
            {
                return(false);
            }
            if (FlyingBlackList.IsBlacklisted(node))
            {
                ToldAboutNode.TellAbout("is blacklisted", node);
                return(false);
            }
            DescentToSchool(node);
            Mount.Dismount();
            var timeout      = new Ticker((FlyingSettings.MaxTimeAtSchool * 60) * 1000);
            var checkIfValid = new Ticker(8000);

            while (node.IsValid)
            {
                while (combat.NeedToRun)
                {
                    combat.DoWork();
                    timeout.Reset();
                }
                if (checkIfValid.IsReady)
                {
                    if (ObjectManager.GetObjects.FirstOrDefault(u => u.BaseAddress == node.BaseAddress) == null)
                    {
                        break;
                    }
                    checkIfValid.Reset();
                }
                if (FlyingSettings.Lure && _reLure.IsReady)
                {
                    KeyHelper.SendKey("Lure");
                    Thread.Sleep(3500);
                    _reLure.Reset();
                }
                if (timeout.IsReady)
                {
                    return(false);
                }
                if (ObjectManager.MyPlayer.IsSwimming)
                {
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1000);
                    KeyHelper.SendKey("Waterwalk");
                    Thread.Sleep(2000);
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1500);
                    if (ObjectManager.MyPlayer.IsSwimming)
                    {
                        return(false);
                    }
                }
                node.Location.Face();
                var timeout3 = new Ticker(4000);
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D < 14))
                {
                    MoveHelper.Backwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                timeout3.Reset();
                node.Location.Face();
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D > 16))
                {
                    MoveHelper.Forwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                KeyHelper.SendKey("Fishing");
                Thread.Sleep(1500);
                Fishing.FindBobberAndClick(FlyingSettings.WaitForLoot);
                Thread.Sleep(100);
            }
            return(true);
        }
Example #28
0
 public override void DoWork()
 {
     KeyHelper.SendKey("Fishing");
     Thread.Sleep(1500);
     Fishing.FindBobberAndClick(true);
 }
Example #29
0
        private void TickEvent(List <Events.TickNametagData> nametags)
        {
            // Get the current time
            DateTime dateTime = DateTime.UtcNow;

            // Check if the player is connected
            if (playerLogged)
            {
                // Disable hitting with the weapon
                RAGE.Game.Pad.DisableControlAction(0, 140, true);
                RAGE.Game.Pad.DisableControlAction(0, 141, true);

                if (Vehicles.lastPosition != null)
                {
                    if (Player.LocalPlayer.Vehicle == null)
                    {
                        // He fell from the vehicle, save the data
                        Vehicles.RemoveSpeedometerEvent(null);
                    }
                    else
                    {
                        // Update the speedometer
                        Vehicles.UpdateSpeedometer();
                    }
                }

                // Update the player's money each 450ms
                if (dateTime.Ticks - lastTimeChecked.Ticks >= 4500000)
                {
                    // Check if the player is loaded
                    object money = Player.LocalPlayer.GetSharedData(Constants.HAND_MONEY);

                    if (money != null)
                    {
                        playerMoney     = Convert.ToInt32(money) + "$";
                        lastTimeChecked = dateTime;
                    }
                }

                if (Fishing.fishingState > 0)
                {
                    // Start the fishing minigame
                    Fishing.DrawFishingMinigame();
                }

                // Draw the money
                RAGE.NUI.UIResText.Draw(playerMoney, 1900, 60, RAGE.Game.Font.Pricedown, 0.5f, Color.DarkOliveGreen, RAGE.NUI.UIResText.Alignment.Right, true, true, 0);

                // Check if the player
                if (RAGE.Game.Pad.IsControlJustPressed(0, (int)RAGE.Game.Control.VehicleSubPitchDownOnly) && Player.LocalPlayer.Vehicle != null)
                {
                    // Check if the player is on a forklift
                    Trucker.CheckPlayerStoredCrate();
                }

                // Check if the player is handcuffed
                if (Police.handcuffed)
                {
                    RAGE.Game.Pad.DisableControlAction(0, 12, true);
                    RAGE.Game.Pad.DisableControlAction(0, 13, true);
                    RAGE.Game.Pad.DisableControlAction(0, 14, true);
                    RAGE.Game.Pad.DisableControlAction(0, 15, true);
                    RAGE.Game.Pad.DisableControlAction(0, 16, true);
                    RAGE.Game.Pad.DisableControlAction(0, 17, true);
                    RAGE.Game.Pad.DisableControlAction(0, 22, true);
                    RAGE.Game.Pad.DisableControlAction(0, 24, true);
                    RAGE.Game.Pad.DisableControlAction(0, 25, true);
                }
            }

            // Detect if a key has been pressed
            int key = Keys.DetectPressedKey(dateTime.Ticks);

            if (key >= 0)
            {
                // Fire the event for the pressed key
                Keys.FireKeyPressed(key);
            }
        }
Example #30
0
        /// <summary>
        /// Command list for the game
        /// </summary>
        /// <param name="commandOptions">Everything after the 1st occurance of a space</param>
        /// <param name="commandKey">The string before the 1st occurance of a space</param>
        /// <param name="playerData">Player Data</param>
        /// <param name="room">Current room</param>
        /// <returns>Returns Dictionary of commands</returns>
        public static void Commands(string commandOptions, string commandKey, PlayerSetup.Player playerData, Room.Room room)
        {
            var context = HubContext.Instance;

            switch (commandKey)
            {
            case "north":
                Movement.Move(playerData, room, "North");
                break;

            case "east":
                Movement.Move(playerData, room, "East");
                break;

            case "south":
                Movement.Move(playerData, room, "South");
                break;

            case "west":
                Movement.Move(playerData, room, "West");
                break;

            case "up":
                Movement.Move(playerData, room, "Up");
                break;

            case "down":
                Movement.Move(playerData, room, "Down");
                break;

            case "look":
            case "look at":
            case "l at":
            case "search":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "look");
                break;

            case "l in":
            case "search in":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "look in");
                break;

            case "examine":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "examine");
                break;

            case "touch":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "touch");
                break;

            case "smell":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "smell");
                break;

            case "taste":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "taste");
                break;

            case "score":
                Score.ReturnScore(playerData);
                break;

            case "inventory":
                Inventory.ReturnInventory(playerData.Inventory, playerData);
                break;

            case "eq":
            case "equip":
            case "equipment":
            case "garb":
                Equipment.ShowEquipment(playerData);
                break;

            case "loot":
            case "get":
            case "take":
                ManipulateObject.GetItem(room, playerData, commandOptions, commandKey, "item");
                break;

            case "plunder":
                ManipulateObject.GetItem(room, playerData, "all " + commandOptions, commandKey, "item");
                break;

            case "drop":
            case "put":
                ManipulateObject.DropItem(room, playerData, commandOptions, commandKey);
                break;

            case "give":
                ManipulateObject.GiveItem(room, playerData, commandOptions, commandKey, "killable");
                break;

            case "save":
                Save.SavePlayer(playerData);
                break;

            case "say":
            case "'":
                Communicate.Say(commandOptions, playerData, room);
                break;

            case "sayto":
            case ">":
                Communicate.SayTo(commandOptions, room, playerData);
                break;

            case "newbie":
                Communicate.NewbieChannel(commandOptions, playerData);
                break;

            case "gossip":
                Communicate.GossipChannel(commandOptions, playerData);
                break;

            case "ooc":
                Communicate.OocChannel(commandOptions, playerData);
                break;

            case "yes":
                Communicate.Say("Yes", playerData, room);
                break;

            case "no":
                Communicate.Say("No", playerData, room);
                break;

            case "yell":
                Communicate.Yell(commandOptions, room, playerData);
                break;

            case "talkto":
                Talk.TalkTo(commandOptions, room, playerData);
                break;

            case "emote":
                Emote.EmoteActionToRoom(commandOptions, playerData);
                break;

            case "use":
            case "wear":
            case "wield":
                Equipment.WearItem(playerData, commandOptions);
                break;

            case "remove":
            case "doff":
            case "unwield":
                Equipment.RemoveItem(playerData, commandOptions);
                break;

            case "hit":
            case "kill":
            case "attack":
                Fight2.PerpareToFight(playerData, room, commandOptions);
                break;

            case "flee":
                Flee.fleeCombat(playerData, room);
                break;

            case "sacrifice":
            case "harvest":
                Harvest.Body(playerData, room, commandOptions);
                break;

            case "peek":
                Peak.DoPeak(context, playerData, room, commandOptions);
                break;

            case "steal":
                Steal.DoSteal(context, playerData, room, commandOptions);
                break;

            case "pick":
                LockPick.DoLockPick(context, playerData, room, commandOptions);
                break;

            case "c magic missile":
            case "cast magic missile":
                MagicMissile.StartMagicMissile(playerData, room, commandOptions);
                break;

            case "c armour":
            case "cast armour":
            case "c armor":
            case "cast armor":
                new Armour().StartArmour(playerData, room, commandOptions);
                break;

            case "c continual light":
            case "cast continual light":
                ContinualLight.StarContinualLight(playerData, room, commandOptions);
                break;

            case "c invis":
            case "cast invis":
                Invis.StartInvis(playerData, room, commandOptions);
                break;

            case "c weaken":
            case "cast weaken":
                Weaken.StartWeaken(playerData, room, commandOptions);
                break;

            case "c chill touch":
            case "cast chill touch":
                ChillTouch.StartChillTouch(playerData, room, commandOptions);
                break;

            case "c fly":
            case "cast fly":
                Fly.StartFly(playerData, room, commandOptions);
                break;

            case "c refresh":
            case "cast refresh":
                Refresh.StartRefresh(playerData, room, commandOptions);
                break;

            case "c faerie fire":
            case "cast faerie fire":
                FaerieFire.StartFaerieFire(playerData, room, commandOptions);
                break;

            case "c teleport":
            case "cast teleport":
                Teleport.StartTeleport(playerData, room);
                break;

            case "c blindness":
            case "cast blindness":
                Blindness.StartBlind(playerData, room, commandOptions);
                break;

            case "c haste":
            case "cast haste":
                Haste.StartHaste(playerData, room, commandOptions);
                break;

            case "c create spring":
            case "cast create spring":
                CreateSpring.StartCreateSpring(playerData, room);
                break;

            case "c shocking grasp":
            case "cast shocking grasp":
                new ShockingGrasp().StartShockingGrasp(playerData, room, commandOptions);
                break;

            case "c cause light":
            case "cast cause light":
                new CauseLight().StartCauseLight(context, playerData, room, commandOptions);
                break;

            case "c cure light":
            case "cast cure light":
                new CureLight().StartCureLight(context, playerData, room, commandOptions);
                break;

            case "c cure blindness":
                new CureBlindness().StartCureBlindness(context, playerData, room, commandOptions);
                break;

            case "c detect invis":
            case "cast detect invis":
                DetectInvis.DoDetectInvis(context, playerData, room);
                break;

            case "forage":
                new Foraging().StartForaging(playerData, room);
                break;

            case "fish":
            case "angle":
            case "line":
            case "trawl":
            case "lure":
                new Fishing().StartFishing(playerData, room);
                break;

            case "reel":
                Fishing.GetFish(playerData, room);
                break;

            case "dirt kick":
                new DirtKick().StartDirtKick(context, playerData, room, commandOptions);
                break;

            case "bash":
                new Bash().StartBash(context, playerData, room, commandOptions);
                break;

            case "shield bash":
                new ShieldBash().StartBash(context, playerData, room, commandOptions);
                break;

            case "punch":
                Punch.StartPunch(playerData, room);
                break;

            case "kick":
                new Kick().StartKick(context, playerData, room, commandOptions);
                break;

            case "spin kick":
                new SpinKick().StartKick(context, playerData, room, commandOptions);
                break;

            case "rescue":
                new Rescue().StartRescue(context, playerData, room, commandOptions);
                break;

            case "lunge":
                new Lunge().StartLunge(context, playerData, room, commandOptions);
                break;

            case "disarm":
                new Disarm().StartDisarm(context, playerData, room);
                break;

            case "backstab":
                new Backstab().StartBackstab(context, playerData, room, commandOptions);
                break;

            case "feint":
                new Feint().StartFeint(context, playerData, room, commandOptions);
                break;

            case "mount":
            case "ride":
                Mount.StartMount(playerData, room, commandOptions);
                break;

            case "dismount":
                Mount.Dismount(playerData, room, commandOptions);
                break;

            case "trip":
                new Trip().StartTrip(context, playerData, room, commandOptions);
                break;

            case "sneak":
                Sneak.DoSneak(context, playerData);
                break;

            case "hide":
                Hide.DoHide(context, playerData);
                break;

            case "lore":
                Lore.DoLore(context, playerData, commandOptions);
                break;

            case "unlock":
                ManipulateObject.UnlockItem(room, playerData, commandOptions, commandKey);
                break;

            case "lock":
                ManipulateObject.LockItem(room, playerData, commandOptions, commandKey);
                break;

            case "close":
            case "shut":
                ManipulateObject.Close(room, playerData, commandOptions, commandKey);
                break;

            case "drink":
                ManipulateObject.Drink(room, playerData, commandOptions, commandKey);
                break;

            case "help":
            case "/help":
            case "?":
            case "commands":
                Help.ShowHelp(commandOptions, playerData);
                break;

            case "time":
            case "clock":
                Update.Time.ShowTime();
                break;

            case "skills":
            case "spells":
            case "skills all":
                ShowSkills.ShowPlayerSkills(playerData, commandOptions);
                break;

            case "practice":
                Trainer.Practice(playerData, room, commandOptions);
                break;

            case "list":
                Shop.listItems(playerData, room);
                break;

            case "buy":
                Shop.buyItems(playerData, room, commandOptions);
                break;

            case "sell":
                Shop.sellItems(playerData, room, commandOptions);
                break;

            case "quest log":
            case "qlog":
                Quest.QuestLog(playerData);
                break;

            case "wake":
                Status.WakePlayer(context, playerData, room);
                break;

            case "sleep":
                Status.SleepPlayer(context, playerData, room);
                break;

            case "rest":
            case "sit":
                Status.RestPlayer(context, playerData, room);
                break;

            case "stand":
                Status.StandPlayer(context, playerData, room);
                break;

            case "greet":
                Greet.GreetMob(playerData, room, commandOptions);
                break;

            case "who":
                Who.Connected(playerData);
                break;

            case "affects":
                Effect.Show(playerData);
                break;

            case "follow":
                Follow.FollowThing(playerData, room, commandOptions);
                break;

            case "nofollow":
                Follow.FollowThing(playerData, room, "noFollow");
                break;

            case "quit":
                HubContext.Instance.Quit(playerData.HubGuid, room);
                break;

            case "craft":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Craft);
                break;

            case "chop":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Chop);
                break;

            case "cook":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Cook);
                break;

            case "brew":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Brew);
                break;

            case "forge":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Forge);
                break;

            case "carve":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Carve);
                break;

            case "knit":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Knitting);
                break;

            case "make":
            case "build":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Craft);
                break;

            case "show crafts":
            case "craftlist":
                Craft.CraftList(playerData);
                break;

            case "set up camp":
                Camp.SetUpCamp(playerData, room);
                break;

            case "repair":
                Events.Repair.RepairItem(playerData, room, commandOptions);
                break;

            case "/debug":
                PlayerSetup.Player.DebugPlayer(playerData);
                break;

            case "/setGold":
                PlayerSetup.Player.SetGold(playerData, commandOptions);
                break;

            case "/setAc":
                PlayerSetup.Player.SetAC(playerData, commandOptions);
                break;

            case "/map":
                SigmaMap.DrawMap(playerData.HubGuid);     //not what you think it does
                break;

            default:
                HubContext.Instance.SendToClient("Sorry you can't do that. Try help commands or ask on the discord channel.", playerData.HubGuid);
                var log = new Error.Error
                {
                    Date         = DateTime.Now,
                    ErrorMessage = commandKey + " " + commandOptions,
                    MethodName   = "Wrong command"
                };

                Save.LogError(log);
                break;
            }
        }