//###########################
//#  CSD UO Banquet system  #
//###########################

// 21.11.2001, Nika: Type with Wedding Rings added 
// 21.11.2001, Eidolon: Linked stones synchronization added

// sunday, Nov 11, 2001 - i think i'll upload this file today

[itemdef i_banquet_gate]
NAME= Banquet
ID= i_moongate_blue

On=@Create
	Color=0482

On=@Step
	if <timer> == -1
		remove
	endif

	if (<color>==0) || (<src.brain>)
		return 0
	endif

	if <src.flags> & statf_onhorse
		src.message No pets allowed!
		return 0
	endif

	if <more>==0
		src.spelleffect s_dispel 1000
	endif

	src.go <morep>


On=@Timer
	remove
	return 1


[FUNCTION f_link_sync]
	if (<link>!=04fffffff)
		if <link.baseid>!=i_bq_stolb
			link=04fffffff
			return 1
		endif
		if <link.timer> > <timer>
			timer=<link.timer>
		elseif <link.timer> < <timer>
			link.timer = <timer>
		endif
		if (<link.more> == 0) && (<more> > 0)
			link.more=<more>
		elseif (<more> == 0) && (<link.more> > 0)
			more=<link.more>
		endif
	endif
	return 1

[itemdef i_bq_stolb]
Name=Banquet Column
ID= i_gravestone_5
Type= t_normal

// on dclick testing for ticket : later on - for money

on=@dclick
	
	f_link_sync

	if <distance>>3
		message Thou art too far. Come closer.
		return 1
	endif
	
	if <timer>>0
		message Banquet Hall is not available now, Please try again in <timer> seconds.
		return 1
	endif

	if <more2> //in use, creating gates
		message Banquet Hall is not available now, Please try again later.
		return 1
	endif
	if <link>!=04fffffff
		if <link.more2> // link in use, creating gates
			message Banquet Hall is not available now, Please try again later.
			return 1
		endif
	endif

	if  <src.restest 1 i_banquet_ticket>
		f_banquet_gates
		src.consume 1 i_banquet_ticket
	elseif <src.restest <more> i_gold>
		f_banquet_gates
		src.consume <more> i_gold
	else
		src.message You must have <more> gold or Banquet Ticket to hold a banquet.
	endif
	return 1

On=@Timer
	if <timer>==0
		timer=-1
	endif
	return 1



[function f_banquet_gates]

		if <more2> //in use, creating gates
			return 1
		endif
		if <link>!=04fffffff
			if <link.more2> //link in use, creating gates
				return 1
			endif
		endif

		more2 = 1 //i am in use

// brit gate
		src.newitem =  i_banquet_gate
		src.act.morep= 2487,3569,5
		src.act.p = 1439,1703,0
		src.act.timer= 3600
//Buc gate
		src.newitem = i_banquet_gate
		src.act.morep= 2487,3569,5
		src.act.p= 2675,2179,0
		src.act.timer= 3600

// set timer on stolb
		timer= 3600

		if <link>!=04fffffff
			link.timer = 3600
		endif

		more2 = 0

[TYPEDEF t_wedding]
On=@click
src.message Click this to get Wedding Rings...
return 1
On=@Dclick
target Whom would you like to marry?
return 1

On=@Targon_char
	if (<distance>>3) || (<src.targ.distance>>3)
		message Thou art too far. Come closer.
		return 1
	endif
	
if !(<src.targ.brain>==0)
	  src.message You can not marry with NPC!! 
	  return 1
	endif
     if <src.uid>==<src.targ.uid>
	  src.message You can not marry yourself to yourself!
	  return 1
	endif

src.tag.p1=<src.sex 0/1>
src.tag.p2=<src.targ.sex 0/1>
     if <src.tag.p1>==<src.tag.p2>
       src.message Monosex marriages aren't blessed by Oskom's administration. Only polysex marriages allowed now.
       return 1
     else
src.tag.p1=
src.tag.p2=
     endif
	if (<src.findid.i_wedding_ring.uid>)
	  src.sysmessage You can't marry till divorce
	  return 1
	endif
	if (<src.targ.findid.i_wedding_ring.uid>)
	  src.targ.sysmessage You can't marry till divorce
	  src.sysmessage Your partner have been already married
	  return 1
	endif
	if <src.restest <more> i_gold>
		src.newitem= i_wedding_ring
		src.act.name= Married to <src.name>
          src.act.tag.partner=<src.uid>
          src.act.tag.owner=<src.targ.uid>
		src.act.cont=<src.targ.uid>
          SRC.EMOTE HAS BEEN MARRIED TO <src.targ.name>
          SRC.EMOTE feels happy
          
		src.newitem= i_wedding_ring
		src.act.name= Married to <src.targ.name>
          src.act.tag.partner=<src.targ.uid>
          src.act.tag.owner=<src.uid>
		src.act.cont=<src.uid>
          SRC.TARG.EMOTE HAS BEEN MARRIED TO <src.name>
          SRC.TARG.EMOTE feels happy
                   
		src.consume <more> i_gold
 		src.sound 0202
		return 1
	else
		src.message Wedding Rings pair cost <more> gold.
	endif
return 1

[ITEMDEF i_wedding_ring]
id=0108a
type=t_eq_script
WEIGHT=.1
CATEGORY=Provisions - Jewels and Jewelry
SUBSECTION=Jewelry
DESCRIPTION=Ring (Gold)
SKILLMAKE=TINKERING 250.0,t_tinker_tools
LAYER=8 

on=@create
attr= 04
more1= 07fff7fff
color= 08fc
type=t_eq_script
morex=1

On=@DClick
if !(<tag.owner>==<topobj.uid>)  //кольцо отдали другому:( давить! Убираем кольца! 
  if (<tag.partner>==<topobj.uid>) //на самом деле отдали мужу/жене - ок. норма.
    return 1
  endif
  if (<tag.owner>==<src.uid>) //сами одеваем с пола
    return 1
  endif
  topobj.emote holding NOT YORS MARRYAGE RING! SLAY HIM DOWN! Both rings removed! Marriage broken!
  link=<tag.partner>
  link.emote Your marriage broken. Your <src.uid.<tag.owner>.sex hasbend's/wife's> ring was in wrong hands...
  link=<tag.owner>
  link.emote Your marriage broken. Your <src.uid.<tag.partner>.sex hasbend's/wife's> ring was in wrong hands...
  link=04fffffff
  uid.<tag.partner>.findid(i_wedding_ring).remove
  remove
update
endif
cont=<src.uid>
return 1

On=@Click
src.message You see ring indicating that <topobj.name> have been married to <src.uid.<tag.partner>.name>
if !(<tag.owner>==<topobj.uid>)  //кольцо отдали другому:( давить! Убираем кольца! 
  if (<tag.partner>==<topobj.uid>) //на самом деле отдали мужу/жене - ок. норма.
    return 1
  endif
  if (<tag.owner>==<src.uid>) //сами одеваем с пола
    return 1
  endif
  topobj.emote holding NOT YOURS MARRYAGE RING! SLAY HIM DOWN! Both rings removed! Marriage broken!
  link=<tag.partner>
  link.emote Your marriage broken. Your <src.uid.<tag.owner>.sex husband's/wife's> ring was in wrong hands...
  link=<tag.owner>
  link.emote Your marriage broken. Your <src.uid.<tag.partner>.sex husband's/wife's> ring was in wrong hands...
  link=04fffffff
  uid.<tag.partner>.findid(i_wedding_ring).remove
  remove
update
endif

return 1

[EOF]