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
idk what happend to the quality ( watch in fullscreen )
Download for resource & pictures : https://drive.google.com/drive/folde...usp=share_link
example :
teleport16.inc
teleport16.txt.txtCode:/* DWORD dwWorldID; -> WI_WORLD_MADRIGAL D3DXVECTOR3 vPos; -> (5731.7, 87.7 ,8161.8) TCHAR szName[64]; -> IDS_TP_055 TCHAR szDesc[512]; -> 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
Code : #define __SYS_TELE16 ( and dont forget to define the packet "PACKETTYPE_TELE16" )Code:/*szName & szDesc defined*/ IDS_TP_055 [Instance] Kalgas Cave IDS_TP_056 To enter here is pure folly. It is believed that th......
Spoiler:
Project.cpp
Spoiler:
Search for "LoadMotionProp( "propMotion.txt" )"
add above
search for "if( script.Token == "DropItem" )"Code:#ifdef __SYS_TELE16 LoadTeleportInfo(); #endif //__SYS_TELE16 LoadMotionProp( "propMotion.txt" ); LoadPropMoverEx( "PropMoverEx.inc" );
scroll a bit down untill you see "di.dwNumber2 = 0;"
add below :
insert this at the end of the file :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" )
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
Spoiler:
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
Spoiler:
Inside "void CProject::LoadStrings()" add :
Code:#ifdef __SYS_TELE16 ,"teleport16.txt.txt" #endif //__SYS_TELE16
ProjectCmn.h
Spoiler:
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
Spoiler:
im sure you know where to past this:
Code:#ifdef __SYS_TELE16 DECLAREAPPLET( AppMain_WndTeleporter , new CWndTeleporter ); #endif //__SYS_TELE16Code:#ifdef __SYS_TELE16 AddAppletFunc( AppMain_WndTeleporter, APP_TELE16, _T("WndTeleporter"), _T("Icon_Motion.dds"), "Teleporter", 'V'); #endif //__SYS_TELE16
WndField.cpp/.h
Spoiler:
.cpp
.hCode:#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
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
Spoiler:
Add at the end of the file :
Code:#ifdef __SYS_TELE16 void CDPClient::SendTeleport(unsigned int nIndex) { BEFORESENDSOLE(ar, PACKETTYPE_TELE16, DPID_UNKNOWN); ar << nIndex; SEND(ar, this, DPID_SERVERPLAYER); } #endif //__SYS_TELE16
DPClient.h
Spoiler:
add at the end of the file
Code:#ifdef __SYS_TELE16 void SendTeleport(unsigned int nIndex); #endif //__SYS_TELE16
DPSrvr.cpp
Spoiler:
inside "CDPSrvr::CDPSrvr()" add:
at the end of the file add :Code:#ifdef __SYS_TELE16 ON_MSG(PACKETTYPE_TELE16, &CDPSrvr::OnTeleport); #endif // __SYS_TELE16
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; unsigned int nIndex; ar >> nIndex; if (nIndex >= prj.TPData.size()) 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; } } decltype(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
Spoiler:
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 };
resData.inc (also define it in resdata.h)
Spoiler:Code:APP_TELE16 "WndTile00.tga" "" 1 560 413 0x2410000 26 { // Title String "Teleporter" } { // ToolTip "" } { WTYPE_STATIC WIDC_STATIC "" 0 22 14 175 33 0x220000 0 0 0 0 246 204 77 { // Title String "Locations" } { // ToolTip "" } WTYPE_LISTBOX WIDC_LISTBOX "WndEditTile00.tga" 1 22 37 258 328 0x20020000 0 0 0 0 255 255 255 { // Title String "" } { // ToolTip "" } WTYPE_BUTTON WIDC_BUTTON "ButtNormal02.tga" 0 25 339 235 363 0x220010 0 0 0 0 0 0 0 { // Title String "Teleport" } { // ToolTip "" } WTYPE_TEXT WIDC_TEXT "WndEditTile00.tga" 1 276 231 526 363 0x20020000 0 0 0 0 255 255 255 { // Title String "" } { // ToolTip "" } WTYPE_STATIC WIDC_STATIC1 "" 0 276 17 515 196 0x260012 0 0 0 0 246 204 77 { // Title String "" } { // ToolTip "" } WTYPE_CUSTOM WIDC_CUSTOM "" 0 538 155 716 368 0x260000 0 0 0 0 46 112 169 { // Title String "" } { // ToolTip "" } }



Reply With Quote![[RELEASE] reworked teleporter + drops](http://ragezone.com/hyper728.png)


