AVA2 unlock P5: mount costume and mount skin
COSTUME_MOUNT=2 / COSTUME_MOUNT_SKIN=4, WEAR_COSTUME_MOUNT 25 / _SKIN 26. port_mount.cpp summons/unsummons the horse on equip, skin overrides the mount vnum in GetMyHorseVnum; costume subtypes no longer map onto the armor attribute sets. db ProtoReader learns COSTUME_MOUNT_SKIN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c30258ef5e
commit
fb066e7046
@@ -8,6 +8,7 @@ The 478 AVA2 drop items come from metin2-client `tools/server/ava2-items` (see F
|
|||||||
| P2 stones | 28444 破碑之石+4 (`APPLY_ATTBONUS_STONE`), 28445 Boss stone (`APPLY_ATTBONUS_BOSS`) | done |
|
| P2 stones | 28444 破碑之石+4 (`APPLY_ATTBONUS_STONE`), 28445 Boss stone (`APPLY_ATTBONUS_BOSS`) | done |
|
||||||
| P3 dragon armor | 21210–21219 暗龙 (warrior), 21230– 风龙 (assassin), 21250– 魔龙 (sura), 21270– 神龙 (shaman), +0..+9 | done (client) |
|
| P3 dragon armor | 21210–21219 暗龙 (warrior), 21230– 风龙 (assassin), 21250– 魔龙 (sura), 21270– 神龙 (shaman), +0..+9 | done (client) |
|
||||||
| P4 sash | 85004 领主 / 85008 大师 / 85014 王朝 / 85018 皇家 披风 (`COSTUME_SASH`, grade 4) | done, not deployed |
|
| P4 sash | 85004 领主 / 85008 大师 / 85014 王朝 / 85018 皇家 披风 (`COSTUME_SASH`, grade 4) | done, not deployed |
|
||||||
|
| P5 mounts | 71502 / 71505 / 71508 / 71511 坐骑时装 (`COSTUME_MOUNT`), 71234 / 71254 坐骑外观 (`COSTUME_MOUNT_SKIN`) + mobs 32012 / 32028 | done, not deployed |
|
||||||
|
|
||||||
## P1: boxes and keys
|
## P1: boxes and keys
|
||||||
|
|
||||||
@@ -45,3 +46,30 @@ AVA2's sash (acce) system, ported from `Srcs/Server` (`#ifdef __SASH_SYSTEM__`)
|
|||||||
- Client: `src/platform/ScriptLib/SashScript.inc` (`mt_sash`: windows, costume slot, tooltips), models + `item_scale.txt` + effects in the ava2items pack.
|
- Client: `src/platform/ScriptLib/SashScript.inc` (`mt_sash`: windows, costume slot, tooltips), models + `item_scale.txt` + effects in the ava2items pack.
|
||||||
|
|
||||||
Test: `tests/features/test_sash.py` (numbering, packet layout shared with the client header, quest hook).
|
Test: `tests/features/test_sash.py` (numbering, packet layout shared with the client header, quest hook).
|
||||||
|
|
||||||
|
## P5: mount costume and mount skin
|
||||||
|
|
||||||
|
AVA2's `ENABLE_MOUNT_COSTUME_SYSTEM` + `ENABLE_MOUNT_SKIN`, ported 1:1 into `game/src/port_mount.cpp`. They ride on the 40250 horse: the worn costume only changes the horse race.
|
||||||
|
|
||||||
|
- Items: `ITEM_COSTUME` / `COSTUME_MOUNT = 2` and `COSTUME_MOUNT_SKIN = 4` (AVA2 numbers the skin 7; ProtoReader `arSub28` gains `COSTUME_MOUNT_SKIN`, so **the db binary changes again**). value0 = horse race.
|
||||||
|
- 71502 狮子 20113 (怪物强悍 +30 %), 71505 野猪 20110 (破碑 +30 %), 71508 狼 20111 (Boss +30 %), 71511 20112 (双倍经验 30 %).
|
||||||
|
- The applies count while the costume is worn.
|
||||||
|
- Skins 71234 蓝色巴里 → 32012, 71254 白色冬日羊驼 → 32028.
|
||||||
|
- Both subtypes return no attribute set (`GetAttributeSetIndex` −1, the sash too), so they cannot be rerolled.
|
||||||
|
- Slots `WEAR_COSTUME_MOUNT = 25` and `WEAR_COSTUME_MOUNT_SKIN = 26`.
|
||||||
|
- `GetMyHorseVnum`: the worn skin's value0, else the worn mount's value0, else the horse-level race.
|
||||||
|
- Summoning and riding still need horse level ≥ 1, as on AVA2; equipping without a horse says `MTMOUNT need_horse`.
|
||||||
|
- Riding uses horse stamina.
|
||||||
|
- Hooks follow AVA2:
|
||||||
|
- Equipping re-summons.
|
||||||
|
- Taking the mount off sends the horse away; taking the skin off re-summons.
|
||||||
|
- A skin needs a worn mount (`need_mount`). Neither piece changes while riding (`riding`). The mount stays while a skin is worn (`has_skin`).
|
||||||
|
- A worn mount is summoned on login.
|
||||||
|
- `/user_horse_back` also takes the mount off.
|
||||||
|
- Mobs 32012 / 32028 come from the AVA2 mob_proto rows (`mobs-server.tsv`, installed by `install_items.py … <mobs-server.tsv>`).
|
||||||
|
- Client:
|
||||||
|
- RaceManager `__IsNewMountRace` (32000–32100 → `npc_mount`).
|
||||||
|
- `mt_mount` (`MountScript.inc`) registers the npclist rows, adds the costume window slots and renders the `MTMOUNT` messages.
|
||||||
|
- The models ship in the ava2items pack (`MOUNT_MOBS`).
|
||||||
|
|
||||||
|
Test: `tests/features/test_mount.py`.
|
||||||
|
|||||||
@@ -113,7 +113,9 @@ enum ECostumeSubTypes
|
|||||||
{
|
{
|
||||||
COSTUME_BODY = ARMOR_BODY, // [중요!!] ECostumeSubTypes enum value는 종류별로 EArmorSubTypes의 그것과 같아야 함.
|
COSTUME_BODY = ARMOR_BODY, // [중요!!] ECostumeSubTypes enum value는 종류별로 EArmorSubTypes의 그것과 같아야 함.
|
||||||
COSTUME_HAIR = ARMOR_HEAD, // 이는 코스츔 아이템에 추가 속성을 붙이겠다는 사업부의 요청에 따라서 기존 로직을 활용하기 위함임.
|
COSTUME_HAIR = ARMOR_HEAD, // 이는 코스츔 아이템에 추가 속성을 붙이겠다는 사업부의 요청에 따라서 기존 로직을 활용하기 위함임.
|
||||||
COSTUME_SASH = 3, // AVA2 sash (85001..85024); 2 = COSTUME_MOUNT
|
COSTUME_MOUNT = 2, // AVA2 mount costume (value0 = horse race)
|
||||||
|
COSTUME_SASH = 3, // AVA2 sash (85001..85024)
|
||||||
|
COSTUME_MOUNT_SKIN = 4, // AVA2 mount skin (value0 = horse race, needs COSTUME_MOUNT)
|
||||||
COSTUME_NUM_TYPES,
|
COSTUME_NUM_TYPES,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,8 @@ enum EWearPositions
|
|||||||
|
|
||||||
WEAR_BELT, // 23 : 신규 벨트슬롯
|
WEAR_BELT, // 23 : 신규 벨트슬롯
|
||||||
WEAR_COSTUME_SASH, // 24 : AVA2 sash
|
WEAR_COSTUME_SASH, // 24 : AVA2 sash
|
||||||
|
WEAR_COSTUME_MOUNT, // 25 : AVA2 mount costume
|
||||||
|
WEAR_COSTUME_MOUNT_SKIN, // 26 : AVA2 mount skin
|
||||||
|
|
||||||
WEAR_MAX = 32 //
|
WEAR_MAX = 32 //
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ int get_Item_SubType_Value(int type_value, string inputString)
|
|||||||
"RESOURCE_STONE", "RESOURCE_METIN", "RESOURCE_ORE" };
|
"RESOURCE_STONE", "RESOURCE_METIN", "RESOURCE_ORE" };
|
||||||
static string arSub16[] = { "UNIQUE_NONE", "UNIQUE_BOOK", "UNIQUE_SPECIAL_RIDE", "UNIQUE_3", "UNIQUE_4", "UNIQUE_5",
|
static string arSub16[] = { "UNIQUE_NONE", "UNIQUE_BOOK", "UNIQUE_SPECIAL_RIDE", "UNIQUE_3", "UNIQUE_4", "UNIQUE_5",
|
||||||
"UNIQUE_6", "UNIQUE_7", "UNIQUE_8", "UNIQUE_9", "USE_SPECIAL"};
|
"UNIQUE_6", "UNIQUE_7", "UNIQUE_8", "UNIQUE_9", "USE_SPECIAL"};
|
||||||
static string arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT", "COSTUME_SASH" };
|
static string arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT", "COSTUME_SASH", "COSTUME_MOUNT_SKIN" };
|
||||||
static string arSub29[] = { "DS_SLOT1", "DS_SLOT2", "DS_SLOT3", "DS_SLOT4", "DS_SLOT5", "DS_SLOT6" };
|
static string arSub29[] = { "DS_SLOT1", "DS_SLOT2", "DS_SLOT3", "DS_SLOT4", "DS_SLOT5", "DS_SLOT6" };
|
||||||
static string arSub31[] = { "EXTRACT_DRAGON_SOUL", "EXTRACT_DRAGON_HEART" };
|
static string arSub31[] = { "EXTRACT_DRAGON_SOUL", "EXTRACT_DRAGON_HEART" };
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ CPPFILE = BattleArena.cpp FSM.cpp MarkConvert.cpp MarkImage.cpp MarkManager.cpp
|
|||||||
desc_client.cpp desc_manager.cpp desc_p2p.cpp dev_log.cpp dungeon.cpp empire_text_convert.cpp entity.cpp\
|
desc_client.cpp desc_manager.cpp desc_p2p.cpp dev_log.cpp dungeon.cpp empire_text_convert.cpp entity.cpp\
|
||||||
entity_view.cpp event.cpp event_queue.cpp exchange.cpp file_loader.cpp fishing.cpp gm.cpp guild.cpp\
|
entity_view.cpp event.cpp event_queue.cpp exchange.cpp file_loader.cpp fishing.cpp gm.cpp guild.cpp\
|
||||||
guild_manager.cpp guild_war.cpp horse_rider.cpp horsename_manager.cpp input.cpp input_auth.cpp input_db.cpp\
|
guild_manager.cpp guild_war.cpp horse_rider.cpp horsename_manager.cpp input.cpp input_auth.cpp input_db.cpp\
|
||||||
input_login.cpp input_main.cpp input_p2p.cpp port_boss_track.cpp port_attr_lock.cpp port_sash.cpp input_teen.cpp input_udp.cpp ip_ban.cpp\
|
input_login.cpp input_main.cpp input_p2p.cpp port_boss_track.cpp port_attr_lock.cpp port_sash.cpp port_mount.cpp input_teen.cpp input_udp.cpp ip_ban.cpp\
|
||||||
item.cpp item_addon.cpp item_attribute.cpp item_manager.cpp item_manager_idrange.cpp locale.cpp\
|
item.cpp item_addon.cpp item_attribute.cpp item_manager.cpp item_manager_idrange.cpp locale.cpp\
|
||||||
locale_service.cpp log.cpp login_data.cpp lzo_manager.cpp marriage.cpp matrix_card.cpp\
|
locale_service.cpp log.cpp login_data.cpp lzo_manager.cpp marriage.cpp matrix_card.cpp\
|
||||||
messenger_manager.cpp mining.cpp mob_manager.cpp monarch.cpp motion.cpp over9refine.cpp p2p.cpp packet_info.cpp\
|
messenger_manager.cpp mining.cpp mob_manager.cpp monarch.cpp motion.cpp over9refine.cpp p2p.cpp packet_info.cpp\
|
||||||
|
|||||||
@@ -2091,6 +2091,14 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
|||||||
void RemoveSashMaterial(BYTE bPos);
|
void RemoveSashMaterial(BYTE bPos);
|
||||||
BYTE CanRefineSashMaterials();
|
BYTE CanRefineSashMaterials();
|
||||||
void RefineSashMaterials();
|
void RefineSashMaterials();
|
||||||
|
|
||||||
|
// AVA2 mount costume / skin (port_mount.cpp)
|
||||||
|
public:
|
||||||
|
bool MountCostumeCanEquip(LPITEM item);
|
||||||
|
bool MountCostumeCanUnequip(LPITEM item);
|
||||||
|
void MountCostumeEquipped(LPITEM item);
|
||||||
|
void MountCostumeUnequipped(LPITEM item, bool bAlwaysSummon);
|
||||||
|
void MountCostumeOnLogin();
|
||||||
};
|
};
|
||||||
|
|
||||||
ESex GET_SEX(LPCHARACTER ch);
|
ESex GET_SEX(LPCHARACTER ch);
|
||||||
|
|||||||
@@ -265,6 +265,15 @@ DWORD CHARACTER::GetMyHorseVnum() const
|
|||||||
++delta;
|
++delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AVA2 ENABLE_MOUNT_SKIN / ENABLE_MOUNT_COSTUME_SYSTEM: the worn skin, else the worn mount, is the horse
|
||||||
|
LPITEM pkCostumeMountSkin = GetWear(WEAR_COSTUME_MOUNT_SKIN);
|
||||||
|
if (pkCostumeMountSkin)
|
||||||
|
return pkCostumeMountSkin->GetValue(0);
|
||||||
|
|
||||||
|
LPITEM pkCostumeMount = GetWear(WEAR_COSTUME_MOUNT);
|
||||||
|
if (pkCostumeMount)
|
||||||
|
return pkCostumeMount->GetValue(0);
|
||||||
|
|
||||||
return c_aHorseStat[GetHorseLevel()].iNPCRace + delta;
|
return c_aHorseStat[GetHorseLevel()].iNPCRace + delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5697,6 +5697,9 @@ bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count)
|
|||||||
snprintf(szBuf, sizeof(szBuf), "%u %u %u %u ", item2->GetID(), item2->GetCount(), item->GetCount(), item->GetCount() + item2->GetCount());
|
snprintf(szBuf, sizeof(szBuf), "%u %u %u %u ", item2->GetID(), item2->GetCount(), item->GetCount(), item->GetCount() + item2->GetCount());
|
||||||
LogManager::instance().ItemLog(this, item, "ITEM_SPLIT", szBuf);
|
LogManager::instance().ItemLog(this, item, "ITEM_SPLIT", szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Cell.IsEquipPosition()) // AVA2 mount costume / skin taken off by drag
|
||||||
|
MountCostumeUnequipped(item, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -6100,6 +6103,8 @@ bool CHARACTER::UnequipItem(LPITEM item)
|
|||||||
else
|
else
|
||||||
item->AddToCharacter(this, TItemPos(INVENTORY, pos));
|
item->AddToCharacter(this, TItemPos(INVENTORY, pos));
|
||||||
|
|
||||||
|
MountCostumeUnequipped(item, true); // AVA2 mount costume / skin
|
||||||
|
|
||||||
CheckMaximumPoints();
|
CheckMaximumPoints();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -6272,6 +6277,8 @@ bool CHARACTER::EquipItem(LPITEM item, int iCandidateCell)
|
|||||||
{
|
{
|
||||||
quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false);
|
quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MountCostumeEquipped(item); // AVA2 mount costume / skin
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -7568,6 +7575,9 @@ bool CHARACTER::CanEquipNow(const LPITEM item, const TItemPos& srcCell, const TI
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!MountCostumeCanEquip(item)) // AVA2 mount skin
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7582,6 +7592,9 @@ bool CHARACTER::CanUnequipNow(const LPITEM item, const TItemPos& srcCell, const
|
|||||||
if (IS_SET(item->GetFlag(), ITEM_FLAG_IRREMOVABLE))
|
if (IS_SET(item->GetFlag(), ITEM_FLAG_IRREMOVABLE))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!MountCostumeCanUnequip(item)) // AVA2 mount costume / skin
|
||||||
|
return false;
|
||||||
|
|
||||||
// 아이템 unequip시 인벤토리로 옮길 때 빈 자리가 있는 지 확인
|
// 아이템 unequip시 인벤토리로 옮길 때 빈 자리가 있는 지 확인
|
||||||
{
|
{
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
|
|||||||
@@ -104,6 +104,10 @@ ACMD(do_user_horse_back)
|
|||||||
if (ch->GetHorse() != NULL)
|
if (ch->GetHorse() != NULL)
|
||||||
{
|
{
|
||||||
ch->HorseSummon(false);
|
ch->HorseSummon(false);
|
||||||
|
// AVA2 mount costume: sending the horse back also takes the costume off
|
||||||
|
LPITEM pkCostumeMount = ch->GetWear(WEAR_COSTUME_MOUNT);
|
||||||
|
if (pkCostumeMount)
|
||||||
|
ch->UnequipItem(pkCostumeMount);
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("말을 돌려보냈습니다."));
|
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("말을 돌려보냈습니다."));
|
||||||
}
|
}
|
||||||
else if (ch->IsHorseRiding() == true)
|
else if (ch->IsHorseRiding() == true)
|
||||||
|
|||||||
@@ -635,6 +635,8 @@ void CInputLogin::Entergame(LPDESC d, const char * data)
|
|||||||
|
|
||||||
_send_bonus_info(ch);
|
_send_bonus_info(ch);
|
||||||
|
|
||||||
|
ch->MountCostumeOnLogin(); // AVA2 mount costume
|
||||||
|
|
||||||
for (int i = 0; i <= PREMIUM_MAX_NUM; ++i)
|
for (int i = 0; i <= PREMIUM_MAX_NUM; ++i)
|
||||||
{
|
{
|
||||||
int remain = ch->GetPremiumRemainSeconds(i);
|
int remain = ch->GetPremiumRemainSeconds(i);
|
||||||
|
|||||||
@@ -523,6 +523,10 @@ int CItem::FindEquipCell(LPCHARACTER ch, int iCandidateCell)
|
|||||||
return WEAR_COSTUME_HAIR;
|
return WEAR_COSTUME_HAIR;
|
||||||
else if (GetSubType() == COSTUME_SASH)
|
else if (GetSubType() == COSTUME_SASH)
|
||||||
return WEAR_COSTUME_SASH;
|
return WEAR_COSTUME_SASH;
|
||||||
|
else if (GetSubType() == COSTUME_MOUNT)
|
||||||
|
return WEAR_COSTUME_MOUNT;
|
||||||
|
else if (GetSubType() == COSTUME_MOUNT_SKIN)
|
||||||
|
return WEAR_COSTUME_MOUNT_SKIN;
|
||||||
}
|
}
|
||||||
else if (GetType() == ITEM_RING)
|
else if (GetType() == ITEM_RING)
|
||||||
{
|
{
|
||||||
@@ -1765,6 +1769,16 @@ bool CItem::IsRideItem()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CItem::IsCostumeMount()
|
||||||
|
{
|
||||||
|
return GetType() == ITEM_COSTUME && GetSubType() == COSTUME_MOUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CItem::IsCostumeMountSkin()
|
||||||
|
{
|
||||||
|
return GetType() == ITEM_COSTUME && GetSubType() == COSTUME_MOUNT_SKIN;
|
||||||
|
}
|
||||||
|
|
||||||
bool CItem::IsRamadanRing()
|
bool CItem::IsRamadanRing()
|
||||||
{
|
{
|
||||||
if (GetVnum() == UNIQUE_ITEM_RAMADAN_RING)
|
if (GetVnum() == UNIQUE_ITEM_RAMADAN_RING)
|
||||||
|
|||||||
@@ -234,6 +234,8 @@ class CItem : public CEntity
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
bool IsRideItem();
|
bool IsRideItem();
|
||||||
|
bool IsCostumeMount(); // AVA2 mount costume
|
||||||
|
bool IsCostumeMountSkin();
|
||||||
bool IsRamadanRing();
|
bool IsRamadanRing();
|
||||||
|
|
||||||
void ClearMountAttributeAndAffect();
|
void ClearMountAttributeAndAffect();
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ int CItem::GetAttributeSetIndex()
|
|||||||
return ATTRIBUTE_SET_WEAPON;
|
return ATTRIBUTE_SET_WEAPON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AVA2 costume sub types reuse ARMOR_SHIELD/WRIST/FOOTS numbers but take no random attributes
|
||||||
|
if (GetType() == ITEM_COSTUME && (GetSubType() == COSTUME_MOUNT || GetSubType() == COSTUME_SASH || GetSubType() == COSTUME_MOUNT_SKIN))
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (GetType() == ITEM_ARMOR || GetType() == ITEM_COSTUME)
|
if (GetType() == ITEM_ARMOR || GetType() == ITEM_COSTUME)
|
||||||
{
|
{
|
||||||
switch (GetSubType())
|
switch (GetSubType())
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
// AVA2 mount costume + mount skin (ENABLE_MOUNT_COSTUME_SYSTEM / ENABLE_MOUNT_SKIN), ported onto the
|
||||||
|
// 40250 horse: the worn costume (or its skin) only replaces the horse race in GetMyHorseVnum, so
|
||||||
|
// riding still needs horse level >= 1 and uses horse stamina, exactly as on AVA2.
|
||||||
|
// Messages go to the client as "MTMOUNT <code>" commands (rendered by the client's mt_mount script)
|
||||||
|
// instead of AVA2's numeric locale strings 334 / 1097 / 1098.
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "char.h"
|
||||||
|
#include "item.h"
|
||||||
|
|
||||||
|
// AVA2 CanEquipNow: a skin needs a worn mount and cannot be put on while riding.
|
||||||
|
bool CHARACTER::MountCostumeCanEquip(LPITEM item)
|
||||||
|
{
|
||||||
|
if (!item->IsCostumeMountSkin())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (IsRiding())
|
||||||
|
{
|
||||||
|
ChatPacket(CHAT_TYPE_COMMAND, "MTMOUNT riding");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetWear(WEAR_COSTUME_MOUNT))
|
||||||
|
{
|
||||||
|
ChatPacket(CHAT_TYPE_COMMAND, "MTMOUNT need_mount");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AVA2 CanUnequipNow: neither piece comes off while riding; the mount stays while a skin is worn.
|
||||||
|
bool CHARACTER::MountCostumeCanUnequip(LPITEM item)
|
||||||
|
{
|
||||||
|
if (!item->IsCostumeMount() && !item->IsCostumeMountSkin())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (IsRiding())
|
||||||
|
{
|
||||||
|
ChatPacket(CHAT_TYPE_COMMAND, "MTMOUNT riding");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->IsCostumeMount() && GetWear(WEAR_COSTUME_MOUNT_SKIN))
|
||||||
|
{
|
||||||
|
ChatPacket(CHAT_TYPE_COMMAND, "MTMOUNT has_skin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AVA2 EquipItem tail: re-summon so the horse takes the new race.
|
||||||
|
void CHARACTER::MountCostumeEquipped(LPITEM item)
|
||||||
|
{
|
||||||
|
if (!item->IsCostumeMount() && !item->IsCostumeMountSkin())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (GetHorseLevel() <= 0)
|
||||||
|
ChatPacket(CHAT_TYPE_COMMAND, "MTMOUNT need_horse");
|
||||||
|
|
||||||
|
if (GetHorse())
|
||||||
|
HorseSummon(false);
|
||||||
|
HorseSummon(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// AVA2 UnequipItem / MoveItem: taking the mount off sends the horse away, taking the skin off
|
||||||
|
// re-summons it with the mount's race (bAlwaysSummon: UnequipItem summons even without a horse out).
|
||||||
|
void CHARACTER::MountCostumeUnequipped(LPITEM item, bool bAlwaysSummon)
|
||||||
|
{
|
||||||
|
if (item->IsCostumeMount())
|
||||||
|
{
|
||||||
|
if (GetHorse())
|
||||||
|
HorseSummon(false);
|
||||||
|
}
|
||||||
|
else if (item->IsCostumeMountSkin())
|
||||||
|
{
|
||||||
|
if (GetHorse())
|
||||||
|
{
|
||||||
|
HorseSummon(false);
|
||||||
|
HorseSummon(true);
|
||||||
|
}
|
||||||
|
else if (bAlwaysSummon)
|
||||||
|
HorseSummon(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AVA2 input_login: a worn mount comes out on login.
|
||||||
|
void CHARACTER::MountCostumeOnLogin()
|
||||||
|
{
|
||||||
|
if (!GetWear(WEAR_COSTUME_MOUNT))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!IsRiding() && !GetHorse())
|
||||||
|
HorseSummon(true);
|
||||||
|
else
|
||||||
|
StopRiding();
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""AVA2 mount costume + skin (docs/FEATURE-AVA2-UNLOCK.md P5): subtype/wear numbering shared with the client,
|
||||||
|
the horse race override and the equip/unequip/login hooks."""
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
ROOT=Path(__file__).resolve().parents[2]
|
||||||
|
SRC=ROOT/'src/server'
|
||||||
|
CLIENT=ROOT.parent/'metin2-client/src/port'
|
||||||
|
def source(name):return (SRC/name).read_bytes().decode('latin1')
|
||||||
|
def enum_after(text,start,end):
|
||||||
|
body=text[text.index(start):];body=body[:body.index(end)]
|
||||||
|
return re.findall(r'^\s*([A-Z_0-9]+)\s*[,=]',body,re.M)
|
||||||
|
|
||||||
|
item=source('common/item_length.h')
|
||||||
|
assert 'COSTUME_MOUNT = 2,' in item and 'COSTUME_MOUNT_SKIN = 4,' in item
|
||||||
|
reader=source('db/src/ProtoReader.cpp')
|
||||||
|
assert '"COSTUME_MOUNT", "COSTUME_SASH", "COSTUME_MOUNT_SKIN" };' in reader
|
||||||
|
wear=enum_after(source('common/length.h'),'WEAR_BODY','WEAR_MAX_NUM')
|
||||||
|
assert wear.index('WEAR_COSTUME_MOUNT')==25 and wear.index('WEAR_COSTUME_MOUNT_SKIN')==26,wear
|
||||||
|
if CLIENT.is_dir():
|
||||||
|
gametype=(CLIENT/'UserInterface/GameType.h').read_text()
|
||||||
|
assert 'c_Costume_Slot_Mount = c_Equipment_Start + 25;' in gametype and 'c_Costume_Slot_MountSkin = c_Equipment_Start + 26;' in gametype
|
||||||
|
itemdata=(CLIENT/'GameLib/ItemData.h').read_text()
|
||||||
|
assert 'COSTUME_MOUNT = 2,' in itemdata and 'COSTUME_MOUNT_SKIN = 4,' in itemdata
|
||||||
|
|
||||||
|
horse=source('game/src/char_horse.cpp')
|
||||||
|
body=horse[horse.index('DWORD CHARACTER::GetMyHorseVnum'):];body=body[:body.index('\n}\n')]
|
||||||
|
assert body.index('WEAR_COSTUME_MOUNT_SKIN')<body.index('GetWear(WEAR_COSTUME_MOUNT)')<body.index('c_aHorseStat'),body
|
||||||
|
assert 'return WEAR_COSTUME_MOUNT;' in source('game/src/item.cpp') and 'return WEAR_COSTUME_MOUNT_SKIN;' in source('game/src/item.cpp')
|
||||||
|
attr=source('game/src/item_attribute.cpp')
|
||||||
|
assert 'GetSubType() == COSTUME_MOUNT || GetSubType() == COSTUME_SASH || GetSubType() == COSTUME_MOUNT_SKIN))\n\t\treturn -1;' in attr
|
||||||
|
|
||||||
|
items=source('game/src/char_item.cpp')
|
||||||
|
for hook in ('MountCostumeCanEquip(item)','MountCostumeCanUnequip(item)','MountCostumeEquipped(item);',
|
||||||
|
'MountCostumeUnequipped(item, true);','MountCostumeUnequipped(item, false);'):
|
||||||
|
assert items.count(hook)==1,hook
|
||||||
|
assert 'ch->MountCostumeOnLogin();' in source('game/src/input_login.cpp')
|
||||||
|
assert 'ch->UnequipItem(pkCostumeMount);' in source('game/src/cmd_general.cpp')
|
||||||
|
assert 'port_mount.cpp' in source('game/src/Makefile')
|
||||||
|
mount=source('game/src/port_mount.cpp')
|
||||||
|
for code in ('riding','need_mount','has_skin','need_horse'):assert '"MTMOUNT %s"'%code in mount,code
|
||||||
|
script=ROOT.parent/'metin2-client/src/platform/ScriptLib/MountScript.inc'
|
||||||
|
if script.is_file():
|
||||||
|
s=script.read_text()
|
||||||
|
for code in ('riding','need_mount','has_skin','need_horse'):assert "'%s':"%code in s,code
|
||||||
|
print('PASS: mount subtypes 2/4, WEAR 25/26, horse race = skin > mount > horse level, hooks, MTMOUNT codes')
|
||||||
@@ -17,7 +17,7 @@ for k,v in (('SASH_ABSORPTION_SOCKET',0),('SASH_ABSORBED_SOCKET',1),('SASH_GRADE
|
|||||||
('SASH_GRADE_4_ABS_MAX_COMB',19),('SASH_EFFECT_FROM_ABS',19),('SASH_GRADE_4_PRICE',500000),('SASH_COMBINE_GRADE_4',30)):
|
('SASH_GRADE_4_ABS_MAX_COMB',19),('SASH_EFFECT_FROM_ABS',19),('SASH_GRADE_4_PRICE',500000),('SASH_COMBINE_GRADE_4',30)):
|
||||||
assert re.search(r'\b%s = %d,'%(k,v),item),k
|
assert re.search(r'\b%s = %d,'%(k,v),item),k
|
||||||
reader=source('db/src/ProtoReader.cpp')
|
reader=source('db/src/ProtoReader.cpp')
|
||||||
assert 'arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT", "COSTUME_SASH" };' in reader
|
assert 'arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT", "COSTUME_SASH", "COSTUME_MOUNT_SKIN" };' in reader
|
||||||
|
|
||||||
length=source('common/length.h')
|
length=source('common/length.h')
|
||||||
wear=enum_after(length,'WEAR_BODY','WEAR_MAX_NUM')
|
wear=enum_after(length,'WEAR_BODY','WEAR_MAX_NUM')
|
||||||
|
|||||||
Reference in New Issue
Block a user