Beispiel #1
0
 protected override void OnRead(SQLiteDataReader reader)
 {
     Elements.Read();
     WeaponTypes.Read();
     ToolTypes.Read();
     ToolFormulas.Read();
 }
Beispiel #2
0
 protected override void OnInitializeNew()
 {
     Elements.Read();
     WeaponTypes.Read();
     ToolTypes.Read();
     ToolFormulas.Read();
 }
Beispiel #3
0
 protected override void OnUpdate(SQLiteConnection conn)
 {
     Elements.Update(conn);
     WeaponTypes.Update(conn);
     ToolTypes.Update(conn);
     ToolFormulas.Update(conn);
 }
Beispiel #4
0
 public override void ParameterizeAttributes()
 {
     Elements.ParameterizeAttributes();
     WeaponTypes.ParameterizeAttributes();
     ToolTypes.ValidateInputs();
     ToolFormulas.ParameterizeAttributes();
 }
        public static BaseToolkitTool GetTool(ToolTypes type)
        {
            if (_tools.ContainsKey(type))
                return _tools[type];

            BaseToolkitTool newTool;
            switch (type)
            {
                case ToolTypes.RomInfo:
                    newTool = new RomInfoTool();
                    break;
                case ToolTypes.HexEditor:
                    newTool = new HexEditorTool();
                    break;
                case ToolTypes.F3DEXViewer:
                    newTool = new F3DEXViewerTool();
                    break;
                case ToolTypes.ResourceViewer:
                    newTool = new ResourceViewTool();
                    break;
                case ToolTypes.LevelViewer:
                default: //To Do: add a default null tool
                    newTool = new LevelViewerTool();
                    break;
            }

            _tools.Add(type, newTool);

            return newTool;
        }
        public void TurnOn(ToolTypes tool)
        {
            TurnOffAll();
            foreach (var tgo in tools)
            {
                if (tgo == null)
                {
                    continue;
                }
                var toolBase = tgo.GetComponentInChildren <ToolBase>(true);
                if (toolBase == null)
                {
                    continue;
                }

                if (toolBase.tool == tool)
                {
                    toolBase.mystery = GameMgr.CurrentIsMystery();
                    activeTool       = toolBase;
                    tgo.SetActive(true);

                    if (ToolText.instance != null)
                    {
                        ToolText.instance.Log(tgo.name);
                    }
                    if (GuideText.instance != null)
                    {
                        GuideText.instance.ResetForTool(tgo);
                    }

                    break;
                }
            }
        }
Beispiel #7
0
 public Tool(string Name, string IconPath, string Description, string ID, ToolTypes type, float StaminaCost, bool IsSellable, UseFunc UseFunction = null, float BuyingPrice = 0, float SellingPrice = 0)
     : base(Name, IconPath, Description, ID, IsSellable, 0, BuyingPrice, SellingPrice)
 {
     Type             = type;
     this.UseFunction = UseFunction;
     this.StaminaCost = StaminaCost;
 }
Beispiel #8
0
    public Tool CheckForTool(ToolTypes toolType = ToolTypes.Axe, bool any = false)
    {
        Tool tool   = null;
        int  damage = 0;

        for (int i = 0; i < items.Count; i++)
        {
            if (!items[i])
            {
                continue;
            }
            Tool t = items[i].GetComponent <Tool>();
            if (t)
            {
                if (t.damage < damage)
                {
                    continue;
                }

                if (any)
                {
                    tool   = t;
                    damage = tool.damage;
                }
                else if (t.toolType == toolType)
                {
                    tool   = t;
                    damage = tool.damage;
                }
            }
        }
        return(tool);
    }
Beispiel #9
0
 public void OnInteract(ToolTypes toolType, GameObject gameObject = null, Action onSuccessful = null)
 {
     if (toolType == ToolTypes.Hoe)
     {
         RemoveSprinkler();
     }
 }
 public ToolInfoStruct(ToolList newId, ToolTypes newType, int newTier, int newDamage, Dictionary <ResourceList, int> newRecipe)
 {
     id     = newId;
     type   = newType;
     tier   = newTier;
     damage = newDamage;
     recipe = newRecipe;
 }
Beispiel #11
0
 public static ToolType?GetToolType(short itemId)
 {
     if (ToolTypes.ContainsKey(itemId))
     {
         return(ToolTypes[itemId]);
     }
     return(null);
 }
    public int           count; // setting default to 1 for testing purposes.

    public ResourceInfoStruct(ResourceList newId, ToolTypes newToolType, ResourceTypes newResourceType, int newResourceTier, int newDurability, int newCount)
    {
        id           = newId;
        toolType     = newToolType;
        resourceType = newResourceType;
        resourceTier = newResourceTier;
        durability   = newDurability;
        count        = newCount;
    }
Beispiel #13
0
        public override string ValidateInputs()
        {
            string err = Elements.ValidateInputs();

            err += WeaponTypes.ValidateInputs();
            err += ToolTypes.ValidateInputs();
            err += ToolFormulas.ValidateInputs();
            return(err);
        }
Beispiel #14
0
 private void Harvest(ToolTypes toolType)
 {
     if (plant != null)
     {
         plant.OnHarvest(toolType, () => plant = null);
         INodeData node = nodeGrid.GetNodeFromXY(X, Y);
         node.Data.IsOccupied = false;
     }
 }
Beispiel #15
0
 public tool(Dictionary <string, string> itemsDictionary, Dictionary <int, int> itemCompo)
 {
     name         = itemsDictionary["name"];
     itemID       = int.Parse(itemsDictionary["itemID"]);
     itemType     = (ItemTypes)System.Enum.Parse(typeof(baseItem.ItemTypes), itemsDictionary["itemType"]);
     durability   = int.Parse(itemsDictionary["durability"]);
     StatModifier = int.Parse(itemsDictionary["statModifier"]);
     toolType     = (ToolTypes)System.Enum.Parse(typeof(tool.ToolTypes), itemsDictionary["type"]);
     compo        = itemCompo;
 }
Beispiel #16
0
        protected override void SetupTableData()
        {
            List <string> columnNames = new List <string> {
                "Name"
            };

            Elements.Setup("", "TypesLists", "Elements", columnNames, 200);
            WeaponTypes.Setup("", "TypesLists", "Weapon Types", columnNames, 200);
            ToolTypes.Setup("", "TypesLists", "Tool Types", columnNames, 200);
            ToolFormulas.Setup("", "TypesLists", "Tool Formulas", columnNames, 200);
        }
    public void CraftItem(ToolTypes toolId, int amount)
    {
        int newValue = 0;

        inventory.tools.TryGetValue(toolId, out newValue);

        inventory.tools[toolId] = amount;
        string inventoryString = inventory.ToString();

        Debug.Log("new inventory: " + inventoryString);
    }
Beispiel #18
0
        public void OnInteract(ToolTypes toolType, GameObject gameObject, Action onSuccessful)
        {
            switch (toolType)
            {
            case ToolTypes.Hoe:
                Hoe();
                onSuccessful?.Invoke();
                break;

            case ToolTypes.WateringCan:
                Water();
                onSuccessful?.Invoke();
                break;

            case ToolTypes.Sickle:
                if (plant == null)
                {
                    return;
                }
                Harvest(ToolTypes.Sickle);
                onSuccessful?.Invoke();
                break;

            case ToolTypes.Axe:
                if (plant == null)
                {
                    return;
                }
                Harvest(ToolTypes.Axe);
                onSuccessful?.Invoke();
                break;

            case ToolTypes.Other:
                // check if the given gameObject contains a Planteable component
                if (data.Hoed && gameObject != null && gameObject.TryGetComponent <Plantable>(out _))
                {
                    // generate the Planteable GameObject
                    var obj = Instantiate(gameObject);
                    obj.transform.position = transform.position;

                    // initialize the Dirts Plant field and give it the same Id as this Dirt instance.
                    plant = obj.GetComponent <Plantable>();
                    plant.SetDataId(data.Id);
                    onSuccessful?.Invoke();
                }
                break;

            default:
                /*Debug.Log($"Do nothing with tooltype {toolType}");*/
                break;
            }
        }
Beispiel #19
0
 /// <summary>
 ///     Adds to the players inventory an amount within a
 ///     given range and destroys the Planteable gameObject.
 /// </summary>
 public virtual void OnHarvest(ToolTypes toolType, Action removePlantRef)
 {
     if (!CanHarvest)
     {
         return;
     }
     if (toolType == ToolTypes.Sickle)
     {
         DropItems(itemHarvested, minAmtToDrop, maxAmtToDrop);
         RemovePlant();
         removePlantRef?.Invoke();
     }
 }
Beispiel #20
0
        private void Update()
        {
            MoveToolToMouse();

            if (Input.GetMouseButtonDown(0))
            {
                INodeData node = nodeGrid.GetNodeFromMousePosition();
                if (node != null)
                {
                    nodeToToolOn = node;
                }
                ToolToUse = EquippedTool.ToolType;
            }
        }
Beispiel #21
0
 public void ChangeTool(ToolTypes target)     // For buttons
 {
     SelectedTool         = target;
     currentToolText.text = "Current tool:\n" + target.ToString();
     if (target == ToolTypes.Linking)
     {
         currentToolText.text += " [" + linkSource[0] + "," + linkSource[1] + "]";
     }
     else
     {
         linkSource = new int[] { -1, -1 }; // Reset link if changed during linking stage
     }
     Debug.Log("Current Tool: " + SelectedTool);
 }
Beispiel #22
0
        private void SwitchToolkitMode(ToolTypes type)
        {
            BaseToolkitTool newTool = ToolkitFactory.GetTool(type);

            if (_currentTool == newTool)
            {
                return;
            }

            if (_currentTool != null)
            {
                pnlCurrentTool.Controls.Remove(_currentTool.GetToolControl());
                _currentTool.DeActivate();
            }

            _currentTool = newTool;

            _currentTool.Activate();
            pnlCurrentTool.Controls.Add(_currentTool.GetToolControl());
        }
Beispiel #23
0
        public override void OnHarvest(ToolTypes toolType, Action removePlantRef)
        {
            switch (toolType)
            {
            case ToolTypes.Sickle:
                if (!CanHarvest)
                {
                    return;
                }

                DropItems(itemHarvested, minAmtToDrop, maxAmtToDrop);
                BackTrackGrowth();
                break;

            case ToolTypes.Axe:
                DropItems(logItem, minLogsToDrop, maxLogsToDrop);
                RemovePlant();
                removePlantRef?.Invoke();
                nodeData.Data.IsWalkable = true;
                break;
            }
        }
    public override string ToString()
    {
        string stringifiedInventory = "resources: { ";

        foreach (KeyValuePair <ResourceList, int> kvp in resources)
        {
            ResourceList resourceId = kvp.Key;
            int          count      = kvp.Value;
            stringifiedInventory += string.Format("{0}: {1}, ", resourceId, count);
        }
        stringifiedInventory += "}, tools: { ";

        foreach (KeyValuePair <ToolTypes, int> kvp in tools)
        {
            ToolTypes type  = kvp.Key;
            int       count = kvp.Value;
            stringifiedInventory += string.Format("{0}: {1}, ", type, count);
        }
        stringifiedInventory += "}";

        return(stringifiedInventory);
    }
Beispiel #25
0
    public void SetBrush(ToolTypes brushId)
    {
        isBrushTool = false;
        if ((ToolTypes)brushId == ToolTypes.Tube)
        {
            _currentTool = _tubeTool;
        }
        else if ((ToolTypes)brushId == ToolTypes.Ribbon)
        {
            _currentTool = _ribbonTool;
        }
        else if ((ToolTypes)brushId == ToolTypes.Triangle)
        {
            _currentTool = _triangleTool;
        }
        else if ((ToolTypes)brushId == ToolTypes.Brush)
        {
            _currentTool = _brushTool;
            isBrushTool  = true;
        }

        _isMidTriangle = false;
    }
Beispiel #26
0
        private void ToolSwitcher_Checked(object sender, RoutedEventArgs e)
        {
            var       radioButton = sender as RadioButton;
            ToolTypes toolType    = ToolTypes.Null;

            if (radioButton != null)
            {
                if (radioButton.Content.ToString() == "Tile placer")
                {
                    toolType = ToolTypes.TilePlacer;
                }
                else if (radioButton.Content.ToString() == "Tile selector")
                {
                    toolType = ToolTypes.TileSelector;
                }
                else if (radioButton.Content.ToString() == "Entities")
                {
                    toolType = ToolTypes.Entities;
                }
            }

            Global.ToolType = toolType;
        }
    // Use this for initialization
    void Start () {
        var toolType = ToolTypes.Scanner;
        switch (TypeName)
        {
            case ("Scanner"):
                toolType = ToolTypes.Scanner;
                break;

            case ("Process"):
                toolType = ToolTypes.Process;
                break;

            case ("Exploit"):
                toolType = ToolTypes.Exploit;
                break;

            case ("Utility"):
                toolType = ToolTypes.Utility;
                break;

            case ("Sniffer"):
                toolType = ToolTypes.Sniffer;
                break;

            case ("Spoofer"):
                toolType = ToolTypes.Spoofer;
                break;

            case ("Social"):
                toolType = ToolTypes.Phisher;
                break;

        }
        ToolType = toolType;

        ChangeSprite(Licenses > 0);
    }
        public static BaseToolkitTool GetTool(ToolTypes type)
        {
            if (_tools.ContainsKey(type))
            {
                return(_tools[type]);
            }

            BaseToolkitTool newTool;

            switch (type)
            {
            case ToolTypes.RomInfo:
                newTool = new RomInfoTool();
                break;

            case ToolTypes.HexEditor:
                newTool = new HexEditorTool();
                break;

            case ToolTypes.F3DEXViewer:
                newTool = new F3DEXViewerTool();
                break;

            case ToolTypes.ResourceViewer:
                newTool = new ResourceViewTool();
                break;

            case ToolTypes.LevelViewer:
            default:     //To Do: add a default null tool
                newTool = new LevelViewerTool();
                break;
            }

            _tools.Add(type, newTool);

            return(newTool);
        }
Beispiel #29
0
        private void ChooseAnimation(ToolTypes toolType)
        {
            switch (toolType)
            {
            case ToolTypes.Hoe:
                animator.SetTrigger("Hoe");
                break;

            case ToolTypes.WateringCan:
                animator.SetTrigger("Water");
                break;

            case ToolTypes.Sickle:
                animator.SetTrigger("Sickle");
                break;

            case ToolTypes.Axe:
                animator.SetTrigger("Axe");
                break;

            default:
                break;
            }
        }
Beispiel #30
0
 public Tool(ToolTypes name, bool HTTPSConfiguration)
 {
     this.name = name.ToString();
     WithHTTPSConfiguration = false;
     Init();
 }
Beispiel #31
0
        //Initialize must at least be called once when the program starts
        //but may be called more than once in the case where the file path is changed
        //for example, when it fails the first time, let the user locate the license file...
        public virtual bool Initialize(ToolTypes tool, string dataPathRoot = "")
        {
            m_errorMsg = "";
            ToolType = tool;

            //special case: only let the LicenseGen child class identify itself as a generator
            if (tool == ToolTypes.LicenseGenerator)
            {
                Assembly caller = Assembly.GetCallingAssembly();
                string callerName = caller.FullName;
                if (!m_allowGenerator || !caller.FullName.Contains(m_licGenAssbyName))
                {
                    m_errorMsg = "Illegal tool type: LicenseGenerator";
                    m_initFlag = false;
                    return false;
                }
            }

            if (dataPathRoot.Length > 0)
            {
                m_dataPathRoot = dataPathRoot;
                if (!m_dataPathRoot.EndsWith("\\")) m_dataPathRoot += "\\";
            }
            else
            {
                m_dataPathRoot = DataPath.Instance.Root;
            }
            //Validate that an external license file exists and is not expired
            m_licenseFilename = m_dataPathRoot + m_licenseName;
            if (!LoadLicenseFile())
            {
                //error message set in LoadLicenseFile()
                m_initFlag = false;
                return false;
            }

            //Then confirm external extivation
            m_initFlag = ConfirmActivation();

            return m_initFlag;
        }
 /// <summary>
 /// Konstruktor
 /// </summary>
 public ToolTableItem(string name, ToolTypes toolType) : this()
 {
     _name    = name;
     ToolType = toolType;
 }
Beispiel #33
0
        private bool IsToolAllowed(LicenseInfo Client, ToolTypes tool)
        {
            if (tool == ToolTypes.LicenseGenerator) return true;

            byte thisTool = (byte)(Math.Pow(2, (int)tool));
            return (thisTool & Client.toolFlags) > 0;
        }
Beispiel #34
0
 public Tool(string Name, string IconPath, string Discription, int ID, ToolTypes type, float Price = 0)
     : base(Name, IconPath, Discription, ID, Price)
 {
     Type = type;
 }
Beispiel #35
0
    private  void IncreaseToolLicensesForPlayer(GameObject player, ToolTypes toolType, int v)
    {
        var ToolTemplates = new List<GameObject> (GameObject.FindGameObjectsWithTag("ToolTemplate"));
        var toolTemplateObject = ToolTemplates.Find(x => x.GetComponent<ToolTemplateBehaviour>().ToolType == toolType);
        var scriptToolTemplate = toolTemplateObject.GetComponent<ToolTemplateBehaviour>();

        scriptToolTemplate.Licenses += v;
        
        if (scriptToolTemplate.Licenses <= 0)
        {
            ChangeToolTemplateSprite(toolTemplateObject, false);
        }
        else
        {
            ChangeToolTemplateSprite(toolTemplateObject, true);
        }
    }
Beispiel #36
0
 internal void SetDefaultValues(ToolTypes toolType)
 {
     var playerScript = GC.Instance.ScriptPlayer;
     ToolType = toolType;
     ChangeSprite(true);
 }
Beispiel #37
0
        private void SwitchToolkitMode(ToolTypes type)
        {
            BaseToolkitTool newTool = ToolkitFactory.GetTool(type);

            if (_currentTool == newTool)
                return;

            if (_currentTool != null)
            {
                pnlCurrentTool.Controls.Remove(_currentTool.GetToolControl());
                _currentTool.DeActivate();
            }

            _currentTool = newTool;

            _currentTool.Activate();
            pnlCurrentTool.Controls.Add(_currentTool.GetToolControl());
        }