private RemoteCharacter FindTarget(RemoteCharacter a_curTarget) { RemoteCharacter result = null; if (null != this.m_client) { RemoteCharacter player = this.m_client.GetPlayer(); if (null != player) { float num = Mathf.Max(Items.GetItemDef(this.m_client.GetHandItem()).range, 5f); float d = num * 0.25f; float num2 = num * 0.75f; Vector3 vector = player.transform.position + player.transform.forward * d; RemoteCharacter remoteCharacter = this.m_client.GetNearestNpc(vector); if (null != remoteCharacter && (remoteCharacter.transform.position - vector).magnitude > num2) { remoteCharacter = null; } RemoteCharacter remoteCharacter2 = null; if (null != remoteCharacter2 && (remoteCharacter2.transform.position - vector).magnitude > num2) { remoteCharacter2 = null; } if ((null == remoteCharacter || remoteCharacter == a_curTarget) && player != remoteCharacter2 && null != remoteCharacter2) { result = remoteCharacter2; } else if (null != remoteCharacter) { result = remoteCharacter; } } } return(result); }
private void ResetTarget() { m_rotTowardsMousePos = -1f; m_currentTarget = null; if (null != m_bullsEye) { m_bullsEye.position = Vector3.one * 1000f; } }
private void OnOpponentArrived(NewUserMessage opponentInfo) { this.Scene.QueueAction(() => { var opponent = new RemoteCharacter(client, opponentInfo.NewUserId); opponent.ResizeTo(0, 0); opponent.Tags.Add("enemy"); this.Scene.Add(opponent); opponents.Add(opponent); }); }
public RemoteCharacter GetNearestNpc(Vector3 a_pos) { float num = 9999999f; RemoteCharacter result = null; for (int i = 0; i < m_npcs.Length; i++) { if (null != m_npcs[i] && m_npcs[i].IsNpc() && m_npcs[i].IsVisible()) { float sqrMagnitude = (a_pos - m_npcs[i].transform.position).sqrMagnitude; if (sqrMagnitude < num) { result = m_npcs[i]; num = sqrMagnitude; } } } return(result); }
public RemoteCharacter GetNearestCharacter(Vector3 a_pos, bool a_cars = false) { RemoteCharacter[] array = (!a_cars) ? m_players : m_cars; float num = 9999999f; RemoteCharacter result = null; for (int i = 0; i < array.Length; i++) { if (null != array[i] && array[i].IsVisible()) { float sqrMagnitude = (a_pos - array[i].transform.position).sqrMagnitude; if (sqrMagnitude < num && sqrMagnitude > 0.01f) { result = array[i]; num = sqrMagnitude; } } } return(result); }
private bool DisplayMessage(eMsg a_msg) { bool flag = false; int a_prio = 100; Vector3 pos = m_client.GetPos(); switch (a_msg) { case eMsg.eEatFood: flag = (m_inventoryGui.IsVisible() && m_inventoryGui.HasFood()); break; case eMsg.eBuildBuilding: flag = (m_inventoryGui.IsVisible() && m_inventoryGui.HasBuilding()); break; case eMsg.eBuildBuilding2: { int num; if (!m_inventoryGui.IsVisible()) { ItemDef itemDef = Items.GetItemDef(m_client.GetHandItem()); num = ((itemDef.buildingIndex > 0) ? 1 : 0); } else { num = 0; } flag = ((byte)num != 0); break; } case eMsg.eShovel: flag = (m_inventoryGui.IsVisible() && m_inventoryGui.HasItemType(109)); break; case eMsg.eStarving: flag = (0f == m_client.GetEnergy()); a_prio = 110; break; case eMsg.ePickupItem: { RemoteItem nearestItem = m_client.GetNearestItem(pos); flag = (null != nearestItem && 25f > (nearestItem.transform.position - pos).sqrMagnitude); break; } case eMsg.eGatherResource: { RemoteBuilding nearestResource = m_client.GetNearestResource(pos); flag = (null != nearestResource && 25f > (nearestResource.transform.position - pos).sqrMagnitude); break; } case eMsg.eAttackEnemy: { RemoteCharacter nearestNpc = m_client.GetNearestNpc(pos); flag = (null != nearestNpc && 36f > (nearestNpc.transform.position - pos).sqrMagnitude); break; } case eMsg.eDriveCar: { RemoteCharacter nearestCharacter2 = m_client.GetNearestCharacter(pos, true); flag = (null != nearestCharacter2 && 36f > (nearestCharacter2.transform.position - pos).sqrMagnitude); break; } case eMsg.eChat: case eMsg.ePlayerProfile: { RemoteCharacter nearestCharacter = m_client.GetNearestCharacter(pos); flag = (null != nearestCharacter && 49f > (nearestCharacter.transform.position - pos).sqrMagnitude); break; } } if (flag) { m_msgBar.DisplayMessage(LNG.Get("TUTORIAL_MESSAGE_" + (int)a_msg), a_prio); } return flag; }
void OnGUI() { GUI.skin = this.skin; if (g_gui) { windowRect = GUI.Window(5000, windowRect, MainWindow, "encode P.A.S. unknowncheats.me"); } if (g_esp && World.Instance.HasCharacter) { foreach (MatchStats.Player player in GetPlayers()) { if (!(player.Name == Session.UserProfile.name)) { if (!IsInMyTeam(player.Team)) { RemoteCharacter entity = World.Instance.GetEntity <RemoteCharacter>(player.EntityId); if (!entity.Dead) { String name = player.Name; float health = entity.NetworkCharacter.Health.GetValue(); float maxHealth = entity.NetworkCharacter.MaxHealth.GetValue(); Vector3 head = entity.GetHeadBone().position; Vector3 headPos = Camera.main.WorldToScreenPoint(head); Vector3 overHead = entity.GetHeadBone().position + Vector3.up * 0.3f; Vector3 overHeadPos = Camera.main.WorldToScreenPoint(overHead); Vector3 feet = entity.BoneMap[RemoteCharacter.ROOT_BONE_NAME].position; Vector3 feetPos = Camera.main.WorldToScreenPoint(feet); float distance = Vector3.Distance(Camera.main.transform.position, head) / 2; if (headPos.z > 0f & headPos.y < (float)(Screen.width - 2) && distance < 401) { headPos.y = (float)Screen.height - (headPos.y + 1f); overHeadPos.y = (float)Screen.height - (overHeadPos.y + 1f); feetPos.y = (float)Screen.height - (feetPos.y + 1f); Cocacola.Render.BoxRect(new Rect(headPos.x - 1, headPos.y - 1, 2, 2), Color.red); float height = (feetPos.y - overHeadPos.y); float width = height / 2; Cocacola.Render.DrawBox(new Vector2(overHeadPos.x - (width / 2), overHeadPos.y), new Vector2(width, height), 1.5f, Color.red); if (distance < 151) { Cocacola.Render.DrawBorderedString(new Vector2(overHeadPos.x, overHeadPos.y - 70), name, Color.red, Color.black, true); Cocacola.Render.DrawBorderedString(new Vector2(overHeadPos.x, overHeadPos.y - 50), string.Format("[HP: {0:0}/", health) + string.Format("{0:0}]", maxHealth), Color.red, Color.black, true); Cocacola.Render.DrawBorderedString(new Vector2(overHeadPos.x, overHeadPos.y - 30), string.Format("[DS: {0:0}m]", distance), Color.red, Color.black, true); } if (!entity.gameObject.HasComponent <Cocacola.Chams>()) { entity.gameObject.AddComponent <Cocacola.Chams>(); Cocacola.Chams chams = entity.gameObject.GetComponent <Cocacola.Chams>(); chams.AttachEvent(); } if (g_chams) { Cocacola.Chams chams = entity.gameObject.GetComponent <Cocacola.Chams>(); if (!chams.chamsEnabled) { chams.EnableChams(); } } else { Cocacola.Chams chams = entity.gameObject.GetComponent <Cocacola.Chams>(); if (chams.chamsEnabled) { chams.DisableChams(); } } } } else { if (entity.gameObject.HasComponent <LineRenderer>()) { Cocacola.Render.Disable3DLine(entity.gameObject); } } } } } } }
private bool DisplayMessage(TutorialMessages.eMsg a_msg) { bool flag = false; int a_prio = 100; Vector3 pos = this.m_client.GetPos(); switch (a_msg) { case TutorialMessages.eMsg.ePickupItem: { RemoteItem nearestItem = this.m_client.GetNearestItem(pos); flag = (null != nearestItem && 25f > (nearestItem.transform.position - pos).sqrMagnitude); break; } case TutorialMessages.eMsg.eEatFood: flag = (this.m_inventoryGui.IsVisible() && this.m_inventoryGui.HasFood()); break; case TutorialMessages.eMsg.eDriveCar: { RemoteCharacter nearestCharacter = this.m_client.GetNearestCharacter(pos, true); flag = (null != nearestCharacter && 36f > (nearestCharacter.transform.position - pos).sqrMagnitude); break; } case TutorialMessages.eMsg.eGatherResource: { RemoteBuilding nearestResource = this.m_client.GetNearestResource(pos); flag = (null != nearestResource && 25f > (nearestResource.transform.position - pos).sqrMagnitude); break; } case TutorialMessages.eMsg.eAttackEnemy: { RemoteCharacter nearestNpc = this.m_client.GetNearestNpc(pos); flag = (null != nearestNpc && 36f > (nearestNpc.transform.position - pos).sqrMagnitude); break; } case TutorialMessages.eMsg.eStarving: flag = (0f == this.m_client.GetEnergy()); a_prio = 110; break; case TutorialMessages.eMsg.eChat: case TutorialMessages.eMsg.ePlayerProfile: { RemoteCharacter nearestCharacter2 = this.m_client.GetNearestCharacter(pos, false); flag = (null != nearestCharacter2 && 49f > (nearestCharacter2.transform.position - pos).sqrMagnitude); break; } case TutorialMessages.eMsg.eBuildBuilding: flag = (this.m_inventoryGui.IsVisible() && this.m_inventoryGui.HasBuilding()); break; case TutorialMessages.eMsg.eShovel: flag = (this.m_inventoryGui.IsVisible() && this.m_inventoryGui.HasItemType(109)); break; case TutorialMessages.eMsg.eBuildBuilding2: flag = (!this.m_inventoryGui.IsVisible() && Items.GetItemDef(this.m_client.GetHandItem()).buildingIndex > 0); break; } if (flag) { this.m_msgBar.DisplayMessage(LNG.Get("TUTORIAL_MESSAGE_" + (int)a_msg), a_prio); } return(flag); }
private void GetMouseInput(float a_deltaTime) { if (Time.timeSinceLevelLoad < 0.5f) { return; } bool flag = !this.m_inventory.IsVisible() && !this.m_communicator.IsActive(true) && false == this.m_popupGui.IsActive(); Vector3 mousePosition = Input.mousePosition; bool flag2 = (this.m_lastMousePos - mousePosition).sqrMagnitude > 4f; this.m_lastMousePos = mousePosition; Ray ray = Camera.main.ScreenPointToRay(mousePosition); if (flag2) { this.m_hideCursorTime = Time.time + 1f; } bool flag3 = Time.time < this.m_hideCursorTime; if (flag3 != Screen.showCursor) { Screen.showCursor = flag3; } if (Input.GetMouseButton(1) && flag) { this.m_buildRot += a_deltaTime * 90f; while (this.m_buildRot > 360f) { this.m_buildRot -= 360f; } } if (Input.GetMouseButtonDown(1)) { RaycastHit raycastHit; if (Physics.Raycast(ray, out raycastHit, 100f, 665600)) { int layer = raycastHit.transform.gameObject.layer; if (layer != 13) { if (layer == 17) { if (!this.m_inventory.IsShopActive()) { RemoteItem component = raycastHit.transform.GetComponent <RemoteItem>(); if (null != component && this.m_inventory.IsVisible()) { this.m_itemGui.Show(component, ray.GetPoint(4.5f)); } } } } else if (flag) { RemoteCharacter component2 = raycastHit.transform.GetComponent <RemoteCharacter>(); if (null != component2 && null != this.m_client) { ulong steamId = this.m_client.GetSteamId(component2.m_id); if (Global.isSteamActive && 0UL < steamId) { SteamFriends.ActivateGameOverlayToUser("steamid", new CSteamID(steamId)); } } } } } else if (Input.GetMouseButtonDown(0)) { if (flag) { this.ResetTarget(); } bool flag4 = false; RaycastHit raycastHit2; if (Physics.Raycast(ray, out raycastHit2, 100f, 6995488)) { switch (raycastHit2.transform.gameObject.layer) { case 9: case 13: if (flag) { RemoteCharacter component3 = raycastHit2.transform.GetComponent <RemoteCharacter>(); if (null != component3) { if (!component3.m_isOwnPlayer) { this.m_currentTarget = component3; flag4 = true; } } else if (flag && Input.GetAxis("Vertical") == 0f && Input.GetAxis("Horizontal") == 0f) { this.CalculatePath(raycastHit2.point, 12 != raycastHit2.transform.gameObject.layer); } } break; case 10: case 12: case 21: if (flag && Input.GetAxis("Vertical") == 0f && Input.GetAxis("Horizontal") == 0f && null != this.m_client && !this.m_client.IsInVehicle()) { Vector3 point = raycastHit2.point; this.m_walkIndicator.position = new Vector3(raycastHit2.point.x, 0.1f, raycastHit2.point.z); this.CalculatePath(point, 12 != raycastHit2.transform.gameObject.layer); } break; case 11: case 15: case 19: case 22: flag4 = flag; break; case 17: if (this.m_inventory.IsShopActive()) { RemoteItem component4 = raycastHit2.transform.GetComponent <RemoteItem>(); if (null != component4 && component4.m_type != 254 && this.m_inventory.IsVisible()) { this.m_buySellPos = this.m_inventory.ToWorldPos(component4.transform.localPosition); bool flag5 = this.m_buySellPos.x < 6f; float num = (!flag5) ? this.m_inventory.GetShopBuyMultiplier() : this.m_inventory.GetShopSellMultiplier(); string text = (!flag5) ? LNG.Get("BUY") : LNG.Get("SELL"); int num2 = (int)(Items.GetValue(component4.m_type, component4.m_amountOrCond) * num + 0.5f); string text2 = (!Items.HasCondition(component4.m_type)) ? ("x " + component4.m_amountOrCond) : (component4.m_amountOrCond.ToString() + "%"); ItemDef itemDef = Items.GetItemDef(component4.m_type); if (flag5 || this.m_client.GetGoldCount() >= num2) { string a_caption = string.Concat(new object[] { text, "\n", LNG.Get(itemDef.ident), "\n", text2, "\nfor ", num2, " ", LNG.Get("CURRENCY"), "?" }); this.m_buySellPopupSessionId = this.m_popupGui.ShowGui(true, a_caption); } else { string a_caption2 = string.Concat(new object[] { LNG.Get("ITEMSHOP_TOO_LESS_GOLD"), "\n", num2, " ", LNG.Get("CURRENCY") }); this.m_popupGui.ShowGui(true, a_caption2); } } } else if (Time.time < this.m_doubleClickTime) { this.m_doubleClickTime = 0f; if (null != raycastHit2.transform) { Vector3 localPosition = raycastHit2.transform.localPosition; Vector3 zero = Vector3.zero; if (this.m_inventory.DragDrop(ref localPosition, ref zero)) { this.m_sendDragPos = localPosition; this.m_sendDropPos = Vector3.zero; } } } else { this.m_dragItem = raycastHit2.transform; this.m_startDragPos = this.m_dragItem.localPosition; } break; } } if (flag4) { this.CalculateRotTowardsMouse(mousePosition); this.m_stopAttackingTime = Time.time + 0.3f; } } else if (Input.GetMouseButtonUp(0) && null != this.m_dragItem) { Vector3 startDragPos = this.m_startDragPos; Vector3 localPosition2 = this.m_dragItem.localPosition; if (this.m_inventory.DragDrop(ref startDragPos, ref localPosition2)) { if (startDragPos != localPosition2) { this.m_sendDragPos = startDragPos; this.m_sendDropPos = localPosition2; } else { this.m_dragItem.localPosition = this.m_startDragPos; this.m_doubleClickTime = Time.time + 0.5f; } } this.m_dragItem = null; } if (null != this.m_dragItem) { this.m_dragItem.position = ray.GetPoint(5f); Vector3 localPosition3 = this.m_dragItem.localPosition; localPosition3.z = 0f; this.m_dragItem.localPosition = localPosition3; } else if (!flag2) { if (this.m_mouseOverDur != -1f) { this.m_mouseOverDur += a_deltaTime; if (this.m_mouseOverDur > 0.1f) { this.m_buildingHealthIndicator.position = Vector3.up * 1000f; this.m_tooltip.position = Vector3.up * 1000f; this.m_tooltipHudR.position = Vector3.up * 1000f; this.m_tooltipHudR.parent = null; this.m_tooltipHudL.position = Vector3.up * 1000f; this.m_tooltipHudL.parent = null; if (this.m_mouseOverRenderers != null && this.m_mouseOverRenderers.Length != 0) { foreach (Renderer renderer in this.m_mouseOverRenderers) { if (null != renderer) { renderer.gameObject.layer = this.m_mouseOverLayer; } } this.m_mouseOverRenderers = null; } if (null != this.m_mouseOverTransform) { this.m_mouseOverTransform.localScale = this.m_initialMouseOverScale; this.m_mouseOverTransform = null; } RaycastHit raycastHit3; if (Physics.Raycast(ray, out raycastHit3, 100f, 7007776)) { if (raycastHit3.transform.gameObject.layer == 5) { string[] array = raycastHit3.transform.gameObject.name.Split(new char[] { '-' }); if (array != null && 1 < array.Length) { if ("tooltip" == array[0]) { this.m_tooltipHudRText.text = LNG.Get(array[1]); this.m_tooltipHudR.position = raycastHit3.transform.position - raycastHit3.transform.right * 0.3f; this.m_tooltipHudR.rotation = raycastHit3.transform.rotation; this.m_tooltipHudR.parent = raycastHit3.transform; } else if ("mission" == array[0]) { int a_index = 0; try { a_index = int.Parse(array[1]); } catch (Exception ex) { Debug.LogWarning("ClientInput.cs: " + ex.ToString()); } Mission mission = this.m_client.GetMission(a_index); if (mission != null) { this.m_tooltipHudLText.text = string.Concat(new object[] { this.GetMissionText(mission), LNG.Get("TIME_LEFT"), ": ", (int)(mission.m_dieTime / 60f), " min" }); this.m_tooltipHudL.position = raycastHit3.transform.position + raycastHit3.transform.right * 0.3f; this.m_tooltipHudL.rotation = raycastHit3.transform.rotation; this.m_tooltipHudL.parent = raycastHit3.transform; } } } } else { this.m_mouseOverTransform = raycastHit3.transform; this.m_initialMouseOverScale = this.m_mouseOverTransform.localScale; if (raycastHit3.transform.gameObject.layer == 17) { if (this.m_inventory.IsVisible()) { this.m_inventory.ShowInfo(raycastHit3.transform.position); } } else if (raycastHit3.transform.gameObject.layer == 10) { this.m_mouseOverTransform.localScale *= 1.33f; } else if (raycastHit3.transform.gameObject.layer == 19) { RemoteBuilding component5 = raycastHit3.transform.parent.GetComponent <RemoteBuilding>(); if (null != this.m_buildingHealthIndicator && null != component5) { Vector3 b = Vector3.up * 4f; float x = 0.25f * (float)(3 - (int)(component5.m_health * 0.033f)); this.m_buildingHealthIndicator.renderer.material.mainTextureOffset = new Vector2(x, 0f); this.m_buildingHealthIndicator.position = raycastHit3.transform.position + b; } } else if (raycastHit3.transform.gameObject.layer == 15) { bool flag6 = "building_10" == raycastHit3.transform.gameObject.name || "building_11" == raycastHit3.transform.gameObject.name; Vector3 b2 = Vector3.up * ((!flag6) ? 3f : 6.5f); this.m_tooltipText.text = LNG.Get("TOOLTIP_RESOURCE"); this.m_tooltip.position = raycastHit3.transform.position + b2; } else if (raycastHit3.transform.gameObject.layer == 21) { Vector3 b3 = Vector3.up * 2f; this.m_tooltipText.text = LNG.Get("TOOLTIP_ITEMSTORAGE"); this.m_tooltip.position = raycastHit3.transform.position + b3; } else if (raycastHit3.transform.gameObject.layer == 9) { RemoteCharacter component6 = raycastHit3.transform.GetComponent <RemoteCharacter>(); if (null == component6) { Vector3 b4 = Vector3.up * 3f; this.m_tooltipText.text = LNG.Get("TOOLTIP_INTERACT"); this.m_tooltip.position = raycastHit3.transform.position + b4; } } else if (raycastHit3.transform.gameObject.layer == 22) { MissionObjective component7 = raycastHit3.transform.GetComponent <MissionObjective>(); if (null != component7) { Vector3 b5 = Vector3.up * 3f; this.m_tooltipText.text = LNG.Get("MISSION_TYPE_" + component7.m_type.ToString("d")); this.m_tooltip.position = raycastHit3.transform.position + b5; } } this.m_mouseOverRenderers = raycastHit3.transform.GetComponentsInChildren <Renderer>(); if (this.m_mouseOverRenderers.Length == 0 && null != raycastHit3.transform.parent) { this.m_mouseOverRenderers = raycastHit3.transform.parent.GetComponentsInChildren <Renderer>(); } if (this.m_mouseOverRenderers.Length != 0) { this.m_mouseOverLayer = this.m_mouseOverRenderers[0].gameObject.layer; foreach (Renderer renderer2 in this.m_mouseOverRenderers) { renderer2.gameObject.layer = 20; } } } } this.m_mouseOverDur = -1f; } } } else { this.m_mouseOverDur = 0f; } }
private void Update() { GetMouseInput(Time.deltaTime); if (null != m_client && m_client.enabled) { CalculateAxis(); HandlePopup(); HandleHotKeys(); if (m_client.GetHealth() == 0f) { ResetPath(); } if (Input.GetButtonDown("FindTarget") || (IsAttacking() && null == m_currentTarget)) { m_currentTarget = FindTarget(m_currentTarget); } bool flag = null != m_currentTarget && m_currentTarget.IsVisible(); bool flag2 = flag && (m_currentTarget.m_type == eCharType.ePlayer || eCharType.ePlayerFemale == m_currentTarget.m_type); int num = Mathf.Clamp((int)(m_rotTowardsMousePos / 360f * 255f), 0, 255); int a_targetIdOrAtkRot = (!flag) ? num : m_currentTarget.m_id; int num2 = 0; num2 |= (IsInteracting() ? 1 : 0); num2 |= (IsAttacking() ? 2 : 0); num2 |= (flag ? 4 : 0); num2 |= (flag2 ? 8 : 0); num2 |= (IsAttackingWithMouse() ? 16 : 0); num2 |= (byte)((m_vertAxis + 1f) * 100f) << 8; num2 |= (byte)((m_horiAxis + 1f) * 100f) << 16; if ((num2 != m_input || m_sendDragPos != m_sendDropPos || m_nextInputTime + 1f < Time.time) && m_nextInputTime < Time.time) { m_input = num2; m_client.SendInput(m_input, a_targetIdOrAtkRot, m_buildRot, m_sendDragPos, m_sendDropPos); m_sendDragPos = Vector3.zero; m_sendDropPos = Vector3.zero; m_nextInputTime = Time.time + m_minSendIntervall; } } if (null != m_currentTarget) { if (null != m_bullsEye) { float x = 0.25f * (float)(3 - (int)(m_currentTarget.m_health * 0.033f)); m_bullsEye.renderer.material.mainTextureOffset = new Vector2(x, 0f); m_bullsEye.position = m_currentTarget.transform.position + Vector3.up * 0.1f; } if (!m_currentTarget.IsVisible()) { ResetTarget(); } } else if (!IsAttacking()) { ResetTarget(); } ScreenshotInput(); if (m_burpFlag && !base.audio.isPlaying) { base.audio.clip = m_soundBurp; base.audio.Play(); m_burpFlag = false; } if (null != m_currentTarget && m_currentTarget.m_isSaint && IsAttacking() && Time.time > m_attackNoticeTime) { m_client.GetPlayer().OnSpecialEvent(eSpecialEvent.cantHurtSaints); m_attackNoticeTime = Time.time + 1f; } }