import es

import wcs
from wcs import wcs

itemName = 'Tomb of Health'

wcs.Item(itemName).registerItem('powerup', 5900, "Mystical powers shroud you in a protective light. +100 health", True)

def item_bought(ev):
    if ev['item'] == itemName:
        wcs.Command(ev['userid']).HealthAdd(50)
        
def player_spawn(ev):
    count = wcs.Command(ev['userid']).GetItemCount(itemName)
    while count:
        wcs.Command(ev['userid']).HealthAdd(50)
        count -= 1
        
def player_death(ev):
    wcs.Command(ev['userid']).RemoveItem(itemName)
