Exemple #1
0
 def _load_clanIcons_callback(self, pl, tID, bytes):
     try:
         debug(tID + " " + (str(len(bytes)) if bytes else '(none)'))
         if bytes and imghdr.what(None, bytes) is not None:
             # imgid = str(uuid.uuid4())
             # BigWorld.wg_addTempScaleformTexture(imgid, bytes) # removed after first use?
             imgid = 'icons/{0}.png'.format(pl.clan)
             filecache.save(imgid, bytes)
             pl.emblem = 'xvm://cache/{0}'.format(imgid)
     except Exception:
         err(traceback.format_exc())
     finally:
         self._loadingClanIconsCount -= 1
 def _load_clanIcons_callback(self, pl, tID, bytes):
     try:
         if bytes and imghdr.what(None, bytes) is not None:
             # imgid = str(uuid.uuid4())
             # BigWorld.wg_addTempScaleformTexture(imgid, bytes) # removed after first use?
             imgid = 'icons/{0}.png'.format(pl.clan)
             filecache.save(imgid, bytes)
             del pl.x_emblem_loading
             pl.x_emblem = 'res_mods/mods/shared_resources/xvm/cache/%s' % imgid
             if hasattr(pl, 'clanicon'):
                 del pl.clanicon
             as_xfw_cmd(XVM_COMMAND.AS_ON_CLAN_ICON_LOADED, pl.vehicleID, pl.name)
         #debug('{} {} {} {}'.format(
         #    pl.clan,
         #    tID,
         #    len(bytes) if bytes else '(none)',
         #    imghdr.what(None, bytes) if bytes else ''))
     except Exception:
         err(traceback.format_exc())
     finally:
         self._loadingClanIconsCount -= 1
Exemple #3
0
 def _load_clanIcons_callback(self, pl, tID, bytes):
     try:
         if bytes and imghdr.what(None, bytes) is not None:
             # imgid = str(uuid.uuid4())
             # BigWorld.wg_addTempScaleformTexture(imgid, bytes) # removed after first use?
             imgid = 'icons/{0}.png'.format(pl.clan)
             filecache.save(imgid, bytes)
             del pl.x_emblem_loading
             pl.x_emblem = 'res_mods/mods/shared_resources/xvm/cache/%s' % imgid
             if hasattr(pl, 'clanicon'):
                 del pl.clanicon
             as_xfw_cmd(XVM_COMMAND.AS_ON_CLAN_ICON_LOADED, pl.vehicleID, pl.name)
         #debug('{} {} {} {}'.format(
         #    pl.clan,
         #    tID,
         #    len(bytes) if bytes else '(none)',
         #    imghdr.what(None, bytes) if bytes else ''))
     except Exception:
         err(traceback.format_exc())
     finally:
         self._loadingClanIconsCount -= 1