ON INIT {
 SETNAME [description_leggings_villager3]
 SET_PRICE 60
 SET_MATERIAL CLOTH
 SET_ARMOR_MATERIAL CLOTH
 SET_STEP_MATERIAL Foot_shoe
 SET_GROUP PROVISIONS
 SETPLAYERTWEAK LEGS "human_villager_legs3"
 TWEAK SKIN "npc_human_chainmail_body" "npc_human_villager2_clothes3"
 SETOBJECTTYPE LEGGINGS
 SETEQUIP armor_class 1
 SET_DURABILITY 8
 SET_WEIGHT 1
 ACCEPT
}

ON EQUIPIN {
 PLAY "equip_armor"
 ACCEPT
}

ON INVENTORYUSE {
 //COLORISE SELF 0 0 0
 EQUIP PLAYER
 ACCEPT
}

//#armor
ON COMBINE {
 IF (^$PARAM1 ISCLASS "Tool_Craft" ) {
  PLAY "equip_armor"
 INVENTORY PLAYERADD \\PROVISIONS\\Cloth_Normal\\Cloth_Normal
 INVENTORY PLAYERADD \\PROVISIONS\\Leather_Normal\\Leather_Normal
 DESTROY SELF
  ACCEPT
 }
 IF (§enchanted == 1) { 
  SPEAK -p [player_no] NOP
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "GARLIC" ) {
  SET £reagent "garlic"
  HALO -ocs 0 1 0 30
  GOTO REGENTMIXED
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "rock_amikar" ) {
  SET £reagent "rock_amikar"
  HALO -ocs 1 1 1 30
  GOTO REGENTMIXED
  ACCEPT
 }
 ACCEPT
}

>>REGENTMIXED
 DESTROY ^$PARAM1
 TIMERoff 1 1 HALO -f
 SETNAME [description_chainmail_leggings_ready]
 SPEAK -p [Player_off_interesting] NOP
 ACCEPT


ON SPELLCAST {
 IF (^$PARAM1 != ENCHANT_WEAPON) ACCEPT
 IF (§enchanted == 1) { 
  SPEAK -p [player_no] NOP
  ACCEPT
 }
 IF (£reagent == 0) { 
  SPEAK -p [player_wrong] NOP
  ACCEPT
 }
 SET §enchanted 1
 PLAY -o "Magic_Spell_Enchant_Weapon"
 SETNAME [description_chainmail_leggings]
  IF (£reagent == "garlic") {
  HALO -ocs 0 1 0 30
  SETEQUIP defense 5
  SET §tmp ~^PRICE~
  MUL §tmp 1.2
  //HALO -ocs 0 1 1 30
  GOTO ENCHANTED
 }
  IF (£reagent == "rock_amikar") {
  HALO -ocs 1 1 1 30
  SET_DURABILITY 100
  SET_DURABILITY -c 100
  SET §tmp ~^PRICE~
  MUL §tmp 2
  //HALO -ocs 1 1 1 30
  GOTO ENCHANTED
 }
 ACCEPT
}

>>ENCHANTED
  SET_PRICE §tmp
  UNSET §tmp
  UNSET £reagent
  //HALO -ocs 0.6 0.6 1 30
  ACCEPT

ON REPAIRED {
 IF (^$PARAM1 == "checkdur") {
  IF (^DURABILITY == ^MAXDURABILITY) {
   SPEAK -p [player_weapon_already_repaired] NOP
   ACCEPT
  }
  SENDEVENT REPAIR ^SENDER ""
  ACCEPT
 }
 SET §tmp ~^MAXDURABILITY~
 REPAIR SELF ~^PLAYER_SKILL_MECANISM~
 if (^DURABILITY < §tmp) {
  SPEAK -p [player_weapon_repaired_partially] NOP
  ACCEPT
 }
 SPEAK -p [player_weapon_repaired_in_full] NOP
 UNSET §tmp
 ACCEPT
}

ON BREAK {
PLAY "Crushing"
DESTROY SELF
ACCEPT
}
//#
ON DURABILITY_ARMOR {
 SET_DURABILITY -c ~^$PARAM1~
 ACCEPT
}