• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[RELEASE] reworked teleporter + drops

Newbie Spellweaver
Joined
Oct 4, 2022
Messages
38
Reaction score
54
Henlo i made this thing that teleports you. Thanks to ketchup and fenris for the help
Its taking all information from resource files:
-teleport16.inc
-teleport16.txt.txt

DONT FORGET TO ADD THE BOTH RESOURCE FILES IN THE resource.txt BEFORE MERGING IT

idk what happend to the quality ( watch in fullscreen )

Download for resource & pictures :

example :

teleport16.inc
Code:
[COLOR=#008000]/*[/COLOR]
[COLOR=#008000]    DWORD dwWorldID;        -> WI_WORLD_MADRIGAL[/COLOR]
[COLOR=#008000]    D3DXVECTOR3 vPos;       -> (5731.7, 87.7 ,8161.8)[/COLOR]
[COLOR=#008000]    TCHAR   szName[64];     -> IDS_TP_055[/COLOR]
[COLOR=#008000]    TCHAR   szDesc[512];    -> IDS_TP_056[/COLOR]
[COLOR=#008000]    TCHAR   szImage[64];    -> "tp_kalgas.png"[/COLOR]
[COLOR=#008000]    DWORD dwBossID;         -> MI_KALGASBOSS[/COLOR]
[COLOR=#008000]    DWORD dwMinLevel;       -> 135[/COLOR]
[COLOR=#008000]    DWORD dwMaxLevel;       -> 0[/COLOR]
[COLOR=#008000]    DWORD dwClassID;        -> 2 ( This is only ment for the dwMinLevel ( 0 = none, 1 = master, 2 = hero) )[/COLOR]
[COLOR=#008000]    DWORD dwCoolDown;       -> 21600 ( cooldown in seconds)[/COLOR]
[COLOR=#008000]*/[/COLOR]
[COLOR=#008000]//and down here is how the resource file looks[/COLOR]
WI_WORLD_MADRIGAL [COLOR=#098658]5731.7[/COLOR] [COLOR=#098658]87.7[/COLOR] [COLOR=#098658]8161.8[/COLOR] IDS_TP_055 IDS_TP_056 [COLOR=#a31515]"tp_kalgas.png"[/COLOR] MI_KALGASBOSS [COLOR=#098658]135[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]2[/COLOR] [COLOR=#098658]21600[/COLOR]
teleport16.txt.txt
Code:
[COLOR=#008000]/*szName & szDesc defined*/[/COLOR]
IDS_TP_055      [Instance] Kalgas Cave
IDS_TP_056      To enter here [COLOR=#0000ff]is[/COLOR] pure folly. It [COLOR=#0000ff]is[/COLOR] believed that th......

Code :
#define __SYS_TELE16 ( and dont forget to define the packet "PACKETTYPE_TELE16" )
Project.cpp
Search for "LoadMotionProp( "propMotion.txt" )"
add above
Code:
#ifdef __SYS_TELE16
    LoadTeleportInfo();
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
    LoadMotionProp( [COLOR=#a31515]"propMotion.txt"[/COLOR] );
    LoadPropMoverEx( [COLOR=#a31515]"PropMoverEx.inc"[/COLOR] );

search for "if( script.Token == "DropItem" )"
scroll a bit down untill you see "di.dwNumber2 = 0;"
add below :
Code:
            [COLOR=#0000ff]if[/COLOR]( script.Token == [COLOR=#a31515]"DropItem"[/COLOR] )
            {
                DROPITEM di;
                memset( &di, [COLOR=#098658]0[/COLOR], sizeof(DROPITEM) );
                di.dtType = DROPTYPE_NORMAL;
                script.GetToken();  [COLOR=#008000]// ([/COLOR]
                di.dwIndex  = script.GetNumber();   [COLOR=#008000]// specific item index[/COLOR]
                [COLOR=#0000ff]if[/COLOR]( di.dwIndex == [COLOR=#098658]0[/COLOR] )
                    Error( [COLOR=#a31515]"%s : %s�� defineItem.h�� ���ǵ��� �ʾ���"[/COLOR], szFileName, script.token );
                ASSERT( di.dwIndex != [COLOR=#098658]0[/COLOR] );
                script.GetToken();  [COLOR=#008000]// ,[/COLOR]
                di.dwProbability    = script.GetNumber();   [COLOR=#008000]// probability[/COLOR]
                script.GetToken();  [COLOR=#008000]// ,[/COLOR]
                di.dwLevel  = script.GetNumber();   [COLOR=#008000]// level[/COLOR]
                script.GetToken();  [COLOR=#008000]// ,[/COLOR]
                di.dwNumber = script.GetNumber();   [COLOR=#008000]// number[/COLOR]
                script.GetToken();  [COLOR=#008000]// )[/COLOR]
[COLOR=#0000ff]#ifdef __WORLDSERVER[/COLOR]
                pProp->m_DropItemGenerator.AddTail( di, pProp->szName );    [COLOR=#008000]// copy[/COLOR]
[COLOR=#0000ff]#endif[/COLOR]
                di.dwNumber2 = [COLOR=#098658]0[/COLOR];

[COLOR=#0000ff]#if defined(__SYS_TELE16) [/COLOR]&&[COLOR=#0000ff] defined(__CLIENT)[/COLOR]
            [COLOR=#0000ff]for[/COLOR]([COLOR=#0000ff]int[/COLOR] i = [COLOR=#098658]0[/COLOR]; i < prj.TPData.size(); i++)
            {
                [COLOR=#0000ff]if[/COLOR](nVal == prj.TPData[i].dwBossID)
                {
                    [COLOR=#0000ff]if[/COLOR](ItemProp * pProp = prj.GetItemProp(di.dwIndex))
                    {
                        [COLOR=#0000ff]if[/COLOR](pProp->dwItemKind3 == IK3_EGG [COLOR=#008000]//eggers[/COLOR]
                        || pProp->dwItemKind3 == IK3_SMELT_GENERAL_MATERIAL [COLOR=#008000]//sunstone[/COLOR]
                        || pProp->dwItemKind3 == IK3_SMELT_ULTIMATE_MATERIAL [COLOR=#008000]//shini[/COLOR]
                        || pProp->dwItemKind3 == IK3_SMELT_ACCESSORY_MATERIAL [COLOR=#008000]//moonstone[/COLOR]
                        || pProp->dwItemKind3 == IK3_ULTIMATE [COLOR=#008000]//dias[/COLOR]
                        || pProp->dwItemKind3 == IK3_GEM [COLOR=#008000]//quest items[/COLOR]
                        || pProp->dwItemKind3 == IK3_ELECARD [COLOR=#008000]//element cards[/COLOR]
                        || pProp->dwItemKind2 == IK2_FOOD [COLOR=#008000]//food[/COLOR]
                        || pProp->dwItemKind2 == IK2_POTION [COLOR=#008000]//fp[/COLOR]
                        || pProp->dwItemKind2 == IK2_REFRESHER [COLOR=#008000]//mp[/COLOR]
[COLOR=#0000ff]#ifdef __NEW_ITEM_VARUNA[/COLOR]
                        || pProp->dwItemKind3 == IK3_BARUNAWEA_PIERCE_RUNE
                        || pProp->dwItemKind3 == IK3_OPERCID
                        || pProp->dwItemKind3 == IK3_CIDCRYSTAL
                        || pProp->dwItemKind3 == IK3_CIDMIX
                        || pProp->dwItemKind3 == IK3_CID
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__NEW_ITEM_VARUNA[/COLOR]
                        )
                            [COLOR=#0000ff]continue[/COLOR];

                        [COLOR=#0000ff]if[/COLOR](pProp->dwItemKind1 == IK1_ARMOR && pProp->dwItemLV <= [COLOR=#098658]105[/COLOR] && pProp->dwItemKind3 != IK3_SHIELD)
                            [COLOR=#0000ff]continue[/COLOR];

                        [COLOR=#0000ff]if[/COLOR](pProp->dwItemKind1 == IK1_WEAPON )
                        {
                            [COLOR=#0000ff]bool[/COLOR] bValidWeapon = ( pProp->dwReferStat1 == WEAPON_UNIQUE|| pProp->IsUltimate()
[COLOR=#0000ff]#ifdef __NEW_ITEM_VARUNA[/COLOR]
                                || pProp->IsBaruna()
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__NEW_ITEM_VARUNA[/COLOR]
                                );

                            [COLOR=#0000ff]if[/COLOR](!bValidWeapon)
                                [COLOR=#0000ff]continue[/COLOR];
                        }
                        [COLOR=#008000]//duplicates[/COLOR]
                        [COLOR=#0000ff]if[/COLOR] (find(prj.TPData[i].vDrops.begin(), prj.TPData[i].vDrops.end(), di.dwIndex) == prj.TPData[i].vDrops.end())
                            prj.TPData[i].vDrops.push_back(di.dwIndex);
                    }
                }
            }
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
            }
            [COLOR=#0000ff]else[/COLOR]
            [COLOR=#0000ff]if[/COLOR]( script.Token == [COLOR=#a31515]"DropKind"[/COLOR] )

insert this at the end of the file :
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
void CProject::LoadTeleportInfo()
{
    CScript sFile;

    [COLOR=#0000ff]if[/COLOR] (!sFile.Load( [COLOR=#a31515]"teleport16.inc"[/COLOR] ))
    {
        ADDERRORMSG([COLOR=#a31515]"::LoadTeleportInfo() ~ teleport16.inc is missing."[/COLOR]);
        [COLOR=#0000ff]return[/COLOR];
    }

    [COLOR=#0000ff]while[/COLOR] (sFile.tok != FINISHED)
    {
        TeleportInfo tpData{};
[COLOR=#0000ff]#ifdef __WORLDSERVER[/COLOR]
        tpData.dwWorldID = sFile.GetNumber();
        tpData.vPos.x = sFile.GetFloat();
        tpData.vPos.y = sFile.GetFloat();
        tpData.vPos.z = sFile.GetFloat();
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();
[COLOR=#0000ff]#elif defined(__CLIENT)[/COLOR]
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();

        sFile.GetToken();
        _tcsncpy(tpData.szName, sFile.token, sizeof(tpData.szName) / sizeof(tpData.szName[[COLOR=#098658]0[/COLOR]]) -[COLOR=#098658]2[/COLOR]);
        tpData.szName[sizeof(tpData.szName) / sizeof(tpData.szName[[COLOR=#098658]0[/COLOR]]) - [COLOR=#098658]1[/COLOR]] = [COLOR=#a31515]'\0'[/COLOR];

        sFile.GetToken();
        _tcsncpy(tpData.szDesc, sFile.token, sizeof(tpData.szDesc) / sizeof(tpData.szDesc[[COLOR=#098658]0[/COLOR]]) -[COLOR=#098658]2[/COLOR]);
        tpData.szDesc[sizeof(tpData.szDesc) / sizeof(tpData.szDesc[[COLOR=#098658]0[/COLOR]]) - [COLOR=#098658]1[/COLOR]] = [COLOR=#a31515]'\0'[/COLOR];

        sFile.GetToken();
        _tcsncpy(tpData.szImage, sFile.token, sizeof(tpData.szImage) / sizeof(tpData.szImage[[COLOR=#098658]0[/COLOR]]) -[COLOR=#098658]2[/COLOR]);
        tpData.szImage[sizeof(tpData.szImage) / sizeof(tpData.szImage[[COLOR=#098658]0[/COLOR]]) - [COLOR=#098658]1[/COLOR]] = [COLOR=#a31515]'\0'[/COLOR];
        
        tpData.dwBossID = sFile.GetNumber();
        tpData.dwMinLevel   = sFile.GetNumber();
        tpData.dwMaxLevel   = sFile.GetNumber();
        tpData.dwClassID = sFile.GetNumber();
        tpData.dwCoolDown = sFile.GetNumber();

        [COLOR=#0000ff]if[/COLOR](tpData.dwMaxLevel < tpData.dwMinLevel)
            tpData.dwMaxLevel = MAX_CHARACTER_LEVEL;
[COLOR=#0000ff]#endif[/COLOR]

        TPData.emplace_back(std::move(tpData));
    }
}
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]

Project.h
search for "const CString& GetQuestDestination( DWORD dwKey ) const;"
add below :
Code:
[COLOR=#0000ff]#if __VER >= 15 [/COLOR][COLOR=#008000]/* __IMPROVE_QUEST_INTERFACE */[/COLOR]&&[COLOR=#0000ff] defined( __CLIENT )[/COLOR]
    BOOL LoadQuestDestination( void );
    [COLOR=#0000ff]const[/COLOR] CString& GetQuestDestination( DWORD dwKey ) [COLOR=#0000ff]const[/COLOR];
    BOOL LoadPatrolDestination( void );
    [COLOR=#0000ff]const[/COLOR] CString& GetPatrolDestination( DWORD dwKey ) [COLOR=#0000ff]const[/COLOR];
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]// defined( __IMPROVE_QUEST_INTERFACE ) && defined( __CLIENT )[/COLOR]

[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
    [COLOR=#0000ff]using[/COLOR] TeleportData = std::vector<TeleportInfo>;
    TeleportData TPData;
    [COLOR=#0000ff]void[/COLOR] LoadTeleportInfo();
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
ProjectCmn.cpp
Inside "void CProject::LoadStrings()" add :
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
        ,[COLOR=#a31515]"teleport16.txt.txt"[/COLOR]
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
ProjectCmn.h
add the struct :
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
[COLOR=#0000ff]struct[/COLOR] TeleportInfo
{
[COLOR=#0000ff]#if defined(__WORLDSERVER)[/COLOR]
    DWORD dwWorldID;
    D3DXVECTOR3 vPos;
[COLOR=#0000ff]#elif defined(__CLIENT)[/COLOR]
    TCHAR   szName[64];
    TCHAR   szDesc[512];
    TCHAR   szImage[64];
    DWORD dwBossID;
    DWORD dwMinLevel;
    DWORD dwMaxLevel;
    DWORD dwClassID;
    DWORD dwCoolDown;
    vector<DWORD> vDrops;
[COLOR=#0000ff]#endif[/COLOR]
};
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
FuncApplet.cpp
im sure you know where to past this:
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
DECLAREAPPLET( AppMain_WndTeleporter , new CWndTeleporter  );
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]

Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
    AddAppletFunc( AppMain_WndTeleporter, APP_TELE16, _T([COLOR=#a31515]"WndTeleporter"[/COLOR]), _T([COLOR=#a31515]"Icon_Motion.dds"[/COLOR]), [COLOR=#a31515]"Teleporter"[/COLOR], [COLOR=#a31515]'V'[/COLOR]);
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
WndField.cpp/.h
.cpp
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
CWndTeleporter::CWndTeleporter()
{
    m_defaultSize = NULL;
    m_nCursorIndex = NULL;
    m_pWndDropList = nullptr;
    m_pLocationList = nullptr;
}
CWndTeleporter::~CWndTeleporter()
{
}
BOOL CWndTeleporter::Initialize(CWndBase *pWndParent, DWORD dwStyle)
{
    [COLOR=#0000ff]return[/COLOR] CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_TELE16, [COLOR=#098658]0[/COLOR], [COLOR=#098658]0[/COLOR], pWndParent );
}
void CWndTeleporter::OnInitialUpdate()
{
    CWndNeuz::OnInitialUpdate();
    m_defaultSize = GetClientRect();
    m_defaultSize.bottom += [COLOR=#098658]20[/COLOR]; [COLOR=#008000]//titlebar?[/COLOR]

    m_pLocationList = (CWndListBox*)GetDlgItem(WIDC_LISTBOX);

    [COLOR=#008000]//droplist[/COLOR]
    m_pWndDropList = new CWndDropList;
    m_pWndDropList->m_bVisible = [COLOR=#0000ff]false[/COLOR];
    m_pWndDropList->Create(WBS_VSCROLL, GetWndCtrl(WIDC_CUSTOM)->rect, [COLOR=#0000ff]this[/COLOR], [COLOR=#098658]0[/COLOR]);

    [COLOR=#0000ff]for[/COLOR] ([COLOR=#0000ff]int[/COLOR] i = [COLOR=#098658]0[/COLOR]; i < prj.TPData.size(); ++i)
    {
        [COLOR=#0000ff]if[/COLOR]( strlen(prj.TPData[i].szName) > [COLOR=#098658]0[/COLOR])
            m_pLocationList->AddString(prj.TPData[i].szName);
    }

    [COLOR=#008000]//default[/COLOR]
    m_pLocationList->SetCurSel([COLOR=#098658]0[/COLOR]);
    m_nCursorIndex = m_pLocationList->GetCurSel();
    UpdateIndex();
    MoveParentCenter();
}
BOOL CWndTeleporter::OnChildNotify(UINT message, UINT nID, LRESULT *pLResult)
{
    [COLOR=#0000ff]if[/COLOR]( nID == WIDC_LISTBOX )
    {
        [COLOR=#0000ff]if[/COLOR] (m_pLocationList->GetCurSel() > -[COLOR=#098658]1[/COLOR] && m_pLocationList->GetCurSel() <= prj.TPData.size())
        {
            m_nCursorIndex = m_pLocationList->GetCurSel();
            UpdateIndex(m_nCursorIndex);
        }
    }
    [COLOR=#0000ff]else[/COLOR] [COLOR=#0000ff]if[/COLOR]( nID == WIDC_BUTTON )
    {
        g_DPlay.SendTeleport(m_nCursorIndex);
        Destroy();
    }
    [COLOR=#0000ff]return[/COLOR] CWndNeuz::OnChildNotify(message,nID,pLResult);
}
void CWndTeleporter::OnDraw( C2DRender* p2DRender )
{
    CTexture* pImage = m_textureMng.AddTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, m_TeleportInfo.szImage ), [COLOR=#098658]0xff000000[/COLOR] );

    [COLOR=#0000ff]if[/COLOR](pImage == NULL )
        pImage = m_textureMng.AddTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, [COLOR=#a31515]"tp_default.png"[/COLOR] ), [COLOR=#098658]0xff000000[/COLOR] );

    LPWNDCTRL lpWndCtrl = GetWndCtrl( WIDC_STATIC1 );
    POINT pt = lpWndCtrl->rect.TopLeft();
    pt.y += [COLOR=#098658]20[/COLOR];
    pImage->Render( p2DRender, pt, g_Option.m_nWindowAlpha );

    [COLOR=#0000ff]if[/COLOR](m_TeleportInfo.dwBossID)
    {
        MoverProp* pMoverProp = prj.m_pPropMover + m_TeleportInfo.dwBossID;

        [COLOR=#0000ff]if[/COLOR](pMoverProp)
        {
            TCHAR   szTemp[[COLOR=#098658]128[/COLOR]];
            [COLOR=#008000]//Name[/COLOR]
            p2DRender->TextOut(m_defaultSize.Width() - [COLOR=#098658]10[/COLOR]  ,[COLOR=#098658]19[/COLOR], pMoverProp->szName, [COLOR=#098658]0xfff6cc4d[/COLOR]);
            [COLOR=#008000]//Level[/COLOR]
            sprintf( szTemp, [COLOR=#a31515]"Level:  %d"[/COLOR], pMoverProp->dwLevel);
            p2DRender->TextOut(m_defaultSize.Width() - [COLOR=#098658]10[/COLOR] ,[COLOR=#098658]49[/COLOR], szTemp, [COLOR=#098658]0xffffffff[/COLOR]);
            [COLOR=#008000]//HP[/COLOR]
            [COLOR=#0000ff]int[/COLOR] nNewHealth = pMoverProp->dwAddHp;

            [COLOR=#0000ff]if[/COLOR] (nNewHealth >= [COLOR=#098658]1000000000[/COLOR])
                sprintf( szTemp, [COLOR=#a31515]"Health:  %d B"[/COLOR], nNewHealth / [COLOR=#098658]1000000000[/COLOR]);
            [COLOR=#0000ff]else[/COLOR] [COLOR=#0000ff]if[/COLOR] (nNewHealth >= [COLOR=#098658]1000000[/COLOR])
                sprintf( szTemp, [COLOR=#a31515]"Health:  %d M"[/COLOR], nNewHealth / [COLOR=#098658]1000000[/COLOR]);
            [COLOR=#0000ff]else[/COLOR] [COLOR=#0000ff]if[/COLOR] (nNewHealth >= [COLOR=#098658]1000[/COLOR])
                sprintf( szTemp, [COLOR=#a31515]"Health:  %d K"[/COLOR], nNewHealth / [COLOR=#098658]1000[/COLOR]);
                
            p2DRender->TextOut(m_defaultSize.Width() - [COLOR=#098658]10[/COLOR] ,[COLOR=#098658]69[/COLOR], szTemp, [COLOR=#098658]0xffffffff[/COLOR]);
            [COLOR=#008000]//Element[/COLOR]
            [COLOR=#0000ff]if[/COLOR] ( pMoverProp->eElementType )
            {
                g_WndMng.m_pWndWorld->m_texAttrIcon.Render(p2DRender, CPoint(m_defaultSize.Width() + [COLOR=#098658]55[/COLOR], [COLOR=#098658]87[/COLOR]), pMoverProp->eElementType - [COLOR=#098658]1[/COLOR], [COLOR=#098658]255[/COLOR], [COLOR=#098658]1.2f[/COLOR], [COLOR=#098658]1.2f[/COLOR]);
                p2DRender->TextOut(m_defaultSize.Width() - [COLOR=#098658]10[/COLOR] ,[COLOR=#098658]89[/COLOR], [COLOR=#a31515]"Element: "[/COLOR], [COLOR=#098658]0xffffffff[/COLOR]);
            }
            [COLOR=#0000ff]else[/COLOR]
                p2DRender->TextOut(m_defaultSize.Width() - [COLOR=#098658]10[/COLOR] ,[COLOR=#098658]89[/COLOR], [COLOR=#a31515]"Element: N/A"[/COLOR], [COLOR=#098658]0xffffffff[/COLOR]);

            [COLOR=#0000ff]if[/COLOR](m_TeleportInfo.dwMinLevel)
            {
                [COLOR=#008000]//eee idk[/COLOR]
                [COLOR=#0000ff]switch[/COLOR](m_TeleportInfo.dwClassID)
                {
                    [COLOR=#0000ff]case[/COLOR] [COLOR=#098658]1[/COLOR]:
                        [COLOR=#0000ff]if[/COLOR](m_TeleportInfo.dwMaxLevel < MAX_GENERAL_LEVEL)
                            sprintf( szTemp, [COLOR=#a31515]"Level Req.: %dM - %dM"[/COLOR], m_TeleportInfo.dwMinLevel, m_TeleportInfo.dwMaxLevel);
                        [COLOR=#0000ff]else[/COLOR] [COLOR=#0000ff]if[/COLOR](m_TeleportInfo.dwMaxLevel > MAX_GENERAL_LEVEL)
                            sprintf( szTemp, [COLOR=#a31515]"Level Req.: %dM - %dH"[/COLOR], m_TeleportInfo.dwMinLevel, m_TeleportInfo.dwMaxLevel);
                    [COLOR=#0000ff]break[/COLOR];
                    [COLOR=#0000ff]case[/COLOR] [COLOR=#098658]2[/COLOR]:
                        sprintf( szTemp, [COLOR=#a31515]"Level Req.: %dH - %dH"[/COLOR], m_TeleportInfo.dwMinLevel, m_TeleportInfo.dwMaxLevel);
                    [COLOR=#0000ff]break[/COLOR];
                    [COLOR=#0000ff]default[/COLOR] :
                        [COLOR=#0000ff]if[/COLOR](m_TeleportInfo.dwMaxLevel > MAX_GENERAL_LEVEL)
                            sprintf( szTemp, [COLOR=#a31515]"Level Req.: %d - %dH"[/COLOR], m_TeleportInfo.dwMinLevel,m_TeleportInfo.dwMaxLevel);
                        [COLOR=#0000ff]else[/COLOR]
                            sprintf( szTemp, [COLOR=#a31515]"Level Req.: %d - %d"[/COLOR], m_TeleportInfo.dwMinLevel,m_TeleportInfo.dwMaxLevel);
                    [COLOR=#0000ff]break[/COLOR];
                }
            }
            [COLOR=#0000ff]else[/COLOR]
                sprintf(szTemp,[COLOR=#a31515]"Level Cap: N/A"[/COLOR]);

            p2DRender->TextOut(m_defaultSize.Width() - [COLOR=#098658]10[/COLOR] ,[COLOR=#098658]109[/COLOR], szTemp, [COLOR=#098658]0xffffffff[/COLOR]);    
            [COLOR=#008000]//Cooldown[/COLOR]
            [COLOR=#0000ff]if[/COLOR](m_TeleportInfo.dwCoolDown)
            {
                [COLOR=#0000ff]if[/COLOR](m_TeleportInfo.dwCoolDown > [COLOR=#098658]60[/COLOR])
                    sprintf( szTemp, [COLOR=#a31515]"Cooldown: %d Minutes"[/COLOR], m_TeleportInfo.dwCoolDown / [COLOR=#098658]60[/COLOR]);
                [COLOR=#0000ff]else[/COLOR]
                    sprintf( szTemp, [COLOR=#a31515]"Cooldown: %d Seconds"[/COLOR], m_TeleportInfo.dwCoolDown);[COLOR=#008000]//lol[/COLOR]
            }
            [COLOR=#0000ff]else[/COLOR]
                sprintf( szTemp, [COLOR=#a31515]"Cooldown: N/A"[/COLOR] );

            p2DRender->TextOut(m_defaultSize.Width() - [COLOR=#098658]10[/COLOR] ,[COLOR=#098658]129[/COLOR], szTemp, [COLOR=#098658]0xffffffff[/COLOR]);    
        }
    }
}
void CWndTeleporter::UpdateIndex([COLOR=#0000ff]int[/COLOR] nIndex)
{
    m_TeleportInfo = prj.TPData[nIndex];

    CWndText* pLocationDesc = (CWndText*)GetDlgItem(WIDC_TEXT);
    pLocationDesc->SetString(m_TeleportInfo.szDesc);

    CWndStatic* pPictureBox = (CWndStatic*)GetDlgItem(WIDC_STATIC1);
    pPictureBox->m_strTitle = m_TeleportInfo.szName;

    [COLOR=#0000ff]if[/COLOR](m_TeleportInfo.dwBossID)
    {
        m_pWndDropList->m_bVisible = [COLOR=#0000ff]true[/COLOR];
        m_pWndDropList->m_wndScrollBar.SetScrollPos([COLOR=#098658]0[/COLOR]);
        SetWndSize(m_defaultSize.Width() + [COLOR=#098658]190[/COLOR], m_defaultSize.Height());
    }
    [COLOR=#0000ff]else[/COLOR]
    {
        m_pWndDropList->m_bVisible = [COLOR=#0000ff]false[/COLOR];
        SetWndSize(m_defaultSize.Width(), m_defaultSize.Height());
    }
}
CWndDropList::CWndDropList()
{
}
CWndDropList::~CWndDropList()
{
}
void CWndDropList::OnDraw(C2DRender * p2DRender)
{
    CWndTeleporter * pWndTeleporter = (CWndTeleporter*)GetParentWnd();

    [COLOR=#0000ff]if[/COLOR] ( pWndTeleporter->m_nCursorIndex < [COLOR=#098658]0[/COLOR] || pWndTeleporter->m_nCursorIndex > prj.TPData.size())
        [COLOR=#0000ff]return[/COLOR];

    auto tpData = prj.TPData[pWndTeleporter->m_nCursorIndex];

    [COLOR=#0000ff]if[/COLOR](!tpData.dwBossID)
        [COLOR=#0000ff]return[/COLOR];

    [COLOR=#0000ff]int[/COLOR] nRowItems = GetClientRect().Width() / nIconSize;
    m_wndScrollBar.SetScrollRange( [COLOR=#098658]0[/COLOR], tpData.vDrops.size() / nRowItems );
    m_wndScrollBar.SetScrollPage( GetClientRect().Height() / nIconSize );

    [COLOR=#0000ff]for[/COLOR]( [COLOR=#0000ff]int[/COLOR] i = [COLOR=#098658]0[/COLOR]; i < tpData.vDrops.size(); i++ )
    {
        [COLOR=#0000ff]int[/COLOR] x = i % nRowItems;
        [COLOR=#0000ff]int[/COLOR] y = ( i / nRowItems ) - m_wndScrollBar.GetScrollPos();

        CItemElem pItemElem;
        pItemElem.m_dwItemId = tpData.vDrops.at(i);
        pItemElem.SetTexture();

        [COLOR=#0000ff]float[/COLOR] fScale = static_cast<[COLOR=#0000ff]float[/COLOR]>(nIconSize) / [COLOR=#098658]35.0f[/COLOR];

        CRect rectHittest = CRect( x * nIconSize, y * nIconSize, x * nIconSize + nIconSize, y * nIconSize + nIconSize);
        CPoint point = GetMousePoint();

        [COLOR=#0000ff]if[/COLOR]( rectHittest.PtInRect( point ) )
        {
            CPoint point2 = point;
            ClientToScreen( &point2 );
            ClientToScreen( &rectHittest );

            g_WndMng.PutToolTip_Item( &pItemElem, point2, &rectHittest );
            p2DRender->RenderTexture2(CPoint( x * nIconSize, y * nIconSize), pItemElem.GetTexture(), fScale + [COLOR=#098658]0.1f[/COLOR], fScale + [COLOR=#098658]0.1f[/COLOR]);
        }
        [COLOR=#0000ff]else[/COLOR]
            p2DRender->RenderTexture2(CPoint( x * nIconSize, y * nIconSize), pItemElem.GetTexture(), fScale, fScale);
    }
}
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
.h
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
[COLOR=#0000ff]class[/COLOR] CWndDropList : public CWndListBox
{
[COLOR=#0000ff]public[/COLOR]:
    CWndDropList();
    ~CWndDropList();

    [COLOR=#0000ff]const[/COLOR] [COLOR=#0000ff]int[/COLOR] nIconSize = [COLOR=#098658]30[/COLOR];
    [COLOR=#0000ff]virtual[/COLOR] [COLOR=#0000ff]void[/COLOR] OnDraw(C2DRender * p2DRender);
};
[COLOR=#0000ff]class[/COLOR] CWndTeleporter : public CWndNeuz
{
[COLOR=#0000ff]private[/COLOR] :
    CRect           m_defaultSize;
    TeleportInfo    m_TeleportInfo;
    CWndDropList*   m_pWndDropList;
    CWndListBox*    m_pLocationList;
[COLOR=#0000ff]public[/COLOR]:
    [COLOR=#0000ff]int[/COLOR] m_nCursorIndex;

    CWndTeleporter();
    ~CWndTeleporter();

    [COLOR=#0000ff]virtual[/COLOR] BOOL Initialize(CWndBase *pWndParent = nullptr, DWORD dwStyle = [COLOR=#098658]0[/COLOR]);
    [COLOR=#0000ff]virtual[/COLOR] [COLOR=#0000ff]void[/COLOR] OnInitialUpdate();
    [COLOR=#0000ff]virtual[/COLOR] void CWndTeleporter::OnDraw( C2DRender* p2DRender );
    [COLOR=#0000ff]virtual[/COLOR] BOOL OnChildNotify(UINT message, UINT nID, LRESULT *pLResult);
    [COLOR=#0000ff]void[/COLOR] UpdateIndex([COLOR=#0000ff]int[/COLOR] nIndex = [COLOR=#098658]0[/COLOR]);
};
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
DPClient.cpp
Add at the end of the file :
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
void CDPClient::SendTeleport(unsigned [COLOR=#0000ff]int[/COLOR] nIndex)
{
    BEFORESENDSOLE(ar, PACKETTYPE_TELE16, DPID_UNKNOWN);
    ar << nIndex;
    SEND(ar, [COLOR=#0000ff]this[/COLOR], DPID_SERVERPLAYER);
}
[COLOR=#0000ff]#endif  [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
DPClient.h
add at the end of the file
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
    [COLOR=#0000ff]void[/COLOR]    SendTeleport(unsigned int nIndex);
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]

DPSrvr.cpp
inside "CDPSrvr::CDPSrvr()" add:
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
    ON_MSG(PACKETTYPE_TELE16, &CDPSrvr::OnTeleport);
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]// __SYS_TELE16[/COLOR]

at the end of the file add :
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
void CDPSrvr::OnTeleport(CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE, u_long)
{
    CUser* pUser = g_UserMng.GetUser(dpidCache, dpidUser);
    CWorld* pWorld;

    unsigned [COLOR=#0000ff]int[/COLOR] nIndex;
    ar >> nIndex;

    [COLOR=#0000ff]if[/COLOR] (nIndex >= prj.TPData.size())
        [COLOR=#0000ff]return[/COLOR];

    [COLOR=#0000ff]if[/COLOR] (IsValidObj(pUser) && (pWorld = pUser->GetWorld()))
    {
        [COLOR=#0000ff]if[/COLOR] (pUser->IsDie() || pUser->IsCollecting() || pUser->m_vtInfo.VendorIsVendor() || pUser->m_vtInfo.IsVendorOpen())
            [COLOR=#0000ff]return[/COLOR];

        [COLOR=#0000ff]if[/COLOR] (!pUser->IsAuthHigher(AUTH_GAMEMASTER))
        {  
            [COLOR=#0000ff]if[/COLOR](pUser->IsAttackMode() || pUser->GetWorld() && pUser->GetWorld()->GetID() == WI_WORLD_GUILDWAR)
            {
                pUser->AddText([COLOR=#a31515]"Can't teleport while fighting."[/COLOR]);
                [COLOR=#0000ff]return[/COLOR];
            }
        }
        decltype(auto) teleportInfo = prj.TPData[nIndex];
        CWorld* pTargetWorld = g_WorldMng.GetWorld(teleportInfo.dwWorldID);

        [COLOR=#0000ff]if[/COLOR](!pTargetWorld)
        {
            Error([COLOR=#a31515]"CDPSrvr::OnTeleport() - WorldID : %d, Name = %s"[/COLOR], teleportInfo.dwWorldID, pUser->GetName());
            [COLOR=#0000ff]return[/COLOR];
        }
        pUser->REPLACE(g_uIdofMulti, teleportInfo.dwWorldID, teleportInfo.vPos, REPLACE_NORMAL, nDefaultLayer);
    }
}
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]//__SYS_TELE16[/COLOR]
DPSrvr.h
at the end of the file add :
Code:
[COLOR=#0000ff]#ifdef __SYS_TELE16[/COLOR]
    [COLOR=#0000ff]void[/COLOR]    OnTeleport(CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE, u_long);
[COLOR=#0000ff]#endif [/COLOR][COLOR=#008000]// __SYS_TELE16[/COLOR]
[COLOR=#0000ff]private[/COLOR]:
    DPID    m_dpidCache;        [COLOR=#008000]// ij������ DPID[/COLOR]
};

resData.inc (
also define it in resdata.h)
Code:
APP_TELE16 [COLOR=#a31515]"WndTile00.tga"[/COLOR] [COLOR=#a31515]""[/COLOR] [COLOR=#098658]1[/COLOR] [COLOR=#098658]560[/COLOR] [COLOR=#098658]413[/COLOR] [COLOR=#098658]0x2410000[/COLOR] [COLOR=#098658]26[/COLOR]
{
[COLOR=#008000]// Title String[/COLOR]
[COLOR=#a31515]"Teleporter"[/COLOR]
}
{
[COLOR=#008000]// ToolTip[/COLOR]
[COLOR=#a31515]""[/COLOR]
}
{
    WTYPE_STATIC WIDC_STATIC [COLOR=#a31515]""[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]22[/COLOR] [COLOR=#098658]14[/COLOR] [COLOR=#098658]175[/COLOR] [COLOR=#098658]33[/COLOR] [COLOR=#098658]0x220000[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]246[/COLOR] [COLOR=#098658]204[/COLOR] [COLOR=#098658]77[/COLOR]
    {
   [COLOR=#008000]// Title String[/COLOR]
    [COLOR=#a31515]"Locations"[/COLOR]
    }
    {
   [COLOR=#008000]// ToolTip[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
    WTYPE_LISTBOX WIDC_LISTBOX [COLOR=#a31515]"WndEditTile00.tga"[/COLOR] [COLOR=#098658]1[/COLOR] [COLOR=#098658]22[/COLOR] [COLOR=#098658]37[/COLOR] [COLOR=#098658]258[/COLOR] [COLOR=#098658]328[/COLOR] [COLOR=#098658]0x20020000[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]255[/COLOR] [COLOR=#098658]255[/COLOR] [COLOR=#098658]255[/COLOR]
    {
   [COLOR=#008000]// Title String[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
    {
   [COLOR=#008000]// ToolTip[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
    WTYPE_BUTTON WIDC_BUTTON [COLOR=#a31515]"ButtNormal02.tga"[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]25[/COLOR] [COLOR=#098658]339[/COLOR] [COLOR=#098658]235[/COLOR] [COLOR=#098658]363[/COLOR] [COLOR=#098658]0x220010[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR]
    {
   [COLOR=#008000]// Title String[/COLOR]
    [COLOR=#a31515]"Teleport"[/COLOR]
    }
    {
   [COLOR=#008000]// ToolTip[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
    WTYPE_TEXT WIDC_TEXT [COLOR=#a31515]"WndEditTile00.tga"[/COLOR] [COLOR=#098658]1[/COLOR] [COLOR=#098658]276[/COLOR] [COLOR=#098658]231[/COLOR] [COLOR=#098658]526[/COLOR] [COLOR=#098658]363[/COLOR] [COLOR=#098658]0x20020000[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]255[/COLOR] [COLOR=#098658]255[/COLOR] [COLOR=#098658]255[/COLOR]
    {
   [COLOR=#008000]// Title String[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
    {
   [COLOR=#008000]// ToolTip[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
    WTYPE_STATIC WIDC_STATIC1 [COLOR=#a31515]""[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]276[/COLOR] [COLOR=#098658]17[/COLOR] [COLOR=#098658]515[/COLOR] [COLOR=#098658]196[/COLOR] [COLOR=#098658]0x260012[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]246[/COLOR] [COLOR=#098658]204[/COLOR] [COLOR=#098658]77[/COLOR]
    {
   [COLOR=#008000]// Title String[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
    {
   [COLOR=#008000]// ToolTip[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
    WTYPE_CUSTOM WIDC_CUSTOM [COLOR=#a31515]""[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]538[/COLOR] [COLOR=#098658]155[/COLOR] [COLOR=#098658]716[/COLOR] [COLOR=#098658]368[/COLOR] [COLOR=#098658]0x260000[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]0[/COLOR] [COLOR=#098658]46[/COLOR] [COLOR=#098658]112[/COLOR] [COLOR=#098658]169[/COLOR]
    {
   [COLOR=#008000]// Title String[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
    {
   [COLOR=#008000]// ToolTip[/COLOR]
    [COLOR=#a31515]""[/COLOR]
    }
}

 
Last edited:
Inactive
Joined
Jan 20, 2009
Messages
1,014
Reaction score
1,830

I won't use this and it's nothing against you, i just don't need it personally.

I do want to say ty for trying and eventully releasing. If only this community had more people like you then maybe it would prosper better.

Thanks for your contribution
 
Newbie Spellweaver
Joined
Oct 4, 2022
Messages
38
Reaction score
54
Yea i know it not something big and they're already alot of teleporters out there my main goal was just to practice and who knows maybe some people find use for it
 
Inactive
Joined
Jan 20, 2009
Messages
1,014
Reaction score
1,830
Yea i know it not something big and they're already alot of teleporters out there my main goal was just to practice and who knows maybe some people find use for it

This scene really needs more people like you.
 
Experienced Elementalist
Joined
Jan 7, 2020
Messages
257
Reaction score
97
Good job and great release man, Thank you for your contribution.
 
Newbie Spellweaver
Joined
Sep 8, 2011
Messages
67
Reaction score
252
Good job, and nice release.


I would like to point out that auto doesn't deduce references, so you are creating copies of your struct. A change would be to add the reference and make it const or to just use decltype.

Code:
auto teleportInfo = prj.TPData[nIndex]; //copy
const auto& teleportInfo = prj.TPData[nIndex]; // const reference
decltype(auto) teleportInfo = prj.TPData[nIndex];  // reference because operator[] returns reference.

Another thing is, you can send an unsigned integer from the client to the server and read it as an unsigned integer, (or just read it as one as it shouldn't matter sending it as its the same data size) then you would be able to remove the index < 0 check in the dpsrvr function because any negative number would be overflowed on conversion to be > TPData.size()
 
Newbie Spellweaver
Joined
Oct 18, 2020
Messages
6
Reaction score
0
Thank you for this <3 I want to add something like a required scroll to this teleportation system. I just wondering if where I can add it.
 
Newbie Spellweaver
Joined
Oct 4, 2022
Messages
38
Reaction score
54
A simple execution for this in the DPsrvr.cpp part you could check if the player has the specific item and remove it from the inventory if the teleport was successful
 
Newbie Spellweaver
Joined
Oct 4, 2022
Messages
38
Reaction score
54
The startup hotkey is that
You mean which button to open the window ?

Code:
...... [COLOR=#000000]_T("WndTeleporter"), _T("Icon_Motion.dds"), "Teleporter", 'V');
[/COLOR]
 
Newbie Spellweaver
Joined
Mar 8, 2020
Messages
29
Reaction score
8
Thank you for your efforts and let me marvel at this release!
 
Newbie Spellweaver
Joined
Dec 6, 2022
Messages
17
Reaction score
2
Hello, sorry to bump this thread, I would like to ask where to define this two below?

Code :
#define __SYS_TELE16 ( and dont forget to define the packet "PACKETTYPE_TELE16" )

also in this part

is it always WI_WORLD_MADRIGAL whatever the map is?
how about MI_KALGASBOSS is it also always MI_KALGASBOSS? or is there a list about it because I'm not sure what to put if for example it is Flaris, Saint Morning, Darkon, [Instance] Aminus, [Instance] Clockworks, etc.


And this is the error for me so far.




probably because of this
Code : #define __SYS_TELE16 ( and dont forget to define the packet "PACKETTYPE_TELE16" )



 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Jan 8, 2023
Messages
14
Reaction score
1
Hey,
Thank you for your effort.

Im a little bit Stuck.

I implemented it to the k18.3 files with no errors and compiled succesfully.

But when i try to open it ingame my Client crashes.

Couldnt find any error message.

I put the resource Files in my Server/Rescours Folder.

Maybe you are able to tell me what ive done wrong.

Thank you

Edit: I didnt had the WIDC-BUTTON/LISTBOX/COMMON define. I found some but not exactly that one. So i defined them and gave them a unique number.
 
Last edited:
Inactive
Joined
Jan 20, 2009
Messages
1,014
Reaction score
1,830
@ragezonepotato the SendTeleport error via screenshot is a clear indicator you did not add it to DPClient.h and(or) DPClient.cpp in your Neuz project. If you read it it tells you exactly what the problem is lol. Packets are defined in _Network/msghdr.h

LearningIsGood Make sure you have carried the ResData.h from your source to your server resource and make new res files using merge.
 
Newbie Spellweaver
Joined
Dec 6, 2022
Messages
17
Reaction score
2
Can you see my files and see what's wrong, I tried it to check one by one and I think I copy all of it

also I added this on both Neuz and WorldServer in VersionCommon.h
Code:
#define __SYS_TELE16 //by Sir Int16

this is the ss of my theme folder that I already added the images



Attached files:

View attachment Files.zip
 

Attachments

You must be registered for see attachments list
Junior Spellweaver
Joined
Sep 29, 2021
Messages
133
Reaction score
26
did u add teleport16.inc & teleport16.txt.txt in resource.txt?