Patch 0.2

This commit is contained in:
Mitachi
2024-07-23 09:31:14 +02:00
parent 227bc91607
commit adc8f96eb5
5 changed files with 96 additions and 34 deletions

View File

@ -39,26 +39,6 @@
// and add under, this: // and add under, this:
#ifdef ENABLE_MOUNT_LIKE_HORSE #ifdef ENABLE_MOUNT_LIKE_HORSE
RemoveAffect(AFFECT_MOUNT_BONUS);
if (const auto pMountItem = GetWear(WEAR_COSTUME_MOUNT)) if (const auto pMountItem = GetWear(WEAR_COSTUME_MOUNT))
{ CalcBonusMount(pMountItem);
for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i) {
if (pMountItem->GetProto()->aApplies[i].bType == APPLY_NONE || vnum == 0)
continue;
AddAffect(AFFECT_MOUNT_BONUS, aApplyInfo[pMountItem->GetProto()->aApplies[i].bType].bPointType, pMountItem->GetProto()->aApplies[i].lValue, AFF_NONE, INFINITE_AFFECT_DURATION, 0, false);
}
}
#endif
/// 3.) Add at the end of the file:
#ifdef ENABLE_MOUNT_LIKE_HORSE
void CHARACTER::CheckEnterMount()
{
if (GetHorse()) // If is already summoned, do nothing
return;
if (const auto pMountItem = GetWear(WEAR_COSTUME_MOUNT))
HorseSummon(true, false, pMountItem->GetValue(1));
}
#endif #endif

View File

@ -9,6 +9,7 @@ ESex GET_SEX(LPCHARACTER ch);
#ifdef ENABLE_MOUNT_LIKE_HORSE #ifdef ENABLE_MOUNT_LIKE_HORSE
public: public:
void CheckEnterMount(); void CheckEnterMount();
void CalcMountBonusBySeal(const LPITEM pMountItem);
#endif #endif
// like: // like:
@ -17,6 +18,7 @@ ESex GET_SEX(LPCHARACTER ch);
#ifdef ENABLE_MOUNT_LIKE_HORSE #ifdef ENABLE_MOUNT_LIKE_HORSE
public: public:
void CheckEnterMount(); void CheckEnterMount();
void CalcMountBonusBySeal(const LPITEM pMountItem);
#endif #endif
}; };

View File

@ -25,10 +25,8 @@
if (m_chHorse) if (m_chHorse)
{ {
#ifdef ENABLE_MOUNT_LIKE_HORSE #ifdef ENABLE_MOUNT_LIKE_HORSE
if (GetMountVnum() != dwVnum) { if (GetMountVnum() != dwVnum)
HorseSummon(false); m_chHorse->SetPolymorph(dwVnum);
HorseSummon(true);
}
#endif #endif
return; return;
} }
@ -45,11 +43,9 @@ void CHARACTER::HorseSummon(bool bSummon, bool bFromFar, DWORD dwVnum, const cha
// NOTE: If you summon and there is already a horse, it will do nothing. // NOTE: If you summon and there is already a horse, it will do nothing.
if (m_chHorse) if (m_chHorse)
{ {
#ifdef ENABLE_MOUNT_LIKE_HORSE // try fix #ifdef ENABLE_MOUNT_LIKE_HORSE
if (GetMountVnum() != dwVnum) { if (GetMountVnum() != dwVnum)
HorseSummon(false); m_chHorse->SetPolymorph(dwVnum);
HorseSummon(true);
}
#endif #endif
return; return;
} }
@ -121,3 +117,29 @@ void CHARACTER::HorseSummon(bool bSummon, bool bFromFar, DWORD dwVnum, const cha
#endif #endif
} }
*/ */
/// 4.) Add at the end of the file:
#ifdef ENABLE_MOUNT_LIKE_HORSE
void CHARACTER::CheckEnterMount()
{
if (GetHorse()) // If is already summoned, do nothing
return;
if (const auto pMountItem = GetWear(WEAR_COSTUME_MOUNT))
HorseSummon(true, false, pMountItem->GetValue(1));
}
void CHARACTER::CalcMountBonusBySeal(const LPITEM pMountItem)
{
if (!GetMountVnum() || !pMountItem || !pMountItem->IsMount())
return;
RemoveAffect(AFFECT_MOUNT_BONUS);
for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i) {
if (pMountItem->GetProto()->aApplies[i].bType == APPLY_NONE || pMountItem->GetValue(1) == 0)
continue;
AddAffect(AFFECT_MOUNT_BONUS, aApplyInfo[pMountItem->GetProto()->aApplies[i].bType].bPointType, pMountItem->GetProto()->aApplies[i].lValue, AFF_NONE, INFINITE_AFFECT_DURATION, 0, false);
}
}
#endif

View File

@ -25,10 +25,8 @@
// and add under, this: // and add under, this:
#ifdef ENABLE_MOUNT_LIKE_HORSE #ifdef ENABLE_MOUNT_LIKE_HORSE
if (item1->IsMount() && item2->IsMount() && destCell.IsEquipPosition()) { if (item1->IsMount() && item2->IsMount() && destCell.IsEquipPosition())
HorseSummon(false);
HorseSummon(true); HorseSummon(true);
}
#endif #endif
/// 3.) Search in bool CHARACTER::UnequipItem(LPITEM item): /// 3.) Search in bool CHARACTER::UnequipItem(LPITEM item):
@ -53,3 +51,12 @@
if (item->IsMount()) if (item->IsMount())
HorseSummon(true); HorseSummon(true);
#endif #endif
/// 5.) in CHARACTER::SetWear(BYTE bCell, LPITEM item):
// at the end before the }, add:
#ifdef ENABLE_MOUNT_LIKE_HORSE
if (item)
CalcBonusMount(item);
#endif

View File

@ -0,0 +1,51 @@
/// 1.) Search in void ITEM_MANAGER::RemoveItem(LPITEM item, const char * c_pszReason)
}
// END_OF_SAFEBOX_TIME_LIMIT_ITEM_BUG_FIX
else
{
// and add under, this:
#ifdef ENABLE_MOUNT_LIKE_HORSE
if (o->GetWear(WEAR_COSTUME_MOUNT) && item == o->GetWear(WEAR_COSTUME_MOUNT)) {
o->StopRiding();
o->HorseSummon(false);
}
#endif
/*Example:
void ITEM_MANAGER::RemoveItem(LPITEM item, const char * c_pszReason)
{
LPCHARACTER o;
if ((o = item->GetOwner()))
{
char szHint[64]{};
snprintf(szHint, sizeof(szHint), "%s %u ", item->GetName(), item->GetCount());
LogManager::instance().ItemLog(o, item, c_pszReason ? c_pszReason : "REMOVE", szHint);
// SAFEBOX_TIME_LIMIT_ITEM_BUG_FIX
if (item->GetWindow() == MALL || item->GetWindow() == SAFEBOX)
{
// If you have a timed item in your store, the server will go down when the time expires.
if (const auto pSafebox = item->GetWindow() == MALL ? o->GetMall() : o->GetSafebox())
pSafebox->Remove(item->GetCell());
}
// END_OF_SAFEBOX_TIME_LIMIT_ITEM_BUG_FIX
else
{
#ifdef ENABLE_MOUNT_LIKE_HORSE
if (o->GetWear(WEAR_COSTUME_MOUNT) && item == o->GetWear(WEAR_COSTUME_MOUNT)) {
o->StopRiding();
o->HorseSummon(false);
}
#endif
o->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
item->RemoveFromCharacter();
}
}
M2_DESTROY_ITEM(item);
}
*/