project-topaz / topaz

Server emulator for FFXI
Other
161 stars 223 forks source link

Trusts - Hasso probably doesn't work #1537

Open zach2good opened 3 years ago

zach2good commented 3 years ago

I have:

Additional Information (Steps to reproduce/Expected behavior) : From @Omnione

Everything in core works as expected, upon looking in the scripts: https://github.com/project-topaz/topaz/blob/59597822cc386ae8022d07df104408f8d15d87d2/scripts/globals/abilities/hasso.lua#L26

This call will fail, as trusts are mobs behind the scenes - and don't have equipment.

This call requires equipment:

inline int32 CLuaBaseEntity::isWeaponTwoHanded(lua_State *L)
{
    TPZ_DEBUG_BREAK_IF(m_PBaseEntity == nullptr);
    TPZ_DEBUG_BREAK_IF(m_PBaseEntity->objtype == TYPE_NPC);

    auto weapon = dynamic_cast<CItemWeapon*>(((CBattleEntity*)m_PBaseEntity)->m_Weapons[SLOT_MAIN]);

    if (weapon == nullptr)
    {
        ShowDebug(CL_CYAN"lua::getWeaponDmg weapon in main slot is NULL!\n" CL_RESET);
        return 0;
    }
    lua_pushboolean(L, weapon->isTwoHanded());
    return 1;
}
bool CItemWeapon::isTwoHanded()
{
    return m_twoHanded;
}

Possible ways to handle this: The mob_pool entries for Trusts have correct cmbSkill, but it isn't assigned to anything. If it was looked at on load and then used to set the m_twoHanded flag - Hasso might start working.

Probably worth looking through all the other abilities that Trusts use and see if there are other gotchas like this

TeoTwawki commented 3 years ago

cmbSkill should be deprecated phased out and unused by even regular mobs, let alone trusts as its correct and accurate that they do not actually have weapons equipped, and the if check condition should be adjusted to check for 2 handed equipped OR isn't a player.

if target:isWeaponTwoHanded() or not target:isPC() then -- If we're not a PC, we don't care about weapons

Additional note: there will be other things like this and you will run into quotes of SE saying such and such trust "counts as using a 2 handed weapon" - this ONLY means that they get the benefits of traits that in players hands would depend on 2 handed weapons, and not that they are coded to use a 2 handed weapon. Like other things player shave to put effort into (such as certain merit bonuses), mobs (and by extension trusts) just get the perks for free.