Exemple #1
0
def _check_gems(char_id, gems, func_name=""):
    from core.item import Item
    item = Item(char_id)
    for _id, _amount in gems:
        if not item.has_gem(_id, _amount):
            raise SanguoException(GEM_NOT_ENOUGH, char_id, func_name, 'Gem {0} Not Enough/Exist'.format(_id))

    yield

    for _id, _amount in gems:
        item.gem_remove(_id, _amount)
Exemple #2
0
def _check_gems(char_id, gems, func_name=""):
    from core.item import Item
    item = Item(char_id)
    for _id, _amount in gems:
        if not item.has_gem(_id, _amount):
            raise SanguoException(GEM_NOT_ENOUGH, char_id, func_name,
                                  'Gem {0} Not Enough/Exist'.format(_id))

    yield

    for _id, _amount in gems:
        item.gem_remove(_id, _amount)