#===============================================================#
#   )      (\_     | WOLFPACK 13.0.0 Scripts                    #
#  ((    _/{  "-;  | Created by: DarkStorm                      #
#   )).-' {{ ;'`   | Revised by:                                #
#  ( (  ;._ \\ ctr | Last Modification: Created                 #
#===============================================================#
# Script for Recall (Magic)										#
#===============================================================#

from recall_rune import isrune
from wolfpack.utilities import fizzle

def onSpellSuccess( char, spell, type, target ):
	# Check the target
	if not isrune( target.item ):
		char.socket.sysmessage( "This is not a rune." )
		fizzle( char )
		return

	# Check if we can mark a rune here
	if char.region and char.region.nomark:
		char.socket.sysmessage( "You can't mark a rune here." )
		fizzle( char )
		return

	item = target.item

	# Save Position on the rune and set charges to 50
	item.settag( 'charges', 50 )
	item.settag( 'marked', 1 )

	pos = char.pos
	item.settag( 'target_x', pos.x )
	item.settag( 'target_y', pos.y )
	item.settag( 'target_z', pos.z )
	item.settag( 'target_map',pos.map )
	
	region_name = "Unknown"
	if char.region:
		region_name = char.region.name

	item.name = region_name

	char.soundeffect( 0x1FA )
	char.socket.sysmessage( "You mark the rune." )
