void ShowDamage(GameCmd.stMultiAttackDownMagicUserCmd_S cmd) { Profiler.BeginSample("ShowDamage"); uint skillID = cmd.wdSkillID; stShowDemage st = new stShowDemage(); st.uid = Master.GetUID(); st.skillid = skillID; st.defenerList = cmd.data; st.attackID = cmd.dwAttackerID; st.attacktype = (uint)cmd.byAttackerType; st.filterList = null; //Dictionary<uint, List<stMultiAttackDownMagicUserCmd_S.stDefender>> dic = new Dictionary<uint, List<stMultiAttackDownMagicUserCmd_S.stDefender>>(); //dic.Add(skillID, cmd.data); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSTEM_SHOWDAMAGE, (object)st); // damagerManager.RemoveDamage(cmd, m_Master.GetUID()); Profiler.EndSample(); }
void OnEvent(int eventID, object param) { if (eventID == (int)Client.GameEventID.SKILLSYSTEM_SHOWDAMAGE) { stShowDemage st = (stShowDemage)param; bool IsMyNpc = false;//是否是其他人的宠物或者召唤物 if ((GameCmd.SceneEntryType)st.attacktype != GameCmd.SceneEntryType.SceneEntry_Player) { IEntity attacker = EntitySystem.EntityHelper.GetEntity((GameCmd.SceneEntryType)st.attacktype, st.attackID); if (attacker != null) { INPC npc = attacker as INPC; if (npc != null) { if (npc.IsMainPlayerSlave()) { IsMyNpc = true; } } } } uint skillid = st.skillid; List <GameCmd.stMultiAttackDownMagicUserCmd_S.stDefender> defenerList = st.defenerList; if (IsMyNpc || st.attackID == MainPlayerHelper.GetPlayerID()) { //如果攻击者是自己或者自己的宠物 飘血 for (int i = 0; i < defenerList.Count; i++) { var info = defenerList[i]; EntityType type = EntitySystem.EntityHelper.GetEntityEtype(info.byDefencerType); if (info.dwDamage == 0 && info.byDamType == (uint)GameCmd.AttackType.ATTACK_TYPE_FO) { continue; } ShowDamage(info.dwDamage, info.byDamType, info.dwDefencerID, type, info.dwDefencerHP, skillid, st.attackID); } } else { for (int i = 0; i < defenerList.Count; i++) { var info = defenerList[i]; //如果受击者是自己或者自己的宠物 飘血 if (info.dwDamage == 0 && info.byDamType == (uint)GameCmd.AttackType.ATTACK_TYPE_FO) { continue; } if (info.dwDefencerID != MainPlayerHelper.GetPlayerID()) { IEntity en = EntitySystem.EntityHelper.GetEntity(info.byDefencerType, info.dwDefencerID); if (en != null) { INPC npc = en as INPC; if (npc != null) { if (npc.IsTrap()) { return; } if (npc.IsMainPlayerSlave()) {//防御者是自己的宠物 EntityType type = EntitySystem.EntityHelper.GetEntityEtype(info.byDefencerType); ShowDamage(info.dwDamage, info.byDamType, info.dwDefencerID, type, info.dwDefencerHP, skillid, st.attackID); } } else { //怪打人 血量同步 先不同步 //IPlayer otherPlayer = en as IPlayer; //if(otherPlayer != null) //{ // SetEntityCurHP(en, info.dwDefencerHP); //} } } } else {//防御者是自己 EntityType type = EntitySystem.EntityHelper.GetEntityEtype(info.byDefencerType); ShowDamage(info.dwDamage, info.byDamType, info.dwDefencerID, type, info.dwDefencerHP, skillid, st.attackID); } } } } else if (eventID == (int)Client.GameEventID.SKILLSYSTEM_SHOWBUFFDAMAGE) { stBuffDamage st = (stBuffDamage)param; ShowBuffDamage(st); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE) { stPropUpdate prop = (stPropUpdate)param; if (MainPlayerHelper.GetPlayerUID() != prop.uid) { return; } if (prop.nPropIndex == (int)PlayerProp.Exp) { int exp = prop.newValue - prop.oldValue; if (exp < 0) { return; } ShowExp(exp); } } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_LEAVEMAP) { OnLowMemoryWarning(); } else if (eventID == (int)GameEventID.APPLICATION_LOWMEMORY) { OnLowMemoryWarning(); } }