sharedobjects

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.

Note

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)

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

csgo_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.

@csgo_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 csgo_client.socache[ESOType.CSOEconItem][obj.id]
csgo.features.sharedobjects.find_so_proto(type_id)

Resolves proto massage for given type_id

Parameters:type_id (csgo.enums.ESOType) – SO type
Returns:proto message or None
class csgo.features.sharedobjects.NO_KEY
csgo.features.sharedobjects.get_so_key_fields(desc)
csgo.features.sharedobjects.get_key_for_object(obj)
class csgo.features.sharedobjects.SOBase

Bases: object

class csgo.features.sharedobjects.SOCache(csgo_client, logger_name)

Bases: eventemitter.EventEmitter, dict

class ESOType

Bases: enum.IntEnum

CSOAccountSeasonalOperation = 41
CSOEconCoupon = 45
CSOEconDefaultEquippedDefinitionInstanceClient = 43
CSOEconGameAccountClient = 7
CSOEconItem = 1
CSOEconItemDropRateBonus = 38
CSOEconItemEventTicket = 40
CSOItemRecipe = 5
CSOPersonaDataPublic = 2
CSOQuestProgress = 46
emit(event, *args)

Emit event with some arguments

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