import es
import gamethread

import wcs
from wcs import wcs

itemName = 'Helmet of Excellence'

wcs.Item(itemName).registerItem('defense', 4000, "This helmet grants you an additional 200 armor", True)
        
def item_bought(ev):
    if ev['item'] == itemName:
        wcs.Command(ev['userid']).ArmorAdd(200)
        
def player_spawn(ev):
    count = wcs.Command(ev['userid']).GetItemCount(itemName)
    while count:
        wcs.Command(ev['userid']).ArmorAdd(200)
        count -= 1
        
def player_death(ev):
    wcs.Command(ev['userid']).RemoveItem(itemName)
