public void LearnSpell(SpellBookSpell spellEntry) { if (spellEntry.Cost > Points) { return; } points -= spellEntry.Cost; var player = netTab.LastInteractedPlayer(); var playerScript = player.GetComponent <PlayerScript>(); var spell = spellEntry.Spell.AddToPlayer(playerScript); var mind = playerScript.mind; mind.AddSpell(spell); }
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()); SpellData teleportSpell = SpellList.Instance.Spells.Find(spell => spell.Name == "Teleport"); SoundManager.PlayNetworkedAtPos( teleportSpell.CastSound, teleportingPlayer.Player().Script.WorldPos, sourceObj: teleportingPlayer); var incantation = $"{teleportSpell.InvocationMessage.Trim('!')} {destination.ToString().ToUpper()}!"; Chat.AddChatMsgToChat(teleportingPlayer.Player(), incantation, ChatChannel.Local); ChargesRemaining--; }
public void LearnSpell(SpellBookSpell spellEntry) { if (spellEntry.Cost > Points) { return; } points -= spellEntry.Cost; var player = netTab.LastInteractedPlayer().Player(); SoundManager.PlayNetworkedAtPos("Blind", player.Script.WorldPos, sourceObj: player.GameObject); Chat.AddChatMsgToChat(player, spellEntry.Incantation, ChatChannel.Local); Spell spell = spellEntry.Spell.AddToPlayer(player.Script); player.Script.mind.AddSpell(spell); }
public void SpawnUplinkItem(GameObject objectRequested, int cost) { // Grabs the player's playerscript by asking HasNetworkTabItem who was the last person to interact if (cost <= teleCrystals) { var player = TabOnGameObject.LastInteractedPlayer().GetComponent <PlayerScript>().ItemStorage; var result = Spawn.ServerPrefab(objectRequested); var item = result.GameObject; teleCrystals -= cost; if (player.GetNamedItemSlot(NamedSlot.rightHand) == null) { Inventory.ServerAdd(item, player.GetNamedItemSlot(NamedSlot.rightHand), ReplacementStrategy.DropOther); } Inventory.ServerAdd(item, player.GetNamedItemSlot(NamedSlot.leftHand), ReplacementStrategy.DropOther); } }
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--; }
/// <summary> /// Gets the latest player to interact with tab. /// </summary> public ConnectedPlayer GetLastReader() { return(netTab.LastInteractedPlayer().Player()); }