public void AddGem(IGem gem, string weaponName, int socket)
 {
     if (this.weapons.ContainsKey(weaponName))
     {
         IWeapon weapon = this.weapons[weaponName];
         weapon.AddGemToSocket(socket, gem);
     }
 }
Example #2
0
        public override void Execute()
        {
            string weaponName  = this.args[1];
            int    socketIndex = int.Parse(this.args[2]);

            string[] gemArgs    = this.args[3].Split();
            string   gemClarity = gemArgs[0];
            string   gemType    = gemArgs[1];

            IGem    currentGem    = GemFactory.GenerateGem(gemType, gemClarity);
            IWeapon currentWeapon = this.weapons.FirstOrDefault(w => w.Name.Equals(weaponName));

            if (!Validator.IsNull(currentWeapon))
            {
                currentWeapon.AddGemToSocket(socketIndex, currentGem);
            }
            else
            {
                throw new ArgumentException("Weapon not found.");
            }
        }