Exemple #1
0
        public void UpdatePosition()
        {
            Vector2 pos = oriMemory.GetCameraTargetPosition();

            if (pos.X != posX || pos.Y != posY)
            {
                posX = pos.X;
                posY = pos.Y;
                oriTriggers.OnPositionChange(pos);
            }
        }
Exemple #2
0
        public void GetValues()
        {
            if (!mem.HookProcess())
            {
                return;
            }

            GameState gameState      = mem.GetGameState();
            bool      isInGame       = CheckInGame(gameState);
            bool      isInGameWorld  = CheckInGameWorld(gameState);
            bool      isStartingGame = CheckStartingNewGame(gameState);

            if (!isInGameWorld)
            {
                notInGame = DateTime.Now;
            }

            LogValues();

            if (settings.RainbowDash && isInGameWorld)
            {
                mem.ActivateRainbowDash();
            }

            if (Model != null && currentSplit < settings.Splits.Count)
            {
                bool shouldSplit = false;

                OriSplit split = settings.Splits[currentSplit];
                if (split.Field == "Start Game")
                {
                    shouldSplit = isStartingGame;
                }
                else if (split.Field == "In Game")
                {
                    shouldSplit = isInGame && notInGame.AddSeconds(1) > DateTime.Now;
                }
                else if (split.Field == "In Menu")
                {
                    shouldSplit = !isInGame;
                }
                else if (split.Field == "Hitbox" || split.Field == "End of Forlorn Escape" || split.Field == "End of Horu Escape" || split.Field == "Spirit Tree Reached")
                {
                    HitBox ori    = new HitBox(mem.GetCameraTargetPosition(), 0.68f, 1.15f, true);
                    HitBox hitBox = new HitBox(split.Value);
                    shouldSplit = hitBox.Intersects(ori);
                }
                else if (isInGameWorld && DateTime.Now.AddSeconds(-1) > notInGame)
                {
                    switch (split.Field)
                    {
                    case "Map %":
                        decimal map = mem.GetTotalMapCompletion();
                        decimal splitMap;
                        if (decimal.TryParse(split.Value, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out splitMap))
                        {
                            shouldSplit = map >= splitMap;
                        }
                        break;

                    case "Valley 100%":
                    case "Grotto 100%":
                    case "Swamp 100%":
                    case "Ginso 100%":
                    case "Forlorn 100%":
                    case "Horu 100%":
                    case "Glades 100%":
                    case "Sorrow 100%":
                    case "Black Root 100%":
                        string      areaName = split.Field.Substring(0, split.Field.Length - 5);
                        List <Area> areas    = mem.GetMapCompletion();
                        for (int i = 0; i < areas.Count; i++)
                        {
                            Area area = areas[i];
                            if (area.Name.IndexOf(areaName, StringComparison.OrdinalIgnoreCase) >= 0)
                            {
                                shouldSplit = area.Progress > (decimal)99.99;
                                break;
                            }
                        }
                        break;

                    case "Soul Flame":
                    case "Spirit Flame":
                    case "Wall Jump":
                    case "Charge Flame":
                    case "Dash":
                    case "Double Jump":
                    case "Bash":
                    case "Stomp":
                    case "Light Grenade":
                    case "Glide":
                    case "Climb":
                    case "Charge Jump":
                        shouldSplit = mem.GetAbility(split.Field); break;

                    case "Ability":
                        shouldSplit = mem.GetAbility(split.Value); break;

                    case "Mist Lifted":
                    case "Clean Water":
                    case "Wind Restored":
                    case "Gumo Free":
                    case "Warmth Returned":
                    case "Darkness Lifted":
                        shouldSplit = mem.GetEvent(split.Field); break;

                    case "Gumon Seal":
                    case "Sunstone":
                    case "Water Vein":
                        shouldSplit = mem.GetKey(split.Field); break;

                    case "Ginso Tree Entered":
                    case "Forlorn Ruins Entered":
                    case "Mount Horu Entered":
                    case "End Game":
                        List <Scene> scenes = mem.GetScenes();
                        for (int i = 0; i < scenes.Count; i++)
                        {
                            Scene scene = scenes[i];
                            if (scene.State == SceneState.Loaded)
                            {
                                switch (scene.Name)
                                {
                                case "ginsoEntranceIntro": shouldSplit = split.Field == "Ginso Tree Entered"; break;

                                case "forlornRuinsGetNightberry": shouldSplit = split.Field == "Forlorn Ruins Entered"; break;

                                case "mountHoruHubMid": shouldSplit = split.Field == "Mount Horu Entered"; break;
                                }
                            }
                            else if (scene.State == SceneState.Loading)
                            {
                                switch (scene.Name)
                                {
                                case "creditsScreen": shouldSplit = split.Field == "End Game"; break;
                                }
                            }
                        }
                        break;

                    case "Health Cells":
                        int maxHP = mem.GetCurrentHPMax();
                        int splitMaxHP;
                        if (int.TryParse(split.Value, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out splitMaxHP))
                        {
                            shouldSplit = maxHP >= splitMaxHP;
                        }
                        break;

                    case "Current Health":
                        int   curHP = mem.GetCurrentHP();
                        float splitCurHP;
                        if (float.TryParse(split.Value, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out splitCurHP))
                        {
                            shouldSplit = curHP == (int)(splitCurHP * 4);
                        }
                        break;

                    case "Energy Cells":
                        float maxEN = mem.GetCurrentENMax();
                        int   splitMaxEN;
                        if (int.TryParse(split.Value, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out splitMaxEN))
                        {
                            shouldSplit = maxEN >= splitMaxEN;
                        }
                        break;

                    case "Current Energy":
                        float curEN = mem.GetCurrentEN();
                        float splitCurEN;
                        if (float.TryParse(split.Value, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out splitCurEN))
                        {
                            shouldSplit = Math.Abs(curEN - splitCurEN) < 0.1f;
                        }
                        break;

                    case "Ability Cells":
                        int cells = mem.GetAbilityCells();
                        int splitCells;
                        if (int.TryParse(split.Value, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out splitCells))
                        {
                            shouldSplit = cells >= splitCells;
                        }
                        break;

                    case "Level":
                        int lvl = mem.GetCurrentLevel();
                        int splitLvl;
                        if (int.TryParse(split.Value, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out splitLvl))
                        {
                            shouldSplit = lvl >= splitLvl;
                        }
                        break;

                    case "Key Stones":
                        int keystones = mem.GetKeyStones();
                        int splitKeys;
                        if (int.TryParse(split.Value, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out splitKeys))
                        {
                            shouldSplit = keystones == splitKeys;
                        }
                        break;
                    }
                }
                HandleSplit(shouldSplit, split);
            }
        }
Exemple #3
0
        public void Update()
        {
            try {
                UpdatePosition();
                double  fontSize      = Math.Max((double)Height / 50, (double)6);
                double  fontSizeSmall = Math.Max((double)Height / 70, (double)6);
                Vector4 hitbox        = new Vector4(0, 0, 0, 0);

                var mouse = System.Windows.Forms.Form.MousePosition;
                if (mouse.X >= Left && mouse.X < Left + Width && mouse.Y >= Top && mouse.Y < Top + Height &&
                    System.Windows.Forms.Form.MouseButtons == System.Windows.Forms.MouseButtons.Middle)
                {
                    if (isDragging == false)
                    {
                        start = reader.ScreenToGame(new Vector2(mouse.X, mouse.Y));
                    }
                    isDragging = true;

                    Vector2 startScreen = reader.GameToScreen(start);
                    if (mouse.X < startScreen.X)
                    {
                        hitbox.X = mouse.X;
                    }
                    else
                    {
                        hitbox.X = startScreen.X;
                    }
                    if (mouse.Y < startScreen.Y)
                    {
                        hitbox.Y = mouse.Y;
                    }
                    else
                    {
                        hitbox.Y = startScreen.Y;
                    }

                    hitbox.W = (float)Math.Abs(mouse.X - startScreen.X);
                    hitbox.H = (float)Math.Abs(mouse.Y - startScreen.Y);

                    lastHitbox = reader.ScreenToGame(hitbox);
                    if (OnNewHitbox != null)
                    {
                        OnNewHitbox(this, new EventArgs());
                    }
                }
                else
                {
                    isDragging = false;
                }

                DrawRectangle(lastHitbox);

                OriInfo.FontSize = fontSize;
                Vector2       pos    = reader.ScreenToGame(new Vector2(mouse.X, mouse.Y));
                Vector2       oripos = reader.GetCameraTargetPosition();
                StringBuilder sb     = new StringBuilder();
                sb.AppendLine("Ori: " + oripos.ToString()).AppendLine("Mouse: " + pos.ToString());

                if (hitboxUI != null)
                {
                    sb.AppendLine("Hitbox: " + lastHitbox.ToString());
                }

                OriInfo.Text = sb.ToString();

                Canvas.SetLeft(OriInfo, Width - OriInfo.ActualWidth * 1.2);
                Canvas.SetTop(OriInfo, Height - OriInfo.ActualHeight * 1.3);
            } catch { }
        }