teleport

concepts
CONCEPT
	Teleportation

LAST UPDATE
	Mutabor, February 13 12:16:33 MET DST 1994

DESCRIPTION
  General:
	Teleportation is the moving of a living(npc/pc) or an item from
	one location to another.
	Teleportation can be done by either spells, items, livings or 
	even rooms.
	It is a fact that teleportation produces the most problems of 
	all magic related stuff in a mud. That is because you can
	easily cheat e.g. during a quest if you have a teleport item
	that doesn't check the teleport properties correctly.

	So whatever you do with teleportation, ALWAYS double check your
	code AND inform the magic department that you have created a
	teleport item/spell/... to prevent major problems.

  Rules:
    General:
	- THESE RULES ARE PART OF THE WIZRULES!
        - The use of teleportation items/scrolls/spells is allowed for
	  players with a level equal or higher than 10. 
	- Players equal to or higher than level 18 may teleport even if
	  they are fighting at the moment. All others are not allowed to
	  teleport away or be teleported away from the midst of a battle.
	- Teleport should cost at least 30 SP. Exceptions possible.
	- Teleport items/spells/scrolls/... MUST be reported and after-
	  wards checked by the magic department. Any change MUST also be
	  reported.
    Players teleporting Players:
	- Only teleportation of players is allowed. NO teleportation to
	  players (In other words: 'trans' is allowed, 'goto' not).
          (Exception: GuildCommanderTools/Rooms. They allow teleport to
           a player)
	- Players may be only teleported if they have the teleport-amulet
	  and they want to be teleported (More about the teleport-amulet
	  below).
    Teleport to certain locations or away from certain locations:
	- Teleportation by items/scrolls/spells to certain locations is
	  allowed also for lower level characters (Example: The guide and
	  its milliways command.)
	- Teleport items/scrolls/spells/... must use a 
	  move("location",M_TELEPORT). Exceptions possible, but only very
	  seldom.
    Players teleporting Wizards:
	- Always forbid teleporting to or of a wizard. Check this!
    Wizards in General:
	- No limitation for teleports for wizards. In fact you have to
	  make sure that wizards can use your items too.
	- If you include a wizcheck (that in fact is very nice) also
	  include a check about wizmode (QueryProp(P_NOWIZ))

  Rooms:
	Every room can be 'teleport proof'. All you have to do is to
	include the <magic.h> and to set the teleport properties (see
	also the examples):
	  TPORT_NO   allows no teleporting into or from the room.
	  TPORT_IN   allows only teleport into the room
	  TPORT_OUT  allows only teleport from the room
	  TPORT_BOTH  allows every teleport (default).
	You can disable all teleport spells (but not the items) with the
	new magic protection (see example below)
	
  	
  Spells/Scrolls:
	Spells/Scrolls must check if a room is teleport-proof. To see how
	this is done, have a look at /obj/magic/scrolls/teleport.c or look at 
	the example below.
	Also always inherit /obj/scroll. 
	Use its QueryAllowedTeleport() (even if it's part of /obj/scroll 
	see also Std-Teleport below) or the CheckTeleport().

  Items:
	Same as Spells, but inherit STD_TELEPORT as defined in <magic.h>
	instead.

  Teleport-Amulet:
	Every Player who wants to be teleported by other players must
	have the teleport-amulet. It's Id is "tportamulet".
	To be teleported by others the amulet has to be switched on.
	To check if the teleport-amulet is switched on, simply call the
	QueryTeleport() in the teleport-amulet. 1 is switched on; 0 switched
	off.
	If you want to inform the owner of the teleport	amulet that someone
	tried to teleport him/her, call
	glow(object <owner>, string <teleporter>, [string <item>])
	    lets the amulet of <owner> glow and tell him/her that <teleporter>
	    tried to teleport him/her.
	    if <item> is given, it also tells him/her which item <teleporter>
	    was used to try to teleport him/her.

   Std-Teleport:
	It includes properties.h; magic.h and wizlevels.h
	To check if teleport is allowed call:
	CheckTeleport(object <player>, int <Amount SP>, [int <level>])
	    This function does all the checking like Queryenemies, Wizchecks.
	    <player> is the recepient of the spell/item ability.
	    It reduces (if possible) the Spell points of caster/user of a 
	    teleport spell/item by <Amount SP>. If <Amount SP> is < 30 it is
	    set to 30.
            It returns the given values from magic.h if anything is wrong.
            (E.g. TP_NO_SP if caster has not enough Spell points)
	    TP_OK means that teh SP are reduced and that everything is
            fine.
	Or you can also call QuerryAllowedTeleport(<player> <SP> [level])
	    It does not only all necessary checkings, but also sends out
	    the proper notify_fail messages.
	    It returns 1 if everything is fine and player may use teleport
	    It returns 0 if something is wrong(like not enough SP) and sends
	       a notify_fail message.
	    
        The optional <level> can be set to allow teleport below level 10
		but that has to be approved by the magic department.
	The lowest possible <level> is 4.

	Remember that you have to use move with M_TELEPORT and that the
        room itself may prefent teleporting also. The rooms will send
        ME_NO_LEAVE e.g. if player is not allowed to leave the rooms.
        For more details look at the 'man room'

SOURCES
	Example files can be found in /d/archwiz/common/magic/rooms, under 
	the magic department:
	TELEPORT PROPERTIES:
	t1: All teleports are allowed
	t2: No teleport allowed
	t3: Only teleport out allowed
	t4: Only teleport in allowed
	
	To try these properties correctely you have to switch off your
	wizardhood first :-). That is done with:
	wizmode off           To switch it on again you have to type:
	wizmode on

	teleport_amulet 	/obj/magic/obj/t_amulet.c	
	std-teleport 		/obj/magic/std/std-teleport.c
                       or just  STD_TELEPORT as defined in magic.h

	magic.h 		<magic.h> or /sys/magic.h (where else;-) 

EXAMPLES
	SetTPort(TPORT_NO); forbids teleporting in or out of a certain room
	SetTPort(TPORT_IN); allows only teleporting into this room ...

	AddMagicProtection(ST_TELEPORT,"<Message why it is forbidden>");
			    Forbids all TeleportSpells, but not the items.
	An good example how to use the CheckTeleport is coded in the
        STD_TELEPORT itself. Have a look at its QueryAllowedTeleport
	An other example can be found in /obj/magic/examples/teleport_ring

SEE ALSO
	magic(C)