Facebook MobWars Helper

By Piotr P. Karwasz Last update Dec 23, 2008 — Installed 91,001 times.

Ultimate Fix: Drop items, jobs preps, etc. (*** UPDATED November 24, 2008 ***)

in
Subscribe to Ultimate Fix: Drop items, jobs preps, etc. (*** UPDATED November 24, 2008 ***) 18 posts, 10 voices



Pea Cracker Scriptwright

*** UPDATED November 24, 2008 ***

First head to the Itemlist.prototype.updateData = function() section...

Step #1, change the line:

item = new Prepitem();

into:
if (Utils.getElementsByXPath('.//a[contains(@href,"item")]/following-sibling::span', div)[0].innerHTML.match(/\%/)) continue; else item = new Prepitem();

Step #2, just a few more lines after Step #1, you should see:

result = str.match(/Energy: (\d+).*\(\+(\d+)\)/);

replace it with the following 2 lines:
inventory[item_id]=parseInt(div.parentNode.parentNode.parentNode.nextSibling.nextSibling.nextSibling.nextSibling.innerHTML.replace(/\n/g,'').match(/Owned: (\d+)/)[1]);
GM_setValue('inventory', inventory.toSource());
result = (div.parentNode.parentNode.parentNode.nextSibling.nextSibling.innerHTML.replace(/\n/g,'')+str).match(/Energy: (\d+).*\(\+(\d+)\)/);

Then head to the function datadisplay_getUpgrade(selection, type) section...

Step #3, about 35 lines down from the start of this section, marked under /* select best weapon */ replace the line:

if (itemlist[item].type != 'stockpile' || itemlist[item].stocktype != types[i]) continue;

into:

if (itemlist[item].type != 'stockpile' || itemlist[item].stocktype != types[i] || itemlist[item].price == 0) continue;

Step #4, right under the function jobs_needPrepJob(jobs, jobid) section, find the line:

for (var item in jobs[jobid].prep_items) {

insert this line after it:
if (!inventory[item]) inventory[item] = 0;

Step #5, find the function Boss(), and change the line:

this.actions = {"boss_type":{"page":"profile", "url_params":"user_id=" + Page.c_user, "message":"Checking name and type of your boss", "time":0}, "boss_attack":{"page":"boss", "message":"Checking attack parameters of your boss", "time":0}};

into:
this.actions = {
"boss_type":{"page":"profile", "url_params":"user_id=" + Page.c_user, "message":"Checking name and type of your boss", "time":0},
"boss_attack":{"page":"boss", "message":"Checking attack parameters of your boss", "time":0},
"jobs_check":{"page":"jobs", "message":"Checking the jobs", "time":0},
"bank_check":{"page":"bank", "message":"Checking the bank", "time":0},
"city_check":{"page":"city", "message":"Checking the city", "time":0},
"stockpile_check":{"page":"stockpile", "message":"Checking the stockile", "time":0}};

My script modifications are aimed to calculate the values and count inventory correctly to make the program as useful as intended without breaking, and to avoid getting bad suggestions on what to acquire in the stockpile... I'm still doing further testing with these changes. Please feel free to test it out and make suggestions, thank you.

 
alala Scriptwright

You'll want to make sure that the regex in the energy_str.match function reads /Energy: (\d+)/ (non-breaking space HTML entity after the colon), or the match will fail.

Should the script be able to do the job prep for specific jobs with this code? I haven't examined the rest of the script's logic to see how it figures out what the job prep requirement is and that it should go ahead and do it.

 
TheDruidsKeeper Scriptwright

my second comment in http://userscripts.org/topics/18023 fixes the auto preping problem if anyone is interested.

 
Chrisos User

I'll integrate that and let you know how it turns out.

 
Keleas User

For some reason, when i made those changes, my script stopped working completely. Doesn't even show up.

 
mrwizard96 User

I just made the changes you outlined and it seems to be working we will see in a couple of hours if it will do my drug smuggling by air without thinking it needs more safe houses (I have 28) :)

 
alala Scriptwright

@mohamedrm, make sure the regex portion for the energy_str.match contains the non-breaking space HTML entity ( )

 
alala Scriptwright

I find that the script can't remember that it has a prep item when it's not on the jobs page. For example, if I want to do "Illegal Weapons Smuggling", I need to do "Acquire Illegal Weapons" first. Ok so far.

The script will see I don't have an Illegal Weapons Cache and start the Prep Job (10 energy). Once the Prep Job is done, it will correctly try to do Illegal Weapons Smuggling, but if I navigate away from the jobs page, the script will forget that I have the cache.

If I have more than 10 energy, the required amount for the Prep Job, it will move me to the Jobs page to acquire a cache, even if I have one already. Once it hits the jobs page, it notices that I *do* have a cache, but once I move off the jobs page, it forgets again and constantly returns me there.

 
Pea Cracker Scriptwright

You're right Alala... it's fixed now. Check top post again.

 
alala Scriptwright

I'm into "light" modding; I made it so the script says ROI instead of ROR (for some reason, that was bugging me), and made it so that the number of city items you can sell is equal to the recommended number you should buy, so that I don't accidentally sell one parcel of land when I want to sell 10 (I land bank).

 
Pea Cracker Scriptwright

OK I've combined all my efforts thus far... check out the new post:

http://userscripts.org/topics/18250

 
justbeez User

One thing I noticed on this is that when I try to set the script to automatically run "Illegal Weapons Smuggling" it gives me the following error: "You can not perform the job 'Illegal Weapons Smuggling'."

Any ideas on this?

 
Keleas User

@justbeez

Do you have the 10 tactical shotguns?

I've used TheDruidsKeeper's fixes and this job runs pretty smoothly for me.

 
justbeez User

Nevermind -- Pea's final version of the script doesn't have this issue.

Thanks for the great update PC; I appreciate this all working again!

 
Pea Cracker Scriptwright

I'm glad it works for you, my character isn't high enough for me to test out more... so you're actually helping me out. Please let me know if anything breaks, thanks.

The script is set to handle routed jobs based on prep items, but as for required items that are usually just purchased at stockpile, it was a manual thing. However, I haven't checked at the required items that are actually drop items, such as the Tactical Shotgun being mentioned. I will check on it as soon as I get that job in my list.

 
hotc25 User

pea sorry that link you put up doesn't work is there link to the new script with your changes

thanks

 
plaguez User

Pea Cracker, can you repost your link, it doesn't work.

 
ThePCMan User

Guys, Please read the Apologies topic for your answer

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel