public void TeleportTo(TeleportDestination destination)
        {
            ConnectedPlayer teleportingPlayer = GetLastReader();

            if (!HasChargesRemaining(teleportingPlayer.GameObject))
            {
                return;
            }

            if (teleport.IsBusy)
            {
                Chat.AddExamineMsgFromServer(teleportingPlayer.GameObject, $"You are already teleporting!");
                return;
            }

            Transform spawnTransform = PlayerSpawn.GetSpawnForJob((JobType)destination);

            teleport.ServerTeleportWizard(teleportingPlayer.GameObject, spawnTransform.position.CutToInt());

            SpellData teleportSpell = SpellList.Instance.Spells.Find(spell => spell.Name == "Teleport");

            SoundManager.PlayNetworkedAtPos(
                teleportSpell.CastSound, teleportingPlayer.Script.WorldPos, sourceObj: teleportingPlayer.GameObject);

            var incantation = $"{teleportSpell.InvocationMessage.Trim('!')} {destination.ToString().ToUpper()}!";

            Chat.AddChatMsgToChat(teleportingPlayer, incantation, ChatChannel.Local);

            ChargesRemaining--;
        }
        public void TeleportTo(TeleportDestination destination)
        {
            var teleportingPlayer = netTab.LastInteractedPlayer();

            if (!HasChargesRemaining(teleportingPlayer))
            {
                return;
            }

            if (teleport.IsBusy)
            {
                Chat.AddExamineMsgFromServer(teleportingPlayer, $"You are already teleporting!");
                return;
            }

            Transform spawnTransform = PlayerSpawn.GetSpawnForJob((JobType)destination);

            teleport.ServerTeleportWizard(teleportingPlayer, spawnTransform.position.CutToInt());
            Chat.AddChatMsgToChat(teleportingPlayer.Player(), $"SCYAR NILA {destination.ToString().ToUpper()}!", ChatChannel.Local);

            ChargesRemaining--;
        }
Beispiel #3
0
 public void Init(GUI_TeleportScroll scrollGUI, TeleportDestination destination)
 {
     this.scrollGUI   = scrollGUI;
     this.destination = destination;
     destinationLabel.SetValueServer(destination.ToString());
 }