public static void RewardWarriors() { List <int> _warriors = WarriorList; for (int i = 0; i < _warriors.Count; i++) { int _warrior = _warriors[i]; EntityAlive _player = GameManager.Instance.World.Players.dict[_warrior]; if (_player != null && _player.IsAlive()) { int _killedZ; KilledZombies.TryGetValue(_warrior, out _killedZ); if (_killedZ >= Zombie_Kills && _player.Died > 0) { ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForEntityId(_warrior); if (_cInfo != null) { int _deathCount = _player.Died - 1; _player.Died = _deathCount; _player.bPlayerStatsChanged = true; _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackagePlayerStats>().Setup(_player)); WarriorList.Remove(_warrior); KilledZombies.Remove(_warrior); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "You have survived and been rewarded by hades himself. Your death count was reduced by one." + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } if (WarriorList.Contains(_warrior)) { WarriorList.Remove(_warrior); KilledZombies.Remove(_warrior); } } }
static bool Prefix(float _dt, XUiC_TargetBar __instance) { foreach (Entity entity in GameManager.Instance.World.Entities.list) { EntityAlive entity1 = entity as EntityAlive; EntityAlive entityAlive = null; WorldRayHitInfo hitInfo = __instance.xui.playerUI.entityPlayer.HitInfo; if (hitInfo.bHitValid && hitInfo.transform && hitInfo.tag.StartsWith("E_")) { Transform hitRootTransform; if ((hitRootTransform = GameUtils.GetHitRootTransform(hitInfo.tag, hitInfo.transform)) != null) { entityAlive = hitRootTransform.GetComponent <EntityAlive>(); } bool flag = entityAlive != null && entityAlive.IsAlive(); if (flag) { if (entityAlive.IsSleeping) { //__instance.ViewComponent.IsVisible = false; return(false); } else { //__instance.ViewComponent.IsVisible = true; return(true); } } } } return(true); }
public bool CheckSurroundingEntities() { this.NearbyEntities.Clear(); NearbyEnemies.Clear(); EntityAlive leader = EntityUtilities.GetLeaderOrOwner(this.theEntity.entityId) as EntityAlive; float originalView = this.theEntity.GetMaxViewAngle(); this.theEntity.SetMaxViewAngle(360f); // Search in the bounds are to try to find the most appealing entity to follow. Bounds bb = new Bounds(this.theEntity.position, new Vector3(20f, 20f, 20f)); this.theEntity.world.GetEntitiesInBounds(typeof(EntityAlive), bb, this.NearbyEntities); DisplayLog(" Nearby Entities: " + this.NearbyEntities.Count); for (int i = this.NearbyEntities.Count - 1; i >= 0; i--) { EntityAlive x = (EntityAlive)this.NearbyEntities[i]; if (x is EntityVehicle) { continue; } if (x.IsDead()) { continue; } if (x != this.theEntity && x.IsAlive()) { if (leader != null && x == leader) { continue; } if (x.CanSee(this.theEntity.position)) { DisplayLog(" I can be seen by an enemy."); if (!this.theEntity.CanSee(x.position)) { DisplayLog(" I know an entity is there, but I can't see it: " + x.EntityName); continue; } } DisplayLog("Nearby Entity: " + x.EntityName); if (CheckFactionForEnemy(x)) { NearbyEnemies.Add(x); } } } this.theEntity.SetMaxViewAngle(originalView); return(NearestEnemy()); }
public static void PlayerCheck() { try { if (!IsRunning) { IsRunning = true; List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null && _cInfoList.Count > 0) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null && !string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId > 0) { EntityAlive _player = PersistentOperations.GetPlayerAlive(_cInfo.playerId); if (_player != null) { if (!_player.IsDead()) { if (_player.IsSpawned() && _player.IsAlive()) { if (Zones.IsEnabled) { Zones.ZoneCheck(_cInfo, _player); } if (Lobby.IsEnabled) { Lobby.LobbyCheck(_cInfo, _player); } if (Market.IsEnabled) { Market.MarketCheck(_cInfo, _player); } } } else if (BloodmoonWarrior.IsEnabled && BloodmoonWarrior.WarriorList.Contains(_cInfo.playerId)) { BloodmoonWarrior.WarriorList.Remove(_cInfo.playerId); BloodmoonWarrior.KilledZombies.Remove(_cInfo.playerId); } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.PlayerCheck: {0}", e.Message)); } IsRunning = false; }
public bool CheckSurroundingEntities() { this.NearbyEntities.Clear(); NearbyEnemies.Clear(); EntityAlive leader = null; if (this.theEntity.Buffs.HasCustomVar("Leader")) { DisplayLog(" leader Detected."); int EntityID = (int)this.theEntity.Buffs.GetCustomVar("Leader"); leader = this.theEntity.world.GetEntity(EntityID) as EntityAlive; } float originalView = this.theEntity.GetMaxViewAngle(); this.theEntity.SetMaxViewAngle(250f); // Search in the bounds are to try to find the most appealing entity to follow. Bounds bb = new Bounds(this.theEntity.position, new Vector3(this.theEntity.GetSeeDistance(), 20f, this.theEntity.GetSeeDistance())); this.theEntity.world.GetEntitiesInBounds(typeof(EntityAlive), bb, this.NearbyEntities); DisplayLog(" Nearby Entities: " + this.NearbyEntities.Count); for (int i = this.NearbyEntities.Count - 1; i >= 0; i--) { EntityAlive x = (EntityAlive)this.NearbyEntities[i]; if (x != this.theEntity && x.IsAlive()) { if (x == leader) { continue; } if (x.CanSee(this.theEntity.position)) { DisplayLog(" I can be seen by an enemy."); if (!this.theEntity.CanSee(x.position)) { DisplayLog(" I know an entity is there, but I can't see it: " + x.EntityName); continue; } } DisplayLog("Nearby Entity: " + x.EntityName); if (CheckFactionForEnemy(x)) { NearbyEnemies.Add(x); } } } this.theEntity.SetMaxViewAngle(originalView); return(NearestEnemy()); }
private void FindNaturalEnemy() { if (naturalEnemies == null) { return; } if (naturalEnemies.Length == 0) { return; } using ( List <Entity> .Enumerator enumerator = this.world.GetEntitiesInBounds(typeof(EntityAlive), BoundsUtils.BoundsForMinMax(this.position.x - 50f, this.position.y - 50f, this.position.z - 50f, this.position.x + 50f, this.position.y + 50f, this.position.z + 50f), new List <Entity>()).GetEnumerator()) { while (enumerator.MoveNext()) { EntityAlive _other = enumerator.Current as EntityAlive; if (Array.Exists(naturalEnemies, s => s.Equals(_other.EntityName))) { if (_other.IsAlive()) { //if (base.CanSee(_other)) { if (_other.GetWaterLevel() < 0.5f) { if (debug) { Debug.Log("Found natural enemy!"); } base.SetRevengeTarget(_other); isHunting = true; return; } } } } } } }
public static void Exec() { try { if (!BloodmoonStarted) { if (PersistentOperations.BloodMoonSky()) { BloodmoonStarted = true; List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null && !string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId > 0) { EntityAlive _player = (EntityAlive)PersistentOperations.GetEntity(_cInfo.entityId); if (_player != null && _player.IsSpawned() && _player.IsAlive() && _player.Died > 0 && _player.Progression.GetLevel() >= 10 && random.Next(0, 11) < 6) { WarriorList.Add(_cInfo.entityId); KilledZombies.Add(_cInfo.entityId, 0); string _response = "Hades has called upon you. Survive this night and kill {ZombieCount} zombies to be rewarded by the king of the underworld."; _response = _response.Replace("{ZombieCount}", Zombie_Kills.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _response + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } } } else if (!PersistentOperations.BloodMoonSky()) { BloodmoonStarted = false; RewardWarriors(); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in BloodmoonWarrior.Exec: {0}.", e.Message)); } }
public override bool Continue() { if (this.theEntity.sleepingOrWakingUp || this.theEntity.bodyDamage.CurrentStun != global::EnumEntityStunType.None) { return(false); } EntityAlive attackTarget = this.theEntity.GetAttackTarget(); if (attackTarget) { if (!attackTarget.IsAlive()) { return(false); } } if (this.isGoingHome) { return(!attackTarget && this.theEntity.ChaseReturnLocation != Vector3.zero); } return(attackTarget && !(attackTarget != this.entityTarget)); }
// Enables the entity, and checks if we have root motion enabled or not. public void SwitchModelAndView(string _modelName, bool _bFPV, bool _bMale) { Log("Running Switch and Model View"); // If Root MOtion is enabled on this entity, initialize it. if (entityAlive.RootMotion) { Log("Enabling Root Motion..."); var avatarRootMotion = bipedTransform.GetComponent <AvatarRootMotion>(); if (avatarRootMotion == null) { avatarRootMotion = bipedTransform.gameObject.AddComponent <AvatarRootMotion>(); } avatarRootMotion.Init(this, anim); Log("Enabled Root Motion"); } anim.SetBool("IsDead", entityAlive.IsDead()); anim.SetBool("IsAlive", entityAlive.IsAlive()); assignBodyParts(); //// Add in support for animations that can fire weapons if (rightHandItemTransform != null) { Log("Reading Right hand Items to equipment weapons"); Debug.Log("Setting Right hand position"); //Debug.Log("RIGHTHAND ITEM TRANSFORM"); rightHandItemTransform.parent = rightHandItemTransform; var position = AnimationGunjointOffsetData.AnimationGunjointOffset[entityAlive.inventory.holdingItem.HoldType.Value].position; var rotation = AnimationGunjointOffsetData.AnimationGunjointOffset[entityAlive.inventory.holdingItem.HoldType.Value].rotation; rightHandItemTransform.localPosition = position; rightHandItemTransform.localEulerAngles = rotation; SetInRightHand(this.rightHandItemTransform); } }
public static void Exec() { if (!BloodmoonStarted) { if (PersistentOperations.BloodMoonSky()) { BloodmoonStarted = true; List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null && !string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId > 0) { EntityAlive _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null && _player.IsSpawned() && _player.IsAlive()) { WarriorList.Add(_cInfo.entityId); KilledZombies.Add(_cInfo.entityId, 0); if (_cInfo != null) { string _response = "Hades has called upon you. Survive this night and kill {ZombieCount} zombies to be rewarded by the king of the underworld."; _response = _response.Replace("{ZombieCount}", Zombie_Kills.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _response + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } } } } else if (!PersistentOperations.BloodMoonSky()) { BloodmoonStarted = false; RewardWarriors(); } }
public static bool Prefix(XUiC_TargetBar __instance) { EntityAlive entityAlive = null; WorldRayHitInfo hitInfo = __instance.xui.playerUI.entityPlayer.HitInfo; if (hitInfo.bHitValid && hitInfo.transform && hitInfo.tag.StartsWith("E_")) { Transform hitRootTransform; if ((hitRootTransform = GameUtils.GetHitRootTransform(hitInfo.tag, hitInfo.transform)) != null) { entityAlive = hitRootTransform.GetComponent <EntityAlive>(); } if (entityAlive != null && entityAlive.IsAlive()) { if (SphereII_InertEntity.IsInert(entityAlive)) { return(false); } } } return(true); }
public bool CheckSurroundingEntities() { this.NearbyEntities.Clear(); NearbyEnemies.Clear(); EntityAlive leader = null; if (this.theEntity.Buffs.HasCustomVar("Leader")) { DisplayLog(" leader Detected."); int EntityID = (int)this.theEntity.Buffs.GetCustomVar("Leader"); leader = this.theEntity.world.GetEntity(EntityID) as EntityAlive; } // Search in the bounds are to try to find the most appealing entity to follow. Bounds bb = new Bounds(this.theEntity.position, new Vector3(this.theEntity.GetSeeDistance(), 20f, this.theEntity.GetSeeDistance())); this.theEntity.world.GetEntitiesInBounds(typeof(EntityAlive), bb, this.NearbyEntities); DisplayLog(" Nearby Entities: " + this.NearbyEntities.Count); for (int i = this.NearbyEntities.Count - 1; i >= 0; i--) { EntityAlive x = (EntityAlive)this.NearbyEntities[i]; if (x != this.theEntity && x.IsAlive()) { if (x == leader) { continue; } DisplayLog("Nearby Entity: " + x.EntityName); if (CheckFactionForEnemy(x)) { NearbyEnemies.Add(x); } } // if one of our faction died, flee from the spot. if (x.factionId == this.theEntity.factionId) { if (x.GetRevengeTarget() != null) { DisplayLog(" My Faction has a Revenge Target. I am sharing it. "); this.fleeDistance = 100; this.theEntity.SetRevengeTarget(x.GetRevengeTarget()); this.avoidEntity = x.GetRevengeTarget(); return(true); } if (x.IsDead()) { //DisplayLog(" One of my factions has died. Fleeing, and abandoning the herd"); //this.fleeDistance = 100; //if (x.entityThatKilledMe != null) //{ // DisplayLog(" I am fleeing: " + x.entityThatKilledMe.EntityName); // this.avoidEntity = x.entityThatKilledMe; //} //else //{ DisplayLog(" I don not know who killed my friend, so i am running from " + x.EntityName); this.avoidEntity = x; // } return(true); } } } return(NearestEnemy()); }
public static void Exec() { try { if ((int)GameManager.Instance.fps.Counter > 4) { List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null && !string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId > 0) { AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId); if (Admin.PermissionLevel > Admin_Level) { EntityAlive _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null && _player.IsSpawned() && _player.IsAlive() && !_player.IsStuck) { float _x = _player.position.x; float _y = _player.position.y; float _z = _player.position.z; if (_player.AttachedToEntity == null && (AirCheck(_x, _y, _z) || GroundCheck(_x, _y, _z))) { if (OldY.ContainsKey(_cInfo.entityId)) { float lastY; OldY.TryGetValue(_cInfo.entityId, out lastY); OldY[_cInfo.entityId] = _y; if (lastY - _y >= 4) { if (Flag.ContainsKey(_cInfo.entityId)) { Flag.Remove(_cInfo.entityId); } continue; } } else { OldY.Add(_cInfo.entityId, _y); } int _flags; if (Flag.TryGetValue(_cInfo.entityId, out _flags)) { if (_flags + 1 >= Flags) { Flag.Remove(_cInfo.entityId); ChatHook.ChatMessage(null, "[FF0000]" + "Cheater! Player " + _cInfo.playerName + " detected flying!" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); Log.Warning("[SERVERTOOLS] Detected {0}, Steam Id {1}, flying @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, _x, _y, _z); string _file = string.Format("DetectionLog_{0}.txt", DateTime.Today.ToString("M-d-yyyy")); string _filepath = string.Format("{0}/Logs/DetectionLogs/{1}", API.ConfigPath, _file); using (StreamWriter sw = new StreamWriter(_filepath, true)) { sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, flying @ {2} {3} {4}.", _cInfo.playerName, _cInfo.playerId, _x, _y, _z)); sw.WriteLine(); sw.Flush(); sw.Close(); } Penalty(_cInfo); continue; } else { Flag[_cInfo.entityId] = _flags + 1; } } else { Flag.Add(_cInfo.entityId, 1); } } else if (Flag.ContainsKey(_cInfo.entityId)) { Flag.Remove(_cInfo.entityId); } } else { if (OldY.ContainsKey(_cInfo.entityId)) { OldY.Remove(_cInfo.entityId); } if (Flag.ContainsKey(_cInfo.entityId)) { Flag.Remove(_cInfo.entityId); } } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Flying.Exec: {0}.", e.Message)); } }