public void Update()
 {
     if (this.bDestroyed)
     {
         return;
     }
     VFX_PlayerGhostImage xOldest = this.lxGhostImageSnatchers[this.iMaxFrames - 1];
     for (int i = this.iMaxFrames - 1; i > 0; i--)
     {
         this.lxGhostImageSnatchers[i] = this.lxGhostImageSnatchers[i - 1];
     }
     if (xOldest == null)
     {
         xOldest = new VFX_PlayerGhostImage(this.xPlayer);
         xOldest.xRenderComponent.cColor = this.cShadowColor;
     }
     else
     {
         xOldest.bSnatchedTexture = false;
         (xOldest.xRenderComponent as SnatchRenderComponent).Reset();
     }
     if (this.lxGhostImageSnatchers[1] != null)
     {
         this.lxGhostImageSnatchers[1].xRenderComponent.fVirtualHeight -= 2f;
     }
     xOldest.xRenderComponent.fVirtualHeight = this.xPlayer.xEntity.xRenderComponent.fVirtualHeight + 1f;
     xOldest.xRenderComponent.xTransform.v2Pos = this.xPlayer.xEntity.xTransform.v2Pos;
     this.lxGhostImageSnatchers[0] = xOldest;
     for (int j = 0; j < this.iMaxFrames; j++)
     {
         if (this.lxGhostImageSnatchers[j] != null)
         {
             if (!this.liShowFrames.Contains(j))
             {
                 this.lxGhostImageSnatchers[j].xRenderComponent.fAlpha = 0f;
             }
             else
             {
                 this.lxGhostImageSnatchers[j].xRenderComponent.fAlpha = this.fTargetAlpha;
             }
         }
     }
 }
Пример #2
0
 private void ParseInstruction(AnimationInstruction ins)
 {
     if (ins.xEvent.enEventType == AnimInsEvent.EventType.PlayAnimation)
     {
         this.SwitchAnimation((ushort)ins.xEvent.afAlterableValues[0], Animation.CancelOptions.RestartIfPlaying);
         if (ins.xEvent.afAlterableValues.Length >= 2)
         {
             this.fPassedTicks = ins.xEvent.afAlterableValues[1];
             this.GetCurrentAnimation().Update(this.fPassedTicks);
             return;
         }
     }
     else if (ins.xEvent.enEventType == AnimInsEvent.EventType.RunDelegate)
     {
         if (ins.xEvent.xDelegateFunction != null)
         {
             ins.xEvent.xDelegateFunction();
             return;
         }
     }
     else if (ins.xEvent.enEventType == AnimInsEvent.EventType.FreezeFrame)
     {
         if (ins.xEvent.afAlterableValues[1] < ins.xEvent.afAlterableValues[0])
         {
             ins.xEvent.afAlterableValues[1] += 1f;
             this.fPassedTicks -= this.fAnimationTimeWarp;
             this.GetCurrentAnimation().iLogicFrame--;
             return;
         }
     }
     else if (ins.xEvent.enEventType == AnimInsEvent.EventType.AddSmoothPush)
     {
         if (!this.GetCurrentAnimation().bDisableAnimationMovement)
         {
             this.xOwnerObject.xTransform.v2SmoothPush += new Vector2(ins.xEvent.afAlterableValues[0], ins.xEvent.afAlterableValues[1]);
             return;
         }
     }
     else if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetWeaponRenderOrder)
     {
         if (ins.xEvent.afAlterableValues[0] == 0f)
         {
             this.iWeaponRenderOrderOverride = -1;
             return;
         }
         this.iWeaponRenderOrderOverride = 1;
         return;
     }
     else if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetRenderWeapon)
     {
         if (ins.xEvent.afAlterableValues[0] == 0f)
         {
             this.bRenderWeapon = false;
             return;
         }
         this.bRenderWeapon = true;
         return;
     }
     else if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetMoveCancel)
     {
         if (ins.xEvent.afAlterableValues[0] == 1f)
         {
             this.xOwnerObject.bMoveCancelable = true;
             return;
         }
         if (ins.xEvent.afAlterableValues[0] == 0f)
         {
             this.xOwnerObject.bMoveCancelable = false;
             return;
         }
         if (ins.xEvent.afAlterableValues[0] == 2f && this.xOwnerObject.xCurrentSpellCharge != null && this.xOwnerObject.xCurrentSpellCharge.bChangeDirectionAllowed)
         {
             this.xOwnerObject.bMoveCancelable = true;
             return;
         }
     }
     else
     {
         if (ins.xEvent.enEventType == AnimInsEvent.EventType.AdjustPosition)
         {
             Vector2 v2Tomove = new Vector2(ins.xEvent.afAlterableValues[0], ins.xEvent.afAlterableValues[1]);
             this.xOwnerObject.xTransform.v2Pos += v2Tomove;
             this.xOwnerObject.xTransform.v2ServerPos += v2Tomove;
             return;
         }
         if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetFlashCancel)
         {
             if (ins.xEvent.afAlterableValues[0] == 1f)
             {
                 this.xOwnerObject.bFlashCancelable = true;
                 return;
             }
             this.xOwnerObject.bFlashCancelable = false;
             return;
         }
         else
         {
             if (ins.xEvent.enEventType == AnimInsEvent.EventType.AttackCancelTrue)
             {
                 this.xOwnerObject.bAttackCancelable = true;
                 return;
             }
             if (ins.xEvent.enEventType == AnimInsEvent.EventType.SpellCancelTrue)
             {
                 this.xOwnerObject.bSpellCancelable = true;
                 return;
             }
             if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetKnockbackResistance)
             {
                 this.xOwnerObject.xBaseStats.iKnockbackResistance = (int)ins.xEvent.afAlterableValues[0];
                 return;
             }
             if (ins.xEvent.enEventType == AnimInsEvent.EventType.SpecialClass)
             {
                 ins.xEvent.RunSpecialEvent();
                 return;
             }
             if (ins.xEvent.enEventType == AnimInsEvent.EventType.PlayEffect)
             {
                 IEffect xEff = ins.xEvent.xEffect.Clone();
                 xEff.xRenderComponent.xTransform.v2Pos = this.xOwnerObject.xTransform.v2Pos;
                 if (ins.xEvent.afAlterableValues.Length < 3 || ins.xEvent.afAlterableValues[2] == 0f)
                 {
                     xEff.xRenderComponent.xTransform.v2Pos += new Vector2(ins.xEvent.afAlterableValues[0], ins.xEvent.afAlterableValues[1]);
                 }
                 else
                 {
                     xEff.xRenderComponent.v2OffsetRenderPos = new Vector2(ins.xEvent.afAlterableValues[0], ins.xEvent.afAlterableValues[1]);
                 }
                 xEff.xRenderComponent.fVirtualHeight += this.fVirtualHeight;
                 Program.GetTheGame()._EffectMaster_AddEffect(xEff);
                 return;
             }
             if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetShield)
             {
                 if (ins.xEvent.afAlterableValues[0] == 0f)
                 {
                     this.xOwnerObject.bShieldUp = false;
                     this.xOwnerObject.xBaseStats.bPerfectGuard = false;
                     return;
                 }
                 if (ins.xEvent.afAlterableValues[0] != 1f)
                 {
                     this.xOwnerObject.iCancelPerfectGuardIn = 0;
                     this.xOwnerObject.bShieldUp = true;
                     this.xOwnerObject.xBaseStats.bPerfectGuard = true;
                     return;
                 }
                 this.xOwnerObject.bShieldUp = true;
                 int iShieldBearer = (int)this.xOwnerObject.Owner.xViewStats.GetSkillLevel(SpellCodex.SpellTypes._Talent_ShieldBearer);
                 if (iShieldBearer > 0)
                 {
                     this.xOwnerObject.iCancelPerfectGuardIn = iShieldBearer;
                     return;
                 }
                 this.xOwnerObject.xBaseStats.bPerfectGuard = false;
                 return;
             }
             else if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetBow)
             {
                 if (ins.xEvent.afAlterableValues[0] == 0f)
                 {
                     this.xOwnerObject.bBowReady = false;
                     return;
                 }
                 if (ins.xEvent.afAlterableValues[0] == 1f)
                 {
                     this.xOwnerObject.bBowReady = true;
                     return;
                 }
             }
             else if (ins.xEvent.enEventType == AnimInsEvent.EventType.CallBackAnimation)
             {
                 if (ins.xEvent.afAlterableValues[0] == 0f)
                 {
                     if (this.xOwnerObject.xCurrentSpellActivation != null)
                     {
                         this.xOwnerObject.xCurrentSpellActivation.AnimationActivationCallback(ins.xEvent.sCustomScript);
                         return;
                     }
                 }
                 else
                 {
                     if (ins.xEvent.afAlterableValues[0] == 1f)
                     {
                         Program.GetTheGame()._TreasureMap_UncoverTreasure(this.xOwnerObject.Owner);
                         return;
                     }
                     if (ins.xEvent.afAlterableValues[0] == 2f)
                     {
                         CollisionComponent.ColliderGroup colGroup = CollisionComponent.ColliderGroup.All;
                         if (ins.xEvent.sCustomScript == "Movement")
                         {
                             colGroup = CollisionComponent.ColliderGroup.Movement;
                         }
                         else if (ins.xEvent.sCustomScript == "Combat")
                         {
                             colGroup = CollisionComponent.ColliderGroup.Combat;
                         }
                         if (ins.xEvent.afAlterableValues[1] == 0f)
                         {
                             this.xOwnerObject.xCollisionComponent.DeactivateGroup(colGroup);
                             return;
                         }
                         this.xOwnerObject.xCollisionComponent.ActivateGroup(colGroup);
                         return;
                     }
                     else if (ins.xEvent.afAlterableValues[0] == 3f)
                     {
                         if (ins.xEvent.afAlterableValues[1] == 0f)
                         {
                             if (this.xOwnerObject.xCurrentSpellCharge != null)
                             {
                                 if (this.xOwnerObject.xCurrentSpellCharge.bButtonReleased && Program.GetTheGame().xNetworkInfo.enCurrentRole != NetworkHelperInterface.NetworkRole.Client)
                                 {
                                     this.xOwnerObject.xCurrentSpellCharge.Release();
                                     return;
                                 }
                                 this.xOwnerObject.xCurrentSpellCharge.bStartupOver = true;
                                 return;
                             }
                         }
                         else if (ins.xEvent.afAlterableValues[1] == 1f)
                         {
                             if (this.xOwnerObject.xCurrentSpellCharge != null)
                             {
                                 this.xOwnerObject.xCurrentSpellCharge.ExecuteSpellCallback();
                                 return;
                             }
                         }
                         else if (ins.xEvent.afAlterableValues[1] == 2f && this.xOwnerObject.xCurrentSpellCharge != null)
                         {
                             this.xOwnerObject.xCurrentSpellCharge.OnAnimationCallback(ins);
                             return;
                         }
                     }
                     else if (ins.xEvent.afAlterableValues[0] == 4f)
                     {
                         if (ins.xEvent.afAlterableValues[1] == 0f)
                         {
                             return;
                         }
                     }
                     else if (ins.xEvent.afAlterableValues[0] == 5f)
                     {
                         if (ins.xEvent.afAlterableValues[1] == 0f)
                         {
                             if (this.xOwnerObject.Owner.xEquipment.xBufferWeapon == null)
                             {
                                 return;
                             }
                             ItemCodex.ItemTypes enType = this.xOwnerObject.Owner.xEquipment.xBufferWeapon.enItemType;
                             if (enType == ItemCodex.ItemTypes._OneHanded_LaserSword)
                             {
                                 Program.GetTheGame().xSoundSystem.PlayCue("1HSwingLaser01", this.xOwnerObject, false);
                                 return;
                             }
                             Program.GetTheGame().xSoundSystem.PlayCue("1HSwing02", this.xOwnerObject, false);
                             return;
                         }
                         else if (ins.xEvent.afAlterableValues[1] == 1f)
                         {
                             if (this.xOwnerObject.Owner.xEquipment.xBufferWeapon == null)
                             {
                                 return;
                             }
                             ItemCodex.ItemTypes arg_891_0 = this.xOwnerObject.Owner.xEquipment.xBufferWeapon.enItemType;
                             Program.GetTheGame().xSoundSystem.PlayCue("TwohandedSwing", this.xOwnerObject, false);
                             return;
                         }
                         else if (ins.xEvent.afAlterableValues[1] == 2f)
                         {
                             Color cGetPoso = Program.game.xLevelMaster.xCurrentLevel.xSurfaceMap.GetPoint(this.xTransform.v2Pos);
                             if (cGetPoso != Color.Transparent)
                             {
                                 if (cGetPoso.R == 255)
                                 {
                                     this.xOwnerObject.enCurrentSurface = PlayerEntity.EnvironmentSurface.Snow;
                                 }
                                 else if (cGetPoso.B == 255)
                                 {
                                     this.xOwnerObject.enCurrentSurface = PlayerEntity.EnvironmentSurface.Water;
                                 }
                                 else if (cGetPoso.B == 0)
                                 {
                                     this.xOwnerObject.enCurrentSurface = PlayerEntity.EnvironmentSurface.Normal;
                                 }
                             }
                             else
                             {
                                 this.xOwnerObject.enCurrentSurface = PlayerEntity.EnvironmentSurface.Normal;
                             }
                             if (this.xOwnerObject.enCurrentSurface == PlayerEntity.EnvironmentSurface.Normal)
                             {
                                 Program.GetTheGame().xSoundSystem.PlayCue("Footstep", this.xOwnerObject, false);
                                 return;
                             }
                             if (this.xOwnerObject.enCurrentSurface == PlayerEntity.EnvironmentSurface.Snow)
                             {
                                 Vector2 v2Mos = this.xOwnerObject.xTransform.v2Pos;
                                 if (this.iActiveAnimation == 4)
                                 {
                                     if (this.GetCurrentAnimation().iRenderedFrame == 3)
                                     {
                                         v2Mos += new Vector2(1f, 1f);
                                     }
                                     else
                                     {
                                         v2Mos += new Vector2(-2f, 1f);
                                     }
                                 }
                                 else if (this.iActiveAnimation == 5)
                                 {
                                     if (this.GetCurrentAnimation().iRenderedFrame == 3)
                                     {
                                         v2Mos += new Vector2(0f, -2f);
                                     }
                                     else
                                     {
                                         v2Mos += new Vector2(0f, 1f);
                                     }
                                 }
                                 else if (this.iActiveAnimation == 6)
                                 {
                                     if (this.GetCurrentAnimation().iRenderedFrame == 3)
                                     {
                                         v2Mos += new Vector2(-2f, 1f);
                                     }
                                     else
                                     {
                                         v2Mos += new Vector2(1f, 1f);
                                     }
                                 }
                                 else if (this.iActiveAnimation == 7)
                                 {
                                     if (this.GetCurrentAnimation().iRenderedFrame == 3)
                                     {
                                         v2Mos += new Vector2(0f, -2f);
                                     }
                                     else
                                     {
                                         v2Mos += new Vector2(0f, 1f);
                                     }
                                 }
                                 SortedAnimated.SortedAnimatedEffects enType2 = SortedAnimated.SortedAnimatedEffects.SnowStepUp;
                                 if (this.xOwnerObject.byAnimationDirection != 0 && this.xOwnerObject.byAnimationDirection != 2)
                                 {
                                     enType2 = SortedAnimated.SortedAnimatedEffects.SnowStepRight;
                                 }
                                 Program.game._EffectMaster_AddEffect(new SortedAnimated(v2Mos, enType2));
                                 return;
                             }
                             if (this.xOwnerObject.enCurrentSurface == PlayerEntity.EnvironmentSurface.Water)
                             {
                                 Vector2 v2Mos2 = this.xOwnerObject.xTransform.v2Pos;
                                 if (this.iActiveAnimation == 4)
                                 {
                                     if (this.GetCurrentAnimation().iRenderedFrame == 3)
                                     {
                                         v2Mos2 += new Vector2(1f, 1f);
                                     }
                                     else
                                     {
                                         v2Mos2 += new Vector2(-2f, 1f);
                                     }
                                 }
                                 else if (this.iActiveAnimation == 5)
                                 {
                                     if (this.GetCurrentAnimation().iRenderedFrame == 3)
                                     {
                                         v2Mos2 += new Vector2(0f, -2f);
                                     }
                                     else
                                     {
                                         v2Mos2 += new Vector2(0f, -1f);
                                     }
                                 }
                                 else if (this.iActiveAnimation == 6)
                                 {
                                     if (this.GetCurrentAnimation().iRenderedFrame == 3)
                                     {
                                         v2Mos2 += new Vector2(-2f, 0f);
                                     }
                                     else
                                     {
                                         v2Mos2 += new Vector2(1f, 0f);
                                     }
                                 }
                                 else if (this.iActiveAnimation == 7)
                                 {
                                     if (this.GetCurrentAnimation().iRenderedFrame == 3)
                                     {
                                         v2Mos2 += new Vector2(0f, -2f);
                                     }
                                     else
                                     {
                                         v2Mos2 += new Vector2(0f, -1f);
                                     }
                                 }
                                 Program.game._EffectMaster_AddEffect(new SortedAnimated(v2Mos2, SortedAnimated.SortedAnimatedEffects.WaterStep));
                                 return;
                             }
                         }
                         else if (ins.xEvent.afAlterableValues[1] == 3f)
                         {
                             Color cGetPoso2 = Program.game.xLevelMaster.xCurrentLevel.xSurfaceMap.GetPoint(this.xTransform.v2Pos);
                             if (!(cGetPoso2 != Color.Transparent))
                             {
                                 this.xOwnerObject.enCurrentSurface = PlayerEntity.EnvironmentSurface.Normal;
                                 return;
                             }
                             if (cGetPoso2.R == 255)
                             {
                                 this.xOwnerObject.enCurrentSurface = PlayerEntity.EnvironmentSurface.Snow;
                                 return;
                             }
                             if (cGetPoso2.B == 255)
                             {
                                 this.xOwnerObject.enCurrentSurface = PlayerEntity.EnvironmentSurface.Water;
                                 return;
                             }
                             if (cGetPoso2.B == 0)
                             {
                                 this.xOwnerObject.enCurrentSurface = PlayerEntity.EnvironmentSurface.Normal;
                                 return;
                             }
                         }
                         else if (ins.xEvent.afAlterableValues[1] == 4f)
                         {
                             this.xOwnerObject.enCurrentSurface = PlayerEntity.EnvironmentSurface.Normal;
                             return;
                         }
                     }
                 }
             }
             else
             {
                 if (ins.xEvent.enEventType == AnimInsEvent.EventType.PlaySound)
                 {
                     bool bVoice = false;
                     if (ins.xEvent.afAlterableValues[0] == 1f)
                     {
                         bVoice = true;
                     }
                     Program.GetTheGame().xSoundSystem.PlayCue(ins.xEvent.sCustomScript, this.xOwnerObject, bVoice);
                     return;
                 }
                 if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetAlpha)
                 {
                     this.fAlpha = ins.xEvent.afAlterableValues[0];
                     return;
                 }
                 if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetMoveColliderWeight)
                 {
                     this.xOwnerObject.xCollisionComponent.xMovementCollider.fWeight = ins.xEvent.afAlterableValues[0];
                     return;
                 }
                 if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetMovementSpeed)
                 {
                     this.xOwnerObject.xBaseStats.fMovementSpeed = ins.xEvent.afAlterableValues[0];
                     return;
                 }
                 if (ins.xEvent.enEventType == AnimInsEvent.EventType.CreateGhostImage)
                 {
                     if (Program.GetTheGame().bEffectsOn)
                     {
                         VFX_PlayerGhostImage xEff2 = new VFX_PlayerGhostImage(this.xOwnerObject.Owner);
                         Program.GetTheGame()._EffectMaster_AddEffect(xEff2);
                         if (ins.xEvent.afAlterableValues.Length > 0)
                         {
                             xEff2.fAlphaChange = ins.xEvent.afAlterableValues[0];
                             return;
                         }
                     }
                 }
                 else if (ins.xEvent.enEventType == AnimInsEvent.EventType.SetCameraShake)
                 {
                     if (Vector2.Distance(Program.GetTheGame().xLocalPlayer.xEntity.xTransform.v2Pos, this.xOwnerObject.xTransform.v2Pos) < 600f)
                     {
                         this.xCamera.SetShake((int)ins.xEvent.afAlterableValues[0]);
                         return;
                     }
                 }
                 else
                 {
                     if (ins.xEvent.enEventType == AnimInsEvent.EventType.SkipFrameFractions)
                     {
                         this.fPassedTicks += ins.xEvent.afAlterableValues[0] * this.fAnimationTimeWarp;
                         return;
                     }
                     if (ins.xEvent.enEventType == AnimInsEvent.EventType.OverrideHatDirection)
                     {
                         this.byHatDirectionOverride = (byte)ins.xEvent.afAlterableValues[0];
                         return;
                     }
                     if (ins.xEvent.enEventType == AnimInsEvent.EventType.OverrideHatRotation)
                     {
                         this.fHatRotation = ins.xEvent.afAlterableValues[0];
                         return;
                     }
                     if (ins.xEvent.enEventType == AnimInsEvent.EventType.ClearAttackphaseHitlist)
                     {
                         if (this.xOwnerObject.xAttackPhase != null)
                         {
                             this.xOwnerObject.xAttackPhase.lxHitEntities.Clear();
                             return;
                         }
                     }
                     else if (ins.xEvent.enEventType == AnimInsEvent.EventType.PlayAnimationOfWantedQuad)
                     {
                         ushort iAnimToPlay = (ushort)ins.xEvent.afAlterableValues[0];
                         if (this.byWantedNextDirection == 4)
                         {
                             iAnimToPlay += (ushort)this.xOwnerObject.byAnimationDirection;
                         }
                         else
                         {
                             iAnimToPlay += (ushort)this.byWantedNextDirection;
                         }
                         this.SwitchAnimation(iAnimToPlay, Animation.CancelOptions.IgnoreIfPlaying);
                     }
                 }
             }
         }
     }
 }