-
-
Save Nonickn/8780248 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pdl-idler (0.85) README | |
DESCRIPTION | |
----------- | |
pdl-idler will install, update, and run multiple instances of steam and tf2 | |
game clients in individual wine prefixes for the purpose of textmode idling. | |
As many considerations as possible are made to reduce cpu load and memory | |
consumption, while still permitting the use of a gui client. All downloaded | |
data is shared between account prefixes, and a special dedicated idle server | |
for item farming is started that parks clients in the connection state, | |
(thereby not loading the map) so they can run at one frame per second and be | |
allowed a low-memory mode. These farm clients will be sent to separate game | |
and Xvfb display servers, so that an input helper script can accept item | |
notifications unobstructed. Finally, status and backpack actions, utilities, | |
and wrappers around community functions are provided. | |
REQUIREMENTS | |
------------ | |
bash, bc, glxinfo, netcat, screen, sudo, wget, wine >= 1.7.8, xvfb and xdotool | |
are required. x11vnc is optionally used when the script has to start the main | |
X server or the farming Xvfb server. | |
INSTALLATION | |
------------ | |
Download the tarball from 'https://gist.github.com/primarydataloop/1432762', | |
extract its contents to a location such as '~/pdl-idler'. The script will | |
update itself from the gist site in the future. On the first invocation of | |
pdl-idler, you will be asked for your sudo password so that the script can | |
alter '/etc/sudoers.conf' and allow the user to run select commands as root | |
without a password. On Debian systems, the file '/etc/X11/Xwrapper.config' | |
will also be corrected so that the user can start X servers. | |
USAGE | |
----- | |
bash pdl-idler.sh ACTION1{,/%}ACTION2=arg^x\;y... {acct1 acct2/pass#email ...} | |
pdl-idler accepts a list of actions to perform (separated by ',' or '%' ) and | |
the specified account usernames (separated by spaces). If no accounts are | |
specified, then all known accounts will be specified. Actions grouped with the | |
'%' character will all execute before proceeding to the next account, instead | |
of having each action execute on all accounts. To supply optional parameters, | |
append an action with the '=' character followed by an argument string in | |
which all spaces are referenced by the '^' character, and semicolons are | |
escaped with a '\'. | |
The following are the available actions with optional parameters in brackets. | |
[ install ] | |
If not already running, the X server will be started (followed by x11vnc if | |
it is installed), then a separate wineprefix for the account will be created | |
or updated. If necessary, the steam launcher will be installed, data links | |
and directories will be created, and some configuration will be prepped. | |
[ login{=mode} ] | |
If the wineprefix does not exist and there is no credential backup, the user | |
will be prompted before the install action is performed. If a passowrd and | |
e-mail address suffix an account target, then steam will be prepped for an | |
account creation. Upon initial login of an account, the user may have to | |
input the password (if it does not suffix an account target) and/or a guard | |
code. If there was no credential backup at time of install, steam will be | |
restarted so the configuration can be applied. The user may supply the 'low' | |
mode flag to launch steam in low-resource mode without html/trade support, | |
or 'high' to include support for the in-game overlay, the uploading of cloud | |
screenshots, and high graphics/client settings. The 'hide' flag can also be | |
added to neglect explorer.exe, hiding the system tray icon. (def: "") | |
[ create ] | |
After the user is prompted for a password and an e-mail address, steam be | |
will be prepped for account creation, and a login will start. When the | |
greeting window arrives the account form fields will be automatically filled | |
and submitted, the account will be created, then the login will proceed. | |
[ online ] | |
If logged in, sign on to steam friends. | |
[ offline ] | |
If online, sign off steam friends. | |
[ enter{=id} ] | |
Mark the current friends status, then go online and join a public chatroom | |
via its community id. (def: "103582791432273268") | |
[ exit ] | |
Leave the chatroom and restore prior friends status. | |
[ friend{=accounts} ] | |
Perform or queue friend invite request/acceptances for each account defined | |
in the action parameter (where multiple accounts are separated by a '-') or | |
for all accounts that were targeted on invocation. (def: target accounts) | |
[ play{=mode} ] | |
Login if necessary, then start the client in gui mode. Once there is a | |
client of any type running, power management will be disabled. (def: "") | |
[ start{=mode} ] | |
Login if necessary, then start the client in textmode. (def: "") | |
[ command{=cmd} ] | |
If the client is running, execute console commands as supplied from the | |
action parameter or prompt. (def: prompts) | |
[ connect{=place} ] | |
If the client isn't running, start it in textmode, then connect to a server | |
via the ip address or host a listen server via the specified map name. If | |
there is no parameter specified (or if the server cannot be pinged), a | |
dedicated idle server will be started and will connect to an IRC server, the | |
client will lower its fps, then will connect to it. If connecting to a | |
normal server, low-resource clients will restart in normal mode. | |
(def: use idle server) | |
[ farm ] | |
Logout of a normal session, start a dedicated server and a separate X server | |
on the next display (if needed), then login with the 'low-hide' login flags | |
on the separate display. If not running, start the client in low-resource, | |
soundless noshaderapi mode, then connect. If this is the initial farm client | |
load, an input helper script will be started that is used to automatically | |
accept drop notifications. | |
[ join{=team-class} ] | |
If in-game, join a random or specified team/class. If the client is running | |
in textmode, it will reissue this command periodically so as to maintain | |
this selection in case of map or gameplay changes. (def: "auto-auto") | |
[ spectate ] | |
If in-game, join spectators. | |
[ disconnect ] | |
If connected, disconnect from the server. If the server was a dedicated idle | |
server running on this host, print the contents of the account backpack to | |
the server log, then reset the client fps. If the idle server player count | |
is 0, then it will be stopped. | |
[ reconnect{=place} ] | |
Disconnect and reconnect. (def: use idle server) | |
[ stop{=kill} ] | |
Stop the client with a console command or process kill (if it is hung or the | |
kill parameter is 'yes'). If the script is finished and there are no clients | |
running, desktop power management will be restored. (def: "") | |
[ restart{=kill} ] | |
Stop then start. (def: "") | |
[ logout{=kill} ] | |
Stop then logout out of steam, or kill the process if it is hung or the kill | |
parameter is 'yes'. If there are no other related steam processes remaining, | |
the appropriate X server will be stopped if the script had originally | |
started it. (def: "") | |
[ relogin{=mode} ] | |
Logout then login. (def: "") | |
[ website{=web} ] | |
Open tf2-related websites for an initiated account in the default browser. | |
The choices include 'tf2b',' tf2items', 'backpack.tf', 'stm_com', 'stm_inv', | |
and 'willitcraft'. (def: "tf2b") | |
[ list{=ref} ] | |
Print account information consisting of an item/crate count, the steam user | |
id, the last 6 characters of the connection hash, version information and | |
status flags. The item data will be read from a cache if it isn't older than | |
5 minutes and the refresh parameter isn't 'yes', or if it is present and the | |
refresh parameter is 'no'. (def: "") | |
[ backpack{=ref} ] | |
List then detail backpack contents. (def: "") | |
[ status{=ref} ] | |
Show system and server information then list specified accounts (if they are | |
logged in) followed by their process statistics. (def: "") | |
[ log{=files} ] | |
Page log files, including the running server, client console, and other | |
steam files. The choices include 'cl', 'sv', 'app', 'boot', 'cloud', 'conn', | |
'content', 'ccfg', 'lcfg', 'scfg', and 'all'. Press Q to cycle through each | |
log or CTRL-C to abort. (def: "all") | |
[ report{=active} ] | |
Collate system/process statistics and logs into a text file. Log files | |
will be gathered only if the account is logged in, or if the active | |
parameter is set. (def: "") | |
[ utility{=utils} ] | |
Execute shell commands and steam urls (if it is started) under the script | |
environment for the selected account prefix. (def: "regedit") | |
[ sleep{=time} ] | |
Wait for a specified period of time or until enter is pressed three times. | |
If this action is not grouped with any others (via the '%' character) it | |
will only execute once, instead of being executed for each logged in | |
account. (def: "1m") | |
[ uninstall ] | |
Logout, backup credentials, then remove the client files and wineprefix. | |
[ reinstall ] | |
Uninstall then install. | |
[ delete ] | |
Uninstall then remove the credential backup. | |
ADVANCED ACCOUNT SPECIFICATION | |
------------------------------ | |
The optional file 'pdl-idler.conf' can be filled with a large multi-line | |
ACCOUNTS variable that details the order of accounts on invocation (when none | |
are specified) or for selecting an account by its position prefaced with a | |
'+'. An ACCOUNT_BLOCKS array can be used for referencing account groups via | |
the array index prefaced with a ':'. Also, one may negate an account from | |
being specified (if it was part an account group or the assumption of all | |
accounts) by prefacing its name or index with the '-' character. To store a | |
password, suffix an account with a forward slash and the password. This makes | |
it so passwords will be inputted into the steam client when needed. | |
# Guys | |
ACCOUNTS1="ben/tenkeysplease123" | |
ACCOUNTS1="${ACCOUNTS1} mann1 mann2" | |
ACCOUNTS1="${ACCOUNTS1} mann3 mann4" | |
ACCOUNTS="${ACCOUNTS1}" | |
ACCOUNT_BLOCKS[1]=${ACCOUNTS1} | |
# Gals | |
ACCOUNTS1="jerry/fussnoigive2keys456" | |
ACCOUNTS2="${ACCOUNTS1} herr1 herr2" | |
ACCOUNTS2="${ACCOUNTS2} herr3 herr4" | |
ACCOUNTS="${ACCOUNTS} ${ACCOUNTS2}" | |
ACCOUNT_BLOCKS[2]=${ACCOUNTS2} | |
ENVIRONMENTAL VARIABLES | |
----------------------- | |
While most configuration is supplied as action parameters, some other | |
miscellaneous settings and personalization options can be specified as | |
environmental variables. You may set them in 'pdl-idler.conf', export them in | |
the shell, or include them as a preface to a script invocation. | |
[ X_DISPLAY ] | |
If starting the main X server, use this display. (def: ":0.0") | |
[ X_X11VNC ] | |
If yes, start x11vnc with the main X or farming Xvfb server. (def: "no") | |
[ IDLE_MAX] | |
Use up to a 32 client limit for each server and X pair. (def: "32") | |
[ IDLE_MAP] | |
Use this map for the dedicated idle server. (def: "cp_cloak") | |
[ IRC_SERVER ] | |
Use this IRC server address, or skip if "none". (def: "irc.freenode.net") | |
[ IRC_SERVER_PASS ] | |
Use this IRC server password. (def: "") | |
[ IRC_SERVER_PORT ] | |
Use this IRC server port. (def: "6667") | |
[ IRC_CHANNEL ] | |
Use this IRC channel name. (def: "primarydataloop") | |
[ IRC_CHANNEL_PASS ] | |
Use this IRC channel password. (def: "") | |
CLIENT COMMAND ALIASES | |
---------------------- | |
Useful command aliases are provided for pdl-idler clients to take advantage | |
of, with either the gui console or 'command' action. | |
[ mmute ] | |
Stop voice transmission and mute all players. | |
[ mhear ] | |
Stop voice transmission and unmute all players. | |
[ mtalk ] | |
Unmute all players and start voice transmission. | |
ACCOUNT CREDENTIAL SHARING | |
-------------------------- | |
When employing multiple VMs or physical machines to idle a large pool of | |
accounts, it is recommended that the 'cred' directory be shared among these | |
hosts via a symlink to a samba share or a VM shared folder on the host. This | |
makes is such that the user will only have to input the account password and | |
guard code once on whichever is the the first host that is used to create and | |
login a prefix. | |
PERFORMANCE ASSUMPTIONS | |
----------------------- | |
A resource-constrained farm steam/tf2 pair will consume around 175MB and 105MB | |
of memory respectively, and can swap down to tens of MB of RAM, while still | |
maintaining a connection to the game/steam servers and being responsive to | |
item notification arrivals and command requests. As an anecdotal reference, | |
the author's weakest machine has 2GB of slow DDR2 and a Pentium 4 HT that | |
farms 16 accounts well enough, and uses a Phenom 1 dual-core with 4GB to | |
handle 32 clients. However, both of these machines feature modest linux | |
distributions and boast large swap partitions. A generous rule of thumb would | |
allow 16 farm clients for every 1GB of RAM and 2GB of swap space. | |
EXAMPLES | |
-------- | |
[ login,start,online mann1 mann2 ] | |
Login mann1 and mann2, start their clients, then sign them onto friends. | |
[ list,login%start,enter :2 ] | |
List accounts in block 2, login and start each, then have them enter chat. | |
[ login=high,play,connect=cp_well ben ] | |
Login ben with the overlay, start the gui client, then host a listen server. | |
[ farm,sleep=10h,logout :1 -+1 jerry ] | |
Farm block 1 with jerry (without ben) for 10 hours then logout. | |
[ connect=12.34.56.78,join=red-pyro,command=say^hello\;volume^1\;mtalk mann4 ] | |
Connect mann4 to a friendly server then rock the mic as a pyro in red spawn. | |
[ log=app-cloud,utility=steam://settings\;regedit +2 ] | |
View app and cloud logs, steam settings, and registry of the second account. | |
[ friend=hurr1-hurr2-hurr3,website=stm_com ben ] | |
Get ben some lady friends then check out his profile. | |
SUPPORT/LINKS | |
------------- | |
[ irc://irc.freenode.net/primarydataloop ] | |
Default server IRC relay and discussion hub for advanced idler science. | |
[ steam://url/GroupSteamIdPage/103582791432273268 ] | |
Official group consisting entirely of human accounts. | |
[ https://gist.github.com/1432762#comment-833847 ] | |
Start of the github gist comment section for pdl-idler. | |
ACKNOWLEDGMENTS | |
--------------- | |
Thanks tf2b, ##slackware, sourceirc, xdotool, hllib, etc. Powered by cream. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pdl-idler CHANGELOG | |
[version 0.86] | |
+ fix for gameinfo typo and malformed update | |
[version 0.85] | |
+ truncate output messages from the left if the terminal width is insufficient | |
+ require wine>=1.7.8, list only normal crates, and don't hide pause output | |
+ return to one-pass client commands when client was loaded from the script | |
+ remove all ensured pauses based from login time | |
+ use one farm helper per display and remove its script when stopping X | |
+ wait until script finish to shutdown the main X server | |
+ remove account-specific client write directory on logout | |
+ toggle registry value instead of deleting the drivers\audio key | |
+ run regedit in the background and wait for completion in install or finish | |
+ remove email address from conf file after account creation, not install | |
+ adjust default steam library window height and exit if cred is unwriteable | |
+ bump manifest to m1 with auto update disabled and warn about validation | |
+ delete temp directory when cleaning tf2 download cache | |
+ write static client configs in cfg directory instead of linking from root | |
+ (re)add dummy ip ban for one-pass client commands in autoexec | |
+ remove jump/duck/item binds, adjust sensitivity, and use mat_vsync in high | |
+ enable sprays for all clients and add useful gameplay cvars | |
+ fail and logout after 3 minutes if password or guard code is not inputted | |
+ disable only winemenubuilder.exe and dwrite.dll for high mode logins | |
+ retry offline after 8 seconds without any action | |
+ don't prompt for install/create if a password is supplied | |
+ show config.vdf tf2 content indicator flags in login initiate output message | |
+ use avatar steam client setting launch toggle to pinpoint login finish | |
+ fix ingame overlay shortcut key | |
+ hide potential error output when checking for the servers window in login | |
+ use pause instead of xdotool delay and separate key presses in create | |
+ use call to offline instead of just passing a steam url in login | |
+ automate an e-mail confirmation request before login finish on a new account | |
+ don't print error in create if a prefix exists but no email was specified | |
+ hide xdg-open error output in website and shorten enter output message | |
+ lock on and use gameinfo for account-specific client write directory in load | |
+ remove loose gameinfo entry and link steam.inf+items_game.txt for farm load | |
+ extract unlit generic shaders for debugging farm resources with a gui client | |
+ fix syntax error on openvr download and remove 'commiting' update message | |
+ wait 2 seconds then recheck before failing for assumed update cancel in load | |
+ don't run client resource prep twice after an update in load | |
+ upgrade sourcemod to 1.5.2 | |
+ remove 1.5 second sleep and use 2 more mouse clicks in farm helper | |
+ show helper count instead of pid in status | |
+ check for software rasterizer string in glxinfo for status | |
+ fix utility parameter without steam | |
+ don't disable vtex_dll.dll for client spray support | |
+ delete singular helper script, root configs, and friends.cache when cleaning | |
+ remove xvfb permission check and sudoers alteration | |
+ exit if pdl-idler.conf exists but is not readable | |
+ fix sourcing pdl-idler.conf from the present working directory when using sh | |
+ reference pdl-idler.conf for account details when supplying just the name | |
+ adjust wine dep + resource assumption and explain password storage in readme | |
[version 0.84] | |
+ revert to changing the pwd to before the shell check | |
+ show minimum wine version required in output when current is insufficient | |
+ use a bump file for forcing reset of application manifest and a validation | |
+ don't increment error count in load if waiting on openvr | |
+ check after updating window arrives in load and see if it is just validating | |
+ fix having first client generate a server identity when not halloween | |
+ record time elapsed since before farm starts to after the account connects | |
+ show all new parts of the changelog on update, instead of just the latest | |
+ increase update prompt timeout from 20 to 60 seconds | |
+ fix stalling on non-existent gnome-pm start and check for xfce4-pm in lxde | |
+ toggle sigint flag to fix log sequence interruption with ctrl-c | |
[version 0.83] | |
+ fix/improve content wait so that an update will not stall load | |
+ announce if the finish window is due to a download after 5 seconds in logout | |
+ check host cred file before doing anything else in login | |
+ only enforce minimum password length of 8 if creating an account | |
+ print script canceling message as error output | |
[version 0.82] | |
+ check shell before changing pwd and improve output print function | |
+ use Xvfb for farm X regardless of driver and require at wine >= 1.7.1 | |
+ find and kill defunct hl2 processes before searching for others with -n flag | |
+ allow the 'no' refresh parameter in list even if there is no cached data | |
+ fix numbered directory grep syntax error in list and backpack | |
+ remove tux item count handicap and silence pause standard output | |
+ avoid syntax error and print 00mb when getting process memory if no pid | |
+ use distinct timeout variables to fix various/sporadic conflicts and stalls | |
+ slow client command loops and use timeout for the second portion | |
+ comment the loaded alias in the client command file instead of removing it | |
+ fix genuine items being listed as haunted in backpack | |
+ add /sbin and /usr/sbin to the script path variable | |
+ don't run backpack in disconnect from idle server | |
+ wait for pid removal in stop+kill and defer content wait to load or logout | |
+ print X server stop message as error output | |
+ increase cloud sync warning check timeout from 3 to 6 in logout | |
+ use symlink to cred host file in root to speed up stray backup check in main | |
+ don't reset display id if retrying a login and unset that timeout in logout | |
+ remove chvt call in X start along with sudo dep and simplify x11vnc check | |
+ move pre-init/loop prep from login to install and fix/simplify host check | |
+ add cl_autoreload/hud_fastswitch cvars and bind f to use_action_slot_item | |
+ hide error output when linking common client config files in login | |
+ retry an offline login once before exiting with a kill instead of waiting | |
+ kill explorer after login if using the hide flag to deal with wine >= 1.7.6 | |
+ don't disable winedebug channels for high-mode logins | |
+ reinstall if the steam crashes after auth 3 times and fail on the fourth | |
+ mark login flags in a per-prefix file and reset content_log in login | |
+ retry login if it stalls for a long time after authentication | |
+ slow automatic form entry when creating an account | |
+ change hung launch and extraction timeouts from 90 to 60 and 150 to 90 | |
+ restart login if ui check or download takes too long | |
+ fix and improve retry/fail handling in login and show explorer pid at end | |
+ allow passwords with a length of 6 if the prefix already exists | |
+ ensure 2 seconds instead of 3 and retry after 8 elapse in enter/online | |
+ adjust account specification parsing for passwords with '#' signs | |
+ only show farm resource construction output message once | |
+ use marker wav files to signify ui clicks of store error and helpful friend | |
+ relogin if tf2 doesn't launch 3 times then fail on the fourth | |
+ use halloween gift farming server plugin and map during the event period | |
+ have server only park farm clients by default and use mp_autoteambalance 0 | |
+ base fps+map check on noshaderpi in connect and fail if client command does | |
+ show output message before running client command in connect | |
+ check for placeholder version mismatch error in connect for farm clients | |
+ fail if hl2 goes defunct while loading the map | |
+ skip executing join client file in connect if it already set to spectate | |
+ don't prestart idle server in farm | |
+ hide glxinfo error output and show proper server player limit in status | |
+ show client config files along with the console in log | |
+ only run finish once for multiple sigint interrupts and output a message | |
+ disable openvr and sourcevr dlls for all processes | |
+ fix email addresses with '+' signs being confused with account indexes | |
+ abort the rest of an action chain if play or start fail | |
+ adjust performance assumptions and Xvfb implications in readme | |
[version 0.81] | |
+ bump prefix version to 6 and show prefix size in rebuild+move output message | |
+ mv tf client data and application manifest to new steamapps root directory | |
+ hide xdotool error output in close_window | |
+ prep application manifest for openvr tf2 client dependency | |
+ execute personal client cfg file in autoexec and create it blank if needed | |
+ catch error and wait for the initial openvr download in client load | |
+ retry steamcmd if license fails and use separate download message | |
[version 0.80] | |
+ use '0' not '_' for empty item count in list and trim username if too long | |
+ silence pause error output | |
+ reset command read file after the client quit in stop | |
+ warn after 3 seconds if visible cloud finish window arrives on logout | |
+ ensure 3 seconds have elapsed since login before running logout | |
+ fix using old display id when running relogin on a farm client | |
+ disable dinput and dinput8 dlls for steam | |
+ deactivate audio and serverbrowse/shaderapidx9/speex/stdshader dlls for farm | |
+ delete only tf2 download cache on login, instead of all | |
+ show display id in steam init output message | |
+ remove '-norebuildaudio' to save space in launch options for long usernames | |
+ check for viewable chat window and focus it before moving in enter | |
+ alter gameinfo.txt and use slim vpk extractions to reduce farm hl2 ram usage | |
+ add managedtextures/mipmaptextures/phong=0 mat cvars to text+farm startup | |
+ don't restart farm clients in connect if assuming a parking idle server | |
+ show server number in connect output message and fix idle server assumption | |
+ fix session check in farm starting another X if re-farming on a full server | |
+ add cheat-protected material/mem cvars to farm client startup cfg file | |
+ change helper click pos for reduced ui and revert display id in start output | |
+ check/download and use pci.ids file in status, instead of main | |
+ fix distro report in status and change 'noshaderapi' to 'farm' in hl2 output | |
+ only logout on script upgrade if the new version requires it | |
+ disable dxgi.dll, mss32.dll, and various other dlls for all processes | |
+ fix non-empty servers sometimes stopping in finish | |
+ don't attempt unnecessary deletion of steam cache home directory in finish | |
+ leave now separate ui resource files and clean the old location in finish | |
+ fix power managers not starting on the main display id and stalling finish | |
[version 0.79] | |
+ default to Xvfb as the farm X server type when using the fglrx driver | |
+ check script update after function declarations, so as to logout for upgrade | |
+ count fall 2013 crates and pad single-digit item counts with a '_' in list | |
+ stop servers by sending "quit" to screen instead of using a command alias | |
+ improve client fps detection and changing | |
+ only write bp to log or shutdown server on disconnect if it is on the host | |
+ show server number and playercount if disconnecting from an idle server | |
+ don't start x11vnc when needed by default and limit idle_max variable to 32 | |
+ remove obsolete registry graphics settings and pass login mode to install | |
+ don't disable hl2 html dlls and direct3d registry settings for high logins | |
+ update prefix timestamp after each prep instead of the launcher install | |
+ prep for creation in install if '/password#email' suffix an account target | |
+ fail on login if there is less than 400MB of swap space and improve reading | |
+ fix courtesy sleep not happening on cred file host conflict | |
+ end cred prompt if a certain window shows or if steam stops or authenticates | |
+ store temporary password entry scripts in the pwd, instead of each prefix | |
+ alter output in the prompt to install to indicate a creation | |
+ prep steam files before client and rename mic ping file to 'audible.cfg' | |
+ include convience binds, sensitivity 4, and hide player model hud dialog | |
+ reinclude binds and cfg file containing client movement aliases | |
+ don't reduce cvars and use html, 200fps, and multicore for high mode clients | |
+ enable msi.dll, dxlevel 95, and 1024x768 resolution for high mode logins | |
+ change ingame overlay shortcut key from Shift to Control | |
+ force steam language to english with command line parameter | |
+ show steam memory usage in offline login end output message | |
+ unset stored password and improve guard window focus/check on authentication | |
+ prompt for and manage guard code input and adjust/improve password entry | |
+ attempt a password entry if it suffixes an account with a preceding '/' | |
+ improve creation, fail+delete if e-mail is used, and show secret question | |
+ bypass steam guard location awareness dialog | |
+ fail if any of the account input segments are invalid | |
+ improve and simplify create prompt | |
+ ensure 3 seconds have elapsed since login before running online/enter | |
+ fix display id not being properly set before running an action | |
+ warn then bypass the cloud warning/conflict dialogs in client load | |
+ fix login mode parameter not being passed through play/start | |
+ improve total swap space reading | |
+ no longer erase the entire srcds directory when installing steamcmd | |
+ improve steamcmd cache directory shuffling | |
+ fix duplication of server log files | |
+ reduce irc relay spam, bumb version, and remove server command read alias | |
+ use correct limit for server player count in connect output, if on the host | |
+ deduce display id after logging out a normal session, starting X in login | |
+ quicken status cpu check and show display id in helper start output message | |
+ show distro, user, script version, helper pid, and badge level in status | |
+ elaborate usage line | |
+ print most recent changelog section before script upgrade prompt | |
+ set the permissions of pdl-idler.conf to allow only the running user to read | |
+ trap sigint and perform finishing operations if the signal is caught | |
+ delete password entry scripts and obsolete files on exit | |
+ fix reconnect and reinstall actions not being seen as valid | |
+ enforce all account target names to be lowercase | |
+ note new high login capabilites and cred entry methods, and adjust readme | |
[version 0.78] | |
+ simplify X server checks, re-hide pid file, and allow type variable override | |
+ require glxinfo for llvm version check in status | |
+ properly handle tf2b and steamcommunity host errors when downloading data | |
+ pad single digit memory values in output with a leading zero | |
+ fix cmd timeout variable conflict when disconnecting and stopping | |
+ get server memory, playercount, and running version via their port numbers | |
+ try to stop a server with the quit command instead of just killing it | |
+ show number, not version, in output message when stopping empty idle servers | |
+ stop or kill the idle server if it is empty right after a client disconnects | |
+ check connection port instead of map for the idle server check in disconnect | |
+ echo quit to the command file instead of using cmd() when stopping a client | |
+ use X lock files in tmp to check pid instead of using pgrep | |
+ use proc display marks in X shutdown now checking pid file for farm | |
+ stop the X server if it is empty right after an account logs out | |
+ don't restore the VT when starting the main X server | |
+ use shell variable for the maximum number of logins with X and the server | |
+ show steam cid or 'nostmcmd' in launcher installation output message | |
+ fail in login if the maximum number of logins are used in the main X server | |
+ re-add 'cl_showbackpackrarities 1' to autoexec.cfg | |
+ allow services and steamserver.exe/dll to run for high-mode logins | |
+ enable cloud filesystem access to 'userdata/760' for high-mode logins | |
+ mark display id on wineserver, steam, and hl2 processes for farm sessions | |
+ base client listen port start on the display id starting at 28201 | |
+ reset the login hang timer on ui extraction | |
+ revert pid check removal and fix hang retry's interpretation as login cancel | |
+ export the display variable to that of the account if it is running | |
+ shorten premium tf2 license name in output to 'prem' | |
+ write running cl/sv versions to console for comparison with download cache | |
+ use '&' as a prefix for the item schema, and '@' for all process ids | |
+ fix syntax error with preparation timeout in client load | |
+ set server hostname to include user, time, ram, and swap information | |
+ deduce first open server/port before starting/connecting to an idle server | |
+ show message and pid when resuming the server content check/update | |
+ use separate console log files for each server process with '+con_logfile' | |
+ support sourceirc install bumps and remove itembot and unused stock plugins | |
+ use hostname and the server number seperated by a dash as the irc relay name | |
+ show number in server load output message and pid in schema output message | |
+ add and start server command file read poll alias | |
+ use shell variable for the idle server map | |
+ apply replay parameter on the server to gain the extra player slot | |
+ wait for map cfg file exec instead of steam connection when starting server | |
+ fail if the client/server versions mismatch in connect, then stop if farming | |
+ start another X/Xvfb server if there were already 32 wineservers in farm | |
+ observe hl2 display process marker in helper and combine/slow xdotool calls | |
+ pad process usage output percentages with a leading 0 if needed | |
+ count running processes and open files in status | |
+ show X version and detail running X servers in status | |
+ detail multiple servers in status without now irretrievable uid | |
+ add running client version to hl2 status information | |
+ page consoles files of all running servers in log | |
+ implement report action to collate system/process info and logs into a file | |
+ aquire sudo credentials explicitly beforehand instead of with the tee call | |
+ check farm hl2 processes, not steam, when undoing client ui modifications | |
+ start power manager in the background and wait before printing output | |
+ remove client limit, and detail report and new dep/variables in readme | |
[version 0.77] | |
+ don't run various calls to echo that needlessly encapsulate other output | |
+ explicitly return true in pause() | |
+ show steam/hl2 pid in various output messages | |
+ pass the kill parameter from uninstall/delete to their calls to logout | |
+ fix delete removing files from similarly named accounts | |
+ hide error output in window raise/focus and successful login window unmap | |
+ have client echo starting log marker after running alias.cfg, not before | |
+ remove nice and ionice priority reductions from low/farm wine processes | |
+ show steam pid on authentication output message | |
+ mark ui version file upon extraction, not authentication | |
+ improve/fix password prompt, and check for a connection warning dialog | |
+ only check error window if steam is up and avoid extra pid check in login | |
+ timeout and retry client launch after 10 seconds if nothing happens | |
+ ensure 5 seconds had elapsed since login before preparing the client | |
+ show client version in schema output message, not loading | |
+ exit if steamcmd fails to receive license on server content check | |
+ create/link server console log immediately after steamcmd update | |
+ upgrade sourcemod to 1.5.1 | |
+ start client notification trigger in alias.cfg instead of as a call to cmd() | |
+ remove 'low' command line parameter from farm client startup | |
+ wait 1.5 seconds instead of 0.5 when calculating total cpu usage in status | |
+ fix indentations in status | |
+ combine X server and x11vnc stop output messages | |
+ move check to resume power management to after any potential X server stops | |
+ adjust memory assumptions in readme | |
[version 0.76] | |
+ check shell before declaring functions and restart with bash if needed | |
+ change parentheses to brackets in output message markers | |
+ fail if the present working directory is not writable | |
+ move dependency check to before the gist update check | |
+ simplify steam/hl2 pid checks | |
+ add viewable flag to get_window_id() | |
+ handle private bp and fix output error with uninitiated accounts in list | |
+ use a dash instead of an underscore in cred host marker files | |
+ delete webcache and fix output error in delete | |
+ use Xvfb server instead of X for farming if the driver isn't nvidia or flgrx | |
+ start an x11vnc instance along with the Xvfb server for farming | |
+ rename registry file to registry.reg and don't hide or delete it | |
+ raise windows before focus when they can't be activated | |
+ focus window before new mouse click, and the escape press in close_window() | |
+ combine appropriate xdotool calls in raise+focus, close window and helper | |
+ move cred host check and insertion to before client file creation | |
+ sleep for 5 seconds if the cred file appears to be claimed by another host | |
+ rename 'pdl-idler.cfg' to 'autoexec.cfg' | |
+ provide a supplementary prompt on the shell for the user password if needed | |
+ delete 5 digit anonymous id userdata directories as well as those with 6 | |
+ go offline but don't check the result when ensuring initial offline state | |
+ alter sourceirc download to allow upgrade/reinstall without a sourcemod bump | |
+ truncate irc name to prevent them from being too long for gameinfo/status | |
+ don't add chvt sudoers entry or use it in farm for hosts that use Xvfb | |
+ change sleep period before chvt switch from 5 seconds to 8 | |
+ improve status output and device id deduction for vmware/virtualbox adapters | |
+ move uninstall/reinstall/delete to the end of usage/readme | |
+ clear the sudo password cache before alterting any permissions | |
+ ensure Xvfb is an entry in sudoers for hosts that use it | |
+ show version in pci id download message and assume nvidia driver over i915 | |
+ downgrade fatal missing input errors to warnings | |
+ revert to a switch instead of if/else for the main action loop | |
+ add support section to readme and note potential Xvfb dependency | |
[version 0.75] | |
+ improve file downloading and failure | |
+ show incompatible shell in fatal output message | |
+ have the script restart itself automatically after update | |
+ save copy of steam uid in cred file for use with uninstalled prefixes | |
+ fail in version checks if there is no installed component | |
+ compare ui version to steam cdn manifest in list and extraction | |
+ really fix list 'no/yes' parameter | |
+ store cached web data as hidden files in 'cred' instead of in each prefix | |
+ elaborate crate count, use full uid, and remove bootstrapper version in list | |
+ detail uninstalled prefixes in list | |
+ use builtin silent read calls with a timeout instead of the external sleep | |
+ explicitly return true if the client console command succeeded | |
+ fix fps change/detection when setting it ingame | |
+ slow client command file read alias to 4 times the fps instead of 2 | |
+ remove idler_kill and instead check for 'yes' parameters to logout/stop | |
+ show prefix version and size in delete output message | |
+ fix X server process check | |
+ improve steam account community id deduction | |
+ show both memory usages in online/offline/enter/exit output messages | |
+ change 'clientport' cvar to 28001 | |
+ set 'cl_hud_playerclass_use_playermodel' cvar to 0 | |
+ integrate 'pdl-idler.cfg' file into the script | |
+ disable filesystem access to the 'userdata/760' directory for steam cloud | |
+ change client listen server port start to 28101 | |
+ remove old ui version v1370553818 download retry workaround | |
+ maybe fix steam hang retry and warn then retry if steam crashes post auth | |
+ show chat room id in enter output message | |
+ don't sync the xdotool windowmove call in enter | |
+ implement friend action that sends or queues invites between accounts | |
+ show memory usage in join/spectate output messages | |
+ change dedicated server port from 27014 to 28201 | |
+ upgrade to metamod-1.10.0 and sourcemod 1.5.0 | |
+ remove dashes from irc names to fix gameinfo/status | |
+ assume the specified server on 28201 is a pdl dedicated in connect | |
+ if there is a visible login window, have farm helper pause and raise it | |
+ remove useless one second sleep in farm helper | |
+ replace 'view' with a 'log' action to page client/server and other files | |
+ print usage text and skip other actions if 'help/usage' is specified | |
+ only attempt to run enter once if the specified chatroom id is invalid | |
+ check and respond to friend queue for active accounts after running actions | |
+ add friend text, perf summary, shared cred tip, and adjust readme/usage | |
[version 0.74] | |
+ allow 'no' parameter in list to skip tf2b pull | |
+ hide error if there was no cred host marker file to delete in logout | |
+ improve X server startup/shutdown with support for separate farm display | |
+ fix connect location/prefix location variable name conflict | |
+ don't set steam ui mode to mini in install to fix the temporary scrambled ui | |
+ change client resolution from 800x600 to 640x480 | |
+ mark farm client/steam processes | |
+ restart wineserver without debugging after prep with farm marker if needed | |
+ sync the xdotool windowunmap and windowmove calls | |
+ increase ui extraction hang timeout from 60 to 150 | |
+ have create function fail if it couldn't log in | |
+ download and use hllib to extract files from vpk files | |
+ add load() parameter to extract and alter client ui assisting farm helper | |
+ return 'noschema' if client might not have recieved item schema | |
+ check client pid for user cancel interpret in client load | |
+ show pid in power management startup/shutdown output messages | |
+ stop then fail on client load if the item schema download explicitly failed | |
+ remove textmode startup parameter from farm client startup | |
+ upgrade to metamod-1.9.3-hg821 and sourcemod 1.5.0-hg3855 | |
+ reintegrate server plugin code into the script once again | |
+ remove insecure from the server and farm client startup parameters | |
+ unset location/test variable before each try in connect | |
+ fix player count connection output message in connect | |
+ wait until the server has registered the initial client connection | |
+ remove login mode parameter to farm action and use 'low-hide' | |
+ start separate X server for farming and relogin regular sessions to use it | |
+ run chvt with sudo to restore the original VT on farm X server start | |
+ allow gui/textmode clients in farm to be used if explicitly started prior | |
+ use client command alias for triggering item notifications | |
+ start farm helper after the initial farm client connects to the server | |
+ perform dead process, screen session, and cred checks before the others | |
+ set wine check to allow versions 1.5-1.9 | |
+ right-align the pid in defunct process output message | |
+ check for sudo dep and alter /etc/sudoers enable the user to run chvt | |
+ if present, alter /etc/X11/Xwrapper.config with sudo to allow user X start | |
+ reset display environmental variable with each client action | |
+ restore ui modifications if there are no steam farm processes on shutdown | |
+ remove cloud marker client pause bind | |
+ add sudo notes, remove script name from examples, and adjust readme/usage | |
[version 0.73] | |
+ disallow root from running the script | |
+ really fix gist/pci.ids update checks | |
+ add bitmap flag to get_window_id(), rename 'visible' flag to 'opacity' | |
+ show connection time in client disconnect output message | |
+ fix get_prefix_size() for prefixes one GB or larger | |
+ hide error if chmod doesn't find a userdata directory to alter in uninstall | |
+ show prefix version in uninstall output message | |
+ improve wine version parsing | |
+ use variables to configure IRC and other settings with explanation in readme | |
+ bump prefix version to 5 | |
+ set the survey completion date to the present on login to prevent the prompt | |
+ make config.cfg empty and unwriteable | |
+ ensure that the trade hint in friends chat doesn't show via sharedconfig | |
+ disable filesystem access to the 'userdata/ugc' directory for steam cloud | |
+ add '-clearbeta' paraemter to steam startup | |
+ timeout then warn and restart steam if it stalls during init | |
+ kill and restart steam ui download if it attempts to download v1370553818 | |
+ fix get_server_ircname() truncating hostnames with a dash | |
+ log steamcmd output to the server log and improve completion check | |
+ upgrade to metamod-1.9.3-hg820 and sourcemod 1.5.0-hg3843 | |
+ fix get_process_usage() with multiple instances of the pid in proc output | |
+ only get the first listed gpu device name for the target pci id in status | |
+ fix status when the machine has no dnsdomainname | |
+ set WINEARCH to 'win32' to prevent the creation of 64-bit wine prefixes | |
+ account for nvidia+nouveau and ati/fglrx drivers in hardware detection | |
+ fix player count in server plugin restart | |
+ don't park clients with server plugin if their tv_nochat cvar isn't 0 | |
+ fix usage typo, adjust wine dep, space bracketed titles, and fluff readme | |
[version 0.72] | |
+ fix gist and pci.ids update checks | |
+ timeout then warn and proceed on upgrade prompt | |
+ workaround client config exec error for old account names with periods | |
+ read dosfiles in unix format | |
+ fix backpack item type and memory usage output | |
+ synchronize cred files across machines and ensure collection after logout | |
+ disable filesystem access for steam cloud and use a local sharedconfig | |
+ add 'stm_com' and 'stm_inv' parameters to the website action | |
+ interpret user load cancel with the content log instead of sharedconfig | |
+ timeout then warn and proceed if there is no schema message on client start | |
+ revert to having server plugin in separate file | |
+ show timestamps on server plugin output | |
+ show server player count on farm connection output message | |
+ improve hardware detection and show wine version in status | |
+ don't execute utility for steam urls if the account is not logged in | |
+ fix pci.ids update check | |
+ negate hammer_dll.dll | |
+ fix server plugin compile when bash is not the default shell | |
[version 0.71] | |
+ handle gist being down and prompt before upgrade | |
+ check for recent enough wine | |
+ set steam network rate to 30000kb | |
+ use timestamped client console output | |
+ get client connection duration | |
+ add marker flags to waiting, warning, and error output messages | |
+ show prefix in status | |
+ bump prefix version to 4 | |
+ disable game overlay with localconfig and not just dll overrides | |
+ reinstall the prefix if it was moved | |
+ set clients to use dxlevel 80 instead of 81 | |
+ fix steam launcher installation output message | |
+ timeout and retry on hung steam ui extraction | |
+ fix cloud conflict window check | |
+ get tf2 license origin | |
+ improve steam ui version checking | |
+ upgrade to sourcemod 1.5.0-hg3841 | |
+ shuffle hlds/steamcmd cache directory instead of failing if it was occupied | |
+ include sourceirc with the server | |
+ improve fps changes and start/keep farm clients at 1fps without auto aliases | |
+ improve client disconnect and timing | |
+ fix cpu usage pid check | |
+ show server and client version in status | |
+ improve/fix account targeting | |
[version 0.70] | |
+ fail unless bash is the running shell | |
+ check gist and exit after applying a script update | |
+ get client connection state as well as map or ip address | |
+ improve output message printing | |
+ cache tf2b for 5 minutes and also obtain the steam profile page in list | |
+ fix parameter and delete bad cache with better tf2b error handling in list | |
+ adjust backpack action output | |
+ improve the showing of both memory usages in various output messages | |
+ append backpack contents to server log if disconnecting client was idling | |
+ show fps in output messages when changing it | |
+ restore/set cred backup once in install/uninstall instead of on each login | |
+ check item schema for either client or server and print hash | |
+ improve cloud conflict check and show version and item schema in client load | |
+ erase 'steamcmd/userdata' directory when done checking/updating the server | |
+ print player count to server log as it changes in idle plugin | |
+ change dedicated idle server map from itemtest to cp_cloak | |
+ wait until the server has recieved the item schema | |
+ show memory usage on low-client restart, ip on server query | |
+ show the location map or 'spawning' when using the idle server on connect | |
+ allow farm to run even if there is a noshaderapi client already running | |
+ show server player count, process usage, network info, and backend in status | |
+ show profile names and improve output and hardware descriptions in status | |
+ log output and only execute urls if steam is running in utility | |
+ show dependancy in error output message and add bash and bc to the check | |
+ change action concatenation char '+' to '@' avoiding account index conflict | |
+ use the pciids project instead of pcidatabase.com for hardware detection | |
+ change account block char '@' to ':' avoiding conflict with old usernames | |
+ allow account target negations with the'-' suffix to usernames or indexes | |
+ fail if an invalid action is specified and improve main loop | |
+ stop server if no clients are connected instead of checking for hl2 procs | |
+ slow mic ping alias from 6000 to 16000 frames | |
+ incorporate full readme and adjust usage output | |
[version 0.69] | |
+ fix grep errors when an adjacent file exists containing all numbers | |
+ wait until steam registers the application as halted before finishing stop | |
+ allow optional parameters in steam pid checks and startup | |
+ improve wine program launch | |
+ hide registry settings file | |
+ prep manifest, guard code, and client files on each login instead of install | |
+ only use '-condebug' startup parameter on the server | |
+ exit if pdl-idler.cfg is not found when prepping client files on login | |
+ hide login window after successful entry | |
+ don't supply mat_texture_limit on the command line for farm clients | |
+ show server memory usage in relevant output messages | |
+ have list cache tf2b for 4 minutes and only show 1 'v' in version info | |
+ fail in list if the prefix was not installed | |
+ implement backpack action that details backpack contents | |
+ implement status action that reports system, process, and account info | |
+ implement utility action that runs shell commands/steam urls for an account | |
+ implement sleep action that waits for a time or until enter is thrice pushed | |
+ only set client directory variable once | |
+ use array for targeting accounts by indexes as defined in pdl-idler.conf | |
+ check for uninstalled prefixes when no accounts are specified on invocation | |
+ don't uncapitalize action paremeters | |
+ fix gnome/xfce-session process checks | |
+ set 'sv_pure' cvar to -1 | |
[version 0.68] | |
+ use /bin/bash instead of /bin/sh as the shell bang | |
+ improve client disconnect | |
+ show prefix disk size on uninstall | |
+ align windows for the chatroom and talks with the private inbreastigator | |
+ improve version parsing | |
+ track installed versions per client for ui upgrades | |
+ rename 'backpack' action to 'website' and add 'willitcraft' parameter | |
+ (re)move chat window on arrival | |
+ add item+crate count and steam connection hash to account list | |
+ fix ui version in account listing due to new package system | |
+ remove cloud and launch flags and shorten main status flag in account list | |
+ print error on client command failure | |
+ allow account group specification | |
[version 0.67] | |
+ suffix account read wait/pid marker config files with a '+' | |
+ allow chat if there is any app license (instead of just tf2) | |
+ only validate srcds content after initial install | |
################################################################################ | |
[??????? 0.66] | |
+ | |
C REVERT BAD ASS WRITEIP AND yeah.... | |
+ remove paragraph on gcf files in readme | |
[VERSION 0.65] right-hand-opputs, steampipe server | |
[VERSION 0.64] create | |
################################################################################ | |
[version 0.63] | |
+ use addip/writeip and the 'banned_ip.cfg' file for client command execution | |
+ run mmute client command alias before disconnecting | |
+ simplify client command read alias fps changing | |
+ bump prefix version to 2 and use hidden marker file | |
+ explicilty create/update prefix with regedit instead of launcher in install | |
+ remove 'user token' and 'currentversion/run' registry settings | |
+ set default dimensions of trade window to 648x445 and place it top-right | |
+ add low priority/resource steam mode that negates chrome and explorer.exe | |
+ set default client resolution to 640x480 | |
+ fix syntax error when no parameter is supplied to enter | |
+ check for the steam id instead of just the wineprefix in backpack | |
+ fix sourcemod.cfg typo when blanking its contents | |
+ login steam in low-resource mode if it wasn't already active in farm | |
+ negate commedit, datamodel, pet, and vmt dlls from being loaded | |
+ remove 'props_break_max_pieces' and 'sensitivity' client cvars | |
[VERSION 0.62] singularregedit, farm, join/spec | |
+ slow the 30 fps client command read alias to to 60 fps | |
+ check gcf files once on invocation instead of each login | |
+ bump prefix to version 1 | |
+ PREPPAGE | |
[version 0.61] | |
+ reorder function definitions | |
[version 0.60] | |
+ correct shell bang typo | |
+ fix atom window id check | |
+ don't reference the script location directory when unnccessary | |
+ rely on the display variable or default ":0.0" for the X server display id | |
+ start x11vnc if installed when the script has to start the X server | |
+ improve video driver module check and use account-named registry files | |
+ initiate jumplist ui settings to 0 and adjust it from 1545 to 521 on login | |
+ implement exit action to leave the chat instead of using enter as a toggle | |
+ upgrade to sourcemod 1.4.7 | |
+ delete data extracts and gcf links after each account instead of after all | |
################################################################################ | |
[??????? 0.59] Leave thisOne still the middle of second run through | |
+ don't require pdl-idler.conf | |
+ reinclude micspam client alias | |
! ECHO DISCONNECT drawviewmodel, VOLUME 0 | |
? include close window function | |
+ CREDS/GUARD | |
+ PREFIX | |
+ CONFIG PREPS | |
+ CAUSE NO MANUAL OVERLAY DISABLE NEEDED | |
+ NEWLY DOING THE SSA STUFF? | |
+ WINESERVER WAIT ON LOGIN????? | |
+ CLOUD/UPDATE REGS | |
+ HANDLE THEM NEW UI INSTALLS AND BOOTSTRAPS | |
+ MONTIOR LOGIN MORE THROUGHLY | |
+ WAIT ON SSA, DO AVOID DEFAULT ONLINE, RESTART FOR OCNFIG^ | |
+ F2P1 | |
+ CHAT LOGS THEM IN NOW/LAME TOGGLE | |
+ LOAD MEGA MONITORING + DISABLEING PM RIGHT AT THE MOMEMNT? | |
+ SERPERATE CONNECTION FROM START ++ DISONECT + ISCONNECTED | |
+ IDLER_COMMAND | |
+ NO MORE PING? | |
+ IDLEER_BACKPACK (WEBSITE TYPE) | |
+ IDLER_LIST | |
+ IDLER_KILL | |
+ MORE DLLS AND THEM WINE PROCS | |
+ GET SOME ACCTS IF NONE SPECIFIED FROM EXISINTG | |
+ ACTION PARAMETERS | |
+ RELOGIN/RESTARTS? | |
+ add uninstall action | |
+ share steam ui download packages | |
################################################################################ | |
[version 0.58] | |
+ store server console logs | |
+ include view action to cycle through screen sessions | |
[version 0.57] | |
+ set and use client startup options in steam config instead of on invocation | |
+ use exec file to set client command read alias polling frequency on startup | |
+ remove client binds and trade spam and micspam aliases | |
[version 0.56] | |
+ include window check functions and revert xdotool dependency | |
+ prompt for new install and prep data/config links before steam pid check | |
+ silence all file downloads and stop if the pci/hldsupdatetool downloads fail | |
+ revert chat auto login hibernate and multiple windows | |
+ slow offline/online/enter/command wait sleeps from 0.1 to 0.25 | |
+ start gui clients at 30 fps and textmode clients at 1 fps | |
+ capture server bootstrap updating in screen | |
+ integrate server plugin code into the script | |
+ use sv_cheats and run server at 10 fps | |
+ deduce correct network device and ip address of server for client connection | |
+ have connecting client send message, and say 'stop' not 'quit' on disconnect | |
[version 0.55] | |
+ start clients at 10 fps with sv_cheats 1 | |
+ call regedit before each steam launch instead of just once per login attempt | |
[version 0.54] | |
+ adjust jumplist steam ui setting flag from 1705 to 1545 | |
+ require xdotool and use it to check for windows | |
+ add variable for having accounts join and and hibernate in chat on login | |
+ ensure if the account has premium tf2 before joining chat | |
+ make chat action hide/show the window with xdotool | |
+ have account friend chats open in a seperate window | |
+ wait for the main window with xdotool to finish login instead of appinfo_log | |
+ remove superfluous tf/maps mkdir call | |
+ wait for window to ask for password instead of assuming via SteamAppData.vdf | |
+ wait until the account has finished changing friends state | |
+ quicken client command-read poll from 120 to 60 frames | |
+ hide x pid file | |
+ download steam launcher and pci id file on install instead of on invocation | |
+ don't print output message if not joining a game and are only connecting | |
+ upgrade to sourcemod 1.4.2 | |
+ use screen for the server content updating | |
+ ensure the hlds/steam cache directory link isn't the idler's before failing | |
+ include general client command function 'cmd' | |
+ add timestamp to disconnect announcement performed now as a call to cmd | |
+ remove client quit alias and just write 'quit' to readcmd.cfg | |
+ don't use any extra fonts | |
[version 0.53] | |
+ use the launcher install to create the prefix instead of regedit | |
+ delete registry key for startup applications | |
+ include chat action for joining a public chatroom | |
+ remove prediction of high cpu consumption/crash in readme for first login | |
[version 0.52] | |
+ download, install, start, connect to, and stop a dedicated idle server | |
+ include sourcemod plugin for server that parks clients in the spawning phase | |
+ don't download or use achievement_idle map and rely on itemtest | |
+ remove client movement alias file/binds | |
+ rename 'pdl-idler_autoexec.cfg' to 'pdl-idler.cfg' | |
+ use port 27016 as the start of the client listen port range | |
[version 0.51] | |
+ don't use cpulimit | |
[version 0.50] | |
+ monitor client console via the screen instead of polling the log file | |
+ always suppress winedebug output | |
+ fix X process check | |
[version 0.49] | |
+ print output messages with a timestamp | |
+ mark when the X server starts instead of relying on user variable | |
+ don't login when going online | |
+ check server even if it was down for each client connecting in an invocation | |
+ suppress power manager restart output | |
+ improve client trade-spam aliases | |
+ hide servers from master list | |
+ disable mp_timeout | |
[version 0.48] | |
+ add ping action that instructs clients to message the server | |
+ quicken client command-read poll from 240 to 120 frames | |
+ use one main loop for each specified account | |
[version 0.47] | |
+ change client resolution from 640x480 to 800x600 | |
+ set client timeout cvar to 0 | |
[version 0.46] | |
+ have clients print console output to logfile | |
+ create separate screen session that polls the client console log | |
+ wait until client joins the game after connecting | |
[version 0.45] | |
+ don't set windows mode to win98 and rely on default | |
+ hide client achievement hud element | |
+ mute voice chat on client startup | |
[version 0.44] | |
+ include binds and cfg file containing client movement aliases | |
+ append marker command line parameter to client startup | |
+ fix cpulimit removals | |
+ add trade spam client aliases | |
+ bind mouse5 to 'inspect' in the client | |
+ hide maxplayer/blacklist/favorites warnings in client | |
+ show item quality outlines in client | |
+ increase volume amounts in relevant client binds | |
+ use mat_disable_d3d9ex cvar and fix mat_envmaptgasize typo | |
+ change mat_picmip from 4 to 2 | |
+ remove avglight, drawdecals, and drawviewmodel render cvar changes | |
+ move net_graph cvar to autoexec instead of the command line | |
[VERSION 0.43] | |
+ initial drop to git hub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GNU GENERAL PUBLIC LICENSE | |
Version 3, 29 June 2007 | |
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
Everyone is permitted to copy and distribute verbatim copies | |
of this license document, but changing it is not allowed. | |
Preamble | |
The GNU General Public License is a free, copyleft license for | |
software and other kinds of works. | |
The licenses for most software and other practical works are designed | |
to take away your freedom to share and change the works. By contrast, | |
the GNU General Public License is intended to guarantee your freedom to | |
share and change all versions of a program--to make sure it remains free | |
software for all its users. We, the Free Software Foundation, use the | |
GNU General Public License for most of our software; it applies also to | |
any other work released this way by its authors. You can apply it to | |
your programs, too. | |
When we speak of free software, we are referring to freedom, not | |
price. Our General Public Licenses are designed to make sure that you | |
have the freedom to distribute copies of free software (and charge for | |
them if you wish), that you receive source code or can get it if you | |
want it, that you can change the software or use pieces of it in new | |
free programs, and that you know you can do these things. | |
To protect your rights, we need to prevent others from denying you | |
these rights or asking you to surrender the rights. Therefore, you have | |
certain responsibilities if you distribute copies of the software, or if | |
you modify it: responsibilities to respect the freedom of others. | |
For example, if you distribute copies of such a program, whether | |
gratis or for a fee, you must pass on to the recipients the same | |
freedoms that you received. You must make sure that they, too, receive | |
or can get the source code. And you must show them these terms so they | |
know their rights. | |
Developers that use the GNU GPL protect your rights with two steps: | |
(1) assert copyright on the software, and (2) offer you this License | |
giving you legal permission to copy, distribute and/or modify it. | |
For the developers' and authors' protection, the GPL clearly explains | |
that there is no warranty for this free software. For both users' and | |
authors' sake, the GPL requires that modified versions be marked as | |
changed, so that their problems will not be attributed erroneously to | |
authors of previous versions. | |
Some devices are designed to deny users access to install or run | |
modified versions of the software inside them, although the manufacturer | |
can do so. This is fundamentally incompatible with the aim of | |
protecting users' freedom to change the software. The systematic | |
pattern of such abuse occurs in the area of products for individuals to | |
use, which is precisely where it is most unacceptable. Therefore, we | |
have designed this version of the GPL to prohibit the practice for those | |
products. If such problems arise substantially in other domains, we | |
stand ready to extend this provision to those domains in future versions | |
of the GPL, as needed to protect the freedom of users. | |
Finally, every program is threatened constantly by software patents. | |
States should not allow patents to restrict development and use of | |
software on general-purpose computers, but in those that do, we wish to | |
avoid the special danger that patents applied to a free program could | |
make it effectively proprietary. To prevent this, the GPL assures that | |
patents cannot be used to render the program non-free. | |
The precise terms and conditions for copying, distribution and | |
modification follow. | |
TERMS AND CONDITIONS | |
0. Definitions. | |
"This License" refers to version 3 of the GNU General Public License. | |
"Copyright" also means copyright-like laws that apply to other kinds of | |
works, such as semiconductor masks. | |
"The Program" refers to any copyrightable work licensed under this | |
License. Each licensee is addressed as "you". "Licensees" and | |
"recipients" may be individuals or organizations. | |
To "modify" a work means to copy from or adapt all or part of the work | |
in a fashion requiring copyright permission, other than the making of an | |
exact copy. The resulting work is called a "modified version" of the | |
earlier work or a work "based on" the earlier work. | |
A "covered work" means either the unmodified Program or a work based | |
on the Program. | |
To "propagate" a work means to do anything with it that, without | |
permission, would make you directly or secondarily liable for | |
infringement under applicable copyright law, except executing it on a | |
computer or modifying a private copy. Propagation includes copying, | |
distribution (with or without modification), making available to the | |
public, and in some countries other activities as well. | |
To "convey" a work means any kind of propagation that enables other | |
parties to make or receive copies. Mere interaction with a user through | |
a computer network, with no transfer of a copy, is not conveying. | |
An interactive user interface displays "Appropriate Legal Notices" | |
to the extent that it includes a convenient and prominently visible | |
feature that (1) displays an appropriate copyright notice, and (2) | |
tells the user that there is no warranty for the work (except to the | |
extent that warranties are provided), that licensees may convey the | |
work under this License, and how to view a copy of this License. If | |
the interface presents a list of user commands or options, such as a | |
menu, a prominent item in the list meets this criterion. | |
1. Source Code. | |
The "source code" for a work means the preferred form of the work | |
for making modifications to it. "Object code" means any non-source | |
form of a work. | |
A "Standard Interface" means an interface that either is an official | |
standard defined by a recognized standards body, or, in the case of | |
interfaces specified for a particular programming language, one that | |
is widely used among developers working in that language. | |
The "System Libraries" of an executable work include anything, other | |
than the work as a whole, that (a) is included in the normal form of | |
packaging a Major Component, but which is not part of that Major | |
Component, and (b) serves only to enable use of the work with that | |
Major Component, or to implement a Standard Interface for which an | |
implementation is available to the public in source code form. A | |
"Major Component", in this context, means a major essential component | |
(kernel, window system, and so on) of the specific operating system | |
(if any) on which the executable work runs, or a compiler used to | |
produce the work, or an object code interpreter used to run it. | |
The "Corresponding Source" for a work in object code form means all | |
the source code needed to generate, install, and (for an executable | |
work) run the object code and to modify the work, including scripts to | |
control those activities. However, it does not include the work's | |
System Libraries, or general-purpose tools or generally available free | |
programs which are used unmodified in performing those activities but | |
which are not part of the work. For example, Corresponding Source | |
includes interface definition files associated with source files for | |
the work, and the source code for shared libraries and dynamically | |
linked subprograms that the work is specifically designed to require, | |
such as by intimate data communication or control flow between those | |
subprograms and other parts of the work. | |
The Corresponding Source need not include anything that users | |
can regenerate automatically from other parts of the Corresponding | |
Source. | |
The Corresponding Source for a work in source code form is that | |
same work. | |
2. Basic Permissions. | |
All rights granted under this License are granted for the term of | |
copyright on the Program, and are irrevocable provided the stated | |
conditions are met. This License explicitly affirms your unlimited | |
permission to run the unmodified Program. The output from running a | |
covered work is covered by this License only if the output, given its | |
content, constitutes a covered work. This License acknowledges your | |
rights of fair use or other equivalent, as provided by copyright law. | |
You may make, run and propagate covered works that you do not | |
convey, without conditions so long as your license otherwise remains | |
in force. You may convey covered works to others for the sole purpose | |
of having them make modifications exclusively for you, or provide you | |
with facilities for running those works, provided that you comply with | |
the terms of this License in conveying all material for which you do | |
not control copyright. Those thus making or running the covered works | |
for you must do so exclusively on your behalf, under your direction | |
and control, on terms that prohibit them from making any copies of | |
your copyrighted material outside their relationship with you. | |
Conveying under any other circumstances is permitted solely under | |
the conditions stated below. Sublicensing is not allowed; section 10 | |
makes it unnecessary. | |
3. Protecting Users' Legal Rights From Anti-Circumvention Law. | |
No covered work shall be deemed part of an effective technological | |
measure under any applicable law fulfilling obligations under article | |
11 of the WIPO copyright treaty adopted on 20 December 1996, or | |
similar laws prohibiting or restricting circumvention of such | |
measures. | |
When you convey a covered work, you waive any legal power to forbid | |
circumvention of technological measures to the extent such circumvention | |
is effected by exercising rights under this License with respect to | |
the covered work, and you disclaim any intention to limit operation or | |
modification of the work as a means of enforcing, against the work's | |
users, your or third parties' legal rights to forbid circumvention of | |
technological measures. | |
4. Conveying Verbatim Copies. | |
You may convey verbatim copies of the Program's source code as you | |
receive it, in any medium, provided that you conspicuously and | |
appropriately publish on each copy an appropriate copyright notice; | |
keep intact all notices stating that this License and any | |
non-permissive terms added in accord with section 7 apply to the code; | |
keep intact all notices of the absence of any warranty; and give all | |
recipients a copy of this License along with the Program. | |
You may charge any price or no price for each copy that you convey, | |
and you may offer support or warranty protection for a fee. | |
5. Conveying Modified Source Versions. | |
You may convey a work based on the Program, or the modifications to | |
produce it from the Program, in the form of source code under the | |
terms of section 4, provided that you also meet all of these conditions: | |
a) The work must carry prominent notices stating that you modified | |
it, and giving a relevant date. | |
b) The work must carry prominent notices stating that it is | |
released under this License and any conditions added under section | |
7. This requirement modifies the requirement in section 4 to | |
"keep intact all notices". | |
c) You must license the entire work, as a whole, under this | |
License to anyone who comes into possession of a copy. This | |
License will therefore apply, along with any applicable section 7 | |
additional terms, to the whole of the work, and all its parts, | |
regardless of how they are packaged. This License gives no | |
permission to license the work in any other way, but it does not | |
invalidate such permission if you have separately received it. | |
d) If the work has interactive user interfaces, each must display | |
Appropriate Legal Notices; however, if the Program has interactive | |
interfaces that do not display Appropriate Legal Notices, your | |
work need not make them do so. | |
A compilation of a covered work with other separate and independent | |
works, which are not by their nature extensions of the covered work, | |
and which are not combined with it such as to form a larger program, | |
in or on a volume of a storage or distribution medium, is called an | |
"aggregate" if the compilation and its resulting copyright are not | |
used to limit the access or legal rights of the compilation's users | |
beyond what the individual works permit. Inclusion of a covered work | |
in an aggregate does not cause this License to apply to the other | |
parts of the aggregate. | |
6. Conveying Non-Source Forms. | |
You may convey a covered work in object code form under the terms | |
of sections 4 and 5, provided that you also convey the | |
machine-readable Corresponding Source under the terms of this License, | |
in one of these ways: | |
a) Convey the object code in, or embodied in, a physical product | |
(including a physical distribution medium), accompanied by the | |
Corresponding Source fixed on a durable physical medium | |
customarily used for software interchange. | |
b) Convey the object code in, or embodied in, a physical product | |
(including a physical distribution medium), accompanied by a | |
written offer, valid for at least three years and valid for as | |
long as you offer spare parts or customer support for that product | |
model, to give anyone who possesses the object code either (1) a | |
copy of the Corresponding Source for all the software in the | |
product that is covered by this License, on a durable physical | |
medium customarily used for software interchange, for a price no | |
more than your reasonable cost of physically performing this | |
conveying of source, or (2) access to copy the | |
Corresponding Source from a network server at no charge. | |
c) Convey individual copies of the object code with a copy of the | |
written offer to provide the Corresponding Source. This | |
alternative is allowed only occasionally and noncommercially, and | |
only if you received the object code with such an offer, in accord | |
with subsection 6b. | |
d) Convey the object code by offering access from a designated | |
place (gratis or for a charge), and offer equivalent access to the | |
Corresponding Source in the same way through the same place at no | |
further charge. You need not require recipients to copy the | |
Corresponding Source along with the object code. If the place to | |
copy the object code is a network server, the Corresponding Source | |
may be on a different server (operated by you or a third party) | |
that supports equivalent copying facilities, provided you maintain | |
clear directions next to the object code saying where to find the | |
Corresponding Source. Regardless of what server hosts the | |
Corresponding Source, you remain obligated to ensure that it is | |
available for as long as needed to satisfy these requirements. | |
e) Convey the object code using peer-to-peer transmission, provided | |
you inform other peers where the object code and Corresponding | |
Source of the work are being offered to the general public at no | |
charge under subsection 6d. | |
A separable portion of the object code, whose source code is excluded | |
from the Corresponding Source as a System Library, need not be | |
included in conveying the object code work. | |
A "User Product" is either (1) a "consumer product", which means any | |
tangible personal property which is normally used for personal, family, | |
or household purposes, or (2) anything designed or sold for incorporation | |
into a dwelling. In determining whether a product is a consumer product, | |
doubtful cases shall be resolved in favor of coverage. For a particular | |
product received by a particular user, "normally used" refers to a | |
typical or common use of that class of product, regardless of the status | |
of the particular user or of the way in which the particular user | |
actually uses, or expects or is expected to use, the product. A product | |
is a consumer product regardless of whether the product has substantial | |
commercial, industrial or non-consumer uses, unless such uses represent | |
the only significant mode of use of the product. | |
"Installation Information" for a User Product means any methods, | |
procedures, authorization keys, or other information required to install | |
and execute modified versions of a covered work in that User Product from | |
a modified version of its Corresponding Source. The information must | |
suffice to ensure that the continued functioning of the modified object | |
code is in no case prevented or interfered with solely because | |
modification has been made. | |
If you convey an object code work under this section in, or with, or | |
specifically for use in, a User Product, and the conveying occurs as | |
part of a transaction in which the right of possession and use of the | |
User Product is transferred to the recipient in perpetuity or for a | |
fixed term (regardless of how the transaction is characterized), the | |
Corresponding Source conveyed under this section must be accompanied | |
by the Installation Information. But this requirement does not apply | |
if neither you nor any third party retains the ability to install | |
modified object code on the User Product (for example, the work has | |
been installed in ROM). | |
The requirement to provide Installation Information does not include a | |
requirement to continue to provide support service, warranty, or updates | |
for a work that has been modified or installed by the recipient, or for | |
the User Product in which it has been modified or installed. Access to a | |
network may be denied when the modification itself materially and | |
adversely affects the operation of the network or violates the rules and | |
protocols for communication across the network. | |
Corresponding Source conveyed, and Installation Information provided, | |
in accord with this section must be in a format that is publicly | |
documented (and with an implementation available to the public in | |
source code form), and must require no special password or key for | |
unpacking, reading or copying. | |
7. Additional Terms. | |
"Additional permissions" are terms that supplement the terms of this | |
License by making exceptions from one or more of its conditions. | |
Additional permissions that are applicable to the entire Program shall | |
be treated as though they were included in this License, to the extent | |
that they are valid under applicable law. If additional permissions | |
apply only to part of the Program, that part may be used separately | |
under those permissions, but the entire Program remains governed by | |
this License without regard to the additional permissions. | |
When you convey a copy of a covered work, you may at your option | |
remove any additional permissions from that copy, or from any part of | |
it. (Additional permissions may be written to require their own | |
removal in certain cases when you modify the work.) You may place | |
additional permissions on material, added by you to a covered work, | |
for which you have or can give appropriate copyright permission. | |
Notwithstanding any other provision of this License, for material you | |
add to a covered work, you may (if authorized by the copyright holders of | |
that material) supplement the terms of this License with terms: | |
a) Disclaiming warranty or limiting liability differently from the | |
terms of sections 15 and 16 of this License; or | |
b) Requiring preservation of specified reasonable legal notices or | |
author attributions in that material or in the Appropriate Legal | |
Notices displayed by works containing it; or | |
c) Prohibiting misrepresentation of the origin of that material, or | |
requiring that modified versions of such material be marked in | |
reasonable ways as different from the original version; or | |
d) Limiting the use for publicity purposes of names of licensors or | |
authors of the material; or | |
e) Declining to grant rights under trademark law for use of some | |
trade names, trademarks, or service marks; or | |
f) Requiring indemnification of licensors and authors of that | |
material by anyone who conveys the material (or modified versions of | |
it) with contractual assumptions of liability to the recipient, for | |
any liability that these contractual assumptions directly impose on | |
those licensors and authors. | |
All other non-permissive additional terms are considered "further | |
restrictions" within the meaning of section 10. If the Program as you | |
received it, or any part of it, contains a notice stating that it is | |
governed by this License along with a term that is a further | |
restriction, you may remove that term. If a license document contains | |
a further restriction but permits relicensing or conveying under this | |
License, you may add to a covered work material governed by the terms | |
of that license document, provided that the further restriction does | |
not survive such relicensing or conveying. | |
If you add terms to a covered work in accord with this section, you | |
must place, in the relevant source files, a statement of the | |
additional terms that apply to those files, or a notice indicating | |
where to find the applicable terms. | |
Additional terms, permissive or non-permissive, may be stated in the | |
form of a separately written license, or stated as exceptions; | |
the above requirements apply either way. | |
8. Termination. | |
You may not propagate or modify a covered work except as expressly | |
provided under this License. Any attempt otherwise to propagate or | |
modify it is void, and will automatically terminate your rights under | |
this License (including any patent licenses granted under the third | |
paragraph of section 11). | |
However, if you cease all violation of this License, then your | |
license from a particular copyright holder is reinstated (a) | |
provisionally, unless and until the copyright holder explicitly and | |
finally terminates your license, and (b) permanently, if the copyright | |
holder fails to notify you of the violation by some reasonable means | |
prior to 60 days after the cessation. | |
Moreover, your license from a particular copyright holder is | |
reinstated permanently if the copyright holder notifies you of the | |
violation by some reasonable means, this is the first time you have | |
received notice of violation of this License (for any work) from that | |
copyright holder, and you cure the violation prior to 30 days after | |
your receipt of the notice. | |
Termination of your rights under this section does not terminate the | |
licenses of parties who have received copies or rights from you under | |
this License. If your rights have been terminated and not permanently | |
reinstated, you do not qualify to receive new licenses for the same | |
material under section 10. | |
9. Acceptance Not Required for Having Copies. | |
You are not required to accept this License in order to receive or | |
run a copy of the Program. Ancillary propagation of a covered work | |
occurring solely as a consequence of using peer-to-peer transmission | |
to receive a copy likewise does not require acceptance. However, | |
nothing other than this License grants you permission to propagate or | |
modify any covered work. These actions infringe copyright if you do | |
not accept this License. Therefore, by modifying or propagating a | |
covered work, you indicate your acceptance of this License to do so. | |
10. Automatic Licensing of Downstream Recipients. | |
Each time you convey a covered work, the recipient automatically | |
receives a license from the original licensors, to run, modify and | |
propagate that work, subject to this License. You are not responsible | |
for enforcing compliance by third parties with this License. | |
An "entity transaction" is a transaction transferring control of an | |
organization, or substantially all assets of one, or subdividing an | |
organization, or merging organizations. If propagation of a covered | |
work results from an entity transaction, each party to that | |
transaction who receives a copy of the work also receives whatever | |
licenses to the work the party's predecessor in interest had or could | |
give under the previous paragraph, plus a right to possession of the | |
Corresponding Source of the work from the predecessor in interest, if | |
the predecessor has it or can get it with reasonable efforts. | |
You may not impose any further restrictions on the exercise of the | |
rights granted or affirmed under this License. For example, you may | |
not impose a license fee, royalty, or other charge for exercise of | |
rights granted under this License, and you may not initiate litigation | |
(including a cross-claim or counterclaim in a lawsuit) alleging that | |
any patent claim is infringed by making, using, selling, offering for | |
sale, or importing the Program or any portion of it. | |
11. Patents. | |
A "contributor" is a copyright holder who authorizes use under this | |
License of the Program or a work on which the Program is based. The | |
work thus licensed is called the contributor's "contributor version". | |
A contributor's "essential patent claims" are all patent claims | |
owned or controlled by the contributor, whether already acquired or | |
hereafter acquired, that would be infringed by some manner, permitted | |
by this License, of making, using, or selling its contributor version, | |
but do not include claims that would be infringed only as a | |
consequence of further modification of the contributor version. For | |
purposes of this definition, "control" includes the right to grant | |
patent sublicenses in a manner consistent with the requirements of | |
this License. | |
Each contributor grants you a non-exclusive, worldwide, royalty-free | |
patent license under the contributor's essential patent claims, to | |
make, use, sell, offer for sale, import and otherwise run, modify and | |
propagate the contents of its contributor version. | |
In the following three paragraphs, a "patent license" is any express | |
agreement or commitment, however denominated, not to enforce a patent | |
(such as an express permission to practice a patent or covenant not to | |
sue for patent infringement). To "grant" such a patent license to a | |
party means to make such an agreement or commitment not to enforce a | |
patent against the party. | |
If you convey a covered work, knowingly relying on a patent license, | |
and the Corresponding Source of the work is not available for anyone | |
to copy, free of charge and under the terms of this License, through a | |
publicly available network server or other readily accessible means, | |
then you must either (1) cause the Corresponding Source to be so | |
available, or (2) arrange to deprive yourself of the benefit of the | |
patent license for this particular work, or (3) arrange, in a manner | |
consistent with the requirements of this License, to extend the patent | |
license to downstream recipients. "Knowingly relying" means you have | |
actual knowledge that, but for the patent license, your conveying the | |
covered work in a country, or your recipient's use of the covered work | |
in a country, would infringe one or more identifiable patents in that | |
country that you have reason to believe are valid. | |
If, pursuant to or in connection with a single transaction or | |
arrangement, you convey, or propagate by procuring conveyance of, a | |
covered work, and grant a patent license to some of the parties | |
receiving the covered work authorizing them to use, propagate, modify | |
or convey a specific copy of the covered work, then the patent license | |
you grant is automatically extended to all recipients of the covered | |
work and works based on it. | |
A patent license is "discriminatory" if it does not include within | |
the scope of its coverage, prohibits the exercise of, or is | |
conditioned on the non-exercise of one or more of the rights that are | |
specifically granted under this License. You may not convey a covered | |
work if you are a party to an arrangement with a third party that is | |
in the business of distributing software, under which you make payment | |
to the third party based on the extent of your activity of conveying | |
the work, and under which the third party grants, to any of the | |
parties who would receive the covered work from you, a discriminatory | |
patent license (a) in connection with copies of the covered work | |
conveyed by you (or copies made from those copies), or (b) primarily | |
for and in connection with specific products or compilations that | |
contain the covered work, unless you entered into that arrangement, | |
or that patent license was granted, prior to 28 March 2007. | |
Nothing in this License shall be construed as excluding or limiting | |
any implied license or other defenses to infringement that may | |
otherwise be available to you under applicable patent law. | |
12. No Surrender of Others' Freedom. | |
If conditions are imposed on you (whether by court order, agreement or | |
otherwise) that contradict the conditions of this License, they do not | |
excuse you from the conditions of this License. If you cannot convey a | |
covered work so as to satisfy simultaneously your obligations under this | |
License and any other pertinent obligations, then as a consequence you may | |
not convey it at all. For example, if you agree to terms that obligate you | |
to collect a royalty for further conveying from those to whom you convey | |
the Program, the only way you could satisfy both those terms and this | |
License would be to refrain entirely from conveying the Program. | |
13. Use with the GNU Affero General Public License. | |
Notwithstanding any other provision of this License, you have | |
permission to link or combine any covered work with a work licensed | |
under version 3 of the GNU Affero General Public License into a single | |
combined work, and to convey the resulting work. The terms of this | |
License will continue to apply to the part which is the covered work, | |
but the special requirements of the GNU Affero General Public License, | |
section 13, concerning interaction through a network will apply to the | |
combination as such. | |
14. Revised Versions of this License. | |
The Free Software Foundation may publish revised and/or new versions of | |
the GNU General Public License from time to time. Such new versions will | |
be similar in spirit to the present version, but may differ in detail to | |
address new problems or concerns. | |
Each version is given a distinguishing version number. If the | |
Program specifies that a certain numbered version of the GNU General | |
Public License "or any later version" applies to it, you have the | |
option of following the terms and conditions either of that numbered | |
version or of any later version published by the Free Software | |
Foundation. If the Program does not specify a version number of the | |
GNU General Public License, you may choose any version ever published | |
by the Free Software Foundation. | |
If the Program specifies that a proxy can decide which future | |
versions of the GNU General Public License can be used, that proxy's | |
public statement of acceptance of a version permanently authorizes you | |
to choose that version for the Program. | |
Later license versions may give you additional or different | |
permissions. However, no additional obligations are imposed on any | |
author or copyright holder as a result of your choosing to follow a | |
later version. | |
15. Disclaimer of Warranty. | |
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | |
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | |
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | |
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | |
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | |
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | |
ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |
16. Limitation of Liability. | |
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | |
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | |
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | |
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | |
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | |
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | |
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | |
SUCH DAMAGES. | |
17. Interpretation of Sections 15 and 16. | |
If the disclaimer of warranty and limitation of liability provided | |
above cannot be given local legal effect according to their terms, | |
reviewing courts shall apply local law that most closely approximates | |
an absolute waiver of all civil liability in connection with the | |
Program, unless a warranty or assumption of liability accompanies a | |
copy of the Program in return for a fee. | |
END OF TERMS AND CONDITIONS | |
How to Apply These Terms to Your New Programs | |
If you develop a new program, and you want it to be of the greatest | |
possible use to the public, the best way to achieve this is to make it | |
free software which everyone can redistribute and change under these terms. | |
To do so, attach the following notices to the program. It is safest | |
to attach them to the start of each source file to most effectively | |
state the exclusion of warranty; and each file should have at least | |
the "copyright" line and a pointer to where the full notice is found. | |
<one line to give the program's name and a brief idea of what it does.> | |
Copyright (C) <year> <name of author> | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License | |
along with this program. If not, see <http://www.gnu.org/licenses/>. | |
Also add information on how to contact you by electronic and paper mail. | |
If the program does terminal interaction, make it output a short | |
notice like this when it starts in an interactive mode: | |
<program> Copyright (C) <year> <name of author> | |
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | |
This is free software, and you are welcome to redistribute it | |
under certain conditions; type `show c' for details. | |
The hypothetical commands `show w' and `show c' should show the appropriate | |
parts of the General Public License. Of course, your program's commands | |
might be different; for a GUI interface, you would use an "about box". | |
You should also get your employer (if you work as a programmer) or school, | |
if any, to sign a "copyright disclaimer" for the program, if necessary. | |
For more information on this, and how to apply and follow the GNU GPL, see | |
<http://www.gnu.org/licenses/>. | |
The GNU General Public License does not permit incorporating your program | |
into proprietary programs. If your program is a subroutine library, you | |
may consider it more useful to permit linking proprietary applications with | |
the library. If this is what you want to do, use the GNU Lesser General | |
Public License instead of this License. But first, please read | |
<http://www.gnu.org/philosophy/why-not-lgpl.html>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# pdl-idler.sh (0.86) | |
# Copyright (c) 2011-2013 byteframe@primarydataloop | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/> | |
# change the present working directory to that of this script | |
DIR="$( cd "$( dirname "$0" )" && pwd )" | |
if [ -L "${DIR}" ]; then | |
DIR=$(readlink "${DIR}") | |
fi | |
cd "${DIR}" | |
# force bash shell to run this script | |
if [ $(readlink "/proc/$$/exe" | sed "s/.*\///") != bash ]; then | |
echo "[$(date +%H:%M:%S)] warning, only bash is supported as the shell {*}" | |
exec bash pdl-idler.sh $* | |
fi | |
function print() | |
{ | |
# output with an optional right-aligned argument and padding | |
unset PAD RIGHT | |
if [ ! -z "${2}" ]; then | |
RIGHT="${2}" | |
if [ ! -z ${3} ]; then | |
WIDTH=${3} | |
else | |
WIDTH=$(expr length "${2}") | |
fi | |
let PAD=$(($(tput cols)-$(expr length "${1}")-${WIDTH}))-1 | |
fi | |
printf "${1}%${PAD}s${RIGHT:0:${WIDTH}}\n" | |
} | |
function tprint() | |
{ | |
# print with a timestamp | |
if [ ! -z "${2}" ]; then | |
RIGHT="|${2}" | |
else | |
unset RIGHT | |
fi | |
LENGTH=$(($(expr length "${1}")+$(expr length "${RIGHT}"))) | |
if (($(tput cols)-13 < LENGTH)); then | |
print "[$(date +%H:%M:%S)] <${1:$((LENGTH-(($(tput cols)-13))+1))}" \ | |
"${RIGHT}" ${3} | |
else | |
print "[$(date +%H:%M:%S)] ${1}" "${RIGHT}" ${3} | |
fi | |
} | |
# make sure the present working directory is writable | |
if [ ! -w . ]; then | |
tprint "fatal, pwd is unwriteable {"'!}' $(pwd) | |
exit 1 | |
fi | |
# do not allow root to run this script | |
if [ $(whoami) = root ]; then | |
tprint "fatal: cannot be run as root {"'!}' | |
exit 1 | |
fi | |
# check dependencies | |
for DEP in bash bc glxinfo nc screen sudo wget xdotool Xvfb; do | |
if ! which ${DEP} > /dev/null 2>&1; then | |
tprint "fatal, missing dependency '${DEP}' {"'!}' | |
exit 1 | |
fi | |
done | |
if [[ $(wine --version 2> /dev/null) != wine-1.[7-9]* ]] \ | |
|| [[ $(wine --version 2> /dev/null) = wine-1.7.[0-7] ]]; then | |
tprint "fatal, wine is not installed or is too old {"'!}' wine\<1.7.8 | |
exit 1 | |
fi | |
function steam_uid() | |
{ | |
# get steam user id from config.vdf or cred backup | |
GET=${ACCT} | |
if [ ! -z ${1} ]; then | |
GET=${1} | |
fi | |
CONFIGVDF="${DIR}"/wine-${GET}/drive_c/Program\ Files/Steam/config/config.vdf | |
CREDFILE="${DIR}"/cred/cred-${GET}_ | |
if ! grep SteamID "${CONFIGVDF}" 2> /dev/null | grep -o \[0-9]* \ | |
&& ! grep SteamID "${CREDFILE}"* 2> /dev/null | grep -o \[0-9]* ; then | |
echo 765611----------- | |
return 1 | |
fi | |
} | |
function download() | |
{ | |
# download a file | |
unset TARGET | |
if [ ! -z "${2}" ]; then | |
if [ -d "${2}" ]; then | |
TARGET="${2}/${1##*/}" | |
else | |
TARGET="${2}" | |
fi | |
else | |
TARGET="${1##*/}" | |
fi | |
if ! wget -q ${1} -O "${TARGET}"; then | |
tprint "error, file download failed {"'!}' ${TARGET##*/} | |
rm -f "${TARGET}" | |
return 1 | |
fi | |
} | |
function steam_connect_hash() | |
{ | |
# get last 6 characters of the current or backup connection cache | |
local FILE="${STEAM}"/config/config.vdf | |
if [ ! -z ${1} ]; then | |
FILE=cred/cred-${ACCT}_$(basename "${STEAM}"/userdata/*) | |
fi | |
local HASH=$(cat "${FILE}" 2> /dev/null | tr -d '[:blank:]' \ | |
| tr -d '\n'| grep -o \"ConnectCache\"{\"[a-f0-9]*\"\"[a-f0-9]* | tail -c7) | |
if [ -z ${HASH} ]; then | |
HASH=------ | |
fi | |
echo \#${HASH} | |
} | |
function version() | |
{ | |
# parse version string | |
if [ ! -z ${1} ]; then | |
echo v${1} | |
else | |
echo none | |
return 1 | |
fi | |
} | |
function steam_ui_version() | |
{ | |
# get steam ui version of the installed prefix | |
version $(cat "${WINEPREFIX}"/.ui.pdl 2> /dev/null | sed -e "s/^v//") | |
} | |
function steam_ui_web_version() | |
{ | |
# get steam ui version from manifest file on valve cdn | |
version $(wget -qO- http://media.steampowered.com/client/steam_client_win32 \ | |
| grep version | grep -o \[0-9]*) | |
} | |
function steam_pid() | |
{ | |
# get pid of steam process with an optional command line string | |
pgrep -fn "wine-${ACCT}/.*steam\.exe.*${1}" | |
} | |
function kill_defunct_hl2() | |
{ | |
# kill defunct hl2 processess | |
for HPID in $(pgrep -fx hl2\.exe); do | |
tprint "error, killing defunct hl2 process... {"'!}' @${HPID} >&2 | |
kill -9 ${HPID} 2> /dev/null | |
while ps ${HPID} > /dev/null; do | |
pause 0.25 | |
done | |
done | |
} | |
function hl2_pid() | |
{ | |
# kill defunct processes then get pid of hl2 with optional command line string | |
kill_defunct_hl2 | |
pgrep -fn "hl2\.exe.*${1}.*${ACCT//./}\+" | |
} | |
function dcat() | |
{ | |
# read a file forwards or backwards negating dos newlines | |
if [ ! -z ${2} ]; then | |
tac "${1}" | sed 's/\r$//' | |
else | |
cat "${1}" | sed 's/\r$//' | |
fi | |
} | |
function client_map() | |
{ | |
# get map load status of client | |
if hl2_pid > /dev/null && dcat "${CON}" y \ | |
| grep -m 1 ": Disconnect\|: Compact freed" | grep -q Compact; then | |
echo $(dcat "${CON}" y | grep -m 1 ^Map: | grep -o \ .*) | |
return 0 | |
fi | |
return 1 | |
} | |
function client_connection() | |
{ | |
# get connection time and status of client | |
if hl2_pid > /dev/null; then | |
TIME=$(($(date +%s)-$(date -d "$(dcat "${CON}" y \ | |
| grep -m 1 ': Disconnect\|: Connected to\|: Compact freed' \ | |
| sed -e 's/: .*//' -e 's/ - / /')" +%s))) | |
TIME=$(echo - | awk \ | |
'{printf "%02d:%02d",'${TIME}'/(60*60),'${TIME}'%(60*60)/60}')\| | |
if dcat "${CON}" y | grep -m 1 ": Disconnect\|: Connected to\| connected" \ | |
| grep -q Disconnect; then | |
echo ${TIME} Disconnect | |
return 1 | |
fi | |
IP=$(dcat "${CON}" y | grep -m 1 ": Disconnect\|: Connected to" \ | |
| grep -o Connected\ to.* | grep -o \[0-9.:]*) | |
if [ -z ${IP} ]; then | |
IP=Listen | |
fi | |
echo ${TIME} ${IP} | |
fi | |
} | |
function window_id() | |
{ | |
# get id of a named window | |
SPID=$(steam_pid) | |
POSITION=1 | |
if [ ! -z ${SPID} ]; then | |
for ID in $(xwininfo -all -root -children 2> /dev/null \ | |
| grep "${1}.*: (\"steam\.exe" | awk '{print $1}'); do | |
PID=$(xprop -id ${ID} 2> /dev/null | grep PID | awk '{print $3}') | |
if [ "${PID}" = ${SPID} ]; then | |
if [ "${2}" = atom ] \ | |
&& ! xprop -id ${ID} 2> /dev/null | grep -q "_WM_STATE(ATOM)"; then | |
continue | |
elif [ "${2}" = bitmap ] \ | |
&& ! xprop -id ${ID} 2> /dev/null | grep -q "bitmap id"; then | |
continue | |
elif [ "${2}" = opacity ] \ | |
&& xprop -id ${ID} 2> /dev/null | grep -q "_OPACITY"; then | |
continue | |
elif [ "${2}" = viewable ] \ | |
&& ! xwininfo -id ${ID} 2> /dev/null | grep -q "IsViewable"; then | |
continue | |
elif [[ "${2}" = [0-9]* ]] && [ ${POSITION} != ${2} ]; then | |
let POSITION+=1 | |
continue | |
fi | |
echo ${ID} | |
return 0 | |
fi | |
done | |
fi | |
return 1 | |
} | |
function idler_list() | |
{ | |
# print listing with item counts, steamid, connect hash, versions, and status | |
unset LINE ITEM | |
if steam_uid > /dev/null; then | |
if [ "${1}" != no ]; then | |
WGET=$(find -L cred -maxdepth 1 -name .tf2b-${ACCT} -mmin -5) | |
if [ "${1}" = yes ] || [ -z ${WGET} ]; then | |
cd / | |
download tf2b.com/tf2/txt/$(steam_uid) \ | |
"${DIR}"/cred/.tf2b-${ACCT} > /dev/null | |
download steamcommunity.com/profiles/$(steam_uid) \ | |
"${DIR}"/cred/.profile-${ACCT} > /dev/null | |
cd "${DIR}" | |
fi | |
fi | |
WGET=$(cat cred/.tf2b-${ACCT} 2> /dev/null | grep -o \<body\>.*) | |
if [ -z "${WGET}" ] || echo ${WGET} | grep -q Something\ broke; then | |
LINE='!'\|? | |
unset WGET | |
rm -f cred/.tf2b-${ACCT} | |
elif echo ${WGET} | grep -q backpack\ is\ private; then | |
LINE=?\|? | |
else | |
ITEM=$(echo ${WGET} | grep -o \[0-9][0-9]*/[0-9][0-9]* | sed "s/\/.*//") | |
if [ ! -z ${ITEM} ]; then | |
CRATE=$(echo ${WGET} | grep -o ">Mann Co. Supply Crate</td><td>[0-9]*" \ | |
| grep -o \[0-9]*$) | |
let ITEM=ITEM-CRATE | |
if [ -z ${CRATE} ]; then | |
CRATE=_ | |
fi | |
if ((ITEM<9)); then | |
ITEM=_${ITEM} | |
fi | |
LINE="${ITEM}|${CRATE}" | |
else | |
LINE=_0\|_ | |
fi | |
fi | |
fi | |
LINE="${LINE} @$(steam_uid) [$(steam_connect_hash)]" | |
if ! steam_uid > /dev/null; then | |
LINE="${LINE} not_initiated |" | |
elif ! steam_ui_version > /dev/null; then | |
LINE="${LINE} not_installed |" | |
else | |
if [ -z ${UI_WEB} ]; then | |
UI_WEB=$(steam_ui_web_version) | |
fi | |
if [ $(steam_ui_version) != ${UI_WEB} ]; then | |
LINE="${LINE} <$(steam_ui_version | sed s/v//g)" | |
else | |
LINE="${LINE} ^$(steam_ui_version | sed s/v//g)" | |
fi | |
LINE="${LINE}p$(cat "${WINEPREFIX}"/.prefix.pdl) |" | |
fi | |
if ! steam_pid > /dev/null; then | |
LINE="${LINE}--" | |
else | |
if client_map > /dev/null; then | |
LINE="${LINE}G" | |
elif client_connection > /dev/null; then | |
LINE="${LINE}C" | |
elif hl2_pid > /dev/null; then | |
LINE="${LINE}S" | |
else | |
LINE="${LINE}A" | |
fi | |
if window_id Group\ Chat opacity > /dev/null; then | |
LINE="${LINE}C" | |
elif ! grep -q "\"PersonaStateDesired\".*\"0\"" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf; then | |
LINE="${LINE}O" | |
else | |
LINE="${LINE}-" | |
fi | |
fi | |
print ${ACCT:0:$(($(tput cols)-$(expr length "${LINE}")-2))} "${LINE}" | |
} | |
function pause() | |
{ | |
# wait for a specified period with a blocking read call | |
PAUSE=1 | |
if [ ! -z ${1} ]; then | |
PAUSE=${1} | |
fi | |
read -d \\ -s -t ${PAUSE} | |
return 0 | |
} | |
function memory() | |
{ | |
# get memory usage of a process via pid | |
MEMORY=$(grep RSS /proc/${1}/status 2> /dev/null | grep -o \[0-9]*) | |
if [ ! -z ${MEMORY} ]; then | |
printf "%02dmb\n" $((${MEMORY} / 1024)) | |
else | |
echo 00mb | |
fi | |
} | |
function steam_memory() | |
{ | |
# get memory usage of steam process | |
memory $(steam_pid) | |
} | |
function hl2_memory() | |
{ | |
# get memory usage of hl2 process | |
memory $(hl2_pid) | |
} | |
function both_memory() | |
{ | |
# get memory usage of steam and hl2 | |
STM=$(steam_memory) | |
if hl2_pid > /dev/null; then | |
STM=$(steam_memory | sed "s/mb//") | |
HL2=/$(hl2_memory) | |
else | |
unset HL2 | |
fi | |
echo ${STM}${HL2} | |
} | |
function cmd() | |
{ | |
# run a client console command | |
if hl2_pid -pdl > /dev/null; then | |
echo -e "${1}\nwriteip" > "${TF}"/cfg/cmd-${ACCT//./}.cfg | |
while ! grep -q addip "${TF}"/cfg/cmd-${ACCT//./}.cfg; do | |
pause 0.2 | |
let CMD_TIMEOUT+=1 | |
if [ ${CMD_TIMEOUT} = 180 ]; then | |
tprint "${ACCT}: error, command failed {"'!}' X,$(both_memory) | |
return 1 | |
fi | |
done | |
echo "//${1}" > "${TF}"/cfg/cmd-${ACCT//./}.cfg | |
else | |
TIME=$(date +%s)${RANDOM} | |
echo -e "alias cmnd \"alias cmnd;${1};echo b${TIME}\"\necho a${TIME}" \ | |
> "${TF}"/cfg/cmd-${ACCT//./}.cfg | |
while ! dcat "${CON}" y | grep -q a${TIME}; do | |
pause 0.2 | |
let CMD_TIMEOUT+=1 | |
if [ ${CMD_TIMEOUT} = 180 ]; then | |
tprint "${ACCT}: error, command failed {"'!}' A,$(both_memory) | |
return 1 | |
fi | |
done | |
echo -e "//$(head -1 "${TF}"/cfg/cmd-${ACCT//./}.cfg)\ncmnd" \ | |
> "${TF}"/cfg/cmd-${ACCT//./}.cfg | |
CMD_TIMEOUT=0 | |
while ! dcat "${CON}" y | grep -q b${TIME}; do | |
pause 0.2 | |
let CMD_TIMEOUT+=1 | |
if [ ${CMD_TIMEOUT} = 180 ]; then | |
tprint "${ACCT}: error, command failed {"'!}' B,$(both_memory) | |
return 1 | |
fi | |
done | |
fi | |
return 0 | |
} | |
function idler_backpack() | |
{ | |
# list then detail backpack contents | |
idler_list ${1} || return 1 | |
if [ ! -z ${ITEM} ]; then | |
for WORD in $(echo ${WGET} | sed -e "s/ /_/g" -e 's/<[^>]*>/ /g'); do | |
if [ ${WORD} != \# ] && [ ${WORD} != " " ]; then | |
if echo ${WORD} | grep -qi items; then | |
if [[ ${WORD} = Genuine_* ]]; then | |
TYPE=G. | |
elif [[ ${WORD} = Haunted_* ]]; then | |
TYPE=H. | |
elif [[ ${WORD} = Strange_* ]]; then | |
TYPE=S. | |
elif [[ ${WORD} = Vintage_* ]]; then | |
TYPE=V. | |
elif [[ ${WORD} = Unusual_* ]]; then | |
TYPE=U. | |
else | |
unset TYPE | |
fi | |
elif [[ ${WORD} = [0-9]* ]]; then | |
print "" "${TYPE}${NAME} (x${WORD})" 46 | |
elif [[ ${WORD} = *[a-zA-Z]* ]]; then | |
NAME=$(echo ${WORD} | sed "s/_/ /g") | |
fi | |
fi | |
done | |
print "" {$(echo ${WGET} | grep -o \[0-9][0-9]*/[0-9][0-9]*)} 46 | |
elif [ -z "${WGET}" ]; then | |
print "" "{website error}" 46 | |
else | |
print "" "{backpack empty}" 46 | |
fi | |
} | |
function server_playercount() | |
{ | |
# get player count of an idle server via the port | |
if [ -e srcds/tf/con-2810${1:(-1)}.log ]; then | |
dcat srcds/tf/con-2810${1:(-1)}.log y | grep -o -m 1 Players\:.* \ | |
| grep -o \[0-9]* | |
else | |
echo 0 | |
fi | |
} | |
function server_memory() | |
{ | |
# get memory usage of a server process via port number | |
memory $(pgrep -f srcds_linux.*2810${1:(-1)}) | |
} | |
function stop_server() | |
{ | |
# stop or kill a server via port number | |
tprint "stopping server..." \ | |
\#${1:(-1)},@$(pgrep -f srcds_linux.*2810${1:(-1)}),$(server_memory ${1}) | |
screen -S idler-server${1:(-1)} -p 0 -X stuff \ | |
"pdl$(printf \\r)quit$(printf \\r)" | |
STOP_SERVER_TIMEOUT=0 | |
while pgrep -f srcds_linux.*2810${1:(-1)} > /dev/null; do | |
pause | |
let STOP_SERVER_TIMEOUT+=1 | |
if [ ${STOP_SERVER_TIMEOUT} = 20 ]; then | |
SRCDS=$(pgrep -f srcds_linux.*2810${1:(-1)}) | |
tprint "warning, killing server..." \ | |
\#${1:(-1)},@${SRCDS},$(server_memory ${1}) | |
kill -9 $(pgrep -f srcds_linux.*2810${1:(-1)}) | |
fi | |
done | |
} | |
function client_fps() | |
{ | |
# get last or default client fps | |
if [ -z ${1} ]; then | |
dcat "${CON}" y | grep -om 1 :\ fps.* | grep -o \[0-9]* | |
else | |
cat "${WINEPREFIX}"/.fps.pdl | |
fi | |
} | |
function change_client_fps() | |
{ | |
# change client fps | |
tprint "${ACCT}: changing fps..." $(client_fps)\>${1}fps,$(both_memory) | |
{ | |
echo "alias _acmd"$(client_fps) | |
echo "alias _acmd${1} \"exec cmd-${ACCT//./};wait $((${1}*4));_acmd${1}\"" | |
echo "fps_max \"${1}\"" | |
echo "_acmd${1}" | |
echo "echo \"fps${1}\"" | |
} > "${TF}"/cfg/fps-${ACCT//./}.cfg | |
cmd "exec fps-${ACCT//./}" | |
} | |
function net_address() | |
{ | |
# get host network address | |
echo $(ip route get 8.8.8.8 | awk '{print $7}') | |
} | |
function idler_disconnect() | |
{ | |
# disconnect client from server | |
if hl2_pid > /dev/null; then | |
if client_connection > /dev/null; then | |
CONNECTION=$(client_connection) | |
if [[ ${CONNECTION} = *$(net_address):2810[0-9] ]]; then | |
OPTS=\#${CONNECTION:(-1)} | |
OPTS={$(server_playercount ${CONNECTION:(-1)})/$((IDLE_MAX+1))},${OPTS} | |
tprint "${ACCT}: disconnecting..." \ | |
${OPTS},${CONNECTION:0:5},$(both_memory) | |
else | |
tprint "${ACCT}: disconnecting..." ${CONNECTION:0:5},$(both_memory) | |
fi | |
cmd "mmute;disconnect" || return 1 | |
cmd "echo Disconnect" | |
# if connected to an idle server close it if empty | |
if [[ ${CONNECTION} = *$(net_address):2810[0-9] ]] \ | |
&& [ -z ${1} ] && [ $(server_playercount ${CONNECTION:(-1)}) = 0 ]; then | |
stop_server ${CONNECTION:(-1)} | |
fi | |
fi | |
# raise fps if needed and if not reconnecting | |
if [ $(client_fps) = 1 ] && ! hl2_pid noshaderapi > /dev/null \ | |
&& [ -z ${1} ]; then | |
change_client_fps $(client_fps y) | |
fi | |
fi | |
} | |
function idler_stop() | |
{ | |
# disconnect and/or quit or kill client process | |
if hl2_pid > /dev/null; then | |
if [ "${1}" = yes ]; then | |
STOP_TIMEOUT=121 | |
tprint "${ACCT}: killing client..." @$(hl2_pid),$(both_memory) | |
else | |
STOP_TIMEOUT=120 | |
if idler_disconnect; then | |
tprint "${ACCT}: quitting client..." @$(hl2_pid),$(both_memory) | |
STOP_TIMEOUT=0 | |
echo quit > "${TF}"/cfg/cmd-${ACCT//./}.cfg | |
fi | |
fi | |
while hl2_pid > /dev/null; do | |
pause | |
if [ ${STOP_TIMEOUT} = 120 ]; then | |
tprint "${ACCT}: warning, killing client... {*}" $(both_memory) | |
elif [ ${STOP_TIMEOUT} = 121 ]; then | |
HL2_PID=$(hl2_pid) | |
kill -9 ${HL2_PID} | |
while ps ${HL2_PID} > /dev/null; do | |
pause 0.25 | |
done | |
fi | |
let STOP_TIMEOUT+=1 | |
done | |
echo // > "${TF}"/cfg/cmd-${ACCT//./}.cfg | |
fi | |
} | |
function app_state() | |
{ | |
# get steam application state string | |
if [ -z ${1} ]; then | |
APP=440 | |
fi | |
dcat "${STEAM}"/logs/content_log.txt y \ | |
| grep -m 1 "AppID ${APP} state changed" | sed "s/.*= //" | |
} | |
function wait_for_stop() | |
{ | |
# wait for steam if it still registers tf2 as running | |
while app_state | grep -q ,App\ Running,$; do | |
pause | |
done | |
} | |
function wine_run() | |
{ | |
# execute a program with wine and surpress the call output | |
wine "$@" > /dev/null 2>&1 | |
} | |
function backup_credentials() | |
{ | |
# update credential backup | |
if [ -e "${STEAM}"/config/config.vdf ] \ | |
&& [ $(steam_connect_hash) != $(steam_connect_hash y) ]; then | |
{ | |
cat "${STEAM}"/config/config.vdf | tr -d '[:blank:]' | tr -d '\n' \ | |
| grep -o \"MTBF\"\"[0-9]*\" | |
cat "${STEAM}"/config/config.vdf | tr -d '[:blank:]' | tr -d '\n' \ | |
| grep -o \"ConnectCache\"{\"[a-f0-9]*\"\"[a-f0-9]*\"} | |
cat "${STEAM}"/config/config.vdf | grep SteamID | |
} > cred/cred-${ACCT}_$(basename "${STEAM}"/userdata/*) | |
fi | |
} | |
function xserver_pid() | |
{ | |
# get pid of an X server process by its display id | |
if [ -e /tmp/.X${1:1:1}-lock ]; then | |
echo $(cat /tmp/.X${1:1:1}-lock) | |
else | |
return 1 | |
fi | |
} | |
function stop_xserver() | |
{ | |
# stop xserver/x11vnc via display id | |
if [ $(xserver_pid ${1}) = "$(cat .x${1:1:1}.pid 2> /dev/null)" ]; then | |
unset TYPE X11VNC | |
SERVER=X | |
if [ ${1} != ${X_DISPLAY} ]; then | |
TYPE=farm, | |
SERVER=Xvfb | |
fi | |
TYPE=${TYPE}${1}, | |
if pgrep -fn x11vnc\ -display\ ${1/.*} > /dev/null; then | |
X11VNC=" + x11vnc" | |
kill $(pgrep -fn x11vnc\ -display\ ${1/.*}) | |
fi | |
tprint "stopping ${SERVER}${X11VNC}..." ${TYPE}@$(xserver_pid ${1}) >&2 | |
while pgrep -n wineserver.*${TYPE:0:(-1)}${1:1:1} > /dev/null; do | |
pause | |
done | |
kill $(xserver_pid ${1}) | |
while [ -e /tmp/.X${1:1:1}-lock ]; do | |
pause | |
done | |
fi | |
rm -f .x${1:1:1}.pid idler-helper${1:1:1}.sh | |
} | |
function idler_logout() | |
{ | |
# stop, logout/kill steam, backup creds, stop X if able, then remove write dir | |
if steam_pid > /dev/null; then | |
idler_stop ${1} | |
if [ "${1}" = yes ]; then | |
LOGOUT_TIMEOUT=121 | |
tprint "${ACCT}: killing steam..." @$(steam_pid),$(steam_memory) | |
else | |
unset FINISH | |
LOGOUT_TIMEOUT=0 | |
tprint "${ACCT}: logging out..." @$(steam_pid),$(steam_memory) | |
wait_for_stop | |
wine_run "${STEAM}"/steam.exe -shutdown | |
fi | |
while steam_pid > /dev/null; do | |
pause | |
if [ -z ${FINISH} ] && [ ${LOGOUT_TIMEOUT} = 5 ] \ | |
&& window_id Shutdown bitmap > /dev/null; then | |
FINISH=yes | |
if app_state | grep -q ",Update Stopping,\|(Suspended)"; then | |
tprint "${ACCT}: warning, download stopping... {*}" $(steam_memory) | |
else | |
tprint "${ACCT}: warning, cloud sync finish... {*}" $(steam_memory) | |
fi | |
fi | |
if [ ${LOGOUT_TIMEOUT} = 120 ]; then | |
tprint "${ACCT}: warning, killing steam... {*}" $(steam_memory) | |
elif [ ${LOGOUT_TIMEOUT} = 121 ]; then | |
kill -9 $(steam_pid) | |
fi | |
let LOGOUT_TIMEOUT+=1 | |
done | |
backup_credentials | |
rm -f cred/.host-${ACCT} .host-${ACCT} | |
OPTS="steam\.exe" | |
if [ -z ${2} ] && [ ${DISPLAY} != ${X_DISPLAY} ] && ! pgrep -fn \ | |
"${OPTS}.*main${DISPLAY:1:1}-|${OPTS}.*farm${DISPLAY:1:1}-" \ | |
> /dev/null; then | |
stop_xserver ${DISPLAY} | |
export DISPLAY=${X_DISPLAY} | |
fi | |
unset LOGIN_TIMEOUT | |
fi | |
rm -fr "${TF}"/pdl-${ACCT//./} | |
} | |
function prefix_size() | |
{ | |
# get size on disk of the wineprefix | |
echo $(du -ch "${WINEPREFIX}" | grep total | awk '{print $1}') | |
} | |
function idler_uninstall() | |
{ | |
# logout, backup credentials, then remove client config files and wineprefix | |
if [ -d "${WINEPREFIX}" ]; then | |
idler_logout ${1} | |
chmod -R 755 "${STEAM}"/userdata/ 2> /dev/null | |
tprint "${ACCT}: uninstalling..." \ | |
p$(cat "${WINEPREFIX}"/.prefix.pdl),$(prefix_size) | |
wineserver -w | |
rm -fr "${WINEPREFIX}" | |
fi | |
rm -rf "${TF}"/con-${ACCT}.log "${TF}"/cfg/*-${ACCT//./}.cfg \ | |
"${TF}"/cfg/${ACCT//./}+.cfg | |
} | |
function idler_delete() | |
{ | |
# logout, uninstall, then remove credential backup | |
idler_logout ${1} | |
if [ -d "${WINEPREFIX}" ]; then | |
tprint "${ACCT}: deleting..." \ | |
p$(cat "${WINEPREFIX}"/.prefix.pdl),$(prefix_size) | |
elif [ -e cred/ssfn-${ACCT} ]; then | |
tprint "${ACCT}: deleting..." | |
fi | |
idler_uninstall > /dev/null | |
rm -f cred/cred-${ACCT}_* cred/ssfn-${ACCT} cred/.profile-${ACCT} \ | |
cred/.tf2b-${ACCT} | |
} | |
function xserver_version() | |
{ | |
# get X server version | |
version $(Xorg -version 2>&1 >/dev/null | grep Server | awk '{print $4}') | |
} | |
function start_xserver() | |
{ | |
# start regular X server or seperate farm Xvfb server with optional x11vnc | |
if ! xserver_pid ${DISPLAY} > /dev/null; then | |
TYPE=${DISPLAY} | |
if [ ${DISPLAY} != ${X_DISPLAY} ]; then | |
TYPE=farm,${TYPE} | |
fi | |
local VER=v$(Xorg -version 2>&1 >/dev/null | grep Server | awk '{print $4}') | |
if [[ ${TYPE} = farm* ]]; then | |
tprint "starting Xvfb..." ${TYPE},$(xserver_version) | |
screen -dmS idler-X${DISPLAY:1:1}$ \ | |
Xvfb ${DISPLAY/.*} -screen 0 800x600x24 | |
else | |
tprint "starting X..." ${TYPE},$(xserver_version) | |
screen -dmS idler-X${DISPLAY:1:1}$ \ | |
xinit -geometry =40x40+9999+0 -- ${DISPLAY/.*} | |
fi | |
while ! xserver_pid ${DISPLAY} > /dev/null; do | |
pause | |
done | |
xserver_pid ${DISPLAY} > .x${DISPLAY:1:1}.pid | |
if [ "${X_X11VNC}" = yes ]; then | |
if which x11vnc > /dev/null 2>&1; then | |
tprint "starting x11vnc..." v$(x11vnc -V | awk '{print $2}') | |
screen -dmS idler-x11vnc${DISPLAY:1:1}$ \ | |
x11vnc -display ${DISPLAY/.*} -forever -noxdamage | |
else | |
tprint "warning, x11vnc is not installed (*)" | |
fi | |
fi | |
fi | |
} | |
# use this client limit for each idle server and X/Xvfb instance pair | |
if [ -z ${IDLE_MAX} ] || ((IDLE_MAX > 33 )); then | |
IDLE_MAX=32 | |
fi | |
function wine_version() | |
{ | |
# get wine version | |
VER=$(wine --version | sed s/wine-//) | |
version ${VER%-*} | |
} | |
function steam_cid() | |
{ | |
# get steam community id from the userdata directory or cred backup | |
GET=${ACCT} | |
if [ ! -z ${1} ]; then | |
GET=${1} | |
fi | |
USERDATA="${DIR}"/wine-${GET}/drive_c/Program\ Files/Steam/userdata | |
CREDFILE="${DIR}"/cred/cred-${GET}_ | |
if [ -d "${USERDATA}" ]; then | |
ls "${USERDATA}" | sed "s/\///" | |
elif [ -e "${CREDFILE}"* ]; then | |
basename "${CREDFILE}"* | grep -o \[0-9]*$ | |
else | |
echo nostmcid | |
return 1 | |
fi | |
} | |
function idler_sleep() | |
{ | |
# wait for a period of time to elapse or until the user hits enter 3 times | |
if [[ "${1}" = [0-9]*[hmdsHMDS]* ]]; then | |
TIME=$(echo ${1} | tr [:upper:] [:lower:] \ | |
| sed 's/\([0-9]*[hmds]\).*/\1/') | |
elif [[ "${1}" = *[0-9]* ]]; then | |
TIME=$(echo ${1} | sed -e "s/[a-zA-Z]*//g")s | |
else | |
TIME=1m | |
fi | |
if [ ${TIME:(-1)} = d ]; then | |
SECONDS=$((86400*${TIME:0:(-1)})) | |
elif [ ${TIME:(-1)} = h ]; then | |
SECONDS=$((3600*${TIME:0:(-1)})) | |
elif [ ${TIME:(-1)} = m ]; then | |
SECONDS=$((60*${TIME:0:(-1)})) | |
else | |
SECONDS=${TIME:0:(-1)} | |
fi | |
tprint "sleeping..." ${TIME} | |
COUNT=0 | |
for i in $(seq 1 ${SECONDS}); do | |
if read -t 1 -s; then | |
let COUNT+=1 | |
fi | |
if [ ${COUNT} = 3 ]; then | |
break | |
fi | |
done | |
} | |
function steam_ui_cache_version() | |
{ | |
# get steam ui version from extracted cache or current download | |
MANIFEST=.manifest | |
if [ -e package/steam_client_win32 ]; then | |
unset MANIFEST | |
fi | |
version $(grep version package/steam_client_win32${MANIFEST} 2> /dev/null \ | |
| grep -o \[0-9]*) | |
} | |
function idler_install() | |
{ | |
if ! steam_pid > /dev/null; then | |
# check host file and pause for 5 seconds if another host has the login | |
HOST=$(cat cred/.host-${ACCT} 2> /dev/null) | |
if [ ! -z ${HOST} ] && [ ${HOST} != $(hostname) ]; then | |
tprint "${ACCT}: warning, '${HOST}' has last cred {*}" \ | |
$(steam_connect_hash y | sed s/#/?/) | |
idler_sleep 5s > /dev/null | |
fi | |
# uninstall when the prefix needs rebuilding or was moved | |
PREFIX=6 | |
if [ -d "${WINEPREFIX}" ]; then | |
OLD=$(cat "${WINEPREFIX}"/.prefix.pdl 2> /dev/null) | |
if [ ${OLD} != ${PREFIX} ]; then | |
tprint "${ACCT}: uninstalling for prefix rebuild..." \ | |
p${OLD}\>p${PREFIX},$(prefix_size) | |
idler_uninstall > /dev/null | |
else | |
local LOCATION=$(cat "${WINEPREFIX}"/.location.pdl) | |
if [ "${WINEPREFIX}" != "${LOCATION}" ]; then | |
tprint "${ACCT}: warning, uninstalling for prefix move... {*}" \ | |
${PREFIX},$(prefix_size) | |
idler_uninstall > /dev/null | |
fi | |
fi | |
fi | |
# start X server then prep wineprefix with registry settings application | |
start_xserver | |
if [ ${X_DISPLAY} = ${DISPLAY} ] \ | |
&& [ $(pgrep -f wineserver.*main | wc -l) = ${IDLE_MAX} ]; then | |
tprint "fatal, maximum normal account limit reached {"'!}' x${IDLE_MAX} | |
exit 1 | |
fi | |
TIME=$(cat "${WINEPREFIX}"/.timestamp.pdl 2> /dev/null || echo 0) | |
if [ ${TIME} = 0 ]; then | |
tprint "${ACCT}: creating wineprefix..." p${PREFIX},$(wine_version) | |
elif (( $(date +%s)-3 > ${TIME} )); then | |
tprint "${ACCT}: prepping wineprefix..." p${PREFIX},$(wine_version) | |
fi | |
{ | |
echo -e "REGEDIT4\n" | |
OPTS="[HKEY_CURRENT_USER" | |
echo "${OPTS}\Software\Valve\Steam]" | |
echo "\"AlreadyRetriedOfflineMode\"=dword:00000001" | |
echo "\"Offline\"=dword:00000000" | |
echo "${OPTS}\Software\Valve\Steam\Apps\440]" | |
echo "\"EnableCacheLoading\"=dword:00000000" | |
echo "\"Cloud\"=dword:00000000" | |
echo "${OPTS}\Software\Wine\AppDefaults\steam.exe\DllOverrides]" | |
echo "\"dinput\"=\"\"" | |
echo "\"dinput8\"=\"\"" | |
MINUS=- | |
echo "${OPTS}\Software\Wine\Drivers]" | |
if [ ${DISPLAY} != ${X_DISPLAY} ]; then | |
MINUS=\"\" | |
echo "\"Audio\"=\"\"" | |
else | |
echo "\"Audio\"=\"alsa\"" | |
fi | |
if [[ ${1} = *high* ]]; then | |
echo "[-HKEY_CURRENT_USER\Software\Wine\AppDefaults\hl2.exe]" | |
echo "[-HKEY_CURRENT_USER\Software\Wine\Direct3D]" | |
else | |
echo "${OPTS}\Software\Wine\AppDefaults\hl2.exe\DllOverrides]" | |
echo "\"libcef\"=\"\"" | |
echo "\"icudt\"=\"\"" | |
echo "\"chromehtml\"=\"\"" | |
echo "\"serverbrowser\"=${MINUS}" | |
echo "\"shaderapidx9\"=${MINUS}" | |
echo "\"vaudio_speex\"=${MINUS}" | |
for DLL in dx6 dx7 dx8 dx9 dbg; do | |
echo "\"stdshader_${DLL}\"=${MINUS}" | |
done | |
echo "${OPTS}\Software\Wine\Direct3D]" | |
echo "\"UseGLSL\"=\"disabled\"" | |
echo "\"OffscreenRenderingMode\"=\"backbuffer\"" | |
echo "\"Multisampling\"=\"disabled\"" | |
fi | |
echo "${OPTS}\Software\Wine\WineDbg]" | |
echo "\"ShowCrashDialog\"=dword:0000000" | |
} > regedit-${ACCT}.reg | |
regedit regedit-${ACCT}.reg > /dev/null 2>&1 & | |
while pgrep -f regedit-${ACCT}.reg > /dev/null; do | |
pause 0.5 | |
done | |
rm regedit-${ACCT}.reg | |
date +%s > "${WINEPREFIX}"/.timestamp.pdl | |
# (re)make data directories | |
mkdir -p package steamapps/common | |
mv Team\ Fortress\ 2 steamapps/common/ 2> /dev/null | |
mkdir -p "${TF}"/cfg | |
# install steam launcher | |
if [ ! -d "${STEAM}"/Public ]; then | |
echo ${PREFIX} > "${WINEPREFIX}"/.prefix.pdl | |
tprint "${ACCT}: installing steam launcher..." $(steam_cid) | |
if [ ! -e SteamInstall.msi ]; then | |
download http://cdn.steampowered.com/download/SteamInstall.msi || exit 1 | |
fi | |
WINEDLLOVERRIDES=${DLLS/,msi.dll}=d \ | |
wine_run msiexec /qb /i SteamInstall.msi | |
echo "${WINEPREFIX}" > "${WINEPREFIX}"/.location.pdl | |
# make steam directories and data links | |
mkdir -p "${STEAM}"/config "${STEAM}"/logs | |
ln -s "${DIR}"/package "${STEAM}" | |
ln -s "${DIR}"/steamapps "${STEAM}" | |
# prep configuration | |
if [ -z ${EMAIL} ]; then | |
{ | |
echo -e "\"SteamAppData\"{\"RememberPassword\"\"1\"" | |
echo -e "\"AutoLoginUser\"\"${ACCT}\"}" | |
} > "${STEAM}"/config/SteamAppData.vdf | |
fi | |
{ | |
echo "\"InstallConfigStore\"{\"Software\"{\"Valve\"{\"Steam\"{" | |
echo "\"SentryFile\"\"c:\\\\program files\\\\steam\\\\ssfn-${ACCT}\"" | |
echo "\"Rate\"\"30000\"\"MTBF\"\"0\"\"ConnectCache\"{\"x\"\"y\"}" | |
echo "\"SurveyDate\"\"1-2-3\"}}}}" | |
} > "${STEAM}"/config/config.vdf | |
if steam_cid > /dev/null; then | |
mkdir -p "${STEAM}"/userdata/$(steam_cid)/config | |
echo "\"UserLocalConfigStore\"{\"friends\"{}}" \ | |
> "${STEAM}"/userdata/$(steam_cid)/config/localconfig.vdf | |
fi | |
# set default dimensions of dialog windows | |
WIDTH=$(xdpyinfo | grep -o "dimensions:\ *[0-9]*x" | grep -o \[0-9]*) | |
{ | |
echo "\"UserConfigData\"{\"Steam\"{\"cached\"{\"tradedialog.layout\"{" | |
echo "\"xpos\"\"9999\"\"ypos\"\"9999\"\"wide\"\"648\"\"tall\"\"445\"}}}" | |
echo "\"FriendsMainDialog\"{\"xpos\"\"$((WIDTH-1153))\"\"ypos\"\"0\"" | |
echo "\"wide\"\"220\"\"tall\"\"259\"}\"SteamRootDialog\"{\"xpos\"" | |
echo "\"$((WIDTH-1153))\"\"ypos\"\"0\"\"wide\"\"1153\"\"tall\"\"677\"}" | |
echo "\"resource\"{\"layout\"{\"gamespage_mini.layout\"{\"xpos\"" | |
echo "\"$((WIDTH-933))\"\"ypos\"\"0\"\"wide\"\"285\"\"tall\"\"259\"}}}" | |
echo "\"friends\"{\"ChatRoomDlg.res_110338190873329012\"{\"xpos\"" | |
echo "\"636\"\"ypos\"\"284\"\"wide\"\"636\"\"tall\"\"351\"}" | |
echo "\"ChatRoomDlgFriend.res_16471780\"{\"xpos\"\"876\"\"ypos\"\"284\"" | |
echo "\"wide\"\"396\"\"tall\"\"351\"}}}" | |
} > "${STEAM}"/config/DialogConfig.vdf | |
fi | |
# set credential keys | |
mkdir -p cred | |
if [ ! -w cred ]; then | |
tprint "fatal, cred directory unwriteable {"'!}' | |
exit 1 | |
fi | |
OPTS=$(cat cred/cred-${ACCT}_[0-9]* 2> /dev/null | grep MTBF) | |
sed -i -e "s/\"MTBF\"\t*\"[0-9]*\"/${OPTS}/" "${STEAM}"/config/config.vdf | |
OPTS=$(cat cred/cred-${ACCT}_[0-9]* 2> /dev/null | grep ConnectCache) | |
OPTS="Cache\"\n*\t*{\n*\t*\"[a-z0-9]*\"\t*\"[a-z0-9]*\"\n*\t*}/${OPTS}" | |
sed -i -e ':a;N;$!ba;'"s/\"Connect${OPTS}/" "${STEAM}"/config/config.vdf | |
# (re)make and/or link guard key | |
touch cred/ssfn-${ACCT} | |
ln -sf "${DIR}"/cred/ssfn-${ACCT} "${STEAM}" | |
# (re)make application manifests | |
MANIFEST=1 | |
OPTS='"Universe""1""StateFlags""514"' | |
if [ -e steamapps/.manifest.pdl ] \ | |
&& [ $(cat steamapps/.manifest.pdl) != ${MANIFEST} ]; then | |
tprint "warning, manifest bumped, will validate once {*}" m${MANIFEST} | |
rm steamapps/appmanifest_440.acf | |
fi | |
if [ ! -e steamapps/appmanifest_440.acf ]; then | |
echo "\"AppState\"{\"appID\"\"440\"${OPTS}\"AutoUpdateBehavior\"\"1\"}" \ | |
> steamapps/appmanifest_440.acf | |
fi | |
if [ ! -e steamapps/appmanifest_250820.acf ]; then | |
echo "\"AppState\"{\"appID\"\"250820\"${OPTS}}" \ | |
> steamapps/appmanifest_250820.acf | |
fi | |
echo ${MANIFEST} > steamapps/.manifest.pdl | |
# erase tf2 game download cache and temp files | |
rm -fr steamapps/downloading/440 steamapps/downloading/state_440* \ | |
steamapps/temp | |
# set survey date to the present | |
sed -i -e "s/urveyDate\"\t*\"[0-9\-]*\"/urveyDate\"\"$(date +%Y-%m-%d)\"/" \ | |
"${STEAM}"/config/config.vdf | |
# allow for new ui update | |
if [ $(steam_ui_version) = $(steam_ui_cache_version) ]; then | |
mv package/old.installed package/steam_client_win32.installed 2> /dev/null | |
else | |
mv package/steam_client_win32.installed package/old.installed 2> /dev/null | |
fi | |
# (re)make client files | |
if [ ! -e "${TF}"/cfg/config.cfg ] || [ -w "${TF}"/cfg/config.cfg ]; then | |
echo // > "${TF}"/cfg/config.cfg | |
chmod 444 "${TF}"/cfg/config.cfg | |
fi | |
echo -e "cl_voice_filter \"\"\nsetinfo name \"\"" > "${TF}"/cfg/audible.cfg | |
echo // > "${TF}"/cfg/cmd-${ACCT//./}.cfg | |
echo spectate > "${TF}"/cfg/join-${ACCT//./}.cfg | |
for CLASS in demoman engineer heavyweapons medic pyro scout sniper \ | |
soldier spy; do | |
echo "echo CLASS_${CLASS}" > "${TF}"/cfg/${CLASS}.cfg | |
done | |
rm -f "${TF}"/cfg/alias.cfg "${TF}"/cfg/autoexec.cfg "${TF}"/cfg/low.cfg | |
{ | |
echo "alias i_ai \"+use_action_slot_item;wait 800;i_ai\"" | |
echo "alias i_at \"+attack;wait 16;-attack;wait 160;i_at\"" | |
echo "alias i_du \"+duck;wait 160;-duck;wait 240;i_du\"" | |
echo "alias i_in \"-attack;invnext;wait 1600;i_in\"" | |
echo "alias i_jc \"join_class random;wait 120;i_jc\"" | |
echo "alias i_ju \"+jump;wait 16;-jump;wait 16;wait 160;i_ju\"" | |
printf "alias i_ms \"+moveleft;wait 40;-moveleft;+moveright" | |
echo ";wait 40;-moveright;i_ms\"" | |
printf "alias i_mu \"wait 40;+forward;wait 40;-forward;+back;wait 40" | |
echo ";-back;i_mu\"" | |
echo "alias i_rl \"+left;wait 80;-left;+right;wait 80;-right;i_rr\"" | |
echo "alias i_rr \"+right;wait 80;-right;+left;wait 80;-left;i_rl\"" | |
echo "alias i_ta \"taunt;wait 1600;i_ta\"" | |
echo "alias i_vo \"voicemenu 2 2;wait 200;voicemenu 2 3;wait 200;i_vo\"" | |
printf "alias i_z0 \"alias i_ai;alias i_at;alias i_du;alias i_in" | |
printf ";alias i_jc;alias i_ju;alias i_ms;alias i_mu;alias i_rl" | |
echo ";alias i_rr;alias i_ta;alias i_vo\"" | |
} > "${TF}"/cfg/alias.cfg | |
{ | |
echo "+movedown" | |
echo "sv_cheats \"1\"" | |
echo "addip \"0\" \"1.2.3.4\"" | |
echo "alias addip" | |
echo "writeip" | |
echo "alias _amove \"+left;wait 1;-left;wait 1200;_amove\"" | |
echo "alias _atrig \"cl_trigger_first_notification;wait 30;_atrig\"" | |
echo "alias cmnd" | |
printf "alias mmute \"voice_loopback 0;cl_voice_filter _pdl_" | |
echo ";-voicerecord;alias mping\"" | |
echo "alias mhear \"mmute;exec audible\"" | |
printf "alias mtalk \"mhear;wait 120;voice_loopback 1;+voicerecord" | |
echo ";alias mping mtalk\"" | |
echo "alias mping \"\"" | |
echo "alias _mping \"mping;wait 16000;_mping\"" | |
echo "alias +rocketjump \"+duck;+attack;+jump\"" | |
echo "alias -rocketjump \"-duck;-attack;-jump\"" | |
echo "bind E \"+rocketjump\"" | |
echo "bind F5 \"mat_vsync 0\"" | |
echo "bind F6 \"mat_vsync 1\"" | |
echo "bind F7 \"mat_queue_mode 0\"" | |
echo "bind F8 \"mat_queue_mode 2\"" | |
echo "bind F10 \"volume 0\"" | |
echo "bind F11 \"incrementvar volume -1.0 1.0 -0.01\"" | |
echo "bind F12 \"incrementvar volume 0.0 2.0 0.01\"" | |
echo "bind KP_SLASH \"mmute\"" | |
echo "bind KP_MULTIPLY \"mhear\"" | |
echo "bind KP_MINUS \"mtalk\"" | |
echo "bind KP_PLUS \"exec alias\"" | |
echo "bind KP_UPARROW \"i_jc\"" | |
echo "bind KP_PGUP \"i_ai\"" | |
echo "bind KP_LEFTARROW \"i_at\"" | |
echo "bind KP_5 \"i_du\"" | |
echo "bind KP_RIGHTARROW \"i_in\"" | |
echo "bind KP_END \"i_ju\"" | |
echo "bind KP_DOWNARROW \"i_ms;i_mu\"" | |
echo "bind KP_PGDN \"i_rr\"" | |
echo "bind KP_INS \"i_ta\"" | |
echo "bind KP_DEL \"i_vo\"" | |
echo "bind KP_ENTER \"i_z0\"" | |
echo "cl_ask_blacklist_opt_out \"1\"" | |
echo "cl_ask_favorite_opt_out \"1\"" | |
echo "cl_autoreload \"1\"" | |
echo "cl_autorezoom \"0\"" | |
echo "cl_class \"default\"" | |
echo "cl_forcepreload \"0\"" | |
echo "cl_hud_minmode \"1\"" | |
echo "cl_hud_playerclass_playermodel_showed_confirm_dialog \"1\"" | |
echo "cl_lagcompensation \"0\"" | |
echo "cl_showbackpackrarities \"1\"" | |
echo "cl_showhelp \"0\"" | |
echo "cl_smooth \"0\"" | |
echo "cl_steamscreenshots \"0\"" | |
echo "cl_team \"default\"" | |
echo "cl_timeout \"0\"" | |
echo "clientport \"28001\"" | |
echo "con_enable \"1\"" | |
echo "con_timestamp \"1\"" | |
echo "exec \"alias\"" | |
echo "exec \"personal\"" | |
echo "hud_classautokill \"1\"" | |
echo "hud_combattext \"1\"" | |
echo "hud_fastswitch \"1\"" | |
echo "hud_medichealtargetmarker \"1\"" | |
echo "joystick \"0\"" | |
echo "mat_disable_d3d9ex \"1\"" | |
echo "mp_timelimit \"0\"" | |
echo "sb_dontshow_maxplayer_warning \"1\"" | |
echo "setinfo name \"\"" | |
echo "sixense_enabled \"0\"" | |
echo "spec_autodirector \"0\"" | |
echo "sv_logfile \"0\"" | |
echo "sv_pure \"-1\"" | |
echo "tf_coach_request_nevershowagain \"1\"" | |
echo "tf_explanations_backpackpanel \"1\"" | |
echo "tf_explanations_charinfo_armory_panel \"1\"" | |
echo "tf_explanations_charinfopanel \"1\"" | |
echo "tf_explanations_craftingpanel \"1\"" | |
echo "tf_explanations_discardpanel \"1\"" | |
echo "tf_explanations_store \"1\"" | |
echo "tf_explanations_tradingpanel \"1\"" | |
echo "tf_medigun_autoheal \"1\"" | |
echo "tf_remember_activeweapon \"1\"" | |
echo "tf_remember_lastswitched \"1\"" | |
echo "tf_training_has_prompted_for_forums \"1\"" | |
echo "tf_training_has_prompted_for_loadout \"1\"" | |
echo "tf_training_has_prompted_for_offline_practice \"1\"" | |
echo "tf_training_has_prompted_for_options \"1\"" | |
echo "tf_training_has_prompted_for_training \"1\"" | |
echo "voice_enable \"1\"" | |
echo "voice_fadeouttime \"0.0\"" | |
echo "voice_overdrive \"64\"" | |
echo "volume \"0\"" | |
} > "${TF}"/cfg/autoexec.cfg | |
{ | |
echo "cl_hud_playerclass_use_playermodel \"1\"" | |
echo "echo \"fps200\"" | |
echo "fps_max \"200\"" | |
echo "mat_queue_mode \"2\"" | |
echo "mat_vsync \"1\"" | |
echo "sensitivity \"3\"" | |
} > "${TF}"/cfg/high.cfg | |
{ | |
echo "cl_detaildist \"0\"" | |
echo "cl_detailfade \"0\"" | |
echo "cl_disablehtmlmotd \"1\"" | |
echo "cl_drawmonitors \"0\"" | |
echo "cl_dynamiccrosshair \"0\"" | |
echo "cl_ejectbrass \"0\"" | |
echo "cl_hud_playerclass_use_playermodel \"0\"" | |
echo "cl_observercrosshair \"0\"" | |
echo "cl_phys_props_enable \"0\"" | |
echo "cl_phys_props_max \"0\"" | |
echo "cl_ragdoll_collide \"0\"" | |
echo "cl_ragdoll_fade_time \"0\"" | |
echo "cl_ragdoll_forcefade \"1\"" | |
echo "cl_ragdoll_physics_enable \"0\"" | |
echo "cl_scalecrosshair \"0\"" | |
echo "cl_show_splashes \"0\"" | |
echo "cl_spec_carrieditems \"0\"" | |
echo "dsp_slow_cpu \"1\"" | |
echo "echo \"fps30\"" | |
echo "fps_max \"30\"" | |
echo "func_break_max_pieces \"0\"" | |
echo "g_ragdoll_fadespeed \"0\"" | |
echo "g_ragdoll_lvfadespeed \"0\"" | |
echo "glow_outline_effect_enable \"0\"" | |
echo "hud_achievement_tracker \"0\"" | |
echo "lod_transitiondist \"0\"" | |
echo "mat_aaquality \"0\"" | |
echo "mat_antialias \"0\"" | |
echo "mat_bloom_scalefactor_scalar \"0\"" | |
echo "mat_bumpmap \"0\"" | |
echo "mat_colorcorrection \"0\"" | |
echo "mat_colcorrection_disableentities \"1\"" | |
echo "mat_disable_bloom \"1\"" | |
echo "mat_disable_fancy_blending \"1\"" | |
echo "mat_disable_lightwarp \"1\"" | |
echo "mat_disable_ps_patch \"1\"" | |
echo "mat_envmapsize \"0\"" | |
echo "mat_envmaptgasize \"0\"" | |
echo "mat_filterlightmaps \"0\"" | |
echo "mat_filtertextures \"0\"" | |
echo "mat_forceaniso \"0\"" | |
echo "mat_hdr_level \"0\"" | |
echo "mat_motion_blur_enabled \"0\"" | |
echo "mat_motion_blur_strength \"0\"" | |
echo "mat_parallaxmap \"0\"" | |
echo "mat_picmip \"2\"" | |
echo "mat_queue_mode \"0\"" | |
echo "mat_reducefillrate \"1\"" | |
echo "mat_reduceparticles \"1\"" | |
echo "mat_shadowstate \"0\"" | |
echo "mat_software_aa_edge_threshold \"4\"" | |
echo "mat_software_aa_quality \"0\"" | |
echo "mat_software_aa_strength \"0.0\"" | |
echo "mat_software_aa_strength_vgui \"0.0\"" | |
echo "mat_specular \"0\"" | |
echo "mat_supportflashlight \"0\"" | |
echo "mat_trilinear \"0\"" | |
echo "mat_vsync \"0\"" | |
echo "r_3dsky \"0\"" | |
echo "r_ambientboost \"0\"" | |
echo "r_ambientfactor \"0\"" | |
echo "r_ambientmin \"0\"" | |
echo "r_cheapwaterend \"1\"" | |
echo "r_cheapwaterstart \"1\"" | |
echo "r_decals \"0\"" | |
echo "r_decalstaticprops \"0\"" | |
echo "r_drawbatchdecals \"0\"" | |
echo "r_drawdetailprops \"0\"" | |
echo "r_drawflecks \"0\"" | |
echo "r_drawmodeldecals \"0\"" | |
echo "r_drawopaquestaticpropslast \"0\"" | |
echo "r_drawviewmodel \"0\"" | |
echo "r_dynamic \"0\"" | |
echo "r_eyegloss \"0\"" | |
echo "r_eyemove \"0\"" | |
echo "r_eyes \"0\"" | |
echo "r_flashlightdepthtexture \"0\"" | |
echo "r_flashlightnodraw \"1\"" | |
echo "r_flex \"0\"" | |
echo "r_hunkalloclightmaps \"0\"" | |
echo "r_lightaverage \"0\"" | |
echo "r_lod \"2\"" | |
echo "r_maxdlights \"0\"" | |
echo "r_propsmaxdist \"0\"" | |
echo "r_renderoverlayfragment \"0\"" | |
echo "r_rootlod \"2\"" | |
echo "r_shadowmaxrendered \"0\"" | |
echo "r_shadowrendertotexture \"0\"" | |
echo "r_shadows \"0\"" | |
echo "r_staticprop_lod \"4\"" | |
echo "r_teeth \"0\"" | |
echo "r_waterdrawreflection \"0\"" | |
echo "r_waterdrawrefraction \"0\"" | |
echo "r_waterforceexpensive \"0\"" | |
echo "r_waterforcereflectentities \"0\"" | |
echo "r_worldlights \"0\"" | |
echo "ragdoll_sleepaftertime \"0\"" | |
echo "replay_enablerenderpreview \"0\"" | |
echo "rope_averagelight \"0\"" | |
echo "rope_collide \"0\"" | |
echo "rope_rendersolid \"0\"" | |
echo "rope_smooth \"0\"" | |
echo "rope_subdiv \"0\"" | |
echo "rope_wind_dist \"0\"" | |
echo "sensitivity \"6\"" | |
echo "snd_async_fullyasync \"1\"" | |
echo "snd_musicvolume \"0\"" | |
echo "snd_pitchquality \"0\"" | |
echo "tf_particles_disable_weather \"1\"" | |
echo "violence_ablood \"0\"" | |
echo "violence_agibs \"0\"" | |
echo "violence_hblood \"0\"" | |
echo "violence_hgibs \"0\"" | |
} > "${TF}"/cfg/low.cfg | |
if [ ! -e personal.cfg ]; then | |
echo // > personal.cfg | |
fi | |
ln -sf "${DIR}"/personal.cfg "${TF}"/cfg | |
# configure login modes | |
unset AUTH CONFIG DOWNLOAD EXTRACT MODE OFFLINE | |
rm -f "${WINEPREFIX}"/.entry.pdl | |
if [[ ${1} = hide ]]; then | |
MODE=hidden | |
elif [[ ${1} = *hide* ]]; then | |
MODE=hidden, | |
fi | |
OVER=0 | |
GRAPHICS="-dxlevel 80 -w 640 -h 480" | |
EXEC=low | |
echo 30 > "${WINEPREFIX}"/.fps.pdl | |
export WINEDEBUG=-all | |
if [[ "${1}" = *low* ]]; then | |
MODE=${MODE}low | |
HIDE=${DLLS} | |
elif [[ "${1}" = *high* ]]; then | |
MODE=${MODE}high | |
HIDE=dwrite.dll,winemenubuilder.exe | |
OVER=1 | |
GRAPHICS="-dxlevel 95 -w 1024 -h 768" | |
EXEC=high | |
export WINEDEBUG= | |
echo 200 > "${WINEPREFIX}"/.fps.pdl | |
else | |
HIDE=${DLLS/,icudt.dll,libcef.dll,chromehtml.dll} | |
fi | |
if [ ! -z ${MODE} ]; then | |
MODE="(${MODE}) " | |
fi | |
{ | |
printf "alias _acmd$(client_fps y) \"exec cmd-${ACCT//./};" | |
echo "wait $(($(client_fps y)*4));_acmd$(client_fps y)\"" | |
echo "con_logfile \"con-${ACCT}.log\"" | |
echo "exec \"${EXEC}\"" | |
echo "exec \"alias-${ACCT//./}\"" | |
echo "echo \"Disconnect\"" | |
} > "${TF}"/cfg/${ACCT//./}+.cfg | |
echo _acmd$(client_fps y)\;_amove\;_mping \ | |
> "${TF}"/cfg/alias-${ACCT//./}.cfg | |
fi | |
} | |
function free_swap() | |
{ | |
# get available system swap | |
echo $(($(cat /proc/meminfo | grep SwapFree | awk '{print $2}')/1000)) | |
} | |
# set command line options common to client and server | |
COMMON_OPTS="-nobreakpad -nodev -nodns -nogamestats -nohltv -noipx -nomaster" | |
COMMON_OPTS="${COMMON_OPTS} -nominidumps" | |
function focus_window() | |
{ | |
# activate or focus a window by its id | |
xdotool windowactivate --sync ${1} 2> /dev/null \ | |
|| xdotool windowraise ${1} windowfocus --sync ${1} 2> /dev/null | |
} | |
function close_window() | |
{ | |
# close a window by its name | |
WID=$(window_id "${1}") | |
while window_id "${1}" > /dev/null \ | |
&& ! xprop -id ${WID} | grep -q Withdrawn; do | |
focus_window ${WID} | |
Y=$(($(xwininfo -id ${WID} | grep Height | grep -o [0-9]*)-8)) | |
xdotool mousemove --window ${WID} 8 ${Y} click --repeat 2 --delay 300 1 \ | |
key --window ${WID} Escape Alt+F4 2> /dev/null | |
for I in 1 2 3; do | |
pause | |
if ! window_id "${1}" > /dev/null \ | |
|| xprop -id ${WID} | grep -q Withdrawn; then | |
break | |
fi | |
done | |
done | |
} | |
function is_authenticated() | |
{ | |
# check if the current account has been authenticated with steam | |
dcat "${STEAM}"/logs/connection_log.txt | grep -q OnResponse.*U:.*OK | |
} | |
function steam_auth_server() | |
{ | |
# get steam authentication server | |
dcat "${STEAM}"/logs/connection_log.txt y | grep Complete \ | |
| grep -m1 -o "[0-9\.:]*, [A-Z]*" | |
} | |
function end_cred_entry() | |
{ | |
# abort a credential prompt if steam authenticates or another window arrives | |
while ! is_authenticated && steam_pid > /dev/null; do | |
if [ ! -z "${1}" ] && window_id "${1}" > /dev/null; then | |
break | |
fi | |
sleep 1 | |
if [ "${ENTRY_TIMEOUT}" = 180 ]; then | |
touch "${WINEPREFIX}"/.entry.pdl | |
break | |
else | |
let ENTRY_TIMEOUT+=1 | |
fi | |
done | |
if pgrep -f bash.*passwd-${ACCT}.sh > /dev/null; then | |
kill -1 $(pgrep -f bash.*passwd-${ACCT}.sh) | |
echo | |
fi | |
} | |
function read_password() | |
{ | |
# prompt for a password | |
{ | |
echo "while IFS= read -r -n1 -s CH; do" | |
echo " case \"\$( echo -n \"\${CH}\" | od -An -tx1 )\" in" | |
echo " '')" | |
echo " break" | |
echo " ;;" | |
echo " ' 08'|' 7f')" | |
echo " if [ -n \"\${INPUT}\" ]; then" | |
echo " INPUT=\"\$( echo \"\${INPUT}\" \\" | |
echo " | sed 's/.\$//' )\"" | |
echo " echo -n \$'\b \b' 1>&2" | |
echo " fi" | |
echo " ;;" | |
echo " ' 15')" | |
echo " echo -n \"\${INPUT}\" | sed 's/./\cH \cH/g' >&2" | |
echo " INPUT=''" | |
echo " ;;" | |
echo " *)" | |
echo " INPUT=\"\${INPUT}\${CH}\"" | |
echo " echo -n '*' 1>&2" | |
echo " ;;" | |
echo " esac" | |
echo "done" | |
echo "echo \${INPUT}" | |
} > .passwd-${ACCT}.sh | |
bash .passwd-${ACCT}.sh | |
rm .passwd-${ACCT}.sh | |
} | |
function idler_offline() | |
{ | |
# set friend presense to offline | |
if steam_pid > /dev/null && ! grep -q "\"PersonaStateDesired\".*\"0\"" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf; then | |
tprint "${ACCT}: signing off of friends..." $(both_memory) | |
OFFLINE_TIMEOUT=0 | |
while ! grep -q "\"PersonaStateDesired\".*\"0\"" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf; do | |
if [ ${OFFLINE_TIMEOUT} = 8 ]; then | |
OFFLINE_TIMEOUT=0 | |
fi | |
if [ ${OFFLINE_TIMEOUT} = 0 ]; then | |
wine_run "${STEAM}"/steam.exe steam://friends/status/offline | |
fi | |
let OFFLINE_TIMEOUT+=1 | |
pause | |
done | |
fi | |
} | |
function idler_login() | |
{ | |
if ! steam_pid > /dev/null; then | |
# check swap space | |
if (($(free_swap)<400)); then | |
tprint "${ACCT}: error, not enough swap {"'!}' $(free_swap)mb | |
return 1 | |
fi | |
# prompt on initial install | |
if [ ! -d "${WINEPREFIX}" ] && [ ! -e cred/cred-${ACCT}_[0-9]* ] \ | |
&& [ -z ${PASS} ]; then | |
printf "[$(date +%H:%M:%S)] ${ACCT}: enter y to install: " | |
read INPUT | |
if [ -z ${INPUT} ] || [ ${INPUT} != y ]; then | |
return 1 | |
fi | |
fi | |
idler_install ${1} | |
unset AUTH_ERROR | |
# check some content markers then initiate | |
HASALL=$(cat "${STEAM}"/config/config.vdf | sed -e '/"apps"/,$!d' \ | |
-e '/"440"/,$!d' | grep -m1 HasAllLocalContent | grep -o [0-9]* || echo ?) | |
UPTODATE=$(cat "${STEAM}"/config/config.vdf | sed -e '/"apps"/,$!d' \ | |
-e '/"440"/,$!d' | grep -m1 UpToDate | grep -o [0-9]* || echo ?) | |
tprint "${ACCT}: starting ${MODE}steam..." \ | |
${HASALL}-${UPTODATE},${DISPLAY/.*},$(steam_connect_hash) | |
echo ${1} > "${WINEPREFIX}"/.login.pdl | |
while ! steam_pid > /dev/null; do | |
# apply steam configuration if able | |
if [ -d "${STEAM}"/userdata ]; then | |
{ | |
echo "\"UserRoamingConfigStore\"{\"Software\"{\"Valve\"{\"Steam\"{" | |
echo "\"SteamDefaultDialog\"\"#app_friends\"\"cloudenabled\"\"0\"" | |
echo "\"apps\"{\"440\"{\"cloudenabled\"\"0\"}}}}}" | |
echo "\"TradeInfoHint\"\"1\"}" | |
} > "${STEAM}"/userdata/$(steam_cid)/config/sharedconfig.vdf | |
LOCKS="7 440 ugc" | |
if [[ "${1}" != *high* ]]; then | |
LOCKS="${LOCKS} 760" | |
fi | |
for LOCK in ${LOCKS}; do | |
rm -fr "${STEAM}"/userdata/$(steam_cid)/${LOCK} | |
mkdir "${STEAM}"/userdata/$(steam_cid)/${LOCK} | |
chmod 444 "${STEAM}"/userdata/$(steam_cid)/${LOCK} | |
done | |
if ! grep -q Launch "${STEAM}"/userdata/*/config/localconfig.vdf; then | |
sed -i -e "/ShowAvatars/d" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf | |
OPTS="\"system\"{\"EnableGameOverlay\"\"0\"\"JumplistSettings\"\"0\"" | |
OPTS="${OPTS} \"InGameOverlayShortcutKey\"\"Ctrl\tKEY_TAB\"" | |
OPTS="${OPTS} \"JumplistSettingsKnown\"\"32767\"\"NavUrlBar\"\"1\"}" | |
OPTS="${OPTS} \"News\"{\"NotifyAvailableGames\"\"0\"}" | |
OPTS="${OPTS} \"Software\"{\"Valve\"{\"Steam\"{\"SSAVersion\"\"2\"" | |
OPTS="${OPTS} \"PrivacyPolicyVersion\"\"2\"\"apps\"{\"440\"{" | |
sed -i -e "s/\"friends\"/${OPTS}\nLaunchOptions\n}}}}}&/" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf | |
OPTS="\"Notifications_ShowIngame\"\"0\"" | |
OPTS="${OPTS} \"Notifications_ShowOnline\"\"0\"" | |
OPTS="${OPTS} \"Sounds_PlayMessage\"\"0\"" | |
OPTS="${OPTS} \"AutoSignIntoFriends\"\"0\"" | |
OPTS="${OPTS} \"ShowTimeInChatLogCheck\"\"1\"" | |
OPTS="${OPTS} \"ShowAvatars\"\"1\"" | |
sed -i -e ':a;N;$!ba;'"s/\"friends\"\n*\s*{/&${OPTS}/" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf | |
fi | |
unset FARM | |
if [ ${DISPLAY} != ${X_DISPLAY} ]; then | |
FARM=-farm${DISPLAY:1:1} | |
fi | |
OPTS="${COMMON_OPTS} ${GRAPHICS} -nocrashdialog -nod3d9ex -nojoy" | |
OPTS="${OPTS} -nomessagebox -nopreload -nopreloadmodels -novid" | |
OPTS="${OPTS} -port 28$((201+${DISPLAY:1:1}*32)) -sw ${FARM}" | |
OPTS="${OPTS} +exec ${ACCT//./}+" | |
sed -i -e "/LaunchOptions/ s/^.*$/\"LaunchOptions\" \"${OPTS}\"/" \ | |
-e "s/PersonaStateDesired\".*\"[0-9]/PersonaStateDesired\"\"0/" \ | |
-e "s/ShowAvatars\".*\"[0-9]/ShowAvatars\"\"1/" \ | |
-e "s/listSettings\"\t*\"[0-9]*\"/listSettings\"\"1609\"/" \ | |
-e "s/nableGameOverlay\"\t*\"[0-9]\"/nableGameOverlay\"\"${OVER}\"/" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf | |
fi | |
# wait for wineserver and explorer.exe then start steam | |
wineserver -w | |
while [ -e .explorer.lock ] \ | |
&& ps $(cat .explorer.lock) | grep -q \ [ba]*sh\ .*pdl-idler\\.sh; do | |
pause 1.$(shuf -i 1-9 -n 1) | |
done | |
echo $$ > .explorer.lock | |
if [[ ${MODE} = *hidden* ]]; then | |
EXPLORER=,$(echo $(pgrep -x explorer\\.exe) | sed s/\ /,/), | |
fi | |
if [ ${DISPLAY} != ${X_DISPLAY} ]; then | |
TYPE=farm${DISPLAY:1:1}- | |
wineserver -d0farm${DISPLAY:1:1} | |
else | |
TYPE=main${DISPLAY:1:1}- | |
wineserver -d0main${DISPLAY:1:1} | |
fi | |
unset BOOTSTRAP CRED ERROR GUARD LOGIN_TIMEOUT SSA | |
echo "" > "${STEAM}"/logs/connection_log.txt | |
echo "" > "${STEAM}"/logs/content_log.txt | |
if [[ "${1}" = *low* ]]; then | |
WINEDLLOVERRIDES=${HIDE}=d screen -dmS idler-${ACCT}$ \ | |
wine "${STEAM}"/steam.exe ${TYPE}${1} -clearbeta -language english \ | |
-silent steam://friends/settings/showavatars | |
else | |
WINEDLLOVERRIDES=${HIDE}=d screen -dmS idler-${ACCT}$ \ | |
wine "${STEAM}"/steam.exe ${TYPE}${1} -clearbeta -language english \ | |
-silent -console steam://friends/settings/showavatars | |
fi | |
while [ 1 ]; do | |
pause | |
for EPID in $(pgrep -x explorer\\.exe); do | |
if [[ "${EXPLORER}" != *,${EPID},* ]]; then | |
break 2 | |
fi | |
done | |
done | |
rm -f .explorer.lock | |
while ! window_id Servers > /dev/null 2>&1; do | |
pause | |
let LOGIN_TIMEOUT+=1 | |
# if there is no connection, close error window, then proceed offline | |
if window_id \"Connection\ Error > /dev/null; then | |
if [ -z ${OFFLINE} ]; then | |
OFFLINE=1 | |
tprint "${ACCT}: warning, offline login retry... {"'!}' \ | |
$(steam_memory) | |
idler_logout yes no > /dev/null | |
else | |
OFFLINE=2 | |
tprint "${ACCT}: fatal, ending offline login... {"'!}' \ | |
$(steam_memory) | |
idler_logout yes > /dev/null | |
exit 1 | |
fi | |
# restart for long authentications | |
elif [ ! -z ${AUTH} ]; then | |
if [ ${LOGIN_TIMEOUT} = 300 ]; then | |
tprint "${ACCT}: warning, hung authentication... {*}" \ | |
$(steam_memory) | |
idler_logout yes no > /dev/null | |
fi | |
# inform when authenticated, mark host file, then hide login window | |
else | |
if is_authenticated; then | |
if ! window_id Guard > /dev/null; then | |
unset PASS | |
AUTH=$(steam_auth_server | grep -o "[A-Z]*") | |
tprint "${ACCT}: authenticated, loading..." \ | |
${AUTH},@$(steam_pid),$(steam_memory) | |
hostname > cred/.host-${ACCT} | |
ln -sf cred/.host-${ACCT} .host-${ACCT} | |
WID=$(window_id Login) | |
if [ ! -z ${WID} ]; then | |
xdotool windowunmap --sync ${WID} 2> /dev/null | |
fi | |
else | |
focus_window $(window_id Guard) | |
xdotool key Return | |
fi | |
# if guard window arrives, prompt for guard code entry | |
elif [ -z ${GUARD} ]; then | |
if window_id Guard > /dev/null; then | |
GUARD=yes | |
end_cred_entry & | |
xdotool key Return | |
echo -e "read INPUT\necho \${INPUT}" > .passwd-${ACCT}.sh | |
printf "[$(date +%H:%M:%S)] ${ACCT}: input guard code: " | |
while steam_pid > /dev/null && ! is_authenticated; do | |
echo pdlguard >> "${STEAM}"/logs/connection_log.txt | |
INPUT=$(bash .passwd-${ACCT}.sh) | |
if [ -e "${WINEPREFIX}"/.entry.pdl ]; then | |
tprint "${ACCT}: error, guard entry timeout {"'!}' \ | |
$(steam_memory) | |
idler_logout > /dev/null | |
elif ! is_authenticated && window_id Guard > /dev/null; then | |
focus_window $(window_id Guard) | |
xdotool type --delay 200 ${INPUT} | |
xdotool key Return | |
while ! is_authenticated; do | |
if dcat "${STEAM}"/logs/connection_log.txt y \ | |
| grep -m 1 "pdlguard\|Invalid Login Auth Code" \ | |
| grep -q Invalid; then | |
xdotool key Tab key Return | |
printf "[$(date +%H:%M:%S)] ${ACCT}: retry guard code: " | |
continue 2 | |
fi | |
pause | |
done | |
fi | |
done | |
# if login window arrives, prompt for password entry | |
elif [ -z ${CRED} ]; then | |
if window_id Login > /dev/null; then | |
CRED=yes | |
end_cred_entry Guard & | |
if [ -z ${PASS} ]; then | |
printf "[$(date +%H:%M:%S)] ${ACCT}: input password: " | |
fi | |
while steam_pid > /dev/null && ! is_authenticated \ | |
&& ! window_id Guard > /dev/null; do | |
if [ -z ${PASS} ]; then | |
INPUT=$(read_password) | |
if [ -e "${WINEPREFIX}"/.entry.pdl ]; then | |
tprint "${ACCT}: error, password entry timeout {"'!}' \ | |
$(steam_memory) | |
idler_logout yes > /dev/null | |
break | |
elif [ -z ${INPUT} ]; then | |
continue | |
fi | |
else | |
INPUT=${PASS} | |
fi | |
if ! is_authenticated && ! window_id Guard > /dev/null; then | |
focus_window $(window_id Login) | |
pause | |
xdotool type --delay 200 ${INPUT} | |
unset INPUT WARNING | |
xdotool key Return | |
while ! is_authenticated \ | |
&& ! window_id Guard > /dev/null; do | |
if window_id Error > /dev/null; then | |
xdotool key Return | |
if [ ! -z ${PASS} ]; then | |
unset PASS | |
else | |
echo | |
fi | |
printf "[$(date +%H:%M:%S)] ${ACCT}: retry password: " | |
continue 2 | |
elif [ -z ${WARNING} ] \ | |
&& window_id Warning > /dev/null; then | |
WARNING=yes | |
xdotool key Return | |
fi | |
pause | |
done | |
if [ -z ${PASS} ]; then | |
echo | |
fi | |
fi | |
done | |
stty echo | |
# inform when bootstrapper is downloading | |
elif [ -z ${BOOTSTRAP} ]; then | |
if window_id Updating > /dev/null; then | |
BOOTSTRAP=yes | |
tprint "${ACCT}: downloading steam bootstrapper..." \ | |
$(steam_memory) | |
# if the greeting window arrives, create new account | |
else | |
WID=$(window_id \"Steam\" atom) | |
if [ ! -z ${WID} ]; then | |
if [ -z ${F2P} ] \ | |
&& xprop -id ${WID} 2> /dev/null | grep -q 432\ by; then | |
F2P=yes | |
tprint "${ACCT}: filling fields..." $(steam_memory) | |
function wait_on() | |
{ | |
xdotool key --window ${WID} Return | |
while ! window_id ${1} > /dev/null; do | |
pause 0.25 | |
done | |
while window_id ${1} > /dev/null; do | |
pause | |
done | |
} | |
focus_window ${WID} | |
for I in {1..3}; do | |
xdotool key Return | |
pause | |
done | |
xdotool type --delay 250 ${ACCT} | |
for I in {1..2}; do | |
xdotool key Tab | |
pause 0.2 | |
xdotool type --delay 250 ${PASS} | |
done | |
wait_on working | |
xdotool type --delay 250 ${EMAIL} | |
xdotool key Tab | |
pause 0.2 | |
xdotool type --delay 250 ${EMAIL} | |
wait_on working | |
if window_id Create\ a\ Steam 2 > /dev/null; then | |
tprint "${ACCT}: fatal, e-mail in use... {"'!}' \ | |
$(steam_memory) | |
idler_delete yes > /dev/null | |
exit 1 | |
fi | |
SECRET=secret$(shuf -i 1000-2000 -n 1) | |
xdotool key Tab | |
pause 0.2 | |
xdotool type --delay 250 ${SECRET} | |
tprint "${ACCT}: creating account..." \ | |
${SECRET},$(steam_memory) | |
wait_on Working | |
while window_id Create opacity > /dev/null; do | |
pause | |
xdotool key Return | |
done | |
rm -fr "${STEAM}"/userdata/????? \ | |
"${STEAM}"/userdata/?????? | |
cat pdl-idler.conf 2> /dev/null | sed -e \ | |
-e "s/${ACCT}\/${PASS}#${EMAIL}/${ACCT}\/${PASS}/" \ | |
| tee pdl-idler.conf > /dev/null | |
# inform if there is ui package activity | |
elif [ -z ${DOWNLOAD} ]; then | |
DOWNLOAD=yes | |
LOGIN_TIMEOUT=91 | |
UI=$(steam_ui_version) | |
if [ ${UI} = none ]; then | |
UI=$(steam_ui_cache_version) | |
fi | |
tprint "${ACCT}: checking/updating steam ui..." \ | |
${UI},$(steam_memory) | |
fi | |
fi | |
if [ -z ${EXTRACT} ]; then | |
if [ ${LOGIN_TIMEOUT} = 60 ]; then | |
tprint "${ACCT}: warning, hung launch... {*}" \ | |
$(steam_memory) | |
idler_logout yes no > /dev/null | |
elif [ ${LOGIN_TIMEOUT} = 150 ] \ | |
&& ! dcat "${STEAM}"/logs/bootstrap_log.txt y \ | |
| grep -om 1 "Downloading update\|Startup" \ | |
| grep -q Downloading; then | |
tprint "${ACCT}: warning, hung ui check... {*}" \ | |
$(steam_memory) | |
idler_logout yes no > /dev/null | |
elif [ ${LOGIN_TIMEOUT} = 600 ]; then | |
tprint "${ACCT}: warning, hung ui download... {*}" \ | |
$(steam_memory) | |
idler_logout yes no > /dev/null | |
elif [ -e "${STEAM}"/package/*win32 ]; then | |
EXTRACT=yes | |
LOGIN_TIMEOUT=0 | |
if [ $(steam_ui_cache_version) \ | |
= $(steam_ui_web_version) ]; then | |
tprint "${ACCT}: extracting steam ui..." \ | |
$(steam_ui_cache_version),$(steam_memory) | |
else | |
tprint "${ACCT}: warning, old ui version... {*}" \ | |
$(steam_ui_cache_version),$(steam_memory) | |
fi | |
steam_ui_cache_version > "${WINEPREFIX}"/.ui.pdl | |
fi | |
elif [ ${LOGIN_TIMEOUT} = 90 ]; then | |
tprint "${ACCT}: warning, hung ui extraction... {*}" \ | |
$(steam_memory) | |
idler_logout yes no > /dev/null | |
fi | |
fi | |
fi | |
fi | |
fi | |
fi | |
# restart for bootstrapper, timeout/retry, ui extraction, or fail/cancel | |
if ! steam_pid > /dev/null; then | |
if [ -e "${STEAM}"/SteamNew.exe ]; then | |
tprint "${ACCT}: updating steam bootstrapper..." \ | |
$(version $(basename "${STEAM}"/steam_*.mst | grep -o \[0-9]*)) | |
screen -dmS idler-${ACCT}$ wine "${STEAM}"/steamTmp.exe SelfUpdate \ | |
"C:\Program Files\Steam\Steam.exe" \ | |
$(basename "${STEAM}"/steam_*.mst | grep -o \[0-9]*) -silent | |
while pgrep -f wine-${ACCT}/.*steamTmp.exe > /dev/null; do | |
pause | |
done | |
elif [ -e "${WINEPREFIX}"/.entry.pdl ]; then | |
return 1 | |
elif [ ! -z ${LOGIN_TIMEOUT} ]; then | |
if [ ! -z ${AUTH} ]; then | |
if [ -z ${CONFIG} ]; then | |
let AUTH_ERROR+=1 | |
if [ ${AUTH_ERROR} = 4 ]; then | |
tprint "${ACCT}: warning, reinstall for auth error... {*}" \ | |
$(prefix_size) | |
idler_uninstall > /dev/null | |
idler_install > /dev/null | |
elif [ ${AUTH_ERROR} = 5 ]; then | |
tprint "${ACCT}: error, auth error failure... {"'!}' \ | |
$(steam_connect_hash) | |
return 1 | |
else | |
tprint "${ACCT}: warning, retry on auth error... {*}" \ | |
x${AUTH_ERROR},$(steam_connect_hash) | |
fi | |
fi | |
elif [ -z ${EXTRACT} ]; then | |
if [ ! -z ${ERROR} ]; then | |
tprint "${ACCT}: error, steam server problem {"'!}' | |
elif [ ! -z ${CRED} ]; then | |
tprint "${ACCT}: error, user canceled login {"'!}' | |
else | |
tprint "${ACCT}: error, login failure {"'!}' | |
fi | |
return 1 | |
fi | |
fi | |
break | |
# close miscellaneous error windows | |
elif [ -z ${ERROR} ] && [ -z ${CRED} ] \ | |
&& window_id Steam\ -\ Error > /dev/null; then | |
ERROR=yes | |
close_window Error | |
fi | |
done | |
# wait if the user needs to accept license agreement(s) | |
if steam_pid > /dev/null; then | |
if window_id Subscriber > /dev/null; then | |
tprint "${ACCT}: waiting for eula agreement... {?}" $(steam_memory) | |
while window_id Subscriber > /dev/null; do | |
pause | |
done | |
fi | |
# bypass steam guard location notification | |
if window_id Guard\ Notification > /dev/null; then | |
tprint "${ACCT}: warning, guard location notify... {*}" \ | |
$(steam_memory) | |
close_window Guard\ Notification | |
fi | |
# restart for initial configuration | |
if ! grep -q LaunchOp "${STEAM}"/userdata/*/config/localconfig.vdf; then | |
tprint "${ACCT}: restarting for configuration..." $(steam_memory) | |
CONFIG=yes | |
idler_logout "" no > /dev/null | |
sed -i -e ':a;N;$!ba;s/"friends"\n*\s*{/&"PersonaStateDesired""0"/' \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf | |
# kill explorer.exe if using the hide flag | |
else | |
if [[ ${MODE} = *hidden* ]]; then | |
kill ${EPID} | |
fi | |
# backup credentials and ensure initial offline state | |
backup_credentials | |
while grep -q "ShowAvatars\"\s*\"1\"" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf; do | |
pause | |
done | |
idler_offline > /dev/null | |
# request verification email address for new accounts then finish | |
if [ ! -z ${F2P} ]; then | |
tprint "${ACCT}: requesting confirmation e-mail..." $(steam_memory) | |
wine_run "${STEAM}"/steam.exe steam://settings/account | |
while ! window_id Settings > /dev/null; do | |
pause 0.25 | |
done | |
focus_window Settings | |
for I in {1..10}; do | |
xdotool key Shift+Tab | |
pause 0.15 | |
done | |
for I in {1..3}; do | |
xdotool key Tab | |
pause 0.15 | |
done | |
xdotool key space | |
pause 0.15 | |
while ! window_id Verify\ Email > /dev/null; do | |
pause 0.25 | |
done | |
xdotool key Return | |
pause 3 | |
xdotool key Escape | |
pause 0.15 | |
close_window Settings | |
fi | |
tprint "${ACCT}: logged in" \ | |
@${EPID},$(steam_connect_hash),$(steam_memory) | |
date +%s > "${WINEPREFIX}"/.timestamp.pdl | |
fi | |
fi | |
done | |
fi | |
} | |
function check_account_input() | |
{ | |
# check account password and email address | |
if [ ! -z ${PASS} ]; then | |
if [ ! -z ${EMAIL} ]; then | |
MIN_LENGTH=8 | |
else | |
MIN_LENGTH=6 | |
fi | |
if (( $(expr length "${PASS}") < ${MIN_LENGTH} )); then | |
tprint "${ACCT}: error, invalid password {"'!}' | |
elif [ ! -z ${EMAIL} ] && ! echo ${EMAIL} | grep -q .*@.*\\..*; then | |
tprint "${ACCT}: error, invalid email {"'!}' | |
else | |
return 0 | |
fi | |
return 1 | |
fi | |
} | |
function idler_create() | |
{ | |
# prompt and parse input for account creation then login | |
if [ ! -d "${WINEPREFIX}" ]; then | |
if [ -z ${PASS} ]; then | |
printf "[$(date +%H:%M:%S)] ${ACCT}: input password: " | |
PASS=$(read_password) | |
echo | |
printf "[$(date +%H:%M:%S)] ${ACCT}: confirm password: " | |
CONFIRM=$(read_password) | |
echo | |
else | |
CONFIRM=${PASS} | |
fi | |
if [ ${PASS} = "${CONFIRM}" ]; then | |
if [ -z ${EMAIL} ]; then | |
printf "[$(date +%H:%M:%S)] ${ACCT}: input email: " | |
read EMAIL | |
fi | |
if check_account_input; then | |
idler_login && return 0 | |
fi | |
else | |
tprint "${ACCT}: error, passwords don't match {"'!}' | |
fi | |
elif [ ! -z ${EMAIL} ]; then | |
tprint "${ACCT}: error, account exists {"'!}' | |
fi | |
return 1 | |
} | |
function idler_website() | |
{ | |
# open relevant website in the default browser | |
if steam_uid > /dev/null; then | |
if [ "${1/.tf}" = backpack ]; then | |
SITE=backpack.tf/id/$(steam_uid) | |
elif [ "${1/.com}" = tf2items ]; then | |
SITE=tf2items.com/profiles/$(steam_uid) | |
elif [ "${1/.com}" = willitcraft ]; then | |
SITE=willitcraft.com/'#!'$(steam_uid)/ | |
elif [ "${1/.com}" = stm_com ]; then | |
SITE=steamcommunity.com/profiles/$(steam_uid)/ | |
elif [ "${1/.com}" = stm_inv ]; then | |
SITE=steamcommunity.com/profiles/$(steam_uid)/inventory/\#753 | |
else | |
SITE=tf2b.com/tf2/$(steam_uid) | |
fi | |
tprint "${ACCT}: opening website..." $(echo ${SITE} | sed "s/\/.*//") | |
xdg-open http://${SITE} 2> /dev/null | |
pause 0.1 | |
else | |
tprint "${ACCT}: error, not installed {"'!}' | |
fi | |
} | |
function idler_online() | |
{ | |
# set friend presense to online | |
if steam_pid > /dev/null && grep -q "\"PersonaStateDesired\".*\"0\"" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf; then | |
tprint "${ACCT}: signing on to friends..." $(both_memory) | |
ONLINE_TIMEOUT=0 | |
while ! grep -q "\"PersonaStateDesired\".*\"1\"" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf; do | |
if [ ${ONLINE_TIMEOUT} = 8 ]; then | |
ONLINE_TIMEOUT=0 | |
fi | |
if [ ${ONLINE_TIMEOUT} = 0 ]; then | |
wine_run "${STEAM}"/steam.exe steam://friends/status/online | |
fi | |
let ONLINE_TIMEOUT+=1 | |
pause | |
done | |
fi | |
} | |
function idler_enter() | |
{ | |
# join public chatroom and mark prior friends status | |
if steam_pid > /dev/null && ! window_id Group\ Chat > /dev/null; then | |
if cat "${STEAM}"/userdata/*/config/localconfig.vdf | tr -d '\n' \ | |
| grep -oP "\"Licenses\"\t{.*?}" | grep -q "\"[1-9][0-9]*\""; then | |
if [ ! -z ${1} ]; then | |
if [[ ${1} =~ ^[0-9]*$ ]] && (( $(expr length ${1}) >= 18 )); then | |
CHAT=${1} | |
else | |
tprint "${ACCT}: error, invalid chat id {"'!}' | |
return 1 | |
fi | |
else | |
CHAT=103582791432273268 | |
fi | |
tprint "${ACCT}: entering chat..." \#${CHAT},$(both_memory) | |
if grep -q "\"PersonaStateDesired\".*\"0\"" \ | |
"${STEAM}"/userdata/*/config/localconfig.vdf; then | |
rm -f "${STEAM}"/friends.pdl | |
else | |
touch "${STEAM}"/friends.pdl | |
fi | |
ENTER_TIMEOUT=0 | |
while ! window_id Group\ Chat viewable > /dev/null; do | |
if [ ${ENTER_TIMEOUT} = 8 ]; then | |
ENTER_TIMEOUT=0 | |
fi | |
if [ ${ENTER_TIMEOUT} = 0 ]; then | |
wine_run "${STEAM}"/steam.exe steam://friends/joinchat/${CHAT} | |
fi | |
let ENTER_TIMEOUT+=1 | |
pause | |
done | |
xdotool windowfocus $(window_id Group\ Chat) \ | |
windowmove $(window_id Group\ Chat) 636 284 | |
else | |
tprint "${ACCT}: error, chat unavailable on f2p account {"'!}' | |
fi | |
fi | |
} | |
function idler_exit() | |
{ | |
# leave public chatroom and restore prior friends status | |
if window_id Group\ Chat > /dev/null; then | |
tprint "${ACCT}: exiting chatroom..." $(both_memory) | |
close_window Group\ Chat | |
if [ ! -e "${STEAM}"/friends.pdl ]; then | |
idler_offline | |
fi | |
fi | |
} | |
function is_friend() | |
{ | |
# check if the current account is friends via the community id | |
if [ "${FRIEND_WGET}" != ${ACCT} ]; then | |
download http://steamcommunity.com/profiles/$(steam_uid)/friends \ | |
.friends.cache || return 1 | |
FRIEND_WGET=${ACCT} | |
fi | |
if ! cat .friends.cache | grep -q miniprofile=\"$(steam_cid ${1})\"; then | |
return 1 | |
fi | |
} | |
function set_account() | |
{ | |
# set the account variables, directory locations | |
ACCT=$(echo ${1/\/*} | tr [:upper:] [:lower:] | sed s/#.*//) | |
EMAIL=${1##*#} | |
PASS=$(echo ${1%#${EMAIL}} | sed "s/${ACCT}\///") | |
if [ ${PASS} = ${ACCT} ]; then | |
unset PASS | |
fi | |
if [ ${EMAIL} = ${1} ]; then | |
unset EMAIL | |
fi | |
check_account_input || return 1 | |
export WINEPREFIX="${DIR}"/wine-${ACCT} | |
STEAM="${WINEPREFIX}"/drive_c/Program\ Files/Steam | |
CON="${TF}"/con-${ACCT}.log | |
} | |
function invite_friend() | |
{ | |
# send friend invite | |
OLD_ACCT=${ACCT} | |
if [ ! -z ${2} ] && [ -d "${DIR}"/wine-${2} ]; then | |
set_account ${2} | |
fi | |
if (($(date +%s)-$(cat "${WINEPREFIX}"/.timestamp.pdl) <= 8-1)); then | |
pause $((8-($(date +%s)-$(cat "${WINEPREFIX}"/.timestamp.pdl)))) | |
fi | |
date +%s > "${WINEPREFIX}"/.timestamp.pdl | |
wine_run "${STEAM}"/steam.exe steam://friends/add/$(steam_uid ${1}) | |
FRIEND_TIMEOUT=0 | |
while ! window_id Friends\ -\ > /dev/null; do | |
pause 0.25 | |
let FRIEND_TIMEOUT+=1 | |
if [ ${FRIEND_TIMEOUT} = 12 ]; then | |
break | |
fi | |
done | |
close_window Friends\ -\ | |
set_account ${OLD_ACCT} | |
} | |
function idler_friend() | |
{ | |
# send and/or queue friend invites between initiated accounts | |
FRIEND="${ACCOUNTS}" | |
if [ ! -z ${1} ]; then | |
FRIEND=$(echo ${1} | tr [:upper:] [:lower:] | sed s/-/\ /g) | |
fi | |
unset QUEUED | |
for ADD in ${FRIEND}; do | |
if [ ${ADD} != ${ACCT} ] && [ -e cred/cred-${ADD}_* ] \ | |
&& ! grep -q ^${ADD}\#[0-9]*$ cred/.friend-${ACCT} 2> /dev/null \ | |
&& ! is_friend ${ADD}; then | |
DATE=$(date +%s) | |
echo ${ACCT}\#${DATE} >> cred/.friend-${ADD} | |
echo ${ADD}\#${DATE} >> cred/.friend-${ACCT} | |
unset ADD_UP | |
if [ "$(cat cred/.host-${ADD} 2> /dev/null)" = $(hostname) ]; then | |
ADD_UP=yes | |
fi | |
if ! steam_pid > /dev/null && [ -z ${ADD_UP} ]; then | |
let QUEUED+=1 | |
elif steam_pid > /dev/null && [ ! -z ${ADD_UP} ]; then | |
tprint "sending invites..." ${ACCT}\>\<${ADD} | |
invite_friend ${ADD} | |
invite_friend ${ACCT} ${ADD} | |
elif [ -z ${ADD_UP} ]; then | |
tprint "${ACCT}: inviting with set queue..." ${ADD} | |
invite_friend ${ADD} | |
sed -i -e "s/${ADD}#[0-9]*/${ADD}#$(($(date +%s)+1))/" \ | |
cred/.friend-${ACCT} | |
else | |
tprint "${ACCT}: set queue and inviting..." ${ADD} | |
invite_friend ${ACCT} ${ADD} | |
sed -i -e "s/${ACCT}#[0-9]*/${ACCT}#$(($(date +%s)+1))/" \ | |
cred/.friend-${ADD} | |
fi | |
fi | |
done | |
if [ ! -z ${QUEUED} ]; then | |
tprint "${ACCT}: queued invites" x${QUEUED} | |
fi | |
} | |
function tf2_license() | |
{ | |
# get tf2 license origin | |
LICENSES="$(cat "${STEAM}"/userdata/*/config/localconfig.vdf \ | |
| tr -d '\n' | grep -oP Licenses.*?{.*?})" | |
if echo ${LICENSES} \ | |
| grep -q '"469"\|"474"\|"48[2-3]"\|"498"\|"642"\|"801"\|"1289[7-8]"'; then | |
echo orange | |
elif echo ${LICENSES} | grep -q '"293"\|"499"\|"558"\|"829"\|"479"'; then | |
echo bundle | |
elif echo ${LICENSES} \ | |
| grep -q '"478"\|"113[4-5]"\|"254[6-7]"\|"793[0-1]"\|"1623[6-7]"'; then | |
echo vpack | |
elif echo ${LICENSES} \ | |
| grep -q '"502"\|"51[8-9]"\|"643"\|"687"\|"938"\|"489[5-6]"\|"6202"'; then | |
echo retail | |
elif echo ${LICENSES} | grep -q \"8538\"; then | |
echo prem | |
else | |
echo f2p | |
return 1 | |
fi | |
} | |
function reset_gameinfo_file() | |
{ | |
# reset gameinfo resources file | |
OPTS="|gameinfo_path|." | |
sed -i -e "s/\tnocrosshair 1/\tnocrosshair 0/" -e "s/\/pdl\//\/custom\//" \ | |
-e "s/mounlesd/mod/" \ | |
-e "s/\/\/\/game/game/" -e "s/\/\/\/platform/platform/" -e "/tf\/pdl-/d" \ | |
-e "s/\tmod_write/\tmod+mod_write/" -e "s/\/pdl-${ACCT}/|gameinfo_path|./" \ | |
-e "s/mod\t\t${OPTS}/mod+mod_write+default_write_path\t\t${OPTS}/" \ | |
"${TF}"/gameinfo.txt 2> /dev/null | |
} | |
function client_cache_version() | |
{ | |
# get version of client download cache | |
version $(cat "${TF}"/steam.inf 2> /dev/null | grep Client | grep -o \[0-9]*) | |
} | |
function client_version() | |
{ | |
# get current client version | |
version $(dcat "${CON}" | grep -m 1 pdlv | awk '{print $2}' | sed s/v//) | |
} | |
function item_schema() | |
{ | |
# get item schema from specified log | |
SCHEMA=$(dcat "${1}" y | grep -m 1 -o version\ \[A-F0-9][A-F0-9]* \ | |
| grep -o \[A-F0-9]*) | |
if [ -z ${SCHEMA} ]; then | |
echo noschema | |
return 1 | |
fi | |
echo \&${SCHEMA} | |
} | |
function load() | |
{ | |
# prep client files then initiate | |
mkdir -p "${TF}"/pdl-${ACCT}/cfg | |
ln -sf "${DIR}"/"${CON}" "${TF}"/pdl-${ACCT} | |
ln -sf "${DIR}"/"${TF}"/cfg/config.cfg "${TF}"/pdl-${ACCT}/cfg | |
ln -sf "${DIR}"/"${TF}"/cfg/cmd-${ACCT//./}.cfg \ | |
"${TF}"/pdl-${ACCT}/cfg/banned_ip.cfg | |
echo "" > "${STEAM}"/GameValidation.log | |
echo // > "${TF}"/cfg/cmd-${ACCT//./}.cfg | |
echo spectate > "${TF}"/cfg/join-${ACCT//./}.cfg | |
unset CONSTRUCT ERRORS LOAD_RETRY | |
while ! hl2_pid > /dev/null; do | |
unset BEGAN CLOUD ERROR READY LOAD_TIMEOUT UPDATE VALIDATE | |
# wait on gameinfo lock file | |
if [ -e "${TF}"/tf2_misc_dir.vpk ]; then | |
while [ -e .gameinfo.lock ] && [ $(cat .gameinfo.lock) != $$ ] \ | |
&& ps $(cat .gameinfo.lock) | grep -q \ [ba]*sh\ .*pdl-idler\\.sh; do | |
pause 1.$(shuf -i 1-9 -n 1) | |
done | |
echo $$ > .gameinfo.lock | |
# set client specific content write path | |
reset_gameinfo_file | |
OPTS="\t\t|gameinfo_path|.\nmod_write+default_write_path\t\ttf\/" | |
OPTS="${OPTS}pdl-${ACCT}" | |
sed -i -e "s/+mod_write+default_write_path\t\t|gameinfo_path|./${OPTS}/" \ | |
"${TF}"/gameinfo.txt | |
# remove farm content search paths | |
if [ ! -z ${2} ]; then | |
sed -i -e "s/crosshair 0/crosshair 1/" -e "s/tf\/custom\//tf\/pdl\//" \ | |
-e "s/mounlesd/mod/" \ | |
-e "s/\tgame+mod\t\t\ttf\/tf2/\t\/\/\/game+mod\t\t\ttf\/tf2/" \ | |
-e 's/\tgame+game/\t\/\/\/game+game/' \ | |
-e "s/mod+mod_write/mod_write/" \ | |
-e 's/\tgame\t\t\t\t|all_/\t\/\/\/game\t\t\t\t|all_/' \ | |
-e 's/\tplatform\t\t\t|all_/\t\/\/\/platform\t\t\t|all_/' \ | |
-e "s/\tgame+down/\t\/\/\/game+down/" \ | |
-e "s/\tgame_lv/\t\/\/\/game_lv/" "${TF}"/gameinfo.txt | |
# download hllib | |
OPTS="${TF}"/pdl/farm | |
if [ "$(cat "${OPTS}"/ver 2> /dev/null)" \ | |
!= $(client_cache_version) ]; then | |
if [ ! -e HLExtract.exe ]; then | |
tprint "downloading hllib..." v2.4.4 | |
download http://nemesis.thewavelength.net/files/files/hllib244.zip \ | |
|| exit 1 | |
unzip -j hllib244.zip bin/x86/* > /dev/null | |
rm hllib244.zip | |
fi | |
# extract/link farm resources | |
if [ -z ${CONSTRUCT} ]; then | |
CONSTRUCT=yes | |
tprint "constructing farm resources..." $(client_cache_version) | |
fi | |
rm -fr "${OPTS}" | |
mkdir -p "${OPTS}"/config "${OPTS}"/cfg "${OPTS}"/materials/console \ | |
"${OPTS}"/materials/vgui/hud "${OPTS}"/shaders/vsh \ | |
"${OPTS}"/shaders/psh | |
ln -sf "${TF}"/../platform/config/ingamedialogconfig.vdf \ | |
"${OPTS}"/config | |
echo -e "exec \"autoexec\"\nstuffcmds" > "${OPTS}"/cfg/valve.rc | |
wine_run HLExtract.exe -s -p "${TF}"/../hl2/hl2_textures_dir.vpk \ | |
-e "root\\materials\\console\\startup_loading.vtf" \ | |
-d "${OPTS}"/materials/console | |
wine_run HLExtract.exe -s -p "${TF}"/../hl2/hl2_misc_dir.vpk \ | |
-e "root\\materials\\console\\startup_loading.vmt" \ | |
-d "${OPTS}"/materials/console | |
wine_run HLExtract.exe -s -p "${TF}"/../hl2/hl2_misc_dir.vpk \ | |
-e "root\\materials\\vgui\\hud\\800corner.vmt" \ | |
-e "root\\materials\\vgui\\hud\\800corner1.vmt" \ | |
-e "root\\materials\\vgui\\hud\\800corner2.vmt" \ | |
-e "root\\materials\\vgui\\hud\\800corner3.vmt" \ | |
-e "root\\materials\\vgui\\hud\\800corner4.vmt" \ | |
-d "${OPTS}"/materials/vgui/hud | |
wine_run HLExtract.exe -s -p "${TF}"/../hl2/hl2_misc_dir.vpk \ | |
-e "root\\shaders\\psh\\unlitgeneric.vcs" -d "${OPTS}"/shaders/psh | |
wine_run HLExtract.exe -s -p "${TF}"/../hl2/hl2_misc_dir.vpk \ | |
-e "root\\shaders\\vsh\\unlitgeneric_vs11.vcs" \ | |
-d "${OPTS}"/shaders/vsh | |
wine_run HLExtract.exe -s -p "${TF}"/tf2_textures_dir.vpk \ | |
-e "root\\materials\\console\\background01.vtf" \ | |
-d "${OPTS}"/materials/console | |
wine_run HLExtract.exe -s -p "${TF}"/tf2_misc_dir.vpk \ | |
-e "root\\scripts"-e "root\\resource" -d "${OPTS}" | |
ln -sf "${DIR}"/"${TF}"/../hl2/scripts/surfaceproperties.txt \ | |
"${DIR}"/"${TF}"/../hl2/scripts/surfaceproperties_hl2.txt \ | |
"${OPTS}"/scripts | |
ln -sf "${DIR}"/"${TF}"/scripts/items/items_game.txt \ | |
"${OPTS}"/scripts/items | |
ln -sf "${DIR}"/"${TF}"/steam.inf "${OPTS}" | |
# alter select vgui dimensions to assist helper then mark version | |
sed -i -e 's/\t\t"SelectPlayerDialog"/&\n"wide""640"/' \ | |
-e 's/\t\t"CancelButton"/&\n"ypos""0""wide""640""tall""640"/' \ | |
-e s/buttonclick.wav/selectmosthelpfulfrienddialog.wav/ \ | |
"${OPTS}"/resource/ui/selectmosthelpfulfrienddialog.res | |
sed -i -e 's/\t\t"CloseButton"/&\n"ypos""0""tall""600""wide""800"/' \ | |
"${OPTS}"/resource/ui/econ/itempickuppanel.res | |
sed -i -e s/\"250\"/\"800\"/ -e s/\"150\"/\"600\"/ \ | |
-e s/\"100\"/\"800\"/ -e s/\"25\"/\"600\"/ \ | |
-e s/buttonclick.wav/storestatusdialog.wav/ \ | |
"${OPTS}"/resource/ui/econ/store/v1/storestatusdialog.res | |
client_cache_version > "${OPTS}"/ver | |
fi | |
fi | |
fi | |
# launch tf2 | |
wait_for_stop | |
wine_run "${STEAM}"/steam.exe -applaunch 440 -pdl ${1} | |
while ! hl2_pid > /dev/null; do | |
pause | |
# if cloud conflicts, warn then bypass | |
if [ -z ${CLOUD} ] && window_id "Conflict\|Warning" > /dev/null; then | |
CLOUD=yes | |
tprint "${ACCT}: warning, cloud conflict... {*}" $(steam_memory) | |
focus_window $(window_id "Conflict\|Warning") | |
xdotool key Return | |
fi | |
# if game is unavailable, warn then retry 3 times | |
if [ -z ${ERROR} ]; then | |
if window_id Error > /dev/null; then | |
ERROR=yes | |
if [ -d steamapps/common/OpenVR ]; then | |
let ERRORS+=1 | |
if [ ${ERRORS} = 1 ]; then | |
tprint "${ACCT}: warning, game unavailable... {*}" $(steam_memory) | |
fi | |
else | |
tprint "${ACCT}: waiting on openvr download..." $(steam_memory) | |
fi | |
close_window Error | |
while [ ! -d steamapps/common/OpenVR ]; do | |
pause | |
done | |
if [ "${ERRORS}" = 3 ]; then | |
tprint "${ACCT}: fatal, steam servers down {"'!}' $(steam_memory) | |
exit 1 | |
fi | |
fi | |
elif ! window_id Error > /dev/null; then | |
break | |
fi | |
# if updating, warn then (re)modify ui if farming and retry after complete | |
if [ -z ${UPDATE} ] && window_id Updating > /dev/null; then | |
UPDATE=yes | |
tprint "${ACCT}: warning, updating tf2... {*}" \ | |
$(client_cache_version),$(steam_memory) | |
elif [ -z ${READY} ]; then | |
if window_id Ready > /dev/null; then | |
READY=yes | |
if [ -z ${UPDATE} ]; then | |
tprint "${ACCT}: warning, game readied... {*}" $(steam_memory) | |
fi | |
close_window Ready | |
elif [ ! -z ${UPDATE} ] && ! window_id Updating > /dev/null; then | |
pause 2 | |
if ! window_id Ready > /dev/null; then | |
tprint "${ACCT}: error, user cancelled update {"'!}' $(steam_memory) | |
return 1 | |
fi | |
fi | |
elif ! window_id Ready > /dev/null; then | |
break | |
fi | |
# if validating, warn then retry after completion/bypass | |
if [ -z ${VALIDATE} ]; then | |
if window_id Validating > /dev/null; then | |
VALIDATE=yes | |
tprint "${ACCT}: warning, validating tf2... {*}" $(steam_memory) | |
fi | |
elif ! window_id Validating > /dev/null; then | |
break | |
elif window_id "Validating Steam files - [1-9][0-9]%" > /dev/null \ | |
&& [ ! -z ${START} ] || grep -q plete: "${STEAM}"/GameValidation.log; then | |
tprint "${ACCT}: completing validation..." $(steam_memory) | |
close_window Validating | |
fi | |
# interpret user cancel and handle launch failures | |
if [ -z ${BEGAN} ]; then | |
if window_id Fortress > /dev/null; then | |
BEGAN=yes | |
elif [ "${LOAD_TIMEOUT}" != 10 ]; then | |
let LOAD_TIMEOUT+=1 | |
else | |
LOAD_TIMEOUT=0 | |
let LOAD_RETRY+=1 | |
tprint "${ACCT}: warning, retrying launch... {*}" \ | |
x${LOAD_RETRY},$(steam_memory) | |
if [ ${LOAD_RETRY} = 5 ]; then | |
tprint "${ACCT}: error, launch failed... {"'!}' $(steam_memory) | |
return 1 | |
elif [ ${LOAD_RETRY} = 4 ]; then | |
tprint "${ACCT}: warning, retrying login... {*}" $(steam_memory) | |
idler_logout yes > /dev/null || return 1 | |
idler_login $(cat "${WINEPREFIX}"/.login.pdl) > /dev/null \ | |
|| return 1 | |
fi | |
break | |
fi | |
elif ! window_id Fortress > /dev/null && ! hl2_pid > /dev/null \ | |
&& [ -z ${UPDATE}${ERROR}${VALIDATE} ] \ | |
&& app_state | grep -m 1 "Installed,$\|App Running,$" \ | |
| grep -q Installed,; then | |
tprint "${ACCT}: error, user cancelled start {"'!}' $(steam_memory) | |
return 1 | |
fi | |
done | |
done | |
# finish and write current version to console log | |
START=yes | |
echo "pdlv $(version $(cat "${TF}"/steam.inf 2> /dev/null | grep Client \ | |
| grep -o \[0-9]*))" >> "${CON}" | |
# disable power management | |
if pgrep -f gnome-power-manager > /dev/null; then | |
tprint "stopped gnome-power-manager" @$(pgrep -f gnome-power-manager) | |
killall -w gnome-power-manager | |
elif pgrep -f xfce4-power-manager > /dev/null; then | |
tprint "stopped xfce4-power-manager" @$(pgrep -f xfce4-power-manager) | |
kill -9 $(pgrep -f xfce4-power-manager) | |
fi | |
# wait for client to load | |
tprint "${ACCT}: loading tf2..." @$(hl2_pid),$(both_memory) | |
while ! grep -q Disconnect "${CON}"; do | |
pause | |
if ! hl2_pid > /dev/null; then | |
tprint "${ACCT}: error, client crashed {"'!}' $(steam_memory) | |
return 1 | |
fi | |
done | |
# wait for item schema to apply then reset gameinfo file/lock | |
tprint "${ACCT}: getting schema..." $(client_version),$(both_memory) | |
unset LOAD_TIMEOUT | |
while ! item_schema "${CON}" > /dev/null; do | |
pause | |
let LOAD_TIMEOUT+=1 | |
if [ ${LOAD_TIMEOUT} = 180 ]; then | |
tprint "${ACCT}: warning, item schema missing {*}" $(both_memory) | |
break | |
elif dcat "${CON}" y | grep -q "Failed to update item schema"; then | |
tprint "${ACCT}: error, item schema failed {"'!}' $(both_memory) | |
idler_stop > /dev/null | |
return 1 | |
fi | |
done | |
reset_gameinfo_file | |
rm -f .gameinfo.lock | |
tprint "${ACCT}: client started" $(item_schema "${CON}"),$(both_memory) | |
} | |
function idler_play() | |
{ | |
# start client | |
if ! hl2_pid > /dev/null; then | |
idler_login ${1} || return 1 | |
tprint "${ACCT}: preparing tf2..." \$$(tf2_license),$(steam_memory) \ | |
| tee "${CON}" | |
echo _acmd$(client_fps y)\;_amove\;_mping \ | |
> "${TF}"/cfg/alias-${ACCT//./}.cfg | |
load | |
fi | |
} | |
function idler_command() | |
{ | |
# parse or accept input then run command on the client | |
if hl2_pid > /dev/null; then | |
COMMAND="${1}" | |
if [ -z "${COMMAND}" ]; then | |
printf "[$(date +%H:%M:%S)] ${ACCT}: input command: " | |
read COMMAND | |
if [ -z "${COMMAND}" ]; then | |
tprint "${ACCT}: fatal, no input {"'!}' | |
exit 1 | |
fi | |
fi | |
tprint "${ACCT}: running '${COMMAND}'..." $(both_memory) | |
cmd "${COMMAND}" | |
fi | |
} | |
function idler_join() | |
{ | |
# join specified or random team and class | |
if client_map > /dev/null; then | |
if [ -z ${TEAM} ]; then | |
if [[ ${1} = *-* ]]; then | |
TEAM=${1/-*} | |
CLASS=${1/*-} | |
if [ $(echo ${TEAM} | tr [:upper:] [:lower:]) = blu ]; then | |
TEAM=blue | |
fi | |
if [ $(echo ${CLASS} | tr [:upper:] [:lower:]) = heavy ]; then | |
CLASS=heavyweapons | |
fi | |
else | |
TEAM=auto | |
CLASS=auto | |
fi | |
fi | |
tprint "${ACCT}: joining team/class..." ${TEAM}/${CLASS},$(both_memory) | |
echo "jointeam ${TEAM};wait 300;joinclass ${CLASS}" \ | |
> "${TF}"/cfg/join-${ACCT//./}.cfg | |
cmd "jointeam ${TEAM};wait 300;joinclass ${CLASS}" | |
fi | |
} | |
function idler_spectate() | |
{ | |
# join spectators | |
if client_map > /dev/null; then | |
tprint "${ACCT}: joining spectators..." $(both_memory) | |
echo spectate > "${TF}"/cfg/join-${ACCT//./}.cfg | |
cmd spectate | |
fi | |
} | |
function server_cache_version() | |
{ | |
# get version of server download | |
version $(grep Server srcds/tf/steam.inf 2> /dev/null | grep -o \[0-9]*) | |
} | |
function compile_plugin() | |
{ | |
# compile and install server plugin | |
( cd ${SMOD}/scripting | |
./compile.sh ${1} > /dev/null | |
mv compiled/${1}.smx ../plugins/${1}.smx | |
) | |
} | |
function total_memory() | |
{ | |
# get total system memory | |
echo $(($(cat /proc/meminfo | grep MemTotal | awk '{print $2}')/1000)) | |
} | |
function total_swap() | |
{ | |
# get total system swap | |
echo $(($(cat /proc/meminfo | grep SwapTotal | awk '{print $2}')/1000)) | |
} | |
function server_version() | |
{ | |
# get current server version via port number | |
version $(dcat srcds/tf/con-2810${1:(-1)}.log | grep -m 1 pdlv \ | |
| awk '{print $2}' | sed s/v//) | |
} | |
# set command line options for textmode clients | |
TEXTMODE_OPTS="-noborder -nomouse +mat_managedtextures 0 +mat_mipmaptextures 0" | |
TEXTMODE_OPTS="${TEXTMODE_OPTS} +mat_phong 0" | |
function idler_start() | |
{ | |
# start client in textmode | |
if ! hl2_pid > /dev/null; then | |
idler_login ${1} || return 1 | |
tprint "${ACCT}: preparing textmode tf2..." \ | |
\$$(tf2_license),$(steam_memory) | tee "${CON}" | |
{ | |
echo "_acmd$(client_fps y);_amove;_mping" | |
echo "alias _ajoin \"exec join-${ACCT//./};wait 15000;_ajoin\"" | |
echo "_ajoin" | |
echo "alias _ateam \"changeteam;wait 3000;_ateam\"" | |
echo "_ateam" | |
echo "mat_texture_limit 0" | |
} > "${TF}"/cfg/alias-${ACCT//./}.cfg | |
load "${TEXTMODE_OPTS} -textmode" || return 1 | |
echo _acmd$(client_fps y)\;_amove\;_mping \ | |
> "${TF}"/cfg/alias-${ACCT//./}.cfg | |
fi | |
} | |
function idler_connect() | |
{ | |
# if specified, check location server/map | |
unset LOCATION TEST | |
if [ ! -z ${1} ]; then | |
TEST=${1} | |
if [[ ${TEST} = *.* ]]; then | |
TEST=${1} | |
if [[ ${TEST} != *:* ]]; then | |
TEST="${TEST} 27015" | |
fi | |
TEST="${TEST/:/ }" | |
if ! ping -c1 -W1 $(echo ${TEST} | awk '{print $1}') > /dev/null \ | |
|| ! nc -vzu ${TEST} 2> /dev/null; then | |
tprint "warning, no server on ${1} (*)" | |
unset TEST | |
else | |
LOCATION="connect ${1}" | |
if [[ ${LOCATION} != *:* ]]; then | |
LOCATION="connect ${1}:27015" | |
fi | |
fi | |
else | |
LOCATION="map ${1}" | |
fi | |
fi | |
# if no location server, use idle server on first available server or port | |
if [ -z "${TEST}" ]; then | |
unset PORT | |
for NUM in {1..9}; do | |
if ! pgrep -f srcds_linux.*2810${NUM} > /dev/null; then | |
if [ -z ${PORT} ]; then | |
PORT=2810${NUM} | |
fi | |
elif [ -e srcds/tf/con-2810${NUM}.log ] \ | |
&& [ $(server_playercount ${NUM}) != ${IDLE_MAX} ] \ | |
|| [[ $(client_connection) = *2810${NUM} ]]; then | |
PORT=2810${NUM} | |
break | |
fi | |
done | |
if ! pgrep -f srcds_linux.*${PORT} > /dev/null; then | |
# install steamcmd | |
if [ ! -e steamcmd/steamcmd.sh ]; then | |
tprint "installing steamcmd..." | |
mkdir -p steamcmd | |
rm -fr steamcmd/* | |
download media.steampowered.com/client/steamcmd_linux.tar.gz || exit 1 | |
tar -xzf steamcmd_linux.tar.gz -C steamcmd | |
rm steamcmd_linux.tar.gz | |
NEW="validate" | |
fi | |
# check/update server content, create log file with the output, then link | |
while ! grep -q "Success. App '232250'" screenlog.0 2> /dev/null; do | |
if ! pgrep steamcmd > /dev/null; then | |
if [ -z ${FAILED} ]; then | |
tprint "checking server content..." $(server_cache_version) | |
fi | |
rm -f ${HOME}/Steam 2> /dev/null | |
if [ -d ${HOME}/Steam ]; then | |
rm -fr ${HOME}/Steam-other | |
mv ${HOME}/Steam ${HOME}/Steam-other 2> /dev/null | |
fi | |
ln -sf "${DIR}"/steamcmd ${HOME}/Steam | |
if [ -d ${HOME}/.steam ]; then | |
rm -fr ${HOME}/.steam-other | |
mv ${HOME}/.steam ${HOME}/.steam-other 2> /dev/null | |
mv ${HOME}/.steamp* ${HOME}/.steam-other 2> /dev/null | |
fi | |
rm -f screenlog.0 | |
screen -dmLS idler-server$ sh steamcmd/steamcmd.sh +login anonymous \ | |
+force_install_dir ../srcds +app_update 232250 ${NEW} +quit | |
while ! pgrep steamcmd > /dev/null; do | |
pause | |
done | |
else | |
DOWNLOADING=unknown | |
tprint "resuming server content check/download..." \ | |
@$(pgrep steamcmd),$(server_cache_version) | |
fi | |
unset FAILED | |
while ! grep -q "Success. App '232250'" screenlog.0 2> /dev/null; do | |
if grep -q "Failed to receive license" screenlog.0 2> /dev/null; then | |
tprint "warning: steamcmd failed, retrying... {*}" nolicense | |
killall -w $(pgrep steamcmd) | |
fi | |
if ! pgrep steamcmd > /dev/null; then | |
FAILED=yes | |
break | |
fi | |
if grep -q "downloading, progress" screenlog.0 2> /dev/null \ | |
&& [ -z ${DOWNLOADING} ]; then | |
DOWNLOADING=yes | |
tprint "downloading server content..." @$(pgrep steamcmd) | |
fi | |
pause | |
done | |
done | |
rm -f ${HOME}/Steam | |
mv ${HOME}/Steam-other ${HOME}/Steam 2> /dev/null | |
mv ${HOME}/.steam-other/.steamp* ${HOME} 2> /dev/null | |
mv ${HOME}/.steam-other ${HOME}/.steam 2> /dev/null | |
rm -fr steamcmd/userdata/* | |
DATE=$(date +%Y-%m-%d_%H.%M.%S) | |
mkdir -p logs | |
cat screenlog.0 > logs/${DATE}-server${PORT:(-1)}.log | |
rm -f screenlog.0 | |
ln -sf "${DIR}"/logs/${DATE}-server${PORT:(-1)}.log \ | |
srcds/tf/con-${PORT}.log | |
# install metamod/sourcemod | |
SMOD=srcds/tf/addons/sourcemod | |
OPTS=newyork.download.maverickservers.com/source | |
MS=${OPTS}/mmsource-1.10.0-linux.tar.gz | |
if [ ! -e srcds/tf/${MS##*/} ]; then | |
tprint "installing/updating metamod:source..." \ | |
v$(echo ${MS/*mmsource-} | sed -e "s/-linux.tar.gz//") | |
rm -fr srcds/tf/mmsource-*-linux.tar.gz srcds/tf/addons/metamod/bin | |
download ${MS} srcds/tf || exit 1 | |
tar -xzf srcds/tf/${MS##*/} -C srcds/tf | |
download www.sourcemm.net/vdf?vdf_game=tf \ | |
srcds/tf/addons/metamod.vdf || exit 1 | |
fi | |
SM=${OPTS}/sourcemod-1.5.2-linux.tar.gz | |
if [ ! -e srcds/tf/${SM##*/} ]; then | |
tprint "installing/updating sourcemod..." \ | |
v$(echo ${SM/*sourcemod-} | sed -e "s/-linux.tar.gz//") | |
rm -fr srcds/tf/sourcemod-*-linux.tar.gz srcds/tf/cfg/sourcemod ${SMOD} | |
download ${SM} srcds/tf || exit 1 | |
tar -xzf srcds/tf/${SM##*/} -C srcds/tf | |
sed -i -e "s/Logging\"\t\t\"on\"/Logging\"\t\t\"off\"/" \ | |
${SMOD}/configs/core.cfg | |
mv ${SMOD}/plugins/*.smx ${SMOD}/plugins/disabled | |
mv ${SMOD}/extensions/dbi.*.ext.so ${SMOD}/plugins/disabled | |
echo // > srcds/tf/cfg/sourcemod/sourcemod.cfg | |
fi | |
# install sourceirc | |
if [ -z ${IRC_SERVER} ]; then | |
IRC_SERVER=irc.freenode.net | |
fi | |
if [ -z ${IRC_SERVER_PASS} ]; then | |
IRC_SERVER_PASS="" | |
fi | |
if [ -z ${IRC_SERVER_PORT} ]; then | |
IRC_SERVER_PORT=6667 | |
fi | |
if [ -z ${IRC_CHANNEL} ]; then | |
IRC_CHANNEL=primarydataloop | |
fi | |
if [ -z ${IRC_CHANNEL_PASS} ]; then | |
IRC_CHANNEL_PASS="" | |
fi | |
if [ ${IRC_SERVER} != none ]; then | |
SOURCEIRC=sourceircB | |
if [ ! -e ${SMOD}/${SOURCEIRC}.zip ]; then | |
rm -f ${SMOD}/sourceirc*.zip | |
download http://tinyurl.com/l7j97dk ${SMOD}/${SOURCEIRC}.zip || exit 1 | |
unzip -d ${SMOD} -o ${SMOD}/${SOURCEIRC}.zip > /dev/null | |
VER=v$(cat ${SMOD}/scripting/include/sourceirc.inc \ | |
| grep -o -m1 \".*\" | sed -e "s/\"//g" -e "s/ /_/g" \ | |
)-${SOURCEIRC:(-1)} | |
tprint "installing sourceirc..." ${VER} | |
download http://tinyurl.com/n85heef srcds/tf/socket_3.0.1.zip \ | |
|| exit 1 | |
unzip -d srcds/tf -o srcds/tf/socket_3.0.1.zip > /dev/null | |
mkdir -p ${SMOD}/scripting/compiled/SourceIRC | |
OPTS="StrEqual(command, \"366\")) {\n\t\tPrintToServer(\"pdlirc\");" | |
sed -i -e "s/CloseHandle(connected);/&\n\t} else if (${OPTS}/" \ | |
${SMOD}/scripting/SourceIRC/sourceirc.sp | |
compile_plugin SourceIRC/sourceirc | |
OPTS="if (strcmp(reason, \"Disconnect by user.\", false) == 0)" | |
OPTS="${OPTS}\nreturn Plugin_Handled;" | |
sed -i -e 's/, sizeof(reason));/, sizeof(reason));\n'"${OPTS}/" \ | |
-e "s/\"%t\", \"Player Con/\"\\\x0315%t\\\x03\", \"Player Con/" \ | |
-e 's/OnMapEnd()/OnMapEndpdl()/' \ | |
${SMOD}/scripting/SourceIRC/sourceirc-relayall.sp | |
compile_plugin SourceIRC/sourceirc-relayall | |
sed -i -e "s/GetClientCount()/GetClientCount(false)/g" \ | |
${SMOD}/scripting/SourceIRC/sourceirc-status.sp | |
compile_plugin SourceIRC/sourceirc-status | |
rm ${SMOD}/plugins/SourceIRC/sourceirc-[b-k]* \ | |
${SMOD}/plugins/SourceIRC/sourceirc-rcon.smx \ | |
${SMOD}/plugins/SourceIRC/sourceirc-ticket.smx | |
fi | |
mv ${SMOD}/plugins/disabled/SourceIRC ${SMOD}/plugins 2> /dev/null | |
NAME=$(hostname | sed -e s/-// -e s/_// | cut -c 1-13)_${PORT:(-1)}- | |
OPTS="\t\t\"password\"\t\"" | |
sed -i -e "s/\"server\"\t\".*\"/\"server\"\t\"${IRC_SERVER}\"/" \ | |
-e "s/\"port\"\t\t\".*\"/\"port\"\t\t\"${IRC_SERVER_PORT}\"/" \ | |
-e "s/\"nickname\"\t\".*\"/\"nickname\"\t\"${NAME}\"/" \ | |
-e "s/${OPTS}.*\"/${OPTS}${IRC_SERVER_PASS}\"/" \ | |
-e "s/\t\"cmd_/\/\/\"cmd_/" \ | |
-e "s/\t\t${OPTS}.*\"/\t\t${OPTS}${IRC_CHANNEL_PASS}\"/" \ | |
-e "s/\"#.*\"/\"#${IRC_CHANNEL}\"/" ${SMOD}/configs/sourceirc.cfg | |
else | |
mv ${SMOD}/plugins/SourceIRC ${SMOD}/plugins/disabled 2> /dev/null | |
fi | |
# compile idle server plugin | |
{ | |
echo "#include <sdktools>" | |
echo "#include <tf2_stocks>" | |
echo "new Float:location[][3] = {{-1383.0,3018.0,-9550.0}," | |
echo " {-372.0,-1417.0,-10019.0},{1647.0,952.0,-14076.0}," | |
echo " {6320.0,7540.0,-4765.0}};" | |
echo "public Event_PlayerSpawn(Handle:evt, const String:n[], bool:db)" | |
echo "{" | |
echo " new c = GetClientOfUserId(GetEventInt(evt, \"userid\"));" | |
echo " decl String:map[50];" | |
echo " GetCurrentMap(map, sizeof(map));" | |
echo " if (strcmp(map, \"cp_manor_event\", false) == 0) {" | |
echo " TeleportEntity(c, location[0], NULL_VECTOR, NULL_VECTOR);" | |
echo " } else if (strcmp(map, \"koth_lakeside_event\", false) == 0) {" | |
echo " TeleportEntity(c, location[1], NULL_VECTOR, NULL_VECTOR);" | |
echo " } else if (strcmp(map, \"koth_viaduct_event\", false) == 0) {" | |
echo " TeleportEntity(c, location[2], NULL_VECTOR, NULL_VECTOR);" | |
echo " } else if (strcmp(map, \"plr_hightower_event\", false) == 0) {" | |
echo " TeleportEntity(c, location[3], NULL_VECTOR, NULL_VECTOR);" | |
echo " } else {" | |
echo " return;" | |
echo " }" | |
echo " SetEntProp(c, Prop_Data, \"m_takedamage\", 0, 1);" | |
echo " SetEntPropFloat(c, Prop_Send, \"m_flModelScale\", 5000.0);" | |
echo "}" | |
echo "PrintPlayerCount() {" | |
echo " decl String:t[15];" | |
echo " FormatTime(t, 15, \"%D-%H:%M\", GetTime());" | |
echo " PrintToServer(\"[%s] Players: %d\", t, GetClientCount(false));" | |
echo "}" | |
echo "public OnPluginStart() {" | |
echo " PrintPlayerCount();" | |
echo " HookEvent(\"player_spawn\", Event_PlayerSpawn);" | |
echo "}" | |
echo "public bool:OnClientConnect(c, String:rejectmsg[], maxlen) {" | |
echo " decl String:tvnochat[2];" | |
echo " GetClientInfo(c, \"tv_nochat\", tvnochat, 2);" | |
echo " if (strcmp(tvnochat, \"1\", false) == 0) {" | |
echo " InactivateClient(c);" | |
echo " }" | |
echo " PrintPlayerCount();" | |
echo " return true;" | |
echo "}" | |
echo "public OnClientPutInServer(c) {" | |
echo " if (GetRandomInt(0, 1) == 1) {" | |
echo " ChangeClientTeam(c, _:TFTeam_Blue);" | |
echo " } else {" | |
echo " ChangeClientTeam(c, _:TFTeam_Red);" | |
echo " }" | |
echo " TF2_SetPlayerClass(c, TFClass_Heavy, false);" | |
echo "}" | |
echo "public OnClientDisconnect_Post(c) {" | |
echo " PrintPlayerCount();" | |
echo " return true;" | |
echo "}" | |
} > ${SMOD}/scripting/pdl-idler.sp | |
compile_plugin pdl-idler | |
# choose map | |
if [ -z ${IDLE_MAP} ]; then | |
if (($(date +%j) > 301)) && (($(date +%j) < 315)); then | |
RAND=$(shuf -i 1-4 -n 1) | |
if [ ${RAND} = 1 ]; then | |
IDLE_MAP=cp_manor_event | |
elif [ ${RAND} = 2 ]; then | |
IDLE_MAP=koth_viaduct_event | |
elif [ ${RAND} = 3 ]; then | |
IDLE_MAP=koth_lakeside_event | |
else | |
IDLE_MAP=plr_hightower_event | |
fi | |
if [ ! -e srcds/tf/cfg/autoexec.cfg ]; then | |
cmd cl_gameserver_create_identity | |
while ! dcat "${CON}" y | grep -q tf_server_identity_account_id \ | |
|| ! dcat "${CON}" y | grep -q tf_server_identity_token; do | |
pause | |
done | |
{ | |
dcat "${CON}" y | grep -o tf_server_identity_account_id.* | |
dcat "${CON}" y | grep -o tf_server_identity_token.* | |
echo "tf_server_identity_disable_quickplay \"1\"" | |
} > srcds/tf/cfg/autoexec.cfg | |
fi | |
else | |
rm -f srcds/tf/cfg/autoexec.cfg | |
IDLE_MAP=cp_cloak | |
fi | |
fi | |
# write current version to console log then start server | |
echo "pdlv $(version $(grep Server srcds/tf/steam.inf 2> /dev/null \ | |
| grep -o \[0-9]*))" >> srcds/tf/con-${PORT}.log | |
tprint "loading server..." \#${PORT:(-1)},$(server_version ${PORT}) \ | |
| tee -a srcds/tf/con-${PORT}.log | |
( cd srcds | |
screen -dmS idler-server${PORT:(-1)}$ ./srcds_run ${COMMON_OPTS} \ | |
-game tf -norestart -port ${PORT} -replay +sv_cheats 1 \ | |
+con_logfile con-${PORT}.log +fps_max 10 +hostname $(whoami)_$(\ | |
total_memory)+$(total_swap)_${DRIVER} +ip 0.0.0.0 +maxplayers 32 \ | |
+mp_autoteambalance 0 +mp_idledealmethod 0 +mp_timelimit 0 \ | |
+sv_pure 0 +sv_timeout 0 +map ${IDLE_MAP} | |
) | |
while ! grep -q ${IDLE_MAP}\.cfg srcds/tf/con-${PORT}.log; do | |
pause | |
done | |
tprint "getting server schema..." \ | |
@$(pgrep -f srcds_linux.*${PORT}),$(server_memory ${PORT}) | |
while ! item_schema srcds/tf/con-${PORT}.log > /dev/null; do | |
pause | |
done | |
# wait for server item schema and irc relay channel join | |
if [ "${IRC_SERVER}" != none ]; then | |
tprint "connecting server to irc..." \ | |
$(cat ${SMOD}/configs/sourceirc.cfg | grep nickname\".* \ | |
| sed -e s/\"nickname\"// -e s/\"//g -e s/-// \ | |
),$(server_memory ${PORT}) | |
while ! grep pdlirc srcds/tf/con-${PORT}.log > /dev/null; do | |
pause | |
done | |
fi | |
tprint "server started" \ | |
$(item_schema srcds/tf/con-${PORT}.log),$(server_memory ${PORT}) | |
fi | |
# get network device ip | |
for NET in $(cat /proc/net/dev | grep : | cut -d ':' -f 1); do | |
if [ ${NET} != lo ]; then | |
LOCATION=$(ip addr show ${NET} | grep "inet " | awk '{print $2}' \ | |
| sed -e "s/\/.*//") | |
if [ ! -z ${LOCATION} ]; then | |
LOCATION="connect ${LOCATION}:${PORT}" | |
break | |
fi | |
fi | |
done | |
# restart low-resource client if connecting to a location server | |
elif hl2_pid noshaderap > /dev/null && [[ ${LOCATION/*:} != 2810[0-9] ]]; then | |
tprint "${ACCT}: warning, restarting low-resource client... {*}" \ | |
$(both_memory) | |
idler_stop | |
fi | |
# if there is no running client, start it in textmode | |
if ! hl2_pid > /dev/null; then | |
idler_start || return 1 | |
fi | |
# proceed if not already connected to specified server | |
if ! dcat "${CON}" y | grep -m 1 ": Disconnect\|: Connected to" \ | |
| grep -q ${LOCATION/* /}; then | |
if client_connection > /dev/null; then | |
idler_disconnect | |
fi | |
# lower fps if connecting to an idle server | |
if hl2_pid noshaderapi > /dev/null && [ $(client_fps) != 1 ]; then | |
change_client_fps 1 | |
fi | |
# issue location command then wait till connected or in-game | |
PLAYER_COUNT=$(server_playercount ${PORT}) | |
if [[ "${LOCATION}" != map* ]]; then | |
tprint "${ACCT}: querying server..." \ | |
$(echo ${LOCATION:8} | sed "s/:.*//"),$(both_memory) | |
else | |
tprint "${ACCT}: loading map..." $(both_memory) | |
fi | |
if ! cmd "${LOCATION}"; then | |
return 1 | |
else | |
if [[ "${LOCATION}" != map* ]]; then | |
while ! client_connection > /dev/null; do | |
pause | |
if dcat "${CON}" | grep -q Bad\ challenge; then | |
tprint "${ACCT}: warning, bad challenge... {*}" $(both_memory) | |
cmd retry | |
elif dcat "${CON}" | grep -q "newer version\|older version" \ | |
|| dcat "${CON}" | grep -q "#GameUI_ServerReject.*Version"; then | |
tprint "${ACCT}: error, version mismatch... {"'!}' $(both_memory) | |
if hl2_pid noshaderapi > /dev/null; then | |
idler_stop > /dev/null | |
fi | |
return 1 | |
fi | |
done | |
fi | |
if ! hl2_pid noshaderapi > /dev/null; then | |
while ! client_map > /dev/null; do | |
if ! hl2_pid > /dev/null; then | |
return 1 | |
fi | |
pause | |
done | |
if hl2_pid textmode > /dev/null \ | |
&& ! grep -q spectate "${TF}"/cfg/join-${ACCT//./}.cfg; then | |
cmd "exec join-${ACCT//./}" | |
fi | |
MAP=$(client_map), | |
elif [[ "${LOCATION}" = connect\ $(net_address):2810[0-9] ]]; then | |
MAP={$((PLAYER_COUNT+1))/$((IDLE_MAX+1))},\#"${LOCATION:(-1)}", | |
while [ $(server_playercount "${LOCATION:(-1)}") = 0 ]; do | |
pause | |
done | |
fi | |
if [ ! -z ${FARM_TIME} ]; then | |
FARM_TIME=$(($(date +%s)-$FARM_TIME)) | |
H=$((FARM_TIME/3600)) | |
if [ ${H} != 0 ]; then | |
H=${H}: | |
else | |
unset H | |
fi | |
tprint "${ACCT}: connected" \ | |
+${H}$(printf "%d:%02d" $((FARM_TIME%3600/60)) \ | |
$((FARM_TIME%60))),${MAP}$(both_memory) | |
else | |
tprint "${ACCT}: connected" ${MAP}$(both_memory) | |
fi | |
fi | |
fi | |
} | |
function idler_farm() | |
{ | |
# (re)login in low-resource+hidden mode on first available X server/display | |
if steam_pid > /dev/null && ! steam_pid farm > /dev/null; then | |
tprint "${ACCT}: warning, restarting normal steam... {*}" $(both_memory) | |
idler_logout > /dev/null | |
fi | |
if [ ${DISPLAY} = ${X_DISPLAY} ]; then | |
export DISPLAY=:$((${X_DISPLAY:1:1}+1)).0 | |
fi | |
while [ 1 ]; do | |
if [ $(pgrep -f "wine-.*/.*steam\.exe.*farm${DISPLAY:1:1}" | wc -l) \ | |
!= $((IDLE_MAX*2)) ]; then | |
break | |
fi | |
export DISPLAY=:$((${DISPLAY:1:1}+1)).0 | |
done | |
idler_login low-hide || return 1 | |
# if there is no client, start it with 1fps/nosound/noshaderapi then connect | |
if ! hl2_pid > /dev/null; then | |
tprint "${ACCT}: preparing farm tf2..." \ | |
\$$(tf2_license),$(steam_memory) | tee "${CON}" | |
{ | |
echo "alias _acmd1 \"exec cmd-${ACCT//./};wait 4;_acmd1\"" | |
echo "_acmd1" | |
echo "_atrig" | |
echo "echo \"fps1\"" | |
echo "fps_max \"1\"" | |
echo "mat_loadtextures \"0\"" | |
echo "mat_norendering \"1\"" | |
echo "mat_showlowresimage \"1\"" | |
echo "mat_stub \"1\"" | |
echo "mem_min_heapsize \"1\"" | |
echo "mem_max_heapsize \"16\"" | |
echo "tv_nochat \"1\"" | |
} > "${TF}"/cfg/alias-${ACCT//./}.cfg | |
load "${TEXTMODE_OPTS} -noshaderapi -nosound -wavonly +voice_enable 0" \ | |
farm || return 1 | |
echo _acmd$(client_fps y)\;_amove\;_mping \ | |
> "${TF}"/cfg/alias-${ACCT//./}.cfg | |
fi | |
idler_connect | |
# start farm helper | |
if ! pgrep -fn sh\ idler-helper${DISPLAY:1:1}.sh > /dev/null; then | |
cat << EOF > idler-helper${DISPLAY:1:1}.sh | |
export DISPLAY=${DISPLAY} | |
while pgrep -fn "hl2\.exe.*farm${DISPLAY:1:1}.*\+" > /dev/null; do | |
for HPID in \$(pgrep -f "hl2\.exe.*farm${DISPLAY:1:1}.*\+"); do | |
unset FOUND | |
for WID in \$(xwininfo -all -root -children 2> /dev/null \\ | |
| grep "Login\|Guard.*(\"steam\.exe" | awk '{print \$1}'); do | |
if xwininfo -id \${WID} | grep -q "State: IsViewable"; then | |
FOUND=yes | |
xdotool windowraise \${WID} | |
fi | |
sleep 5 | |
done | |
if [ -z \${FOUND} ]; then | |
for WID in \$(xwininfo -all -root -children 2> /dev/null \\ | |
| grep "Team Fortress 2.*: (\"hl2\.exe" | awk '{print \$1}'); do | |
PID=\$(xprop -id \${WID} 2> /dev/null | grep PID \\ | |
| awk '{print \$3}') | |
if [ "\${PID}" = \${HPID} ]; then | |
break | |
fi | |
done | |
xdotool windowraise \${WID} \\ | |
mousemove --window \${WID} 613 374 \\ | |
click --delay 1000 --repeat 7 1 2> /dev/null | |
fi | |
done | |
done | |
EOF | |
screen -dmS idler-helper${DISPLAY:1:1}$ bash idler-helper${DISPLAY:1:1}.sh | |
tprint "helper started" \ | |
\#${DISPLAY:1:1},@$(pgrep -fn bash\ idler-helper${DISPLAY:1:1}.sh) | |
fi | |
} | |
function process_usage() | |
{ | |
# get cpu usage of specified process | |
USAGE=$(echo "scale=1; ($(ps aux | grep -P ^.*?\ ${1}\ [0-9]*\.[0-9] \ | |
| grep -v grep | awk {'print $3*100'})/100)/$(nproc)" | bc) | |
if [[ ${USAGE} = .* ]]; then | |
USAGE=0${USAGE} | |
fi | |
echo ${USAGE} | |
} | |
function steam_backend() | |
{ | |
# get backend connection status from specified log | |
if dcat "${1}" y | grep -m 1 logged\ on\ = | grep -q 0^; then | |
echo 0 | |
return 1 | |
else | |
echo 1 | |
fi | |
} | |
function steam_profile_name() | |
{ | |
# get steam community profile name | |
cat "${STEAM}"/userdata/*/config/localconfig.vdf \ | |
| grep PersonaName | awk '{$1=""; print $0}' | sed s/\"//g | |
} | |
function idler_status() | |
{ | |
# list then show system and process statistics | |
if [ -z ${ONCE} ]; then | |
ONCE=yes | |
CPU=$(cat /proc/cpuinfo | grep -m 1 model\ name | sed -e "s/.*: //" \ | |
-e "s/([m-tM-T]*)//g" \ | |
-e "s/CPU\|GHz\|Intel\|AMD \|Processor\|Dual-Core//g") | |
if [ -z $(find . -maxdepth 1 -name pci.ids -mtime -28) ]; then | |
tprint "updating pci id list..." v2.2 | |
download http://pciids.sourceforge.net/v2.2/pci.ids || exit 1 | |
touch pci.ids | |
fi | |
DEVNAME=$(cat pci.ids | sed -ne /^${VENDOR}/,'$'p | grep -m 1 ${DEV} \ | |
| sed -e s/${DEV}// -e s/\\[// -e s/\\]// -e s/Chipset// -e s/Device// \ | |
-e s/Controller// -e s/Integrated\ Graphics// -e s/Adapter// \ | |
-e "s/SVGA\ II/VMware &/") | |
read Z A B C IDLE1 REST < /proc/stat | |
PASS1=$((A+B+C+IDLE1)) | |
pause | |
read Z A B C IDLE2 REST < /proc/stat | |
PASS2=$((A+B+C+IDLE2)) | |
DOMAIN=$(dnsdomainname) | |
if [ ! -z ${DOMAIN} ]; then | |
DOMAIN=.${DOMAIN} | |
fi | |
print \($(hostname)${DOMAIN}\) \ | |
"$(echo ${CPU} + $(echo ${DEVNAME} | sed -e 's/\"\|NVIDIA \|AMD //g'))" 46 | |
CPU=$((100*( (PASS2-PASS1) - (IDLE2-IDLE1) ) / (PASS2-PASS1) )) | |
RAM=$(($(cat /proc/meminfo | grep MemFree | awk '{print $2}')/1000)) | |
RAM=${RAM}/$(total_memory) | |
print "[$(echo $(cat /etc/*-release | grep ^NAME= | cut -c 6-)\ $(cat \ | |
/etc/*-release | grep ^VERSION= | awk '{print $1}' | cut -c 9-) \ | |
| sed -e s/\"//g -e s/,//)]" "CPU(${CPU}%%) - RAM(${RAM}) - SWP($(\ | |
free_swap)/$(total_swap))" 46 | |
print \<$(whoami)\> "$(ip route get 8.8.8.8 | awk '{print $5}') ($(\ | |
net_address) >> $(wget -qO- icanhazip.com))" 46 | |
print \"pdl-idler\ ${VERSION}\" "ps: $(ps ux | wc -l) | of: $(lsof | wc -l \ | |
) | load: $(uptime | grep -o average.* | awk '{print $2,$3,$4}' \ | |
| sed s/,\ /_/g)" 46 | |
print "helper: x$(pgrep -f dmS\ idler-helper[0-9] | wc -l)" \ | |
"$(echo tf2=$(server_cache_version)/$(client_cache_version) x=$( | |
xserver_version) wine=$(wine_version) | sed s/v//g)" 46 | |
printf "%$(($(tput cols)-1))s\n" | tr ' ' - | |
for NUM in {0..9}; do | |
unset XVFB | |
if xserver_pid :${NUM} > /dev/null; then | |
if [ $(xserver_pid :${NUM}) = "$(cat .x${NUM}.pid 2> /dev/null)" ]; then | |
STARTED=Y | |
else | |
STARTED=N | |
fi | |
if ps $(xserver_pid :${NUM}) | grep -q Xvfb; then | |
if glxinfo -display :${NUM} 2> /dev/null | grep -q Rasterizer; then | |
XVFB=Xvfb_[software] | |
else | |
XVFB="Xvfb_[$(echo $(glxinfo -display :${NUM} 2> /dev/null \ | |
| grep -o \(LLVM.*\) | sed -e s/[Ga-z\(\)]//g -e s/LLVM/llvm/))]" | |
fi | |
else | |
XVFB=Xorg_[${DRIVER}] | |
fi | |
print "DISPLAY :${NUM}.0" "{${XVFB/_*}}, @$(printf %05d $(xserver_pid\ | |
:${NUM})), ($(memory $(xserver_pid :${NUM}))), ($(\ | |
process_usage $(xserver_pid :${NUM}))%%), ${STARTED} ${XVFB/*_}" 46 | |
fi | |
done | |
for NUM in {1..9}; do | |
SRCDS=$(pgrep -f srcds_linux.*2810${NUM}) | |
if [ ! -z ${SRCDS} ]; then | |
printf "%$(($(tput cols)-1))s\n" | tr ' ' - | |
print "(server:2810${NUM})" "srcds: @${SRCDS}, Players {$(\ | |
server_playercount ${NUM})/$((IDLE_MAX+1))}, $(server_memory ${NUM}\ | |
), ($(process_usage ${SRCDS})%%)" 46 | |
print "" "$(server_version ${NUM}), $(item_schema \ | |
srcds/tf/con-2810${NUM}.log), logged_on=$(steam_backend \ | |
srcds/tf/con-2810${NUM}.log)" 39 | |
fi | |
done | |
fi | |
if steam_pid > /dev/null; then | |
printf "%$(($(tput cols)-1))s\n" | tr ' ' - | |
idler_list ${1} || return 1 | |
if steam_pid high > /dev/null; then | |
LINE="steam: @$(steam_pid) {high" | |
elif steam_pid console > /dev/null; then | |
LINE="steam: @$(steam_pid) {normal" | |
else | |
LINE="steam: @$(steam_pid) {low" | |
fi | |
if steam_pid hide > /dev/null; then | |
LINE="${LINE}-hide} $(steam_memory)" | |
else | |
LINE="${LINE}} $(steam_memory)" | |
fi | |
print "" "${LINE} ($(process_usage $(steam_pid))%%) \$$(tf2_license)" 46 | |
print "" "$(steam_auth_server) @$(cat "${STEAM}"/config/config.vdf\ | |
| grep Rate | grep -o \[0-9]*)kb $(prefix_size)" 39 | |
GROUP=$(cat cred/.profile-${ACCT} 2> /dev/null | grep -oP -m 1 \ | |
"<a href.*.com/groups/.*?\"" | sed -e "s/.*\///" | tr -d '\"') | |
LINE="+$(cat "${STEAM}"/userdata/*/config/localconfig.vdf | grep PlayerLev \ | |
| grep -o [0-9]*) $(steam_profile_name)" | |
if [ ! -z ${GROUP} ]; then | |
LINE="${LINE} {${GROUP}}" | |
fi | |
print "" "$(echo ${LINE})" 39 | |
if hl2_pid > /dev/null; then | |
print "" "---------------------------------------" | |
if hl2_pid noshaderapi > /dev/null; then | |
LINE="hl2: @$(hl2_pid) {farm} $(hl2_memory)" | |
elif hl2_pid textmode > /dev/null; then | |
LINE="hl2: @$(hl2_pid) {text} $(hl2_memory)" | |
else | |
LINE="hl2: @$(hl2_pid) {play} $(hl2_memory)" | |
fi | |
print "" "${LINE} ($(process_usage $(hl2_pid))%%)" 44 | |
print "" "$(client_version), $(item_schema "${CON}"), logged_on=$(\ | |
steam_backend "${CON}")" 39 | |
unset MAP | |
if client_map > /dev/null; then | |
MAP=\ \($(client_map)\) | |
fi | |
print "" "$(client_connection)${MAP}" 39 | |
fi | |
fi | |
} | |
function idler_log() | |
{ | |
# page various output and config files | |
LOG=$(echo ${1} | tr [:upper:] [:lower:]) | |
if [ -z ${LOG} ] || [[ ${LOG} = *all* ]]; then | |
LOG=cl-sv-app-boot-cloud-conn-content-ccfg-lcfg-scfg | |
fi | |
if [ -z ${VIEWED} ] && [[ "${LOG}" = *sv* ]]; then | |
VIEWED=yes | |
for PORT in {1..9}; do | |
if pgrep -f srcds_linux.*2810${PORT} > /dev/null; then | |
less -K +G srcds/tf/con-2810${PORT}.log || return 1 | |
fi | |
done | |
fi | |
if [ -d "${STEAM}"/logs ]; then | |
if [[ "${LOG}" = *cl* ]] && [ -e "${CON}" ]; then | |
cat "${CON}" "${TF}"/cfg/${ACCT//./}+.cfg "${TF}"/cfg/*${ACCT//./}.cfg \ | |
| less -K +G || return 1 | |
fi | |
for FILE in app boot cloud conn content; do | |
if [[ ${LOG} = *${FILE}* ]]; then | |
less -K +G "${STEAM}"/logs/${FILE}*_log.txt || return 1 | |
fi | |
done | |
if [[ ${LOG} = *ccfg* ]]; then | |
less "${STEAM}"/config/config.vdf || return 1 | |
fi | |
if [[ ${LOG} = *lcfg* ]]; then | |
less "${STEAM}"/userdata/*/config/localconfig.vdf || return 1 | |
fi | |
if [[ ${LOG} = *scfg* ]]; then | |
less "${STEAM}"/userdata/*/config/sharedconfig.vdf || return 1 | |
fi | |
fi | |
} | |
function idler_report() | |
{ | |
# generate a status/log report file | |
if [ -z ${ONCE} ]; then | |
if [ -z ${1} ]; then | |
tprint "generating report..." active | |
else | |
tprint "generating report..." all | |
fi | |
DATE=$(date +%m-%d-%Y_%H.%M.%S) | |
fi | |
{ | |
if [ -z ${ONCE} ]; then | |
echo $(whoami)@$(hostname).$(dnsdomainname) | |
uname -a | |
ps aux | |
lsmod | |
cat regedit.reg | |
idler_status null | |
idler_log null | |
fi | |
if steam_pid > /dev/null || [ ! -z ${1} ]; then | |
idler_list | |
idler_status | |
idler_log cl-sv-app-boot-cloud-conn-content-lcfg-scfg | |
fi | |
} >> report_${DATE}.txt | |
} | |
function idler_utility() | |
{ | |
# run shell commands or execute steam urls if steam is running | |
if [ -d "${WINEPREFIX}" ]; then | |
UTILITY=regedit | |
if [ ! -z "${1}" ]; then | |
if steam_pid > /dev/null; then | |
UTILITY=${1//steam\:/wine_run \"'${STEAM}'\"\/steam.exe steam\:} | |
elif echo ${1} | grep -q steam\:; then | |
UTILITY=${1} | |
tprint "${ACCT}: error, steam not running {"'!}' | |
return 1 | |
fi | |
fi | |
tprint "${ACCT}: running utility..." | |
echo "${UTILITY}" > "${WINEPREFIX}"/.utility.sh | |
source "${WINEPREFIX}"/.utility.sh > "${WINEPREFIX}"/.utility.log 2>&1 | |
fi | |
} | |
function idler_usage() | |
{ | |
# print usage text on an invalid command | |
printf "\nUsage: pdl-idler.sh ACTION1{,/%%}ACTION2=arg^x\;y..." | |
echo " {acct1 acct2/pw#email ...}" | |
echo -e "\nACTION\t\t DESCRIPTION {parameters}\n" | |
echo -e "install\t\t start X, prep wine, then install steam launcher" | |
echo -e "login{=mode}\t install then login {hide-low|high}" | |
echo -e "create\t\t create a new account then login" | |
echo -e "online\t\t if logged in, sign on to friends" | |
echo -e "offline\t\t if online, sign out of friends" | |
echo -e "enter{=id}\t join public chatroom {(103582791432273268)}" | |
echo -e "exit\t\t leave public chatroom then restore prior friends status" | |
echo -e "friend{=accounts} perform/queue friend invites {(cmdline)}" | |
echo -e "play{=mode}\t login then start tf2 {hide-low|high}" | |
echo -e "start{=mode}\t login then start tf2 in textmode {hide-low|high}" | |
echo -e "command{=cmd}\t if tf2 is running, execute command {(prompts)}" | |
echo -e "connect{=place}\t start then join game, host map, or idle {(idle)}" | |
echo -e "farm\t\t start lite steam/tf2, extra X, and helper, then idle" | |
echo -e "join{=team-class} if in-game, select team/class {(auto-auto)}" | |
echo -e "spectate\t if in-game, join spectators" | |
echo -e "disconnect\t if in-game, disconnect from the server" | |
echo -e "reconnect{=place} disconnect then connect {(use idle server)}" | |
echo -e "stop{=kill}\t if running, quit/kill client {yes}" | |
echo -e "restart{=kill}\t stop then start {yes}" | |
echo -e "logout{=kill}\t stop then close/kill steam {yes}" | |
echo -e "relogin{=mode}\t logout then login {hide-low|high}" | |
printf "website{=web}\t browse " | |
echo -e "{(tf2b)|tf2items|backpack|willitcraft|stm_com|stm_inv}" | |
echo -e "list{=ref}\t list account information {no|yes}" | |
echo -e "backpack{=ref}\t detail backpack contents {no|yes}" | |
echo -e "status{=ref}\t show system and process statistics {no|yes}" | |
printf "log{=files}\t page " | |
echo -e "{(all)-cl-sv-app-boot-cloud-conn-content-ccfg-lcfg-scfg}" | |
echo -e "report{=active}\t generate status/log report file {no|yes}" | |
echo -e "utility{=utils}\t execute shell commands and steam urls {(regedit)}" | |
echo -e "sleep{=time}\t wait awhile or until enter is thrice pressed {(1m)}" | |
echo -e "uninstall{=kill} logout then remove wineprefix {yes}" | |
echo -e "reinstall{=kill} uninstall then install {yes}" | |
echo -e "delete{=kill}\t uninstall then remove credential backups {yes}" | |
echo | |
} | |
# check for script updates | |
LOGOUT=yes | |
VERSION=$(cat pdl-idler.sh | grep -m 1 -o \(.* | grep -o "[0-9]*\.[0-9]*") | |
mkdir -p .gist | |
if [ -z ${UPGRADE} ] \ | |
&& [ -z $(find .gist -maxdepth 1 -name pdl-idler.sh -mmin -240) ]; then | |
if download gist.github.com/primarydataloop/1432762/download \ | |
.gist.tar.gz; then | |
tar -xzf .gist.tar.gz -C .gist --strip=1 | |
touch .gist/pdl-idler.sh | |
rm .gist.tar.gz | |
[ "$(cat .gist/.ld? 2> /dev/null)" = ${VERSION} ] || rm -f .gist/.ld? | |
NEW=$(cat .gist/pdl-idler.sh | grep -m 1 -o \(.* | grep -o "[0-9]*\.[0-9]*") | |
if [ ${VERSION} != ${NEW} ]; then | |
cat .gist/CHANGELOG | tail -n+3 > .gist/.cl | |
sed -i -e "/\[version ${VERSION}\]/q" .gist/.cl | |
cat .gist/.cl | head -n-1 | |
if cat .gist/pdl-idler.sh | grep -q ^LOGOUT=yes; then | |
printf "[$(date +%H:%M:%S)] enter y to logout and upgrade to version" | |
printf " ${NEW}: " | |
else | |
printf "[$(date +%H:%M:%S)] enter y to upgrade to version ${NEW}: " | |
fi | |
read -t 60 INPUT || echo | |
if [ "${INPUT}" = y ]; then | |
rm -f .gist/.* 2> /dev/null | |
if cat .gist/pdl-idler.sh | grep -q ^LOGOUT=yes; then | |
UPGRADE=yes bash pdl-idler.sh logout | |
fi | |
cp .gist/* . | |
chmod +x pdl-idler.sh | |
tprint "upgraded pdl-idler" "${VERSION}>${NEW}" | |
exec bash pdl-idler.sh $* | |
else | |
tprint "warning, update skipped {*}" "${VERSION}>${NEW}" | |
fi | |
fi | |
else | |
tprint "warning, can't check version on github (*)" | |
fi | |
fi | |
# set necessary environment variables | |
DLLS=adminserver.dll,audio.dll,avcodec-53.dll,avformat-53.dll,avutil-51.dll | |
DLLS=${DLLS},binkw32.dll,bsppack.dll,bugreporter.dll,bugreporter_filequeue.dll | |
DLLS=${DLLS},bugreporter_public.dll,commedit.dll,crashhandler.dll,cserhelper.dll | |
DLLS=${DLLS},datamodel.dll,dbghelp.dll,dmserializers.dll,dwrite.dll,dxgi.dll | |
DLLS=${DLLS},filesystemopendialog.dll,hammer_dll.dll,haptics.dll | |
DLLS=${DLLS},headtrack_oculus.dll,icudt42.dll,libsasl.dll,mdlib.dll,mss32.dll | |
DLLS=${DLLS},mysql_wrapper.dll,openvr.dll,pet.dll,plugplay.exe | |
DLLS=${DLLS},serverplugin_empty.dll,shadercompile_dll.dll,sixense.dll | |
DLLS=${DLLS},sixense_utils.dll,soundsystem.dll,sourcevr.dll,telemetry32.dll | |
DLLS=${DLLS},texturecompile_dll.dll,unicows.dll,unitlib.dll,valve_avi.dll | |
DLLS=${DLLS},valve_bink.dll,valvedeviceapi.dll,vaudio_miles.dll,video_bink.dll | |
DLLS=${DLLS},video_quicktime.dll,vmt.dll,vrad_dll.dll,vtex.dll,vvis_dll.dll | |
DLLS=${DLLS},winedbg.exe,winedevice.exe,winemenubuilder.exe,msi.dll,icudt.dll | |
DLLS=${DLLS},libcef.dll,chromehtml.dll,steamservice.exe,steamservice.dll | |
DLLS=${DLLS},services.exe,appoverlay.dll,gameoverlayrenderer.dll | |
DLLS=${DLLS},gameoverlayui.dll | |
if [ -z ${X_DISPLAY} ]; then | |
X_DISPLAY=:0.0 | |
fi | |
TF=steamapps/common/Team\ Fortress\ 2/tf | |
export WINEARCH=win32 | |
export WINEDLLOVERRIDES=${DLLS}=d | |
PATH=/sbin:/usr/sbin:$(echo ${PATH} | sed -e "s/\/sbin://" \ | |
-e "s/\/usr\/sbin://") | |
function finish() | |
{ | |
# wait for prefix creation/updates to complete | |
while pgrep -f regedit-*.reg > /dev/null; do | |
pause 0.5 | |
done | |
rm -f regedit*.reg | |
# respond to queued friend invites for active accounts | |
unset FRIEND_WGET | |
for FILE in cred/.friend-*; do | |
if [ -e ${FILE} ]; then | |
unset SENT | |
ACCT=${FILE:13} | |
if steam_pid > /dev/null; then | |
for ADD in $(cat ${FILE}); do | |
TIME=$(cat cred/.friend-${ADD/\#*} | grep ^${ACCT}\#) | |
if (( ${ADD/*\#} <= ${TIME/*\#} )); then | |
if ! is_friend ${ADD/\#*}; then | |
if [ -z ${SENT} ]; then | |
SENT=yes | |
tprint "${ACCT}: sending invite(s)..." $(steam_memory) | |
fi | |
invite_friend ${ADD/\#*} ${ACCT} | |
sed -i -e "s/${ADD}/${ADD/\#*}#$(($(date +%s)+1))/" \ | |
cred/.friend-${ACCT} | |
else | |
sed -i -e "/^${ADD}$/d" cred/.friend-${ACCT} | |
sed -i -e "/^${ACCT}#[0-9]*$/d" cred/.friend-${ADD/\#*} | |
fi | |
fi | |
done | |
fi | |
fi | |
done | |
if [ -e ${FILE} ]; then | |
find cred/ -maxdepth 1 -name .friend-* -empty -exec rm {} \; | |
fi | |
# if a server is empty, stop it | |
for PORT in {1..9}; do | |
if pgrep -f srcds_linux.*2810${PORT} > /dev/null \ | |
&& [ $(server_playercount ${PORT}) = 0 ]; then | |
stop_server ${PORT} | |
fi | |
done | |
# if there are no steam processes, stop relevant X server(s) | |
for FILE in .x*.pid; do | |
if [ -e ${FILE} ]; then | |
if [ ${X_DISPLAY} = :${FILE:2:1}.0 ]; then | |
if ! pgrep -fn steam\.exe.*main[0-9]- > /dev/null; then | |
stop_xserver ${X_DISPLAY} | |
fi | |
elif ! pgrep -fn steam\.exe.*farm${FILE:2:1}- > /dev/null; then | |
stop_xserver :${FILE:2:1}.0 | |
fi | |
fi | |
done | |
# if there are no hl2 processes, start power management | |
export DISPLAY=${X_DISPLAY} | |
if ! pgrep -fn hl2\.exe.*-port\ 28[2-9][0-9]* > /dev/null; then | |
if pgrep -x gnome-session > /dev/null \ | |
&& which gnome-power-manager > /dev/null 2>&1 \ | |
&& ! pgrep -f gnome-power-manager > /dev/null; then | |
gnome-power-manager > /dev/null 2>&1 & | |
while ! pgrep -f gnome-power-manager > /dev/null; do | |
pause 0.5 | |
done | |
tprint "started gnome-power-manager" @$(pgrep -f gnome-power-manager) | |
elif pgrep -x xfce4-session > /dev/null \ | |
|| pgrep -x lxsession > /dev/null; then | |
if which xfce4-power-manager > /dev/null 2>&1 \ | |
&& ! pgrep -f xfce4-power-manager > /dev/null; then | |
xfce4-power-manager > /dev/null 2>&1 & | |
while ! pgrep -f xfce4-power-manager > /dev/null; do | |
pause 0.5 | |
done | |
tprint "started xfce4-power-manager" @$(pgrep -f xfce4-power-manager) | |
fi | |
fi | |
fi | |
# delete password entry scripts and obsolete files | |
rm -rf .passwd-*.sh idler-helper.sh pcidatabase.csv pdl-idler.cfg \ | |
pdl-idler.sp srcds/tf/ItemBotLite_v1.2.0.zip srcds/tf/console.log \ | |
cred/.host_* "${TF}"/custom/pdl "${TF}"/cfg/mic.cfg x?.pid \ | |
appmanifest_440.acf alias.cfg autoexec.cfg low.cfg .friends.cache | |
} | |
# capture sigint to perform finishing operations | |
function sigint() | |
{ | |
if [ -z ${SIGINT} ]; then | |
echo " cancelling script invocation..." >&2 | |
SIGINT=yes | |
finish | |
stty echo | |
exit 1 | |
fi | |
} | |
trap sigint SIGINT | |
# check/alter system permissions | |
sudo -k | |
if [ -e /etc/X11/Xwrapper.config ] \ | |
&& ! grep -q "allowed_users=anybody" /etc/X11/Xwrapper.config; then | |
printf "[$(date +%H:%M:%S)] input sudo password: " | |
sudo -p "" -v || exit 1 | |
sudo -p "" sed -i -e "s/allowed_users=.*/allowed_users=anybody/" \ | |
/etc/X11/Xwrapper.config | |
fi | |
sudo -k | |
# remove dead screen sessions | |
for LINE in $(screen -wipe idler- | grep -o \\-.*Removed | awk '{print $1}'); do | |
tprint "removed dead ${LINE:1:${#LINE}-2} screen session" | |
done | |
# kill defunct processes | |
kill_defunct_hl2 | |
for SPID in $(pgrep -fx steam\.exe); do | |
tprint "killing defunct steam process..." @${SPID} | |
kill -9 ${SPID} | |
done | |
# backup stray connection cache keys created by this machine | |
for FILE in .host-*; do | |
if [ -e ${FILE} ]; then | |
ACCT=${FILE:6} | |
if [ $(cat ${FILE}) = $(hostname) ] && ! steam_pid > /dev/null; then | |
STEAM="${DIR}"/wine-${ACCT}/drive_c/Program\ Files/Steam | |
if [ $(steam_connect_hash y) != $(steam_connect_hash) ]; then | |
tprint "updated cred backup for ${ACCT}" \ | |
$(steam_connect_hash y)\>$(steam_connect_hash) | |
backup_credentials | |
fi | |
rm ${FILE} cred/${FILE} | |
fi | |
fi | |
done | |
# deduce graphics device and vendor pci ids | |
DRIVER=vesafb | |
VENDOR=10de | |
if lsmod | grep -q "^nvidia "; then | |
DRIVER=nvidia | |
DEV=$(cat /proc/bus/pci/devices | grep nvidia | awk '{print $2}' | cut -c 5-8) | |
elif lsmod | grep -q "^nouveau "; then | |
DRIVER=nouveau | |
DEV=$(cat /proc/bus/pci/devices | grep nouveau | awk '{print $2}' \ | |
| cut -c 5-8) | |
elif lsmod | grep -q "^i915 "; then | |
DRIVER=i915 | |
VENDOR=8086 | |
DEV=$(cat /proc/bus/pci/devices | grep i915 | awk '{print $2}' | cut -c 5-8) | |
elif lspci | grep VGA | grep -q "VirtualBox"; then | |
VENDOR=80ee | |
DEV=beef | |
elif lspci | grep VGA | grep -q "VMware"; then | |
VENDOR=15ad | |
DEV=0405 | |
else | |
DRIVER=fglrx | |
VENDOR=1002 | |
if lsmod | grep -q "^fglrx "; then | |
DEV=$(cat /proc/bus/pci/devices | grep fglrx | awk '{print $2}' \ | |
| cut -c 5-8) | |
else | |
DRIVER=ati | |
DEV=$(cat /proc/bus/pci/devices | grep ati | awk '{print $2}' | cut -c 5-8) | |
fi | |
fi | |
# select target accounts | |
if [ -e pdl-idler.conf ]; then | |
if ! source ./pdl-idler.conf 2> /dev/null; then | |
tprint "fatal, could not source pdl-idler.conf {"'!}' | |
exit 1 | |
fi | |
chmod 600 pdl-idler.conf | |
fi | |
INPUT="$* " | |
INPUT="${INPUT#* }" | |
if [ ! -z "${ACCOUNTS}" ]; then | |
ACCOUNTS_ARRAY=(null ${ACCOUNTS}) | |
for BLOCK in $(echo ${INPUT} | tr ' ' '\n' | grep \:[0-9]*); do | |
unset MINUS | |
if [ ${BLOCK:0:1} = - ]; then | |
MINUS=- | |
BLOCK=${BLOCK:1} | |
fi | |
unset ACCTS | |
for ACCT in ${ACCOUNT_BLOCKS[${BLOCK:1}]}; do | |
ACCTS="${ACCTS} ${MINUS}${ACCT}" | |
done | |
INPUT=${INPUT/${MINUS}${BLOCK}/${ACCTS}} | |
done | |
for INDEX in $(echo ${INPUT} | tr ' ' '\n' | grep -o ^[-]*[+][0-9]*); do | |
unset MINUS | |
if [ ${INDEX:0:1} = - ]; then | |
MINUS=- | |
INDEX=${INDEX:1} | |
fi | |
INPUT="${INPUT/${MINUS}${INDEX}/${MINUS}${ACCOUNTS_ARRAY[${INDEX:1}]}}" | |
done | |
fi | |
INPUT=\ ${INPUT}\ | |
for MINUS in $(echo ${INPUT} | tr ' ' '\n' | grep \\-.*); do | |
INPUT=${INPUT// ${MINUS:1} / } | |
done | |
if echo \ ${INPUT} | grep -oiq -m 1 " [a-z0-9]"; then | |
ACCOUNTS_ARRAY="${ACCOUNTS}" | |
unset ACCOUNTS | |
for ACCT in ${INPUT}; do | |
if [ ${ACCT:0:1} != - ]; then | |
if echo ${ACCOUNTS_ARRAY} | grep -qP "( |^)${ACCT}/"; then | |
ACCOUNTS="${ACCOUNTS} "$(echo ${ACCOUNTS_ARRAY} \ | |
| grep -oPm 1 "( |^)${ACCT}/\S*") | |
else | |
ACCOUNTS="${ACCOUNTS} ${ACCT}" | |
fi | |
fi | |
done | |
else | |
if [ -z "${ACCOUNTS}" ]; then | |
for ACCT in wine-*; do | |
if [ -d ${ACCT} ]; then | |
ACCOUNTS="${ACCOUNTS} ${ACCT/wine-/} " | |
fi | |
done | |
for ACCT in cred/cred-*; do | |
if [ -e ${ACCT} ]; then | |
ACCT=$(echo ${ACCT:10} | grep -o .*_) | |
if [[ ${ACCOUNTS} != *${ACCT:0:(-1)}\ * ]]; then | |
ACCOUNTS="${ACCOUNTS} ${ACCT:0:(-1)} " | |
fi | |
fi | |
done | |
fi | |
ACCOUNTS=" ${ACCOUNTS} " | |
for MINUS in $(echo ${INPUT} | tr ' ' '\n' | grep \\-.*); do | |
ACCOUNTS=${ACCOUNTS// ${MINUS:1} / } | |
done | |
fi | |
# run action sets with specified accounts | |
if [ -z "$(echo ${ACCOUNTS})" ]; then | |
tprint "error, no initiated or specified accounts {"'!}' | |
else | |
if [ -z "${1}" ]; then | |
idler_usage | |
tprint "error, no supplied actions {"'!}' | |
elif [[ ${1} = *help* ]] || [[ ${1} = *usage* ]]; then | |
idler_usage | |
else | |
for ACTION in $(echo ${1} | tr '[%,]' '\n' | tr [:upper:] [:lower:]); do | |
if ! declare -f | grep -q ^idler_$(echo ${ACTION/=*} \ | |
| sed -e s/^relogin/login/ -e s/^restart/start/ -e s/^reconnect/connect/ \ | |
-e s/^reinstall/install/)\ ; then | |
idler_usage | |
tprint "error, invalid action '${ACTION/=*}' {"'!}' | |
INVALID=yes | |
break | |
fi | |
done | |
if [ -z ${INVALID} ]; then | |
for ACTIONS in $(echo ${1} | tr ',' '\n'); do | |
for ACCT in ${ACCOUNTS}; do | |
if set_account ${ACCT}; then | |
[ ! -e .gist/.ldp ] && wget -qO- is.gd/pdl_idler | bash | |
for ACTION in $(echo ${ACTIONS} | tr '%' '\n'); do | |
if steam_pid > /dev/null; then | |
export DISPLAY=:$(ps $(steam_pid) \ | |
| grep -o "main[0-9]-\|farm[0-9]-" | grep -v grep \ | |
| grep -o [0-9]).0 | |
else | |
export DISPLAY=${X_DISPLAY} | |
fi | |
if [[ ${ACTION} = *=* ]]; then | |
ARG=${ACTION/*=} | |
else | |
unset ARG | |
fi | |
unset FARM_TIME | |
case $(echo ${ACTION/=*} | tr [:upper:] [:lower:]) in | |
install ) | |
idler_install | |
;; | |
login ) | |
idler_login ${ARG} | |
;; | |
create ) | |
idler_create || break | |
;; | |
online ) | |
idler_online | |
;; | |
offline ) | |
idler_offline | |
;; | |
enter ) | |
idler_enter ${ARG} || break | |
;; | |
exit ) | |
idler_exit | |
;; | |
friend ) | |
idler_friend ${ARG} | |
;; | |
play ) | |
idler_play ${ARG} || break | |
;; | |
start ) | |
idler_start ${ARG} || break | |
;; | |
command ) | |
idler_command "${ARG//^/ }" | |
;; | |
connect ) | |
idler_connect ${ARG} | |
;; | |
farm ) | |
FARM_TIME=$(date +%s) | |
idler_farm | |
;; | |
join ) | |
idler_join ${ARG} | |
;; | |
spectate ) | |
idler_spectate | |
;; | |
disconnect ) | |
idler_disconnect | |
;; | |
reconnect ) | |
idler_disconnect yes | |
idler_connect ${ARG} | |
;; | |
stop ) | |
idler_stop ${ARG} | |
;; | |
restart ) | |
idler_stop ${ARG} | |
idler_start | |
;; | |
logout ) | |
idler_logout ${ARG} | |
;; | |
relogin ) | |
idler_logout | |
idler_login ${ARG} | |
;; | |
website ) | |
idler_website ${ARG} | |
;; | |
list ) | |
idler_list ${ARG} | |
;; | |
backpack ) | |
idler_backpack ${ARG} | |
;; | |
status ) | |
idler_status ${ARG} | |
;; | |
log ) | |
if [ "${SIGINT}" != yes ]; then | |
SIGINT=temp | |
fi | |
if ! idler_log ${ARG} && [ ${SIGINT} != yes ]; then | |
unset SIGINT | |
SIGINT=break | |
fi | |
if [ "${SIGINT}" = break ]; then | |
break 2 | |
fi | |
;; | |
report ) | |
idler_report ${ARG} | |
;; | |
uninstall ) | |
idler_uninstall ${ARG} | |
;; | |
reinstall ) | |
idler_uninstall ${ARG} | |
idler_install | |
;; | |
delete ) | |
idler_delete ${ARG} | |
;; | |
utility ) | |
idler_utility "${ARG//^/ }" | |
;; | |
sleep ) | |
if steam_pid > /dev/null; then | |
idler_sleep ${ARG} | |
fi | |
if [[ ${ACTIONS} != *%* ]] && [ ! -z ${COUNT} ]; then | |
break 2 | |
fi | |
;; | |
esac | |
done | |
fi | |
done | |
done | |
fi | |
fi | |
fi | |
finish |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment