예제 #1
0
	void OnActionItem( AsIMessage _msg)
	{
		if( AsPStoreManager.Instance.UnableActionByPStore() == true)
			return;

		if( CheckSpecificWindowOpened() == true)
			return;

		Msg_Player_Use_ActionItem msg = _msg as Msg_Player_Use_ActionItem;
		ItemData itemData = msg.realItem.item.ItemData;
		Tbl_Skill_Record record = AsTableManager.Instance.GetTbl_Skill_Record( itemData.itemSkill);
		eGENDER gender = UserEntity.GetProperty<eGENDER>( eComponentProperty.GENDER);
		Msg_Player_Skill_Ready ready = new Msg_Player_Skill_Ready( itemData, msg.realItem.getSlot, gender);
		ready.SetCurrentTarget( Target);

		if( CheckMap_Village() == true && ready.constructSucceed == true)
		{
//			string content = AsTableManager.Instance.GetTbl_String(830);
//			AsChatManager.Instance.InsertChat( content, eCHATTYPE.eCHATTYPE_SYSTEM, true);
			AsMyProperty.Instance.AlertSkillInTown();
			return;
		}

//		Msg_Player_Use_ActionItem msg = _msg as Msg_Player_Use_ActionItem;
//		ItemData itemData = msg.realItem.item.ItemData;
//		Tbl_Skill_Record record = AsTableManager.Instance.GetTbl_Skill_Record( itemData.itemSkill);

		bool permit = true;

		if( record.Skill_Type == eSKILL_TYPE.SlotBase && m_ElapsedCoolTime_BaseAttack > 0)
			permit = false;

		if( permit == true)
		{
//			eGENDER gender = UserEntity.GetProperty<eGENDER>( eComponentProperty.GENDER);
//			Msg_Player_Skill_Ready ready = new Msg_Player_Skill_Ready( itemData, msg.realItem.getSlot, gender);

			if( ready.constructSucceed == true)
			{
				if( WeaponEquip == false)
				{
					AsMyProperty.Instance.AlertNoWeapon();
					return;
				}

				if( null == msg || null == msg.realItem || msg.realItem.CheckSkillUsable() == false)
					return;

				int iCurLevel = m_Entity.GetProperty<int>( eComponentProperty.LEVEL);
				if( iCurLevel < itemData.levelLimit)
				{
					AsChatManager.Instance.InsertChat( AsTableManager.Instance.GetTbl_String(1651), eCHATTYPE.eCHATTYPE_SYSTEM);
					AsEventNotifyMgr.Instance.CenterNotify.AddTradeMessage( AsTableManager.Instance.GetTbl_String(1651));
					return;
				}

				if( AsCommonSender.CheckSkillUseProcessing() == true)
					return;

				if( m_Entity.CheckCondition( eSkillIcon_Enable_Condition.Movable) == false &&
					ready.skillRecord.CheckSkillUsingOnly_Movable() == true)
				{
					AsMyProperty.Instance.AlertState();
					return;
				}

//				if( SetTargetInActionItem( record) == false)
//					return;
				
				TargetDecider.sTargeting_AsSlot( this, ready.skillRecord);
				
				if( TargetDecider.CheckValidSkill( this, ready.skillRecord) == false)
					return;

				if( m_Target == null &&
					( ready.skillRecord.Skill_Type == eSKILL_TYPE.Target ||
					ready.skillRecord.Skill_Type == eSKILL_TYPE.SlotBase))
					return;
				
				if( TargetDecider.TargetSkillCheck( ready.skillRecord.Index, this) == false)
					return;

				if( ready.CheckValidTargeting( m_Target) == false)
					return;

				if( Target != null &&
					m_Entity.GetNavPathDistance( Entity.transform.position, Target.transform.position, true) >
					ready.skillLvRecord.Usable_Distance * 0.01f)// * m_Character_Size)
				{
					Debug.Log( "AsPlayerFsm::OnSkillActive: msg.skillIdx_ = " + itemData.itemSkill + ", BattleRun state began [time:" + Time.realtimeSinceStartup + "]");
					Msg_Player_Skill_Target_Move targetMove = new Msg_Player_Skill_Target_Move( ready);
					m_CurrentFsmState.MessageProcess( targetMove);
				}
				else
				{
					Debug.Log( "AsPlayerFsm::OnSkillActive: msg.skillIdx_ = " + itemData.itemSkill + ", SkillReady state began [time:" + Time.realtimeSinceStartup + "]");
					m_CurrentFsmState.MessageProcess( ready);
				}
			}
			else if( ready.skillRecord.CheckNonAnimation() == true)
			{
				if( msg.realItem.CheckSkillUsable() == false)
					return;

				int iCurLevel = m_Entity.GetProperty<int>( eComponentProperty.LEVEL);
				if( iCurLevel < itemData.levelLimit)
				{
					AsChatManager.Instance.InsertChat( AsTableManager.Instance.GetTbl_String(1651), eCHATTYPE.eCHATTYPE_SYSTEM);
					AsEventNotifyMgr.Instance.CenterNotify.AddTradeMessage( AsTableManager.Instance.GetTbl_String(1651));
					return;
				}
				
				if( AsCommonSender.CheckSkillUseProcessing() == true)
					return;
				
				TargetDecider.sTargeting_AsSlot( this, ready.skillRecord);
				
				if( TargetDecider.CheckValidSkill( this, ready.skillRecord) == false)
					return;
				
				if( TargetDecider.TargetSkillCheck( ready.skillRecord.Index, this) == false)
					return;

				int mainTargetIdxNpc = 0;
				uint mainTargetIdxUser = 0;

				TargetDecider decider = new TargetDecider();
				if( decider.SetTarget( this, ready) == true)
				{
					mainTargetIdxNpc = decider.listTargets_Npc[0];
					mainTargetIdxUser = decider.listTargets_User[0];

					if( mainTargetIdxNpc != int.MaxValue && mainTargetIdxUser != uint.MaxValue)
					{
						AS_CS_CHAR_ATTACK_NPC attack = new AS_CS_CHAR_ATTACK_NPC( ready.skillLvRecord.Skill_GroupIndex,
							ready.skillLvRecord.Skill_Level, ready.actionRecord.Index,
							0, false, false, ready.itemSlot,
							decider.listTargets_Npc , decider.listTargets_User, ready.picked, transform.forward,
							decider.decidedEntities.TargetCount, decider.decidedEntities.CharCount,
							decider.decidedEntities.listTarget.ToArray(), decider.decidedEntities.listChar.ToArray());

						if( showSendingPacket == true)
						{
							Tbl_Action_Record action = AsTableManager.Instance.GetTbl_Action_Record( attack.nActionTableIdx);

							Debug.Log( "OnActionItem::SendingPacket: action name=" + action.ActionName +
								" skill index=" + attack.nSkillTableIdx +
								" skill level=" + attack.nSkillLevel + " action index=" + attack.nActionTableIdx +
								" charge step=" + attack.nChargeStep + " casting=" + attack.bCasting + " attack.nSlot =" + attack.nSlot +
								" main target id=" + attack.nNpcIdx[0] + " skill pos=" + attack.sTargeting +
								" transform.forward=" + transform.forward);
						}

//						byte[] bytes = attack.ClassToPacketBytes();
//						AsCommonSender.Send( bytes);
						ePotency_Type potencyType = ready.skillRecord.listSkillPotency[0].Potency_Type;
						if( ePotency_Type.NormalHardPlayCount == potencyType || ePotency_Type.HellPlayCount == potencyType || ePotency_Type.HellPlayCountAll == potencyType)
						{
							if( null != AsHudDlgMgr.Instance && null != AsHudDlgMgr.Instance.invenDlg)
							{
								AsHudDlgMgr.Instance.invenDlg.ConfirmIndunCountItem( potencyType, attack, itemData, ready.skillRecord.Index);
							}
						}
						else
						{
							byte[] bytes = attack.ClassToPacketBytes();
							AsCommonSender.Send( bytes);
						}
					}
				}
			}
		}
	}
예제 #2
0
	void OnSkillActive( AsIMessage _msg)
	{
//		Msg_Input_Slot_Active __msg = _msg as Msg_Input_Slot_Active;
//		Debug.Log( "AsPlayerFsm::OnSkillActive: __msg.skillIdx_ = " + __msg.skillIdx_);

		if( AsPStoreManager.Instance.UnableActionByPStore() == true)
			return;

		if( CheckSpecificWindowOpened() == true)
			return;

		if( CheckMap_Village() == true)
		{
//			string content = AsTableManager.Instance.GetTbl_String(830);
//			AsChatManager.Instance.InsertChat( content, eCHATTYPE.eCHATTYPE_SYSTEM, true);
			AsMyProperty.Instance.AlertSkillInTown();
			return;
		}

		if( WeaponEquip == false)
		{
			AsMyProperty.Instance.AlertNoWeapon();
			return;
		}

		Msg_Input_Slot_Active msg = _msg as Msg_Input_Slot_Active;
		Tbl_Skill_Record record = AsTableManager.Instance.GetTbl_Skill_Record( msg.skillIdx_);

		bool permit = true;

		if( record.Skill_Type == eSKILL_TYPE.SlotBase && m_ElapsedCoolTime_BaseAttack > 0)
		{
			Debug.Log( "AsPlayerFsm::OnSkillActive: SlotBase skill is used in base attack cool time.");
			permit = false;
		}
		
//		if(record.Skill_Type == eSKILL_TYPE.Stance)
//		{
//			body_CS_CHAR_SKILL_STANCE stance = new body_CS_CHAR_SKILL_STANCE();
//			byte[] bytes = stance.ClassToPacketBytes();
//			AsCommonSender.Send(bytes);
//			
////			AsCommonSender.BeginSkillUseProcess( record.Index);
//		}

		if( permit == true)
		{
			eGENDER gender = UserEntity.GetProperty<eGENDER>( eComponentProperty.GENDER);

			Msg_Player_Skill_Ready ready = new Msg_Player_Skill_Ready( record, gender, msg.step_,
				null, Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero,
				m_Entity.transform.forward, eClockWise.CW);

			if( ready.constructSucceed == true)
			{
				if( AsCommonSender.CheckSkillUseProcessing() == true)
					return;
				
				if( ready.CheckValidTargeting( m_Target) == false)
				{
					Debug.Log( "AsPlayerFsm::OnSkillActive: m_Target.GetInstanceID() = " + m_Target.GetInstanceID());
					Target = null;
					return;
				}

				if( Target != null &&
					m_Entity.GetNavPathDistance( Entity.transform.position, Target.transform.position, true) >
					ready.skillLvRecord.Usable_Distance * 0.01f)// * m_Character_Size)
				{
//					Debug.Log( "AsPlayerFsm::OnSkillActive: msg.skillIdx_ = " + msg.skillIdx_ + ", BattleRun state began [time:" + Time.realtimeSinceStartup + "]");
					Msg_Player_Skill_Target_Move targetMove = new Msg_Player_Skill_Target_Move( ready);
					m_CurrentFsmState.MessageProcess( targetMove);
				}
				else
				{
//					Debug.Log( "AsPlayerFsm::OnSkillActive: msg.skillIdx_ = " + msg.skillIdx_ + ", SkillReady state began [time:" + Time.realtimeSinceStartup + "]");
					m_CurrentFsmState.MessageProcess( ready);
				}
			}
		}
	}