Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:44:53 +09:30
commit f1fbbe67bb
1722 changed files with 165268 additions and 0 deletions

View File

@@ -0,0 +1,321 @@
using Audio;
using System.Globalization;
public class EntityAnimalChickenRebirth : EntityAnimalRabbit
{
public float flCaptureDistance = 2;
public int numFeedInterval = 20;
public ulong FeedIntervalTicks = 0UL;
public string[] entityNames;
public string strName = "NotSet";
public string feedType = "";
public int feedAmount = 0;
public int numUpdateInterval = 1;
public ulong UpdateIntervalTicks = 0UL;
public int numHealthLossPerFeedInterval = 1;
public TileEntityAnimalChickenRebirth tileEntityAnimalChickenRebirth;
public Vector3i homePos = Vector3i.zero;
public bool homeSet = false;
public override void Write(BinaryWriter _bw, bool _bNetworkWrite)
{
base.Write(_bw, _bNetworkWrite);
_bw.Write(strName);
StreamUtils.Write(_bw, homePos);
}
public override void Read(byte _version, BinaryReader _br)
{
base.Read(_version, _br);
strName = _br.ReadString();
try
{
homePos = StreamUtils.ReadVector3i(_br);
}
catch (Exception)
{
}
}
public Vector3i HomePosition
{
get
{
return homePos;
}
set
{
homePos = value;
}
}
public override string ToString()
{
return EntityName;
}
public override string EntityName
{
get
{
if (!EntityClass.entityClassName.Contains("PickedUp"))
{
return Localization.Get("animalChicken");
}
return strName;
}
}
public override void SetEntityName(string _name)
{
if (strName == "NotSet")
{
string randomName = RebirthUtilities.GetRandomName(this);
if (!string.IsNullOrEmpty(randomName))
{
_name = randomName;
}
}
if (_name.Equals(entityName)) return;
entityName = _name;
HandleSetNavName();
}
public override void CopyPropertiesFromEntityClass()
{
base.CopyPropertiesFromEntityClass();
EntityClass entityClass = EntityClass.list[this.entityClass];
if (entityClass.Properties.Values.ContainsKey("CaptureDistance"))
{
flCaptureDistance = StringParsers.ParseFloat(entityClass.Properties.Values["CaptureDistance"], 0, -1, NumberStyles.Any);
}
if (entityClass.Properties.Values.ContainsKey("FeedInterval"))
{
numFeedInterval = (int)StringParsers.ParseFloat(entityClass.Properties.Values["FeedInterval"], 0, -1, NumberStyles.Any);
}
if (entityClass.Properties.Values.ContainsKey("FeedType"))
{
feedType = entityClass.Properties.Values["FeedType"];
}
if (entityClass.Properties.Values.ContainsKey("FeedAmount"))
{
feedAmount = (int)StringParsers.ParseFloat(entityClass.Properties.Values["FeedAmount"], 0, -1, NumberStyles.Any);
}
if (entityClass.Properties.Values.ContainsKey("HealthLossPerFeedInterval"))
{
numHealthLossPerFeedInterval = (int)StringParsers.ParseFloat(entityClass.Properties.Values["HealthLossPerFeedInterval"], 0, -1, NumberStyles.Any);
}
string randomName = RebirthUtilities.GetRandomName(this);
if (randomName != "")
{
strName = randomName;
entityName = strName;
HandleSetNavName();
}
else
{
//Log.Out("EntityAnimalChickenRebirth-CopyPropertiesFromEntityClass 2");
string allNames = entityClass.Properties.Values["EntityNamesA"] + "," +
entityClass.Properties.Values["EntityNamesB"] + "," +
entityClass.Properties.Values["EntityNamesC"] + "," +
entityClass.Properties.Values["EntityNamesD"] + "," +
entityClass.Properties.Values["EntityNamesE"] + "," +
entityClass.Properties.Values["EntityNamesF"] + "," +
entityClass.Properties.Values["EntityNamesG"] + "," +
entityClass.Properties.Values["EntityNamesH"] + "," +
entityClass.Properties.Values["EntityNamesI"];
entityNames = allNames.Replace(" ", "").Split(new char[] { ',' });
System.Random r = new System.Random();
int rInt = r.Next(0, entityNames.Length - 1);
strName = entityNames[rInt];
//Log.Out("EntityAnimalChickenRebirth-CopyPropertiesFromEntityClass 2 strName: " + strName);
}
}
public override void OnUpdateLive()
{
try
{
base.OnUpdateLive();
}
catch (Exception ex)
{
//Log.Out("EntityAnimalChickenRebirth-OnUpdateLive ERROR: " + ex.Message);
// why would the base method throw an exception here?
}
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer) return;
if (EntityClass.entityClassName.Contains("PickedUp"))
{
//Log.Out("EntityAnimalChickenRebirth-OnUpdateLive IS PickedUp");
/*Log.Out("EntityAnimalChickenRebirth-OnUpdateLive GameTimer.Instance.ticks - FeedIntervalTicks: " + (GameTimer.Instance.ticks - FeedIntervalTicks));
Log.Out("EntityAnimalChickenRebirth-OnUpdateLive (ulong)(numFeedInterval * 20): " + ((ulong)(numFeedInterval * 20)));*/
if (GameTimer.Instance.ticks - FeedIntervalTicks > (ulong)(numFeedInterval * 20))
{
//Log.Out("EntityAnimalChickenRebirth-OnUpdateLive WITHIN INTERVAL");
if (RebirthUtilities.GetFood(world, new Vector3i(position.x, position.y, position.z), 3, 30, feedType, feedAmount, "FuriousRamsayBucket001"))
{
//Log.Out("EntityAnimalChickenRebirth-OnUpdateLive BEEN FED");
// is this supposed to do something?
}
else
{
//Log.Out("EntityAnimalChickenRebirth-OnUpdateLive HAS NOT BEEN FED");
Health = Health - numHealthLossPerFeedInterval;
if (Health > 0)
{
Buffs.AddBuff("FuriousRamsayChickenPain");
}
}
FeedIntervalTicks = GameTimer.Instance.ticks;
}
if (GameTimer.Instance.ticks - UpdateIntervalTicks > (ulong)(numUpdateInterval * 20))
{
//Log.Out("EntityAnimalChickenRebirth-OnUpdateLive UpdateInterval TICK");
//Log.Out("EntityAnimalChickenRebirth-OnUpdateLive GameTimer.Instance.ticks: " + GameTimer.Instance.ticks);
if (HomePosition != Vector3i.zero)
{
//Log.Out("EntityAnimalChickenRebirth-OnUpdateLive Home Position exists!");
BlockValue block = world.GetBlock(HomePosition);
if (block.Block is BlockCoopRebirth)
{
//Log.Out("EntityAnimalChickenRebirth-OnUpdateLive Home Position IS COOP!");
// do we do something here?
}
else
{
//Log.Out("======================================================================================");
//Log.Out("homePos RESET");
HomePosition = Vector3i.zero;
UpdateIntervalTicks = GameTimer.Instance.ticks;
return;
}
}
UpdateIntervalTicks = GameTimer.Instance.ticks;
}
}
}
public override void PostInit()
{
//Log.Out("EntityAnimalChickenRebirth-GetActivationCommands START");
base.PostInit();
if (tileEntityAnimalChickenRebirth == null)
{
//Log.Out("EntityAnimalChickenRebirth-GetActivationCommands 1");
tileEntityAnimalChickenRebirth = new TileEntityAnimalChickenRebirth(null);
tileEntityAnimalChickenRebirth.entityId = entityId;
}
cmds = new EntityActivationCommand[] { new EntityActivationCommand("capture", "capture", true) };
}
public override EntityActivationCommand[] GetActivationCommands(Vector3i _tePos, EntityAlive _entityFocusing)
{
//Log.Out("EntityAnimalChickenRebirth-GetActivationCommands START");
if (IsDead())
{
//Log.Out("EntityAnimalChickenRebirth-GetActivationCommands 1");
return new EntityActivationCommand[0];
}
//Log.Out("EntityAnimalChickenRebirth-GetActivationCommands 2");
cmds[0].enabled = true;
return cmds;
}
public override bool OnEntityActivated(int _indexInBlockActivationCommands, Vector3i _tePos, EntityAlive _entityFocusing)
{
//Log.Out("EntityAnimalChickenRebirth-OnEntityActivated START");
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(_entityFocusing as EntityPlayerLocal);
if (_indexInBlockActivationCommands == 0)
{
//Log.Out("EntityAnimalChickenRebirth-OnEntityActivated 1");
string strItem = "FuriousRamsayAnimalChicken001Spawn";
if (HasAnyTags(FastTags<TagGroup.Global>.Parse("FuriousRamsayAnimalChicken002")))
{
//Log.Out("EntityAnimalChickenRebirth-OnEntityActivated 2");
strItem = "FuriousRamsayAnimalChicken002Spawn";
}
else if (HasAnyTags(FastTags<TagGroup.Global>.Parse("FuriousRamsayAnimalChicken003")))
{
//Log.Out("EntityAnimalChickenRebirth-OnEntityActivated 3");
strItem = "FuriousRamsayAnimalChicken003Spawn";
}
else if (HasAnyTags(FastTags<TagGroup.Global>.Parse("FuriousRamsayAnimalChicken004")))
{
//Log.Out("EntityAnimalChickenRebirth-OnEntityActivated 4");
strItem = "FuriousRamsayAnimalChicken004Spawn";
}
ItemValue itemQuickHeal = ItemClass.GetItem(strItem, false);
ItemClass itemClass = itemQuickHeal.ItemClass;
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 1);
_entityFocusing.inventory.AddItem(@is);
Vector3i coopPosition = homePos;
Manager.PlayInsidePlayerHead("chickenpain");
//Log.Out("EntityAnimalChickenRebirth-OnEntityActivated entityID: " + entityID);
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageDespawnEntityRebirth>().Setup(entityId), false);
}
else
{
bIsChunkObserver = false;
bWillRespawn = false;
int entityID = entityId;
DamageResponse damageResponse = new DamageResponse
{
Fatal = true,
Source = new DamageSource(EnumDamageSource.External, EnumDamageTypes.Bashing),
Strength = 999999,
Critical = true,
HitDirection = Utils.EnumHitDirection.None,
MovementState = this.MovementState,
Random = rand.RandomFloat,
ImpulseScale = 1
};
damageResponse.Fatal = true;
damageResponse.Strength = 999999;
timeStayAfterDeath = 0;
Kill(damageResponse);
bWillRespawn = false;
GameManager.Instance.World.RemoveEntity(entityId, EnumRemoveEntityReason.Despawned);
}
}
return false;
}
}

View File

@@ -0,0 +1,45 @@
public class EntityChunkObserver : EntityAlive
{
public override void Awake()
{
base.Awake();
//this.MaxLedgeHeight = 4;
if (this.ModelTransform)
{
this.animator = this.ModelTransform.GetComponentInChildren<Animator>();
}
}
public override Color GetMapIconColor()
{
return new Color(1f, 0.8235294f, 0.34117648f);
}
public override void playStepSound(string stepSound)
{
}
public override bool isGameMessageOnDeath()
{
return false;
}
public override void OnUpdateLive()
{
base.OnUpdateLive();
}
public override void VisiblityCheck(float _distanceSqr, bool _masterIsZooming)
{
bool bVisible = _distanceSqr < (float)(_masterIsZooming ? 14400 : 8100);
this.emodel.SetVisible(bVisible, false);
}
public override bool CanDamageEntity(int _sourceEntityId)
{
Entity entity = this.world.GetEntity(_sourceEntityId);
return !entity || entity.entityClass != this.entityClass;
}
private Animator animator;
}

View File

@@ -0,0 +1,97 @@
public abstract class EntityCoreSDX : EntityAlive
{
public override void Init(int _entityClass)
{
base.Init(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void InitFromPrefab(int _entityClass)
{
base.InitFromPrefab(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void VisiblityCheck(float _distanceSqr, bool _masterIsZooming)
{
bool bVisible = this.ticksUntilVisible <= 0 && _distanceSqr < (float)(_masterIsZooming ? 14400 : 8100);
this.emodel.SetVisible(bVisible, false);
}
public override void PostInit()
{
base.PostInit();
if (!this.isEntityRemote)
{
this.IsBloodMoon = this.world.aiDirector.BloodMoonComponent.BloodMoonActive;
}
}
public override bool IsDrawMapIcon()
{
return true;
}
public override Vector3 GetMapIconScale()
{
return new Vector3(0.75f, 0.75f, 1f);
}
public override bool IsSavedToFile()
{
return (base.GetSpawnerSource() != EnumSpawnerSource.Dynamic || this.IsDead()) && base.IsSavedToFile();
}
public override bool canDespawn()
{
return (!this.IsHordeZombie || this.world.GetPlayers().Count == 0) && base.canDespawn();
}
public override void OnUpdateLive()
{
try
{
base.OnUpdateLive();
}
catch (Exception ex)
{
Log.Out("EntityCoreSDX-OnUpdateLive ERROR: " + ex.Message);
}
if (this.ticksUntilVisible > 0)
{
this.ticksUntilVisible--;
}
}
public override bool isRadiationSensitive()
{
return false;
}
public override bool isDetailedHeadBodyColliders()
{
return true;
}
public override void OnEntityTargeted(EntityAlive target)
{
base.OnEntityTargeted(target);
if (!this.isEntityRemote && base.GetSpawnerSource() != EnumSpawnerSource.Dynamic && target is EntityPlayer)
{
this.world.aiDirector.NotifyIntentToAttack(this, target as EntityPlayer);
}
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale)
{
return base.DamageEntity(_damageSource, _strength, _criticalHit, _impulseScale);
}
public override bool isGameMessageOnDeath()
{
return false;
}
public bool IsHordeZombie;
private int ticksUntilVisible = 2;
}

View File

@@ -0,0 +1,168 @@
public class EntityEnemyAnimalRebirth : EntityEnemy
{
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale = 1f)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0");
EnumDamageSource source = _damageSource.GetSource();
if (_damageSource.IsIgnoreConsecutiveDamages() && source != EnumDamageSource.Internal)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0a");
if (this.damageSourceTimeouts.ContainsKey(source) && GameTimer.Instance.ticks - this.damageSourceTimeouts[source] < 30UL)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0b");
return 0;
}
this.damageSourceTimeouts[source] = GameTimer.Instance.ticks;
}
EntityAlive entityAlive = this.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 1");
if (!this.FriendlyFireCheck(entityAlive))
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 1a");
return 0;
}
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2");
if (!flag && entityAlive is EntityMeleeCyborgRebirth && this is EntityEnemyAnimalRebirth)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2a");
return 0;
}
if (this.IsGodMode.Value)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2b");
return 0;
}
bool flagSuicide = _damageSource.GetDamageType() == EnumDamageTypes.Suicide;
//var myRelationship = FactionManager.Instance.GetRelationshipTier(this, entityAlive);
bool shouldAttack = RebirthUtilities.VerifyFactionStanding(this, entityAlive, true);
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3");
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Love*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3a");
return 0;
}
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Like*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3b");
return 0;
}
if (entityAlive != null)
{
if (!flagSuicide && !shouldAttack /*myRelationship == FactionManager.Relationship.Neutral*/ && (this.entityClass == entityAlive.entityClass))
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3c");
return 0;
}
}
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4");
if (!this.IsDead() && entityAlive)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4a");
float value = EffectManager.GetValue(PassiveEffects.DamageBonus, null, 0f, entityAlive, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (value > 0f)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4b");
_damageSource.DamageMultiplier = value;
_damageSource.BonusDamageType = EnumDamageBonusType.Sneak;
}
}
DamageResponse damageResponse = this.damageEntityLocal(_damageSource, _strength, _criticalHit, _impulseScale);
NetPackage package = NetPackageManager.GetPackage<NetPackageDamageEntity>().Setup(this.entityId, damageResponse);
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5");
if (this.world.IsRemote())
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5a");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(package, false);
}
else
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5b");
int excludePlayer = -1;
if (!flag && _damageSource.CreatorEntityId != -2)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5c");
excludePlayer = _damageSource.getEntityId();
if (_damageSource.CreatorEntityId != -1)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5d");
Entity entity = this.world.GetEntity(_damageSource.CreatorEntityId);
if (entity && !entity.isEntityRemote)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5e");
excludePlayer = -1;
}
}
}
this.world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(this.entityId, excludePlayer, package);
}
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 6");
return damageResponse.ModStrength;
}
public override void Awake()
{
base.Awake();
if (!(bool)(UnityEngine.Object)this.ModelTransform)
return;
this.animator = this.ModelTransform.GetComponentInChildren<Animator>();
}
public override Color GetMapIconColor() => new Color(1f, 0.8235294f, 0.34117648f);
public override void playStepSound(string stepSound)
{
}
public override bool isGameMessageOnDeath() => false;
/*public override void OnUpdateLive()
{
RebirthUtilities.CheckSleeperActivated(this);
base.OnUpdateLive();
}*/
/*public override void VisiblityCheck(float _distanceSqr, bool _masterIsZooming)
{
bool bVisible = _distanceSqr < (float)(_masterIsZooming ? 14400 : 8100);
this.emodel.SetVisible(bVisible, false);
}*/
public override bool CanDamageEntity(int _sourceEntityId)
{
Entity entity = this.world.GetEntity(_sourceEntityId);
//Log.Out("ME: class=" + this.entityClass + ", entity=" + this.entityName);
//Log.Out("THEM: class=" + entity.entityClass + ", entity=" + entity.name);
bool cCanDamageEntity = !entity || entity.entityClass != this.entityClass;
//Log.Out("EntityEnemyAnimalRebirth-CanDamageEntity: " + cCanDamageEntity);
return cCanDamageEntity;
}
public override void updateTasks()
{
if ((this.Buffs.HasBuff("buffShocked") || RebirthUtilities.HasBuffLike(this, "FuriousRamsayRangedStun")) && !this.HasAnyTags(FastTags<TagGroup.Global>.Parse("ally")))
{
this.motion = this.rand.RandomOnUnitSphere * -0.075f;
this.motion.y = this.motion.y + -0.060000002f;
if (this.animator)
{
this.animator.enabled = false;
}
return;
}
else
{
if (this.animator)
this.animator.enabled = true;
base.updateTasks();
}
}
private Animator animator;
}

View File

@@ -0,0 +1,621 @@
using System.Collections.Generic;
public class EntityEnemyRebirthSDX : EntityEnemy
{
public override string EntityName
{
get
{
string name = Localization.Get(this.entityName);
if (this.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("invisible")))
{
name = "";
}
return name;
}
}
public override void Awake()
{
base.Awake();
}
public override void InitCommon()
{
base.InitCommon();
if (this.walkType == 4)
{
this.TurnIntoCrawler();
}
}
public override void OnAddedToWorld()
{
base.OnAddedToWorld();
this.timeToDie = this.world.worldTime + 1800UL + (ulong)(22000f * this.rand.RandomFloat);
if (this.IsFeral && base.GetSpawnerSource() == EnumSpawnerSource.Biome)
{
int num = (int)SkyManager.GetDawnTime();
int num2 = (int)SkyManager.GetDuskTime();
int num3 = GameUtils.WorldTimeToHours(this.WorldTimeBorn);
if (num3 < num || num3 >= num2)
{
int num4 = GameUtils.WorldTimeToDays(this.world.worldTime);
if (GameUtils.WorldTimeToHours(this.world.worldTime) >= num2)
{
num4++;
}
this.timeToDie = GameUtils.DayTimeToWorldTime(num4, num, 0);
}
}
}
private int attackTargetTime;
private bool bJumping;
private bool bClimbing;
private bool hasAI;
private bool isMoveDirAbsolute;
private float proneRefillRate;
private float kneelRefillRate;
private float proneRefillCounter;
private float kneelRefillCounter;
private int ticksToCheckSeenByPlayer;
private bool wasSeenByPlayer;
private bool disableFallBehaviorUntilOnGround;
private DynamicRagdollFlags _dynamicRagdoll;
private Vector3 _dynamicRagdollRootMotion;
private readonly List<Vector3> _ragdollPositionsPrev = new List<Vector3>();
private readonly List<Vector3> _ragdollPositionsCur = new List<Vector3>();
private void UpdateDynamicRagdoll()
{
if (this._dynamicRagdoll.HasFlag(DynamicRagdollFlags.Active))
{
if (this.accumulatedRootMotion != Vector3.zero)
{
this._dynamicRagdollRootMotion = this.accumulatedRootMotion;
}
if (this._dynamicRagdoll.HasFlag(DynamicRagdollFlags.UseBoneVelocities))
{
this._ragdollPositionsPrev.Clear();
this._ragdollPositionsCur.CopyTo(this._ragdollPositionsPrev);
this.emodel.CaptureRagdollPositions(this._ragdollPositionsCur);
}
if (this._dynamicRagdoll.HasFlag(DynamicRagdollFlags.RagdollOnFall) && !this.onGround)
{
this.ActivateDynamicRagdoll();
return;
}
}
}
public override void OnUpdateLive()
{
try
{
base.OnUpdateLive();
}
catch (Exception ex)
{
Log.Out("EntityEnemyRebirthSDX-OnUpdateLive ERROR: " + ex.Message);
}
if (this.moveSpeedRagePer > 0f && this.bodyDamage.CurrentStun == EnumEntityStunType.None)
{
this.moveSpeedScaleTime -= 0.05f;
if (this.moveSpeedScaleTime <= 0f)
{
this.StopRage();
}
}
/////////////////////////////////////////////////////////
if (emodel != null && emodel.avatarController != null)
{
emodel.avatarController.UpdateBool("CanFall",
!emodel.IsRagdollActive && bodyDamage.CurrentStun == EnumEntityStunType.None && !isSwimming);
emodel.avatarController.UpdateBool("IsOnGround", onGround || isSwimming);
}
/////////////////////////////////////////////////////////
if (!this.isEntityRemote)
{
if (!this.IsDead() && this.world.worldTime >= this.timeToDie && !this.attackTarget)
{
this.Kill(DamageResponse.New(true));
}
if (this.emodel)
{
AvatarController avatarController = this.emodel.avatarController;
if (avatarController)
{
bool flag = this.onGround || this.isSwimming || this.bInElevator;
if (flag)
{
this.fallTime = 0f;
this.fallThresholdTime = 0f;
if (this.bInElevator)
{
this.fallThresholdTime = 0.6f;
}
}
else
{
if (this.fallThresholdTime == 0f)
{
this.fallThresholdTime = 0.1f + this.rand.RandomFloat * 0.3f;
}
this.fallTime += 0.05f;
}
bool canFall = !this.emodel.IsRagdollActive && this.bodyDamage.CurrentStun == EnumEntityStunType.None && !this.isSwimming && !this.bInElevator && this.jumpState == EntityAlive.JumpState.Off && !this.IsDead();
if (this.fallTime <= this.fallThresholdTime)
{
canFall = false;
}
avatarController.SetFallAndGround(canFall, flag);
}
}
}
}
public override Ray GetLookRay()
{
Ray result;
if (base.IsBreakingBlocks)
{
result = new Ray(this.position + new Vector3(0f, this.GetEyeHeight(), 0f), this.GetLookVector());
}
else if (base.GetWalkType() == 8)
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
else
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
return result;
}
public override Vector3 GetLookVector()
{
if (this.lookAtPosition.Equals(Vector3.zero))
{
return base.GetLookVector();
}
return this.lookAtPosition - this.getHeadPosition();
}
public override bool IsRunning
{
get
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
return GamePrefs.GetInt(eProperty) >= 2;
}
}
public override float GetMoveSpeedAggro()
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
int @int = GamePrefs.GetInt(eProperty);
float num = EntityEnemyRebirthSDX.moveSpeeds[@int];
if (this.moveSpeedRagePer > 1f)
{
num = EntityEnemyRebirthSDX.moveSuperRageSpeeds[@int];
}
else if (this.moveSpeedRagePer > 0f)
{
float num2 = EntityEnemyRebirthSDX.moveRageSpeeds[@int];
num = num * (1f - this.moveSpeedRagePer) + num2 * this.moveSpeedRagePer;
}
if (num < 1f)
{
num = this.moveSpeedAggro * (1f - num) + this.moveSpeedAggroMax * num;
}
else
{
num = this.moveSpeedAggroMax * num;
}
return EffectManager.GetValue(PassiveEffects.RunSpeed, null, num, this, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
}
public override float getNextStepSoundDistance()
{
if (!this.IsRunning)
{
return 0.5f;
}
return 1.5f;
}
public override void MoveEntityHeaded(Vector3 _direction, bool _isDirAbsolute)
{
// Check the state to see if the controller IsBusy or not. If it's not, then let it walk.
var isBusy = false;
if (emodel != null && emodel.avatarController != null)
emodel.avatarController.TryGetBool("IsBusy", out isBusy);
if (isBusy)
return;
if (this.walkType == 4 && this.Jumping)
{
this.motion = this.accumulatedRootMotion;
this.accumulatedRootMotion = Vector3.zero;
this.IsRotateToGroundFlat = true;
if (this.moveHelper != null)
{
Vector3 vector = this.moveHelper.JumpToPos - this.position;
if (Utils.FastAbs(vector.y) < 0.2f)
{
this.motion.y = vector.y * 0.2f;
}
if (Utils.FastAbs(vector.x) < 0.3f)
{
this.motion.x = vector.x * 0.2f;
}
if (Utils.FastAbs(vector.z) < 0.3f)
{
this.motion.z = vector.z * 0.2f;
}
if (vector.sqrMagnitude < 0.010000001f)
{
if (this.emodel && this.emodel.avatarController)
{
this.emodel.avatarController.StartAnimationJump(AnimJumpMode.Land);
}
this.Jumping = false;
}
}
this.entityCollision(this.motion);
return;
}
base.MoveEntityHeaded(_direction, _isDirAbsolute);
}
public override void UpdateJump()
{
if (this.walkType == 4 && !this.isSwimming)
{
base.FaceJumpTo();
this.jumpState = EntityAlive.JumpState.Climb;
if (!this.emodel.avatarController || !this.emodel.avatarController.IsAnimationJumpRunning())
{
this.Jumping = false;
}
if (this.jumpTicks == 0 && this.accumulatedRootMotion.y > 0.005f)
{
this.jumpTicks = 30;
}
return;
}
base.UpdateJump();
if (this.isSwimming)
{
return;
}
this.accumulatedRootMotion.y = 0f;
}
public override void EndJump()
{
base.EndJump();
this.IsRotateToGroundFlat = false;
}
public override bool ExecuteFallBehavior(EntityAlive.FallBehavior behavior, float _distance, Vector3 _fallMotion)
{
if (behavior == null || !this.emodel)
{
return false;
}
AvatarController avatarController = this.emodel.avatarController;
if (!avatarController)
{
return false;
}
avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.FallBehavior.Op.None:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, -1);
break;
case EntityAlive.FallBehavior.Op.Land:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 0);
break;
case EntityAlive.FallBehavior.Op.LandLow:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 1);
break;
case EntityAlive.FallBehavior.Op.LandHard:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 2);
break;
case EntityAlive.FallBehavior.Op.Stumble:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 3);
break;
case EntityAlive.FallBehavior.Op.Ragdoll:
this.emodel.DoRagdoll(this.rand.RandomFloat * 2f, EnumBodyPartHit.None, _fallMotion * 20f, Vector3.zero, false);
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet() && this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand)))
{
avatarController.StartAnimationRaging();
}
return true;
}
public override bool ExecuteDestroyBlockBehavior(EntityAlive.DestroyBlockBehavior behavior, ItemActionAttack.AttackHitInfo attackHitInfo)
{
if (behavior == null || attackHitInfo == null || this.moveHelper == null || this.emodel == null || this.emodel.avatarController == null)
{
return false;
}
if (this.walkType == 4)
{
return false;
}
this.moveHelper.ClearBlocked();
this.moveHelper.ClearTempMove();
this.emodel.avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.DestroyBlockBehavior.Op.Ragdoll:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThroughRagdoll, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThroughRagdoll);
break;
case EntityAlive.DestroyBlockBehavior.Op.Stumble:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThrough, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThrough);
this.bodyDamage.StunDuration = 1f;
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet())
{
this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand));
}
return true;
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float impulseScale)
{
if (_damageSource.GetDamageType() == EnumDamageTypes.Falling)
{
_strength = (_strength + 1) / 2;
int num = (this.GetMaxHealth() + 2) / 3;
if (_strength > num)
{
_strength = num;
}
}
//return base.DamageEntity(_damageSource, _strength, _criticalHit, impulseScale);
EnumDamageSource source = _damageSource.GetSource();
if (_damageSource.IsIgnoreConsecutiveDamages() && source != EnumDamageSource.Internal)
{
if (this.damageSourceTimeouts.ContainsKey(source) && GameTimer.Instance.ticks - this.damageSourceTimeouts[source] < 30UL)
{
return 0;
}
this.damageSourceTimeouts[source] = GameTimer.Instance.ticks;
}
EntityAlive entityAlive = this.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
if (!this.FriendlyFireCheck(entityAlive))
{
return 0;
}
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
/*if (!flag && entityAlive is EntityZombie && this is EntityZombie)
{
return 0;
}*/
if (this.IsGodMode.Value)
{
return 0;
}
if (!this.IsDead() && entityAlive)
{
float value = EffectManager.GetValue(PassiveEffects.DamageBonus, null, 0f, entityAlive, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (value > 0f)
{
_damageSource.DamageMultiplier = value;
_damageSource.BonusDamageType = EnumDamageBonusType.Sneak;
}
}
DamageResponse damageResponse = this.damageEntityLocal(_damageSource, _strength, _criticalHit, impulseScale);
NetPackage package = NetPackageManager.GetPackage<NetPackageDamageEntity>().Setup(this.entityId, damageResponse);
if (this.world.IsRemote())
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(package, false);
}
else
{
int excludePlayer = -1;
if (!flag && _damageSource.CreatorEntityId != -2)
{
excludePlayer = _damageSource.getEntityId();
if (_damageSource.CreatorEntityId != -1)
{
Entity entity = this.world.GetEntity(_damageSource.CreatorEntityId);
if (entity && !entity.isEntityRemote)
{
excludePlayer = -1;
}
}
}
this.world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(this.entityId, excludePlayer, package);
}
return damageResponse.ModStrength;
}
public bool StartRage(float speedPercent, float time)
{
if (speedPercent >= this.moveSpeedRagePer)
{
this.moveSpeedRagePer = speedPercent;
this.moveSpeedScaleTime = time;
return true;
}
return false;
}
public void StopRage()
{
this.moveSpeedRagePer = 0f;
this.moveSpeedScaleTime = 0f;
}
public override Vector3i dropCorpseBlock()
{
if (this.lootContainer != null && this.lootContainer.IsUserAccessing())
{
return Vector3i.zero;
}
Vector3i vector3i = base.dropCorpseBlock();
if (vector3i == Vector3i.zero)
{
return Vector3i.zero;
}
TileEntityLootContainer tileEntityLootContainer = this.world.GetTileEntity(0, vector3i) as TileEntityLootContainer;
if (tileEntityLootContainer == null)
{
return Vector3i.zero;
}
if (this.lootContainer != null)
{
tileEntityLootContainer.CopyLootContainerDataFromOther(this.lootContainer);
}
else
{
tileEntityLootContainer.lootListName = this.lootListOnDeath;
tileEntityLootContainer.SetContainerSize(LootContainer.GetLootContainer(this.lootListOnDeath, true).size, true);
}
tileEntityLootContainer.SetModified();
return vector3i;
}
public override void AnalyticsSendDeath(DamageResponse _dmResponse)
{
DamageSource source = _dmResponse.Source;
if (source == null)
{
return;
}
string name;
if (source.BuffClass != null)
{
name = source.BuffClass.Name;
}
else
{
if (source.ItemClass == null)
{
return;
}
name = source.ItemClass.Name;
}
GameSparksCollector.IncrementCounter(GameSparksCollector.GSDataKey.ZombiesKilledBy, name, 1, true, GameSparksCollector.GSDataCollection.SessionUpdates);
}
public override void TurnIntoCrawler()
{
BoxCollider component = base.gameObject.GetComponent<BoxCollider>();
if (component)
{
component.center = new Vector3(0f, 0.35f, 0f);
component.size = new Vector3(0.8f, 0.8f, 0.8f);
}
base.SetupBounds();
this.boundingBox.center = this.boundingBox.center + this.position;
this.bCanClimbLadders = false;
}
public override void BuffAdded(BuffValue _buff)
{
if (_buff.BuffClass.DamageType == EnumDamageTypes.Electrical)
{
this.Electrocuted = true;
}
}
public ulong timeToDie;
private float moveSpeedRagePer;
private float moveSpeedScaleTime;
private float fallTime;
private float fallThresholdTime;
private static float[] moveSpeeds = new float[]
{
0f,
0.35f,
0.7f,
1f,
1.35f
};
private static float[] moveRageSpeeds = new float[]
{
0.75f,
0.8f,
0.9f,
1.15f,
1.7f
};
private static float[] moveSuperRageSpeeds = new float[]
{
0.88f,
0.92f,
1f,
1.2f,
1.7f
};
private static float[] rageChances = new float[]
{
0f,
0.15f,
0.3f,
0.35f,
0.4f,
0.5f
};
private static float[] superRageChances = new float[]
{
0f,
0.01f,
0.03f,
0.05f,
0.08f,
0.15f
};
private Vector3i blockPosStandingOn;
private float nextSwimDistance;
private float nextStepDistance;
private string soundFootstepModifier;
private int ticksUntilVisible = 2;
}

View File

@@ -0,0 +1,40 @@
public class EntityFlyingRebirth : EntityEnemy
{
public override void MoveEntityHeaded(Vector3 _direction, bool _isDirAbsolute)
{
if (this.AttachedToEntity != null)
{
return;
}
if (this.IsDead())
{
this.entityCollision(this.motion);
this.motion.y = this.motion.y - 0.08f;
this.motion.y = this.motion.y * 0.98f;
this.motion.x = this.motion.x * 0.91f;
this.motion.z = this.motion.z * 0.91f;
return;
}
if (base.IsInWater())
{
this.Move(_direction, _isDirAbsolute, 0.02f, 1f);
this.entityCollision(this.motion);
this.motion *= 0.8f;
return;
}
float num = 0.91f;
if (this.onGround)
{
num = 0.55f;
BlockValue block = this.world.GetBlock(Utils.Fastfloor(this.position.x), Utils.Fastfloor(this.boundingBox.min.y) - 1, Utils.Fastfloor(this.position.z));
if (!block.isair)
{
num = Mathf.Clamp(block.Block.blockMaterial.Friction, 0.01f, 1f);
}
}
float num2 = 0.163f / (num * num * num);
this.Move(_direction, _isDirAbsolute, this.onGround ? (0.1f * num2) : 0.02f, 1f);
this.entityCollision(this.motion);
this.motion *= num;
}
}

View File

@@ -0,0 +1,198 @@
using System.Collections.Generic;
public class EntityHornetRebirth : EntityFlyingRebirth
{
public override void Awake()
{
BoxCollider component = base.gameObject.GetComponent<BoxCollider>();
if (component)
{
component.center = new Vector3(0f, 0.35f, 0f);
component.size = new Vector3(0.4f, 0.4f, 0.4f);
}
base.Awake();
Transform transform = base.transform.Find("Graphics/BlobShadowProjector");
if (transform)
{
transform.gameObject.SetActive(false);
}
}
public override void Init(int _entityClass)
{
base.Init(_entityClass);
this.emodel.SetVisible(true, false);
if (this.navigator != null)
{
this.navigator.setCanDrown(true);
}
}
public override void InitFromPrefab(int _entityClass)
{
base.InitFromPrefab(_entityClass);
this.emodel.SetVisible(true, false);
if (this.navigator != null)
{
this.navigator.setCanDrown(true);
}
}
public override void updateTasks()
{
if (GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving) || GameStats.GetInt(EnumGameStats.GameState) == 2)
{
return;
}
base.GetEntitySenses().ClearIfExpired();
if (this.attackCounter > 0)
{
this.attackCounter--;
}
if (this.attackCounter <= 0)
{
Vector3 a = this.waypoint - this.position;
float sqrMagnitude = a.sqrMagnitude;
if (sqrMagnitude < 1f || sqrMagnitude > 2304f)
{
if (!base.isWithinHomeDistanceCurrentPosition())
{
Vector3 vector = RandomPositionGenerator.CalcTowards(this, 10, 30, base.getMaximumHomeDistance() / 2, base.getHomePosition().position.ToVector3());
if (!vector.Equals(Vector3.zero))
{
this.waypoint = vector;
this.bDuringHomePathing = true;
}
}
else
{
this.bDuringHomePathing = false;
if (base.GetRevengeTarget() != null && base.GetRevengeTarget().GetDistanceSq(this) < 2304f && this.rand.RandomFloat <= 0.5f)
{
this.waypoint = base.GetRevengeTarget().GetPosition() + Vector3.up;
}
else
{
this.waypoint = base.GetPosition() + new Vector3((this.rand.RandomFloat * 2f - 1f) * 16f, (this.rand.RandomFloat * 2f - 1f) * 16f, (this.rand.RandomFloat * 2f - 1f) * 16f);
}
}
this.waypoint.y = Mathf.Min(this.waypoint.y, 250f);
}
int num = this.courseChangeCooldown;
this.courseChangeCooldown = num - 1;
if (num <= 0)
{
this.courseChangeCooldown += this.rand.RandomRange(5) + 2;
if (this.isCourseTraversable(this.waypoint, out sqrMagnitude))
{
this.motion += a / sqrMagnitude * 0.1f;
}
else
{
this.waypoint = base.GetPosition();
}
}
}
if (base.GetRevengeTarget() != null && base.GetRevengeTarget().IsDead())
{
base.SetRevengeTarget((EntityAlive) null);
}
if (!(base.GetRevengeTarget() == null))
{
int num = this.aggroCooldown;
this.aggroCooldown = num - 1;
if (num > 0)
{
goto IL_296;
}
}
EntityPlayer closestPlayer = this.world.GetClosestPlayer(this, 48f, false);
if (base.CanSee(closestPlayer))
{
base.SetRevengeTarget(closestPlayer);
}
if (base.GetRevengeTarget() != null)
{
this.aggroCooldown = 20;
}
IL_296:
float distanceSq;
if (!this.bDuringHomePathing && base.GetRevengeTarget() != null && (distanceSq = base.GetRevengeTarget().GetDistanceSq(this)) < 2304f)
{
float y = base.GetRevengeTarget().position.x - this.position.x;
float x = base.GetRevengeTarget().position.z - this.position.z;
this.rotation.y = Mathf.Atan2(y, x) * 180f / 3.1415927f;
if (this.attackCounter <= 0 && distanceSq < 2.8f && this.position.y >= base.GetRevengeTarget().position.y && this.position.y <= base.GetRevengeTarget().getHeadPosition().y && base.Attack(false))
{
this.attackCounter = base.GetAttackTimeoutTicks();
base.Attack(true);
return;
}
}
else
{
this.rotation.y = (float)Math.Atan2((double)this.motion.x, (double)this.motion.z) * 180f / 3.1415927f;
}
}
protected bool isCourseTraversable(Vector3 _pos, out float _distance)
{
float num = _pos.x - this.position.x;
float num2 = _pos.y - this.position.y;
float num3 = _pos.z - this.position.z;
_distance = Mathf.Sqrt(num * num + num2 * num2 + num3 * num3);
if (_distance < 1.5f)
{
return true;
}
num /= _distance;
num2 /= _distance;
num3 /= _distance;
Bounds boundingBox = this.boundingBox;
this.collBB.Clear();
int num4 = 1;
while ((float)num4 < _distance - 1f)
{
boundingBox.center += new Vector3(num, num2, num3);
this.world.GetCollidingBounds(this, boundingBox, this.collBB);
if (this.collBB.Count > 0)
{
return false;
}
num4++;
}
return true;
}
public override void fallHitGround(float _v, Vector3 _fallMotion)
{
}
public override bool isDetailedHeadBodyColliders()
{
return true;
}
public override bool isRadiationSensitive()
{
return false;
}
public override float GetEyeHeight()
{
return 0.5f;
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float impulseScale)
{
return base.DamageEntity(_damageSource, _strength, _criticalHit, impulseScale);
}
private const float maxDistanceToTarget = 48f;
private int courseChangeCooldown;
private Vector3 waypoint;
private bool bDuringHomePathing;
private int aggroCooldown;
private int attackCounter;
private List<Bounds> collBB = new List<Bounds>();
}

View File

@@ -0,0 +1,669 @@
using System.Globalization;
using Random = System.Random;
public class EntityMeleeBanditSDX : EntityEnemyRebirthSDX
{
public float flEyeHeight = -1f;
public Random random = new Random();
public float StaticSizeScale = 1;
public bool hasNotified = false;
public string lootDropEntityClass = "";
public string otherTags = "";
public override void CopyPropertiesFromEntityClass()
{
base.CopyPropertiesFromEntityClass();
EntityClass entityClass = EntityClass.list[this.entityClass];
if (entityClass.Properties.Values.ContainsKey("StaticSizeScale"))
{
this.StaticSizeScale = StringParsers.ParseFloat(entityClass.Properties.Values["StaticSizeScale"], 0, -1, NumberStyles.Any);
}
}
public override void fallHitGround(float _distance, Vector3 _fallMotion)
{
this.SetScale(this.StaticSizeScale);
base.fallHitGround(_distance, _fallMotion);
if (_distance > 2f)
{
int num = (int)((-_fallMotion.y - 0.85f) * 160f);
if (num > 0)
{
this.DamageEntity(DamageSource.fall, num, false, 1f);
}
}
}
public override void OnUpdateLive()
{
if (this.bDead)
{
if (this.lootContainer != null)
{
if (this.lootContainer.bTouched && this.lootContainer.IsEmpty())
{
this.MarkToUnload();
this.KillLootContainer();
}
}
}
else
{
float flNotified = this.Buffs.GetCustomVar("$FR_ENTITY_NotifiedEvent");
if (flNotified == 1)
{
hasNotified = true;
}
if (!hasNotified && this.attackTarget && this.HasAllTags(FastTags<TagGroup.Global>.Parse("boss,eventspawn")))
{
hasNotified = true;
this.Buffs.SetCustomVar("$FR_ENTITY_NotifiedEvent", 1);
this.attackTarget.Buffs.AddBuff("FuriousRamsayEventTrigger");
}
}
try
{
base.OnUpdateLive();
}
catch (Exception ex)
{
Log.Out("EntityMeleeBanditSDX-OnUpdateLive ERROR: " + ex.Message);
}
if (!this.bDead)
{
if (this.ticksUntilVisible > 0)
{
this.ticksUntilVisible--;
}
if (!this.isEntityRemote)
{
if (!this.IsDead() && this.world.worldTime >= this.timeToDie && !this.attackTarget)
{
this.Kill(DamageResponse.New(true));
}
}
}
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale = 1f)
{
if ((_damageSource.GetDamageType() == EnumDamageTypes.Falling))
{
if (this.GetWeight() == 69)
{
//Log.Out("DamageEntity SizeScale: " + this.EntityClass.SizeScale);
this.SetScale(this.EntityClass.SizeScale);
return 0;
}
else
{
_strength = (_strength + 1) / 2;
int num = (this.GetMaxHealth() + 2) / 3;
if (_strength > num)
{
_strength = num;
}
}
}
//Log.Out("EntityMeleeBanditSDX-DamageEntity 0");
EnumDamageSource source = _damageSource.GetSource();
if (_damageSource.IsIgnoreConsecutiveDamages() && source != EnumDamageSource.Internal)
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 0a");
if (this.damageSourceTimeouts.ContainsKey(source) && GameTimer.Instance.ticks - this.damageSourceTimeouts[source] < 30UL)
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 0b");
return 0;
}
this.damageSourceTimeouts[source] = GameTimer.Instance.ticks;
}
EntityAlive entityAlive = this.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
//Log.Out("EntityMeleeBanditSDX-DamageEntity 1");
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
//Log.Out("EntityMeleeBanditSDX-DamageEntity 2");
if (!flag && entityAlive is EntityMeleeBanditSDX && this is EntityMeleeBanditSDX)
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 2a");
return 0;
}
if (this.IsGodMode.Value)
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 2b");
return 0;
}
bool flagSuicide = _damageSource.GetDamageType() == EnumDamageTypes.Suicide;
bool shouldAttack = RebirthUtilities.VerifyFactionStanding(this, entityAlive, true);
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3");
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Love*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3a");
return 0;
}
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Like*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3b");
return 0;
}
if (entityAlive != null)
{
if (!flagSuicide && !shouldAttack /*myRelationship == FactionManager.Relationship.Neutral*/ && (this.entityClass == entityAlive.entityClass))
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3c");
return 0;
}
}
//Log.Out("EntityMeleeBanditSDX-DamageEntity 4");
if (!this.IsDead() && entityAlive)
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 4a");
float value = EffectManager.GetValue(PassiveEffects.DamageBonus, null, 0f, entityAlive, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (value > 0f)
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 4b");
_damageSource.DamageMultiplier = value;
_damageSource.BonusDamageType = EnumDamageBonusType.Sneak;
}
}
DamageResponse damageResponse = this.damageEntityLocal(_damageSource, _strength, _criticalHit, _impulseScale);
NetPackage package = NetPackageManager.GetPackage<NetPackageDamageEntity>().Setup(this.entityId, damageResponse);
//Log.Out("EntityMeleeBanditSDX-DamageEntity 5");
if (this.world.IsRemote())
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 5a");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(package, false);
}
else
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 5b");
int excludePlayer = -1;
if (!flag && _damageSource.CreatorEntityId != -2)
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 5c");
excludePlayer = _damageSource.getEntityId();
if (_damageSource.CreatorEntityId != -1)
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 5d");
Entity entity = this.world.GetEntity(_damageSource.CreatorEntityId);
if (entity && !entity.isEntityRemote)
{
//Log.Out("EntityMeleeBanditSDX-DamageEntity 5e");
excludePlayer = -1;
}
}
}
this.world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(this.entityId, excludePlayer, package);
}
//Log.Out("EntityMeleeBanditSDX-DamageEntity 6");
return damageResponse.ModStrength;
}
public override void OnAddedToWorld()
{
base.OnAddedToWorld();
this.timeToDie = this.world.worldTime + 1800UL + (ulong)(22000f * this.rand.RandomFloat);
if (this.IsFeral && base.GetSpawnerSource() == EnumSpawnerSource.Biome)
{
int num = (int)SkyManager.GetDawnTime();
int num2 = (int)SkyManager.GetDuskTime();
int num3 = GameUtils.WorldTimeToHours(this.WorldTimeBorn);
if (num3 < num || num3 >= num2)
{
int num4 = GameUtils.WorldTimeToDays(this.world.worldTime);
if (GameUtils.WorldTimeToHours(this.world.worldTime) >= num2)
{
num4++;
}
this.timeToDie = GameUtils.DayTimeToWorldTime(num4, num, 0);
}
}
}
public override bool IsSavedToFile()
{
// If they have a cvar persist, keep them around.
if (Buffs.HasCustomVar("Persist")) return true;
// If its dynamic spawn, don't let them stay.
if (GetSpawnerSource() == EnumSpawnerSource.Dynamic) return false;
return true;
}
public override void Init(int _entityClass)
{
base.Init(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void InitFromPrefab(int _entityClass)
{
base.InitFromPrefab(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void VisiblityCheck(float _distanceSqr, bool _masterIsZooming)
{
bool bVisible = this.ticksUntilVisible <= 0 && _distanceSqr < (float)(_masterIsZooming ? 14400 : 8100);
this.emodel.SetVisible(bVisible, false);
}
public override void PostInit()
{
base.PostInit();
if (!this.isEntityRemote)
{
this.IsBloodMoon = this.world.aiDirector.BloodMoonComponent.BloodMoonActive;
}
}
public override bool IsDrawMapIcon()
{
return true;
}
public override bool isRadiationSensitive()
{
return false;
}
public override bool isDetailedHeadBodyColliders()
{
return true;
}
public override void OnEntityTargeted(EntityAlive target)
{
base.OnEntityTargeted(target);
if (!this.isEntityRemote && base.GetSpawnerSource() != EnumSpawnerSource.Dynamic && target is EntityPlayer)
{
this.world.aiDirector.NotifyIntentToAttack(this, target as EntityPlayer);
}
}
public override bool isGameMessageOnDeath()
{
return false;
}
public override void Awake()
{
base.Awake();
}
public override Ray GetLookRay()
{
Ray result;
if (base.IsBreakingBlocks)
{
result = new Ray(this.position + new Vector3(0f, this.GetEyeHeight(), 0f), this.GetLookVector());
}
else if (base.GetWalkType() == 8)
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
else
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
return result;
}
public override Vector3 GetLookVector()
{
if (this.lookAtPosition.Equals(Vector3.zero))
{
return base.GetLookVector();
}
return this.lookAtPosition - this.getHeadPosition();
}
public override bool IsRunning
{
get
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
return GamePrefs.GetInt(eProperty) >= 2;
}
}
public override float GetMoveSpeedAggro()
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
int @int = GamePrefs.GetInt(eProperty);
float num = moveSpeeds[@int];
if (this.moveSpeedRagePer > 1f)
{
num = moveSuperRageSpeeds[@int];
}
else if (this.moveSpeedRagePer > 0f)
{
float num2 = moveRageSpeeds[@int];
num = num * (1f - this.moveSpeedRagePer) + num2 * this.moveSpeedRagePer;
}
if (num < 1f)
{
num = this.moveSpeedAggro * (1f - num) + this.moveSpeedAggroMax * num;
}
else
{
num = this.moveSpeedAggroMax * num;
}
return EffectManager.GetValue(PassiveEffects.RunSpeed, null, num, this, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
}
public override float getNextStepSoundDistance()
{
if (!this.IsRunning)
{
return 0.5f;
}
return 1.5f;
}
public override void MoveEntityHeaded(Vector3 _direction, bool _isDirAbsolute)
{
if (this.walkType == 4 && this.Jumping)
{
this.motion = this.accumulatedRootMotion;
this.accumulatedRootMotion = Vector3.zero;
this.IsRotateToGroundFlat = true;
if (this.moveHelper != null)
{
Vector3 vector = this.moveHelper.JumpToPos - this.position;
if (Utils.FastAbs(vector.y) < 0.2f)
{
this.motion.y = vector.y * 0.2f;
}
if (Utils.FastAbs(vector.x) < 0.3f)
{
this.motion.x = vector.x * 0.2f;
}
if (Utils.FastAbs(vector.z) < 0.3f)
{
this.motion.z = vector.z * 0.2f;
}
if (vector.sqrMagnitude < 0.010000001f)
{
if (this.emodel && this.emodel.avatarController)
{
this.emodel.avatarController.StartAnimationJump(AnimJumpMode.Land);
}
this.Jumping = false;
}
}
this.entityCollision(this.motion);
return;
}
base.MoveEntityHeaded(_direction, _isDirAbsolute);
}
public override void UpdateJump()
{
if (this.walkType == 4 && !this.isSwimming)
{
base.FaceJumpTo();
this.jumpState = EntityAlive.JumpState.Climb;
if (!this.emodel.avatarController || !this.emodel.avatarController.IsAnimationJumpRunning())
{
this.Jumping = false;
}
if (this.jumpTicks == 0 && this.accumulatedRootMotion.y > 0.005f)
{
this.jumpTicks = 30;
}
return;
}
base.UpdateJump();
if (this.isSwimming)
{
return;
}
this.accumulatedRootMotion.y = 0f;
}
public override void EndJump()
{
base.EndJump();
this.IsRotateToGroundFlat = false;
}
public override bool ExecuteFallBehavior(EntityAlive.FallBehavior behavior, float _distance, Vector3 _fallMotion)
{
if (behavior == null || !this.emodel)
{
return false;
}
AvatarController avatarController = this.emodel.avatarController;
if (!avatarController)
{
return false;
}
avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.FallBehavior.Op.None:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, -1);
break;
case EntityAlive.FallBehavior.Op.Land:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 0);
break;
case EntityAlive.FallBehavior.Op.LandLow:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 1);
break;
case EntityAlive.FallBehavior.Op.LandHard:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 2);
break;
case EntityAlive.FallBehavior.Op.Stumble:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 3);
break;
case EntityAlive.FallBehavior.Op.Ragdoll:
this.emodel.DoRagdoll(this.rand.RandomFloat * 2f, EnumBodyPartHit.None, _fallMotion * 20f, Vector3.zero, false);
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet() && this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand)))
{
avatarController.StartAnimationRaging();
}
return true;
}
public override bool ExecuteDestroyBlockBehavior(EntityAlive.DestroyBlockBehavior behavior, ItemActionAttack.AttackHitInfo attackHitInfo)
{
if (behavior == null || attackHitInfo == null || this.moveHelper == null || this.emodel == null || this.emodel.avatarController == null)
{
return false;
}
if (this.walkType == 4)
{
return false;
}
this.moveHelper.ClearBlocked();
this.moveHelper.ClearTempMove();
this.emodel.avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.DestroyBlockBehavior.Op.Ragdoll:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThroughRagdoll, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThroughRagdoll);
break;
case EntityAlive.DestroyBlockBehavior.Op.Stumble:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThrough, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThrough);
this.bodyDamage.StunDuration = 1f;
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet())
{
this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand));
}
return true;
}
public override void ProcessDamageResponseLocal(DamageResponse _dmResponse)
{
base.ProcessDamageResponseLocal(_dmResponse);
if (!this.isEntityRemote)
{
int @int = GameStats.GetInt(EnumGameStats.GameDifficulty);
float num = (float)_dmResponse.Strength / 40f;
if (num > 1f)
{
num = Mathf.Pow(num, 0.29f);
}
float num2 = rageChances[@int] * num;
if (this.rand.RandomFloat < num2)
{
if (this.rand.RandomFloat < superRageChances[@int])
{
this.StartRage(2f, 30f);
this.PlayOneShot(this.GetSoundAlert(), false);
return;
}
this.StartRage(0.5f + this.rand.RandomFloat * 0.5f, 4f + this.rand.RandomFloat * 6f);
}
}
}
public override Vector3i dropCorpseBlock()
{
if (this.lootContainer != null && this.lootContainer.IsUserAccessing())
{
return Vector3i.zero;
}
Vector3i vector3i = base.dropCorpseBlock();
if (vector3i == Vector3i.zero)
{
return Vector3i.zero;
}
TileEntityLootContainer tileEntityLootContainer = this.world.GetTileEntity(0, vector3i) as TileEntityLootContainer;
if (tileEntityLootContainer == null)
{
return Vector3i.zero;
}
if (this.lootContainer != null)
{
tileEntityLootContainer.CopyLootContainerDataFromOther(this.lootContainer);
}
else
{
tileEntityLootContainer.lootListName = this.lootListOnDeath;
tileEntityLootContainer.SetContainerSize(LootContainer.GetLootContainer(this.lootListOnDeath, true).size, true);
}
tileEntityLootContainer.SetModified();
return vector3i;
}
public override void AnalyticsSendDeath(DamageResponse _dmResponse)
{
DamageSource source = _dmResponse.Source;
if (source == null)
{
return;
}
string name;
if (source.BuffClass != null)
{
name = source.BuffClass.Name;
}
else
{
if (source.ItemClass == null)
{
return;
}
name = source.ItemClass.Name;
}
GameSparksCollector.IncrementCounter(GameSparksCollector.GSDataKey.ZombiesKilledBy, name, 1, true, GameSparksCollector.GSDataCollection.SessionUpdates);
}
public override void BuffAdded(BuffValue _buff)
{
if (_buff.BuffClass.DamageType == EnumDamageTypes.Electrical)
{
this.Electrocuted = true;
}
}
private int ticksUntilVisible = 2;
private float moveSpeedRagePer;
private float moveSpeedScaleTime;
private float fallTime;
private float fallThresholdTime;
private static float[] moveSpeeds = new float[]
{
0f,
0.35f,
0.7f,
1f,
1.35f
};
private static float[] moveRageSpeeds = new float[]
{
0.75f,
0.8f,
0.9f,
1.15f,
1.7f
};
private static float[] moveSuperRageSpeeds = new float[]
{
0.88f,
0.92f,
1f,
1.2f,
1.7f
};
private static float[] rageChances = new float[]
{
0f,
0.15f,
0.3f,
0.35f,
0.4f,
0.5f
};
private static float[] superRageChances = new float[]
{
0f,
0.01f,
0.03f,
0.05f,
0.08f,
0.15f
};
}

View File

@@ -0,0 +1,767 @@
using Audio;
using System.Collections.Generic;
using System.Globalization;
using Random = System.Random;
public class EntityMeleeCyborgRebirth : EntityEnemyRebirthSDX
{
public float flEyeHeight = -1f;
public Random random = new Random();
/*public ulong timeToDie;*/
private bool bPlayHurtSound;
public float StaticSizeScale = 1;
public bool hasNotified = false;
public List<int> generatedNumbers = new List<int>();
public bool NanoCyborgFuriousRamsayStage1 = false;
public bool NanoCyborgFuriousRamsayStage2 = false;
public bool NanoCyborgFuriousRamsayStage3 = false;
public string lootDropEntityClass = "";
public string otherTags = "";
public override void CopyPropertiesFromEntityClass()
{
base.CopyPropertiesFromEntityClass();
EntityClass entityClass = EntityClass.list[this.entityClass];
if (entityClass.Properties.Values.ContainsKey("StaticSizeScale"))
{
this.StaticSizeScale = StringParsers.ParseFloat(entityClass.Properties.Values["StaticSizeScale"], 0, -1, NumberStyles.Any);
//Log.Out("CopyPropertiesFromEntityClass-StaticSizeScale: " + StaticSizeScale);
}
else
{
//Log.Out("NO StaticSizeScale FOUND");
}
}
public override void fallHitGround(float _distance, Vector3 _fallMotion)
{
this.SetScale(this.StaticSizeScale);
//Log.Out("fallHitGround-StaticSizeScale: " + StaticSizeScale);
base.fallHitGround(_distance, _fallMotion);
if (_distance > 2f)
{
int num = (int)((-_fallMotion.y - 0.85f) * 160f);
if (num > 0)
{
this.DamageEntity(DamageSource.fall, num, false, 1f);
}
}
}
public override void OnUpdateLive()
{
if (this.bDead)
{
if (this.lootContainer != null)
{
if (this.lootContainer.bTouched && this.lootContainer.IsEmpty())
{
this.MarkToUnload();
this.KillLootContainer();
}
}
}
try
{
base.OnUpdateLive();
}
catch (Exception ex)
{
Log.Out("EntityMeleeCyborgRebirth-OnUpdateLive ERROR: " + ex.Message);
}
if (!this.bDead)
{
float flNotified = this.Buffs.GetCustomVar("$FR_ENTITY_NotifiedEvent");
if (flNotified == 1)
{
hasNotified = true;
}
if (this.attackTarget && !hasNotified && this.HasAllTags(FastTags<TagGroup.Global>.Parse("boss,eventspawn")))
{
hasNotified = true;
this.Buffs.SetCustomVar("$FR_ENTITY_NotifiedEvent", 1);
this.attackTarget.Buffs.AddBuff("FuriousRamsayEventTrigger");
}
if (this.ticksUntilVisible > 0)
{
this.ticksUntilVisible--;
}
if (!this.isEntityRemote)
{
if (!this.IsDead() && this.world.worldTime >= this.timeToDie && !this.attackTarget)
{
this.Kill(DamageResponse.New(true));
}
}
}
}
/*public override bool CanDamageEntity(int _sourceEntityId)
{
return true;
}*/
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale = 1f)
{
if ((_damageSource.GetDamageType() == EnumDamageTypes.Falling))
{
if (this.GetWeight() == 69)
{
return 0;
}
else
{
_strength = (_strength + 1) / 2;
int num = (this.GetMaxHealth() + 2) / 3;
if (_strength > num)
{
_strength = num;
}
}
}
EntityAlive entityAlive = this.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0: " + entityAlive.EntityName);
EnumDamageSource source = _damageSource.GetSource();
if (_damageSource.IsIgnoreConsecutiveDamages() && source != EnumDamageSource.Internal)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0a");
if (this.damageSourceTimeouts.ContainsKey(source) && GameTimer.Instance.ticks - this.damageSourceTimeouts[source] < 30UL)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0b");
return 0;
}
this.damageSourceTimeouts[source] = GameTimer.Instance.ticks;
}
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 1");
if (!this.FriendlyFireCheck(entityAlive))
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 1a");
return 0;
}
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2");
if (!flag && entityAlive is EntityMeleeCyborgRebirth && this is EntityMeleeCyborgRebirth)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2a");
return 0;
}
if (this.IsGodMode.Value)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2b");
return 0;
}
bool flagSuicide = _damageSource.GetDamageType() == EnumDamageTypes.Suicide;
bool shouldAttack = RebirthUtilities.VerifyFactionStanding(this, entityAlive, true);
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3");
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Love*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3a");
return 0;
}
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Like*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3b");
return 0;
}
if (entityAlive != null)
{
if (!flagSuicide && !shouldAttack /*myRelationship == FactionManager.Relationship.Neutral*/ && (this.entityClass == entityAlive.entityClass))
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3c");
return 0;
}
}
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4");
if (!this.IsDead() && entityAlive)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4a");
float value = EffectManager.GetValue(PassiveEffects.DamageBonus, null, 0f, entityAlive, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (value > 0f)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4b");
_damageSource.DamageMultiplier = value;
_damageSource.BonusDamageType = EnumDamageBonusType.Sneak;
}
}
DamageResponse damageResponse = this.damageEntityLocal(_damageSource, _strength, _criticalHit, _impulseScale);
if (this.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("nanospawnerevent")))
{
bool isHordeNight = RebirthUtilities.IsHordeNight();
bool NanoCyborgFuriousRamsayStage1Spawns = !NanoCyborgFuriousRamsayStage1 &&
!isHordeNight &&
(this.Health / this.Stats.Health.ModifiedMax) < .8f;
bool NanoCyborgFuriousRamsayStage2Spawns = !NanoCyborgFuriousRamsayStage2 &&
!isHordeNight &&
(this.Health / this.Stats.Health.ModifiedMax) < .55f;
bool NanoCyborgFuriousRamsayStage3Spawns = !NanoCyborgFuriousRamsayStage3 &&
!isHordeNight &&
(this.Health / this.Stats.Health.ModifiedMax) < .3f;
EntityAlive entityplayer = null;
if (entityAlive is EntityPlayer)
{
entityplayer = entityAlive;
}
if (NanoCyborgFuriousRamsayStage1Spawns)
{
NanoCyborgFuriousRamsayStage1 = true;
Manager.BroadcastPlay(this.position, "FuriousRamsayNanoSpawn");
generatedNumbers.Clear();
RebirthUtilities.SpawnEntity(this.entityId, "NanoCyborg002_FR", 2, "", "", "2", "dynamic", "20", "", 1, -1, true, false, true, entityplayer.entityId);
}
else if (NanoCyborgFuriousRamsayStage2Spawns)
{
NanoCyborgFuriousRamsayStage2 = true;
Manager.BroadcastPlay(this.position, "FuriousRamsayNanoSpawn");
generatedNumbers.Clear();
RebirthUtilities.SpawnEntity(this.entityId, "NanoCyborg003_FR", 2, "", "", "2", "dynamic", "20", "", 1, -1, true, false, true, entityplayer.entityId);
}
else if (NanoCyborgFuriousRamsayStage3Spawns)
{
NanoCyborgFuriousRamsayStage3 = true;
Manager.BroadcastPlay(this.position, "FuriousRamsayNanoSpawn");
generatedNumbers.Clear();
RebirthUtilities.SpawnEntity(this.entityId, "NanoCyborg004_FR", 2, "", "", "2", "dynamic", "20", "", 1, -1, true, false, true, entityplayer.entityId);
}
}
else if (this.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("nanospawnerboss")))
{
bool isHordeNight = RebirthUtilities.IsHordeNight();
bool NanoCyborgFuriousRamsayStage1Spawns = !NanoCyborgFuriousRamsayStage1 &&
!isHordeNight &&
(this.Health / this.Stats.Health.ModifiedMax) < .8f;
bool NanoCyborgFuriousRamsayStage2Spawns = !NanoCyborgFuriousRamsayStage2 &&
!isHordeNight &&
(this.Health / this.Stats.Health.ModifiedMax) < .55f;
bool NanoCyborgFuriousRamsayStage3Spawns = !NanoCyborgFuriousRamsayStage3 &&
!isHordeNight &&
(this.Health / this.Stats.Health.ModifiedMax) < .3f;
EntityAlive entityplayer = null;
if (entityAlive is EntityPlayer)
{
entityplayer = entityAlive;
}
if (NanoCyborgFuriousRamsayStage1Spawns)
{
NanoCyborgFuriousRamsayStage1 = true;
Manager.BroadcastPlay(this.position, "FuriousRamsayNanoSpawn");
generatedNumbers.Clear();
RebirthUtilities.SpawnEntity(this.entityId, "NanoCyborg002_FREvent", 2, "", "", "2", "dynamic", "20", "", 1, -1, true, false, true, entityplayer.entityId);
}
else if (NanoCyborgFuriousRamsayStage2Spawns)
{
NanoCyborgFuriousRamsayStage2 = true;
Manager.BroadcastPlay(this.position, "FuriousRamsayNanoSpawn");
generatedNumbers.Clear();
RebirthUtilities.SpawnEntity(this.entityId, "NanoCyborg003_FREvent", 2, "", "", "2", "dynamic", "20", "", 1, -1, true, false, true, entityplayer.entityId);
}
else if (NanoCyborgFuriousRamsayStage3Spawns)
{
NanoCyborgFuriousRamsayStage3 = true;
Manager.BroadcastPlay(this.position, "FuriousRamsayNanoSpawn");
generatedNumbers.Clear();
RebirthUtilities.SpawnEntity(this.entityId, "NanoCyborg004_FREvent", 2, "", "", "2", "dynamic", "20", "", 1, -1, true, false, true, entityplayer.entityId);
}
}
NetPackage package = NetPackageManager.GetPackage<NetPackageDamageEntity>().Setup(this.entityId, damageResponse);
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5");
if (this.world.IsRemote())
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5a");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(package, false);
}
else
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5b");
int excludePlayer = -1;
if (!flag && _damageSource.CreatorEntityId != -2)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5c");
excludePlayer = _damageSource.getEntityId();
if (_damageSource.CreatorEntityId != -1)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5d");
Entity entity = this.world.GetEntity(_damageSource.CreatorEntityId);
if (entity && !entity.isEntityRemote)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5e");
excludePlayer = -1;
}
}
}
this.world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(this.entityId, excludePlayer, package);
}
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 6");
return damageResponse.ModStrength;
}
public override void OnAddedToWorld()
{
base.OnAddedToWorld();
this.timeToDie = this.world.worldTime + 1800UL + (ulong)(22000f * this.rand.RandomFloat);
if (this.IsFeral && base.GetSpawnerSource() == EnumSpawnerSource.Biome)
{
int num = (int)SkyManager.GetDawnTime();
int num2 = (int)SkyManager.GetDuskTime();
int num3 = GameUtils.WorldTimeToHours(this.WorldTimeBorn);
if (num3 < num || num3 >= num2)
{
int num4 = GameUtils.WorldTimeToDays(this.world.worldTime);
if (GameUtils.WorldTimeToHours(this.world.worldTime) >= num2)
{
num4++;
}
this.timeToDie = GameUtils.DayTimeToWorldTime(num4, num, 0);
}
}
}
public override bool IsSavedToFile()
{
// If they have a cvar persist, keep them around.
if (Buffs.HasCustomVar("Persist")) return true;
// If its dynamic spawn, don't let them stay.
if (GetSpawnerSource() == EnumSpawnerSource.Dynamic) return false;
return true;
}
public override Ray GetLookRay()
{
Ray result;
if (base.IsBreakingBlocks)
{
result = new Ray(this.position + new Vector3(0f, this.GetEyeHeight(), 0f), this.GetLookVector());
}
else if (base.GetWalkType() == 8)
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
else
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
return result;
}
public override Vector3 GetLookVector()
{
if (this.lookAtPosition.Equals(Vector3.zero))
{
return base.GetLookVector();
}
return this.lookAtPosition - this.getHeadPosition();
}
public override bool IsRunning
{
get
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
return GamePrefs.GetInt(eProperty) >= 2;
}
}
public override float GetMoveSpeedAggro()
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
int @int = GamePrefs.GetInt(eProperty);
float num = moveSpeeds[@int];
if (this.moveSpeedRagePer > 1f)
{
num = moveSuperRageSpeeds[@int];
}
else if (this.moveSpeedRagePer > 0f)
{
float num2 = moveRageSpeeds[@int];
num = num * (1f - this.moveSpeedRagePer) + num2 * this.moveSpeedRagePer;
}
if (num < 1f)
{
num = this.moveSpeedAggro * (1f - num) + this.moveSpeedAggroMax * num;
}
else
{
num = this.moveSpeedAggroMax * num;
}
return EffectManager.GetValue(PassiveEffects.RunSpeed, null, num, this, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
}
public override float getNextStepSoundDistance()
{
if (!this.IsRunning)
{
return 0.5f;
}
return 1.5f;
}
public override void MoveEntityHeaded(Vector3 _direction, bool _isDirAbsolute)
{
if (this.walkType == 4 && this.Jumping)
{
this.motion = this.accumulatedRootMotion;
this.accumulatedRootMotion = Vector3.zero;
this.IsRotateToGroundFlat = true;
if (this.moveHelper != null)
{
Vector3 vector = this.moveHelper.JumpToPos - this.position;
if (Utils.FastAbs(vector.y) < 0.2f)
{
this.motion.y = vector.y * 0.2f;
}
if (Utils.FastAbs(vector.x) < 0.3f)
{
this.motion.x = vector.x * 0.2f;
}
if (Utils.FastAbs(vector.z) < 0.3f)
{
this.motion.z = vector.z * 0.2f;
}
if (vector.sqrMagnitude < 0.010000001f)
{
if (this.emodel && this.emodel.avatarController)
{
this.emodel.avatarController.StartAnimationJump(AnimJumpMode.Land);
}
this.Jumping = false;
}
}
this.entityCollision(this.motion);
return;
}
base.MoveEntityHeaded(_direction, _isDirAbsolute);
}
public override void UpdateJump()
{
if (this.walkType == 4 && !this.isSwimming)
{
base.FaceJumpTo();
this.jumpState = EntityAlive.JumpState.Climb;
if (!this.emodel.avatarController || !this.emodel.avatarController.IsAnimationJumpRunning())
{
this.Jumping = false;
}
if (this.jumpTicks == 0 && this.accumulatedRootMotion.y > 0.005f)
{
this.jumpTicks = 30;
}
return;
}
base.UpdateJump();
if (this.isSwimming)
{
return;
}
this.accumulatedRootMotion.y = 0f;
}
public override void EndJump()
{
base.EndJump();
this.IsRotateToGroundFlat = false;
}
public override bool ExecuteFallBehavior(EntityAlive.FallBehavior behavior, float _distance, Vector3 _fallMotion)
{
if (behavior == null || !this.emodel)
{
return false;
}
AvatarController avatarController = this.emodel.avatarController;
if (!avatarController)
{
return false;
}
avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.FallBehavior.Op.None:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, -1);
break;
case EntityAlive.FallBehavior.Op.Land:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 0);
break;
case EntityAlive.FallBehavior.Op.LandLow:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 1);
break;
case EntityAlive.FallBehavior.Op.LandHard:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 2);
break;
case EntityAlive.FallBehavior.Op.Stumble:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 3);
break;
case EntityAlive.FallBehavior.Op.Ragdoll:
this.emodel.DoRagdoll(this.rand.RandomFloat * 2f, EnumBodyPartHit.None, _fallMotion * 20f, Vector3.zero, false);
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet() && this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand)))
{
avatarController.StartAnimationRaging();
}
return true;
}
public override bool ExecuteDestroyBlockBehavior(EntityAlive.DestroyBlockBehavior behavior, ItemActionAttack.AttackHitInfo attackHitInfo)
{
if (behavior == null || attackHitInfo == null || this.moveHelper == null || this.emodel == null || this.emodel.avatarController == null)
{
return false;
}
if (this.walkType == 4)
{
return false;
}
this.moveHelper.ClearBlocked();
this.moveHelper.ClearTempMove();
this.emodel.avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.DestroyBlockBehavior.Op.Ragdoll:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThroughRagdoll, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThroughRagdoll);
break;
case EntityAlive.DestroyBlockBehavior.Op.Stumble:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThrough, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThrough);
this.bodyDamage.StunDuration = 1f;
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet())
{
this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand));
}
return true;
}
public override Vector3i dropCorpseBlock()
{
if (this.lootContainer != null && this.lootContainer.IsUserAccessing())
{
return Vector3i.zero;
}
Vector3i vector3i = base.dropCorpseBlock();
if (vector3i == Vector3i.zero)
{
return Vector3i.zero;
}
TileEntityLootContainer tileEntityLootContainer = this.world.GetTileEntity(0, vector3i) as TileEntityLootContainer;
if (tileEntityLootContainer == null)
{
return Vector3i.zero;
}
if (this.lootContainer != null)
{
tileEntityLootContainer.CopyLootContainerDataFromOther(this.lootContainer);
}
else
{
tileEntityLootContainer.lootListName = this.lootListOnDeath;
tileEntityLootContainer.SetContainerSize(LootContainer.GetLootContainer(this.lootListOnDeath, true).size, true);
}
tileEntityLootContainer.SetModified();
return vector3i;
}
public override void AnalyticsSendDeath(DamageResponse _dmResponse)
{
DamageSource source = _dmResponse.Source;
if (source == null)
{
return;
}
string name;
if (source.BuffClass != null)
{
name = source.BuffClass.Name;
}
else
{
if (source.ItemClass == null)
{
return;
}
name = source.ItemClass.Name;
}
GameSparksCollector.IncrementCounter(GameSparksCollector.GSDataKey.ZombiesKilledBy, name, 1, true, GameSparksCollector.GSDataCollection.SessionUpdates);
}
public override void BuffAdded(BuffValue _buff)
{
if (_buff.BuffClass.DamageType == EnumDamageTypes.Electrical)
{
this.Electrocuted = true;
}
}
private int ticksUntilVisible = 2;
private float moveSpeedRagePer;
private float moveSpeedScaleTime;
private float fallTime;
private float fallThresholdTime;
private static float[] moveSpeeds = new float[]
{
0f,
0.35f,
0.7f,
1f,
1.35f
};
private static float[] moveRageSpeeds = new float[]
{
0.75f,
0.8f,
0.9f,
1.15f,
1.7f
};
private static float[] moveSuperRageSpeeds = new float[]
{
0.88f,
0.92f,
1f,
1.2f,
1.7f
};
private static float[] rageChances = new float[]
{
0f,
0.15f,
0.3f,
0.35f,
0.4f,
0.5f
};
private static float[] superRageChances = new float[]
{
0f,
0.01f,
0.03f,
0.05f,
0.08f,
0.15f
};
private void ApplyLocalBodyDamage(DamageResponse _dmResponse)
{
if (_dmResponse.Dismember)
{
switch (_dmResponse.HitBodyPart)
{
case EnumBodyPartHit.Head:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 1U);
break;
case EnumBodyPartHit.LeftUpperArm:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 2U);
break;
case EnumBodyPartHit.RightUpperArm:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 8U);
break;
case EnumBodyPartHit.LeftUpperLeg:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 32U);
this.bodyDamage.ShouldBeCrawler = true;
break;
case EnumBodyPartHit.RightUpperLeg:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 128U);
this.bodyDamage.ShouldBeCrawler = true;
break;
case EnumBodyPartHit.LeftLowerArm:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 4U);
break;
case EnumBodyPartHit.RightLowerArm:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 16U);
break;
case EnumBodyPartHit.LeftLowerLeg:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 64U);
this.bodyDamage.ShouldBeCrawler = true;
break;
case EnumBodyPartHit.RightLowerLeg:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 256U);
this.bodyDamage.ShouldBeCrawler = true;
break;
}
}
if (_dmResponse.TurnIntoCrawler)
{
this.bodyDamage.ShouldBeCrawler = true;
}
if (_dmResponse.CrippleLegs)
{
if (_dmResponse.HitBodyPart.IsLeftLeg())
{
this.bodyDamage.Flags = (this.bodyDamage.Flags | 4096U);
}
else if (_dmResponse.HitBodyPart.IsRightLeg())
{
this.bodyDamage.Flags = (this.bodyDamage.Flags | 8192U);
}
}
this.bodyDamage.damageType = _dmResponse.Source.damageType;
this.bodyDamage.bodyPartHit = _dmResponse.HitBodyPart;
}
}

View File

@@ -0,0 +1,652 @@
using System.Globalization;
using Random = System.Random;
public class EntityMeleeRangedBanditSDX : EntityEnemyRebirthSDX
{
public float flEyeHeight = -1f;
public Random random = new Random();
public float StaticSizeScale = 1;
public string lootDropEntityClass = "";
public string otherTags = "";
public override void CopyPropertiesFromEntityClass()
{
base.CopyPropertiesFromEntityClass();
EntityClass entityClass = EntityClass.list[this.entityClass];
if (entityClass.Properties.Values.ContainsKey("StaticSizeScale"))
{
this.StaticSizeScale = StringParsers.ParseFloat(entityClass.Properties.Values["StaticSizeScale"], 0, -1, NumberStyles.Any);
}
}
public override void fallHitGround(float _distance, Vector3 _fallMotion)
{
this.SetScale(this.StaticSizeScale);
base.fallHitGround(_distance, _fallMotion);
if (_distance > 2f)
{
int num = (int)((-_fallMotion.y - 0.85f) * 160f);
if (num > 0)
{
this.DamageEntity(DamageSource.fall, num, false, 1f);
}
}
}
public override void OnUpdateLive()
{
if (this.bDead)
{
if (this.lootContainer != null)
{
if (this.lootContainer.bTouched && this.lootContainer.IsEmpty())
{
this.MarkToUnload();
this.KillLootContainer();
}
}
}
try
{
base.OnUpdateLive();
}
catch (Exception ex)
{
Log.Out("EntityMeleeRangedBanditSDX-OnUpdateLive ERROR: " + ex.Message);
}
if (!this.bDead)
{
if (this.ticksUntilVisible > 0)
{
this.ticksUntilVisible--;
}
if (!this.isEntityRemote)
{
if (!this.IsDead() && this.world.worldTime >= this.timeToDie && !this.attackTarget)
{
this.Kill(DamageResponse.New(true));
}
}
}
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale = 1f)
{
if ((_damageSource.GetDamageType() == EnumDamageTypes.Falling))
{
if (this.GetWeight() == 69)
{
return 0;
}
else
{
_strength = (_strength + 1) / 2;
int num = (this.GetMaxHealth() + 2) / 3;
if (_strength > num)
{
_strength = num;
}
}
}
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 0");
EnumDamageSource source = _damageSource.GetSource();
if (_damageSource.IsIgnoreConsecutiveDamages() && source != EnumDamageSource.Internal)
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 0a");
if (this.damageSourceTimeouts.ContainsKey(source) && GameTimer.Instance.ticks - this.damageSourceTimeouts[source] < 30UL)
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 0b");
return 0;
}
this.damageSourceTimeouts[source] = GameTimer.Instance.ticks;
}
EntityAlive entityAlive = this.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 1");
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 2");
if (!flag && entityAlive is EntityMeleeRangedBanditSDX && this is EntityMeleeRangedBanditSDX)
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 2a");
return 0;
}
if (this.IsGodMode.Value)
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 2b");
return 0;
}
bool flagSuicide = _damageSource.GetDamageType() == EnumDamageTypes.Suicide;
bool shouldAttack = RebirthUtilities.VerifyFactionStanding(this, entityAlive, true);
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3");
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Love*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3a");
return 0;
}
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Like*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3b");
return 0;
}
if (entityAlive != null)
{
if (!flagSuicide && !shouldAttack /*myRelationship == FactionManager.Relationship.Neutral*/ && (this.entityClass == entityAlive.entityClass))
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3c");
return 0;
}
}
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 4");
if (!this.IsDead() && entityAlive)
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 4a");
float value = EffectManager.GetValue(PassiveEffects.DamageBonus, null, 0f, entityAlive, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (value > 0f)
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 4b");
_damageSource.DamageMultiplier = value;
_damageSource.BonusDamageType = EnumDamageBonusType.Sneak;
}
}
DamageResponse damageResponse = this.damageEntityLocal(_damageSource, _strength, _criticalHit, _impulseScale);
NetPackage package = NetPackageManager.GetPackage<NetPackageDamageEntity>().Setup(this.entityId, damageResponse);
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 5");
if (this.world.IsRemote())
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 5a");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(package, false);
}
else
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 5b");
int excludePlayer = -1;
if (!flag && _damageSource.CreatorEntityId != -2)
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 5c");
excludePlayer = _damageSource.getEntityId();
if (_damageSource.CreatorEntityId != -1)
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 5d");
Entity entity = this.world.GetEntity(_damageSource.CreatorEntityId);
if (entity && !entity.isEntityRemote)
{
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 5e");
excludePlayer = -1;
}
}
}
this.world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(this.entityId, excludePlayer, package);
}
//Log.Out("EntityMeleeRangedBanditSDX-DamageEntity 6");
return damageResponse.ModStrength;
}
public override void OnAddedToWorld()
{
base.OnAddedToWorld();
this.timeToDie = this.world.worldTime + 1800UL + (ulong)(22000f * this.rand.RandomFloat);
if (this.IsFeral && base.GetSpawnerSource() == EnumSpawnerSource.Biome)
{
int num = (int)SkyManager.GetDawnTime();
int num2 = (int)SkyManager.GetDuskTime();
int num3 = GameUtils.WorldTimeToHours(this.WorldTimeBorn);
if (num3 < num || num3 >= num2)
{
int num4 = GameUtils.WorldTimeToDays(this.world.worldTime);
if (GameUtils.WorldTimeToHours(this.world.worldTime) >= num2)
{
num4++;
}
this.timeToDie = GameUtils.DayTimeToWorldTime(num4, num, 0);
}
}
}
public override bool IsSavedToFile()
{
// If they have a cvar persist, keep them around.
if (Buffs.HasCustomVar("Persist")) return true;
// If its dynamic spawn, don't let them stay.
if (GetSpawnerSource() == EnumSpawnerSource.Dynamic) return false;
return true;
}
public override void Init(int _entityClass)
{
base.Init(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void InitFromPrefab(int _entityClass)
{
base.InitFromPrefab(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void VisiblityCheck(float _distanceSqr, bool _masterIsZooming)
{
bool bVisible = this.ticksUntilVisible <= 0 && _distanceSqr < (float)(_masterIsZooming ? 14400 : 8100);
this.emodel.SetVisible(bVisible, false);
}
public override void PostInit()
{
base.PostInit();
if (!this.isEntityRemote)
{
this.IsBloodMoon = this.world.aiDirector.BloodMoonComponent.BloodMoonActive;
}
}
public override bool IsDrawMapIcon()
{
return true;
}
public override bool isRadiationSensitive()
{
return false;
}
public override bool isDetailedHeadBodyColliders()
{
return true;
}
public override void OnEntityTargeted(EntityAlive target)
{
base.OnEntityTargeted(target);
if (!this.isEntityRemote && base.GetSpawnerSource() != EnumSpawnerSource.Dynamic && target is EntityPlayer)
{
this.world.aiDirector.NotifyIntentToAttack(this, target as EntityPlayer);
}
}
public override bool isGameMessageOnDeath()
{
return false;
}
public override void Awake()
{
base.Awake();
//this.MaxLedgeHeight = 20;
}
public override Ray GetLookRay()
{
Ray result;
if (base.IsBreakingBlocks)
{
result = new Ray(this.position + new Vector3(0f, this.GetEyeHeight(), 0f), this.GetLookVector());
}
else if (base.GetWalkType() == 8)
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
else
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
return result;
}
public override Vector3 GetLookVector()
{
if (this.lookAtPosition.Equals(Vector3.zero))
{
return base.GetLookVector();
}
return this.lookAtPosition - this.getHeadPosition();
}
public override bool IsRunning
{
get
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
return GamePrefs.GetInt(eProperty) >= 2;
}
}
public override float GetMoveSpeedAggro()
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
int @int = GamePrefs.GetInt(eProperty);
float num = moveSpeeds[@int];
if (this.moveSpeedRagePer > 1f)
{
num = moveSuperRageSpeeds[@int];
}
else if (this.moveSpeedRagePer > 0f)
{
float num2 = moveRageSpeeds[@int];
num = num * (1f - this.moveSpeedRagePer) + num2 * this.moveSpeedRagePer;
}
if (num < 1f)
{
num = this.moveSpeedAggro * (1f - num) + this.moveSpeedAggroMax * num;
}
else
{
num = this.moveSpeedAggroMax * num;
}
return EffectManager.GetValue(PassiveEffects.RunSpeed, null, num, this, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
}
public override float getNextStepSoundDistance()
{
if (!this.IsRunning)
{
return 0.5f;
}
return 1.5f;
}
public override void MoveEntityHeaded(Vector3 _direction, bool _isDirAbsolute)
{
if (this.walkType == 4 && this.Jumping)
{
this.motion = this.accumulatedRootMotion;
this.accumulatedRootMotion = Vector3.zero;
this.IsRotateToGroundFlat = true;
if (this.moveHelper != null)
{
Vector3 vector = this.moveHelper.JumpToPos - this.position;
if (Utils.FastAbs(vector.y) < 0.2f)
{
this.motion.y = vector.y * 0.2f;
}
if (Utils.FastAbs(vector.x) < 0.3f)
{
this.motion.x = vector.x * 0.2f;
}
if (Utils.FastAbs(vector.z) < 0.3f)
{
this.motion.z = vector.z * 0.2f;
}
if (vector.sqrMagnitude < 0.010000001f)
{
if (this.emodel && this.emodel.avatarController)
{
this.emodel.avatarController.StartAnimationJump(AnimJumpMode.Land);
}
this.Jumping = false;
}
}
this.entityCollision(this.motion);
return;
}
base.MoveEntityHeaded(_direction, _isDirAbsolute);
}
public override void UpdateJump()
{
if (this.walkType == 4 && !this.isSwimming)
{
base.FaceJumpTo();
this.jumpState = EntityAlive.JumpState.Climb;
if (!this.emodel.avatarController || !this.emodel.avatarController.IsAnimationJumpRunning())
{
this.Jumping = false;
}
if (this.jumpTicks == 0 && this.accumulatedRootMotion.y > 0.005f)
{
this.jumpTicks = 30;
}
return;
}
base.UpdateJump();
if (this.isSwimming)
{
return;
}
this.accumulatedRootMotion.y = 0f;
}
public override void EndJump()
{
base.EndJump();
this.IsRotateToGroundFlat = false;
}
public override bool ExecuteFallBehavior(EntityAlive.FallBehavior behavior, float _distance, Vector3 _fallMotion)
{
if (behavior == null || !this.emodel)
{
return false;
}
AvatarController avatarController = this.emodel.avatarController;
if (!avatarController)
{
return false;
}
avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.FallBehavior.Op.None:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, -1);
break;
case EntityAlive.FallBehavior.Op.Land:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 0);
break;
case EntityAlive.FallBehavior.Op.LandLow:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 1);
break;
case EntityAlive.FallBehavior.Op.LandHard:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 2);
break;
case EntityAlive.FallBehavior.Op.Stumble:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 3);
break;
case EntityAlive.FallBehavior.Op.Ragdoll:
this.emodel.DoRagdoll(this.rand.RandomFloat * 2f, EnumBodyPartHit.None, _fallMotion * 20f, Vector3.zero, false);
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet() && this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand)))
{
avatarController.StartAnimationRaging();
}
return true;
}
public override bool ExecuteDestroyBlockBehavior(EntityAlive.DestroyBlockBehavior behavior, ItemActionAttack.AttackHitInfo attackHitInfo)
{
if (behavior == null || attackHitInfo == null || this.moveHelper == null || this.emodel == null || this.emodel.avatarController == null)
{
return false;
}
if (this.walkType == 4)
{
return false;
}
this.moveHelper.ClearBlocked();
this.moveHelper.ClearTempMove();
this.emodel.avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.DestroyBlockBehavior.Op.Ragdoll:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThroughRagdoll, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThroughRagdoll);
break;
case EntityAlive.DestroyBlockBehavior.Op.Stumble:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThrough, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThrough);
this.bodyDamage.StunDuration = 1f;
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet())
{
this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand));
}
return true;
}
public override void ProcessDamageResponseLocal(DamageResponse _dmResponse)
{
base.ProcessDamageResponseLocal(_dmResponse);
if (!this.isEntityRemote)
{
int @int = GameStats.GetInt(EnumGameStats.GameDifficulty);
float num = (float)_dmResponse.Strength / 40f;
if (num > 1f)
{
num = Mathf.Pow(num, 0.29f);
}
float num2 = rageChances[@int] * num;
if (this.rand.RandomFloat < num2)
{
if (this.rand.RandomFloat < superRageChances[@int])
{
this.StartRage(2f, 30f);
this.PlayOneShot(this.GetSoundAlert(), false);
return;
}
this.StartRage(0.5f + this.rand.RandomFloat * 0.5f, 4f + this.rand.RandomFloat * 6f);
}
}
}
public override Vector3i dropCorpseBlock()
{
if (this.lootContainer != null && this.lootContainer.IsUserAccessing())
{
return Vector3i.zero;
}
Vector3i vector3i = base.dropCorpseBlock();
if (vector3i == Vector3i.zero)
{
return Vector3i.zero;
}
TileEntityLootContainer tileEntityLootContainer = this.world.GetTileEntity(0, vector3i) as TileEntityLootContainer;
if (tileEntityLootContainer == null)
{
return Vector3i.zero;
}
if (this.lootContainer != null)
{
tileEntityLootContainer.CopyLootContainerDataFromOther(this.lootContainer);
}
else
{
tileEntityLootContainer.lootListName = this.lootListOnDeath;
tileEntityLootContainer.SetContainerSize(LootContainer.GetLootContainer(this.lootListOnDeath, true).size, true);
}
tileEntityLootContainer.SetModified();
return vector3i;
}
public override void AnalyticsSendDeath(DamageResponse _dmResponse)
{
DamageSource source = _dmResponse.Source;
if (source == null)
{
return;
}
string name;
if (source.BuffClass != null)
{
name = source.BuffClass.Name;
}
else
{
if (source.ItemClass == null)
{
return;
}
name = source.ItemClass.Name;
}
GameSparksCollector.IncrementCounter(GameSparksCollector.GSDataKey.ZombiesKilledBy, name, 1, true, GameSparksCollector.GSDataCollection.SessionUpdates);
}
public override void BuffAdded(BuffValue _buff)
{
if (_buff.BuffClass.DamageType == EnumDamageTypes.Electrical)
{
this.Electrocuted = true;
}
}
private int ticksUntilVisible = 2;
private float moveSpeedRagePer;
private float moveSpeedScaleTime;
private float fallTime;
private float fallThresholdTime;
private static float[] moveSpeeds = new float[]
{
0f,
0.35f,
0.7f,
1f,
1.35f
};
private static float[] moveRageSpeeds = new float[]
{
0.75f,
0.8f,
0.9f,
1.15f,
1.7f
};
private static float[] moveSuperRageSpeeds = new float[]
{
0.88f,
0.92f,
1f,
1.2f,
1.7f
};
private static float[] rageChances = new float[]
{
0f,
0.15f,
0.3f,
0.35f,
0.4f,
0.5f
};
private static float[] superRageChances = new float[]
{
0f,
0.01f,
0.03f,
0.05f,
0.08f,
0.15f
};
}

View File

@@ -0,0 +1,617 @@
using Random = System.Random;
public class EntityMeleeSurvivorSDX : EntityEnemyRebirthSDX
{
public float flEyeHeight = -1f;
public Random random = new Random();
/*public ulong timeToDie;*/
public override void OnUpdateLive()
{
if (!RebirthUtilities.IsAnyPlayerWithingDist(3f, this))
{
//Log.Out("I AM NOT CLOSE");
RebirthUtilities.toggleCollisions(true, this);
}
else
{
//Log.Out("I AM CLOSE");
RebirthUtilities.toggleCollisions(false, this);
}
try
{
base.OnUpdateLive();
}
catch (Exception ex)
{
Log.Out("EntityMeleeSurvivorSDX-OnUpdateLive ERROR: " + ex.Message);
}
if (this.ticksUntilVisible > 0)
{
this.ticksUntilVisible--;
}
if (!this.isEntityRemote)
{
if (!this.IsDead() && this.world.worldTime >= this.timeToDie && !this.attackTarget)
{
this.Kill(DamageResponse.New(true));
}
}
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale = 1f)
{
EntityAlive entityAlive = this.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
if (entityAlive is EntityPlayer)
{
return 0;
}
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 0");
EnumDamageSource source = _damageSource.GetSource();
if (_damageSource.IsIgnoreConsecutiveDamages() && source != EnumDamageSource.Internal)
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 0a");
if (this.damageSourceTimeouts.ContainsKey(source) && GameTimer.Instance.ticks - this.damageSourceTimeouts[source] < 30UL)
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 0b");
return 0;
}
this.damageSourceTimeouts[source] = GameTimer.Instance.ticks;
}
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 1");
if (!this.FriendlyFireCheck(entityAlive))
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 1a");
return 0;
}
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 2");
if (!flag && entityAlive is EntityMeleeSurvivorSDX && this is EntityMeleeSurvivorSDX)
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 2a");
return 0;
}
if (this.IsGodMode.Value)
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 2b");
return 0;
}
bool flagSuicide = _damageSource.GetDamageType() == EnumDamageTypes.Suicide;
bool shouldAttack = RebirthUtilities.VerifyFactionStanding(this, entityAlive, true);
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3");
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Love*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3a");
return 0;
}
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Like*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3b");
return 0;
}
if (entityAlive != null)
{
if (!flagSuicide && !shouldAttack /*myRelationship == FactionManager.Relationship.Neutral*/ && (this.entityClass == entityAlive.entityClass))
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3c");
return 0;
}
}
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 4");
if (!this.IsDead() && entityAlive)
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 4a");
float value = EffectManager.GetValue(PassiveEffects.DamageBonus, null, 0f, entityAlive, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (value > 0f)
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 4b");
_damageSource.DamageMultiplier = value;
_damageSource.BonusDamageType = EnumDamageBonusType.Sneak;
}
}
DamageResponse damageResponse = this.damageEntityLocal(_damageSource, _strength, _criticalHit, _impulseScale);
NetPackage package = NetPackageManager.GetPackage<NetPackageDamageEntity>().Setup(this.entityId, damageResponse);
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 5");
if (this.world.IsRemote())
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 5a");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(package, false);
}
else
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 5b");
int excludePlayer = -1;
if (!flag && _damageSource.CreatorEntityId != -2)
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 5c");
excludePlayer = _damageSource.getEntityId();
if (_damageSource.CreatorEntityId != -1)
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 5d");
Entity entity = this.world.GetEntity(_damageSource.CreatorEntityId);
if (entity && !entity.isEntityRemote)
{
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 5e");
excludePlayer = -1;
}
}
}
this.world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(this.entityId, excludePlayer, package);
}
//Log.Out("EntityMeleeSurvivorSDX-DamageEntity 6");
return damageResponse.ModStrength;
}
public override void OnAddedToWorld()
{
base.OnAddedToWorld();
this.timeToDie = this.world.worldTime + 1800UL + (ulong)(22000f * this.rand.RandomFloat);
if (this.IsFeral && base.GetSpawnerSource() == EnumSpawnerSource.Biome)
{
int num = (int)SkyManager.GetDawnTime();
int num2 = (int)SkyManager.GetDuskTime();
int num3 = GameUtils.WorldTimeToHours(this.WorldTimeBorn);
if (num3 < num || num3 >= num2)
{
int num4 = GameUtils.WorldTimeToDays(this.world.worldTime);
if (GameUtils.WorldTimeToHours(this.world.worldTime) >= num2)
{
num4++;
}
this.timeToDie = GameUtils.DayTimeToWorldTime(num4, num, 0);
}
}
}
public override bool IsSavedToFile()
{
// If they have a cvar persist, keep them around.
if (Buffs.HasCustomVar("Persist")) return true;
// If its dynamic spawn, don't let them stay.
if (GetSpawnerSource() == EnumSpawnerSource.Dynamic) return false;
return true;
}
public override void Init(int _entityClass)
{
base.Init(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void InitFromPrefab(int _entityClass)
{
base.InitFromPrefab(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void VisiblityCheck(float _distanceSqr, bool _masterIsZooming)
{
bool bVisible = this.ticksUntilVisible <= 0 && _distanceSqr < (float)(_masterIsZooming ? 14400 : 8100);
this.emodel.SetVisible(bVisible, false);
}
public override void PostInit()
{
base.PostInit();
if (!this.isEntityRemote)
{
this.IsBloodMoon = this.world.aiDirector.BloodMoonComponent.BloodMoonActive;
}
}
public override bool IsDrawMapIcon()
{
return true;
}
public override bool isRadiationSensitive()
{
return false;
}
public override bool isDetailedHeadBodyColliders()
{
return true;
}
public override void OnEntityTargeted(EntityAlive target)
{
base.OnEntityTargeted(target);
if (!this.isEntityRemote && base.GetSpawnerSource() != EnumSpawnerSource.Dynamic && target is EntityPlayer)
{
this.world.aiDirector.NotifyIntentToAttack(this, target as EntityPlayer);
}
}
public override bool isGameMessageOnDeath()
{
return false;
}
public override void Awake()
{
base.Awake();
//this.MaxLedgeHeight = 20;
}
public override Ray GetLookRay()
{
Ray result;
if (base.IsBreakingBlocks)
{
result = new Ray(this.position + new Vector3(0f, this.GetEyeHeight(), 0f), this.GetLookVector());
}
else if (base.GetWalkType() == 8)
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
else
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
return result;
}
public override Vector3 GetLookVector()
{
if (this.lookAtPosition.Equals(Vector3.zero))
{
return base.GetLookVector();
}
return this.lookAtPosition - this.getHeadPosition();
}
public override bool IsRunning
{
get
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
return GamePrefs.GetInt(eProperty) >= 2;
}
}
public override float GetMoveSpeedAggro()
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
int @int = GamePrefs.GetInt(eProperty);
float num = moveSpeeds[@int];
if (this.moveSpeedRagePer > 1f)
{
num = moveSuperRageSpeeds[@int];
}
else if (this.moveSpeedRagePer > 0f)
{
float num2 = moveRageSpeeds[@int];
num = num * (1f - this.moveSpeedRagePer) + num2 * this.moveSpeedRagePer;
}
if (num < 1f)
{
num = this.moveSpeedAggro * (1f - num) + this.moveSpeedAggroMax * num;
}
else
{
num = this.moveSpeedAggroMax * num;
}
return EffectManager.GetValue(PassiveEffects.RunSpeed, null, num, this, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
}
public override float getNextStepSoundDistance()
{
if (!this.IsRunning)
{
return 0.5f;
}
return 1.5f;
}
public override void MoveEntityHeaded(Vector3 _direction, bool _isDirAbsolute)
{
if (this.walkType == 4 && this.Jumping)
{
this.motion = this.accumulatedRootMotion;
this.accumulatedRootMotion = Vector3.zero;
this.IsRotateToGroundFlat = true;
if (this.moveHelper != null)
{
Vector3 vector = this.moveHelper.JumpToPos - this.position;
if (Utils.FastAbs(vector.y) < 0.2f)
{
this.motion.y = vector.y * 0.2f;
}
if (Utils.FastAbs(vector.x) < 0.3f)
{
this.motion.x = vector.x * 0.2f;
}
if (Utils.FastAbs(vector.z) < 0.3f)
{
this.motion.z = vector.z * 0.2f;
}
if (vector.sqrMagnitude < 0.010000001f)
{
if (this.emodel && this.emodel.avatarController)
{
this.emodel.avatarController.StartAnimationJump(AnimJumpMode.Land);
}
this.Jumping = false;
}
}
this.entityCollision(this.motion);
return;
}
base.MoveEntityHeaded(_direction, _isDirAbsolute);
}
public override void UpdateJump()
{
if (this.walkType == 4 && !this.isSwimming)
{
base.FaceJumpTo();
this.jumpState = EntityAlive.JumpState.Climb;
if (!this.emodel.avatarController || !this.emodel.avatarController.IsAnimationJumpRunning())
{
this.Jumping = false;
}
if (this.jumpTicks == 0 && this.accumulatedRootMotion.y > 0.005f)
{
this.jumpTicks = 30;
}
return;
}
base.UpdateJump();
if (this.isSwimming)
{
return;
}
this.accumulatedRootMotion.y = 0f;
}
public override void EndJump()
{
base.EndJump();
this.IsRotateToGroundFlat = false;
}
public override bool ExecuteFallBehavior(EntityAlive.FallBehavior behavior, float _distance, Vector3 _fallMotion)
{
if (behavior == null || !this.emodel)
{
return false;
}
AvatarController avatarController = this.emodel.avatarController;
if (!avatarController)
{
return false;
}
avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.FallBehavior.Op.None:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, -1);
break;
case EntityAlive.FallBehavior.Op.Land:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 0);
break;
case EntityAlive.FallBehavior.Op.LandLow:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 1);
break;
case EntityAlive.FallBehavior.Op.LandHard:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 2);
break;
case EntityAlive.FallBehavior.Op.Stumble:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 3);
break;
case EntityAlive.FallBehavior.Op.Ragdoll:
this.emodel.DoRagdoll(this.rand.RandomFloat * 2f, EnumBodyPartHit.None, _fallMotion * 20f, Vector3.zero, false);
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet() && this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand)))
{
avatarController.StartAnimationRaging();
}
return true;
}
public override bool ExecuteDestroyBlockBehavior(EntityAlive.DestroyBlockBehavior behavior, ItemActionAttack.AttackHitInfo attackHitInfo)
{
if (behavior == null || attackHitInfo == null || this.moveHelper == null || this.emodel == null || this.emodel.avatarController == null)
{
return false;
}
if (this.walkType == 4)
{
return false;
}
this.moveHelper.ClearBlocked();
this.moveHelper.ClearTempMove();
this.emodel.avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.DestroyBlockBehavior.Op.Ragdoll:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThroughRagdoll, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThroughRagdoll);
break;
case EntityAlive.DestroyBlockBehavior.Op.Stumble:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThrough, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThrough);
this.bodyDamage.StunDuration = 1f;
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet())
{
this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand));
}
return true;
}
public override void ProcessDamageResponseLocal(DamageResponse _dmResponse)
{
base.ProcessDamageResponseLocal(_dmResponse);
if (!this.isEntityRemote)
{
int @int = GameStats.GetInt(EnumGameStats.GameDifficulty);
float num = (float)_dmResponse.Strength / 40f;
if (num > 1f)
{
num = Mathf.Pow(num, 0.29f);
}
float num2 = rageChances[@int] * num;
if (this.rand.RandomFloat < num2)
{
if (this.rand.RandomFloat < superRageChances[@int])
{
this.StartRage(2f, 30f);
this.PlayOneShot(this.GetSoundAlert(), false);
return;
}
this.StartRage(0.5f + this.rand.RandomFloat * 0.5f, 4f + this.rand.RandomFloat * 6f);
}
}
}
public override Vector3i dropCorpseBlock()
{
if (this.lootContainer != null && this.lootContainer.IsUserAccessing())
{
return Vector3i.zero;
}
Vector3i vector3i = base.dropCorpseBlock();
if (vector3i == Vector3i.zero)
{
return Vector3i.zero;
}
TileEntityLootContainer tileEntityLootContainer = this.world.GetTileEntity(0, vector3i) as TileEntityLootContainer;
if (tileEntityLootContainer == null)
{
return Vector3i.zero;
}
if (this.lootContainer != null)
{
tileEntityLootContainer.CopyLootContainerDataFromOther(this.lootContainer);
}
else
{
tileEntityLootContainer.lootListName = this.lootListOnDeath;
tileEntityLootContainer.SetContainerSize(LootContainer.GetLootContainer(this.lootListOnDeath, true).size, true);
}
tileEntityLootContainer.SetModified();
return vector3i;
}
public override void AnalyticsSendDeath(DamageResponse _dmResponse)
{
DamageSource source = _dmResponse.Source;
if (source == null)
{
return;
}
string name;
if (source.BuffClass != null)
{
name = source.BuffClass.Name;
}
else
{
if (source.ItemClass == null)
{
return;
}
name = source.ItemClass.Name;
}
GameSparksCollector.IncrementCounter(GameSparksCollector.GSDataKey.ZombiesKilledBy, name, 1, true, GameSparksCollector.GSDataCollection.SessionUpdates);
}
public override void BuffAdded(BuffValue _buff)
{
if (_buff.BuffClass.DamageType == EnumDamageTypes.Electrical)
{
this.Electrocuted = true;
}
}
private int ticksUntilVisible = 2;
private float moveSpeedRagePer;
private float moveSpeedScaleTime;
private float fallTime;
private float fallThresholdTime;
private static float[] moveSpeeds = new float[]
{
0f,
0.35f,
0.7f,
1f,
1.35f
};
private static float[] moveRageSpeeds = new float[]
{
0.75f,
0.8f,
0.9f,
1.15f,
1.7f
};
private static float[] moveSuperRageSpeeds = new float[]
{
0.88f,
0.92f,
1f,
1.2f,
1.7f
};
private static float[] rageChances = new float[]
{
0f,
0.15f,
0.3f,
0.35f,
0.4f,
0.5f
};
private static float[] superRageChances = new float[]
{
0f,
0.01f,
0.03f,
0.05f,
0.08f,
0.15f
};
}

View File

@@ -0,0 +1,653 @@
using Random = System.Random;
public class EntityMeleeWerewolfSDX : EntityEnemyRebirthSDX
{
public float flEyeHeight = -1f;
public Random random = new Random();
public bool hasNotified = false;
public string lootDropEntityClass = "";
public string otherTags = "";
public override string EntityName
{
get
{
return this.entityName;
}
/*
set
{
string randomName = RebirthUtilities.GetRandomName(this);
if (randomName != "")
{
value = randomName;
}
if (!value.Equals(this.entityName))
{
this.entityName = value;
this.bPlayerStatsChanged |= !this.isEntityRemote;
this.HandleSetNavName();
}
}*/
}
public override void OnUpdateLive()
{
if (this.bDead)
{
if (this.lootContainer != null)
{
if (this.lootContainer.bTouched && this.lootContainer.IsEmpty())
{
this.MarkToUnload();
this.KillLootContainer();
}
}
}
else
{
float flNotified = this.Buffs.GetCustomVar("$FR_ENTITY_NotifiedEvent");
if (flNotified == 1)
{
hasNotified = true;
}
if (!hasNotified && this.attackTarget && this.HasAllTags(FastTags<TagGroup.Global>.Parse("boss,eventspawn")))
{
hasNotified = true;
this.Buffs.SetCustomVar("$FR_ENTITY_NotifiedEvent", 1);
this.attackTarget.Buffs.AddBuff("FuriousRamsayEventTrigger");
}
}
try
{
base.OnUpdateLive();
}
catch (Exception ex)
{
Log.Out("EntityMeleeWerewolfSDX-OnUpdateLive ERROR: " + ex.Message);
}
if (!this.bDead)
{
if (this.ticksUntilVisible > 0)
{
this.ticksUntilVisible--;
}
if (!this.isEntityRemote)
{
if (!this.IsDead() && this.world.worldTime >= this.timeToDie && !this.attackTarget)
{
this.Kill(DamageResponse.New(true));
}
}
}
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale = 1f)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0");
EnumDamageSource source = _damageSource.GetSource();
if (_damageSource.IsIgnoreConsecutiveDamages() && source != EnumDamageSource.Internal)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0a");
if (this.damageSourceTimeouts.ContainsKey(source) && GameTimer.Instance.ticks - this.damageSourceTimeouts[source] < 30UL)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0b");
return 0;
}
this.damageSourceTimeouts[source] = GameTimer.Instance.ticks;
}
EntityAlive entityAlive = this.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 1");
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2");
if (!flag && entityAlive is EntityMeleeCyborgRebirth && this is EntityMeleeWerewolfSDX)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2a");
return 0;
}
if (this.IsGodMode.Value)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2b");
return 0;
}
bool flagSuicide = _damageSource.GetDamageType() == EnumDamageTypes.Suicide;
bool shouldAttack = RebirthUtilities.VerifyFactionStanding(this, entityAlive, true);
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3");
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Love*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3a");
return 0;
}
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Like*/)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3b");
return 0;
}
if (entityAlive != null)
{
if (!flagSuicide && !shouldAttack /*myRelationship == FactionManager.Relationship.Neutral*/ && (this.entityClass == entityAlive.entityClass))
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3c");
return 0;
}
}
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4");
if (!this.IsDead() && entityAlive)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4a");
float value = EffectManager.GetValue(PassiveEffects.DamageBonus, null, 0f, entityAlive, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (value > 0f)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4b");
_damageSource.DamageMultiplier = value;
_damageSource.BonusDamageType = EnumDamageBonusType.Sneak;
}
}
DamageResponse damageResponse = this.damageEntityLocal(_damageSource, _strength, _criticalHit, _impulseScale);
NetPackage package = NetPackageManager.GetPackage<NetPackageDamageEntity>().Setup(this.entityId, damageResponse);
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5");
if (this.world.IsRemote())
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5a");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(package, false);
}
else
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5b");
int excludePlayer = -1;
if (!flag && _damageSource.CreatorEntityId != -2)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5c");
excludePlayer = _damageSource.getEntityId();
if (_damageSource.CreatorEntityId != -1)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5d");
Entity entity = this.world.GetEntity(_damageSource.CreatorEntityId);
if (entity && !entity.isEntityRemote)
{
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5e");
excludePlayer = -1;
}
}
}
this.world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(this.entityId, excludePlayer, package);
}
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 6");
return damageResponse.ModStrength;
}
public override void OnAddedToWorld()
{
base.OnAddedToWorld();
this.timeToDie = this.world.worldTime + 1800UL + (ulong)(22000f * this.rand.RandomFloat);
if (this.IsFeral && base.GetSpawnerSource() == EnumSpawnerSource.Biome)
{
int num = (int)SkyManager.GetDawnTime();
int num2 = (int)SkyManager.GetDuskTime();
int num3 = GameUtils.WorldTimeToHours(this.WorldTimeBorn);
if (num3 < num || num3 >= num2)
{
int num4 = GameUtils.WorldTimeToDays(this.world.worldTime);
if (GameUtils.WorldTimeToHours(this.world.worldTime) >= num2)
{
num4++;
}
this.timeToDie = GameUtils.DayTimeToWorldTime(num4, num, 0);
}
}
}
public override bool IsSavedToFile()
{
// If they have a cvar persist, keep them around.
if (Buffs.HasCustomVar("Persist")) return true;
// If its dynamic spawn, don't let them stay.
if (GetSpawnerSource() == EnumSpawnerSource.Dynamic) return false;
return true;
}
public override void Init(int _entityClass)
{
base.Init(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void InitFromPrefab(int _entityClass)
{
base.InitFromPrefab(_entityClass);
this.emodel.SetVisible(false, false);
}
public override void VisiblityCheck(float _distanceSqr, bool _masterIsZooming)
{
bool bVisible = this.ticksUntilVisible <= 0 && _distanceSqr < (float)(_masterIsZooming ? 14400 : 8100);
this.emodel.SetVisible(bVisible, false);
}
public override void PostInit()
{
base.PostInit();
if (!this.isEntityRemote)
{
this.IsBloodMoon = this.world.aiDirector.BloodMoonComponent.BloodMoonActive;
}
}
public override bool IsDrawMapIcon()
{
return true;
}
public override bool isRadiationSensitive()
{
return false;
}
public override bool isDetailedHeadBodyColliders()
{
return true;
}
public override void OnEntityTargeted(EntityAlive target)
{
base.OnEntityTargeted(target);
if (!this.isEntityRemote && base.GetSpawnerSource() != EnumSpawnerSource.Dynamic && target is EntityPlayer)
{
this.world.aiDirector.NotifyIntentToAttack(this, target as EntityPlayer);
}
}
public override bool isGameMessageOnDeath()
{
return false;
}
public override void Awake()
{
base.Awake();
//this.MaxLedgeHeight = 20;
}
public override Ray GetLookRay()
{
Ray result;
if (base.IsBreakingBlocks)
{
result = new Ray(this.position + new Vector3(0f, this.GetEyeHeight(), 0f), this.GetLookVector());
}
else if (base.GetWalkType() == 8)
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
else
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
return result;
}
public override Vector3 GetLookVector()
{
if (this.lookAtPosition.Equals(Vector3.zero))
{
return base.GetLookVector();
}
return this.lookAtPosition - this.getHeadPosition();
}
public override bool IsRunning
{
get
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
return GamePrefs.GetInt(eProperty) >= 2;
}
}
public override float GetMoveSpeedAggro()
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
int @int = GamePrefs.GetInt(eProperty);
float num = moveSpeeds[@int];
if (this.moveSpeedRagePer > 1f)
{
num = moveSuperRageSpeeds[@int];
}
else if (this.moveSpeedRagePer > 0f)
{
float num2 = moveRageSpeeds[@int];
num = num * (1f - this.moveSpeedRagePer) + num2 * this.moveSpeedRagePer;
}
if (num < 1f)
{
num = this.moveSpeedAggro * (1f - num) + this.moveSpeedAggroMax * num;
}
else
{
num = this.moveSpeedAggroMax * num;
}
return EffectManager.GetValue(PassiveEffects.RunSpeed, null, num, this, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
}
public override float getNextStepSoundDistance()
{
if (!this.IsRunning)
{
return 0.5f;
}
return 1.5f;
}
public override void MoveEntityHeaded(Vector3 _direction, bool _isDirAbsolute)
{
if (this.walkType == 4 && this.Jumping)
{
this.motion = this.accumulatedRootMotion;
this.accumulatedRootMotion = Vector3.zero;
this.IsRotateToGroundFlat = true;
if (this.moveHelper != null)
{
Vector3 vector = this.moveHelper.JumpToPos - this.position;
if (Utils.FastAbs(vector.y) < 0.2f)
{
this.motion.y = vector.y * 0.2f;
}
if (Utils.FastAbs(vector.x) < 0.3f)
{
this.motion.x = vector.x * 0.2f;
}
if (Utils.FastAbs(vector.z) < 0.3f)
{
this.motion.z = vector.z * 0.2f;
}
if (vector.sqrMagnitude < 0.010000001f)
{
if (this.emodel && this.emodel.avatarController)
{
this.emodel.avatarController.StartAnimationJump(AnimJumpMode.Land);
}
this.Jumping = false;
}
}
this.entityCollision(this.motion);
return;
}
base.MoveEntityHeaded(_direction, _isDirAbsolute);
}
public override void UpdateJump()
{
if (this.walkType == 4 && !this.isSwimming)
{
base.FaceJumpTo();
this.jumpState = EntityAlive.JumpState.Climb;
if (!this.emodel.avatarController || !this.emodel.avatarController.IsAnimationJumpRunning())
{
this.Jumping = false;
}
if (this.jumpTicks == 0 && this.accumulatedRootMotion.y > 0.005f)
{
this.jumpTicks = 30;
}
return;
}
base.UpdateJump();
if (this.isSwimming)
{
return;
}
this.accumulatedRootMotion.y = 0f;
}
public override void EndJump()
{
base.EndJump();
this.IsRotateToGroundFlat = false;
}
public override bool ExecuteFallBehavior(EntityAlive.FallBehavior behavior, float _distance, Vector3 _fallMotion)
{
if (behavior == null || !this.emodel)
{
return false;
}
AvatarController avatarController = this.emodel.avatarController;
if (!avatarController)
{
return false;
}
avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.FallBehavior.Op.None:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, -1);
break;
case EntityAlive.FallBehavior.Op.Land:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 0);
break;
case EntityAlive.FallBehavior.Op.LandLow:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 1);
break;
case EntityAlive.FallBehavior.Op.LandHard:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 2);
break;
case EntityAlive.FallBehavior.Op.Stumble:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 3);
break;
case EntityAlive.FallBehavior.Op.Ragdoll:
this.emodel.DoRagdoll(this.rand.RandomFloat * 2f, EnumBodyPartHit.None, _fallMotion * 20f, Vector3.zero, false);
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet() && this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand)))
{
avatarController.StartAnimationRaging();
}
return true;
}
public override bool ExecuteDestroyBlockBehavior(EntityAlive.DestroyBlockBehavior behavior, ItemActionAttack.AttackHitInfo attackHitInfo)
{
if (behavior == null || attackHitInfo == null || this.moveHelper == null || this.emodel == null || this.emodel.avatarController == null)
{
return false;
}
if (this.walkType == 4)
{
return false;
}
this.moveHelper.ClearBlocked();
this.moveHelper.ClearTempMove();
this.emodel.avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.DestroyBlockBehavior.Op.Ragdoll:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThroughRagdoll, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThroughRagdoll);
break;
case EntityAlive.DestroyBlockBehavior.Op.Stumble:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThrough, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThrough);
this.bodyDamage.StunDuration = 1f;
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet())
{
this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand));
}
return true;
}
public override void ProcessDamageResponseLocal(DamageResponse _dmResponse)
{
base.ProcessDamageResponseLocal(_dmResponse);
if (!this.isEntityRemote)
{
int @int = GameStats.GetInt(EnumGameStats.GameDifficulty);
float num = (float)_dmResponse.Strength / 40f;
if (num > 1f)
{
num = Mathf.Pow(num, 0.29f);
}
float num2 = rageChances[@int] * num;
if (this.rand.RandomFloat < num2)
{
if (this.rand.RandomFloat < superRageChances[@int])
{
this.StartRage(2f, 30f);
this.PlayOneShot(this.GetSoundAlert(), false);
return;
}
this.StartRage(0.5f + this.rand.RandomFloat * 0.5f, 4f + this.rand.RandomFloat * 6f);
}
}
}
public override Vector3i dropCorpseBlock()
{
if (this.lootContainer != null && this.lootContainer.IsUserAccessing())
{
return Vector3i.zero;
}
Vector3i vector3i = base.dropCorpseBlock();
if (vector3i == Vector3i.zero)
{
return Vector3i.zero;
}
TileEntityLootContainer tileEntityLootContainer = this.world.GetTileEntity(0, vector3i) as TileEntityLootContainer;
if (tileEntityLootContainer == null)
{
return Vector3i.zero;
}
if (this.lootContainer != null)
{
tileEntityLootContainer.CopyLootContainerDataFromOther(this.lootContainer);
}
else
{
tileEntityLootContainer.lootListName = this.lootListOnDeath;
tileEntityLootContainer.SetContainerSize(LootContainer.GetLootContainer(this.lootListOnDeath, true).size, true);
}
tileEntityLootContainer.SetModified();
return vector3i;
}
public override void AnalyticsSendDeath(DamageResponse _dmResponse)
{
DamageSource source = _dmResponse.Source;
if (source == null)
{
return;
}
string name;
if (source.BuffClass != null)
{
name = source.BuffClass.Name;
}
else
{
if (source.ItemClass == null)
{
return;
}
name = source.ItemClass.Name;
}
GameSparksCollector.IncrementCounter(GameSparksCollector.GSDataKey.ZombiesKilledBy, name, 1, true, GameSparksCollector.GSDataCollection.SessionUpdates);
}
public override void BuffAdded(BuffValue _buff)
{
if (_buff.BuffClass.DamageType == EnumDamageTypes.Electrical)
{
this.Electrocuted = true;
}
}
private int ticksUntilVisible = 2;
private float moveSpeedRagePer;
private float moveSpeedScaleTime;
private float fallTime;
private float fallThresholdTime;
private static float[] moveSpeeds = new float[]
{
0f,
0.35f,
0.7f,
1f,
1.35f
};
private static float[] moveRageSpeeds = new float[]
{
0.75f,
0.8f,
0.9f,
1.15f,
1.7f
};
private static float[] moveSuperRageSpeeds = new float[]
{
0.88f,
0.92f,
1f,
1.2f,
1.7f
};
private static float[] rageChances = new float[]
{
0f,
0.15f,
0.3f,
0.35f,
0.4f,
0.5f
};
private static float[] superRageChances = new float[]
{
0f,
0.01f,
0.03f,
0.05f,
0.08f,
0.15f
};
}

View File

@@ -0,0 +1,3400 @@

using Audio;
using Rebirth.RemoteCrafting;
using System.Collections.Generic;
using System.Linq;
using static RebirthManager;
public class EntityNPCRebirth : EntityAliveV2
{
public string otherTags = "";
public string lootDropEntityClass = "";
public bool setSize = false;
public bool setNavIcon = false;
public EntityPlayer Owner = null;
private float ownerCheck = 0f;
private float ownerTick = 10f;
public bool canShotgunTrigger = true;
public bool hasSetOwner = false;
public bool hasNotified = false;
public bool bSoundCheck = false;
public bool bSoundRandomCheck = false;
public bool hasAttackTarget = false;
public bool isOnFire = false;
public int killingSpree = 0;
public ulong tempSpawn = 60UL;
public ulong tempSpawnTime = 0UL;
public bool despawning = false;
public float delta = 0f;
public float updateCheck = 0f;
public float positionCheck = 0f;
public float bedrollCheck = 0f;
public float positionTick = 5f;
public float spawnCheck = 0f;
public float ownerFastCheck = 0f;
public float ownerMidCheck = 0f;
public float ownerSlowCheck = 0f;
public float spawnTick = 30f;
public float hiredCheck = 0f;
public float hiredTick = 60f;
public float bedrollTick = 3f;
public float ownerFastTick = 0.5f;
public float ownerMidTick = 2f;
public float ownerSlowTick = 10f;
public string[,] strCouldNotRepair = new string[99999, 2];
public int numCouldNotRepair = 0;
public string strSerialize = "";
public bool bRepair = false;
public bool bRepairing = false;
public int numRepairedBlocks = 0;
public bool bMine = false;
public float HideDuration = 0;
public float followDuration = 0;
public float followDurationTick = 1;
public float roundsPerMinute = 0;
public int numMagazineSize = 0;
public List<string> uniqueKeysUsed = new List<string>();
public string rightHandTransformName;
public ItemValue handItem;
public int numReposition = 0;
public Vector3i spawnBlockPosition = new Vector3i();
public Vector3 previousPosition = new Vector3();
public bool bSpwanBlockSet = false;
public int previousOrder = 0;
public string _currentWeapon = "";
private int _defaultTraderID;
private string _strTitle;
private List<string> _startedThisFrame;
private TileEntityTrader _tileEntityTrader;
private float fallTime;
private float fallThresholdTime;
public string strWeaponType = "none";
private string strAmmoType = "none";
public ulong GameTimerTicks = 0UL;
public ulong AccumulatedTicks = 0UL;
public ulong AccumulatedTicksUpdate = 0UL;
public ulong AccumulatedTicksSurvivor = 0UL;
public ulong AccumulatedTicksZombieCompanion = 0UL;
public ulong AccumulatedTicksDespawn = 0UL;
public ulong AccumulatedTicksSound = 0UL;
public ulong AccumulatedTicksSoundRandom = 0UL;
public ulong AccumulatedTicksSoundKillingSpree = 0UL;
public ulong AccumulatedTicksSoundTarget = 0UL;
public ulong AccumulatedTicksFoundAttackTarget = 0UL;
public ulong TickRate = 100UL;
public System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
public override void Collect(int _playerId)
{
//Log.Out("EntityNPCRebirth-Collect START");
var entityPlayerLocal = world.GetEntity(_playerId) as EntityPlayerLocal;
if (entityPlayerLocal == null) return;
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(entityPlayerLocal);
var itemStack = new ItemStack(GetItemValue(), 1);
if (!uiforPlayer.xui.PlayerInventory.AddItem(itemStack))
{
GameManager.Instance.ItemDropServer(itemStack, entityPlayerLocal.GetPosition(), Vector3.zero, _playerId,
60f, false);
}
}
public override void SetItemValue(ItemValue itemValue)
{
//Log.Out("EntityNPCRebirth-SetItemValue START");
if (itemValue.HasMetadata("NPCName"))
{
string newName = (string)itemValue.GetMetadata("NPCName");
SetEntityName(newName);
//Log.Out("EntityNPCRebirth-SetItemValue EntityName: " + (string)itemValue.GetMetadata("NPCName"));
SetEntityName((string)itemValue.GetMetadata("NPCName"));
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageChangeNPCName>().Setup(this.entityId, newName), false, this.belongsPlayerId, -1, -1, null, 192);
}
}
if (itemValue.HasMetadata("health"))
{
//Log.Out("EntityNPCRebirth-SetItemValue $tempHealth: " + (int)itemValue.GetMetadata("health"));
this.Buffs.SetCustomVar("$tempHealth", (int)itemValue.GetMetadata("health"));
}
if (itemValue.HasMetadata("numKills"))
{
//Log.Out("EntityNPCRebirth-SetItemValue $varNumKills: " + (int)itemValue.GetMetadata("numKills"));
this.Buffs.SetCustomVar("$varNumKills", (int)itemValue.GetMetadata("numKills"));
}
if (itemValue.HasMetadata("NPCLevel"))
{
//Log.Out("EntityNPCRebirth-SetItemValue $FR_NPC_Level: " + (int)itemValue.GetMetadata("NPCLevel"));
this.Buffs.SetCustomVar("$FR_NPC_Level", (int)itemValue.GetMetadata("NPCLevel"));
}
if (itemValue.HasMetadata("NPCMiningLevel"))
{
//Log.Out("EntityNPCRebirth-SetItemValue $FR_NPC_MiningLevel: " + (int)itemValue.GetMetadata("NPCMiningLevel"));
this.Buffs.SetCustomVar("$FR_NPC_MiningLevel", (int)itemValue.GetMetadata("NPCMiningLevel"));
}
//this.Buffs.AddBuff("AdjustNPCStats");
GameManager.Instance.StartCoroutine(RebirthUtilities.adjustNPCStats(this));
}
public ItemValue GetItemValue(ItemValue itemValue)
{
//Log.Out("EntityNPCRebirth-GetItemValue START");
itemValue.SetMetadata("NPCName", EntityName, TypedMetadataValue.TypeTag.String);
itemValue.SetMetadata("health", (int)Stats.Health.Value, TypedMetadataValue.TypeTag.Integer);
itemValue.SetMetadata("numKills", (int)this.Buffs.GetCustomVar("$varNumKills"), TypedMetadataValue.TypeTag.Integer);
itemValue.SetMetadata("NPCLevel", (int)this.Buffs.GetCustomVar("$FR_NPC_Level"), TypedMetadataValue.TypeTag.Integer);
itemValue.SetMetadata("NPCMiningLevel", (int)this.Buffs.GetCustomVar("$FR_NPC_MiningLevel"), TypedMetadataValue.TypeTag.Integer);
return itemValue;
}
public override EntityActivationCommand[] GetActivationCommands(Vector3i _tePos, EntityAlive _entityFocusing)
{
//Log.Out("EntityNPCRebirth-GetActivationCommands-START");
// Don't allow you to interact with it when its dead.
float flEntityRespawnCommandActivation = this.Buffs.GetCustomVar("$FR_NPC_RespawnCommandActivation");
float flEntityNoHire = this.Buffs.GetCustomVar("$FR_NPC_NoHire");
if (this.Buffs.HasBuff("FuriousRamsayRespawned"))
{
this.Buffs.SetCustomVar("$FR_NPC_RespawnCommandActivation", 0);
flEntityRespawnCommandActivation = 0;
}
//Log.Out("EntityNPCRebirth-GetActivationCommands - flEntityNoHire: " + flEntityNoHire);
if (IsDead() || NPCInfo == null || flEntityRespawnCommandActivation == 1 || flEntityNoHire == 1)
{
//Log.Out("EntityNPCRebirth-GetActivationCommands - NO COMMANDS");
return new EntityActivationCommand[0];
}
else
{
////Log.Out("EntityNPCRebirth-GetActivationCommands-IS ALIVE");
}
if (this.IsDead() || NPCInfo == null)
{
//Debug.Log("NPC info == null.");
return new EntityActivationCommand[0];
}
return new EntityActivationCommand[] {
new EntityActivationCommand("talk", "talk", true)
};
/*return new EntityActivationCommand[] {
new EntityActivationCommand("talk", "talk", true),
new EntityActivationCommand("talk", "talk", true),
new EntityActivationCommand("talk", "talk", true)
};*/
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale)
{
//Log.Out("EntityNPCRebirth-DamageEntity START, _damageSource.GetDamageType(): " + _damageSource.GetDamageType());
if (_damageSource.damageType == EnumDamageTypes.Falling || IsOnMission())
{
return 0;
}
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
if (flag && _damageSource.AttackingItem != null && _damageSource.AttackingItem.ItemClass.GetItemName() == "otherExplosion")
{
if (this.Buffs.GetCustomVar("$Leader") > 0)
{
if (HasAnyTags(FastTags<TagGroup.Global>.Parse("melee")))
{
_strength = 20;
}
else
{
_strength = 50;
}
//Log.Out("EntityNPCRebirth-DamageEntity _strength: " + _strength);
}
}
global::EntityAlive entityAlive = this.world.GetEntity(_damageSource.getEntityId()) as global::EntityAlive;
if (this.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("nanospawner")))
{
float perc = this.Health / this.Stats.Health.ModifiedMax;
float stage = this.Buffs.GetCustomVar("$NanoStage");
//Log.Out("EntityNPCRebirth-DamageEntity this.Health: " + this.Health);
//Log.Out("EntityNPCRebirth-DamageEntity this.Stats.Health.ModifiedMax: " + this.Stats.Health.ModifiedMax);
//Log.Out("EntityNPCRebirth-DamageEntity perc: " + perc);
//Log.Out("EntityNPCRebirth-DamageEntity stage: " + stage);
bool NanoCyborgFuriousRamsayStage1Spawns = stage == 0f && perc < .85f;
bool NanoCyborgFuriousRamsayStage2Spawns = stage == 1f && perc < .65f;
bool NanoCyborgFuriousRamsayStage3Spawns = stage == 2f && perc < .45f;
int playerID = -1;
if (entityAlive is EntityPlayer)
{
playerID = entityAlive.entityId;
}
if (NanoCyborgFuriousRamsayStage1Spawns)
{
this.Buffs.SetCustomVar("$NanoStage", 1f);
Manager.BroadcastPlay(this.position, "FuriousRamsayNanoSpawn");
RebirthUtilities.SpawnEntity(this.entityId, "NanoCyborg002_FR", 2, "", "", "0", "static", "", "", 1, -1, true, false, true, playerID);
}
else if (NanoCyborgFuriousRamsayStage2Spawns)
{
this.Buffs.SetCustomVar("$NanoStage", 2f);
Manager.BroadcastPlay(this.position, "FuriousRamsayNanoSpawn");
RebirthUtilities.SpawnEntity(this.entityId, "NanoCyborg003_FR", 2, "", "", "0", "static", "", "", 1, -1, true, false, true, playerID);
}
else if (NanoCyborgFuriousRamsayStage3Spawns)
{
this.Buffs.SetCustomVar("$NanoStage", 3f);
Manager.BroadcastPlay(this.position, "FuriousRamsayNanoSpawn");
RebirthUtilities.SpawnEntity(this.entityId, "NanoCyborg004_FR", 2, "", "", "0", "static", "", "", 1, -1, true, false, true, playerID);
}
}
return base.DamageEntity(_damageSource, _strength, _criticalHit, _impulseScale);
}
public override void OnAddedToWorld()
{
base.OnAddedToWorld();
if (this.Buffs.GetCustomVar("$FR_NPC_ContainerY") == 0)
{
////Log.Out("EntityNPCRebirth-PostInit Container NOT Sized");
bool blIsEmpty = this.lootContainer.IsEmpty();
if (blIsEmpty)
{
////Log.Out("EntityNPCRebirth-PostInit Container NOT Empty");
if (this.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("allyanimal")))
{
lootContainer.SetContainerSize(new Vector2i(10, 1));
}
else
{
int numRandom = this.rand.RandomRange(3, 5);
lootContainer.SetContainerSize(new Vector2i(8, numRandom));
}
}
this.Buffs.SetCustomVar("$FR_NPC_ContainerY", this.lootContainer.GetContainerSize().y);
}
}
public override void CopyPropertiesFromEntityClass()
{
base.CopyPropertiesFromEntityClass();
var _entityClass = EntityClass.list[entityClass];
if (_entityClass.Properties.Values.ContainsKey("DespawnAfter"))
{
this.tempSpawn = Convert.ToUInt64(_entityClass.Properties.Values["DespawnAfter"]);
}
if (_entityClass.Properties.Values.ContainsKey("WeaponType"))
strWeaponType = _entityClass.Properties.Values["WeaponType"];
if (_entityClass.Properties.Values.ContainsKey("Hirable"))
isHirable = StringParsers.ParseBool(_entityClass.Properties.Values["Hirable"], 0, -1, true);
flEyeHeight = EntityUtilities.GetFloatValue(entityId, "EyeHeight");
// Read in a list of names then pick one at random.
if (_entityClass.Properties.Values.ContainsKey("Names"))
{
var text = _entityClass.Properties.Values["Names"];
var names = text.Split(',');
string randomName = RebirthUtilities.GetRandomName(this);
if (randomName != "")
{
_strMyName = randomName;
}
else
{
var index = UnityEngine.Random.Range(0, names.Length);
_strMyName = names[index];
}
}
// By default, make the sleepers to always be awake, this solves the issue where entities in a Passive volume does not wake up fully
// ie, buffs are not firing, but the uai is.
isAlwaysAwake = false;
if (_entityClass.Properties.Values.ContainsKey("SleeperInstantAwake"))
isAlwaysAwake = StringParsers.ParseBool(_entityClass.Properties.Values["SleeperInstantAwake"], 0, -1, true);
if (_entityClass.Properties.Values.ContainsKey("IsAlwaysAwake"))
isAlwaysAwake = StringParsers.ParseBool(_entityClass.Properties.Values["IsAlwaysAwake"], 0, -1, true);
if (_entityClass.Properties.Values.ContainsKey("Titles"))
{
var text = _entityClass.Properties.Values["Titles"];
var names = text.Split(',');
var index = UnityEngine.Random.Range(0, names.Length);
_strTitle = names[index];
}
var component = gameObject.GetComponent<BoxCollider>();
if (component)
{
////Log.Out(" Box Collider: " + component.size.ToCultureInvariantString());
////Log.Out(" Current Boundary Box: " + boundingBox.ToCultureInvariantString());
}
if (_entityClass.Properties.Classes.ContainsKey("Boundary"))
{
////Log.Out(" Found Boundary Settings");
var strBoundaryBox = "0,0,0";
var strCenter = "0,0,0";
var dynamicProperties3 = _entityClass.Properties.Classes["Boundary"];
foreach (var keyValuePair in dynamicProperties3.Values.Dict)
{
////Log.Out("Key: " + keyValuePair.Key);
switch (keyValuePair.Key)
{
case "BoundaryBox":
////Log.Out(" Found a Boundary Box");
strBoundaryBox = dynamicProperties3.Values[keyValuePair.Key];
continue;
case "Center":
////Log.Out(" Found a Center");
strCenter = dynamicProperties3.Values[keyValuePair.Key];
break;
}
}
var box = StringParsers.ParseVector3(strBoundaryBox);
var center = StringParsers.ParseVector3(strCenter);
ConfigureBoundaryBox(box, center);
}
}
public override bool IsDeadIfOutOfWorld()
{
if (this.LeaderUtils.Owner != null)
{
return false;
}
else
{
float flLeader = RebirthUtilities.GetLeader(this);
if (flLeader > 0)
{
return false;
}
else
{
return true;
}
}
}
public override bool CanDamageEntity(int _sourceEntityId)
{
var canDamage = EntityTargetingUtilities.CanTakeDamage(this, (EntityAlive)world.GetEntity(_sourceEntityId));
////Log.Out("EntityNPCRebirth-CanDamageEntity entity: " + this.EntityClass.entityClassName + " / canDamage: " + canDamage);
return canDamage;
}
public override void MarkToUnload()
{
if (!bWillRespawn)
{
base.MarkToUnload();
}
}
public void HideNPC(bool send)
{
//Log.Out("EntityNPCRebirth-HideNPC send: " + send);
if (send)
{
if (Buffs.GetCustomVar("$FR_NPC_Hidden") == 1f)
{
return;
}
//Log.Out("EntityNPCRebirth-HideNPC HIDE");
//Log.Out("EntityNPCRebirth-HideNPC 1");
var enemy = GetRevengeTarget();
if (enemy != null)
{
//Log.Out("EntityNPCRebirth-HideNPC 2");
enemy.attackTarget = (EntityAlive) null;
enemy.SetRevengeTarget((EntityAlive) null);
enemy.DoRagdoll(new DamageResponse());
}
// Don't let anything target you
//isIgnoredByAI = true;
/*var newFaction = FactionManager.Instance.GetFactionByName("none");
if (newFaction != null)
{
this.factionId = newFaction.ID;
}*/
this.attackTarget = (EntityAlive) null;
this.SetRevengeTarget((EntityAlive) null);
// rescale to make it invisible.
Buffs.SetCustomVar("$Scale", transform.localScale.y);
//transform.localScale = new Vector3(0, 0, 0);
//emodel.SetVisible(false, false);
RebirthUtilities.toggleCollisions(false, this);
//if (this.currentOrder == 1)
{
//enabled = false;
}
Buffs.SetCustomVar("onMission", 1f);
Buffs.AddBuff("FuriousRamsayRespawned");
Buffs.AddBuff("FuriousRamsayResistFireShockSmoke");
// Turn off the compass
if (this.NavObject != null)
{
//Log.Out("EntityNPCRebirth-HideNPC 3");
if (this.Buffs.GetCustomVar("$FR_NPC_Respawn") == 0)
{
this.NavObject.IsActive = false;
}
}
// Clear the debug information, usually set from UAI
this.DebugNameInfo = "";
// Turn off the display component
SetupDebugNameHUD(false);
Buffs.SetCustomVar("$FR_NPC_Hidden", 1f);
}
else
{
Buffs.SetCustomVar("$FR_NPC_Hidden", 0f);
//Log.Out("EntityNPCRebirth-HideNPC SHOW 1");
//Log.Out("EntityNPCRebirth-HideNPC scale: " + scale);
float oldScale = Buffs.GetCustomVar("$Scale");
//Log.Out($"EntityNPCRebirth-HideNPC {this.entityName}/{this.EntityClass.entityClassName} BEFORE oldScale: " + oldScale);
if (oldScale == 0f)
{
oldScale = 1;
}
//Log.Out("EntityNPCRebirth-HideNPC AFTER oldScale: " + oldScale);
//Log.Out("EntityNPCRebirth-HideNPC SHOW 2");
emodel.SetVisible(true, true);
SetScale(oldScale);
//Log.Out("EntityNPCRebirth-HideNPC SHOW 3");
RebirthUtilities.toggleCollisions(true, this);
//enabled = true;
//Log.Out("EntityNPCRebirth-HideNPC SHOW 4");
HideDuration = 0;
//Log.Out("EntityNPCRebirth-HideNPC SHOW 5");
//Log.Out("EntityNPCRebirth-HideNPC SHOW 6");
if (this.LeaderUtils.Owner != null)
{
this.LeaderUtils.Owner.Buffs.RemoveBuff("FuriousRamsayHelpRepairBuff");
}
this.Buffs.RemoveBuff("FuriousRamsayHelpRepair");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningLogs");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningNailandScrews");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningClay");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningScrapIron");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningCoal");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningNitrate");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningLead");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningSand");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningShale");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningSandPremium");
this.Buffs.RemoveBuff("FuriousRamsayGoMiningShalePremium");
bMine = false;
bRepair = false;
Buffs.CVars.Remove("$FR_NPC_Hidden");
//Log.Out("EntityNPCRebirth-HideNPC SHOW 22");
Buffs.SetCustomVar("onMission", 0f);
//Log.Out("EntityNPCRebirth-HideNPC SHOW 23");
if (this.NavObject != null)
{
//Log.Out("EntityNPCRebirth-HideNPC SHOW 24");
//Log.Out("EntityNPCRebirth-HideNPC 5");
this.NavObject.IsActive = true;
}
//Log.Out("EntityNPCRebirth-HideNPC SHOW 25");
//isIgnoredByAI = false;
//Log.Out("EntityNPCRebirth-HideNPC SHOW 26");
/*var newFaction = FactionManager.Instance.GetFactionByName("whiteriver");
Log.Out("EntityNPCRebirth-HideNPC SHOW 27");
if (newFaction != null)
{
//Log.Out("EntityNPCRebirth-HideNPC SHOW 28");
this.factionId = newFaction.ID;
}*/
//Log.Out("EntityNPCRebirth-HideNPC SHOW 29");
this.attackTarget = (EntityAlive) null;
//Log.Out("EntityNPCRebirth-HideNPC SHOW 30");
this.SetRevengeTarget((EntityAlive) null);
//Log.Out("EntityNPCRebirth-HideNPC SHOW 31");
float flRespawn = this.Buffs.GetCustomVar("$FR_NPC_Respawn");
//Log.Out("EntityNPCRebirth-HideNPC SHOW 32");
if (flRespawn == 0)
{
//Log.Out("EntityNPCRebirth-HideNPC SHOW 33");
Buffs.RemoveBuff("FuriousRamsayRespawned");
Buffs.RemoveBuff("FuriousRamsayResistFireShockSmoke");
}
//Log.Out("EntityNPCRebirth-HideNPC SHOW 34");
}
}
public override Vector3 GetLookVector()
{
if (!IsDead() && attackTarget != null && HasAnyTags(FastTags<TagGroup.Global>.Parse("ranged")))
{
int npcLevel = (int)this.Buffs.GetCustomVar("$FR_NPC_Level");
int headshotChance = npcLevel - 1;
int random = GameManager.Instance.World.GetGameRandom().RandomRange(1, 11);
string tagName = "E_BP_Head";
if (headshotChance < random)
{
tagName = RebirthVariables.bodyTags[random];
}
float numAccuracyModifier = float.Parse(RebirthVariables.customRangedNPCAccuracyModifier) / 100;
float baseValue = 70 * numAccuracyModifier;
if (numMagazineSize == 0)
{
ItemActionRanged myAction = null;
myAction = (ItemActionRanged)inventory.holdingItem.Actions[1];
ItemActionData _actionData = inventory.holdingItemData.actionData[1];
ItemActionRanged.ItemActionDataRanged itemActionDataRanged = (ItemActionRanged.ItemActionDataRanged)_actionData;
//float myDelay = 60f / EffectManager.GetValue(PassiveEffects.RoundsPerMinute, ItemClass.GetItem(inventory.holdingItem.GetItemName(), false), 60f / itemActionDataRanged.OriginalDelay, this, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1, false);
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.RoundsPerMinute, itemActionDataRanged.invData.itemValue, 60f / itemActionDataRanged.OriginalDelay, this);
roundsPerMinute = 60 / myDelay;
//numMagazineSize = (int)EffectManager.GetValue(PassiveEffects.MagazineSize, ItemClass.GetItem(inventory.holdingItem.GetItemName(), false), myAction.BulletsPerMagazine, this, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
numMagazineSize = (int)EffectManager.GetValue(PassiveEffects.MagazineSize, itemActionDataRanged.invData.itemValue, myAction.BulletsPerMagazine, this);
}
if (numMagazineSize > 1)
{
baseValue = 60 * numAccuracyModifier;
int baseRoundsPerMinute = 60;
if (roundsPerMinute > baseRoundsPerMinute)
{
float multiplier = 1 - ((roundsPerMinute / baseRoundsPerMinute) / 15);
baseValue *= multiplier;
}
}
float missShotChance = baseValue + (npcLevel * 0.3f * numAccuracyModifier) * 10;
//Log.Out("EntityNPCRebirth-GetLookVector level: " + this.Buffs.GetCustomVar("$FR_NPC_Level"));
//Log.Out("EntityNPCRebirth-GetLookVector A random: " + random);
//Log.Out("EntityNPCRebirth-GetLookVector missShotChance: " + missShotChance);
random = GameManager.Instance.World.GetGameRandom().RandomRange(1, 101);
//Log.Out("EntityNPCRebirth-GetLookVector B random: " + random);
if (missShotChance < random)
{
//Log.Out("EntityNPCRebirth-GetLookVector MISS");
return new Vector3(0, 100, 0);
}
var col = attackTarget.GetComponentsInChildren<Collider>().Where(x => x.CompareTag(tagName)).FirstOrDefault();
if (col != null)
{
return (col.transform.position - (transform.position + new Vector3(0f, GetEyeHeight(), 0f)));
}
}
return base.GetLookVector();
}
public override bool IsFriendlyPlayer(EntityPlayer player)
{
if (!RebirthUtilities.VerifyFactionStanding(this, player)) return true;
return false;
}
public override void OnUpdateLive()
{
//Log.Out("EntityNPCRebirth-OnUpdateLive entityClassName: " + this.EntityClass.entityClassName);
float respawned = this.Buffs.GetCustomVar("$FR_NPC_Respawn");
float flLeader = RebirthUtilities.GetLeader(this);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && (Time.time - ownerFastCheck) > ownerFastTick)
{
ownerFastCheck = Time.time;
if (this.LeaderUtils.Owner != null)
{
if (!this.HasAnyTags(FastTags<TagGroup.Global>.Parse("allyanimal")))
{
this.Crouching = this.LeaderUtils.Owner.Crouching;
}
}
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && (Time.time - ownerMidCheck) > ownerMidTick)
{
ownerMidCheck = Time.time;
if (this.LeaderUtils.Owner != null && RebirthUtilities.IsPrimaryClass(this.LeaderUtils.Owner, 10) && RebirthUtilities.HasBuffLike(this.LeaderUtils.Owner, "FuriousRamsayRage"))
{
if (this.HasAnyTags(FastTags<TagGroup.Global>.Parse("allyanimal,melee")) && !this.Buffs.HasBuff("FuriousRamsayTempRageBuff"))
{
this.Buffs.AddBuff("FuriousRamsayTempRageBuff");
}
}
else if (this.Buffs.HasBuff("FuriousRamsayTempRageBuff"))
{
this.Buffs.RemoveBuff("FuriousRamsayTempRageBuff");
}
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && (Time.time - ownerSlowCheck) > ownerSlowTick)
{
ownerSlowCheck = Time.time;
if (this.LeaderUtils.Owner != null)
{
if (!RebirthManager.hasHire(this.LeaderUtils.Owner.entityId, this.entityId) && !(this.EntityClass.Tags.Test_AnySet(FastTags<TagGroup.Global>.Parse("temp"))))
{
RebirthUtilities.DespawnEntity(this);
}
}
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && (Time.time - bedrollCheck) > bedrollTick)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive bedrollTick, $FR_NPC_Respawn: " + respawned);
bedrollCheck = Time.time;
if (this.LeaderUtils.Owner != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive Owner exists");
SpawnPosition spawnPoint = RebirthUtilities.GetSpawnPoint(this.LeaderUtils.Owner);
if (!spawnPoint.IsUndef())
{
//Log.Out("EntityNPCRebirth-OnUpdateLive spawnPoint: " + spawnPoint.position);
float distance = Vector3.Distance(this.position, spawnPoint.position);
//Log.Out("EntityNPCRebirth-OnUpdateLive distance: " + distance);
if (distance < 3 && respawned == 1f)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive Apply Buff");
this.Buffs.AddBuff("buffBedrollAOEEffect");
}
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive No Owner Spawnpoint");
}
}
}
//Log.Out("EntityNPCRebirth-OnUpdateLive TempPause: " + this.Buffs.GetCustomVar(".TempPause") + $"[{this.EntityClass.entityClassName}]");
if (this.Buffs.GetCustomVar(".TempPause") == 0f)
{
if (this.IsSleeping)
{
if (this.Buffs.GetCustomVar("$FR_NPC_Respawn") == 0f)
{
this.ConditionalTriggerSleeperWakeUp();
}
return;
}
else
{
if (this.Buffs.GetCustomVar("$FR_NPC_Respawn") == 1f && this.Buffs.GetCustomVar("$FR_NPC_RespawnCommandActivation") == 0f)
{
this.TriggerSleeperPose(0);
}
}
}
if (!setSize)
{
float sizeScale = this.Buffs.GetCustomVar("$StartScale");
//Log.Out("EntityNPCRebirth-OnUpdateLive sizeScale: " + sizeScale);
if (sizeScale > 0f)
{
this.scale = new Vector3(sizeScale, sizeScale, sizeScale);
this.SetScale(sizeScale);
this.OverrideSize = sizeScale;
}
setSize = true;
}
if (!setNavIcon)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SET NAV ICON");
string navObjectName = "";
if (NavObject != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive NavObject.name: " + NavObject.name);
NavObjectManager.Instance.UnRegisterNavObject(NavObject);
NavObject = null;
}
if (RebirthVariables.customEventsNotification && this.Buffs.GetCustomVar("$varFuriousRamsaySupportMinion") == 1f)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SET NAV ICON SUPPORT NO HEALTH");
navObjectName = RebirthVariables.navIconSupportEventNoHealth;
if (RebirthVariables.customTargetBarVisibility == "always")
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SET NAV ICON SUPPORT");
navObjectName = RebirthVariables.navIconSupportEvent;
}
this.AddNavObject(navObjectName, "", "");
}
else if (RebirthVariables.customEventsNotification && this.Buffs.GetCustomVar("$varFuriousRamsayBoss") == 1f)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SET NAV ICON BOSS NO HEALTH");
navObjectName = RebirthVariables.navIconBossEventNoHealthNPC;
if (RebirthVariables.customTargetBarVisibility == "always")
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SET NAV ICON BOSS");
navObjectName = RebirthVariables.navIconBossEventNPC;
}
this.AddNavObject(navObjectName, "", "");
}
//Log.Out("EntityNPCRebirth-OnUpdateLive navObjectName: " + navObjectName);
setNavIcon = true;
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && (Time.time - positionCheck) > positionTick)
{
positionCheck = Time.time;
if (flLeader == 0)
{
ulong worldTime = GameManager.Instance.World.worldTime;
ValueTuple<int, int, int> valueTuple = GameUtils.WorldTimeToElements(worldTime);
int day = valueTuple.Item1;
int hour = valueTuple.Item2;
float originalDayAlive = Buffs.GetCustomVar("$OriginalDayAlive");
if (originalDayAlive == 0)
{
Buffs.SetCustomVar("$OriginalDayAlive", day - 1);
}
else
{
if (originalDayAlive < day)
{
float numDaysAlive = day - originalDayAlive;
float maxDaysAlive = Buffs.GetCustomVar("$MaxDaysAlive");
if (maxDaysAlive == 0)
{
maxDaysAlive = 2;
}
if (numDaysAlive >= maxDaysAlive)
{
bWillRespawn = false;
GameManager.Instance.World.RemoveEntity(entityId, EnumRemoveEntityReason.Unloaded);
return;
}
Buffs.SetCustomVar("$CurrentDayAlive", day);
Buffs.SetCustomVar("$NumDaysAlive", numDaysAlive);
}
}
}
if (flLeader > 0)
{
if (respawned == 0)
{
//Log.Out("Entity [" + EntityName + "], POSITION: " + this.position);
//Log.Out("Entity [" + EntityName + "], LOOK POSITION: " + this.position + this.GetLookVector());
//Log.Out("GUARD POSITION: " + this.guardPosition);
//Log.Out("RESPAWN POSITION: " + RebirthUtilities.GetRespawnPosition(this));
if (this.LeaderUtils.Owner != null)
{
if (this.Buffs.GetCustomVar("CurrentOrder") == 10)
{
this.Buffs.SetCustomVar("CurrentOrder", 1f);
HideNPC(false);
}
if (!this.LeaderUtils.Owner.AttachedToEntity)
{
this.Buffs.SetCustomVar("$traveling", 0f);
}
}
if (NavObject == null)
{
NavObject = NavObjectManager.Instance.RegisterNavObject(EntityClass.list[this.entityClass].NavObject, this, "", false);
NavObject.name = EntityName;
}
if (this.Buffs.GetCustomVar("CurrentOrder") == (int)EntityUtilities.Orders.Follow)
{
RebirthManager.UpdateHireInfo(this.entityId, "spawnPosition", "", this.position.ToString(), new Vector3(0, this.rotation.y, 0).ToString());
}
/*Vector3 newPosition = this.position;
if (this.position.y < 0)
{
if (this.LeaderUtils.Owner != null)
{
if (this.Buffs.GetCustomVar("CurrentOrder") == 1)
{
newPosition = this.LeaderUtils.Owner.position;
}
else
{
if (this.guardPosition != Vector3.zero)
{
newPosition = this.guardPosition;
}
else
{
newPosition = RebirthUtilities.GetRespawnPosition(this);
}
}
}
else
{
newPosition = RebirthUtilities.GetRespawnPosition(this);
}
Log.Out("EntityNPCRebirth-OnUpdateLive REPOSITION");
this.SetPosition(newPosition);
bool foundHire = false;
foreach (chunkObservers observer in observers)
{
if (observer.entityID == this.entityId)
{
foundHire = true;
break;
}
}
if (!foundHire)
{
//Log.Out("MinEventActionRespawnEntity-Execute ADDED CHUNK OBSERVER for: " + this.entityId);
ChunkManager.ChunkObserver observerRef = GameManager.Instance.AddChunkObserver(newPosition, false, 3, -1);
observers.Add(new chunkObservers(this.entityId, observerRef));
}
}*/
}
}
}
if (this.HasAllTags(FastTags<TagGroup.Global>.Parse("ignoreFactionChange")) || !this.enabled || respawned == 1)
{
//Log.Out($"EntityNPCRebirth-OnUpdateLive this Entity: {this} respawned: {respawned}");
base.OnUpdateLive();
return;
}
if (this.LeaderUtils.Owner != null && (Time.time - hiredCheck) > hiredTick)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive EntityName: " + this.EntityName);
hiredCheck = Time.time;
bool foundMyself = false;
int order = -1;
if (this.Buffs.GetCustomVar("CurrentOrder") == 1)
{
foreach (hireInfo hire in playerHires)
{
if (hire.playerID == this.LeaderUtils.Owner.entityId && hire.hireID == this.entityId)
{
foundMyself = true;
order = hire.order;
break;
}
}
if (!foundMyself)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive ADDED MISSING HIRE entityName: " + this.entityName);
if (!this.EntityClass.Tags.Test_AnySet(FastTags<TagGroup.Global>.Parse("temp")))
{
RebirthManager.AddHire(this.LeaderUtils.Owner.entityId,
this.entityId,
this.EntityName,
this.EntityClass.entityClassName,
this.position,
this.rotation,
new Vector3(0, 0, 0),
new Vector3(0, 0, 0),
0,
0,
0,
true
);
}
}
else
{
if (order > 0)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive CHANGE ORDER TO FOLLOW");
RebirthManager.UpdateHireInfo(this.entityId, "order", "follow");
}
//Log.Out("EntityNPCRebirth-OnUpdateLive HIRE ALREADY EXISTS entityName: " + this.entityName);
}
}
}
if (this.GetCVar("_stunned") == 1f && !this.emodel.avatarController.IsAnimationStunRunning())
{
this.ClearStun();
}
FastTags<TagGroup.Global> tagsToCompare = FastTags<TagGroup.Global>.Parse("survivor");
bool bHasTags = this.HasAllTags(tagsToCompare);
bool isNPC = this.HasAllTags(FastTags<TagGroup.Global>.Parse("npc"));
bool isAnimal = this.HasAnyTags(FastTags<TagGroup.Global>.Parse("allyanimal"));
bool isPanther = this.HasAnyTags(FastTags<TagGroup.Global>.Parse("panther"));
//Log.Out("EntityNPCRebirth-OnUpdateLive this.tempSpawn: " + this.tempSpawn);
if (isAnimal)
{
ulong elpasedTimeUpdate = GameTimer.Instance.ticks - AccumulatedTicksUpdate;
if (elpasedTimeUpdate >= 1200UL)
{
AccumulatedTicksUpdate = GameTimer.Instance.ticks;
//Log.Out("EntityNPCRebirth-OnUpdateLive entity: " + this.entityId);
if (this.lootContainer != null)
{
bool blIsEmpty = this.lootContainer.IsEmpty();
if (blIsEmpty && this.lootContainer.containerSize != new Vector2i(10, 1))
{
lootContainer.SetContainerSize(new Vector2i(10, 1));
}
if (this.LeaderUtils.Owner)
{
EntityPlayer entityPlayer = this.world.GetEntity(this.LeaderUtils.Owner.entityId) as EntityPlayer;
if (entityPlayer != null)
{
SpawnPosition spawnPoint = RebirthUtilities.GetSpawnPoint(entityPlayer);
this.Buffs.SetCustomVar("$SpawnPoint_X", spawnPoint.position.x);
this.Buffs.SetCustomVar("$SpawnPoint_Y", spawnPoint.position.y);
this.Buffs.SetCustomVar("$SpawnPoint_Z", spawnPoint.position.z);
//Log.Out("EntityNPCRebirth-OnUpdateLive SET SPAWNPOINT");
}
}
}
}
}
if (this.HasAnyTags(FastTags<TagGroup.Global>.Parse("temp")))
{
ulong elpasedTimeDespawn = GameTimer.Instance.ticks - AccumulatedTicksDespawn;
if (elpasedTimeDespawn >= 20UL)
{
AccumulatedTicksDespawn = GameTimer.Instance.ticks;
tempSpawnTime = tempSpawnTime + 1UL;
//Log.Out("EntityNPCRebirth-OnUpdateLive tempSpawnTime: " + tempSpawnTime);
}
if ((this.tempSpawnTime >= this.tempSpawn) && !despawning)
{
despawning = true;
//Log.Out("EntityNPCRebirth-OnUpdateLive UNLOAD TEMP");
this.Buffs.AddBuff("FuriousRamsayDespawnEntity");
}
}
if (this.HasAnyTags(FastTags<TagGroup.Global>.Parse("zombieCompanion")))
{
ulong elpasedTimeZombieCompanion = GameTimer.Instance.ticks - AccumulatedTicksZombieCompanion;
if (elpasedTimeZombieCompanion >= 600UL)
{
AccumulatedTicksZombieCompanion = GameTimer.Instance.ticks;
if (this.LeaderUtils.Owner)
{
ProgressionValue progressionValue = this.LeaderUtils.Owner.Progression.GetProgressionValue("FuriousRamsayPerkBlackMagic");
if (progressionValue != null)
{
float flZombieCompanion = this.Buffs.GetCustomVar("$FR_NPC_ZombieLvl");
this.Buffs.SetCustomVar("$FR_NPC_ZombieLvl", progressionValue.Level);
//Log.Out("EntityAliveSDX-UpdateLive flZombieCompanion: " + flZombieCompanion);
if (flZombieCompanion > 0f)
{
if (flZombieCompanion != progressionValue.Level)
{
this.Buffs.AddBuff("FuriousRamsayWitchDoctorZombies" + progressionValue.Level);
for (int i = 1; i < 11; i++)
{
if (i != progressionValue.Level)
{
//Log.Out("EntityAliveSDX-UpdateLive REMOVE BUFF: " + flZombieCompanion);
this.Buffs.RemoveBuff("FuriousRamsayWitchDoctorZombies" + flZombieCompanion);
}
}
}
}
else
{
//Log.Out("EntityAliveSDX-UpdateLive ADD BUFF: " + progressionValue.Level);
this.Buffs.AddBuff("FuriousRamsayWitchDoctorZombies" + progressionValue.Level);
}
//Log.Out("EntityAliveSDX-UpdateLive ZombieCompanion: " + "FuriousRamsayWitchDoctorZombies" + progressionValue.Level);
}
}
}
}
if (this.bDead)
{
if (this.lootContainer != null)
{
if (this.lootContainer.bTouched && this.lootContainer.IsEmpty())
{
this.MarkToUnload();
this.KillLootContainer();
}
}
}
else
{
ulong elpasedTime = GameTimer.Instance.ticks - AccumulatedTicks;
if (this.LeaderUtils.Owner && this.Buffs.GetCustomVar("CurrentOrder") == 1)
{
if (this.LeaderUtils.Owner.AttachedToEntity)
{
this.position.x = this.LeaderUtils.Owner.position.x;
this.position.z = this.LeaderUtils.Owner.position.z;
this.position.y = this.LeaderUtils.Owner.position.y + 100;
this.IsFlyMode.Value = true;
this.IsNoCollisionMode.Value = true;
}
else
{
this.IsNoCollisionMode.Value = false;
this.IsFlyMode.Value = false;
}
}
float flNotified = this.Buffs.GetCustomVar("$FR_ENTITY_NotifiedEvent");
if (flNotified == 1)
{
hasNotified = true;
}
if (this.attackTarget && !hasNotified && this.HasAllTags(FastTags<TagGroup.Global>.Parse("boss,eventspawn")))
{
hasNotified = true;
this.Buffs.SetCustomVar("$FR_ENTITY_NotifiedEvent", 1);
this.attackTarget.Buffs.AddBuff("FuriousRamsayEventTrigger");
}
if (elpasedTime > 100UL)
{
AccumulatedTicks = GameTimer.Instance.ticks;
if (this.LeaderUtils.Owner != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive this.NavObject == null: " + (this.NavObject == null));
if (this.NavObject != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive this.NavObject.IsActive: " + this.NavObject.IsActive);
}
//Log.Out("EntityNPCRebirth-OnUpdateLive entity: " + this.EntityClass.entityClassName);
//Log.Out("EntityNPCRebirth-OnUpdateLive this.bIsChunkObserver: " + this.bIsChunkObserver);
//Log.Out("EntityNPCRebirth-OnUpdateLive this.bWillRespawn: " + this.bWillRespawn);
//Log.Out("EntityNPCRebirth-OnUpdateLive this.IsEntityUpdatedInUnloadedChunk: " + this.IsEntityUpdatedInUnloadedChunk);
}
}
int randomProbability = 0;
if (elpasedTime > 30UL)
{
bSoundCheck = true;
AccumulatedTicksSound = GameTimer.Instance.ticks;
}
bool attackTargetCheck = false;
ulong elpasedTimeSoundTarget = GameTimer.Instance.ticks - AccumulatedTicksSoundTarget;
if (elpasedTimeSoundTarget > 20UL)
{
attackTargetCheck = true;
AccumulatedTicksSoundTarget = GameTimer.Instance.ticks;
randomProbability = UnityEngine.Random.Range(0, 20);
//Log.Out("EntityNPCRebirth-OnUpdateLive Found Target randomProbability: " + randomProbability);
//Log.Out("EntityNPCRebirth-OnUpdateLive Found Target attackTargetCheck: " + attackTargetCheck);
}
ulong elpasedTimeSoundRandom = GameTimer.Instance.ticks - AccumulatedTicksSoundRandom;
if (elpasedTimeSoundRandom > 5000UL && randomProbability == 5)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive Found Target elpasedTimeSoundRandom: " + elpasedTimeSoundRandom);
bSoundRandomCheck = true;
AccumulatedTicksSoundRandom = GameTimer.Instance.ticks;
}
ulong elpasedTimeSoundKillingSpree = GameTimer.Instance.ticks - AccumulatedTicksSoundKillingSpree;
if (elpasedTimeSoundKillingSpree > 600UL)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive Found Target elpasedTimeSoundRandom: " + elpasedTimeSoundRandom);
killingSpree = 0;
AccumulatedTicksSoundKillingSpree = GameTimer.Instance.ticks;
}
if (AccumulatedTicksFoundAttackTarget == 0UL)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SET AccumulatedTicksFoundAttackTarget");
AccumulatedTicksFoundAttackTarget = GameTimer.Instance.ticks;
}
bool canTalk = true;
if (!this.enabled || this.Buffs.GetCustomVar("$FR_NPC_Respawn") == 1)
{
canTalk = false;
}
bool hasBuffs = this.Buffs.HasBuff("FuriousRamsayNPCOtherAttackedSelf") ||
this.Buffs.HasBuff("FuriousRamsayNPCOtherDamagedSelf") ||
this.Buffs.HasBuff("FuriousRamsayNPCOnFire") ||
this.Buffs.HasBuff("FuriousRamsayNPCRandom");
if (!isAnimal && attackTargetCheck && !hasAttackTarget && canTalk && !hasBuffs)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive Found Target AccumulatedTicksFoundAttackTarget: " + AccumulatedTicksFoundAttackTarget);
//Log.Out("EntityNPCRebirth-OnUpdateLive Found Target AccumulatedTicksFoundAttackTarget + 200UL: " + (AccumulatedTicksFoundAttackTarget + 200UL));
//Log.Out("EntityNPCRebirth-OnUpdateLive Found Target GameTimer.Instance.ticks: " + GameTimer.Instance.ticks);
//Log.Out("EntityNPCRebirth-OnUpdateLive this.attackTarget: " + this.GetAttackTarget());
//Log.Out("EntityNPCRebirth-OnUpdateLive Found Target this.attackTarget != null: " + (this.attackTarget != null));
if (this.GetAttackTarget() != null)
{
if (this.GetAttackTarget() is EntityNPCRebirth)
{
EntityNPCRebirth target = (EntityNPCRebirth)this.GetAttackTarget();
if (target.HasAllTags(FastTags<TagGroup.Global>.Parse("bandit,ranged")))
{
hasAttackTarget = true;
AccumulatedTicksFoundAttackTarget = GameTimer.Instance.ticks;
//Log.Out("EntityNPCRebirth-OnUpdateLive Found Target: " + this.GetAttackTarget().EntityClass.entityClassName);
List<string> myTags = this.EntityTags.GetTagNames();
List<string> myRandomSounds = new List<string>();
if (!RebirthUtilities.IsHordeNight())
{
foreach (string tag in myTags)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK tag: " + tag);
if (tag.Contains("-CST-"))
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 3c");
myRandomSounds.Add(tag);
}
}
if (myRandomSounds.Count > 0)
{
this.Buffs.AddBuff("FuriousRamsayNPCCanSeeTarget");
int index = UnityEngine.Random.Range(0, myRandomSounds.Count - 1);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
if (this.LeaderUtils.Owner != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 3d");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
//Manager.BroadcastPlay(leader.position, myRandomSounds[index], 0f);
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 3e");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
}
else
{
if (this.LeaderUtils.Owner != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 3f");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
//Manager.BroadcastPlay(leader.position, myRandomSounds[index], 0f);
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 3g");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
}
}
}
}
}
}
}
else
{
randomProbability = UnityEngine.Random.Range(0, 10);
//Log.Out("EntityNPCRebirth-OnUpdateLive randomProbability: " + randomProbability);
if (((AccumulatedTicksFoundAttackTarget + 1800UL) < GameTimer.Instance.ticks) && this.GetAttackTarget() == null && randomProbability == 5)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive Cleared Target");
hasAttackTarget = false;
}
}
hasBuffs = this.Buffs.HasBuff("FuriousRamsayNPCOtherAttackedSelf") ||
this.Buffs.HasBuff("FuriousRamsayNPCOtherDamagedSelf") ||
this.Buffs.HasBuff("FuriousRamsayNPCOnFire") ||
this.Buffs.HasBuff("FuriousRamsayNPCRandom");
if (!isAnimal && !isOnFire && !hasAttackTarget && bSoundRandomCheck && this.LeaderUtils.Owner && !RebirthUtilities.IsHordeNight() && canTalk && !hasBuffs)
{
List<string> myTags = this.EntityTags.GetTagNames();
List<string> myRandomSounds = new List<string>();
foreach (string tag in myTags)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK tag: " + tag);
if (tag.Contains("-R-"))
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 3c");
myRandomSounds.Add(tag);
}
}
if (myRandomSounds.Count > 0)
{
this.Buffs.AddBuff("FuriousRamsayNPCRandom");
int index = UnityEngine.Random.Range(0, myRandomSounds.Count - 1);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
if (this.LeaderUtils.Owner != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 4d");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 4e");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
}
else
{
//var leader = EntityUtilities.GetLeaderOrOwner(entityId) as EntityAlive;
if (this.LeaderUtils.Owner != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 4f");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 4g");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
}
}
bSoundRandomCheck = false;
}
if (!isAnimal && bSoundCheck && this.LeaderUtils.Owner && canTalk)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 1");
bSoundCheck = false;
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 2");
bool hasFireBuff = this.Buffs.HasBuff("buffBurningFlamingArrow") ||
this.Buffs.HasBuff("buffBurningMolotov") ||
this.Buffs.HasBuff("buffBurningEnvironmentHack") ||
this.Buffs.HasBuff("buffBurningEnvironment") ||
this.Buffs.HasBuff("buffBurningElement") ||
this.Buffs.HasBuff("buffIsOnFire") ||
this.Buffs.HasBuff("FuriousRamsayFireZombieAoEDamage") ||
this.Buffs.HasBuff("FuriousRamsayFireZombieAoEDamageDisplay") ||
this.Buffs.HasBuff("FuriousRamsayAddBurningEnemyBoss") ||
this.Buffs.HasBuff("FuriousRamsayBurningTrapDamage");
// On Fire
if (hasFireBuff)
{
List<string> myTags = this.EntityTags.GetTagNames();
List<string> myRandomSounds = new List<string>();
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 3a");
hasBuffs = this.Buffs.HasBuff("FuriousRamsayNPCOtherAttackedSelf") ||
this.Buffs.HasBuff("FuriousRamsayNPCOtherDamagedSelf") ||
this.Buffs.HasBuff("FuriousRamsayNPCOnFire") ||
this.Buffs.HasBuff("FuriousRamsayNPCRandom");
if (!isOnFire && myTags.Count > 0 && !hasBuffs)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 3b");
foreach (string tag in myTags)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK tag: " + tag);
if (tag.Contains("-OF-"))
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 3c");
myRandomSounds.Add(tag);
//Manager.BroadcastPlay(this.position, tag, 0f);
break;
}
}
if (myRandomSounds.Count > 0)
{
this.Buffs.AddBuff("FuriousRamsayNPCOnFire");
int index = UnityEngine.Random.Range(0, myRandomSounds.Count - 1);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
if (this.LeaderUtils.Owner != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 5d");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 5e");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
}
else
{
if (this.LeaderUtils.Owner != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 5f");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 5g");
Manager.BroadcastPlay(this.position, myRandomSounds[index], 0f);
}
}
}
}
isOnFire = true;
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SOUND CHECK 4");
isOnFire = false;
}
}
float updateTick = 5f;
delta = 0;
//Log.Out("EntityNPCRebirth-OnUpdateLive flHidden: " + Buffs.GetCustomVar("$FR_NPC_Hidden"));
if (Buffs.GetCustomVar("$FR_NPC_Hidden") == 1)
{
int dayLength = GameStats.GetInt(EnumGameStats.DayLightLength);
delta = HideDuration - ((int)GameManager.Instance.World.worldTime / GameStats.GetInt(EnumGameStats.TimeOfDayIncPerSec));
if (delta < 0)
{
delta = 0;
}
}
/*if (delta > 0)
{
Log.Out("EntityNPCRebirth-OnUpdateLive delta: " + delta);
Log.Out("EntityNPCRebirth-OnUpdateLive bRepair: " + bRepair);
Log.Out("EntityNPCRebirth-OnUpdateLive bMine: " + bMine);
}*/
if ((Time.time - updateCheck) > updateTick)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive delta: " + delta);
updateCheck = Time.time;
float flMagazineSize = this.Buffs.GetCustomVar("$Magsize");
float flEntityLevel = this.Buffs.GetCustomVar("$FR_NPC_Level");
if (!isAnimal && flMagazineSize == 0)
{
int magazineSize = RebirthUtilities.GetNPCMagazineSize(this);
//Log.Out("EntityNPCRebirth-OnUpdateLive INITIAL magazineSize: " + magazineSize);
this.Buffs.SetCustomVar("$Magsize", magazineSize);
this.Buffs.SetCustomVar("$roundsinmag", magazineSize);
this.Buffs.SetCustomVar("$Burstsize", magazineSize);
this.Buffs.SetCustomVar("$burstrate", magazineSize);
}
//if (flEntityLevel > 0)
{
float flNumKills = this.Buffs.GetCustomVar("$varNumKills");
//Log.Out("EntityNPCRebirth-OnUpdateLive flEntityLevel: " + flEntityLevel);
//Log.Out("EntityNPCRebirth-OnUpdateLive flNumKills: " + flNumKills);
//Log.Out("EntityNPCRebirth-OnUpdateLive BEFORE $Magsize: " + this.Buffs.GetCustomVar("$Magsize"));
//Log.Out("EntityNPCRebirth-OnUpdateLive BEFORE $roundsinmag: " + this.Buffs.GetCustomVar("$roundsinmag"));
//Log.Out("EntityNPCRebirth-OnUpdateLive BEFORE $Burstsize: " + this.Buffs.GetCustomVar("$Burstsize"));
//Log.Out("EntityNPCRebirth-OnUpdateLive BEFORE $burstrate: " + this.Buffs.GetCustomVar("$burstrate"));
bool levelHasChanged = false;
int NPCLevel = 0;
float multiplier = 1.5f;
if (isAnimal && !isPanther)
{
multiplier = 1f;
}
if (flNumKills >= 0 && flNumKills <= 50 * multiplier)
{
NPCLevel = 1;
}
else if (flNumKills > 50 * multiplier && flNumKills <= 150 * multiplier)
{
NPCLevel = 2;
}
else if (flNumKills > 150 * multiplier && flNumKills <= 300 * multiplier)
{
NPCLevel = 3;
}
else if (flNumKills > 300 * multiplier && flNumKills <= 500 * multiplier)
{
NPCLevel = 4;
}
else if (flNumKills > 500 * multiplier && flNumKills <= 750 * multiplier)
{
NPCLevel = 5;
}
else if (flNumKills > 750 * multiplier && flNumKills <= 1050 * multiplier)
{
NPCLevel = 6;
}
else if (flNumKills > 1050 * multiplier && flNumKills <= 1400 * multiplier)
{
NPCLevel = 7;
}
else if (flNumKills > 1400 * multiplier && flNumKills <= 1800 * multiplier)
{
NPCLevel = 8;
}
else if (flNumKills > 1800 * multiplier && flNumKills <= 2250 * multiplier)
{
NPCLevel = 9;
}
else if (flNumKills > 2250 * multiplier)
{
NPCLevel = 10;
}
if (NPCLevel > flEntityLevel)
{
this.Buffs.SetCustomVar("$FR_NPC_Level", NPCLevel);
levelHasChanged = true;
}
//Log.Out("EntityNPCRebirth-OnUpdateLive levelHasChanged: " + levelHasChanged);
if (levelHasChanged)
{
int magazineSize = RebirthUtilities.GetNPCMagazineSize(this);
//Log.Out("EntityNPCRebirth-OnUpdateLive magazineSize: " + magazineSize);
this.Buffs.SetCustomVar("$Magsize", magazineSize);
this.Buffs.SetCustomVar("$Burstsize", magazineSize);
this.Buffs.SetCustomVar("$burstrate", magazineSize);
//Log.Out("EntityNPCRebirth-OnUpdateLive AFTER $Magsize: " + this.Buffs.GetCustomVar("$Magsize"));
//Log.Out("EntityNPCRebirth-OnUpdateLive AFTER $roundsinmag: " + this.Buffs.GetCustomVar("$roundsinmag"));
//Log.Out("EntityNPCRebirth-OnUpdateLive AFTER $Burstsize: " + this.Buffs.GetCustomVar("$Burstsize"));
//Log.Out("EntityNPCRebirth-OnUpdateLive AFTER $burstrate: " + this.Buffs.GetCustomVar("$burstrate"));
}
}
//if (!isAnimal && delta == 0)
if (delta == 0)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive delta == 0");
//Log.Out("EntityNPCRebirth-OnUpdateLive transform.localScale: " + transform.localScale);
if (bMine || bRepair)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive bMine || bRepair");
HideNPC(false);
return;
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive transform.localScale: " + transform.localScale);
//Log.Out("EntityNPCRebirth-OnUpdateLive CurrentOrder: " + this.Buffs.GetCustomVar("CurrentOrder"));
//Log.Out("EntityNPCRebirth-OnUpdateLive $traveling: " + this.Buffs.GetCustomVar("$traveling"));
if (transform.localScale == new Vector3(0, 0, 0) && this.Buffs.GetCustomVar("$traveling") == 0f)
{
HideNPC(false);
}
}
}
}
/*if (Buffs.GetCustomVar("$FR_NPC_Hidden") == 1)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive flHidden == 1");
//Log.Out("EntityNPCRebirth-OnUpdateLive enabled: " + enabled);
//Log.Out("EntityNPCRebirth-OnUpdateLive scale: " + scale);
Log.Out("EntityNPCRebirth-OnUpdateLive HIDENPC 1");
HideNPC(true);
if (!RebirthVariables.isHordeNight)
{
//float flGoneMining = this.Buffs.GetCustomVar("$FuriousRamsayGoneMining");
//float flRepairing = this.Buffs.GetCustomVar("$FR_NPC_Repairing");
//Log.Out("EntityNPCRebirth-OnUpdateLive bMine: " + bMine);
//Log.Out("EntityNPCRebirth-OnUpdateLive bRepairing: " + bRepairing);
if (!bMine &&
!bRepairing &&
delta == 0
)
{
Log.Out("EntityNPCRebirth-OnUpdateLive UNHIDE NPC");
HideNPC(false);
}
}
}*/
if (bRepair)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive bRepairing: " + bRepairing);
if (!this.bRepairing)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive !this.bRepairing");
GameTimerTicks = GameTimer.Instance.ticks;
bRepairing = true;
numRepairedBlocks = 0;
watch.Reset();
watch.Start();
if (strSerialize != null)
{
if (strSerialize.Length > 0)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerialize.Length: " + strSerialize.Length);
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerializeTmp LOAD: " + strSerialize);
string[] array = strSerialize.Split(new char[]
{
'<'
});
if (array.Length > 0)
{
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(new char[]
{
'|'
});
for (int i2 = 0; i2 < array2.Length; i2++)
{
strCouldNotRepair[numCouldNotRepair, i2] = array2[i2];
//Log.Out("EntityNPCRebirth-OnUpdateLive RELOAD strCouldNotRepair[" + numCouldNotRepair + "," + i2 + "] i(" + i + "): " + strCouldNotRepair[numCouldNotRepair, i2]);
}
numCouldNotRepair++;
}
}
}
}
strSerialize = "";
//Log.Out("EntityNPCRebirth-OnUpdateLive numCouldNotRepair: " + numCouldNotRepair);
}
float range = RebirthVariables.repairWidth;
float rangeY = RebirthVariables.repairHeight;
int blockCount = 0;
numCouldNotRepair = 0;
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerialize: " + strSerialize);
////Log.Out("EntityNPCRebirth-OnUpdateLive AccumulatedTicks: " + AccumulatedTicks);
////Log.Out("EntityNPCRebirth-OnUpdateLive tempTickRate: " + tempTickRate);
if (delta > 0)
{
if (this.LeaderUtils.Owner != null)
{
List<TileEntity> tileEntities = RemoteCraftingUtils.GetTileEntities(this.LeaderUtils.Owner);
GameTimerTicks = GameTimer.Instance.ticks;
watch.Stop();
//Log.Out("EntityNPCRebirth-OnUpdateLive Execution Time: " + watch.ElapsedMilliseconds + " ms");
for (int x = -(int)range; x <= range; x++)
{
for (int z = -(int)range; z <= range; z++)
{
for (int y = (int)this.position.y - (int)rangeY; y <= (int)(this.position.y) + (int)rangeY; y++)
{
var blockPosition = new Vector3i(this.position.x + x, y, this.position.z + z);
BlockValue block = this.world.GetBlock(blockPosition);
if (!block.isair)
{
if (block.damage > 0 &&
block.Block.GetBlockName() != "terrAsphalt" &&
block.Block.GetBlockName() != "terrGravel" &&
block.Block.GetBlockName() != "terrForestGround" &&
block.Block.GetBlockName() != "terrDestroyedStone" &&
block.Block.GetBlockName() != "terrSnow" &&
block.Block.GetBlockName() != "terrDesertGround" &&
block.Block.GetBlockName() != "terrBurntForestGround" &&
block.Block.GetBlockName() != "terrDirt" &&
block.Block.GetBlockName() != "terrSand" &&
block.Block.GetBlockName() != "terrSandStone" &&
block.Block.GetBlockName() != "terrTopSoil" &&
block.Block.GetBlockName() != "terrDestroyedWoodDebris"
)
{
//Log.Out("==============================================================================");
//Log.Out("EntityNPCRebirth-OnUpdateLive blockCount: " + blockCount);
//Log.Out("EntityNPCRebirth-OnUpdateLive position: " + blockPosition);
//Log.Out("EntityNPCRebirth-OnUpdateLive block: " + block.Block.GetBlockName());
//Log.Out("EntityNPCRebirth-OnUpdateLive damage: " + block.damage);
float damagePerc = (float)block.damage / (float)Block.list[block.type].MaxDamage; ;
//Log.Out("EntityNPCRebirth-OnUpdateLive damagePerc: " + damagePerc);
if (block.Block.RepairItems != null)
{
for (int i = 0; i < block.Block.RepairItems.Count; i++)
{
int needed = block.Block.RepairItems[i].Count;
needed = (int)Mathf.Ceil(damagePerc * needed);
ItemValue itemValue = new ItemValue(ItemClass.GetItem(block.Block.RepairItems[i].ItemName, false).type, true);
bool bHaveItems = RebirthUtilities.ContainersHaveItem(tileEntities, needed, itemValue);
if (!bHaveItems)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive COULD NOT FIND, POSITION: " + numCouldNotRepair);
strCouldNotRepair[numCouldNotRepair, 0] = block.Block.RepairItems[i].ItemName;
strCouldNotRepair[numCouldNotRepair, 1] = needed.ToString();
//Log.Out("EntityNPCRebirth-OnUpdateLive ITEM: " + strCouldNotRepair[numCouldNotRepair, 0]);
//Log.Out("EntityNPCRebirth-OnUpdateLive COUNT: " + strCouldNotRepair[numCouldNotRepair, 1]);
numCouldNotRepair++;
//Log.Out("EntityNPCRebirth-OnUpdateLive DON'T HAVE ENOUGH OF: " + block.Block.RepairItems[i].ItemName);
}
else
{
RebirthUtilities.RemoveContainerItems(tileEntities, needed, itemValue);
block.damage = 0;
Chunk chunk = (Chunk)this.world.GetChunkFromWorldPos(blockPosition);
world.SetBlock(chunk.ClrIdx, blockPosition, block, false, false);
world.SetBlockRPC(chunk.ClrIdx, blockPosition, block, block.Block.Density);
//Log.Out("EntityNPCRebirth-OnUpdateLive REMOVED " + needed + " " + block.Block.RepairItems[i].ItemName);
numRepairedBlocks++;
}
//Log.Out("EntityNPCRebirth-OnUpdateLive item: " + block.Block.RepairItems[i].ItemName);
//Log.Out("EntityNPCRebirth-OnUpdateLive needed: " + needed);
}
}
blockCount++;
if (blockCount >= 100000)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive Break");
break;
}
}
}
if (blockCount >= 100000)
{
break;
}
}
if (blockCount >= 100000)
{
break;
}
}
}
if (blockCount < 100000)
{
bRepairing = false;
bRepair = false;
//Log.Out("EntityNPCRebirth-OnUpdateLive numRepairedBlocks: " + numRepairedBlocks);
//Log.Out("EntityNPCRebirth-OnUpdateLive HideDuration END: " + HideDuration);
if (this.LeaderUtils.Owner)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive HAS LEADER");
//Log.Out("EntityNPCRebirth-OnUpdateLive LEADER HAS REPAIR BUFF");
int numDuration = (int)numRepairedBlocks; // / 20;
//Log.Out("EntityNPCRebirth-OnUpdateLive numDuration: " + numDuration);
this.LeaderUtils.Owner.Buffs.SetCustomVar("$varFuriousRamsayHelpRepairBuffDisplay", numDuration);
this.LeaderUtils.Owner.Buffs.SetCustomVar("$FR_NPC_Repair", this.entityId);
this.LeaderUtils.Owner.Buffs.AddBuff("FuriousRamsayHelpRepairBuff");
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive HAS NO LEADER");
}
if (numCouldNotRepair > 0)
{
string strSerializeTmp = "";
for (int numFind = 0; (numFind < numCouldNotRepair); numFind++)
{
if (strSerializeTmp.Length > 0)
{
strSerializeTmp = strSerializeTmp + "<";
}
strSerializeTmp = strSerializeTmp + strCouldNotRepair[numFind, 0] + "|" + strCouldNotRepair[numFind, 1];
}
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerializeTmp A: " + strSerializeTmp);
strSerialize = strSerializeTmp;
string[,] strCouldNotRepairTmp = new string[numCouldNotRepair * 2, 2];
int numCouldNotRepairTmp = 0;
string[] array = strSerializeTmp.Split(new char[]
{
'<'
});
if (array.Length > 0)
{
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(new char[]
{
'|'
});
for (int i2 = 0; i2 < array2.Length; i2++)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive numCouldNotRepairTmp: " + numCouldNotRepairTmp);
//Log.Out("EntityNPCRebirth-OnUpdateLive i2: " + i2);
//Log.Out("EntityNPCRebirth-OnUpdateLive array2[i2]: " + array2[i2]);
strCouldNotRepairTmp[numCouldNotRepairTmp, i2] = array2[i2];
//Log.Out("EntityNPCRebirth-OnUpdateLive RELOAD strCouldNotRepairTmp[" + numCouldNotRepairTmp + "," + i2 + "] i(" + i + "): " + strCouldNotRepairTmp[numCouldNotRepairTmp, i2]);
}
numCouldNotRepairTmp++;
}
}
string[,] strCouldNotRepairTmp2 = new string[numCouldNotRepairTmp * 2, 2];
int numCouldNotRepairTmp2 = 0;
for (int i = 0; i < numCouldNotRepairTmp; i++)
{
if (numCouldNotRepairTmp2 > 0)
{
bool bFound = false;
for (int j = 0; j < numCouldNotRepairTmp2; j++)
{
if (strCouldNotRepairTmp2[j, 0] == strCouldNotRepairTmp[i, 0])
{
bFound = true;
int numRepair = 0;
//Log.Out("EntityNPCRebirth-OnUpdateLive FOUND");
//Log.Out("EntityNPCRebirth-OnUpdateLive numCouldNotRepairTmp2: " + numCouldNotRepairTmp2);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp2[j, 0]: " + strCouldNotRepairTmp2[j, 0]);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp2[j, 1]: " + strCouldNotRepairTmp2[j, 1]);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp[i, 0]: " + strCouldNotRepairTmp[i, 0]);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp[i, 1]: " + strCouldNotRepairTmp[i, 1]);
int numRepair1 = int.Parse(strCouldNotRepairTmp2[j, 1]);
int numRepair2 = int.Parse(strCouldNotRepairTmp[i, 1]);
numRepair = numRepair1 + numRepair2;
strCouldNotRepairTmp2[j, 1] = numRepair.ToString();
}
}
if (!bFound)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive DID NOT FIND");
strCouldNotRepairTmp2[numCouldNotRepairTmp2, 0] = strCouldNotRepairTmp[i, 0];
strCouldNotRepairTmp2[numCouldNotRepairTmp2, 1] = strCouldNotRepairTmp[i, 1];
//Log.Out("EntityNPCRebirth-OnUpdateLive numCouldNotRepairTmp2: " + numCouldNotRepairTmp2);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp2[numCouldNotRepairTmp2, 0]: " + strCouldNotRepairTmp2[numCouldNotRepairTmp2, 0]);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp2[numCouldNotRepairTmp2, 1]: " + strCouldNotRepairTmp2[numCouldNotRepairTmp2, 1]);
numCouldNotRepairTmp2++;
}
}
else
{
//Log.Out("EntityNPCRebirth-OnUpdateLive INITIAL ENTRY");
strCouldNotRepairTmp2[numCouldNotRepairTmp2, 0] = strCouldNotRepairTmp[i, 0];
strCouldNotRepairTmp2[numCouldNotRepairTmp2, 1] = strCouldNotRepairTmp[i, 1];
//Log.Out("EntityNPCRebirth-OnUpdateLive numCouldNotRepairTmp2: " + numCouldNotRepairTmp2);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp[i, 0]: " + strCouldNotRepairTmp[i, 0]);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp[i, 1]: " + strCouldNotRepairTmp[i, 1]);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp2[numCouldNotRepairTmp2, 0]: " + strCouldNotRepairTmp2[numCouldNotRepairTmp2, 0]);
//Log.Out("EntityNPCRebirth-OnUpdateLive strCouldNotRepairTmp2[numCouldNotRepairTmp2, 1]: " + strCouldNotRepairTmp2[numCouldNotRepairTmp2, 1]);
numCouldNotRepairTmp2++;
}
}
string strSerializeTmp2 = "";
for (int numFind = 0; (numFind < numCouldNotRepairTmp2); numFind++)
{
if (strSerializeTmp2.Length > 0)
{
strSerializeTmp2 = strSerializeTmp2 + "<";
}
strSerializeTmp2 = strSerializeTmp2 + strCouldNotRepairTmp2[numFind, 0] + "|" + strCouldNotRepairTmp2[numFind, 1];
}
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerializeTmp2 A2: " + strSerializeTmp2);
strSerialize = strSerializeTmp2;
}
}
else
{
if (numCouldNotRepair > 0)
{
string strSerializeTmp = "";
for (int numFind = 0; (numFind < numCouldNotRepair); numFind++)
{
if (strSerializeTmp.Length > 0)
{
strSerializeTmp = strSerializeTmp + "<";
}
strSerializeTmp = strSerializeTmp + strCouldNotRepair[numFind, 0] + "|" + strCouldNotRepair[numFind, 1];
}
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerializeTmp B: " + strSerializeTmp);
strSerialize = strSerializeTmp;
//Log.Out("EntityNPCRebirth-OnUpdateLive strSerialize: " + strSerialize);
}
}
}
}
}
//Log.Out("EntityNPCRebirth-OnUpdateLive this.rotation.y: " + this.rotation.y);
if (isNPC)
{
ulong elpasedTimeSurvivor = GameTimer.Instance.ticks - AccumulatedTicksSurvivor;
float flEntityRespawn = this.Buffs.GetCustomVar("$FR_NPC_Respawn");
if (elpasedTimeSurvivor >= 60UL && this.LeaderUtils.Owner != null && flEntityRespawn == 0)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 1");
AccumulatedTicksSurvivor = GameTimer.Instance.ticks;
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor bag size: " + this.bag.SlotCount);
if (this.lootContainer != null)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 2");
bool hasFireBuff = this.Buffs.HasBuff("FuriousRamsayFireZombieDamage") ||
this.Buffs.HasBuff("buffBurningFlamingArrow") ||
this.Buffs.HasBuff("buffBurningMolotov") ||
this.Buffs.HasBuff("buffBurningEnvironmentHack") ||
this.Buffs.HasBuff("buffBurningEnvironment") ||
this.Buffs.HasBuff("buffBurningElement") ||
this.Buffs.HasBuff("buffIsOnFire") ||
this.Buffs.HasBuff("FuriousRamsayFireZombieAoEDamage") ||
this.Buffs.HasBuff("FuriousRamsayFireZombieAoEDamageDisplay") ||
this.Buffs.HasBuff("FuriousRamsayAddBurningEnemyBoss") ||
this.Buffs.HasBuff("FuriousRamsayBurningTrapDamage");
bool blIsEmpty = this.lootContainer.IsEmpty();
//FIRE
ItemValue itemFuriousRamsayModFireResist = ItemClass.GetItem("FuriousRamsayModFireResist", false);
bool hasFuriousRamsayModFireResist = lootContainer.HasItem(itemFuriousRamsayModFireResist);
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor hasFuriousRamsayModFireResist: " + hasFuriousRamsayModFireResist);
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor hasFuriousRamsayModFireResist: " + hasFuriousRamsayModFireResist);
if (hasFuriousRamsayModFireResist)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor HAS FIRE IMMUNITY");
this.Buffs.AddBuff("FuriousRamsayResistFire");
this.Buffs.AddBuff("FuriousRamsayAddFireBuffEffect");
}
else
{
if (this.Buffs.HasBuff("FuriousRamsayResistFire"))
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor NO LONGER HAS FIRE IMMUNITY");
this.Buffs.RemoveBuff("FuriousRamsayResistFire");
this.Buffs.RemoveBuff("FuriousRamsayAddFireBuffEffect");
}
}
//SHOCK
ItemValue itemFuriousRamsayModShockResist = ItemClass.GetItem("FuriousRamsayModShockResist", false);
bool hasFuriousRamsayModShockResist = lootContainer.HasItem(itemFuriousRamsayModShockResist);
if (hasFuriousRamsayModShockResist)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor HAS SHOCK IMMUNITY");
this.Buffs.AddBuff("FuriousRamsayResistShock");
this.Buffs.AddBuff("FuriousRamsayAddShockBuffEffect");
}
else
{
if (this.Buffs.HasBuff("FuriousRamsayResistShock"))
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor NO LONGER HAS SHOCK IMMUNITY");
this.Buffs.RemoveBuff("FuriousRamsayResistShock");
this.Buffs.RemoveBuff("FuriousRamsayAddShockBuffEffect");
}
}
//EXPLOSION
ItemValue itemFuriousRamsayModSmokeResist = ItemClass.GetItem("FuriousRamsayModSmokeResist", false);
bool hasFuriousRamsayModSmokeResist = lootContainer.HasItem(itemFuriousRamsayModSmokeResist);
if (hasFuriousRamsayModSmokeResist)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor HAS EXPLOSION IMMUNITY");
this.Buffs.AddBuff("FuriousRamsayResistSmoke");
this.Buffs.AddBuff("FuriousRamsayAddSmokeBuffEffect");
}
else
{
if (this.Buffs.HasBuff("FuriousRamsayResistSmoke"))
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor NO LONGER HAS EXPLOSION IMMUNITY");
this.Buffs.RemoveBuff("FuriousRamsayResistSmoke");
this.Buffs.RemoveBuff("FuriousRamsayAddSmokeBuffEffect");
}
}
//FIRE AND SHOCK
ItemValue itemFuriousRamsayModResistFireShock = ItemClass.GetItem("FuriousRamsayModFireShockResist", false);
bool hasFuriousRamsayModResistFireShock = lootContainer.HasItem(itemFuriousRamsayModResistFireShock);
if (hasFuriousRamsayModResistFireShock)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor HAS FIRE/SHOCK IMMUNITY");
this.Buffs.AddBuff("FuriousRamsayResistFireShock");
this.Buffs.AddBuff("FuriousRamsayAddFireShockBuffEffect");
}
else
{
if (this.Buffs.HasBuff("FuriousRamsayResistFireShock"))
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor NO LONGER HAS FIRE/SHOCK IMMUNITY");
this.Buffs.RemoveBuff("FuriousRamsayResistFireShock");
this.Buffs.RemoveBuff("FuriousRamsayAddFireShockBuffEffect");
}
}
//FIRE, SHOCK AND EXPLOSION
ItemValue itemFuriousRamsayModResistFireShockSmoke = ItemClass.GetItem("FuriousRamsayModFireShockSmokeResist", false);
bool hasFuriousRamsayModResistFireShockSmoke = lootContainer.HasItem(itemFuriousRamsayModResistFireShockSmoke);
if (hasFuriousRamsayModResistFireShockSmoke)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor HAS FIRE/SHOCK/EXPLOPSION IMMUNITY");
this.Buffs.AddBuff("FuriousRamsayResistFireShockSmoke");
this.Buffs.AddBuff("FuriousRamsayAddFireShockSmokeBuffEffect");
}
else
{
if (this.Buffs.HasBuff("FuriousRamsayResistFireShockSmoke"))
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor NO LONGER HAS FIRE/SHOCK/EXPLOPSION IMMUNITY");
this.Buffs.RemoveBuff("FuriousRamsayResistFireShockSmoke");
this.Buffs.RemoveBuff("FuriousRamsayAddFireShockSmokeBuffEffect");
}
}
if (bHasTags && blIsEmpty)
{
float flContainerY = this.Buffs.GetCustomVar("$FR_NPC_ContainerY");
if (flContainerY == 0)
{
this.Buffs.SetCustomVar("$FR_NPC_ContainerY", this.lootContainer.GetContainerSize().y);
flContainerY = this.lootContainer.GetContainerSize().y;
}
int flCurrentContainerSizeY = this.lootContainer.GetContainerSize().y;
float flEntityLevel = this.Buffs.GetCustomVar("$FR_NPC_Level");
int numAdd = (int)flContainerY + (int)flEntityLevel;
if (numAdd > 10)
{
numAdd = 10;
}
if (numAdd > flCurrentContainerSizeY)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive SET CONTAINER SIZE 8X" + numAdd);
lootContainer.SetContainerSize(new Vector2i(8, numAdd));
}
}
if (bHasTags && !blIsEmpty)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 3");
if (hasFireBuff)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 4");
ItemValue itemMurkyWater = ItemClass.GetItem("drinkJarRiverWater", false);
bool hasMurkyWater = lootContainer.HasItem(itemMurkyWater);
ItemValue itemBoiledWater = ItemClass.GetItem("drinkJarBoiledWater", false);
bool hasBoiledWater = lootContainer.HasItem(itemBoiledWater);
ItemValue itemDistilledWater = ItemClass.GetItem("drinkJarPureMineralWater", false);
bool hasDistilledWater = lootContainer.HasItem(itemDistilledWater);
bool removeFire = false;
ItemStack[] array = lootContainer.GetItems();
if (hasMurkyWater)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 5");
RebirthUtilities.takeFromEntityContainer(this, "drinkJarRiverWater");
removeFire = true;
}
else if (hasBoiledWater)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 6");
RebirthUtilities.takeFromEntityContainer(this, "drinkJarBoiledWater");
removeFire = true;
}
else if (hasDistilledWater)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 6");
RebirthUtilities.takeFromEntityContainer(this, "drinkJarPureMineralWater");
removeFire = true;
}
if (removeFire)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 7");
this.Buffs.AddBuff("buffExtinguishFire");
this.Buffs.RemoveBuff("FuriousRamsayFireZombieDamage");
this.Buffs.RemoveBuff("buffBurningFlamingArrow");
this.Buffs.RemoveBuff("buffBurningMolotov");
this.Buffs.RemoveBuff("buffBurningEnvironmentHack");
this.Buffs.RemoveBuff("buffBurningEnvironment");
this.Buffs.RemoveBuff("buffBurningElement");
this.Buffs.RemoveBuff("buffIsOnFire");
this.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamage");
this.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamageDisplay");
this.Buffs.RemoveBuff("FuriousRamsayAddBurningEnemyBoss");
this.Buffs.RemoveBuff("FuriousRamsayBurningTrapDamage");
this.Buffs.AddBuff("FuriousRamsayTempResistFire");
}
}
}
if (!blIsEmpty)
{
//NPC self healing
int healedAmount = 0;
int survivorMaxHealth = this.GetMaxHealth();
int survivorHealth = this.Health;
int survivorHealthModifier = (int)Math.Floor(this.Stats.Health.MaxModifier);
int missingHealth = survivorMaxHealth - survivorHealth - healedAmount + survivorHealthModifier;
bool bHealing = this.Buffs.HasBuff("buffHealHealth");
float numHealing = this.Buffs.GetCustomVar("medicalRegHealthAmount");
bool bPainKillers = this.Buffs.HasBuff("buffDrugPainkillers");
bool isSkeleton = this.HasAnyTags(FastTags<TagGroup.Global>.Parse("skeletonCompanion"));
bool isZombie = this.HasAnyTags(FastTags<TagGroup.Global>.Parse("zombieCompanion"));
float numHealingLeft = missingHealth - numHealing;
if (numHealingLeft > 0 && missingHealth > 0 && !bHealing)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 8");
ItemValue itemRawMeat = ItemClass.GetItem("foodRawMeat", false);
bool hasRawMeat = lootContainer.HasItem(itemRawMeat);
ItemValue itemBone = ItemClass.GetItem("resourceBone", false);
bool hasBone = lootContainer.HasItem(itemBone);
ItemValue itemBrains = ItemClass.GetItem("foodRottingFlesh", false);
bool hasBrain = lootContainer.HasItem(itemBrains);
ItemValue itemMedicalBandage = ItemClass.GetItem("medicalBandage", false);
bool hasMedicalBandage = lootContainer.HasItem(itemMedicalBandage);
ItemValue itemMedicalFirstAidBandage = ItemClass.GetItem("medicalFirstAidBandage", false);
bool hasMedicalFirstAidBandage = lootContainer.HasItem(itemMedicalFirstAidBandage);
ItemValue itemMedicalFirstAidKit = ItemClass.GetItem("medicalFirstAidKit", false);
bool hasMedicalFirstAidKit = lootContainer.HasItem(itemMedicalFirstAidKit);
ItemValue itemDrugPainkillers = ItemClass.GetItem("drugPainkillers", false);
bool hasDrugPainkillers = lootContainer.HasItem(itemDrugPainkillers);
//Log.Out("EntityNPCRebirth-OnUpdateLive survivorHealth: " + survivorHealth);
//Log.Out("EntityNPCRebirth-OnUpdateLive numHealingLeft: " + numHealingLeft);
//Log.Out("EntityNPCRebirth-OnUpdateLive missingHealth: " + missingHealth);
//Log.Out("EntityNPCRebirth-OnUpdateLive hasMedicalBandage: " + hasMedicalBandage);
//Log.Out("EntityNPCRebirth-OnUpdateLive hasMedicalFirstAidBandage: " + hasMedicalFirstAidBandage);
//Log.Out("EntityNPCRebirth-OnUpdateLive hasMehasMedicalFirstAidKitdicalBandage: " + hasMedicalFirstAidKit);
//Log.Out("EntityNPCRebirth-OnUpdateLive hasDrugPainkillers: " + hasDrugPainkillers);
//Log.Out("EntityNPCRebirth-OnUpdateLive bPainKillers: " + bPainKillers);
if (isZombie)
{
if (numHealingLeft >= 90 && hasBrain)
{
this.Buffs.SetCustomVar("$medicRegHealthIncreaseSpeed", 4f);
this.Buffs.AddBuff("FuriousRamsayRawMeatTrigger");
RebirthUtilities.takeFromEntityContainer(this, "foodRottingFlesh");
this.Buffs.AddBuff("FuriousRamsayBrainHealTrigger");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
}
else if (isSkeleton)
{
if (numHealingLeft >= 70 && hasBone)
{
this.Buffs.SetCustomVar("$medicRegHealthIncreaseSpeed", 4f);
this.Buffs.AddBuff("FuriousRamsayRawMeatTrigger");
RebirthUtilities.takeFromEntityContainer(this, "resourceBone");
this.Buffs.AddBuff("FuriousRamsayBoneHealTrigger");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
}
else if (isAnimal)
{
if (numHealingLeft >= 140 && hasRawMeat)
{
this.Buffs.SetCustomVar("$medicRegHealthIncreaseSpeed", 4f);
this.Buffs.AddBuff("FuriousRamsayRawMeatHealTrigger");
RebirthUtilities.takeFromEntityContainer(this, "foodRawMeat");
this.Buffs.AddBuff("FuriousRamsayTriggerHealingAnim");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
}
else
{
if (numHealingLeft >= 100 && !bPainKillers && survivorHealth < 50 && hasDrugPainkillers)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 8a");
this.Buffs.SetCustomVar("$buffDrugPainkillersDuration", 583);
this.Buffs.AddBuff("FuriousRamsayDrugPainkillersTrigger");
RebirthUtilities.takeFromEntityContainer(this, "drugPainkillers");
this.Buffs.AddBuff("FuriousRamsayTriggerHealingAnim");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
else if (numHealingLeft >= 100 && hasMedicalFirstAidKit)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 8b");
this.Buffs.SetCustomVar("$medicRegHealthIncreaseSpeed", 4f);
this.Buffs.AddBuff("FuriousRamsayMedicalFirstAidKitTrigger");
RebirthUtilities.takeFromEntityContainer(this, "medicalFirstAidKit");
this.Buffs.AddBuff("FuriousRamsayTriggerHealingAnim");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
else if ((numHealingLeft >= 20 && numHealingLeft < 100) && hasMedicalFirstAidBandage)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 8c");
this.Buffs.SetCustomVar("$medicRegHealthIncreaseSpeed", 4f);
this.Buffs.AddBuff("FuriousRamsayMedicalFirstAidBandageTrigger");
RebirthUtilities.takeFromEntityContainer(this, "medicalFirstAidBandage");
this.Buffs.AddBuff("FuriousRamsayTriggerHealingAnim");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
else if ((numHealingLeft >= 6 && numHealingLeft < 20) && hasMedicalBandage)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 8d");
this.Buffs.SetCustomVar("$medicRegHealthIncreaseSpeed", 4f);
this.Buffs.AddBuff("FuriousRamsayMedicalBandageTrigger");
RebirthUtilities.takeFromEntityContainer(this, "medicalBandage");
this.Buffs.AddBuff("FuriousRamsayTriggerHealingAnim");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
else if (numHealingLeft >= 20 && hasMedicalFirstAidBandage)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 8e");
this.Buffs.SetCustomVar("$medicRegHealthIncreaseSpeed", 4f);
this.Buffs.AddBuff("FuriousRamsayMedicalFirstAidBandageTrigger");
RebirthUtilities.takeFromEntityContainer(this, "medicalFirstAidBandage");
this.Buffs.AddBuff("FuriousRamsayTriggerHealingAnim");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
else if (numHealingLeft >= 6 && hasMedicalBandage)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 8f");
this.Buffs.SetCustomVar("$medicRegHealthIncreaseSpeed", 4f);
this.Buffs.AddBuff("FuriousRamsayMedicalBandageTrigger");
RebirthUtilities.takeFromEntityContainer(this, "medicalBandage");
this.Buffs.AddBuff("FuriousRamsayTriggerHealingAnim");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
else if (numHealingLeft >= 30 && !bPainKillers && hasDrugPainkillers)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 8g");
this.Buffs.SetCustomVar("$buffDrugPainkillersDuration", 583);
this.Buffs.AddBuff("FuriousRamsayDrugPainkillersTrigger");
RebirthUtilities.takeFromEntityContainer(this, "drugPainkillers");
this.Buffs.AddBuff("FuriousRamsayTriggerHealingAnim");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
else if (numHealingLeft >= 50 && hasMedicalFirstAidKit)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive elpasedTimeSurvivor 8h");
this.Buffs.SetCustomVar("$medicRegHealthIncreaseSpeed", 4f);
this.Buffs.AddBuff("FuriousRamsayMedicalFirstAidKitTrigger");
RebirthUtilities.takeFromEntityContainer(this, "medicalFirstAidKit");
this.Buffs.AddBuff("FuriousRamsayTriggerHealingAnim");
this.Buffs.AddBuff("FuriousRamsayHealParticle");
}
}
}
}
}
}
if (flEntityRespawn > 0)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive flEntityRespawn: " + flEntityRespawn);
this.isHirable = false;
}
else
{
if (!this.HasAnyTags(FastTags<TagGroup.Global>.Parse("ignoreFactionChange")))
{
this.factionId = FactionManager.Instance.GetFactionByName("whiteriver").ID;
}
this.isHirable = true;
numReposition = 0;
}
}
}
base.OnUpdateLive();
if (!isAnimal && !this.bDead)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive strWeaponType: " + strWeaponType);
if (bHasTags)
{
try
{
float numSupplyAmmo = this.Buffs.GetCustomVar("$varFuriousRamsaySupplyAmmo");
if (this.Buffs.HasCustomVar("NPCInteractedFlag") && strWeaponType != "none")
{
//Log.Out("EntityNPCRebirth-OnUpdateLive NPCInteractedFlag");
ItemValue item762Ammo = ItemClass.GetItem("ammo762mmBulletBall", false);
ItemValue item9mmAmmo = ItemClass.GetItem("ammo9mmBulletBall", false);
ItemValue item44Ammo = ItemClass.GetItem("ammo44MagnumBulletBall", false);
ItemValue itemShellAmmo = ItemClass.GetItem("ammoShotgunShell", false);
ItemValue gunNPCPistol = ItemClass.GetItem("gunNPCPistol", false);
ItemValue gunNPCDPistol = ItemClass.GetItem("gunNPCDPistol", false);
ItemValue gunNPCPShotgun = ItemClass.GetItem("gunNPCPShotgun", false);
ItemValue gunNPCSMG5 = ItemClass.GetItem("gunNPCSMG5", false);
ItemValue gunNPCSRifle = ItemClass.GetItem("gunNPCSRifle", false);
ItemValue gunNPCTRifle = ItemClass.GetItem("gunNPCTRifle", false);
ItemValue gunNPCM60 = ItemClass.GetItem("gunNPCM60", false);
ItemValue gunNPCAk47 = ItemClass.GetItem("gunNPCAk47", false);
if (this.inventory.holdingItem.GetItemName() == "meleeNPCEmptyHand")
{
//Log.Out("EntityNPCRebirth-OnUpdateLive Holding meleeNPCEmptyHand, Weapon: " + strWeaponType);
//Log.Out("EntityNPCRebirth-OnUpdateLive Holding meleeNPCEmptyHand, HasItem item762Ammo: " + this.lootContainer.HasItem(item762Ammo));
if (strWeaponType == "PistolUser" && (this.lootContainer.HasItem(item9mmAmmo) || numSupplyAmmo == 0))
{
string _strRangedWeapon = strWeaponType;
string _strRangedWeaponItem = "gunNPCPistol";
string _strAmmo = "ammo9mmBulletBall";
strAmmoType = _strAmmo;
ItemStack[] array = this.lootContainer.GetItems();
this.Buffs.RemoveBuff("EmptyHandUser");
this.Buffs.AddBuff("buffReload");
this.Buffs.AddBuff("buffBurst");
this.Buffs.AddBuff(_strRangedWeapon);
Transform transform2 = this.RootTransform.FindInChilds(_strRangedWeapon.Replace("User", ""), true);
this.rightHandTransformName = _strRangedWeapon.Replace("User", "");
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 0);
this.emodel.avatarController.UpdateInt(_strRangedWeapon, 1);
ItemStack itemStack = ItemStack.FromString(_strRangedWeaponItem);
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString(_strAmmo);
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (strWeaponType == "DPistolUser" && (this.lootContainer.HasItem(item44Ammo) || numSupplyAmmo == 0))
{
string _strRangedWeapon = strWeaponType;
string _strRangedWeaponItem = "gunNPCDPistol";
string _strAmmo = "ammo44MagnumBulletBall";
strAmmoType = _strAmmo;
ItemStack[] array = this.lootContainer.GetItems();
this.Buffs.RemoveBuff("EmptyHandUser");
this.Buffs.AddBuff("buffReload");
this.Buffs.AddBuff("buffBurst");
this.Buffs.AddBuff(_strRangedWeapon);
Transform transform2 = this.RootTransform.FindInChilds(_strRangedWeapon.Replace("User", ""), true);
this.rightHandTransformName = _strRangedWeapon.Replace("User", "");
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 0);
this.emodel.avatarController.UpdateInt(_strRangedWeapon, 1);
ItemStack itemStack = ItemStack.FromString(_strRangedWeaponItem);
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString(_strAmmo);
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (strWeaponType == "PShotgunUser" && (this.lootContainer.HasItem(itemShellAmmo) || numSupplyAmmo == 0))
{
string _strRangedWeapon = strWeaponType;
string _strRangedWeaponItem = "gunNPCPShotgun";
string _strAmmo = "ammoShotgunShell";
strAmmoType = _strAmmo;
ItemStack[] array = this.lootContainer.GetItems();
this.Buffs.RemoveBuff("EmptyHandUser");
this.Buffs.AddBuff("buffReload");
this.Buffs.AddBuff("buffBurst");
this.Buffs.AddBuff(_strRangedWeapon);
Transform transform2 = this.RootTransform.FindInChilds(_strRangedWeapon.Replace("User", ""), true);
this.rightHandTransformName = _strRangedWeapon.Replace("User", "");
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 0);
this.emodel.avatarController.UpdateInt(_strRangedWeapon, 1);
ItemStack itemStack = ItemStack.FromString(_strRangedWeaponItem);
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString(_strAmmo);
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (strWeaponType == "SMGUser" && (this.lootContainer.HasItem(item9mmAmmo) || numSupplyAmmo == 0))
{
string _strRangedWeapon = strWeaponType;
string _strRangedWeaponItem = "gunNPCSMG5";
string _strAmmo = "ammo9mmBulletBall";
strAmmoType = _strAmmo;
ItemStack[] array = this.lootContainer.GetItems();
this.Buffs.RemoveBuff("EmptyHandUser");
this.Buffs.AddBuff("buffReload");
this.Buffs.AddBuff("buffBurst");
this.Buffs.AddBuff(_strRangedWeapon);
Transform transform2 = this.RootTransform.FindInChilds(_strRangedWeapon.Replace("User", ""), true);
this.rightHandTransformName = _strRangedWeapon.Replace("User", "");
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 0);
this.emodel.avatarController.UpdateInt(_strRangedWeapon, 1);
ItemStack itemStack = ItemStack.FromString(_strRangedWeaponItem);
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString(_strAmmo);
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (strWeaponType == "SRifleUser" && (this.lootContainer.HasItem(item762Ammo) || numSupplyAmmo == 0))
{
string _strRangedWeapon = strWeaponType;
string _strRangedWeaponItem = "gunNPCSRifle";
string _strAmmo = "ammo762mmBulletBall";
strAmmoType = _strAmmo;
ItemStack[] array = this.lootContainer.GetItems();
this.Buffs.RemoveBuff("EmptyHandUser");
this.Buffs.AddBuff("buffReload");
this.Buffs.AddBuff("buffBurst");
this.Buffs.AddBuff(_strRangedWeapon);
Transform transform2 = this.RootTransform.FindInChilds(_strRangedWeapon.Replace("User", ""), true);
this.rightHandTransformName = _strRangedWeapon.Replace("User", "");
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 0);
this.emodel.avatarController.UpdateInt(_strRangedWeapon, 1);
ItemStack itemStack = ItemStack.FromString(_strRangedWeaponItem);
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString(_strAmmo);
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (strWeaponType == "TRifleUser" && (this.lootContainer.HasItem(item762Ammo) || numSupplyAmmo == 0))
{
string _strRangedWeapon = strWeaponType;
string _strRangedWeaponItem = "gunNPCTRifle";
string _strAmmo = "ammo762mmBulletBall";
strAmmoType = _strAmmo;
ItemStack[] array = this.lootContainer.GetItems();
this.Buffs.RemoveBuff("EmptyHandUser");
this.Buffs.AddBuff("buffReload");
this.Buffs.AddBuff("buffBurst");
this.Buffs.AddBuff(_strRangedWeapon);
Transform transform2 = this.RootTransform.FindInChilds(_strRangedWeapon.Replace("User", ""), true);
this.rightHandTransformName = _strRangedWeapon.Replace("User", "");
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 0);
this.emodel.avatarController.UpdateInt("ARUser", 1);
ItemStack itemStack = ItemStack.FromString(_strRangedWeaponItem);
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString(_strAmmo);
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (strWeaponType == "M60User" && (this.lootContainer.HasItem(item762Ammo) || numSupplyAmmo == 0))
{
string _strRangedWeapon = strWeaponType;
string _strRangedWeaponItem = "gunNPCM60";
string _strAmmo = "ammo762mmBulletBall";
strAmmoType = _strAmmo;
ItemStack[] array = this.lootContainer.GetItems();
this.Buffs.RemoveBuff("EmptyHandUser");
this.Buffs.AddBuff("buffReload");
this.Buffs.AddBuff("buffBurst");
this.Buffs.AddBuff(_strRangedWeapon);
Transform transform2 = this.RootTransform.FindInChilds(_strRangedWeapon.Replace("User", ""), true);
this.rightHandTransformName = _strRangedWeapon.Replace("User", "");
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 0);
this.emodel.avatarController.UpdateInt(_strRangedWeapon, 1);
ItemStack itemStack = ItemStack.FromString(_strRangedWeaponItem);
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString(_strAmmo);
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (strWeaponType == "AK47User" && (this.lootContainer.HasItem(item762Ammo) || numSupplyAmmo == 0))
{
string _strRangedWeapon = strWeaponType;
string _strRangedWeaponItem = "gunNPCAk47";
string _strAmmo = "ammo762mmBulletBall";
strAmmoType = _strAmmo;
//Log.Out("EntityNPCRebirth-OnUpdateLive _strRangedWeapon: " + _strRangedWeapon + ", strWeaponType: " + strWeaponType + " and has ammo");
ItemStack[] array = this.lootContainer.GetItems();
this.Buffs.RemoveBuff("EmptyHandUser");
this.Buffs.AddBuff("buffReload");
this.Buffs.AddBuff("buffBurst");
this.Buffs.AddBuff(_strRangedWeapon);
Transform transform2 = this.RootTransform.FindInChilds(_strRangedWeapon.Replace("User", ""), true);
this.rightHandTransformName = _strRangedWeapon.Replace("User", "");
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 0);
this.emodel.avatarController.UpdateInt(_strRangedWeapon, 1);
ItemStack itemStack = ItemStack.FromString(_strRangedWeaponItem);
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString(_strAmmo);
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
}
else if (this.inventory.holdingItem.GetItemName() == "gunNPCPistol" && !this.lootContainer.HasItem(item9mmAmmo) && numSupplyAmmo == 1)
{
if (this.Buffs.HasBuff(strWeaponType))
{
this.Buffs.RemoveBuff(strWeaponType);
this.Buffs.RemoveBuff("buffReload");
this.Buffs.RemoveBuff("buffBurst");
this.Buffs.AddBuff("EmptyHandUser");
}
Transform transform2 = this.RootTransform.FindInChilds("RightWeapon", true);
this.rightHandTransformName = "RightWeapon";
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt(strWeaponType, 0);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 1);
ItemStack itemStack = ItemStack.FromString("meleeNPCEmptyHand");
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString("ammo9mmBulletBall");
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (this.inventory.holdingItem.GetItemName() == "gunNPCDPistol" && !this.lootContainer.HasItem(item44Ammo) && numSupplyAmmo == 1)
{
if (this.Buffs.HasBuff(strWeaponType))
{
this.Buffs.RemoveBuff(strWeaponType);
this.Buffs.RemoveBuff("buffReload");
this.Buffs.RemoveBuff("buffBurst");
this.Buffs.AddBuff("EmptyHandUser");
}
Transform transform2 = this.RootTransform.FindInChilds("RightWeapon", true);
this.rightHandTransformName = "RightWeapon";
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt(strWeaponType, 0);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 1);
ItemStack itemStack = ItemStack.FromString("meleeNPCEmptyHand");
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString("ammo44MagnumBulletBall");
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (this.inventory.holdingItem.GetItemName() == "gunNPCPShotgun" && !this.lootContainer.HasItem(itemShellAmmo) && numSupplyAmmo == 1)
{
if (this.Buffs.HasBuff(strWeaponType))
{
this.Buffs.RemoveBuff(strWeaponType);
this.Buffs.RemoveBuff("buffReload");
this.Buffs.RemoveBuff("buffBurst");
this.Buffs.AddBuff("EmptyHandUser");
}
Transform transform2 = this.RootTransform.FindInChilds("RightWeapon", true);
this.rightHandTransformName = "RightWeapon";
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt(strWeaponType, 0);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 1);
ItemStack itemStack = ItemStack.FromString("meleeNPCEmptyHand");
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString("ammoShotgunShell");
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (this.inventory.holdingItem.GetItemName() == "gunNPCSMG5" && !this.lootContainer.HasItem(item9mmAmmo) && numSupplyAmmo == 1)
{
if (this.Buffs.HasBuff(strWeaponType))
{
this.Buffs.RemoveBuff(strWeaponType);
this.Buffs.RemoveBuff("buffReload");
this.Buffs.RemoveBuff("buffBurst");
this.Buffs.AddBuff("EmptyHandUser");
}
Transform transform2 = this.RootTransform.FindInChilds("RightWeapon", true);
this.rightHandTransformName = "RightWeapon";
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt(strWeaponType, 0);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 1);
ItemStack itemStack = ItemStack.FromString("meleeNPCEmptyHand");
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString("ammo9mmBulletBall");
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (this.inventory.holdingItem.GetItemName() == "gunNPCSRifle" && !this.lootContainer.HasItem(item762Ammo) && numSupplyAmmo == 1)
{
if (this.Buffs.HasBuff(strWeaponType))
{
this.Buffs.RemoveBuff(strWeaponType);
this.Buffs.RemoveBuff("buffReload");
this.Buffs.RemoveBuff("buffBurst");
this.Buffs.AddBuff("EmptyHandUser");
}
Transform transform2 = this.RootTransform.FindInChilds("RightWeapon", true);
this.rightHandTransformName = "RightWeapon";
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt(strWeaponType, 0);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 1);
ItemStack itemStack = ItemStack.FromString("meleeNPCEmptyHand");
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString("ammo762mmBulletBall");
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (this.inventory.holdingItem.GetItemName() == "gunNPCTRifle" && !this.lootContainer.HasItem(item762Ammo) && numSupplyAmmo == 1)
{
if (this.Buffs.HasBuff(strWeaponType))
{
this.Buffs.RemoveBuff(strWeaponType);
this.Buffs.RemoveBuff("buffReload");
this.Buffs.RemoveBuff("buffBurst");
this.Buffs.AddBuff("EmptyHandUser");
}
Transform transform2 = this.RootTransform.FindInChilds("RightWeapon", true);
this.rightHandTransformName = "RightWeapon";
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt("ARUser", 0);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 1);
ItemStack itemStack = ItemStack.FromString("meleeNPCEmptyHand");
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString("ammo762mmBulletBall");
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (this.inventory.holdingItem.GetItemName() == "gunNPCM60" && !this.lootContainer.HasItem(item762Ammo) && numSupplyAmmo == 1)
{
if (this.Buffs.HasBuff(strWeaponType))
{
this.Buffs.RemoveBuff(strWeaponType);
this.Buffs.RemoveBuff("buffReload");
this.Buffs.RemoveBuff("buffBurst");
this.Buffs.AddBuff("EmptyHandUser");
}
Transform transform2 = this.RootTransform.FindInChilds("RightWeapon", true);
this.rightHandTransformName = "RightWeapon";
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt(strWeaponType, 0);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 1);
ItemStack itemStack = ItemStack.FromString("meleeNPCEmptyHand");
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString("ammo762mmBulletBall");
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
else if (this.inventory.holdingItem.GetItemName() == "gunNPCAk47" && !this.lootContainer.HasItem(item762Ammo) && numSupplyAmmo == 1)
{
//Log.Out("EntityNPCRebirth-OnUpdateLive Holding gunNPCAk47 no ammo");
if (this.Buffs.HasBuff(strWeaponType))
{
//Log.Out("EntityNPCRebirth-OnUpdateLive have buff: " + strWeaponType);
this.Buffs.RemoveBuff(strWeaponType);
this.Buffs.RemoveBuff("buffReload");
this.Buffs.RemoveBuff("buffBurst");
this.Buffs.AddBuff("EmptyHandUser");
}
//Log.Out("EntityNPCRebirth-OnUpdateLive _strRangedWeapon: meleeNPCEmptyHand, strWeaponType: " + strWeaponType + " and has no ammo");
Transform transform2 = this.RootTransform.FindInChilds("RightWeapon", true);
this.rightHandTransformName = "RightWeapon";
this.emodel.SetInRightHand(transform2);
this.emodel.avatarController.UpdateInt(strWeaponType, 0);
this.emodel.avatarController.UpdateInt("EmptyHandUser", 1);
ItemStack itemStack = ItemStack.FromString("meleeNPCEmptyHand");
this.inventory.SetItem(0, itemStack);
itemStack = ItemStack.FromString("ammo762mmBulletBall");
this.inventory.SetItem(1, itemStack);
this.inventory.ForceHoldingItemUpdate();
}
}
}
catch (Exception ex)
{
}
}
}
}
public override void Read(byte _version, BinaryReader _br)
{
base.Read(_version, _br);
int npcHealth = _br.ReadInt32();
//Log.Out("EntityNPCRebirth-Read HEALTH: " + npcHealth);
Health = npcHealth;
this.Buffs.AddBuff("delayPickup");
if (this.Buffs.GetCustomVar("$updateStats") == 1f)
{
this.Buffs.SetCustomVar("$tempHealth", npcHealth);
GameManager.Instance.StartCoroutine(RebirthUtilities.adjustNPCStats(this));
}
this.Buffs.SetCustomVar("$updateStats", 1f);
try
{
HideDuration = _br.ReadInt32();
}
catch
{
HideDuration = 0;
}
//Log.Out("EntityNPCRebirth-Read HideDuration: " + HideDuration);
try
{
bMine = _br.ReadBoolean();
}
catch
{
bMine = false;
}
try
{
bRepair = _br.ReadBoolean();
}
catch
{
bRepair = false;
}
try
{
this.strSerialize = _br.ReadString();
}
catch
{
this.strSerialize = "";
}
try
{
this.lootDropEntityClass = _br.ReadString();
}
catch
{
this.lootDropEntityClass = "";
}
//Log.Out("EntityNPCRebirth-Write AFTER currentOrder: " + this.currentOrder);
try
{
this.otherTags = _br.ReadString();
}
catch
{
this.otherTags = "";
}
}
// Saves the buff and quest information
public override void Write(BinaryWriter _bw, bool _bNetworkWrite)
{
//Log.Out("StackTrace: '{0}'", Environment.StackTrace);
base.Write(_bw, _bNetworkWrite);
//Log.Out("EntityNPCRebirth-Write HEALTH: " + Health);
_bw.Write(Health);
//Log.Out("EntityNPCRebirth-Write HideDuration: " + (GameManager.Instance.World.worldTime / 20) + delta);
_bw.Write((int)((GameManager.Instance.World.worldTime / 20) + delta));
_bw.Write(this.bMine);
_bw.Write(this.bRepair);
_bw.Write(this.strSerialize);
_bw.Write(lootDropEntityClass);
_bw.Write(otherTags);
}
public override string EntityName
{
get
{
if (_strMyName.Contains("REBIRTHREBIRTH"))
{
return _strMyName.Replace("REBIRTHREBIRTH", "");
}
else
{
string name = Localization.Get(_strMyName);
return name;
}
}
}
public override void TeleportToPlayer(EntityAlive target, bool randomPosition = false)
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer START: " + this.EntityClass.entityClassName);
if (target == null)
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer 1");
return;
}
if (target.IsInElevator())
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer target.IsInElevator(): " + target.IsInElevator());
return;
}
if (this.Buffs.GetCustomVar("CurrentOrder") == (int)EntityUtilities.Orders.Stay ||
this.Buffs.GetCustomVar("CurrentOrder") == (int)EntityUtilities.Orders.TempStay)
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer 2");
return;
}
if (!(this.HasAnyTags(FastTags<TagGroup.Global>.Parse("survivor")) || this.HasAnyTags(FastTags<TagGroup.Global>.Parse("ally"))))
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer 3a");
return;
}
var target2i = new Vector2(target.position.x, target.position.z);
var mine2i = new Vector2(position.x, position.z);
var distance = Vector2.Distance(target2i, mine2i);
//Log.Out("EntityNPCRebirth-TeleportToPlayer distance: " + distance);
//Log.Out("EntityNPCRebirth-TeleportToPlayer Math.Abs(target.position.y - this.position.y): " + Math.Abs(target.position.y - this.position.y));
if (LeaderUtils.IsTeleporting)
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer 5");
return;
}
var myPosition = target.position - target.GetForwardVector();
var player = target as EntityPlayer;
if (player != null)
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer 6, player: " + player.position);
//Log.Out("EntityNPCRebirth-TeleportToPlayer 6, myPosition: " + myPosition);
// If my target distance is still way off from the player, teleport randomly. That means the bread crumb isn't accurate
var distance2 = Vector3.Distance(myPosition, player.position);
//Log.Out("EntityNPCRebirth-TeleportToPlayer 7, distance2: " + distance2);
if (distance2 > 40f)
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer 7");
randomPosition = true;
}
if (randomPosition)
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer 8");
Vector3 dirV = target.position - this.position;
myPosition = RandomPositionGenerator.CalcPositionInDirection(target, target.position, dirV, 5, 80f);
}
// Find the ground.
//Log.Out("EntityNPCRebirth-TeleportToPlayer A player X: " + player.position.x);
//Log.Out("EntityNPCRebirth-TeleportToPlayer A player Y: " + player.position.y);
//Log.Out("EntityNPCRebirth-TeleportToPlayer A player Z: " + player.position.z);
//Log.Out("EntityNPCRebirth-TeleportToPlayer A NPC X: " + this.position.x);
//Log.Out("EntityNPCRebirth-TeleportToPlayer A NPC Y: " + this.position.y);
//Log.Out("EntityNPCRebirth-TeleportToPlayer A NPC Z: " + this.position.z);
//Log.Out("EntityNPCRebirth-TeleportToPlayer A myPosition X: " + myPosition.x);
//Log.Out("EntityNPCRebirth-TeleportToPlayer A myPosition Y: " + myPosition.y);
//Log.Out("EntityNPCRebirth-TeleportToPlayer A myPosition Z: " + myPosition.z);
//Log.Out("EntityNPCRebirth-TeleportToPlayer A player ground: " + GameManager.Instance.World.GetHeightAt(player.position.x, player.position.z));
//Log.Out("EntityNPCRebirth-TeleportToPlayer A NPC ground: " + GameManager.Instance.World.GetHeightAt(target.position.x, target.position.z));
float positionY = player.position.y + 1f;
if (player.position.y > this.position.y)
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer A1");
//myPosition = player.position;
myPosition.y = positionY;
}
else
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer A2");
if (GameManager.Instance.World.GetHeightAt(myPosition.x, myPosition.z) <= player.position.y)
{
}
else
{
positionY = GameManager.Instance.World.GetHeightAt(myPosition.x, myPosition.z) + 1f;
}
}
myPosition.y = positionY;//(int)GameManager.Instance.World.GetHeightAt(myPosition.x, myPosition.z) + 1;
if (this.Buffs.GetCustomVar("$FR_NPC_ForceTeleport") == 1f)
{
//Log.Out("EntityNPCRebirth-TeleportToPlayer C");
myPosition = player.position;
myPosition.y = myPosition.y + 1f;
this.Buffs.SetCustomVar("$FR_NPC_ForceTeleport", 0f);
}
}
motion = Vector3.zero;
navigator?.clearPath();
moveHelper?.Stop();
speedForward = 0;
speedStrafe = 0;
RebirthUtilities.toggleCollisions(false, this);
//motion = Vector3.zero;
//navigator?.clearPath();
//Log.Out("EntityNPCRebirth-TeleportToPlayer myPosition: " + myPosition);
//Log.Out("EntityNPCRebirth-TeleportToPlayer REPOSITION");
this.SetPosition(myPosition, true);
}
public override void ProcessDamageResponseLocal(DamageResponse _dmResponse)
{
if (this.Buffs.GetCustomVar("$eventSpawn") == 1f && _dmResponse.Source.getEntityId() != -1)
{
Entity sourceEntity = this.world.GetEntity(_dmResponse.Source.getEntityId());
if (sourceEntity != null)
{
this.SetAttackTarget((EntityAlive)sourceEntity, 60);
this.SetRevengeTarget((EntityAlive)sourceEntity);
}
}
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal HAS OWNER A: " + (this.LeaderUtils.Owner != null));
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal name: " + this.EntityClass.entityClassName);
bool blEntityClass = false;
float flEntityInvincible = this.Buffs.GetCustomVar("$FR_NPC_Invincible");
if (flEntityInvincible == 1)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 1");
return;
}
if (!isEntityRemote)
{
emodel.avatarController.UpdateBool("IsBusy", false);
}
float flLeader = this.Buffs.GetCustomVar("$Leader");
if (this.LeaderUtils.Owner == null && flLeader > 0)
{
EntityPlayer entityPlayer = (EntityPlayer)this.world.GetEntity((int)flLeader);
if (entityPlayer != null)
{
this.LeaderUtils.Owner = entityPlayer;
}
}
bool cannotRespawn = true;
bool respawnAtBedroll = false;
if (flLeader > 0)
{
if (this.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("npc")) &&
!this.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("temp")) /*&&
!this.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("allyanimal"))*/
)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2");
blEntityClass = true;
cannotRespawn = false;
}
}
if (this.Buffs.HasBuff("FuriousRamsayTemp"))
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2a1");
cannotRespawn = true;
blEntityClass = false;
}
if ((this.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("bedrollSpawn")))
)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2a2");
respawnAtBedroll = true;
}
float flEntityRespawn = this.Buffs.GetCustomVar("$FR_NPC_Respawn");
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal flEntityRespawn: " + flEntityRespawn);
Vector3 respawnPosition = new Vector3(0, 0, 0);
Vector3 respawnRotation = new Vector3(0, 0, 0);
if (flEntityRespawn == 0)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal flEntityRespawn IS 0");
bool letDie = false;
if (cannotRespawn)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal Let Die");
letDie = true;
}
if (blEntityClass || respawnAtBedroll)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2a2");
if (!this.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("allyanimal,zombieCompanion,skeletonCompanion")))
{
foreach (hireInfo hire in playerHires)
{
if (hire.hireID == this.entityId && hire.reSpawnPosition != new Vector3(0, 0, 0))
{
respawnPosition = hire.reSpawnPosition;
respawnRotation = hire.reSpawnRotation;
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal respawnPosition: " + respawnPosition + "[" + this.EntityName + "]");
break;
}
}
}
if (respawnPosition == new Vector3(0, 0, 0))
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2c");
if (this.LeaderUtils.Owner)
{
if (this.LeaderUtils.Owner.IsSpawned())
{
EntityPlayer entityPlayer = this.world.GetEntity(this.LeaderUtils.Owner.entityId) as EntityPlayer;
if (entityPlayer != null)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2c-1");
SpawnPosition spawnPoint = RebirthUtilities.GetSpawnPoint(entityPlayer);
if (spawnPoint.IsUndef())
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2c-2");
respawnPosition = this.position; // Vector3.zero;
respawnRotation.y = this.rotation.y;
//letDie = true;
/*if (this.IsDead() && this.Buffs.GetCustomVar("$died") == 0f && this.EntityClass.Properties.Values.ContainsKey("SpawnBlock"))
{
this.Buffs.SetCustomVar("$died", 1f);
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7c");
string itemName = "FuriousRamsaySpawnCube" + this.EntityClass.Properties.Values["SpawnBlock"];
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7d, itemName: " + itemName);
var item = ItemClass.GetItem(itemName);
if (item != null)
{
//Log.Out("DialogActionNPCActionRebirth-PerformAction 7e");
var itemStack = new ItemStack(item, 1);
if (!entityPlayer.inventory.AddItem(itemStack))
{
entityPlayer.bag.AddItem(itemStack);
}
}
}*/
}
else
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2c-3, respawnPosition: " + respawnPosition);
respawnPosition = spawnPoint.position;
respawnRotation.y = this.rotation.y;
//RebirthManager.UpdateHireInfo(this.entityId, "reSpawnPosition", "", respawnPosition.ToString(), new Vector3(0, this.rotation.y, 0).ToString());
}
}
else
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2c-4");
}
}
else
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2c-5");
}
}
else
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 2c-6");
respawnPosition = this.position;
respawnRotation.y = this.rotation.y;
letDie = true;
}
}
}
if (((this.Health - _dmResponse.Strength) <= 0) && blEntityClass && !cannotRespawn)
{
if (letDie == true)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 3a");
if (!HasAnyTags(FastTags<TagGroup.Global>.Parse("bedrollSpawn")))
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 3b");
RebirthManager.RemoveHire(this.entityId);
}
base.ProcessDamageResponseLocal(_dmResponse);
return;
}
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 3");
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal DIED");
this.Buffs.SetCustomVar("$FR_NPC_Respawn", 1);
this.Buffs.SetCustomVar("$FR_NPC_RespawnCommandActivation", 1);
//this.Buffs.SetCustomVar("$FR_NPC_RespawnNav", 1);
this.factionId = FactionManager.Instance.GetFactionByName("trader").ID;
this.guardPosition = Vector3.zero;
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal SET TO STAY");
this.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Stay);
this.Buffs.AddBuff("FuriousRamsayRespawned");
this.Buffs.AddBuff("FuriousRamsayResistFireShockSmoke");
this.Health = 1;
this.markedForUnload = false;
this.bDead = false;
if (this.emodel.HasRagdoll())
{
this.emodel.DoRagdoll(_dmResponse, 999999f);
}
else
{
this.emodel.avatarController.TriggerEvent("DeathTrigger");
}
PlayOneShot(soundDeath);
attackTarget = null;
attackTargetTime = 0;
RebirthManager.UpdateHireInfo(this.entityId, "order", "guard", Vector3.zero.ToString(), Vector3.zero.ToString());
GameManager.Instance.StartCoroutine(RebirthUtilities.delayRespawn(this, respawnPosition, respawnRotation));
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal REPOSITION");
RebirthManager.UpdateHireInfo(this.entityId, "order", "stay", respawnPosition.ToString(), this.rotation.ToString());
bool foundHire = false;
foreach (chunkObservers observer in observers)
{
if (observer.entityID == this.entityId)
{
foundHire = true;
break;
}
}
if (!foundHire)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal ADDED CHUNK OBSERVER for: " + this.entityId);
ChunkManager.ChunkObserver observerRef = GameManager.Instance.AddChunkObserver(respawnPosition, false, 3, -1);
observers.Add(new chunkObservers(this.entityId, observerRef));
}
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal HAS OWNER B: " + (this.LeaderUtils.Owner != null));
return;
}
else
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 8");
if (((this.Health - _dmResponse.Strength) <= 0))
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 9");
bool dontRespawn = false;
if (this.spawnerSource == EnumSpawnerSource.Dynamic)
{
dontRespawn = true;
}
if (this.LeaderUtils.Owner && !dontRespawn)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 10");
if (this.LeaderUtils.Owner.IsSpawned())
{
EntityPlayer entityPlayer = this.world.GetEntity(this.LeaderUtils.Owner.entityId) as EntityPlayer;
if (entityPlayer != null)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 11");
SpawnPosition spawnPoint = RebirthUtilities.GetSpawnPoint(entityPlayer);
if (spawnPoint.IsUndef())
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 12");
RebirthManager.UpdateHireInfo(this.entityId, "reSpawnPosition", "", Vector3.zero.ToString(), new Vector3(0, this.rotation.y, 0).ToString());
dontRespawn = true;
}
else
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 13");
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal cannotRespawn: " + cannotRespawn);
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal respawnAtBedroll: " + respawnAtBedroll);
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal dontRespawn: " + dontRespawn);
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal spawnPoint.position: " + spawnPoint.position);
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal entityPlayer.position: " + entityPlayer.position);
if (cannotRespawn && respawnAtBedroll && !dontRespawn)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 14A");
if (this.LeaderUtils.Owner)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 14B");
this.LeaderUtils.Owner.Companions.Remove(this);
}
RebirthManager.UpdateHireInfo(this.entityId, "order", "stay", spawnPoint.position.ToString(), this.rotation.ToString());
//RebirthManager.UpdateHireInfo(this.entityId, "reSpawnPosition", "", spawnPoint.position.ToString(), new Vector3(0, this.rotation.y, 0).ToString());
}
}
}
}
else
{
if (this.Buffs.HasCustomVar("$SpawnPoint_X"))
{
float spawnPointX = this.Buffs.GetCustomVar("$SpawnPoint_X");
float spawnPointY = this.Buffs.GetCustomVar("$SpawnPoint_Y");
float spawnPointZ = this.Buffs.GetCustomVar("$SpawnPoint_Z");
Vector3 spawnPoint = new Vector3(spawnPointX, spawnPointY, spawnPointZ);
if (cannotRespawn && respawnAtBedroll && !dontRespawn)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 14B");
RebirthManager.UpdateHireInfo(this.entityId, "order", "stay", spawnPoint.ToString(), this.rotation.ToString());
RebirthManager.UpdateHireInfo(this.entityId, "reSpawnPosition", "", spawnPoint.ToString(), new Vector3(0, this.rotation.y, 0).ToString());
}
}
}
}
if (cannotRespawn && (!respawnAtBedroll || dontRespawn))
{
this.bWillRespawn = false;
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal 16");
for (int i = 0; i < observers.Count; i++)
{
if (observers[i].entityID == this.entityId)
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal REMOVED OBSERVER, hire: " + this.entityId);
GameManager.Instance.RemoveChunkObserver(observers[i].observerRef);
observers.RemoveAt(i);
break;
}
}
if (this.LeaderUtils.Owner && !HasAnyTags(FastTags<TagGroup.Global>.Parse("bedrollSpawn")))
{
//Log.Out("EntityNPCRebirth-ProcessDamageResponseLocal REMOVED HIRE/OWNED ENTITY, hire: " + this.entityId);
RebirthManager.RemoveHire(this.entityId);
}
}
}
base.ProcessDamageResponseLocal(_dmResponse);
this.Buffs.AddBuff("FuriousRamsayHit");
}
}
}
}

View File

@@ -0,0 +1,509 @@
public class EntityNotEnemySDX : EntityCoreSDX
{
public override void Awake()
{
base.Awake();
}
public override void InitCommon()
{
base.InitCommon();
if (this.walkType == 4)
{
this.TurnIntoCrawler();
}
}
public override void OnAddedToWorld()
{
base.OnAddedToWorld();
this.timeToDie = this.world.worldTime + 1800UL + (ulong)(22000f * this.rand.RandomFloat);
if (this.IsFeral && base.GetSpawnerSource() == EnumSpawnerSource.Biome)
{
int num = (int)SkyManager.GetDawnTime();
int num2 = (int)SkyManager.GetDuskTime();
int num3 = GameUtils.WorldTimeToHours(this.WorldTimeBorn);
if (num3 < num || num3 >= num2)
{
int num4 = GameUtils.WorldTimeToDays(this.world.worldTime);
if (GameUtils.WorldTimeToHours(this.world.worldTime) >= num2)
{
num4++;
}
this.timeToDie = GameUtils.DayTimeToWorldTime(num4, num, 0);
}
}
}
public override void OnUpdateLive()
{
try
{
base.OnUpdateLive();
}
catch (Exception ex)
{
Log.Out("EntityNotEnemySDX-OnUpdateLive ERROR: " + ex.Message);
}
if (this.moveSpeedRagePer > 0f && this.bodyDamage.CurrentStun == EnumEntityStunType.None)
{
this.moveSpeedScaleTime -= 0.05f;
if (this.moveSpeedScaleTime <= 0f)
{
this.StopRage();
}
}
if (!this.isEntityRemote)
{
if (!this.IsDead() && this.world.worldTime >= this.timeToDie && !this.attackTarget)
{
this.Kill(DamageResponse.New(true));
}
if (this.emodel)
{
AvatarController avatarController = this.emodel.avatarController;
if (avatarController)
{
bool flag = this.onGround || this.isSwimming || this.bInElevator;
if (flag)
{
this.fallTime = 0f;
this.fallThresholdTime = 0f;
if (this.bInElevator)
{
this.fallThresholdTime = 0.6f;
}
}
else
{
if (this.fallThresholdTime == 0f)
{
this.fallThresholdTime = 0.1f + this.rand.RandomFloat * 0.3f;
}
this.fallTime += 0.05f;
}
bool canFall = !this.emodel.IsRagdollActive && this.bodyDamage.CurrentStun == EnumEntityStunType.None && !this.isSwimming && !this.bInElevator && this.jumpState == EntityAlive.JumpState.Off && !this.IsDead();
if (this.fallTime <= this.fallThresholdTime)
{
canFall = false;
}
avatarController.SetFallAndGround(canFall, flag);
}
}
}
}
public override Ray GetLookRay()
{
Ray result;
if (base.IsBreakingBlocks)
{
result = new Ray(this.position + new Vector3(0f, this.GetEyeHeight(), 0f), this.GetLookVector());
}
else if (base.GetWalkType() == 8)
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
else
{
result = new Ray(this.getHeadPosition(), this.GetLookVector());
}
return result;
}
public override Vector3 GetLookVector()
{
if (this.lookAtPosition.Equals(Vector3.zero))
{
return base.GetLookVector();
}
return this.lookAtPosition - this.getHeadPosition();
}
public override bool IsRunning
{
get
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
return GamePrefs.GetInt(eProperty) >= 2;
}
}
public override float GetMoveSpeedAggro()
{
EnumGamePrefs eProperty = EnumGamePrefs.ZombieMove;
if (this.IsBloodMoon)
{
eProperty = EnumGamePrefs.ZombieBMMove;
}
else if (this.IsFeral)
{
eProperty = EnumGamePrefs.ZombieFeralMove;
}
else if (this.world.IsDark())
{
eProperty = EnumGamePrefs.ZombieMoveNight;
}
int @int = GamePrefs.GetInt(eProperty);
float num = EntityNotEnemySDX.moveSpeeds[@int];
if (this.moveSpeedRagePer > 1f)
{
num = EntityNotEnemySDX.moveSuperRageSpeeds[@int];
}
else if (this.moveSpeedRagePer > 0f)
{
float num2 = EntityNotEnemySDX.moveRageSpeeds[@int];
num = num * (1f - this.moveSpeedRagePer) + num2 * this.moveSpeedRagePer;
}
if (num < 1f)
{
num = this.moveSpeedAggro * (1f - num) + this.moveSpeedAggroMax * num;
}
else
{
num = this.moveSpeedAggroMax * num;
}
return EffectManager.GetValue(PassiveEffects.RunSpeed, null, num, this, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
}
public override float getNextStepSoundDistance()
{
if (!this.IsRunning)
{
return 0.5f;
}
return 1.5f;
}
public override void MoveEntityHeaded(Vector3 _direction, bool _isDirAbsolute)
{
if (this.walkType == 4 && this.Jumping)
{
this.motion = this.accumulatedRootMotion;
this.accumulatedRootMotion = Vector3.zero;
this.IsRotateToGroundFlat = true;
if (this.moveHelper != null)
{
Vector3 vector = this.moveHelper.JumpToPos - this.position;
if (Utils.FastAbs(vector.y) < 0.2f)
{
this.motion.y = vector.y * 0.2f;
}
if (Utils.FastAbs(vector.x) < 0.3f)
{
this.motion.x = vector.x * 0.2f;
}
if (Utils.FastAbs(vector.z) < 0.3f)
{
this.motion.z = vector.z * 0.2f;
}
if (vector.sqrMagnitude < 0.010000001f)
{
if (this.emodel && this.emodel.avatarController)
{
this.emodel.avatarController.StartAnimationJump(AnimJumpMode.Land);
}
this.Jumping = false;
}
}
this.entityCollision(this.motion);
return;
}
base.MoveEntityHeaded(_direction, _isDirAbsolute);
}
public override void UpdateJump()
{
if (this.walkType == 4 && !this.isSwimming)
{
base.FaceJumpTo();
this.jumpState = EntityAlive.JumpState.Climb;
if (!this.emodel.avatarController || !this.emodel.avatarController.IsAnimationJumpRunning())
{
this.Jumping = false;
}
if (this.jumpTicks == 0 && this.accumulatedRootMotion.y > 0.005f)
{
this.jumpTicks = 30;
}
return;
}
base.UpdateJump();
if (this.isSwimming)
{
return;
}
this.accumulatedRootMotion.y = 0f;
}
public override void EndJump()
{
base.EndJump();
this.IsRotateToGroundFlat = false;
}
public override bool ExecuteFallBehavior(EntityAlive.FallBehavior behavior, float _distance, Vector3 _fallMotion)
{
if (behavior == null || !this.emodel)
{
return false;
}
AvatarController avatarController = this.emodel.avatarController;
if (!avatarController)
{
return false;
}
avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.FallBehavior.Op.None:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, -1);
break;
case EntityAlive.FallBehavior.Op.Land:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 0);
break;
case EntityAlive.FallBehavior.Op.LandLow:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 1);
break;
case EntityAlive.FallBehavior.Op.LandHard:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 2);
break;
case EntityAlive.FallBehavior.Op.Stumble:
avatarController.UpdateInt(AvatarController.jumpLandResponseHash, 3);
break;
case EntityAlive.FallBehavior.Op.Ragdoll:
this.emodel.DoRagdoll(this.rand.RandomFloat * 2f, EnumBodyPartHit.None, _fallMotion * 20f, Vector3.zero, false);
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet() && this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand)))
{
avatarController.StartAnimationRaging();
}
return true;
}
public override bool ExecuteDestroyBlockBehavior(EntityAlive.DestroyBlockBehavior behavior, ItemActionAttack.AttackHitInfo attackHitInfo)
{
if (behavior == null || attackHitInfo == null || this.moveHelper == null || this.emodel == null || this.emodel.avatarController == null)
{
return false;
}
if (this.walkType == 4)
{
return false;
}
this.moveHelper.ClearBlocked();
this.moveHelper.ClearTempMove();
this.emodel.avatarController.UpdateInt("RandomSelector", this.rand.RandomRange(0, 64));
switch (behavior.ResponseOp)
{
case EntityAlive.DestroyBlockBehavior.Op.Ragdoll:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThroughRagdoll, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThroughRagdoll);
break;
case EntityAlive.DestroyBlockBehavior.Op.Stumble:
this.emodel.avatarController.BeginStun(EnumEntityStunType.StumbleBreakThrough, EnumBodyPartHit.LeftLowerLeg, Utils.EnumHitDirection.None, false, 1f);
base.SetStun(EnumEntityStunType.StumbleBreakThrough);
this.bodyDamage.StunDuration = 1f;
break;
}
if (this.attackTarget != null && behavior.RagePer.IsSet() && behavior.RageTime.IsSet())
{
this.StartRage(behavior.RagePer.Random(this.rand), behavior.RageTime.Random(this.rand));
}
return true;
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float impulseScale)
{
if (_damageSource.GetDamageType() == EnumDamageTypes.Falling)
{
_strength = (_strength + 1) / 2;
int num = (this.GetMaxHealth() + 2) / 3;
if (_strength > num)
{
_strength = num;
}
}
return base.DamageEntity(_damageSource, _strength, _criticalHit, impulseScale);
}
public override void ProcessDamageResponseLocal(DamageResponse _dmResponse)
{
base.ProcessDamageResponseLocal(_dmResponse);
if (!this.isEntityRemote)
{
int @int = GameStats.GetInt(EnumGameStats.GameDifficulty);
float num = (float)_dmResponse.Strength / 40f;
if (num > 1f)
{
num = Mathf.Pow(num, 0.29f);
}
float num2 = EntityNotEnemySDX.rageChances[@int] * num;
if (this.rand.RandomFloat < num2)
{
if (this.rand.RandomFloat < EntityNotEnemySDX.superRageChances[@int])
{
this.StartRage(2f, 30f);
this.PlayOneShot(this.GetSoundAlert(), false);
return;
}
this.StartRage(0.5f + this.rand.RandomFloat * 0.5f, 4f + this.rand.RandomFloat * 6f);
}
}
}
public bool StartRage(float speedPercent, float time)
{
if (speedPercent >= this.moveSpeedRagePer)
{
this.moveSpeedRagePer = speedPercent;
this.moveSpeedScaleTime = time;
return true;
}
return false;
}
public void StopRage()
{
this.moveSpeedRagePer = 0f;
this.moveSpeedScaleTime = 0f;
}
public override Vector3i dropCorpseBlock()
{
if (this.lootContainer != null && this.lootContainer.IsUserAccessing())
{
return Vector3i.zero;
}
Vector3i vector3i = base.dropCorpseBlock();
if (vector3i == Vector3i.zero)
{
return Vector3i.zero;
}
TileEntityLootContainer tileEntityLootContainer = this.world.GetTileEntity(0, vector3i) as TileEntityLootContainer;
if (tileEntityLootContainer == null)
{
return Vector3i.zero;
}
if (this.lootContainer != null)
{
tileEntityLootContainer.CopyLootContainerDataFromOther(this.lootContainer);
}
else
{
tileEntityLootContainer.lootListName = this.lootListOnDeath;
tileEntityLootContainer.SetContainerSize(LootContainer.GetLootContainer(this.lootListOnDeath, true).size, true);
}
tileEntityLootContainer.SetModified();
return vector3i;
}
public override void AnalyticsSendDeath(DamageResponse _dmResponse)
{
DamageSource source = _dmResponse.Source;
if (source == null)
{
return;
}
string name;
if (source.BuffClass != null)
{
name = source.BuffClass.Name;
}
else
{
if (source.ItemClass == null)
{
return;
}
name = source.ItemClass.Name;
}
GameSparksCollector.IncrementCounter(GameSparksCollector.GSDataKey.ZombiesKilledBy, name, 1, true, GameSparksCollector.GSDataCollection.SessionUpdates);
}
public override void TurnIntoCrawler()
{
BoxCollider component = base.gameObject.GetComponent<BoxCollider>();
if (component)
{
component.center = new Vector3(0f, 0.35f, 0f);
component.size = new Vector3(0.8f, 0.8f, 0.8f);
}
base.SetupBounds();
this.boundingBox.center = this.boundingBox.center + this.position;
this.bCanClimbLadders = false;
}
public override void BuffAdded(BuffValue _buff)
{
if (_buff.BuffClass.DamageType == EnumDamageTypes.Electrical)
{
this.Electrocuted = true;
}
}
public ulong timeToDie;
private float moveSpeedRagePer;
private float moveSpeedScaleTime;
private float fallTime;
private float fallThresholdTime;
private static float[] moveSpeeds = new float[]
{
0f,
0.35f,
0.7f,
1f,
1.35f
};
private static float[] moveRageSpeeds = new float[]
{
0.75f,
0.8f,
0.9f,
1.15f,
1.7f
};
private static float[] moveSuperRageSpeeds = new float[]
{
0.88f,
0.92f,
1f,
1.2f,
1.7f
};
private static float[] rageChances = new float[]
{
0f,
0.15f,
0.3f,
0.35f,
0.4f,
0.5f
};
private static float[] superRageChances = new float[]
{
0f,
0.01f,
0.03f,
0.05f,
0.08f,
0.15f
};
}

View File

@@ -0,0 +1,26 @@

public class EntityTraderRebirth : EntityTrader
{
public override bool OnEntityActivated(int _indexInBlockActivationCommands, Vector3i _tePos, EntityAlive _entityFocusing)
{
_entityFocusing.Buffs.SetCustomVar("CurrentNPC", entityId);
return base.OnEntityActivated(_indexInBlockActivationCommands, _tePos, _entityFocusing);
}
public override void OnUpdateLive()
{
if (
!RebirthUtilities.ScenarioSkip() && !this.EntityClass.entityClassName.ToLower().Contains("poppy_poi_") ||
RebirthUtilities.ScenarioSkip() && this.EntityClass.entityClassName.ToLower().Contains("poppy_poi_") ||
this.EntityClass.entityClassName.ToLower() == "briston_poi_fr" || this.EntityClass.entityClassName.ToLower().Contains("tradermercenary_poi")
)
{
base.OnUpdateLive();
}
else
{
RebirthUtilities.DespawnEntity(this);
}
}
}

View File

@@ -0,0 +1,137 @@
public class EntityVHelicopterRebirth : EntityVehicleRebirth
{
public override void Init(int _entityClass)
{
//Log.Out("EntityVHelicopterRebirth-Init START");
base.Init(_entityClass);
Transform meshTransform = this.vehicle.GetMeshTransform();
this.topPropT = meshTransform.Find("Origin/TopPropellerJoint");
this.rearPropT = meshTransform.Find("Origin/BackPropellerJoint");
}
public override void PhysicsInputMove()
{
//Log.Out("EntityVHelicopterRebirth-PhysicsInputMove START");
if (this.vehicle.GetFuelPercent() == 0f)
{
//Log.Out("EntityVHelicopterRebirth-PhysicsInputMove 1");
return;
}
if (this.vehicle.FindPart("engine").IsBroken())
{
//Log.Out("EntityVHelicopterRebirth-PhysicsInputMove 2");
return;
}
float deltaTime = Time.deltaTime;
this.vehicleRB.velocity *= 0.995f;
this.vehicleRB.velocity += new Vector3(0f, -0.002f, 0f);
this.vehicleRB.angularVelocity *= 0.97f;
if (this.movementInput != null)
{
//Log.Out("EntityVHelicopterRebirth-PhysicsInputMove 3");
this.vehicleRB.AddForce(0f, Mathf.Lerp(0.1f, 1.005f, this.topRPM / 3f) * -Physics.gravity.y * deltaTime, 0f, (ForceMode)2);
float num = 1f;
if (this.movementInput.running)
{
num *= 6f;
}
this.wheelMotor = this.movementInput.moveForward;
this.vehicleRB.AddRelativeForce(0f, 0f, this.wheelMotor * num * 0.1f, (ForceMode)2);
float num2;
if (this.movementInput.lastInputController)
{
num2 = this.movementInput.moveStrafe * num;
}
else
{
num2 = this.movementInput.moveStrafe * num;
}
this.vehicleRB.AddRelativeTorque(0f, num2 * 0.03f, 0f, (ForceMode)2);
if (this.movementInput.jump)
{
this.vehicleRB.AddRelativeForce(0f, 0.03f * num, 0f, (ForceMode)2);
this.vehicleRB.AddRelativeTorque(-0.01f, 0f, 0f, (ForceMode)2);
}
if (this.movementInput.down)
{
this.vehicleRB.AddRelativeForce(0f, -0.03f * num, 0f, (ForceMode)2);
this.vehicleRB.AddRelativeTorque(0.01f, 0f, 0f, (ForceMode)2);
}
}
if (base.HasDriver)
{
//Log.Out("EntityVHelicopterRebirth-PhysicsInputMove 4");
this.topRPM += 0.6f * deltaTime;
this.topRPM = Mathf.Min(this.topRPM, 3f);
return;
}
this.topRPM *= 0.99f;
}
protected void SetWheelsForces(float motorTorque, float brakeTorque)
{
//Log.Out("EntityVHelicopterRebirth-SetWheelsForces START");
if (this.vehicle.GetFuelPercent() == 0f)
{
//Log.Out("EntityVHelicopterRebirth-SetWheelsForces 1");
return;
}
if (this.vehicle.FindPart("engine").IsBroken())
{
//Log.Out("EntityVHelicopterRebirth-SetWheelsForces 2");
return;
}
//Log.Out("EntityVHelicopterRebirth-SetWheelsForces this.wheels.Length: " + this.wheels.Length);
for (int i = 0; i < this.wheels.Length; i++)
{
EntityVehicle.Wheel wheel = this.wheels[i];
wheel.wheelC.motorTorque = motorTorque;
wheel.wheelC.brakeTorque = 0f;
}
}
public override void UpdateWheelsSteering()
{
//Log.Out("EntityVHelicopterRebirth-UpdateWheelsSteering START");
this.wheels[0].wheelC.steerAngle = this.wheelDir;
}
public override void Update()
{
//Log.Out("EntityVHelicopterRebirth-SetWheelsForces START");
base.Update();
if (this.vehicle.GetFuelPercent() == 0f)
{
//Log.Out("EntityVHelicopterRebirth-Update 1");
return;
}
if (this.vehicle.FindPart("engine").IsBroken())
{
//Log.Out("EntityVHelicopterRebirth-Update 2");
return;
}
if (base.HasDriver && this.rearPropT)
{
Vector3 localEulerAngles = this.rearPropT.localEulerAngles;
localEulerAngles.z += 2880f * Time.deltaTime;
this.rearPropT.localEulerAngles = localEulerAngles;
}
if (this.topRPM > 0.1f && this.topPropT)
{
Vector3 localEulerAngles2 = this.topPropT.localEulerAngles;
localEulerAngles2.y += this.topRPM * 360f * Time.deltaTime;
this.topPropT.localEulerAngles = localEulerAngles2;
}
}
private const float cTopRPMMax = 3f;
private Transform topPropT;
private float topRPM;
private Transform rearPropT;
}

View File

@@ -0,0 +1,827 @@
using System.Collections.Generic;
public class EntityWraith : EntityFlying
{
public override void FireEvent(MinEventTypes _eventType, bool useInventory = true)
{
bool applyBlockDamageBuffs = false;
if (_eventType == MinEventTypes.onSelfDamagedOther)
{
//Log.Out("EntityAlivePatches-FireEvent WRAITH DAMAGED OTHER");
this.Buffs.AddBuff("FuriousRamsayWraithProtection");
this.Buffs.SetCustomVar("$FuriousRamsayAttacked", 0f);
}
else if (_eventType == MinEventTypes.onSelfRangedBurstShotStart)
{
//Log.Out("EntityAlivePatches-FireEvent WRAITH BURST SHOT OTHER");
this.Buffs.AddBuff("FuriousRamsayWraithProtection");
this.Buffs.SetCustomVar("$FuriousRamsayAttacked", 1f);
}
else if (_eventType == MinEventTypes.onSelfAttackedOther)
{
//Log.Out("EntityAlivePatches-FireEvent WRAITH ATTACKED OTHER");
this.Buffs.AddBuff("FuriousRamsayWraithProtection");
float attacks = this.Buffs.GetCustomVar("$FuriousRamsayAttacked") - 2f;
if (attacks < 0f)
{
attacks = 0f;
}
this.Buffs.SetCustomVar("$FuriousRamsayAttacked", attacks);
}
else if (_eventType == MinEventTypes.onSelfDamagedBlock)
{
//Log.Out("EntityAlivePatches-FireEvent WRAITH DAMAGED BLOCK");
applyBlockDamageBuffs = true;
}
else if (_eventType == MinEventTypes.onSelfDestroyedBlock)
{
//Log.Out("EntityAlivePatches-FireEvent WRAITH DESTROYED BLOCK");
applyBlockDamageBuffs = true;
}
else if (_eventType == MinEventTypes.onSelfPrimaryActionUpdate ||
_eventType == MinEventTypes.onSelfSecondaryActionUpdate
)
{
}
else
{
//Log.Out("EntityAlivePatches-FireEvent _eventType: " + _eventType);
}
if (applyBlockDamageBuffs)
{
//Log.Out("EntityAlivePatches-FireEvent ADD BLOCK BUFF");
this.Buffs.AddBuff("FuriousRamsayWraithProtectionBlocks");
}
if (_eventType == MinEventTypes.onOtherDamagedSelf)
{
float attacks = this.Buffs.GetCustomVar("$FuriousRamsayAttacked") + 1f;
this.Buffs.SetCustomVar("$FuriousRamsayAttacked", attacks);
if (attacks >= 4f)
{
this.Buffs.RemoveBuff("FuriousRamsayWraithProtection");
this.Buffs.RemoveBuff("FuriousRamsayWraithProtectionBlocks");
}
}
base.FireEvent(_eventType, useInventory);
}
public override string EntityName
{
get
{
return this.entityName;
}
}
public override void OnUpdateLive()
{
if (this.bDead)
{
if (this.lootContainer != null)
{
if (this.lootContainer.bTouched && this.lootContainer.IsEmpty())
{
this.MarkToUnload();
this.KillLootContainer();
}
}
}
base.OnUpdateLive();
}
public override void Awake()
{
base.Awake();
this.state = EntityWraith.State.WanderStart;
}
public override void Init(int _entityClass)
{
base.Init(_entityClass);
this.Init();
}
public override void InitFromPrefab(int _entityClass)
{
base.InitFromPrefab(_entityClass);
this.Init();
}
private void Init()
{
this.isRadiated = EntityClass.list[this.entityClass].Properties.Values.ContainsKey("Radiated");
this.battleFatigueSeconds = 30f + this.rand.RandomFloat * 60f;
}
public override void SetSleeper()
{
base.SetSleeper();
this.sorter = new EAISetNearestEntityAsTargetSorter(this);
base.setHomeArea(new Vector3i(this.position), (int)this.sleeperSightRange + 1);
this.battleFatigueSeconds = float.MaxValue;
}
public override void updateTasks()
{
if (GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving))
{
this.aiManager.UpdateDebugName();
return;
}
if (GameStats.GetInt(EnumGameStats.GameState) == 2)
{
return;
}
base.CheckDespawn();
base.GetEntitySenses().ClearIfExpired();
bool flag = this.Buffs.HasBuff("buffShocked");
if (flag)
{
this.SetState(EntityWraith.State.Stun);
}
else
{
EntityAlive revengeTarget = base.GetRevengeTarget();
if (revengeTarget)
{
this.battleDuration = 0f;
this.isBattleFatigued = false;
base.SetRevengeTarget((EntityAlive) null);
if (revengeTarget != this.attackTarget && (!this.attackTarget || this.rand.RandomFloat < 0.5f))
{
base.SetAttackTarget(revengeTarget, 1200);
}
}
if (this.attackTarget != this.currentTarget)
{
this.currentTarget = this.attackTarget;
if (this.currentTarget)
{
this.SetState(EntityWraith.State.Attack);
this.waypoint = this.position;
this.moveUpdateDelay = 0;
this.homeCheckDelay = 400;
}
else
{
this.SetState(EntityWraith.State.AttackStop);
}
}
}
float sqrMagnitude = (this.waypoint - this.position).sqrMagnitude;
this.stateTime += 0.05f;
int num2;
switch (this.state)
{
case EntityWraith.State.Attack:
this.battleDuration += 0.05f;
break;
case EntityWraith.State.AttackReposition:
if (sqrMagnitude < 2.25f || this.stateTime >= this.stateMaxTime)
{
this.SetState(EntityWraith.State.Attack);
this.motion *= -0.2f;
this.motion.y = 0f;
}
break;
case EntityWraith.State.AttackStop:
this.ClearTarget();
this.SetState(EntityWraith.State.WanderStart);
break;
case EntityWraith.State.Home:
if (sqrMagnitude < 4f || this.stateTime > 30f)
{
this.SetState(EntityWraith.State.WanderStart);
}
else
{
num2 = this.homeSeekDelay - 1;
this.homeSeekDelay = num2;
if (num2 <= 0)
{
this.homeSeekDelay = 40;
int minXZ = 10;
if (this.stateTime > 20f)
{
minXZ = -20;
}
int maximumHomeDistance = base.getMaximumHomeDistance();
Vector3 vector = RandomPositionGenerator.CalcTowards(this, minXZ, 30, maximumHomeDistance / 2, base.getHomePosition().position.ToVector3());
if (!vector.Equals(Vector3.zero))
{
this.waypoint = vector;
this.AdjustWaypoint();
}
}
}
break;
case EntityWraith.State.Stun:
if (flag)
{
this.motion = this.rand.RandomOnUnitSphere * -0.075f;
this.motion.y = this.motion.y + -0.060000002f;
this.ModelTransform.GetComponentInChildren<Animator>().enabled = false;
return;
}
this.ModelTransform.GetComponentInChildren<Animator>().enabled = true;
this.SetState(EntityWraith.State.WanderStart);
break;
case EntityWraith.State.WanderStart:
this.homeCheckDelay = 60;
this.SetState(EntityWraith.State.Wander);
this.isCircling = (!this.IsSleeper && this.rand.RandomFloat < 0.4f);
float num3 = this.position.y;
RaycastHit raycastHit;
if (Physics.Raycast(this.position - Origin.position, Vector3.down, out raycastHit, 999f, 65536))
{
float num4 = 10f + this.rand.RandomFloat * 20f;
if (this.IsSleeper)
{
num4 *= 0.4f;
}
num3 += -raycastHit.distance + num4;
}
else
{
this.isCircling = false;
}
bool flag2 = false;
EntityPlayer entityPlayer3 = null;
EntityPlayer closestPlayer = null;
float numTarget = 200 * 200;
float numTarget2 = float.MaxValue;
for (int i = this.world.Players.list.Count - 1; i >= 0; i--)
{
EntityPlayer entityPlayer = this.world.Players.list[i];
if (!entityPlayer.IsDead() && entityPlayer.Spawned)
{
////Log.Out("FOUND PLAYER: " + entityPlayer.EntityName);
float distanceSq = entityPlayer.GetDistanceSq(this.position);
if (distanceSq < numTarget2 && distanceSq <= numTarget)
{
numTarget2 = distanceSq;
closestPlayer = entityPlayer;
}
}
}
entityPlayer3 = closestPlayer;
if (this.isCircling)
{
this.wanderChangeDelay = 120;
Vector3 right = base.transform.right;
right.y = 0f;
this.circleReverseScale = 1f;
if (this.rand.RandomFloat < 0.5f)
{
this.circleReverseScale = -1f;
right.x = -right.x;
right.z = -right.z;
}
this.circleCenter = this.position + right * (3f + this.rand.RandomFloat * 7f);
this.circleCenter.y = num3;
if (flag2)
{
this.circleCenter.x = this.circleCenter.x * 0.6f + entityPlayer3.position.x * 0.4f;
this.circleCenter.z = this.circleCenter.z * 0.6f + entityPlayer3.position.z * 0.4f;
}
}
else
{
this.wanderChangeDelay = 400;
this.waypoint = this.position;
this.waypoint.x = this.waypoint.x + (this.rand.RandomFloat * 16f - 8f);
this.waypoint.y = num3;
this.waypoint.z = this.waypoint.z + (this.rand.RandomFloat * 16f - 8f);
if (flag2)
{
this.waypoint.x = this.waypoint.x * 0.6f + entityPlayer3.position.x * 0.4f;
this.waypoint.z = this.waypoint.z * 0.6f + entityPlayer3.position.z * 0.4f;
}
this.AdjustWaypoint();
}
break;
case EntityWraith.State.Wander:
if (this.isBattleFatigued)
{
this.battleDuration -= 0.05f;
if (this.battleDuration <= 0f)
{
this.isBattleFatigued = false;
}
}
num2 = this.wanderChangeDelay - 1;
this.wanderChangeDelay = num2;
if (num2 <= 0)
{
this.SetState(EntityWraith.State.WanderStart);
}
if (this.isCircling)
{
Vector3 vector2 = this.circleCenter - this.position;
float x = vector2.x;
vector2.x = -vector2.z * this.circleReverseScale;
vector2.z = x * this.circleReverseScale;
vector2.y = 0f;
this.waypoint = this.position + vector2;
}
else if (sqrMagnitude < 1f)
{
this.SetState(EntityWraith.State.WanderStart);
}
num2 = this.targetSwitchDelay - 1;
this.targetSwitchDelay = num2;
if (num2 <= 0)
{
this.targetSwitchDelay = 40;
if (this.IsSleeper || this.rand.RandomFloat >= 0.5f)
{
EntityPlayer entityPlayer4 = this.FindTarget();
if (entityPlayer4)
{
base.SetAttackTarget(entityPlayer4, 1200);
}
}
}
break;
}
if (this.state != EntityWraith.State.Home)
{
num2 = this.homeCheckDelay - 1;
this.homeCheckDelay = num2;
if (num2 <= 0)
{
this.homeCheckDelay = 60;
if (!base.isWithinHomeDistanceCurrentPosition())
{
this.SetState(EntityWraith.State.AttackStop);
}
}
}
num2 = this.moveUpdateDelay - 1;
this.moveUpdateDelay = num2;
if (num2 <= 0)
{
this.moveUpdateDelay = 5 + this.rand.RandomRange(5);
if (this.currentTarget && this.state == EntityWraith.State.Attack)
{
this.waypoint = this.currentTarget.getHeadPosition();
this.waypoint.y = this.waypoint.y + -0.1f;
if (this.currentTarget.AttachedToEntity)
{
this.waypoint += this.currentTarget.GetVelocityPerSecond() * 0.3f;
}
Vector3 a = this.waypoint - this.position;
a.y = 0f;
a.Normalize();
this.waypoint += a * -0.6f;
}
float num5;
if (!isCourseTraversable(this.waypoint, out num5))
{
this.waypoint.y = this.waypoint.y + 2f;
if (this.state == EntityWraith.State.Attack)
{
if (this.rand.RandomFloat < 0.1f)
{
this.StartAttackReposition();
}
}
else if (this.state != EntityWraith.State.Home && this.state != EntityWraith.State.AttackReposition)
{
this.SetState(EntityWraith.State.WanderStart);
}
}
}
Vector3 a2 = this.waypoint - this.position;
float magnitude = a2.magnitude;
Vector3 vector3 = a2 * (1f / magnitude);
this.glidingPercent = 0f;
if (vector3.y > 0.57f)
{
this.accel = 0.35f;
}
else if (vector3.y < -0.34f)
{
this.accel = 0.95f;
this.glidingPercent = 1f;
}
else
{
this.accel = 0.55f;
if (this.state == EntityWraith.State.Home || this.state == EntityWraith.State.Wander)
{
this.accel = 0.8f;
if (this.isCircling)
{
this.glidingPercent = 1f;
}
}
}
if (this.attackDelay > 0)
{
this.glidingPercent = 0f;
}
if (this.currentTarget && this.currentTarget.AttachedToEntity)
{
if (this.IsBloodMoon && this.accel > 0.5f)
{
this.accel = 2.5f;
}
this.accel *= this.moveSpeedAggro;
}
else
{
this.accel *= this.moveSpeed;
}
this.motion = this.motion * 0.9f + vector3 * (this.accel * 0.1f);
this.glidingCurrentPercent = Mathf.MoveTowards(this.glidingCurrentPercent, this.glidingPercent, 0.060000002f);
this.emodel.avatarController.UpdateFloat("Gliding", this.glidingCurrentPercent);
if (this.attackDelay > 0)
{
this.attackDelay--;
}
if (this.attack2Delay > 0)
{
this.attack2Delay--;
}
float num6 = Mathf.Atan2(this.motion.x * this.motionReverseScale, this.motion.z * this.motionReverseScale) * 57.29578f;
if (this.currentTarget)
{
num2 = this.targetSwitchDelay - 1;
this.targetSwitchDelay = num2;
if (num2 <= 0)
{
this.targetSwitchDelay = 60;
if (this.state != EntityWraith.State.AttackStop)
{
EntityPlayer entityPlayer5 = this.FindTarget();
EntityPlayer closestPlayer = null;
float numTarget = 200 * 200;
float numTarget2 = float.MaxValue;
for (int i = this.world.Players.list.Count - 1; i >= 0; i--)
{
EntityPlayer entityPlayer = this.world.Players.list[i];
if (!entityPlayer.IsDead() && entityPlayer.Spawned)
{
////Log.Out("FOUND PLAYER: " + entityPlayer.EntityName);
float distanceSq = entityPlayer.GetDistanceSq(this.position);
if (distanceSq < numTarget2 && distanceSq <= numTarget)
{
numTarget2 = distanceSq;
closestPlayer = entityPlayer;
}
}
}
entityPlayer5 = closestPlayer;
if (entityPlayer5 && entityPlayer5 != this.attackTarget)
{
base.SetAttackTarget(entityPlayer5, 400);
}
}
float num7 = this.currentTarget.AttachedToEntity ? 0.1f : 0.25f;
if (this.state != EntityWraith.State.AttackReposition && this.rand.RandomFloat < num7)
{
this.StartAttackReposition();
}
}
}
if (this.currentTarget)
{
Vector3 vector4 = this.currentTarget.getHeadPosition();
vector4 += this.currentTarget.GetVelocityPerSecond() * 0.2f;
Vector3 vector5 = vector4 - this.position;
float sqrMagnitude2 = vector5.sqrMagnitude;
if ((sqrMagnitude2 > 6400f && !this.IsBloodMoon) || this.currentTarget.IsDead())
{
this.SetState(EntityWraith.State.AttackStop);
}
else if (this.state != EntityWraith.State.AttackReposition)
{
if (sqrMagnitude2 < 4f)
{
num6 = Mathf.Atan2(vector5.x, vector5.z) * 57.29578f;
}
if (this.attackDelay <= 0 && !this.isAttack2On)
{
if (sqrMagnitude2 < 0.64000005f && this.position.y >= this.currentTarget.position.y && this.position.y < vector4.y + 0.1f)
{
this.AttackAndAdjust(false);
}
else if (this.checkBlockedDelay > 0)
{
this.checkBlockedDelay--;
}
else
{
this.checkBlockedDelay = 6;
Vector3 normalized = vector5.normalized;
Ray ray = new Ray(this.position + new Vector3(0f, 0.22f, 0f) - normalized * 0.13f, normalized);
if (Voxel.Raycast(this.world, ray, 0.83f, 1082195968, 128, 0.13f))
{
this.AttackAndAdjust(true);
}
}
}
bool flag3 = false;
ItemActionVomit.ItemActionDataVomit itemActionDataVomit = this.inventory.holdingItemData.actionData[1] as ItemActionVomit.ItemActionDataVomit;
if (itemActionDataVomit != null && this.attack2Delay <= 0 && sqrMagnitude2 >= 9f)
{
float range = ((ItemActionRanged)this.inventory.holdingItem.Actions[1]).GetRange(itemActionDataVomit);
if (sqrMagnitude2 < range * range && Utils.FastAbs(Mathf.DeltaAngle(num6, this.rotation.y)) < 20f && Utils.FastAbs(Vector3.SignedAngle(vector5, base.transform.forward, Vector3.right)) < 25f)
{
flag3 = true;
}
}
if (!this.isAttack2On && flag3)
{
this.isAttack2On = true;
itemActionDataVomit.muzzle = this.emodel.GetHeadTransform();
itemActionDataVomit.numWarningsPlayed = 999;
}
if (this.isAttack2On)
{
if (!flag3)
{
this.isAttack2On = false;
}
else
{
this.motion *= 0.7f;
this.SetLookPosition(vector4);
base.Use(false);
if (itemActionDataVomit.isDone)
{
this.isAttack2On = false;
}
}
if (!this.isAttack2On)
{
if (itemActionDataVomit.numVomits > 0)
{
this.StartAttackReposition();
}
base.Use(true);
this.attack2Delay = 60;
this.SetLookPosition(Vector3.zero);
}
}
}
}
float magnitude2 = this.motion.magnitude;
if (magnitude2 < 0.02f)
{
this.motion *= 1f / magnitude2 * 0.02f;
}
base.SeekYaw(num6, 0f, 20f);
this.aiManager.UpdateDebugName();
}
public override string MakeDebugNameInfo()
{
return string.Format("\n{0} {1}\nWaypoint {2}\nTarget {3}, AtkDelay {4}, BtlTime {5}\nSpeed {6}, Motion {7}, Accel {8}", new object[]
{
this.state.ToStringCached<EntityWraith.State>(),
this.stateTime.ToCultureInvariantString("0.00"),
this.waypoint.ToCultureInvariantString(),
this.currentTarget ? this.currentTarget.name : "",
this.attackDelay,
this.battleDuration.ToCultureInvariantString("0.00"),
this.motion.magnitude.ToCultureInvariantString("0.000"),
this.motion.ToCultureInvariantString("0.000"),
this.accel.ToCultureInvariantString("0.000")
});
}
private void SetState(EntityWraith.State newState)
{
this.state = newState;
this.stateTime = 0f;
this.motionReverseScale = 1f;
}
private void AdjustWaypoint()
{
int num = 255;
Vector3i pos = new Vector3i(this.waypoint);
while (!this.world.GetBlock(pos).isair && --num >= 0)
{
this.waypoint.y = this.waypoint.y + 1f;
pos.y++;
}
this.waypoint.y = Mathf.Min(this.waypoint.y, 250f);
}
private void StartAttackReposition()
{
this.SetState(EntityWraith.State.AttackReposition);
this.stateMaxTime = this.rand.RandomRange(0.8f, 5f);
this.attackCount = 0;
this.waypoint = this.position;
this.waypoint.x = this.waypoint.x + (this.rand.RandomFloat * 8f - 4f);
this.waypoint.y = this.waypoint.y + (this.rand.RandomFloat * 4f + 3f);
this.waypoint.z = this.waypoint.z + (this.rand.RandomFloat * 8f - 4f);
this.moveUpdateDelay = 0;
this.motion = -this.motion;
if (this.rand.RandomFloat < 0.5f)
{
this.motionReverseScale = -1f;
this.motion.y = 0.2f;
}
}
private void ClearTarget()
{
base.attackTarget = (EntityAlive) null;
base.SetRevengeTarget((EntityAlive) null);
this.currentTarget = null;
}
private EntityPlayer FindTarget()
{
EntityPlayer closestPlayer = null;
float numTarget = 200 * 200;
float numTarget2 = float.MaxValue;
for (int i = this.world.Players.list.Count - 1; i >= 0; i--)
{
EntityPlayer entityPlayer = this.world.Players.list[i];
if (!entityPlayer.IsDead() && entityPlayer.Spawned)
{
////Log.Out("FOUND PLAYER: " + entityPlayer.EntityName);
float distanceSq = entityPlayer.GetDistanceSq(this.position);
if (distanceSq < numTarget2 && distanceSq <= numTarget)
{
numTarget2 = distanceSq;
closestPlayer = entityPlayer;
}
}
}
return closestPlayer;
}
public override float GetEyeHeight()
{
return 0.3f;
}
public override Vector3 GetLookVector()
{
if (this.lookAtPosition.Equals(Vector3.zero))
{
return base.GetLookVector();
}
return this.lookAtPosition - this.getHeadPosition();
}
public override int DamageEntity(
DamageSource _damageSource,
int _strength,
bool _criticalHit,
float _impulseScale)
{
//Log.Out("EntityWraith-DamageEntity START, _strength: " + _strength);
if (!this.Buffs.HasBuff("FuriousRamsayWraithProtection"))
{
//Log.Out("EntityWraith-CanDamageEntity SHIELD IS UP");
return 0;
}
return base.DamageEntity(_damageSource, _strength, _criticalHit, _impulseScale);
}
/*public override bool CanDamageEntity(int _sourceEntityId)
{
//Log.Out("EntityWraith-CanDamageEntity START");
if (!this.Buffs.HasBuff("FuriousRamsayWraithProtection"))
{
//Log.Out("EntityWraith-CanDamageEntity SHIELD IS UP");
return false;
}
Entity entity = this.world.GetEntity(_sourceEntityId);
return !entity || entity.entityClass != this.entityClass;
}*/
private void AttackAndAdjust(bool isBlock)
{
if (base.Attack(false))
{
base.Attack(true);
this.attackDelay = 18;
this.isCircling = false;
if (this.currentTarget.AttachedToEntity)
{
this.motion *= 0.7f;
}
else
{
this.motion *= 0.6f;
}
int num = this.attackCount + 1;
this.attackCount = num;
if (num >= 5 || this.rand.RandomFloat < 0.25f)
{
this.StartAttackReposition();
}
}
}
private const float cFlyingMinimumSpeed = 0.02f;
private const float cTargetDistanceClose = 0.8f;
private const float cTargetDistanceMax = 80f;
private const float cTargetAttackOffsetY = -0.1f;
private const float cVomitMinRange = 3f;
private const int cAttackDelay = 18;
private const int cCollisionMask = 1082195968;
private const float cBattleFatigueMin = 30f;
private const float cBattleFatigueMax = 90f;
private const float cBattleFatigueCooldownMin = 60f;
private const float cBattleFatigueCooldownMax = 180f;
private bool isRadiated;
private int moveUpdateDelay;
private float motionReverseScale = 1f;
private Vector3 waypoint;
private bool isCircling;
private Vector3 circleCenter;
private float circleReverseScale;
private float glidingCurrentPercent;
private float glidingPercent;
private float accel;
private EntityAlive currentTarget;
private int targetSwitchDelay;
private int homeCheckDelay;
private int homeSeekDelay;
private int wanderChangeDelay;
private int checkBlockedDelay;
private float battleDuration;
private float battleFatigueSeconds;
private bool isBattleFatigued;
private int attackDelay;
private int attackCount;
private int attack2Delay;
private bool isAttack2On;
private EAISetNearestEntityAsTargetSorter sorter;
private static List<Entity> list = new List<Entity>();
private EntityWraith.State state;
private float stateTime;
private float stateMaxTime;
protected bool isCourseTraversable(Vector3 _pos, out float _distance)
{
float num = _pos.x - this.position.x;
float num2 = _pos.y - this.position.y;
float num3 = _pos.z - this.position.z;
_distance = Mathf.Sqrt(num * num + num2 * num2 + num3 * num3);
if (_distance < 1.5f)
{
return true;
}
num /= _distance;
num2 /= _distance;
num3 /= _distance;
Bounds boundingBox = this.boundingBox;
this.collBB.Clear();
int num4 = 1;
while ((float)num4 < _distance - 1f)
{
boundingBox.center += new Vector3(num, num2, num3);
this.world.GetCollidingBounds(this, boundingBox, this.collBB);
if (this.collBB.Count > 0)
{
return false;
}
num4++;
}
return true;
}
private List<Bounds> collBB = new List<Bounds>();
private enum State
{
Attack,
AttackReposition,
AttackStop,
Home,
Stun,
WanderStart,
Wander
}
}

View File

@@ -0,0 +1,194 @@
using System.Globalization;
public class EntityZombieCopRebirth : EntityZombieSDX
{
public override string EntityName
{
get
{
return Localization.Get(this.entityName);
}
}
public override void Init(int _entityClass)
{
base.Init(_entityClass);
this.inventory.SetSlots(new ItemStack[]
{
new ItemStack(this.inventory.GetBareHandItemValue(), 1)
}, true);
}
public override void InitFromPrefab(int _entityClass)
{
base.InitFromPrefab(_entityClass);
this.inventory.SetSlots(new ItemStack[]
{
new ItemStack(this.inventory.GetBareHandItemValue(), 1)
}, true);
}
public override void CopyPropertiesFromEntityClass()
{
DynamicProperties properties = EntityClass.list[this.entityClass].Properties;
properties.ParseFloat(EntityClass.PropExplodeDelay, ref this.explodeDelay);
properties.ParseFloat(EntityClass.PropExplodeHealthThreshold, ref this.explodeHealthThreshold);
properties.ParseString(EntityClass.PropSoundExplodeWarn, ref this.warnSoundName);
properties.ParseString(EntityClass.PropSoundTick, ref this.tickSoundName);
if (this.tickSoundName != null)
{
string[] array = this.tickSoundName.Split(new char[]
{
','
});
this.tickSoundName = array[0];
if (array.Length >= 2)
{
this.tickSoundDelayStart = StringParsers.ParseFloat(array[1], 0, -1, NumberStyles.Any);
if (array.Length >= 3)
{
this.tickSoundDelayScale = StringParsers.ParseFloat(array[2], 0, -1, NumberStyles.Any);
}
}
}
base.CopyPropertiesFromEntityClass();
}
public override void OnUpdateEntity()
{
base.OnUpdateEntity();
if (this.isEntityRemote)
{
return;
}
if (!this.isPrimed && !this.IsSleeping)
{
float num = (float)this.Health;
if (num > 0f && num < (float)this.GetMaxHealth() * this.explodeHealthThreshold)
{
this.isPrimed = true;
this.ticksToStartToExplode = (int)(this.explodeDelay * 20f);
this.PlayOneShot(this.warnSoundName, false);
}
}
if (this.isPrimed && !this.IsDead())
{
if (this.ticksToStartToExplode > 0)
{
this.ticksToStartToExplode--;
if (this.ticksToStartToExplode == 0)
{
this.SpecialAttack2 = true;
this.ticksToExplode = (int)(this.explodeDelay / 5f * 1.5f * 20f);
}
}
if (this.ticksToExplode > 0)
{
this.ticksToExplode--;
if (this.ticksToExplode == 0)
{
base.NotifySleeperDeath();
this.SetModelLayer(2, false);
this.ticksToExplode = -1;
GameManager.Instance.ExplosionServer(0, base.GetPosition(), World.worldToBlockPos(base.GetPosition()), base.transform.rotation, EntityClass.list[this.entityClass].explosionData, this.entityId, 0f, false, null);
this.timeStayAfterDeath = 0;
this.SetDead();
}
}
this.tickSoundDelay -= 0.05f;
if (this.tickSoundDelay <= 0f)
{
this.tickSoundDelayStart *= this.tickSoundDelayScale;
this.tickSoundDelay = this.tickSoundDelayStart;
if (this.tickSoundDelay < 0.2f)
{
this.tickSoundDelay = 0.2f;
}
this.PlayOneShot(this.tickSoundName, false);
}
}
if (this.ticksToExplode < 0)
{
this.motion.x = this.motion.x * 0.7f;
this.motion.z = this.motion.z * 0.7f;
}
}
public override float GetMoveSpeed()
{
if (this.ticksToExplode != 0)
{
return 0f;
}
return base.GetMoveSpeed();
}
public override float GetMoveSpeedAggro()
{
if (this.ticksToExplode != 0)
{
return 0f;
}
if (this.isPrimed)
{
return this.moveSpeedAggroMax;
}
return base.GetMoveSpeedAggro();
}
public override bool IsAttackValid()
{
return !this.isPrimed && base.IsAttackValid();
}
public override void ProcessDamageResponseLocal(DamageResponse _dmResponse)
{
if (!this.isEntityRemote && _dmResponse.HitBodyPart == EnumBodyPartHit.Special)
{
bool flag = !this.isPrimed;
ItemClass itemClass = _dmResponse.Source.ItemClass;
if (itemClass != null && itemClass is ItemClassBlock)
{
flag = false;
}
if (flag)
{
this.HandlePrimingDetonator(-1f);
}
}
base.ProcessDamageResponseLocal(_dmResponse);
}
public void PrimeDetonator()
{
Detonator componentInChildren = base.gameObject.GetComponentInChildren<Detonator>(true);
if (componentInChildren != null)
{
componentInChildren.PulseRateScale = 1f;
componentInChildren.gameObject.GetComponent<Light>().color = Color.red;
componentInChildren.StartCountdown();
return;
}
Log.Out("PrimeDetonator found no Detonator component");
}
public void HandlePrimingDetonator(float overrideDelay = -1f)
{
this.PlayOneShot(this.warnSoundName, false);
this.isPrimed = true;
this.ticksToStartToExplode = (int)(((overrideDelay > 0f) ? overrideDelay : this.explodeDelay) * 20f);
this.PrimeDetonator();
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageEntityPrimeDetonatorRebirth>().Setup(this), false, -1, -1, -1, null, 192);
}
private int ticksToStartToExplode;
private int ticksToExplode;
private float explodeDelay = 5f;
private float explodeHealthThreshold = 0.4f;
private bool isPrimed;
private string warnSoundName;
private string tickSoundName;
private float tickSoundDelayStart = 1f;
private float tickSoundDelayScale = 1f;
private float tickSoundDelay;
}

View File

@@ -0,0 +1,2378 @@
using Audio;
using System.Collections.Generic;
using System.Globalization;
public class EntityZombieSDX : EntityZombie
{
public override void SetEntityName(string _name)
{
if (_name.Equals(this.entityName))
return;
string randomName = RebirthUtilities.GetRandomName(this);
if (!string.IsNullOrEmpty(randomName))
{
_name = randomName;
}
this.entityName = _name;
this.bPlayerStatsChanged |= !this.isEntityRemote;
}
public override void Write(BinaryWriter _bw, bool bNetworkWrite)
{
base.Write(_bw, bNetworkWrite);
Buffs.Write(_bw);
_bw.Write(otherTags);
_bw.Write(lootDropEntityClass);
_bw.Write(wanderingHorde);
}
public override void Read(byte _version, BinaryReader _br)
{
base.Read(_version, _br);
try
{
Buffs.Read(_br);
}
catch { }
try
{
this.otherTags = _br.ReadString();
}
catch
{
this.otherTags = "";
}
try
{
this.lootDropEntityClass = _br.ReadString();
}
catch
{
this.lootDropEntityClass = "";
}
try
{
this.wanderingHorde = _br.ReadInt32();
}
catch
{
this.wanderingHorde = 0;
}
}
/*public override Vector3i dropCorpseBlock()
{
if (this.lootContainer != null && this.lootContainer.IsUserAccessing())
return Vector3i.zero;
Vector3i _blockPos = base.dropCorpseBlock();
if (_blockPos == Vector3i.zero || !(this.world.GetTileEntity(0, _blockPos) is TileEntityLootContainer tileEntity))
return Vector3i.zero;
if (this.lootContainer != null)
{
tileEntity.CopyLootContainerDataFromOther(this.lootContainer);
}
else
{
if (RebirthUtilities.IsHordeNight())
{
this.lootListOnDeath = "";
}
tileEntity.lootListName = this.lootListOnDeath;
tileEntity.SetContainerSize(LootContainer.GetLootContainer(this.lootListOnDeath).size, true);
}
tileEntity.SetModified();
return _blockPos;
}*/
public override void dropItemOnDeath()
{
//Log.Out("EntityZombieSDX-dropItemOnDeath START");
for (int i = 0; i < this.inventory.GetItemCount(); i++)
{
ItemStack item = this.inventory.GetItem(i);
ItemClass forId = ItemClass.GetForId(item.itemValue.type);
if (forId != null && forId.CanDrop())
{
this.world.GetGameManager().ItemDropServer(item, this.position, new Vector3(0.5f, 0f, 0.5f), -1, Constants.cItemDroppedOnDeathLifetime, false);
this.inventory.SetItem(i, ItemValue.None.Clone(), 0, true);
}
}
this.inventory.SetFlashlight(false);
this.equipment.DropItems();
if (this.world.IsDark())
{
this.lootDropProb *= 1f;
}
if (this.entityThatKilledMe)
{
this.lootDropProb = EffectManager.GetValue(PassiveEffects.LootDropProb, this.entityThatKilledMe.inventory.holdingItemItemValue, this.lootDropProb, this.entityThatKilledMe, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1, false);
}
if (RebirthUtilities.IsHordeNight())
{
//Log.Out($"EntityZombieSDX-dropItemOnDeath BEFORE ({this.entityName}) this.lootDropProb: {this.lootDropProb}");
if (RebirthUtilities.ScenarioSkip())
{
string biomeName = RebirthUtilities.GetBiomeName(this);
int biomeID = 0;
if (biomeName != "")
{
biomeID = RebirthUtilities.GetBiomeID(biomeName);
}
this.lootDropProb = RebirthVariables.hiveLootbagDrop + RebirthUtilities.LootDropChance(biomeID);
}
else
{
if (!this.HasAnyTags(FastTags<TagGroup.Global>.Parse("NoLootDropChange")))
{
float customHordeNightLootDropMultiplier = 3 * float.Parse(RebirthVariables.customHordeNightLootDropMultiplier) / 100;
//Log.Out("EntityZombieSDX-dropItemOnDeath customHordeNightLootDropMultiplier: " + customHordeNightLootDropMultiplier);
if (this.lootDropProb >= 1f)
{
customHordeNightLootDropMultiplier = 1f;
//Log.Out("EntityZombieSDX-dropItemOnDeath ADJUST customHordeNightLootDropMultiplier: " + customHordeNightLootDropMultiplier);
}
if (this.HasAnyTags(FastTags<TagGroup.Global>.Parse("reducedHNloot")))
{
this.lootDropProb = this.lootDropProb * 0.25f * customHordeNightLootDropMultiplier;
//Log.Out("EntityZombieSDX-dropItemOnDeath REDUCED this.lootDropProb: " + this.lootDropProb);
}
else
{
this.lootDropProb = this.lootDropProb * 1f * customHordeNightLootDropMultiplier;
//Log.Out("EntityZombieSDX-dropItemOnDeath AFTER this.lootDropProb: " + this.lootDropProb);
}
}
}
}
else
{
//Log.Out("EntityZombieSDX-dropItemOnDeath this.wanderingHorde: " + this.wanderingHorde);
if (RebirthUtilities.ScenarioSkip() && this.wanderingHorde == 1)
{
string biomeName = RebirthUtilities.GetBiomeName(this);
int biomeID = 0;
if (biomeName != "")
{
biomeID = RebirthUtilities.GetBiomeID(biomeName);
}
this.lootDropProb = RebirthVariables.hiveLootbagDrop + RebirthUtilities.LootDropChance(biomeID);
}
else
{
if (this.lootDropProb < 1f && !(this.Buffs.GetCustomVar("$herdEntity") == 1f))
{
this.lootDropProb = 0;
}
}
}
if (this.Buffs.GetCustomVar("$varFuriousRamsayBoss") == 1f)
{
this.lootDropProb = 1;
}
//Log.Out("EntityZombieSDX-dropItemOnDeath this.lootDropProb: " + this.lootDropProb);
if (this.lootDropProb > this.rand.RandomFloat)
{
//Log.Out("EntityZombieSDX-dropItemOnDeath this.EntityTags: " + this.EntityTags);
if (!RebirthVariables.customEventsLoot && this.HasAnyTags(FastTags<TagGroup.Global>.Parse("seeker,boss")))
{
//Log.Out("EntityZombieSDX-dropItemOnDeath A");
}
else
{
//Log.Out("EntityZombieSDX-dropItemOnDeath B");
GameManager.Instance.DropContentOfLootContainerServer(BlockValue.Air, new Vector3i(this.position), this.entityId);
}
}
}
private float GetDamageFraction(float _damage)
{
return _damage / (float)this.GetMaxHealth();
}
public override DamageResponse damageEntityLocal(DamageSource _damageSource, int _strength, bool _criticalHit, float impulseScale)
{
DamageResponse damageResponse = default(DamageResponse);
damageResponse.Source = _damageSource;
damageResponse.Strength = _strength;
damageResponse.Critical = _criticalHit;
damageResponse.HitDirection = Utils.EnumHitDirection.None;
damageResponse.MovementState = this.MovementState;
damageResponse.Random = this.rand.RandomFloat;
damageResponse.ImpulseScale = impulseScale;
damageResponse.HitBodyPart = _damageSource.GetEntityDamageBodyPart(this);
damageResponse.ArmorSlot = _damageSource.GetEntityDamageEquipmentSlot(this);
damageResponse.ArmorSlotGroup = _damageSource.GetEntityDamageEquipmentSlotGroup(this);
if (_strength > 0)
{
damageResponse.HitDirection = (_damageSource.Equals(DamageSource.fall) ? Utils.EnumHitDirection.Back : ((Utils.EnumHitDirection)Utils.Get4HitDirectionAsInt(_damageSource.getDirection(), this.GetLookVector())));
}
if (!GameManager.IsDedicatedServer && _damageSource.damageSource != EnumDamageSource.Internal && GameManager.Instance != null)
{
World world = GameManager.Instance.World;
if (world != null && _damageSource.getEntityId() == world.GetPrimaryPlayerId())
{
Transform hitTransform = this.emodel.GetHitTransform(_damageSource);
Vector3 position;
if (hitTransform)
{
position = hitTransform.position;
}
else
{
position = this.emodel.transform.position;
}
bool flag = world.GetPrimaryPlayer().inventory.holdingItem.HasAnyTags(FastTags<TagGroup.Global>.Parse("ranged"));
float magnitude = (world.GetPrimaryPlayer().GetPosition() - position).magnitude;
if (flag && magnitude > EntityAlive.HitSoundDistance)
{
Manager.PlayInsidePlayerHead("HitEntitySound", -1, 0f, false);
}
if (EntityAlive.ShowDebugDisplayHit)
{
Transform transform = hitTransform ? hitTransform : this.emodel.transform;
Vector3 position2 = Camera.main.transform.position;
DebugLines.CreateAttached("EntityDamage" + this.entityId.ToString(), transform, position2 + Origin.position, _damageSource.getHitTransformPosition(), new Color(0.3f, 0f, 0.3f), new Color(1f, 0f, 1f), EntityAlive.DebugDisplayHitSize * 2f, EntityAlive.DebugDisplayHitSize, EntityAlive.DebugDisplayHitTime);
DebugLines.CreateAttached("EntityDamage2" + this.entityId.ToString(), transform, _damageSource.getHitTransformPosition(), transform.position + Origin.position, new Color(0f, 0f, 0.5f), new Color(0.3f, 0.3f, 1f), EntityAlive.DebugDisplayHitSize * 2f, EntityAlive.DebugDisplayHitSize, EntityAlive.DebugDisplayHitTime);
}
}
}
this.MinEventContext.Other = (this.world.GetEntity(damageResponse.Source.getEntityId()) as EntityAlive);
if (_damageSource.AffectedByArmor())
{
this.equipment.CalcDamage(ref damageResponse.Strength, ref damageResponse.ArmorDamage, damageResponse.Source.DamageTypeTag, this.MinEventContext.Other, damageResponse.Source.AttackingItem);
}
float num = this.GetDamageFraction((float)damageResponse.Strength);
if (damageResponse.Fatal || damageResponse.Strength >= this.Health)
{
if ((damageResponse.HitBodyPart & EnumBodyPartHit.Head) > EnumBodyPartHit.None)
{
if (num >= 0.2f)
{
damageResponse.Source.DismemberChance = Utils.FastMax(damageResponse.Source.DismemberChance * 0.5f, 0.3f);
}
}
else if (num >= 0.12f)
{
damageResponse.Source.DismemberChance = Utils.FastMax(damageResponse.Source.DismemberChance * 0.5f, 0.5f);
}
num = 1f;
}
this.CheckDismember(ref damageResponse, num);
int num2 = this.bodyDamage.StunKnee;
int num3 = this.bodyDamage.StunProne;
if ((damageResponse.HitBodyPart & EnumBodyPartHit.Head) > EnumBodyPartHit.None && damageResponse.Dismember)
{
if (this.Health > 0)
{
damageResponse.Strength = this.Health;
//Log.Out("EntityZombieSDX-damageEntityLocal HEAD DISMEMBER A");
dismemberedPart = EnumBodyPartHit.Head;
}
}
else if (_damageSource.CanStun && this.GetWalkType() != 21 && this.bodyDamage.CurrentStun != EnumEntityStunType.Prone)
{
if ((damageResponse.HitBodyPart & (EnumBodyPartHit.Torso | EnumBodyPartHit.Head | EnumBodyPartHit.LeftUpperArm | EnumBodyPartHit.RightUpperArm | EnumBodyPartHit.LeftLowerArm | EnumBodyPartHit.RightLowerArm)) > EnumBodyPartHit.None)
{
num3 += _strength;
}
else if (damageResponse.HitBodyPart.IsLeg())
{
num2 += _strength * (_criticalHit ? 2 : 1);
}
}
if ((!damageResponse.HitBodyPart.IsLeg() || !damageResponse.Dismember) && this.GetWalkType() != 21 && !this.sleepingOrWakingUp)
{
EntityClass entityClass = EntityClass.list[this.entityClass];
if (this.GetDamageFraction((float)num3) >= entityClass.KnockdownProneDamageThreshold && entityClass.KnockdownProneDamageThreshold > 0f)
{
if (this.bodyDamage.CurrentStun != EnumEntityStunType.Prone)
{
damageResponse.Stun = EnumEntityStunType.Prone;
damageResponse.StunDuration = this.rand.RandomRange(entityClass.KnockdownProneStunDuration.x, entityClass.KnockdownProneStunDuration.y);
}
}
else if (this.GetDamageFraction((float)num2) >= entityClass.KnockdownKneelDamageThreshold && entityClass.KnockdownKneelDamageThreshold > 0f && this.bodyDamage.CurrentStun != EnumEntityStunType.Prone)
{
damageResponse.Stun = EnumEntityStunType.Kneel;
damageResponse.StunDuration = this.rand.RandomRange(entityClass.KnockdownKneelStunDuration.x, entityClass.KnockdownKneelStunDuration.y);
}
}
bool flag2 = false;
int num4 = damageResponse.Strength + damageResponse.ArmorDamage / 2;
if (num4 > 0 && !this.IsGodMode.Value && damageResponse.Stun == EnumEntityStunType.None && !this.sleepingOrWakingUp)
{
flag2 = (damageResponse.Strength < this.Health);
if (flag2)
{
flag2 = (this.GetWalkType() == 21 || !damageResponse.Dismember || !damageResponse.HitBodyPart.IsLeg());
}
if (flag2 && damageResponse.Source.GetDamageType() != EnumDamageTypes.Bashing)
{
flag2 = (num4 >= 6);
}
if (damageResponse.Source.GetDamageType() == EnumDamageTypes.BarbedWire)
{
flag2 = true;
}
}
damageResponse.PainHit = flag2;
if (damageResponse.Strength >= this.Health)
{
damageResponse.Fatal = true;
}
if (damageResponse.Fatal)
{
damageResponse.Stun = EnumEntityStunType.None;
}
if (this.isEntityRemote)
{
damageResponse.ModStrength = 0;
}
else
{
if (this.Health <= damageResponse.Strength)
{
_strength -= this.Health;
}
damageResponse.ModStrength = _strength;
}
if (damageResponse.Dismember && this.IsAlive())
{
//Log.Out("EntityZombieSDX-damageEntityLocal DISMEMBER");
EntityAlive entityAlive = this.world.GetEntity(damageResponse.Source.getEntityId()) as EntityAlive;
if (entityAlive != null)
{
entityAlive.FireEvent(MinEventTypes.onDismember, true);
if (damageResponse.HitBodyPart == EnumBodyPartHit.Head)
{
dismemberedPart = EnumBodyPartHit.Head;
//Log.Out("EntityZombieSDX-damageEntityLocal HEAD DISMEMBER");
bool bRanged = entityAlive.inventory.holdingItem.ItemTags.ToString().ToLower().Contains("ranged");
bool bMelee = entityAlive.inventory.holdingItem.ItemTags.ToString().ToLower().Contains("melee");
bool bMale = this.EntityTags.ToString().ToLower().Contains("male");
bool bFemale = this.EntityTags.ToString().ToLower().Contains("female");
bool bBandit = this.EntityTags.ToString().ToLower().Contains("bandit");
bool bZombie = this.EntityTags.ToString().ToLower().Contains("zombie");
bool bEnemyRobot = this.EntityTags.ToString().ToLower().Contains("enemyrobot");
//Log.Out("EntityZombieSDX-damageEntityLocal Item Tags: " + entityAlive.inventory.holdingItem.ItemTags.ToString());
if (bZombie)
{
//Log.Out("EntityZombieSDX-damageEntityLocal ZOMBIE");
if (bRanged)
{
entityAlive.Buffs.AddBuff("FuriousRamsayDismemberedHeadRanged");
//Log.Out("EntityZombieSDX-damageEntityLocal ZOMBIE RANGED");
}
if (bMelee)
{
entityAlive.Buffs.AddBuff("FuriousRamsayDismemberedHeadRanged");
//Log.Out("EntityZombieSDX-damageEntityLocal ZOMBIE MELEE");
}
}
else if (bEnemyRobot)
{
//Log.Out("EntityZombieSDX-damageEntityLocal ENEMY ROBOT");
entityAlive.Buffs.AddBuff("FuriousRamsayDismemberedHeadEnemyRobot");
}
else if (bBandit)
{
if (bRanged)
{
entityAlive.Buffs.AddBuff("FuriousRamsayDismemberedHeadRanged");
//Log.Out("EntityZombieSDX-damageEntityLocal BANDIT RANGED");
}
if (bMelee)
{
entityAlive.Buffs.AddBuff("FuriousRamsayDismemberedHeadRanged");
//Log.Out("EntityZombieSDX-damageEntityLocal BANDIT MELEE");
}
}
}
}
}
if (this.MinEventContext.Other != null)
{
this.MinEventContext.Other.MinEventContext.DamageResponse = damageResponse;
float value = EffectManager.GetValue(PassiveEffects.HealthSteal, null, 0f, this.MinEventContext.Other, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1, false);
if (value != 0f)
{
int num5 = (int)((float)num4 * value);
if (num5 + this.MinEventContext.Other.Health <= 0)
{
num5 = (this.MinEventContext.Other.Health - 1) * -1;
}
this.MinEventContext.Other.AddHealth(num5);
if (num5 < 0 && this.MinEventContext.Other is EntityPlayerLocal)
{
((EntityPlayerLocal)this.MinEventContext.Other).ForceBloodSplatter();
}
}
}
if (damageResponse.Source.BuffClass == null)
{
this.MinEventContext.DamageResponse = damageResponse;
this.FireEvent(MinEventTypes.onOtherAttackedSelf, true);
}
this.ProcessDamageResponseLocal(damageResponse);
return damageResponse;
}
public override float GetSeeDistance()
{
//Log.Out("EntityZombieSDX-GetSeeDistance START");
this.senseScale = 1f;
if (this.IsSleeping)
{
//Log.Out("EntityZombieSDX-GetSeeDistance 1");
this.sightRange = this.sleeperSightRange;
return this.sleeperSightRange;
}
this.sightRange = this.sightRangeBase;
if (this.aiManager != null)
{
//Log.Out("EntityZombieSDX-GetSeeDistance 2");
float num = EAIManager.CalcSenseScale();
this.senseScale = 1f + num * this.aiManager.feralSense;
this.sightRange = this.sightRangeBase * this.senseScale;
}
string rebirthFeralSense = RebirthVariables.customFeralSense;
int currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
bool randomValid = rebirthFeralSense == "random" &&
currentDay == RebirthManager.nextFeralSenseDay;
if (randomValid && GameManager.Instance.World.IsDaytime() && RebirthManager.nextFeralSensePeriod == 1)
{
randomValid = false;
}
if (randomValid && !GameManager.Instance.World.IsDaytime() && RebirthManager.nextFeralSensePeriod == 2)
{
randomValid = false;
}
bool isValidFeralSense = (rebirthFeralSense == "always") ||
(GameManager.Instance.World.IsDaytime() && rebirthFeralSense == "dayonly") ||
(!GameManager.Instance.World.IsDaytime() && rebirthFeralSense == "nightonly") ||
randomValid;
string rebirthPOISense = RebirthVariables.customPOISense;
bool POISense = (rebirthPOISense == "always") ||
(GameManager.Instance.World.IsDaytime() && rebirthPOISense == "dayonly") ||
(!GameManager.Instance.World.IsDaytime() && rebirthPOISense == "nightonly");
if (isValidFeralSense || (this.IsSleeper && POISense))
{
this.sightRange = 200;
}
//Log.Out("EntityZombieSDX-GetSeeDistance this.sightRange: " + this.sightRange);
return this.sightRange;
}
public override string EntityName
{
get
{
string name = Localization.Get(this.entityName);
if (this.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("invisible")))
{
name = "";
}
return name;
}
}
public override void CopyPropertiesFromEntityClass()
{
//Log.Out("EntityZombieSDX-CopyPropertiesFromEntityClass START");
base.CopyPropertiesFromEntityClass();
EntityClass entityClass = EntityClass.list[this.entityClass];
if (entityClass.Properties.Values.ContainsKey("GamestageStart"))
{
this.gamestageStart = int.Parse(entityClass.Properties.Values["GamestageStart"]);
}
if (entityClass.Properties.Values.ContainsKey("GamestageEnd"))
{
this.gamestageEnd = int.Parse(entityClass.Properties.Values["GamestageEnd"]);
}
if (entityClass.Properties.Values.ContainsKey("MaxJumpHeight"))
{
float flJumpHeight = StringParsers.ParseFloat(entityClass.Properties.Values["MaxJumpHeight"], 0, -1, NumberStyles.Any);
flMaxJumpHeight = flJumpHeight;
}
if (entityClass.Properties.Values.ContainsKey("MaxJumpSize"))
{
float flJumpSize = StringParsers.ParseFloat(entityClass.Properties.Values["MaxJumpSize"], 0, -1, NumberStyles.Any);
flMaxJumpSize = flJumpSize;
}
if (entityClass.Properties.Values.ContainsKey("MaxBaseJumpHeight"))
{
float flBaseJumpHeight = StringParsers.ParseFloat(entityClass.Properties.Values["MaxBaseJumpHeight"], 0, -1, NumberStyles.Any);
flMaxBaseJumpHeight = flBaseJumpHeight;
}
if (entityClass.Properties.Values.ContainsKey("LeapMaxDistance"))
{
float flLeapDistance = StringParsers.ParseFloat(entityClass.Properties.Values["LeapMaxDistance"], 0, -1, NumberStyles.Any);
flLeapMaxDistance = flLeapDistance;
}
}
public override void PostInit()
{
base.PostInit();
//Log.Out(GamePrefs.GetString(EnumGamePrefs.GameMode));
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
//Log.Out("IS SINGLE PLAYER");
}
else
{
ItemValue handItem = this.GetHandItem();
if (flHandItemRangeMP > 0)
{
this.inventory.holdingItem.Actions[0].Range = flHandItemRangeMP;
}
else
{
this.inventory.holdingItem.Actions[0].Range = (float)0.98;
}
//Log.Out("IS MULTIPLAYER");
}
//Log.Out("EntityZombieSDX-PostInit Zombie Range: " + this.inventory.holdingItem.Actions[0].Range);
}
public override bool IsAttackValid()
{
//Log.Out("EntityZombieSDX-IsAttackValid 0");
if (this.emodel.IsRagdollMovement)
{
//Log.Out("EntityZombieSDX-IsAttackValid 1");
return false;
}
if (this.Electrocuted)
{
//Log.Out("EntityZombieSDX-IsAttackValid 2");
return false;
}
if (this.bodyDamage.CurrentStun == EnumEntityStunType.Kneel || this.bodyDamage.CurrentStun == EnumEntityStunType.Prone)
{
//Log.Out("EntityZombieSDX-IsAttackValid 3");
return false;
}
bool flag1 = !(this.emodel != null);
//Log.Out("EntityZombieSDX-IsAttackValid flag1: " + flag1);
bool flag2 = !(this.emodel.avatarController != null);
//Log.Out("EntityZombieSDX-IsAttackValid flag2: " + flag2);
bool flag3 = !this.emodel.avatarController.IsAttackPrevented();
//Log.Out("EntityZombieSDX-IsAttackValid flag3: " + flag3);
bool flag4 = !this.IsDead();
//Log.Out("EntityZombieSDX-IsAttackValid flag4: " + flag4);
bool flag5 = this.painResistPercent >= 1f;
//Log.Out("EntityZombieSDX-IsAttackValid flag5: " + flag5);
bool flag6 = this.hasBeenAttackedTime <= 0;
//Log.Out("EntityZombieSDX-IsAttackValid flag6: " + flag6);
bool flag7 = this.emodel.avatarController == null;
//Log.Out("EntityZombieSDX-IsAttackValid flag7: " + flag7);
bool flag8 = !this.emodel.avatarController.IsAnimationHitRunning();
//Log.Out("EntityZombieSDX-IsAttackValid flag8: " + flag8);
return (flag1 || flag2 || flag3) && flag4 && (flag5 || (flag6 && (flag7 || flag8)));
}
private Dictionary<string, Transform> particles = new Dictionary<string, Transform>();
private void ApplyLocalBodyDamage(DamageResponse _dmResponse)
{
if (_dmResponse.Dismember)
{
switch (_dmResponse.HitBodyPart)
{
case EnumBodyPartHit.Head:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 1U);
break;
case EnumBodyPartHit.LeftUpperArm:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 2U);
break;
case EnumBodyPartHit.RightUpperArm:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 8U);
break;
case EnumBodyPartHit.LeftUpperLeg:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 32U);
this.bodyDamage.ShouldBeCrawler = true;
break;
case EnumBodyPartHit.RightUpperLeg:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 128U);
this.bodyDamage.ShouldBeCrawler = true;
break;
case EnumBodyPartHit.LeftLowerArm:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 4U);
break;
case EnumBodyPartHit.RightLowerArm:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 16U);
break;
case EnumBodyPartHit.LeftLowerLeg:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 64U);
this.bodyDamage.ShouldBeCrawler = true;
break;
case EnumBodyPartHit.RightLowerLeg:
this.bodyDamage.Flags = (this.bodyDamage.Flags | 256U);
this.bodyDamage.ShouldBeCrawler = true;
break;
}
}
if (_dmResponse.TurnIntoCrawler)
{
this.bodyDamage.ShouldBeCrawler = true;
}
if (_dmResponse.CrippleLegs)
{
if (_dmResponse.HitBodyPart.IsLeftLeg())
{
this.bodyDamage.Flags = (this.bodyDamage.Flags | 4096U);
}
else if (_dmResponse.HitBodyPart.IsRightLeg())
{
this.bodyDamage.Flags = (this.bodyDamage.Flags | 8192U);
}
}
this.bodyDamage.damageType = _dmResponse.Source.damageType;
this.bodyDamage.bodyPartHit = _dmResponse.HitBodyPart;
}
public override void StartJump()
{
this.jumpState = EntityAlive.JumpState.Leap;
this.jumpStateTicks = 0;
this.jumpDistance = 1f;
this.jumpHeightDiff = 0f;
this.disableFallBehaviorUntilOnGround = true;
if (this.isSwimming)
{
this.jumpState = EntityAlive.JumpState.SwimStart;
if (this.emodel.avatarController != null)
{
this.emodel.avatarController.SetSwim(true);
return;
}
}
else if (this.emodel.avatarController != null)
{
this.emodel.avatarController.StartAnimationJump(AnimJumpMode.Start);
}
}
public override bool CanDamageEntity(int _sourceEntityId)
{
//Log.Out("SOURCE ENTITY: " + entityAlive.EntityName);
return true;
}
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale = 1f)
{
//Log.Out($"EntityZombieSDX::DamageEntity this: {this}, _damageSource creator id: {_damageSource.CreatorEntityId}, owner id: {_damageSource.ownerEntityId}, getEntityId: {_damageSource.getEntityId()}");
//Log.Out("EntityZombieSDX-DamageEntity 1: " + this.EntityClass.entityClassName);
if ((_damageSource.GetDamageType() == EnumDamageTypes.Falling))
{
//Log.Out("EntityZombieSDX-DamageEntity 2");
if (GetWeight() == 69)
{
//Log.Out("EntityZombieSDX-DamageEntity 3");
return 0;
}
else
{
//Log.Out("EntityZombieSDX-DamageEntity 4");
_strength = (_strength + 1) / 2;
int num = (GetMaxHealth() + 2) / 3;
if (_strength > num)
{
_strength = num;
}
}
}
EnumDamageSource source = _damageSource.GetSource();
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
bool flag1 = false;
//Log.Out("EntityZombieSDX-DamageEntity _damageSource.damageType: " + _damageSource.damageType);
if (_damageSource.GetDamageType() == EnumDamageTypes.None && _damageSource.AttackingItem != null)
{
//Log.Out("EntityZombieSDX-DamageEntity _damageSource.AttackingItem.ItemClass.GetItemName(): " + _damageSource.AttackingItem.ItemClass.GetItemName());
string item = _damageSource.AttackingItem.ItemClass.GetItemName().ToLower();
if (item == "auraexplosion" || item == "throwngrenadecontact")
{
flag1 = true;
}
}
if (flag)
{
flag1 = true;
}
if (flag1)
{
// Give Regen Prevention Debuff
Buffs.AddBuff("buffDamagedByExplosion");
}
if (flag && _damageSource.AttackingItem != null && _damageSource.AttackingItem.ItemClass.GetItemName() == "otherExplosion")
{
return 0;
}
EntityAlive entityAlive = world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
if (_damageSource.IsIgnoreConsecutiveDamages() && source != EnumDamageSource.Internal)
{
//Log.Out("EntityZombieSDX-DamageEntity 5");
if (damageSourceTimeouts.ContainsKey(source) && GameTimer.Instance.ticks - damageSourceTimeouts[source] < 30UL)
{
//Log.Out("EntityZombieSDX-DamageEntity 6");
return 0;
}
damageSourceTimeouts[source] = GameTimer.Instance.ticks;
}
//Log.Out("EntityZombieSDX-DamageEntity _damageSource.CreatorEntityId: " + _damageSource.CreatorEntityId);
if (entityThatKilledMeID == -1)
{
entityThatKilledMeID = _damageSource.getEntityId();
}
if (entityAlive is EntityZombieSDX)
{
string buffCompare = "FuriousRamsayRangedMindControlBuffTier";
for (int i = 0; i < entityAlive.Buffs.ActiveBuffs.Count; i++)
{
BuffValue buffValue = entityAlive.Buffs.ActiveBuffs[i];
if (buffValue != null && buffValue.BuffClass != null)
{
//Log.Out("EntityZombieSDX-DamageEntity buffValue.BuffName[" + i + "]: " + buffValue.BuffName);
if (buffValue.BuffName.ToLower().Contains(buffCompare.ToLower()))
{
//Log.Out("EntityZombieSDX-DamageEntity FOUND BUFF");
Entity instigator = world.GetEntity(buffValue.instigatorId);
if (instigator is EntityPlayer)
{
Buffs.SetCustomVar("$killedby", instigator.entityId);
//Log.Out("EntityZombieSDX-DamageEntity FOUND PLAYER");
break;
}
}
}
}
}
bool bMindControlled = Buffs.HasBuff("FuriousRamsayRangedMindControlBuffTier1") || Buffs.HasBuff("FuriousRamsayRangedMindControlBuffTier2") || Buffs.HasBuff("FuriousRamsayRangedMindControlBuffTier3");
if (entityAlive is EntityPlayer && bMindControlled)
{
//Log.Out("EntityZombieSDX-DamageEntity 7");
return 0;
}
if (!FriendlyFireCheck(entityAlive))
{
//Log.Out("EntityZombieSDX-DamageEntity 8");
return 0;
}
bool shouldAttack = RebirthUtilities.VerifyFactionStanding(this, entityAlive);
if (!shouldAttack && !(entityAlive is EntityPlayer) && entityAlive &&
!(_damageSource.damageType == EnumDamageTypes.Heat && (entityAlive.EntityClass.entityClassName.ToLower().Contains("furiousramsaykamikaze")) || entityAlive.EntityClass.entityClassName.ToLower().Contains("fatcop")))
{
//Log.Out($"EntityZombieSDX-DamageEntity !shouldAttack: {shouldAttack}");
return 0;
}
if (IsGodMode.Value)
{
//Log.Out("EntityZombieSDX-DamageEntity 10");
return 0;
}
if (entityAlive != null)
{
//Log.Out($"EntityZombieSDX-DamageEntity this: {this}, entityAlive: {entityAlive}");
float value = EffectManager.GetValue(PassiveEffects.DamageBonus, null, 0f, entityAlive, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (value > 0f)
{
//Log.Out("EntityZombieSDX-DamageEntity 12");
_damageSource.DamageMultiplier = value;
_damageSource.BonusDamageType = EnumDamageBonusType.Sneak;
}
}
bool optionCustomHeadshot = RebirthVariables.customHeadshot;
if (optionCustomHeadshot && entityAlive is EntityPlayer && !EntityClass.entityClassName.Contains("animalZombie") && !HasAnyTags(FastTags<TagGroup.Global>.Parse("noheadshot")))
{
//Log.Out("EntityZombieSDX-DamageEntity 13");
bool isTurret = false;
if (_damageSource.AttackingItem != null)
{
if (_damageSource.AttackingItem.ItemClass != null)
{
isTurret = (_damageSource.AttackingItem.ItemClass.GetItemName().Contains("JunkTurret")) && (entityAlive.inventory.holdingItem.GetItemName() != "gunBotT2JunkTurret");
}
}
//Log.Out("EntityZombieSDX-DamageEntity isTurret: " + isTurret);
if (!isTurret)
{
//Log.Out("EntityZombieSDX-DamageEntity optionCustomHeadshot: " + optionCustomHeadshot);
string className = EntityClass.entityClassName;
if (_damageSource.GetEntityDamageBodyPart(this) != EnumBodyPartHit.Head && !(_damageSource.damageType == EnumDamageTypes.Heat))
{
//Log.Out("EntityZombieSDX-DamageEntity NOT HEAD SHOT");
if (entityAlive.inventory.holdingItem.HasAnyTags(FastTags<TagGroup.Global>.Parse("ranged")))
{
_strength = (int)(_strength * 0.05);
//Log.Out("EntityZombieSDX-DamageEntity RANGED DAMAGE: " + _strength);
}
else
{
_strength = (int)(_strength * 0.025);
//Log.Out("EntityZombieSDX-DamageEntity MELEE DAMAGE: " + _strength);
}
}
else
{
//Log.Out("EntityZombieSDX-DamageEntity HEAD SHOT");
if (HasAnyTags(FastTags<TagGroup.Global>.Parse("helmet")))
{
_strength = (int)(_strength * .85);
//Log.Out("EntityZombieSDX-DamageEntity HAS HELMET, DAMAGE: " + _strength);
}
//else
//{
//Log.Out("EntityZombieSDX-DamageEntity NO HELMET, DAMAGE: " + _strength);
//}
}
}
}
DamageResponse damageResponse = damageEntityLocal(_damageSource, _strength, _criticalHit, _impulseScale);
if (Health == 0f)
{
//Log.Out("EntityZombieSDX-DamageEntity HEALTH IS ZERO");
if (entityAlive != null)
{
//Log.Out("EntityZombieSDX-DamageEntity entityAlive: " + entityAlive.EntityClass.entityClassName);
//Log.Out("EntityZombieSDX-DamageEntity entityAlive.entityId: " + entityAlive.entityId);
entityThatKilledMe = entityAlive;
}
//Log.Out("EntityZombieSDX-DamageEntity entityThatKilledMeID: " + this.entityThatKilledMeID);
EntityAlive entityKiller = world.GetEntity(entityThatKilledMeID) as EntityAlive;
if (entityKiller != null && entityKiller is EntityPlayer)
{
//Log.Out("EntityZombieSDX-DamageEntity entityKiller.entityId: " + entityKiller.entityId);
if (flag)
{
//Log.Out("EntityZombieSDX-DamageEntity flag: " + flag);
int biomeID = 3;
if (biomeStandingOn != null)
{
biomeID = biomeStandingOn.m_Id;
}
else
{
BiomeDefinition biomeAt = GameManager.Instance.World.ChunkCache.ChunkProvider.GetBiomeProvider().GetBiomeAt((int)this.position.x, (int)this.position.z);
if (biomeAt != null)
{
biomeID = biomeAt.m_Id;
}
}
if (!RebirthUtilities.IsHordeNight())
{
RebirthUtilities.ProcessCheckAchievements(biomeID, entityKiller, this);
}
}
}
}
if (EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("zombieleader")))
{
float flSpawnedMinions = Buffs.GetCustomVar("$SpawnedMinions");
//Log.Out("EntityZombieSDX-DamageEntity flSpawnedMinions: " + flSpawnedMinions);
if (flSpawnedMinions == 0 && !RebirthUtilities.IsHordeNight() && ((Health / Stats.Health.ModifiedMax) < .9f))
{
Buffs.SetCustomVar("$SpawnedMinions", 1f);
Manager.BroadcastPlay(position, "FuriousRamsayZombieLeaderScream");
int EntityID = entityId;
bool attackPlayer = false;
if (entityAlive is EntityPlayer)
{
//Log.Out("EntityZombieSDX-DamageEntity 1");
EntityID = entityAlive.entityId;
attackPlayer = true;
}
else if (attackTarget is EntityPlayer)
{
//Log.Out("EntityZombieSDX-DamageEntity 2");
EntityID = attackTarget.entityId;
attackPlayer = true;
}
else
{
//Log.Out("EntityZombieSDX-DamageEntity 3");
EntityPlayer player = world.GetClosestPlayer(this, 60f, false);
if (player != null)
{
//Log.Out("EntityZombieSDX-DamageEntity 4");
EntityID = player.entityId;
attackPlayer = true;
}
}
//Log.Out("EntityZombieSDX-DamageEntity attackPlayer: " + attackPlayer);
generatedNumbers.Clear();
if (EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("tainted")))
{
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_1_2aTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_2_3bTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_3_2bTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_3cTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_2cTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_5_3dTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_1_3cTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_2_2aTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_3_3aTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_3dTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_5_2bTainted", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
}
else if (EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("radiated")))
{
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_1_2aRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_2_3bRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_3_2bRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_3cRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_2cRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_5_3dRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_1_3cRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_2_2aRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_3_3aRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_3dRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_5_2bRadiated", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
}
else if (EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("feral")))
{
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_1_2aFeral", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_2_3bFeral", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_3_2bFeral", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_3cFeral", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_2cFeral", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_5_3dFeral", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_1_3cFeral", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_2_2aFeral", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_3_3aFeral", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
}
else
{
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_1_2a", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_2_3b", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_3_2b", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_3c", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_4_2c", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1");
RebirthUtilities.SpawnEntity(this.entityId, "FuriousRamsayZombie020_5_3d", 1, "", "", "30", "dynamic", "1", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1");
}
}
}
else if (EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("zombiegrudge")))
{
float flSpawnedMinions = Buffs.GetCustomVar("$SpawnedMinions");
if (flSpawnedMinions == 0 && !RebirthUtilities.IsHordeNight() && Health == 0f)
{
this.Buffs.SetCustomVar("$SpawnedMinions", 1f);
Manager.BroadcastPlay(position, "FuriousRamsayDuplicate");
int EntityID = entityId;
bool attackPlayer = false;
if (entityAlive is EntityPlayer)
{
EntityID = entityAlive.entityId;
attackPlayer = true;
}
else if (attackTarget is EntityPlayer)
{
EntityID = attackTarget.entityId;
attackPlayer = true;
}
else
{
EntityPlayer player = world.GetClosestPlayer(this, 60f, false);
if (player != null)
{
EntityID = player.entityId;
attackPlayer = true;
}
}
generatedNumbers.Clear();
if (EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("tainted")))
{
RebirthUtilities.SpawnEntity(entityId, "FuriousRamsayZombieGirl002Tainted", 6, "", "", "0", "dynamic", "", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
}
else if (EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("radiated")))
{
RebirthUtilities.SpawnEntity(entityId, "FuriousRamsayZombieGirl002Radiated", 5, "", "", "0", "dynamic", "", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Radiated");
}
else if (EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse("feral")))
{
RebirthUtilities.SpawnEntity(entityId, "FuriousRamsayZombieGirl002Feral", 4, "", "", "0", "dynamic", "", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1Feral");
}
else
{
RebirthUtilities.SpawnEntity(entityId, "FuriousRamsayZombieGirl002", 2, "", "", "0", "dynamic", "", "", 1, -1, true, false, attackPlayer, EntityID, -1, "", 1, 0, 40, 1, 1, -1, -1, "", "", 1, "", "FuriousRamsayMinionBuffTier1");
}
}
}
NetPackage package = NetPackageManager.GetPackage<NetPackageDamageEntity>().Setup(entityId, damageResponse);
if (world.IsRemote())
{
//Log.Out("EntityZombieSDX-DamageEntity 14");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(package, false);
}
else
{
//Log.Out("EntityZombieSDX-DamageEntity 15");
/*
int excludePlayer = -1;
if (!flag && _damageSource.CreatorEntityId != -2)
{
//Log.Out("EntityZombieSDX-DamageEntity 16");
excludePlayer = _damageSource.getEntityId();
if (_damageSource.CreatorEntityId != -1)
{
//Log.Out("EntityZombieSDX-DamageEntity 17");
Entity entity = world.GetEntity(_damageSource.CreatorEntityId);
if (entity && !entity.isEntityRemote)
{
//Log.Out("EntityZombieSDX-DamageEntity 18");
excludePlayer = -1;
}
}
}
Log.Out($"EntityZombieSDX::DamageEntity - SendPacket entityId: {entityId}, excludePlayer: {excludePlayer}");
world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(entityId, excludePlayer, package);
*/
// don't exclude any player
world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(entityId, -1, package);
}
return damageResponse.ModStrength;
}
public override void OnEntityDeath()
{
//Log.Out("EntityZombieSDX-OnEntityDeath START");
/*foreach (String s in this.particles.Keys)
{
Log.Out("EntityZombieSDX-OnEntityDeath this.particles[" + s + "].name: " + this.particles[s].name);
}*/
if (RebirthUtilities.IsHordeNight())
{
this.lootListOnDeath = "";
}
if (this.entityThatKilledMe != null)
{
//Log.Out("EntityZombieSDX-OnEntityDeath this.entityThatKilledMe.EntityClass.entityClassName: " + this.entityThatKilledMe.EntityClass.entityClassName);
entityThatKilledMeID = this.entityThatKilledMe.entityId;
if (this.entityThatKilledMe is EntitySurvivor)
{
if (this.entityThatKilledMe.belongsPlayerId > 0)
{
//Log.Out("RebirthUtilities-OnEntityDeath BELONGS TO: " + this.entityThatKilledMe.belongsPlayerId);
EntityPlayer entityPlayer = (EntityPlayer)this.world.GetEntity(this.entityThatKilledMe.belongsPlayerId);
if (entityPlayer != null)
{
this.entityThatKilledMe = entityPlayer;
entityThatKilledMeID = entityPlayer.entityId;
}
}
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
//Log.Out("EntityZombieSDX-OnEntityDeath IS SERVER");
if (dismemberedPart != EnumBodyPartHit.Head && RebirthUtilities.WillLiveAgain(this))
{
//Log.Out("EntityZombieSDX-OnEntityDeath REMOVE LOOT LIST");
this.lootListOnDeath = "";
}
}
}
else
{
//Log.Out("EntityZombieSDX-OnEntityDeath NO CLUE WHO KILLED ME, entityThatKilledMeID: " + entityThatKilledMeID);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
if (entityThatKilledMeID > 0)
{
//Log.Out("EntityZombieSDX-OnEntityDeath IS SERVER");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetInstigatorRebirth>().Setup(this.entityId, entityThatKilledMeID), false, -1, -1, -1, null, 192);
}
}
EntityAlive entity = this.world.GetEntity(entityThatKilledMeID) as EntityAlive;
if (entity != null)
{
this.entityThatKilledMe = entity;
//Log.Out("EntityZombieSDX-OnEntityDeath this.entityThatKilledMe: " + this.entityThatKilledMe.EntityClass.entityClassName);
}
}
if (this.deathUpdateTime != 0)
{
//Log.Out("EntityZombieSDX-OnEntityDeath A");
return;
}
//Log.Out("EntityZombieSDX-OnEntityDeath ADDSCORE");
this.AddScore(1, 0, 0, -1, 0);
if (this.soundLiving != null && this.soundLivingID >= 0)
{
//Log.Out("EntityZombieSDX-OnEntityDeath B");
Manager.Stop(this.entityId, this.soundLiving);
this.soundLivingID = -1;
}
if (this.AttachedToEntity)
{
//Log.Out("EntityZombieSDX-OnEntityDeath C");
this.Detach();
}
if (this.isEntityRemote)
{
//Log.Out("EntityZombieSDX-OnEntityDeath D");
return;
}
//Log.Out("EntityZombieSDX-OnEntityDeath entityThatKilledMeID: " + entityThatKilledMeID);
if (entityThatKilledMeID > 0)
{
//Log.Out("EntityZombieSDX-OnEntityDeath 1");
if (this.entityThatKilledMe is EntityNPCRebirth)
{
//Log.Out("EntityZombieSDX-OnEntityDeath 2");
EntityNPCRebirth npc = (EntityNPCRebirth)(this.entityThatKilledMe);
if (npc && npc.LeaderUtils.Owner)
{
//Log.Out("EntityZombieSDX-OnEntityDeath 3");
float distanceEntity = npc.LeaderUtils.Owner.GetDistance(this.entityThatKilledMe);
if (distanceEntity <= 50)
{
//Log.Out("EntityZombieSDX-OnEntityDeath 4");
this.AwardKill(npc.LeaderUtils.Owner);
}
}
}
else
{
//Log.Out("EntityZombieSDX-OnEntityDeath 5, this.entityThatKilledMe == null: " + (this.entityThatKilledMe == null));
//Log.Out("EntityZombieSDX-OnEntityDeath 5, EntityName: " + this.entityThatKilledMe.EntityName);
this.AwardKill(this.entityThatKilledMe);
}
}
if (this.particleOnDeath != null && this.particleOnDeath.Length > 0)
{
float lightBrightness = this.world.GetLightBrightness(base.GetBlockPosition());
this.world.GetGameManager().SpawnParticleEffectServer(new ParticleEffect(this.particleOnDeath, this.getHeadPosition(), lightBrightness, Color.white, null, null, false), this.entityId, false, false);
}
if (this.isGameMessageOnDeath())
{
GameManager.Instance.GameMessage(EnumGameMessages.EntityWasKilled, this, this.entityThatKilledMe);
}
if (this.entityThatKilledMe != null)
{
Log.Out("Entity {0} {1} killed by {2} {3}", new object[]
{
base.GetDebugName(),
this.entityId,
this.entityThatKilledMe.GetDebugName(),
this.entityThatKilledMe.entityId
});
}
else
{
Log.Out("Entity {0} {1} killed", new object[]
{
base.GetDebugName(),
this.entityId
});
}
ModEvents.EntityKilled.Invoke(this, this.entityThatKilledMe);
this.dropItemOnDeath();
//Log.Out("EntityZombieSDX-OnEntityDeath CLEAR ENTITYTHATKILLEDME");
//this.entityThatKilledMe = null;
}
public override void OnUpdateLive()
{
bool isHordeNight = RebirthUtilities.IsHordeNight();
//RebirthUtilities.CheckSleeperActivated(this);
if (!setSize)
{
float sizeScale = this.Buffs.GetCustomVar("$StartScale");
if (sizeScale > 0f)
{
this.SetScale(sizeScale);
}
setSize = true;
}
if (!setNavIcon)
{
//Log.Out("RebirthUtilities-OnUpdateLive entity: " + this.EntityName);
if (RebirthVariables.customEventsNotification && this.Buffs.GetCustomVar("$EventNavIcon") == 1f)
{
if (RebirthVariables.customTargetBarVisibility == "always")
{
if (this.Buffs.GetCustomVar("$varFuriousRamsaySupportMinion") == 1f)
{
//Log.Out("RebirthUtilities-OnUpdateLive NAV1");
this.AddNavObject(RebirthVariables.navIconSupportEvent, "", "");
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive NAV2");
this.AddNavObject(RebirthVariables.navIconBossEvent, "", "");
}
}
else
{
if (this.Buffs.GetCustomVar("$varFuriousRamsaySupportMinion") == 1f)
{
//Log.Out("RebirthUtilities-OnUpdateLive NAV3");
this.AddNavObject(RebirthVariables.navIconSupportEventNoHealth, "", "");
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive NAV4");
this.AddNavObject(RebirthVariables.navIconBossEventNoHealth, "", "");
}
}
}
setNavIcon = true;
}
float zombieVerifyTick = 2f;
if ((Time.time - zombieVerifyCheck) > zombieVerifyTick)
{
zombieVerifyCheck = Time.time;
bool bMindControlled = this.Buffs.HasBuff("FuriousRamsayRangedMindControlBuffTier1") || this.Buffs.HasBuff("FuriousRamsayRangedMindControlBuffTier2") || this.Buffs.HasBuff("FuriousRamsayRangedMindControlBuffTier3");
if (bMindControlled)
{
this.maxViewAngle = 360;
}
else
{
this.maxViewAngle = StringParsers.ParseFloat(this.EntityClass.Properties.Values[EntityClass.PropMaxViewAngle]);
}
//Log.Out("RebirthUtilities-OnUpdateLive this.maxViewAngle: " + this.maxViewAngle);
}
float zombieModelLayerTick = 5f;
if (RebirthVariables.noHit && RebirthVariables.logModelLayerCheck && (Time.time - zombieModelLayerCheck) > zombieModelLayerTick)
{
zombieModelLayerCheck = Time.time;
if (RebirthVariables.noHit)
{
Log.Out("RebirthUtilities-OnUpdateLive NO HIT, modellayer: " + this.GetModelLayer());
}
List<Transform> setLayerRecursivelyList = new List<Transform>();
this.emodel.GetModelTransform().gameObject.GetComponentsInChildren<Transform>(true, setLayerRecursivelyList);
List<Transform> list = setLayerRecursivelyList;
bool foundLayer = false;
for (int i = list.Count - 1; i >= 0; i--)
{
if (list[i].gameObject.layer == 2)
{
ulong worldTime = GameManager.Instance.World.worldTime;
ValueTuple<int, int, int> valueTuple = GameUtils.WorldTimeToElements(worldTime);
int numDays = valueTuple.Item1;
int numHours = valueTuple.Item2;
int numMinutes = valueTuple.Item3;
foundLayer = true;
Log.Out("RebirthUtilities-OnUpdateLive gameObject: " + list[i].gameObject.name + " / Layer: " + list[i].gameObject.layer + " / Game Time: " + numDays + "D: " + numHours + "H: " + numMinutes + "M");
}
}
if (foundLayer)
{
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
if (primaryPlayer != null)
{
GameManager.ShowTooltip(primaryPlayer, this.entityName + "'s Model Layer is set to 2, preventing hits");
}
}
}
this.hasAI = false;
//Log.Out("this.theEntity.emodel.IsRagdollMovement: " + this.emodel.IsRagdollMovement);
//Log.Out("RANGE: " + this.inventory.holdingItem.Actions[0].Range);
if (this.bDead && !isHordeNight)
{
//Log.Out("RebirthUtilities-OnUpdateLive IS DEAD");
if (this.entityThatKilledMe != null)
{
//Log.Out("RebirthUtilities-OnUpdateLive this.entityThatKilledMe.EntityClass.entityClassName: " + this.entityThatKilledMe.EntityClass.entityClassName);
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive NO CLUE WHO KILLED ME, this.entityThatKilledMeID: " + this.entityThatKilledMeID);
this.entityThatKilledMe = (global::EntityAlive)this.world.GetEntity(this.entityThatKilledMeID);
if (this.entityThatKilledMe != null)
{
//Log.Out("RebirthUtilities-OnUpdateLive this.entityThatKilledMe: " + this.entityThatKilledMe.EntityClass.entityClassName);
}
}
ulong elpasedTimeDead = GameTimer.Instance.ticks - AccumulatedTicksDead;
float willLiveAgain = this.Buffs.GetCustomVar("$willLiveAgain");
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && willLiveAgain == 1f)
{
if (elpasedTimeDead >= 80UL)
{
this.Buffs.SetCustomVar("$willLiveAgain", 0f);
//Log.Out("RebirthUtilities-OnUpdateLive $reborn: " + this.Buffs.GetCustomVar("$reborn"));
RebirthUtilities.Reborn(this);
return;
}
}
if (!GameManager.IsDedicatedServer)
{
if (this.lootContainer != null)
{
//Log.Out("RebirthUtilities-OnUpdateLive CONTAINER EXISTS");
//Log.Out("RebirthUtilities-OnUpdateLive this.lootContainer.bTouched: " + this.lootContainer.bTouched);
bool flag = this.lootContainer != null;
bool flag1 = !this.lootContainer.bTouched;
bool flag2 = this.entityThatKilledMe is EntityPlayer;
bool flag3 = this.entityThatKilledMe is EntityNPCRebirth;
bool flag4 = this.entityThatKilledMe is EntitySurvivor;
bool flag5 = this.entityThatKilledMe is EntityZombieSDX;
bool flag6 = this.entityPlayer == null;
bool flag7 = this.entityThatKilledMe == null;
//Log.Out("RebirthUtilities-OnUpdateLive this.lootContainer != null: " + flag);
//Log.Out("RebirthUtilities-OnUpdateLive !this.lootContainer.bTouched: " + flag1);
//Log.Out("RebirthUtilities-OnUpdateLive this.entityThatKilledMe is EntityPlayer: " + flag2);
//Log.Out("RebirthUtilities-OnUpdateLive this.entityThatKilledMe is EntityNPCRebirth: " + flag3);
//Log.Out("RebirthUtilities-OnUpdateLive this.entityThatKilledMe is EntitySurvivor: " + flag4);
//Log.Out("RebirthUtilities-OnUpdateLive this.entityThatKilledMe is EntityZombieSDX: " + flag5);
//Log.Out("RebirthUtilities-OnUpdateLive this.entityPlayer == null: " + flag6);
//Log.Out("RebirthUtilities-OnUpdateLive this.entityThatKilledMe == null: " + flag7);
//Log.Out("RebirthUtilities-OnUpdateLive elpasedTimeDead: " + elpasedTimeDead);
if (flag && flag1 && (flag2 || flag3 || flag4 || flag5) && flag6)
{
//Log.Out("RebirthUtilities-OnUpdateLive J");
//Log.Out("RebirthUtilities-OnUpdateLive AccumulatedTicksDead: " + AccumulatedTicksDead);
//Log.Out("RebirthUtilities-OnUpdateLive elpasedTimeDead: " + elpasedTimeDead);
if (elpasedTimeDead >= 80UL)
{
if (!removedParticles)
{
RebirthUtilities.RemoveCommonParticles(this);
removedParticles = true;
}
//Log.Out("RebirthUtilities-OnUpdateLive elpasedTimeDead >= 80UL");
AccumulatedTicksDead = GameTimer.Instance.ticks;
bool isValid = false;
bool isPlayer = false;
if (this.entityThatKilledMe is EntityPlayer)
{
//Log.Out("RebirthUtilities-OnUpdateLive KILLED BY PLAYER");
this.entityPlayer = (EntityPlayer)this.entityThatKilledMe;
isValid = true;
isPlayer = true;
}
else if (this.entityThatKilledMe is EntityNPCRebirth)
{
EntityNPCRebirth npc = (EntityNPCRebirth)this.entityThatKilledMe;
if (npc && npc.LeaderUtils.Owner)
{
//Log.Out("RebirthUtilities-OnUpdateLive KILLED BY PLAYER ALLY");
isValid = true;
this.entityPlayer = (EntityPlayer)npc.LeaderUtils.Owner;
this.entityThatKilledMe = (EntityPlayer)npc.LeaderUtils.Owner;
}
}
else if (this.entityThatKilledMe is EntityZombieSDX)
{
//Log.Out("RebirthUtilities-OnUpdateLive KILLED BY ZOMBIE");
int killedByID = (int)this.Buffs.GetCustomVar("$killedby");
if (killedByID > 0)
{
EntityPlayer entityPlayer = (EntityPlayer)this.world.GetEntity(killedByID);
if (entityPlayer != null)
{
//Log.Out("RebirthUtilities-OnUpdateLive FOUND PLAYER KILLER B");
isValid = true;
this.entityPlayer = entityPlayer;
this.entityThatKilledMe = entityPlayer;
}
}
}
if (isValid)
{
//Log.Out("RebirthUtilities-OnUpdateLive IS VALID");
bool lootCorpses = false;
if (this.entityPlayer)
{
lootCorpses = RebirthUtilities.HasMod(this.entityPlayer, "FuriousRamsayLootCorpses");
}
if (lootCorpses)
{
//Log.Out("RebirthUtilities-OnUpdateLive GATHER LOOT");
float containerMod = 0f;
float containerBonus = 0f;
//Log.Out("RebirthUtilities-OnUpdateLive this.lootContainer.EntityId: " + this.lootContainer.EntityId);
//Log.Out("RebirthUtilities-OnUpdateLive this.lootContainer.lootListName: " + this.lootContainer.lootListName);
float lootStage = (float)this.entityPlayer.GetHighestPartyLootStage(containerMod, containerBonus);
//Log.Out("RebirthUtilities-OnUpdateLive lootStage: " + lootStage);
GameManager.Instance.lootManager.LootContainerOpened(this.lootContainer, this.entityPlayer.entityId, this.EntityTags);
this.lootContainer.bTouched = true;
this.lootContainer.SetModified();
//Log.Out("RebirthUtilities-OnUpdateLive EntityTags: " + this.EntityTags);
bool addItems = false;
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
ItemStack[] array = this.lootContainer.items;
//Log.Out("RebirthUtilities-OnUpdateLive isPlayer: " + isPlayer);
//Log.Out("RebirthUtilities-OnUpdateLive array.Length: " + array.Length);
for (int i = 0; i < array.Length; i++)
{
//Log.Out("RebirthUtilities-OnUpdateLive i: " + i);
ItemStack itemStack = array[i];
bool skipItem = false;
//Log.Out("RebirthUtilities-OnUpdateLive itemStack.IsEmpty(): " + itemStack.IsEmpty());
if (!itemStack.IsEmpty())
{
//Log.Out("RebirthUtilities-OnUpdateLive GetItemName: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-OnUpdateLive itemStack.itemValue.ItemClass.Name: " + itemStack.itemValue.ItemClass.Name);
}
if (!isPlayer && !itemStack.IsEmpty() && (
itemStack.itemValue.ItemClass.Name == "foodRottingFlesh"
))
{
//Log.Out("RebirthUtilities-OnUpdateLive SKIP A ");
}
//Log.Out("RebirthUtilities-OnUpdateLive skipItem: " + skipItem);
//Log.Out("RebirthUtilities-OnUpdateLive itemStack.IsEmpty(): " + itemStack.IsEmpty());
if (!itemStack.IsEmpty() && !skipItem)
{
//Log.Out("RebirthUtilities-OnUpdateLive B item name: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-OnUpdateLive B itemStack.count: " + itemStack.count);
//Log.Out("RebirthUtilities-OnUpdateLive itemStack.itemValue.Modifications.Length: " + itemStack.itemValue.Modifications.Length);
//Log.Out("RebirthUtilities-OnUpdateLive itemStack.itemValue.CosmeticMods.Length: " + itemStack.itemValue.CosmeticMods.Length);
Recipe scrapableRecipe = CraftingManager.GetScrapableRecipe(itemStack.itemValue, itemStack.count);
bool dontScrap = (
itemStack.itemValue.ItemClass.Name == "apparelRunningShoesHP" ||
itemStack.itemValue.ItemClass.Name == "apparelCoatJacketLetterZU" ||
itemStack.itemValue.ItemClass.Name.ToLower().Contains("qt_")
);
if (scrapableRecipe != null && !dontScrap)
{
ItemClass forId = ItemClass.GetForId(scrapableRecipe.itemValueType);
ItemClass forId2 = ItemClass.GetForId(itemStack.itemValue.type);
//Log.Out("RebirthUtilities-OnUpdateLive forId.GetWeight(): " + forId.GetWeight());
//Log.Out("RebirthUtilities-OnUpdateLive forId2.GetWeight(): " + forId2.GetWeight());
int num = forId2.GetWeight() * itemStack.count;
//Log.Out("RebirthUtilities-OnUpdateLive num: " + num);
int weight = forId.GetWeight();
int num2 = num / weight;
int num3 = (int)((float)(num2 * weight) / (float)forId2.GetWeight() + 0.5f);
//Log.Out("RebirthUtilities-OnUpdateLive num3: " + num3);
num2 = (int)((float)num2 * 0.75f);
if (num2 <= 0)
{
num2 = 1;
}
ItemValue itemRecipeValue = ItemClass.GetItem(scrapableRecipe.GetOutputItemClass().GetItemName(), false);
ItemStack itemRecipeStack = new ItemStack(itemRecipeValue, num2);
if (!isPlayer && (itemRecipeValue.ItemClass.Name == "resourceCloth" ||
itemRecipeValue.ItemClass.Name == "resourceLeather"
))
{
//Log.Out("RebirthUtilities-OnUpdateLive SKIP B ");
}
//Log.Out("RebirthUtilities-OnUpdateLive scrapableRecipe.GetOutputItemClass().GetItemName(): " + scrapableRecipe.GetOutputItemClass().GetItemName());
//Log.Out("RebirthUtilities-OnUpdateLive num2: " + num2);
//Log.Out("RebirthUtilities-OnUpdateLive A Item Name: " + itemRecipeStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-OnUpdateLive A Item Count: " + itemRecipeStack.count);
if (!skipItem)
{
//Log.Out("RebirthUtilities-OnUpdateLive IS PLAYER A");
addItems = RebirthUtilities.AddPlayerItem(this.entityPlayer, this.lootContainer.GetClrIdx(), itemRecipeStack, true, true, true);
if (addItems)
{
if (this.entityPlayer.entityId == primaryPlayer.entityId)
{
//Log.Out("RebirthUtilities-OnUpdateLive B itemRecipeStack.count: " + itemRecipeStack.itemValue.ItemClass.Name);
//Log.Out("RebirthUtilities-OnUpdateLive B itemRecipeStack.count: " + num2);
primaryPlayer.PlayerUI.xui.CollectedItemList.AddItemStack(new ItemStack(itemRecipeStack.itemValue, num2), false);
}
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive B this.entityPlayer.entityId == primaryPlayer.entityId");
}
}
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive D Item Name: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-OnUpdateLive D Item Count: " + itemStack.count);
int numItems = itemStack.count;
//Log.Out("RebirthUtilities-OnUpdateLive IS PLAYER C");
addItems = RebirthUtilities.AddPlayerItem(this.entityPlayer, this.lootContainer.GetClrIdx(), itemStack, true, true, true);
if (addItems)
{
if (this.entityPlayer.entityId == primaryPlayer.entityId)
{
//Log.Out("RebirthUtilities-OnUpdateLive D itemRecipeStack.count: " + itemStack.itemValue.ItemClass.Name);
//Log.Out("RebirthUtilities-OnUpdateLive D itemRecipeStack.count: " + numItems);
primaryPlayer.PlayerUI.xui.CollectedItemList.AddItemStack(new ItemStack(itemStack.itemValue, numItems), false);
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive D this.entityPlayer.entityId == primaryPlayer.entityId");
}
}
}
//Log.Out("RebirthUtilities-OnUpdateLive SET STACK TO EMPTY i: " + i);
this.lootContainer.items[i] = ItemStack.Empty.Clone();
this.lootContainer.SetModified();
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive STACK IS EMPTY i: " + i);
this.lootContainer.items[i] = ItemStack.Empty.Clone();
this.lootContainer.SetModified();
}
}
if (addItems)
{
//Log.Out("RebirthUtilities-OnUpdateLive PICK UP");
Manager.PlayInsidePlayerHead("item_pickup");
//Log.Out("RebirthUtilities-OnUpdateLive REMOVED BAG: " + this.EntityClass.entityClassName);
this.lootContainer.SetEmpty();
this.lootContainer.SetModified();
this.MarkToUnload();
this.KillLootContainer();
}
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive NO MOD TO GATHER LOOT");
}
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive E1, entityClassName: " + this.EntityClass.entityClassName);
}
}
}
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive NO LOOT CONTAINER");
string lootList = this.GetLootList();
if (!string.IsNullOrEmpty(lootList))
{
this.lootContainer = new TileEntityLootContainer((Chunk)null);
this.lootContainer.entityId = this.entityId;
this.lootContainer.lootListName = lootList;
//Log.Out("RebirthUtilities-OnUpdateLive lootList: " + lootList);
this.lootContainer.SetContainerSize(LootContainer.GetLootContainer(lootList, true).size, true);
}
if (!removedParticles)
{
RebirthUtilities.RemoveCommonParticles(this);
removedParticles = true;
}
}
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && this.lootContainer != null && this.lootContainer.bTouched && this.lootContainer.IsEmpty())
{
//Log.Out("RebirthUtilities-OnUpdateLive F3");
this.MarkToUnload();
this.KillLootContainer();
}
}
else
{
AccumulatedTicksDead = GameTimer.Instance.ticks;
float flNotified = this.Buffs.GetCustomVar("$FR_ENTITY_NotifiedEvent");
if (flNotified == 1)
{
hasNotified = true;
}
//Log.Out("RebirthUtilities-OnUpdateLive Entity: " + this.EntityClass.entityClassName);
string rebirthPOISense = RebirthVariables.customPOISense;
int currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
bool isValidPOISense = (rebirthPOISense == "always") ||
(GameManager.Instance.World.IsDaytime() && rebirthPOISense == "dayonly") ||
(!GameManager.Instance.World.IsDaytime() && rebirthPOISense == "nightonly");
if (this.IsSleeping && isValidPOISense)
{
this.ConditionalTriggerSleeperWakeUp();
}
if (this.attackTarget)
{
//Log.Out("RebirthUtilities-OnUpdateLive Target: " + this.attackTarget.EntityClass.entityClassName);
//Log.Out("RebirthUtilities-OnUpdateLive A this.EntityTags.ToString(): " + this.EntityTags.ToString());
//Log.Out("RebirthUtilities-OnUpdateLive A otherTags: " + this.otherTags);
//Log.Out("RebirthUtilities-OnUpdateLive hasNotified: " + hasNotified);
//Log.Out("RebirthUtilities-OnUpdateLive this.HasAllTags(boss,eventspawn): " + this.HasAllTags(FastTags<TagGroup.Global>.Parse("boss,eventspawn")));
bool hasEventTag = this.HasAllTags(FastTags<TagGroup.Global>.Parse("boss,eventspawn"));
//Log.Out("RebirthUtilities-OnUpdateLive hasEventTag: " + hasEventTag);
if (!hasNotified && hasEventTag)
{
hasNotified = true;
this.Buffs.SetCustomVar("$FR_ENTITY_NotifiedEvent", 1);
this.attackTarget.Buffs.AddBuff("FuriousRamsayEventTrigger");
}
float flRespawned = this.attackTarget.Buffs.GetCustomVar("$FR_NPC_Respawn");
if (flRespawned == 1)
{
this.SetRevengeTarget((EntityAlive) null);
this.attackTarget = null;
this.ClearInvestigatePosition();
}
float flMisery = this.Buffs.GetCustomVar("$FR_Zombie_Misery");
if (flMisery == 0 && !GameUtils.IsPlaytesting() && !RebirthUtilities.ScenarioSkip())
{
//Log.Out("RebirthUtilities-OnUpdateLive flMisery 1");
if (this.attackTarget is EntityPlayer)
{
//Log.Out("RebirthUtilities-OnUpdateLive flMisery 2");
bool hasParticles = false;
//Log.Out("RebirthUtilities-OnUpdateLive Target: " + this.attackTarget.EntityClass.entityClassName);
float progressionLevel = 0;
ProgressionValue progressionValue = this.attackTarget.Progression.GetProgressionValue("FuriousRamsayNaturalSelection");
if (progressionValue != null)
{
progressionLevel = progressionValue.Level;
}
bool isNaturalSelectionOn = RebirthUtilities.IsNaturalSelectionOn();
//Log.Out("RebirthUtilities-OnUpdateLive isNaturalSelectionOn: " + isNaturalSelectionOn);
if (!isNaturalSelectionOn)
{
progressionLevel = 0;
}
if (progressionLevel > 0)
{
//Log.Out("RebirthUtilities-OnUpdateLive flMisery 3");
string strProgressionLevel = progressionLevel.ToString();
if (progressionLevel < 10)
{
strProgressionLevel = "0" + strProgressionLevel;
}
float percentageAdd = progressionLevel / 20;
this.Buffs.SetCustomVar("$varFuriousRamsayPercentageAdd", percentageAdd);
this.Buffs.SetCustomVar("$varFuriousRamsayPercentageAddx4", percentageAdd * 4);
float addHealth = this.GetMaxHealth() * percentageAdd * 4;
this.Buffs.SetCustomVar("$BonusMaxHealth_FR", addHealth);
this.Buffs.SetCustomVar("$BonusHealth_FR", addHealth - 25);
//Log.Out("RebirthUtilities-OnUpdateLive progressionLevel this.Health: " + this.Health);
//Log.Out("RebirthUtilities-OnUpdateLive progressionLevel addHealth: " + addHealth);
//Log.Out("RebirthUtilities-OnUpdateLive progressionLevel $varFuriousRamsayPercentageAdd: " + percentageAdd);
//Log.Out("RebirthUtilities-OnUpdateLive progressionLevel (PLAYER KILLS): " + progressionLevel);
//Log.Out("RebirthUtilities-OnUpdateLive 10 * progressionLevel: " + (10 * progressionLevel));
float random = (float)this.rand.RandomRange(0, 100 + 1);
float levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills HealthMax");
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerTierKills" + strProgressionLevel + "HealthMax");
//this.Stats.Health.BaseMax = this.Stats.Health.BaseMax + (int)addHealth;
//this.AddHealth((int)addHealth);
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills HealthBoost");
this.Buffs.AddBuff("FuriousRamsayGrowStrongerHealthBoostTier" + strProgressionLevel);
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills EntityDamage");
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerTierKills" + strProgressionLevel + "EntityDamage");
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills BlockDamage");
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerTierKills" + strProgressionLevel + "BlockDamage");
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills JumpStrength");
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerTierKills" + strProgressionLevel + "JumpStrength");
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills WalkSpeed");
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerTierKills" + strProgressionLevel + "WalkSpeed");
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills RunSpeed");
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerTierKills" + strProgressionLevel + "RunSpeed");
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills Mobility");
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerTierKills" + strProgressionLevel + "Mobility");
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills MovementFactorMultiplier");
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerTierKills" + strProgressionLevel + "MovementFactorMultiplier");
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 10 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills AttacksPerMinute");
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerTierKills" + strProgressionLevel + "AttacksPerMinute");
}
this.Buffs.SetCustomVar("$FR_Zombie_Misery", 1f);
}
hasParticles = this.HasAnyTags(FastTags<TagGroup.Global>.Parse("hasparticle"));
//Log.Out("RebirthUtilities-OnUpdateLive hasParticles: " + hasParticles);
if (!this.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal")) && !hasParticles && !particlesSet)
{
float random = (float)this.rand.RandomRange(0, 100 + 1);
//Log.Out("RebirthUtilities-OnUpdateLive biome random A: " + random);
if (random <= 10)
{
//Log.Out("RebirthUtilities-OnUpdateLive biome 1");
string otherTags = this.otherTags;
string biomeName = RebirthUtilities.GetBiomeName(this);
if (biomeName == "wasteland")
{
this.Buffs.AddBuff("HandParticles11");
otherTags = otherTags + ",explosionresist,smokeimmunezombie,fireresist,fireimmunezombie,shockresist,shockimmunezombie";
this.lootListOnDeath = "FuriousRamsay881";
this.SetEntityName("ttZombieFireShockSmoke");
particlesSet = true;
}
else if (biomeName == "desert")
{
this.Buffs.AddBuff("HandParticles1");
otherTags = otherTags + ",fireresist,fireimmunezombie";
this.lootListOnDeath = "FuriousRamsay877";
this.SetEntityName("ttZombieFire");
particlesSet = true;
}
else if (biomeName == "forest" || biomeName == "pine_forest")
{
this.Buffs.AddBuff("HandParticles10");
otherTags = otherTags + ",explosionresist,smokeimmunezombie";
this.lootListOnDeath = "FuriousRamsay880";
this.SetEntityName("ttZombieSmoke");
particlesSet = true;
}
else if (biomeName == "burnt_forest")
{
this.Buffs.AddBuff("HandParticles1");
otherTags = otherTags + ",fireresist,fireimmunezombie";
this.lootListOnDeath = "FuriousRamsay877";
this.SetEntityName("ttZombieFire");
particlesSet = true;
}
else if (biomeName == "snow")
{
this.Buffs.AddBuff("HandParticles2");
otherTags = otherTags + ",shockresist,shockimmunezombie";
this.lootListOnDeath = "FuriousRamsay878";
this.SetEntityName("ttZombieShock");
particlesSet = true;
}
this.otherTags = otherTags;
//Log.Out("RebirthUtilities-OnUpdateLive D this.EntityTags.ToString(): " + this.EntityTags.ToString());
//Log.Out("RebirthUtilities-OnUpdateLive D this.otherTags: " + this.otherTags);
}
else
{
random = (float)this.rand.RandomRange(1, 100);
//Log.Out("RebirthUtilities-OnUpdateLive biome random B: " + random);
if (random <= 2)
{
this.Buffs.AddBuff("HandParticles4");
this.SetEntityName("ttZombieToxic");
}
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
//Log.Out("RebirthUtilities-OnUpdateLive SendPackage this.entityId: " + this.entityId);
//Log.Out("RebirthUtilities-OnUpdateLive SendPackage this.otherTags: " + this.otherTags);
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSynchZombieInfoRebirth>().Setup(this.entityId, this.otherTags, this.entityName, this.lootListOnDeath), false, -1, -1, -1, null, 192);
}
}
progressionLevel = 0;
progressionValue = this.attackTarget.Progression.GetProgressionValue("FuriousRamsayAscension");
if (progressionValue != null)
{
progressionLevel = progressionValue.Level;
}
bool isAscensionOn = RebirthVariables.customAscension;
if (!isAscensionOn)
{
progressionLevel = 0;
}
if (progressionLevel > 0 && !particlesSet && !hasParticles)
{
//Log.Out("RebirthUtilities-OnUpdateLive flMisery 4");
string strProgressionLevel = progressionLevel.ToString();
if (progressionLevel < 10)
{
strProgressionLevel = "0" + strProgressionLevel;
}
float random = (float)this.rand.RandomRange(0, 100 + 1);
float randomElement = 0;
if (progressionLevel < 3)
{
randomElement = 0;
}
if (progressionLevel == 3)
{
randomElement = 1;
}
if (progressionLevel == 4)
{
randomElement = (float)this.rand.RandomRange(1, 3);
}
if (progressionLevel == 5)
{
randomElement = (float)this.rand.RandomRange(1, 6);
}
if (progressionLevel == 6)
{
if (isHordeNight)
{
randomElement = (float)this.rand.RandomRange(1, 9);
}
else
{
randomElement = (float)this.rand.RandomRange(1, 6);
}
}
if (progressionLevel >= 7)
{
if (isHordeNight)
{
randomElement = (float)this.rand.RandomRange(1, 9);
}
else
{
randomElement = (float)this.rand.RandomRange(1, 9);
}
}
//Log.Out("RebirthUtilities-OnUpdateLive progressionLevel (ASCENSION LEVEL): " + progressionLevel);
//Log.Out("RebirthUtilities-OnUpdateLive 5 * progressionLevel: " + (5 * progressionLevel));
//Log.Out("RebirthUtilities-OnUpdateLive randomElement: " + randomElement);
this.Buffs.SetCustomVar("$FuriousRamsayElement", randomElement);
if (randomElement == 1 || randomElement == 3 || randomElement == 5 || randomElement == 7)
{
this.Buffs.SetCustomVar("$FuriousRamsayElementFire", 1f);
}
float levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 5 * progressionLevel)
{
//Log.Out("RebirthUtilities-OnUpdateLive Kills SpeedBurst");
if (!this.HasAnyTags(FastTags<TagGroup.Global>.Parse("feral")))
{
this.Buffs.AddBuff("FuriousRamsaySpeedBurstTimerLevel" + strProgressionLevel);
}
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
//Log.Out("RebirthUtilities-OnUpdateLive B this.EntityTags.ToString(): " + this.EntityTags.ToString());
//Log.Out("RebirthUtilities-OnUpdateLive B this.otherTags: " + this.otherTags);
//Log.Out("RebirthUtilities-OnUpdateLive HasParticle: " + this.otherTags.Contains("hasparticle"));
//Log.Out("RebirthUtilities-OnUpdateLive HasParticle: " + hasParticles);
if (levelRandom < 5 * progressionLevel && randomElement > 0 & !hasParticles)
{
//Log.Out("RebirthUtilities-OnUpdateLive HAS ELEMENT: " + strProgressionLevel + "Buffs" + randomElement);
if (!this.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal")))
{
if (!isHordeNight)
{
if (randomElement == 7)
{
randomElement = 5;
}
else if (randomElement == 8)
{
randomElement = 6;
}
else if (randomElement == 9)
{
randomElement = 10;
}
}
this.Buffs.AddBuff("HandParticles" + randomElement);
hasParticles = true;
//Log.Out("RebirthUtilities-OnUpdateLive : " + "HandParticles" + randomElement);
string otherTags = this.otherTags;
if (randomElement == 1)
{
otherTags = otherTags + ",fireresist,fireimmunezombie";
this.lootListOnDeath = "FuriousRamsay877";
this.SetEntityName("ttZombieFire");
}
else if (randomElement == 2)
{
otherTags = otherTags + ",shockresist,shockimmunezombie";
this.lootListOnDeath = "FuriousRamsay878";
this.SetEntityName("ttZombieShock");
}
else if (randomElement == 3)
{
otherTags = otherTags + ",fireresist,fireimmunezombie,shockresist,shockimmunezombie";
this.lootListOnDeath = "FuriousRamsay879";
this.SetEntityName("ttZombieFireShock");
}
else if (randomElement == 4)
{
// RADIATION
this.SetEntityName("ttZombieToxic");
}
else if (randomElement == 5)
{
// FIRE, RADIATION
otherTags = otherTags + ",fireresist,fireimmunezombie";
this.lootListOnDeath = "FuriousRamsay877";
this.SetEntityName("ttZombieToxicFire");
}
else if (randomElement == 6)
{
// SHOCK, RADIATION
otherTags = otherTags + ",shockresist,shockimmunezombie";
this.lootListOnDeath = "FuriousRamsay878";
this.SetEntityName("ttZombieToxicShock");
}
else if (randomElement == 7)
{
// FIRE, BLOCK DAMAGE
otherTags = otherTags + ",fireresist,fireimmunezombie";
this.lootListOnDeath = "FuriousRamsay877";
this.SetEntityName("ttZombiePowerFire");
}
else if (randomElement == 8)
{
// SHOCK, BLOCK DAMAGE
otherTags = otherTags + ",shockresist,shockimmunezombie";
this.lootListOnDeath = "FuriousRamsay878";
this.SetEntityName("ttZombiePowerShock");
}
else if (randomElement == 9)
{
// RADIATION, BLOCK DAMAGE
this.SetEntityName("ttZombiePowerToxic");
}
else if (randomElement == 10)
{
otherTags = otherTags + ",explosionresist,smokeimmunezombie";
this.lootListOnDeath = "FuriousRamsay880";
this.SetEntityName("ttZombieSmoke");
}
else if (randomElement == 11)
{
otherTags = otherTags + ",explosionresist,smokeimmunezombie,fireresist,fireimmunezombie,shockresist,shockimmunezombie";
this.lootListOnDeath = "FuriousRamsay881";
this.SetEntityName("ttZombieFireShockSmoke");
}
this.otherTags = otherTags;
//Log.Out("RebirthUtilities-OnUpdateLive C this.EntityTags.ToString(): " + this.EntityTags.ToString());
//Log.Out("RebirthUtilities-OnUpdateLive C this.otherTags: " + this.otherTags);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
//Log.Out("RebirthUtilities-OnUpdateLive SendPackage this.entityId: " + this.entityId);
//Log.Out("RebirthUtilities-OnUpdateLive SendPackage this.otherTags: " + this.otherTags);
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSynchZombieInfoRebirth>().Setup(this.entityId, this.otherTags, this.entityName, this.lootListOnDeath), false, -1, -1, -1, null, 192);
}
}
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 5 * progressionLevel)
{
if (progressionLevel >= 4)
{
//Log.Out("RebirthUtilities-OnUpdateLive OPENS DOORS");
this.Buffs.SetCustomVar("$varFuriousRamsayOpenDoors", 1f);
}
}
random = (float)this.rand.RandomRange(0, 100 + 1);
levelRandom = random * (progressionLevel / 10);
//Log.Out("RebirthUtilities-OnUpdateLive random: " + random);
//Log.Out("RebirthUtilities-OnUpdateLive levelRandom: " + levelRandom);
if (levelRandom < 5 * progressionLevel)
{
if (progressionLevel >= 6 && progressionLevel < 9)
{
//Log.Out("RebirthUtilities-OnUpdateLive JUMPS 1");
if (!this.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss")))
{
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerZombieJump01");
}
}
else if (progressionLevel >= 9)
{
//Log.Out("RebirthUtilities-OnUpdateLive JUMPS 2");
if (!this.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss")))
{
this.Buffs.AddBuff("FuriousRamsayTheyGrowStrongerZombieJump02");
}
}
}
this.Buffs.SetCustomVar("$FR_Zombie_Misery", 1f);
}
particlesSet = true;
}
}
}
else
{
//Log.Out("RebirthUtilities-OnUpdateLive NO ATTACK TARGET");
}
}
base.OnUpdateLive();
}
private int ticksUntilVisible = 2;
//private float moveSpeedRagePer;
//private float moveSpeedScaleTime;
//private float fallTime;
//private float fallThresholdTime;
//private bool disableFallBehaviorUntilOnGround;
//private bool bPlayHurtSound;
//private string soundLiving;
//private int soundLivingID = -1;
public int unloadAfterTime = 0;
//private string particleOnDeath;
//public bool bLastAttackReleased;
public EntityAlive targetEntity;
//private int attackTargetTime;
//private bool bJumping;
//private bool bClimbing;
public new bool hasAI;
//private bool isMoveDirAbsolute;
//private float proneRefillRate;
//private int ticksToCheckSeenByPlayer;
//private float proneRefillCounter;
//private float kneelRefillCounter;
//private float kneelRefillRate;
//private bool wasSeenByPlayer;
//private DynamicRagdollFlags _dynamicRagdoll;
//private Vector3 _dynamicRagdollRootMotion;
//private readonly List<Vector3> _ragdollPositionsPrev = new List<Vector3>();
//private readonly List<Vector3> _ragdollPositionsCur = new List<Vector3>();
//private BlockValue corpseBlockValue;
//private float corpseBlockChance;
public float flHandItemRangeMP = 0;
public float flMaxBaseJumpHeight = 1;
public float flMaxJumpHeight = 1;
public float flMaxJumpSize = 2;
public float flLeapMaxDistance = 5;
public bool hasNotified = false;
public int gamestageStart = 0;
public int gamestageEnd = 0;
public List<int> generatedNumbers = new List<int>();
public ulong AccumulatedTicksDead = 0UL;
public int entityThatKilledMeID = -1;
public EntityPlayer entityPlayer = null;
public bool particlesSet = false;
public string lootDropEntityClass = "";
public string otherTags = "";
public bool removedParticles = false;
public bool setSize = false;
public bool setNavIcon = false;
public int wanderingHorde = 0;
public float zombieModelLayerCheck = 0f;
public float zombieVerifyCheck = 0f;
Vector3i corpsePosition;
public long LastHit = 0L;
public EnumBodyPartHit dismemberedPart = EnumBodyPartHit.None;
}

View File

@@ -0,0 +1,4 @@

public class EntityZombieScreamerRebirth : EntityZombieSDX
{
}

View File

@@ -0,0 +1,33 @@
using System;
public class EntityBicycleRebirth : EntityDriveable
{
public float SpeedBoostMultiplier = 1f; // temp - for player buffs that boost the vehicle speed
public override void Update()
{
base.Update();
//Log.Out("EntityBicycleRebirth-Update this.HasDriver: " + this.HasDriver);
if (HasDriver && AttachedMainEntity != null)
{
//Log.Out("EntityBicycleRebirth-Update AttachedMainEntity: " + this.AttachedMainEntity.EntityClass.entityClassName);
EntityAlive driver = (EntityAlive)AttachedMainEntity;
if (driver.Buffs.HasBuff("FuriousRamsayMobilityBoostRedTea"))
{
// todo fix - temp - this needs a better implementation
SpeedBoostMultiplier = 1.5f; // red tea boosts speed by 1.5 or ?
vehicle.VelocityMaxForward *= SpeedBoostMultiplier;
//Log.Out("EntityBicycleRebirth-Update HAS BUFF");
}
}
else
{
SpeedBoostMultiplier = 1f;
vehicle.VelocityMaxForward *= SpeedBoostMultiplier;
//Log.Out("EntityBicycleRebirth-Update DOESN'T HAVE BUFF");
}
}
}