• Visit Rebornbuddy
  • Use Gadget - how?

    Discussion in 'Wildbuddy Support' started by daffy82, Nov 22, 2015.

    1. daffy82

      daffy82 Member

      Joined:
      Apr 29, 2014
      Messages:
      129
      Likes Received:
      1
      Trophy Points:
      16
      Im trying to get the bot to use gadget "Endosmose Grenade".
      I have edit'ed MyGadget.cs: But it dosnt cast it. Ideal for me would be that he used it when on 90% health in any fight

      Code:
      using System.Linq;
      using System.Threading.Tasks;
      
      using Buddy.Wildstar.Game;
      
      namespace Buddy.DefaultRoutine.Classes
      {
      	public class MyGadget : BaseCombatClass
      	{
      		private string GadgetAbility = "Endosmose Grenade"; //Name of the gadget used
      		private int GadgetType = 1; //-1 Gadget hasn't yet been scanned
      
      		//1 = Offensive Gadget
      		//2 = Defensive Gadget
      		//3 = CC break gadget
      		//4 = Focus recovery gadget
      
      
      		internal bool ScanGadget()
      		{
      			if (HasSpell("Power")) //Increases Assault Power
      			{
      				GadgetAbility = "Power";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Savagery")) //Increases Assault Power and next attack auto-crits
      			{
      				GadgetAbility = "Savagery";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Disabler")) //Increases PVP Power and chance to snare
      			{
      				GadgetAbility = "Disabler";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Shredder")) //Increases PVP Power and Armor Pierce
      			{
      				GadgetAbility = "Shredder";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Severity")) //Increases Critical Hit Severity
      			{
      				GadgetAbility = "Severity";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Cruelty")) //Increases Critical Hit Rating
      			{
      				GadgetAbility = "Cruelty";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Bloodscent")) //Increases Assault Power and Lifesteal
      			{
      				GadgetAbility = "Bloodscent";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Precision")) //Increases Strikethrough
      			{
      				GadgetAbility = "Precision";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Destruction")) //Deals technology damage to 5 foes
      			{
      				GadgetAbility = "Destruction";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Dissolve")) //Increases Armor Pierce
      			{
      				GadgetAbility = "Dissolve";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Wisdom")) //Increases Support Power
      			{
      				GadgetAbility = "Wisdom";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Intensity")) //Increases Support Power, and next heal auto-crits
      			{
      				GadgetAbility = "Intensity";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Erudite")) //Increases all primary stats
      			{
      				GadgetAbility = "Erudite";
      				GadgetType = 1;
      			}
      			else if (HasSpell("True Strike")) //Increases Strikethrough and PVP power
      			{
      				GadgetAbility = "True Strike";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Wings")) //Increases Movement speed
      			{
      				GadgetAbility = "Wings";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Break")) //Breaks Interrupt Armor from your target
      			{
      				GadgetAbility = "Break";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Powerup")) //Increases Support Power (Low level pvp gadget)
      			{
      				GadgetAbility = "Powerup";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Endosmose Grenade"))
      			{
      				GadgetAbility = "Endosmose Grenade";
      				GadgetType = 1;
      			}
      
      			//Defensive Gadgets
      			else if (HasSpell("Reserves")) //Restores Shield
      			{
      				GadgetAbility = "Reserves";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Rally")) //Heals self and allies, also increases outgoing and incoming healing
      			{
      				GadgetAbility = "Rally";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Heal")) //Heals self
      			{
      				GadgetAbility = "Heal";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Absorb")) //Grant Absorb to self
      			{
      				GadgetAbility = "Absorb";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Tenacity")) //Increases PVP Defense
      			{
      				GadgetAbility = "Tenacity";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Parry")) //Increases Deflect Rating
      			{
      				GadgetAbility = "Parry";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Buffer")) //Restores shield to self and allies
      			{
      				GadgetAbility = "Buffer";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Giant's Growth")) //Increases Maximum health
      			{
      				GadgetAbility = "Giant's Growth";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Encase")) //Increases Armor
      			{
      				GadgetAbility = "Encase";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Guard")) //Increases Armor and PVP Def
      			{
      				GadgetAbility = "Guard";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Dodger")) //Increases Deflect, Deflect Critical, and restores a dash token
      			{
      				GadgetAbility = "Dodger";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Juggernaut")) //Adds Interrupt Armor tokens
      			{
      				GadgetAbility = "Juggernaut";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Replenish")) //Heals self and allies
      			{
      				GadgetAbility = "Replenish";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Unbreakable")) //Grants Absorb and a Interrupt Armor
      			{
      				GadgetAbility = "Unbreakable";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Protection")) //Heals self and allies, and grants PVP Def
      			{
      				GadgetAbility = "Protection";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Salvation")) //Heals self and allies, and absorb
      			{
      				GadgetAbility = "Salvation";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Reinforce")) //Increases PVP Def and Increases Max HP
      			{
      				GadgetAbility = "Reinforce";
      				GadgetType = 2;
      			}
      
      			//CC Break Gadgets
      			else if (HasSpell("Break Free")) //Breaks free from CC and grants absorb
      			{
      				GadgetAbility = "Break Free";
      				GadgetType = 3;
      			}
      			else if (HasSpell("Barrier")) //Breaks free from CC and grants PVP Def
      			{
      				GadgetAbility = "Barrier";
      				GadgetType = 3;
      			}
      
      
      			//Focus Recovery Gadgets
      			else if (HasSpell("Second Wind")) //Recovers focus and PVP Def
      			{
      				GadgetAbility = "Second Wind";
      				GadgetType = 4;
      			}
      			else if (HasSpell("Recovery")) //Grants absorb and recovers focus
      			{
      				GadgetAbility = "Recovery";
      				GadgetType = 4;
      			}
      
      			else //No gadget equipped
      			{
      				GadgetAbility = "None";
      				GadgetType = 255;
      			}
      
      			DefaultRoutine.Log.Info("Gadget Ability '" + GadgetAbility + "' was found.");
      			return true;
      		}
      
      		internal override async Task<bool> Combat()
      		{
      			return false;
      		}
      
      
      		//Uses the Gadget ability with different conditions depending on the Gadget type.
      		//If the gadget hasn't already been scanned, this method will do that instead and save the name and type for future calls.
      		internal async Task<bool> UseGadget()
      		{
      			if (GadgetType == 1 && await SelfCast(GadgetAbility)) //Pops DPS gadgets on CD
      			{
      				return true;
      			}
      			if (GadgetType == 2 && Me.HealthPercent < 75 && await SelfCast(GadgetAbility)) //Health Remaining Constraint
      			{
      				return true;
      			}
      			if (GadgetType == 3 && Me.GetActiveCCs().Count > 0 && await SelfCast(GadgetAbility)) //CC'd Constraint	
      			{
      				return true;
      			}
      			//if (GadgetType == 4 && Me.FocusPercent < 75 && await SelfCast(Gadget))	//Focus Constraint
      			//	return true;		
      
      			if (GadgetAbility == "Invalid" || (!HasSpell(GadgetAbility) && GadgetAbility != "None") || (GadgetAbility == "None" && GadgetEquipped()))
      				//Checks if Gadget was previously scanned (if it wasn't then Gadget = "Invalid")
      			{
      				ScanGadget(); //Also checks if Gadget was changed. If either are true, performs a gadget scan.
      			}
      			//Finally checks if a Gadget has recently been equipped, if so also performs a scan.
      			return false;
      		}
      
      		public int GetType()
      		{
      			if (GadgetAbility == "Endosmose Grenade" || (!HasSpell(GadgetAbility) && GadgetAbility != "None") || (GadgetAbility == "None" && GadgetEquipped())) //Same Logic as the UseGadget Above
      			{
      				ScanGadget(); //Needed as logical comparisons will be used before determining
      			}
      			//Gadget ability activations. The ScanGadget() method needs to be activated
      			return GadgetType; //before any logical comparisons will properly function.
      		}
      
      		public bool GadgetEquipped()
      		{
      			InventoryItem item = GameManager.Inventory.Equipped.Items.FirstOrDefault(i => i.Info.TypeName == "Gadget");
      			return item != null && item.IsValid;
      		}
      	}
      }
       
    2. Deathdisguise

      Deathdisguise Community Developer

      Joined:
      Mar 7, 2015
      Messages:
      678
      Likes Received:
      6
      Trophy Points:
      0
      GadgetAbility needs to be the name of the spell itself, not the name of the item! Ensure you have the right name by typing this in the PEC:

      Log(SpellManager.GetMiscSpell(MiscSpellType.Gadget).Name)

      And after discovery, give Walter a poke so it can be added to the gadget class for everyone else. :)
       
    3. daffy82

      daffy82 Member

      Joined:
      Apr 29, 2014
      Messages:
      129
      Likes Received:
      1
      Trophy Points:
      16
      But when I type that in PEC it returns Endosmose Grenade.

      So it should work right? What am I doing wrong

      This is already in MyGadget.cs:

      Code:
      	else if (HasSpell("Endosmose Grenade"))
      			{
      				GadgetAbility = "Endosmose Grenade";
      				GadgetType = 1;
       
    4. Deathdisguise

      Deathdisguise Community Developer

      Joined:
      Mar 7, 2015
      Messages:
      678
      Likes Received:
      6
      Trophy Points:
      0
      It should work then! Post a log, please! :)
       
    5. daffy82

      daffy82 Member

      Joined:
      Apr 29, 2014
      Messages:
      129
      Likes Received:
      1
      Trophy Points:
      16
      Newest log in log folder

      http://justpaste.it/p5ps
       
    6. Deathdisguise

      Deathdisguise Community Developer

      Joined:
      Mar 7, 2015
      Messages:
      678
      Likes Received:
      6
      Trophy Points:
      0
      So a quick forum search has others' logs showing it as found, making me think this is a bug related to gadgets being changed. As a wild shot in the dark:

      1) Close the attached bot.
      2) Make sure the Gadget is equipped
      3) /reloadui in game.
      4) Attach a new bot.

      Changing gadgets mid-bot attach usually has unique results. :p
       
    7. daffy82

      daffy82 Member

      Joined:
      Apr 29, 2014
      Messages:
      129
      Likes Received:
      1
      Trophy Points:
      16
      That did not work unfortunately. Could it be something in warrior.cs? (i am a warrior)
       
    8. Deathdisguise

      Deathdisguise Community Developer

      Joined:
      Mar 7, 2015
      Messages:
      678
      Likes Received:
      6
      Trophy Points:
      0
      Not entirely sure! If you have Agility installed, run it for a few seconds and see if it uses the gadget! :D
       
    9. Apoc

      Apoc Moderator Staff Member Moderator

      Joined:
      Jan 16, 2010
      Messages:
      2,790
      Likes Received:
      94
      Trophy Points:
      48
      Unequip, and re-equip your gadget. Chances are it bugged out when you hit some loading screen. This is a bug in the game itself unfortunately.
       
    10. daffy82

      daffy82 Member

      Joined:
      Apr 29, 2014
      Messages:
      129
      Likes Received:
      1
      Trophy Points:
      16
      Tried and did not work.
      The Gadget Endosmose Grenade is very common. Everyone gets one from the Protostar sack at level 20 i think. Can someone post a working MyGadget.cs perhaps?

      Edit: This is what I did last
      Downloaded the newest RELEASE version with a fresh MyGadget.cs. Then I edit'ed that file and the only thing I added in there was the name "Endosmose Grenade" like so:

      Code:
      using System.Linq;
      using System.Threading.Tasks;
      
      using Buddy.Wildstar.Game;
      
      namespace Buddy.DefaultRoutine.Classes
      {
      	public class MyGadget : BaseCombatClass
      	{
      		private string GadgetAbility = "[B][COLOR="#FF0000"]Endosmose Grenade[/COLOR][/B]"; //Name of the gadget used
      		private int GadgetType = -1; //-1 Gadget hasn't yet been scanned
      
      		//1 = Offensive Gadget
      		//2 = Defensive Gadget
      		//3 = CC break gadget
      		//4 = Focus recovery gadget
      
      
      		internal bool ScanGadget()
      		{
      			if (HasSpell("Power")) //Increases Assault Power
      			{
      				GadgetAbility = "Power";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Savagery")) //Increases Assault Power and next attack auto-crits
      			{
      				GadgetAbility = "Savagery";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Disabler")) //Increases PVP Power and chance to snare
      			{
      				GadgetAbility = "Disabler";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Shredder")) //Increases PVP Power and Armor Pierce
      			{
      				GadgetAbility = "Shredder";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Severity")) //Increases Critical Hit Severity
      			{
      				GadgetAbility = "Severity";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Cruelty")) //Increases Critical Hit Rating
      			{
      				GadgetAbility = "Cruelty";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Bloodscent")) //Increases Assault Power and Lifesteal
      			{
      				GadgetAbility = "Bloodscent";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Precision")) //Increases Strikethrough
      			{
      				GadgetAbility = "Precision";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Destruction")) //Deals technology damage to 5 foes
      			{
      				GadgetAbility = "Destruction";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Dissolve")) //Increases Armor Pierce
      			{
      				GadgetAbility = "Dissolve";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Wisdom")) //Increases Support Power
      			{
      				GadgetAbility = "Wisdom";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Intensity")) //Increases Support Power, and next heal auto-crits
      			{
      				GadgetAbility = "Intensity";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Erudite")) //Increases all primary stats
      			{
      				GadgetAbility = "Erudite";
      				GadgetType = 1;
      			}
      			else if (HasSpell("True Strike")) //Increases Strikethrough and PVP power
      			{
      				GadgetAbility = "True Strike";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Wings")) //Increases Movement speed
      			{
      				GadgetAbility = "Wings";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Break")) //Breaks Interrupt Armor from your target
      			{
      				GadgetAbility = "Break";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Powerup")) //Increases Support Power (Low level pvp gadget)
      			{
      				GadgetAbility = "Powerup";
      				GadgetType = 1;
      			}
      			else if (HasSpell("Endosmose Grenade"))
      			{
      				GadgetAbility = "Endosmose Grenade";
      				GadgetType = 1;
      			}
      
      			//Defensive Gadgets
      			else if (HasSpell("Reserves")) //Restores Shield
      			{
      				GadgetAbility = "Reserves";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Rally")) //Heals self and allies, also increases outgoing and incoming healing
      			{
      				GadgetAbility = "Rally";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Heal")) //Heals self
      			{
      				GadgetAbility = "Heal";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Absorb")) //Grant Absorb to self
      			{
      				GadgetAbility = "Absorb";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Tenacity")) //Increases PVP Defense
      			{
      				GadgetAbility = "Tenacity";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Parry")) //Increases Deflect Rating
      			{
      				GadgetAbility = "Parry";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Buffer")) //Restores shield to self and allies
      			{
      				GadgetAbility = "Buffer";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Giant's Growth")) //Increases Maximum health
      			{
      				GadgetAbility = "Giant's Growth";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Encase")) //Increases Armor
      			{
      				GadgetAbility = "Encase";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Guard")) //Increases Armor and PVP Def
      			{
      				GadgetAbility = "Guard";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Dodger")) //Increases Deflect, Deflect Critical, and restores a dash token
      			{
      				GadgetAbility = "Dodger";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Juggernaut")) //Adds Interrupt Armor tokens
      			{
      				GadgetAbility = "Juggernaut";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Replenish")) //Heals self and allies
      			{
      				GadgetAbility = "Replenish";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Unbreakable")) //Grants Absorb and a Interrupt Armor
      			{
      				GadgetAbility = "Unbreakable";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Protection")) //Heals self and allies, and grants PVP Def
      			{
      				GadgetAbility = "Protection";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Salvation")) //Heals self and allies, and absorb
      			{
      				GadgetAbility = "Salvation";
      				GadgetType = 2;
      			}
      			else if (HasSpell("Reinforce")) //Increases PVP Def and Increases Max HP
      			{
      				GadgetAbility = "Reinforce";
      				GadgetType = 2;
      			}
      
      			//CC Break Gadgets
      			else if (HasSpell("Break Free")) //Breaks free from CC and grants absorb
      			{
      				GadgetAbility = "Break Free";
      				GadgetType = 3;
      			}
      			else if (HasSpell("Barrier")) //Breaks free from CC and grants PVP Def
      			{
      				GadgetAbility = "Barrier";
      				GadgetType = 3;
      			}
      
      
      			//Focus Recovery Gadgets
      			else if (HasSpell("Second Wind")) //Recovers focus and PVP Def
      			{
      				GadgetAbility = "Second Wind";
      				GadgetType = 4;
      			}
      			else if (HasSpell("Recovery")) //Grants absorb and recovers focus
      			{
      				GadgetAbility = "Recovery";
      				GadgetType = 4;
      			}
      
      			else //No gadget equipped
      			{
      				GadgetAbility = "None";
      				GadgetType = 255;
      			}
      
      			DefaultRoutine.Log.Info("Gadget Ability '" + GadgetAbility + "' was found.");
      			return true;
      		}
      
      		internal override async Task<bool> Combat()
      		{
      			return false;
      		}
      
      
      		//Uses the Gadget ability with different conditions depending on the Gadget type.
      		//If the gadget hasn't already been scanned, this method will do that instead and save the name and type for future calls.
      		internal async Task<bool> UseGadget()
      		{
      			if (GadgetType == 1 && await SelfCast(GadgetAbility)) //Pops DPS gadgets on CD
      			{
      				return true;
      			}
      			if (GadgetType == 2 && Me.HealthPercent < 75 && await SelfCast(GadgetAbility)) //Health Remaining Constraint
      			{
      				return true;
      			}
      			if (GadgetType == 3 && Me.GetActiveCCs().Count > 0 && await SelfCast(GadgetAbility)) //CC'd Constraint	
      			{
      				return true;
      			}
      			//if (GadgetType == 4 && Me.FocusPercent < 75 && await SelfCast(Gadget))	//Focus Constraint
      			//	return true;		
      
      			if (GadgetAbility == "Invalid" || (!HasSpell(GadgetAbility) && GadgetAbility != "None") || (GadgetAbility == "None" && GadgetEquipped()))
      				//Checks if Gadget was previously scanned (if it wasn't then Gadget = "Invalid")
      			{
      				ScanGadget(); //Also checks if Gadget was changed. If either are true, performs a gadget scan.
      			}
      			//Finally checks if a Gadget has recently been equipped, if so also performs a scan.
      			return false;
      		}
      
      		public int GetType()
      		{
      			if (GadgetAbility == "Invalid" || (!HasSpell(GadgetAbility) && GadgetAbility != "None") || (GadgetAbility == "None" && GadgetEquipped())) //Same Logic as the UseGadget Above
      			{
      				ScanGadget(); //Needed as logical comparisons will be used before determining
      			}
      			//Gadget ability activations. The ScanGadget() method needs to be activated
      			return GadgetType; //before any logical comparisons will properly function.
      		}
      
      		public bool GadgetEquipped()
      		{
      			InventoryItem item = GameManager.Inventory.Equipped.Items.FirstOrDefault(i => i.Info.TypeName == "Gadget");
      			return item != null && item.IsValid;
      		}
      	}
      }
       
      Last edited: Nov 23, 2015

    Share This Page