Merge pull request 'fix: update show anim EP normal attack' (#34) from feature/EP_normal_attack into develop

Reviewed-on: https://git.brew.monster/Unity/perfect-world-unity/pulls/34
This commit is contained in:
tungdv
2025-10-22 10:15:47 +00:00
3 changed files with 81 additions and 68 deletions
@@ -1,6 +1,7 @@
using CSNetwork.GPDataType;
using PerfectWorld.Scripts.Player;
using System;
using System.Collections.Generic;
namespace BrewMonster.Scripts
{
@@ -346,7 +347,12 @@ namespace BrewMonster.Scripts
}
private EC_ElsePlayer m_pElsePlayer;
private WorkList[] m_WorkStack = new WorkList[Work_type.NUM_WORKTYPE];
private WorkList[] m_WorkStack = new WorkList[Work_type.NUM_WORKTYPE]
{
new List<CECEPWork>(),
new List<CECEPWork>(),
new List<CECEPWork>()
};
private int m_iCurWorkType;
public CECEPWorkMan(EC_ElsePlayer pElsePlayer)
+67 -66
View File
@@ -401,8 +401,8 @@ public abstract class CECPlayer : CECObject
public void PlayAttackEffect(int idTarget, int idSkill, int skillLevel, int nDamage,
uint dwModifier, int nAttackSpeed, ref int piAttackTime , int nSection = 0)
{
/* if (!IsAllResReady())
return;*/
if (!IsAllResReady())
return;
if (idSkill == 0)
{
@@ -438,7 +438,7 @@ public abstract class CECPlayer : CECObject
{
if (!IsDead() && (dwModifier & (uint)MOD.MOD_RETORT) == 0
&& (dwModifier & (uint)MOD.MOD_ATTACK_AURA) == 0
&& PlayAttackAction(nAttackSpeed, out piAttackTime, pAttack)
&& PlayAttackAction(nAttackSpeed, ref piAttackTime, pAttack)
&& (dwModifier & (uint)MOD.MOD_BEAT_BACK) == 0)
{
}
@@ -448,66 +448,67 @@ public abstract class CECPlayer : CECObject
}
}
}
else
{
/* if (skillLevel == 0)
{
if (m_pCurSkill)
skillLevel = m_pCurSkill->GetSkillLevel();
else
skillLevel = 1;
}
//else
//{
// if (skillLevel == 0)
// {
// if (m_pCurSkill)
// skillLevel = m_pCurSkill.GetSkillLevel();
// else
// skillLevel = 1;
// }
CECAttackEvent* pAttack = NULL;
// CECAttackEvent pAttack1 = null;
// first try to find if there is already a skill attack event in attackman
CECAttackerEvents attackerEvents = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->FindAttackByAttacker(GetPlayerInfo().cid);
if (attackerEvents)
{
if (CECAttackEvent * pAttack = attackerEvents.Find(idSkill, nSection))
{
// Ãæ¹¥»÷µÄ·ÇµÚÒ»´ÎÉ˺¦ÏûÏ¢
pAttack->AddTarget(idTarget, dwModifier, nDamage);
goto EXIT;
}
else
{
attackerEvents.Signal();
}
}
if (GNET::ElementSkill::IsGoblinSkill(idSkill) &&
GNET::ElementSkill::GetType(idSkill) == 2)
{
pAttack = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->AddSkillAttack(
GetPlayerInfo().cid, GetPlayerInfo().cid, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
}
else
{
// begin a skill attack
pAttack = g_pGame->GetGameRun()->GetWorld()->GetAttacksMan()->AddSkillAttack(
GetPlayerInfo().cid, m_idCurSkillTarget, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
}
// // first try to find if there is already a skill attack event in attackman
// CECAttackerEvents attackerEvents = g_pGame.GetGameRun().GetWorld().GetAttacksMan().FindAttackByAttacker(GetPlayerInfo().cid);
// if (attackerEvents)
// {
// CECAttackEvent pAttack1 = attackerEvents.Find(idSkill, nSection);
// if (pAttack1 != null)
// {
// // Ãæ¹¥»÷µÄ·ÇµÚÒ»´ÎÉ˺¦ÏûÏ¢
// pAttack1.AddTarget(idTarget, dwModifier, nDamage);
// goto EXIT;
// }
// else
// {
// attackerEvents.Signal();
// }
// }
// if (ElementSkill::IsGoblinSkill(idSkill) &&
// GNET::ElementSkill::GetType(idSkill) == 2)
// {
// pAttack = g_pGame.GetGameRun().GetWorld().GetAttacksMan().AddSkillAttack(
// GetPlayerInfo().cid, GetPlayerInfo().cid, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
// }
// else
// {
// // begin a skill attack
// pAttack = g_pGame.GetGameRun().GetWorld().GetAttacksMan().AddSkillAttack(
// GetPlayerInfo().cid, m_idCurSkillTarget, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
// }
if (pAttack)
{
pAttack->SetSkillSection(nSection);
if (!IsDead() && (dwModifier & CECAttackEvent::MOD_RETORT) == 0
&& (dwModifier & CECAttackEvent::MOD_ATTACK_AURA) == 0
&& PlaySkillAttackAction(idSkill, nAttackSpeed, NULL, nSection, &pAttack->m_bSignaled)
&& (dwModifier & CECAttackEvent::MOD_BEAT_BACK) == 0)
{
}
else
{
pAttack->m_bSignaled = true;
}
}
// if (pAttack)
// {
// pAttack.SetSkillSection(nSection);
// if (!IsDead() && (dwModifier & CECAttackEvent::MOD_RETORT) == 0
// && (dwModifier & CECAttackEvent::MOD_ATTACK_AURA) == 0
// && PlaySkillAttackAction(idSkill, nAttackSpeed, NULL, nSection, &pAttack.m_bSignaled)
// && (dwModifier & CECAttackEvent::MOD_BEAT_BACK) == 0)
// {
// }
// else
// {
// pAttack.m_bSignaled = true;
// }
// }
EXIT:
// For skill attacking, time is always set to 0
if (piAttackTime)
*piAttackTime = 0;*/
}
//EXIT:
// // For skill attacking, time is always set to 0
// if (piAttackTime)
// *piAttackTime = 0;
//}
}
private void ClearComActFlagAllRankNodes(bool v)
@@ -522,12 +523,12 @@ public abstract class CECPlayer : CECObject
v = value;
}
}
public bool PlayAttackAction(int nAttackSpeed, out int attackTime, CECAttackEvent attackEvent)
public bool PlayAttackAction(int nAttackSpeed, ref int attackTime, CECAttackEvent attackEvent)
{
attackTime = 0;
//attackTime = 0;
if (_pPlayerModel == null)
return false;
//if (_pPlayerModel == null)
// return false;
int nRand = UnityEngine.Random.Range(0, 4);
string szAct = string.Empty;
@@ -746,7 +747,7 @@ public abstract class CECPlayer : CECObject
return;
}
}
var target = EC_ManMessageMono.Instance.GetObject(idTarget, 0).transform;
var target = EC_ManMessageMono.Instance?.GetObject(idTarget, 0)?.gameObject.transform;
if (target == null)
{
BMLogger.LogError("HoangDev: ko có transform ");
@@ -782,7 +783,7 @@ public abstract class CECPlayer : CECObject
}
bool IsPlayingMoveAction()
{
return m_pActionController ? m_pActionController->IsPlayingMoveAction() : false;
return m_pActionController ? m_pActionController.IsPlayingMoveAction() : false;
}*/
public int GetMoveStandAction(bool bMove, bool bFight = false)
{
@@ -945,7 +946,7 @@ public abstract class CECPlayer : CECObject
public float GetGroundSpeed()
{
// return m_bWalkRun ? g_pGame->GetConfigs()->GetHostRunSpeed() : m_ExtProps.mv.walk_speed;
// return m_bWalkRun ? g_pGame.GetConfigs().GetHostRunSpeed() : m_ExtProps.mv.walk_speed;
return m_bWalkRun ? m_ExtProps.mv.run_speed : m_ExtProps.mv.walk_speed;
}
@@ -32,6 +32,7 @@ namespace PerfectWorld.Scripts.Player
public void Init(RoleInfo roleInfo, info_player_1 Info)
{
m_dwResFlags = (uint)PlayerResourcesReadyFlag.RESFG_ALL;
m_pEPWorkMan = new CECEPWorkMan(this);
m_iProfession = roleInfo.occupation;
m_iGender = roleInfo.gender;
@@ -45,6 +46,10 @@ namespace PerfectWorld.Scripts.Player
m_cdr.vExts = m_aabbServer.Extents;
m_cdr.vVelocity.Clear();
m_FightCnt = new CECCounter();
m_FightCnt.SetPeriod(15000);
m_FightCnt.Reset(true);
A3DVECTOR3 vPos = GetPos();
m_aabb.Center = vPos + new A3DVECTOR3(0.0f, m_aabb.Extents.y, 0.0f);
m_aabb.CompleteMinsMaxs();
@@ -409,7 +414,8 @@ namespace PerfectWorld.Scripts.Player
TurnFaceTo(pCmd.target_id);
// TO DO: fix later
//PlayAttackEffect(pCmd.target_id, 0, 0, -1, pCmd.attack_flag, pCmd.speed* 50);
int attackTime = int.MinValue;
PlayAttackEffect(pCmd.target_id, 0, 0, -1, (uint)pCmd.attack_flag, pCmd.speed* 50, ref attackTime);
if (!m_pEPWorkMan.FindWork(CECEPWorkMan.Work_type.WT_NORMAL, CECEPWork.EP_work_ID.WORK_HACKOBJECT)){
m_pEPWorkMan.StartNormalWork(new CECEPWorkMelee(m_pEPWorkMan, pCmd.target_id));