Ejemplo n.º 1
0
    //Check to see if there's extraData and if so, we do stuff
    bool ExtraVariablesLookUp(VIDE_Data.NodeData data, bool PreCall)
    {
        //Don't conduct extra variable actions if we are waiting on a paused action
        if (data.pausedAction)
        {
            return(false);
        }

        if (!data.currentIsPlayer) //For player nodes
        {
            //Check for extra variables
            //This one finds a key named "item" which has the value of the item thats gonna be given
            //If there's an 'item' key, then we will assume there's also an 'itemLine' key and use it
            if (PreCall) //Checks that happen right before calling the next node
            {
                if (data.extraVars.ContainsKey("item") && !data.dirty)
                {
                    if (data.npcCommentIndex == (int)data.extraVars["itemLine"])
                    {
                        if (data.extraVars.ContainsKey("item++"))                 //If we have this key, we use it to increment the value of 'item' by 'item++'
                        {
                            Dictionary <string, object> newVars = data.extraVars; //Clone the current extraVars content
                            int newItem = (int)newVars["item"];                   //Retrieve the value we want to change
                            newItem        += (int)data.extraVars["item++"];      //Change it as we desire
                            newVars["item"] = newItem;                            //Set it back
                            VIDE_Data.UpdateExtraVariables(25, newVars);          //Send newVars through UpdateExtraVariable method
                        }

                        //If it's CrazyCap, check his stock before continuing
                        //If out of stock, change override start node
                        if (VIDE_Data.assigned.alias == "CrazyCap")
                        {
                            if ((int)data.extraVars["item"] + 1 >= example_Items.Count)
                            {
                                VIDE_Data.assigned.overrideStartNode = 28;
                            }
                        }


                        if (!example_ItemInventory.Contains(example_Items[(int)data.extraVars["item"]]))
                        {
                            GiveItem((int)data.extraVars["item"]);
                            return(true);
                        }
                    }
                }
            }

            if (data.extraVars.ContainsKey("nameLookUp"))
            {
                nameLookUp(data);
            }
        }
        else   //for NPC nodes
        {
            //Nothing here yet ¯\_(ツ)_/¯
        }
        return(false);
    }