public override void OnSubmit() { if (GriefClientPro.ChatManager == null) { base.OnSubmit(); return; } // Create local event var chatEvent = new ChatManager.ChatEventArgs { Text = _input.value }; // Process the event GriefClientPro.ChatManager.OnSubmit(chatEvent); if (!chatEvent.CustomHandler || string.IsNullOrEmpty(chatEvent.Text)) { base.OnSubmit(); } else { // Create the chat event var @event = ChatEvent.Create(chatEvent.Target); @event.Message = chatEvent.Text; @event.Sender = chatEvent.SenderId; // Send the message PacketQueue.Add(@event); _input.value = null; _mustClose = true; _lastInteractionTime = Time.time; } }
// ReSharper disable once UnusedMember.Local private void Update() { try { if (BoltNetwork.isRunning && LocalPlayer.Entity != null && LocalPlayer.Entity.isAttached) { PlayerName = LocalPlayer.Entity.GetState <IPlayerState>().name; } } catch (Exception) { // ignored } if (ChatBox.IsChatOpen) { return; } if (OnTick != null) { try { foreach (var action in OnTick.GetInvocationList()) { try { action.DynamicInvoke(this, EventArgs.Empty); } catch (Exception e) { Logger.Exception($"Exception while notifying {nameof(OnTick)} listener: " + action.GetType().Name, e); } } } catch (Exception e) { Logger.Exception($"Exception while looping over {nameof(OnTick)} listeners", e); } } if (BoltNetwork.isRunning) { // Visible player if (Menu.Values.Self.Visible && LocalPlayer.Entity != null && !LocalPlayer.Entity.isAttached) { Utility.AttachLocalPlayer(); } // Invisible player else if (!Menu.Values.Self.Visible && LocalPlayer.Entity != null && LocalPlayer.Entity.isAttached) { Utility.DetachLocalPlayer(); } // Add fire trail to movement if (Menu.Values.Self.FireTrail) { var feetPos = LocalPlayer.Transform.position - new Vector3(0, 4, 0); if (Vector3.Distance(LastFirePos, feetPos) > 2 || Environment.TickCount - LastFireTime > 5000) { LastFirePos = feetPos; LastFireTime = Environment.TickCount; BoltPrefabsHelper.Spawn(BoltPrefabs.Fire, feetPos, LocalPlayer.Transform.rotation); } } } if (FreeCam && !_lastFreeCam) { LocalPlayer.CamFollowHead.enabled = false; LocalPlayer.CamRotator.enabled = false; LocalPlayer.MainRotator.enabled = false; LocalPlayer.FpCharacter.enabled = false; _lastFreeCam = true; } if (!FreeCam && _lastFreeCam) { LocalPlayer.CamFollowHead.enabled = true; LocalPlayer.CamRotator.enabled = true; LocalPlayer.MainRotator.enabled = true; LocalPlayer.FpCharacter.enabled = true; _lastFreeCam = false; } if (FreeCam && !Menu.IsOpen && !LocalPlayer.FpCharacter.Locked) { var button1 = Input.GetButton("Crouch"); var button2 = Input.GetButton("Run"); var button3 = Input.GetButton("Jump"); var multiplier = 0.1f; if (button2) { multiplier = 2f; } var vector3 = Camera.main.transform.rotation * ( new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical") ) * multiplier); if (button3) { vector3.y += multiplier; } if (button1) { vector3.y -= multiplier; } Camera.main.transform.position += vector3; var rotationX = Camera.main.transform.localEulerAngles.y + Input.GetAxis("Mouse X") * 15f; _rotationY += Input.GetAxis("Mouse Y") * 15f; _rotationY = Mathf.Clamp(_rotationY, -80f, 80f); Camera.main.transform.localEulerAngles = new Vector3(-_rotationY, rotationX, 0); } if (ModAPI.Input.GetButtonDown("FreeCam")) { FreeCam = !FreeCam; } if (ModAPI.Input.GetButton("SphereAction")) { SphereAction?.OnPrepare(); } else { SphereAction?.OnTick(); } if (LocalPlayer.Stats != null) { if (Menu.Values.Stats.FixBodyTemp) { LocalPlayer.Stats.BodyTemp = Menu.Values.Stats.FixedBodyTemp; } if (Menu.Values.Stats.FixBatteryCharge) { LocalPlayer.Stats.BatteryCharge = Menu.Values.Stats.FixedBatteryCharge; } if (Menu.Values.Stats.FixEnergy) { LocalPlayer.Stats.Energy = Menu.Values.Stats.FixedEnergy; } if (Menu.Values.Stats.FixHealth) { LocalPlayer.Stats.Health = Menu.Values.Stats.FixedHealth; } if (Menu.Values.Stats.FixStamina) { LocalPlayer.Stats.Stamina = Menu.Values.Stats.FixedStamina; } if (Menu.Values.Stats.FixFullness) { LocalPlayer.Stats.Fullness = Menu.Values.Stats.FixedFullness; } if (Menu.Values.Stats.FixStarvation) { LocalPlayer.Stats.Starvation = Menu.Values.Stats.FixedStarvation; } if (Menu.Values.Stats.FixThirst) { LocalPlayer.Stats.Thirst = Menu.Values.Stats.FixedThirst; } } if (BoltNetwork.isRunning && Menu.Values.Self.InstaRevive) { foreach (var player in PlayerManager.Players) { var triggerObject = player.DeadTriggerObject; if (triggerObject != null && triggerObject.activeSelf) { var trigger = triggerObject.GetComponent <RespawnDeadTrigger>(); //Logger.Info("Reviving " + player.Entity.GetState<IPlayerState>().name); // Send revive packet var playerHealed = PlayerHealed.Create(GlobalTargets.Others); playerHealed.HealingItemId = trigger._healItemId; playerHealed.HealTarget = player.Entity; PacketQueue.Add(playerHealed); // Set revive trigger inactive trigger.SendMessage("SetActive", false); } } } }