Skip to content

Commit 53d9694

Browse files
committedMar 8, 2011
added path_to_bot variable
1 parent 7824b6a commit 53d9694

21 files changed

+63
-29
lines changed
 

‎README.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@ Obviously.
2020

2121

2222
Starting the application:
23-
First thing's first. You must go through each of the python files(.py) and edit the import path at the top to wherever you have this folder located. I'm still trying to figure out a way to get the relative paths from Python.
23+
First thing's first. I'm still trying to figure out a way to get the relative paths from Python.
2424

25+
You must go through each of the python files(.py) and edit the import path at the top to wherever you have this folder located.
2526
*Technical
2627
With Sikuli, there are no sys.argv variables, so I am unable to get the relative path of the script file that way.
2728

29+
*IMPORTANT
30+
I have screencapture all the images while the Magic Online App was in it's default size. What this means is that you should not maximize the Magic Online or change it's size. I plan to add support for a maximized window in the future.
31+
2832
You should already be logged in to Magic Online. As soon as you are logged in, just start the bot and it will respond to a trade request.
2933
For testing purposes I have have turned off signin feature. This is so the user doesn't need to exit Magic Online everytime they have to restart the bot.
3034

35+
After a successful transaction, the bot will open Notepad and write the transaction.
36+
3137
I have created a convenient start.bat for those who are not especially experienced in programming. This file will start the Sikuli application, and all you have to do to start the application is click "Run".
3238

3339
Structure:
@@ -36,7 +42,7 @@ The view folder contains all the class definitions for interaction with the appl
3642
The model folder contains all classes that deal with storing or retrieving database information, like prices, images for pixel scans, transaction records, etc.
3743
The controller folder contains the MainController, which will coordinate the entire application.
3844

39-
In the main folder you will find the main app file. It instantiates the controller and starts everything.
45+
In the main folder you will find the main app file, "bot.sikuli". It instantiates the controller and starts everything.
4046

4147

4248

‎code.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@
55

66
#DEPENDENCIES
77
#used in controller to set time of transaction for recording
8+
path_to_bot = "c:/users/darkray16/desktop/my dropbox/mtgobot/"
9+
810
from datetime import datetime
911
import sys
10-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot")
12+
13+
path_to_bot = ""
14+
sys.path.append(path_to_bot)
15+
1116
import model
1217
import view
1318
import controller
1419

15-
exec(open("c:/users/darkray16/desktop/my dropbox/mtgo bot/ini.py", "rb").read())
20+
exec(open(path_to_bot "ini.py", "rb").read())
1621

1722
class Bot(object):
1823
#this is at the highest level and owns all other classes

‎controller/ErrorHandler.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
exec(open("c:/users/darkray16/desktop/my dropbox/mtgo bot/ini.py", "rb").read())
1+
path_to_bot = ""
2+
3+
exec(open(path_to_bot + "ini.py", "rb").read())
24

35
class ErrorHandler(Exception):
46
#custom Exception parent class to handle errors

‎controller/MainController$py.class

9 Bytes
Binary file not shown.

‎controller/MainController.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
exec(open("c:/users/darkray16/desktop/my dropbox/mtgo bot/ini.py", "rb").read())
1+
path_to_bot = ""
2+
3+
exec(open(path_to_bot + "ini.py", "rb").read())
24

35
import sys
4-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/model")
5-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/controller")
6-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
6+
sys.path.append(path_to_bot + "model")
7+
sys.path.append(path_to_bot + "controller")
8+
sys.path.append(path_to_bot + "view")
79
import ErrorHandler
810
import Session
911

@@ -73,7 +75,7 @@ def trade_mode(self, mode=None):
7375
#wait(2)
7476
#self.Itrade.giving_window_region.onChange(self.set_mode("sell"))
7577
if not mode:
76-
mode="buy"
78+
mode=settings["DEFAULTMODE"]
7779

7880
self.set_mode(mode=mode)
7981
#open a session to record data to

‎model/CardPricesDAL.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
path_to_bot = ""
2+
13
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/model")
4+
sys.path.append(path_to_bot + "model")
35
import ProductPriceModel
46

57
class CardPricesDAL(object):

‎model/CardsList.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/model")
3+
sys.path.append(path_to_bot + "model")
34
from List import *
45

56
class CardsList(List):

‎model/DataStorage.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sikuli.Sikuli
22

3+
34
class DataStorage(object):
45
#object that will handle exporting transaction history
56
#you must have the program that you want to send the transaction to, open
@@ -10,6 +11,9 @@ def __init__(self, program):
1011
self._program = program
1112

1213
def write(self, transaction):
14+
#write the transaction record to a text file
15+
transaction_file = open(
16+
1317
record_app = App("Notepad")
1418
if not record_app.window():
1519
App.open("Notepad"); wait(1)

‎model/PackPricesDAL.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/model")
3+
sys.path.append(path_to_bot + "model")
34
import ProductPriceModel
45

56

‎model/PacksList.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/model")
3+
sys.path.append(path_to_bot + "model")
34
from List import *
45

56
class PacksList(List):

‎model/ProductPriceModel.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#handles reading and writing to pricelist files
2+
path_to_bot = ""
23

34
from sys import *
45

@@ -8,19 +9,19 @@ def __init__(self):
89

910
self.pricelist_files = {}
1011
try:
11-
self.pricelist_files["packs_buy"] = open("c:/users/darkray16/desktop/my dropbox/mtgo bot/pricelist/packs/buy.txt", "r")
12+
self.pricelist_files["packs_buy"] = open(path_to_bot + "pricelist/packs/buy.txt", "r")
1213
except IOError:
1314
print("Pack buy price file not found at pricelist/packs/buy/")
1415
try:
15-
self.pricelist_files["packs_sell"] = open("c:/users/darkray16/desktop/my dropbox/mtgo bot/pricelist/packs/sell.txt", "r")
16+
self.pricelist_files["packs_sell"] = open(path_to_bot + "pricelist/packs/sell.txt", "r")
1617
except IOError:
1718
print("Pack sell price file not found at pricelist/packs/sell/")
1819
try:
19-
self.pricelist_files["cards_buy"] = open("c:/users/darkray16/desktop/my dropbox/mtgo bot/pricelist/cards/buy.txt", "r")
20+
self.pricelist_files["cards_buy"] = open(path_to_bot + "pricelist/cards/buy.txt", "r")
2021
except IOError:
2122
print("Card buy price file not found at pricelist/cards/buy/")
2223
try:
23-
self.pricelist_files["cards_sell"] = open("c:/users/darkray16/desktop/my dropbox/mtgo bot/pricelist/cards/sell.txt", "r")
24+
self.pricelist_files["cards_sell"] = open(path_to_bot + "pricelist/cards/sell.txt", "r")
2425
except IOError:
2526
print("Card sell price file not found at pricelist/cards/buy/")
2627

‎model/Session.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/model")
3+
sys.path.append(path_to_bot + "model")
34
import DataStorage
45

56
class Session(object):

‎transaction_records/transactions.txt

Whitespace-only changes.

‎view/FrontInterface.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
3+
sys.path.append(path_to_bot + "view")
34
import Interface
45
import ITrade
56
import ISell

‎view/IBuy.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
3+
sys.path.append(path_to_bot + "view")
34
import PackPricesDAL
45
import CardPricesDAL
56
import Product
67

7-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
8+
sys.path.append(path_to_bot + "view")
89
import ITrade
910
from sikuli.Sikuli import *
1011

‎view/IChat.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
3+
sys.path.append(path_to_bot + "view")
34
import Interface
45
from sikuli.Sikuli import *
56

‎view/IClassified.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
3+
sys.path.append(path_to_bot + "view")
34
import Interface
45
from sikuli.Sikuli import *
56

‎view/ISell.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
3+
sys.path.append(path_to_bot + "model")
34
import PackPricesDAL
45
import CardPricesDAL
56
import Product
67

7-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
8+
sys.path.append(path_to_bot + "view")
89
import ITrade
910
from sikuli.Sikuli import *
1011

‎view/ISignIn.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
3+
sys.path.append(path_to_bot + "view")
34
import Interface
45
from sikuli.Sikuli import *
56

‎view/ITrade.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/view")
3+
sys.path.append(path_to_bot + "view")
34

45
import Interface
56
import IChat

‎view/Interface.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
path_to_bot = ""
12
import sys
2-
sys.path.append("c:/users/darkray16/desktop/my dropbox/mtgo bot/model")
3+
sys.path.append(path_to_bot + "model")
34
import ImagesModel
45
from sikuli.Sikuli import *
56

0 commit comments

Comments
 (0)
Please sign in to comment.