using Thousandto.Cfg.Data; using Thousandto.Code.Center; using Thousandto.Code.Global; namespace Thousandto.Code.Logic { //变身buff public class ChangeModelBuff : Buff { protected override void OnAddBuffSpecial(Character owner) { base.OnAddBuffSpecial(owner); if (owner is Player) { Player p = owner as Player; var changeCfg = DeclareChangeModel.Get(Cfg.Id); if (changeCfg != null) { p.StartChangeModel(changeCfg); if (p.IsLocalPlayer()) { var lp = p as LocalPlayer; if (lp.IsOnMount) { //下马 lp.MountDown(); } var paramsArray = changeCfg.Skill.Split('_'); int[] changeSkills = new int[4]; for (int i = 0; i < changeSkills.Length && i < paramsArray.Length; ++i) { changeSkills[i] = int.Parse(paramsArray[i]); } GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_SET_CHANGEMODEL_SKILL, Cfg.Id); //重新开始挂机 GameCenter.LuaSystem.Adaptor.RestartMandate(); GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CHANGE_SKILL_CHANGED); //功能开启检测 GameCenter.BlockingUpPromptSystem.AddNewFunction(0, 10000005); } } } } protected override void OnDeleteBuffSpecial(Character owner) { base.OnDeleteBuffSpecial(owner); if (owner is Player) { var player = owner as Player; player.StopChangeModel(); if (owner.IsLocalPlayer()) { GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CLEAR_CHANGEMODEL_SKILL); //重新开始挂机 GameCenter.LuaSystem.Adaptor.RestartMandate(); GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CHANGE_SKILL_CHANGED); } } } } }