Exemple #1
0
        /// <summary>
        /// Delegate function for getting rando item. This can be used by IL hooks that need to make this call later.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        private EItems GetRandoItemByItem(EItems item)
        {
            LocationRO ruxxAmuletLocation;

            if (randoStateManager.IsLocationRandomized(item, out ruxxAmuletLocation))
            {
                Console.WriteLine($"IL Wackiness -- Checking for Item '{item}' | Rando item to return '{randoStateManager.CurrentLocationToItemMapping[ruxxAmuletLocation]}'");

                EItems randoItem = randoStateManager.CurrentLocationToItemMapping[ruxxAmuletLocation].Item;

                if (EItems.TIME_SHARD.Equals(randoItem))
                {
                    /* Having a lot of problems with timeshards and the ruxxtin check due to it having some checks behind the scenes.
                     * What I am trying is to change the item to the NONE value since that is expected to have no quantity. This will trick the cutscene into playing correctly the first time.
                     * Checks after the first time rely on the collected items list so it shouldn't have any impact...
                     */
                    randoItem = EItems.NONE;
                }
                return(randoItem);
            }
            else
            {
                return(item);
            }
        }
Exemple #2
0
        /// <summary>
        /// Check through the mappings for any location that is represented by vanilla location item(since that is the key used to uniquely identify locations).
        /// </summary>
        /// <param name="vanillaLocationItem">EItem being used to look up location.</param>
        /// <param name="locationFromItem">Out parameter used to return the location found.</param>
        /// <returns>true if location was found, otherwise false(location item will be null in this case)</returns>
        public bool IsLocationRandomized(EItems vanillaLocationItem, out LocationRO locationFromItem)
        {
            bool isLocationRandomized = false;

            locationFromItem = null;

            //We'll check through notes first
            foreach (RandoItemRO note in RandomizerConstants.GetNotesList())
            {
                if (note.Item.Equals(vanillaLocationItem))
                {
                    locationFromItem = new LocationRO(note.Name);

                    if (CurrentLocationToItemMapping.ContainsKey(locationFromItem))
                    {
                        isLocationRandomized = true;
                    }
                    else
                    {
                        //Then we know for certain it was not randomized. No reason to continue.
                        locationFromItem = null;
                        return(false);
                    }
                }
            }

            //If it wasn't a note we'll look through the rest of the items
            if (!isLocationRandomized)
            {
                //Real quick, check Climbing Claws because it is special
                if (EItems.CLIMBING_CLAWS.Equals(vanillaLocationItem))
                {
                    locationFromItem = new LocationRO("Climbing_Claws");
                    return(true);
                }


                foreach (RandoItemRO item in RandomizerConstants.GetRandoItemList())
                {
                    if (item.Item.Equals(vanillaLocationItem))
                    {
                        locationFromItem = new LocationRO(item.Name);

                        if (CurrentLocationToItemMapping.ContainsKey(locationFromItem))
                        {
                            isLocationRandomized = true;
                        }
                        else
                        {
                            //Then we know for certain it was not randomized.
                            locationFromItem = null;
                            return(false);
                        }
                    }
                }
            }

            //Return whether we found it or not.
            return(isLocationRandomized);
        }
Exemple #3
0
        private void cboMaterial_SelectedIndexChanged(object sender, EventArgs e)
        {
            //cboMaterial.SelectedIndex = (int)currItem;
            switch (cboMaterial.SelectedIndex)
            {
            case 0:
                currItem = EItems.E_BOX;
                break;

            case 1:
                currItem = EItems.E_MAT;
                break;

            case 2:
                currItem = EItems.E_GAS;
                break;
            }
            this.UpdateChart();
        }
        public BaseItem(EItems _eType, float fConst)
        {
            if (_eType == EItems.E_BOX)
            {
                nMinPrice = 6;
                nFixPrice = 10;
                nMaxPrice = 16;
            }
            else if (_eType == EItems.E_MAT)
            {
                nMinPrice = 29;
                nFixPrice = 45;
                nMaxPrice = 74;
            }
            else if (_eType == EItems.E_GAS)
            {
                nMinPrice = 320;
                nFixPrice = 450;
                nMaxPrice = 680;
            }

            nCurrentPrice = (int)(nMinPrice + (nMaxPrice - nMinPrice) * fConst);
        }
Exemple #5
0
        /// <summary>
        /// The initial generation of the dictionary of dialog replacement based on the currently randomized item locations
        /// </summary>
        /// <returns>A Dictionary containing keys of locationdialogID and values of replacementdialogID</returns>
        ///
        public static Dictionary <string, string> GenerateDialogMappingforItems()
        {
            Dictionary <string, string>          dialogmap         = new Dictionary <string, string>();
            Dictionary <EItems, string>          itemToDialogIDMap = GetDialogIDtoItems();
            Dictionary <LocationRO, RandoItemRO> current           = RandomizerStateManager.Instance.CurrentLocationToItemMapping;

            /* OLD
             * foreach (KeyValuePair<LocationRO, RandoItemRO> KVP in current)
             * {
             *  Console.WriteLine($"Dialog mapping -- {KVP.Key.PrettyLocationName}");
             *  EItems LocationChecked = (EItems)Enum.Parse(typeof(EItems), KVP.Key.PrettyLocationName);
             *  RandoItemRO ItemActuallyFound = KVP.Value;
             *
             *  if (ItemtoDialogIDMap.ContainsKey(LocationChecked) && ItemtoDialogIDMap.ContainsKey(ItemActuallyFound.Item))
             *  {
             *      dialogmap.Add(ItemtoDialogIDMap[LocationChecked], ItemtoDialogIDMap[ItemActuallyFound.Item]);
             *      Console.WriteLine($"We mapped item dialog {ItemtoDialogIDMap[ItemActuallyFound.Item]} to the location {ItemtoDialogIDMap[LocationChecked]}");
             *  }
             * }
             */

            //I am gonna keep the mappings limited to basic locations since the advanced locations are handled by another process.
            foreach (LocationRO location in RandomizerConstants.GetRandoLocationList())
            {
                Console.WriteLine($"Dialog mapping -- {location.PrettyLocationName}");
                EItems      locationChecked   = (EItems)Enum.Parse(typeof(EItems), location.PrettyLocationName);
                RandoItemRO itemActuallyFound = current[location];

                if (itemToDialogIDMap.ContainsKey(locationChecked) && itemToDialogIDMap.ContainsKey(itemActuallyFound.Item))
                {
                    dialogmap.Add(itemToDialogIDMap[locationChecked], itemToDialogIDMap[itemActuallyFound.Item]);
                    Console.WriteLine($"We mapped item dialog {itemToDialogIDMap[itemActuallyFound.Item]} to the location {itemToDialogIDMap[locationChecked]}");
                }
            }

            return(dialogmap);
        }
Exemple #6
0
 // Mario
 public void UpdateItem(float _item)
 {
     m_eItem = (EItems)_item;
 }
        private void InventoryManagerOnAddItem(On.InventoryManager.orig_AddItem orig, InventoryManager self, EItems itemId, int quantity)
        {
            if (!_hcMode)
            {
                orig(self, itemId, quantity);
                return;
            }

            switch (itemId)
            {
            case EItems.BASIC_SCROLL:
                Manager <SkinManager> .Instance.EquipSkin(ESkin.DARK_MESSENGER);

                break;

            case EItems.TIME_SHARD:
                orig(self, itemId, 0);
                break;

            default:
                orig(self, itemId, quantity);
                break;
            }
        }
Exemple #8
0
        int InventoryManager_GetItemQuantity(On.InventoryManager.orig_GetItemQuantity orig, InventoryManager self, EItems item)
        {
            //Just doing some logging here
            if (EItems.NONE.Equals(item))
            {
                Console.WriteLine($"INVENTORYMANAGER_GETITEMQUANTITY CALLED! Let's learn some stuff. Item: '{item}' | Quantity of said item: '{orig(self, item)}'");
            }

            return(orig(self, item));
        }
Exemple #9
0
        void InventoryManager_AddItem(On.InventoryManager.orig_AddItem orig, InventoryManager self, EItems itemId, int quantity)
        {
            LocationRO randoItemCheck;

            if (itemId != EItems.TIME_SHARD) //killing the timeshard noise in the logs
            {
                Console.WriteLine($"Called InventoryManager_AddItem method. Looking to give x{quantity} amount of item '{itemId}'.");
            }

            //Wierd Ruxxtin logic stuff
            if (EItems.NONE.Equals(itemId))
            {
                Console.WriteLine("Looks like Ruxxtin has a timeshard.");
            }

            //Lets make sure that the item they are collecting is supposed to be randomized
            if (randoStateManager.IsRandomizedFile && !RandomizerStateManager.Instance.HasTempOverrideOnRandoItem(itemId) && randoStateManager.IsLocationRandomized(itemId, out randoItemCheck))
            {
                //Based on the item that is attempting to be added, determine what SHOULD be added instead
                RandoItemRO randoItemId = randoStateManager.CurrentLocationToItemMapping[randoItemCheck];
                Console.WriteLine($"Randomizer magic engage! Game wants item '{itemId}', giving it rando item '{randoItemId}' with a quantity of '{quantity}'");

                //If that item is the windmill shuriken, immediately activate it and the mod option
                if (EItems.WINDMILL_SHURIKEN.Equals(randoItemId.Item))
                {
                    OnToggleWindmillShuriken();
                }
                else if (EItems.TIME_SHARD.Equals(randoItemId.Item)) //Handle timeshards
                {
                    Manager <InventoryManager> .Instance.CollectTimeShard(quantity);

                    randoStateManager.GetSeedForFileSlot(randoStateManager.CurrentFileSlot).CollectedItems.Add(randoItemId);
                    return; //Collecting timeshards internally call add item so I dont need to do it again.
                }

                //Set the itemId to the new item
                itemId = randoItemId.Item;
                //Set this item to have been collected in the state manager
                randoStateManager.GetSeedForFileSlot(randoStateManager.CurrentFileSlot).CollectedItems.Add(randoItemId);

                //Save
                Save.seedData = randomizerSaveMethod.GenerateSaveData();
            }

            //Call original add with items
            orig(self, itemId, quantity);
        }
Exemple #10
0
 public bool HasTempOverrideOnRandoItem(EItems randoItem)
 {
     return(temporaryRandoOverrides.Contains(randoItem));
 }
Exemple #11
0
 public void RemoveTempRandoItemOverride(EItems randoItem)
 {
     temporaryRandoOverrides.Remove(randoItem);
 }
Exemple #12
0
 public void AddTempRandoItemOverride(EItems randoItem)
 {
     temporaryRandoOverrides.Add(randoItem);
 }
Exemple #13
0
 public void SetNoteCutsceneTriggered(EItems note)
 {
     this.noteCutsceneTriggerStates[note] = true;
 }
Exemple #14
0
 public bool IsNoteCutsceneTriggered(EItems note)
 {
     return(this.noteCutsceneTriggerStates[note]);
 }
 public RandoItemRO(string name, EItems item, int quantity = 1)
 {
     Name     = name;
     Item     = item;
     Quantity = quantity;
 }