Example #1
0
def sell(request):
    req = request._proto
    char_id = request._char_id

    item = Item(char_id)
    horse = Horse(char_id)

    # check
    for ele in req.elements:
        if ele.tp == 1:
            print "NOT SUPPORT SELL HERO"
            continue

        if ele.tp == 2:
            print "NOT SUPPORT SELL SOUL"
            continue

        if ele.tp == 3:
            item.equip_check_sell([ele.id])
            continue

        if ele.tp == 4:
            item.gem_check_sell(ele.id, ele.amount)
            continue

        if ele.tp == 5:
            item.stuff_check_sell(ele.id, ele.amount)
            continue

        if ele.tp == 6:
            horse.check_sell(ele.id)
            continue

    # sell
    for ele in req.elements:
        if ele.tp == 1:
            print "NOT SUPPORT SELL HERO"
            continue

        if ele.tp == 2:
            print "NOT SUPPORT SELL SOUL"
            continue

        if ele.tp == 3:
            item.equip_sell([ele.id])
            continue

        if ele.tp == 4:
            item.gem_sell(ele.id, ele.amount)
            continue

        if ele.tp == 5:
            item.stuff_sell(ele.id, ele.amount)
            continue

        if ele.tp == 6:
            horse.sell(ele.id)
            continue

    return None