import es

import wcs
from wcs import wcs

itemName = 'Ring of Armor'

wcs.Item(itemName).registerItem('powerup', 1000, "This protective ring can stop bullets. +120 Armor", True)

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