Initial commit
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
16
README.txt
Normal file
16
README.txt
Normal file
@ -0,0 +1,16 @@
|
||||
Copr. Mitachi
|
||||
|
||||
Pros:
|
||||
- Fewer lines of code (50 or so, versus 1200+ in the public system)
|
||||
- By not using apply_type and value to assign the monster to ride, we will not lose a usable bonus
|
||||
- Being horse-based, trivially it is code that has been tested for years.
|
||||
- If you are on the mount and warp, you will still be on the mount at login (being that we use EnterHorse)
|
||||
- You can take advantage of the horse name system with a few modifications
|
||||
- You only get mount bonuses if you are riding it and not while it is summoned
|
||||
|
||||
Cons:
|
||||
- I couldn't find any
|
||||
|
||||
USAGE:
|
||||
Put the mount vnum in the seal item's value1.
|
||||
You can remove ride.quest or whatever quest you're using for mounts.
|
||||
1
Srcs-Server/#undefined/README.txt
Normal file
1
Srcs-Server/#undefined/README.txt
Normal file
@ -0,0 +1 @@
|
||||
This is a change that required by the system but is not part of it, I just moved code
|
||||
22
Srcs-Server/#undefined/VnumHelper.h
Normal file
22
Srcs-Server/#undefined/VnumHelper.h
Normal file
@ -0,0 +1,22 @@
|
||||
// Search:
|
||||
|
||||
static bool IsPhoenix(DWORD vnum) { return 34001 == vnum; }
|
||||
|
||||
// add under, this:
|
||||
|
||||
static bool IsMount(DWORD vnum) {
|
||||
switch (vnum) {
|
||||
case 20030: case 20110: case 20111: case 20112: case 20113: case 20114: case 20115:
|
||||
case 20116: case 20117: case 20118: case 20205: case 20206: case 20207: case 20208:
|
||||
case 20209: case 20210: case 20211: case 20212: case 20119: case 20219: case 20220:
|
||||
case 20221: case 20222: case 20120: case 20121: case 20122: case 20123: case 20124:
|
||||
case 20125: case 20214: case 20215: case 20217: case 20218: case 20224: case 20225:
|
||||
case 20226: case 20227:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// If you are sick:
|
||||
static constexpr bool IsMount(const DWORD& vnum) noexcept {
|
||||
12
Srcs-Server/#undefined/item.h
Normal file
12
Srcs-Server/#undefined/item.h
Normal file
@ -0,0 +1,12 @@
|
||||
// Search:
|
||||
|
||||
DWORD GetSIGVnum() const
|
||||
{
|
||||
return m_dwSIGVnum;
|
||||
}
|
||||
|
||||
// add under, this:
|
||||
|
||||
// #ifdef ENABLE_MOUNT_COSTUME
|
||||
const bool IsMount() { return GetType() == ITEM_COSTUME && GetSubType() == COSTUME_MOUNT; }
|
||||
// #endif
|
||||
48
Srcs-Server/#undefined/pvp.cpp
Normal file
48
Srcs-Server/#undefined/pvp.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
// Search:
|
||||
|
||||
#include "locale_service.h"
|
||||
|
||||
// add under, this:
|
||||
|
||||
#include "../../common/VnumHelper.h"
|
||||
|
||||
// Search:
|
||||
|
||||
if( true == pkChr->IsHorseRiding() )
|
||||
{
|
||||
if( pkChr->GetHorseLevel() > 0 && 1 == pkChr->GetHorseGrade() )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(!g_bAllMountAttack)
|
||||
{
|
||||
switch( pkChr->GetMountVnum() )
|
||||
{
|
||||
case 0:
|
||||
case 20030:
|
||||
....
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// and replace with:
|
||||
|
||||
if (pkChr->IsHorseRiding())
|
||||
{
|
||||
if (pkChr->GetHorseLevel() > 0 && 1 == pkChr->GetHorseGrade())
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
const auto mountVnum = pkChr->GetMountVnum();
|
||||
if (mountVnum != 0 && !CMobVnumHelper::IsMount(mountVnum))
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
NOTE: Make sure that all the cases you had in the switch,
|
||||
are present in the new IsMount method added in VnumHelper.h
|
||||
|
||||
Also: g_bAllMountAttack comes from novaline, however if you have mainline replace the if/else statement anyway.
|
||||
*/
|
||||
@ -0,0 +1,3 @@
|
||||
// Add
|
||||
|
||||
#define ENABLE_MOUNT_LIKE_HORSE
|
||||
64
Srcs-Server/game/src/char.cpp
Normal file
64
Srcs-Server/game/src/char.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/// 1.) Search in void CHARACTER::SetProto(const CMob * pkMob):
|
||||
|
||||
if (m_bCharType == CHAR_TYPE_HORSE ||
|
||||
GetRaceNum() == 20101 ||
|
||||
GetRaceNum() == 20102 ||
|
||||
GetRaceNum() == 20103 ||
|
||||
GetRaceNum() == 20104 ||
|
||||
GetRaceNum() == 20105 ||
|
||||
GetRaceNum() == 20106 ||
|
||||
GetRaceNum() == 20107 ||
|
||||
GetRaceNum() == 20108 ||
|
||||
GetRaceNum() == 20109
|
||||
)
|
||||
|
||||
// and replace with:
|
||||
|
||||
if (m_bCharType == CHAR_TYPE_HORSE ||
|
||||
GetRaceNum() == 20101 ||
|
||||
GetRaceNum() == 20102 ||
|
||||
GetRaceNum() == 20103 ||
|
||||
GetRaceNum() == 20104 ||
|
||||
GetRaceNum() == 20105 ||
|
||||
GetRaceNum() == 20106 ||
|
||||
GetRaceNum() == 20107 ||
|
||||
GetRaceNum() == 20108 ||
|
||||
GetRaceNum() == 20109
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
|| CMobVnumHelper::IsMount(GetRaceNum())
|
||||
#endif
|
||||
)
|
||||
|
||||
/// 2.) Search in void CHARACTER::MountVnum(DWORD vnum):
|
||||
|
||||
}
|
||||
|
||||
SetValidComboInterval(0);
|
||||
SetComboSequence(0);
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
RemoveAffect(AFFECT_MOUNT_BONUS);
|
||||
if (const auto pMountItem = GetWear(WEAR_COSTUME_MOUNT))
|
||||
{
|
||||
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, true);
|
||||
}
|
||||
}
|
||||
#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
|
||||
25
Srcs-Server/game/src/char.h
Normal file
25
Srcs-Server/game/src/char.h
Normal file
@ -0,0 +1,25 @@
|
||||
/// 1.) Search:
|
||||
|
||||
};
|
||||
|
||||
ESex GET_SEX(LPCHARACTER ch);
|
||||
|
||||
// and add before, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
public:
|
||||
void CheckEnterMount();
|
||||
#endif
|
||||
|
||||
// like:
|
||||
/*
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
public:
|
||||
void CheckEnterMount();
|
||||
#endif
|
||||
};
|
||||
|
||||
ESex GET_SEX(LPCHARACTER ch);
|
||||
#endif
|
||||
*/
|
||||
79
Srcs-Server/game/src/char_horse.cpp
Normal file
79
Srcs-Server/game/src/char_horse.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/// 1.) Search in bool CHARACTER::StartRiding():
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD dwMountVnum = m_chHorse ? m_chHorse->GetRaceNum() : GetMyHorseVnum();
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
if (const LPITEM pMountItem = GetWear(WEAR_COSTUME_MOUNT))
|
||||
dwMountVnum = pMountItem->GetValue(1);
|
||||
#endif
|
||||
|
||||
// then search:
|
||||
|
||||
UpdatePacket();
|
||||
}
|
||||
|
||||
PointChange(POINT_ST, 0);
|
||||
PointChange(POINT_DX, 0);
|
||||
PointChange(POINT_HT, 0);
|
||||
PointChange(POINT_IQ, 0);
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
RemoveAffect(AFFECT_MOUNT_BONUS);
|
||||
#endif
|
||||
|
||||
/// 2.) Search in LPCHARACTER CHARACTER::GetRider() const:
|
||||
|
||||
void CHARACTER::HorseSummon(bool bSummon, bool bFromFar, DWORD dwVnum, const char* pPetName)
|
||||
{
|
||||
|
||||
// and add at the init, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
if (const LPITEM pMountItem = GetWear(WEAR_COSTUME_MOUNT))
|
||||
dwVnum = pMountItem->GetValue(1);
|
||||
#endif
|
||||
|
||||
/*Example:
|
||||
void CHARACTER::HorseSummon(bool bSummon, bool bFromFar, DWORD dwVnum, const char* pPetName)
|
||||
{
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
if (const LPITEM pMountItem = GetWear(WEAR_COSTUME_MOUNT))
|
||||
dwVnum = pMountItem->GetValue(1);
|
||||
#endif
|
||||
|
||||
if (bSummon)
|
||||
{...
|
||||
*/
|
||||
|
||||
/// 3.) Search in void CHARACTER::HorseSummon(bool bSummon, bool bFromFar, DWORD dwVnum, const char* pPetName):
|
||||
|
||||
m_chHorse->m_stName += LC_TEXT("´ÔÀÇ ¸»");
|
||||
|
||||
// and replace with:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
m_chHorse->m_stName += LC_TEXT(CMobVnumHelper::IsMount(dwVnum) ? "'s Mount" : "´ÔÀÇ ¸»");
|
||||
#else
|
||||
m_chHorse->m_stName += LC_TEXT("´ÔÀÇ ¸»");
|
||||
#endif
|
||||
|
||||
/*Example:
|
||||
if (pHorseName && strlen(pHorseName) != 0)
|
||||
m_chHorse->m_stName = pHorseName;
|
||||
else
|
||||
{
|
||||
m_chHorse->m_stName = GetName();
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
m_chHorse->m_stName += LC_TEXT(CMobVnumHelper::IsMount(dwVnum) ? "'s Mount" : "´ÔÀÇ ¸»");
|
||||
#else
|
||||
m_chHorse->m_stName += LC_TEXT("´ÔÀÇ ¸»");
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
55
Srcs-Server/game/src/char_item.cpp
Normal file
55
Srcs-Server/game/src/char_item.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/// 1.) Search in bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count):
|
||||
|
||||
if (!CanHandleItem())
|
||||
{
|
||||
if (NULL != DragonSoul_RefineWindow_GetOpener())
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°ÈâÀ» ¿¬ »óÅ¿¡¼´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
if (item->IsMount() && item->IsEquipped() && DestCell.IsDefaultInventoryPosition()) {
|
||||
StopRiding();
|
||||
HorseSummon(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// 2.) Search in bool CHARACTER::SwapItem(BYTE bCell, BYTE bDestCell):
|
||||
|
||||
item1->AddToCharacter(this, TItemPos(INVENTORY, bCell2));
|
||||
item2->AddToCharacter(this, TItemPos(INVENTORY, bCell1));
|
||||
}
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
if (item1->IsMount() && item2->IsMount() && destCell.IsEquipPosition()) {
|
||||
HorseSummon(false);
|
||||
HorseSummon(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// 3.) Search in bool CHARACTER::UnequipItem(LPITEM item):
|
||||
|
||||
if (!CanUnequipNow(item))
|
||||
return false;
|
||||
|
||||
// and add before, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
if (item->IsMount()) {
|
||||
StopRiding();
|
||||
HorseSummon(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// 4.) in bool CHARACTER::UnequipItem(LPITEM item):
|
||||
|
||||
// before the final "return true;", add this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
if (item->IsMount())
|
||||
HorseSummon(true);
|
||||
#endif
|
||||
10
Srcs-Server/game/src/input_login.cpp
Normal file
10
Srcs-Server/game/src/input_login.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
/// 1.) Search in void CInputLogin::Entergame(LPDESC d, const char * data):
|
||||
|
||||
if (ch->GetHorseLevel() > 0)
|
||||
ch->EnterHorse();
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
ch->CheckEnterMount();
|
||||
#endif
|
||||
27
Srcs-Server/game/src/item.cpp
Normal file
27
Srcs-Server/game/src/item.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
/// 1.) Search in void CItem::ModifyPoints(bool bAdd):
|
||||
|
||||
for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i)
|
||||
{
|
||||
if (m_pProto->aApplies[i].bType == APPLY_NONE)
|
||||
continue;
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
if (IsMount())
|
||||
continue;
|
||||
#endif
|
||||
|
||||
/*Example:
|
||||
for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i)
|
||||
{
|
||||
if (m_pProto->aApplies[i].bType == APPLY_NONE)
|
||||
continue;
|
||||
#ifdef ENABLE_MOUNT_LIKE_HORSE
|
||||
if (IsMount())
|
||||
continue;
|
||||
#endif
|
||||
|
||||
long value = m_pProto->aApplies[i].lValue;
|
||||
...
|
||||
*/
|
||||
Reference in New Issue
Block a user