Sphereserver / Source-X

Ultima Online server emulator
Apache License 2.0
57 stars 45 forks source link

[Feature Request] ARROWQUEST_ADD and ARROWQUEST_CLOSE new trigger #1146

Open canerksk opened 11 months ago

canerksk commented 11 months ago

Since multiple arrowquests can be opened in new clients, sometimes it can be confused which arrow has which id and a confusion in the script can cause the arrow to remain on the screen for the duration of the game. These 2 triggers can be added to control ArrowQuestes more easily and to add additional features.

eg;

void CClient::addArrowQuest( int x, int y, int id, int uid ) const
{
    ADDTOCALLSTACK("CClient::addArrowQuest");

    CScriptTriggerArgs Args(x,y,id);
    Args.m_VarsLocal.SetNumNew("X", x);
    Args.m_VarsLocal.SetNumNew("Y", y);
    Args.m_VarsLocal.SetNumNew("UID", uid);

    if (this->GetNetState()->isClientVersion(MINCLIVER_HS) || this->GetNetState()->isClientEnhanced())
    {
        Args.m_VarsLocal.SetNumNew("ID", id);
    }
    else
    {
        Args.m_VarsLocal.SetNumNew("ID", 0);
    }

    if (x > 0)
    {
        if (IsTrigUsed(TRIGGER_ARROWQUEST_ADD))
        {
            m_pChar->OnTrigger(CTRIG_ArrowQuest_Add, m_pChar, &Args);
        }
    }
    else
    {
        if (IsTrigUsed(TRIGGER_ARROWQUEST_CLOSE))
        {
            m_pChar->OnTrigger(CTRIG_ArrowQuest_Close, m_pChar, &Args);
        }
    }

    new PacketArrowQuest(this, x, y, id);
}

The codes here are purely examples. Although many have been tested, some may need to be rewritten.