Merge branch 'develop' into feature/skill-set-shortcut

This commit is contained in:
VDH
2026-02-24 15:02:51 +07:00
28 changed files with 5635 additions and 5416 deletions
@@ -192,7 +192,7 @@ namespace BrewMonster.Scripts
{
if (handle.IsValid())
{
Addressables.Release(handle);
Addressables.Release(handle);
}
}
@@ -20,6 +20,7 @@ namespace BrewMonster
void OnDestroy()
{
BMLogger.Log("AutoInitializer: OnDestroy called, disposing auto initializers");
foreach (var autoInitializer in _autoInitializers)
{
autoInitializer.Dispose();
@@ -87,406 +87,6 @@ namespace BrewMonster
}
return 0;
}
void OnMsgHstPetOpt(ECMSG Msg)
{
CECGameRun pGameRun = EC_Game.GetGameRun();
int header = Convert.ToInt32(Msg.dwParam2);
switch (header)
{
case CommandID.GAIN_PET:
{
cmd_gain_pet pCmd = GPDataTypeHelper.FromBytes<cmd_gain_pet>((byte[])Msg.dwParam1);
m_pPetCorral.AddPet(pCmd.slot_index, pCmd.data);
// Print a notify
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
if (pPet != null)
{
if (pPet.IsFollowPet() || pPet.IsCombatPet() || pPet.IsEvolutionPet())
{
// TO DO: fix later
//pGameRun.AddFixedMessage(FIXMSG_PET_HATCH, pPet.GetName());
}
else if (pPet.IsSummonPet())
{
// TO DO: fix later
//pGameRun.AddFixedMessage(FIXMSG_SUMMON_PET_APPEAR, pPet.GetName());
}
}
break;
}
case CommandID.FREE_PET:
{
cmd_free_pet pCmd = GPDataTypeHelper.FromBytes<cmd_free_pet>((byte[])Msg.dwParam1);
// Print a notify
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
if (pPet != null)
{
if (pPet.IsFollowPet() || pPet.IsCombatPet() || pPet.IsEvolutionPet())
{
// TO DO: fix later
//pGameRun.AddFixedMessage(FIXMSG_PET_FREE, pPet.GetName());
}
else if (pPet.IsSummonPet())
{
// TO DO: fix later
//pGameRun.AddFixedMessage(FIXMSG_SUMMON_PET_DISAPPEAR, pPet.GetName());
}
}
// Remove pet from corral
m_pPetCorral.FreePet(pCmd.slot_index, pCmd.pet_id);
// Update pet shortcuts
UpdateFreedPetSC(pCmd.slot_index);
break;
}
case CommandID.SUMMON_PET:
{
cmd_summon_pet pCmd = GPDataTypeHelper.FromBytes<cmd_summon_pet>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
//ASSERT(pPet && pPet.GetTemplateID() == pCmd.pet_tid);
m_pPetCorral.SetActivePetIndex(pCmd.slot_index);
m_pPetCorral.SetActivePetNPCID(pCmd.pet_pid);
m_pPetCorral.SetActivePetLifetime(pCmd.life_time);
if (EC_Game.GetConfigs().GetGameSettings().bPetAutoSkill)
{
for (int i = 0; i < pPet.GetSkillNum(SKILLTYPE.EM_SKILL_DEFAULT); i++)
{
PETSKILL? pSkill = pPet.GetSkill(SKILLTYPE.EM_SKILL_DEFAULT, i);
if (pSkill != null && EC_Game.IsPetAutoSkill(pSkill.Value.idSkill))
pPet.AddAutoSkill(pSkill.Value.idSkill);
}
}
// TO DO: fix later
//OnPetSays(pCmd.pet_tid, pCmd.pet_pid, CECPetWords::TW_SUMMON);
//if (pPet.IsCombatPet() || pPet.IsSummonPet() || pPet.IsEvolutionPet())
// CDlgQuickBarPet::ResetAutoCastSkill();
break;
}
case CommandID.RECALL_PET:
{
cmd_recall_pet pCmd = GPDataTypeHelper.FromBytes<cmd_recall_pet>((byte[])Msg.dwParam1);
//ASSERT(pCmd.slot_index == m_pPetCorral.GetActivePetIndex());
int tid = pCmd.pet_id;
int nid = m_pPetCorral.GetActivePetNPCID();
// 宠物有话说
switch (pCmd.reason)
{
case (char)PET_RECALL_REASON.PET_RECALL_DEFAULT:
//OnPetSays(tid, nid, CECPetWords::TW_RECALL);
break;
case (char)PET_RECALL_REASON.PET_RECALL_DEATH:
//OnPetSays(tid, nid, CECPetWords::TW_DEAD);
break;
case (char)PET_RECALL_REASON.PET_RECALL_LIFE_EXHAUST:
//OnPetSays(tid, nid, CECPetWords::TW_DISAPPEAR);
break;
case (char)PET_RECALL_REASON.PET_RECALL_SACRIFICE:
//OnPetSays(tid, nid, CECPetWords::TW_SACRIFICE);
break;
}
CECPetData pPet = m_pPetCorral.GetActivePet();
if (pPet != null)
pPet.OnPetDead();
m_pPetCorral.SetActivePetIndex(-1);
m_pPetCorral.SetActivePetNPCID(0);
m_bPetInSanctuary = false;
break;
}
case CommandID.PLAYER_START_PET_OP:
{
cmd_player_start_pet_op pCmd = GPDataTypeHelper.FromBytes<cmd_player_start_pet_op>((byte[])Msg.dwParam1);
int iDoWhat;
if (pCmd.op == 0)
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_SUMMONPET;
else if (pCmd.op == 1)
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_RECALLPET;
else if (pCmd.op == 2)
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_BANISHPET;
else if (pCmd.op == 3)
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_RESTOREPET;
else
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_UNKNOWN;
m_PetOptCnt.SetPeriod(pCmd.delay * 50);
m_PetOptCnt.Reset();
CECHPWorkConcentrate pWork = (CECHPWorkConcentrate)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_CONCENTRATE);
pWork.SetDoWhat(iDoWhat);
m_pWorkMan.StartWork_p1(pWork);
break;
}
case CommandID.PLAYER_STOP_PET_OP:
{
if (IsOperatingPet() != 0)
m_pWorkMan.FinishRunningWork(CECHPWork.Host_work_ID.WORK_CONCENTRATE);
break;
}
case CommandID.PET_RECEIVE_EXP:
{
cmd_pet_receive_exp pCmd = GPDataTypeHelper.FromBytes<cmd_pet_receive_exp>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
if (pPet != null)
{
//ASSERT(pPet.GetTemplateID() == pCmd.pet_id);
pPet.AddExp(pCmd.exp);
}
break;
}
case CommandID.PET_LEVELUP:
{
cmd_pet_levelup pCmd = GPDataTypeHelper.FromBytes<cmd_pet_levelup>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
if (pPet != null)
{
//ASSERT(pPet.GetTemplateID() == pCmd.pet_id);
pPet.LevelUp(pCmd.level, pCmd.exp);
}
//pGameRun.AddFixedMessage(FIXMSG_PET_LEVELUP, pCmd.level);
break;
}
case CommandID.PET_ROOM:
{
cmd_pet_room pCmd = GPDataTypeHelper.FromBytes<cmd_pet_room>((byte[])Msg.dwParam1);
m_pPetCorral.UpdatePets(pCmd, (byte[])Msg.dwParam1);
CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
//if (pGameUI.GetDialog("Win_Teach").IsShow())
// {
// //pGameUI.UpdateTeach();
// }
break;
}
case CommandID.PET_ROOM_CAPACITY:
{
cmd_pet_room_capacity pCmd = GPDataTypeHelper.FromBytes<cmd_pet_room_capacity>((byte[])Msg.dwParam1);
m_pPetCorral.MagnifyPetSlots((int)pCmd.capacity);
if (m_pPetCorral.HasInit())
{
//pGameRun.AddFixedMessage(FIXMSG_PET_ROOM_SIZE, pCmd.capacity);
}
else
m_pPetCorral.SetHasInit(true);
break;
}
case CommandID.PET_HONOR_POINT:
{
cmd_pet_honor_point pCmd = GPDataTypeHelper.FromBytes<cmd_pet_honor_point>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.index);
if (pPet != null)
pPet.SetIntimacy(pCmd.cur_honor_point);
break;
}
case CommandID.PET_HUNGER_GAUGE:
{
cmd_pet_hunger_gauge pCmd = GPDataTypeHelper.FromBytes<cmd_pet_hunger_gauge>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.index);
if (pPet != null)
pPet.SetHunger(pCmd.cur_hunge_gauge);
break;
}
case CommandID.PET_DEAD:
{
cmd_pet_dead pCmd = GPDataTypeHelper.FromBytes<cmd_pet_dead>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData((int)pCmd.pet_index);
if (pPet != null)
{
pPet.SetHPFactor(0.0f);
pPet.SetHP(0);
pPet.OnPetDead();
}
//pGameRun.AddFixedMessage(FIXMSG_PET_DEAD);
break;
}
case CommandID.PET_REVIVE:
{
cmd_pet_revive pCmd = GPDataTypeHelper.FromBytes<cmd_pet_revive>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData((int)pCmd.pet_index);
if (pPet != null)
pPet.SetHPFactor(pCmd.hp_factor);
break;
}
case CommandID.PET_HP_NOTIFY:
{
cmd_pet_hp_notify pCmd = GPDataTypeHelper.FromBytes<cmd_pet_hp_notify>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData((int)pCmd.pet_index);
if (pPet != null)
{
int lastHP = pPet.GetHP();
pPet.SetHPFactor(pCmd.hp_factor);
pPet.SetHP(pCmd.cur_hp);
pPet.SetMPFactor(pCmd.mp_factor);
pPet.SetMP(pCmd.cur_mp);
// If HP is too low, popup a warning on pet's head
int iLimit = (int)(pPet.CalcMaxHP() * 0.3f);
if (pCmd.cur_hp < lastHP && lastHP != 0 && pCmd.cur_hp < iLimit)
{
CECNPC pNPC = EC_Game.GetGameRun().GetWorld().GetNPCMan().GetNPC(m_pPetCorral.GetActivePetNPCID());
if (pNPC && pNPC.GetMasterID() == GetCharacterID())
{
//pNPC.BubbleText(CECNPC::BUBBLE_HPWARN, 0);
}
}
}
break;
}
case CommandID.PET_AI_STATE:
{
cmd_pet_ai_state pCmd = GPDataTypeHelper.FromBytes<cmd_pet_ai_state>((byte[])Msg.dwParam1);
// 宠物有话说
CECPetData pPetData = m_pPetCorral.GetActivePet();
if (pPetData != null)
{
int tid = pPetData.GetTemplateID();
int nid = m_pPetCorral.GetActivePetNPCID();
if (m_pPetCorral.GetMoveMode() != pCmd.move)
{
switch (pCmd.move)
{
case (byte)CECPetCorral.ePet_MovingMode.MOVE_FOLLOW:
{
//OnPetSays(tid, nid, CECPetWords::TW_FOLLOW);
break;
}
case (byte)CECPetCorral.ePet_MovingMode.MOVE_STAND:
{
//OnPetSays(tid, nid, CECPetWords::TW_STOP);
break;
}
}
}
if (m_pPetCorral.GetAttackMode() != pCmd.attack)
{
switch (pCmd.attack)
{
case (byte)CECPetCorral.ePet_AttackingMode.ATK_DEFENSE:
//OnPetSays(tid, nid, CECPetWords::TW_DEFENSIVE);
break;
case (byte)CECPetCorral.ePet_AttackingMode.ATK_POSITIVE:
//OnPetSays(tid, nid, CECPetWords::TW_OFFENSIVE);
break;
case (byte)CECPetCorral.ePet_AttackingMode.ATK_PASSIVE:
//OnPetSays(tid, nid, CECPetWords::TW_PASSIVE);
break;
}
}
}
m_pPetCorral.SetMoveMode(pCmd.move);
m_pPetCorral.SetAttackMode(pCmd.attack);
break;
}
case CommandID.PET_SET_COOLDOWN:
{
cmd_pet_set_cooldown pCmd = GPDataTypeHelper.FromBytes<cmd_pet_set_cooldown>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.pet_index);
if (pPet != null)
pPet.SetSkillCoolTime(pCmd.cooldown_index, pCmd.cooldown_time);
break;
}
case CommandID.SUMMON_PLANT_PET:
{
int size = Marshal.SizeOf<cmd_summon_plant_pet>();
if (((byte[])Msg.dwParam1).Length >= size)
{
cmd_summon_plant_pet pCmd = GPDataTypeHelper.FromBytes<cmd_summon_plant_pet>((byte[])Msg.dwParam1);
m_pPetCorral.PlantPetEnter(pCmd);
}
break;
}
case CommandID.PLANT_PET_DISAPPEAR:
{
int size = Marshal.SizeOf<cmd_plant_pet_disapper>();
if (((byte[])Msg.dwParam1).Length >= size)
{
cmd_plant_pet_disapper pCmd = GPDataTypeHelper.FromBytes<cmd_plant_pet_disapper>((byte[])Msg.dwParam1);
m_pPetCorral.PlantPetDisappear(pCmd);
}
break;
}
case CommandID.PLANT_PET_HP_NOTIFY:
{
int size = Marshal.SizeOf<cmd_plant_pet_hp_notify>();
if (((byte[])Msg.dwParam1).Length >= size)
{
cmd_plant_pet_hp_notify pCmd = GPDataTypeHelper.FromBytes<cmd_plant_pet_hp_notify>((byte[])Msg.dwParam1);
m_pPetCorral.PlantPetInfo(pCmd);
}
break;
}
case CommandID.PET_PROPERTY:
{
cmd_pet_property pCmd = GPDataTypeHelper.FromBytes<cmd_pet_property>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.pet_index);
if (pPet != null)
{
pPet.SetExtendProps(pCmd.prop);
}
break;
}
case CommandID.PET_REBUILD_INHERIT_START:
case CommandID.PET_REBUILD_INHERIT_INFO:
case CommandID.PET_REBUILD_INHERIT_END:
case CommandID.PET_EVOLUTION_DONE:
case CommandID.PET_REBUILD_NATURE_START:
case CommandID.PET_REBUILD_NATURE_INFO:
case CommandID.PET_REBUILD_NATURE_END:
{
CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
if (pGameUI != null)
{
//((CDlgPreviewPetRebuild*)pGameUI.GetDialog("Win_PreviewPet")).OnServerNotify(Msg.dwParam2, (void*)Msg.dwParam1);
}
break;
}
default:
break;
}
}
void OnMsgHstSetPlayerLimit(ECMSG Msg)
{
cmd_set_player_limit pCmd = GPDataTypeHelper.FromBytes<cmd_set_player_limit>((byte[])Msg.dwParam1);
if (pCmd.index >= 0 && pCmd.index < (int)PLAYER_LIMIT.PLAYER_LIMIT_MAX)
m_playerLimits[pCmd.index] = (pCmd.b != 0);
}
}
}
@@ -73,8 +73,8 @@ namespace BrewMonster
public void ShowMessageBox(MessageBoxData messageBoxData)
{
_messageData = messageBoxData;
SetName(messageBoxData.Title);
messageText.text = messageBoxData.Message;
SetName(string.IsNullOrEmpty(messageBoxData.Title) ? "" : messageBoxData.Title);
messageText.text = string.IsNullOrEmpty(messageBoxData.Message) ? "" : messageBoxData.Message;
okButton.gameObject.SetActive(false);
_noButton.gameObject.SetActive(false);
@@ -25,19 +25,21 @@ namespace BrewMonster
Disenchase
}
[Header("Mode")]
[SerializeField] private InstallMode m_Mode = InstallMode.Enchase;
[Header("Mode")] [SerializeField] private InstallMode m_Mode = InstallMode.Enchase;
[Header("Slot First")] [SerializeField]
private Transform m_SlotFirstParent;
[Header("Slot First")]
[SerializeField] private Transform m_SlotFirstParent;
[SerializeField] private TextMeshProUGUI m_TxtFirstName;
[Header("Slot Second")]
[SerializeField] private Transform m_SlotSecondlParent;
[Header("Slot Second")] [SerializeField]
private Transform m_SlotSecondlParent;
[SerializeField] private TextMeshProUGUI m_TxtSecondName;
[Header("Buttons and Money")]
[SerializeField] private TextMeshProUGUI m_TxtMoney;
[Header("Buttons and Money")] [SerializeField]
private TextMeshProUGUI m_TxtMoney;
[SerializeField] private Button m_BtnMergeOrReset;
[SerializeField] private Button m_BtnCancel;
@@ -51,6 +53,10 @@ namespace BrewMonster
private int m_SecondInvSlot = -1;
private int m_install_price = -1;
public InstallMode GetInstallMode => m_Mode;
public EC_IvtrItem SelectedEquip => m_SelectedEquip;
public int FirstSlotIndex => m_FirstInvSlot;
public override void Awake()
{
base.Awake();
@@ -87,7 +93,7 @@ namespace BrewMonster
m_BtnMergeOrReset.onClick.AddListener(OnClickedMergeOrReset);
m_BtnCancel.onClick.AddListener(OnClickedCancel);
m_install_price = -1;
if(m_SlotSecondlParent != null)
if (m_SlotSecondlParent != null)
m_SlotSecondlParent.gameObject.SetActive(m_Mode == InstallMode.Enchase);
}
@@ -132,7 +138,8 @@ namespace BrewMonster
return null;
var field = typeof(EC_InventoryUI)
.GetField("inventoryPackButtons", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
.GetField("inventoryPackButtons",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
if (field == null)
return null;
@@ -143,7 +150,7 @@ namespace BrewMonster
return list[slot];
}
private void RegisterDrop(Transform target, Action<PointerEventData> callback)
{
var trigger = target.GetComponent<EventTrigger>();
@@ -156,17 +163,14 @@ namespace BrewMonster
{
eventID = EventTriggerType.Drop
};
entry.callback.AddListener((data) =>
{
callback((PointerEventData)data);
});
entry.callback.AddListener((data) => { callback((PointerEventData)data); });
trigger.triggers.Add(entry);
}
private void RegisterClick(Transform target, Action<PointerEventData> callback)
{
if(target == null) return;
if (target == null) return;
var trigger = target.GetComponent<EventTrigger>();
if (trigger == null)
@@ -176,10 +180,7 @@ namespace BrewMonster
{
eventID = EventTriggerType.PointerClick
};
entry.callback.AddListener((data) =>
{
callback((PointerEventData)data);
});
entry.callback.AddListener((data) => { callback((PointerEventData)data); });
trigger.triggers.Add(entry);
}
@@ -201,7 +202,7 @@ namespace BrewMonster
ClearMaterialSlot();
}
}
private EC_IvtrItem GetItemFromDrag(PointerEventData eventData)
{
if (eventData.pointerDrag == null)
@@ -261,15 +262,12 @@ namespace BrewMonster
SetSlotIcon(m_SlotFirstParent, detailedItem);
SetInventorySlotGray(btn, true);
detailedItem.Freeze(true);
if(m_Mode == InstallMode.Disenchase)
{
CalculateUninstallPrice(detailedItem);
}
UpdateResourceInfo();
}
private void OnDropMaterial(PointerEventData eventData)
{
if (eventData.pointerDrag == null)
@@ -306,42 +304,8 @@ namespace BrewMonster
SetSlotIcon(m_SlotSecondlParent, detailedItem);
SetInventorySlotGray(btn, true);
// GetGameUIMan().PlayItemSound(pIvtrSrc, true);
EC_IvtrStone pStone = null;
STONE_ESSENCE pEssence;
// ACHAR szText[40] = _AL("0");
//check if material is stone and show price to merge
if(m_SelectedMaterial.GetClassID() == (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_STONE)
{
pStone = (EC_IvtrStone)m_SelectedMaterial;
pEssence = pStone.GetDBEssence();
m_TxtMoney.text = $"{pEssence.install_price}";
// a_sprintf(szText, _AL("%d"), pEssence->install_price);
// m_pTxtGold->SetText(szText);
}
// else if( 0 == stricmp(this->GetName(), "Win_Disenchase")
// && pIvtrSrc->IsEquipment() )
// {
// a_LogOutput(1, "[Dat Embed] OnItemDragDrop stricmp(this->GetName(), Win_Disenchase");
// int i, nAmount = 0, idItem;
// CECIvtrEquip *pEquip = (CECIvtrEquip *)pIvtrSrc;
//
// for( i = 0; i < pEquip->GetHoleNum(); i++ )
// {
// idItem = pEquip->GetHoleItem(i);
// if( idItem <= 0 ) continue;
//
// pStone = (CECIvtrStone *)CECIvtrItem::CreateItem(idItem, 0, 1);
// pEssence = (STONE_ESSENCE *)pStone->GetDBEssence();
// nAmount += pEssence->uninstall_price;
// delete pStone;
// }
//
// a_sprintf(szText, _AL("%d"), nAmount);
// m_pTxtGold->SetText(szText);
// }
UpdateResourceInfo();
}
private void CalculateUninstallPrice(EC_IvtrItem equipment)
@@ -455,24 +419,23 @@ namespace BrewMonster
img.sprite = khung_item;
}
private void OnClickedMergeOrReset()
{
// PAUIDIALOG pMsgBox;
CECHostPlayer pHost = GetHostPlayer();
string message = "";
if (pHost != null && m_Mode == InstallMode.Enchase)
{
// if( !m_pItema->GetDataPtr("ptr_CECIvtrItem") ) return;
string message = "";
int nMoney = m_install_price;
if (nMoney > pHost.GetMoneyAmount())
{
message = GetGameUIMan().GetStringFromTable(226);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().GetDialog("")
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox->SetLife(3);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
@@ -480,100 +443,104 @@ namespace BrewMonster
if (!pIvtrA.IsEquipment())
{
message = GetGameUIMan().GetStringFromTable(223);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(223), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
EC_IvtrEquip pEquipA = (EC_IvtrEquip)pIvtrA;
// a_LogOutput(1, "[Dat Embed] Send protocol here");
// if( 0 == string.CompareOrdinal(GetName(), "Win_Enchase") )
// {
if (pEquipA.GetEmptyHoleNum() <= 0)
if (m_Mode == InstallMode.Enchase)
{
message = GetGameUIMan().GetStringFromTable(224);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan()->GetStringFromTable(224), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
return;
}
if (pEquipA.GetEmptyHoleNum() <= 0)
{
message = GetGameUIMan().GetStringFromTable(224);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
EC_IvtrItem pIvtrB = m_SelectedMaterial;
if (pIvtrB == null || !pIvtrB.IsEmbeddable())
EC_IvtrItem pIvtrB = m_SelectedMaterial;
if (pIvtrB == null || !pIvtrB.IsEmbeddable())
{
message = GetGameUIMan().GetStringFromTable(225);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
if (pIvtrB.GetClassID() != (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_STONE)
return;
int nStoneLevel = ((EC_IvtrStone)pIvtrB).GetDBEssence().level;
int nEquipLevel = -1;
switch (pEquipA.GetClassID())
{
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_WEAPON:
nEquipLevel = ((CECIvtrWeapon)pEquipA).GetDBEssence().level;
break;
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_ARMOR:
nEquipLevel = ((EC_IvtrArmor)pEquipA).GetDBEssence().level;
break;
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_DECORATION:
nEquipLevel = ((EC_IvtrDecoration)pEquipA).GetDBEssence().level;
break;
}
if (nStoneLevel > nEquipLevel)
{
message = GetGameUIMan().GetStringFromTable(300);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
//pr
UnityGameSession.c2s_CmdNPCSevEmbed(
(ushort)m_SecondInvSlot, (ushort)m_FirstInvSlot,
pIvtrB.GetTemplateID(), pIvtrA.GetTemplateID());
pHost.GetPack(InventoryConst.IVTRTYPE_PACK).UnfreezeAllItems();
message = GetGameUIMan().GetStringFromTable(228);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
}
else if (m_Mode == InstallMode.Disenchase)
{
message = GetGameUIMan().GetStringFromTable(225);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(225), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
return;
if (pEquipA.GetEmptyHoleNum() == pEquipA.GetHoleNum())
{
message = GetGameUIMan().GetStringFromTable(227);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
message = GetGameUIMan().GetStringFromTable(229);
var x = new MessageBoxData()
{
Message = message,
Dlg = this,
MessageBoxType = MessageBoxType.BothYesNoButton
};
CECUIManager.Instance.ShowMessageBox(x);
}
if (pIvtrB.GetClassID() != (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_STONE)
return;
int nStoneLevel = ((EC_IvtrStone)pIvtrB).GetDBEssence().level;
int nEquipLevel = -1;
switch (pEquipA.GetClassID())
{
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_WEAPON:
nEquipLevel = ((CECIvtrWeapon)pEquipA).GetDBEssence().level;
break;
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_ARMOR:
nEquipLevel = ((EC_IvtrArmor)pEquipA).GetDBEssence().level;
break;
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_DECORATION:
nEquipLevel = ((EC_IvtrDecoration)pEquipA).GetDBEssence().level;
break;
}
if (nStoneLevel > nEquipLevel)
{
message = GetGameUIMan().GetStringFromTable(300);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(300), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
return;
}
//pr
UnityGameSession.c2s_CmdNPCSevEmbed(
(ushort)m_SecondInvSlot, (ushort)m_FirstInvSlot,
pIvtrB.GetTemplateID(), pIvtrA.GetTemplateID());
ClearEquipSlot();
ClearMaterialSlot();
pHost.GetPack(InventoryConst.IVTRTYPE_PACK).UnfreezeAllItems();
message = GetGameUIMan().GetStringFromTable(228);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(228),
// MB_OK, A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
// }
// else if( 0 == stricmp(GetName(), "Win_Disenchase") )
// {
// a_LogOutput(1, "[Dat Embed] Win_Disenchase");
// if( pEquipA->GetEmptyHoleNum() == pEquipA->GetHoleNum() )
// {
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(227), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox->SetLife(3);
// return;
// }
// GetGameUIMan()->MessageBox("Game_Disenchase", GetGameUIMan()->GetStringFromTable(229),
// MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160));
// }
}
else if (pHost != null || m_Mode == InstallMode.Disenchase)
{
// TODO: implement uninstall logicq
}
}
@@ -609,12 +576,59 @@ namespace BrewMonster
private void CheckHidePanel(Vector2 screenPos)
{
if (!RectTransformUtility.RectangleContainsScreenPoint(
itemInventoryRoot as RectTransform, screenPos,
Camera.main))
itemInventoryRoot as RectTransform, screenPos,
Camera.main))
{
if(itemInventoryRoot!=null)
if (itemInventoryRoot != null)
itemInventoryRoot.gameObject.SetActive(false);
}
}
private void UpdateResourceInfo()
{
// GetGameUIMan().PlayItemSound(pIvtrSrc, true);
EC_IvtrStone stone;
STONE_ESSENCE pEssence;
// ACHAR szText[40] = _AL("0");
//check if material is stone and show price to merge
if (m_Mode == InstallMode.Enchase)
{
if (m_SelectedMaterial != null)
{
stone = (EC_IvtrStone)m_SelectedMaterial;
pEssence = stone.GetDBEssence();
m_TxtMoney.text = $"{pEssence.install_price}";
// a_sprintf(szText, _AL("%d"), pEssence->install_price);
// m_pTxtGold->SetText(szText);
}
else
{
m_TxtMoney.text = $"{0}";
}
}
else if (m_Mode == InstallMode.Disenchase)
{
int i, nAmount = 0, idItem;
if (m_SelectedEquip is EC_IvtrEquip pEquip)
{
for (i = 0; i < pEquip.GetHoleNum(); i++)
{
idItem = pEquip.GetHoleItem(i);
if (idItem <= 0) continue;
stone = (EC_IvtrStone)EC_IvtrItem.CreateItem(idItem, 0, 1);
pEssence = stone.GetDBEssence();
nAmount += pEssence.uninstall_price;
}
m_TxtMoney.text = $"{nAmount}";
}
else
{
m_TxtMoney.text = $"{0}";
}
}
}
}
}
@@ -54,7 +54,11 @@ namespace BrewMonster
player.GetCurSkill() != null ||
player.IsFighting())
{
uiManager.ShowMessageBox("MessageBox", gameUIMan.GetStringFromTable(11327));
uiManager.ShowMessageBox(new MessageBoxData()
{
Title = "MessageBox",
Message = gameUIMan.GetStringFromTable(11327)
});
}
int nCondition = CECHostSkillModel.Instance.CheckLearnCondition(m_skillID);
@@ -97,7 +101,11 @@ namespace BrewMonster
int needSp = CECHostSkillModel.Instance.GetSkillSp(m_skillID, m_curLevel + 1);
string str = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11326), needMoney, needSp);
var messagebox = uiManager.ShowMessageBox("Game_LearnSkill", str);
var messagebox = uiManager.ShowMessageBox(new MessageBoxData()
{
Title = "Game_LearnSkill",
Message = str,
});
messagebox.SetData((uint)m_skillID);
//GetGameUIMan()->MessageBox("Game_LearnSkill", str, //GetGameUIMan()->GetStringFromTable(231),
// MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
@@ -42,10 +42,10 @@ namespace BrewMonster.PerfectWorld.Scripts.Vfx
}
private void OnDestroy()
{
if(!string.IsNullOrEmpty(_vfxPath))
{
AddressableManager.Instance.ReleaseAsset(_vfxPath);
}
//if(!string.IsNullOrEmpty(_vfxPath))
//{
// AddressableManager.Instance.ReleaseAsset(_vfxPath);
//}
}
private void Update()
@@ -79,21 +79,6 @@ public class LitModelHolder : MonoSingleton<LitModelHolder>
_cts.Cancel();
_cts.Dispose();
}
if (addressableObjects == null)
{
return;
}
// go through candidate list and loaded list, unload all objects in those lists.
foreach (var kvp in _candidatesForLoading)
{
kvp.Key.UnloadAsset();
}
foreach (var obj in _loadedObjects)
{
obj.UnloadAsset();
}
}
#endregion
-5
View File
@@ -107,11 +107,6 @@ public partial class CECGameRun
private static void Dispose()
{
instance = null;
AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.PlayerPrefab);
AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.MonsterPrefab);
AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.NpcServerPrefab);
//AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.PetServerPrefab);
//AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.PetMountServerPrefab);
}
private void LoadPrefabs()
+961
View File
@@ -0,0 +1,961 @@
using BrewMonster.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts;
using BrewMonster.Scripts.World;
using CSNetwork;
using CSNetwork.GPDataType;
using System;
using UnityEngine;
using static BrewMonster.Scripts.CECHPWork;
using static CECPlayerWrapper;
namespace BrewMonster
{
public partial class CECHostPlayer
{
public void OnMsgHstAttackResult(ECMSG Msg)
{
byte[] data = Msg.dwParam1 as byte[];
cmd_host_attack_result pCmd = EC_Utility.ByteArrayToStructure<cmd_host_attack_result>(data);
int iAttackTime = 0;
TurnFaceTo(pCmd.idTarget);
PlayAttackEffect(pCmd.idTarget, 0, 0, pCmd.iDamage, (uint)pCmd.attack_flag, pCmd.attack_speed * 50,
ref iAttackTime);
if (iAttackTime != 0)
{
if (m_pWorkMan.GetRunningWork(CECHPWork.Host_work_ID.WORK_HACKOBJECT) is CECHPWorkMelee pCurWork)
{
pCurWork.SetIdleTime(iAttackTime);
}
}
}
void OnMsgHstAttacked(ECMSG Msg)
{
var m_pPlayerMan = EC_ManMessageMono.Instance.EC_ManPlayer;
cmd_host_attacked pCmd = GPDataTypeHelper.FromBytes<cmd_host_attacked>(Msg.dwParam1 as byte[]);
if (pCmd.iDamage != 0 && (pCmd.cEquipment & 0x7f) != 0x7f)
{
/* char cEquip = (char)(pCmd.cEquipment & 0x7f);
CECIvtrEquip pEquip = (CECIvtrEquip)m_pEquipPack.GetItem(cEquip);
if (pEquip)
pEquip.AddCurEndurance(ARMOR_RUIN_SPEED);*/
}
// The host player is attacked, we should make an effect here
if (GPDataTypeHelper.ISPLAYERID(pCmd.idAttacker))
{
EC_ElsePlayer pAttacker = m_pPlayerMan.GetElsePlayer(pCmd.idAttacker);
if (pAttacker)
{
if (!pAttacker.IsDead())
{
// Face to target
pAttacker.TurnFaceTo(GetPlayerInfo().cid);
}
int useless_attacktime = 0;
pAttacker.PlayAttackEffect(GetCharacterID(), 0, 0, pCmd.iDamage, (uint)pCmd.attack_flag,
pCmd.speed * 50, ref useless_attacktime);
pAttacker.EnterFightState();
}
}
else if (GPDataTypeHelper.ISNPCID(pCmd.idAttacker))
{
CECNPC pAttacker = EC_ManMessageMono.Instance.CECNPCMan.GetNPC(pCmd.idAttacker);
if (pAttacker)
{
pAttacker.OnMsgAttackHostResult(GetCharacterID(), pCmd.iDamage, pCmd.attack_flag, pCmd.speed);
}
}
//CECAutoPolicy::GetInstance().SendEvent_BeHurt(pCmd.idAttacker);
}
private void OnMsgHstHurtResult(ECMSG Msg)
{
//BMLogger.LogError("HoangDev : OnMsgHstHurtResult");
/* int cmd = Convert.ToInt32(Msg.dwParam2);
if (cmd == CommandID.BE_HURT)
{
cmd_be_hurt pCmd = (cmd_be_hurt)Msg.dwParam1;
if (pCmd.damage != 0)
Damaged(pCmd.damage);
}
else if (cmd == CommandID.HURT_RESULT)
{
cmd_hurt_result pCmd = (cmd_hurt_result)Msg.dwParam1;
if (pCmd.target_id == m_PlayerInfo.cid)
return; // Host himself will receive BE_HURT, so ignore this.
if (UnityGameSession.Instance.GameSession.ISPLAYERID(pCmd.target_id))
{
CECElsePlayer pTarget = m_pPlayerMan.GetElsePlayer(pCmd.target_id);
if (pTarget)
pTarget.Damaged(pCmd.damage);
}
else if (UnityGameSession.Instance.GameSession.ISNPCID(pCmd.target_id))
{
CECNPC pTarget = EC_ManMessageMono.Instance._CECNPCMan.GetNPC(pCmd.target_id);
if (pTarget)
pTarget.Damaged(pCmd.damage);
}
}*/
}
private void OnMsgHstStartAttack(in ECMSG Msg)
{
cmd_host_start_attack pCmd = GPDataTypeHelper.FromBytes<cmd_host_start_attack>((byte[])Msg.dwParam1);
// ASSERT(pCmd);
// test code...
// g_pGame.GetRTDebug().OutputNotifyMessage(RTDCOL_WARNING, _AL("start attack !"));
// Check whether target is the one that we have selected
if (m_idSelTarget != pCmd.idTarget)
// g_pGame.RuntimeDebugInfo(RTDCOL_WARNING, _AL("Target has changed !"));
// If target turn to be un-attackable, cancel action
if (AttackableJudge(pCmd.idTarget, true) == 0)
{
UnityGameSession.c2s_CmdCancelAction();
// g_pGame.RuntimeDebugInfo(RTDCOL_WARNING, _AL("Cannel attacking !"));
return;
}
// Synchronize ammo amount
// CECIvtrItem* pItem = m_pEquipPack.GetItem(EQUIPIVTR_PROJECTILE);
// if (pItem)
// {
// if (!pCmd.ammo_remain)
// m_pEquipPack.SetItem(EQUIPIVTR_PROJECTILE, NULL);
// else
// pItem.SetAmount(pCmd.ammo_remain);
// }
CECHPWorkMelee pWork = (CECHPWorkMelee)m_pWorkMan.CreateWork(Host_work_ID.WORK_HACKOBJECT);
m_pWorkMan.StartWork_p1(pWork);
m_bMelee = true;
// AP_ActionEvent(AP_EVENT_STARTMELEE);
}
private void OnMsgHstStopAttack(in ECMSG Msg)
{
// using namespace S2C;
//
m_bMelee = false;
//
// // if there is an attack event currently, we should let it fire now.
ClearComActFlagAllRankNodes(true);
cmd_host_stop_attack pCmd = GPDataTypeHelper.FromBytes<cmd_host_stop_attack>((byte[])Msg.dwParam1);
// ASSERT(pCmd);
/* If attack stopped for target is leave too far, trace it and continue
attacking. Stop reason defined as below:
0x00: attack is canceled or host want to do some other things.
0x01: unable to attack anymore (no ammo, weapon is broken etc.)
0x02: invalid target (target missed or died)
0x04: target is out of range
*/
if ((pCmd.iReason & 0x04) != 0)
{
if (!m_pWorkMan.IsMovingToPosition() &&
!m_pWorkMan.IsTracing())
{
if (CmdNormalAttack(false, false, 0, -1)) //m_pComboSkill != NULL
{
// AP_ActionEvent(AP_EVENT_MELEEOUTOFRANGE, 1);
}
else
{
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_HACKOBJECT);
// AP_ActionEvent(AP_EVENT_STOPMELEE);
}
}
else
{
// AP_ActionEvent(AP_EVENT_STOPMELEE);
}
}
else
{
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_HACKOBJECT);
// AP_ActionEvent(AP_EVENT_STOPMELEE);
}
// #ifdef _SHOW_AUTOPOLICY_DEBUG
// a_LogOutput(1, "Stop Attack, Reason = %d", pCmd.iReason);
// #endif
}
private void OnMsgHstSkillResult(ECMSG Msg)
{
cmd_host_skill_attack_result pCmd =
GPDataTypeHelper.FromBytes<cmd_host_skill_attack_result>((byte[])Msg.dwParam1);
int refFake = 0;
PlayAttackEffect(pCmd.idTarget, pCmd.idSkill, 0, pCmd.iDamage, (uint)pCmd.attack_flag,
pCmd.attack_speed * 50, ref refFake, pCmd.section);
}
private void OnMsgPlayerCastSkill(ECMSG Msg)
{
bool bDoOtherThing = false;
int idTarget = 0;
bool bActionStartSkill = false;
int iActionTime = 1000;
CECPlayerWrapper pWrapper = CECAutoPolicy.GetInstance().GetPlayerWrapper();
switch (Convert.ToInt32(Msg.dwParam2))
{
case CommandID.OBJECT_CAST_SKILL:
{
cmd_object_cast_skill pCmd =
GPDataTypeHelper.FromBytes<cmd_object_cast_skill>((byte[])Msg.dwParam1);
if (m_pCurSkill != null)
{
m_pCurSkill.EndCharging();
}
m_pCurSkill = GetPositiveSkillByID(pCmd.skill);
if (m_pCurSkill == null) m_pCurSkill = GetEquipSkillByID(pCmd.skill);
if (m_pCurSkill == null)
m_pCurSkill = CECComboSkillState.Instance.GetInherentSkillByID((uint)pCmd.skill);
if (m_pCurSkill == null)
{
Debug.Assert(m_pCurSkill != null, "Current skill should not be null");
return;
}
if (m_pCurSkill.IsChargeable())
m_pCurSkill.StartCharging(pCmd.time);
int iWaitTime = -1;
if (m_pCurSkill.GetExecuteTime() >= 0)
iWaitTime = pCmd.time + m_pCurSkill.GetExecuteTime();
CECHPWorkSpell pWork = (CECHPWorkSpell)m_pWorkMan.CreateWork(Host_work_ID.WORK_SPELLOBJECT);
pWork.PrepareCast(pCmd.target, m_pCurSkill, iWaitTime);
m_pWorkMan.StartWork_p1(pWork);
// Start time counter for some type skill
// 为某些类型的技能启动时间计数器
if (!m_pCurSkill.IsChargeable())
{
int iTime = pCmd.time;
if (iTime < 10) iTime = 10; // a_ClampFloor
m_IncantCnt.SetPeriod(iTime);
m_IncantCnt.Reset();
}
else
{
// make sure the counter is correct shown
// 确保计数器正确显示
m_IncantCnt.Reset(true);
}
m_bSpellDSkill = false;
TurnFaceTo(pCmd.target);
m_idCurSkillTarget = pCmd.target;
PlaySkillCastAction(m_pCurSkill.GetSkillID());
bActionStartSkill = true;
iActionTime = iWaitTime;
// Special logging for return-to-town skill (167)
// 回城技能(167)的特殊日志
if (m_pCurSkill.GetSkillID() == ID_RETURNTOWN_SKILL)
{
Debug.Log(
$"Return-to-town skill (167) cast - State2 should trigger SetReturntown(1) on server");
}
break;
}
case CommandID.SKILL_PERFORM:
{
// Skill perform
// 技能执行
m_pPrepSkill = null;
if (m_pCurSkill != null && m_pCurSkill.IsDurative())
m_bSpellDSkill = true;
// Special handling for return-to-town skill (167)
// 回城技能(167)的特殊处理
// When skill 167 reaches State2, server calls SetReturntown(1) which should trigger MSG_HST_GOTO
// 当技能167到达State2时,服务器调用SetReturntown(1),这应该触发MSG_HST_GOTO
if (m_pCurSkill != null && m_pCurSkill.GetSkillID() == ID_RETURNTOWN_SKILL)
{
Debug.Log($"Skill 167 (Return to Town) performed - waiting for MSG_HST_GOTO from server");
}
break;
}
case CommandID.HOST_STOP_SKILL:
{
m_pPrepSkill = null;
CECSkill pSkillToMatch = m_pCurSkill;
if (m_pCurSkill != null)
{
ClearComActFlagAllRankNodes(true);
if (((m_pComboSkill != null && !m_pComboSkill.IsStop()) ||
m_pCurSkill.ChangeToMelee()) && !m_pWorkMan.HasDelayedWork())
{
bDoOtherThing = true;
idTarget = m_idCurSkillTarget;
}
m_pCurSkill.EndCharging();
m_pCurSkill = null;
}
AP.AP_ActionEvent((int)AP_EVENT.AP_EVENT_STOPSKILL);
if (pSkillToMatch != null)
{
// m_pWorkMan中的当前任何Work为最高优先级或、或 CECHPWorkSpell 处于最高优先级且队列中有Delay时间
// 此时此处无法准确匹配,而导致的 CECHPWorkSpell 执行时将落后于其它 CECHPWorkSpell 执行期间将无法响应
// 在这种方法执行完成后,我们使用回城机制来
// If the current Work in m_pWorkMan is the highest priority or CECHPWorkSpell is at the highest priority and there is Delay time in the queue
// At this point, it cannot be accurately matched, causing the CECHPWorkSpell execution to lag behind other CECHPWorkSpell execution and cannot respond
// After this method is executed, we use the return to city mechanism
m_pWorkMan.FinishWork(new CECHPWorkSpellMatcher(pSkillToMatch));
}
StopSkillAttackAction();
m_idCurSkillTarget = 0;
break;
}
case CommandID.SELF_SKILL_INTERRUPTED:
{
// Skill interrupted
// 技能被打断
int skill_id = 0;
m_pPrepSkill = null;
CECSkill
pSkillToMatch = m_pCurSkill; // 保存指针值,用在后面函数调用中 | Save pointer value for later function call
if (m_pCurSkill != null)
{
skill_id = m_pCurSkill.GetSkillID();
ClearComActFlagAllRankNodes(false);
if (((m_pComboSkill != null && !m_pComboSkill.IsStop()) ||
m_pCurSkill.ChangeToMelee()) && !m_pWorkMan.HasDelayedWork())
{
bDoOtherThing = true;
idTarget = m_idCurSkillTarget;
}
m_pCurSkill.EndCharging();
m_pCurSkill = null;
}
m_idCurSkillTarget = 0;
if (pSkillToMatch != null)
{
// 逻辑同 HOST_STOP_SKILL 分支处理 | Logic same as HOST_STOP_SKILL branch
m_pWorkMan.FinishWork(new CECHPWorkSpellMatcher(pSkillToMatch));
}
StopSkillCastAction();
// Print a notify message
// 打印提示消息
//EC_Game.GetGameRun().AddFixedMessage(FIXMSG_SKILLINTERRUPT);
AP.AP_ActionEvent((int)AP_EVENT.AP_EVENT_STOPSKILL);
// 通知策略技能被打断 | Notify policy that skill is interrupted
CECAutoPolicy.GetInstance().SendEvent_SkillInterrupt(skill_id);
break;
}
case CommandID.OBJECT_CAST_INSTANT_SKILL:
{
// Cast instant skill
// 施放即时技能
cmd_object_cast_instant_skill pCmd =
GPDataTypeHelper.FromBytes<cmd_object_cast_instant_skill>((byte[])Msg.dwParam1);
Debug.Assert(pCmd.caster == m_PlayerInfo.cid);
CECSkill pSkill = GetPositiveSkillByID(pCmd.skill);
if (pSkill == null) pSkill = GetEquipSkillByID(pCmd.skill);
if (pSkill == null)
{
Debug.Assert(pSkill != null, "Skill should not be null");
return;
}
if (pCmd.target != 0 && pCmd.target != m_PlayerInfo.cid)
TurnFaceTo(pCmd.target);
PlaySkillCastAction(pSkill.GetSkillID());
bActionStartSkill = true;
break;
}
case CommandID.OBJECT_CAST_POS_SKILL:
{
// Cast position skill (target position instead of target object)
// 施放位置技能(目标位置而不是目标对象)
cmd_object_cast_pos_skill pCmd =
GPDataTypeHelper.FromBytes<cmd_object_cast_pos_skill>((byte[])Msg.dwParam1);
Debug.Assert(pCmd.caster == m_PlayerInfo.cid);
CECSkill pSkill = GetNormalSkill(pCmd.skill);
if (pSkill == null) pSkill = GetEquipSkillByID(pCmd.skill);
if (pSkill == null)
{
Debug.Assert(pSkill != null, "Skill should not be null");
break;
}
TurnFaceTo(pCmd.target);
if (pSkill.GetRangeType() != (int)CECSkill.RangeType.RANGE_SLEF &&
pSkill.GetRangeType() != (int)CECSkill.RangeType.RANGE_SELFSPHERE &&
(pSkill.GetSkillID() == 1095 || // 瞬影瞬斩 | Shadow instant slash
pSkill.GetSkillID() == 1278 || // 魔·瞬影瞬斩 | Demon Shadow instant slash
pSkill.GetSkillID() == 1279 || // 妖瞬影瞬斩 | Monster Shadow instant slash
pSkill.GetSkillID() == 2313))
{
A3DVECTOR3 vPos = pCmd.pos;
if (!IsPosCollideFree(vPos))
{
// Add a little height to ensure player's AABB won't embed with building
// 添加一点高度以确保玩家的AABB不会嵌入建筑物
vPos += new A3DVECTOR3(0, 1, 0) * 0.1f;
}
// Ensure we are not under ground
// 确保我们不在地下
A3DVECTOR3 vNormal = new A3DVECTOR3();
float vTerrainHeight = CECWorld.Instance.GetTerrainHeight(vPos, ref vNormal);
if (vPos.y < vTerrainHeight)
vPos.y = vTerrainHeight;
SetPos(EC_Utility.ToVector3(vPos));
m_CDRInfo.vTPNormal = vPos.y <= vTerrainHeight + 0.1f ? vNormal : new A3DVECTOR3(0);
m_CDRInfo.fYVel = 0.0f;
m_CDRInfo.vAbsVelocity = new A3DVECTOR3(0);
ResetJump();
m_MoveCtrl.SetHostLastPos(vPos);
m_MoveCtrl.SetLastSevPos(vPos);
// Update camera
// 更新相机
//UpdateFollowCamera(false, 10);
}
else
{
CECHPWorkFMove pWork =
(CECHPWorkFMove)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_FLASHMOVE);
// 检查技能执行时间,防止出现浮点数0,出现错误 | Check skill execute time to prevent float 0 error
int nExecuteTime = pSkill.GetExecuteTime();
if (nExecuteTime < 50) nExecuteTime = 50; // a_ClampFloor
if (pSkill.GetSkillID() == 1145 || // 刺客的瞬移技能,需要增加地面效果1145:百步穿杨瞬斩 | Assassin teleport skill
pSkill.GetSkillID() == 1314 || // 魔·百步穿杨瞬斩 | Demon hundred steps instant slash
pSkill.GetSkillID() == 1315 || // 妖·百步穿杨瞬斩 | Monster hundred steps instant slash
pSkill.GetSkillID() == 1362 || // 影遁回杨 | Shadow escape return
pSkill.GetSkillID() == 1690 || // 影遁魔·回杨 | Shadow escape demon return
pSkill.GetSkillID() == 1691 || // 影遁妖回杨 | Shadow escape monster return
pSkill.GetSkillID() == 1845 || // 星湖之狐·瞬移技能 | Star Lake Fox teleport
pSkill.GetSkillID() == 1844 || // 星湖之狐·瞬移技能 | Star Lake Fox teleport
pSkill.GetSkillID() == 1815 || // 妖精 飞 | Fairy fly
pSkill.GetSkillID() == 2272 || // 一步登天 | One step to heaven
pSkill.GetSkillID() == 2315 || // 百步穿杨瞬斩 | Hundred steps instant slash
pSkill.GetSkillID() == 2285 || // 回杨 | Return
pSkill.GetSkillID() == 2340 || // 突袭 | Raid
pSkill.GetSkillID() == 2341 || // 突袭 | Raid
pSkill.GetSkillID() == 2342 || // 突袭 | Raid
pSkill.GetSkillID() == 2553 || // 飞箭雨 | Arrow rain
pSkill.GetSkillID() == 2740 || // 魔·飞箭雨 | Demon arrow rain
pSkill.GetSkillID() == 2741 || // 妖飞箭雨 | Monster arrow rain
pSkill.GetSkillID() == 2559 || // 闪电 | Lightning
pSkill.GetSkillID() == 2752 || // 魔·闪电 | Demon lightning
pSkill.GetSkillID() == 2753) // 妖闪电 | Monster lightning
{
A3DVECTOR3 vPos = pCmd.pos;
if (!IsPosCollideFree(vPos))
{
// Add a little height to ensure player's AABB won't embed with building
// 添加一点高度以确保玩家的AABB不会嵌入建筑物
vPos += new A3DVECTOR3(0, 1, 0) * 0.1f;
}
// Ensure we are not under ground
// 确保我们不在地下
A3DVECTOR3 vNormal = new A3DVECTOR3();
float vTerrainHeight = CECWorld.Instance.GetTerrainHeight(vPos, ref vNormal);
if (vPos.y < vTerrainHeight)
vPos.y = vTerrainHeight;
m_CDRInfo.vTPNormal = vPos.y <= vTerrainHeight + 0.1f ? vNormal : new A3DVECTOR3(0);
m_CDRInfo.fYVel = 0.0f;
m_CDRInfo.vAbsVelocity = new A3DVECTOR3(0);
ResetJump();
pWork.PrepareMove(pCmd.pos, nExecuteTime * 0.001f, pSkill.GetSkillID());
}
else
{
if (pSkill.GetRangeType() == (int)CECSkill.RangeType.RANGE_SLEF ||
pSkill.GetRangeType() == (int)CECSkill.RangeType.RANGE_SELFSPHERE)
{
m_CDRInfo.vTPNormal = m_MoveCtrl.m_vFlashTPNormal;
}
pWork.PrepareMove(pCmd.pos, nExecuteTime * 0.001f, 0);
}
m_pWorkMan.StartWork_p2(pWork);
iActionTime = nExecuteTime;
}
bActionStartSkill = true;
break;
}
case CommandID.PLAYER_CAST_RUNE_SKILL:
{
// Cast rune skill (item skill)
// 施放符文技能(物品技能)
cmd_player_cast_rune_skill pCmd =
GPDataTypeHelper.FromBytes<cmd_player_cast_rune_skill>((byte[])Msg.dwParam1);
Debug.Assert(pCmd.caster == m_PlayerInfo.cid);
if (m_pTargetItemSkill != null)
{
// Delete old target item skill
m_pTargetItemSkill = null;
}
m_pTargetItemSkill = new CECSkill(pCmd.skill, pCmd.level);
if (m_pTargetItemSkill == null)
{
Debug.Assert(m_pTargetItemSkill != null, "Target item skill should not be null");
return;
}
m_pCurSkill = m_pTargetItemSkill;
if (m_pCurSkill.IsChargeable())
m_pCurSkill.StartCharging(pCmd.time);
int iWaitTime = -1;
if (m_pCurSkill.GetExecuteTime() >= 0)
iWaitTime = pCmd.time + m_pCurSkill.GetExecuteTime();
CECHPWorkSpell pWork =
(CECHPWorkSpell)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_SPELLOBJECT);
pWork.PrepareCast(pCmd.target, m_pCurSkill, iWaitTime);
m_pWorkMan.StartWork_p1(pWork);
// Start time counter for some type skill
// 为某些类型的技能启动时间计数器
if (!m_pCurSkill.IsChargeable())
{
int iTime = pCmd.time;
if (iTime < 10) iTime = 10; // a_ClampFloor
m_IncantCnt.SetPeriod(iTime);
m_IncantCnt.Reset();
}
else
{
// make sure the counter is correct shown
// 确保计数器正确显示
m_IncantCnt.Reset(true);
}
m_bSpellDSkill = false;
TurnFaceTo(pCmd.target);
m_idCurSkillTarget = pCmd.target;
PlaySkillCastAction(m_pCurSkill.GetSkillID());
bActionStartSkill = true;
iActionTime = iWaitTime;
Debug.Log($"Cast rune skill({m_pCurSkill.GetSkillID()})");
break;
}
case CommandID.PLAYER_CAST_RUNE_INSTANT_SKILL:
{
// Cast instant rune skill
// 施放即时符文技能
cmd_player_cast_rune_instant_skill pCmd =
GPDataTypeHelper.FromBytes<cmd_player_cast_rune_instant_skill>((byte[])Msg.dwParam1);
Debug.Assert(pCmd.caster == m_PlayerInfo.cid);
if (m_pTargetItemSkill != null)
{
// Delete old target item skill
m_pTargetItemSkill = null;
}
m_pTargetItemSkill = new CECSkill(pCmd.skill, pCmd.level);
if (m_pTargetItemSkill == null)
{
Debug.Assert(m_pTargetItemSkill != null, "Target item skill should not be null");
return;
}
if (pCmd.target != 0 && pCmd.target != m_PlayerInfo.cid)
TurnFaceTo(pCmd.target);
PlaySkillCastAction(m_pTargetItemSkill.GetSkillID());
bActionStartSkill = true;
break;
}
case CommandID.ERROR_MESSAGE:
bDoOtherThing = true;
break;
default:
Debug.Assert(false, "Unknown message type in OnMsgPlayerCastSkill");
break;
}
if (bActionStartSkill)
AP.AP_ActionEvent((int)AP_EVENT.AP_EVENT_STARTSKILL, iActionTime);
if (bDoOtherThing)
{
if (m_pComboSkill != null && !m_pComboSkill.IsStop())
{
// Continue combo skill
// 继续连击技能
if (CECAutoPolicy.GetInstance().IsAutoPolicyEnabled())
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_CONTINUECOMBOSKILL, MANAGER_INDEX.MAN_PLAYER, 0, 0,
m_pComboSkill.GetGroupIndex());
else
m_pComboSkill.Continue(false);
}
else
{
if (idTarget != 0 && idTarget != m_PlayerInfo.cid)
NormalAttackObject(idTarget, true);
}
}
}
void OnMsgHstTargetIsFar(ECMSG Msg)
{
// TO DO: fix later
//if(CmdNormalAttack(true, m_pComboSkill != null, 0, -1) )
// AP_ActionEvent(AP_EVENT_MELEEOUTOFRANGE, 1);
if (CmdNormalAttack(true, false, 0, -1))
{
//AP_ActionEvent(AP_EVENT_MELEEOUTOFRANGE, 1);
}
}
private void OnMsgHstDied(in ECMSG msg)
{
// Mark host player as corpse so CECPlayer.IsDead() returns true
m_dwStates |= (uint)PlayerNPCState.GP_STATE_CORPSE;
EventBus.PublishChannel(GetCharacterID(), new ClearComActFlagAllRankNodesEvent(true));
PlayAction((int)PLAYER_ACTION_TYPE.ACT_GROUNDDIE);
if (PopupManager.Instance != null)
{
PopupManager.Instance.OnPlayerDied();
}
}
private bool NormalAttackObject(int idTarget, bool bForceAttack, bool bMoreClose = false)
{
if (idTarget == 0 || idTarget == m_PlayerInfo.cid)
{
// We should have check target isn't dead
return false;
}
//if (!EC_Game.GetGameRun().GetWorld().GetObject(idTarget, 1))
// return false;
bool bStartNewWork = false;
bool bUseAutoPF = false;
//CECPlayerWrapper* pWrapper = CECAutoPolicy::GetInstance().GetPlayerWrapper();
//if (CECAutoPolicy::GetInstance().IsAutoPolicyEnabled() && pWrapper.GetAttackError() >= 2)
//bUseAutoPF = true;
CECHPWorkTrace pWorkTrace = null;
CECHPWork pWork = null;
if ((pWork = m_pWorkMan.GetWork(CECHPWork.Host_work_ID.WORK_TRACEOBJECT)) != null)
{
pWorkTrace = pWork as CECHPWorkTrace;
}
else if ((pWork = m_pWorkMan.GetWork(CECHPWork.Host_work_ID.WORK_HACKOBJECT)) != null)
{
if ((pWork as CECHPWorkMelee).GetTarget() == idTarget)
return false; // Host is attacking the target
pWorkTrace = (CECHPWorkTrace)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_TRACEOBJECT);
bStartNewWork = true;
}
else if (m_pWorkMan.CanStartWork(CECHPWork.Host_work_ID.WORK_TRACEOBJECT))
{
pWorkTrace = (CECHPWorkTrace)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_TRACEOBJECT);
bStartNewWork = true;
}
if (pWorkTrace != null)
{
pWorkTrace.SetTraceTarget(
pWorkTrace.CreatTraceTarget(idTarget, CECHPWorkTrace.Trace_reason.TRACE_ATTACK, bForceAttack),
bUseAutoPF);
pWorkTrace.SetMoveCloseFlag(bMoreClose);
if (bStartNewWork)
m_pWorkMan.StartWork_p1(pWorkTrace);
return true;
}
return false;
}
public int AttackableJudge(int idTarget, bool bForceAttack)
{
if (CannotAttack())
return 0;
//if (CDlgAutoHelp::IsAutoHelp())
// return 0;
if (idTarget == 0 || idTarget == m_PlayerInfo.cid)
return -1;
CECObject pObject = EC_ManMessageMono.Instance.GetObject(idTarget, 1);
if (!pObject)
return -1;
// If target is pet, it's attacked possibility depends on it's monster
if (GPDataTypeHelper.ISNPCID(idTarget))
{
CECNPC pNPC = (CECNPC)pObject;
int idMaster = pNPC.GetMasterID();
if (idMaster != 0)
{
// master¿ÉÄÜÊÇhostplayer
if (idMaster == m_PlayerInfo.cid)
return 0;
//// Follow pet cannot be attacked
//if (pNPC.IsPetNPC() && ((CECPet)pNPC).IsFollowPet())
// return 0;
idTarget = idMaster;
pObject = EC_ManMessageMono.Instance.GetObject(idTarget, 1);
if (!pObject)
return -1;
}
}
int iRet = 0;
if (GPDataTypeHelper.ISNPCID(idTarget))
{
CECNPC pNPC = (CECNPC)pObject;
// If this npc is host's pet, cannot be attacked
if (pNPC.GetMasterID() == m_PlayerInfo.cid)
return 0;
// If it's a pet and can not be attacked, pet can be attacked only if it's a fighting pet
//if (pNPC.IsPetNPC() && !((CECPet)pNPC).CanBeAttacked())
// return 0;
if (IsInBattle()) // Host is in battle
{
if (InSameBattleCamp(pNPC))
iRet = 0;
else
{
if (pNPC.IsMonsterNPC())
iRet = 1;
else if (pNPC.IsServerNPC() &&
(IsInFortress() ||
pNPC.GetRoleInBattle() == 8)) // ¶Ô·þÎñÐÍNPCµÄ¹¥»÷£¬°ïÅÉ»ùµØ»ò³Çսʱ¿ÉÓÃ
iRet = 1;
else
iRet = 0;
}
}
else if (pNPC.IsServerNPC())
{
// In sanctuary we cannot attack NPCs
if (!IsPVPOpen() || m_bInSanctuary || !bForceAttack)
iRet = 0;
else
iRet = 1;
}
else // Is monster
{
iRet = 1;
}
if (iRet == 1 && pNPC.GetOwnerFaction() > 0)
{
// Õë¶Ô°ïÅÉ PVP Õ½ÕùÖнûÖ¹²¿·Ö¹¥»÷
if (GetFactionID() == pNPC.GetOwnerFaction() || // ²»¹¥»÷ͬ°ï¹Ö
pNPC.IsFactionPVPMineCar() && !CanAttackFactionPVPMineCar() || // ÎÞ·¨ÔÙ¹¥»÷Ëû°ï¿ó³µÇé¿ö
pNPC.IsFactionPVPMineBase() && !CanAttackFactionPVPMineBase())
{
// ÎÞ·¨ÔÙ¹¥»÷Ëû°ï´æ¿óµãÇé¿ö
iRet = 0;
}
}
}
// TO DO: fix later
//else if (GPDataTypeHelper.ISPLAYERID(idTarget))
//{
// // Check duel at first
// if (m_pvp.iDuelState == Duel_state.DUEL_ST_INDUEL && m_pvp.idDuelOpp == idTarget)
// return 1;
// else if (m_pvp.iDuelState == Duel_state.DUEL_ST_STOPPING && m_pvp.idDuelOpp == idTarget)
// return 0;
// // In sanctuary we cannot attack other players
// if (m_bInSanctuary)
// return 0;
// //ASSERT(pObject.GetClassID() == CECObject::OCID_ELSEPLAYER);
// EC_ElsePlayer pPlayer = (EC_ElsePlayer)pObject;
// ROLEBASICPROP bp = pPlayer.GetBasicProps();
// EC_GAME_SETTING gs = g_pGame.GetConfigs().GetGameSettings();
// if (m_pvp.bFreePVP)
// {
// if (IsTeamMember(idTarget))
// return 0;
// // In free pvp mode, for example, host is in arena.
// if (bForceAttack)
// iRet = 1;
// else if (gs.bAtk_NoMafia && IsFactionMember(pPlayer.GetFactionID()))
// iRet = 0;
// else if (gs.bAtk_NoWhite && !pPlayer.IsInvader() && !pPlayer.IsPariah())
// iRet = 0;
// else if (gs.bAtk_NoAlliance && g_pGame.GetFactionMan().IsFactionAlliance(pPlayer.GetFactionID()))
// iRet = 0;
// else if (gs.bAtk_NoForce && GetForce() > 0 && GetForce() == pPlayer.GetForce())
// iRet = 0;
// else
// iRet = 1;
// }
// else if (m_iBattleCamp != GP_BATTLE_CAMP_NONE)
// {
// // Host is in battle
// int iCamp = pPlayer.GetBattleCamp();
// if (iCamp != GP_BATTLE_CAMP_NONE && iCamp != m_iBattleCamp)
// iRet = 1;
// else
// iRet = 0;
// }
// else // Normal mode
// {
// if (IsTeamMember(idTarget))
// return 0;
// if (!IsPVPOpen() || !pPlayer.IsPVPOpen() || m_BasicProps.iLevel < EC_MAXNOPKLEVEL || bp.iLevel < EC_MAXNOPKLEVEL)
// iRet = 0;
// else if (bForceAttack)
// iRet = 1;
// else if (!gs.bAtk_Player)
// iRet = 0;
// else if (gs.bAtk_NoMafia && IsFactionMember(pPlayer.GetFactionID()))
// iRet = 0;
// else if (gs.bAtk_NoWhite && !pPlayer.IsInvader() && !pPlayer.IsPariah())
// iRet = 0;
// else if (gs.bAtk_NoAlliance && g_pGame.GetFactionMan().IsFactionAlliance(pPlayer.GetFactionID()))
// iRet = 0;
// else if (gs.bAtk_NoForce && GetForce() > 0 && GetForce() == pPlayer.GetForce())
// iRet = 0;
// else
// iRet = 1;
// }
//}
else
{
return -1;
}
return iRet;
}
public bool CannotAttack()
{
return (m_dwLIES & (uint)Logic_Influence_Extned_states.LIES_DISABLEFIGHT) != 0;
}
public bool glb_GetForceAttackFlag(uint pdwParam)
{
/*bool bForceAttack = false;
CECInputCtrl* pInputCtrl = g_pGame.GetGameRun().GetInputCtrl();
if (pdwParam)
bForceAttack = pInputCtrl.IsCtrlPressed(*pdwParam);
else
bForceAttack = pInputCtrl.KeyIsBeingPressed(VK_CONTROL);
return bForceAttack;*/
return false;
}
// Start normal attacking to selected target
public bool CmdNormalAttack(bool bMoreClose /* false */, bool bCombo /* false */,
int idTarget /* 0 */, int iForceAtk /* -1 */)
{
// StackChecker::ACTrace(2);
// first of all see if we need to cancel sitdown work.
// if (m_pWorkMan.IsSitting())
// {
// g_pGame.GetGameSession().c2s_CmdStandUp();
// return false;
// }
if (!CanDo(ActionCanDo.CANDO_MELEE))
return false;
// if (InSlidingState())
// return false;
// if (!bCombo)
// ClearComboSkill();
if (idTarget <= 0)
idTarget = m_idSelTarget;
bool bForceAttack;
if (iForceAtk < 0)
bForceAttack = glb_GetForceAttackFlag(0);
else
bForceAttack = iForceAtk > 0 ? true : false;
if (AttackableJudge(idTarget, bForceAttack) != 1)
return false;
return NormalAttackObject(idTarget, bForceAttack, bMoreClose);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9117c7fe23c427b4781d9dd334c1aba7
+265
View File
@@ -0,0 +1,265 @@
using BrewMonster.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts;
using BrewMonster.UI;
using CSNetwork;
using CSNetwork.GPDataType;
using ModelRenderer.Scripts.GameData;
using PerfectWorld.Scripts;
using PerfectWorld.Scripts.Managers;
using System;
using UnityEngine;
using static BrewMonster.Scripts.CECHPWork;
namespace BrewMonster
{
public partial class CECHostPlayer
{
private void OnMsgHstNPCGreeting(ECMSG Msg)
{
cmd_npc_greeting pCmd = GPDataTypeHelper.FromBytes<cmd_npc_greeting>((byte[])Msg.dwParam1);
if (GPDataTypeHelper.ISNPCID(pCmd.idObject))
{
// רŴѧϰܵNPC
//if (CECHostSkillModel::Instance().IsSkillLearnNPC(pCmd.idObject))
//{
// CECGameUIMan* pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
// //m_idSevNPC = pCmd.idObject;
// //m_bTalkWithNPC = true;
// //pGameUI.GetDialog("Win_SkillAction").Show(true);
// //CDlgSkillAction* dlg = dynamic_cast<CDlgSkillAction*>(pGameUI.GetDialog("Win_SkillAction"));
// //dlg.ForceShowDialog();
// CDlgSkillAction* dlg = dynamic_cast<CDlgSkillAction*>(pGameUI.GetDialog("Win_SkillAction"));
// dlg.SetReceivedNPCGreeting(true);
// return;
//}
CECNPC pNPC = EC_ManMessageMono.Instance.CECNPCMan.GetNPC(pCmd.idObject);
if (!pNPC || !pNPC.IsServerNPC())
{
return;
}
// Check distance again
if (!CanTouchTarget(pNPC.GetPos(), pNPC.GetTouchRadius(), 3))
return;
m_idSevNPC = pCmd.idObject;
m_bTalkWithNPC = true;
// Check way point service on NPC
//TODO: Fix later
//var dwID = (pNPC as CECNPCServer).GetWayPointID();
//if (dwID != null && !HasWayPoint(dwID))
//UnityGameSession.c2s_CmdNPCSevWaypoint();
//g_pGame.GetGameSession().c2s_CmdNPCSevWaypoint();
var pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
NPC_ESSENCE? result = (pNPC as CECNPCServer).GetDBEssence();
if (result != null)
{
pGameUI.PopupNPCDialog(result.Value);
}
}
//else if (GPDataTypeHelper.ISPLAYERID(pCmd.idObject))
//{
// EC_ElsePlayer pPlayer = m_pPlayerMan.GetElsePlayer(pCmd.idObject);
// // Check distance again
// if (!pPlayer || !CanTouchTarget(pPlayer.GetPos(), 0.0f, 3))
// return;
// m_idSevNPC = pCmd.idObject;
// m_bTalkWithNPC = true;
// m_iBoothState = 3;
// g_pGame.GetGameSession().c2s_CmdNPCSevGetContent(GP_NPCSEV_BOOTHSELL);
// m_pBuyPack.RemoveAllItems();
// m_pSellPack.RemoveAllItems();
// m_pEPBoothBPack.RemoveAllItems();
// m_pEPBoothSPack.RemoveAllItems();
// CECGameUIMan* pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
// pGameUI.PopupBoothDialog(true, false, pCmd.idObject);
//}
else
{
return;
}
}
private void OnMsgPlayerDoEmote(ECMSG Msg)
{
if (!m_pWorkMan.IsStanding() &&
!m_pWorkMan.IsBeingBound())
return;
int cmd = Convert.ToInt32(Msg.dwParam2);
if (cmd == CommandID.OBJECT_DO_EMOTE)
{
cmd_object_do_emote pCmd = GPDataTypeHelper.FromBytes<cmd_object_do_emote>((byte[])Msg.dwParam1);
DoEmote(pCmd.emotion);
// if( m_iBuddyId )
// {
// CECPlayer pBuddy = m_pPlayerMan.GetPlayer(m_iBuddyId);
// if (pBuddy)
// pBuddy.DoEmote(pCmd.emotion);
// }
GetTaskInterface().SetEmotion(pCmd.emotion);
}
else if (cmd == CommandID.OBJECT_EMOTE_RESTORE)
{
CECHPWork pWork = m_pWorkMan.GetRunningWork((int)WorkID.WORK_STAND);
if (pWork != null)
{
((CECHPWorkStand)pWork).SetPoseAction((int)PLAYER_ACTION_TYPE.ACT_STAND, false);
}
}
}
// Do emote action
private bool DoEmote(int idEmote)
{
if (!m_pWorkMan.IsStanding())
return false;
CECHPWorkStand pWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_STAND) as CECHPWorkStand;
if (pWork == null)
{
Debug.LogError("Null CECHPWorkStand");
}
int iAction = (int)PLAYER_ACTION_TYPE.ACT_STAND;
bool bSession = false;
// Select action according to pose
switch (idEmote)
{
case (int)RoleExpression.ROLEEXP_WAVE: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_WAVE; break;
case (int)RoleExpression.ROLEEXP_NOD: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_NOD; break;
case (int)RoleExpression.ROLEEXP_SHAKEHEAD: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_SHAKEHEAD; break;
case (int)RoleExpression.ROLEEXP_SHRUG: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_SHRUG; break;
case (int)RoleExpression.ROLEEXP_LAUGH: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_LAUGH; break;
case (int)RoleExpression.ROLEEXP_ANGRY: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_ANGRY; break;
case (int)RoleExpression.ROLEEXP_STUN: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_STUN; break;
case (int)RoleExpression.ROLEEXP_DEPRESSED: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_DEPRESSED; break;
case (int)RoleExpression.ROLEEXP_KISSHAND: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_KISSHAND; break;
case (int)RoleExpression.ROLEEXP_SHY: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_SHY; break;
case (int)RoleExpression.ROLEEXP_SALUTE: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_SALUTE; break;
case (int)RoleExpression.ROLEEXP_SITDOWN:
iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_SITDOWN;
bSession = true;
break;
case (int)RoleExpression.ROLEEXP_ASSAULT: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_ASSAULT; break;
case (int)RoleExpression.ROLEEXP_THINK: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_THINK; break;
case (int)RoleExpression.ROLEEXP_DEFIANCE: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_DEFIANCE; break;
case (int)RoleExpression.ROLEEXP_VICTORY: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_VICTORY; break;
case (int)RoleExpression.ROLEEXP_GAPE: iAction = (int)PLAYER_ACTION_TYPE.ACT_GAPE; break;
case (int)RoleExpression.ROLEEXP_KISS: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_KISS; break;
case (int)RoleExpression.ROLEEXP_FIGHT: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_FIGHT; break;
case (int)RoleExpression.ROLEEXP_ATTACK1: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_ATTACK1; break;
case (int)RoleExpression.ROLEEXP_ATTACK2: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_ATTACK2; break;
case (int)RoleExpression.ROLEEXP_ATTACK3: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_ATTACK3; break;
case (int)RoleExpression.ROLEEXP_ATTACK4: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_ATTACK4; break;
case (int)RoleExpression.ROLEEXP_DEFENCE: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_DEFENCE; break;
case (int)RoleExpression.ROLEEXP_FALL: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_FALL; break;
case (int)RoleExpression.ROLEEXP_FALLONGROUND:
iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_FALLONGROUND; break;
case (int)RoleExpression.ROLEEXP_LOOKAROUND:
iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_LOOKAROUND; break;
case (int)RoleExpression.ROLEEXP_DANCE: iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_DANCE; break;
case (int)RoleExpression.ROLEEXP_FASHIONWEAPON:
iAction = (int)PLAYER_ACTION_TYPE.ACT_EXP_FASHIONWEAPON; break;
case (int)RoleExpression.ROLEEXP_TWO_KISS: iAction = (int)PLAYER_ACTION_TYPE.ACT_TWO_KISS; break;
case (int)RoleExpression.ROLEEXP_FIREWORK: iAction = (int)PLAYER_ACTION_TYPE.ACT_ATTACK_TOSS; break;
default:
break;
}
pWork.SetPoseAction(iAction, bSession);
return true;
}
void OnMsgPlayerGather(ECMSG Msg)
{
int cmd = Convert.ToInt32(Msg.dwParam2);
if (cmd == CommandID.PLAYER_GATHER_START)
{
cmd_player_gather_start pCmd = GPDataTypeHelper.FromBytes<cmd_player_gather_start>((byte[])Msg.dwParam1);
EC_ManMatter pMatterMan = EC_ManMessageMono.Instance.GetECManMatter;//g_pGame.GetGameRun().GetWorld().GetMatterMan();
CECMatter pMatter = pMatterMan.GetMatter(pCmd.mid);
// if (pMatter && pMatter.IsMonsterSpiritMine()) {
// CECHPWorkUse* pWork = (CECHPWorkUse*)m_pWorkMan.CreateWork(CECHPWork::WORK_USEITEM);
// if (pWork) {
// pWork.SetParams(pCmd.mid, pCmd.use_time * 1000, pCmd.mid, true);
// m_pWorkMan.StartWork_p1(pWork);
// }
// StartMonsterSpiritConnectGfx(pCmd.mid, pMatter.GetPos());
// } else {
EC_HPWorkPick pWork = (EC_HPWorkPick)m_pWorkMan.CreateWork(Host_work_ID.WORK_PICKUP);
if (pWork != null)
{
pWork.SetGather(true, pMatter ? pMatter.GetTemplateID() : 0);
m_pWorkMan.StartWork_p1(pWork);
}
// }
// Start time counter
m_GatherCnt.SetPeriod(pCmd.use_time * 1000);
m_GatherCnt.Reset();
}
else if (cmd == CommandID.PLAYER_GATHER_STOP)
{
cmd_player_gather_stop pCmd = GPDataTypeHelper.FromBytes<cmd_player_gather_stop>((byte[])Msg.dwParam1);
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_PICKUP);
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_USEITEM);
// StopMonsterSpiritConnectGfx();
var pDlg = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan().GetDialog("Win_Prgs2");
if (pDlg == null)
{
BMLogger.LogError("Null Win_Prgs2");
return;
}
if (pDlg is not DlgWinPrgs2 dlgWinPrgs)
{
BMLogger.LogError("Can not cast Win_Prgs2");
return;
}
dlgWinPrgs.SetActiveProgress(false);
}
else if (cmd == CommandID.MINE_GATHERED)
{
cmd_mine_gathered pCmd = GPDataTypeHelper.FromBytes<cmd_mine_gathered>((byte[])Msg.dwParam1);
// ASSERT(pCmd && pCmd.player_id == m_PlayerInfo.cid);
elementdataman pDataMan = EC_Game.GetElementDataMan();
DATA_TYPE DataType = pDataMan.get_data_type((uint)pCmd.item_type, ID_SPACE.ID_SPACE_ESSENCE);
if (DataType == DATA_TYPE.DT_MONSTER_SPIRIT_ESSENCE)
{
// StartMonsterSpiritBallGfx();
// m_CardHolder.gain_times++;
}
}
}
// Is doing session pose ?
private bool DoingSessionPose()
{
var pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_STAND);
if (pCurWork != null)
{
if (((CECHPWorkStand)pCurWork).DoingSessionPose())
{
return true;
}
}
return false;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e28dd00d9a790bb4eb9e05f52c4e6aba
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9c5087cf8a535ec4db0686ae8fba0ecf
+69
View File
@@ -0,0 +1,69 @@
using BrewMonster.Managers;
using BrewMonster.Network;
using CSNetwork;
using CSNetwork.GPDataType;
using System.Runtime.InteropServices;
namespace BrewMonster
{
public partial class CECHostPlayer
{
private void OnMsgHstJoinTeam(ECMSG Msg)
{
var data = (byte[])Msg.dwParam1;
if (data == null || data.Length < Marshal.SizeOf<cmd_team_join_team>()) return;
var pCmd = GPDataTypeHelper.FromBytes<cmd_team_join_team>(data);
var pTeamMan = CECGameRun.Instance?.GetTeamMan();
if (pTeamMan == null) return;
var pTeam = pTeamMan.GetTeam(pCmd.idLeader);
if (pTeam == null)
pTeam = pTeamMan.CreateTeam(pCmd.idLeader);
if (pTeam == null) return;
if (pCmd.idLeader == m_PlayerInfo.cid)
pTeam.AddMember(pCmd.idLeader);
pTeam.SetPickupFlag(pCmd.wPickFlag);
SetTeam(pTeam);
NotifyUIUpdateTeam();
}
private void OnMsgHstLeaveTeam(ECMSG Msg)
{
var data = (byte[])Msg.dwParam1;
if (data == null || data.Length < Marshal.SizeOf<cmd_team_leave_party>()) return;
var pCmd = GPDataTypeHelper.FromBytes<cmd_team_leave_party>(data);
if (m_pTeam == null) return;
var pTeamMan = CECGameRun.Instance?.GetTeamMan();
if (pTeamMan != null)
pTeamMan.ReleaseTeam(pCmd.idLeader);
SetTeam(null);
NotifyUIUpdateTeam();
}
private void OnMsgHstNewTeamMem(ECMSG Msg)
{
var data = (byte[])Msg.dwParam1;
if (data == null || data.Length < Marshal.SizeOf<cmd_team_new_member>()) return;
var pCmd = GPDataTypeHelper.FromBytes<cmd_team_new_member>(data);
if (m_pTeam == null) return;
int cid = pCmd.idMember;
m_pTeam.AddMember(cid);
m_pTeam.AddUnknownID(cid);
if (EC_ManMessageMono.Instance?.GetECManPlayer?.GetPlayer(cid, 0) == null && UnityGameSession.Instance != null)
UnityGameSession.c2s_CmdTeamMemberPos(1, new[] { cid });
NotifyUIUpdateTeam();
}
private void OnMsgHstTeamMemberData(ECMSG Msg)
{
var data = (byte[])Msg.dwParam1;
if (data == null) return;
try
{
var (header, members) = GPDataTypeHelper.ParseTeamMemberData(data);
if (m_pTeam == null || header.idLeader != m_pTeam.GetLeaderID()) return;
m_pTeam.UpdateTeamData(header, members);
NotifyUIUpdateTeam();
}
catch { }
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2c86a928789ee0f47861a6e0948ad971
+559
View File
@@ -0,0 +1,559 @@
using BrewMonster.Network;
using BrewMonster.Scripts;
using BrewMonster.Scripts.Pet;
using BrewMonster.UI;
using CSNetwork;
using CSNetwork.GPDataType;
using System;
using System.Runtime.InteropServices;
using BrewMonster.Assets.PerfectWorld.Scripts.Players;
using UnityEngine;
using static BrewMonster.Scripts.Pet.CECPetData;
namespace BrewMonster
{
public partial class CECHostPlayer
{
private void OnMsgPlayerFly(ECMSG Msg)
{
if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_TAKEOFF)
{
if ((m_dwStates & PlayerNPCState.GP_STATE_FLY) == 0)
{
m_dwStates |= PlayerNPCState.GP_STATE_FLY;
m_bRushFly = false;
CECHPWorkFly pWork = (CECHPWorkFly)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_FLYOFF);
if (m_pWorkMan.IsFreeFalling())
{
pWork.m_bContinueFly = true;
m_pWorkMan.StartWork_p1(pWork);
}
else
{
pWork.m_bContinueFly = false;
m_pWorkMan.StartWork_p2(pWork);
}
}
}
else if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_LANDING)
{
if ((m_dwStates & PlayerNPCState.GP_STATE_FLY) != 0)
{
m_dwStates &= ~(uint)PlayerNPCState.GP_STATE_FLY;
if (IsDead() || m_bCandHangerOn || IsHangerOn())
ShowWing(false);
else
{
CECHPWorkFall pWork =
(CECHPWorkFall)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_FREEFALL);
pWork.SetFallType(CECHPWorkFall.Fall_type.TYPE_FLYFALL);
m_pWorkMan.StartWork_p1(pWork);
}
// Below two lines will fix the "host stand in air" bug.
m_iMoveEnv = Move_environment.MOVEENV_GROUND;
m_CDRInfo.vTPNormal.Clear();
}
}
else // HOST_RUSH_FLY
{
cmd_host_rush_fly pCmd = GPDataTypeHelper.FromBytes<cmd_host_rush_fly>((byte[])Msg.dwParam1);
m_bRushFly = pCmd.is_active != 0 ? true : false;
}
}
void OnMsgHstPetOpt(ECMSG Msg)
{
CECGameRun pGameRun = EC_Game.GetGameRun();
int header = Convert.ToInt32(Msg.dwParam2);
switch (header)
{
case CommandID.GAIN_PET:
{
cmd_gain_pet pCmd = GPDataTypeHelper.FromBytes<cmd_gain_pet>((byte[])Msg.dwParam1);
m_pPetCorral.AddPet(pCmd.slot_index, pCmd.data);
// Print a notify
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
if (pPet != null)
{
if (pPet.IsFollowPet() || pPet.IsCombatPet() || pPet.IsEvolutionPet())
{
// TO DO: fix later
//pGameRun.AddFixedMessage(FIXMSG_PET_HATCH, pPet.GetName());
}
else if (pPet.IsSummonPet())
{
// TO DO: fix later
//pGameRun.AddFixedMessage(FIXMSG_SUMMON_PET_APPEAR, pPet.GetName());
}
}
break;
}
case CommandID.FREE_PET:
{
cmd_free_pet pCmd = GPDataTypeHelper.FromBytes<cmd_free_pet>((byte[])Msg.dwParam1);
// Print a notify
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
if (pPet != null)
{
if (pPet.IsFollowPet() || pPet.IsCombatPet() || pPet.IsEvolutionPet())
{
// TO DO: fix later
//pGameRun.AddFixedMessage(FIXMSG_PET_FREE, pPet.GetName());
}
else if (pPet.IsSummonPet())
{
// TO DO: fix later
//pGameRun.AddFixedMessage(FIXMSG_SUMMON_PET_DISAPPEAR, pPet.GetName());
}
}
// Remove pet from corral
m_pPetCorral.FreePet(pCmd.slot_index, pCmd.pet_id);
// Update pet shortcuts
UpdateFreedPetSC(pCmd.slot_index);
break;
}
case CommandID.SUMMON_PET:
{
cmd_summon_pet pCmd = GPDataTypeHelper.FromBytes<cmd_summon_pet>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
//ASSERT(pPet && pPet.GetTemplateID() == pCmd.pet_tid);
m_pPetCorral.SetActivePetIndex(pCmd.slot_index);
m_pPetCorral.SetActivePetNPCID(pCmd.pet_pid);
m_pPetCorral.SetActivePetLifetime(pCmd.life_time);
if (EC_Game.GetConfigs().GetGameSettings().bPetAutoSkill)
{
for (int i = 0; i < pPet.GetSkillNum(SKILLTYPE.EM_SKILL_DEFAULT); i++)
{
PETSKILL? pSkill = pPet.GetSkill(SKILLTYPE.EM_SKILL_DEFAULT, i);
if (pSkill != null && EC_Game.IsPetAutoSkill(pSkill.Value.idSkill))
pPet.AddAutoSkill(pSkill.Value.idSkill);
}
}
// TO DO: fix later
//OnPetSays(pCmd.pet_tid, pCmd.pet_pid, CECPetWords::TW_SUMMON);
//if (pPet.IsCombatPet() || pPet.IsSummonPet() || pPet.IsEvolutionPet())
// CDlgQuickBarPet::ResetAutoCastSkill();
break;
}
case CommandID.RECALL_PET:
{
cmd_recall_pet pCmd = GPDataTypeHelper.FromBytes<cmd_recall_pet>((byte[])Msg.dwParam1);
//ASSERT(pCmd.slot_index == m_pPetCorral.GetActivePetIndex());
int tid = pCmd.pet_id;
int nid = m_pPetCorral.GetActivePetNPCID();
// л˵
switch (pCmd.reason)
{
case (char)PET_RECALL_REASON.PET_RECALL_DEFAULT:
//OnPetSays(tid, nid, CECPetWords::TW_RECALL);
break;
case (char)PET_RECALL_REASON.PET_RECALL_DEATH:
//OnPetSays(tid, nid, CECPetWords::TW_DEAD);
break;
case (char)PET_RECALL_REASON.PET_RECALL_LIFE_EXHAUST:
//OnPetSays(tid, nid, CECPetWords::TW_DISAPPEAR);
break;
case (char)PET_RECALL_REASON.PET_RECALL_SACRIFICE:
//OnPetSays(tid, nid, CECPetWords::TW_SACRIFICE);
break;
}
CECPetData pPet = m_pPetCorral.GetActivePet();
if (pPet != null)
pPet.OnPetDead();
m_pPetCorral.SetActivePetIndex(-1);
m_pPetCorral.SetActivePetNPCID(0);
m_bPetInSanctuary = false;
break;
}
case CommandID.PLAYER_START_PET_OP:
{
cmd_player_start_pet_op pCmd =
GPDataTypeHelper.FromBytes<cmd_player_start_pet_op>((byte[])Msg.dwParam1);
int iDoWhat;
if (pCmd.op == 0)
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_SUMMONPET;
else if (pCmd.op == 1)
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_RECALLPET;
else if (pCmd.op == 2)
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_BANISHPET;
else if (pCmd.op == 3)
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_RESTOREPET;
else
iDoWhat = (int)CECHPWorkConcentrate.eDO_PET.DO_UNKNOWN;
m_PetOptCnt.SetPeriod(pCmd.delay * 50);
m_PetOptCnt.Reset();
CECHPWorkConcentrate pWork =
(CECHPWorkConcentrate)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_CONCENTRATE);
pWork.SetDoWhat(iDoWhat);
m_pWorkMan.StartWork_p1(pWork);
break;
}
case CommandID.PLAYER_STOP_PET_OP:
{
if (IsOperatingPet() != 0)
m_pWorkMan.FinishRunningWork(CECHPWork.Host_work_ID.WORK_CONCENTRATE);
break;
}
case CommandID.PET_RECEIVE_EXP:
{
cmd_pet_receive_exp pCmd = GPDataTypeHelper.FromBytes<cmd_pet_receive_exp>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
if (pPet != null)
{
//ASSERT(pPet.GetTemplateID() == pCmd.pet_id);
pPet.AddExp(pCmd.exp);
}
break;
}
case CommandID.PET_LEVELUP:
{
cmd_pet_levelup pCmd = GPDataTypeHelper.FromBytes<cmd_pet_levelup>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.slot_index);
if (pPet != null)
{
//ASSERT(pPet.GetTemplateID() == pCmd.pet_id);
pPet.LevelUp(pCmd.level, pCmd.exp);
}
//pGameRun.AddFixedMessage(FIXMSG_PET_LEVELUP, pCmd.level);
break;
}
case CommandID.PET_ROOM:
{
cmd_pet_room pCmd = GPDataTypeHelper.FromBytes<cmd_pet_room>((byte[])Msg.dwParam1);
m_pPetCorral.UpdatePets(pCmd, (byte[])Msg.dwParam1);
CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
//if (pGameUI.GetDialog("Win_Teach").IsShow())
// {
// //pGameUI.UpdateTeach();
// }
break;
}
case CommandID.PET_ROOM_CAPACITY:
{
cmd_pet_room_capacity pCmd =
GPDataTypeHelper.FromBytes<cmd_pet_room_capacity>((byte[])Msg.dwParam1);
m_pPetCorral.MagnifyPetSlots((int)pCmd.capacity);
if (m_pPetCorral.HasInit())
{
//pGameRun.AddFixedMessage(FIXMSG_PET_ROOM_SIZE, pCmd.capacity);
}
else
m_pPetCorral.SetHasInit(true);
break;
}
case CommandID.PET_HONOR_POINT:
{
cmd_pet_honor_point pCmd = GPDataTypeHelper.FromBytes<cmd_pet_honor_point>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.index);
if (pPet != null)
pPet.SetIntimacy(pCmd.cur_honor_point);
break;
}
case CommandID.PET_HUNGER_GAUGE:
{
cmd_pet_hunger_gauge pCmd = GPDataTypeHelper.FromBytes<cmd_pet_hunger_gauge>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.index);
if (pPet != null)
pPet.SetHunger(pCmd.cur_hunge_gauge);
break;
}
case CommandID.PET_DEAD:
{
cmd_pet_dead pCmd = GPDataTypeHelper.FromBytes<cmd_pet_dead>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData((int)pCmd.pet_index);
if (pPet != null)
{
pPet.SetHPFactor(0.0f);
pPet.SetHP(0);
pPet.OnPetDead();
}
//pGameRun.AddFixedMessage(FIXMSG_PET_DEAD);
break;
}
case CommandID.PET_REVIVE:
{
cmd_pet_revive pCmd = GPDataTypeHelper.FromBytes<cmd_pet_revive>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData((int)pCmd.pet_index);
if (pPet != null)
pPet.SetHPFactor(pCmd.hp_factor);
break;
}
case CommandID.PET_HP_NOTIFY:
{
cmd_pet_hp_notify pCmd = GPDataTypeHelper.FromBytes<cmd_pet_hp_notify>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData((int)pCmd.pet_index);
if (pPet != null)
{
int lastHP = pPet.GetHP();
pPet.SetHPFactor(pCmd.hp_factor);
pPet.SetHP(pCmd.cur_hp);
pPet.SetMPFactor(pCmd.mp_factor);
pPet.SetMP(pCmd.cur_mp);
// If HP is too low, popup a warning on pet's head
int iLimit = (int)(pPet.CalcMaxHP() * 0.3f);
if (pCmd.cur_hp < lastHP && lastHP != 0 && pCmd.cur_hp < iLimit)
{
CECNPC pNPC = EC_Game.GetGameRun().GetWorld().GetNPCMan()
.GetNPC(m_pPetCorral.GetActivePetNPCID());
if (pNPC && pNPC.GetMasterID() == GetCharacterID())
{
//pNPC.BubbleText(CECNPC::BUBBLE_HPWARN, 0);
}
}
}
break;
}
case CommandID.PET_AI_STATE:
{
cmd_pet_ai_state pCmd = GPDataTypeHelper.FromBytes<cmd_pet_ai_state>((byte[])Msg.dwParam1);
// л˵
CECPetData pPetData = m_pPetCorral.GetActivePet();
if (pPetData != null)
{
int tid = pPetData.GetTemplateID();
int nid = m_pPetCorral.GetActivePetNPCID();
if (m_pPetCorral.GetMoveMode() != pCmd.move)
{
switch (pCmd.move)
{
case (byte)CECPetCorral.ePet_MovingMode.MOVE_FOLLOW:
{
//OnPetSays(tid, nid, CECPetWords::TW_FOLLOW);
break;
}
case (byte)CECPetCorral.ePet_MovingMode.MOVE_STAND:
{
//OnPetSays(tid, nid, CECPetWords::TW_STOP);
break;
}
}
}
if (m_pPetCorral.GetAttackMode() != pCmd.attack)
{
switch (pCmd.attack)
{
case (byte)CECPetCorral.ePet_AttackingMode.ATK_DEFENSE:
//OnPetSays(tid, nid, CECPetWords::TW_DEFENSIVE);
break;
case (byte)CECPetCorral.ePet_AttackingMode.ATK_POSITIVE:
//OnPetSays(tid, nid, CECPetWords::TW_OFFENSIVE);
break;
case (byte)CECPetCorral.ePet_AttackingMode.ATK_PASSIVE:
//OnPetSays(tid, nid, CECPetWords::TW_PASSIVE);
break;
}
}
}
m_pPetCorral.SetMoveMode(pCmd.move);
m_pPetCorral.SetAttackMode(pCmd.attack);
break;
}
case CommandID.PET_SET_COOLDOWN:
{
cmd_pet_set_cooldown pCmd = GPDataTypeHelper.FromBytes<cmd_pet_set_cooldown>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.pet_index);
if (pPet != null)
pPet.SetSkillCoolTime(pCmd.cooldown_index, pCmd.cooldown_time);
break;
}
case CommandID.SUMMON_PLANT_PET:
{
int size = Marshal.SizeOf<cmd_summon_plant_pet>();
if (((byte[])Msg.dwParam1).Length >= size)
{
cmd_summon_plant_pet pCmd =
GPDataTypeHelper.FromBytes<cmd_summon_plant_pet>((byte[])Msg.dwParam1);
m_pPetCorral.PlantPetEnter(pCmd);
}
break;
}
case CommandID.PLANT_PET_DISAPPEAR:
{
int size = Marshal.SizeOf<cmd_plant_pet_disapper>();
if (((byte[])Msg.dwParam1).Length >= size)
{
cmd_plant_pet_disapper pCmd =
GPDataTypeHelper.FromBytes<cmd_plant_pet_disapper>((byte[])Msg.dwParam1);
m_pPetCorral.PlantPetDisappear(pCmd);
}
break;
}
case CommandID.PLANT_PET_HP_NOTIFY:
{
int size = Marshal.SizeOf<cmd_plant_pet_hp_notify>();
if (((byte[])Msg.dwParam1).Length >= size)
{
cmd_plant_pet_hp_notify pCmd =
GPDataTypeHelper.FromBytes<cmd_plant_pet_hp_notify>((byte[])Msg.dwParam1);
m_pPetCorral.PlantPetInfo(pCmd);
}
break;
}
case CommandID.PET_PROPERTY:
{
cmd_pet_property pCmd = GPDataTypeHelper.FromBytes<cmd_pet_property>((byte[])Msg.dwParam1);
CECPetData pPet = m_pPetCorral.GetPetData(pCmd.pet_index);
if (pPet != null)
{
pPet.SetExtendProps(pCmd.prop);
}
break;
}
case CommandID.PET_REBUILD_INHERIT_START:
case CommandID.PET_REBUILD_INHERIT_INFO:
case CommandID.PET_REBUILD_INHERIT_END:
case CommandID.PET_EVOLUTION_DONE:
case CommandID.PET_REBUILD_NATURE_START:
case CommandID.PET_REBUILD_NATURE_INFO:
case CommandID.PET_REBUILD_NATURE_END:
{
CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
if (pGameUI != null)
{
//((CDlgPreviewPetRebuild*)pGameUI.GetDialog("Win_PreviewPet")).OnServerNotify(Msg.dwParam2, (void*)Msg.dwParam1);
}
break;
}
default:
break;
}
}
/* Is host operating pet ?
return value:
0: host doesn't operating pet.
1: host is summoning pet.
2: host is recalling pet.
3: host is banishing pet.
*/
public int IsOperatingPet()
{
CECHPWorkConcentrate pWork =
(m_pWorkMan.GetRunningWork(CECHPWork.Host_work_ID.WORK_CONCENTRATE)) as CECHPWorkConcentrate;
if (pWork != null)
{
if (pWork.GetDoWhat() == (int)CECHPWorkConcentrate.eDO_PET.DO_SUMMONPET)
return 1;
else if (pWork.GetDoWhat() == (int)CECHPWorkConcentrate.eDO_PET.DO_RECALLPET)
return 2;
else if (pWork.GetDoWhat() == (int)CECHPWorkConcentrate.eDO_PET.DO_BANISHPET)
return 3;
else if (pWork.GetDoWhat() == (int)CECHPWorkConcentrate.eDO_PET.DO_RESTOREPET)
return 4;
}
return 0;
}
// Summon pet
public bool SummonPet(int iPetIdx)
{
if (m_pActionSwitcher != null)
m_pActionSwitcher.PostMessge((int)EMsgActionSwitcher.MSG_MOUNTPET);
CECGameRun pGameRun = EC_Game.GetGameRun();
CECPetData pPet = m_pPetCorral.GetPetData(iPetIdx);
if (pPet == null)
return false;
if (!CanDo(ActionCanDo.CANDO_SUMMONPET))
return false;
// Couldn't summon daed pet
if (pPet.IsDead())
{
//pGameRun.AddFixedMessage(FIXMSG_PET_DEAD);
Debug.LogError("FIXMSG_PET_DEAD");
return false;
}
// If host could't stop naturally, cancel summoning
if (!NaturallyStopMoving())
return false;
// ¼ì²éµ±Ç°ÊÇ·ñ½ûÖ¹ÕÙ»½Æï³è
if (pPet.IsMountPet() && m_playerLimits[(int)PLAYER_LIMIT.PLAYER_LIMIT_NOMOUNT])
return false;
if (m_ReincarnationCount != 0)
{
int iLevelRequired = pPet.GetLevel() - 35 - m_ReincarnationCount * 5;
if (m_BasicProps.iLevel < iLevelRequired)
{
CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
if (pGameUI != null)
{
// TO DO: fix later
//string strText = "";
//strText.Format(pGameUI.GetStringFromTable(10787), iLevelRequired);
//pGameUI.MessageBox("", strText, MB_OK, A3DCOLORRGBA(255, 255, 255, 160));
}
return false;
}
}
UnityGameSession.c2s_CmdPetSummon(iPetIdx);
return true;
}
public CECPetCorral GetPetCorral()
{
return m_pPetCorral;
}
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 199b19ff05aa30049aca1caf465398f0
@@ -0,0 +1,79 @@
using CSNetwork;
using CSNetwork.GPDataType;
namespace BrewMonster
{
public partial class CECHostPlayer
{
void OnMsgHstExtProp(ECMSG Msg)
{
cmd_own_ext_prop pCmd = GPDataTypeHelper.FromBytes<cmd_own_ext_prop>((byte[])Msg.dwParam1);
m_ExtProps = pCmd.prop;
m_BasicProps.iStatusPt = (int)pCmd.status_point;
m_BasicProps.iAtkDegree = pCmd.attack_degree;
m_BasicProps.iDefDegree = pCmd.defend_degree;
m_BasicProps.iCritRate = pCmd.crit_rate;
m_BasicProps.iCritDamageBonus = pCmd.crit_damage_bonus;
m_BasicProps.iInvisibleDegree = pCmd.invisible_degree;
m_BasicProps.iAntiInvisibleDegree = pCmd.anti_invisible_degree;
m_BasicProps.iPenetration = pCmd.penetration;
m_BasicProps.iResilience = pCmd.resilience;
m_BasicProps.iVigour = pCmd.vigour;
}
private void OnMsgHstInfo00(in ECMSG Msg)
{
cmd_self_info_00 pCmd = GPDataTypeHelper.FromBytes<cmd_self_info_00>((byte[])Msg.dwParam1);
bool bFirstTime = m_BasicProps.iLevel == 0 ? true : false;
if (!bFirstTime)
{
int iLimit = (int)(pCmd.iMaxHP * 0.3f);
if (pCmd.iHP < m_BasicProps.iCurHP && m_BasicProps.iCurHP >= iLimit && pCmd.iHP < iLimit)
{
/*if (CECUIHelper::GetGameUIMan().IsShowLowHP()) {
// ѪÁ¿µÍÓÚÁÙ½çÖµÔò²¥·ÅÌØÐ§
const int GfxLastTime = 10000; // ³ÖÐøÊ±¼ä10Ãë
CECUIHelper::GetGameUIMan().GetScreenEffectMan().StartEffect(CECScreenEffect::EFFECT_REDSPARK, GfxLastTime);
}*/
}
/*if (pCmd.iHP >= iLimit || pCmd.iHP <= 0) {
// ѪÁ¿¸ßÓÚÁÙ½çÖµ»òËÀÍö£¬ÔòÍ£Ö¹²¥·ÅÌØÐ§
CECUIHelper::GetGameUIMan().GetScreenEffectMan().FinishEffect(CECScreenEffect::EFFECT_REDSPARK);
}*/
/*iLimit = (int)(pCmd.iMaxMP * 0.2f);
if (pCmd.iMP < m_BasicProps.iCurMP && m_BasicProps.iCurMP >= iLimit && pCmd.iMP < iLimit)
BubbleText(BUBBLE_MPWARN, 0);*/
/*if (m_ExtProps.max_ap != pCmd.iMaxAP)
g_pGame.GetGameRun().AddFixedMessage(FIXMSG_ADDMAXAP, pCmd.iMaxAP - m_ExtProps.max_ap);*/
}
m_BasicProps.iLevel = pCmd.sLevel;
SetLevel2(pCmd.Level2, bFirstTime);
m_BasicProps.iExp = pCmd.iExp;
m_BasicProps.iSP = pCmd.iSP;
m_BasicProps.iCurHP = pCmd.iHP;
m_BasicProps.iCurMP = pCmd.iMP;
m_BasicProps.iCurAP = pCmd.iAP;
m_ExtProps.bs.max_hp = pCmd.iMaxHP;
m_ExtProps.bs.max_mp = pCmd.iMaxMP;
m_ExtProps.max_ap = pCmd.iMaxAP;
EventBus.Publish(new EXPToUpLevel(GetLevelUpExp(pCmd.sLevel)));
EventBus.Publish<cmd_self_info_00>(pCmd);
EventBus.PublishChannel<cmd_self_info_00>(GetCharacterID(), pCmd);
// if (pCmd.State != 0 && m_bFight == false) PlayEnterBattleGfx();
m_bFight = pCmd.State != 0 ? true : false;
// UpdateGodEvilSprite();
/*CECGameUIMan* pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
CDlgAutoHelp *pDlgHelp = dynamic_cast<CDlgAutoHelp *>(pGameUI.GetDialog("Win_WikiPop"));*/
/*if(pDlgHelp && m_bFight)
pDlgHelp.SetAutoHelpState(false);*/
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a19218082b79eef4687286340cd52157
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c8ab82b5b1e1aee45a936ba119de3444
+270
View File
@@ -0,0 +1,270 @@
using BrewMonster.Network;
using BrewMonster.Scripts;
using CSNetwork;
using CSNetwork.GPDataType;
using System.Runtime.InteropServices;
using Cysharp.Threading.Tasks;
using UnityEngine;
using static BrewMonster.Scripts.CECHPWork;
namespace BrewMonster
{
public partial class CECHostPlayer
{
public void OnMsgHstCorrectPos(in ECMSG Msg)
{
//Debug.LogError("HoangDev : OnMsgHstCorrectPos");
byte[] buf = (byte[])Msg.dwParam1; // chỗ bạn lưu pDataBuf
GCHandle handle = GCHandle.Alloc(buf, GCHandleType.Pinned);
cmd_host_correct_pos pCmd = (cmd_host_correct_pos)Marshal.PtrToStructure(
handle.AddrOfPinnedObject(), typeof(cmd_host_correct_pos));
handle.Free();
//cmd_host_correct_pos pCmd = GPDataTypeHelper.FromBytes<cmd_host_correct_pos>((byte[])Msg.dwParam1);
Debug.LogError("HoangDev :pCmd.pos " + pCmd.pos);
SetPos(pCmd.pos);
m_vVelocity.Clear();
m_CDRInfo.vAbsVelocity.Clear();
m_MoveCtrl.SetMoveStamp(pCmd.stamp);
}
public void OnMsgHstGoto(in ECMSG Msg)
{
PopupManager.Instance.OnPlayerRevived();
// p1 is a byte[] buffer; parse into cmd_notify_hostpos then set position
// p1 是一个 byte[] 缓冲区;解析为 cmd_notify_hostpos 然后设置位置
byte[] buf = (byte[])Msg.dwParam1;
cmd_notify_hostpos pCmd = GPDataTypeHelper.FromBytes<cmd_notify_hostpos>(buf);
int idInst = pCmd.tag;
Vector3 vPos = new Vector3(pCmd.vPos.x, pCmd.vPos.y, pCmd.vPos.z);
int iLine = pCmd.line;
// Call Goto method to properly handle teleportation
// 调用 Goto 方法来正确处理传送
if (!Goto(idInst, vPos, iLine))
{
BMLogger.LogError($"OnMsgHstGoto: Failed to teleport to instance {idInst}");
return;
}
}
void OnMsgHstWayPoint(ECMSG Msg)
{
//CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
//if (Convert.ToInt32(Msg.dwParam2) == CommandID.ACTIVATE_WAYPOINT)
//{
// cmd_activate_waypoint pCmd = GPDataTypeHelper.FromBytes<cmd_activate_waypoint>((byte[])Msg.dwParam1);
// m_aWayPoints.Add(pCmd.waypoint);
// // add to waypoints array
// pGameUI.GetMapDlgsMgr().UpdateWayPoints(&pCmd.waypoint, 1, false);
// // Print a notify message
// const CECMapDlgsMgr::PointMap& aWayPoints = pGameUI.GetMapDlgsMgr().GetTransPoint();
// CECMapDlgsMgr::PointMap::const_iterator itr = aWayPoints.find(pCmd.waypoint);
// if(itr != aWayPoints.end())
// {
// g_pGame.GetGameRun().AddFixedMessage(FIXMSG_NEWWAYPOINT, (itr.second).strName);
// bool bCanPopUITips = true;
// int count = CECUIConfig::Instance().GetGameUI().GetTaskIDDisableWayPointsUITipsCount();
// // ¼ì²éÉíÉÏÊÇ·ñÓнûÖ¹µ¯³ötipsµÄÈÎÎñ
// for (int i=0;i<count;i++){
// int taskID = CECUIConfig::Instance().GetGameUI().GetTaskIDDisableWayPointsUITips(i);
// if(GetTaskInterface() && GetTaskInterface().HasTask(taskID)){
// bCanPopUITips = false;
// break;
// }
// }
// // µ¯³ötips
// CECScriptMan* pScriptMan = g_pGame.GetGameRun().GetUIManager().GetScriptMan();
// if (pScriptMan && bCanPopUITips)
// {
// pScriptMan.GetContext().GetUI().SetTipDialogTitleAndContent(AC2AS_CP(CP_UTF8, pGameUI.GetStringFromTable(11350)), AC2AS_CP(CP_UTF8, (itr.second).strName));
// pScriptMan.GetContext().GetUI().ShowTip(500, 500, 5000, 300);
// }
// }
// }
// else if (Msg.dwParam2 == WAYPOINT_LIST)
// {
// cmd_waypoint_list* pCmd = (cmd_waypoint_list*)Msg.dwParam1;
// m_aWayPoints.SetSize(pCmd.count, 16);
// for (size_t i = 0; i < pCmd.count; i++)
// m_aWayPoints[i] = pCmd.list[i];
// // update the whole list
// pGameUI.GetMapDlgsMgr().UpdateWayPoints(pCmd.list, pCmd.count, true);
// }
}
void OnMsgHstSetPlayerLimit(ECMSG Msg)
{
cmd_set_player_limit pCmd = GPDataTypeHelper.FromBytes<cmd_set_player_limit>((byte[])Msg.dwParam1);
if (pCmd.index >= 0 && pCmd.index < (int)PLAYER_LIMIT.PLAYER_LIMIT_MAX)
m_playerLimits[pCmd.index] = (pCmd.b != 0);
}
private void OnMsgHstPressCancel(ECMSG Msg)
{
CECHPWork pCurWork = null;
pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_TRACEOBJECT);
if (pCurWork is CECHPWorkTrace workTrace)
{
workTrace.PressCancel();
return;
}
pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_HACKOBJECT);
if (pCurWork != null)
{
UnityGameSession.c2s_CmdCancelAction();
return;
}
pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_USEITEM);
if (pCurWork != null)
{
UnityGameSession.c2s_CmdCancelAction();
return;
}
pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_SPELLOBJECT);
if (pCurWork != null)
{
int iState = ((CECHPWorkSpell)pCurWork).GetState();
if (iState == CECHPWorkSpell.Spell_magic_state.ST_INCANT)
{
UnityGameSession.c2s_CmdCancelAction();
return;
}
}
pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_PICKUP);
if (pCurWork != null)
{
if (((EC_HPWorkPick)pCurWork).IsGather())
{
UnityGameSession.c2s_CmdCancelAction();
return;
}
}
//todo: handle this part
// pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_CONCENTRATE);
// if (pCurWork !=null){
// if (IsOperatingPet()){
// UnityGameSession.c2s_CmdCancelAction();
// return;
// }
// }
// pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_CONGREGATE);
// if (pCurWork !=null){
// if (IsCongregating()){
// UnityGameSession.c2s_CmdCancelAction();
// return;
// }
// }
if (m_bUsingTrashBox || DoingSessionPose())
{
UnityGameSession.c2s_CmdCancelAction();
return;
}
// Cancel current selection
if (m_idSelTarget > 0)
{
SelectTarget(0);
return;
}
// Some work have lower priority
pCurWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_MOVETOPOS);
if (pCurWork != null)
{
((CECHPWorkMove)pCurWork).PressCancel();
return;
}
}
public void StopMovement()
{
m_MoveCtrl.SendStopMoveCmd(playerTransform.position, 5f, (int)GPMoveMode.GP_MOVE_WALK);
}
// Return to a target town through skill
// 通过技能返回目标城镇
// This method implements the Goto logic from the original C++ code
// 此方法实现了原始 C++ 代码中的 Goto 逻辑
private bool Goto(int idInst, Vector3 vPos, int iParallelWorldID)
{
// Jump to instance (change world/instance)
// 跳转到实例(更改世界/实例)
// Note: JumpToInstance is currently a stub in CECGameRun, so we skip the call for now
// 注意:JumpToInstance 目前在 CECGameRun 中是一个存根,所以我们现在跳过调用
// if (CECGameRun.Instance != null && !CECGameRun.Instance.JumpToInstance(idInst, vPos, iParallelWorldID))
// {
// Debug.LogError($"CECHostPlayer::Goto, Failed to jump to instance {idInst}");
// return false;
// }
// Stop all current work and goto specified position
// 停止所有当前工作并转到指定位置
if (m_pWorkMan != null)
{
// Stop auto-moving if active
// 如果正在自动移动则停止
// Note: IsAutoMoving check would go here if available
// 注意:如果可用,IsAutoMoving 检查将放在这里
// Finish all work
// 完成所有工作
m_pWorkMan.FinishAllWork(true);
}
// Add a little height to ensure player's AABB won't embed with building
// 增加一点高度以确保玩家的 AABB 不会嵌入建筑物
vPos.y += 0.1f;
// Ensure we are not under ground (terrain height check would go here)
// 确保我们不会在地下(地形高度检查将放在这里)
// Note: Terrain height check is skipped for now as it requires world access
// 注意:暂时跳过地形高度检查,因为它需要世界访问
// Set position
// 设置位置
SetPos(vPos);
// Reset jump state if available
// 如果可用则重置跳跃状态
// ResetJump(); // Uncomment if ResetJump method exists
// Update camera if available
// 如果可用则更新相机
// UpdateFollowCamera(false, 10); // Uncomment if UpdateFollowCamera method exists
LitModelHolder.Instance.LoadAllObjectsNearTargetPosition(vPos).Forget();
return true;
}
public void SetStatusRun(bool value)
{
if (!isGrounded)
{
Debug.LogError("Player not in ground");
return;
}
isRun = value;
}
public bool IsPlayerMoving()
{
return m_pWorkMan.IsMoving();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 570900be694cc7c4c9c0fc5c399c9a25
File diff suppressed because it is too large Load Diff
+13 -23
View File
@@ -108,17 +108,12 @@ public class CECUIManager : MonoSingleton<CECUIManager>
Debug.LogWarning($"Không tìm thấy UI {componentName} đã spawn trong canvasDlg. Type found: {(type != null ? type.FullName : "null")}");
}
public CDlgMessageBox ShowMessageBox(string title, string message)
public CDlgMessageBox ShowMessageBox(MessageBoxData messageBoxData)
{
var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox;
if (msgBox != null)
{
msgBox.ShowMessageBox(new MessageBoxData()
{
Title = title,
Message = message,
MessageBoxType = MessageBoxType.YesButton
});
msgBox.ShowMessageBox(messageBoxData);
return msgBox;
}
else
@@ -261,24 +256,19 @@ public class CECUIManager : MonoSingleton<CECUIManager>
}
}
else if(string.CompareOrdinal("Game_Disenchase",pDlg.GetName())==0 && DialogBoxCommandIDs.IDOK == iRetVal)
{
// PAUIDIALOG pMsgBox;
var clearEmbeddedChipDlg = GetInGameUIMan().GetDialog("Game_Disenchase");
// EC_IvtrItem pIvtr = (EC_IvtrItem)m_pDlgUninstall->m_pItema->GetDataPtr("ptr_CECIvtrItem");
//
// pSession.c2s_CmdNPCSevClearEmbeddedChip(
// (WORD)m_pDlgUninstall->m_pItema->GetData(), pIvtr->GetTemplateID());
//
// m_pDlgUninstall->Show(false);
// pHost->EndNPCService();
else if (pDlg is DlgInstall dlgInstall && dlgInstall.GetInstallMode == DlgInstall.InstallMode.Disenchase && DialogBoxCommandIDs.IDOK == iRetVal)
{
UnityGameSession.c2s_CmdNPCSevClearEmbeddedChip(dlgInstall.FirstSlotIndex, dlgInstall.SelectedEquip.GetTemplateID());
dlgInstall.Show(false);
pHost.EndNPCService();
// m_pCurNPCEssence = NULL;
// m_pDlgInventory->Show(false);
// pHost->GetPack(IVTRTYPE_PACK)->UnfreezeAllItems();
//
// MessageBox("", GetStringFromTable(228), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox->SetLife(3);
pHost.GetPack((int)InventoryType.IVTRTYPE_PACK).UnfreezeAllItems();
ShowMessageBox(new MessageBoxData()
{
Message = pDlg.GetStringFromTable(228)
});
}
}
+1 -1
View File
@@ -802,7 +802,7 @@ PlayerSettings:
PS4: DOTWEEN
PS5: DOTWEEN
QNX: DOTWEEN
Standalone: DOTWEEN;TESTFAST;_TASK_CLIENT
Standalone: DOTWEEN;_TASK_CLIENT
VisionOS: DOTWEEN
WebGL: DOTWEEN
Windows Store Apps: DOTWEEN