Sign in to follow this  
Followers 0
marian001

Facebook - Mafia Wars - Automatic buying properties

4 posts in this topic

#1 ·  Posted (edited)

Hi all,

UPDATED (current version 4.8):

facebook_mafia_buy_properties.au3

WHAT IT DOES: (you can rearrange the functions to suit your needs, so the following is an algorithm that works for me)

- opens IE window with Mafia Wars (this can be switched to hidden mode)

-- if you're not logged into Facebook, it will log you in (don't forget to fill variables $email and $password) - Thanks to koldkaos

-- if you are in Cuba it will automatically fly you to NY

- reads current prices and hourly earnings for each property

- calculates current price per earning ratio for each property

- sorts properties from lowest to highest P/E

- reads your cash balance (not what you have in bank)

- attempts to make the best buy for the money you have

- continues with "reads current prices...." until you are out of money or no purchase can be done meeting criteria:

-- $minBuy - lot (amount of items in 1 purchase [1-10])

-- $PEmax - maximum price per earning ratio value

-- $maxRank - maximum allowed P/E ranking

- flies to Cuba

- sells all crates produced by your businesses and collects politico corrupto

- deposits all C$ to bank - currently doesn't work

- fights weakest opponent from opponents offered on Fight screen (if you win the fight and button Attack Again! is available, you will fight the same opponent again)

- executes selected job (on the screen displayed after clicking Jobs)

- accepts energy pack (if available and conditions met...) and sends energy pack to friends

- fights and does jobs again...

- closes IE and quits

- heals (if conditions are met) and fights again

- get gifts if available - doesn't work yet..

- flying between NY and Cuba fixed (since Transport button was introduced)

- UPDATE: as requested, I have added looping functionality, so you can enable looping ($loop = 1) and set loop delay ($loopDelay) in minutes; to stop the loop at any time and finalize the script with the summary, press Shift-Alt-L (the script will finalize after finishing current/next run); I didn't test this functionality, so let me know if there are some problems

PREREQUISITES:

- obviously, you have to have a Facebook account, have Mafia Wars application activated/installed, have some Mafia Wars (NY) money to spend, have businesses in Cuba

- define following variables:

-- $email - your Facebook login (will be needed only if you are not logged in by default)

-- $password - your Facebook password (will be needed only if you are not logged in by default)

-- $minBuy - lot (amount of NY properties in 1 purchase [1-10])

-- $PEmax - maximum price per earning ratio value (I recently stopped purchasing at 7000)

-- $maxRank - for item to be bought, it must placed among e.g. top 3 properties (based on P/E ratio ranking) [1-12]

-- $minEnergy - level of energy when to stop executing jobs (don't decrease below energy amount necessary to execute selected job!)

-- $minHealth - level of health when to stop fighting [20-...]

-- $minStamina - level of stamina at which healing is enabled [0-...]

-- $jobNum - job to execute (on screen displayed when you click 'Jobs') [1-n] (n is number of jobs available on selected screen)

-- $minExpDiff - minimum difference between current experience and exp. needed for next level at which you want to enable accepting energy pack

-- $loop = 0 ; loop the script execution: 0-off, 1-on

-- $loopDelay = 60 ; delay between runs (if looping is enabled) [minutes]

COMMENTS:

- there are still some things to fix (e.g. 'fight result unknown' happens from time to time - script should handle it, just let it work...) and some unfinished/WIP functions (e.g. playing lotto, helping friends, claiming rewards)

- watch the console - it tells you what's happening :-)

- I am sure it could have been coded more neatly, but I wasn't aiming to win a beauty contest with this code :-)

- script contains bunch of useless (commented) stuff which are remains of code development and debugging - feel free to clean it

- the shopping logic I used seems quite reasonable to me, but I will be glad to hear your ideas

- script is now built into functions, so you can play with the flow of the execution - see the script

- also any improvements are welcome

have fun :-)

Marian

www.marian001.com

p.s. oh yes... if you want to join my mafia, add me - http://www.facebook.com/profile.php?id=550...amp;ref=profile

p.s.2 I suppose next update will be necessary after Moscow is launched...

Edited by marian001

Share this post


Link to post
Share on other sites



Hi,

If you add:

CODE
$oLForm = _IEFormGetCollection($oIE,0)

$oEmail = _IEFormElementGetObjByName($oLForm, "email")

_IEFormElementSetValue($oEmail, $email)

$oPass = _IEFormElementGetObjByName($oLForm, "pass")

_IEFormElementSetValue($oPass, $pass)

_IEFormSubmit($oLForm)

Where $oIE is your Internet Explorer Object and $email and $pass are strings containing your email and password it will log onto facebook for you when on a login page.

Also i have a Property Calculate writen in Excel here http://everyrandom.com/blog/?p=37 which might be helpful.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I'd like to take a look at this, but the link in the original post is no longer valid. Is the file hosted somewhere else?

-edit- Nevermind, I just wasn't logged in...sorry about that.

Edited by SimianPirate

Share this post


Link to post
Share on other sites

Just to make number thingy easier add this code.

Add this somewhere at the top.

$mynum = "";Mafia Wars profile number.

Then do a replace:

Find What: 10979261223

Replace with: "&$mynum&"

I like the idea, ima start write this into objects so it can be used inn a dynamic matter :)


UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0