Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

5Line Awakenings

Newbie Spellweaver
Joined
Sep 8, 2011
Messages
67
Reaction score
252
#FuckMental. #RagezoneIsDead
Years and still no dev status.
 
Last edited:
Not working on UnitedFlyf
Loyal Member
Joined
Apr 21, 2009
Messages
1,385
Reaction score
934
Check out this one weird trick to give your players cancer; RNGesus will love you.
 
Newbie Spellweaver
Joined
Sep 24, 2021
Messages
36
Reaction score
2
Is there a more detailed on how to add that awake transfer?
 
Newbie Spellweaver
Joined
Jul 30, 2011
Messages
7
Reaction score
2
Hi there! I'm trying to apply this on Ketchup's V18.2 (VS22). It compiled with no errors but in game it says "Item has already been awakened" even if they're not. Applying 5 lines of awakening using /sro is working fine. Using /GenRandomOption gives me invisible 5 line awakenings but I need to relogin (everytime) to see the awakening value.

What file/s should I double check if I have the above issues? I edited and double check User.cpp several times giving me the same result and I don't know if I'm looking on the wrong file. Thanks!
 
Last edited:
Newbie Spellweaver
Joined
Sep 8, 2011
Messages
67
Reaction score
252
Using this system, you'll have to update the mail table and some other tables, I believe, to make it work 100%. You'll have to double-check that.

The reason why it's not appearing is because it's not running the "UpdateItemEx" function for both the DST and ADJ variables. UpdateItemEx should also send a packet to the client and handle that information as well via client. There's an example of DST in the function when 5LAwakes is not defined. There's examples of both in DpSrvr.
 
Newbie Spellweaver
Joined
Sep 27, 2020
Messages
39
Reaction score
21
Small Question : Do i need to touch the database to make the 5line awake work's perfectly ?
 
Junior Spellweaver
Joined
Jul 13, 2013
Messages
139
Reaction score
1
QQ图片20220918172534 - 5Line Awakenings - RaGEZONE Forums
i got this error when tried this file ,can someone help me? i use the"V22-K19" file.thanks~~
 

Attachments

You must be registered for see attachments list
Junior Spellweaver
Joined
Jul 13, 2013
Messages
139
Reaction score
1
Setdata in wndawakening.h do not put in private, then put it in public to try



(ResData.inc). Has anyone sent it? APP_AWAKETRANSFER
thanks for your advise.
but i don't edit the "transfer",i just wanna the 5 line awake @@ so i have to edit the transfer files at the same time ?
 
Newbie Spellweaver
Joined
May 12, 2022
Messages
85
Reaction score
2
thanks for your advise.
but i don't edit the "transfer",i just wanna the 5 line awake @@ so i have to edit the transfer files at the same time ?

#define __5LAWAKES in Client, Worldserver and Databaseserver
Define the #define __5LAWAKES in the definition file
 
Newbie Spellweaver
Joined
May 12, 2022
Messages
85
Reaction score
2
5Line Awakenings with Awakening Transfer and Safe Awakening support


Awakening Code + Safe Awakening
DbManagerFun.cpp
do
Code:
CDbManager::GetBank( CMover* pMover, CQuery *qry, LPDB_OVERLAPPED_PLUS lpDbOverlappedPlus, int nSlot )

Code:
#if __VER >= 11 // __SYS_IDENTIFY
        __int64 iRandomOptItemId = GetInt64PaFromStr(ExtBank, &CountStr);
        pMover->m_Bank[nSlot].m_apItem[nExtBankCount].SetRandomOptItemId(iRandomOptItemId);
#ifdef __5LAWAKES
        pMover->m_Bank[nSlot].m_apItem[nExtBankCount].SetnAdjItemId(GetInt64PaFromStr(ExtBank, &CountStr));
#endif
#else

do
Code:
CDbManager::GetBankMover( CMover* pMover, CQuery *qry, int nSlot )

Code:
#if __VER >= 11 // __SYS_IDENTIFY
        pMover->m_Bank[nSlot].m_apItem[nExtBankCount].SetRandomOptItemId( GetInt64PaFromStr( ExtBank, &CountStr ) );
#ifdef __5LAWAKES
        pMover->m_Bank[nSlot].m_apItem[nExtBankCount].SetnAdjItemId(GetInt64PaFromStr(ExtBank, &CountStr));
#endif

do
Code:
CDbManager::GetGuildBank( CItemContainer< CItemElem  >*  GuildBank, CQuery *qry )

Code:
#if __VER >= 11 // __SYS_IDENTIFY
        __int64 iRandomOptItemId = GetInt64PaFromStr( ExtBank, &CountStr );
        GuildBank->m_apItem[nExtBank].SetRandomOptItemId( iRandomOptItemId );
#ifdef __5LAWAKES
        GuildBank->m_apItem[nExtBank].SetnAdjItemId(GetInt64PaFromStr(ExtBank, &CountStr));
#endif
#else    // __SYS_IDENTIFY

do
Code:
CDbManager::GetPocket( CMover* pMover, CQuery* pQuery, LPDB_OVERLAPPED_PLUS lpDbOverlappedPlus )

Code:
            __int64 iRandomOptItemId    = GetInt64PaFromStr( szExt, &nOffset );
            pPocket->m_apItem[i].SetRandomOptItemId(iRandomOptItemId);

#ifdef __5LAWAKES
            pPocket->m_apItem[i].SetnAdjItemId(GetInt64PaFromStr(szExt, &nOffset));
#endif
#if __VER >= 15 // __PETVIS
            pPocket->m_apItem[i].m_bTranformVisPet = static_cast<BOOL>( GetIntPaFromStr( szExt, &nOffset ) );
#endif // __PETVIS
            i++;
            nOffset++;

do
Code:
CDbManager::GetInventory( CMover* pMover, CQuery *qry, LPDB_OVERLAPPED_PLUS lpDbOverlappedPlus )

Code:
#if __VER >= 11 // __SYS_IDENTIFY
        __int64 iRandomOptItemId    = GetInt64PaFromStr( ExtInven, &CountStr );
        pMover->m_Inventory.m_apItem[nExtInven].SetRandomOptItemId( iRandomOptItemId );
#ifdef __5LAWAKES
        pMover->m_Inventory.m_apItem[nExtInven].SetnAdjItemId(GetInt64PaFromStr(ExtInven, &CountStr));
#endif

DBManagerSave.cpp
do
Code:
CDbManager::SaveOneItem( CItemElem* pItemElem, PItemStruct pItemStruct )

Code:
#if __VER >= 11 // __SYS_IDENTIFY
        sprintf(pItemStruct->szExt, "%d,%d,%I64d"
#ifdef __5LAWAKES
            ",%I64d"
#endif
#if __VER >= 15 // __PETVIS    
            ",%d"
#endif
            "/", pItemElem->m_bCharged, pItemElem->m_dwKeepTime, pItemElem->GetRandomOptItemId()
#ifdef __5LAWAKES
            , pItemElem->GetnAdjItemId()
#endif
#if __VER >= 15 // __PETVIS
            , static_cast<int>(pItemElem->m_bTranformVisPet)
#endif
            );
#else
        sprintf( pItemStruct->szExt, "%d,%d,%d/", pItemElem->m_bCharged, pItemElem->m_dwKeepTime, pItemElem->GetRandomOptItemId() );
#endif

Obj.cpp
do
Code:
CItemElem::CItemElem()

Code:
#if __VER >= 11 // __SYS_IDENTIFY
    m_iRandomOptItemId    = 0;
#ifdef __5LAWAKES
    nAdjItemId = 0;
#endif

do
Code:
CItemElem& CItemElem::operator =( CItemElem & ie )

Code:
#if __VER >= 11 // __SYS_IDENTIFY
    m_iRandomOptItemId        = ie.GetRandomOptItemId();
#ifdef __5LAWAKES
    nAdjItemId = ie.GetnAdjItemId();
#endif

Obj.h
do
Code:
class CItemElem : public CItemBase

Code:
#ifdef __5LAWAKES
private:
    __int64 nAdjItemId;
public:
    __int64    GetnAdjItemId(){ return nAdjItemId; }
    __int64* GetnAdjItemIdPtr(){ return &nAdjItemId; }
    void SetnAdjItemId(__int64 inAjdItemSet){ nAdjItemId = inAjdItemSet; }
#endif

ObjSerialize.cpp
do
Code:
CItemElem::Serialize( CAr & ar )

Code:
#if __VER >= 11 // __SYS_IDENTIFY
        ar << m_iRandomOptItemId;
#ifdef __5LAWAKES
        ar << nAdjItemId;
#endif

Code:
#if __VER >= 11 // __SYS_IDENTIFY
        ar >> m_iRandomOptItemId;
#ifdef __5LAWAKES
        ar >> nAdjItemId;
#endif

Item.h
do
Code:
class CItemElem : public CItemBase

Code:
#ifdef __5LAWAKES
private:
    __int64 nAdjItemId;
    __int64 nNewAdjItemId;
public:
    __int64    GetnAdjItemId() { return nAdjItemId; }
    __int64* GetnAdjItemIdPtr() { return &nAdjItemId; }
    void SetnAdjItemId(__int64 inAjdItemSet) { nAdjItemId = inAjdItemSet; }

    __int64    GetnNewAdjItemId() { return nNewAdjItemId; }
    __int64* GetnNewAdjItemIdPtr() { return &nNewAdjItemId; }
    void SetnNewAdjItemId(__int64 inAjdItemSet) { nNewAdjItemId = inAjdItemSet; }
    void SetNewRandomOptId(__int64 iDst){ m_n64NewRandomOption = iDst; }
#endif

Item.cpp
do
Code:
CItemElem::CItemElem()

Code:
    m_iRandomOptItemId    = 0;
    m_n64NewRandomOption = 0;
#ifdef __5LAWAKES
    nAdjItemId = 0;
#endif

Mover.cpp
do
Code:
CMover::SetDestParamRandomOptExtension( CItemElem* pItemElem )

Code:
#if __VER >= 11 // __SYS_IDENTIFY
#ifdef __5LAWAKES
    byte cbOption = g_xRandomOptionProperty->GetAdjSize(pItemElem->GetnAdjItemId());
    
    for (int i = 0; i < cbOption; i++)
    {
        int nDst, nAdj;
        if (g_xRandomOptionProperty->GetDstAdj(pItemElem->GetRandomOptItemId(), pItemElem->GetnAdjItemId(), i, &nDst, &nAdj))
            SetDestParam(nDst, nAdj, NULL_CHGPARAM);
    }
#else
    int cbOption    = g_xRandomOptionProperty->GetRandomOptionSize( pItemElem->GetRandomOptItemId() );
    for( int i = 0; i < cbOption; i++ )
    {
        int nDst, nAdj;
        if( g_xRandomOptionProperty->GetParam( pItemElem->GetRandomOptItemId(), i, &nDst, &nAdj ) )
            SetDestParam( nDst, nAdj, NULL_CHGPARAM );
    }
#endif

do
Code:
CMover::ResetDestParamRandomOptExtension( CItemElem* pItemElem )

Code:
#if __VER >= 11 // __SYS_IDENTIFY
#ifdef __5LAWAKES
    byte cbOption = g_xRandomOptionProperty->GetDstSize(pItemElem->GetRandomOptItemId());
    for (int i = 0; i < cbOption; ++i)
    {
        int nDst, nAdj;
        if(g_xRandomOptionProperty->GetDstAdj(pItemElem->GetRandomOptItemId(), pItemElem->GetnAdjItemId(), i, &nDst, &nAdj))
            ResetDestParam( nDst, nAdj, TRUE );
    }
#else
    int cbOption    = g_xRandomOptionProperty->GetRandomOptionSize( pItemElem->GetRandomOptItemId() );
    for( int i = 0; i < cbOption; i++ )
    {
        int nDst, nAdj;
        if( g_xRandomOptionProperty->GetParam( pItemElem->GetRandomOptItemId(), i, &nDst, &nAdj ) )
            ResetDestParam( nDst, nAdj, TRUE );
    }
#endif

Mover.h
do
Code:
#if __VER >= 15 // __PETVIS
[URL="https://forum.ragezone.com/usertag.php?do=list&action=hash&hash=define"]#define[/URL]  UI_PETVIS_SIZE 15
[URL="https://forum.ragezone.com/usertag.php?do=list&action=hash&hash=define"]#define[/URL]  UI_PETVIS_ITEM 16
[URL="https://forum.ragezone.com/usertag.php?do=list&action=hash&hash=define"]#define[/URL]  UI_PETVIS_ITEMSWAP 17
[URL="https://forum.ragezone.com/usertag.php?do=list&action=hash&hash=define"]#define[/URL]  UI_TRANSFORM_VISPET 18
const int PETVIS_DEFAULT_VIS_SLOT_SZIE = 2;
#endif

Code:
#ifdef __5LAWAKES
[URL="https://forum.ragezone.com/usertag.php?do=list&action=hash&hash=define"]#define[/URL]  UI_ADJRANDOMOPT 30
#endif

MoverParam.cpp
do
Code:
CMover::UpdateItemEx(unsigned char id, char cParam, __int64 iValue)

Code:
        case UI_RANDOMOPTITEMID: pItemElem->SetRandomOptItemId(iValue); break;
#ifdef __5LAWAKES
        case UI_ADJRANDOMOPT: pItemElem->SetnAdjItemId(iValue); break;
#endif

RandomOption.cpp
do
Code:
CRandomOptionProperty::InitializeRandomOption(__int64* pnRandomOptItemId)

Code:
#ifdef __5LAWAKES
    *pnRandomOptItemId &= 0xFFFF0000000000FF;
#else
    *pnRandomOptItemId &= 0xC0000000000000FF;
#endif

#ifdef __FASHION_COMBINE do
Code:
bool CRandomOptionProperty::MergeRandomOption(CItemElem* pItemElemMain, CItemElem* pItemElemDestroy)

Code:
#ifdef __5LAWAKES
    int nMainSize = GetDstSize(pItemElemMain->GetRandomOptItemId());
    int nDestroySize = GetDstSize(pItemElemDestroy->GetRandomOptItemId());
#else
    int nMainSize = GetRandomOptionSize(pItemElemMain->GetRandomOptItemId());
    int nDestroySize = GetRandomOptionSize(pItemElemDestroy->GetRandomOptItemId());
#endif

Code:
#ifndef __5LAWAKES
        if (GetParam(pItemElemDestroy->GetRandomOptItemId(), i, &nDst, &nAdj))
            SetParam(pItemElemMain->GetRandomOptItemIdPtr(), nDst, nAdj);
#else
        if (GetDstAdj(pItemElemDestroy->GetRandomOptItemId(), pItemElemDestroy->GetnAdjItemId(), i, &nDst, &nAdj))
        {
            SetDsts(pItemElemMain->GetRandomOptItemIdPtr(), i + nMainSize, nDst);
            SetAdjs(pItemElemMain->GetnAdjItemIdPtr(), i + nMainSize, nAdj);
        }
#endif

Add to End of file
Code:
#ifdef __5LAWAKES
#ifdef __WORLDSERVER
void CRandomOptionProperty::GenDstAdj(CItemElem* pItemElem, int nRandomOptionKind, int nParts, bool noProtect)
{
    __int64 nDstSet = 0;
    __int64 nAdjSet = 0;
    SetValues(&nDstSet, &nAdjSet, nRandomOptionKind, nParts);
    if (noProtect)
    {
        pItemElem->SetRandomOptItemId(nDstSet);
        pItemElem->SetnAdjItemId(nAdjSet);
    }
    else
    {
        pItemElem->SetNewRandomOptId(nDstSet);
        pItemElem->SetnNewAdjItemId(nAdjSet);
    }
}

void CRandomOptionProperty::SetValues(__int64* nDstSet, __int64* nAdjSet, int nRandomKind, int nParts)
{
    __int64 nBonus = 0;
    byte nloop = 5; 
    if(nRandomKind >= eBlessing)
        nloop = 3;

    for (int i = 0; i < nloop; i++)
    {
        nBonus = 0;
        RANDOM_OPTION* pRandomOption = DetermineRandomOptionDst(nRandomKind, nParts);
        nBonus = pRandomOption->nDst;
        nBonus = nBonus << ( 8 + (8 * i));
        *nDstSet = *nDstSet | nBonus;

        nBonus = 0;
        short nAdj = DetermineRandomOptionAdj(pRandomOption, false);
        if (nAdj < 0)
        {
            nBonus |= 0x200;
            nBonus = nBonus | (-nAdj);
        }
        else
            nBonus = nBonus | nAdj;

        nBonus = nBonus << (10 * i);
        *nAdjSet = *nAdjSet | nBonus;
    }
}
#endif
void CRandomOptionProperty::SetDsts(__int64* Dstset, byte ati, byte nDst)
{
    __int64 wew = nDst;
    wew = wew << (8 + (ati * 8));
    *Dstset = *Dstset | wew;
}

void CRandomOptionProperty::SetAdjs(__int64* Adjset, byte ati, short nAdj)
{
    __int64 nAdjz = 0;
    if (nAdj < 0) {
        nAdjz |= 0x200;
        nAdjz = nAdjz | (-nAdj);
    }
    else { nAdjz = nAdjz | nAdj; }
    nAdjz = nAdjz << (10 * ati);
    *Adjset = *Adjset | nAdjz;
}

byte CRandomOptionProperty::GetDstSize(__int64 nDstList, bool Safe)
{
    byte nSize = 0;
    if (!Safe)
    {
        bool bCheckedSafeFlag = false;
        bCheckedSafeFlag = IsCheckedSafeFlag(nDstList);
        if (bCheckedSafeFlag == true) { return nSize; }
    }

    __int64 i = 0xFF << 8; 
    for (int j = 0; j < 5; j++)
    {
        if (nDstList & i)
        {
            nSize++;
            i = i << 8;
        }
        else
            return nSize;
    }
    return nSize;
}

byte CRandomOptionProperty::GetAdjSize(__int64 nAdjList)
{
    byte nSize = 0;
    __int64 i = 0x3FF;
    for (int j = 0; j < 5; j++)
    {
        if (nAdjList & i)
        {
            nSize++;
            i = i << 10;
        }
        else
            return nSize;
    }

    return nSize;
}

void CRandomOptionProperty::ResetAdjs(__int64* wew)
{
    *wew &= 0x0000000000000000;
}
BOOL CRandomOptionProperty::GetDstAdj(__int64 nDstId, __int64 nAdjId, int i, int* pnDst, int* pnAdj)
{
    int nDst = static_cast<int>(nDstId >> (8 + (i * 8)));
    int nAdj = static_cast<int>(nAdjId >> (10 * i));

    *pnAdj = nAdj & 0x1FF;
    if (nAdj & 0x200)
        *pnAdj = -*pnAdj;

    *pnDst = nDst & 0xFF;
    return TRUE;
}
#endif

RandomOption.h
Code:
#ifdef __5LAWAKES
[URL="https://forum.ragezone.com/usertag.php?do=list&action=hash&hash=define"]#define[/URL]     MAX_RANDOM_OPTION 5
#else
[URL="https://forum.ragezone.com/usertag.php?do=list&action=hash&hash=define"]#define[/URL]  MAX_RANDOM_OPTION 3
#endif

Code:
#ifdef __5LAWAKES
[URL="https://forum.ragezone.com/usertag.php?do=list&action=hash&hash=define"]#define[/URL]  _AWAKE_SAFE_FLAG 0x100000000000000
#else
[URL="https://forum.ragezone.com/usertag.php?do=list&action=hash&hash=define"]#define[/URL]  _AWAKE_SAFE_FLAG 0x2000000000000000
#endif

do
Code:
class CRandomOptionProperty

Code:
#ifdef __5LAWAKES
public:
    void GenDstAdj(CItemElem* pItemElem, int nRandomOptionKind, int nParts, bool noProtect = true);
    void SetValues(__int64* nDstSet, __int64* nAdjSet, int nRandomKind, int nParts);

    void SetDsts(__int64* Dstset, byte ati, byte nDst);
    void SetAdjs(__int64* Adjset, byte ati, short nAdj);

    byte GetDstSize(__int64 nRandomOptDstId, bool Safe = true);
    byte GetAdjSize(__int64 nRandomOptAdjId);
    void ResetAdjs(__int64* pnRandomOptAdjId);

    BOOL GetDstAdj(__int64 nDstId, __int64 nAdjId, int i, int* pnDst, int* pnAdj);
#endif

FuncTextCmd.cpp
Code:
BOOL TextCmd_SetRandomOption(CScanner & s)
{
#ifdef __WORLDSERVER
    CUser* pUser = (CUser*)s.dwValue;
    CItemElem* pItemElem = pUser->m_Inventory.GetAt(0);
    if (pItemElem)
    {
        if (g_xRandomOptionProperty->GetRandomOptionKind(pItemElem) >= 0)
        {
            g_xRandomOptionProperty->InitializeRandomOption(pItemElem->GetRandomOptItemIdPtr());
#ifdef __5LAWAKES
            g_xRandomOptionProperty->ResetAdjs(pItemElem->GetnAdjItemIdPtr());
            __int64 DstSet = 0, AdjSet = 0;
#endif
            unsigned char nDst = 0; short nAdj = 0; byte nloopcnt = 0;
            nDst = s.GetNumber();
            while (s.tok != FINISHED)
            {
                nAdj = s.GetNumber();
                if (nDst < 1 || nDst > MAX_ADJPARAMARY){
                    pUser->AddText("You went over or under the required Dst amount");
                    break;
                }
                if (nAdj < -512 || nAdj > 512){
                    pUser->AddText("Max Adj = 512, Min adj = -512. Stop overflowing you hoe");
                    break;
                }
#ifdef __5LAWAKES
                g_xRandomOptionProperty->SetDsts(&DstSet, nloopcnt, nDst);
                g_xRandomOptionProperty->SetAdjs(&AdjSet, nloopcnt, nAdj);
#else
                g_xRandomOptionProperty->SetParam(pItemElem->GetRandomOptItemIdPtr(), nDst, nAdj);
#endif

                nloopcnt++;
#ifdef __5LAWAKES
                if (nloopcnt >= 5)
#else
                if (nloopcnt >= 3)
#endif
                    break;
                nDst = s.GetNumber();
            }

#ifdef __5LAWAKES
            pItemElem->SetRandomOptItemId(DstSet);
            pItemElem->SetnAdjItemId(AdjSet);
            pUser->UpdateItemEx((BYTE)(pItemElem->m_dwObjId), UI_ADJRANDOMOPT, pItemElem->GetnAdjItemId());
#else
            pItemElem->SetRandomOptItemId(pItemElem->GetRandomOptItemId());
#endif 
            pUser->UpdateItemEx((BYTE)(pItemElem->m_dwObjId), UI_RANDOMOPTITEMID, pItemElem->GetRandomOptItemId());
        }
    }
#endif    // __WORLDSERVER
    return true;
}


Code:
BOOL TextCmd_GenRandomOption(CScanner & s)
{
#ifdef __WORLDSERVER
    CUser* pUser = (CUser*)s.dwValue;
    CItemElem* pItemElem = pUser->m_Inventory.GetAt(0);
    if (pItemElem)
    {
        int nRandomOptionKind = g_xRandomOptionProperty->GetRandomOptionKind(pItemElem);
        if (nRandomOptionKind >= 0)
        {
#ifdef __AWAKENINGCOMMAND
            const unsigned int cost = 1000000;
            if (pUser->GetGold() < nAwakeCost){
                pUser->AddText("Not enough Gold");
                return false;
            }
            pUser->AddGold(-(nCost));
#endif
            g_xRandomOptionProperty->InitializeRandomOption(pItemElem->GetRandomOptItemIdPtr());
#ifdef __5LAWAKES
            g_xRandomOptionProperty->ResetAdjs(pItemElem->GetnAdjItemIdPtr());
            g_xRandomOptionProperty->GenDstAdj(pItemElem, nRandomOptionKind, pItemElem->GetProp()->dwParts);
#else
            g_xRandomOptionProperty->GenRandomOption(pItemElem->GetRandomOptItemIdPtr(), nRandomOptionKind, pItemElem->GetProp()->dwParts);
            pUser->UpdateItemEx((BYTE)(pItemElem->m_dwObjId), UI_RANDOMOPTITEMID, pItemElem->GetRandomOptItemId());
#endif
        }
    }
#endif
    return true;
}

Code:
BOOL TextCmd_InitializeRandomOption(CScanner & s)
{
#ifdef __WORLDSERVER
    CUser* pUser = (CUser*)s.dwValue;
    CItemElem* pItemElem = pUser->m_Inventory.GetAt(0);
    if (pItemElem)
    {
        int nRandomOptionKind = g_xRandomOptionProperty->GetRandomOptionKind(pItemElem);
        if (nRandomOptionKind >= 0)
        {
#ifdef __5LAWAKES
            g_xRandomOptionProperty->ResetAdjs(pItemElem->GetnAdjItemIdPtr());
            pUser->UpdateItemEx((BYTE)(pItemElem->m_dwObjId), UI_ADJRANDOMOPT, pItemElem->GetnAdjItemId());
#endif
            g_xRandomOptionProperty->InitializeRandomOption(pItemElem->GetRandomOptItemIdPtr());
            pUser->UpdateItemEx((BYTE)(pItemElem->m_dwObjId), UI_RANDOMOPTITEMID, pItemElem->GetRandomOptItemId());
        }
    }
#endif
    return true;
}

WndManager.cpp
do
Code:
CWndMgr::PutAwakeningBlessing( CItemElem* pItemElem, CEditString* pEdit )

Code:
#ifdef __5LAWAKES
    byte nSize = g_xRandomOptionProperty->GetDstSize(pItemElem->GetRandomOptItemId());
#else
    int nSize = g_xRandomOptionProperty->GetRandomOptionSize( pItemElem->GetRandomOptItemId() );
#endif
#ifdef __PROTECT_AWAKE
    bool bSafe = g_xRandomOptionProperty->IsCheckedSafeFlag(pItemElem->GetRandomOptItemId());
#ifndef __5LAWAKES
    if (bSafe)
        nSize = g_xRandomOptionProperty->GetViewRandomOptionSize(pItemElem->GetRandomOptItemId());
#endif
#endif //__PROTECT_AWAKE

Code:
#ifdef __5LAWAKES
        if (!g_xRandomOptionProperty->GetDstAdj(pItemElem->GetRandomOptItemId(), pItemElem->GetnAdjItemId(), i, &nDst, &nAdj))
#else
        if( !g_xRandomOptionProperty->GetParam( pItemElem->GetRandomOptItemId(), i, &nDst, &nAdj ) )
#endif

DPSrvr
do
Code:
CDPSrvr::OnBlessednessCancel(CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize)

Code:
                g_xRandomOptionProperty->InitializeRandomOption(pItem->GetRandomOptItemIdPtr());
                pUser->UpdateItemEx((BYTE)(pItem->m_dwObjId), UI_RANDOMOPTITEMID, pItem->GetRandomOptItemId());
#ifdef __5LAWAKES
                g_xRandomOptionProperty->ResetAdjs(pItem->GetnAdjItemIdPtr());
                pUser->UpdateItemEx((BYTE)(pItem->m_dwObjId), UI_ADJRANDOMOPT, pItem->GetnAdjItemId());
#endif

do
Code:
CDPSrvr::OnAwakening(CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize)

Code:
            }
            g_xRandomOptionProperty->InitializeRandomOption(pItem->GetRandomOptItemIdPtr());
#ifdef __5LAWAKES
            g_xRandomOptionProperty->ResetAdjs(pItem->GetnAdjItemIdPtr());
            g_xRandomOptionProperty->GenDstAdj(pItem, nRandomOptionKind, pItem->GetProp()->dwParts);
            pUser->UpdateItemEx((BYTE)(pItem->m_dwObjId), UI_ADJRANDOMOPT, pItem->GetnAdjItemId());
#else
            g_xRandomOptionProperty->GenRandomOption(pItem->GetRandomOptItemIdPtr(), nRandomOptionKind, pItem->GetProp()->dwParts);
#endif

do
Code:
CDPSrvr::DoUseItemTarget_GenRandomOption(CUser* pUser, CItemElem* pTarget, int nKind, int nOk, int nMismatchKind, int nHasOption, const char* szOperation, const char* szReceive)

Code:
    if (
#ifdef __5LAWAKES
        g_xRandomOptionProperty->GetDstSize(pTarget->GetRandomOptItemId(), false) > 0
#else
        g_xRandomOptionProperty->GetRandomOptionSize(pTarget->GetRandomOptItemId()) > 0
#endif
#if __VER >= 12 // __J12_0
        && (nKind != CRandomOptionProperty::eBlessing && nKind != CRandomOptionProperty::eEatPet)
#endif
        )

Code:
    bool bCheckedSafeFlag = false;
    bCheckedSafeFlag = g_xRandomOptionProperty->IsCheckedSafeFlag(pTarget->GetRandomOptItemId());
    if (bCheckedSafeFlag == true)
    {
        g_xRandomOptionProperty->ResetSafeFlag(pTarget->GetRandomOptItemIdPtr());
        g_xRandomOptionProperty->InitializeRandomOption(pTarget->GetNewRandomOptionPtr());
#ifdef __5LAWAKES
        g_xRandomOptionProperty->ResetAdjs(pTarget->GetnNewAdjItemIdPtr());
        g_xRandomOptionProperty->GenDstAdj(pTarget, nRandomOptionKind, pTarget->GetProp()->dwParts, false);
#else
        g_xRandomOptionProperty->GenRandomOption(pTarget->GetNewRandomOptionPtr(), nRandomOptionKind, pTarget->GetProp()->dwParts, true);
#endif
        TCHAR szNewOption[128];
        ::memset(szNewOption, 0, sizeof(szNewOption));
        ::_stprintf(szNewOption, "%I64d", pTarget->GetNewRandomOption());
        g_DPSrvr.PutItemLog(pUser, "z", szNewOption, pTarget, 1);
#ifdef __5LAWAKES
        pUser->SendNewRandomOption((BYTE)(pTarget->m_dwObjId), (DWORD)(pTarget->GetSerialNumber()), pTarget->GetNewRandomOption(), pTarget->GetnNewAdjItemId());
#else
        pUser->SendNewRandomOption((BYTE)(pTarget->m_dwObjId), (DWORD)(pTarget->GetSerialNumber()), pTarget->GetNewRandomOption());
#endif
    }
    else
    {
        g_xRandomOptionProperty->InitializeRandomOption(pTarget->GetRandomOptItemIdPtr());
#ifdef __5LAWAKES
        g_xRandomOptionProperty->ResetAdjs(pTarget->GetnAdjItemIdPtr());
        g_xRandomOptionProperty->GenDstAdj(pTarget, nRandomOptionKind, pTarget->GetProp()->dwParts);
#else
        g_xRandomOptionProperty->GenRandomOption(pTarget->GetRandomOptItemIdPtr(), nRandomOptionKind, pTarget->GetProp()->dwParts);
#endif
    }

#ifdef __5LAWAKES
    pUser->UpdateItemEx((BYTE)(pTarget->m_dwObjId), UI_ADJRANDOMOPT, pTarget->GetnAdjItemId());
#endif
    pUser->UpdateItemEx((BYTE)(pTarget->m_dwObjId), UI_RANDOMOPTITEMID, pTarget->GetRandomOptItemId())


do
Code:
CDPSrvr::DoUseItemTarget_InitializeRandomOption(CUser* pUser, CItemElem* pTarget, int nKind, int nOk, int nError, const char* szOperation, const char* szRecv)

Code:
        else
        {
            g_xRandomOptionProperty->InitializeRandomOption(pTarget->GetRandomOptItemIdPtr());
#ifdef __5LAWAKES
            g_xRandomOptionProperty->ResetAdjs(pTarget->GetnAdjItemIdPtr());
#endif
        }

Code:
#ifdef __5LAWAKES
        pUser->UpdateItemEx((BYTE)(pTarget->m_dwObjId), UI_ADJRANDOMOPT, pTarget->GetnAdjItemId());
#endif
        pUser->UpdateItemEx((BYTE)(pTarget->m_dwObjId), UI_RANDOMOPTITEMID, pTarget->GetRandomOptItemId());

WndAwakening.cpp
do
Code:
CWndSelectAwakeCase::CWndSelectAwakeCase( )

Code:
    m_n64NewOption = 0;
#ifdef __5LAWAKES
    m_nAdjOpt = 0;
#endif


do
Code:
CWndSelectAwakeCase::OutputOptionString( C2DRender* p2DRender, CItemElem* pItemElem, BOOL bNew )

Code:
    if (!bNew)
    {
#ifdef __5LAWAKES
        nSize = g_xRandomOptionProperty->GetDstSize(pItemElem->GetRandomOptItemId());
#else
        nSize = g_xRandomOptionProperty->GetRandomOptionSize(pItemElem->GetRandomOptItemId());
#endif
    }
    else
    {
#ifdef __5LAWAKES
        nSize = g_xRandomOptionProperty->GetDstSize(m_n64NewOption, false);
#else
        nSize = g_xRandomOptionProperty->GetViewRandomOptionSize(m_n64NewOption);
#endif
    }

    __int64 n64Options = 0;
    n64Options = ( bNew ? m_n64NewOption : pItemElem->GetRandomOptItemId());
#ifdef __5LAWAKES
    __int64 nAdjOptions = 0;
    nAdjOptions = (bNew ? m_nAdjOpt : pItemElem->GetnAdjItemId());
#endif

    CString str;
    int nDst = 0, nAdj = 0;
    for (int i = 0; i < nSize; ++i)
    {
#ifdef __5LAWAKES
        if (!g_xRandomOptionProperty->GetDstAdj(n64Options, nAdjOptions, i, &nDst, &nAdj))
#else
        if (!g_xRandomOptionProperty->GetParam(n64Options, i, &nDst, &nAdj))
#endif
            continue;


do
Code:
CWndSelectAwakeCase::SetData(BYTE byObjID, DWORD dwSerialNum, __int64 n64NewOption)

Code:
#ifdef __5LAWAKES
void CWndSelectAwakeCase::SetData( BYTE byObjID, DWORD dwSerialNum, __int64 n64NewOption, __int64 nAdjOpt ) 
#else
void CWndSelectAwakeCase::SetData(BYTE byObjID, DWORD dwSerialNum, __int64 n64NewOption)
#endif
{
    m_byObjID = byObjID;
    m_dwSerialNum = dwSerialNum;
    m_n64NewOption = n64NewOption; 
#ifdef __5LAWAKES
    m_nAdjOpt = nAdjOpt;
#endif

WndAwakening.h
do
Code:
CWndSelectAwakeCase : public CWndNeuz

Code:
#ifdef __5LAWAKES
    void SetData( BYTE byObjID, DWORD dwSerialNum, __int64 n64NewOption, __int64 nAdjOpt);
#else
    void SetData(BYTE byObjID, DWORD dwSerialNum, __int64 n64NewOption);
#endif

Code:
    __int64 m_n64NewOption;
#ifdef __5LAWAKES
    __int64 m_nAdjOpt;
#endif

dpClient.cpp
do
Code:
CDPClient::OnSafeAwakening(CAr& ar)

Code:
#ifdef __5LAWAKES
    __int64 nAdjOpt = 0;
    ar >> nAdjOpt;
#endif
    if (!g_pPlayer) return;

    g_WndMng.m_pWndSelectAwakeCase = new CWndSelectAwakeCase;
#ifdef __5LAWAKES
    g_WndMng.m_pWndSelectAwakeCase->SetData(byItemObjID, dwSerialNumber, n64NewRandomOption, nAdjOpt);
#else
    g_WndMng.m_pWndSelectAwakeCase->SetData(byItemObjID, dwSerialNumber, n64NewRandomOption);
#endif

User.h
Code:
    void    SelectAwakeningValue( DWORD dwItemObjID, DWORD dwSerialNumber, BYTE bySelectFlag );
#ifdef __5LAWAKES
    void SendNewRandomOption(unsigned char id, DWORD dwSerialNumber, __int64 n64NewRandomOption, __int64 nAdjOpt);
#else
    void SendNewRandomOption( unsigned char id, DWORD dwSerialNumber, __int64 n64NewRandomOption );
#endif

User.cpp
Code:
#ifdef __5LAWAKES
void CUser::SendNewRandomOption(unsigned char id, DWORD dwSerialNumber, __int64 n64NewRandomOption, __int64 nAdjOpt)
#else
void CUser::SendNewRandomOption(unsigned char id, DWORD dwSerialNumber, __int64 n64NewRandomOption)
#endif
{
    if (IsDelete())    return;

    m_Snapshot.cb++;
    m_Snapshot.ar << GetId();
    m_Snapshot.ar << SNAPSHOTTYPE_ITEM_SELECT_AWAKENING_VALUE;
    m_Snapshot.ar << id << dwSerialNumber << n64NewRandomOption;
#ifdef __5LAWAKES
    m_Snapshot.ar << nAdjOpt;
#endif
}


do
Code:
CUser::SelectAwakeningValue(DWORD dwItemObjID, DWORD dwSerialNumber, BYTE bySelectFlag)

Code:
#ifndef __5LAWAKES
    bRetValue = pItem->SelectRandomOption(bySelectFlag); //old way
    if (bRetValue == true)
    {
        UpdateItemEx((BYTE)(pItem->m_dwObjId), UI_RANDOMOPTITEMID, pItem->GetRandomOptItemId());

        TCHAR szSelectValue[128];
        ::memset(szSelectValue, 0, sizeof(szSelectValue));

        if (bySelectFlag == 1)            //    _AWAKE_OLD_VALUE
        {
            ::_stprintf(szSelectValue, "SELECT _AWAKE_OLD_VALUE");
        }
        else if (bySelectFlag == 2)    //    _AWAKE_NEW_VALUE
        {
            ::_stprintf(szSelectValue, "SELECT _AWAKE_NEW_VALUE");
        }
        else
        {
            ::_stprintf(szSelectValue, "SELECT ERROR");
        }

        g_DPSrvr.PutItemLog(this, "z", szSelectValue, pItem, 1);
    }
#else
    if (bySelectFlag == 1)
    {
        pItem->SetNewRandomOptId(0);
        pItem->SetnNewAdjItemId(0);
    }
    else if (bySelectFlag == 2)
    {
        __int64 nNewOpt = (pItem->GetRandomOptItemId() & 0xF0000000000000FF) | pItem->GetNewRandomOption();
        pItem->SetRandomOptItemId(nNewOpt);
        UpdateItemEx((BYTE)(pItem->m_dwObjId), UI_RANDOMOPTITEMID, nNewOpt);
        nNewOpt = pItem->GetnNewAdjItemId();
        pItem->SetnAdjItemId(nNewOpt);
        UpdateItemEx((BYTE)(pItem->m_dwObjId), UI_ADJRANDOMOPT, nNewOpt);
        pItem->SetNewRandomOptId(0);
        pItem->SetnNewAdjItemId(0);
    }
#endif

Awakening Transfer
WndField.cpp
Code:
#ifdef __TRANSFER_AWAKE
CWndAwakeTransfer::CWndAwakeTransfer()
{
    for (int i = 0; i < 4; ++i)
    {
        m_pItemElem[i] = NULL;
        m_pTexture[i] = NULL;
    }
    m_editAwakes.Empty();
}
CWndAwakeTransfer::~CWndAwakeTransfer()
{
    for (int i = 0; i < 4; ++i)
    {
        if (m_pItemElem[i] != NULL)
        {
            if (!g_pPlayer->m_vtInfo.IsTrading(m_pItemElem[i])){ m_pItemElem[i]->SetExtra(0); }
        }
        m_pItemElem[i] = NULL;
        m_pTexture[i] = NULL;
    }
    m_editAwakes.Empty();
} 

BOOL CWndAwakeTransfer::Initialize(CWndBase* pWndParent, DWORD dwType){ return CWndNeuz::InitDialog(g_Neuz.GetSafeHwnd(), APP_AWAKETRANSFER, 0, CPoint(0, 0), pWndParent); }
BOOL CWndAwakeTransfer::OnCommand(UINT nID, DWORD dwMessage, CWndBase* pWndBase){ return CWndNeuz::OnCommand(nID, dwMessage, pWndBase); }
void CWndAwakeTransfer::OnSize(UINT nType, int cx, int cy){ CWndNeuz::OnSize(nType, cx, cy); }
void CWndAwakeTransfer::OnLButtonUp(UINT nFlags, CPoint point){ }
void CWndAwakeTransfer::OnLButtonDown(UINT nFlags, CPoint point){ }

void CWndAwakeTransfer::OnDraw(C2DRender* p2DRender)
{
    CWndButton* pButt = (CWndButton*)GetDlgItem(WIDC_BUTTON1);
    LPWNDCTRL wndCtrl[5];
    wndCtrl[0] = GetWndCtrl(WIDC_CUSTOM1);
    wndCtrl[1] = GetWndCtrl(WIDC_CUSTOM2);
    wndCtrl[2] = GetWndCtrl(WIDC_CUSTOM3);
    wndCtrl[3] = GetWndCtrl(WIDC_CUSTOM4);
    wndCtrl[4] = GetWndCtrl(WIDC_TEXT);

    for (int i = 0; i < 4; ++i)
    {
        CRect CtrlRect = wndCtrl[i]->rect; 
        if (m_pItemElem[i] != NULL)
        {
            if (m_pTexture[i] != NULL){ m_pTexture[i]->Render(p2DRender, CPoint(CtrlRect.left + 5, CtrlRect.top + 5)); }
            CPoint point = GetMousePoint();
            if (CtrlRect.PtInRect(point))
            {
                CPoint point2 = point;
                ClientToScreen(&point2);
                ClientToScreen(&CtrlRect);
                g_WndMng.PutToolTip_Item(m_pItemElem[i], point2, &CtrlRect);
            }
        }
    }

    if (m_pItemElem[0] != NULL)
    {
        p2DRender->TextOut_EditString(wndCtrl[4]->rect.left + 2, wndCtrl[4]->rect.top + 1, m_editAwakes, 0, 0, 2);

        if (m_pItemElem[1] != NULL) 
        {
            m_pTexture[3] = CWndBase::m_textureMng.AddTexture(D3DDEVICE, MakePath(DIR_ITEM, m_pItemElem[1]->GetProp()->szIcon), 0xffff00ff);
            m_pTexture[3]->Render(p2DRender, CPoint(wndCtrl[3]->rect.left + 5, wndCtrl[3]->rect.top + 5));
            pButt->EnableWindow(TRUE);
        }
        else{ pButt->EnableWindow(FALSE); }
    }
}
HRESULT CWndAwakeTransfer::RestoreDeviceObjects()
{
    CWndNeuz::RestoreDeviceObjects();
    return S_OK;
}
HRESULT CWndAwakeTransfer::InvalidateDeviceObjects()
{
    CWndNeuz::InvalidateDeviceObjects();
    return S_OK;
}
HRESULT CWndAwakeTransfer::DeleteDeviceObjects()
{
    CWndNeuz::DeleteDeviceObjects();
    InvalidateDeviceObjects();
    return S_OK;
}
void CWndAwakeTransfer::OnInitialUpdate()
{
    LPWNDCTRL wndCtrl;
    wndCtrl = GetWndCtrl(WIDC_TEXT);
    m_editAwakes.Init(m_pFont, &wndCtrl->rect);
    CWndNeuz::OnInitialUpdate();
    CWndButton* pButt = (CWndButton*)GetDlgItem(WIDC_BUTTON1);
    pButt->EnableWindow(FALSE);

    CWndInventory* pWndInventory = (CWndInventory*)g_WndMng.CreateApplet(APP_INVENTORY);
    MoveParentCenter(); 
}
BOOL CWndAwakeTransfer::OnDropIcon(LPSHORTCUT pShortcut, CPoint point)
{
    LPWNDCTRL pCtrl[4];
    pCtrl[0] = GetWndCtrl(WIDC_CUSTOM1);
    pCtrl[1] = GetWndCtrl(WIDC_CUSTOM2);
    pCtrl[2] = GetWndCtrl(WIDC_CUSTOM3);
    pCtrl[3] = GetWndCtrl(WIDC_CUSTOM4);

    CItemElem *pItem = (CItemElem*)g_pPlayer->GetItemId(pShortcut->m_dwId);
    if (!pItem) { return false; }
    __int64 nAwake = pItem->GetRandomOptItemId();

    for (int i = 0; i < 3; ++i)
    {
        if (pCtrl && pCtrl[i]->rect.PtInRect(point))
        {
            if (i == 0)
            {
                if (nAwake & 0x0000FFFFFFFFFF00) {}
                else { g_WndMng.PutString("This item slot needs to have an Awakening."); return false; }
            }
#ifdef __5LAWAKES
            else if (i == 1 && (nAwake & 0x0000FFFFFFFFFF00))
#else
            else if (i == 1 && (pItem->GetRandomOptItemId() & 0xCFFFFFFFFFFFFF00))
#endif
            {
                g_WndMng.PutString("This item slot requires no awakening.");
                return false;
            }
            if (i == 2 && pItem->m_dwItemId != II_SYS_AWAKETRANSFER) {
                g_WndMng.PutString("This slot is for the Protect Scroll");
                return false;
            }
            m_pItemElem[i] = pItem;
            pItem->SetExtra(1);
            m_pTexture[i] = CWndBase::m_textureMng.AddTexture(D3DDEVICE, MakePath(DIR_ITEM, m_pItemElem[i]->GetProp()->szIcon), 0xffff00ff);
            if (i == 0) { g_WndMng.PutAwakeningBlessing(m_pItemElem[0], &m_editAwakes); }
            return true;
        }
    }
    return false;
}
void CWndAwakeTransfer::OnRButtonUp(UINT nFlags, CPoint point)
{
    LPWNDCTRL pCtrl[3];
    pCtrl[0] = GetWndCtrl(WIDC_CUSTOM1);
    pCtrl[1] = GetWndCtrl(WIDC_CUSTOM2);
    pCtrl[2] = GetWndCtrl(WIDC_CUSTOM3);

    for (int i = 0; i < 3; ++i)
    {
        if (pCtrl[i]->rect.PtInRect(point))
        {
            if (m_pItemElem[i] != 0)
            {
                if (!g_pPlayer->m_vtInfo.IsTrading(m_pItemElem[i])){ m_pItemElem[i]->SetExtra(0); }
            }
            m_pItemElem[i] = 0;
            m_pTexture[i] = 0;
        }
    }
    if (m_pItemElem[0] == 0){ m_editAwakes.Empty(); }
}

BOOL CWndAwakeTransfer::OnChildNotify(UINT message, UINT nID, LRESULT* pLResult)
{
    switch (nID)
    {
        case WIDC_BUTTON1:
            if (m_pItemElem[0] != NULL && m_pItemElem[1] != NULL)
            {
                if (m_pItemElem[2]){ g_DPlay.SendTransferAwake(m_pItemElem[0]->m_dwObjId, m_pItemElem[1]->m_dwObjId, m_pItemElem[2]->m_dwObjId); }
                else{ g_DPlay.SendTransferAwake(m_pItemElem[0]->m_dwObjId, m_pItemElem[1]->m_dwObjId, NULL); }
                Destroy();
            }
            else{ g_WndMng.PutString("You have not filled the required slots."); }
            break;
        case WIDC_BUTTON2: Destroy(); break;
    }
    return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
#endif

WndField.h
Code:
#ifdef __TRANSFER_AWAKE
class CWndAwakeTransfer : public CWndNeuz
{
public:
    CItemElem* m_pItemElem[4];
    CTexture* m_pTexture[4];
    CEditString m_editAwakes;

    CWndAwakeTransfer();
    ~CWndAwakeTransfer();
    virtual HRESULT RestoreDeviceObjects();
    virtual HRESULT InvalidateDeviceObjects();
    virtual HRESULT DeleteDeviceObjects();

    virtual BOOL Initialize(CWndBase* pWndParent = NULL, DWORD nType = MB_OK);
    virtual BOOL OnChildNotify(UINT message, UINT nID, LRESULT* pLResult);
    virtual void OnDraw(C2DRender* p2DRender);
    virtual void OnInitialUpdate();
    virtual BOOL OnCommand(UINT nID, DWORD dwMessage, CWndBase* pWndBase);
    virtual BOOL OnDropIcon(LPSHORTCUT pShortcut, CPoint point);
    virtual void OnSize(UINT nType, int cx, int cy);
    virtual void OnRButtonUp(UINT nFlags, CPoint point);
    virtual void OnLButtonUp(UINT nFlags, CPoint point);
    virtual void OnLButtonDown(UINT nFlags, CPoint point);
};  
#endif

WndManager.cpp
do
Code:
CWndMgr::CWndMgr()

Code:
#ifdef __TRANSFER_AWAKE
    m_pWndAwakeTransfer = NULL;
#endif

do
Code:
CWndMgr::Free()

Code:
#ifdef __TRANSFER_AWAKE
    SAFE_DELETE(m_pWndAwakeTransfer);
#endif

do
Code:
CWndMgr::OnDestroyChildWnd

Code:
#ifdef __TRANSFER_AWAKE
    if (m_pWndAwakeTransfer == pWndChild)
    {
        SAFE_DELETE(m_pWndAwakeTransfer);
        pWndChild = NULL;
    }
#endif

WndManager.h
do
Code:
class CWndMgr : public CWndBase

Code:
#ifdef __TRANSFER_AWAKE
    CWndAwakeTransfer* m_pWndAwakeTransfer;
#endif

WndWorld.cpp
do
Code:
CWndWorld::OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase )

Code:
#ifdef __TRANSFER_AWAKE
        case MMI_AWAKE_TRANSFER:
            SAFE_DELETE(g_WndMng.m_pWndAwakeTransfer);
            g_WndMng.m_pWndAwakeTransfer = new CWndAwakeTransfer;
            g_WndMng.m_pWndAwakeTransfer->Initialize();
            break;
#endif

dpClient.cpp
Code:
#ifdef __TRANSFER_AWAKE
void CDPClient::SendTransferAwake(DWORD pAwakened, DWORD pItemElem, DWORD pItemMat)
{
    BEFORESENDSOLE(ar, PACKETTYPE_TRANSFERAWAKE, DPID_UNKNOWN);
    ar << pAwakened << pItemElem << pItemMat;
    SEND(ar, this, DPID_SERVERPLAYER);
}
#endif

dpClient.h
Code:
#ifdef __TRANSFER_AWAKE
    void SendTransferAwake( DWORD pItemElemMain, DWORD pItemElemDestroy, DWORD pItemMat ); 
#endif

dpSrvr.cpp
Code:
#ifdef __TRANSFER_AWAKE
void CDPSrvr::OnSendTransferAwake(CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE, u_long)
{
    CUser *pUser = g_UserMng.GetUser(dpidCache, dpidUser);
    if (IsInvalidObj(pUser)){ return; }

    DWORD dwAwaked, dwItem, dwMat;
    ar >> dwAwaked >> dwItem >> dwMat;

    CItemElem *pAwakened = pUser->m_Inventory.GetAtId(dwAwaked), *pItem = pUser->m_Inventory.GetAtId(dwItem),
        *pMat = (dwMat != NULL) ? pUser->m_Inventory.GetAtId(dwMat) : 0;

    if (!pAwakened || !pItem) { pUser->AddText("An Error Had occured with the Awake Transfer"); return; }
    if (pItem->GetProp()->dwParts != pAwakened->GetProp()->dwParts) {
        pUser->AddText("Both items need to be the same type");
        return;
    }
    if (g_xRandomOptionProperty->GetRandomOptionKind(pAwakened) != g_xRandomOptionProperty->GetRandomOptionKind(pItem)) {
        pUser->AddText("You are only allowed to transfer awakes of the same base type");
        return;
    }
    if (pItem->GetRandomOptItemId() & 0x0000FFFFFFFFFF00) { pUser->AddText("Cannot transfer to already awakened Item."); return; }

    if (pUser->m_Inventory.IsEquip(pItem->m_dwObjId) || pUser->m_Inventory.IsEquip(pAwakened->m_dwObjId))
    {
        Error("Attempt to Hack: %s : AwakeningTransfer StatStack", pUser->GetName());
        pUser->AddText("Please unequip the items");
        return;
    }

#ifdef __5LAWAKES
    if (pAwakened->GetRandomOptItemId() & 0x0000FFFFFFFFFF00)
#else
    if (pAwakened->GetRandomOptItemId() & 0x0FFFFFFFFFFFFF00)
#endif
    {
        static const int nCost = 1;
        if (nCost > pUser->GetGold()) { return; }
        pUser->AddGold(-nCost);

        //Chance
        if (xRandom(1000) < 1000)
        {
            if (dwMat != 0) { pUser->UpdateItem((BYTE)(pMat->m_dwObjId), UI_NUM, pMat->m_nItemNum - 1); }

            pItem->SetRandomOptItemId((pAwakened->GetRandomOptItemId() & 0x0000FFFFFFFFFF00) | pItem->GetRandomOptItemId());
            g_xRandomOptionProperty->InitializeRandomOption(pAwakened->GetRandomOptItemIdPtr());
            pUser->UpdateItemEx((BYTE)(pAwakened->m_dwObjId), UI_RANDOMOPTITEMID, pAwakened->GetRandomOptItemId());
            pUser->UpdateItemEx((BYTE)(pItem->m_dwObjId), UI_RANDOMOPTITEMID, pItem->GetRandomOptItemId());

#ifdef __5LAWAKES
            pItem->SetnAdjItemId(pAwakened->GetnAdjItemId());
            g_xRandomOptionProperty->ResetAdjs(pAwakened->GetnAdjItemIdPtr());
            pUser->UpdateItemEx((BYTE)(pAwakened->m_dwObjId), UI_ADJRANDOMOPT, pAwakened->GetnAdjItemId());
            pUser->UpdateItemEx((BYTE)(pItem->m_dwObjId), UI_ADJRANDOMOPT, pItem->GetnAdjItemId());
#endif
            pUser->AddText("Transfer Success!");
        }
        else
        {
            if (dwMat == 0)
            {
                g_xRandomOptionProperty->InitializeRandomOption(pAwakened->GetRandomOptItemIdPtr());
                pUser->UpdateItemEx((BYTE)(pAwakened->m_dwObjId), UI_RANDOMOPTITEMID, pAwakened->GetRandomOptItemId());
#ifdef __5LAWAKES
                g_xRandomOptionProperty->ResetAdjs(pAwakened->GetnAdjItemIdPtr());
                pUser->UpdateItemEx((BYTE)(pAwakened->m_dwObjId), UI_ADJRANDOMOPT, pAwakened->GetnAdjItemId());
#endif
                pUser->AddText("Transfer Failed! : You're Awakening has been destroyed");
            }
            else
            {
                pUser->UpdateItem((BYTE)(pMat->m_dwObjId), UI_NUM, pMat->m_nItemNum - 1);
                pUser->AddText("Transfer Failed! : You're Awakening has been saved");
            }
        }
    }
    else
    {
        Error("no awake %I64d", pAwakened->GetRandomOptItemId());
        pUser->AddText("Awakened item has no awake");
        return;
    }
}
#endif

do
Code:
CDPSrvr::CDPSrvr()

Code:
#ifdef __TRANSFER_AWAKE
    ON_MSG(PACKETTYPE_TRANSFERAWAKE, &CDPSrvr::OnSendTransferAwake);
#endif


RandomOption.inc (to Avoid error)
Code:
Awakening 0 0 0 0 100
Code:
Blessing 100 0 0 0 0
Code:
SystemPet 35 35 30 0 0
Code:
EatPet 100 0 0 0 0
#define __5LAWAKES in Client, Worldserver and Databaseserver
#define __TRANSFER_AWAKE in Client and WorldServer.

Default Awakening values are set in "SetValues" in RandomOption.cpp. You could change it to whatever or create a function to return the amount of awakenings with a random function on the RandomOption.inc numbers.


(ResData.inc). Has anyone sent it? APP_AWAKETRANSFER
 
Back
Top