import es

import wcs
from wcs import wcs

wcs.Item('Ring of Regeneration').registerItem('defense', 4000, 'Regain health over time.', True)

def item_bought(ev):
    if ev['item'] == 'Ring of Regeneration':
        wcs.Command(ev['userid']).Regen(2, 1)
            
def player_spawn(ev):
    count = wcs.Command(ev['userid']).GetItemCount('Ring of Regeneration')
    while count:
        count -= 1
        wcs.Command(ev['userid']).Regen(2, 1)
            
def player_death(ev):
    wcs.Command(ev['userid']).RemoveItem('Ring of Regeneration')
