Ejemplo n.º 1
0
	void OnSoulStone( AsIMessage _msg)
	{
		Msg_CharSkillSoulStone soul = _msg as Msg_CharSkillSoulStone;
		soul.SetPlayerFsm( this);

		eGENDER gender = m_Entity.GetProperty<eGENDER>(eComponentProperty.GENDER);
		Msg_Player_Skill_Ready ready = new Msg_Player_Skill_Ready( soul.soul_.nSkillTableIdx, soul.soul_.nSkillLevel, gender);
		ready.SetCurrentTarget( Target);

		if( ready.skillRecord.CheckNonAnimation() == true)
		{
			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());
					
					attack.SetEquipSlot( soul.soul_.eEquipSlot);

//					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);
				}
			}
		}
	}
Ejemplo n.º 2
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);
						}
					}
				}
			}
		}
	}