Skip to content

Instantly share code, notes, and snippets.

@primarydataloop
Last active May 12, 2022 17:30
Show Gist options
  • Save primarydataloop/1432762 to your computer and use it in GitHub Desktop.
Save primarydataloop/1432762 to your computer and use it in GitHub Desktop.
pdl-idler
pdl-idler CHANGELOG
[version 0.9025]
+ remove xorg/xvfb display server pid mark and deduce by display id instead
+ simplify display driver detection in status and cache hl2_pid gather
+ remove inotifywait dependancy and use wineserver -w instead in registry prep
+ only check for defunct hl2 pids on startup and organize clutch deletions
+ move hl2 pid check from disconnect() to before the action is started
+ simplify killing of hl2 in stop, and preserve files in logout with $debug
+ increase sourceirc msg delay to 2 seconds and always compile pdl-idler.sp
+ only run regedit on wine prep instead of using obsolete font key check
+ generate sourcemod items.kv file after steamcmd instead of in addon install
+ always concatenate stock lcfg with userdata one even if it already exists
+ remove file check in login wait and hpid check from client_map gather
+ simplify connect query wait and fix not defaulting drop_irc/chat to 'yes'
+ show y|n for each of the drop variables in helper start output message
+ fix using uid in helper chat urls and multiple irc sourcemod function load
[version 0.9024]
+ include sourceirc.cfg and irc-connected.cfg for sv target in log pager
+ overhaul/simplify/fix sleep action and cache steam pid checks
+ fix sourcing config file before setting default variables
+ silence potential error if steamcmd_log wasn't created
+ change default irc server to gamesurge.net and simplify install/config
+ use new variable 'irc_server_user' for use with authserver in irc-connected
[version 0.9023]
+ rearrange some global statements/declarations for clarity/hardening
+ use env instead of checking lcfg when deciding to logout/delete in sigint
+ improve cid/uid gathering and cache values from setaccount() or login()
+ don't use system env var 'uid' in trade function sender prep
+ fix node binary name not being sourced in common/helper and break type check
+ run stop in logout evem if spid as latter's call to stop_node was removed
+ only stop node chat enter sessions in exit()
+ don't check available ports/server twice if the server was prestarted
+ export winedebug=-all globablly for either login mode
+ fix not removing old zip files in steam package processing
+ only migrate ssfn if both entry and file exist and fix sourcemod tarball rm
+ revert helper log/retrieve, and check caps/start drop_chat in farm
[version 0.9022]
+ use bump mark with farm construction version file
+ properly cross link stf/addons into the tf/pdl/farm
+ ensure linking of tf/pdl>stf/pdl directory instead of only after sv steamcmd
+ download mm/sm tarballs in addons dir for when it is removed and flip ver
[version 0.9021]
+ get and show steam connection cellid in list and authenticated login message
+ hide occasional error resulting from steam.exe rewriting lcfg during login
+ shorten selection of client connection cache hash from 6 to 4 characters
+ add more granularity to application size gathering
+ preemptively start idle server (if needed) before farm login
+ remove sourcemod/metamod versions from srcds hostname cvar
+ copy atf/gameinfo to stf and remove content search paths there
+ fix irc plugin loading when irc server is 'none'
+ include tf/maps and stf/addons symlink into client farm resources
+ move sv model extractions and now hltv/replay/server.res to cl construction
+ replace server farm construction with simple link to tf/pdl files
+ show retry attempts in password warning flag in auth login message
+ fix consuming login window closing in play()
+ use 32 instead of $idle_max for xvfb/display account limit
+ copy server farm gameinfo to farm client and just change pdl directory
+ remove -nopreload/models from farm cmdline to fix drop from smaller server
[version 0.9020]
+ kill and wait for errant wineservers before steam merge clutch
+ remove farm version file in steam merge clutch
+ only check for cloud/stopping once in logout() and fix timeout variable
+ bump sourcemod to latest 1.7 branch snapshot
+ fix drop chat account variable in helper
[version 0.9019]
+ declare functions before global code other than shell check (sans tprint)
+ revert to improved finish routine run at both sigint or finish with untrap
+ don't copy output to stderr and adjust log/logout tf2+ccfg file locations
+ fix list item/line typo, use lsmod to check virtual gpu and drop lspci dep
+ remove tf2 license gather function and asterisk password entry function
+ run steam.exe via C:/ drive label instead of absolute file location
+ remove idler_join and idler_spectate actions and rely on user commands
+ implement discover action to browse through store discovery queues
+ fix receiver/trader uid check and don't use 'I' variable name for loops
+ run common source+trap after checks and source conf in common
+ add inotifywait and missed bc deps and remove sudo for now
+ always logout when performing a gist script ugprade
+ fill account information array after conf source instead of input processing
+ remove now obsolete passwd script cleanup
+ clutch merge steam windows/cmd dir with obsolete shared tf2 file changes
+ remove farm debugging mode and paramater check
+ declare terminal type as xterm and use dynamic terminal width for output
+ now use account mark on steam proc to differentiate due to C:\ reference
+ improve/fix is_logged_in lcfg check
+ unset last wid if new window isnt found and return don't break on pause stop
+ improve steam web helper memory check and fix commandable check
+ stop node client before hl2 in stop instead of after
+ remove unnecessary calls to reset cmd file in logout and simplify acct size
+ get full authentication message/state for login checks
+ improve file blocks with new wait+skip mode and improve close_window()
+ fix getting app content_log state from previous process if log still exists
+ reduce logout timeout from 120 to 60 seconds
+ also show display and account size in killing steam message for logout
+ condense logout close window calls and improve cloud/dl finish check
+ don't bother changing lcfg avatars or use login_timeout variable in logout
+ require account passwords and improve display check in setaccount()
+ fail and exit if uninstall/delete cannot remove contents
+ allow for multple files and always check for digits in version()
+ remove client fps checking and change key frequency from 350 to 300 ms
+ ignore potentional errant 'anonymous' dirs when getting cid from userdata/
+ fix/adjust/revert steam app size and version gather functions
+ improve steamcmd args, log, screen name, dir prep, and check for two-factor
+ have steam home directories restored after steamcmd instead of server start
+ improve type_input ctrl-a handling and slow delay from 250 to 300 ms
+ simplify cred entry background child now only used for guard input
+ no longer reset gameinfo file as each account will have their own
+ neglect msmhtml.dll to avoid gecko and export winedbg+crashhandler+msi
+ remove check/link for shared package directory
+ use missing package files instead of version file to deduce need for upgrade
+ avoid deleting steam/appcache and steamcmd files on ui download/extraction
+ create empty gameoverlayrender.log file after ui extraction
+ silence url_list log concatenation and ensure removal of package lock file
+ no longer remove/relink package dir and conditionally fill steamappdata.vdf
+ improve vnc arg/bin checks, don't chmod passwd file, and remove ssh support
+ simplify/run wineboot in foreground without gecko check
+ use inotifywait instead of wineserver-w before writing registry backups
+ check for and announce existence of crash file in steam init
+ compare web api file to client inf once per invocation before steamcmd
+ don't modify/create tf2 client application manifest before login
+ run steamcmd to check/validate tf2 cl+sv before login init with credentials
+ make cl/sv farm resource collections and plugin installations after steamcmd
+ remove loop creating player class config files with con marker echos
+ include required new pvp/mym resource files in client farm construction
+ assemble account apps/tf2 directory link stucture to have seperate gameinfo
+ adjust and simplify client login prep and port selection
+ use avatars/loggedin instead of server window check for login loop
+ run logout to clean files before failing in login and improve log checking
+ improve and simplify guard code entry with kill child process after read
+ remove subscriber window close as it's assumed to only happen before restart
+ only check guard notifcation wid once and remove unneeded reconfigure var
+ no longer remove package link or block on gameinfo on login finish
+ don't check for ssfn files and output error/warning in login finish
+ backup an exisiting file in share when migrating ssfn
+ overhaul login loop sans password prompt, timeouts, and second chance retry
+ remove password logic from node login prep and show error result on failure
+ fix f2p prep and improve efficiency of account creation routine
+ remove presumably uncessary subscriber close routine before login finish
+ remove check/fail if a steam app is running in node gc prep
+ concatenate crates constant with itself if set prior to invocation
+ simplify/generalize load prep/logic
+ anchor to a previous client shutdown in loading wait if log file was present
+ don't block, check for micro content updates, or reset files in load
+ remove support for slower alternative command line passing for tf2 clients
+ try -noassert common command line parameter and fix sv hostname cvar
+ check for another bad challenge message in connect
+ adjust gameinfo farm sed to account for new vgui keyword and neglect all vpk
+ defer farm version file write until after call to load finishes
+ try 'thread -1' command line paramater for farm clients
+ fix killing pulseaudio clients in farm and announce after doing so
+ move helper initialization code to helper.sh and remove pulseaudio startup
+ pause then gather output of helper initialization and fix drop_chat variable
+ reinclude halloween spawn code for posterity in sourcemod plugin
+ delay initial irc message(s) until server fully joins channel
+ remove unused client trigger alias and move start echo markers to autoexec
+ add shortcut url for discover action to url list
[version 0.9018]
+ condense/improve initial check deduction and store/cache wine version
+ always assume logout requirement upon gist upgrade
+ colorize/standardize timestamped messages that request input
+ simplify version gathering without inherent 'v'
+ merge command/play function pairs and simplify download routine
+ remove quotes around console var in connection gather and improve disconnect
+ condense node functions and don't wait 0.4 sec after focus on main display
+ fix package linking, url list cat in login, and use winedebug-all for low
+ reorder tf2 client file construction in login with some moved from load
+ improve node chat prep and merge cl/sv size+version (now buildid) functions
+ remove tee call, farm bump var, stream chmod clutch, and alias.cfg reset
+ write farm ver file before finish and colorize update available window mark
+ improve steamcmd installation check and content adjust output messages
+ don't try to wrangle the two $HOME/.steam* symlinks before steamcmd
+ sleep before checking content in steamcmd wait loop
+ move server cvars from command line to autoexec.cfg and simplify startup
+ remove wait and queue irc messages that are to be sent until channel join
+ erase server lock file if one remains from a cancelled prior start
+ improve farm display deduction and fix not starting another xvfb server
+ try to catch more hats/miscs and event crates in helper/sourcemod item code
+ fill in missing action description in help file
[version 0.9017]
+ improve gist procedure and retrieve/show usage text in help from file
+ adjust delete function and move invalid username check to set_account
+ merge and compress install/login functions and eschew prefix bumping
+ adjust package dir procedure and skip checking /opt/wine-staging
+ keep/protect steamwindows/vr directory during upgrade
+ retry download if ui client zip file is corrupt and remove url list clutch
+ no longer fill config/dialogconfig.vdf, or use app manifest bump
+ rework/improve dll negation scheme and use dwrite.dll for hi logins
+ start either display at the same time on creation login and skip :99 x11vnc
+ improve wineboot procedure and don't prompt on install for unknown accounts]
+ don't use login.pdl state file and seperate registry into project file
+ simplify steam init message and remove userdata clutches
+ move initial localconfig.vdf file to a seperate project file
+ no longer check/apply steam/tf2 cloud clutches in login
+ remove clearbeta steam switch, try singlecore, and simplify init log reset
+ colorize password entry mark in authenticated output message
+ improve create window check and remove invalid email check/delete
+ remove auth error reinstall and just fail on third attempt
+ don't wait for full logout before restart for initial account configuration
+ improve/fix log paging function and support all *_log.txt files
+ colorize/embellish/fix list, backpack, and status output
+ remove restart/reconnect/reinstall/relogin actions
+ reset terminal text attributes on finish and improve sigint checks/output
+ apply tf2 dll restrictions only at farm login and remove path/lc_all/debug
+ colorize and accent timestamped messages with special highlighting
+ improve steam pid gather and window functions and underline memory values
+ remove empty share/$acct/$hostname/logs dir on logout and show account size
+ check email in set account and use more convenience variables
+ quicken xfce4 disable procedure by not waiting for xconf file update
+ remove unnecessary secondary appstate check in load
+ adjust mm/sm downloading and create the metamod.vdf file
+ improve network address gather in connect and check items first in farm
+ show timestamp in server command log write
+ fix showing invalid command for irc gameinfo/status
+ wait 3 seconds before server quit check on client disconnect
[version 0.9016]
+ improve download function and shorten many applicable variable constructions
+ don't use no-hsts for wget as it will crash if not present and delete file
+ remove hide login mode option and only use it for farm logins
+ overhaul and simplify wineserver handling without using process marks/waits
+ don't use retro x/xvfb process marks and instead check for screen sessions
+ start x11vnc for normal logins even if the xorg wasn't started by pdl
+ fix key_press deley parameter for single key calls
+ improve steam client ui manifest get/check
+ remove normal account login limit based on wineserver count
+ improve/generalize sleep/pause function and remove unused farm hl2 proc mark
+ remove obsolete call to ensure client offline state on login
+ delete link to package folder upon login to try to block background updating
+ always show action duration after every output message
+ improve/condense process usage gather and status functions
+ remove gnome support in power manager function
+ improve account display gather, arg check, and display server stop
+ remove obsolete headtrack_oculus from dll exclusion variable
+ fix displaying other pid in block file function and fix logout typo
+ only check server player count once in connect
+ remove automatic linking to share/steamcmd in connect
+ don't block or mkdir if server is started and save (don't merge) screenlog
+ remove check for missed steamcmd download nor use ver file for resources
+ disable sourcemod logging in core.cfg at time of installation
+ modify server gameinfo after sourceirc installation
+ replace use of and modifications to sourceirc plugins with reduced sp code
+ improve network device gather and non noshaderapi checks/sleep in connect
+ try mat_managed_textures=0 in for farm cvar and remove wavonly parameter
[version 0.9015]
+ drop current clutches and use no-hsts for wget downloads
+ remove relogin action and employ hostname variable instead of the program
+ use hostnames in lock files and wait if another host is claimant
+ bump prefix to 9 for/and return appcache to local wineprefix
+ no longer link to logs directory for convenience in wineprefix root
+ remove calls to get data from the 'share/$acct/cred' file
+ use warning for all block file waits and remove obsolete windows.lock find
+ concatenate extra urls from new file for steam if needed in install
+ no longer check/react to steam pid status in register/exhibit/socialize
+ use custom url to skip inital profile edit page in exhibit routine
+ remove kill argument from logout call in password entry login timeout
+ no longer check for seconds lost string on connection log on login
+ show action duration upon login and remove cred log target
+ remove current routine for sale events in socialize
+ clean any xdotool lock files on singular invocation finish
+ remove wine staging shared memory variable
+ bump tf2 resources to c and improve steam pid gather
+ improve node login background gather
+ avoid initial pause if killing client in stop
+ show action duration when starting logout and remove hosts log directory
+ arrest client memory leak by stopping twich with chmod in load construction
+ fix needlessly checking srcds by using patchver to compare and quell error
+ bump sourcemod to 1.7.3-5303 and dont change sourcemod debug logging
+ compile sp/items.kv once per smod install and use per-server irc.cfg
+ remove server gameinfo lock before waiting on started marker
+ also check for vac banned marker in connect insecure client logout
+ try reducing datacachesize farm client var from 64 to 32
+ catch more special items for improved helper sounds and sourcemod irc drops
[version 0.9014]
+ remove xdpyinfo dependancy for simplified dialogconfig.vdf fill
+ change sample.conf to example and optimize grep/cat calls by combining them
+ show action description if help action is supplied with an argument
+ move class cfg file generation to client construction instead of login
+ fill dialogconfig once in install instead of every login
+ always fill steamappdata.vdf with more xdotool key presses for create
+ remove dcat function and adjust grep calls if needed for dos newline files
+ disable client game streaming for farm login and adjust status ver output
+ return cl_disablehtmlmotd tf2 client cvar for low mode
+ use '-no-cef-sandbox' steam command line argument to fix web components
+ also check for two-factor-code error in login guard code without window key
+ dont call register or exhibit after an account is created in login
+ correct server file in log and remove insecure start/textmode functionality
+ fix mode and llvm checks in status and remove report function
+ remove old call to link low.cfg and adjust content checks and pauses in load
+ ensure executability for srcds script/binary and sourcemod compile.sh/spcomp
+ fix server item schema check and enforce steamcmd validate variable
+ harden sourceirc installation check and adjust client map loading message
+ check for vac message instead of map cfg load error to deduce server start
+ use proper output for item failure message in helper
+ fix 200 fps command alias variable in autoexec.cfg
[version 0.9013]
+ dont require gcc and clutch rename steamgui directory to steamwindows
+ remove alias.cfg file with auto-movement client aliases
+ return to per user appcache share to prevent redownloading of app data
+ improve steam windows client manifest download/checking
+ remove xserver version function since Xorg may not be able to run
+ coordinate/optimize xdotool window selection/focus and display locking
+ bump prefix to 9 and support/maintain link to 'share/steamwindows/package'
+ set survey date to 2050 once in ccfg creation instead of a login sed
+ use block to project just client data not whole invocations that login
+ download the non-vz variants of client package files and remove vunzip
+ don't erase tf2 download/temp in install, and move manifest sed to login
+ make client autoexec.cfg a static project file and link to it
+ improve login logic without download code, windowunmap call, and error close
+ fix erasing tf2 account files in certain login error conditions
+ adjust to removal of secret question stage in account creation
+ remove chat window move, and include hostname in server log filenames
+ correct helper pid check in status
+ fix stall on trade confirmation and improve focus and close window functions
+ close guard window if it is present in logout and fix drops file node error
+ support and maintain link to 'share/steamcmd' if it exists
+ only run steamcmd to update server if steam.inf differs from the client
+ don't preserve ~/Steam directory before relinking to steamcmd
+ fix syntax error on downed item server check in helper
[version 0.9012]
+ remove obsolete trade confirmation block/unlock logic and cred mark
+ clutch file permission reset for sharedconfig.vdf in login
+ catch undefined result for the confirmation required trade result
+ don't disable power management for trade reciever backgrounds
+ delete account drops file after a successful node backpack sort
+ remove obsolete item discard panel client ui mark
+ disable drop_sound variable by default and improve chat variable check
+ use item data instead of ui mark to deduce a full backpack in helper
+ if configured, stop/deterge/resume farming in the helper on a full backpack
+ improve and fully fix helper stall on delivered gifts
[version 0.9011]
+ disallow apikey set in environment so as to force conf requirement
+ update wine dependency check to require 1.8 or later
+ remove chmod calls to mark the script as executable
+ don't recognize high_accounts variable and remove normal mode logins
+ reset localconfig separately from wineprefix bump
+ no longer clear share/config/htmlcache directory in login/logout
+ remove modified farm steam skin that hid notifications to prevent a crash
+ don't bother restricting file permissions on local tf/config.cfg
+ prune client cfgs avoiding assumptions and unnecessary cloud contamination
+ no longer alter or rely on permissions for files in share with clutch resets
+ hide file not found error when checking trade flag in cred file
+ remove wine version check, and lcfg toggle for overlay support in login
+ apply one default jumplist setting regardless of login mode
+ hide possible steam controller dialog window in login with lcfg entry
+ enable streaming and relevant settings for all login modes
+ use pdl flag in sharedconfig to initiate and mark cloud reset of the file
+ reset tf2 cloud config.cfg file if it contains and old cvar marker in login
+ remove farm/low specific registry options as well other dinput/cloud keys
+ use only the alsa sound driver in registry setting application
+ adjust to lack of error window on incorrect password and catch retry limits
+ fix not showing explorer.exe pid in login output
+ reference scfg file in remote userdata dir instead of local config in log
+ disable power management before client launch/update instead of after start
+ delete srcds farm client version file when rebuilding client data
+ extract new farm dep scripts/paintkitmaster
+ provide error.vtx/vvd files companion files to quell error.mdl server spam
+ return power management enabling to sigint instead of just finish
+ clear account specific tf client files if there are no steam procs in finish
+ remove mat_managedtextures cvar from text/farm client command line
+ return a failure instead of 'listen' for client connection if no information
+ warn about steam cloud sync only after 5 seconds in logout
+ fix losing display id in power management disable
+ avoid a stall and improve farm helper
[version 0.9010]
+ fix farm load crash due to renamed resource file
+ remove halloween map selection, server registration, and game logic
[version 0.9009]
+ split helper, common elements, and sourcemod plugin from main script file
+ fix checking for share directory permissions when it doesn't exist
+ now require a valid apikey, nodejs installation, npm, and git
+ simplify wine/node dep check, and remove sudo/xwrapper/migration logic
+ tighten variable interpretation for boolean 'yes' values
+ mark display server procs to deduce ownership instead of display lock file
+ remove x_display, and assume :0, with other farm session having no leading 0
+ change creation display id to :99 and erase temporary manifest before login
+ copy and use errant ssfn generated by steam instead of deleting it
+ no longer have script change client fps and use only one idle_max variable
+ remove conditional x server stop from logout and fix xdotool lock typo
+ eschew non-node based variants of routines and related checks
+ dont queue friend requests and instead fail if node login is unavailable
+ remove display/wid gather in load for farm helper
+ only start pulseaudio if needed after flite/aplay checks in helper prep
+ fix drop deterge variable checks in farm and remove cl_trigger from acmd
+ have drop sound variable enabled by default and check for aplay
+ fix x server pgrep sorting in status
+ only run temp files deletion routine at script end instead of also in sigint
+ skip unnecessary removal of steamgui lock at sigint
+ have sourcemod plugin stop server when empty instead of handling in script
+ only run x/pm/stty finish routine at script end instead of also start
+ remove disconnect calls in stop
+ wait for node to exit if sending a local term signal and print sigterm
+ improve farm helper and reorient to multiple drops without accepting
+ include sample conf with variable details transplanted from readme, now help
+ adjust deps, merge installation/sharing, and elaborate on config in readme
[version 0.9008]
+ don't have the ui client verify extracts nor wait for manifest in login
+ show ui package download output through error stream
+ re-extract ui content if the client manifest is removed
+ protect erasing depot/app cache and music directories in ui extraction
+ wait for wineserver to exit from a previous session during a (re)login
+ hide missing file error for tf2 client acf stateflag sed
+ fix force_aniso high cvar typo and use widescreen resolution for high client
+ remove steamvr logic as it is now longer a required bundle for tf2
+ fix error when checking non-existant size-on-disk from an app manifest
+ show size on disk of tf2 app when preparing farm client
[version 0.9007]
+ move common functions to a separate load file to share with helper
+ don't exclude dgbhelp.dll to resolve crashing on certain systems
+ neglect vrclient+icudt.dll and steamwebhelper instead of libcef/chromehtml
+ use winedebug setting if debug env variable is set and require xdpyinfo
+ apply wine staging shared-memory environmental variable
+ fail and exit if the script file has no 'pdl-idler' prefix
+ require ip/lspci, depend on gcc for vunzip compile, and find alt node binary
+ include xwininfo and xprop into the dependency check
+ reinclude support for sudo command alterations and improve xwrapper check
+ migrate/rearrange shared data and account files from cred to share directory
+ move deletion of hlextract,launcher,xpid/x11vnc,etc files to migration
+ delete existent files before download, try 3 times, and handle redirects
+ don't check gist for updated version if script is renamed and do less often
+ adapt gist download and extraction for new zip file format
+ remove background sleep on gist download and always announce it
+ ensure deletion of gist download tarball if it wasn't during the check
+ reference window with id not name and store the previously gathered wid
+ support toggle between read/sleep for pause when running background routines
+ ensure correct pid/return value when waiting on a lock file
+ skip redundant hl2 pid check and cache client connection status
+ support up to 99 srcds or xvfb instances with corresponding variables
+ mark cl con to test cmd ability and slow/lengthen timeout loop with time fix
+ collate totals of relevant steam web helpers when calculating steam memory
+ pause to ensure new hl2 proc went defunct and to allow for final srcds irc
+ use default fps marker without separate file and fix an error on disconnect
+ end fake only if no invocator in stop and fix content state check
+ halt the stop wait at 10 seconds with process kill
+ pause for moment after window focus and target by wid not name when closing
+ look for unmapped window state along with withdrawn in close_window
+ install steam ui in drive c no program files with chmod adjust now in delete
+ reference correct file for the connect hash when the prefix is uninstalled
+ share/link steam config/userdata dir and eschew cred backup in logout/global
+ track existence/pid and protect X server stop/start via display block file
+ fix vnc pid check and wait for wineserver end in X stop with faster pause
+ change/hide farm helper script file and delete new xdotool lock in x stop
+ erase config/htmlcache in not-high logout and login
+ show X id in logout message and close error windows when logging out normal
+ just close subscriber window in logout for the initial config restart
+ remove 5 sec delay on check for the cloud/download shutdown window in logout
+ handle stalled client stop and use stderr for kill warning in logout
+ no longer track/use host files or employ their relevant checks
+ fix potential bad lcfg modification in logout/sigint with avatars variable
+ allow main X server to be stopped in logout when called from sigint
+ prune tf2/friend files in logout not uninstall along with utility script
+ don't have logout end node background sessions that aren't enter/fake
+ fail on short usernames and collate all relevant files in account size
+ move and link steam logs directory to share/account/logs/host
+ warn if 8 seconds have elapsed after when waiting for wineserver to finish
+ rely on logout call regardless of wineprefix presence in uninstall
+ remove appcache acct stats in uninstall and fix wine-staging ver detection
+ change x11vnc passwd file name and remove noxdamage parameter from startup
+ fail if the display server doesnt successfully start
+ don't attempt yes or output redirection with ssh-copy-id in x11vnc start
+ show x/xvfb server pid in x11vnc start output message
+ avoid steam pid check on some install calls and reset proper create display
+ bump prefix ver to 8 and ignore prefix location change
+ share depot/appcache/vr locally within steamgui to fix vr redownloading
+ consider wine-staging when checking wine.inf and other system files
+ backup registry file for cloning to other accounts for creation or low login
+ create and or use links for each account wine prefix/registry and steam data
+ disable steam music folder crawl option of config.vdf in install
+ show various warning error messages in stderr output stream for validate
+ block/download/extract/link/touch client ui data manually before install
+ run wineboot instead of regedit to create/prep data and do only if needed
+ copy and use default steam skin without notifications for farm logins
+ no longer use timestamp files in the prefix for the install/friends delay
+ cancel wine gecko installer prompt if it arrives in prefix prep
+ make prefix documents directory and link companions to it in install
+ recreate lcfg entirely in login (not install) for initial restart/creation
+ prefer shared ssfn over errant on conflict and remove clutch in install
+ reset tf2 app stateflag from 1030 to 6 before login to handle a crash
+ use rawinput, motionblur, 8x aa/af, and disable vsync for high mode clients
+ set default client class cvar to scout and do similar with sourcemod plugin
+ disable tf_taunt_always_show_hint client cvar and adjust to mode in login
+ truncate steam server address representation in authenticated output message
+ unify most key/input/mouse xdotool calls under optimized wrapper funcs
+ rely on script variable instead of passwd script presence for the end echo
+ move email routine into its own action simplified with a click not keys
+ ignore error, retry 4x, fix empty bp read, and skip profile in tf2b download
+ implement exhibit to relax acct inventory and/or comment privacy settings
+ simplify explorer pid check and don't use pid in each prefix
+ no longer halt node fake sessions in login start and use error stream more
+ properly fail for the entire action if there is not enough swap in install
+ always neglect crashhandler.dll for high-mode logins and mark normal logins
+ set wine version 1.7.38 as the minimum required to support the game overlay
+ change port ranges for client/listen and mark steam process for coordination
+ print error and logout if a preset password entry fails 3 times in login
+ bump/recreate app manifests for tf2/steamvr to fix empty location bug
+ reset from create display at login loop lcfg prep instead of config restart
+ relax cloud settings/permissions now blocking only tf2 config.cfg
+ improve login cfg handling with ss key, broadcast disable, and high jumplist
+ download image and embed a steam client screenshot entry before ready login
+ fix farm var and jumplist/dupe streaming in lcfg and hide block notification
+ move nopreload/nopreloadmodelscmdline switches to only farm client
+ get explorer pid at login finish instead of locking and tracking ps
+ regedit if needed with csmt/font/sb/audio keys and fix some tampers
+ erase dumps directory and all log txt files before steam client init
+ show 3 digits of ssfn/cred in init message not auth and use console always
+ retry offline login after a minute and close window instead of kill
+ mark authenticated output message if password was inputted with truncated ip
+ close error window instead of just hitting return in login password entry
+ delay for creation network/password check to wait for the steam client
+ catch and restart on io operation stall in account creation
+ remove new creation anonymous userdata and change ui message to a warning
+ watch for client ui manifest extraction and relink in login if needed
+ fix ssa window stall and skip mouse/alt+f4 for closing guard location window
+ run register and exhibit actions after creation but before changing display
+ check/show for time spent on auth reconnect and errant ssfns in login msg
+ don't needlessly call regedit to modify hl2 settings in login finish
+ preempt steamvr download with stall before login finish
+ show prefix size, short hash, and pid in login output message
+ fix urls with multiple slashes and only try default X display in website
+ increment the xdg-open delay for each account in website
+ support echo to chatroom from log writes in node enter
+ build node modules inside of steamnode directory to prevent an npm error
+ fix deletion of /tmp/npm directories, npm-debug.log, and previous version
+ manually install/use ref module as it is not implicitly used in node-steam
+ upgrade node-steam to 0.6.8 and steam-trade to 0.2.4 with improved ver check
+ mark script pid in node js and hide future output when it breaks from shell
+ pause for the updated node servers file download before exiting a node login
+ warn and relogin/retry/continue for some node actions that timeout/fail
+ better handle a transient node relogin due to connectivity issues
+ utilize new chat event in node-steam instead of a timeout on a join failure
+ error/fail when trying to fake while running another node action/steam app
+ fix fake returning a failure when already on the same appid
+ disable PM on a node login break with new xfconf/restart procedure for xfce
+ use just wget and apikey instead of node script pipe for friend+online check
+ employ local friends/online checks in trade prep if the steam pid is present
+ cache creds, fix file/pid/timing/window_close/queue/suffixed-acct in friend
+ assume default display and pause after running alternative pager in log
+ use proc list instead of checking each port in server log page
+ implement socialize action that completes community tasks and/or votes
+ enforce minimum random dictionary word length of 6 characters
+ adjust to new string in content log and fix app download size reading
+ don't run pre-load hl2 regedit unless needed and not in the background
+ switch to vpk binary instead of external hlextract program
+ bump farm resources to version B with a heavily-reduced set of scripts/ui
+ use links to handle cfg files now being read only from the mod gameinfo path
+ improve wait/check loop in load and include farm files for gun mettle update
+ show tf2 versions in client/server farm resource construction messages
+ mark output if tf2 was readied with count of farm constructions
+ include discard/passtime panel and extract gameui txt files in construction
+ symlink items_game.txt and the signature file into farm resources
+ extract and arrange item drop/pickup sound files for farm drop logger
+ increase size of client ui crafting status dialog close button
+ mark item discard panel arrival in client log to deduce a full bp in farm
+ delay writing farm construction version file until successful cl/sv launch
+ properly target the error windows and mark/close available window in load
+ turn steam vr wait message into a marker on loading output
+ check for micro validates and don't build farm resources if no dl in load
+ exit and fail if the d3d error shows in load due to damaged prefix/registry
+ warn then consume another login by overriding error window in load
+ fix cloud conflict/warning window targeting and bypass in load
+ close updating and/or ready window after dl is done in load and mark output
+ skip regedit in load finish and ensure reset/return of alias.cfg on failure
+ mark hl2 window id and display in wid file for reference by farm drop logger
+ show disk size of tf2 app in client preparing messages instead of license
+ read the correct server app download size and show size and port in check
+ show action time in all connect messages instead of just for farm
+ fix server availability check and farm clients not restarting in connect
+ start cl before sv in connect to ensure vpk and no longer keep server logs
+ institute server resource bump following the client's and use empty precache
+ upgrade to sourcemod 1.7.3git5258 and metamod 1.10.6 and retain basecommands
+ revert default server to irc.freenode.net and fix duplicate channel section
+ show tf2b uid link in sourceirc connection/disconnection/status messages
+ protect sourceirc.cfg file with file permissions in connect
+ include item event and relay activity in farm server plugin for drop logger
+ improve event map deduction, mark account, and skip server identity if f2p
+ reuse existing game server account identity in event registration
+ apply ignoresigint srcds switch to block errant ctrl-c in the screen session
+ use 0 for sv mp_allowspectators/team_unbalance_limit and show map in output
+ only check hl2 once for noshaderapi flag in connect and truncate ip output
+ fix not waiting for a map load in non farm client connect to a pdl server
+ better handle challenge/mismatch/full/ban/password and exit on vac failure
+ check/fail if local steam client is running an app before a node game action
+ handle private bp failure in node backpack retrieval
+ collate all crate defindexes into one recognized tag for item modifications
+ show various available/max counts in node item modification output messages
+ start pulseaudio for drop logger if the default alsa device points to it
+ deterge before farm if free bp spaces are less than drop_deterge variable
+ don't start extra farm helper, change bg to #3a342e, and remove schema wait
+ move notification trigger into slower acmd and remove noaudio switch in farm
+ remove the wine processes from pulseaudio client list after farm load
+ implement sound/tts/irc/chat drop logger in helper with other improvements
+ use one helper for all displays and delete junk files on migrate not finish
+ don't differentiate items from crates in list output
+ show padded prefix disk usage in list instead of status and truncate uid
+ just reference cached version of steam ui and skip download in list
+ add flag for separate node login state in list and move pci.ids to share
+ hide dns error, remove lsof/profile download/group name, and level in status
+ show pid instead of helper count in status and sort xvfb/srcds listings
+ read ps for srcds/X instead of trying 0-9 and fix vnc+llvm+dns in status
+ detail left aligned pid+usage for wineserver+explorer+services in status
+ fix parameter spaces and not using it when steam is not running in utility
+ fix failure returns and parsing of node receiver account with '@' characters
+ fail or warn about trade block with cred file mark and/or handle in session
+ fix check for both left/disconnect status codes in node chat state change
+ include steam game gifts in trade, unless nosg flag is present
+ fix incorrect timing out on uid targeting sender accounts in trade
+ check online first, properly reset account, and fix refake in trade/harvest
+ don't warn when the last trade target leaves the chatroom
+ use explicit warning for trade error 22 when a sender cannot trade
+ carry over truncated trades to subsequent exchanges in the same node login
+ retry node trade sessions within the same login if they don't complete
+ fix receiver syntax error and increase trade send exit timeout from 10 to 32
+ increase trade item add timeout from 60 to 80 seconds and fix harvest fail
+ explicitly leave chat after finishing trade and remove pdl.conf mv clutch
+ allow user to specify/negate account index/group ranges in invocation input
+ fail and exit if account index/group/range input is invalid and harden logic
+ skip global init start/end operations for an invalid action
+ perform deletion of temporary files/dirs for sigint as well as global end
+ sigint once, attempt just logout, show acct, and use stty there and finish
+ fail with return code 2 for assisting in canceling looping invocations
+ use proc list instead of checking each port in finish server stop and x stop
+ look for crashdialog not listen to count hl2 procs and show xfce pm version
+ run finish (without in progress logout) before and after main action loop
+ fix initial display deduction and condense multiple underscores in arguments
+ only select active accounts with relogin and improve global receiver stop
+ move friend invite queue process to after the main action loop
+ remove unneeded steamcmd/dumps/vnc directories after main loop not finish
[version 0.9006]
+ bump prefix version to 7
+ fix launch options config injection failure
+ disable streaming client in initial config injection
[version 0.9005]
+ skip unneeded mouse interactions when closing certain windows
+ suppress separate input prompts for x11vnc ssh keygen
+ revert skipping of regedit/wineprefix prep in install
+ disable family sharing notifications in initial steam client config inject
+ fix setting other apps' launch options to those of tf2
+ remove unnecessary 0.5 second wait in e-mail registration request routine
+ check for empty steam server list in node login prep
+ fix sigint handling for node logins and mark position in action timeout
+ rely on error window instead of licenses for ui chat permission check
+ fix parsing empty account password suffixes
+ set x root background to gray after logging in a farm account
+ fix responding to friend chat events other than a message in node fake log
+ fix trade input string for receivers with a supplied password
+ transform account indexes entered with the receiver input prompt
+ fix clearing receiver variable after error if it was targeted as a sender
+ abort trade for all accounts if the receiver password is invalid or failed
+ remove broken local symlinks to cred host files on init
+ fix error, warn, and remove lone '+' characters from account selection
[version 0.9004]
+ truncate path from script name reference
+ harden node dependencies with npm, git, and nodejs-legacy/binary checks
+ force a gist update check if environmental variable is set
+ close empty server if client was stopped with a kill instead of normally
+ show hostname in node background stop if applicable
+ fix client game unavailable error/retry and adjust close window error hiding
+ don't attempt to backup creds without uid and protect cred file with chmod
+ close create and/or steam window in logout and hide errors if no localconfig
+ supply variables for password and ssh tunnel handling with x11vnc
+ disallow 'steam/valve' in name when creating an account and use display :9
+ only run main regedit in install if the prefix needs to be prepped
+ retain some settings and the textures vpk for a farm debug parameter
+ fix errant regedit prep stall/cancel in install
+ institute steam launcher download bump at version A
+ hide dd output in ssfn generation and use default cred/ssfn if present
+ reset client gameinfo on login if there is no lock on the file
+ retry account creation once or fail for weak password or server block
+ fix stalling after ui extract when creating multiple accounts
+ use uid instead of dir checks in login userdata config and create test
+ show first 3 digits of ssfn sha1 hash in authenticated output message
+ mark create stages in output and watch connection log before password entry
+ fix email removal sed from wiping the whole conf file in account creation
+ stop subscriber agreement bypass from continuously running
+ increase speed of email confirmation request routine
+ fix old acct conflict switch in trade for accounts with conf passwords
+ use marker file when stopping xfce4-pm so as to know to restart it
+ hide gameinfo error on initial server start
+ upgrade sourcemod to 1.6.0-hg4359
+ only show finish message in validate if it is successful
+ improve gpu deduction with amd dominant over i915 and use vnc status flag
+ hide pass from node script and permit background paging with _ prefix in log
+ include output of screen -ls in report data
+ set node fake game clients to the busy persona state and log friend messages
+ replace steam/valve strings in node rename selection with 'pdl'
+ perform node backpack error handling with error event instead of try/catch
+ change common crate item defindexes to those of the supply munitions
+ don't wait for pid when restarting the power manager
+ improve account targeting with conf-less indexes and invalid number checks
+ add node dependencies, new variables, and new parameter info to readme
[version 0.9003]
+ fix ssfn file entry config.vdf sed
[version 0.9002]
+ fix node installation assumption in many places
+ migrate errant ssfn files generated by the steam client before login
+ fix random ssfn file generation
+ fix exit_timeout node typo in trade
[version 0.9001]
+ allow renamed scripts and show filename in status+usage
+ keep winedebug disabled for high-mode and add default chatroom variable
+ update gist cache timestamp even if the download failed and hide that error
+ use proper read line program for install/create/command input prompts
+ fix false command errors due to timeout not resetting on a each command
+ don't show empty pid if ending a node session running on another host
+ silence errant xprop/xwininfo error output from close_window
+ don't use alt+f4 when closing friend invite window
+ backup/restore authorized device ccfg section with cred file
+ stop background node sessions in logout
+ look for high-acct files in cred instead of the idler root
+ make steamappdata.vdf before every login not just the initial install
+ recreate ssfn file to the correct size and dirty cred hash
+ change to default of 300 fps for high clients and move personal.cfg to cred
+ don't reinstall on second offline error and just wait 4 minutes before retry
+ warn about broken overlay pending a future wine bug fix update
+ provide aload alias instead of starting manual play-mode reoccurring aliases
+ relax cloud restrictions on 760, 7/serverbrowser, and 440/item_clientacks
+ remove write access to sharedconfig.vdf after (re)creating it
+ check steam client url handling ability before restarting for initial config
+ accept 2/busy+3/away+5/trade+6/play parameters to online and show in list
+ delete steam client cred host marker files in node login if they exist
+ lurk and log chatrooms with node if not using the steam client in enter/exit
+ harden lcfg steam uid gather for when there are multiple accounts listed
+ accept optional '/?' suffix to stm_com website parameter and fix tf2b
+ check friendship status via uid with node and improve account selection
+ send friend invites with node if steam isnt running and allow uid/index add
+ revert farm vpk packaging to reclaim some hl2 memory and fix mismatch error
+ fix steamcmd validate variable and improve watch loop with state/download kb
+ fail on sourcemod plugin compilation and show output
+ improve and delay ~/Steam restoration until after server has started
+ extract scripts/tf_weapon* for server resources to fix non-farm client crash
+ upgrade sourcemod to 1.6.0-hg4304
+ enable sourcemod logging if debug environmental variable is set
+ show client connection duration in sourceirc and idler plugin output
+ verify srcds content and connect to server in validate skipping schema check
+ change dashes to underscores in fake parameter input
+ delay writing node schema url marker file until it downloads
+ fix not crafting a single weapon pair and slow craft/waste delay to 200
+ delimit combined craft/waste parameters with a ':' in deterge arg string
+ implement trade action with defindex selection/negation and uid send
+ use harvest action to deterge and trade in one node login
+ delete junk ~/Steam dir and empty/errant gist.tar.gz in finish clean
+ don't fail if no pdl-idler.conf and break twice if node isn't installed
+ logout steam if it's running on the host rather than fail before node action
+ fix parameter and advanced account typos in readme and add new info/examples
[version 0.9000]
+ export LC_ALL to C at the start of the script
+ only show gist check message if its been 4 seconds since the download start
+ compare script versions numerically instead of just checking equality
+ fix/improve window id targeting in close_window
+ don't warn or dirty cred hash unless ssfn file was existent as well as empty
+ harden initial client connection marker and use net_graph cvar for high mode
+ remove obsolete empty config.vdf content markers from steam init message
+ fix case sensitivity when checking app buildid and gameinfo complication
+ clear steam cloud log before account login
+ expose more warnings/errors to error output thereby showing them in validate
+ move the pdl-idler.conf file into cred
+ auto accept client subscriber agreement dialog in login
+ open website in the first available display instead of the active one
+ package client farm resources into a vpk file and use it as a version marker
+ pad first empty decimal place in process usage output
+ show first server console even if it is not running in log
+ condense and improve report output data
+ reset display variable export before starting steam in validate
+ remove errant apostrophes from random words in rename
+ delete the correct openvr directory and don't delete .screen in finish clean
+ don't skip pausing in sleep action if there is a node background session
+ fix default website parameter in readme and adjust conf locations
[version 0.89]
+ change gist update check frequency from 4 to 8 hours and fix typo
+ improve client fps log marker
+ fix non-empty guard keys not linking on reinstall
+ pause after focus the guard window before entry
+ focus then accept sporadic 'update available' steam window in load
[version 0.88]
+ announce when checking gist for updates
+ return condebug use with separate gameinfo write directories for console.log
+ remove normal arg from window check and use authentication instead in logout
+ disable winemenubuilder in regedit and show launcher download before install
+ default to high mode if the file 'high-${ACCT} exists in the idler root
+ reset steam client ui dimensions before every login
+ warn about new invalid empty ssfn files, fill them, and force password entry
+ provide convience alias to kill reoccuring client comand loops
+ randomize player logo spray selection if any exist in pre-login prep
+ enable d3d9ex for high mode and remove obsolete explanationtradingpanel cvar
+ add matchmaking_ticket_help + show_preset_explanation_in_loadout client cvar
+ split checking/updating ui messages into checking + downloading with size
+ retry once after a unknown steam login failure
+ delay steam init message until wineserver restart and slow prefix wait loop
+ don't warn about manifest bump if initial tf2 download is unfinished
+ disable autoupdate for apps if they have a buildid before login
+ retry, then reinstall, then keep retrying and waiting 10s on offline logins
+ improve password prompt output echos and guard prompt input
+ fix auth error reinstall not retrying with the same login flags
+ change default selection in website from tf2b to stm_inv and increase pause
+ don't alter gameinfo without buildid and show vr dl/size in load+validate
+ use seperate gameinfo write dirs for srcds condebug files
+ negate server tf2misc vpk and use extractions to greatly lower memory usage
+ change default irc server from irc.freenode.net to chat.freenode.net
+ revert server map to itemtest to avoid some new reoccuring console spam
+ fix irc timeout stall and increase it by 10
+ lower client schema timeout from 180 to 90 and accept gc message after 10
+ fix node flag alignment in list
+ accept "bin:" prefix to log parameter for selecting text viewer
+ change 'cl' log parameter flag to 'tf' to avoid conflict with 'cloud'
+ combine both node files into one call to less in log
+ ensure logon operations are performed only once per node session
+ switch from '-' to '_' delimiters in fake, waste, and craft actions
+ have item_safety var block accounts in a spaced list from changing items
+ use 100ms delay between sending each message to the gc in craft/waste
+ fix looking for the incorrect node process when running a login script
+ kill account if not logged in or waiting for cred entry in finish
+ don't stop a server in finish if another invocation is running connect/farm
+ delete empty /tmp/dumps + .screen dirs and old server console logs in clean
+ adjust readme adding astop client alias and item_safety var descriptions
[version 0.87]
+ disallow the running of a renamed script
+ print newline upon script cancellation on non-password input prompts
+ check for optional node.js in dependency enforcement and deduce executable
+ fix constant gist checks when using a symlink to the directory
+ improve server playercount checks
+ check host/pid, log age, or exit marker to deduce node login availability
+ end node fake sessions if one is running in stop
+ improve steam application state reading
+ if present, close login window and wait for steam to end in logout
+ fix window focus for farm sessions by adding mouse click inside window
+ use return for close_window and hide syntax error for invalid x.pid files
+ improve show avatars flag login deduction and fix manifest variable conflict
+ fix sometimes not waiting for regedit/prefix prep completion in install
+ remove old steamapps directory move call crutch in install
+ download and adjust to new steam installer executable
+ fix tf2 content manifest bump not prompting validate when there was no file
+ bump content manifest file to version 2 and remove node script+log in delete
+ stop a node background session before login and don't unset pass variable
+ remove bootstrapper update handling in login
+ pipe password input to xdotool (instead of passing it) to hide from ps list
+ fix conf file being erased after creating an account and improve sed call
+ slow e-mail confirmation request automation and remove gameinfo typo crutch
+ simplify load by ignoring cancels and using app state/download size
+ don't modify gameinfo if updating/validating and use correct newline format
+ institute farm resource variable bump
+ fix crash from typo in farm resource creation and remake on update/validate
+ catch and notify about small tf2 updates after launching
+ only wait on schema after loading farm clients and adjust output messages
+ explicitly use bash for steamcmd fixing a crash if it is not the default
+ fix halloween date check syntax error
+ warn and proceed if server irc connection check times out after 20 seconds
+ truncate ip-address in connection output message
+ add node status check flag to list entries
+ move global graphics device+vendor+name deduction to status
+ replace sharedconfig flag in log with 'node' that pages script+log files
+ remove obsolete regedit.reg file read in report
+ implement validate action that uses one account to check client content
+ have npm install the node-steam module to the pdl-idler root
+ check ssfn and use $APIKEY environmental variable for node functionality
+ prompt or use last password in node script and erase entry on login fail
+ wait on node action completion before script prepping once until it is run
+ stop and later resume a running background node if about to run an action
+ construct node script with logic/action interchange before execution
+ implement background fake, rename, waste, craft, sort, and deterge actions
+ if canceling, logout/kill the current account if it has not fully logged in
+ delete obsolete steam msi installer and old openvr directory in finish clean
+ show timestamp and current running action in sigint output message
+ echo newline to canceled password prompts
+ fix grep error for pdl-idler.conf passwords for block/index referencing
+ simplify log sigint handling
+ add node dep+credit, api key, new action descriptions, and example to readme
[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
pdl-idler (0.9025) HELP
DESCRIPTION
-----------
pdl-idler will install, update, and run multiple instances of steam and tf2
game clients in individual wine prefixes for the purpose of idle farming. As
many considerations as possible are made to reduce cpu load and memory/disk
consumption. Downloaded data and program files are shared between account
prefixes, and a special dedicated idle server for item farming is started that
parks clients in the connection state, so they can run at one fps and run in a
a low-memory mode. 32 of these farm clients can fit in one game/X server pair,
and a helper script will announce the item drop notifications. Also, status
and backpack actions, crafting/trading routines, utilities, and wrappers
around community functions are provided.
REQUIREMENTS
------------
bash, bc, gcc, git, glxinfo, netcat, nodejs, npm, screen, sudo, wget, xvfb,
wine >= 1.7.8, xdotool, xwininfo, and xprop are required. x11vnc and ssh are
optionally used when the script starts an X/Xvfb display server. aplay and
flite are required for item drop log sound and speech.
INSTALLATION
------------
Download the zipfile from 'https://gist.github.com/primarydataloop/1432762',
then extract its contents to a location such as '${HOME}/pdl-idler'. The
script will prompt for later updates from this gist site. When employing
multiple machines, it is recommended that the 'share' directory be assigned
among these hosts via samba to allow for synchronization of data and logs.
CONFIGURATION
-------------
Copy 'pdl-idler_sample.conf' to 'share/pdl-idler.conf', and modify it. You
will need to specify an apikey, and fill the sample account array/lists with
real accounts. Also, you may adjust some miscellaneous variables not otherwise
controlled by action parameters.
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
accounts (separated by spaces). 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 replaced with the '^' character, and semicolons are escaped'. If no
accounts are specified, then all known accounts will be selected. To reference
an account by its position in the list, preface the index with '+'. Account
blocks can be referenced with a preceding ':'. For selecting a range of
account indexes or blocks use the format +X..Y or :X..Y. You may also negate
account selections by prefacing element with a '-'.
The following are the available actions with optional parameters in brackets.
[ help{=action} ] /show this page or an action description then quit
Print a short table of the available actions or a longer description for an
action supplied as a parameter. (def: "")
[ login{=mode} ] /install/prep, then authenticate and login {lo}
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 client will be installed, data links
and directories will be created, and some configuration will be prepped. The
user may supply the 'hi' mode flag to launch steam with dlls enabled, high
graphics/client settings, and support for the in-game overlay, or the 'lo'
flag to disable web support and other features to save memory. If a password
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 was not pre-supplied) and/or a guard code. If
there was no credential backup at time of install, steam will be restarted
so the new configuration can be applied. (def: "")
[ create ] / create a new account then login
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{=type} ] /if logged in, sign on) {(online)|busy|away|trade|play}
If logged in, sign on to steam friends, with either' online',' busy',
'away', 'trade' or 'play' as the status type. (def: "online")
[ offline ] / if online, sign out of friends
If online, sign off steam friends.
[ enter{=id} ] /join public chatroom {(103582791432273268)}
Mark the current friends status, then go online and join a public chatroom
via its community id. (def: "103582791435720285")
[ exit ] / leave public chatroom then restore prior friends status
Leave the chatroom and restore prior friends status.
[ friend{=accts} ] /perform/queue friend invites {(cmdline)}
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 then start tf2 {low}
Login if necessary (observing mode parameter), then start the client in
gui mode. After a client launch of any type is initiated, power management
will be disabled. (def: "")
[ command{=cmd} ] /if tf2 is running, execute command {(?)}
If the client is running, execute console commands as supplied from the
action parameter or prompt. (def: prompts)
[ connect{=loc} ] /start tf2 then join game, map, or idle {(idle)}
If the client isn't running, start it, 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
elsewhere, farm clients will restart in normal mode. (def: use idle server)
[ farm ] / start low steam+tf2/Xvfb/helper then idle
Logout of a normal session, start a dedicated server and a separate X server
on the next display (if needed), then login with the 'hide' login flag on
the separate display. If not running, start the client in low-resource,
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 and
announce drop notifications.
[ disconnect ] /if in-game, disconnect from the server
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.
[ stop{=kill} ] /if running, quit/kill client {yes}
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: "")
[ logout{=kill} ] /stop then close/kill steam {yes}
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: "")
[ website{=web} ] /browse {(tf2b)|tf2items|backpack|willitcraft|stm_com/inv}
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: "stm_inv")
[ list{=ref} ] /list account information {no|yes}
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: "")
[ status{=ref} ] /show system and process statistics {no|yes}
Show system and server information, then list selected accounts (if they are
logged in) followed by their process statistics. (def: "")
[ backpack{=ref} ] /detail backpack contents {no|yes}
List, then detail backpack contents. (def: "")
[ log{=files} ] /page {(all)-tf-sv-app-boot-cloud-conn-content-ccfg-lcfg-node}
Page log files, including the running server, client console, and other
steam files. The choices include 'tf', 'sv', 'app', 'boot', 'cloud', 'conn',
'content', 'ccfg', 'lcfg', 'node', and 'all'. Press Q to cycle through each
log or CTRL-C to abort. The files parameter may be prefixed with the name of
an alternate pager program, and should that be prefixed with an underscore,
the execution will happen in the background. (def: "all")
[ utility{=utils} ] /execute sh commands or steam urls {(regedit)}
Execute shell commands and steam urls (if it is started) under the script
environment for the selected account prefix. (def: "regedit")
[ uninstall{=k} ] /logout then remove wineprefix {yes}
Logout (normally or with a kill), backup credentials, then remove client
files and wineprefix. (def: "")
[ delete{=kill} ] /uninstall then remove credential backups {yes}
Uninstall, then remove the credential backup and related files. (def: "")
[ sleep{=time} ] /wait awhile or til enter is thrice pressed {(1m)}
Wait for a specified period of time (in seconds) or until enter is pressed.
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: "5")
[ fake{=appids} ] /feign play activity for game(s) {(440)}
Feign gameplay in the background for tf2 or the underscore-separated list of
appids (def: "440")
[ rename{=format} ] /generate profile name {(~word-~INT_~WORD~INDEX}
Generate and assign a profile name for an account, according to a format
where "~word or ~Word" will be replaced with random uppercase or lowercase
dictionary word, where "~INT" will be replaced with a random single-digit
integer, and "~INDEX~" will be replaced with the account index as referenced
from share/pdl-idler.conf. Finally, ~ACCT will be replaced with the account
name. (def: "~word-~INT_~WORD~INDEX")
[ craft{=no} ] /turn common weapons into metal {(0)}
Turn weapons into metal and scrap into reclaimed, where only common
weapons are consumed, excluding any other negations of items with defindexes
from an underscore-separated list. (def: "0")
[ waste{=del} ] /destroy items {(crates)}
Destroy all instances of items with defindexes from an underscore-separated
list. (def: "crates")
[ sort ] / sort player backpack by item age
Sort the player backpack by item age.
[ deterge{=n:d} ] /craft, waste, then sort {(0:crates)}
Run craft, waste, and sort in one node login session. (def: "0:crates")
[ trade={offer} ] /send/receive items {(?@all_-crates)}
Send items from selected accounts to the index/name/uid specified in the
offer parameter. All items from the tf2/steam backpacks will be added if
nothing suffixes the target account. If 'nosc' is present, the steam
community items will be neglected, while 'nosg' will neglect game gifts. By
default, all tf2 items will be sent unless a underscore-delimited list of
additive item defindexes are added, resulting in the selection of only these
items. To trade all tf2 items with specific negations, specify 'all' and
append select defindexes prefixed with a '-'. (def: "prompts@all_-crates)"
[ harvest={n:d.o} ] /deterge+trade {(0:crates.?@all_-crates)}
Run craft, waste, trade, and sort in one node login session. Separate the
craft/waste arguments with a ':', and suffix the offer parameter with a '.'.
(def: "0:crates.prompts@all_-crates")
[ register ] /login and/or request confirmation email
Login, then request an e-mail confirmation if needed.
[ exhibit={ex} ] /login and/or relax privacy settings {(ic)}
Check inventory and/or comment permissions (based on the presence of 'i/c'
in the argument flag), then login and relax settings if needed. (def: "ic")
[ socialize={f} ] /login then complete community badge and/or vote
Login, then attempt to complete a majority of the community ambassador badge
objectives and vote if there is a store event. A common trade bot will be
the friend target unless an account name, index, or uid is supplied as the
action parameter. (def: "")
[ discover ] /login if appropriate, then click through store discovery queue
Login, then browse through store discovery queue.
CLIENT COMMAND ALIASES
----------------------
Useful command aliases are provided for pdl-idler clients to take advantage
of, with either the gui console or 'command' action.
| aload |
Start recurring client command loops.
| astop |
Halt recurring client command loops for the life of the client.
| mmute |
Stop voice transmission and mute all players.
| mhear |
Stop voice transmission and unmute all players.
| mtalk |
Unmute all players and start voice transmission.
EXAMPLE INVOCATIONS
-------------------
"login,play,online mann1 mann2"
Login mann1 and mann2, start their clients, then sign them onto friends.
"list,login%play,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 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=herr1-herr2-herr3,website=stm_com ben"
Get ben some lady friends, then check out his profile.
"waste=673_5635 +2"
Delete all winter noisemakers and robocrates from mann1's backpack.
"craft=42_311_433 jerry"
Make metal from common weapons while preserving sandviches+steaks+fishcakes.
"deterge=59:5639,fake mann3"
Process bp (saving dead ringers and deleting claim checks), then feign play.
"trade=ben@all_nosc_-5708_-5719 mann2 mann3"
Send all of mann2/3's items to ben sans acorns, strong boxes, and all cards.
"harvest=56:crates.+2@5709_5640 herr3 herr4"
Craft (no hunstman), waste crates, send gourd/sac to mann1, then sort.
SUPPORT/LINKS
-------------
< irc://irc.freenode.net/primarydataloop >
Discussion hub for advanced idler science.
< steam://url/GroupSteamIdPage/103582791432273268 >
Official steam community group.
< https://gist.github.com/1432762#comment-833847 >
Start of the github gist comment section for pdl-idler.
ACKNOWLEDGMENTS
---------------
Thanks to tf2b, ##slackware, sourceirc, xdotool, hllib, node-steam, gnu, etc.
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>.
#!/bin/bash
# pdl-idler.sh (0.9025)
# Copyright (c) 2011-2016 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/>
# check shell, then change pwd
if [ $(readlink "/proc/$$/exe" | sed "s/.*\///") != bash ]; then
echo "warning, only bash is supported as the shell"
exec bash ${0} $*
fi
cd "$( cd "$( dirname "$0" )" && pwd )"
DIR="${PWD}"
finish()
{
# if no hl2/node processes, enable power management
export DISPLAY=:0
if ! pgrep -fn hl2\\.exe.*-nocrashdialog > /dev/null \
&& ! pgrep -fn ${NODE}\ share/ > /dev/null; then
XFCE_PID=$(pgrep -fx xfce4-power-manager)
if [ -e .xfce4pm.pdl ] && [ ! -z ${XFCE_PID} ]; then
XFCE_AC=$(cat .xfce4pm.pdl)
tprint "enabling xfce4-power-manager..." 0\>${XFCE_AC},@${XFCE_PID}
set_xfce_power ${XFCE_AC}
rm .xfce4pm.pdl
fi
fi
# delete junk and wine temporary internet files
if ! pgrep -fa sh\ .*pdl-idler.*\\.sh | grep -v pdl-idler_helper\\.sh \
| grep -qv $$; then
rmdir /tmp/dumps 2> /dev/null
rm -f npm-debug.log .xdotool*.lock
if ! pgrep -f wget.*GetPlayerItems > /dev/null; then
rm -f .items-*.pdl
fi
if ! pgrep -fn steam\\.exe.*-noverifyfiles > /dev/null; then
rm -fr wine/users/${USER}/"Local Settings/Temporary Internet Files"/* \
wine/users/${USER}/"Local Settings/Application Data"/* \
wine-*/drive_c/Steam/steamapps "${TF}"/con-*.log .vnc_passwd
fi
# if there are no steam processes, stop relevant X server(s)
for X in $(pgrep -fal idler-X | grep -o \ :[0-9]*); do
if ! pgrep -fn steam\\.exe.*_${X} > /dev/null; then
VNC=$(pgrep -fn "vnc.*display ${X} ")
if [ ! -z ${VNC} ]; then
tprint "stopping x11vnc..." ${X},@${VNC}
kill ${VNC}
fi
if pgrep -f idler-X${X:1} > /dev/null; then
tprint "stopping X/Xvfb..." ${X},@$(xserver_pid ${X})
kill $(xserver_pid ${X})
while [ -e /tmp/.X${X:1}-lock ]; do
idler_sleep 0.5
done
fi
fi
done
fi
# reset terminal attributes
stty sane
tput setf 9
tput sgr0
}
sigint()
{
# capture sigint to conditionally end, perform finishing operations, then exit
trap - SIGINT
if [ ! -z ${END_ECHO} ]; then
echo
fi
tprint "cancelling script invocation..." ${ACTION},@$$
if [ ! -z ${LOGIN} ] && steam_pid > /dev/null; then
if window_id Login > /dev/null; then
idler_logout
elif window_id Create > /dev/null; then
idler_delete yes
else
idler_logout yes
fi
fi
finish
exit 2
}
# print action description or usage text
PDLIDLER=${0##*/}
idler_help()
{
local HELP=${1}
if ! grep -q "^ \[ ${1}" HELP; then
unset HELP
fi
if [ ! -z ${HELP} ]; then
sed -n '/^ \[ '${HELP}'/,/^$/p' HELP | head -n-1
else
printf "\n${p}Usage: ${g}${PDLIDLER}${x} ${b}ACTION1${z}${m}{,/%%}${x}"
echo "${b}ACTION2${z}${y}=arg^x\;y... ${l}{acct1 acct2/pw#email ...}${x}"
echo -e "\n${u}ACTION{=ARGS}${v}\t ${u}DESCRIPTION {(default)parameters}${v}\n"
for HELP in $(grep "^ \[ " HELP | awk '{print $2}'); do
echo -e "${p}${HELP}${x}\t $(grep -m1 " \[ ${HELP}" HELP \
| grep -o "/.*" | sed -e s/\\//${b}/ -e s/{/${z}${l}{/)${z}"
done
echo
fi
}
page_files()
{
# view a set of files the less paper or another program in the background
SAVEIFS=$IFS
IFS=$'\n'
for FILE in $@; do
if [ -s ${FILE} ]; then
if [ ${1} = _ ]; then
less -K +G "${FILE}"
else
if [[ ${1} = _* ]]; then
DISPLAY=:0 ${1:1} "${FILE}" &
else
DISPLAY=:0 ${1} "${FILE}"
fi
idler_sleep 0.5
fi
fi
done
IFS=${SAVEIFS}
}
idler_log()
{
# page various output and config files
PAGER="page_files _"
if [[ ${1} = *:* ]]; then
PAGER="page_files ${1%%:*}"
fi
if [ -z ${1} ] || [[ ${1} = *all* ]]; then
LOG="tf-sv-app-boot-cloud-conn-content-library-parental-remote-stats-
workshop-ccfg-lcfg-scfg-node"
else
LOG=$(echo ${1} | tr [:upper:] [:lower:])
fi
if [[ "${LOG}" = *sv* ]]; then
LOG=${LOG//sv}
for SRCDS in "${STF}"/pdl-*; do
${PAGER} "${SRCDS}"/console.log \
"${SRCDS}"/addons/sourcemod/configs/sourceirc.cfg \
"${SRCDS}"/cfg/sourcemod/irc-connected.cfg || return 1
done
fi
if [[ "${LOG}" = *tf* ]]; then
${PAGER} ${CON} "${ATF}"/pdl-${ACCT}/cfg/${ACCT//./}+.cfg \
"${ATF}"/pdl-${ACCT}/cfg/banned_ip.cfg \
${USERDATA}/440/remote/cfg/config.cfg || return 1
fi
for FILE in ${LOGS}/*_log.txt; do
FILE=${FILE##*/}
if [[ ${LOG} = *${FILE:0:4}* ]]; then
${PAGER} ${LOGS}/${FILE} || return 1
fi
done
if [[ ${LOG} = *ccfg* ]]; then
${PAGER} ${CONFIG}/*.vdf || return 1
fi
if [[ ${LOG} = *lcfg* ]]; then
${PAGER} ${LCONFIG} || return 1
fi
if [[ ${LOG} = *scfg* ]]; then
${PAGER} ${USERDATA}/7/remote/sharedconfig.vdf || return 1
fi
if [[ ${LOG} = *node* ]] && [ -e ${NODELOG} ]; then
${PAGER} ${NODEJS} ${NODELOG} || return 1
fi
}
idler_list()
{
# print listing with item counts, steamid, connect hash, versions, and status
unset ITEM
LINE="${g}@${SUID/76561}${x} ${l}[$(steam_cellid)$(steam_connect_hash)]${x} ${u}$(
account_size 2> /dev/null | sed -e :a -e 's/^.\{1,3\}$/0&/;ta')${v}"
if [ -z ${SUID} ]; then
LINE=${p}"-|${x} ${LINE} nonexistant |"
else
cache_backpack ${1} > /dev/null
if [ -z "${WGET}" ]; then
LINE=${p}'!|'"${x} ${LINE}"
elif echo ${WGET} | grep -q pack\ is\ private; then
LINE=${p}"?|${x} ${LINE}"
else
ITEM=$(echo ${WGET} | grep -o \[0-9][0-9]*/[0-9][0-9]* | sed "s/\/.*//")
if [ -z ${ITEM} ]; then
ITEM=0
fi
LINE=${p}${ITEM}\|${x}\ ${LINE}
fi
if ! steam_ui_version > /dev/null; then
LINE="${LINE} uninstalled |"
elif [ $(steam_ui_version) != $(steam_ui_cache_version) ]; then
LINE="${LINE} <$(steam_ui_version) |"
else
LINE="${LINE} ^$(steam_ui_version) |"
fi
fi
if ! steam_pid > /dev/null; then
LINE="${LINE}--"
else
PERSONA=$(grep StateDesired\".*\"[1-9]\" ${LCONFIG} | grep -o \[1-9])
if window_id Group\ Chat opacity -v > /dev/null; then
LINE="${LINE}${m}C${x}-"
elif [ ! -z ${PERSONA} ]; then
LINE="${LINE}${m}${PERSONA}${x}-"
else
LINE="${LINE}${y}A${x}-"
fi
if hl2_pid > /dev/null; then
if client_map > /dev/null; then
LINE="${LINE:0:(-1)}${r}G${x}"
elif client_connection > /dev/null; then
LINE="${LINE:0:(-1)}${r}C${x}"
else
LINE="${LINE:0:(-1)}${y}S${x}"
fi
fi
fi
LINE="${LINE}-"
if ! is_node_login_available; then
if tac ${NODELOG} | grep -q BREAK_FAKE; then
LINE="${LINE:0:(-1)}${p}F${x}"
else
LINE="${LINE:0:(-1)}${y}N${x}"
fi
fi
print ${b}${ACCT}${z} "${LINE} "
}
idler_backpack()
{
# list account then detail backpack contents
idler_list ${1} || return 1
if [ -z "${WGET}" ]; then
print "" "{website error}" 46
elif [ -z ${ITEM} ]; then
print "" "{backpack empty}" 46
else
for WORD in $(echo ${WGET} | sed -e "s/ /_/g" -e 's/<[^>]*>/ /g'); do
if [ ${WORD} != \# ] && [ ${WORD} != " " ]; then
if echo ${WORD} | grep -qi items; then
QUALITY="${b}${y}"
if [[ ${WORD} = Genuine_* ]]; then
QUALITY=${g}G.
elif [[ ${WORD} = Haunted_* ]]; then
QUALITY=${m}H.
elif [[ ${WORD} = Strange_* ]]; then
QUALITY=${y}S.
elif [[ ${WORD} = Vintage_* ]]; then
QUALITY=${l}V.
elif [[ ${WORD} = Unusual_* ]]; then
QUALITY=${p}U.
fi
elif [[ ${WORD} = [0-9]* ]]; then
print "" "${QUALITY}${NAME}${z}${x} (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
fi
}
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)
printf "%0.1f" ${USAGE}
}
steam_backend()
{
# get backend connection status from specified log
if tac "${1}" | grep -om 1 logged\ on\ =\ \[0-9] | grep -q 0; then
echo 0
return 1
fi
echo 1
}
# list then show system and process statistics
VERSION=$(grep -om1 \(.* pdl-idler.sh | grep -o "[0-9]*\.[0-9]*")
WINE=$(wine --version | awk '{print $1}' | sed s/wine-//)
idler_status()
{
if [ -z ${ONCE} ]; then
ONCE=yes
if lsmod | grep -q "^vboxquest "; then
VENDOR=80ee
DEV=beef
elif lsmod | grep -q "^vmxnet "; then
VENDOR=15ad
DEV=0405
else
VENDOR=1002
DRIVER=$(lsmod | grep -om1 "^nvidia\|^nouveau\|^fglrx\|^radeon\|^i915")
if [ -z ${DRIVER} ]; then
DRIVER=vesafb
VENDOR=10de
elif [ ${DRIVER} = i915 ]; then
VENDOR=8086
fi
DEV=$(grep ${DRIVER} /proc/bus/pci/devices | awk '{print $2}' | cut -c5-8)
fi
if [ -z $(find share/ -maxdepth 1 -name pci.ids -mtime -28) ]; then
tprint "updating pci id list..." v2.2
download pciids.sourceforge.net/v2.2/pci.ids share/pci.ids || exit 1
touch share/pci.ids
fi
KIT=$(echo $(grep -m 1 model\ name /proc/cpuinfo)~$(cat share/pci.ids \
| sed -ne /^${VENDOR}/,'$'p | grep -m 1 ${DEV}) \
| sed -e "s/model name *://" -e "s/${DEV}//" -e "s/\\[//" -e "s/\\]//" \
-e "s/\ //g" -e "s/([m-tM-T]*)//g" -e "s/@[0-9.]*//" \
-e "s/CPU\|GHz\|Intel\|AMD \|Processor\|Dual-Core//g" \
-e "s/Controller\|Adapter\|Device\|Chipset\|AMD\|NVIDIA\|Mobile//g" \
-e "s/Express\|Integrated\|Graphics//g" -e "s/SVGA II/VMware &/")
DOMAIN=$(dnsdomainname 2> /dev/null)
if [ ! -z ${DOMAIN} ]; then
DOMAIN=.${DOMAIN}
fi
print "${b}<${HOSTNAME}${DOMAIN}>${z}" "${b}dev: ${z}${g}${KIT}${x}" 46
read Z A B C IDLE1 REST < /proc/stat
PASS1=$((A+B+C+IDLE1))
idler_sleep 1
read Z A B C IDLE2 REST < /proc/stat
PASS2=$((A+B+C+IDLE2))
CPU=$((100*( (PASS2-PASS1) - (IDLE2-IDLE1) ) / (PASS2-PASS1) ))
RAM=$(($(grep MemFree /proc/meminfo | awk '{print $2}')/1000))
RAM=${RAM}/$(($(grep MemTotal /proc/meminfo | awk '{print $2}')/1000))
SWP=$(free_swap)/$(($(grep SwapTotal /proc/meminfo | awk '{print $2}')/1000))
DISTRO=$(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/,// -e s/\ $//)
print "${p}[${DISTRO}]${x}" \
"${b}sys:${z} ${g}CPU=${CPU}% RAM=${RAM} SWP=${SWP}${x}" 46
print ${p}\<${USER}\>${x} "${b}net:${z} ${g}$(ip route get 8.8.8.8 \
| awk '{print $5}' | cut -c 1-4) ($(net_address) >> $(\
wget -qO- icanhazip.com))${x}" 46
print "${p}\"${PDLIDLER} ${VERSION}\"${x}" "${b}run:${z}${g} proc{$(\
ps ux | wc -l)}, load{$(uptime | grep -o average.*\
| awk '{print $2,$3,$4}' | sed s/,\ /_/g)}, core{$(nproc)}${x}" 46
print "${p}/helper: @$(pgrep -fn bash\ pdl-idler_helper || echo n/a)/${x}" \
"${b}ver:${z} ${g}tf2=$(app_version 440), srcds=$(app_version 232250\
), wine=${WINE}${x}" 46
t=$(tput cols)
printf "%$((${t}-1))s\n" | tr ' ' -
for X in $(pgrep -fl Xorg\|Xvfb | grep -vi screen | sort -k 2 \
| awk '{print $1}'); do
NUM=$(ps ${X} | grep -o \ :[0-9]* | grep -o [0-9]*)
if xserver_pid :${NUM} > /dev/null; then
STARTED=N
if pgrep -fn "x11vnc.*display :${NUM} " > /dev/null; then
STARTED=V
elif pgrep -f idler-X${NUM} > /dev/null; then
STARTED=Y
fi
XVFB=Xorg-HI_[${DRIVER}]
if ps $(xserver_pid :${NUM}) | grep -q Xvfb; then
XVFB="Xvfb-LO_[$(echo $(glxinfo -display :${NUM} 2> /dev/null \
| grep -om1 LLVM\ [0-9.]* | sed -e s/LLVM\ /llvm-/))]"
if [ ${XVFB} = Xvfb-LO_\[\] ]; then
XVFB=Xvfb-LO_[null]
fi
fi
print "${b}DISPLAY=:${NUM}${z}" "${g}($(process_usage\
$(xserver_pid :${NUM}))%) @$(printf %05d $(xserver_pid :${NUM}\
)) ${l}<${XVFB/_*}>${x} $(\
memory $(xserver_pid :${NUM})) ${STARTED}=${XVFB/*_}" 46
fi
done
for SRCDS in $(pgrep -fl cds_linux.*281 | sort -k 16 | awk '{print $1}'); do
NUM=$(ps ${SRCDS} | grep -o port\ 281[0-9]* | grep -o [0-9]*)
printf "%$((${t}-1))s\n" | tr ' ' -
SERVER_VERSION=$(version $(grep -m 1 pdlv \
"${STF}"/pdl-${HOSTNAME}-281${NUM:(-2)}/console.log | awk '{print $2}'))
print "${b}(server:${NUM})" "srcds:${z} ${g}($(process_usage ${SRCDS}\
)%) ${l}[${SERVER_VERSION}]${x} $(server_memory \
${NUM})${z} Players ${b}{$(server_playercount ${NUM})/$((IDLE_MAX+1))}${z}" 46
print "" "${g}@$(printf %05d ${SRCDS}) ${l}$(item_schema \
"${STF}"/pdl-${HOSTNAME}-${NUM}/console.log)${x} game=$(steam_backend \
"${STF}"/pdl-${HOSTNAME}-${NUM}/console.log)" 39
done
fi
printf "%$((${t}-1))s\n" | tr ' ' -
idler_list ${1} || return 1
if steam_pid > /dev/null; then
LINE="${b}steam:${z} ${g}($(process_usage ${SPID})%) ${l}{lo_mode"
if steam_pid _hi> /dev/null; then
LINE="${LINE:0:(-7)}hi_mode"
fi
XPID=$(auxiliary_pid wineserver)
print "${p}|ws: @$(printf %05d ${XPID}), ($(process_usage ${XPID}))|${x}" \
"${LINE}}${x} $(steam_memory) @$(grep Rate ${CONFIG}/config.vdf \
| grep -o \[0-9]*)kb" 46
if auxiliary_pid explorer.exe > /dev/null; then
XPID="|ex: @$(printf %05d ${XPID}), ($(process_usage ${XPID}))|"
else
XPID="|ex: n/a|"
fi
print "${p}${XPID}${g}" "@$(printf %05d ${SPID}) ${l}/#$(\
sha1sum share/${ACCT}/ssfn | cut -c1-6)/${x} $(steam_auth_server)" 39
if auxiliary_pid services.exe > /dev/null; then
XPID="|sv: @$(printf %05d ${XPID}), ($(process_usage ${XPID}))|"
else
XPID="|sv: n/a|"
fi
print "${p}${XPID}${x}" "${g}\"$(echo $(steam_name))\"${x}" 39
if hl2_pid > /dev/null; then
print "" "--------------------------------------" 39
LINE="${b}hl2:${z} ${g}($(process_usage ${HPID})%) ${l}(normalc"
if hl2_pid noshaderapi > /dev/null; then
LINE="${LINE:0:(-7)}noshade"
fi
print "" "${LINE})${x} $(hl2_memory) game=$(steam_backend ${CON})" 44
print "" "${g}@$(printf %05d ${HPID}) ${l}|$(cat "${TF}"/pdl-${ACCT}/ver \
2> /dev/null || echo none)| ${x}$(item_schema ${CON})" 39
if client_map > /dev/null; then
local MAP=\($(client_map)\)
fi
print "" "${MAP}${p}${CONNECTION/\|/\|${g}}${x}" 39
fi
fi
}
idler_utility()
{
# run shell commands or execute steam urls if steam is running
if [ -d wine-${ACCT} ]; then
UTILITY=regedit
if [ ! -z "${1}" ]; then
UTILITY=${1}
if steam_pid > /dev/null; then
UTILITY=${1//steam\:/wine_run \"'${STEAM}'\"\/steam.exe steam\:}
elif echo ${1} | grep -q steam\:; then
tprint "${ACCT}: error, steam not running"
return 1
fi
fi
tprint "${ACCT}: running utility..."
echo "${UTILITY//^/ }" > wine-${ACCT}/.utility.sh
source wine-${ACCT}/.utility.sh > wine-${ACCT}/.utility.log 2>&1
fi
}
idler_website()
{
# open relevant website in the default browser
if [ -z ${SUID} ]; then
tprint "${ACCT}: error, not installed"
else
if [ "${1/.tf}" = backpack ]; then
SITE=backpack.tf/id/${SUID}
elif [ "${1/.com}" = tf2items ]; then
SITE=tf2items.com/profiles/${SUID}
elif [ "${1/.com}" = willitcraft ]; then
SITE=willitcraft.com/'#!'${SUID}/
elif [[ "${1/.com}" = stm_com* ]]; then
if [[ ${1} = */* ]]; then
SITE=${1#*/}
fi
SITE=steamcommunity.com/profiles/${SUID}/${SITE}
elif [ "${1/.com}" = tf2b ]; then
SITE=tf2b.com/tf2/${SUID}
else
SITE=steamcommunity.com/profiles/${SUID}/inventory/\#753
fi
tprint "${ACCT}: opening website..." $(echo ${SITE} | sed "s/\/.*//")
DISPLAY=:0 xdg-open http://${SITE} 2> /dev/null
if [ ${ACCT} = ${ACCOUNTS_ARRAY[1]%%/*} ]; then
WEBSITE_DELAY=200
fi
let WEBSITE_DELAY+=25
idler_sleep $(echo "scale=4;${WEBSITE_DELAY}/1000" | bc)
fi
}
idler_create()
{
# prompt and/or parse input for account creation then login
if [ ! -z ${SUID} ]; then
tprint "${ACCT}: error, account exists"
elif [[ ${ACCT} = *steam* ]] || [[ ${ACCT} = *valve* ]]; then
tprint "${ACCT}: error, invalid username"
else
CONFIRM=${PASS}
if [ -z ${PASS} ]; then
tprint "${ACCT}: input password:" "" "" 1
read -s PASS
echo
tprint "${ACCT}: confirm password:" "" "" 1
read -s CONFIRM
echo
fi
if [ ${PASS} != "${CONFIRM}" ]; then
tprint "${ACCT}: error, passwords don't match"
else
if [ -z ${EMAIL} ]; then
tprint "${ACCT}: input email:" "" "" 1
read -e EMAIL
fi
if check_account_input; then
idler_login && return 0
fi
fi
fi
return 1
}
idler_offline()
{
# set friend presense to offline
if steam_pid > /dev/null && ! grep -q "\"ateDesired\".*\"0\"" ${LCONFIG}; then
tprint "${ACCT}: signing off of friends..." $(both_memory)
OFFLINE_TIMEOUT=0
while ! grep -q "\"PersonaStateDesired\".*\"0\"" ${LCONFIG}; do
if [ ${OFFLINE_TIMEOUT} = 8 ]; then
OFFLINE_TIMEOUT=0
fi
if [ ${OFFLINE_TIMEOUT} = 0 ]; then
wine_run C:/Steam/steam.exe steam://friends/status/offline
fi
let OFFLINE_TIMEOUT+=1
idler_sleep 1
done
fi
}
idler_online()
{
# set friend presense to online
local ONLINE=1online
if [ "${1}" = 2 ] || echo ${1} | grep -qi busy; then
ONLINE=2busy
elif [ "${1}" = 3 ] || echo ${1} | grep -qi away; then
ONLINE=3away
elif [ "${1}" = 5 ] || echo ${1} | grep -qi trade; then
ONLINE=5trade
elif [ "${1}" = 6 ] || echo ${1} | grep -qi play; then
ONLINE=6play
fi
if steam_pid > /dev/null \
&& ! grep -q "\"PersonaStateDesired\".*\"${ONLINE:0:1}\"" ${LCONFIG}; then
tprint "${ACCT}: changing persona status..." ${ONLINE:1},$(both_memory)
if [ ${ONLINE} != 1online ] && grep -q "\"Desired\".*\"0\"" ${LCONFIG}; then
idler_online > /dev/null
fi
ONLINE_TIMEOUT=0
while ! grep -q "\"PersonaStateDesired\".*\"${ONLINE:0:1}\"" ${LCONFIG}; do
if [ ${ONLINE_TIMEOUT} = 8 ]; then
ONLINE_TIMEOUT=0
fi
if [ ${ONLINE_TIMEOUT} = 0 ]; then
wine_run C:/Steam/steam.exe steam://friends/status/${ONLINE:1}
fi
let ONLINE_TIMEOUT+=1
idler_sleep 1
done
fi
}
idler_enter()
{
# join chatroom and mark persona status or lurk with node if not logged in
prep_chat ${1}
if steam_pid > /dev/null; then
if ! window_id Group\ Chat > /dev/null; then
tprint "${ACCT}: entering chat..." \#${CHAT},$(both_memory)
if grep -q "\"PersonaStateDesired\".*\"0\"" ${LCONFIG}; then
rm -f wine-${ACCT}/.friends.pdl
else
touch wine-${ACCT}/.friends.pdl
fi
ENTER_TIMEOUT=0
while ! window_id Group\ Chat > /dev/null; do
if [ ${ENTER_TIMEOUT} = 8 ]; then
ENTER_TIMEOUT=0
fi
if [ ${ENTER_TIMEOUT} = 0 ]; then
wine_run C:/Steam/steam.exe steam://friends/joinchat/${CHAT}
fi
if window_id Open\ Chat > /dev/null; then
tprint "${ACCT}: error, chat unavailable on limited account"
close_window $(window_id Open\ Chat) no no
return 1
fi
let ENTER_TIMEOUT+=1
idler_sleep 1
done
fi
else
if is_node_login_available; then
prep_node_login yes "${OPTS}" || return 1
prep_node_enter ${CHAT} ", 1"
prep_node_http
OPTS="steam.setPersonaState(Steam.EPersonaState.Snooze);"
OPTS="${OPTS}\nexitBreak('ENTER', 1);"
sed -i -e "s/setTimeout(exit, 4444);/${OPTS}/g" ${NODEJS}
cat << EOF >> ${NODEJS}
steam.on('chatMsg', function(chatid, msg, type, user) {
http_opt.path = '/ISteamUser/GetPlayerSummaries/v0002/'
+ '?key=${APIKEY}&steamids=' + user;
http.get(http_opt, function(response) {
var output = '';
response.on('data', function(chunk) {
output += chunk;
});
response.on('end', function() {
console.error(
JSON.parse(output).response.players[0].personaname + ': ' + msg);
});
});
});
steam.on('chatStateChange', function(change, user, chatid, kicker) {
http_opt.path = '/ISteamUser/GetPlayerSummaries/v0002/'
+ '?key=${APIKEY}&steamids=' + user;
http.get(http_opt, function(response) {
var output = '';
response.on('data', function(chunk) {
output += chunk;
});
response.on('end', function() {
var name = JSON.parse(output).response.players[0].personaname;
if (change == 1) {
console.error(name + ' entered chat.');
} else if (change == 2) {
console.error(name + ' left chat.');
} else if (change == 4) {
console.error(name + ' disconnected.');
} else if (change == 8) {
console.error(name + ' was kicked by ' + kicker + '.');
} else if (change == 10) {
console.error(name + ' was banned by ' + kicker + '.');
}
});
});
});
EOF
run_node_login
elif ! tac ${NODELOG} | grep -q BREAK_ENTER; then
tprint "${ACCT}: error, node login in use"
fi
fi
}
idler_exit()
{
# leave public chatroom then restore prior friends status or end node lurker
if window_id Group\ Chat > /dev/null; then
tprint "${ACCT}: exiting chatroom..." $(both_memory)
close_window $(window_id Group\ Chat)
if [ ! -e wine-${ACCT}/.friends.pdl ]; then
idler_offline
fi
fi
if ! is_node_login_available \
&& tac ${NODELOG} | grep -q BREAK_ENTER; then
stop_node_login
fi
}
is_friend()
{
# check if this account is friends via the community id or uid if using node
OPTS="http://api.steampowered.com/ISteamUser/GetFriendList/v0001/"
OPTS="${OPTS}?key=${APIKEY}&steamid=$(steam_uid ${1})&relationship=friend"
if ! wget -qO- "${OPTS}" | grep -q ${SUID}; then
return 1
fi
}
invite_friend()
{
# send friend invite with steam client or node login
if [ ! -z ${2} ]; then
if [ -d "${PWD}"/wine-${2} ] || steam_uid ${2} > /dev/null; then
set_account ${2}
else
tprint "error, unknown account specified as friend inviter" ${2}
return 1
fi
fi
if steam_pid > /dev/null; then
idler_sleep 8
wine_run C:/Steam/steam.exe steam://friends/add/$(steam_uid ${1})
FRIEND_TIMEOUT=0
while ! window_id Friends\ -\ > /dev/null; do
idler_sleep 1
let FRIEND_TIMEOUT+=1
if [ ${FRIEND_TIMEOUT} = 3 ]; then
break
fi
done
if window_id Friends\ -\ > /dev/null; then
close_window $(window_id Friends\ -) no
fi
else
prep_node_login yes || return 1
OPTS="steam.addFriend('$(steam_uid ${1})');"
OPTS="${OPTS}\nsetTimeout(function() { setTimeout(exit, 4444); }, 2500);"
sed -i -e "s/setTimeout(exit, 4444);/${OPTS}/g" ${NODEJS}
run_node_login > /dev/null
fi
if [ ! -z ${2} ]; then
set_account ${OLD_ACCT}
fi
}
idler_friend()
{
# send/queue invites between initiated accounts or send one to a uid
FRIEND="${ACCOUNTS}"
if [ ! -z ${1} ]; then
FRIEND=$(echo ${1} | tr [:upper:] [:lower:] | sed s/-/\ /g)
for ADD in ${FRIEND}; do
if [[ ${FRIEND} = *\+[0-9]* ]]; then
FRIEND=${FRIEND/${ADD}/${ACCOUNTS_ARRAY[${FRIEND:1}]}}
fi
done
fi
unset QUEUED
for ADD in ${FRIEND}; do
ADD=${ADD%%\/*}
if [[ ${ADD} = 765611* ]]; then
if ! is_friend ${ADD}; then
if is_node_login_available; then
tprint "${ACCT}: node invite to uid..." ${ADD}
invite_friend ${ADD}
elif steam_pid > /dev/null; then
tprint "${ACCT}: invite to uid..." ${ADD}
invite_friend ${ADD}
else
tprint "${ACCT}: error, steam offline and node client in use" \
${ACCT}\>${ADD:6}
fi
fi
else
if [ ${ADD} != ${ACCT} ] && [ -e share/${ADD}/ssfn ] \
&& ! is_friend ${ADD}; then
DATE=$(date +%s)
if ! steam_pid > /dev/null && ! steam_pid "" ${ADD}; then
if is_node_login_available && is_node_login_available ${ADD}; then
tprint "sending/receiving node invite..." ${ACCT}\>\<${ADD}
invite_friend ${ADD}
invite_friend ${ACCT} ${ADD}
else
tprint "${ACCT}: error, node client(s) in use" ${ACCT}\>\<${ADD}
fi
elif steam_pid > /dev/null && steam_pid "" ${ADD}; then
tprint "sending/receiving invite..." ${ACCT}\>\<${ADD}
invite_friend ${ADD}
invite_friend ${ACCT} ${ADD}
elif ! steam_pid "" ${ADD}; then
if is_node_login_available ${ADD}; then
tprint "${ACCT}: response from node invite..." ${ADD}
invite_friend ${ACCT} ${ADD}
invite_friend ${ADD}
else
tprint "${ACCT}: error, node client in use" ${ADD}
fi
else
if is_node_login_available; then
tprint "${ACCT}: node invite with response..." ${ADD}
invite_friend ${ADD}
invite_friend ${ACCT} ${ADD}
else
tprint "${ACCT}: error, node client in use" ${ACCT}
fi
fi
fi
fi
done
}
idler_register()
{
# use steam ui to prompt for a email confirmation request
idler_login || return 1
tprint "${ACCT}: requesting confirmation e-mail..." $(steam_memory)
wine_run C:/Steam/steam.exe steam://settings/account
while ! window_id Settings bitmap\ id > /dev/null; do
idler_sleep 0.5
done
mouse_click ${WID} 250 160
local REGISTER_TIMEOUT=0
while ! window_id Verify\ Email > /dev/null; do
idler_sleep 0.3
let REGISTER_TIMEOUT+=1
if [ ${REGISTER_TIMEOUT} = 20 ]; then
tprint "error, register error/failure"
break
fi
done
if [ ${REGISTER_TIMEOUT} = 20 ]; then
return 1
else
key_press "" Return 3000
key_press "" Escape 500
fi
close_window $(window_id Settings)
}
cache_backpack()
{
# download player item data
unset WGET ATTEMPTS
while [ "${ATTEMPTS}" != 4 ] && [ -z "${WGET}" ]; do
if [ "${1}" != no ]; then
WGET=$(find -L share/${ACCT}/ -maxdepth 1 -name tf2b -mmin -5)
if [ "${1}" = yes ] || [ -z ${WGET} ]; then
download tf2b.com/tf2/txt/${SUID} \
"${PWD}"/share/${ACCT}/tf2b > /dev/null 2>&1
fi
fi
WGET=$(cat share/${ACCT}/tf2b 2> /dev/null)
if [[ "${WGET}" != *Total\ ite* ]] && [[ "${WGET}" != *is\ private* ]] \
&& [[ "${WGET}" != *body\>?\</body* ]]; then
unset WGET
rm -f cat share/${ACCT}/tf2b
let ATTEMPTS+=1
fi
done
echo ${WGET}
}
open_url()
{
# open steam component/url or other page in the client ui then wait/adjust
STEAM_WID=$(window_id Steam)
if [[ ${1} = steam:* ]]; then
wine_run C:/Steam/steam.exe ${1}
else
wine_run C:/Steam/steam.exe steam://open/console
fi
idler_sleep 1
if [[ ${1} != steam:* ]]; then
type_input ${STEAM_WID} "open ${1}" 250 yes
key_press ${STEAM_WID} Return
fi
idler_sleep 4
if [[ ${1} != steam://open* ]]; then
key_press ${STEAM_WID} "Home Left Left Left Left"
fi
}
idler_exhibit()
{
# unlock bp privacy and open up comments
local EXHIBIT=ic
if [ ! -z ${1} ]; then
if [[ ${1} = *i* ]] || [[ ${1} = *c* ]]; then
EXHIBIT=${1//[!ic]/}
else
tprint "${ACCT}: error, invalid exhibit flag" ${1}
fi
fi
local KEYS=Tab
if [[ ${EXHIBIT} = *c* ]]; then
OPTS="http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/"
OPTS="${OPTS}?key=${APIKEY}&steamids=${SUID}"
if [ "$(wget -qO- "${OPTS}" | grep mentpermission | grep -o 1)" != 1 ]; then
KEYS="Down Down ${KEYS}"
else
EXHIBIT=${EXHIBIT//c/}
fi
fi
if [[ ${EXHIBIT} = *i* ]]; then
OPTS="http://api.steampowered.com/IEconItems_440/GetPlayerItems/v0001/"
OPTS="${OPTS}?SteamID=${SUID}&key=${APIKEY}"
if ! wget -qO- "${OPTS}" | grep -q \"status\":\ 1, \
|| cache_backpack | grep -q pack\ is\ private; then
KEYS="${KEYS} Down Down Tab Tab Down"
else
EXHIBIT=${EXHIBIT//i/}
fi
fi
if [[ ${KEYS} = *Down* ]]; then
idler_login || return 1
tprint "${ACCT}: relaxing profile privacy..." flag=${EXHIBIT}
while [ 1 ]; do
open_url steam://url/SteamIDEditSettingsPage
key_press ${STEAM_WID} "Tab Tab Tab Tab Down Down Tab ${KEYS} Return"
idler_sleep 2
if ! window_id Valve > /dev/null && ! window_id Agreemen > /dev/null; then
break
fi
done
fi
}
check_badge_task()
{
# download and/or check community badge task completion
if [ -z ${1} ]; then
unset TASKS
fi
if [ -z ${1} ] || [[ "${TASKS}" = *${1}* ]]; then
if [[ "${TASKS}" = *${1}* ]]; then
idler_sleep 3
fi
download http://steamcommunity.com/profiles/${SUID}/badges/2 \
share/${ACCT}/badges || exit 1
fi
if [ ! -z ${1} ] && [ -z ${2} ] \
&& ! grep -q ${1}_on share/${ACCT}/badges; then
TASKS=${TASKS},${1}
return 1
fi
}
check_obtainable_badge_tasks()
{
# check for an obtainable badge task
if cat share/${ACCT}/badges | grep -v Facebook | grep -v OnMarket \
| grep -v InOverlay | grep -v PostVideo | grep -v Trade \
| grep -v CraftGameBadge | grep -v ${ICON_TASK} | grep -q _off.png; then
return 1
fi
return 0
}
random_word()
{
# generate random dictionary word
local WORD
while (( ${#WORD} < 6 )); do
WORD=$(cat -n /usr/share/dict/words | grep -w $(shuf -i 1-$(\
cat /usr/share/dict/words | wc -l) -n 1) | cut -f2)
done
echo ${WORD}
}
idler_socialize()
{
# check for sale event or obtainable badge objective
if (($(date +%s) < 1434931200)); then
SALE=yes
fi
unset INCOMPLETE BADGE_INIT TASKS
if [ -e share/${ACCT}/badges ] \
&& ! grep -q "</body>" share/${ACCT}/badges 2> /dev/null; then
rm -f share/${ACCT}/badges
local BODY=X
fi
if [ ! -e share/${ACCT}/badges ]; then
BADGE_INIT=yes
check_badge_task
fi
ICON_TASK=UseEmoticonInChat
if ! check_badge_task UseEmoticonInChat no; then
ICON=http://steamcommunity.com/profiles/${SUID}/inventory/json/753/6
ICON=$(wget -q ${ICON} -O- \
| grep -oi -m1 \"name\":\":[[:graph:]]*:\",\"market_hash)
if [ ! -z ${ICON} ]; then
ICON_TASK=NoEmoticonInChat
fi
fi
if ! check_obtainable_badge_tasks && [ -z ${BADGE_INIT} ]; then
check_badge_task
fi
TOTAL=$((26-$(grep _off share/${ACCT}/badges | wc -l)))
# login, go online, initialize, resize window, then remove search/email
if [ ! -z ${SALE} ] || ! check_obtainable_badge_tasks; then
idler_login || return 1
idler_online
open_url steam://url/SteamIDEditPage
xdotool windowsize --sync ${STEAM_WID} 900 600
idler_sleep 1
mouse_click ${STEAM_WID} 865 110 2
mouse_click ${STEAM_WID} 850 125 2
fi
# start tf2 fake if needed and if node is installed
if ! check_obtainable_badge_tasks; then
tprint "${ACCT}: completing objectives... ${BODY}" "" "" 1
if ! check_badge_task PlayGame; then
printf p
idler_stop
idler_fake
run_node_login > /dev/null
local FAKED=yes
fi
# set profile attributes
while ! check_badge_task SetupCommunityRealName; do
printf n
key_press ${STEAM_WID} "Tab Tab Tab Tab Tab"
type_input ${STEAM_WID} $(random_word)
key_press ${STEAM_WID} "Shift+Tab Shift+Tab Shift+Tab Shift+Tab Shift+Tab Shift+Tab \
Shift+Tab Shift+Tab Shift+Tab Shift+Tab Shift+Tab Shift+Tab Return"
done
# post a status notice then rate it positively
while ! check_badge_task PostStatusToFriends \
|| ! check_badge_task RateUpContentInActivityFeed; do
printf v
open_url steam://url/SteamIDControlPage
mouse_click ${STEAM_WID} 200 200 2 1 300 "key Home"
type_input ${STEAM_WID} $(random_word)\ $(random_word)
mouse_click ${STEAM_WID} 625 235 2
idler_sleep 3
key_press ${STEAM_WID} "Tab Tab Tab Tab Return"
idler_sleep 5
mouse_click ${STEAM_WID} 50 315 2
done
# join a group
while ! check_badge_task JoinGroup; do
printf g
open_url steam://url/GroupSteamIdPage/103582791435720285
key_press ${STEAM_WID} "Tab Return"
done
# if able, provide a friends-only recommendation for tf2
if ! check_badge_task RecommendGame; then
if idler_enter 103582791435720285 > /dev/null; then
idler_exit > /dev/null
printf r
while ! check_badge_task RecommendGame; do
open_url steam://url/RecommendGame/440
mouse_click ${STEAM_WID} 250 400 2
type_input ${STEAM_WID} $(random_word)\ $(random_word)
key_press ${STEAM_WID} \
"Tab Tab Return Down Down Return Tab Tab Return Tab Tab Return"
done
else
printf R
INCOMPLETE=${INCOMPLETE}R
fi
fi
# add application to the wishlist
while ! check_badge_task AddItemToWishlist; do
printf i
open_url steam://url/StoreRecommendationsPage
key_press ${STEAM_WID} "Tab Tab Tab Tab Tab Tab Tab Tab Tab Return"
done
# send and recieve a friend request
if ! check_badge_task AddFriendToFriendsList; then
if [ ! -z ${1} ]; then
printf f
idler_friend ${1} > /dev/null
elif [[ ${INCOMPLETE} != *R* ]]; then
printf f
unset SOCIALIZE_TIMEOUT
BOTSTF=(76561198100287118 76561198100255457 76561198100313270)
while ! window_id Bots.tf > /dev/null; do
wine_run C:/Steam/steam.exe \
steam://friends/add/${BOTSTF[$(shuf -i 0-2 -n 1)]}
let SOCIALIZE_TIMEOUT+=1
if [ ${SOCIALIZE_TIMEOUT} = 3 ]; then
printf X
INCOMPLETE=${INCOMPLETE}F
break
fi
done
close_window $(window_id Bots.tf)
if window_id Friends\ -\ ; then
close_window $(window_id Friends\ -)
fi
else
printf F
INCOMPLETE=${INCOMPLETE}F
fi
fi
# post a comment on own profile page
while ! check_badge_task PostCommentOnFriendsPage; do
printf c
open_url steam://url/SteamIDPage/${SUID}
key_press ${STEAM_WID} Ctrl+F
type_input ${STEAM_WID} "dd a comm"
mouse_click ${STEAM_WID} 100 200
key_press ${STEAM_WID} End
mouse_click ${STEAM_WID} 850 128 3 1 300
mouse_click ${STEAM_WID} 100 200
key_press ${STEAM_WID} Ctrl+F
type_input ${STEAM_WID} "dd a comm"
mouse_click ${STEAM_WID} 200 315 2 1 300
type_input ${STEAM_WID} $(random_word)\ $(random_word)
mouse_click ${STEAM_WID} 600 350
done
# upload a screenshot then comment on it
if ! check_badge_task PostScreenshot; then
printf s
open_url steam://open/screenshots
mouse_click $(window_id Uploader) 50 100 1
mouse_click ${WID} 660 385 2
SOCIALIZE_TIMEOUT=0
while ! window_id Uploading > /dev/null; do
if [ ${SOCIALIZE_TIMEOUT} = 3 ]; then
SOCIALIZE_TIMEOUT=0
fi
if [ ${SOCIALIZE_TIMEOUT} = 0 ]; then
mouse_click ${WID} 455 385
mouse_click ${WID} 555 385
fi
let SOCIALIZE_TIMEOUT+=1
idler_sleep 1
done
while window_id Uploading > /dev/null; do
idler_sleep 1
done
close_window $(window_id Uploader)
fi
if ! check_badge_task PostCommentOnFriendsScreenshot; then
if [[ ${INCOMPLETE} != *R* ]]; then
printf z
while ! check_badge_task PostCommentOnFriendsScreenshot; do
open_url steam://url/CommunityScreenshots
mouse_click ${STEAM_WID} 200 400
idler_sleep 6
key_press ${STEAM_WID} "Tab Tab Tab Tab Tab Tab"
type_input ${STEAM_WID} $(random_word)
key_press ${STEAM_WID} Tab
mouse_click ${STEAM_WID} 775 330
idler_sleep 3
if window_id Formatting > /dev/null; then
printf \*
close_window $(window_id Formatting)
mouse_click ${STEAM_WID} 1015 400 1
idler_sleep 3
fi
done
else
printf Z
INCOMPLETE=${INCOMPLETE}Z
fi
fi
# if an emoticon is possessed, use it in a chatroom
if [ ! -z ${ICON} ]; then
while ! check_badge_task UseEmoticonInChat; do
printf e
idler_enter > /dev/null
mouse_click $(window_id Group\ Chat) 100 300
type_input ${STEAM_WID} $(echo ${ICON:8} | sed "s/\",.*//")
key_press ${STEAM_WID} Return
idler_exit
done
fi
# post in a recent discussion thread on tf2
if ! check_badge_task PostInDiscussions; then
if [[ ${INCOMPLETE} != *R* ]]; then
printf d
unset SOCIALIZE_TIMEOUT
while ! check_badge_task PostInDiscussions; do
open_url steam://url/GameHubDiscussions/440
key_press ${STEAM_WID} Page_Down
mouse_click ${STEAM_WID} 100 $(shuf -i 150-500 -n 1)
idler_sleep 5
key_press ${STEAM_WID} End
key_press ${STEAM_WID} Ctrl+F
type_input ${STEAM_WID} "type you"
key_press ${STEAM_WID} Escape
mouse_click ${STEAM_WID} 150 325
type_input ${STEAM_WID} $(random_word)\ $(random_word)\ $(random_word)
mouse_click ${STEAM_WID} 550 400
idler_sleep 3
key_press ${STEAM_WID} "End Page_Up"
mouse_click ${STEAM_WID} 500 435
mouse_click ${STEAM_WID} 600 435
idler_sleep 1
mouse_click ${STEAM_WID} 250 380
let SOCIALIZE_TIMEOUT+=1
if [ ${SOCIALIZE_TIMEOUT} = 5 ]; then
printf X
INCOMPLETE=${INCOMPLETE}D
break
fi
done
else
printf D
INCOMPLETE=${INCOMPLETE}D
fi
fi
# rate up a recent piece of tf2 workshop content
X=(100 300 500)
Y=(200 500)
if ! check_badge_task RateWorkshopItem; then
if [[ ${INCOMPLETE} != *R* ]]; then
printf w
while ! check_badge_task RateWorkshopItem; do
open_url steam://url/SteamWorkshopPage/440
key_press ${STEAM_WID} Page_Down
mouse_click ${STEAM_WID} ${X[$(shuf -i 0-2 -n 1)]} \
${Y[$(shuf -i 0-1 -n 1)]}
idler_sleep 4
key_press ${STEAM_WID} Ctrl+F
type_input ${STEAM_WID} "Add to coll"
key_press ${STEAM_WID} Escape
mouse_click ${STEAM_WID} 500 420
key_press ${STEAM_WID} Left Left Left Left Left Left
mouse_click ${STEAM_WID} 50 420
done
else
printf W
INCOMPLETE=${INCOMPLETE}W
fi
fi
# subscribe to a capable workshop item
if ! check_badge_task SubscribeToWorkshopItem; then
printf h
WORKSHOP=(272283552 280373247 291105804 294781969)
while ! check_badge_task SubscribeToWorkshopItem; do
open_url steam://url/CommunityFilePage/${WORKSHOP[$(shuf -i 0-3 -n 1)]}
key_press ${STEAM_WID} Ctrl+F
type_input ${STEAM_WID} "Subscribe to"
key_press ${STEAM_WID} Escape
mouse_click ${STEAM_WID} 555 315 2
idler_sleep 3
done
fi
# vote on a greenlight title
if ! check_badge_task VoteOnGreenlight; then
if [[ ${INCOMPLETE} != *R* ]]; then
printf l
while ! check_badge_task VoteOnGreenlight; do
open_url steam://url/CommunityFilePage/262075165
key_press ${STEAM_WID} "Page_Down Page_Down"
mouse_click ${STEAM_WID} 50 225
done
else
printf L
INCOMPLETE=${INCOMPLETE}L
fi
fi
# show uncompletable objectives
wine_run C:/Steam/steam.exe steam://url/SteamIDBadgePage
printf =\(${TOTAL}\>$((26-$(grep _off share/${ACCT}/badges | wc -l)))\)
echo
if [ ! -z ${INCOMPLETE} ]; then
local DELETE=yes
fi
for TASK in EUseEmoticonInChat BCraftGameBadge TTrade AFacebook OInOverlay \
MOnMarket YPostVideo; do
if ! check_badge_task ${TASK:1}; then
INCOMPLETE=${INCOMPLETE}${TASK:0:1}
fi
done
if [ ! -z ${INCOMPLETE} ]; then
tprint "${ACCT}: incompletable objectives remain" ${INCOMPLETE}_\($((\
26-$(grep _off share/${ACCT}/badges | wc -l)))\)
fi
if [ ! -z ${DELETE} ]; then
rm share/${ACCT}/badges
fi
fi
# reset window size and finish
xdotool windowsize --sync ${STEAM_WID} 1153 677
if [ ! -z ${FAKED} ]; then
idler_stop
fi
}
idler_discover()
{
# login and/or click through store discovery queue
DISCOVER_CYCLES=42
if [ ! -z ${1} ]; then
DISCOVER_CYCLES=${1}
fi
idler_login || return 1
# open first app page, resize window, and attempt to turn off auto play
tprint "${ACCT}: started discovery queue"
open_url steam://url/StoreExploreStart
xdotool windowsize --sync ${STEAM_WID} 1024 743
xdotool windowmove --sync ${STEAM_WID} 0 25
mouse_click ${STEAM_WID} 180 570 2
# scroll to top, then on every even cycle, select age
for CYCLE in $(seq 1 ${DISCOVER_CYCLES}); do
key_press ${STEAM_WID} Home
if [ $((CYCLE%2)) = 0 ]; then
mouse_click ${STEAM_WID} 545 555
key_press ${STEAM_WID} 1
mouse_click ${STEAM_WID} 600 555 2
fi
# click on create queue location, then on review/store back
mouse_click ${STEAM_WID} 490 593
mouse_click ${STEAM_WID} 925 155
mouse_click ${STEAM_WID} 725 380
# scroll down once, then click on next button
xdotool click 5
idler_sleep 1
mouse_click ${STEAM_WID} 900 679
# on every odd cycle, scroll to the end and click on nsfw/review location
if [ $((CYCLE%2)) = 1 ]; then
key_press ${STEAM_WID} End 1000
mouse_click ${STEAM_WID} 450 225
fi
# abort account if window is closed
if [ $(echo $((16#${STEAM_WID:2}))) != $(xdotool getwindowfocus) ]; then
tprint "${ACCT}: warning, lost window, skipping account"
break
fi
done
tprint "${ACCT}: finished discovery queue"
}
check_offer_input()
{
# prompt for and/or process item transfer offer input string
unset TRADE_LOCAL
if [ -z ${RECEIVER} ]; then
OFFER=${1}
if [ ! -z ${OFFER} ] && [[ ${OFFER} != *@* ]]; then
OFFER=${OFFER}@
fi
while [ -z ${RECEIVER} ]; do
if [[ ${OFFER} = +[0-9]* ]]; then
OFFER=${OFFER/${OFFER%%@*}/${ACCOUNTS_ARRAY[${OFFER%%@*}]%%/*}}
fi
if [ -z ${OFFER} ] || [[ ${OFFER} = @* ]]; then
tprint "input receiver account/uid: " "" "" 1
read -e OPTS
OFFER=${OPTS//@}${OFFER}
else
RECEIVER=${OFFER%@*}
fi
done
if [ ${RECEIVER} = ${ACCT} ]; then
tprint "${ACCT}: error, receiver specified as trader"
return 1
elif [[ ${RECEIVER} != 765611* ]] && ! steam_uid ${RECEIVER%/*} > /dev/null; then
tprint "error, invalid receiver uid/account" ${RECEIVER}
return 2
else
if steam_pid "" ${RECEIVER} > /dev/null \
&& ! grep -q "\"PersonaStateDesired\".*\"0\"" \
share/${RECEIVER}/userdata/*/config/localconfig.vdf; then
TRADE_LOCAL=yes
RECEIVER=$(steam_uid ${RECEIVER})
fi
OFFER=${OFFER##*@}
unset NOSC NOSG
if [[ ${OFFER} = *nosc* ]]; then
OFFER=${OFFER/nosc}
NOSC=yes
fi
if [[ ${OFFER} = *nosg* ]]; then
OFFER=${OFFER/nosg}
NOSG=yes
fi
if [ -z ${OFFER} ]; then
OFFER=_all_-crates
elif [ ${OFFER:0:1} != _ ]; then
OFFER=_${OFFER}
fi
OFFER=${OFFER//-crates/-${CRATES//,/_-}}
OFFER=${OFFER//crates/${CRATES//,/_}}
if [[ ${OFFER} = *all* ]]; then
OFFER="'"$(echo ${OFFER} | sed -e "s/all//" -e "s/_[0-9][0-9]*//g" \
-e "s/_-/,/g" -e "s/^[_,]*//" -e "s/,/','/g")"'"
OFFER="return ([${OFFER}].indexOf(item.app_data.def_index) == -1)"
else
OFFER="'"$(echo ${OFFER} | sed -e "s/_-[0-9][0-9]*//g" \
-e "s/_/,/g" -e "s/^[_,]*//" -e "s/,/','/g")"'"
OFFER="return ([${OFFER}].indexOf(item.app_data.def_index) != -1)"
fi
OFFER="${OFFER} \&\& item.tradable;"
fi
fi
}
prep_node_trade()
{
# wait for trade web cookies/session id and common trade conditions
install_node_module git://github.com/seishun/node-steam-trade.git 0.2.4
if ! grep -q var\ SteamTrade ${NODEJS}; then
OPTS=$(cat << EOF
setExitTimeout(30000, 'session', 'RETRY');
tprint('session... ', 1);
EOF
)
sed -i -e "s/setTimeout(exit, 4444);/${OPTS//$'\n'/\\$'\n'}/" ${NODEJS}
cat << EOF >> ${NODEJS}
var SteamTrade = require('${PWD}/steamnode/node_modules/steam-trade'),
steam_trade = new SteamTrade(), truncated;
function webLogOn() {
steam.webLogOn(function(cookies) {
cookies.forEach(function(cookie) {
steam_trade.setCookie(cookie);
});
${1}
clearTimeout(exit_timeout);
setTimeout(exit, 4444);
});
}
steam.on('webSessionID', function(sessionID) {
tprint('web... ', 1);
steam_trade.sessionID = sessionID;
webLogOn();
});
steam.on('sessionStart', function(user) {
steam_trade.open(user, function() {
// SESSIONSTART
});
});
steam_trade.on('ready', function() {
clearTimeout(exit_timeout);
steam_trade.ready(function() {
steam_trade.confirm();
});
});
steam_trade.on('error', function(e) {
tprint('error, refreshing web login... {!}');
webLogOn();
});
EOF
fi
}
idler_trade()
{
# logout and/or start node receiver session
check_offer_input ${1} || return $?
if [[ ${RECEIVER} = 765611* ]]; then
OPTS="http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/"
OPTS="${OPTS}?key=${APIKEY}&steamids=${RECEIVER}"
if [ -z ${TRADE_LOCAL} ] \
&& wget -qO- "${OPTS}" | grep personastate\" | grep -qo 0; then
tprint "${ACCT}: error, uid receiver offline" \<${RECEIVER:6}
return 2
elif ! is_friend ${RECEIVER}; then
tprint "${ACCT}: error, uid receiver unfriendly" \<${RECEIVER:6}
return 1
fi
tprint "warning, contacting ui client receiver" ${RECEIVER}
else
if is_node_login_available ${RECEIVER%/*} \
|| [ "$(node_login_background ${RECEIVER%/*})" = FAKE ]; then
if ! set_account ${RECEIVER}; then
EXIT=yes
else
RECEIVER=${ACCT}
OPTS=$(cat << EOF
if (!receiver_stop && log.indexOf('STOP_RECEIVER') > -1) {
stop_receiver();
}
EOF
)
if ! prep_node_login yes "${OPTS}"; then
EXIT=yes
else
prep_node_http
OPTS="if (trades.length) {\n steam_trade.open(trades[0]);\n}"
prep_node_trade "$(echo -e ${OPTS})"
sed -i -e "s/\/\/ SESSIONSTART/trade_count = 0;/" ${NODEJS}
prep_node_enter ${CHATROOM}
OPTS="steam.setPersonaState(Steam.EPersonaState.LookingToTrade);"
OPTS="${OPTS}\nexitBreak('RECEIVER');"
sed -i -e "s/setTimeout(exit, 4444);/${OPTS}/g" ${NODEJS}
unset OPTS
for SENDER in ${ACCOUNTS} ; do
if steam_uid ${SENDER%%/*} > /dev/null; then
OPTS=${OPTS},\'$(steam_uid ${SENDER%%/*})\'
fi
done
cat << EOF >> ${NODEJS}
var trade_count = 0, trades = [];
function trade() {
setTimeout(function() {
steam.trade(trades[0]);
}, 250);
}
steam.on('chatStateChange', function(change, user, chat, kicker) {
if (change == 1 && [${OPTS:1}].indexOf(user) > -1) {
if (trades.length) {
tprint('queued uid ' + user + ' for receiving');
}
trades.push(user);
if (trades.length == 1) {
trade();
}
} else if ((change == 2 || change == 4)
&& trades.indexOf(user) > -1) {
if (trades.indexOf(user) != 0) {
tprint('warning, removed uid ' + user
+ ' from receiver queue {*}');
}
if (user == ${OPTS##*,}) {
stop_receiver();
}
trades.splice(trades.indexOf(user));
}
});
steam.on('friendMsg', function(user, msg, entry) {
if (user == trades[0] && msg == 'retry') {
trade();
}
});
steam_trade.on('chatMsg', function(msg) {
if (trade_count == 0) {
trade_count = Math.round(msg);
if (trade_count == 256) {
truncated = 1;
}
}
});
steam_trade.on('offerChanged', function(action, item) {
if (action) {
if (trade_count == 1) {
http_opt.path = '/IEconItems_440/GetPlayerItems/v0001/?SteamID='
+ steam.steamID + '&key=${APIKEY}';
http.get(http_opt, function(response) {
var output = '';
response.on('data', function(chunk) {
output += chunk;
});
response.on('end', function() {
var result = JSON.parse(output).result;
if (steam_trade.themAssets.length + result.items.length
> result.num_backpack_slots) {
tprint('error, receiver backpack full {!}');
steam_trade.chatMsg('full');
} else {
tprint('confirming offer...');
steam_trade.chatMsg('ready');
}
});
});
}
trade_count--;
} else {
tprint('error, item ' + item.name + ' removed {!}');
}
});
var receiver_stop;
function stop_receiver() {
if (!receiver_stop) {
receiver_stop = 1;
setTimeout(function() {
steam.leaveChat('${CHATROOM}');
setTimeout(exit, 4444);
}, 1000);
}
}
steam.on('tradeResult', function(tradeid, result, user) {
if (result != Steam.EEconTradeResponse.Accepted) {
if (result == 22) {
tprint('error, target account cannot trade {!}');
} else {
tprint('error, trade failure code ' + result + ' {!}');
}
if (trades[0] == ${OPTS##*,}) {
stop_receiver();
}
}
});
steam_trade.on('end', function(status) {
if (status != 'complete' && status != 'cancelled'
&& status !== undefined) {
steam.sendMessage(trades[0], status);
} else {
if (truncated) {
truncated = 0;
trade();
} else {
if (trades[0] == ${OPTS##*,}) {
stop_receiver();
} else {
trade_count = 0;
trades.splice(0);
if (trades.length) {
trade();
}
}
}
}
});
EOF
if ! run_node_login; then
EXIT=yes
fi
fi
fi
set_account ${OLD_ACCT}
if [ ! -z ${EXIT} ]; then
return 1
fi
elif [ "$(node_login_background ${RECEIVER%/*})" != RECEIVER ]; then
tprint "error, receiver node login in use" ${RECEIVER}
return 2
fi
fi
# send items via trading session
if [[ ${RECEIVER} != 765611* ]] && [ -z ${SUID} ]; then
tprint "${ACCT}: error, no uid stored for sender"
else
check_item_safety || return 1
prep_node_login || return 1
prep_node_trade
if [[ ${RECEIVER} = 765611* ]]; then
OPTS="tprint('contacting friend...');"
OPTS="${OPTS}\nsteam.setPersonaState(Steam.EPersonaState.LookingToPlay);"
OPTS="${OPTS}\nsteam.trade('${RECEIVER}');"
else
prep_node_enter ${CHATROOM}
OPTS="steam.setPersonaState(Steam.EPersonaState.LookingToPlay);"
OPTS="${OPTS}\nsetExitTimeout(32000, 'sender');"
fi
sed -i -e "s/setTimeout(exit, 4444);/${OPTS}/g" ${NODEJS}
OPTS=$(cat << EOF
if (!truncated) {
tprint('loading inventories...');
}
truncated = 0;
var inventories = [[],[],[]], totals = [];
steam_trade.loadInventory(440, 2, function(inventory) {
totals[1] = inventory.length;
inventories[1] = inventory.filter(function(item) {
${OFFER}
});
steam_trade.loadInventory(753, 1, function(inventory) {
if ('${NOSG}' != 'yes') {
totals[2] = inventory.length;
inventories[2] = inventory.filter(function(item) {
return item.tradable;
});
}
steam_trade.loadInventory(753, 6, function(inventory) {
if ('${NOSC}' != 'yes') {
totals[2] += inventory.length;
inventories[2] = inventories[2].concat(
inventory.filter(function(item) {
return item.tradable;
})
);
}
inventories[0] = inventories[2].concat(inventories[1]);
if (inventories[0].length) {
if (inventories[0].length > 256) {
tprint('warning, truncating oversized offer... {*}');
truncated = 1;
inventories[0] = inventories[0].slice(0, 256);
inventories[1] = inventories[1].slice(0, 256);
inventories[2] = inventories[2].slice(0,
256-inventories[1].length);
}
setExitTimeout(80000, 'adding', 'RETRY');
if (inventories[2].length) {
tprint('adding ' + inventories[1].length + '\/' + totals[1]
+ ' + ' + inventories[2].length + '\/' + totals[2]
+ ' items...');
} else {
tprint('adding ' + inventories[1].length + '\/' + totals[1]
+ ' items...');
}
steam_trade.chatMsg(inventories[0].length, function() {
inventories[0].forEach(function(item) {
steam_trade.addItem(item);
});
});
} else {
tprint('no items to trade');
steam_trade.cancel(function() {
steam.leaveChat('${CHATROOM}');
setTimeout(exit, 4444);
});
}
});
});
});
EOF
)
sed -i -e "s/\/\/ SESSIONSTART/${OPTS//$'\n'/\\$'\n'}/g" ${NODEJS}
cat << EOF >> ${NODEJS}
steam.on('friendMsg', function(user, msg, entry) {
if (user == $(steam_uid ${RECEIVER})) {
tprint('error, trade error, ' + msg + ' {!}');
steam.sendMessage(user, 'retry');
}
});
steam_trade.on('chatMsg', function(msg) {
if (msg == 'ready') {
tprint('accepting trade...');
steam_trade.ready();
} else if (msg == 'full') {
steam_trade.cancel(function() {
console.error('FAIL');
steam.leaveChat('${CHATROOM}');
setTimeout(exit, 4444);
});
}
});
steam.on('tradeProposed', function(tradeid, user) {
if (user == $(steam_uid ${RECEIVER})) {
clearTimeout(exit_timeout);
steam.respondToTrade(tradeid, true);
} else {
tprint('error, trade declined from unknown user {!}');
steam.respondToTrade(tradeid, false);
}
});
steam.on('tradeResult', function(tradeid, result, user) {
if (result != Steam.EEconTradeResponse.Accepted) {
if (result == Steam.EEconTradeResponse.Declined) {
tprint('error, trade declined {!}');
} else if (result != Steam.EEconTradeResponse.Accepted) {
tprint('error, trade failure code ' + result + ' {!}');
}
console.error('FAILCONTINUE');
steam.leaveChat('${CHATROOM}');
setTimeout(exit, 4444);
}
});
steam_trade.on('end', function(status) {
if (status === undefined) {
tprint('warning, trade confirmation required {*}');
steam.leaveChat('${CHATROOM}');
setTimeout(exit, 4444);
} else if (status == 'complete' && !truncated) {
steam.leaveChat('${CHATROOM}');
setTimeout(exit, 4444);
}
});
EOF
fi
}
idler_harvest()
{
# craft, waste, trade, then sort in one node login
check_offer_input ${1} || return $?
prep_node_login yes || return 1
unset HARVEST_BREAK
if [ ! -z ${BREAK} ]; then
HARVEST_BREAK=${BREAK}
fi
prep_node_trade
if [[ ${1} = *:* ]] || [[ ${1} = *.* ]]; then
idler_craft ${1%%[.:]*}
else
idler_craft
fi
if [[ ${1} = *:* ]]; then
idler_waste $(echo ${1} | sed -e s/\\..*// -e s/.*://)
else
idler_waste
fi
idler_trade ${1##*.} || return $?
idler_sort
if [ ! -z ${HARVEST_BREAK} ]; then
BREAK=${HARVEST_BREAK}
fi
}
idler_rename()
{
# generate and/or assign a profile name
prep_node_login || return 1
NAME="~word-~INT_~WORD~INDEX"
if [ ! -z ${1} ]; then
NAME="${1//^/ }"
fi
while [[ ${NAME} = *~word* ]]; do
NAME=${NAME/~word/$(random_word)}
done
while [[ ${NAME} = *~WORD* ]]; do
NAME=${NAME/~WORD/$(random_word | tr [:lower:] [:upper:])}
done
NAME=${NAME//\'/}
NAME=$(echo ${NAME} | sed -e s/steam/pdl/g -e s/STEAM/pdl/g -e s/valve/pdl/g \
-e s/VALVE/pdl/g)
while [[ ${NAME} = *~INT* ]]; do
NAME=${NAME/~INT/${RANDOM:(-1)}}
done
unset INDEX FOUND
for RENAME in ${ACCOUNTS_ARRAY}; do
let INDEX+=1
if [ ${RENAME} = ${ACCT} ]; then
FOUND=${INDEX}
break
fi
done
if [ ! -z ${FOUND} ]; then
NAME=${NAME//~INDEX/+${FOUND}}
else
NAME=${NAME//~INDEX/}
fi
NAME=${NAME//~ACCT/${ACCT}}
OPTS="steam.setPersonaState(Steam.EPersonaState.Online);"
sed -i -e "s/setTimeout(exit, 4444);/${OPTS}/" ${NODEJS}
cat << EOF >> ${NODEJS}
var rename;
steam.on('user', function(user) {
if (user.friendid == steam.steamID) {
if (!rename) {
if (user.playerName == '${NAME}') {
rename = 2;
tprint('error, cannot apply the same name {!}', 2);
setTimeout(exit, 4444);
} else {
rename = 1;
tprint('renaming to "${NAME}"...', 2);
steam.setPersonaName('${NAME}');
}
} else if (rename == 1) {
rename = 2;
setTimeout(exit, 4444);
}
}
});
EOF
}
# check script name/user/directory, source, check apikey, then trap
if [[ ${PDLIDLER} != pdl-idler* ]]; then
tprint "fatal, renamed scripts must start with pdl-idler*" ${PDLIDLER}
exit 1
elif [ ${USER} = root ]; then
tprint "fatal: cannot be run as root"
exit 1
elif [ -d share ] && [ ! -w share/ ] || [ ! -w . ]; then
tprint "fatal, pwd or share directory is unwriteable" $(pwd)
exit 1
fi
unset APIKEY
source ./pdl-idler_common.sh
if [ -z ${APIKEY} ]; then
tprint "${ACCT}: fatal, apikey not specified"
exit 1
fi
trap sigint SIGINT
# enforce dependencies, and check wine version
for DEP in git glxinfo ip nc npm screen wget xdotool xwininfo xprop Xvfb; do
if ! which ${DEP} > /dev/null 2>&1; then
tprint "fatal, missing dependency '${DEP}'"
exit 1
fi
done
if [[ ${WINE} != 1.[8-9]* ]]; then
tprint "fatal, wine is not installed or is too old" wine\<1.8
exit 1
fi
# check for script updates
mkdir -p share/.gist
if [ -z ${UPGRADE} ] && [ ${PDLIDLER} = pdl-idler.sh ]; then
if [ -z $(find share/.gist/ -maxdepth 1 -name pdl-idler.sh -mmin -1440) ] \
|| [ "${GIST_FORCE}" = yes ]; then
tprint "checking for gist update..." http://gist.github.com
if download gist.github.com/primarydataloop/1432762/download .gist.zip; then
unzip -od share/.gist .gist.zip > /dev/null
mv -f share/.gist/1432762-*/* share/.gist
NEW=$(grep -om1 \(.* share/.gist/pdl-idler.sh | grep -o "[0-9]*\.[0-9]*")
if (( 1${VERSION//./} < 1${NEW//./} )); then
cat share/.gist/CHANGELOG | tail -n+3 \
| sed -e "/\[version ${VERSION}\]/q" | head -n-1
tprint "enter y to logout and upgrade script" "${VERSION}>${NEW}:" "" 1
read -e -t 60 INPUT || echo
if [ "${INPUT}" != y ]; then
tprint "warning, update skipped" "${VERSION}>${NEW}"
else
UPGRADE=yes bash ${PDLIDLER} logout
cp share/.gist/* .
tprint "upgraded pdl-idler" "${VERSION}>${NEW}"
exec bash pdl-idler.sh $*
fi
fi
fi
touch share/.gist/pdl-idler.sh
fi
fi
rm -rf .gist.zip share/.gist/1432762-master
# select target accounts
INPUT="$* "
INPUT="${INPUT#* }"
for STRING in $(echo ${INPUT} | tr ' ' '\n' \
| grep [-]*[+:][0-9][0-9]*\\.*.*[0-9][0-9]*); do
unset MINUS
if [ ${STRING:0:1} = - ]; then
MINUS=-
STRING=${STRING:1}
fi
TYPE=${STRING:0:1}
RANGE=${STRING//[+:]}
unset NUM
if ((${RANGE%%.*} > ${RANGE##*.})); then
tprint "error, invalid account range specified" ${RANGE}
exit 1
else
COUNT=${RANGE%%.*}
while ((COUNT <= ${RANGE##*.})); do
NUM=${NUM}${MINUS}${TYPE}${COUNT}\
let COUNT+=1
done
fi
INPUT=${INPUT/${MINUS}${STRING}/${NUM}}
done
if [ ! -z "${ACCOUNTS}" ]; then
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
if [ -z "${ACCTS}" ]; then
tprint "error, invalid group index specified" \#${BLOCK:1}
exit 1
fi
INPUT=${INPUT/${MINUS}${BLOCK}/${ACCTS}}
done
else
for ACCT in wine-*; do
if [ -d ${ACCT} ]; then
ACCOUNTS="${ACCOUNTS} ${ACCT/wine-/} "
fi
done
for ACCT in share/*; do
if [ -e ${ACCT}/ssfn ]; then
if [[ ${ACCOUNTS} != *${ACCT:11}\ * ]]; then
ACCOUNTS="${ACCOUNTS} ${ACCT:11} "
fi
fi
done
fi
ACCOUNTS_ARRAY=(null ${ACCOUNTS})
for INDEX in $(echo ${INPUT} | tr ' ' '\n' | grep -o ^[-]*[+][0-9]*); do
unset MINUS
if [ ${INDEX:0:1} = - ]; then
MINUS=-
INDEX=${INDEX:1}
fi
if [[ ${INDEX} = *[0-9]* ]] && [ ! -z ${ACCOUNTS_ARRAY[${INDEX}]} ]; then
INPUT=" ${INPUT/${MINUS}${INDEX}/${MINUS}${ACCOUNTS_ARRAY[${INDEX:1}]}} "
else
tprint "error, invalid account index specified" ${INDEX}
exit 1
fi
done
INPUT=\ ${INPUT}\
ACCOUNTS=\ ${ACCOUNTS}\
for MINUS in $(echo ${INPUT} | tr ' ' '\n' | grep \\-.*); do
INPUT=${INPUT// ${MINUS} / }
MINUS=${MINUS:1}
INPUT=${INPUT// ${MINUS} / }
INPUT="$(echo \ ${INPUT} | sed -e "s/\ ${MINUS%%\/*}\/[[:graph:]]*\ /\ /") "
ACCOUNTS=${ACCOUNTS// ${MINUS} / }
ACCOUNTS="$(echo \ ${ACCOUNTS} \
| sed -e "s/\ ${MINUS%%\/*}\/[[:graph:]]*\ /\ /") "
done
if echo \ ${INPUT} | grep -oiq -m 1 " [a-z0-9]"; then
ACCOUNTS="${INPUT}"
fi
# check script input
if [ -z "${1}" ]; then
idler_help
tprint "error, no supplied actions"
exit 1
elif [ -z "$(echo ${ACCOUNTS})" ]; then
tprint "error, no initiated or specified accounts"
exit 1
fi
for ACTION in $(echo ${1} | tr '[%,]' '\n' | tr [:upper:] [:lower:]); do
if ! declare -f | grep -q ^idler_$(echo ${ACTION/=*})\ ; then
idler_help
tprint "fatal, invalid action '${ACTION/=*}'"
exit 1
fi
done
# delete unused passwd scripts, remove dead screens, then kill defunct processes
for LINE in $(screen -wipe idler- | grep -o \\-.*Removed | awk '{print $1}'); do
tprint "removed dead ${LINE:1:${#LINE}-2} screen session"
done
for DPID in $(pgrep -fx steam\\.exe\|hl2\\.exe); do
tprint "killing defunct steam/hl2 process..." @${DPID}
kill -9 ${DPID}
done
# clutch the merging of steamwindows/steamcmd directories with kill/rm if needed
if [ -d steamwindows ]; then
tprint "warning, performing steam_cmd/windows merge clutch..." 0.9019
killall -vw wineserver
find steamcmd/steamapps -maxdepth 2 -type l -exec rm {} \;
mv steamcmd steam
mv steamwindows/steamapps/appmanifest*.acf steam/steamapps 2> /dev/null
mv steamwindows/steamapps/common/* steam/steamapps/common 2> /dev/null
rm -fr steamwindows steam/config steam/logs steam/userdata steam/package \
steam/ssfn* steam/.crash steam/dumps "${STF}"/*.tar.gz "${STF}"/pdl* \
"${TF}"/cfg/config.cfg "${TF}"/cfg/autoexec.cfg "${TF}"/cfg/personal.cfg \
"${TF}"/cfg/audible.cfg "${TF}"/pdl/farm/ver wine wine-*
fi
# run action sets with specified accounts
for ACTIONS in $(echo ${1} | tr ',' '\n'); do
for ACCT in ${ACCOUNTS}; do
if [ "${OLD_ACCT%%/*}" != ${ACCT%%/*} ]; then
ACTION_TIME=$(date +%s)
fi
if set_account ${ACCT}; then
for ACTION in $(echo ${ACTIONS} | tr '%' '\n'); do
ARG=$(echo ${ACTION} | sed -e "s/[a-z_]*=*//" -e "s/__*/_/g")
ACTION=$(echo ${ACTION/=*} | tr [:upper:] [:lower:])
case ${ACTION} in
sleep )
if [ -z ${ARG} ]; then
ARG=5
fi
tprint "sleeping..." ${ARG}
idler_sleep ${ARG}
if [[ ${ACTIONS} != *%* ]]; then
break 2
fi
;;
stop )
idler_stop ${ARG}
;;
logout )
idler_logout ${ARG}
;;
uninstall )
idler_uninstall ${ARG}
;;
delete )
idler_delete ${ARG}
;;
login )
idler_login ${ARG} || break $?
;;
play )
if ! hl2_pid > /dev/null; then
idler_login ${ARG} || break $?
idler_play
fi
;;
command )
if hl2_pid > /dev/null; then
idler_command "${ARG//^/ }"
fi
;;
disconnect )
if hl2_pid > /dev/null; then
idler_disconnect
fi
;;
connect )
idler_connect ${ARG} || break
;;
farm )
idler_farm || break $?
;;
help )
idler_help ${ARG}
break 2
;;
log )
idler_log ${ARG} || break 2
;;
list )
idler_list ${ARG}
;;
backpack )
idler_backpack ${ARG}
;;
status )
idler_status ${ARG}
;;
utility )
idler_utility "${ARG//^/ }"
;;
website )
idler_website ${ARG}
;;
create )
idler_create || break
;;
offline )
idler_offline
;;
online )
idler_online ${ARG}
;;
enter )
idler_enter ${ARG} || break
;;
exit )
idler_exit
;;
friend )
idler_friend ${ARG}
;;
register )
idler_register
;;
exhibit )
idler_exhibit ${ARG}
;;
socialize )
idler_socialize ${ARG}
;;
discover )
idler_discover ${ARG}
;;
* )
case ${ACTION} in
fake )
idler_fake "${ARG}" yes || break
;;
craft )
idler_craft "${ARG}" || break
;;
waste )
idler_waste "${ARG}" || break
;;
sort )
idler_sort || break
;;
deterge )
idler_deterge "${ARG}" || break
;;
trade )
idler_trade "${ARG}"
;;
harvest )
idler_harvest "${ARG}"
;;
rename )
idler_rename "${ARG}" || break
;;
esac
RETURN=$?
if [ ${RETURN} = 1 ]; then
continue
elif [ ${RETURN} = 2 ]; then
break 2
fi
run_node_login || break $?
;;
esac
done
fi
done
# manage offer receiver stop and/or finish
if [ ! -z ${RECEIVER} ]; then
while node_login_pid ${RECEIVER} > /dev/null \
&& [ $(node_login_background ${RECEIVER}) != FAKE ]; do
if [ -z ${RECEIVER_STOP} ]; then
RECEIVER_STOP=yes
echo STOP_RECEIVER >> share/${RECEIVER}/node.log
fi
idler_sleep 1
done
unset RECEIVER RECEIVER_STOP
fi
done
finish
// pdl-idler_autoexec.cfg (0.9025)
// Copyright (c) 2011-2016 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/>
+movedown
sv_cheats "1"
addip "0" "1.2.3.4"
alias addip
writeip
alias astop "echo pdl_astop;alias _acmd1;alias _acmd30;alias _acmd300;alias _amove;alias _mping"
alias _amove "+left;wait 1;-left;wait 1200;_amove"
alias cmnd
alias mmute "voice_loopback 0;cl_voice_filter _pdl_;-voicerecord;alias mping"
alias mhear "mmute;exec audible"
alias mtalk "mhear;wait 120;voice_loopback 1;+voicerecord;alias mping mtalk"
alias mping ""
alias _mping "mping;wait 16000;_mping"
cl_ask_blacklist_opt_out "1"
cl_ask_favorite_opt_out "1"
cl_class "scout"
cl_hud_playerclass_playermodel_showed_confirm_dialog "1"
cl_lagcompensation "0"
cl_showhelp "0"
cl_smooth "0"
cl_team "default"
cl_timeout "0"
con_enable "1"
con_timestamp "1"
echo "Disconnect"
echo "pdl_aload"
exec "personal"
mat_vsync "0"
mat_motion_blur_enabled "1"
mp_timelimit "0"
sb_dontshow_maxplayer_warning "1"
setinfo name ""
sv_pure "-1"
tf_coach_request_nevershowagain "1"
tf_explanations_backpackpanel "1"
tf_explanations_charinfo_armory_panel "1"
tf_explanations_charinfopanel "1"
tf_explanations_craftingpanel "1"
tf_explanations_discardpanel "1"
tf_explanations_store "1"
tf_matchmaking_ticket_help "1"
tf_show_preset_explanation_in_class_loadout "0"
tf_training_has_prompted_for_forums "1"
tf_training_has_prompted_for_loadout "1"
tf_training_has_prompted_for_offline_practice "1"
tf_training_has_prompted_for_options "1"
tf_training_has_prompted_for_training "1"
tf_taunt_always_show_hint "0"
voice_enable "1"
voice_fadeouttime "0.0"
voice_overdrive "64"
volume "0"
#!/bin/bash
# pdl-idler_common.sh (0.9025)
# Copyright (c) 2011-2016 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/>
# colored output with an optional right-aligned argument and padding
export TERM=xterm
b=$(tput bold) d=$(tput dim) u=$(tput smul)
v=$(tput rmul) z=$(tput sgr0)
r=$(tput setf 4) y=$(tput setaf 3) m=$(tput setf 5)
l=$(tput setf 3) p=$(tput setf 7) g=$(tput setaf 2)
x=$(tput setaf 9)
print()
{
tput sc
echo -en "${1}"
tput rc
PAD=${3}
if [ -z ${3} ]; then
PAD=$(($(echo -en "${2}" \
| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | wc -c)-2))
fi
tput cuf $(($(tput cols)-PAD))
echo ${2}
unset END_ECHO
if [ ! -z ${4} ]; then
tput cuu1
tput cuf $(($(echo -en "${1}" \
| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | wc -c)-2))
END_ECHO=yes
fi
}
# print with a timestamp and duration since last call during action chain
ACTION_TIME=$(date +%s)
tprint()
{
PRINT="${g}${1}"
if [[ "${PRINT}" != *${ACCT}:* ]]; then
PRINT="${g}<${HOSTNAME}>: ${1}"
fi
if [[ "${PRINT}" = *warning,* ]]; then
PRINT="${PRINT/warning, /${y}warning,${x} } ${y}${b}{*}${z}${x}"
fi
if [[ "${PRINT}" = *error,* ]]; then
PRINT="${PRINT/error, /${r}error,${x} } ${r}${b}{"'!}'"${z}${x}"
fi
if [[ "${PRINT}" = *fatal,* ]]; then
PRINT="${PRINT/fatal, /${m}fatal,${x} } ${m}${b}{#}${z}${x}"
fi
print "${p}[$(date +%H:%M:%S)]${x} ${PRINT/:/${x}:${b}}${z}" \
"${p}${u}+$(($(date +%s)-ACTION_TIME))s${z}${x}|${l}${2}${x}" "${3}" ${4}
}
steam_pid()
{
# get pid of steam process with an optional command line string
GET=${ACCT}
if [ ! -z ${2} ]; then
GET=${2}
fi
SPID=$(pgrep -fn "steam\\.exe -${GET} .*${1}")
if [ -z ${SPID} ]; then
return 1
fi
echo ${SPID}
}
window_id()
{
# check existance and/or get id of a named window
steam_pid > /dev/null
for WID in $(xwininfo -all -root -children 2> /dev/null \
| grep "${1}.*: (\"steam\\.exe" | awk '{print $1}'); do
XPROP=$(xprop -id ${WID} 2> /dev/null)
if echo "${XPROP}" | grep -q _PID.*\ ${SPID}; then
if [ ! -z "${2}" ] && ! echo "${XPROP}" | grep -q ${3} "${2}"; then
continue
fi
echo ${WID}
return 0
fi
done
unset WID
return 1
}
idler_sleep()
{
# wait for a period of time to elapse or until the user hits enter 3 times
SLEEP=$(read -st ${1})
}
hl2_pid()
{
# get pid of tf2 client process
HPID=$(pgrep -fn "hl2\\.exe.*${1}.*${ACCT//./}\+")
if [ -z ${HPID} ]; then
return 1
fi
echo ${HPID}
}
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
if [ ! -z ${2} ]; then
MEMORY=$((${MEMORY}+${2}*1024))
fi
printf "${u}%03dm${v}\n" $((${MEMORY} / 1024))
else
echo 00m
fi
}
steam_memory()
{
# get memory usage of steam and web helper processes
local WEB=00
for WPID in $(pgrep -f steamwebhelper\\.exe); do
if grep -q ${WINEPREFIX} /proc/${WPID}/environ; then
let WEB+=$(($(grep RSS /proc/${WPID}/status | grep -o \[0-9]*)/1024))
fi
done
memory ${SPID} ${WEB}
}
hl2_memory()
{
# get memory usage of hl2 process
memory ${HPID}
}
both_memory()
{
# get memory usage of steam and hl2
echo $(steam_memory)+$(hl2_memory)
}
node_login_pid()
{
# get user node pid
GET=${ACCT}
if [ ! -z ${1} ]; then
GET=${1}
fi
pgrep -f node\ share/${GET}/node.js
}
is_node_login_available()
{
# check user node availability
GET=${ACCT}
if [ ! -z ${1} ]; then
GET=${1}
fi
if grep -q //${HOSTNAME} share/${GET}/node.js 2> /dev/null \
&& ! node_login_pid ${GET} > /dev/null; then
return 0
elif [ -e share/${GET}/node.log ] \
&& ! tac share/${GET}/node.log | grep -q ^EXIT \
&& [ -z $(find share/${GET}/node.log -maxdepth 1 -mmin +1) ]; then
return 1
fi
return 0
}
node_login_background()
{
# get node background session type
GET=${ACCT}
if [ ! -z ${1} ]; then
GET=${1}
fi
tac share/${GET}/node.log | grep -om 1 ^BREAK_.* | sed s/BREAK_//
}
stop_node_login()
{
# end user node background session
GET=${ACCT}
if [ ! -z ${1} ]; then
GET=${1}
fi
if node_login_pid ${GET} > /dev/null; then
tprint "${GET}: ending node session..." \
@$(node_login_pid ${GET}),$(node_login_background ${GET})
kill $(node_login_pid ${GET})
elif ! is_node_login_available ${GET}; then
tprint "${GET}: ending node session..." $(grep -m1 \/\/ \
share/${GET}/node.js | sed "s/.*\///"),$(node_login_background ${GET})
echo QUIT >> share/${GET}/node.log
fi
while ! is_node_login_available ${GET}; do
idler_sleep 1
done
}
is_commandable()
{
# check if a client has stopped the command aliases
tac ${CON} | grep -m1 "Shutdown func\|pdl_aload\|pdl_astop" | grep -q aload
}
idler_stop()
{
# end a background fake game session and/or quit/kill client process
if ! is_node_login_available && [ "$(node_login_background)" = FAKE ] \
&& ! ps $(grep -m 1 //@ ${NODEJS} | grep -o \[0-9]*) | grep -q pdl-idler.*\\.sh; then
stop_node_login
fi
if hl2_pid > /dev/null; then
if [ "${1}" = yes ]; then
STOP_TIMEOUT=121
tprint "${ACCT}: killing client..." @${HPID},$(both_memory)
else
STOP_TIMEOUT=120
if is_commandable; then
tprint "${ACCT}: quitting client..." @${HPID},$(both_memory)
STOP_TIMEOUT=0
echo quit > "${ATF}"/pdl-${ACCT}/cfg/banned_ip.cfg
fi
fi
while hl2_pid > /dev/null; do
if [ ${STOP_TIMEOUT} = 120 ]; then
tprint "${ACCT}: warning, killing client..." $(both_memory)
elif [ ${STOP_TIMEOUT} = 121 ]; then
kill -9 ${HPID}
else
idler_sleep 1
fi
let STOP_TIMEOUT+=1
done
fi
}
# get size on disk of the wineprefix and other account specific files
APPS=steam/steamapps
TF=${APPS}/common/Team\ Fortress\ 2/tf
account_size()
{
echo $(du --apparent-size -ch share/${ACCT} wine-${ACCT} \
"${TF}"/con-${ACCT}.log 2> /dev/null | grep total | awk '{print $1}')
}
auth_state()
{
# get authentication state
AUTH_STATE=$(tac ${LOGS}/connection_log.txt 2> /dev/null \
| grep -m1 "Log session\|LogOnResponse" | grep -v session)
if [[ ${AUTH_STATE} != *\'OK\'* ]]; then
echo ${AUTH_STATE}
return 1
fi
return 0
}
block_on_file()
{
# lock or wait on a pid file for other invocations
while true; do
for LOCK in ${1}-*.lock; do
if [ -e ${LOCK} ]; then
if [ ${LOCK} != "${1}"-${HOSTNAME}.lock ] || ps $(cat ${LOCK}) \
| grep -v "^[[:space:]]*$$ " | grep -q \ [ba]*sh\ .*pdl-idler.*\\.sh; then
if [ -z ${BLOCKED} ]; then
local BLOCKED=yes
tprint "${ACCT}: warning, blocked file wait..." @$$/$(cat ${LOCK}),${1}
fi
idler_sleep 1.$(shuf -i 1-9 -n 1)
continue 2
fi
fi
done
if [ ! -z ${2} ] && [ ! -z ${BLOCKED} ]; then
return 1
fi
echo $$ > "${1}"-${HOSTNAME}.lock
return 0
done
}
focus_window()
{
# block on display, then activate or focus a window by its id
block_on_file .xdotool${DISPLAY:1}
if [ ! -z ${1} ]; then
if [ ${DISPLAY} != :0 ]; then
xdotool windowraise ${1} windowfocus --sync ${1} \
mousemove --window ${1} 3 3 click 1 2> /dev/null
idler_sleep 0.4
elif [ $(echo $((16#${1:2}))) != $(xdotool getwindowfocus) ]; then
xdotool windowactivate --sync ${1} 2> /dev/null
fi
fi
}
close_window()
{
# close a window by id
if [ -z ${1} ] || ! window_id ${1} > /dev/null; then
return 1
fi
if [ -z ${2} ]; then
local ALTF4=Alt+F4
fi
if [ -z ${3} ]; then
local MOUSE="mousemove --window ${1} 8 $(($(xwininfo -id ${1} 2> /dev/null \
| grep Height | grep -o \[0-9]*)-8)) click --repeat 2 --delay 300 1"
fi
local KEY=Escape
if [ -z ${4} ]; then
KEY=Return
fi
focus_window ${1}
while window_id ${1} > /dev/null && ! xprop -id ${1} | grep -q Withdrawn \
&& ! xwininfo -id ${1} | grep -q IsUnMapped; do
let CLOSEWINDOW_TIMEOUT+=1
if [ ${CLOSEWINDOW_TIMEOUT} = 1 ]; then
xdotool ${MOUSE} key --window ${1} ${KEY} ${ALTF4} 2> /dev/null
elif [ ${CLOSEWINDOW_TIMEOUT} == 3 ]; then
unset CLOSEWINDOW_TIMEOUT
fi
idler_sleep 1
done
rm -f .xdotool${DISPLAY:1}-${HOSTNAME}.lock
return 0
}
app_state()
{
# get steam app state string or return nothing if not changing content
local APPID=440
if [ ! -z ${1} ]; then
APPID=${1}
fi
STATE=$(tac ${LOGS}/content_log.txt 2> /dev/null | grep -om 1 \
"Loaded [0-9]* apps\|AppID ${APPID} .*te changed.*," | grep -v Loaded)
if [ ! -z "${STATE}" ] && [[ "${STATE}" != *Fully\ Installed, ]]; then
echo ${STATE##*: }
return 0
fi
return 1
}
wait_for_stop()
{
# wait for steam if it still registers tf2 as running
local WAIT_FOR_STOP_TIMEOUT
while app_state | grep -q ,App\ Running,$; do
idler_sleep 1
let WAIT_FOR_STOP_TIMEOUT+=1
if [ ${WAIT_FOR_STOP_TIMEOUT} = 10 ]; then
return 1
fi
done
}
wine_run()
{
# execute a program with wine and surpress the call output
wine "$@" > /dev/null 2>&1
}
idler_logout()
{
# stop, end or kill steam/node, backup creds, stop X, and remove temp files
idler_stop ${1}
if steam_pid > /dev/null; then
if [ "${1}" = yes ]; then
LOGOUT_TIMEOUT=61
tprint "${ACCT}: killing steam..." ${DISPLAY},@${SPID}/$(steam_memory)
else
LOGOUT_TIMEOUT=0
tprint "${ACCT}: logging out..." ${DISPLAY},@${SPID}/$(steam_memory)
if ! auth_state > /dev/null; then
close_window $(window_id Error)
close_window $(window_id Guard)
close_window $(window_id Login)
elif wait_for_stop; then
wine_run C:/Steam/steam.exe -shutdown
else
tprint "${ACCT}: error, client stop unregistered, killing steam"
LOGOUT_TIMEOUT=61
fi
fi
if tac ${LOGS}/cloud_log.txt 2> /dev/null \
| grep -m1 "Need to\|Upload complete" | grep -q Need; then
tprint "${ACCT}: cloud sync needed..." $(steam_memory)
fi
if app_state | grep -q ",Update Stopping,\|(Suspended)"; then
tprint "${ACCT}: warning, download stopping..." $(steam_memory)
fi
while steam_pid > /dev/null; do
if [ ${LOGOUT_TIMEOUT} = 60 ]; then
tprint "${ACCT}: warning, killing steam..." $(steam_memory)
elif [ ${LOGOUT_TIMEOUT} = 61 ]; then
kill -9 ${SPID}
fi
idler_sleep 1
let LOGOUT_TIMEOUT+=1
done
fi
if [ -z ${2}${DEBUG} ]; then
rm -fr ${LOGS} ${STEAM}/steamapps wine-${ACCT}/_*_lo*.reg \
wine-${ACCT}/.utility.* "${TF}"/con-${ACCT}.log ${STEAM}/dumps
rmdir share/${ACCT}/logs 2> /dev/null
fi
}
check_account_input()
{
# check account password and email address
MIN_LENGTH=6
if [ ! -z ${EMAIL} ]; then
MIN_LENGTH=8
fi
if (( $(expr length "${PASS}") < ${MIN_LENGTH} )); then
tprint "${ACCT}: error, invalid password" ${PASS}
elif [ ! -z ${EMAIL} ] && ! echo ${EMAIL} | grep -q .*@.*\\..*; then
tprint "${ACCT}: error, invalid email"
else
return 0
fi
return 1
}
steam_uid()
{
# get steam uid from config.vdf
if [[ "${1}" = 765611* ]]; then
echo ${1}
elif ! cat share/${1}/config/config.vdf 2> /dev/null | tr -d '[:blank:]' \
| tr -d '\n' | grep -o \"${1}\"{\"SteamID\"\"765611[0-9]*\" \
| grep -o 765611[0-9]*; then
return 1
fi
}
steam_ids()
{
# get+cache steam account ids
SUID=$(steam_uid ${ACCT})
unset SCID
if [ ! -z ${SUID} ]; then
SCID=$((SUID-76561197960265728))
fi
}
set_account()
{
# set the account credentials, variables, and directory/file locations
if [ -z ${2} ]; then
OLD_ACCT=${ACCT}/${PASS}
fi
ACCT=$(echo ${1/\/*} | tr [:upper:] [:lower:] | sed s/#.*//)
EMAIL=${1##*#}
if [[ ${ACCT} != ?????* ]] \
|| [[ ${ACCT}${EMAIL} = *steam* ]] || [[ ${ACCT}${EMAIL} = *valve* ]]; then
tprint "${ACCT}: error, invalid account credentials"
return 1
fi
PASS=$(echo ${1%#${EMAIL}} | sed "s/${ACCT}\///")
if [ ${PASS} = ${ACCT} ]; then
if echo ${ACCOUNTS_STRING} \
| grep -qP "( |^)${ACCT}/[[:graph:]][[:graph:]]*"; then
set_account $(echo ${ACCOUNTS_STRING} | grep -oPm 1 "( |^)${ACCT}/\S*") no
return
fi
unset PASS
fi
if [ ${EMAIL} = ${1} ]; then
unset EMAIL
fi
check_account_input || return 1
export WINEPREFIX="${PWD}"/wine-${ACCT}/
STEAM=wine-${ACCT}/drive_c/Steam
ATF=${STEAM}/steamapps/common/Team\ Fortress\ 2/tf
CONFIG=share/${ACCT}/config
LOGS=share/${ACCT}/logs/${HOSTNAME}
CON=${LOGS}/con-${ACCT}.log
USERDATA=share/${ACCT}/userdata
LCONFIG=${USERDATA}/"*"/config/localconfig.vdf
NODEJS=share/${ACCT}/node.js
NODELOG=share/${ACCT}/node.log
export DISPLAY=:0
if steam_pid > /dev/null; then
export DISPLAY=:$(ps ${SPID} | grep -o "_\:[0-9]*" | grep -o \[0-9]*)
fi
steam_ids
}
idler_uninstall()
{
# logout, backup credentials, then remove client files and wineprefix
if [ -d wine-${ACCT} ]; then
idler_logout $*
tprint "${ACCT}: uninstalling..." $(account_size)
wineserver -k
if ! rm -rf wine-${ACCT} 2> /dev/null; then
tprint "${ACCT}: fatal, could not uninstall"
exit 1
fi
fi
}
idler_delete()
{
# logout, uninstall, then remove credential backup
if [ -d share/${ACCT} ]; then
idler_uninstall $*
tprint "${ACCT}: deleting..." $(account_size)
if ! rm -fr share/${ACCT} 2> /dev/null; then
tprint "${ACCT}: fatal, could not delete"
exit 1
fi
fi
}
free_swap()
{
# get available system swap
echo $(($(grep SwapFree /proc/meminfo | awk '{print $2}')/1000))
}
version()
{
# parse version string
if [ -z ${1} ]; then
echo none
return 1
fi
echo $* | grep -o \[0-9]*
}
steam_ui_cache_version()
{
# get steam ui version manifest file
version $(grep version steam/package/steam_client_win32.manifest 2> /dev/null)
}
steam_ui_version()
{
# get steam ui version of the installed account prefix
version $(cat wine-${ACCT}/.ui.pdl 2> /dev/null)
}
xserver_pid()
{
# get pid of an X server process by its display id via tmp lock file
local FILE=/tmp/.X${1:1}-lock
if [[ ${FILE} = *.X0?-lock ]]; then
FILE=${FILE//.X0/.X}
fi
if [ ! -e ${FILE} ]; then
return 1
fi
echo $(cat ${FILE})
}
key_press()
{
# press any number of keyboard keys
focus_window ${1}
local DELAY="--delay 300"
if [ ! -z ${3} ]; then
DELAY="--delay ${3}"
fi
if [ $(echo ${2} | wc -w) = 1 ]; then
xdotool key ${4} ${2} ${5}
else
xdotool key ${4} ${DELAY} ${2} ${5}
fi
idler_sleep $(echo "scale=4;${DELAY:8}/1000" | bc)
rm -f .xdotool${DISPLAY:1}-${HOSTNAME}.lock
}
steam_connect_hash()
{
# get last 6 chars of connect cache from config.vdf or old cred file reference
local HASH=$(cat ${CONFIG}/config.vdf 2> /dev/null | tr -d '[:blank:]' \
| tr -d '\n' | grep -o \"ConnectCache\"{\"[a-f0-9]*\"\"[a-f0-9]* | tail -c5)
if [ -z ${HASH} ]; then
HASH=------
fi
echo \#${HASH}
}
download()
{
# download a file
TARGET="${1##*/}"
if [ -d "${2}" ]; then
TARGET="${2}/${TARGET}"
elif [ ! -z "${2}" ]; then
TARGET="${2}"
fi
for DOWNLOAD in {1..3}; do
if wget -q ${1} -O "${TARGET}"; then
rm -f ${HOME}/.wget-hsts
return 0
fi
done
tprint "error, file download failed" ${TARGET##*/}
return 1
}
disable_power_management()
{
# disable power management
XFCE_PID=$(pgrep -fx xfce4-power-manager)
if [ ! -z ${XFCE_PID} ]; then
XFCE_AC=$(DISPLAY=:0 xfconf-query -c xfce4-power-manager \
-p /xfce4-power-manager/inactivity-on-ac -v 2> /dev/null)
if [ ! -z ${XFCE_AC} ] && [ ${XFCE_AC} != 14 ]; then
tprint "disabled xfce4-power-manager" ${XFCE_AC}\>0,@${XFCE_PID}
echo ${XFCE_AC} > .xfce4pm.pdl
set_xfce_power 14 &
fi
fi
}
app_size()
{
# get disk size of the app content or download
if [ ! -z ${2} ]; then
SIZE=$(grep -m1 SizeOnDisk ${APPS}/appmanifest_${1}.acf 2> /dev/null \
| grep -o \[0-9]* || echo 0)
else
SIZE=$(tac ${LOGS}/content_log.txt 2> /dev/null \
| grep -om 1 "ID ${APPID}.*: download [/0-9]*" | grep -om 1 "[0-9]*/[0-9]*")
SIZE=$((${SIZE#*/}-${SIZE%/*}))
fi
if ((SIZE < 10000)); then
echo ${SIZE}b
elif (( SIZE < 10238977)); then
echo $((SIZE/1024))kb
else
echo $(($((SIZE/1024))/1024))mb
fi
}
app_version()
{
# get buildid from application manifest
version $(grep -m1 buildid ${APPS}/appmanifest_${1}.acf 2> /dev/null)
}
app_activity()
{
# announce when steam(cmd) is updating or validating an app
local APP_PID=$(pgrep steamcmd || echo ${SPID})
if [ -z ${VALIDATING} ] && tac ${LOGS}/content_log.txt \
| grep -m 1 "] Loaded\|${1}.*te changed.*,Validating\|validation finished" \
| grep -q Validating; then
VALIDATING=yes
tprint "warning, validating app..." $(app_size ${1} disk),@${APP_PID}
fi
if [ -z ${DOWNLOADING} ] && tac ${LOGS}/content_log.txt \
| grep -m 1 "] Loaded\|${1}.*te changed.*,Downloading" | grep -q Download; then
DOWNLOADING=yes
tprint "warning, downloading app..." $(app_size ${1}),@${APP_PID}
fi
if [ -z ${COMMITTING} ] && tac ${LOGS}/content_log.txt \
| grep -m 1 "] Loaded\|${1}.*te changed.*,Committing" | grep -q Committing; then
COMMITTING=yes
tprint "warning, committing app..." $(app_size ${1}),@${APP_PID}
fi
}
check_steamcmd_app()
{
# disable pm, reset crash/ssfn file, then start steamcmd app check/download
disable_power_management
tprint "checking steam app..." $(app_size ${1} 1),v$(app_version ${1}),\#${1}
rm -fr ${STEAM}/.crash ${STEAM}/steamapps
mkdir -p ${STEAM}/steamapps
ln -sf "${PWD}"/${APPS}/* ${STEAM}/steamapps/
rm -f ${STEAM}/steamapps/*.acf
ln -sf "${PWD}"/${APPS}/appmanifest_${1}.acf ${STEAM}/steamapps
sed -i -e 's/.*SentryFile.*/"SentryFile""'${PWD//\//\\/}\\/share\\/${ACCT}\\/ssfn\"/ \
${CONFIG}/config.vdf
rm -fr ${HOME}/Steam 2> /dev/null
ln -sf "${PWD}"/${STEAM} ${HOME}/Steam
if [ -d ${HOME}/.steam ]; then
rm -fr ${HOME}/.steam-other
mv ${HOME}/.steam ${HOME}/.steam-other 2> /dev/null
fi
chmod +x steam/linux32/steamcmd steam/steamcmd.sh
echo \] Loaded >> ${LOGS}/content_log.txt
touch ${LOGS}/steamcmd_log.txt
bash ${STEAM}/steamcmd.sh -noverifyfiles ${2} ${3} +app_update ${1} \
${STEAMCMD} +quit > ${LOGS}/steamcmd_log.txt 2>&1 &
while ! tac ${LOGS}/steamcmd_log.txt | grep -q "Success.*App '${1}'"; do
idler_sleep 1
app_activity ${1}
if auth_state | grep -q "Logon Denied\|Two-factor\|Limit Exceed"; then
tprint "fatal, steamcmd auth/guard error" \#${1}
killall -w steamcmd
exit 1
fi
done
rm -fr ${HOME}/Steam
mv ${HOME}/.steam-other ${HOME}/.steam 2> /dev/null
unset VALIDATING DOWNLOADING COMMITTING
}
vpk_extract()
{
# extract files from a vpk archive
VPK="${1}"_dir.vpk
DST="${2}"
shift 2
for TGT in $*; do
mkdir -p ${TGT%/*} "${DST}"/${TGT%/*}
done
wine_run "${TF}"/../bin/vpk.exe x "${VPK}" $*
for TGT in $*; do
mv ${TGT} "${DST}"/${TGT%/*} 2> /dev/null
done
for TGT in $*; do
rm -fr ${TGT%%/*}
done
}
# get player count of an idle server via the port
STF=${APPS}/common/Team\ Fortress\ 2\ Dedicated\ Server/tf
server_playercount()
{
tac "${STF}"/pdl-${HOSTNAME}-281${1:(-2)}/console.log \
| grep -om 1 "Players:.*" | grep -o \[0-9]*
}
# find first available server/port
if [ -z ${IDLE_MAX} ] || ((IDLE_MAX > 33)); then
IDLE_MAX=32
fi
SMOD="${STF}"/addons/sourcemod
IRC_SERVER=irc.gamesurge.net
IRC_SERVER_PORT=6667
IRC_CHANNEL=mannsanto
IDLE_MAP=itemtest
COMMON_OPTS="-condebug -nobreakpad -nodev -nodns -nogamestats -nohltv -noipx"
COMMON_OPTS="${COMMON_OPTS} -nomaster -nominidumps -noassert"
function start_server()
{
if [ -z ${PORT} ]; then
for NUM in {01..99}; do
if ! pgrep -f srcds_linux.*281${NUM} > /dev/null; then
if [ -z ${PORT} ]; then
PORT=pdl-${HOSTNAME}-281${NUM}
unset PLAYER
fi
else
PLAYER=$(server_playercount ${NUM})
if ((PLAYER < IDLE_MAX)) || [[ $(client_connection) = *281${NUM} ]]; then
PORT=pdl-${HOSTNAME}-281${NUM}
break
fi
fi
done
# configure server and sourceirc
if ! pgrep -f srcds_linux.*${PORT:(-5)} > /dev/null; then
mkdir -p "${STF}"/${PORT}/addons/sourcemod/configs \
"${STF}"/${PORT}/cfg/sourcemod
{
echo hostname ${HOSTNAME}=${USER}_${VERSION}
echo -e "sv_cheats 1\nfps_max 10\nip 0.0.0.0\nmaxplayers 32"
echo -e "mp_autoteambalance 0\nmp_timelimit 0\nmp_allowspectators 0"
echo -e "mp_teams_unbalance_limit 0\nmp_idledealmethod 0"
echo -e "sv_pure 0\nsv_timeout 0\nmap ${IDLE_MAP}"
} > "${STF}"/${PORT}/cfg/autoexec.cfg
sed -e "s/crosshair 0/crosshair 1/" -e "s/\ttf\/custom\//+vgui\ttf\/pdl\//" \
-e "s/\tgame+mod\t\t\ttf\/tf2/\t\/\/\/game+mod\t\t\ttf\/tf2/" \
-e 's/\tgame+game/\t\/\/\/game+game/' -e "s/\tgame_lv/\t\/\/\/game_lv/" \
-e 's/\tgame\t\t\t\t|all_/\t\/\/\/game\t\t\t\t|all_/' \
-e 's/\tgame+vgui/\t\/\/\/game+vgui/' \
-e 's/\tgame+mod+vgui/\t\/\/\/game+mod+vgui/' \
-e 's/\tplatform+vgui/\t\/\/\/platform+vgui/' \
-e 's/\tplatform\t\t\t|all_/\t\/\/\/platform\t\t\t|all_/' \
-e "s/\tgame+down/\t\/\/\/game+down/" -e "s/\tmod\t/\t\/\/\/mod\t/" \
-e "s/pdl-.*/${PORT}/" "${ATF}"/gameinfo.txt > "${STF}"/gameinfo.txt
rm -f "${STF}"/${PORT}/cfg/sourcemod/irc-connected.cfg \
"${SMOD}"/plugins/sourceirc.smx
if [ "${IRC_SERVER}" != none ]; then
cp "${SMOD}"/plugins/disabled/sourceirc.smx "${SMOD}"/plugins
sed -e "s/irc.gamesurge.net/${IRC_SERVER}/" -e "s/\"1.0\"/\"2.0\"/" \
-e "s/6667/${IRC_SERVER_PORT}/" -e "s/\t\"cmd_/\/\/\"cmd_/" \
-e "s/\" \/\/ The server/${IRC_SERVER_PASS}&/" \
-e "s/\" \/\/ The channel/${IRC_CHANNEL_PASS}&/" \
-e "s/\"#sourceirc.*\"/\"#${IRC_CHANNEL/\#}\"/" \
-e "s/\t\"SourceIRC\"/\t\"$(echo ${HOSTNAME:0:13} \
| sed -e s/-// -e s/_//)_${PORT:(-2)}-\"/" \
"${SMOD}"/configs/sourceirc.cfg.def \
> "${STF}"/${PORT}/addons/sourcemod/configs/sourceirc.cfg
if [ ! -z ${IRC_SERVER_USER} ]; then
echo "irc_send \"/authserv AUTH ${IRC_SERVER_USER} ${IRC_SERVER_PASS}\"" \
> "${STF}"/${PORT}/cfg/sourcemod/irc-connected.cfg
fi
fi
SCON="${STF}"/${PORT}/console.log
# link/compile server plugin
ln -sf "${PWD}"/pdl-idler_sourcemod.sp "${SMOD}"/scripting/pdl-idler.sp
cd "${SMOD}"/scripting
chmod +x compile.sh spcomp
OPTS=$(./compile.sh pdl-idler 2> /dev/null)
if ! mv compiled/pdl-idler.smx \
../plugins/pdl-idler.smx 2> /dev/null; then
echo "${OPTS}"
exit 1
fi
cd "${DIR}"
# write version to console log, then start server
echo "pdlv $(version $(grep Server "${STF}"/steam.inf 2> /dev/null \
| grep -o \[0-9]*))" > "${SCON}"
tprint "loading server..." \
${IDLE_MAP},\#${PORT:(-2)},v$(app_version 232250) | tee -a "${SCON}"
screen -dmS idler-server${PORT:(-2)}$ "${STF}"/../srcds_run -norestart \
${COMMON_OPTS} -game tf -ignoresigint -replay -port ${PORT:(-5)}
fi
fi
}
steam_cellid()
{
# get steam server cellid
grep \"CurrentCellID ${CONFIG}/config.vdf | grep -o \[0-9]*
}
steam_auth_server()
{
# get steam authentication server
tac ${LOGS}/connection_log.txt | grep Completed \
| grep -m1 -o "[0-9\.:]*, [A-Z]" | sed -e "s/, //" -e "s/:270/:/"
}
type_input()
{
# type a string with the keyboard
focus_window ${1}
local DELAY=300
if [ ! -z ${3} ]; then
DELAY=${3}
fi
if [ ! -z ${4} ] ; then
local SELECT=key\ Ctrl+a
fi
echo ${5} ${SELECT} type --delay ${DELAY} \"${2}\" | xdotool -
idler_sleep $(echo "scale=4;${DELAY}/1000" | bc)
rm -f .xdotool${DISPLAY:1}-${HOSTNAME}.lock
}
mouse_click()
{
# mouse the mouse relative to a window and click
focus_window ${1}
local XPOS=0
if [ ! -z ${2} ]; then
XPOS=${2}
fi
local YPOS=0
if [ ! -z ${3} ]; then
YPOS=${3}
fi
local REPEAT=1
if [ ! -z ${4} ]; then
REPEAT=${4}
fi
local BUTTON=1
if [ ! -z ${5} ]; then
BUTTON=${5}
fi
local DELAY=300
if [ ! -z ${6} ]; then
DELAY=${6}
fi
xdotool ${7} mousemove --sync --window ${1} ${XPOS} ${YPOS} \
click --delay ${DELAY} --repeat ${REPEAT} ${BUTTON} ${8}
idler_sleep 0.${DELAY}
rm -f .xdotool${DISPLAY:1}-${HOSTNAME}.lock
}
# check pid and swap space
export WINEDEBUG=-all
export WINEDLLOVERRIDES=mshtml,crashhandler,msi,winedbg.exe,services.exe,winedevice.exe,plugplay.exe,winemenubuilder.exe=d
idler_login()
{
if steam_pid > /dev/null; then
return 0
elif (($(free_swap)<400)); then
tprint "${ACCT}: error, not enough swap" $(free_swap)mb
return 2
fi
# download package manifests once per invocation
mkdir -p steam/appcache steam/depotcache steam/music steam/vr steam/package \
${APPS}/workshop ${APPS}/sourcemods
if [ -z "${PACKAGE}" ]; then
local PACKAGE=media.steampowered.com/client/steam_
if ! download ${PACKAGE}client_win32 steam/package/steam_client_win32.manifest \
|| ! download ${PACKAGE}cmd_linux steam/package/steam_cmd_linux.manifest; then
tprint "${ACCT}: error, cannot download package manifest(s)..."
return 1
fi
# download/replace then extract steam package files with invocation block
for ZIP in $(grep file steam/package/*.manifest | awk '{print $3}'); do
if [ ! -e steam/package/${ZIP:1:(-1)} ]; then
local ZIPS="${ZIPS} ${ZIP:1:(-1)}"
let local UI_SIZE+=$(cat steam/package/*.manifest \
| sed "0,/${ZIP}/d" | grep -m1 size | grep -o \[0-9]*)
fi
done
if [ ! -z "${ZIPS}" ] && block_on_file steam/.package yes; then
tprint "downloading/extracting "$(echo ${ZIPS} | wc -w)" packages..." \
$(echo $((UI_SIZE/1000)))kb
for ZIP in ${ZIPS}; do
rm -f ${ZIP%.zip.*}.zip.*
download media.steampowered.com/client/${ZIP} steam/package/${ZIP}
while ! unzip -o steam/package/${ZIP} -d steam > /dev/null; do
tprint "warning, redownloading corrupt ui package" ${ZIP:0:(-42)}
download media.steampowered.com/client/${ZIP} steam/package/${ZIP}
done
done
# add extra logs and client urls, then remove lock
touch steam/debug.log steam/GameValidation.log steam/GameOverlayRenderer.log
if ! grep -q pdl-idler steam/public/url_list.txt; then
cat steam/public/url_list.txt pdl-idler_url.list \
| tee steam/public/url_list.txt > /dev/null
fi
rm steam/.package-${HOSTNAME}.lock
fi
fi
# (re)link client extractions inside prefix
mkdir -p ${STEAM}
if [ $(steam_ui_version) != $(steam_ui_cache_version) ]; then
find ${STEAM} -maxdepth 1 -type l -exec rm -f {} \;
find steam/ -mindepth 1 -maxdepth 1 -not -name steamapps \
-exec ln -sf "${PWD}"/{} ${STEAM} \;
steam_ui_cache_version > wine-${ACCT}/.ui.pdl
fi
# (re)make and/or link config.vdf and guard key
mkdir -p ${LOGS} ${CONFIG} ${USERDATA%/}
ln -sfn "${PWD}"/${CONFIG} ${STEAM}/config
ln -sfn "${PWD}"/${LOGS} ${STEAM}/logs
ln -sfn "${PWD}"/${USERDATA%/} ${STEAM}/userdata
if [ ! -e ${CONFIG}/config.vdf ]; then
{
echo "\"InstallConfigStore\"{\"Software\"{\"Valve\"{\"Steam\"{"
echo "\"SentryFile\"\"c:\\\\Steam\\\\ssfn-${ACCT}\""
echo "\"SurveyDate\"\"2050-01-01\"}}}"
echo -e "\"Music\"{\"CrawlSteamInstallFolders\"\"0\"}\n}"
} > ${CONFIG}/config.vdf
fi
if [ ! -e share/${ACCT}/ssfn ]; then
if [ -e share/ssfn ]; then
cp share/ssfn share/${ACCT}/ssfn
else
dd if=/dev/urandom of=share/${ACCT}/ssfn bs=2k count=1 > /dev/null 2>&1
fi
fi
ln -sf "${PWD}"/share/${ACCT}/ssfn ${STEAM}/ssfn-${ACCT}
# change display if creating, or prep login prompt, then start X
if [ ! -z ${EMAIL} ] && [ -z ${SUID} ]; then
local OLD_DISPLAY=${DISPLAY}
export DISPLAY=:99
else
echo '"SteamAppData"{"RememberPassword""1""AutoLoginUser""'${ACCT}'"}' \
> ${CONFIG}/SteamAppData.vdf
fi
for DISPLAY in ${OLD_DISPLAY} ${DISPLAY}; do
if ! xserver_pid ${DISPLAY} > /dev/null; then
if [ ${DISPLAY} != :0 ]; then
tprint "starting Xvfb..." ${DISPLAY}
screen -dmS idler-X${DISPLAY:1}$ Xvfb ${DISPLAY} -screen 0 800x600x24
else
tprint "starting X..." ${DISPLAY}
screen -dmS idler-X${DISPLAY:1}$ \
xinit -geometry =40x40+9999+0 -- ${DISPLAY}
fi
while ! xserver_pid ${DISPLAY} > /dev/null; do
idler_sleep 1
if ! pgrep -f SCREEN.*idler-X${DISPLAY:1} > /dev/null; then
tprint "error: could not start display server" ${DISPLAY}
return 2
fi
done
fi
# optionally start x11vnc with or without password
if [ "${X_X11VNC}" != no ] && [ ${DISPLAY} != :99 ] \
&& ! pgrep -fn x11vnc.*display\ ${DISPLAY} > /dev/null; then
if [ "${X_X11VNC}" = yes ] || [ ${DISPLAY} != :0 ]; then
if ! which x11vnc > /dev/null 2>&1; then
tprint "warning, x11vnc is not installed"
unset X_X11VNC
else
if [ ! -z ${X_X11VNC_PASS} ]; then
rm -f .vnc_passwd
x11vnc -storepasswd ${X_X11VNC_PASS} "${PWD}"/.vnc_passwd 2> /dev/null
local RFBA="-rfbauth ${PWD}/.vnc_passwd"
fi
tprint "starting x11vnc..." \
${DISPLAY},@$(xserver_pid ${DISPLAY}),v$(x11vnc -V | awk '{print $2}')
screen -dmS idler-Xvnc${DISPLAY:1}$ x11vnc -display ${DISPLAY} -forever ${RFBA}
fi
fi
fi
done
# structure account wine prefix
rm -f wine-${ACCT}/_*_lo*.reg wine/users/${USER}/My\ Documents 2> /dev/null
local MODE=hi
if [[ "${1}" = *lo* ]]; then
local MODE=lo
fi
mkdir -p wine/Program\ Files_${MODE} wine/windows_${MODE} \
wine-${ACCT}/dosdevices wine/users/${USER}/My\ Documents
ln -sfn ../drive_c wine-${ACCT}/dosdevices/c:
ln -sfn / wine-${ACCT}/dosdevices/z:
ln -sfn "${PWD}"/wine/users wine-${ACCT}/drive_c/users
ln -sfn "${PWD}"/wine/windows_${MODE} wine-${ACCT}/drive_c/windows
ln -sfn "${PWD}"/wine/Program\ Files_${MODE} \
wine-${ACCT}/drive_c/Program\ Files
ln -sf "${PWD}"/wine-${ACCT}/._update-timestamp_${MODE} \
wine-${ACCT}/.update-timestamp
WINEINF=$(stat -c %Y /usr/share/wine/wine.inf)
WINEINF_UPDATE={CP},
for REG in user_${MODE} userdef_${MODE} system_${MODE}; do
if [ ! -e wine-${ACCT}/_${REG}.reg ]; then
if [ -e wine/${REG}.${WINEINF} ]; then
cp wine/${REG}.${WINEINF} wine-${ACCT}/_${REG}.reg
else
local BACKUP="${BACKUP} ${REG} "
echo "WINE REGISTRY Version 2" > wine-${ACCT}/_${REG}.reg
rm -f wine/${REG}
echo 0 > wine-${ACCT}/._update-timestamp_${MODE}
unset WINEINF_UPDATE
fi
elif [ ${REG} = system_${MODE} ]; then
unset WINEINF_UPDATE
fi
ln -f wine-${ACCT}/_${REG}.reg wine-${ACCT}/${REG//_*}.reg
done
if [ ! -z ${WINEINF_UPDATE} ]; then
echo ${WINEINF} > wine-${ACCT}/._update-timestamp_${MODE}
fi
# create/upgrade wine prefix data and make backup files
if [ $(cat wine-${ACCT}/.update-timestamp) != ${WINEINF} ]; then
tprint "${ACCT}: prepping wine data..." ${WINEINF}_${MODE}
WINEARCH=win32 wineboot > /dev/null 2>&1
for ZIP in Music Pictures Videos; do
ln -sfn "${PWD}"/wine/users/${USER}/My\ Documents \
wine/users/${USER}/My\ ${ZIP}
done
regedit pdl-idler_registry.reg > /dev/null 2>&1
fi
if [ ! -z "${BACKUP}" ]; then
tprint "${ACCT}: making registry backup..." ${MODE}_${WINEINF}
wineserver -w
for REG in ${BACKUP}; do
if [ ! -e wine/${REG}.${WINEINF} ]; then
cp wine-${ACCT}/_${REG}.reg wine/${REG}.${WINEINF}
fi
done
fi
# initiate steam launch or reset creation display
LOGIN=yes
if [ -e ${STEAM}/.crash ]; then
local CRASH=${y}/C/${l},
fi
tprint "${ACCT}: starting steam..." \
${CRASH}${MODE},${WINEINF_UPDATE}${REGEDIT}${DISPLAY},\$$(\
sha1sum share/${ACCT}/ssfn | cut -c1-4)+$(steam_connect_hash)
while ! steam_pid > /dev/null; do
if [ ! -z ${F2P} ]; then
export DISPLAY=${OLD_DISPLAY}
fi
# block and check/update tf2 with steamcmd
steam_ids
if [ ! -z ${SCID} ]; then
if [ -z ${TF2_VER} ]; then
block_on_file steam/.steamapps
TF2_VER=$(wget -qO- api.steampowered.com/IGCVersion_440/GetClientVersion/v1 \
| grep -m1 version | grep -o \[0-9]*)${STEAMCMD}
if [ -z ${TF2_VER} ]; then
tprint "${ACCT}: error, cannot obtain tf2 version..."
return 1
elif ! grep -q ClientVersion=${TF2_VER} "${TF}"/steam.inf 2> /dev/null; then
check_steamcmd_app 440 "+login ${ACCT} ${PASS}" \
+@sSteamCmdForcePlatformType\ windows
fi
# extract/link farm resources
if [ "$(cat "${TF}"/pdl/farm/ver 2> /dev/null)" != $(app_version 440)a ]; then
tprint "constructing farm resources..." farm-v$(app_version 440)a
chmod 700 "${TF}"/pdl/farm/streams 2> /dev/null
rm -fr "${TF}"/pdl/farm
mkdir -p "${TF}"/pdl/farm/cfg "${TF}"/pdl/farm/materials/vgui/hud \
"${TF}"/pdl/farm/scripts/items "${TF}"/pdl/farm/streams
chmod 000 "${TF}"/pdl/farm/streams
ln -sf "${PWD}"/"${TF}"/maps "${TF}"/pdl/farm
ln -sf "${PWD}"/"${STF}"/addons "${TF}"/pdl/farm
echo -e "exec \"autoexec\"\nstuffcmds" > "${TF}"/pdl/farm/cfg/valve.rc
vpk_extract "${TF}"/../hl2/hl2_textures "${TF}"/pdl/farm \
materials/console/startup_loading.vtf
cp "${TF}"/pdl/farm/materials/console/startup_loading.vtf \
"${TF}"/pdl/farm/materials/console/background01.vtf
echo '"UnlitGeneric"{"$basetexture""console/startup_loading"}' \
> "${TF}"/pdl/farm/materials/console/startup_loading.vmt
for RES in 800corner 800corner1 800corner2 800corner3 800corner4; do
echo '"UnlitGeneric"{"$basetexture""vgui/hud/'${RES}'"}' \
> "${TF}"/pdl/farm/materials/vgui/hud/${RES}.vmt
done
for RES in clientscheme gamemenu loadingdialog sourcescheme \
loadingdialognobanner modevents ui/charinfoarmorysubpanel \
ui/charinfoloadoutsubpanel ui/charinfopanel ui/craftingpanel \
ui/craftingstatusdialog ui/econ/itempickuppanel \
ui/econ/itemdiscardpanel ui/econ/store/v1/storestatusdialog \
ui/hudalert ui/hudbosshealth ui/huditemattributetracker \
ui/selectmosthelpfulfrienddialog ui/targetid \
ui/hudpasstimeballstatus ui/hudpasstimepassnotify \
ui/quests/questitempanel_base ui/lobbycontainerframe \
ui/lobbycontainerframe_casual ui/lobbycontainerframe_comp \
ui/lobbycontainerframe_mvm ui/lobbypanel ui/lobbypanel_casual \
ui/lobbypanel_comp ui/lobbypanel_mvm ui/matchmakingpanel \
ui/matchmakinggrouppanel ui/pvpcasualrankpanel ui/pvpcomprankpanel \
ui/pvprankpanel; do
FILES="${FILES}resource/${RES}.res "
done
vpk_extract "${TF}"/tf2_misc "${TF}"/pdl/farm ${FILES} \
scripts/objects.txt scripts/dsp_presets.txt \
scripts/items/paintkits_master.txt \
models/vgui/12v12_badge.mdl models/vgui/competitive_badge.mdl
echo "precache{}" > "${TF}"/pdl/farm/scripts/client_precache.txt
ln -sf "${PWD}"/"${TF}"/../hl2/resource/gameui_english.txt \
"${TF}"/pdl/farm/resource/gameui_english.txt
echo "\"Resource/UI/MainMenuOverride.res\"{MainMenuOverride{}}" \
> "${TF}"/pdl/farm/resource/ui/mainmenuoverride.res
for RES in game_sounds soundscapes surfaceproperties; do
echo "${RES}_manifest{}" > "${TF}"/pdl/farm/scripts/${RES}_manifest.txt
done
touch "${TF}"/pdl/farm/scripts/soundmixers.txt
ln -sf "${PWD}"/"${TF}"/scripts/items/items_game.txt \
"${TF}"/pdl/farm/scripts/items/items_game.txt
ln -sf "${PWD}"/"${TF}"/scripts/items/items_game.txt.sig \
"${TF}"/pdl/farm/scripts/items/items_game.txt.sig
vpk_extract "${TF}"/../hl2/hl2_misc "${TF}"/pdl/farm \
shaders/psh/unlitgeneric.vcs shaders/vsh/unlitgeneric_vs11.vcs \
models/error.dx80.vtx models/error.dx90.vtx models/error.mdl \
models/error.sw.vtx models/error.vvd resource/hltvevents.res \
resource/replayevents.res resource/serverevents.res
ln -sf "${PWD}"/"${TF}"/steam.inf "${TF}"/pdl/farm
for WEP in $(wine "${TF}"/../bin/vpk.exe l \
"${TF}"/tf2_misc_dir.vpk 2> /dev/null | grep tf_weapo | sed 's/\r$//'); do
local WEPS="${WEPS}${WEP} "
done
for WAV in $(wine "${TF}"/../bin/vpk.exe l \
"${TF}"/tf2_sound_misc_dir.vpk 2> /dev/null \
| grep ui/item_.*_"\(drop\|pickup\)".wav | sed 's/\r$//'); do
local WAVS="${WAVS}${WAV} "
done
for ARRAY in misc@"${WEPS}" sound_misc@"${WAVS}"; do
VPK_FILE=${ARRAY%%@*}
ARRAY=(${ARRAY#*@})
vpk_extract "${TF}"/tf2_${VPK_FILE} "${TF}"/pdl/farm \
${ARRAY[@]:0:$((${#ARRAY[@]}/4))}
vpk_extract "${TF}"/tf2_${VPK_FILE} "${TF}"/pdl/farm \
${ARRAY[@]:$((${#ARRAY[@]}/4)):$((${#ARRAY[@]}/4))}
vpk_extract "${TF}"/tf2_${VPK_FILE} "${TF}"/pdl/farm \
${ARRAY[@]:$((${#ARRAY[@]}/2)):$((${#ARRAY[@]}/4))}
vpk_extract "${TF}"/tf2_${VPK_FILE} "${TF}"/pdl/farm \
${ARRAY[@]:$((${#ARRAY[@]}/2+${#ARRAY[@]}/4)):$((${#ARRAY[@]}))}
done
vpk_extract "${TF}"/tf2_sound_misc "${TF}"/pdl/farm \
sound/ui/notification_alert.wav
mv "${TF}"/pdl/farm/sound/ui/notification_alert.wav \
"${TF}"/pdl/farm/sound/ui/item_notify_drop.wav
cp "${TF}"/pdl/farm/sound/ui/item_bag_pickup.wav \
"${TF}"/pdl/farm/sound/ui/item_boxing_gloves_drop.wav
cp "${TF}"/pdl/farm/sound/ui/item_cardboard_pickup.wav \
"${TF}"/pdl/farm/sound/ui/item_cardboard_drop.wav
cp "${TF}"/pdl/farm/sound/ui/item_default_pickup.wav \
"${TF}"/pdl/farm/sound/ui/item_leather_pickup.wav
cp "${TF}"/pdl/farm/sound/ui/item_metal_scrap_pickup.wav \
"${TF}"/pdl/farm/sound/ui/item_medal_pickup.wav
cp "${TF}"/pdl/farm/sound/ui/item_mtp_drop.wav \
"${TF}"/pdl/farm/sound/ui/item_sandwich_drop.wav
cp "${TF}"/pdl/farm/sound/ui/item_soda_can_pickup.wav \
"${TF}"/pdl/farm/sound/ui/item_watch_drop.wav
# alter select vgui properties 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/ \
"${TF}"/pdl/farm/resource/ui/selectmosthelpfulfrienddialog.res
sed -i -e s/buttonclick.wav/craftingstatusdialog.wav/ \
-e 's/\t\t"CraftingStatusDialog"/&\n"wide""800""tall""600"/' \
-e 's/\t\t"CloseButton"/&\n"ypos""0""wide""640""tall""640"/' \
"${TF}"/pdl/farm/resource/ui/craftingstatusdialog.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/ \
"${TF}"/pdl/farm/resource/ui/econ/store/v1/storestatusdialog.res
sed -i -e /buttonclick.wav/d \
-e 's/\t\t"CloseButton"/&\n"ypos""0""tall""600""wide""800"/' \
"${TF}"/pdl/farm/resource/ui/econ/itempickuppanel.res
echo $(app_version 440)a > "${TF}"/pdl/farm/ver
fi
# check/update tf2 server and item data, link farm, then install addons
if [ "$(grep -om1 ${STEAMCMD}\[0-9]* "${TF}"/steam.inf)" \
!= "$(grep -om1 \[0-9]* "${STF}"/steam.inf 2> /dev/null)" ]; then
check_steamcmd_app 232250 "+login anonymous"
sed -n '/^\t"items"/,/^\t"attributes"/{/^\t"attributes"/!p}' \
"${TF}"/scripts/items/items_game.txt > "${SMOD}"/configs/items.kv
fi
ln -sfn "${PWD}"/"${TF}"/pdl "${STF}"/pdl
MS=http://www.gsptalk.com/mirror/sourcemod/mmsource-1.10.6
if [ ! -e "${STF}"/addons/${MS##*/}-linux.tar.gz ]; then
tprint "installing/updating metamod:source..." v${MS/*mmsource-}
mkdir -p "${STF}"/addons
rm -fr "${STF}"/addons/mmsource-*.tar.* "${STF}"/addons/metamod/bin
download ${MS}-linux.tar.gz "${STF}"/addons || exit 1
tar -xzf "${STF}"/addons/${MS##*/}-linux.tar.gz -C "${STF}"
echo '"Plugin"{"file""../tf/addons/metamod/bin/server"}' \
> "${STF}"/addons/metamod.vdf
fi
SM=http://sourcemod.net/smdrop/1.7/sourcemod-1.7.3-git5321
if [ ! -e "${STF}"/addons/${SM##*/}-linux.tar.gz ]; then
tprint "installing/updating sourcemod..." v${SM/*sourcemod-}
rm -fr "${STF}"/addons/sourcemod-*.tar.* "${SMOD}" "${STF}"/cfg/sourcemod
download ${SM}-linux.tar.gz "${STF}"/addons || exit 1
tar -xzf "${STF}"/addons/${SM##*/}-linux.tar.gz -C "${STF}"
mv "${SMOD}"/plugins/*.smx "${SMOD}"/plugins/disabled
mv "${SMOD}"/extensions/dbi.*.ext.so "${SMOD}"/plugins/disabled
mv "${SMOD}"/plugins/disabled/basecommands.smx "${SMOD}"/plugins
sed -i -e "s/Logging\"\t\t\"o[fn]*\"/Logging\"\t\t\"off\"/" \
"${SMOD}"/configs/core.cfg
fi
if [ ! -d "${SMOD}"/plugins/SourceIRC ]; then
tprint "installing sourceirc..." sircD
if [ ! -e "${STF}"/sourceirc.zip ]; then
OPTS=jenkins.azelphur.com/job/SourceIRC/lastSuccessfulBuild/artifact
download http://${OPTS}/sourceirc.zip "${STF}"/sourceirc.zip || exit 1
fi
if [ ! -e "${STF}"/socket_3.0.1.zip ]; then
download dropbox.com/s/kcwuii9g80xkdya/socket_3.0.1.zip?dl=0 \
"${STF}"/socket_3.0.1.zip || exit 1
fi
unzip -d "${SMOD}" -o "${STF}"/sourceirc.zip > /dev/null
unzip -d "${STF}" -o "${STF}"/socket_3.0.1.zip > /dev/null
mv "${SMOD}"/plugins/SourceIRC/* "${SMOD}"/plugins/disabled
mv "${SMOD}"/configs/sourceirc.cfg "${SMOD}"/configs/sourceirc.cfg.def
sed -i -e "s/RegCmd\");/&\n\tMarkNativeAsOptional(\"IRC_MsgFlaggedChannels\");/" \
"${SMOD}"/scripting/include/sourceirc.inc
fi
# remove apps block, then turn off app updating
rm -f steam/.steamapps-${HOSTNAME}.lock
fi
sed -i -e "s/UpdateBehavior\"\t\t\".\"/UpdateBehavior\"\t\t\"1\"/" \
${APPS}/appmanifest_*.acf
# create apps and tf2 client directory structure and files
if [ -z ${CLIENT} ]; then
for LOC in steamapps common Team\ Fortress\ 2 tf; do
local BASE="${BASE}"/"${LOC}"
rm -fr ${STEAM}"${BASE}"
mkdir -p ${STEAM}"${BASE}"
ln -sfn "${PWD}"/steam"${BASE}"/* ${STEAM}"${BASE}"
done
rm -f "${TF}"/cfg/banned_ip.cfg ${STEAM}/steamapps/appmanifest_232250.acf
mkdir -p "${ATF}"/pdl-${ACCT}/cfg
echo -e "cl_voice_filter \"\"\nsetinfo name \"\"" \
> "${ATF}"/pdl-${ACCT}/cfg/audible.cfg
echo > "${PWD}"/${CON}
ln -sf "${PWD}"/${CON} "${ATF}"/pdl-${ACCT}/console.log
ln -sf "${PWD}"/pdl-idler_autoexec.cfg "${ATF}"/pdl-${ACCT}/cfg/autoexec.cfg
OPTS="\t\t|gameinfo_path|.\r\nmod+mod_write+default_write_path\t\ttf\/pdl-${ACCT}"
sed -i -e "s/+mod_write+default_write_path\t\t|gameinfo_path|./${OPTS}/" \
"${ATF}"/gameinfo.txt
while [ -z ${LISTEN} ]; do
local CLIENT=28$(printf "%03d\n" $(shuf -i 200-599 -n 1))
if ! steam_pid -${CLIENT} > /dev/null; then
local LISTEN=$((CLIENT+1))
fi
done
{
unset DLLS
STREAMING=1
GRAPHICS="-dxlevel 95 -w 1366 -h 768"
FPS=132
if [ ${MODE} = lo ]; then
DLLS=${2}${WINEDLLOVERRIDES:0:(-2)},appoverlay,dwrite,gameoverlayui
DLLS=${DLLS},gameoverlayrenderer,steamservice.exe,steamwebhelper.exe
STREAMING=0
GRAPHICS="-dxlevel 50 -w 640 -h 480 -nod3d9ex"
FPS=30
echo "cl_disablehtmlmotd 1"
fi
echo "alias _acmd \"exec banned_ip;wait $((${FPS}*4));_acmd\""
echo "_acmd;_amove;_mping"
echo "clientport \"${CLIENT}\""
echo "fps_max \"${FPS}\""
} > "${ATF}"/pdl-${ACCT}/cfg/${ACCT//./}+.cfg
fi
# reset ssfn from steamcmd and/or migrate new file
if grep -q ssfn[0-9]*\" ${CONFIG}/config.vdf && [ -e ${STEAM}/ssfn[0-9]* ]; then
tprint "${ACCT}: warning, migrated ssfn file" $(date +%s)
mv share/${ACCT}/ssfn share/${ACCT}/ssfn.$(date +%s) 2> /dev/null
mv ${STEAM}/ssfn[0-9]* share/${ACCT}/ssfn
fi
sed -i -e 's/.*SentryFile.*/"SentryFile""C\:\\\\Steam\\\\ssfn-'${ACCT}\"/ \
${CONFIG}/config.vdf
# (re)set local steam/tf2 settings
mkdir -p ${USERDATA}/${SCID}/440/remote ${USERDATA}/${SCID}/config \
${USERDATA}/${SCID}/760/remote/440/screenshots/thumbnails
cat pdl-idler_localconfig.vdf ${LCONFIG} > lcfg.tmp
mv lcfg.tmp ${USERDATA}/${SCID}/config/localconfig.vdf
LAUNCH="${COMMON_OPTS} ${GRAPHICS} -nocrashdialog -nojoy -nomessagebox"
LAUNCH="${LAUNCH} -novid -port ${LISTEN} -sw +exec ${ACCT//./}+"
sed -i -e "s/PersonaStateDesired\"\s*\"[0-9]/PersonaStateDesired\"\"0/" \
-e "/LaunchOptions.*nojoy/ s/^.*$/\"LaunchOptions\" \"${LAUNCH}\"/" \
-e "s/EnableStreaming\"\s*\"[0-9]/EnableStreaming\"\"${STREAMING}/" \
-e "/ShowAvatars/d" ${LCONFIG}
# embed screenshot file and entry for socialize
if [ ! -e ${USERDATA}/${SCID}/760/screenshots.vdf ]; then
if [ ! -s share/primarydataloop.jpg ]; then
download http://i.imgur.com/4kNwKCP.jpg share/primarydataloop.jpg
fi
ln -sf "${PWD}"/share/primarydataloop.jpg \
${USERDATA}/${SCID}/760/remote/440/screenshots
ln -sf "${PWD}"/share/primarydataloop.jpg \
${USERDATA}/${SCID}/760/remote/440/screenshots/thumbnails
{
echo '"Screenshots"{"440"{"0"{"imported""1"'
echo '"filename""440/screenshots/primarydataloop.jpg"'
echo '"thumbnail""440/screenshots/thumbnails/primarydataloop.jpg"'
echo '"width""200""height""150""gameid""440"'
echo '"creation""1234567890""caption""""permissions""2"'
echo '"hscreenshot""18446744073709551615"}}}'
} > ${USERDATA}/${SCID}/760/screenshots.vdf
fi
# preemptively start server if farm login
if [ ! -z ${3} ]; then
start_server
fi
fi
# reset crash file, then start steam
rm -f ${STEAM}/.crash
WINEDLLOVERRIDES=${DLLS}=d screen -dmS idler-${ACCT}$ \
wine C:/Steam/steam.exe -${ACCT} -console -${CLIENT} ${MODE}_${DISPLAY} \
-single_core -noverifyfiles -silent -language english -no-cef-sandbox \
steam://friends/settings/showavatars
while true; do
# get authentication state, then restart/fail if no pid
auth_state > /dev/null
if ! steam_pid > /dev/null; then
if [ ! -z ${AUTH} ] && [ "${AUTH_ERROR}" != 3 ]; then
let local AUTH_ERROR+=1
tprint "${ACCT}: warning, auth error retry..." \
x${AUTH_ERROR},$(steam_connect_hash)
elif [ -z ${LOGOUT_TIMEOUT} ]; then
if [ ! -z ${AUTH} ]; then
tprint "${ACCT}: error, auth error failure..." $(steam_connect_hash)
elif [ ! -z ${ERROR} ]; then
tprint "${ACCT}: error, steam server problem"
elif [ ! -z ${CRED} ]; then
tprint "${ACCT}: error, user canceled login"
else
tprint "${ACCT}: error, unknown launch failure"
fi
idler_logout
return 1
fi
unset LOGOUT_TIMEOUT
continue 2
# if greeting window arrives, create account, then alter conf
elif [ -z ${AUTH}${GUARD}${CRED}${F2P} ] \
&& window_id \"Steam\" _WM_STATE\(ATOM\) > /dev/null \
&& xprop -id ${WID} | grep -q 432\ by; then
local F2P=${WID}
tprint "${ACCT}: filling fields..." "" "" 1
for PRESS in {1..3}; do
printf ${PRESS}
key_press ${WID} Return 500
done
printf a
type_input ${WID} ${ACCT} ""
printf p
key_press ${WID} Tab
type_input ${WID} ${PASS} ""
while ! grep -q MsgClientLogOnResp.*OK ${LOGS}/connection_log.txt; do
idler_sleep 1
done
printf c
key_press ${WID} Tab 3000
type_input ${WID} ${PASS} ""
idler_sleep 1
key_press ${WID} Return
while ! grep -q AsyncDisconnect ${LOGS}/connection_log.txt; do
if ! window_id "Create a Steam" > /dev/null; then
echo
tprint "${ACCT}: error, bad password/server, deleting..."
idler_delete yes > /dev/null
return 1
fi
idler_sleep 0.3
done
printf e
type_input ${WID} ${EMAIL}
key_press ${WID} Tab
printf m
type_input ${WID} ${EMAIL}
echo
tprint "${ACCT}: creating account..." ${SECRET},$(steam_memory)
key_press ${WID} Return
while ! window_id Working > /dev/null; do
idler_sleep 0.5
done
while window_id Working > /dev/null; do
if grep -q Operation\ Failed.*OK ${LOGS}/connection_log.txt; then
tprint "${ACCT}: warning, i/o operation problem..."
idler_logout yes no > /dev/null
fi
idler_sleep 1
done
while window_id Create opacity -v > /dev/null; do
key_press ${WID} Return 1000
done
rm -fr ${USERDATA}/anonymous ${USERDATA}/????? ${USERDATA}/??????
sed -i -e "s/#${EMAIL}//" share/pdl-idler.conf 2> /dev/null
# wait for authentication
elif [ -z ${AUTH} ] && [[ ${AUTH_STATE} = *\'OK\'* ]]; then
local AUTH=$(steam_cellid)\|$(steam_auth_server)
close_window "${GUARD}" no no Return
tprint "${ACCT}: authenticated..." ${RETRY}${CRED}${AUTH//.},$(steam_memory)
# if guard window arrives, prompt for guard code entry
elif [ -z ${AUTH}${GUARD} ] && window_id Guard > /dev/null; then
echo -e "read -n 5 -d + -e -t 90 INPUT && echo \${INPUT} || echo _" \
> wine-${ACCT}/passwd-${ACCT}.sh
{
while ! auth_state > /dev/null && steam_pid > /dev/null; do
sleep 1
done
if pgrep -f bash.*passwd-${ACCT}.sh > /dev/null; then
kill -1 $(pgrep -f bash.*passwd-${ACCT}.sh)
echo
fi
} &
PASSWD_PID=$!
tprint "${ACCT}: input guard code:" @${PASSWD_PID},$(steam_memory) "" 1
INPUT=$(bash wine-${ACCT}/passwd-${ACCT}.sh)
{ kill ${PASSWD_PID} && wait ${PASSWD_PID}; } 2> /dev/null
if [ "${INPUT}" = _ ]; then
echo
tprint "${ACCT}: error, guard timeout" @${PASSWD_PID},$(steam_memory)
idler_logout > /dev/null
return 1
elif [ ! -z ${INPUT} ]; then
key_press ${WID} Tab\ Return
type_input ${WID} ${INPUT}
key_press ${WID} Return
fi
local GUARD=${WID}
elif [[ ${AUTH_STATE} = *Auth\ Code* ]] \
|| [[ ${AUTH_STATE} = *code\ mismatch* ]]; then
unset GUARD
# input password if login window arrives
elif [ -z ${AUTH}${CRED} ] && window_id Login > /dev/null; then
local CRED=${y}/P/${l}
type_input ${WID} ${PASS}
key_press ${WID} Return
elif [[ ${AUTH_STATE} = *Limit\ Exceed* ]]; then
tprint "${ACCT}: error, hit password limit" $(steam_memory)
idler_logout > /dev/null
return 1
elif [[ ${AUTH_STATE} = *Invalid\ Pass* ]]; then
let local RETRY+=1
if [ ${RETRY} = 3 ]; then
tprint "${ACCT}: error, bad pass/server" $(steam_memory)
idler_logout > /dev/null
return 1
fi
unset CRED
# if there is no connection, wait then retry
elif window_id Connection\ Error > /dev/null; then
tprint "${ACCT}: warning, offline wait/retry..." 60s,$(steam_memory)
idler_logout yes no > /dev/null
idler_sleep 60 > /dev/null
# close miscellaneous error windows
elif [ -z ${ERROR} ] && window_id Steam\ -\ Error > /dev/null; then
local ERROR=${y}*er*${l},
close_window ${WID}
elif [ -z ${WARNING} ] && window_id Warning > /dev/null; then
local WARNING=${y}*wn*${l},
key_press ${WID} Return
# wait until logged in
elif ! grep -q ShowAvatars ${LCONFIG} 2> /dev/null; then
idler_sleep 1
else
break
fi
done
# bypass steam guard location notification
if window_id Guard\ Notification > /dev/null; then
tprint "${ACCT}: warning, guard location notify..." $(steam_memory)
close_window ${WID} no no
fi
# restart for initial configuration or finish
if ! grep -q LaunchOptions ${LCONFIG}; then
tprint "${ACCT}: restarting for configuration..." $(steam_memory)
idler_logout "" no > /dev/null
else
tprint "${ACCT}: logged in" ${ERROR}${WARNING}$(account_size),$(\
steam_connect_hash),@${SPID}/$(steam_memory)
unset LOGIN
fi
done
}
# check chatroom id variable and declare node chat code
CHATROOM=103582791435720285
prep_chat()
{
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=${CHATROOM}
fi
OPTS=$(cat << EOF
var enter_interval = 0;
while (1) {
var enter_index = log.indexOf('ENTER_', log_index-1);
if (enter_index = -1) {
break;
}
log_index = log.indexOf('__n', enter_index);
setTimeout(function(start, end) {
steam.sendMessage('${CHATROOM}', log.substring(start+6, end));
}, enter_interval*750, enter_index, log_index);
enter_interval++;
}
EOF
)
}
node_module_version()
{
# get version of installed node module
if ! grep -m 1 \"version\": steamnode/node_modules/$(echo ${1##*node-} \
| sed s/.git//)/package.json 2> /dev/null | grep -o \[0-9\.]*; then
echo none
fi
}
install_node_module()
{
# download and install specified node module with npm
local INSTALLED=$(node_module_version ${1})
local VERSION=${2}
if [ ! -e steamnode/node_modules/$(echo ${1##*node-} \
| sed s/.git//)/package.json ] || [ ${VERSION} != ${INSTALLED} ]; then
if [ -d ${HOME}/.npm ]; then
NPM=yes
fi
if [ ${INSTALLED} = none ]; then
tprint "installing node-${1##*node-}..." v${VERSION}
else
tprint "upgrading node-${1##*node-}..." v${INSTALLED}\>${VERSION}
fi
if [[ ${1} = git* ]]; then
VERSION=\#v${VERSION}
else
VERSION=@${VERSION}
fi
mkdir -p steamnode
cd steamnode
npm install ${1}${VERSION} > /dev/null 2>&1 || exit 1
cd ..
if [ -z ${NPM} ]; then
rm -fr ${HOME}/.npm ${HOME}/.node-gyp
fi
for NPM_DIR in /tmp/npm-*; do
if [ -d ${NPM_DIR} ] \
&& ! ps $(echo ${NPM_DIR:9} | sed "s/-.*//") | grep npm; then
rm -fr ${NPM_DIR}
fi
done
rm -f npm-debug.log
rmdir ${HOME}/tmp 2> /dev/null
fi
}
node_fake_appid()
{
# get game appids being faked by node
tac ${NODEJS} | grep -om 1 "gamesPlayed([\[0-9,]*\])" | grep -o \[0-9,]*
}
prep_node_login()
{
# check api key+ssfn, install node-steam, and prep script once per execution
if [ -z ${APIKEY} ]; then
tprint "error, web api key not set" steamcommunity.com/dev/apikey
return 1
elif [ ! -e share/${ACCT}/ssfn ]; then
tprint "${ACCT}: error, no ssfn file"
return 1
elif ! grep -q "\(exit, 4444\)" ${NODEJS} 2> /dev/null || [ ! -z ${1} ]; then
install_node_module ref 1.1.3
install_node_module steam 0.6.8
# check node server list
if [ -e steamnode/servers ] && [ ! -s steamnode/servers ]; then
tprint "${ACCT}: warning, reset empty node servers file"
rm steamnode/servers
fi
# wait for a previous execution to complete or suspend fake session
unset BREAK NODE_WAIT
if [ -e ${NODELOG} ]; then
while ! is_node_login_available; do
if [ -z ${NODE_WAIT} ]; then
if grep -q BREAK_FAKE ${NODELOG}; then
BREAK=$(node_fake_appid)
RELOGIN=re
stop_node_login > /dev/null
else
NODE_WAIT=yes
tprint "${ACCT}: warning, waiting on prior node finish..." \<60sec
fi
fi
idler_sleep 1
done
fi
# make account specific web script
touch ${NODEJS}
cat << EOF > ${NODEJS}
//${HOSTNAME}
//@$$
var broken = 0, counter = 0, exit_action, exit_retry, exit_timeout,
exiting = 2, first_line, fs = require('fs'), logged_on, Steam = require(
'${PWD}/steamnode/node_modules/steam'), steam = new Steam.SteamClient(),
util = require('util'), log_index = 0;
require('${PWD}/steamnode/node_modules/ref');
function exit(value) {
if (exiting == 2) {
if (logged_on) {
steam.gamesPlayed([]);
steam.logOff();
}
console.error('EXIT');
if (!first_line) {
util.print('\n');
}
process.exit(value);
} else {
exiting = 1;
}
}
process.on('SIGINT', function() {
console.error('SIGINT');
exit(0);
});
process.on('SIGTERM', function() {
console.error('SIGTERM');
exit(0);
});
setInterval(function() {
var log = fs.readFileSync('${NODELOG}', 'utf8');
if (log.indexOf('QUIT') > -1) {
exit(0);
}
${2}
counter++;
if (counter == 4) {
time = Math.round((new Date()).getTime() / 1000);
fs.utimesSync('${NODELOG}', time, time);
counter = 0;
}
}, 5000);
if (fs.existsSync('steamnode/servers')) {
Steam.servers = JSON.parse(fs.readFileSync('steamnode/servers'));
}
function pad(i) {
return (i < 10) ? "0" + i : "" + i;
}
function tprint(line, first) {
if (!broken) {
var date = new Date();
var prefix = '[' + pad(date.getHours().toString()) + ':'
+ pad(date.getMinutes().toString()) + ':'
+ pad(date.getSeconds().toString()) + '] ' + process.argv[2] + ': ';
if (first_line === undefined) {
first_line = 0;
line = prefix + line;
}
if (!first_line) {
if (!first) {
first_line = 1;
util.print('\n');
} else {
if (first == 2) {
first_line = 1;
line += '\n';
}
util.print(line);
return 0;
}
}
if (first_line) {
console.log(prefix + line);
}
}
}
function exitTimeout() {
if (!exit_retry) {
tprint('error, node action "' + exit_action + '" timed out {!}');
} else {
tprint('warning, node action "' + exit_action + '" timed out {*}');
}
console.error('FAIL' + exit_retry);
exit(1);
}
function setExitTimeout(time, action, retry) {
exit_timeout = setTimeout(exitTimeout, time);
exit_action = action;
exit_retry = retry;
}
setExitTimeout(30000, 'logon', 'RETRY');
function exitBreak(action, broke) {
if (!first_line) {
first_line = 1;
util.print('\n');
}
console.error('BREAK_' + action);
broken = broke;
}
tprint('${RELOGIN}logon... ', 1);
steam.logOn({
accountName: process.argv[2],
password: '${PASS}',
shaSentryfile: require('crypto').createHash('sha1').update(
fs.readFileSync('share/' + process.argv[2] + '/ssfn')).digest()
});
steam.on('servers', function(servers) {
fs.writeFile('steamnode/servers', JSON.stringify(servers));
if (exiting == 1) {
exiting = 2;
exit(1);
}
exiting = 2;
});
steam.on('loggedOn', function() {
if (!logged_on) {
exiting = 0;
logged_on = 1;
clearTimeout(exit_timeout);
setTimeout(exit, 4444);
}
});
steam.on('loggedOff', function() {
console.error('LOGOFF');
logged_on = 0;
});
steam.on('error', function(error) {
if (error.cause == 'logonFail') {
console.error('FAILLOGON_' + error.eresult);
}
exit(1);
});
EOF
unset RELOGIN
fi
}
prep_node_enter()
{
# enter chatroom
if ! grep -q joinChat ${NODEJS}; then
OPTS=$(cat << EOF
tprint('entering chatroom...'${2});
steam.joinChat('${1}');
EOF
)
sed -i -e "s/setTimeout(exit, 4444);/${OPTS//$'\n'/\\$'\n'}/g" ${NODEJS}
cat << EOF >> ${NODEJS}
steam.on('chatEnter', function(chatid, response) {
if (response != 1) {
tprint('error, chat entry failure code: ' + response + ' {!}');
console.error('FAIL');
exit(1);
}
setTimeout(exit, 4444);
});
EOF
fi
}
prep_node_http()
{
# use http requests to the web api
if ! grep -q http_opt ${NODEJS}; then
cat << EOF >> ${NODEJS}
var http = require('http');
var http_opt = { host: 'api.steampowered.com' };
EOF
fi
}
idler_fake()
{
# feign play activity for tf2 or specified underscore-seperated game appid(s)
local APPID=440
if [ ! -z ${1} ]; then
APPID=${1//-/,}
APPID=${1//_/,}
fi
if ! is_node_login_available && grep -q BREAK_FAKE ${NODELOG} \
&& [ $(node_fake_appid) != ${APPID} ]; then
stop_node_login > /dev/null
RELOGIN=re
fi
if is_node_login_available; then
prep_node_login ${2} || return 1
OPTS="tprint('faking play on ${APPID}...', 2);"
if [ ! -z ${BREAK} ]; then
OPTS="tprint('resumed faking play on ${APPID}...', 2);"
fi
OPTS="${OPTS}\nsteam.setPersonaState(Steam.EPersonaState.Busy);"
if [ ${APPID} != 440 ] || ! grep -q "\(\[440\]\)" ${NODEJS}; then
OPTS="${OPTS}\nsteam.gamesPlayed([${APPID}]);"
fi
sed -i -e "s/setTimeout(exit, 4444);/${OPTS}\n&/" ${NODEJS}
cat << EOF >> ${NODEJS}
steam.on('friendMsg', function(user, msg, status) {
if (status == Steam.EChatEntryType.ChatMsg) {
console.error(user + ': ' + msg)
}
});
EOF
FAKE=yes
return 0
elif [ $(node_fake_appid) != ${APPID} ]; then
tprint "${ACCT}: error, node action running"
fi
return 1
}
set_xfce_power()
{
# set xfce power manager ac suspend setting
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/inactivity-on-ac \
-s ${1}
DBUS_SESSION_BUS_ADDRESS=$(cat /proc/${XFCE_PID}/environ | tr '\0' '\n' \
| grep _SESSION_BUS_ADDRESS | cut -d '=' -f2-) xfce4-power-manager --restart
idler_sleep 1
DISPLAY=:0 xdotool mousemove $(shuf -i 0-800 -n 1) $(shuf -i 0-600 -n 1)
}
# deduce node binary
if node --help 2> /dev/null | grep -q script.js; then
NODE=$(which node)
elif which nodejs > /dev/null 2>&1; then
NODE=$(which nodejs)
else
tprint "fatal, node binary could not be found"
exit 1
fi
run_node_login()
{
# insert refake instruction and/or break (disabling pm), then execute script
if [ ! -z ${BREAK} ]; then
idler_fake ${BREAK}
fi
if [ ! -z ${FAKE} ] ; then
sed -i -e "s/setTimeout(exit, 4444);/exitBreak('FAKE', 1);/" ${NODEJS}
else
sed -i -e "s/setTimeout(exit, 4444);/exit(0);/" ${NODEJS}
fi
unset BREAK FAKE
${NODE} ${NODEJS} ${ACCT} 2> ${NODELOG} &
while ! pgrep -f "${NODE} ${NODEJS}" > /dev/null; do
idler_sleep 0.3
done
while pgrep -f "${NODE} ${NODEJS}" > /dev/null; do
if tac ${NODELOG} | grep -q ^BREAK; then
if tac ${NODELOG} | grep -q ^BREAK_[E-F]; then
disable_power_management
fi
return 0
fi
idler_sleep 1
done
touch -d "1 hour ago" ${NODELOG}
if grep -q ^FAILLOGON ${NODELOG}; then
tprint "${ACCT}: error, node steam login failure"
return 1
elif grep -q ^FAILRETRY ${NODELOG}; then
run_node_login
return $?
elif grep -q ^FAILCONTINUE ${NODELOG}; then
return 1
elif grep -q ^FAIL ${NODELOG} || grep -q ^SIGINT ${NODELOG}; then
return 2
elif grep -q Error: ${NODELOG}; then
cat ${NODELOG}
return 2
fi
}
player_items()
{
# get player item data from web api
ITEMS="http://api.steampowered.com/IEconItems_440/GetPlayerItems"
ITEMS="${ITEMS}/v0001?key=${APIKEY}&steamid=$(steam_uid ${ACCT})"
ITEMS=$(wget -qO- "${ITEMS}")
echo "${ITEMS}"
}
steam_name()
{
# get steam community profile name
echo $(grep PersonaName ${LCONFIG} | awk '{$1=""; print $0}' | sed s/\"//g)
}
check_item_safety()
{
# compare current account to item safety variable
if echo ${ITEM_SAFETY} | grep -q "\<${ACCT}\>"; then
tprint "${ACCT}: error, protected by safety variable" ${ACTION}
sed -i -e "/setTimeout(exit, 4444);/d" ${NODEJS}
return 1
fi
}
prep_node_coordinator()
{
# act on init reply from GC for item changes
if ! grep -q fromGC ${NODEJS}; then
prep_node_http
OPTS=$(cat << EOF
tprint('game... ', 1);
steam.gamesPlayed([440]);
coordinate_timeout = setTimeout(function() {
var buffer = new Buffer(8);
buffer.writeUInt64LE(1);
steam.toGC(440, 4006 | 0x80000000, buffer);
}, 3000);
setExitTimeout(30000, 'game');
EOF
)
sed -i -e "s/setTimeout(exit, 4444);/${OPTS//$'\n'/\\$'\n'}/g" ${NODEJS}
cat << EOF >> ${NODEJS}
var coordinate = 0, coordinate_timeout;
steam.on("fromGC", function(appid, type, message, args) {
var msg = type & ~0x80000000;
console.error(msg);
if (!coordinate && (msg == 1049 || msg == 6500 || msg == 4004)) {
clearTimeout(coordinate_timeout);
clearTimeout(exit_timeout);
coordinate = 1;
setTimeout(exit, 4444);
} // ELSEGC
});
EOF
fi
if [ ! -z "${1}" ]; then
sed -i -e "s/setTimeout(exit, 4444);/${1//$'\n'/\\$'\n'}/g" ${NODEJS}
fi
if [ ! -z "${2}" ]; then
OPTS="${2//$'\n'/\\$'\n'}"
sed -i -e "s/.*} \/\/ ELSEGC/${OPTS//&/\\&}\n&/g" ${NODEJS}
fi
}
idler_sort()
{
# arrange player backpack by id, then delete drops file
check_item_safety || return 1
prep_node_login || return 1
OPTS=$(cat << EOF
tprint('sorting player backpack...');
var buffer = new Buffer(2);
buffer.writeUInt16LE(4, 0);
steam.toGC(440, 1041 | 0x80000000, buffer);
EOF
)
OPTS1=$(cat << EOF
if (fs.existsSync('share\/${ACCT}\/drops')) {
fs.unlinkSync('share\/${ACCT}\/drops');
}
setTimeout(exit, 4444);
EOF
)
prep_node_coordinator "${OPTS}" \
"} else if (msg == 1058) {\n${OPTS1}" || return 1
}
prep_node_backpack()
{
# use webapi backpack data retrieval
if ! grep -q function\ getBackpack ${NODEJS}; then
cat << EOF >> ${NODEJS}
var backpack, backpack_errors = 0, craft_count;
function getBackpack(callback) {
if (backpack === undefined) {
tprint('item... ', 1);
backpack = 0;
}
console.error('BACKPACK');
http_opt.path = '/IEconItems_440/GetPlayerItems/v0001/?SteamID='
+ steam.steamID + '&key=${APIKEY}';
http.get(http_opt, function(response) {
var output = '';
response.on('data', function(chunk) {
output += chunk;
});
response.on('end', function() {
backpack = JSON.parse(output).result.items;
if (!backpack) {
tprint('error, backpack private or other problem {!}');
exit(1);
}
backpack_errors = 0;
callback();
});
response.on('error', function(error) {
console.error(error);
if (backpack_errors == 10) {
tprint('error, tf2 backpack service down {!}');
exit(1);
}
backpack_errors++;
setTimeout(1000, getBackpack, callback);
});
});
}
EOF
fi
}
# delete common crates or all of the specified underscore-seperated defindexes
CRATES=${CRATES}5734,5735,5742,5752,5781,5802,5803,5849
idler_waste()
{
check_item_safety || return 1
prep_node_login || return 1
DEFINDEX=${CRATES}
if [ ! -z ${1} ]; then
DEFINDEX=${1//_/,}
DEFINDEX=${DEFINDEX//crates/${CRATES}}
fi
OPTS1=$(cat << EOF
if (craft_count == -1) {
waste();
} else {
getBackpack(waste);
}
EOF
)
OPTS2=$(cat << EOF
} else if (msg == 23 && waste_count) {
if (!--waste_count) {
setTimeout(exit, 4444);
}
EOF
)
prep_node_coordinator "${OPTS1}" "${OPTS2}" || return 1
prep_node_backpack
cat << EOF >> ${NODEJS}
var waste_count, waste_delay = 0;
function waste() {
items = backpack.filter(function(item) {
return [${DEFINDEX}].indexOf(item.defindex) != -1;
});
if (items.length == 0) {
tprint('no items to delete');
setTimeout(exit, 4444);
} else {
waste_count = items.length;
tprint('deleting ' + items.length + '/' + backpack.length + ' items...');
items.forEach(function(item) {
var buffer = new Buffer(8);
buffer.writeUInt64LE(item.id);
setTimeout(function() {
steam.toGC(440, 1004, buffer);
}, 200*waste_delay++);
});
}
}
EOF
}
prep_node_schema()
{
# use webapi item schema retrieval
if ! grep -q var\ schema ${NODEJS}; then
prep_node_http
echo "var schema, schema_url;" >> ${NODEJS}
OPTS=$(cat << EOF
http_opt.path =
'/IEconItems_440/GetSchemaURL/v1/?language=en&key=${APIKEY}';
http.get(http_opt, function(response) {
var output = '';
response.on('data', function(chunk) {
output += chunk;
});
response.on('end', function() {
var obj = JSON.parse(output);
schema_url = obj.result.items_game_url;
if (fs.existsSync('steamnode/schema')
&& fs.existsSync('steamnode/.schema_url')
&& schema_url == fs.readFileSync('steamnode/.schema_url')) {
schema = JSON.parse(fs.readFileSync('steamnode/schema'));
setTimeout(exit, 4444);
} else {
tprint('schema... ', 1);
http_opt.path =
'/IEconItems_440/GetSchema/v0001/?language=en&key=${APIKEY}';
http.get(http_opt, function(response) {
var output = '';
response.on('data', function(chunk) {
output += chunk;
});
response.on('end', function() {
var obj = JSON.parse(output);
schema = {};
obj.result.items.forEach(function(item) {
schema[item.defindex] = item;
})
fs.writeFileSync('steamnode/schema', JSON.stringify(schema));
fs.writeFileSync('steamnode/.schema_url', schema_url);
setTimeout(exit, 4444);
});
});
}
});
});
EOF
)
OPTS="${OPTS//\//\\/}"
OPTS="${OPTS//&/\\&}"
sed -i -e "s/setTimeout(exit, 4444);/${OPTS//$'\n'/\\$'\n'}/g" ${NODEJS}
fi
}
idler_craft()
{
# create metal with optional underscore-seperated weapon defindex negations
check_item_safety || return 1
DEFINDEX=266,433,452,466,572,574,587,638,727,850,851,863,933,947
if [ ! -z ${1} ]; then
DEFINDEX=${DEFINDEX},${1//_/,}
fi
prep_node_login || return 1
OPTS=$(cat << EOF
} else if (msg == 1003) {
if (!--craft_count) {
craft();
}
EOF
)
prep_node_coordinator "" "${OPTS}" || return 1
prep_node_backpack
prep_node_schema
sed -i -e "s/setTimeout(exit, 4444);/getBackpack(_craft);/" ${NODEJS}
cat << EOF >> ${NODEJS}
var craft_mode = 1, craft_available;
function _craft() {
if (craft_mode == 1) {
var items = backpack.filter(function(item) {
return schema[item.defindex].craft_material_type == 'weapon'
&& !('flag_cannot_trade' in item) && !('flag_cannot_craft' in item)
&& item.quality == 6 && [${DEFINDEX}].indexOf(item.defindex) == -1
&& schema[item.defindex].name.indexOf('TF_WEAPON_') == -1
&& schema[item.defindex].name.indexOf('Festive') == -1
&& schema[item.defindex].name.indexOf('Botkiller') == -1
&& schema[item.defindex].item_class != 'saxxy';
});
craft_available = items.length;
var craft_total = backpack.filter(function(item) {
return schema[item.defindex].craft_material_type == 'weapon';
}).length;
} else {
var items = backpack.filter(function(item) {
if (craft_mode == 2) {
return item.defindex == 5000 && !('flag_cannot_trade' in item);
}
return item.defindex == 5001 && !('flag_cannot_trade' in item);
});
var craft_total = items.length;
}
var crafts = [];
while (true) {
if ((craft_mode == 1 && items.length < 2)
|| ((craft_mode > 1 && items.length < 3))) {
break;
}
if (craft_mode == 1) {
var first = items.shift();
var classes = schema[first.defindex].used_by_classes || [];
var choices = items.filter(function(item) {
return schema[item.defindex].craft_material_type == 'weapon'
&& classes.filter(function(n) {
return schema[item.defindex].used_by_classes.indexOf(n) != -1
}).length;
});
if (!choices.length) {
continue;
}
crafts.push(
[first.id, items.splice(items.indexOf(choices.shift()), 1)[0].id]);
} else {
crafts.push([items.shift().id, items.shift().id, items.shift().id]);
}
}
if (crafts.length) {
craft_count = crafts.length;
if (craft_mode == 1) {
tprint('smelting ' + craft_count*2 + '/' + craft_available
+ '/' + craft_total + ' weapons... ');
} else if (craft_mode == 2) {
tprint('combining ' + craft_count*3 + '/' + craft_total + ' scrap... ');
} else {
tprint('joining ' + craft_count*3 + '/' + craft_total + ' reclaimed... ');
}
var craft_delay = 0;
crafts.forEach(function(craft) {
var buffer = new Buffer(2 + 2 + 8 * craft.length);
buffer.writeInt16LE(-2, 0);
buffer.writeInt16LE(craft.length, 2);
var i = 0;
craft.forEach(function(item) {
buffer.writeUInt64LE(item, 4 + i * 8);
i++;
});
setTimeout(function() {
steam.toGC(440, 1002, buffer);
}, 200*craft_delay++);
});
} else {
if (craft_count !== undefined) {
craft_count = -1;
}
craft();
}
}
function craft() {
if (++craft_mode == 4) {
if (craft_count === undefined) {
tprint('nothing crafted');
craft_count = -1;
}
setTimeout(exit, 4444);
} else if (craft_count == 0) {
getBackpack(_craft);
} else {
_craft();
}
}
EOF
}
idler_deterge()
{
# craft, waste, then sort in one node login
idler_craft ${1%%:*}
if [[ ${1} = *:* ]]; then
idler_waste ${1##*:}
else
idler_waste
fi
idler_sort
}
idler_play()
{
# initiate app launch after prior stop wait and blocking
tprint "${ACCT}: preparing app..." \
$(app_size 440 yes),v$(app_version 440),$(steam_memory),\#440
wait_for_stop
block_on_file steam/.steamapps
# close ready/updated windows, then (re)initiate launch when ready
while ! hl2_pid > /dev/null; do
if ! app_state > /dev/null; then
if close_window $(window_id Ready) \
|| close_window $(window_id Updating); then
local READIED=${y}R${l},
unset READY
fi
if [ "${READY}" = 10 ]; then
unset READY
fi
if [ -z ${READY} ]; then
wine_run C:/Steam/steam.exe -applaunch 440 ${1}
fi
let local READY+=1
fi
idler_sleep 1
# check activity and error/update windows and login override
app_activity 440
if window_id Update\ Available > /dev/null; then
tprint "${ACCT}: warning, available update..." $(steam_memory)
close_window ${WID} no no Return
elif window_id Error\ -\ Steam > /dev/null; then
tprint "${ACCT}: warning, consuming other login..." $(steam_memory)
close_window ${WID} no ""
elif window_id latest\ DirectX > /dev/null; then
tprint "${ACCT}: fatal, directx problem..." $(steam_memory)
exit 1
# if game is unavailable, warn then retry 3 times
elif window_id Steam\ -\ Error > /dev/null; then
let local ERRORS+=1
if [ ${ERRORS} = 1 ]; then
tprint "${ACCT}: warning, game unavailable..." $(steam_memory)
fi
close_window ${WID}
unset READY
if [ "${ERRORS}" = 3 ]; then
tprint "${ACCT}: fatal, steam servers down" $(steam_memory)
exit 1
fi
# if cloud conflicts, warn then bypass
elif [ -z ${CLOUD} ]; then
if window_id "Warning" > /dev/null; then
local CLOUD=yes
tprint "${ACCT}: warning, cloud warning..." $(steam_memory)
close_window ${WID} no no Return
elif window_id "Cloud Sync Conflict" > /dev/null; then
local CLOUD=yes
tprint "${ACCT}: warning, cloud conflict..." $(steam_memory)
mouse_click ${WID} 300 165 2
fi
fi
done
# write version file, wait on client load, then disable pm
tprint "${ACCT}: loading app..." ${READIED}@${HPID},$(both_memory)
unset DOWNLOADING VALIDATING COMMITTING
rm -f steam/.steamapps-${HOSTNAME}.lock
app_version 440 > "${ATF}"/pdl-${ACCT}/ver
while true; do
if ! hl2_pid > /dev/null; then
tprint "${ACCT}: error, app crashed" $(steam_memory)
return 1
elif tac ${CON} | grep -m1 ": Disconnect\|: Shutdown function" \
| grep -q Disconnect; then
tprint "${ACCT}: client started" v$(app_version 440),$(both_memory)
break
fi
idler_sleep 1
done
disable_power_management
}
client_connection()
{
# get connection time and status of client
CONNECTION=$(tac ${CON} \
| grep -m1 ": Disconnect\|: Connected to\| connected\|: Compact freed")
local TIME=$(($(date +%s)-$(date -d "$(echo "${CONNECTION}" \
| sed -e 's/: .*//' -e 's/ - / /')" +%s)))
TIME=$(echo - | awk \
'{printf "%02d:%02d",'${TIME}'/(60*60),'${TIME}'%(60*60)/60}')\|
if echo "${CONNECTION}" | grep -q Disconnect; then
CONNECTION=${TIME}\ Disconnect
echo ${TIME} Disconnect
return 1
elif echo "${CONNECTION}" | grep -q Compact; then
IP=Listen
else
IP=$(echo "${CONNECTION}" | grep -o Connected\ to.* | grep -o \[0-9.:]*)
fi
CONNECTION="${TIME} ${IP}"
echo ${CONNECTION}
if [ -z ${IP} ]; then
return 1
fi
return 0
}
net_address()
{
# get host network address
ip route get 8.8.8.8 | awk '{print $7}'
}
# parse or accept input then run command on the client
idler_command()
{
if ! is_commandable; then
tprint "${ACCT}: error, manual client has not loaded aliases"
return 1
else
COMMAND="${1}"
if [ -z "${COMMAND}" ]; then
tprint "${ACCT}: input command:" @${HPID} "" 1
read -e COMMAND
if [ -z "${COMMAND}" ]; then
tprint "${ACCT}: fatal, no input"
exit 1
fi
fi
tprint "${ACCT}: running '${ARG//^/ }'..." $(both_memory)
echo -e "${1}\nwriteip" > "${ATF}"/pdl-${ACCT}/cfg/banned_ip.cfg
while ! grep -q addip "${ATF}"/pdl-${ACCT}/cfg/banned_ip.cfg; do
idler_sleep 0.3
let local CMD_TIMEOUT+=1
if [ ${CMD_TIMEOUT} = 240 ]; then
tprint "${ACCT}: error, command failed" X,$(both_memory)
return 1
fi
done
echo "//${1}" > "${ATF}"/pdl-${ACCT}/cfg/banned_ip.cfg
return 0
fi
}
idler_disconnect()
{
# disconnect client from server
if client_connection > /dev/null; then
if [[ ${CONNECTION} = *$(net_address):281[0-9][0-9] ]]; then
local PLAYER={$(server_playercount ${CONNECTION:(-2)}\
)/$((IDLE_MAX+1))},\#${CONNECTION:(-2)},
fi
tprint "${ACCT}: disconnecting..." ${PLAYER}${CONNECTION:0:5},$(both_memory)
idler_command "mmute;disconnect;echo Disconnect" > /dev/null || return 1
fi
}
server_memory()
{
# get memory usage of a server process via port number
memory $(pgrep -f srcds_linux.*281${1:(-2)})
}
item_schema()
{
# get item schema from specified log
SCHEMA=$(tac "${1}" | grep -om1 version\ \[A-F0-9]* | awk '{print $2}')
if [ -z ${SCHEMA} ]; then
echo noschema
return 1
fi
echo \&${SCHEMA}
}
client_map()
{
# get map load status of client
if tac ${CON} | grep -m 1 ": Disconnect\|: Compact free" | grep -q Compact; then
echo $(tac ${CON} | grep -om 1 ^Map:\ \[[:graph:]]* | awk '{print $2}')
return 0
fi
return 1
}
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 ! 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
# start normal client if connecting to a location server or if not started
if hl2_pid noshaderapi > /dev/null; then
if [ ! -z "${LOCATION}" ] && [[ ${LOCATION/*:} != 281[0-9][0-9] ]]; then
tprint "${ACCT}: warning, restarting farm client..." $(both_memory)
idler_stop
else
local NOSHADERAPI=yes
fi
elif ! hl2_pid > /dev/null; then
idler_play || return 1
fi
# if no location server, use idle server on first available server or port
if [ -z "${TEST}" ]; then
start_server
LOCATION=connect\ $(ip addr | grep -v \ lo \
| grep -om1 "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/" | sed "s/\///"):${PORT:(-5)}
if [ ! -z "${SCON}" ]; then
while ! grep -q "VAC secure mode is activated" "${SCON}"; do
idler_sleep 1
done
tprint "getting server schema..." \
@$(pgrep -f srcds_linux.*${PORT:(-5)}),$(server_memory ${PORT})
while ! item_schema "${SCON}" > /dev/null; do
idler_sleep 1
done
tprint "server started" $(item_schema "${SCON}"),$(server_memory ${PORT})
fi
unset SCON PORT
fi
# proceed if not already connected to specified server
if ! tac ${CON} | grep -m 1 ": Disconnect\|: Connected to" \
| grep -q ${LOCATION/* /}; then
idler_disconnect
# issue location command then wait till connected or in-game
if [[ "${LOCATION}" != map* ]]; then
tprint "${ACCT}: querying server..." $(echo ${LOCATION:8} | \
sed -e "s/:.*//" -e "s/[0-9]*\.[0-9]*\./*/"),$(item_schema ${CON}),$(\
both_memory)
fi
if ! idler_command "${LOCATION}" > /dev/null; then
return 1
else
if [[ "${LOCATION}" != map* ]]; then
local SKIP CONNECT RETURN
while ! client_connection > /dev/null; do
if [ -z ${SKIP} ]; then
if [ -z ${NOSHADERAPI} ]; then
if tac ${CON} | grep "Bad password\|pdlconnect" \
| grep -q password; then
tprint "${ACCT}: error, wrong password..." $(both_memory)
elif tac ${CON} | grep "Server is full\|pdlconnect" \
| grep -q full; then
tprint "${ACCT}: error, server is full..." $(both_memory)
elif tac ${CON} | grep "have been banned\|pdlconnect" \
| grep -q banned; then
tprint "${ACCT}: error, account banned..." $(both_memory)
fi
fi
if tac ${CON} | grep -m 1 "correct\ chall\|Bad\ chall\|pdlconnect" \
| grep -q challenge; then
tprint "${ACCT}: warning, bad challenge..." $(both_memory)
idler_command retry > /dev/null
SKIP=no
RETURN=no
elif tac ${CON} | grep -m1 "er version of\|pdlconnect" \
| grep -q version; then
tprint "${ACCT}: error, version mismatch..." $(both_memory)
if [ ! -z ${NOSHADERAPI} ]; then
idler_stop > /dev/null
return 1
fi
elif grep -qm1 "are in insecure\|VAC banned" ${CON}; then
tprint "${ACCT}: error, insecure client log out..." $(both_memory)
idler_logout yes
else
CONNECT=no
RETURN=no
fi
if [ -z ${CONNECT} ]; then
idler_command echo\ pdlconnect > /dev/null
fi
if [ -z ${RETURN} ]; then
return 1
fi
fi
idler_sleep 1
done
fi
if [[ ${LOCATION/*:} = 281[0-9][0-9] ]]; then
local MAP={$((PLAYER+1))/$((IDLE_MAX+1))},\#"${LOCATION:(-2)}",
else
tprint "${ACCT}: loading map..." $(both_memory)
while ! client_map > /dev/null; do
idler_sleep 1
done
local MAP=$(client_map),
fi
tprint "${ACCT}: connected" ${MAP}$(both_memory)
fi
fi
}
auxiliary_pid()
{
# find auxiliary pid tied to current account prefix
for XPID in $(pgrep -f ${1}); do
if grep -q ${WINEPREFIX} /proc/${XPID}/environ; then
echo ${XPID}
return 0
fi
done
return 1
}
# check player items in background
DROP_IRC=yes
DROP_CHAT=yes
idler_farm()
{
if [[ "${1}${DROP_DETERGE}" = [1-9][0-9]* ]]; then
if [ -z ${SUID} ]; then
tprint "error, account uid unknown, skipping deterge"
else
player_items > .items-${ACCT}.pdl &
fi
fi
# find first available X display, login, set xroot color, then kill explorer
if ! steam_pid _:[1-9][0-9]* > /dev/null; then
if steam_pid > /dev/null; then
tprint "${ACCT}: warning, restarting steam..." $(both_memory)
idler_logout > /dev/null
fi
while true; do
export DISPLAY=:$((${DISPLAY:1}+1))
if [ $(pgrep -f steam.exe.*_${DISPLAY} | wc -l) != $((32*2)) ]; then
break
fi
done
DLLS=audio,mss32,binkw32,bsppack,bugreporter,bugreporter_filequeue
DLLS=${DLLS},bugreporter_public,commedit,datamodel,dmserializers
DLLS=${DLLS},hammer_dll,haptics,icudt,icudt42,libsasl,mysql_wrapper
DLLS=${DLLS},pet,plugplay.exe,serverplugin_empty,shadercompile_dll,sixense
DLLS=${DLLS},sixense_utils,soundsystem,sourcevr,telemetry32
DLLS=${DLLS},texturecompile_dll,unicows,unitlib,valvedeviceapi,vaudio_miles
DLLS=${DLLS},video_bink,video_quicktime,vmt,vrad_dll,vtex,
idler_login lo ${DLLS} farm || return $?
xsetroot -solid \#3a342e
kill $(auxiliary_pid explorer.exe)
# manage console links, change gameinfo pdl directory, then add cvars
rm -f "${ATF}"/con-*.log
ln -sf "${PWD}"/${CON} "${TF}"/con-${ACCT}.log
sed -e "s/${HOSTNAME}-[0-9]*/${ACCT}/" "${STF}"/gameinfo.txt > "${ATF}"/gameinfo.txt
sed -i -e "/_acmd;/d" "${ATF}"/pdl-${ACCT}/cfg/${ACCT//./}+.cfg
{
echo "alias _acmd \"exec banned_ip;wait 8;_acmd\""
echo "_acmd"
echo "sv_cheats \"1\""
echo "fps_max \"1\""
echo "datacachesize \"32\""
echo "tv_nochat \"1\""
echo "voice_enable \"0\""
echo "mat_loadtextures \"0\""
echo "mat_managed_textures \"0\""
echo "mat_mipmaptextures \"0\""
echo "mat_norendering \"1\""
echo "mat_phong \"0\""
echo "mat_showlowresimage \"1\""
echo "mat_stub \"1\""
echo "mem_min_heapsize \"1\""
echo "mem_max_heapsize \"16\""
} >> "${ATF}"/pdl-${ACCT}/cfg/${ACCT//./}+.cfg
fi
# clean inventory (if desired) before load
if ! hl2_pid > /dev/null; then
if [[ "${1}${DROP_DETERGE}" = [1-9][0-9]* ]] \
&& [ -e .items-${ACCT}.pdl ]; then
while [ ! -s .items-${ACCT}.pdl ]; do
idler_sleep 0.5
done
ITEMS=$(cat .items-${ACCT}.pdl)
ITEMS_SLOTS=$(echo "${ITEMS}" | grep -m1 _slots | grep -o [0-9]*)
ITEMS_COUNT=$(echo "${ITEMS}" | grep original_id | wc -l)
rm .items-${ACCT}.pdl
if ((ITEMS_SLOTS-ITEMS_COUNT < DROP_DETERGE)); then
idler_deterge
run_node_login
else
tprint "${ACCT}: backpack has ${ITEMS_COUNT}/${ITEMS_SLOTS} items" \
free=$((ITEMS_SLOTS-ITEMS_COUNT))_min=${DROP_DETERGE}
fi
fi
# if no client, start for farm, remove pa entries, then connect
idler_play "-threads 1 -nomouse -noshaderapi -noborder" || return 1
fi
if pgrep -x pulseaudio > /dev/null; then
for PA in $(pacmd list-clients \
| grep -A0 -B7 "process.id = \"\(${SPID}\|${HPID}\)\"" \
| grep index: | awk '{print $2}'); do
pacmd kill-client ${PA}
done
fi
if [ ! -z ${PA} ]; then
tprint "${ACCT}: removed pulseaudio client(s)" @$(pgrep pulseaudio)
fi
idler_connect || return 1
# start node chatroom bot, check capabilities, then initiate farm helper
if ! pgrep -fn sh\ pdl-idler_helper.sh > /dev/null; then
tprint "starting helper..." \
${DROP_IRC:0:1}\|${DROP_CHAT:0:1}\|${DROP_SOUND:0:1}\|${DROP_SPEECH:0:1}
if [ "${DROP_CHAT}" = no ]; then
unset DROP_CHAT
else
DROP_CHAT=${ACCT}
if ! is_node_login_available; then
if [ $(node_login_background) != DROP ]; then
tprint "error, node login occupied, drop chat disabled"
unset DROP_CHAT
fi
elif ! prep_chat || ! prep_node_login yes "${OPTS}"; then
tprint "${ACCT}: error, drop chat error"
unset DROP_CHAT
else
prep_node_enter ${CHAT} ", 1"
prep_node_http
OPTS="steam.setPersonaState(Steam.EPersonaState.Away);"
OPTS="${OPTS}\nexitBreak('DROP', 1);"
sed -i -e "s/setTimeout(exit, 4444);/${OPTS}/g" ${NODEJS}
if ! run_node_login > /dev/null; then
tprint "${ACCT}: error, drop chat disabled for error or limited acct"
unset DROP_CHAT
fi
fi
fi
if [ "${DROP_IRC}" != no ] && [ "${IRC_SERVER}" = none ]; then
tprint "error, irc server disabled, drop irc disabled"
unset DROP_IRC
fi
if [ "${DROP_SOUND}" = yes ] && ! which aplay > /dev/null 2>&1; then
tprint "error, aplay not installed, drop sound disabled"
unset DROP_SOUND
fi
if [ "${DROP_SPEECH}" = yes ] && ! which flite > /dev/null 2>&1; then
tprint "error, flite not installed, drop speech disabled"
unset DROP_SPEECH
fi
screen -dmS idler-helper$ bash pdl-idler_helper.sh \
"${DROP_CHAT}" "${DROP_IRC}" "${DROP_SOUND}" "${DROP_SPEECH}"
fi
}
# source user config file
if [ -e share/pdl-idler.conf ]; then
source ./share/pdl-idler.conf
fi
ACCOUNTS_STRING="${ACCOUNTS}"
#!/bin/bash
# pdl-idler_example.conf (0.9025)
# Copyright (c) 2011-2016 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/>
# required api key obtained from http://steamcommunity.com/dev/apikey
APIKEY=""
# if "yes", force gist update check on each invocation instead of once per day.
GIST_FORCE="no"
# if "yes", start x11vnc for the display server, or 'farm' just for xvfb.
X_X11VNC="no"
# if set, use this password for the x11vnc session.
X_X11VNC_PASS=""
# join this chatroom id for enter/trade.
CHATROOM="103582791435720285"
# skip item modifications on accounts from this space-separated list.
ITEM_SAFETY=""
# use up to a 32 client limit for each srcds and X display pair.
IDLE_MAX="32"
# use this map for the dedicated idle server.
IDLE_MAP="itemtest"
# set IRC server address, or skip if "none".
IRC_SERVER="irc.gamesurge.net"
# set IRC server username.
IRC_SERVER_USER=""
# set IRC server password.
IRC_SERVER_PASS=""
# set IRC server port.
IRC_SERVER_PORT="6667"
# set IRC channel name.
IRC_CHANNEL="mannsanto"
# set IRC channel password.
IRC_CHANNEL_PASS=""
# if 'yes' (and if IRC_SERVER is set), relay item drops through server irc.
DROP_IRC="yes"
# if 'yes' (and if CHATROOM is set), a message/picture is sent to steam chat.
DROP_CHAT="yes"
# if "yes", a relevant sound will play for an item drop.
DROP_SOUND="no"
# if "yes", the names of item drops will be vocalized with flite.
DROP_SPEECH="no"
# clean account before farm if it has less than this amount of free spaces.
DROP_DETERGE="0"
# account blocks (one has passwords) with join to central variable and array.
ACCOUNTS1="${ACCOUNTS1} ben/tenkeysplease123"
ACCOUNTS1="${ACCOUNTS1} mann2/qwerty002"
ACCOUNTS1="${ACCOUNTS1} mann3/qwerty003"
ACCOUNTS1="${ACCOUNTS1} mann4/qwerty004"
ACCOUNTS1="${ACCOUNTS1} mann5/qwerty005"
ACCOUNTS1="${ACCOUNTS1} mann6/qwerty006"
ACCOUNTS1="${ACCOUNTS1} mann7/qwerty007"
ACCOUNTS1="${ACCOUNTS1} mann8/qwerty008"
ACCOUNTS="${ACCOUNTS} ${ACCOUNTS1}"
ACCOUNT_BLOCKS[1]=${ACCOUNTS1}
ACCOUNTS2="${ACCOUNTS2} jerry"
ACCOUNTS2="${ACCOUNTS2} herr2"
ACCOUNTS2="${ACCOUNTS2} herr3"
ACCOUNTS2="${ACCOUNTS2} herr4"
ACCOUNTS2="${ACCOUNTS2} herr5"
ACCOUNTS2="${ACCOUNTS2} herr6"
ACCOUNTS2="${ACCOUNTS2} herr7"
ACCOUNTS2="${ACCOUNTS2} herr8"
ACCOUNTS="${ACCOUNTS} ${ACCOUNTS2}"
ACCOUNT_BLOCKS[2]=${ACCOUNTS2}
#!/bin/bash
# pdl-idler_helper.sh (0.9025)
# Copyright (c) 2011-2016 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/>
# source common and trap drop chat sigint
source ./pdl-idler_common.sh
VOICES=(awb rms slt kal16)
if [ ! -z ${1} ]; then
DROP_CHAT=${1}
finish()
{
stop_node_login ${DROP_CHAT}
}
sigint()
{
finish
exit 1
}
trap sigint SIGINT SIGTERM
fi
server_command()
{
# input command to server console through its screen session
screen -S idler-server${1:(-2)} -p 0 -X stuff \
"pdl-$(date +%H:%M:%S)$(printf \\r)${2}$(printf \\r)"
}
# stop if there are no farm clients remaining, or wait for consoles to change
declare -A ALERTS
NEW_ITEM_TIME=0
while true; do
PGREP="$(pgrep -fa hl2\\.exe.*noshaderapi.*\+)"
if [ -z "${PGREP}" ]; then
break
fi
OLD_ITEM_TIME=${NEW_ITEM_TIME}
unset NEW_ITEM_TIME
CONS=$(ls -Hxt "${TF}"/con-* | sed -e "s/.*\/con-//" -e "s/\.log//")
for ACCT in ${CONS}; do
CON=share/${ACCT}/logs/${HOSTNAME}/con-${ACCT}.log
if [ -z ${NEW_ITEM_TIME} ]; then
NEW_ITEM_TIME=$(stat -c %Y "${CON}")
fi
if [ $(stat -c %Y "${CON}") -le ${OLD_ITEM_TIME} ]; then
if [ ! -z ${SOUND} ]; then
aplay "${TF}"/pdl/farm/sound/${SOUND%%^*} > /dev/null 2>&1 &
SOUND="${SOUND#*^}"
fi
if [ ! -z "${SPEECH}" ]; then
flite -voice ${VOICES[$(shuf -i 0-3 -n 1)]} -t "${SPEECH%%^*}"
SPEECH="${SPEECH#*^}"
else
idler_sleep 1
fi
continue 2
# check for a new alert if client is connected
elif [[ ${PGREP} != *${ACCT}+* ]]; then
ALERTS[${ACCT}]=0
elif client_connection > /dev/null; then
ALERT=$(grep -n _alert.wav "${CON}" | tail -n 1 | sed "s/:.*//")
if [ "${ALERT}" != "${ALERTS[${ACCT}]}" ]; then
set_account ${ACCT}
# get item data, or wait on api failure and retry
OPTS=$(player_items)
ITEMS=$(echo "${OPTS}" | grep original_id | wc -l)
SLOTS=$(echo "${OPTS}" | grep num_backpack_slots | grep -o \[0-9]*)
if [[ "${OPTS}" != *status\":\ 1,* ]]; then
tprint "${ACCT}: failed to download item data"
if [ ${ACCT} = ${CONS##*[[:space:]]} ]; then
idler_sleep 5
fi
continue 2
# handle full backpack
elif (( ${ITEMS} >= ${SLOTS} )); then
if [[ "${DROP_DETERGE}" = *[1-9]* ]]; then
tprint "${ACCT}: full inventory, deterging..." ${ITEMS}/${SLOTS}
server_command "$(client_connection)" "sm_kick \"$(\
steam_name)\" \"Cleaning Backpack... (${ITEMS}/${SLOTS})\""
idler_stop
stop_node_login
wait_for_stop
idler_deterge
run_node_login
idler_farm nodeterge
else
tprint "${ACCT}: full inventory, logging out..." ${ITEMS}/${SLOTS}
server_command "$(client_connection)" "sm_kick \"$(\
steam_name)\" \"Full Backpack (${ITEMS}/${SLOTS})\""
idler_logout
fi
# update alert line number, find new items, then log
else
unset CHAT
ALERTS[${ACCT}]=${ALERT}
OPTS=$(echo "${OPTS}" | grep -B6 -A1000 inventory\":\ [03])
ORIGINAL=($(echo "${OPTS}" | grep original_id | grep -o \[0-9]*))
for ID in ${ORIGINAL[@]}; do
if ! grep -q ${ID} share/${ACCT}/drops 2> /dev/null; then
INVENTORY=$(echo "${OPTS}" | grep -A4 ${ID} | grep inventory \
| grep -o \[0-9]*)
if (( ${INVENTORY} >= 3221225472 )) || [ ${INVENTORY} = 0 ]; then
echo ${ID} >> share/${ACCT}/drops
INDEX=$(echo "${OPTS}" | grep -A1 ${ID} | grep defindex \
| grep -o \[0-9]*)
ITEM=$(grep -PA500 "^\s*\t*\"${INDEX}\"" \
"${SMOD}"/configs/items.kv)
NAME=$(echo "${ITEM}" | grep -m1 name.*\" \
| sed -e "s/[[:space:]]*\"name\"[[:space:]]*\"//" \
-e "s/\"[[:space:]]*//" -e 's/\r$//')
WAV=$(echo "${ITEM}" | grep -m1 drop_sound \
| grep -o item_.*\\.wav || echo item_metal_pot_drop.wav)
tprint "${ACCT}: \"${NAME#The }\" (#${INDEX})" \
$(echo ${WAV:5} | sed -e s/_drop.wav// -e s/_pickup.wav//)
# queue sound and/or speech
if [ ! -z ${3} ]; then
SOUND="${SOUND}ui/${WAV}^"
if echo "${ITEM}" | grep -Pm1 \
"^\t\t}|craft_class.*\"weapon|prefab.*weapon|crate\"" \
| grep -q }; then
SOUND="${SOUND}ui/item_notify_drop.wav^"
fi
fi
if [ ! -z ${4} ]; then
SPEECH="${SPEECH}${NAME}^"
fi
# announce item through server irc
if [ ! -z ${2} ]; then
QUALITY=$(echo "${OPTS}" | grep -A3 ${ID} | grep quality \
| grep -o \[0-9]*)
server_command "${CONNECTION}" "itemevent \"$(\
steam_name)\" ${INDEX} ${QUALITY}"
fi
# construct chat line, then send
if [ ! -z ${1} ]; then
CHAT="${CHAT}http://steamcommunity.com/profiles/${SUID}/inventory/#440_2_${ID}\n"
fi
fi
fi
done
if [ ! -z ${CHAT} ]; then
CHAT="ENTER_$(steam_name)\n${CHAT:0:(-2)}__n"
echo -e ${CHAT/\\\nhttp/ http} >> share/${1}/node.log
fi
fi
fi
fi
done
done
finish 2> /dev/null
// pdl-idler_localconfig.vdf (0.9025)
// Copyright (c) 2011-2016 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/>
"UserLocalConfigStore"
{
"system"
{
"EnableGameOverlay" "1"
"JumplistSettings" "65279"
"InGameOverlayShortcutKey" "Ctrl\tKEY_TAB"
"InGameOverlayShowFPSContrast" "1"
"InGameOverlayShowFPSCorner" "3"
"InGameOverlayScreenshotHotKey" "Ctrl\tKEY_F12"
"JumplistSettingsKnown" "65535"
"NavUrlBar" "1"
"SteamControllerVGUIWarning" "1"
"SteamVRHMDVGUIWarning" "1"
}
"HideSharingNotifications" "1"
"News"
{
"NotifyAvailableGames" "0"
}
"streaming_v2"
{
"EnableStreaming" "1"
"QualityPreference" "2"
"EnableHardwareDecodingV2" "1"
"EnableDebugOverlay" "1"
"EnableTrafficPriority" "1"
"EnableHardwareEncoding_NVIDIA" "1"
"EnableHardwareEncoding_Intel" "1"
}
"Broadcast"
{
"Permissions" "0"
}
"Software"
{
"Valve"
{
"Steam"
{
"SSAVersion" "2"
"PrivacyPolicyVersion" "2"
"apps"
{
"440"
{
"LaunchOptions" "nojoy"
}
}
}
}
}
"friends"
{
"Notifications_ShowIngame" "0"
"Notifications_ShowOnline" "0"
"Notifications_ShowMessage" "0"
"ShowBlockCommunicationWarning" "0"
"Sounds_PlayMessage" "0"
"AutoSignIntoFriends" "0"
"ShowTimeInChatLogCheck" "1"
}
}
; pdl-idler_registry.reg (0.9025)
; Copyright (c) 2011-2016 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/>
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\WineDbg]
"ShowCrashDialog"=dword:00000000
[HKEY_CURRENT_USER\Software\Wine\DllOverrides]
"winemenubuilder.exe"=""
"dxsetup.exe"=""
"vcredist_*.exe"=""
"ComradeSetup.exe"=""
"amdcpusetup.exe"=""
"crashhandler.dll"=""
"msi.dll"=""
"winedbg.exe"=""
"plugplay.exe"=""
[HKEY_CURRENT_USER\Software\Wine\Drivers]
"Audio"="alsa"
[HKEY_CURRENT_USER\Software\Valve\Steam]
"AlreadyRetriedOfflineMode"=dword:00000001
"Offline"=dword:00000000
/*
# pdl-idler_sourcemod.sp (0.9025)
# Copyright (c) 2011-2016 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/> */
#include <sdktools>
#include <tf2_stocks>
#undef REQUIRE_PLUGIN
#include <sourceirc>
// print player count on change to assist script
PrintPlayerCount() {
decl String:t[15];
FormatTime(t, 15, "%D-%H:%M", GetTime());
PrintToServer("[%s] Players: %d", t, GetClientCount(false));
}
// teleport spawners to halloween position and resize them
new Float:location[][3] = {{-1383.0,3018.0,-9550.0},
{-372.0,-1417.0,-10019.0},{1647.0,952.0,-14076.0},
{6320.0,7540.0,-4765.0}};
public Event_PlayerSpawn(Handle:evt, const String:n[], bool:db) {
new c = GetClientOfUserId(GetEventInt(evt, "userid"));
decl String:map[50];
GetCurrentMap(map, sizeof(map));
if (strcmp(map, "cp_manor_event", false) == 0) {
TeleportEntity(c, location[0], NULL_VECTOR, NULL_VECTOR);
} else if (strcmp(map, "koth_lakeside_event", false) == 0) {
TeleportEntity(c, location[1], NULL_VECTOR, NULL_VECTOR);
} else if (strcmp(map, "koth_viaduct_event", false) == 0) {
TeleportEntity(c, location[2], NULL_VECTOR, NULL_VECTOR);
} else if (strcmp(map, "plr_hightower_event", false) == 0) {
TeleportEntity(c, location[3], NULL_VECTOR, NULL_VECTOR);
} else {
return;
}
SetEntProp(c, Prop_Data, "m_takedamage", 0, 1);
SetEntPropFloat(c, Prop_Send, "m_flModelScale", 5000.0);
}
// create fake item event with console command
public Action:ItemEvent(c, args) {
decl String:pattern[64];
GetCmdArg(1, pattern, sizeof(pattern));
new targets[MAXPLAYERS];
new String:target_name[MAX_TARGET_LENGTH];
new bool:tn_is_ml;
ProcessTargetString(pattern, 0, targets, MAXPLAYERS,
COMMAND_FILTER_CONNECTED, target_name, sizeof(target_name), tn_is_ml);
decl String:defindex[10], String:quality[10];
GetCmdArg(2, defindex, sizeof(defindex));
GetCmdArg(3, quality, sizeof(quality));
new Handle:event = CreateEvent("item_found");
SetEventInt(event, "player", targets[0]);
SetEventInt(event, "quality", StringToInt(quality));
SetEventInt(event, "method", 0);
SetEventInt(event, "itemdef", StringToInt(defindex));
FireEvent(event);
}
// form client connection duration
String:ClientTime(c) {
new time = RoundToFloor(GetClientTime(c));
new h = time / 3600;
if (h < 1) {
h = 0;
}
decl String:d[64];
Format(d, sizeof(d), "%02d:%02d:%02d", h, (time-3600*h)/60, time%60);
return d;
}
// send an irc message or queue it if not joined to the channel
new joined = 0;
new joiner_count = 0;
new String:joiner[50][IRC_MAXLEN];
QueueMsg(const String:msg[IRC_MAXLEN]) {
if (joined == 1) {
IRC_MsgFlaggedChannels("relay", msg);
} else {
joiner[joiner_count] = msg;
joiner_count++;
}
}
// print irc announcement of item drop when item events fire
new Handle:kv = INVALID_HANDLE;
public Action:ItemFound(Handle:evt, const String:n[], bool:db) {
new c = GetEventInt(evt, "player"), color=6,
index=GetEventInt(evt, "itemdef");
decl String:msg[IRC_MAXLEN], String:name[256], String:type[64],
String:slot[64], String:class[64], String:craft[64], String:armory[64],
String:prefab[64], String:itemdef[10];
Format(itemdef, sizeof(itemdef), "%i", index);
if (KvJumpToKey(kv, itemdef)) {
KvGetString(kv, "name", name, sizeof(name), "Unknown");
KvGetString(kv, "prefab", prefab, sizeof(prefab), "");
KvGetString(kv, "item_slot", slot, sizeof(slot), "");
KvGetString(kv, "item_class", class, sizeof(class), "");
KvGetString(kv, "craft_class", craft, sizeof(craft), "");
KvGetString(kv, "armory_desc", armory, sizeof(armory), "");
KvGetString(kv, "item_type_name", type, sizeof(type), "");
KvGoBack(kv);
} else {
Format(name, sizeof(name), "Unknown Item");
}
msg[0] = '\0';
switch (GetEventInt(evt, "quality")) {
case 1:
color = 3;
case 3:
color = 12;
case 6:
color = 8;
case 11:
color = 7;
case 13:
color = 6;
}
Format(msg, sizeof(msg), "%s\x0315%N [\x03%02d%s\x0315 %s]\x03",
msg, c, color, name, ClientTime(c));
if (StrContains(type, "#TF_Wearable", false) == 0
|| StrContains(prefab, "hat", false) > -1
|| StrContains(prefab, "misc", false) > -1) {
if (!StrEqual(craft, "weapon", false)
&& StrContains(prefab, "weapon", false) == -1) {
StrCat(msg, sizeof(msg), " \x0313(Cosmetic!)\x03");
}
} else if (StrContains(name, "Paint", false) != -1) {
StrCat(msg, sizeof(msg), " \x0309(Paint!)\x03");
} else if (StrEqual(class, "tool", false) || index == 5020) {
StrCat(msg, sizeof(msg), " \x0312(Tool!)\x03");
} else if (StrEqual(slot, "action", false)
|| StrEqual(class, "craft_item", false)) {
StrCat(msg, sizeof(msg), " \x0304(Action!)\x03");
} else if (StrEqual(class, "supply_crate", false)
|| StrEqual(armory, "supply_crate", false)
|| StrEqual(prefab, "eventcrate", false)) {
StrCat(msg, sizeof(msg), " \x0307(Crate!)\x03");
}
QueueMsg(msg);
}
// show count on connect and park client if tv_nochat is set
public bool:OnClientConnect(c, String:rejectmsg[], maxlen) {
decl String:tvnochat[2];
GetClientInfo(c, "tv_nochat", tvnochat, 2);
if (strcmp(tvnochat, "1", false) == 0) {
InactivateClient(c);
}
PrintPlayerCount();
return true;
}
// form tf2b url
stock String:tf2b(c) {
decl String:id[64];
GetClientAuthId(c, AuthId_SteamID64, id, sizeof(id));
Format(id, sizeof(id), "http://tf2b.com/tf2/%s", id);
return id;
}
// show player connection message
public void OnClientAuthorized(c, const String:auth[]) {
decl String:name[IRC_MAXLEN]
GetClientName(c, name, sizeof(name));
Format(name, IRC_MAXLEN, "\x0315%s (%s)\x03", name, tf2b(c));
QueueMsg(name);
return;
}
// give player random team and set class to scout when client joins game
public OnClientPutInServer(c) {
if (GetRandomInt(0, 1) == 1) {
ChangeClientTeam(c, _:TFTeam_Blue);
} else {
ChangeClientTeam(c, _:TFTeam_Red);
}
TF2_SetPlayerClass(c, TFClass_Scout, false);
}
// show duration, reprint player count on disconnect, then stop server if empty
public Action:Event_PlayerDisconnect(Handle:evt, const String:n[], bool:db) {
new c = GetClientOfUserId(GetEventInt(evt, "userid"));
PrintToServer("Duration: %s", ClientTime(c));
decl String:reason[128], String:name[IRC_MAXLEN];
GetEventString(evt, "reason", reason, sizeof(reason));
for (new i = 0; i <= strlen(reason); i++) {
if (reason[i] == '\n') {
RemoveChar(reason, sizeof(reason), i);
}
}
if (strcmp(reason, "Disconnect by user.", false) != 0) {
GetClientName(c, name, sizeof(name));
Format(name, IRC_MAXLEN,
"%s (%s) %s [%s]", name, tf2b(c), reason, ClientTime(c));
QueueMsg(name);
}
}
public Action:Timer_OnClientDisconnect_Post(Handle:timer) {
if (GetClientCount(false) == 0) {
ServerCommand("quit");
}
}
public OnClientDisconnect_Post(c) {
PrintPlayerCount();
CreateTimer(5.0, Timer_OnClientDisconnect_Post);
}
// detect irc channel join
public Action:IrcJoin_Timer(Handle:timer)
{
for (new i = 0; i < joiner_count; i++) {
IRC_MsgFlaggedChannels("relay", joiner[i]);
}
}
public Action:IRCJoin(const String:hostmask[], args) {
if (!joined) {
joined = 1;
CreateTimer(1.5, IrcJoin_Timer);
}
}
// short gameinfo irc status
GameInfo(const String:nick[]) {
decl String:hostname[256];
GetClientName(0, hostname, sizeof(hostname));
IRC_ReplyToCommand(nick, "(%d/%d): %s",
GetClientCount(false), GetMaxClients(), hostname);
}
public Action:IRCGameInfo(const String:nick[], args) {
GameInfo(nick);
return Plugin_Handled;
}
// full irc status list
public Action:IRCStatus(const String:nick[], args) {
GameInfo(nick);
for (new i = 1; i <= GetMaxClients(); i++) {
if (IsClientConnected(i)) {
IRC_ReplyToCommand(nick, "# %d \"%N\" %s %s %d",
GetClientUserId(i), i, tf2b(i), ClientTime(i),
RoundToFloor(GetClientAvgLatency(i, NetFlow_Both)*1000.0));
}
}
return Plugin_Handled;
}
// (de)initialize plugin and hook events
new loaded = 0;
public OnPluginStart() {
PrintPlayerCount();
HookEvent("player_spawn", Event_PlayerSpawn);
}
IRC_Loaded() {
IRC_CleanUp();
if (!loaded) {
loaded = 1;
IRC_HookEvent("366", IRCJoin);
IRC_RegCmd("gameinfo", IRCGameInfo, "gameinfo");
IRC_RegCmd("status", IRCStatus, "status");
RegAdminCmd("itemevent", ItemEvent, ADMFLAG_SLAY, "");
HookEvent("item_found", ItemFound);
HookEvent("player_disconnect", Event_PlayerDisconnect, EventHookMode_Post);
decl String:buffer[512];
BuildPath(Path_SM, buffer, sizeof(buffer), "configs/items.kv");
kv = CreateKeyValues("items");
FileToKeyValues(kv, buffer);
}
}
public OnLibraryAdded(const String:name[]) {
if (StrEqual(name, "sourceirc", false)) {
IRC_Loaded();
}
}
public OnPluginEnd() {
CloseHandle(kv);
IRC_CleanUp();
}
// pdl-idler_url.list (0.9025)
// Copyright (c) 2011-2016 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/>
SteamIDEditSettingsPage
{
url "%community%/%mystuff%/edit/settings"
method "internal"
filter "profile"
}
StoreExploreStart
{
url "%store%/explore/startnew"
method "internal"
filter "store"
}
@rmebjesus
Copy link

Hi there!

I've noticed the 0.74 release. Have you managed to update the idler to work without resorting to -textmode and accepting the item drop confirmation?

Edit: Nvm I've read the changelog and the diff. I'll give the idler a go in the coming weeks.

@gtbsleephead
Copy link

Great program - works really well. I run in a vm and it's by far the best method i have tried.

One problem - could you explain the utility command a bit more pls?

Is it possible to run a windows program under the accounts' wine environment? For example:
./pdl-idler.sh utility=wine /path-to/steamitemmanager.exe accnt1

Should the program be located in account folders:
/home/pdl-idler/wine-accnt1/drive-c/windows/steamitemmanager.exe

or can i use a folder outside the wine folder:
/home/pdl-idler/steamitemmanager.exe

edit:
./pdl-idler.sh utility=/path-to/steamitemmanager.exe accnt1 works - not sure why it did not initally.

@primarydataloop
Copy link
Author

hmm, it would seem you didnt supply '^' character in place of the space after wine in your first invocation. I dont know why its starting without you supplying the 'wine^' in the second example though. hmm, Ill bet your distro has the thing that can assume its wine that needs to load that binary, on my slackware I dont have that. That's probably it. So yah, you need to replace any spaces in utility/command parameters with '^'.

are you rich-Virtualbox, btw?

@gtbsleephead
Copy link

yep - rich-Virtualbox.

It's ubuntu 13.04 on virtualbox host on Windows 7

What is with the irc stuff anyhow? What do you use it for?

Also, could explain a little about the friending command - I have a lot of requests but cannot get to accept.

@primarydataloop
Copy link
Author

the servers connect to my irc channel and report connections/disconnections. It's a convenience that you can disable, or you change the IRC servers if you like. id like them to also report item drops, but that might not be possible. as for support, I wouldn't rely on this gist comment section, add me on steam, or join the IRC channel, irc.freenode.net #primarydataloop

@ferrets
Copy link

ferrets commented Sep 17, 2013

Hi, this code is incredible you must have spent a lot of time on it!! I am pretty new to this with all the recent changes TF2 have made!

Hopefully you can help me out I have it working nicely with the games loading into my own server but because I load the GUI it uses a lot of resources, can you still load it up and accept notifications with the "play" flag not set so I don't see the game? At the moment I loop round and kill the player in game to then get the item notification to close and carry on like that.

@Nonickn
Copy link

Nonickn commented Sep 23, 2013

Did I something wrong? Why you deleted my post?

@primarydataloop
Copy link
Author

did no such thing.

@Nonickn
Copy link

Nonickn commented Sep 28, 2013

Oh this is so strange I was sure I posted here, well sorry then, will just try again lol.

That were something like:

Hello.
Thank you for sharing this great script, would be good if you could help me solve some problem.
Always when I trying to farm few account at once I got stucked on "...authenticated, loading... "
Example:

xxx@xxx:~$ '/home/xxx/pdl-idler/pdl-idler.sh' farm acc1 acc2 acc3 acc4
[20:45:09] checking/updating server content... |v1913431
[20:45:18] loading server... |v1913431
[20:45:35] getting server schema... |220mb
[20:45:36] connecting server to irc... |xxx,220mb
[20:45:49] server started |72D7C1F4,220mb
[20:45:49] starting Xvfb... |farm,:1.0,v1.13.3
[20:45:49] starting x11vnc... |v0.9.13
[20:45:50] acc1: prepping wineprefix... |p5,v1.7.1
[20:45:54] acc1: starting (hidden,low) steam... |#f16545
[20:46:04] acc1: authenticated, loading... |UDP,@2601,113mb"

When I trying to do next account anyway getting the same
Example::

'/home/xxx/pdl-idler/pdl-idler.sh' farm acc2
[05:07:18] acc2: prepping wineprefix... |p5,v1.7.2
[05:07:19] acc2: starting (hidden,low) steam... |#b33899
[05:07:31] acc2: authenticated, loading... |UDP,@25581,121mb

So I just must do this step for each account, only this way work for me. Afer that I can again repeat 1st step and all acounts starting
Example:

xxx@xxx:~$ '/home/xxx/pdl-idler/pdl-idler.sh' farm acc1 acc2 acc3
[05:10:57] acc1: preparing farm tf2... |$premium,163mb
[05:10:59] acc1: loading tf2... |@11966,165/32mb
[05:11:10] acc1: getting schema... |v1919763,164/147mb
[05:11:10] acc1: client started |0D77F4E5,164/147mb
[05:11:11] acc1: querying server... |10.0.2.15,164/151mb
[05:11:12] acc1: connected |(1/32),164/152mb
[05:11:13] started helper |@12605
[05:11:13] acc2: preparing farm tf2... |$premium,163mb
[05:11:15] acc2: loading tf2... |@12701,165/32mb
[05:11:22] acc2: getting schema... |v1919763,166/146mb
[05:11:23] acc2: client started |0D77F4E5,164/149mb
[05:11:24] acc2: querying server... |10.0.2.15,164/151mb
[05:11:26] acc2: connected |(2/32),164/152mb
[05:11:26] acc3: preparing farm tf2... |$premium,163mb
.....

Could you please tell me what i doing wrong?
Ubuntu 12.04

@primarydataloop
Copy link
Author

I think this might be an odd issue with certain graphical drivers, such that, if you were to focus your system VT on the farm display, it might proceed. I've only encountered it once in the past with the intel driver, and somebody else had the issue with the proprietary ati driver (fglrx). As I've noticed, your on virtualbox or something, so it's a mystery. Join the IRC chat for troubleshooting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment