Python AH Buyer / Seller / ffxiah.com scrubber

Applications/Tools written to make running DarkStar easier for the rest of us.
Lucious_Llama
Posts: 40
Joined: Mon Jul 28, 2014 5:22 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by Lucious_Llama » Sat Nov 07, 2015 3:22 pm

Using a mysql command is probably not the best way to do that. It would work for about 30 min's (the default restock time), after which the items would be restocked.

If you really wanted to do this, you are going to want to edit the file called items.csv, and set values to zero for some columns. You can do that with a text editor or excel.

1. Find the item you do not want to be bought or sold in the file

2. Set sell01 to 0 (to stop pydarkstar from selling singles)
3. Set sell12 to 0 (to stop pydarkstar from selling stacks)

or

4. Set stock01 to 0 (to make the number singles posted on the AH 0) # meaningless if sell01 = 0
5. Set stock12 to 0 (to make the number stacks posted on the AH 0) # meaningless if sell12 = 0

and

6. Set buy01 to 0 (to stop pydarkstar from buying singles)
7. Set buy12 to 0 (to stop pydarkstar from buying stacks)

I admit, this is somewhat of a daunting task, as there are 1000's of items. Not all items have a level associated with them either.
If the item does have a level, its not listed in that file either, as such information is not downloaded from the internet when the file is created.

Lastly,

You could in principle use a mysql command (like the one you mentioned) to get a list of itemid's, for item levels <= 75.
You could then set the above mentioned columns in items.csv to 0 for those items using python.
I am not sure of your scripting experience, so if that doesn't make sense just ignore it.

I hope this helps.

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by TeoTwawki » Sat Nov 07, 2015 5:11 pm

It is also possible to edit the flags column of item_basic to exclude items from even showing in the AH list, if the blank entries are a bother (even if not stocked, server will show them). I don't find that a prob myself but a few oldschool servers have decided to hide them from the list.

Interesting undocumented feature: things you can't even AH in retail will show up just fine in DSP's AH if the flags are set for it to happen. This means if some server felt like it they could stock rare/ex in there.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

kennxonline
Posts: 56
Joined: Sun Mar 23, 2014 2:58 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by kennxonline » Sat Nov 14, 2015 5:28 pm

I get this error when trying to run scrub.bat... can anyone help me with this please.

Code: Select all

Activating environment "C:\Anaconda2"...

[Anaconda2] C:\pydarkstar>cd C:\pydarkstar\bin

[Anaconda2] C:\pydarkstar\bin>scrub.bat

[Anaconda2] C:\pydarkstar\bin>usage: run.py [-h] [--verbose] [--silent] [--overw
rite] [--backup]
'usage:' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>[--urls [url [url ...]]] [--itemids [itemids [item
ids ...]]]
'[--urls' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>[--stock01 5] [--stock12 5]
'[--stock01' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>[stub]
'[stub]' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>Create item database.
'Create' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>positional arguments:
'positional' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>stub                  output file stub
'stub' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>optional arguments:
'optional' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>-h, --help            show this help message and e
xit
'-h' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>--verbose             report debug, info, and erro
r
'--verbose' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>--silent              report error only
'--silent' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>--overwrite           overwrite output file
'--overwrite' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>--backup              backup output file
'--backup' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>--urls [url [url ...]]
'--urls' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>a list of category urls
'a' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>--itemids [itemids [itemids ...]]
'--itemids' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>a list of item ids
'a' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>--stock01 5           default stock for singles
'--stock01' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>--stock12 5           default stock for stacks
'--stock12' is not recognized as an internal or external command,
operable program or batch file.

[Anaconda2] C:\pydarkstar\bin>

Lucious_Llama
Posts: 40
Joined: Mon Jul 28, 2014 5:22 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by Lucious_Llama » Sat Nov 14, 2015 6:36 pm

I have two guesses.

1. You are using the wrong terminal program (Anaconda command prompt). Instead you are going to want to use the Windows command prompt, like they describe here:

http://windows.microsoft.com/en-us/wind ... mpt-window

2. Something is wrong with the scrub.bat file. Post its contents for me to look at.

I hope that helps.

kennxonline
Posts: 56
Joined: Sun Mar 23, 2014 2:58 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by kennxonline » Sat Nov 14, 2015 7:06 pm

Lucious_Llama wrote:I have two guesses.

1. You are using the wrong terminal program (Anaconda command prompt). Instead you are going to want to use the Windows command prompt, like they describe here:

http://windows.microsoft.com/en-us/wind ... mpt-window

2. Something is wrong with the scrub.bat file. Post its contents for me to look at.

I hope that helps.
I had some errors while installing but I don't know how to fix them. Would you take a look at the errors maybe they make more since to you then me im lost.

Code: Select all

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Administrator>pip install sqlalchemy
Downloading/unpacking sqlalchemy
  Running setup.py (path:c:\users\admini~1\appdata\local\temp\pip_build_Administ
rator\sqlalchemy\setup.py) egg_info for package sqlalchemy

    warning: no files found matching '*.jpg' under directory 'doc'
    warning: no files found matching '*.mako' under directory 'doc'
    warning: no files found matching 'distribute_setup.py'
    warning: no files found matching 'sa2to3.py'
    warning: no files found matching 'ez_setup.py'
    no previously-included directories found matching 'doc\build\output'
Installing collected packages: sqlalchemy
  Running setup.py install for sqlalchemy
    building 'sqlalchemy.cprocessors' extension
    C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ fo
r Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\in
clude -IC:\Python27\PC /Tclib/sqlalchemy/cextension/processors.c /Fobuild\temp.w
in32-2.7\Release\lib/sqlalchemy/cextension/processors.obj
    processors.c
    C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ fo
r Python\9.0\VC\Bin\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\l
ibs /LIBPATH:C:\Python27\PCbuild /EXPORT:initcprocessors build\temp.win32-2.7\Re
lease\lib/sqlalchemy/cextension/processors.obj /OUT:build\lib.win32-2.7\sqlalche
my\cprocessors.pyd /IMPLIB:build\temp.win32-2.7\Release\lib/sqlalchemy/cextensio
n\cprocessors.lib /MANIFESTFILE:build\temp.win32-2.7\Release\lib/sqlalchemy/cext
ension\cprocessors.pyd.manifest
       Creating library build\temp.win32-2.7\Release\lib/sqlalchemy/cextension\c
processors.lib and object build\temp.win32-2.7\Release\lib/sqlalchemy/cextension
\cprocessors.exp
    building 'sqlalchemy.cresultproxy' extension
    C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ fo
r Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\in
clude -IC:\Python27\PC /Tclib/sqlalchemy/cextension/resultproxy.c /Fobuild\temp.
win32-2.7\Release\lib/sqlalchemy/cextension/resultproxy.obj
    resultproxy.c
    C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ fo
r Python\9.0\VC\Bin\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\l
ibs /LIBPATH:C:\Python27\PCbuild /EXPORT:initcresultproxy build\temp.win32-2.7\R
elease\lib/sqlalchemy/cextension/resultproxy.obj /OUT:build\lib.win32-2.7\sqlalc
hemy\cresultproxy.pyd /IMPLIB:build\temp.win32-2.7\Release\lib/sqlalchemy/cexten
sion\cresultproxy.lib /MANIFESTFILE:build\temp.win32-2.7\Release\lib/sqlalchemy/
cextension\cresultproxy.pyd.manifest
       Creating library build\temp.win32-2.7\Release\lib/sqlalchemy/cextension\c
resultproxy.lib and object build\temp.win32-2.7\Release\lib/sqlalchemy/cextensio
n\cresultproxy.exp
    building 'sqlalchemy.cutils' extension
    C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ fo
r Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\in
clude -IC:\Python27\PC /Tclib/sqlalchemy/cextension/utils.c /Fobuild\temp.win32-
2.7\Release\lib/sqlalchemy/cextension/utils.obj
    utils.c
    C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ fo
r Python\9.0\VC\Bin\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\l
ibs /LIBPATH:C:\Python27\PCbuild /EXPORT:initcutils build\temp.win32-2.7\Release
\lib/sqlalchemy/cextension/utils.obj /OUT:build\lib.win32-2.7\sqlalchemy\cutils.
pyd /IMPLIB:build\temp.win32-2.7\Release\lib/sqlalchemy/cextension\cutils.lib /M
ANIFESTFILE:build\temp.win32-2.7\Release\lib/sqlalchemy/cextension\cutils.pyd.ma
nifest
       Creating library build\temp.win32-2.7\Release\lib/sqlalchemy/cextension\c
utils.lib and object build\temp.win32-2.7\Release\lib/sqlalchemy/cextension\cuti
ls.exp

    warning: no files found matching '*.jpg' under directory 'doc'
    warning: no files found matching '*.mako' under directory 'doc'
    warning: no files found matching 'distribute_setup.py'
    warning: no files found matching 'sa2to3.py'
    warning: no files found matching 'ez_setup.py'
    no previously-included directories found matching 'doc\build\output'
Successfully installed sqlalchemy
Cleaning up...

C:\Users\Administrator>pip install pymysql
Downloading/unpacking pymysql
Installing collected packages: pymysql
Successfully installed pymysql
Cleaning up...

C:\Users\Administrator>pip install beautifulsoup4
Downloading/unpacking beautifulsoup4
Installing collected packages: beautifulsoup4
Successfully installed beautifulsoup4
Cleaning up...

C:\Users\Administrator>pip install pyyaml
Downloading/unpacking pyyaml
  Running setup.py (path:c:\users\admini~1\appdata\local\temp\pip_build_Administ
rator\pyyaml\setup.py) egg_info for package pyyaml

Installing collected packages: pyyaml
  Running setup.py install for pyyaml
    checking if libyaml is compilable
    C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ fo
r Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\in
clude -IC:\Python27\PC /Tcbuild\temp.win32-2.7\Release\check_libyaml.c /Fobuild\
temp.win32-2.7\Release\check_libyaml.obj
    check_libyaml.c
    build\temp.win32-2.7\Release\check_libyaml.c(2) : fatal error C1083: Cannot
open include file: 'yaml.h': No such file or directory

    libyaml is not found or a compiler error: forcing --without-libyaml
    (if libyaml is installed correctly, you may need to
     specify the option --include-dirs or uncomment and
     modify the parameter include_dirs in setup.cfg)

Successfully installed pyyaml
Cleaning up...

C:\Users\Administrator>

Lucious_Llama
Posts: 40
Joined: Mon Jul 28, 2014 5:22 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by Lucious_Llama » Sat Nov 14, 2015 7:16 pm

That all looks good actually. No errors.

I am curious of:

1. The contents of scrub.bat (open it with notepad or another text editor)

2. How did you install Python? Your first post suggests you used Anaconda (the recommended way), but this new post suggests otherwise, as I see you are using pip.

Thanks

kennxonline
Posts: 56
Joined: Sun Mar 23, 2014 2:58 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by kennxonline » Sat Nov 14, 2015 7:55 pm

I tried both ways because nothing is working. I get to the step to make the bin file and it doesn't do it. there is no scrub.bat unless I make one myself using a notepad and naming the file with .bat.

Lucious_Llama
Posts: 40
Joined: Mon Jul 28, 2014 5:22 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by Lucious_Llama » Sat Nov 14, 2015 7:59 pm

That should work (making it yourself) if this is what you put inside:

Code: Select all

ECHO OFF
set PYTHONPATH="%PYTHONPATH%;C:\pydarkstar"
python -m pydarkstar.apps.scrub.run %*
I think you pasted something else in there, like the help message from the website.

kennxonline
Posts: 56
Joined: Sun Mar 23, 2014 2:58 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by kennxonline » Sat Nov 14, 2015 8:16 pm

Lucious_Llama wrote:That should work (making it yourself) if this is what you put inside:

Code: Select all

ECHO OFF
set PYTHONPATH="%PYTHONPATH%;C:\pydarkstar"
python -m pydarkstar.apps.scrub.run %*
I think you pasted something else in there, like the help message from the website.
This is my bat file.

Code: Select all

ECHO OFF
set PYTHONPATH="%PYTHONPATH%;C:\pydarkstar"
python -m pydarkstar.apps.scrub.run %*

usage: run.py [-h] [--verbose] [--silent] [--overwrite] [--backup]
              [--urls [url [url ...]]] [--itemids [itemids [itemids ...]]]
              [--stock01 5] [--stock12 5]
              [stub]

Create item database.

positional arguments:
  stub                  output file stub

optional arguments:
  -h, --help            show this help message and exit
  --verbose             report debug, info, and error
  --silent              report error only
  --overwrite           overwrite output file
  --backup              backup output file
  --urls [url [url ...]]
                        a list of category urls
  --itemids [itemids [itemids ...]]
                        a list of item ids
  --stock01 5           default stock for singles
  --stock12 5           default stock for stacks

Lucious_Llama
Posts: 40
Joined: Mon Jul 28, 2014 5:22 pm

Re: Python AH Buyer / Seller / ffxiah.com scrubber

Post by Lucious_Llama » Sat Nov 14, 2015 9:29 pm

Yes, that is the wrong stuff to have in there (that's the output you would see if you ran the program with the --help flag).

Put in the text I posted above instead.

Post Reply