Jump to content

Casting Reanimation spells on arceuus spell book


roguehippo

Recommended Posts

private void castReanimateSpell(MagicSpell spellToCast) throws InterruptedException
	{
		ArrayList<RS2Widget> allWidgets= new ArrayList<RS2Widget>();
		allWidgets.addAll(widgets.getAll());
		
		String spellNameFixer = spellToCast.toString();
		//the string starts out all caps. we want only first letter of each word to be caps.
		spellNameFixer = spellNameFixer.toLowerCase();
		//now we replace the underscore with a space
		spellNameFixer = spellNameFixer.replace('_', ' ');
		String[] storageArray = spellNameFixer.split(" ");
		String finalName = "";
		//build the final string out of the string array. while capatalizing the first
		// letter of each word
		for(String s : storageArray)
		{
			char temp = s.charAt(0);
			temp = Character.toUpperCase(temp);
			s = Character.toString(temp) + s.substring(1);
			finalName = finalName + s + " ";
			
		}
		//remove the last white space.
		//for some reason all the widget names start with this sequence.
		String temp = finalName.trim();
		finalName = "<col=00ff00>" + temp;
		
		//log("looking for spell " + finalName);
		if(magic.canCast(spellToCast))
		{
			//log("we can cast the spell");
			if(getTabs().getOpen() != Tab.MAGIC)
			{
				log("opening magic tab");
				getTabs().open(Tab.MAGIC);
				sleep(random(400,600));
			}
			ArrayList<RS2Widget> spellWidgetList = new ArrayList<RS2Widget>();
			spellWidgetList.addAll( widgets.getAll());
			
			for(RS2Widget rw : allWidgets)
			{
				if(rw != null && rw.isVisible() && rw.getSpellName().length() > 1)
				{
					if(rw.getSpellName().equals(finalName))
					{
						//log("selecting spell: " + finalName);
						rw.interact("Reanimate");
						sleep(random(50,80));
						break;
					}
					sleep(random(10,20));
				}
				
			}
		}
	}

hey guys, i noticed that it wasn't really possible to use the current cast spell function with the reanimation spells in the arceuus spell book so i made a function that would select the spell. please let me know if this helps, if my code is disgusting , or if its already been done and i just haven't found it yet. thanks! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...