Example #1
0
 public SphereCollider(float p_fRadius, Vector2 p_v2LocalPosition, TransformComponent p_xMount, float p_fWeight, IEntity p_xOwner)
 {
     this.enColliderType = Collider.ColliderType.Sphere;
     this.fRadius = p_fRadius;
     this.xMountTransform = p_xMount;
     this.bFollowMount = true;
     this.xLocalTransform = new TransformComponent(p_v2LocalPosition);
     this.fWeight = p_fWeight;
     this.xOwnerObject = p_xOwner;
     if (p_xOwner != null)
     {
         if (p_xOwner.enEntityType == IEntity.EntityType.Player)
         {
             this.xAttackPhase = ((PlayerEntity)p_xOwner).xAttackPhase;
             this.xBaseStats = ((PlayerEntity)p_xOwner).xBaseStats;
             return;
         }
         if (p_xOwner.enEntityType == IEntity.EntityType.Enemy)
         {
             this.xAttackPhase = ((Enemy)p_xOwner).xAttackPhase;
             this.xBaseStats = ((Enemy)p_xOwner).xBaseStats;
             return;
         }
         if (p_xOwner.enEntityType == IEntity.EntityType.NPC)
         {
             this.xAttackPhase = ((Enemy)p_xOwner).xAttackPhase;
             this.xBaseStats = ((Enemy)p_xOwner).xBaseStats;
             return;
         }
         if (p_xOwner.enEntityType == IEntity.EntityType.DynamicEnvironment)
         {
             this.xBaseStats = ((DynamicEnvironment)p_xOwner).xBaseStats;
         }
     }
 }
Example #2
0
 public NPCCodex.NPCTypes GetEntityName(IEntity xEntity)
 {
     foreach (KeyValuePair<NPCCodex.NPCTypes, IEntity> kvp in this.denxNamedEntities)
     {
         if (kvp.Value == xEntity)
         {
             return kvp.Key;
         }
     }
     return NPCCodex.NPCTypes.NULL;
 }
Example #3
0
 public SphereCollider(float p_fRadius, Vector2 p_v2Position, float p_fWeight, IEntity p_xOwner)
 {
     this.enColliderType = Collider.ColliderType.Sphere;
     this.fRadius = p_fRadius;
     this.xLocalTransform = new TransformComponent(p_v2Position);
     this.fWeight = p_fWeight;
     this.xOwnerObject = p_xOwner;
     if (p_xOwner != null && p_xOwner.enEntityType == IEntity.EntityType.Player)
     {
         this.xAttackPhase = ((PlayerEntity)p_xOwner).xAttackPhase;
     }
 }
Example #4
0
 public BoxCollider(int p_iWidth, int p_iHeight, float p_fRotation, Vector2 p_v2LocalPosition, TransformComponent p_xMount, float p_fWeight, IEntity p_xOwner)
 {
     this.enColliderType = Collider.ColliderType.Box;
     this.fRotation = p_fRotation;
     if (p_xMount != null)
     {
         this.xMountTransform = p_xMount;
         this.bFollowMount = true;
     }
     this.xLocalTransform = new TransformComponent(p_v2LocalPosition);
     this.fWeight = p_fWeight;
     this.xOwnerObject = p_xOwner;
     this.iWidth = p_iWidth;
     this.iHeight = p_iHeight;
     if (p_xOwner != null)
     {
         if (p_xOwner.enEntityType == IEntity.EntityType.Player)
         {
             this.xAttackPhase = ((PlayerEntity)p_xOwner).xAttackPhase;
             this.xBaseStats = ((PlayerEntity)p_xOwner).xBaseStats;
             return;
         }
         if (p_xOwner.enEntityType == IEntity.EntityType.DynamicEnvironment)
         {
             this.xBaseStats = ((DynamicEnvironment)p_xOwner).xBaseStats;
             return;
         }
         if (p_xOwner.enEntityType == IEntity.EntityType.NPC)
         {
             this.xAttackPhase = ((Enemy)p_xOwner).xAttackPhase;
             this.xBaseStats = ((Enemy)p_xOwner).xBaseStats;
             return;
         }
         if (p_xOwner.enEntityType == IEntity.EntityType.Enemy)
         {
             this.xAttackPhase = ((Enemy)p_xOwner).xAttackPhase;
             this.xBaseStats = ((Enemy)p_xOwner).xBaseStats;
         }
     }
 }
Example #5
0
 public SoundSystem.CueWrapper PlayCue(string sCueName, IEntity xEntity, bool bIsVoice)
 {
     if (!this.bSystemActive)
     {
         return null;
     }
     if (bIsVoice && this.lxVoiceEntities.ContainsKey(xEntity) && this.lxVoiceEntities[xEntity].sName == sCueName)
     {
         return null;
     }
     SoundSystem.CueWrapper xCueToAdd = new SoundSystem.PositionedAmbientCueWrapper(this.effectSoundBank.GetCue(sCueName), sCueName, this.xAudioListener, xEntity.xTransform);
     this.lxCueWrappers.Add(xCueToAdd);
     this.lxCuesInLevel.Add(xCueToAdd);
     xCueToAdd.Play();
     if (bIsVoice)
     {
         if (this.lxVoiceEntities.ContainsKey(xEntity))
         {
             this.lxVoiceEntities[xEntity].Stop();
         }
         this.lxVoiceEntities[xEntity] = xCueToAdd;
         this.dxxReverseVoiceEntities[xCueToAdd] = xEntity;
     }
     return xCueToAdd;
 }
Example #6
0
 public AttackPhase(IEntity p_xOwner)
 {
     this.xOwner = p_xOwner;
 }
Example #7
0
 public virtual void OnHitByAttack(AttackCollisionData xAtColData, AttackPhase xAtPhase)
 {
     this.bHasBeenAttacked = true;
     if (xAtPhase.xOwner != null)
     {
         this.xLastAttackedBy = xAtPhase.xOwner;
     }
 }
Example #8
0
 public BaseStats(IEntity p_xOwner)
 {
     this.xOwner = p_xOwner;
 }
Example #9
0
 public AnimatedAttackPhase(RenderComponent p_xRC, IEntity p_xOwner)
     : base(p_xOwner)
 {
     this.xRC = p_xRC;
 }
Example #10
0
 public void ExitLightShift()
 {
     if (Program.GetTheGame().xNetworkInfo.enCurrentRole != NetworkHelperInterface.NetworkRole.Client)
     {
         this.ExitLockedState();
     }
     if (this.byLightShiftDir < 4)
     {
         this.byLightShiftDir = 4;
     }
     NPC xPet = Program.game._Pet_FindPetInstanceOfOwner(this.Owner);
     if (xPet != null)
     {
         (xPet.xBehaviour as PetAI).TurnVisible();
         xPet.xTransform.SetBoth(this.xTransform.v2Pos);
     }
     if (this.HardRelocateEvent != null)
     {
         this.HardRelocateEvent(this, this.e);
     }
     if (this.xLightPlate != null)
     {
         this.xRenderComponent.SwitchAnimation((ushort)this.xLightPlate.xRenderComponent.GetCurrentAnimation().byAnimationDirection, Animation.CancelOptions.IgnoreIfPlaying);
     }
     this.xRenderComponent.fVirtualHeight -= 7f;
     this.xLightPlate = null;
     this.xLastMirror = null;
     this.xCollisionComponent.SetPropertyInGroup(CollisionComponent.ColliderGroup.Movement, CollisionComponent.ColliderProperty.NonGhost);
     this.xCollisionComponent.xMovementCollider.bCollideWithFlat = true;
     if (this.Owner == Program.GetTheGame().xLocalPlayer)
     {
         Program.GetTheGame().xInput_Game.RecheckAll();
     }
     if (Program.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Server)
     {
         NetOutgoingMessage om = Program.GetTheGame()._Network_CreateMessage();
         om.Write(92);
         om.Write(3);
         om.Write(this.Owner.iConnectionIdentifier);
         om.Write(this.xTransform.v2Pos.X);
         om.Write(this.xTransform.v2Pos.Y);
         Program.GetTheGame()._Network_SendMessage(om, true);
     }
 }
Example #11
0
 public override void Update()
 {
     if (this.bDying)
     {
         return;
     }
     IEntity arg_0F_0 = this.xOwner;
     if (this.xOwner != null)
     {
         this.xRenderComponent.fAlpha = (this.xOwner as PlayerEntity).xRenderComponent.fAlpha;
     }
     this.iExistTimer++;
     this.iToLive--;
     if (this.iToLive < 0 && this.xRenderComponent.iActiveAnimation % 5 == 1)
     {
         this.Kill();
         return;
     }
     if ((this.xOwner as PlayerEntity).Owner.xViewStats.bIsDead)
     {
         this.Kill();
         return;
     }
     Program.GetTheGame();
     if (this.iRemoveAPCountDown > 0)
     {
         this.iRemoveAPCountDown--;
         if (this.iRemoveAPCountDown == 0)
         {
             this.xAttackPhaseEnemy.UnregisterCurrent();
             this.xAttackPhaseEnemy.lxHitEntities.Clear();
         }
     }
     Vector2.Distance(this.xTransform.v2Pos, this.xOwner.xTransform.v2Pos);
     if (!this.bPassive && (this.xOwner.enEntityType != IEntity.EntityType.Player || (this.xOwner as PlayerEntity).enTargetable == PlayerEntity.Targetable.Full) && !this.bPassive && this.iCounterAtLastAttack + this.iCooldown < this.iExistTimer)
     {
         Enemy xClosest = Program.GetTheGame()._Enemies_GetClosestEnemyByDistanceToHitbox(this.xTransform.v2Pos, 20f, this.xAttackPhaseEnemy.lxCurrentColliders[0]);
         if (xClosest != null && xClosest.xCollisionComponent.ibitCurrentColliderLayer == (this.xOwner as PlayerEntity).xCollisionComponent.ibitCurrentColliderLayer && xClosest.enType != EnemyCodex.EnemyTypes.Chicken)
         {
             this.xOverrideTarget = xClosest;
             Vector2 v2ClosestPoint;
             if (this.xOverrideTarget.enEntityType == IEntity.EntityType.Enemy)
             {
                 if (!(this.xOverrideTarget as Enemy).xCollisionComponent.lxHitboxColliders[0].ComparePrerequisites(this.xAttackPhaseEnemy.lxCurrentColliders[0]))
                 {
                     this.xOverrideTarget = null;
                     return;
                 }
                 v2ClosestPoint = (this.xOverrideTarget as Enemy).xCollisionComponent.GetClosestPositionToHitbox(this.xTransform.v2Pos);
             }
             else
             {
                 v2ClosestPoint = (this.xOverrideTarget as PlayerEntity).xCollisionComponent.GetClosestPositionToHitbox(this.xTransform.v2Pos);
             }
             float fTargetDistance = Vector2.Distance(v2ClosestPoint, this.xTransform.v2Pos);
             if (fTargetDistance < 20f)
             {
                 bool bRight = this.xOverrideTarget.xTransform.v2Pos.X > this.xTransform.v2Pos.X;
                 if (bRight)
                 {
                     this.xRenderComponent.SwitchAnimation(Convert.ToUInt16(4 + this.iAnimPlus), Animation.CancelOptions.IgnoreIfPlaying);
                 }
                 else
                 {
                     this.xRenderComponent.SwitchAnimation(Convert.ToUInt16(3 + this.iAnimPlus), Animation.CancelOptions.IgnoreIfPlaying);
                 }
                 this.iCounterAtLastAttack = this.iExistTimer;
                 this.xOverrideTarget = null;
                 return;
             }
         }
     }
     this.xTransform.v2ServerPos = this.xTransform.v2Pos;
 }
Example #12
0
 public virtual Collider EmptyInit(TransformComponent p_xMount, IEntity p_xOwner)
 {
     return null;
 }
Example #13
0
 public override Collider EmptyInit(TransformComponent p_xMount, IEntity p_xOwner)
 {
     SphereCollider sc;
     if (p_xMount == null)
     {
         sc = new SphereCollider(0f, Vector2.Zero, 0f, p_xOwner);
     }
     else
     {
         sc = new SphereCollider(0f, Vector2.Zero, p_xMount, 0f, p_xOwner);
     }
     return sc;
 }
 public AnimatedRenderComponent(IEntity p_xOwnerObject)
 {
     this.enType = RenderComponent.ComponentType.AnimatedRenderComponent;
     this.xOwnerObject = p_xOwnerObject;
 }
Example #15
0
 public NPCRenderComponent(IEntity p_xOwnerObject)
     : base(p_xOwnerObject)
 {
     this.xOwner = (NPC)p_xOwnerObject;
 }
Example #16
0
 public void AddAffectedEntity(IEntity xEntity)
 {
     this.dxenAffectedEntities[xEntity] = this.enCurrentSeason;
 }
Example #17
0
 public override void OnHitByAttack(AttackCollisionData xAtColData, AttackPhase xAtPhase)
 {
     base.OnHitByAttack(xAtColData, xAtPhase);
     this.AddHitEffect();
     this.xWhatHitMe = xAtPhase.xOwner.GetTrueOwner();
     if (Program.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Server)
     {
         base.SendClientInstruction(2, new float[0]);
     }
 }
Example #18
0
 public static Collider CreateEmptyShell(Vector2 p_v2LocalPos, TransformComponent p_xMountTransform, IEntity p_xOwner)
 {
     return new Collider
     {
         xLocalTransform = new TransformComponent(p_v2LocalPos),
         xMountTransform = p_xMountTransform,
         xOwnerObject = p_xOwner
     };
 }
Example #19
0
 public void CreateHitEffect(HitEffectMap.HitEffectEvent enEvent, HitEffectMap.Modifier enModifier, Vector2 v2PointOfImpact, IEntity xThingHit)
 {
     HitEffectMap.Entry xEntry = HitEffectMap.GetEntry(enEvent, enModifier);
     SortedAnimated.SortedAnimatedEffects eff = xEntry.enEffect;
     SortedAnimated kaktus = Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(v2PointOfImpact, eff)) as SortedAnimated;
     if ((xEntry.enSpecialFlags & HitEffectMap.Entry.SpecialFlags.Follow) == HitEffectMap.Entry.SpecialFlags.Follow)
     {
         kaktus.xRenderComponent.xTransform = xThingHit.xTransform;
         kaktus.xRenderComponent.v2OffsetRenderPos = v2PointOfImpact - kaktus.xRenderComponent.xTransform.v2Pos;
     }
     if ((xEntry.enSpecialFlags & HitEffectMap.Entry.SpecialFlags.RotateTowards) == HitEffectMap.Entry.SpecialFlags.RotateTowards)
     {
         Vector2 v2Dir = v2PointOfImpact - this.xTransform.v2Pos;
         v2Dir.Normalize();
         float fRadians = (float)Math.Atan2((double)v2Dir.Y, (double)v2Dir.X) + 1.57079637f;
         kaktus.xRenderComponent.fRotation += fRadians;
     }
     kaktus.xRenderComponent.fVirtualHeight += this.xRenderComponent.fVirtualHeight;
     if (Program.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Server)
     {
         Game1 master = Program.GetTheGame();
         if (xThingHit.enEntityType == IEntity.EntityType.Enemy)
         {
             Enemy boeg = xThingHit as Enemy;
             foreach (PlayerView xOtherView in master.dixPlayers.Values)
             {
                 if (xOtherView != master.xLocalPlayer)
                 {
                     NetOutgoingMessage om = master.xNetworkInfo.server.CreateMessage();
                     om.Write(54);
                     om.Write(this.Owner.iConnectionIdentifier);
                     om.Write(boeg.iID);
                     om.Write((byte)enEvent);
                     om.Write((byte)enModifier);
                     om.Write((ushort)v2PointOfImpact.X);
                     om.Write((ushort)v2PointOfImpact.Y);
                     master.xNetworkInfo.server.SendMessage(om, xOtherView.netConnection, NetDeliveryMethod.ReliableUnordered);
                 }
             }
         }
     }
 }
Example #20
0
 public override void OnUpdate()
 {
     if (this.bDying)
     {
         return;
     }
     if (this.bClientConnect)
     {
         this.xOwner.xTransform.SetBoth(this.xFollowView.xEntity.xTransform.v2Pos);
         this.bClientConnect = false;
     }
     this.xChatBubble.Update();
     this.xCombatBubble.Update();
     IEntity xWhatToFollow = this.xFollowView.xEntity;
     this.iCounter++;
     if (this.xOverrideFlyTo != null)
     {
         xWhatToFollow = this.xOverrideFlyTo;
     }
     Game1 master = Program.game;
     HashSet<FlagCodex.FlagID> henActiveFlags = master.xGameSessionData.henActiveFlags;
     this.iHintCooldown--;
     this.iBanterCooldown--;
     if (this.iCombatBanterCooldown > 0)
     {
         this.iCombatBanterCooldown--;
     }
     if (this.iCounter % 16 == 0)
     {
         _Effect_MovingAnimated xEfe = new _Effect_MovingAnimated(this.xOwner.xTransform.v2Pos + 3f * Utility.RandomizeVector2Direction(CAS.RandomInVisual), SortedAnimated.SortedAnimatedEffects.Glitter_Small_Naniva, new Vector2(0f, 0.25f), 40, 5, 1f);
         xEfe.xRenderComponent.v2OffsetRenderPos.Y = -10f;
         xEfe.xRenderComponent.cColor = Color.LightCyan;
         Program.game._EffectMaster_AddEffect(xEfe);
     }
     if (!Program.game.xGameSessionData.henActiveFlags.Contains(FlagCodex.FlagID._HeyListen_ShutUp) && Program.game.xLevelMaster.xCurrentLevel.enRegion != Level.WorldRegion.SeasonTemple)
     {
         if (this.enCurrentHint == FlagCodex.FlagID._HeyListen_Bush || this.enCurrentHint == FlagCodex.FlagID._HeyListen_Jar || this.enCurrentHint == FlagCodex.FlagID._HeyListen_Crate || this.enCurrentHint == FlagCodex.FlagID._HeyListen_Barrel || this.enCurrentHint == FlagCodex.FlagID._HeyListen_NPC || this.enCurrentHint == FlagCodex.FlagID._HeyListen_Enemy || this.enCurrentHint == FlagCodex.FlagID._HeyListen_Fishing || this.enCurrentHint == FlagCodex.FlagID._HeyListen_Loot)
         {
             if (!henActiveFlags.Contains(this.enCurrentHint) && Vector2.Distance(this.xOverrideFlyTo.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) < 30f)
             {
                 this.HandleFlagTrigger(this.enCurrentHint);
                 this.iCounter = 0;
                 this.iHintCooldown = 600;
             }
             if (henActiveFlags.Contains(this.enCurrentHint) && (this.iCounter >= 300 || Vector2.Distance(this.xFollowView.xEntity.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) > 300f))
             {
                 this.xOverrideFlyTo = null;
                 this.enCurrentHint = FlagCodex.FlagID.Null;
             }
         }
         else if (this.enCurrentHint != FlagCodex.FlagID.Null && master.xLocalPlayer.xGUIStuff.xNaniva.iDisplayTimeLeft <= 0 && master.xLocalPlayer.xGUIStuff.xBag.iDisplayTimeLeft <= 0)
         {
             if (this.enCurrentHint == FlagCodex.FlagID._HeyListen_Introduction)
             {
                 this.HandleFlagTrigger(FlagCodex.FlagID._BagTips_Naniva1);
             }
             else if (this.enCurrentHint == FlagCodex.FlagID._BagTips_Naniva1)
             {
                 this.HandleFlagTrigger(FlagCodex.FlagID._HeyListen_Introduction2);
             }
             else if (this.enCurrentHint == FlagCodex.FlagID._HeyListen_Introduction2)
             {
                 this.HandleFlagTrigger(FlagCodex.FlagID._BagTips_Naniva2);
             }
             else
             {
                 this.enCurrentHint = FlagCodex.FlagID.Null;
             }
         }
         if (this.enQueuedHint != FlagCodex.FlagID.Null)
         {
             if (CAS.LocalPlayer.xGUIStuff.xNaniva.iDisplayTimeLeft <= 0 && CAS.LocalPlayer.xGUIStuff.xBag.iDisplayTimeLeft <= 0)
             {
                 this.HandleFlagTrigger(this.enQueuedHint);
                 return;
             }
         }
         else
         {
             if (!henActiveFlags.Contains(FlagCodex.FlagID._BagTips_Naniva2) && this.enCurrentHint == FlagCodex.FlagID.Null && master.xLevelMaster.xCurrentLevel.enZone == Level.ZoneEnum.EvergrindCity_Main && Program.game.xGameSessionData.hsActiveStringFlags.Add("Asdamos"))
             {
                 this.HandleFlagTrigger(FlagCodex.FlagID._HeyListen_Introduction);
             }
             if (henActiveFlags.Contains(FlagCodex.FlagID._BagTips_Naniva2) && this.enCurrentHint == FlagCodex.FlagID.Null && this.iHintCooldown <= 0)
             {
                 if (this.iCounter % 10 == 0 && !henActiveFlags.Contains(FlagCodex.FlagID._HeyListen_Bush))
                 {
                     using (Dictionary<ushort, DynamicEnvironment>.ValueCollection.Enumerator enumerator = Program.game.xEntityMaster.dixDynamicEnvironment.Values.GetEnumerator())
                     {
                         while (enumerator.MoveNext())
                         {
                             DynamicEnvironment x = enumerator.Current;
                             if (x.enType >= DynamicEnvironmentCodex.ObjectTypes.Bush && x.enType < DynamicEnvironmentCodex.ObjectTypes.Bush_Last && (x.xCollisionComponent.ibitCurrentColliderLayer & this.xFollowView.xEntity.xCollisionComponent.ibitCurrentColliderLayer) != 0 && this.AcceptedOverridePosition(x.xTransform.v2Pos) && !base.Raycast((x.xTransform.v2Pos + this.xOwner.xTransform.v2Pos) / 2f))
                             {
                                 this.xOverrideFlyTo = x;
                                 this.enCurrentHint = FlagCodex.FlagID._HeyListen_Bush;
                                 return;
                             }
                         }
                         goto IL_804;
                     }
                 }
                 if (this.iCounter % 10 == 1 && !henActiveFlags.Contains(FlagCodex.FlagID._HeyListen_Jar))
                 {
                     using (Dictionary<ushort, DynamicEnvironment>.ValueCollection.Enumerator enumerator2 = Program.game.xEntityMaster.dixDynamicEnvironment.Values.GetEnumerator())
                     {
                         while (enumerator2.MoveNext())
                         {
                             DynamicEnvironment x2 = enumerator2.Current;
                             if (x2.enType >= DynamicEnvironmentCodex.ObjectTypes.Jar && x2.enType < DynamicEnvironmentCodex.ObjectTypes.Jar_Last && (x2.xCollisionComponent.ibitCurrentColliderLayer & this.xFollowView.xEntity.xCollisionComponent.ibitCurrentColliderLayer) != 0 && this.AcceptedOverridePosition(x2.xTransform.v2Pos) && !base.Raycast((x2.xTransform.v2Pos + this.xOwner.xTransform.v2Pos) / 2f))
                             {
                                 this.xOverrideFlyTo = x2;
                                 this.enCurrentHint = FlagCodex.FlagID._HeyListen_Jar;
                                 return;
                             }
                         }
                         goto IL_804;
                     }
                 }
                 if (this.iCounter % 10 == 2 && !henActiveFlags.Contains(FlagCodex.FlagID._HeyListen_Crate))
                 {
                     using (Dictionary<ushort, DynamicEnvironment>.ValueCollection.Enumerator enumerator3 = Program.game.xEntityMaster.dixDynamicEnvironment.Values.GetEnumerator())
                     {
                         while (enumerator3.MoveNext())
                         {
                             DynamicEnvironment x3 = enumerator3.Current;
                             if (x3.enType >= DynamicEnvironmentCodex.ObjectTypes.Crate && x3.enType < DynamicEnvironmentCodex.ObjectTypes.Crate_Last && (x3.xCollisionComponent.ibitCurrentColliderLayer & this.xFollowView.xEntity.xCollisionComponent.ibitCurrentColliderLayer) != 0 && this.AcceptedOverridePosition(x3.xTransform.v2Pos) && !base.Raycast((x3.xTransform.v2Pos + this.xOwner.xTransform.v2Pos) / 2f))
                             {
                                 this.xOverrideFlyTo = x3;
                                 this.enCurrentHint = FlagCodex.FlagID._HeyListen_Crate;
                                 return;
                             }
                         }
                         goto IL_804;
                     }
                 }
                 if (this.iCounter % 10 == 3 && !henActiveFlags.Contains(FlagCodex.FlagID._HeyListen_Barrel))
                 {
                     foreach (DynamicEnvironment x4 in Program.game.xEntityMaster.dixDynamicEnvironment.Values)
                     {
                         if (x4.enType >= DynamicEnvironmentCodex.ObjectTypes.Barrel && x4.enType < DynamicEnvironmentCodex.ObjectTypes.Barrel_Last && (x4.xCollisionComponent.ibitCurrentColliderLayer & this.xFollowView.xEntity.xCollisionComponent.ibitCurrentColliderLayer) != 0 && this.AcceptedOverridePosition(x4.xTransform.v2Pos) && !base.Raycast((x4.xTransform.v2Pos + this.xOwner.xTransform.v2Pos) / 2f))
                         {
                             this.xOverrideFlyTo = x4;
                             this.enCurrentHint = FlagCodex.FlagID._HeyListen_Barrel;
                             return;
                         }
                     }
                 }
                 IL_804:
                 if (this.iCounter % 10 == 4 && !henActiveFlags.Contains(FlagCodex.FlagID._HeyListen_NPC))
                 {
                     foreach (NPC x5 in Program.game.dixNPCList.Values)
                     {
                         if (x5 != this.xOwner && (x5.xCollisionComponent.ibitCurrentColliderLayer & this.xFollowView.xEntity.xCollisionComponent.ibitCurrentColliderLayer) != 0 && this.AcceptedOverridePosition(x5.xTransform.v2Pos) && !base.Raycast((x5.xTransform.v2Pos + this.xOwner.xTransform.v2Pos) / 2f))
                         {
                             this.xOverrideFlyTo = x5;
                             this.enCurrentHint = FlagCodex.FlagID._HeyListen_NPC;
                             return;
                         }
                     }
                 }
                 if (this.iCounter % 10 == 5 && !henActiveFlags.Contains(FlagCodex.FlagID._HeyListen_Enemy))
                 {
                     foreach (Enemy x6 in Program.game.dixEnemyList.Values)
                     {
                         if ((x6.xCollisionComponent.ibitCurrentColliderLayer & this.xFollowView.xEntity.xCollisionComponent.ibitCurrentColliderLayer) != 0 && this.AcceptedOverridePosition(x6.xTransform.v2Pos) && !base.Raycast((x6.xTransform.v2Pos + this.xOwner.xTransform.v2Pos) / 2f))
                         {
                             this.xOverrideFlyTo = x6;
                             this.enCurrentHint = FlagCodex.FlagID._HeyListen_Enemy;
                             return;
                         }
                     }
                 }
                 if (this.iCounter % 10 == 7 && !henActiveFlags.Contains(FlagCodex.FlagID._HeyListen_Fishing))
                 {
                     foreach (DynamicEnvironment x7 in Program.game.xEntityMaster.dixDynamicEnvironment.Values)
                     {
                         if (x7.enType == DynamicEnvironmentCodex.ObjectTypes.FishingPlate)
                         {
                             Vector2 v2FishPlatePos = Utility.PointToVector2((x7 as FishingPlate).recCollider.Center);
                             if (this.AcceptedOverridePosition(v2FishPlatePos) && !base.Raycast((v2FishPlatePos + this.xOwner.xTransform.v2Pos) / 2f))
                             {
                                 this.xOverrideFlyTo = new EntityShell(v2FishPlatePos);
                                 this.enCurrentHint = FlagCodex.FlagID._HeyListen_Fishing;
                                 return;
                             }
                         }
                     }
                 }
             }
         }
         if (Program.game.xCutsceneMaster.bInCutscene || !henActiveFlags.Contains(FlagCodex.FlagID._BagTips_Naniva2) || this.enCurrentHint != FlagCodex.FlagID.Null || this.iHintCooldown > 0 || this.iBanterCooldown > 0)
         {
             goto IL_CC9;
         }
         this.iBanterCooldown = 200;
         if (this.EnemiesNearby())
         {
             goto IL_CC9;
         }
         if (this.sForceNextBanter != "")
         {
             this.SetBubble(CAS.GetLibraryText("DialogueSnippets", this.sForceNextBanter));
             this.sForceNextBanter = "";
             goto IL_CC9;
         }
         if (CAS.RandomInVisual.Next(5) != 0)
         {
             goto IL_CC9;
         }
         if ((Program.game.xLevelMaster.xCurrentLevel.enZone == Level.ZoneEnum.HalloweenForestWest || Program.game.xLevelMaster.xCurrentLevel.enZone == Level.ZoneEnum.HalloweenForestEast || Program.game.xLevelMaster.xCurrentLevel.enRegion == Level.WorldRegion.FlyingFortress) && CAS.RandomInVisual.Next(2) == 0)
         {
             int iRan = CAS.RandomInVisual.Next(4);
             string sMos = "";
             if (iRan == 0)
             {
                 sMos = "NanivaBubbleNegativeLocation01";
             }
             else if (iRan == 1)
             {
                 sMos = "NanivaBubbleNegativeLocation02";
             }
             else if (iRan == 2)
             {
                 sMos = "NanivaBubbleNegativeLocation03";
             }
             else if (iRan == 3)
             {
                 sMos = "NanivaBubbleNegativeLocation04";
             }
             this.SetBubble(CAS.GetLibraryText("DialogueSnippets", sMos));
         }
         else
         {
             int iGoRandom = CAS.RandomInVisual.Next(this.lsRandomBanterIDs.Count);
             if (iGoRandom == this.iPreviousBanter)
             {
                 goto IL_CC9;
             }
             this.iPreviousBanter = iGoRandom;
             string sMos2 = this.lsRandomBanterIDs[iGoRandom];
             this.SetBubble(CAS.GetLibraryText("DialogueSnippets", sMos2));
             if (sMos2 == "NanivaBubbleRandomBanter04")
             {
                 this.sForceNextBanter = "NanivaBubbleRandomBanter04b";
                 goto IL_CC9;
             }
             if (!(sMos2 == "NanivaBubbleRandomBanter09"))
             {
                 goto IL_CC9;
             }
             int iRan2 = CAS.RandomInVisual.Next(4);
             if (iRan2 == 0)
             {
                 this.sForceNextBanter = "NanivaBubbleRandomBanter09b";
                 goto IL_CC9;
             }
             if (iRan2 == 1)
             {
                 this.sForceNextBanter = "NanivaBubbleRandomBanter09c";
                 goto IL_CC9;
             }
             if (iRan2 == 2)
             {
                 this.sForceNextBanter = "NanivaBubbleRandomBanter09d";
                 goto IL_CC9;
             }
             if (iRan2 == 3)
             {
                 this.sForceNextBanter = "NanivaBubbleRandomBanter09e";
                 goto IL_CC9;
             }
             goto IL_CC9;
         }
         return;
     }
     IL_CC9:
     if (xWhatToFollow.GetRenderComponentIfAny() != null)
     {
         this.xOwner.xRenderComponent.fAlpha = xWhatToFollow.GetRenderComponentIfAny().fAlpha;
         this.xOwner.xRenderComponent.fVirtualHeight = xWhatToFollow.GetRenderComponentIfAny().fVirtualHeight;
     }
     if (this.xOverrideFlyTo == null && (this.xFollowView.xEntity.iPhasing == -1 || Vector2.Distance(this.xOwner.xTransform.v2Pos, this.xFollowView.xEntity.xTransform.v2Pos) > 400f))
     {
         this.TeleportToOwner();
     }
     Program.GetTheGame();
     if (this.iRemoveAPCountDown > 0)
     {
         this.iRemoveAPCountDown--;
         if (this.iRemoveAPCountDown == 0)
         {
             this.xAttackPhaseEnemy.UnregisterCurrent();
             this.xAttackPhaseEnemy.lxHitEntities.Clear();
         }
     }
     float fDistance = Vector2.Distance(this.xOwner.xTransform.v2Pos, xWhatToFollow.xTransform.v2Pos);
     Vector2 v2LookAt;
     if (this.xOwner.xTransform.v2Pos != xWhatToFollow.xTransform.v2Pos)
     {
         v2LookAt = Vector2.Normalize(xWhatToFollow.xTransform.v2Pos - this.xOwner.xTransform.v2Pos);
     }
     else
     {
         v2LookAt = new Vector2(1f, 0f);
     }
     if (this.iExistTimer % 120 == 1)
     {
         Random knark = Program.GetTheGame().randomInVisual;
         this.v2AmbientWantDirection = new Vector2((float)knark.NextDouble() * 2f - 1f, (float)knark.NextDouble() * 2f - 1f) + v2LookAt / 2f;
         this.v2AmbientWantDirection.Normalize();
     }
     this.xOwner.xTransform.v2Pos += this.v2AmbientTravelDirection * 0.2f;
     if (this.v2AmbientTravelDirection == Vector2.Zero)
     {
         this.v2AmbientTravelDirection = this.v2AmbientWantDirection / 2f;
     }
     this.v2AmbientTravelDirection = Vector2.Lerp(this.v2AmbientTravelDirection, this.v2AmbientWantDirection, 0.03f);
     float arg_EFA_0 = v2LookAt.X;
     if (fDistance > this.fDistanceAtMove)
     {
         float fThisVelocity = (fDistance - this.fDistanceAtMove) / (this.fMaxVelocityAtDistance - this.fDistanceAtMove) * 2f;
         if (this.xOverrideFlyTo != null)
         {
             fThisVelocity *= 2f;
         }
         if (fThisVelocity > 2.5f)
         {
             fThisVelocity = 2.5f;
         }
         this.xOwner.xTransform.v2Pos += v2LookAt * fThisVelocity;
     }
     if (this.xOwner.xRenderComponent.GetCurrentAnimation().bIsMoveCancellable)
     {
         this.iExistTimer++;
         Vector2 v2TrueLook = v2LookAt;
         if (this.xOverrideLookat != null)
         {
             v2TrueLook = Utility.Normalize(this.xOverrideLookat.v2Pos - this.xOwner.xTransform.v2Pos);
         }
         this.xOwner.xRenderComponent.SwitchAnimation((ushort)Utility.ConvertV2DirectionToClosestByteDirection(v2TrueLook), Animation.CancelOptions.IgnoreIfPlaying);
     }
     this.xOwner.xTransform.v2ServerPos = this.xOwner.xTransform.v2Pos;
 }
Example #21
0
		public FadeOutRenderComponent(RenderComponent rcComponent, int iFadeOutEnd, IEntity xDestroyAtEnd)
		{
			this.iFadeOutEnd = iFadeOutEnd;
			this.rc = rcComponent;
			this.xDestroyAtEnd = xDestroyAtEnd;
		}