Essentially a dict containing shared object caches. The objects are read-only, so don’t change any values. The instance reference of individual objects will remain the same thought their lifetime. Individual objects can be accessed via their key, if they have one.


Some cache types don’t have a key and only hold one object instance. Then only the the cache type is needed to access it. (e.g. CSOEconGameAccountClient)

dota_client.socache[ESOType.CSOEconItem]          # dict with item objects, key = item id
dota_client.socache[ESOType.CSOEconItem][123456]  # item object

dota_client.socache[ESOType.CSOEconGameAccountClient]  # returns a CSOEconGameAccountClient object

Events will be fired when individual objects are updated. Event key is a tuple` in the following format: (event, cache_type).

The available events are new, updated, and removed. Each event has a single parameter, which is the object instance. Even when removed, there is object instance returned, usually only with the key field filled.

@dota_client.socache.on(('new', ESOType.CSOEconItem))
def got_a_new_item(obj):
    print "Got a new item! Yay"
    print obj

# access the item via socache at any time
print dota_client.socache[ESOType.CSOEconItem][]

Resolves proto massage for given type_id

Parameters:type_id (dota2.enums.ESOType) – SO type
Returns:proto message or None
class dota2.features.sharedobjects.NO_KEY
class dota2.features.sharedobjects.SOBase

Bases: object

class dota2.features.sharedobjects.SOCache(dota_client, logger_name)

Bases: eventemitter.EventEmitter, dict

class ESOType

Bases: enum.IntEnum

CMsgDOTATournament = 2009
CSODOTAGameAccountClient = 2002
CSODOTAGameAccountPlus = 2012
CSODOTAGameHeroFavorites = 2007
CSODOTALobby = 2004
CSODOTALobbyInvite = 2011
CSODOTAMapLocationState = 2008
CSODOTAParty = 2003
CSODOTAPartyInvite = 2006
CSODOTAPlayerChallenge = 2010
CSOEconGameAccountClient = 7
CSOEconItem = 1
CSOEconItemDropRateBonus = 38
CSOEconItemEventTicket = 40
CSOEconItemLeagueViewPass = 39
CSOEconItemPresetInstance = 36
CSOEconItemTournamentPassport = 42
CSOItemRecipe = 5
CSOSelectedItemPreset = 35
file_version = None

so file version

emit(event, *args)

Emit event with some arguments

  • event (any type) – event identifier
  • args – any or no arguments