fix CECHostPlayer
This commit is contained in:
+221
-68
@@ -802,19 +802,26 @@ namespace BrewMonster
|
||||
if (pCmd.cooldown_index == (int)CoolTimeIndex.GP_CT_CAST_ELF_SKILL)
|
||||
{
|
||||
int i;
|
||||
// other goblin skills should be set public cool down, 1 second
|
||||
/* for (i = 0; i < m_aGoblinSkills.GetSize(); i++)
|
||||
{
|
||||
if (m_aGoblinSkills[i] && m_aGoblinSkills[i]->GetCoolingCnt() == 0)
|
||||
m_aGoblinSkills[i]->StartCooling(GetCoolTime(GP_CT_CAST_ELF_SKILL), GetCoolTime(GP_CT_CAST_ELF_SKILL));
|
||||
}*/
|
||||
for (i = 0; i < m_aGoblinSkills.Count; i++)
|
||||
{
|
||||
if (m_aGoblinSkills[i] != null && m_aGoblinSkills[i].GetCoolingCnt() == 0)
|
||||
{
|
||||
int fakeRef = 0;
|
||||
int coolTime = GetCoolTime((int)CoolTimeIndex.GP_CT_CAST_ELF_SKILL, out fakeRef);
|
||||
m_aGoblinSkills[i].StartCooling(coolTime, coolTime);
|
||||
}
|
||||
}
|
||||
|
||||
/* for (i = 0; i < m_aPsSkills.Count; i++)
|
||||
{
|
||||
CECSkill pSkill = GetPassiveSkillByIndex(i);
|
||||
if (pSkill && (pSkill->GetCommonCoolDown() & (1 << (pCmd->cooldown_index - GP_CT_SKILLCOMMONCOOLDOWN0))))
|
||||
pSkill->StartCooling(GetCoolTime(pCmd->cooldown_index), GetCoolTime(pCmd->cooldown_index));
|
||||
}*/
|
||||
for (i = 0; i < m_aPsSkills.Count; i++)
|
||||
{
|
||||
CECSkill pSkill = GetPassiveSkillByIndex(i);
|
||||
if (pSkill != null && (pSkill.GetCommonCoolDown() & (1 << (pCmd.cooldown_index - (int)CoolTimeIndex.GP_CT_SKILLCOMMONCOOLDOWN0))) != 0)
|
||||
{
|
||||
int fakeRef = 0;
|
||||
int coolTime = GetCoolTime(pCmd.cooldown_time, out fakeRef);
|
||||
pSkill.StartCooling(coolTime, coolTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pCmd.cooldown_index >= (int)CoolTimeIndex.GP_CT_SKILLCOMMONCOOLDOWN0 && pCmd.cooldown_index <= (int)CoolTimeIndex.GP_CT_SKILLCOMMONCOOLDOWN4)
|
||||
@@ -826,7 +833,11 @@ namespace BrewMonster
|
||||
CECSkill pSkill = GetPositiveSkillByIndex(i);
|
||||
int fakeRef = 0;
|
||||
if (pSkill != null && (pSkill.GetCommonCoolDown() & mask) != 0)
|
||||
pSkill.StartCooling(GetCoolTime(pCmd.cooldown_index, out fakeRef), GetCoolTime(pCmd.cooldown_index, out fakeRef));
|
||||
{
|
||||
int coolTime = GetCoolTime(pCmd.cooldown_index, out fakeRef);
|
||||
pSkill.StartCooling(coolTime, coolTime);
|
||||
//pSkill.StartCooling(GetCoolTime(pCmd.cooldown_index, out fakeRef), GetCoolTime(pCmd.cooldown_index, out fakeRef));
|
||||
}
|
||||
}
|
||||
/*const std::map<unsigned int, CECSkill*>&inherentSkillMap = CECComboSkillState::Instance().GetInherentSkillMap();
|
||||
std::map < unsigned int, CECSkill*>::const_iterator it;
|
||||
@@ -849,7 +860,9 @@ namespace BrewMonster
|
||||
}
|
||||
ct.iCurTime = pCmd.cooldown_time;
|
||||
ct.iMaxTime = pCmd.cooldown_time;
|
||||
Math.Clamp(ct.iCurTime, 0, ct.iMaxTime);
|
||||
ct.iCurTime = Math.Clamp(ct.iCurTime, 0, ct.iMaxTime);
|
||||
m_skillCoolTime[idSkill] = ct;
|
||||
//Math.Clamp(ct.iCurTime, 0, ct.iMaxTime);
|
||||
|
||||
CECSkill pSkill = GetNormalSkill(idSkill);
|
||||
if (pSkill != null)
|
||||
@@ -864,6 +877,18 @@ namespace BrewMonster
|
||||
{
|
||||
BMLogger.LogError("HoangDev: pSkill " + pSkill);
|
||||
}
|
||||
else
|
||||
{
|
||||
pSkill = CECComboSkillState.Instance.GetInherentSkillByID((uint)idSkill);
|
||||
if (pSkill != null)
|
||||
{
|
||||
pSkill.StartCooling(pCmd.cooldown_time, pCmd.cooldown_time);
|
||||
}
|
||||
else if (GetEquipSkillByID(idSkill) == null)
|
||||
{
|
||||
Debug.LogWarning($"OnMsgHstSetCoolTime: Skill {idSkill} not found in nomal/equip skills");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -874,6 +899,11 @@ namespace BrewMonster
|
||||
UpdateEquipSkillCoolDown(pCmd.cooldown_index);
|
||||
}
|
||||
|
||||
private CECSkill GetPassiveSkillByIndex(int n)
|
||||
{
|
||||
return m_aPsSkills[n];
|
||||
}
|
||||
|
||||
private void OnMsgHstCoolTimeData(ECMSG Msg)
|
||||
{
|
||||
cmd_cooltime_data pCmd = default;
|
||||
@@ -7493,16 +7523,97 @@ namespace BrewMonster
|
||||
CECGameRun pGameRun = EC_Game.GetGameRun();
|
||||
//CECGameSession pSession = g_pGame.GetGameSession();
|
||||
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_FIREWORK)
|
||||
{
|
||||
if (GetProfession() == (int)PROFESSION.PROF_GHOST && IsInvisible())
|
||||
{
|
||||
if (showMsg)
|
||||
pGameRun.AddFixedMessage((int)FixedMsg.FIXMSG_CANNOT_USE_WHEN_INVISIBLE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_INCSKILLABILITY)
|
||||
{
|
||||
EC_IvtrIncSkillAbility pIncSkill = pItem as EC_IvtrIncSkillAbility;
|
||||
//if (pIncSkill != null)
|
||||
//{
|
||||
// var pDBEssence = pIncSkill.GetDBEssence();
|
||||
// CECSkill pSkill = GetNormalSkill(pDBEssence.id_skill);
|
||||
// if (pSkill != null)
|
||||
// {
|
||||
// if (pSkill.GetSkillLevel() != pDBEssence.level_required)
|
||||
// {
|
||||
// if (showMsg)
|
||||
// pGameRun.AddFixedMessage((int)FixedMsg.FIXMSG_PRODUCE_LEVEL_INVALID);
|
||||
// return false;
|
||||
// }
|
||||
// if (GetSkillAbilityPercent(pDBEssence.id_skill) >= 100)
|
||||
// {
|
||||
// if (showMsg)
|
||||
// pGameRun.AddFixedMessage((int)FixedMsg.FIXMSG_PRODUCE_ABILITY_FULL);
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_TRANSMITSCROLL)
|
||||
{
|
||||
CECGameUIMan pGameUI = pGameRun.GetUIManager().GetInGameUIMan();
|
||||
if (pGameUI != null && !IsFighting())
|
||||
{
|
||||
// TODO: Implement travel map dialog
|
||||
//CDlgWorldMap* pMap = (CDlgWorldMap*)pGameUI->GetDialog("Win_WorldMapTravel");
|
||||
//pMap->BuildTravelMap(DT_TRANSMITSCROLL_ESSENCE, (void*)iSlot);
|
||||
//pMap->Show(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_SHOPTOKEN)
|
||||
{
|
||||
CECGameUIMan pGameUI = pGameRun.GetUIManager().GetInGameUIMan();
|
||||
if (pGameUI != null && !IsFighting())
|
||||
{
|
||||
//CDlgTokenShop* pDlg = dynamic_cast<CDlgTokenShop*>(pGameUI->GetDialog("Win_TokenShop"));
|
||||
//if (pDlg)
|
||||
//{
|
||||
// pDlg->InitTokenShopItem(pItem->GetTemplateID());
|
||||
// pDlg->Show(!pDlg->IsShow());
|
||||
//}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_UNIVERSAL_TOKEN)
|
||||
{
|
||||
// TODO: Implement universal token when available
|
||||
EC_IvtrUniversalToken pUniversalToken = pItem as EC_IvtrUniversalToken;
|
||||
//if (pUniversalToken != null && pUniversalToken.HasAnyUsage())
|
||||
//{
|
||||
// CECUseUniversalTokenCommandManager.Instance.Use(pUniversalToken, pUniversalToken.UsageIndexAt(0));
|
||||
// return true;
|
||||
//}
|
||||
}
|
||||
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_TASKDICE)
|
||||
{
|
||||
EC_IvtrTaskDice pTaskDice = pItem as EC_IvtrTaskDice;
|
||||
if (pTaskDice != null)
|
||||
{
|
||||
if (pTaskDice != null)
|
||||
{
|
||||
if (IsFlying() && pTaskDice.GetDBEssence().no_use_in_combat == 1)
|
||||
{
|
||||
if(showMsg)
|
||||
pGameRun.AddFixedMessage((int)FixedMsg.FIXMSG_CANNOT_USE_IN_BATTLE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_TARGETITEM)
|
||||
{
|
||||
EC_IvtrTargetItem pTargetItem = pItem as EC_IvtrTargetItem;
|
||||
@@ -7521,7 +7632,7 @@ namespace BrewMonster
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pTargetItem.GetDBEssence().use_in_sanctuary_only != 0 && !IsInSanctuary())
|
||||
if (essence.use_in_sanctuary_only != 0 && !IsInSanctuary())
|
||||
{
|
||||
if (showMsg)
|
||||
pGameRun.AddFixedMessage((int)FixedMsg.FIXMSG_USE_IN_SANCTUARY_ONLY);
|
||||
@@ -7662,6 +7773,24 @@ namespace BrewMonster
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(pSkill.GetType() == (int)CECSkill.SkillType.TYPE_BLESS)
|
||||
{
|
||||
// TODO: Implement pet blessing when petsystem is available
|
||||
//CECSCPet pPet = EC_Game.GetGameRun().GetWorld().GetPetByID(m_idSelTarget);
|
||||
//if (pPet == null || pPet.GetMasterID() == GetCharacterID())
|
||||
//{
|
||||
// CECPetData pPetData = m_pPetCorral.GetActivePet();
|
||||
// if (pPetData == null ||
|
||||
// pPetData.GetClass() != GP_PET_TYPE.GP_PET_CLASS_COMBAT &&
|
||||
// pPetData.GetClass() != GP_PET_TYPE.GP_PET_CLASS_SUMMON &&
|
||||
// pPetData.GetClass() != GP_PET_TYPE.GP_PET_CLASS_EVOLUTION)
|
||||
// return false;
|
||||
|
||||
// idCastTarget = m_pPetCorral.GetActivePetNPCID();
|
||||
//}
|
||||
//if(iTargetType != 0 && idCastTarget == 0)
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (iTargetType != 0)
|
||||
{
|
||||
@@ -7684,9 +7813,8 @@ namespace BrewMonster
|
||||
|
||||
if (!pSkill.IsInstant() && pSkill.GetType() != (int)CECSkill.SkillType.TYPE_FLASHMOVE)
|
||||
{
|
||||
// TODO: Implement NaturallyStopMoving
|
||||
//if (!NaturallyStopMoving())
|
||||
// return false;
|
||||
if (!NaturallyStopMoving())
|
||||
return false;
|
||||
}
|
||||
else if (pSkill.GetType() == (int)CECSkill.SkillType.TYPE_FLASHMOVE)
|
||||
{
|
||||
@@ -7749,6 +7877,16 @@ namespace BrewMonster
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_DYNSKILLEQUIP)
|
||||
{
|
||||
int iSameIDPos = m_pEquipPack.FindItem(pItem.GetTemplateID());
|
||||
if (iSameIDPos >= 0)
|
||||
{
|
||||
iDst = iSameIDPos;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_ARROW ||
|
||||
pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_DYNSKILLEQUIP)
|
||||
{
|
||||
@@ -7757,6 +7895,7 @@ namespace BrewMonster
|
||||
UnityGameSession.RequestEquipItemAsync((byte)iSlot, (byte)iDst, null);
|
||||
else
|
||||
{
|
||||
// TODO: Implement c2s_CmdMoveItemToEquip when available
|
||||
//UnityGameSession.c2s_CmdMoveItemToEquip((byte)iSlot, (byte)iDst);
|
||||
}
|
||||
}
|
||||
@@ -7765,6 +7904,11 @@ namespace BrewMonster
|
||||
if (pItem.GetClassID() == (int)EC_IvtrItem.InventoryClassId.ICID_GENERALCARD)
|
||||
{
|
||||
//TODO: Add general card equip request
|
||||
EC_IvtrGeneralCard pCard = pItem as EC_IvtrGeneralCard;
|
||||
if (pCard != null)
|
||||
{
|
||||
iDst = InventoryConst.EQUIPIVTR_GENERALCARD1 + pCard.GetEssence().type;
|
||||
}
|
||||
}
|
||||
UnityGameSession.RequestEquipItemAsync((byte)iSlot, (byte)iDst, null);
|
||||
}
|
||||
@@ -7826,19 +7970,21 @@ namespace BrewMonster
|
||||
|
||||
float fDist = 0, fTargetRag = 0;
|
||||
CECObject pObject = null;
|
||||
//if (CalcDist(m_idSelTarget, ref fDist, ref pObject))
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
if (CalcDist(m_idSelTarget, out fDist, out pObject))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GPDataTypeHelper.ISNPCID(m_idSelTarget))
|
||||
{
|
||||
pObject = EC_ManMessageMono.Instance.CECNPCMan.GetNPC(m_idSelTarget);
|
||||
CECNPC pNPC = pObject as CECNPC;
|
||||
if (pNPC != null)
|
||||
fTargetRag = pNPC.GetTouchRadius();
|
||||
}
|
||||
else if (GPDataTypeHelper.ISPLAYERID(m_idSelTarget))
|
||||
{
|
||||
pObject = EC_ManMessageMono.Instance.GetECManPlayer.GetElsePlayer(m_idSelTarget);
|
||||
EC_ElsePlayer pPlayer = pObject as EC_ElsePlayer;
|
||||
if (pPlayer != null)
|
||||
fTargetRag = pPlayer.GetTouchRadius();
|
||||
@@ -7869,6 +8015,7 @@ namespace BrewMonster
|
||||
if (showMsg)
|
||||
{
|
||||
CECGameUIMan pGameUI = pGameRun.GetUIManager().GetInGameUIMan();
|
||||
//pGameUI.MessageBox("", pGameUI.GetStringFromTable(828), MB_OK, new Color32(1, 1, 1, 0.6));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -7944,58 +8091,64 @@ namespace BrewMonster
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate distance to an object and optionally retrieve the object reference
|
||||
/// 计算到对象的距离,并可选地获取对象引用
|
||||
/// </summary>
|
||||
/// <param name="idObject">Target object ID / 目标对象ID</param>
|
||||
/// <param name="pfDist">Output distance / 输出距离</param>
|
||||
/// <param name="ppObject">Output object reference (optional) / 输出对象引用(可选)</param>
|
||||
/// <returns>True if calculation succeeded / 计算成功返回true</returns>
|
||||
//public bool CalcDist(int idObject, ref float pfDist, out CECObject ppObject)
|
||||
//{
|
||||
// ppObject = null;
|
||||
// <summary>
|
||||
// Calculate distance to an object and optionally retrieve the object reference
|
||||
// 计算到对象的距离,并可选地获取对象引用
|
||||
// </summary>
|
||||
// <param name="idObject">Target object ID / 目标对象ID</param>
|
||||
// <param name="pfDist">Output distance / 输出距离</param>
|
||||
// <param name="ppObject">Output object reference (optional) / 输出对象引用(可选)</param>
|
||||
// <returns>True if calculation succeeded / 计算成功返回true</returns>
|
||||
public bool CalcDist(int idObject, out float pfDist, out CECObject ppObject)
|
||||
{
|
||||
pfDist = 0.0f;
|
||||
ppObject = null;
|
||||
|
||||
// if (idObject == 0 || idObject == m_PlayerInfo.cid)
|
||||
// return false;
|
||||
if (idObject == 0 || idObject == m_PlayerInfo.cid)
|
||||
return false;
|
||||
|
||||
// CECObject pObject = CECGameRun.Instance.GetWorld()?.GetObject(idObject, 1);
|
||||
// if (pObject == null)
|
||||
// return false;
|
||||
CECWorld pWorld = CECGameRun.Instance.GetWorld();
|
||||
if(pWorld == null)
|
||||
return false;
|
||||
|
||||
// ppObject = pObject;
|
||||
// float fDist = 0.0f;
|
||||
CECObject pObject = pWorld.GetObject(idObject, 1);
|
||||
if(ppObject == null)
|
||||
return false;
|
||||
|
||||
// if (ISNPCID(idObject))
|
||||
// {
|
||||
// CECNPC pNPC = (CECNPC)pObject;
|
||||
// fDist = pNPC.CalcDist(GetPos(), true);
|
||||
// }
|
||||
// else if (ISPLAYERID(idObject))
|
||||
// {
|
||||
// Debug.Assert(pObject.GetClassID() == CECObject.OCID_ELSEPLAYER);
|
||||
// EC_ElsePlayer pPlayer = (EC_ElsePlayer)pObject;
|
||||
// fDist = pPlayer.CalcDist(GetPos(), true);
|
||||
// }
|
||||
// else if (ISMATTERID(idObject))
|
||||
// {
|
||||
// Debug.Assert(pObject.GetClassID() == CECObject.OCID_MATTER);
|
||||
// CECMatter pMatter = (CECMatter)pObject;
|
||||
// fDist = (pMatter.GetPos() - GetPos()).magnitude;
|
||||
// }
|
||||
// else
|
||||
// return false;
|
||||
ppObject = pObject;
|
||||
float fDist = 0.0f;
|
||||
|
||||
// pfDist = fDist;
|
||||
// return true;
|
||||
//}
|
||||
if (GPDataTypeHelper.ISNPCID(idObject))
|
||||
{
|
||||
CECNPC pNPC = pObject as CECNPC;
|
||||
if (pNPC == null)
|
||||
return false;
|
||||
fDist = pNPC.CalcDist(GetPos(), true);
|
||||
}
|
||||
else if (GPDataTypeHelper.ISMATTERID(idObject))
|
||||
{
|
||||
Debug.Assert(pObject.GetClassID() == Class_ID.OCID_MATTER);
|
||||
CECMatter pMatter = pObject as CECMatter;
|
||||
if (pMatter == null)
|
||||
return false;
|
||||
A3DVECTOR3 vDelta = pMatter.GetPos() - GetPos();
|
||||
fDist = A3d_Magnitude(vDelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//// Helper method overload without object output
|
||||
//public bool CalcDist(int idObject, ref float pfDist)
|
||||
//{
|
||||
// CECObject pObject;
|
||||
// return CalcDist(idObject, ref pfDist, out pObject);
|
||||
//}
|
||||
pfDist = fDist;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Helper method overload without object output
|
||||
public bool CalcDist(int idObject, out float pfDist)
|
||||
{
|
||||
CECObject pObject;
|
||||
return CalcDist(idObject, out pfDist, out pObject);
|
||||
}
|
||||
|
||||
//// ID checking helper methods
|
||||
//private bool ISNPCID(int id) => ((id & 0x80000000) != 0) && ((id & 0x40000000) == 0);
|
||||
|
||||
Reference in New Issue
Block a user