AVA2 unlock P6: costume enchants (USE_CHANGE_ATTRIBUTE 54001-54267)
Enchant stones add one fixed attribute to an unequipped body / hair / mount-skin costume (max 3, no duplicates); gear and the switchbot refuse them. MTCATTR chat commands report the result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fb066e7046
commit
6199b2cbff
@@ -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\
|
||||
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\
|
||||
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\
|
||||
input_login.cpp input_main.cpp input_p2p.cpp port_boss_track.cpp port_attr_lock.cpp port_sash.cpp port_mount.cpp port_costume_attr.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\
|
||||
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\
|
||||
|
||||
@@ -2099,6 +2099,7 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
||||
void MountCostumeEquipped(LPITEM item);
|
||||
void MountCostumeUnequipped(LPITEM item, bool bAlwaysSummon);
|
||||
void MountCostumeOnLogin();
|
||||
bool CostumeEnchantUse(LPITEM item, LPITEM item2);
|
||||
};
|
||||
|
||||
ESex GET_SEX(LPCHARACTER ch);
|
||||
|
||||
@@ -4495,6 +4495,9 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
|
||||
return false;
|
||||
|
||||
if (item->IsCostumeEnchant())
|
||||
return CostumeEnchantUse(item, item2);
|
||||
|
||||
if (item2->IsEquipped())
|
||||
{
|
||||
BuffOnAttr_RemoveBuffsFromItem(item2);
|
||||
|
||||
@@ -236,6 +236,7 @@ class CItem : public CEntity
|
||||
bool IsRideItem();
|
||||
bool IsCostumeMount(); // AVA2 mount costume
|
||||
bool IsCostumeMountSkin();
|
||||
bool IsCostumeEnchant(); // AVA2 costume enchant (port_costume_attr.cpp)
|
||||
bool IsRamadanRing();
|
||||
|
||||
void ClearMountAttributeAndAffect();
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
// AVA2 costume enchant items (ENABLE_SPECIAL_COSTUME_ATTR, char_item.cpp USE_CHANGE_ATTRIBUTE case):
|
||||
// ITEM_USE / USE_CHANGE_ATTRIBUTE rows whose value0 = apply type, value1 = apply value and
|
||||
// value2 = target mask (1 << bonus flag). Dragged onto a costume they add that one fixed attribute,
|
||||
// at most three per costume; they never reroll anything, and gear is refused (they would otherwise be
|
||||
// free 40250 switchers, so the switchbot skips them too).
|
||||
// Only the costume kinds 40250 has are mapped: body (flag 1), hair (2) and mount skin (4). AVA2's
|
||||
// weapon costume (3), sash skin (5) and shining (6) items stay locked in tools/server/ava2-items.
|
||||
// Messages go to the client as "MTCATTR <code>" commands (rendered by the client's mt_costume_attr
|
||||
// script) instead of AVA2's locale strings 1056 / 1057 / 1061 / 1062 / 1063.
|
||||
#include "stdafx.h"
|
||||
#include "char.h"
|
||||
#include "item.h"
|
||||
#include "log.h"
|
||||
|
||||
enum
|
||||
{
|
||||
COSTUME_ENCHANT_VNUM_MIN = 54001,
|
||||
COSTUME_ENCHANT_VNUM_MAX = 54267,
|
||||
COSTUME_ENCHANT_MAX_ATTR = 3, // AVA2 GetBonusMaxAttr: every limit is 3
|
||||
};
|
||||
|
||||
bool CItem::IsCostumeEnchant()
|
||||
{
|
||||
return GetType() == ITEM_USE && GetSubType() == USE_CHANGE_ATTRIBUTE && GetValue(2) != 0 &&
|
||||
GetVnum() >= COSTUME_ENCHANT_VNUM_MIN && GetVnum() <= COSTUME_ENCHANT_VNUM_MAX;
|
||||
}
|
||||
|
||||
// AVA2 CItem::GetBonusFlag for the costume kinds that exist here; 0 = cannot be enchanted.
|
||||
static int CostumeEnchantFlag(LPITEM item)
|
||||
{
|
||||
if (item->GetType() != ITEM_COSTUME)
|
||||
return 0;
|
||||
|
||||
switch (item->GetSubType())
|
||||
{
|
||||
case COSTUME_BODY:
|
||||
return 1;
|
||||
case COSTUME_HAIR:
|
||||
return 2;
|
||||
case COSTUME_MOUNT_SKIN:
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CHARACTER::CostumeEnchantUse(LPITEM item, LPITEM item2)
|
||||
{
|
||||
if (item2->IsExchanging())
|
||||
return false;
|
||||
|
||||
const int flag = CostumeEnchantFlag(item2);
|
||||
const BYTE applyType = static_cast<BYTE>(item->GetValue(0));
|
||||
const short applyValue = static_cast<short>(item->GetValue(1));
|
||||
|
||||
if (!flag || !(item->GetValue(2) & (1 << flag)))
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_COMMAND, "MTCATTR target");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (applyType == APPLY_NONE || applyValue == 0)
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_COMMAND, "MTCATTR none");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 40250 equipped items are never touched by attribute items (the "Fix" in the switcher path):
|
||||
// the new attribute would not be applied to the character until the next re-equip.
|
||||
if (item2->IsEquipped())
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_COMMAND, "MTCATTR equipped");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item2->GetAttributeCount() >= COSTUME_ENCHANT_MAX_ATTR)
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_COMMAND, "MTCATTR full");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item2->HasAttr(applyType))
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_COMMAND, "MTCATTR has");
|
||||
return false;
|
||||
}
|
||||
|
||||
item2->AddAttribute(applyType, applyValue);
|
||||
|
||||
{
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "%u %u %d", item2->GetID(), applyType, applyValue);
|
||||
LogManager::instance().ItemLog(this, item, "COSTUME_ENCHANT", buf);
|
||||
}
|
||||
|
||||
item->SetCount(item->GetCount() - 1);
|
||||
ChatPacket(CHAT_TYPE_COMMAND, "MTCATTR done");
|
||||
return true;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ static LPITEM PortSwitchItem(LPCHARACTER ch,const PortSwitchbot& bot) {
|
||||
}
|
||||
|
||||
static bool PortSwitchScroll(LPITEM scroll) {
|
||||
return scroll && scroll->GetType()==ITEM_USE && scroll->GetSubType()==USE_CHANGE_ATTRIBUTE;
|
||||
return scroll && scroll->GetType()==ITEM_USE && scroll->GetSubType()==USE_CHANGE_ATTRIBUTE && !scroll->IsCostumeEnchant();
|
||||
}
|
||||
|
||||
static void PortSwitchState(LPCHARACTER ch,const PortSwitchbot* bot,bool active,const char* reason) {
|
||||
|
||||
Reference in New Issue
Block a user