2010
This commit is contained in:
@@ -155,7 +155,7 @@ public class CECAttackEvent
|
||||
if (m_timeLived > 3500)
|
||||
{
|
||||
// too long time, this event will be deleted now
|
||||
BMLogger.LogError("HoangDev: m_bSignaled: " + m_bSignaled);
|
||||
//BMLogger.LogError("HoangDev: m_bSignaled: " + m_bSignaled);
|
||||
|
||||
m_bFinished = true;
|
||||
//DoFire();
|
||||
@@ -180,7 +180,7 @@ public class CECAttackEvent
|
||||
}
|
||||
else if (m_timeToDoDamage != 0)
|
||||
{
|
||||
BMLogger.LogError($"HoangDev: m_timeToDoDamage:{m_timeToDoDamage} , dwDeltaTime: {dwDeltaTime}");
|
||||
//BMLogger.LogError($"HoangDev: m_timeToDoDamage:{m_timeToDoDamage} , dwDeltaTime: {dwDeltaTime}");
|
||||
if (m_timeToDoDamage <= dwDeltaTime)
|
||||
{
|
||||
m_timeToDoDamage = 0;
|
||||
@@ -243,13 +243,13 @@ public class CECAttackEvent
|
||||
}
|
||||
else if (GPDataTypeHelper.ISPLAYERID(idTarget))
|
||||
{
|
||||
/* CECPlayer* pPlayer = pGameRun->GetWorld()->GetPlayerMan()->GetPlayer(idTarget);
|
||||
if (!pPlayer)
|
||||
return true;
|
||||
CECPlayer pPlayer = EC_ManMessageMono.Instance.GetECManPlayer.GetPlayer(idTarget);
|
||||
if (!pPlayer)
|
||||
return true;
|
||||
|
||||
strName = GetPlayerName(pPlayer);
|
||||
//strName = GetPlayerName(pPlayer);
|
||||
|
||||
pPlayer->Damaged(data.nDamage, data.dwModifier, m_idSkill);*/
|
||||
pPlayer.Damaged(data.nDamage, data.dwModifier, m_idSkill);
|
||||
}
|
||||
|
||||
/* if (data.nDamage > 0)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using DG.Tweening; // cần DOTween
|
||||
@@ -41,7 +41,7 @@ public class DamageTextManager : MonoBehaviour
|
||||
/// <summary>
|
||||
/// Gọi để spawn text damage
|
||||
/// </summary>
|
||||
public void SpawnDamage(Vector3 worldPos, int damage, Color color, float scale = 1f)
|
||||
public void ShowDamageText(Vector3 worldPos, int damage, Color color = default, float scale = 1f)
|
||||
{
|
||||
var text = GetFromPool();
|
||||
text.text = damage.ToString();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Animancer;
|
||||
using Animancer.Editor;
|
||||
using BrewMonster;
|
||||
using CSNetwork.GPDataType;
|
||||
@@ -6,6 +7,7 @@ using PerfectWorld.Scripts.Managers;
|
||||
using PerfectWorld.Scripts.Player;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -43,7 +45,7 @@ public abstract class CECPlayer : CECObject
|
||||
private QueueActionEvent queueActionEvent;
|
||||
|
||||
protected int NUM_WEAPON_TYPE = 15;
|
||||
|
||||
public static readonly int[] m_sciStateIDForStateAction = { 117 };
|
||||
|
||||
public MOVECONST m_MoveConst; // Const used when moving control
|
||||
|
||||
@@ -212,11 +214,11 @@ public abstract class CECPlayer : CECObject
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool PlayAction(int iAction, bool bRestart/* true */, int iTransTime/* 200 */, bool bQueue/* false */)
|
||||
public bool PlayAction(int iAction, bool bRestart = true, int iTransTime = 200, bool bQueue = false)
|
||||
{
|
||||
return PlayActionWithConfig(iAction, 0, bRestart, iTransTime, bQueue);
|
||||
}
|
||||
public bool PlayActionWithConfig(int iAction, int actionConfigID, bool bRestart/* =true */, int iTransTime/* =200 */, bool bQueue/* =false */)
|
||||
public bool PlayActionWithConfig(int iAction, int actionConfigID, bool bRestart = true, int iTransTime = 200, bool bQueue = false)
|
||||
{
|
||||
if (iAction < 0 || iAction >= (int)PLAYER_ACTION_TYPE.ACT_MAX)
|
||||
{
|
||||
@@ -845,6 +847,99 @@ public abstract class CECPlayer : CECObject
|
||||
|
||||
return iAction;
|
||||
}
|
||||
public void Damaged(int nDamage, uint dwModifier = 0, int skill = 0)
|
||||
{
|
||||
if (nDamage == -2)
|
||||
{
|
||||
// this message is caused by a help skill, so don't use a wounded action here
|
||||
/* if (dwModifier & CECAttackEvent::MOD_IMMUNE)
|
||||
BubbleText(BUBBLE_IMMUNE, 0);
|
||||
else if (dwModifier & CECAttackEvent::MOD_NULLITY)
|
||||
BubbleText(BUBBLE_INVALIDHIT, 0);
|
||||
else if (dwModifier & CECAttackEvent::MOD_DODGE_DEBUFF)
|
||||
BubbleText(BUBBLE_DODGE_DEBUFF, 0);*/
|
||||
}
|
||||
else if (nDamage == -1)
|
||||
{
|
||||
// when else player hit this player iDamage is -1,
|
||||
// Just play a wounded action
|
||||
if (!OnDamaged(skill))
|
||||
{
|
||||
PlayAction((int)PLAYER_ACTION_TYPE.ACT_WOUNDED);
|
||||
}
|
||||
/*if (dwModifier & CECAttackEvent::MOD_IMMUNE)
|
||||
BubbleText(BUBBLE_IMMUNE, 0);
|
||||
else if (dwModifier & CECAttackEvent::MOD_NULLITY)
|
||||
BubbleText(BUBBLE_INVALIDHIT, 0);
|
||||
else if (dwModifier & CECAttackEvent::MOD_DODGE_DEBUFF)
|
||||
BubbleText(BUBBLE_DODGE_DEBUFF, 0);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
// Popup a damage decal
|
||||
if (nDamage > 0)
|
||||
{
|
||||
int p1 = 0;
|
||||
/*if (dwModifier & CECAttackEvent::MOD_CRITICAL_STRIKE)
|
||||
p1 |= 0x0001;
|
||||
|
||||
if (dwModifier & CECAttackEvent::MOD_RETORT)
|
||||
p1 |= 0x0002;*/
|
||||
|
||||
if (!OnDamaged(skill))
|
||||
PlayAction((int)PLAYER_ACTION_TYPE.ACT_WOUNDED);
|
||||
|
||||
DamageTextManager.Instance.ShowDamageText(
|
||||
transform.position,nDamage);
|
||||
/* if (dwModifier & CECAttackEvent::MOD_IMMUNE)
|
||||
BubbleText(BUBBLE_IMMUNE, 0);
|
||||
else if (dwModifier & CECAttackEvent::MOD_REBOUND)
|
||||
BubbleText(BUBBLE_REBOUND, nDamage);
|
||||
else if (dwModifier & CECAttackEvent::MOD_BEAT_BACK)
|
||||
BubbleText(BUBBLE_BEAT_BACK, nDamage);
|
||||
else
|
||||
BubbleText(BUBBLE_DAMAGE, nDamage, p1);*/
|
||||
}
|
||||
/* else if (dwModifier & CECAttackEvent::MOD_IMMUNE)
|
||||
BubbleText(BUBBLE_IMMUNE, 0);
|
||||
else if (dwModifier & CECAttackEvent::MOD_NULLITY)
|
||||
BubbleText(BUBBLE_INVALIDHIT, 0);
|
||||
else
|
||||
BubbleText(BUBBLE_HITMISSED, 0);*/
|
||||
}
|
||||
}
|
||||
public bool OnDamaged(int skill)
|
||||
{
|
||||
var atkMan = CECAttacksMan.Instance;
|
||||
if (atkMan == null)
|
||||
return false;
|
||||
|
||||
string name1, name2;
|
||||
|
||||
for (int i = 0; i < m_sciStateIDForStateAction.Length; i++)
|
||||
{
|
||||
/* if (atkMan.GetSkillStateActionName(skill, m_sciStateIDForStateAction[i], out name1, out name2))
|
||||
{
|
||||
m_SkillIDForStateAction = skill;
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
bool GetSkillStateActionName(int skill, int state, string name1, string name2)
|
||||
{
|
||||
/* for (int i = 0; i < (int)m_SkillStateActionVec.size(); i++)
|
||||
{
|
||||
if (m_SkillStateActionVec[i].skill == skill && m_SkillStateActionVec[i].state == state)
|
||||
{
|
||||
name1 = m_SkillStateActionVec[i].beHitAction;
|
||||
name2 = m_SkillStateActionVec[i].stayDownAction;
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
return false;
|
||||
}
|
||||
|
||||
public float GetGroundSpeed()
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ public class CECMonster : CECNPC
|
||||
public override bool Init(int tid, in info_npc info, ReadOnlySpan<byte> packet, int infoOffset)
|
||||
{
|
||||
base.Init(tid, info, packet, infoOffset);
|
||||
BrewMonster.BMLogger.Log("HoangDev: MonsterInit");
|
||||
//BrewMonster.BMLogger.Log("HoangDev: MonsterInit");
|
||||
var pDB = ElementDataManProvider.GetElementDataMan();
|
||||
DATA_TYPE DataType = default;
|
||||
m_pDBEssence = (MONSTER_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
|
||||
|
||||
@@ -165,6 +165,7 @@ public class CECNPC : CECObject
|
||||
|
||||
public void OnMsgNPCAtkResult(ECMSG msg)
|
||||
{
|
||||
|
||||
// Giống namespace S2C trong C++
|
||||
var pCmd = GPDataTypeHelper.FromBytes<cmd_object_atk_result>(msg.dwParam1 as byte[]);
|
||||
|
||||
@@ -622,7 +623,7 @@ public class CECNPC : CECObject
|
||||
// so if iDamage is -1 we will shoud the wounded animation
|
||||
if (iDamage == -1)
|
||||
PlayModelAction((int)NPCActionIndex.ACT_WOUNDED);
|
||||
DamageTextManager.Instance.SpawnDamage(transform.position, iDamage, Color.red, 1.0f);
|
||||
DamageTextManager.Instance.ShowDamageText(transform.position, iDamage, Color.red, 1.0f);
|
||||
|
||||
/*if ((dwModifier & (uint)MOD.MOD_IMMUNE) != 0 *//* && !IsImmuneDisable()*//*)
|
||||
textma
|
||||
@@ -645,7 +646,7 @@ public class CECNPC : CECObject
|
||||
if (iDamage > 0)
|
||||
{
|
||||
PlayModelAction((int)NPCActionIndex.ACT_WOUNDED);
|
||||
DamageTextManager.Instance.SpawnDamage(transform.position, iDamage, Color.red, 1.0f);
|
||||
DamageTextManager.Instance.ShowDamageText(transform.position, iDamage, Color.red, 1.0f);
|
||||
/* int p1 = 0;
|
||||
if (bDeadlyStrike)
|
||||
p1 |= 0x0001;
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class NPCBuilder : MonoSingleton<NPCBuilder>
|
||||
public class NPCBuilder : MonoSingleton<NPCBuilder>
|
||||
{
|
||||
[SerializeField] List<GameObject> modelNPCList;
|
||||
[SerializeField] Dictionary<string, GameObject> modleNPCDic;
|
||||
@@ -19,6 +19,8 @@ public class NPCBuilder : MonoSingleton<NPCBuilder>
|
||||
modleNPCDic = modelNPCList.GroupBy(obj => obj.name)
|
||||
.ToDictionary(g => g.Key, g => g.First());
|
||||
}
|
||||
public GameObject GetModelByName(string name) =>
|
||||
modleNPCDic.TryGetValue(name, out var model) ? model : null;
|
||||
public GameObject GetModelByName(string name)
|
||||
{
|
||||
return modleNPCDic.TryGetValue(name, out var model) ? model : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ namespace CSNetwork
|
||||
//sss
|
||||
//BMLogger.LogError($"### GameDataSend: CMDID {pCmdHeader}");
|
||||
int iHostID = _selectedRole.roleid;
|
||||
_logger.Info($"### GameDataSend: " + pCmdHeader);
|
||||
BMLogger.LogError($"### GameDataSend: " + pCmdHeader);
|
||||
|
||||
switch (pCmdHeader)
|
||||
{
|
||||
@@ -415,8 +415,9 @@ namespace CSNetwork
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_HURTRESULT, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
case CommandID.OBJECT_ATTACK_RESULT:
|
||||
_logger.Info($"OBJECT_ATTACK_RESULT: " + pCmdHeader);
|
||||
int id = GPDataTypeHelper.FromBytes<int>(pDataBuf);
|
||||
BMLogger.LogError($"OBJECT_ATTACK_RESULT: npc ? " + ISNPCID(id));
|
||||
|
||||
if (ISPLAYERID(id))
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERATKRESULT, MANAGER_INDEX.MAN_PLAYER, -1, pDataBuf, pCmdHeader);
|
||||
else if (ISNPCID(id))
|
||||
|
||||
@@ -197,7 +197,7 @@ public class pickupItem : MonoBehaviour
|
||||
// Store reference to the cube
|
||||
matterCubes[matterId] = cube;
|
||||
|
||||
Debug.Log($"Created cube for matter {matterId} at position {position}");
|
||||
//Debug.Log($"Created cube for matter {matterId} at position {position}");
|
||||
}
|
||||
|
||||
private void CreateItemNameText(GameObject cube, int tid)
|
||||
|
||||
@@ -347,9 +347,13 @@ public class CECHostPlayer : CECPlayer
|
||||
case int value when value == EC_MsgDef.MSG_HST_SELTARGET:
|
||||
OnMsgHstSelTarget(Msg); break;
|
||||
case int value when value == EC_MsgDef.MSG_HST_ATKRESULT: OnMsgHstAttackResult(Msg); break;
|
||||
//case int value when value == EC_MsgDef.MSG_HST_ATTACKED: OnMsgHstAttacked(Msg); break;
|
||||
case int value when value == EC_MsgDef.MSG_HST_ATTACKED: OnMsgHstAttacked(Msg); break;
|
||||
case int value when value == EC_MsgDef.MSG_HST_HURTRESULT: OnMsgHstHurtResult(Msg); break;
|
||||
}
|
||||
}
|
||||
private void OnMsgHstAttacked(ECMSG msg)
|
||||
{
|
||||
|
||||
}
|
||||
public void OnMsgHstAttackResult(ECMSG Msg)
|
||||
{
|
||||
|
||||
+10
-172
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user