void OnEvent(GAME_EVENT_ID eventid, List <string> vParam) { switch (eventid) { case GAME_EVENT_ID.GE_CHANGE_BAR: { for (int i = 0; i < MAX_SHORTCUT_COUNT; i++) { int actionID = CActionSystem.Instance.MainMenuBar_Get(i); mItems[i] = null; CActionItem pItem = CActionSystem.Instance.GetActionByActionId(actionID); if (pItem != null) { switch (pItem.GetType()) { case ACTION_OPTYPE.AOT_SKILL: { SCLIENT_SKILL pSkill = pItem.GetImpl() as SCLIENT_SKILL; if (pSkill == null) { break; } mItems[i] = pItem; } break; case ACTION_OPTYPE.AOT_PET_SKILL: { PET_SKILL pPetSkill = pItem.GetImpl() as PET_SKILL; if (pPetSkill == null) { break; } mItems[i] = pItem; } break; } } } } break; } }
bool isAttackableSkill(CActionItem item) { if (item == null) { return(false); } bool result = false; SCLIENT_SKILL pSkill = item.GetImpl() as SCLIENT_SKILL; switch (item.GetType()) { case ACTION_OPTYPE.AOT_SKILL: { if (pSkill == null) { break; } ENUM_SELECT_TYPE typeSel = (ENUM_SELECT_TYPE)pSkill.m_pDefine.m_nSelectType; switch (typeSel) { case ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER: case ENUM_SELECT_TYPE.SELECT_TYPE_DIR: case ENUM_SELECT_TYPE.SELECT_TYPE_POS: case ENUM_SELECT_TYPE.SELECT_TYPE_NONE: result = true; break; default: break; } } break; default: break; } if (result) { OPERATE_RESULT retVal = pSkill.IsCanUse_CheckCoolDown(); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_CheckPassive(); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_CheckLevel(CObjectManager.Instance.getPlayerMySelf().ID, pSkill.m_nLevel); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_CheckFightState(CObjectManager.Instance.getPlayerMySelf().ID); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_CheckDeplete(CObjectManager.Instance.getPlayerMySelf().ID); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } retVal = pSkill.IsCanUse_Leaned(); if (retVal != OPERATE_RESULT.OR_OK) { return(false); } } return(result); }
bool CanUseSkill(CActionItem skillItem, CObject_Character target) { if (skillItem == null) { return(false); } if (target == null) { return(false); } if (target.IsDie()) { return(false); } switch (skillItem.GetType()) { case ACTION_OPTYPE.AOT_SKILL: { SCLIENT_SKILL pSkill = skillItem.GetImpl() as SCLIENT_SKILL; if (pSkill == null) { break; } Vector3 avatarPos = CObjectManager.Instance.getPlayerMySelf().GetPosition(); Vector3 avatarPosOnPlane = new Vector3(avatarPos.x, 0, avatarPos.z); Vector3 targetPos = new Vector3(-1, 0, -1); int ServerID = -1; targetPos = new Vector3(target.GetPosition().x, 0, target.GetPosition().z); ServerID = target.ServerID; Vector3 PosOnPlane = new Vector3(targetPos.x, 0, targetPos.z); float dir = Vector3.Angle(avatarPosOnPlane, PosOnPlane); OPERATE_RESULT result = pSkill.IsCanUse(CObjectManager.Instance.getPlayerMySelf().ID, pSkill.m_nLevel, ServerID, targetPos.x, targetPos.z, dir); if (result == OPERATE_RESULT.OR_OK) { return(true); } } break; case ACTION_OPTYPE.AOT_PET_SKILL: { PET_SKILL pPetSkill = skillItem.GetImpl() as PET_SKILL; if (pPetSkill == null) { break; } if (Interface.Pet.Instance.IsFighting(pPetSkill.m_nPetNum)) { return(true); } } break; } return(false); }