public void CreateImage(Vector2 v2Origin, Vector2 v2SlashDir, Vector2 v2CreateSlashAt)
 {
     byte byDir = Utility.ConvertV2DirectionToClosestByteDirection(v2SlashDir);
     SortedAnimated.SortedAnimatedEffects enEffect = SortedAnimated.SortedAnimatedEffects._SkillEffects_OneHand_SpiritSlash_CloneRight;
     if (byDir == 2)
     {
         enEffect = SortedAnimated.SortedAnimatedEffects._SkillEffects_OneHand_SpiritSlash_CloneDown;
     }
     else if (byDir == 3)
     {
         enEffect = SortedAnimated.SortedAnimatedEffects._SkillEffects_OneHand_SpiritSlash_CloneLeft;
     }
     _Effect_MovingAnimated xEfe = new _Effect_MovingAnimated(v2Origin, enEffect, v2SlashDir * 8f, 60);
     xEfe.xRenderComponent.fAlpha = 0.5f;
     Program.game._EffectMaster_AddEffect(xEfe);
     HitEffectMap.HitEffectEvent ene = HitEffectMap.HitEffectEvent.OneHandedRight;
     if (xEfe.xRenderComponent.enSpriteEffect == SpriteEffects.FlipHorizontally)
     {
         ene = HitEffectMap.HitEffectEvent.OneHandedLeft;
     }
     HitEffectMap.Entry xEntry = HitEffectMap.GetEntry(ene, HitEffectMap.Modifier.Default);
     SortedAnimated.SortedAnimatedEffects eff = xEntry.enEffect;
     SortedAnimated kaktus = Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(v2CreateSlashAt, eff)) as SortedAnimated;
     kaktus.xRenderComponent.fRotation = Utility.Vector2ToRadians(v2SlashDir);
 }
 public void CreateEffect(Vector2 v2Origin, Vector2 v2Target)
 {
     float fLength = Vector2.Distance(v2Origin, v2Target);
     Vector2 v2Dir = Vector2.Normalize(v2Target - v2Origin);
     Program.GetTheGame().xSoundSystem.PlayCue("chain_lighting_zap", v2Target);
     float fDir = Utility.Vector2ToRadiansReverse(v2Dir);
     float fTravel = 0f;
     while (fLength > 0f)
     {
         SortedAnimated mos = Program.game._EffectMaster_AddEffect(new SortedAnimated(v2Origin + v2Dir * fTravel, SortedAnimated.SortedAnimatedEffects._SpellEffects_Wind_ElectricCurrent)) as SortedAnimated;
         mos.xRenderComponent.fRotation = fDir;
         if (fLength < 24f)
         {
             (mos.xRenderComponent as AnimatedRenderComponent).dixAnimations[0].iCellRenderWidth = (int)fLength;
         }
         fLength -= 24f;
         fTravel += 24f;
     }
     for (int i = 0; i < 10; i++)
     {
         IEffect xMos = new _Effect_MovingAnimated(v2Target, SortedAnimated.SortedAnimatedEffects._SpellEffects_Wind_ElectricCurrent, Utility.RandomizeVector2Direction(Program.game.randomInVisual) * (1f + 0.5f * (float)Program.game.randomInVisual.NextDouble()), 60, 20, 1f);
         xMos.xRenderComponent.fScale = 0.45f;
         float fRotMos = 0.1f + 0.1f * (float)Program.game.randomInVisual.NextDouble();
         if (Program.game.randomInVisual.Next(2) == 0)
         {
             fRotMos *= -1f;
         }
         (xMos as _Effect_MovingAnimated).fRotationMod = fRotMos;
         Program.game._EffectMaster_AddEffect(xMos);
     }
     if (CAS.NetworkRole == NetworkHelperInterface.NetworkRole.Server)
     {
         base.SendClientInstruction(2, new float[]
         {
             v2Origin.X,
             v2Origin.Y,
             v2Target.X,
             v2Target.Y
         });
     }
 }
Example #3
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;
 }