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!

[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
Henlo i made this thing that teleports you. Thanks to ketchup and fenris for the help:thumbup:
Its taking all information from resource files:
-teleport16.inc
-teleport16.txt.txt

idk what happend to the quality ( watch in fullscreen )


Download for resource & pictures :

example :

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

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

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

                        if(pProp->dwItemKind1 == IK1_ARMOR && pProp->dwItemLV <= 105 && pProp->dwItemKind3 != IK3_SHIELD)
                            continue;

                        if(pProp->dwItemKind1 == IK1_WEAPON )
                        {
                            bool bValidWeapon = ( pProp->dwReferStat1 == WEAPON_UNIQUE|| pProp->IsUltimate()
#ifdef __NEW_ITEM_VARUNA
                                || pProp->IsBaruna()
#endif //__NEW_ITEM_VARUNA
                                );

                            if(!bValidWeapon)
                                continue;
                        }
                        //duplicates
                        if (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);
                    }
                }
            }
#endif //__SYS_TELE16
            }
            else 
            if( script.Token == "DropKind" )

insert this at the end of the file :
Code:
#ifdef __SYS_TELE16
void CProject::LoadTeleportInfo()
{
    CScript sFile;

    if (!sFile.Load( "teleport16.inc" ))
    {
        ADDERRORMSG("::LoadTeleportInfo() ~ teleport16.inc is missing.");
        return;
    }

    while (sFile.tok != FINISHED)
    {
        TeleportInfo tpData{};
#ifdef __WORLDSERVER
        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();
#elif defined(__CLIENT)
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();
        sFile.GetToken();

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

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

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

        if(tpData.dwMaxLevel < tpData.dwMinLevel)
            tpData.dwMaxLevel = MAX_CHARACTER_LEVEL;
#endif

        TPData.emplace_back(std::move(tpData));
    }
}
#endif //__SYS_TELE16

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

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

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

    m_pLocationList = (CWndListBox*)GetDlgItem(WIDC_LISTBOX);

    //droplist
    m_pWndDropList = new CWndDropList;
    m_pWndDropList->m_bVisible = false;
    m_pWndDropList->Create(WBS_VSCROLL, GetWndCtrl(WIDC_CUSTOM)->rect, this, 0);

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

    //default
    m_pLocationList->SetCurSel(0);
    m_nCursorIndex = m_pLocationList->GetCurSel();
    UpdateIndex();
    MoveParentCenter();
}
BOOL CWndTeleporter::OnChildNotify(UINT message, UINT nID, LRESULT *pLResult)
{
    if( nID == WIDC_LISTBOX )
    {
        if (m_pLocationList->GetCurSel() > -1 && m_pLocationList->GetCurSel() <= prj.TPData.size())
        {
            m_nCursorIndex = m_pLocationList->GetCurSel();
            UpdateIndex(m_nCursorIndex);
        }
    }
    else if( nID == WIDC_BUTTON )
    {
        g_DPlay.SendTeleport(m_nCursorIndex);
        Destroy();
    }
    return 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 ), 0xff000000 );

    if(pImage == NULL )
        pImage = m_textureMng.AddTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "tp_default.png" ), 0xff000000 );

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

    if(m_TeleportInfo.dwBossID)
    {
        MoverProp* pMoverProp = prj.m_pPropMover + m_TeleportInfo.dwBossID;

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

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

            if(m_TeleportInfo.dwMinLevel)
            {
                //eee idk
                switch(m_TeleportInfo.dwClassID)
                {
                    case 1: 
                        if(m_TeleportInfo.dwMaxLevel < MAX_GENERAL_LEVEL)
                            sprintf( szTemp, "Level Req.: %dM - %dM", m_TeleportInfo.dwMinLevel, m_TeleportInfo.dwMaxLevel); 
                        else if(m_TeleportInfo.dwMaxLevel > MAX_GENERAL_LEVEL)
                            sprintf( szTemp, "Level Req.: %dM - %dH", m_TeleportInfo.dwMinLevel, m_TeleportInfo.dwMaxLevel); 
                    break;
                    case 2: 
                        sprintf( szTemp, "Level Req.: %dH - %dH", m_TeleportInfo.dwMinLevel, m_TeleportInfo.dwMaxLevel); 
                    break;
                    default : 
                        if(m_TeleportInfo.dwMaxLevel > MAX_GENERAL_LEVEL)
                            sprintf( szTemp, "Level Req.: %d - %dH", m_TeleportInfo.dwMinLevel,m_TeleportInfo.dwMaxLevel); 
                        else
                            sprintf( szTemp, "Level Req.: %d - %d", m_TeleportInfo.dwMinLevel,m_TeleportInfo.dwMaxLevel); 
                    break;
                }
            }
            else
                sprintf(szTemp,"Level Cap: N/A");

            p2DRender->TextOut(m_defaultSize.Width() - 10 ,109, szTemp, 0xffffffff);    
            //Cooldown
            if(m_TeleportInfo.dwCoolDown)
            {
                if(m_TeleportInfo.dwCoolDown > 60)
                    sprintf( szTemp, "Cooldown: %d Minutes", m_TeleportInfo.dwCoolDown / 60);
                else
                    sprintf( szTemp, "Cooldown: %d Seconds", m_TeleportInfo.dwCoolDown);//lol
            }
            else
                sprintf( szTemp, "Cooldown: N/A" );

            p2DRender->TextOut(m_defaultSize.Width() - 10 ,129, szTemp, 0xffffffff);    
        }
    }
}
void CWndTeleporter::UpdateIndex(int 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;

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

    if ( pWndTeleporter->m_nCursorIndex < 0 || pWndTeleporter->m_nCursorIndex > prj.TPData.size())
        return;

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

    if(!tpData.dwBossID)
        return;

    int nRowItems = GetClientRect().Width() / nIconSize;
    m_wndScrollBar.SetScrollRange( 0, tpData.vDrops.size() / nRowItems );
    m_wndScrollBar.SetScrollPage( GetClientRect().Height() / nIconSize );

    for( int i = 0; i < tpData.vDrops.size(); i++ )
    {
        int x = i % nRowItems;
        int y = ( i / nRowItems ) - m_wndScrollBar.GetScrollPos();

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

        float fScale = static_cast<float>(nIconSize) / 35.0f;

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

        if( 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 + 0.1f, fScale + 0.1f);
        }
        else
            p2DRender->RenderTexture2(CPoint( x * nIconSize, y * nIconSize), pItemElem.GetTexture(), fScale, fScale);
    }
}
#endif //__SYS_TELE16
.h
Code:
#ifdef __SYS_TELE16
class CWndDropList : public CWndListBox
{
public:
    CWndDropList();
    ~CWndDropList();

    const int nIconSize = 30;
    virtual void OnDraw(C2DRender * p2DRender);
};
class CWndTeleporter : public CWndNeuz
{
private :
    CRect           m_defaultSize;
    TeleportInfo    m_TeleportInfo;
    CWndDropList*   m_pWndDropList;
    CWndListBox*    m_pLocationList;
public:
    int m_nCursorIndex;

    CWndTeleporter();
    ~CWndTeleporter();

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

DPSrvr.cpp
inside "CDPSrvr::CDPSrvr()" add:
Code:
#ifdef __SYS_TELE16
    ON_MSG(PACKETTYPE_TELE16, &CDPSrvr::OnTeleport);
#endif // __SYS_TELE16

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

    int nIndex;
    ar >> nIndex;

    if (nIndex >= prj.TPData.size() || nIndex < 0)
        return;

    if (IsValidObj(pUser) && (pWorld = pUser->GetWorld()))
    {
        if (pUser->IsDie() || pUser->IsCollecting() || pUser->m_vtInfo.VendorIsVendor() || pUser->m_vtInfo.IsVendorOpen())
            return;

        if (!pUser->IsAuthHigher(AUTH_GAMEMASTER))
        {   
            if(pUser->IsAttackMode() || pUser->GetWorld() && pUser->GetWorld()->GetID() == WI_WORLD_GUILDWAR)
            {
                pUser->AddText("Can't teleport while fighting.");
                return;
            }
        }

        auto teleportInfo = prj.TPData[nIndex];
        CWorld* pTargetWorld = g_WorldMng.GetWorld(teleportInfo.dwWorldID);

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



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 :thumbup:
 
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.

/*
DWORD dwWorldID; -> WI_WORLD_MADRIGAL
D3DXVECTOR3 vPos; -> (5731.7, 87.7 ,8161.8)
TCHAR szName[64]; -> IDS_TP_055 IDS_TP_055
TCHAR szDesc[512]; -> IDS_TP_055 IDS_TP_056
TCHAR szImage[64]; -> "tp_kalgas.png"
DWORD dwBossID; -> MI_KALGASBOSS
DWORD dwMinLevel; -> 135
DWORD dwMaxLevel; -> 0
DWORD dwClassID; -> 2 ( This is only ment for the dwMinLevel ( 0 = none, 1 = master, 2 = hero) )
DWORD dwCoolDown; -> 21600 ( cooldown in seconds)
*/
//and down here is how the resource file looks
WI_WORLD_MADRIGAL 5731.7 87.7 8161.8 IDS_TP_055 IDS_TP_056 "tp_kalgas.png" MI_KALGASBOSS 135 0 2 21600

And this is the error for me so far.

error - [RELEASE] reworked teleporter + drops - RaGEZONE Forums
Int16 - [RELEASE] reworked teleporter + drops - RaGEZONE Forums


probably because of this
Code : #define __SYS_TELE16 ( and dont forget to define the packet "PACKETTYPE_TELE16" )
Int16 - [RELEASE] reworked teleporter + drops - RaGEZONE Forums



 

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

theme-files-ss - [RELEASE] reworked teleporter + drops - RaGEZONE Forums

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
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.
did u add teleport16.inc & teleport16.txt.txt in resource.txt?
 
Back
Top