Пример #1
0
 def __getSellPriceModifiersFromCache(self, typeCompDescr):
     cache = self.__cache
     items = cache.get('items', {})
     sellPriceModif = cache.get('sellPriceModif', 0)
     sellPriceFactors = items.get('vehicleSellPriceFactors', {})
     sellForGold = items.get('vehiclesToSellForGold', {})
     return (self.__getCacheRevision(), cache.get('exchangeRate', 0),
             cache.get('exchangeRateForShellsAndEqs', 0), sellPriceModif,
             sellPriceFactors.get(typeCompDescr,
                                  sellPriceModif), typeCompDescr
             in sellForGold)
Пример #2
0
 def __getSellPriceModifiersFromCache(self, typeCompDescr):
     cache = self.__cache
     items = cache.get('items', {})
     sellPriceModif = cache.get('sellPriceModif', 0)
     sellPriceFactors = items.get('vehicleSellPriceFactors', {})
     sellForGold = items.get('vehiclesToSellForGold', {})
     return (self.__getCacheRevision(),
      cache.get('exchangeRate', 0),
      cache.get('exchangeRateForShellsAndEqs', 0),
      sellPriceModif,
      sellPriceFactors.get(typeCompDescr, sellPriceModif),
      typeCompDescr in sellForGold)
Пример #3
0
def _clone_item(s, objname, objtzid, newname=''):
    # first try to clone an item
    # look first in the room or on the player
    # then at existing item objects
    orig = s.player.itemname(objname) or \
                s.player.item(objtzid) or \
                s.room.itemname(objname) or \
                s.room.item(objtzid) or \
                items.getname(objname) or \
                items.get(objtzid)

    # if it is not there, it might be an item class
    if orig is None:
        if objname in items.classes():
            cls = getattr(items, objname)
            obj = cls()
        else:
            obj = None
    else:
        obj = copy.copy(orig)

    if obj:
        if newname:
            obj.name = newname
        s.message(obj, 'created.')
        s.player.add(obj)
        s.room.action(dict(act='clone_item', actor=s.player, item=obj))
        return obj
Пример #4
0
def user_details(username):
	if 'username' not in session: return goto_login(fname(), fparms())
	user_info = userlists.get_user_info(username, check_online=True)
	items_json = {}
	for item in items.get():
		items_json[item['id']] = item['name']
	items_json = json.dumps(items_json)
	mcs.prepare_nbt()
	try:
		pxp = mcs.get_player_xp(username)
	except mcserver.NBT_IO_Exception:
		pxp = None
	return render_template('user_details.html', navigation=get_navi('users'), info=user_info, name=username, items=items.get(), items_json=items_json, pxp=pxp)