From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/XArtsSkill.cs | 1253 +++++++++++++++++++++++ 1 file changed, 1253 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XArtsSkill.cs (limited to 'Client/Assets/Scripts/XMainClient/XArtsSkill.cs') diff --git a/Client/Assets/Scripts/XMainClient/XArtsSkill.cs b/Client/Assets/Scripts/XMainClient/XArtsSkill.cs new file mode 100644 index 00000000..18234d91 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XArtsSkill.cs @@ -0,0 +1,1253 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XArtsSkill : XSkill + { + public override int SkillType + { + get + { + return 1; + } + } + + public override string AnimClipName + { + get + { + return this._data.ClipName; + } + } + + private SmallBuffer _fx; + + protected SmallBuffer _combined_fx; + + private Vector3 _warning_face = Vector3.forward; + + private Vector3 _warning_pos = Vector3.zero; + + protected bool _end_solo_effect = false; + + protected bool _set_camera_effect = false; + + protected bool _combined_set_camera_effect = false; + + protected bool _set_camera_shake = false; + + protected bool _combined_set_camera_shake = false; + + protected bool _set_not_selected = false; + + protected bool _combined_set_not_selected = false; + + public static uint _move_mob_id = 99999999u; + + private SmallBuffer _mob_unit; + + protected enum EArtsSkillTimerCb + { + EOnResult = 2, + EQTEOn, + EQTEOff, + EPreservedSAt, + EPreservedSEnd, + ENotSelected, + EExString, + EManipulate, + EMob, + ECastChain, + EFx, + EAudio, + EWarning, + ECharge, + EShake, + ECameraMotion, + ECameraPostEffect, + ESolidBlack, + ELoopResults, + EGroupResults, + EKillManipulate, + EKillFx, + EEndCameraPostEffect, + EArtsSkillNum + } + + public override void Initialize(XEntity firer) + { + base.Initialize(firer); + this._fx.debugName = "XArtsSkill._fx"; + this._combined_fx.debugName = "XArtsSkill._combined_fx"; + this._mob_unit.debugName = "XArtsSkill._mob_unit"; + XSingleton.singleton.GetSmallBuffer(ref this._fx, 16, 0); + XSingleton.singleton.GetSmallBuffer(ref this._mob_unit, 16, 0); + XSingleton.singleton.GetSmallBuffer(ref this._combined_fx, 16, 0); + } + + public override void Uninitialize() + { + base.Uninitialize(); + XSingleton.singleton.ReturnSmallBuffer(ref this._fx); + XSingleton.singleton.ReturnSmallBuffer(ref this._mob_unit); + XSingleton.singleton.ReturnSmallBuffer(ref this._combined_fx); + } + + protected override bool InnerProcessTimer(object param, int id) + { + bool flag = !base.InnerProcessTimer(param, id); + if (flag) + { + switch (id) + { + case 2: + base.OnResult(param); + return true; + case 3: + this.QTEOn(param); + return true; + case 4: + this.QTEOff(param); + return true; + case 5: + this.PreservedSAt(param); + return true; + case 6: + this.PreservedSEnd(param); + return true; + case 7: + this.NotSelected(param); + return true; + case 8: + this.ExString(param); + return true; + case 9: + this.Manipulate(param); + return true; + case 10: + this.Mob(param); + return true; + case 11: + this.CastChain(param); + return true; + case 12: + this.Fx(param); + return true; + case 13: + this.Audio(param); + return true; + case 14: + this.Warning(param); + return true; + case 15: + this.Charge(param); + return true; + case 16: + this.Shake(param); + return true; + case 17: + this.CameraMotion(param); + return true; + case 18: + this.CameraPostEffect(param); + return true; + case 19: + this.SolidBlack(param); + return true; + case 20: + this.LoopResults(param); + return true; + case 21: + this.GroupResults(param); + return true; + case 22: + this.KillManipulate(param); + return true; + case 23: + this.KillFx(param); + return true; + case 24: + this.EndCameraPostEffect(param); + return true; + } + } + return false; + } + + protected override void Start() + { + base.Start(); + this._set_camera_effect = false; + this._set_camera_shake = false; + this._set_not_selected = false; + bool needTarget = this._data.NeedTarget; + if (needTarget) + { + base.FocusTarget(this._target); + bool isPlayer = this._firer.IsPlayer; + if (isPlayer) + { + base.Manual(); + } + } + this.FireEvents(); + } + + protected virtual void FireEvents() + { + bool flag = this._data.Result != null; + if (flag) + { + for (int i = 0; i < this._data.Result.Count; i++) + { + bool flag2 = this._data.Result[i].LongAttackEffect || !XSingleton.singleton.SyncMode || !this._demonstration; + if (flag2) + { + this._data.Result[i].Token = i; + float at = this._data.Result[i].At; + base.AddedTimerToken(XSingleton.singleton.SetTimer(at * this._time_scale, this._TimerCallback, this._data.Result[i], XArtsSkill.EArtsSkillTimerCb.EOnResult), true); + } + } + } + bool flag3 = this._data.Charge != null; + if (flag3) + { + for (int j = 0; j < this._data.Charge.Count; j++) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer((this._data.Charge[j].Using_Curve ? 0f : this._data.Charge[j].At) * this._time_scale, this._TimerCallback, this._data.Charge[j], XArtsSkill.EArtsSkillTimerCb.ECharge), true); + } + } + bool flag4 = !this._demonstration && this._data.Logical != null; + if (flag4) + { + bool flag5 = this._data.Logical.QTEData != null; + if (flag5) + { + for (int k = 0; k < this._data.Logical.QTEData.Count; k++) + { + bool flag6 = this._firer.QTE != null && this._data.Logical.QTEData[k].QTE != 0; + if (flag6) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Logical.QTEData[k].At * this._time_scale, this._TimerCallback, this._data.Logical.QTEData[k].QTE, XArtsSkill.EArtsSkillTimerCb.EQTEOn), true); + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Logical.QTEData[k].End * this._time_scale, this._TimerCallback, this._data.Logical.QTEData[k].QTE, XArtsSkill.EArtsSkillTimerCb.EQTEOff), true); + } + } + } + bool flag7 = this._core.PreservedStrength > 0; + if (flag7) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Logical.PreservedAt * this._time_scale, this._TimerCallback, this._core.PreservedStrength, XArtsSkill.EArtsSkillTimerCb.EPreservedSAt), true); + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Logical.PreservedEndAt * this._time_scale, this._TimerCallback, null, XArtsSkill.EArtsSkillTimerCb.EPreservedSEnd), true); + } + } + bool flag8 = !XSingleton.singleton.SyncMode || this._demonstration; + if (flag8) + { + bool flag9 = !this._demonstration; + if (flag9) + { + bool flag10 = this._data.Logical != null; + if (flag10) + { + bool flag11 = !string.IsNullOrEmpty(this._data.Logical.Exstring); + if (flag11) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Logical.Exstring_At * this._time_scale, this._TimerCallback, this._data.Logical.Exstring, XArtsSkill.EArtsSkillTimerCb.EExString), true); + } + } + bool flag12 = this._data.Manipulation != null; + if (flag12) + { + for (int l = 0; l < this._data.Manipulation.Count; l++) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Manipulation[l].At * this._time_scale, this._TimerCallback, this._data.Manipulation[l], XArtsSkill.EArtsSkillTimerCb.EManipulate), true); + } + } + bool flag13 = this._data.Chain != null && this._data.Chain.TemplateID > 0 && !string.IsNullOrEmpty(this._data.Chain.Name); + if (flag13) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Chain.At * this._time_scale, this._TimerCallback, this._data.Chain, XArtsSkill.EArtsSkillTimerCb.ECastChain), true); + } + } + bool flag14 = this._data.Mob != null; + if (flag14) + { + for (int m = 0; m < this._data.Mob.Count; m++) + { + bool flag15 = this._data.Mob[m].TemplateID > 0; + if (flag15) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Mob[m].At * this._time_scale, this._TimerCallback, this._data.Mob[m], XArtsSkill.EArtsSkillTimerCb.EMob), true); + } + } + } + } + bool flag16 = this._data.Logical != null && this._data.Logical.Not_Selected_End > 0f; + if (flag16) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Logical.Not_Selected_At * this._time_scale, this._TimerCallback, this._core, XArtsSkill.EArtsSkillTimerCb.ENotSelected), true); + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Logical.Not_Selected_End * this._time_scale, this._TimerCallback, null, XArtsSkill.EArtsSkillTimerCb.ENotSelected), true); + } + bool flag17 = this._data.Fx != null && this._firer.IsVisible && !this._firer.MobShield; + if (flag17) + { + bool flag18 = !XSingleton.singleton.FxShield(this._firer); + for (int n = 0; n < this._data.Fx.Count; n++) + { + bool flag19 = !this._data.Fx[n].Shield || flag18; + if (flag19) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Fx[n].At * this._time_scale, this._TimerCallback, this._data.Fx[n], XArtsSkill.EArtsSkillTimerCb.EFx), false); + } + } + } + bool flag20 = this._data.Audio != null && !this._firer.MobShield; + if (flag20) + { + for (int num = 0; num < this._data.Audio.Count; num++) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Audio[num].At * this._time_scale, this._TimerCallback, this._data.Audio[num], XArtsSkill.EArtsSkillTimerCb.EAudio), false); + } + } + bool flag21 = this._data.Warning != null; + if (flag21) + { + for (int num2 = 0; num2 < this._data.Warning.Count; num2++) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Warning[num2].At * this._time_scale, this._TimerCallback, this._data.Warning[num2], XArtsSkill.EArtsSkillTimerCb.EWarning), false); + } + } + bool flag22 = this._demonstration || this._firer.IsPlayer || this._firer.IsBoss; + if (flag22) + { + bool flag23 = this._data.CameraEffect != null; + if (flag23) + { + for (int num3 = 0; num3 < this._data.CameraEffect.Count; num3++) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.CameraEffect[num3].At * this._time_scale, this._TimerCallback, this._data.CameraEffect[num3], XArtsSkill.EArtsSkillTimerCb.EShake), false); + } + } + bool flag24 = this._demonstration || this._firer.IsPlayer; + if (flag24) + { + bool flag25 = this._data.CameraMotion != null && !string.IsNullOrEmpty(this._data.CameraMotion.Motion3D); + if (flag25) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.CameraMotion.At * this._time_scale, this._TimerCallback, this._core, XArtsSkill.EArtsSkillTimerCb.ECameraMotion), false); + } + bool flag26 = this._data.CameraPostEffect != null; + if (flag26) + { + bool flag27 = !this._demonstration && !string.IsNullOrEmpty(this._data.CameraPostEffect.Effect); + if (flag27) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.CameraPostEffect.At * this._time_scale, this._TimerCallback, this._core, XArtsSkill.EArtsSkillTimerCb.ECameraPostEffect), false); + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.CameraPostEffect.End * this._time_scale, this._TimerCallback, this._core, XArtsSkill.EArtsSkillTimerCb.EEndCameraPostEffect), false); + } + bool flag28 = !this._demonstration && this._data.CameraPostEffect.SolidBlack; + if (flag28) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.CameraPostEffect.Solid_At * this._time_scale, this._TimerCallback, this._core, XArtsSkill.EArtsSkillTimerCb.ESolidBlack), false); + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.CameraPostEffect.Solid_End * this._time_scale, this._TimerCallback, null, XArtsSkill.EArtsSkillTimerCb.ESolidBlack), false); + } + } + } + } + bool flag29 = this._data.Logical.SuppressPlayer && !this._demonstration; + if (flag29) + { + XSingleton.singleton.DummilizePlayer(true); + } + } + + protected override void Stop(bool cleanUp) + { + bool set_camera_effect = this._set_camera_effect; + if (set_camera_effect) + { + XCameraMotionEndEventArgs @event = XEventPool.GetEvent(); + @event.Target = this._firer; + @event.Firer = this._affect_camera; + XSingleton.singleton.FireEvent(@event); + this._affect_camera.Ator.speed = 1f; + bool flag = this._firer.IsPlayer && this._end_solo_effect; + if (flag) + { + XSingleton.singleton.GameCamera.TrySolo(); + } + } + this._end_solo_effect = false; + this._set_camera_effect = false; + bool set_camera_shake = this._set_camera_shake; + if (set_camera_shake) + { + XCameraShakeEventArgs event2 = XEventPool.GetEvent(); + event2.Effect = null; + event2.Firer = this._affect_camera; + XSingleton.singleton.FireEvent(event2); + } + this._set_camera_shake = false; + bool flag2 = this._core == this.MainCore; + if (flag2) + { + bool flag3 = this._data.Logical != null && this._data.Logical.QTEData != null && this._data.Logical.QTEData.Count != 0; + if (flag3) + { + this.QTEOff(null); + } + bool demonstration = this._demonstration; + if (demonstration) + { + XAttackShowEndArgs event3 = XEventPool.GetEvent(); + event3.Firer = this._firer; + event3.ForceQuit = false; + XSingleton.singleton.FireEvent(event3); + } + } + for (int i = 0; i < this._fx.Count; i++) + { + XFx xfx = this._fx[i] as XFx; + bool flag4 = xfx != null; + if (flag4) + { + XSingleton.singleton.DestroyFx(xfx, cleanUp); + } + } + bool flag5 = this._data.Manipulation != null && this._data.Manipulation.Count > 0; + if (flag5) + { + XManipulationOffEventArgs event4 = XEventPool.GetEvent(); + event4.DenyToken = 0L; + XSingleton.singleton.FireEvent(event4); + } + bool flag6 = this._data.Logical != null && this._core.PreservedStrength > 0; + if (flag6) + { + this.PreservedSEnd(null); + } + bool flag7 = this._mob_unit.Count > 0; + if (flag7) + { + for (int j = 0; j < this._mob_unit.Count; j++) + { + XEntity xentity = this._mob_unit[j] as XEntity; + bool lifewithinMobbedSkill = xentity.LifewithinMobbedSkill; + if (lifewithinMobbedSkill) + { + XSingleton.singleton.DestroyEntity(xentity); + } + } + } + this._mob_unit.Clear(); + XSingleton.singleton.StopSound(this._firer, AudioChannel.Skill); + bool flag8 = this._data.Logical != null && this._data.Logical.SuppressPlayer && !this._demonstration; + if (flag8) + { + XSingleton.singleton.DedummilizePlayer(); + } + bool flag9 = this._data.CameraPostEffect != null; + if (flag9) + { + bool flag10 = !this._demonstration && !string.IsNullOrEmpty(this._data.CameraPostEffect.Effect); + if (flag10) + { + this._core.EndCameraPostEffect(); + } + bool flag11 = !this._demonstration && this._data.CameraPostEffect.SolidBlack; + if (flag11) + { + this._affect_camera.SolidCancel(); + } + } + this._fx.Clear(); + bool set_not_selected = this._set_not_selected; + if (set_not_selected) + { + this._firer.CanSelected = true; + } + this._set_not_selected = false; + } + + protected override bool Present() + { + return !XSingleton.singleton.IsGreater(this._timeElapsed, this.MainCore.Soul.Time * this._time_scale); + } + + protected override void Result(XResultData data) + { + bool loop = data.Loop; + if (loop) + { + int num = data.Index << 16; + this.LoopResults(num); + } + else + { + bool group = data.Group; + if (group) + { + int num2 = data.Index << 16; + this.GroupResults(num2); + } + else + { + bool longAttackEffect = data.LongAttackEffect; + if (longAttackEffect) + { + this.Project(data, 0, 0, 0); + } + else + { + XSkill.SkillResult(this._token, this._firer, this._core, data.Index, this.MainCore.ID, data.Token, this._firer.Rotate.GetMeaningfulFaceVector3(), this._firer.EngineObject.Position); + } + } + } + } + + private void Project(XResultData param, int additional = 0, int loop = 0, int group = 0) + { + bool flag = param.LongAttackData == null; + if (!flag) + { + bool attack_All = param.Attack_All; + if (attack_All) + { + List opponent = XSingleton.singleton.GetOpponent(this._firer); + int i = 0; + while (i < opponent.Count) + { + bool flag2 = XEntity.ValideEntity(opponent[i]); + if (flag2) + { + bool flag3 = opponent[i].MobbedBy != null && !param.Mobs_Inclusived; + if (!flag3) + { + XSingleton.singleton.ShootBullet(this.GenerateBullet(param, opponent[i], additional, loop, group, -1, true)); + } + } + IL_8D: + i++; + continue; + goto IL_8D; + } + } + else + { + bool warning = param.Warning; + if (warning) + { + for (int j = 0; j < this._core.WarningPosAt[param.Warning_Idx].Count; j++) + { + XSingleton.singleton.ShootBullet(this.GenerateBullet(param, null, additional, loop, group, j, true)); + } + } + else + { + bool reinforce = param.LongAttackData.Reinforce; + if (reinforce) + { + bool flag4 = loop == 0 && group == 0; + if (flag4) + { + List opponent2 = XSingleton.singleton.GetOpponent(this._firer); + for (int k = 0; k < opponent2.Count; k++) + { + bool flag5 = XEntity.ValideEntity(opponent2[k]) && opponent2[k].Buffs != null && opponent2[k].Buffs.IsBuffStateOn(XBuffType.XBuffType_Mark); + if (flag5) + { + XSingleton.singleton.ShootBullet(this.GenerateBullet(param, opponent2[k], additional, 0, 0, -1, true)); + } + } + } + } + else + { + XSingleton.singleton.ShootBullet(this.GenerateBullet(param, base.Target, additional, loop, group, -1, false)); + } + } + } + } + } + + private void LoopResults(object param) + { + int num = (int)param; + int num2 = num >> 16; + int num3 = num & 65535; + bool flag = !this._data.Result[num2].Loop || this._data.Result[num2].Cycle <= 0f || num3 >= this._data.Result[num2].Loop_Count; + if (!flag) + { + bool group = this._data.Result[num2].Group; + if (group) + { + this.GroupResults(num2 << 16 | num3 << 8 | 0); + } + else + { + bool longAttackEffect = this._data.Result[num2].LongAttackEffect; + if (longAttackEffect) + { + this.Project(this._data.Result[num2], 0, num3, 0); + } + else + { + XSkill.SkillResult(this._token, this._firer, this._core, num2, this.MainCore.ID, this._data.Result[num2].Token, this._firer.EngineObject.Forward, this._firer.EngineObject.Position); + } + } + bool flag2 = !this._demonstration && !XEntity.ValideEntity(this._firer); + if (!flag2) + { + num3++; + bool flag3 = num3 < this._data.Result[num2].Loop_Count; + if (flag3) + { + num = (num2 << 16 | num3); + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Result[num2].Cycle * this._time_scale, this._TimerCallback, num, XArtsSkill.EArtsSkillTimerCb.ELoopResults), true); + } + } + } + } + + private void GroupResults(object param) + { + int num = (int)param; + int num2 = num >> 16; + int num3 = num & 255; + int num4 = (num & 65280) >> 8; + bool flag = !this._data.Result[num2].Group || num3 >= this._data.Result[num2].Group_Count; + if (!flag) + { + Vector3 forward = this._firer.EngineObject.Forward; + int num5 = this._data.Result[num2].Deviation_Angle + this._data.Result[num2].Angle_Step * num3; + num5 = (this._data.Result[num2].Clockwise ? num5 : (-num5)); + bool longAttackEffect = this._data.Result[num2].LongAttackEffect; + if (longAttackEffect) + { + this.Project(this._data.Result[num2], num5, num4, num3); + } + else + { + XSkill.SkillResult(this._token, this._firer, this._core, num2, this.MainCore.ID, this._data.Result[num2].Token, XSingleton.singleton.HorizontalRotateVetor3(forward, (float)num5, true), this._firer.EngineObject.Position); + } + bool flag2 = !this._demonstration && !XEntity.ValideEntity(this._firer); + if (!flag2) + { + num3++; + bool flag3 = num3 < this._data.Result[num2].Group_Count; + if (flag3) + { + num = (num2 << 16 | num4 << 8 | num3); + base.AddedTimerToken(XSingleton.singleton.SetTimer(this._data.Result[num2].Time_Step * this._time_scale, this._TimerCallback, num, XArtsSkill.EArtsSkillTimerCb.EGroupResults), true); + } + } + } + } + + protected void Charge(object o) + { + XChargeData xchargeData = o as XChargeData; + this.ChargeTo(xchargeData.Index); + } + + protected void QTEOn(object o) + { + bool flag = !this._firer.Destroying && this._firer.QTE != null; + if (flag) + { + XSkillQTEEventArgs @event = XEventPool.GetEvent(); + @event.Firer = this._firer; + @event.State = (uint)((o != null) ? ((int)o) : 0); + @event.On = true; + XSingleton.singleton.FireEvent(@event); + } + } + + protected void QTEOff(object o) + { + bool flag = !this._firer.Destroying && this._firer.QTE != null; + if (flag) + { + XSkillQTEEventArgs @event = XEventPool.GetEvent(); + @event.Firer = this._firer; + @event.State = (uint)((o != null) ? ((int)o) : 0); + @event.On = false; + XSingleton.singleton.FireEvent(@event); + } + } + + protected void ChargeTo(int o) + { + int index = o & 255; + float timeGone = (float)(o >> 16) / 1000f; + XChargeEventArgs @event = XEventPool.GetEvent(); + @event.Token = this._token; + @event.Data = this._data.Charge[index]; + @event.TimeGone = timeGone; + @event.TimeScale = this._time_scale; + @event.AimedTarget = (@event.Data.AimTarget ? base.Target : null); + @event.TimeSpan = this._data.Charge[index].End - (this._data.Charge[index].Using_Curve ? 0f : this._data.Charge[index].At); + @event.Firer = this._firer; + XSingleton.singleton.FireEvent(@event); + } + + protected void Audio(object o) + { + XAudioData xaudioData = o as XAudioData; + XSingleton.singleton.PlaySound(this._firer, xaudioData.Channel, xaudioData.Clip); + } + + protected void PreservedSAt(object o) + { + int num = (int)o; + XStrengthPresevationOnArgs @event = XEventPool.GetEvent(); + @event.Host = this._firer; + @event.Firer = XSingleton.singleton.Doc; + XSingleton.singleton.FireEvent(@event); + XAttrChangeEventArgs event2 = XEventPool.GetEvent(); + event2.AttrKey = XAttributeDefine.XAttr_CurrentXULI_Basic; + event2.DeltaValue = (double)num - this._firer.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentXULI_Basic); + event2.Firer = this._firer; + XSingleton.singleton.FireEvent(event2); + } + + protected void PreservedSEnd(object o) + { + XStrengthPresevationOffArgs @event = XEventPool.GetEvent(); + @event.Host = this._firer; + @event.Firer = XSingleton.singleton.Doc; + XSingleton.singleton.FireEvent(@event); + } + + protected void ExString(object o) + { + XSingleton.singleton.SetExternalString(o as string, false); + } + + protected void Manipulate(object o) + { + XManipulationData xmanipulationData = o as XManipulationData; + XManipulationOnEventArgs @event = XEventPool.GetEvent(); + @event.data = xmanipulationData; + @event.Firer = this._firer; + long token = @event.Token; + XSingleton.singleton.FireEvent(@event); + base.AddedTimerToken(XSingleton.singleton.SetTimer((xmanipulationData.End - xmanipulationData.At) * this._time_scale, this._TimerCallback, token, XArtsSkill.EArtsSkillTimerCb.EKillManipulate), true); + } + + protected void MoveMob() + { + XMoveMobEventArgs @event = XEventPool.GetEvent(); + @event.Firer = this._firer; + XSingleton.singleton.FireEvent(@event); + } + + protected void Mob(object o) + { + XMobUnitData xmobUnitData = o as XMobUnitData; + bool flag = (long)xmobUnitData.TemplateID == (long)((ulong)XArtsSkill._move_mob_id); + if (flag) + { + this.MoveMob(); + } + else + { + Vector3 vector = this._firer.EngineObject.Rotation * new Vector3(xmobUnitData.Offset_At_X, xmobUnitData.Offset_At_Y, xmobUnitData.Offset_At_Z); + Vector3 vector2 = this._firer.EngineObject.Position + vector; + bool flag2 = !this._demonstration; + if (flag2) + { + float num = 0f; + bool flag3 = !XSingleton.singleton.TryGetTerrainY(vector2, out num) || num < 0f; + if (flag3) + { + vector2 = this._firer.EngineObject.Position; + } + } + XEntity xentity = this._demonstration ? XSingleton.singleton.CreateDummy((uint)xmobUnitData.TemplateID, vector2, this._firer.EngineObject.Rotation) : XSingleton.singleton.CreateEntityByCaller(this._firer, (uint)xmobUnitData.TemplateID, vector2, this._firer.EngineObject.Rotation, true, this._firer.Attributes.FightGroup); + bool flag4 = xentity != null; + if (flag4) + { + bool isDummy = xentity.IsDummy; + if (isDummy) + { + xentity.LifewithinMobbedSkill = true; + xentity.MobShield = false; + } + else + { + xentity.MobShieldable = xmobUnitData.Shield; + xentity.MobShield = XSingleton.singleton.MobShield(xentity); + xentity.LifewithinMobbedSkill = xmobUnitData.LifewithinSkill; + } + bool flag5 = this._firer.Skill.AddSkillMob(xentity); + if (flag5) + { + bool flag6 = !xentity.IsDummy; + if (flag6) + { + XSingleton.singleton.SetMobProperty(xentity, this._firer, this._core.ID); + bool isBoss = this._firer.IsBoss; + if (isBoss) + { + XSecurityAIInfo xsecurityAIInfo = XSecurityAIInfo.TryGetStatistics(this._firer); + bool flag7 = xsecurityAIInfo != null; + if (flag7) + { + xsecurityAIInfo.OnExternalCallMonster(); + } + } + } + this._mob_unit.Add(xentity); + } + } + } + } + + protected void CastChain(object o) + { + bool flag = this._firer.Skill.SkillMobs == null; + if (!flag) + { + XCastChain xcastChain = o as XCastChain; + for (int i = 0; i < this._firer.Skill.SkillMobs.Count; i++) + { + bool flag2 = (ulong)this._firer.Skill.SkillMobs[i].TypeID == (ulong)((long)xcastChain.TemplateID) && XEntity.ValideEntity(this._firer.Skill.SkillMobs[i]); + if (flag2) + { + XAttackEventArgs @event = XEventPool.GetEvent(); + @event.Identify = XSingleton.singleton.XHash(xcastChain.Name); + @event.Firer = this._firer.Skill.SkillMobs[i]; + @event.Target = null; + XSingleton.singleton.FireEvent(@event); + } + } + } + } + + private XFx FilterFx(Vector3 pos, string path) + { + bool flag = string.IsNullOrEmpty(path); + XFx result; + if (flag) + { + result = null; + } + else + { + bool flag2 = XSingleton.singleton.FilterFx && this._firer != null && !this._firer.IsPlayer && !this._firer.IsBoss && !(this._firer is XDummy); + if (flag2) + { + Vector3 position = XSingleton.singleton.Player.EngineObject.Position; + float num = (pos.x - position.x) * (pos.x - position.x) + (pos.z - position.z) * (pos.z - position.z); + bool flag3 = num < XFxMgr.FilterFxDis4; + if (flag3) + { + result = XSingleton.singleton.CreateFx(path, null, true); + } + else + { + result = null; + } + } + else + { + result = XSingleton.singleton.CreateFx(path, null, true); + } + } + return result; + } + + protected void Fx(object o) + { + XFxData xfxData = o as XFxData; + Vector3 zero = Vector3.zero; + XGameObject xgameObject = this._firer.IsTransform ? this._firer.Transformer.EngineObject : this._firer.EngineObject; + SkillFxType type = xfxData.Type; + if (type != SkillFxType.FirerBased) + { + if (type == SkillFxType.TargetBased) + { + bool flag = this._data.NeedTarget && base.HasValidTarget(); + if (flag) + { + zero= new Vector3(xfxData.Target_OffsetX, xfxData.Target_OffsetY, xfxData.Target_OffsetZ); + xgameObject = (base.Target.IsTransform ? base.Target.Transformer.EngineObject : base.Target.EngineObject); + } + else + { + zero= new Vector3(xfxData.OffsetX, xfxData.OffsetY, xfxData.OffsetZ); + xgameObject = (this._firer.IsTransform ? this._firer.Transformer.EngineObject : this._firer.EngineObject); + } + } + } + else + { + zero= new Vector3(xfxData.OffsetX, xfxData.OffsetY, xfxData.OffsetZ); + xgameObject = (this._firer.IsTransform ? this._firer.Transformer.EngineObject : this._firer.EngineObject); + } + bool flag2 = !this._demonstration && xfxData.StickToGround; + XFx xfx; + if (flag2) + { + zero.y = 0f; + Vector3 vector = xgameObject.Position + xgameObject.Rotation * zero; + vector.y = XSingleton.singleton.TerrainY(vector); + Quaternion rotation = XSingleton.singleton.RotateToGround(vector, xgameObject.Forward); + xfx = this.FilterFx(vector, xfxData.Fx); + bool flag3 = xfx == null; + if (flag3) + { + return; + } + xfx.DelayDestroy = xfxData.Destroy_Delay * this._time_scale; + xfx.Play(vector, rotation, new Vector3(xfxData.ScaleX, xfxData.ScaleY, xfxData.ScaleZ), this._time_scale); + } + else + { + xfx = this.FilterFx(xgameObject.Position, xfxData.Fx); + bool flag4 = xfx == null; + if (flag4) + { + return; + } + xfx.DelayDestroy = xfxData.Destroy_Delay * this._time_scale; + xfx.Play(xgameObject, zero, new Vector3(xfxData.ScaleX, xfxData.ScaleY, xfxData.ScaleZ), this._time_scale, xfxData.Follow, false, xfxData.Bone, 0f); + } + this.RegisterFx(xfx, ((xfxData.End > 0f && xfxData.End < (xfxData.Combined ? this.MainCore.Soul.Time : this._core.Soul.Time)) ? (xfxData.End - xfxData.At) : -1f) * this._time_scale, xfxData.Combined); + } + + protected void Warning(object o) + { + XWarningData xwarningData = o as XWarningData; + this._core.WarningPosAt[xwarningData.Index].Clear(); + bool flag = xwarningData.RandomWarningPos || xwarningData.Type == XWarningType.Warning_Multiple; + if (flag) + { + ulong num = 0UL; + List list = this._core.WarningRandomAt[xwarningData.Index]; + for (int i = 0; i < list.Count; i++) + { + XEntity xentity = (list[i].ID == 0UL) ? base.Target : XSingleton.singleton.GetEntity(list[i].ID); + for (int j = 0; j < list[i].Pos.Count; j++) + { + num += 1UL; + bool flag2 = xentity != null; + if (flag2) + { + uint num2 = list[i].Pos[j]; + float num3 = (num2 & 65535u) / 10f; + uint num4 = num2 >> 16; + XSkillCore.XSkillWarningPackage xskillWarningPackage = default(XSkillCore.XSkillWarningPackage); + Vector3 vector = num3 * XSingleton.singleton.HorizontalRotateVetor3(Vector3.forward, num4, true); + float num5 = xentity.EngineObject.Position.x + vector.x; + float num6 = xentity.EngineObject.Position.z + vector.z; + float num7 = 0f; + bool flag3 = !XSingleton.singleton.TryGetTerrainY(new Vector3(num5, num7, num6), out num7) || num7 < 0f; + if (flag3) + { + num7 = xentity.EngineObject.Position.y; + } + xskillWarningPackage.WarningAt = new Vector3(num5, num7, num6); + xskillWarningPackage.WarningTo = num; + this._core.WarningPosAt[xwarningData.Index].Add(xskillWarningPackage); + XFx xfx = this.FilterFx(xskillWarningPackage.WarningAt, xwarningData.Fx); + bool flag4 = xfx != null; + if (flag4) + { + xfx.Play(xskillWarningPackage.WarningAt, this._demonstration ? Quaternion.identity : XSingleton.singleton.RotateToGround(xskillWarningPackage.WarningAt, Vector3.forward), xwarningData.Scale * Vector3.one, this._time_scale); + bool flag5 = xfx != null; + if (flag5) + { + this.RegisterFx(xfx, xwarningData.FxDuration * this._time_scale, false); + } + } + } + } + } + } + else + { + switch (xwarningData.Type) + { + case XWarningType.Warning_None: + { + XSkillCore.XSkillWarningPackage xskillWarningPackage2 = default(XSkillCore.XSkillWarningPackage); + Vector3 vector2 = this._firer.EngineObject.Rotation * new Vector3(xwarningData.OffsetX, xwarningData.OffsetY, xwarningData.OffsetZ); + float num8 = this._firer.EngineObject.Position.x + vector2.x; + float num9 = this._firer.EngineObject.Position.z + vector2.z; + float num10 = 0f; + bool flag6 = (!this._demonstration && !XSingleton.singleton.TryGetTerrainY(new Vector3(num8, num10, num9), out num10)) || num10 < 0f; + if (flag6) + { + num10 = this._firer.EngineObject.Position.y; + } + num10 = (this._demonstration ? this._firer.EngineObject.Position.y : (num10 + vector2.y)); + xskillWarningPackage2.WarningAt = new Vector3(num8, num10, num9); + xskillWarningPackage2.WarningTo = 0UL; + this._core.WarningPosAt[xwarningData.Index].Add(xskillWarningPackage2); + XFx xfx2 = this.FilterFx(xskillWarningPackage2.WarningAt, xwarningData.Fx); + bool flag7 = xfx2 != null; + if (flag7) + { + xfx2.Play(xskillWarningPackage2.WarningAt, this._demonstration ? Quaternion.identity : XSingleton.singleton.RotateToGround(xskillWarningPackage2.WarningAt, Vector3.forward), xwarningData.Scale * Vector3.one, this._time_scale); + bool flag8 = xfx2 != null; + if (flag8) + { + this.RegisterFx(xfx2, xwarningData.FxDuration * this._time_scale, false); + } + } + break; + } + case XWarningType.Warning_Target: + { + XSkillCore.XSkillWarningPackage xskillWarningPackage3 = default(XSkillCore.XSkillWarningPackage); + bool flag9 = base.HasValidTarget(); + if (flag9) + { + xskillWarningPackage3.WarningAt = new Vector3(base.Target.EngineObject.Position.x, XSingleton.singleton.TerrainY(base.Target.EngineObject.Position), base.Target.EngineObject.Position.z); + xskillWarningPackage3.WarningTo = base.Target.ID; + this._core.WarningPosAt[xwarningData.Index].Add(xskillWarningPackage3); + } + else + { + Vector3 vector3 = this._firer.EngineObject.Rotation * new Vector3(xwarningData.OffsetX, xwarningData.OffsetY, xwarningData.OffsetZ); + float num11 = this._firer.EngineObject.Position.x + vector3.x; + float num12 = this._firer.EngineObject.Position.z + vector3.z; + float num13 = 0f; + bool flag10 = (!this._demonstration && !XSingleton.singleton.TryGetTerrainY(new Vector3(num11, num13, num12), out num13)) || num13 < 0f; + if (flag10) + { + num13 = this._firer.EngineObject.Position.y; + } + num13 = (this._demonstration ? this._firer.EngineObject.Position.y : (num13 + vector3.y)); + xskillWarningPackage3.WarningAt = new Vector3(num11, num13, num12); + xskillWarningPackage3.WarningTo = 0UL; + this._core.WarningPosAt[xwarningData.Index].Add(xskillWarningPackage3); + } + XFx xfx3 = this.FilterFx(xskillWarningPackage3.WarningAt, xwarningData.Fx); + bool flag11 = xfx3 != null; + if (flag11) + { + xfx3.Play(xskillWarningPackage3.WarningAt, this._demonstration ? Quaternion.identity : XSingleton.singleton.RotateToGround(xskillWarningPackage3.WarningAt, Vector3.forward), xwarningData.Scale * Vector3.one, this._time_scale); + bool flag12 = xfx3 != null; + if (flag12) + { + this.RegisterFx(xfx3, xwarningData.FxDuration * this._time_scale, false); + } + } + break; + } + case XWarningType.Warning_All: + { + List opponent = XSingleton.singleton.GetOpponent(this._firer); + int k = 0; + while (k < opponent.Count) + { + bool flag13 = XEntity.ValideEntity(opponent[k]); + if (flag13) + { + bool flag14 = opponent[k].MobbedBy != null && !xwarningData.Mobs_Inclusived; + if (!flag14) + { + XSkillCore.XSkillWarningPackage xskillWarningPackage4 = default(XSkillCore.XSkillWarningPackage); + xskillWarningPackage4.WarningAt = opponent[k].EngineObject.Position; + xskillWarningPackage4.WarningAt.y = XSingleton.singleton.TerrainY(opponent[k].EngineObject.Position); + xskillWarningPackage4.WarningTo = opponent[k].ID; + this._core.WarningPosAt[xwarningData.Index].Add(xskillWarningPackage4); + XFx xfx4 = this.FilterFx(xskillWarningPackage4.WarningAt, xwarningData.Fx); + bool flag15 = xfx4 != null; + if (flag15) + { + xfx4.Play(xskillWarningPackage4.WarningAt, XSingleton.singleton.RotateToGround(xskillWarningPackage4.WarningAt, Vector3.forward), xwarningData.Scale * Vector3.one, this._time_scale); + this.RegisterFx(xfx4, xwarningData.FxDuration * this._time_scale, false); + } + } + } + IL_7F8: + k++; + continue; + goto IL_7F8; + } + break; + } + } + } + } + + protected void CameraMotion(object o) + { + bool flag = !XSingleton.singleton.IsCurrentLevelFinished; + if (flag) + { + XSkillCore xskillCore = o as XSkillCore; + this._affect_camera.Ator.speed = base.TimeScale; + XCameraMotionEventArgs @event = XEventPool.GetEvent(); + @event.Motion = (xskillCore.Soul.CameraMotion.Clone() as XCameraMotionData); + @event.Motion.Follow_Position = true; + @event.Motion.Coordinate = CameraMotionSpace.World; + XOperationMode operationMode = XSingleton.singleton.OperationMode; + if (operationMode != XOperationMode.X25D) + { + if (operationMode - XOperationMode.X3D <= 1) + { + @event.Motion.MotionType = @event.Motion.Motion3DType; + @event.Motion.Motion = @event.Motion.Motion3D; + } + } + else + { + @event.Motion.MotionType = (string.IsNullOrEmpty(@event.Motion.Motion2_5D) ? @event.Motion.Motion3DType : @event.Motion.Motion2_5DType); + @event.Motion.Motion = (string.IsNullOrEmpty(@event.Motion.Motion2_5D) ? @event.Motion.Motion3D : @event.Motion.Motion2_5D); + } + CameraMotionType motionType = @event.Motion.MotionType; + if (motionType != CameraMotionType.AnchorBased) + { + if (motionType == CameraMotionType.CameraBased) + { + @event.Motion.AutoSync_At_Begin = false; + } + } + else + { + @event.Motion.AutoSync_At_Begin = true; + @event.Motion.LookAt_Target = false; + bool flag2 = XSingleton.singleton.GameCamera.Solo != null; + if (flag2) + { + XSingleton.singleton.GameCamera.Solo.Stop(); + this._end_solo_effect = true; + } + } + @event.Target = this._firer; + @event.Trigger = "ToEffect"; + @event.Firer = this._affect_camera; + bool flag3 = xskillCore != this._core; + if (flag3) + { + this._combined_set_camera_effect = XSingleton.singleton.FireEvent(@event); + } + else + { + this._set_camera_effect = XSingleton.singleton.FireEvent(@event); + } + } + } + + protected void CameraPostEffect(object o) + { + XSkillCore xskillCore = o as XSkillCore; + xskillCore.StartCameraPostEffect(); + } + + protected void EndCameraPostEffect(object o) + { + XSkillCore xskillCore = o as XSkillCore; + xskillCore.EndCameraPostEffect(); + } + + protected void NotSelected(object o) + { + this._firer.CanSelected = (o == null); + bool flag = !this._firer.CanSelected; + if (flag) + { + XSkillCore xskillCore = o as XSkillCore; + bool flag2 = xskillCore == this.MainCore; + if (flag2) + { + this._combined_set_not_selected = true; + } + else + { + this._set_not_selected = true; + } + } + } + + protected void Shake(object o) + { + XCameraEffectData xcameraEffectData = o as XCameraEffectData; + XCameraShakeEventArgs @event = XEventPool.GetEvent(); + @event.Effect = xcameraEffectData; + @event.TimeScale = this._time_scale; + @event.Firer = this._affect_camera; + bool combined = xcameraEffectData.Combined; + if (combined) + { + this._combined_set_camera_shake = XSingleton.singleton.FireEvent(@event); + } + else + { + this._set_camera_shake = XSingleton.singleton.FireEvent(@event); + } + } + + protected void SolidBlack(object o) + { + bool flag = o == null; + if (flag) + { + this._affect_camera.SolidCancel(); + } + else + { + this._affect_camera.SolidBlack(); + } + } + + private void KillManipulate(object o) + { + XManipulationOffEventArgs @event = XEventPool.GetEvent(); + @event.DenyToken = (long)o; + @event.Firer = this._firer; + XSingleton.singleton.FireEvent(@event); + } + + private void KillFx(object o) + { + XFx xfx = o as XFx; + this._fx.Remove(xfx); + this._combined_fx.Remove(xfx); + XSingleton.singleton.DestroyFx(xfx, false); + } + + private XBullet GenerateBullet(XResultData data, XEntity target, int additional, int loop, int group, int wid = -1, bool extrainfo = false) + { + ulong bulletid = (ulong)((this._firer.Net == null) ? XSingleton.singleton.UniqueToken : ((long)loop << 56 | (long)group << 48 | (long)((long)((ulong)this.GetCombinedId()) << 40) | (long)data.Index << 32 | (long)((ulong)((uint)this._token)))); + int diviation = data.LongAttackData.FireAngle + additional; + XBullet xbullet = XSingleton.singleton.CreateBullet(bulletid, this._token, this._firer, target, this._core, data, this.MainCore.ID, diviation, this._demonstration, wid); + if (extrainfo) + { + xbullet.ExtraID = (XEntity.ValideEntity(target) ? target.ID : this._core.WarningPosAt[data.Warning_Idx][wid].WarningTo); + } + return xbullet; + } + + private void RegisterFx(XFx fx, float duration, bool combined) + { + if (combined) + { + this._combined_fx.Add(fx); + bool flag = duration > 0f; + if (flag) + { + XCombinedSkill xcombinedSkill = this as XCombinedSkill; + xcombinedSkill.AddedCombinedTimerToken(XSingleton.singleton.SetTimer(duration, this._TimerCallback, fx, XArtsSkill.EArtsSkillTimerCb.EKillFx)); + } + } + else + { + this._fx.Add(fx); + bool flag2 = duration > 0f; + if (flag2) + { + base.AddedTimerToken(XSingleton.singleton.SetTimer(duration, this._TimerCallback, fx, XArtsSkill.EArtsSkillTimerCb.EKillFx), false); + } + } + } + } +} -- cgit v1.1-26-g67d0