Esempio n. 1
0
    public void Add(List <string> args)
    {
        var weaponName    = args[0];
        var index         = int.Parse(args[1]);
        var gemArguments  = args[2];
        Gem gem           = gemFactory.Create(gemArguments);
        var currentWeapon = weapons.FirstOrDefault(w => w.Name == weaponName);

        currentWeapon.AddGem(index, gem);
    }
    public override void Execute(string[] args)
    {
        string weaponName  = args[0];
        int    socketIndex = int.Parse(args[1]);

        string[] gemType = args[2].Split();
        IClarity clarity = clarityFactory.Create(gemType[0]);
        IGem     gem     = gemFactory.Create(clarity, gemType[1]);

        Weapons[weaponName].AddGem(socketIndex, gem);
    }
 public void AddGem(string weaponName, int index, string gemName)
 {
     string[] parts = gemName.Split(' ', StringSplitOptions.RemoveEmptyEntries);
     if (weapons.Any(x => x.Name == weaponName))
     {
         try
         {
             int indexOfWeapon = weapons.FindIndex(x => x.Name == weaponName);
             weapons[indexOfWeapon].Sockets[index] = gemFactory.Create(parts[0], parts[1]);
         }
         catch { }
     }
 }
    public void Add(string[] tokens)
    {
        var weaponName   = tokens[0];
        var socketIndex  = int.Parse(tokens[1]);
        var gemTokens    = tokens[2].Split();
        var levelClarity = gemTokens[0];
        var typeGem      = gemTokens[1];

        var gem    = gemFactory.Create(typeGem, levelClarity);
        var weapon = this.GetWeapon(weaponName);

        weapon.AddNewGem(socketIndex, gem);
    }