rendered paste body//
//
//
//
using System;
using System.Collections;
using System.Timers;
using DOL;
using DOL.IPvP;
using DOL.GS;
using DOL.Database;
using DOL.GS.Scripts;
using DOL.Events;
using DOL.GS.GameEvents;
using DOL.GS.PacketHandler;
using DOL.GS.Quests;
namespace DOL.IPvP
{
public class Teleporter: GameMob
{
RegionTimer TeleportTimer;
public GamePlayer TeleportObject = null;
public int TeleportLocation = 0;
public override bool Interact(GamePlayer player)
{
if (!base.Interact(player)) return false;
TurnTo(player, 100);
//foreach(GamePlayer emoteplayer in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
//player.Out.SendMessage("Hello, "+player.Name+", \n\nWhere may my mights bring you to?\n\"+
// " [iPvP Area]\n\n"+
// "[Camelot] [Tir Na nOg] [Jordheim]", eChatType.CT_System, eChatLoc.CL_PopupWindow);
SendReply(player, "Hello, "+player.Name+", \n\nWhere may my mights bring you to?\n\n"+
" [iPvP Area]\n\n"+
"[Camelot] [Tir Na nOg] [Jordheim]");
return true;
}
public void Teleport(string linename, int spellLevel, GamePlayer t, int loc)
{
TeleportObject = t;
TeleportLocation = loc;
TargetObject = (GameLiving)t;
if (TeleportTimer != null)
TeleportTo(TeleportObject, TeleportLocation);
else {
Spell castSpell = null;
SpellLine castLine = null;
castLine = (SpellLine)SkillBase.GetSpellLine(linename);
IList spells = SkillBase.GetSpellList(castLine.KeyName);
foreach (Spell spell in spells)
{
if (spell.Level == spellLevel)
{
castSpell = spell;
break;
}
}
TurnTo(TargetObject);
CastSpell(castSpell, castLine);
StartTeleportTimer();
}
}
public void StartTeleportTimer()
{
TeleportTimer = null;
TeleportTimer = new RegionTimer(this, new RegionTimerCallback(TeleportTimerCallback), 3000);
}
protected virtual int TeleportTimerCallback(RegionTimer timer)
{
timer.Stop();
timer = null;
TeleportTo(TeleportObject, TeleportLocation);
TeleportObject = null;
TeleportLocation = 0;
return 0;
}
public void TeleportTo(GamePlayer t, int loc)
{
Say(t+ ", You would have been ported to "+loc+" right now.");
}
public override bool WhisperReceive(GameLiving source, string str)
{
if(!base.WhisperReceive(source,str)) return false;
if(!(source is GamePlayer)) return false;
GamePlayer t = (GamePlayer) source;
//GameLiving TargetObject = (GameLiving)this; //(GameLiving)t;
switch(str)
{
case "iPvP Area":
Teleport("Deathsight", 48, t, 1);
break;
case "Tir Na nOg":
Teleport("Deathsight", 48, t, 2);
break;
case "Camelot":
Teleport("Deathsight", 48, t, 3);
break;
case "Jordheim":
Teleport("Deathsight", 48, t, 4);
break;
}
return true;
}
private void SendReply(GamePlayer target, string msg)
{
target.Out.SendMessage(msg,eChatType.CT_System, eChatLoc.CL_PopupWindow);
}
}
}