[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]