#################################################################
#   )      (\_     # WOLFPACK 13.0.0 Scripts                    #
#  ((    _/{  "-;  # Created by: khpae                          #
#   )).-" {{ ;"`   # Revised by:                                #
#  ( (  ;._ \\ ctr # Last Modification: Created                 #
#################################################################

import wolfpack
from spells.spellfunctions import *
from math import floor

def onSpellSuccess( char, spell, type, target ):
	# target check is done at c++ code
	tgt = target.item
	if not tgt:
		return
	# skill check is done in c++ core
	# target validation : multi ?
	# door / wooden box
	if( ( tgt.type == 12 ) or ( tgt.id == "e79" ) or ( tgt.id == "e7d" ) ):
		lockLevel = floor( char.skill[ MAGERY ] / 40 )
		tgt.settag( "lockLevel", lockLevel )
	else:
		return
	# effects
	tgt.soundeffect( 0x1f5 )
	tgt.effect( 0x376a )
	char.socket.sysmessage( "*Locked!*" )
	return 1

