DlgYou.cpp
资源名称:ROA3.40.rar [点击查看]
上传用户:tianheyiqi
上传日期:2010-04-16
资源大小:282k
文件大小:11k
源码类别:
外挂编程
开发平台:
Visual C++
- // DlgYou.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ROA.h"
- #include "DlgYou.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDlgYou dialog
- CDlgYou::CDlgYou(CWnd* pParent /*=NULL*/)
- : CDialog(CDlgYou::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDlgYou)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CDlgYou::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgYou)
- DDX_Control(pDX, IDC_LST_STATUS, m_lstStatus);
- DDX_Control(pDX, IDC_LST_BASE_STATUS, m_lstBase);
- DDX_Control(pDX, IDC_LST_INV_SKILL, m_lstSkills);
- DDX_Control(pDX, IDC_LST_INV_EQUIP, m_lstEquips);
- DDX_Control(pDX, IDC_LST_INV_ITEMS, m_lstItems);
- DDX_Control(pDX, IDC_TAB_SWITCH, m_tabSwitch);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CDlgYou, CDialog)
- //{{AFX_MSG_MAP(CDlgYou)
- ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_SWITCH, OnSelchangeTabSwitch)
- ON_WM_SIZE()
- ON_NOTIFY(NM_CLICK, IDC_LST_INV_ITEMS, OnClickLstInvItems)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgYou message handlers
- enum
- {
- eTabBaseStatus = 0,
- eTabStatus = 1,
- eTabItems = 2,
- eTabEquipments = 3,
- eTabSkills = 4
- };
- enum
- {
- eName,
- eJob,
- eLevel,
- eJobLevel,
- eHp,
- eSp,
- eExp,
- eJobExp,
- eZenny,
- eWeight,
- };
- BOOL CDlgYou::OnInitDialog()
- {
- CDialog::OnInitDialog();
- /*
- // TODO: Add extra initialization here
- m_tabSwitch.InsertItem(eTabBaseStatus, "Base Status");
- m_tabSwitch.InsertItem(eTabStatus, "Status");
- m_tabSwitch.InsertItem(eTabItems, "Items");
- m_tabSwitch.InsertItem(eTabEquipments, "Equipments");
- m_tabSwitch.InsertItem(eTabSkills, "Skills");
- m_lstBase.InsertColumn( 0, _T("Field"), LVCFMT_LEFT, 50 );
- m_lstBase.InsertColumn( 1, _T("Value"), LVCFMT_LEFT, 100);
- m_lstBase.InsertItem(eName, "Name");
- m_lstBase.InsertItem(eJob, "Job");
- m_lstBase.InsertItem(eLevel, "Base Level");
- m_lstBase.InsertItem(eJobLevel, "Job Level");
- m_lstBase.InsertItem(eHp, "HP/Max");
- m_lstBase.InsertItem(eSp, "SP/Max");
- m_lstBase.InsertItem(eExp, "Exp/Max");
- m_lstBase.InsertItem(eJobExp, "JobExp/Max");
- m_lstBase.InsertItem(eZenny, "Zenny");
- m_lstBase.InsertItem(eWeight, "Weight/Max");
- m_lstStatus.InsertColumn( 0, _T("Field"), LVCFMT_LEFT, 50 );
- m_lstStatus.InsertColumn( 1, _T("Value"), LVCFMT_LEFT, 100);
- m_lstItems.InsertColumn( 0, _T("Index"), LVCFMT_LEFT, 50 );
- m_lstItems.InsertColumn( 1, _T("Name"), LVCFMT_LEFT, 100);
- m_lstItems.InsertColumn( 2, _T("Amount"), LVCFMT_LEFT, 50 );
- m_lstItems.InsertColumn( 3, _T("Type"), LVCFMT_LEFT, 100 );
- m_lstEquips.InsertColumn( 0, _T("Index"), LVCFMT_LEFT, 50 );
- m_lstEquips.InsertColumn( 1, _T("Name"), LVCFMT_LEFT, 100);
- m_lstEquips.InsertColumn( 2, _T("Amount"), LVCFMT_LEFT, 50 );
- // m_lstEquips.InsertColumn( 3, _T("Type"), LVCFMT_LEFT, 100 );
- m_lstEquips.InsertColumn( 3, _T("Identified"), LVCFMT_LEFT, 50 );
- m_lstEquips.InsertColumn( 4, _T("EquipType"), LVCFMT_LEFT, 50 );
- m_lstEquips.InsertColumn( 5, _T("Equipped"), LVCFMT_LEFT, 50 );
- m_lstSkills.InsertColumn( 0, _T("Index"), LVCFMT_LEFT, 50 );
- m_lstSkills.InsertColumn( 1, _T("Name"), LVCFMT_LEFT, 100);
- m_lstSkills.InsertColumn( 2, _T("Level"), LVCFMT_LEFT, 50 );
- ListView_SetExtendedListViewStyleEx(m_lstBase.m_hWnd, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT, 0xFFFFFFFF);
- ListView_SetExtendedListViewStyleEx(m_lstStatus.m_hWnd, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT, 0xFFFFFFFF);
- ListView_SetExtendedListViewStyleEx(m_lstItems.m_hWnd, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT, 0xFFFFFFFF);
- ListView_SetExtendedListViewStyleEx(m_lstEquips.m_hWnd, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT, 0xFFFFFFFF);
- ListView_SetExtendedListViewStyleEx(m_lstSkills.m_hWnd, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT, 0xFFFFFFFF);
- OnSelchangeTabSwitch(NULL, NULL);
- */
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CDlgYou::OnSelchangeTabSwitch(NMHDR* pNMHDR, LRESULT* pResult)
- {
- int nIndex = m_tabSwitch.GetCurSel();
- m_lstBase.ShowWindow(nIndex == eTabBaseStatus ? SW_SHOWNORMAL:SW_HIDE);
- m_lstStatus.ShowWindow(nIndex == eTabStatus ? SW_SHOWNORMAL:SW_HIDE);
- m_lstItems.ShowWindow(nIndex == eTabItems ? SW_SHOWNORMAL:SW_HIDE);
- m_lstEquips.ShowWindow(nIndex == eTabEquipments ? SW_SHOWNORMAL:SW_HIDE);
- m_lstSkills.ShowWindow(nIndex == eTabSkills ? SW_SHOWNORMAL:SW_HIDE);
- switch(nIndex)
- {
- case eTabItems:
- case eTabEquipments:
- RefreshInventory();
- break;
- case eTabSkills:
- RefreshSkill();
- break;
- case eTabBaseStatus:
- RefreshBaseStatus();
- break;
- }
- if(pResult)
- *pResult = 0;
- }
- void CDlgYou::RefreshInventory()
- {
- /*
- if(eTabItems != m_tabSwitch.GetCurSel() && eTabEquipments != m_tabSwitch.GetCurSel())
- return;
- CString strValue;
- int nIndex;
- LVFINDINFO info;
- memset(&info, 0, sizeof(LVFINDINFO));
- info.flags = LVFI_STRING;
- for(int i=0; i<inventory.GetSize(); i++)
- {
- if((0 == inventory[i].wEquipType && eTabItems != m_tabSwitch.GetCurSel()) ||
- (0 != inventory[i].wEquipType && eTabEquipments != m_tabSwitch.GetCurSel()))
- continue;
- strValue.Format("%d", inventory[i].dwIndex);
- info.psz = strValue.LockBuffer();
- if(0 == inventory[i].wEquipType)
- {
- nIndex = m_lstItems.FindItem(&info);
- if(-1 == nIndex)
- {
- nIndex = m_lstItems.InsertItem(m_lstItems.GetItemCount(), strValue);
- }
- strValue.UnlockBuffer();
- strValue = mapItem.FindValue(inventory[i].dwId, eItemName);
- if(strValue != m_lstItems.GetItemText(i, 1))
- m_lstItems.SetItemText(nIndex, 1, strValue);
- strValue.Format("%d", inventory[i].wAmount);
- if(strValue != m_lstItems.GetItemText(i, 2))
- m_lstItems.SetItemText(nIndex, 2, strValue);
- strValue = mapItemType.FindValue(inventory[i].wType);
- if(strValue != m_lstItems.GetItemText(i, 3))
- m_lstItems.SetItemText(nIndex, 3, strValue);
- } else
- {
- nIndex = m_lstEquips.FindItem(&info);
- if(-1 == nIndex)
- {
- nIndex = m_lstEquips.InsertItem(m_lstEquips.GetItemCount(), strValue);
- }
- strValue.UnlockBuffer();
- strValue = mapItem.FindValue(inventory[i].dwId, eItemName);
- if(strValue != m_lstEquips.GetItemText(i, 1))
- m_lstEquips.SetItemText(nIndex, 1, strValue);
- strValue.Format("%d", inventory[i].wAmount);
- if(strValue != m_lstEquips.GetItemText(i, 2))
- m_lstEquips.SetItemText(nIndex, 2, strValue);
- // strValue = mapItem.FindValue(inventory[i].wType, eItemSlots);
- // if(strValue != m_lstEquips.GetItemText(i, 3))
- // m_lstEquips.SetItemText(nIndex, 3, strValue);
- strValue.Format("%s", (inventory[i].byIdentified!=0)?"Yes":"No");
- if(strValue != m_lstEquips.GetItemText(i, 3))
- m_lstEquips.SetItemText(nIndex, 3, strValue);
- strValue.Format("%s", mapEquipType.FindValue(inventory[i].wEquipType));
- if(strValue != m_lstEquips.GetItemText(i, 4))
- m_lstEquips.SetItemText(nIndex, 4, strValue);
- strValue.Format("%s", (inventory[i].byEquipped!=0)?"Yes":"No");
- if(strValue != m_lstEquips.GetItemText(i, 5))
- m_lstEquips.SetItemText(nIndex, 5, strValue);
- }
- }
- if(eTabItems == m_tabSwitch.GetCurSel())
- {
- for(i=0; i<m_lstItems.GetItemCount(); i++)
- {
- strValue = m_lstItems.GetItemText(i, 0);
- if(!strValue.IsEmpty() && -1 == inventory.FindIndex(atoi(strValue)))
- m_lstItems.DeleteItem(i);
- }
- m_lstItems.Invalidate();
- }
- if(eTabEquipments == m_tabSwitch.GetCurSel())
- {
- for(i=0; i<m_lstEquips.GetItemCount(); i++)
- {
- strValue = m_lstEquips.GetItemText(i, 0);
- if(!strValue.IsEmpty() && -1 == inventory.FindIndex(atoi(strValue)))
- m_lstEquips.DeleteItem(i);
- }
- m_lstEquips.Invalidate();
- }
- refreshReq.bInventory = false;
- */
- return;
- }
- void CDlgYou::OnSize(UINT nType, int cx, int cy)
- {
- // TODO: Add your message handler code here
- if(SIZE_RESTORED == nType && ::IsWindow(m_tabSwitch.m_hWnd))
- {
- CRect rect;
- GetClientRect(rect);
- m_tabSwitch.SetWindowPos(&wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
- m_tabSwitch.GetClientRect(rect);
- rect.DeflateRect(CSize(10, 10));
- rect.top += 10;
- m_lstBase.SetWindowPos(&wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
- m_lstStatus.SetWindowPos(&wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
- m_lstItems.SetWindowPos(&wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
- m_lstEquips.SetWindowPos(&wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
- m_lstSkills.SetWindowPos(&wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
- }
- CDialog::OnSize(nType, cx, cy);
- }
- void CDlgYou::RefreshSkill()
- {
- /*
- if(eTabSkills != m_tabSwitch.GetCurSel())
- return;
- CString strValue;
- LVFINDINFO info;
- int nIndex;
- int i;
- info.flags = LVFI_STRING;
- for(i=0; i<skills.GetSize(); i++)
- {
- strValue.Format("%d", skills[i].dwIndex);
- info.psz = strValue.LockBuffer();
- nIndex = m_lstSkills.FindItem(&info);
- if(-1 == nIndex)
- {
- nIndex = m_lstSkills.InsertItem(m_lstSkills.GetItemCount(), strValue);
- }
- strValue.UnlockBuffer();
- m_lstSkills.SetItemText(nIndex, 1, mapSkill.FindValue(skills[i].dwId, eSkillAlias));
- strValue.Format("%d", skills[i].wLevel);
- m_lstSkills.SetItemText(nIndex, 2, strValue);
- }
- for(i=0; i<m_lstSkills.GetItemCount(); i++)
- {
- strValue = m_lstSkills.GetItemText(i, 0);
- if(!strValue.IsEmpty() && -1 == skills.FindIndex(strValue))
- m_lstSkills.DeleteItem(i);
- }
- m_lstSkills.Invalidate();
- refreshReq.bSkill = false;
- */
- }
- void CDlgYou::RefreshBaseStatus()
- {
- /*
- if(eTabBaseStatus != m_tabSwitch.GetCurSel())
- return;
- CString strValue;
- m_lstBase.SetItemText(eName, 1, you.cName);
- m_lstBase.SetItemText(eJob, 1, you.cJob);
- strValue.Format("%d", you.wLevel);
- m_lstBase.SetItemText(eLevel, 1, strValue);
- strValue.Format("%d", you.wJobLevel);
- m_lstBase.SetItemText(eJobLevel, 1, strValue);
- strValue.Format("%d/%d (%0.1f%%)", you.wHp, you.wHpMax,
- (you.wHpMax==0) ? 0 : (double)you.wHp/you.wHpMax*100);
- m_lstBase.SetItemText(eHp, 1, strValue);
- strValue.Format("%d/%d (%0.1f%%)", you.wSp, you.wSpMax,
- (you.wSpMax==0) ? 0 : (double)you.wSp/you.wSpMax*100);
- m_lstBase.SetItemText(eSp, 1, strValue);
- strValue.Format("%d/%d (%0.3f%%)", you.dwExp, you.dwExpMax,
- (you.dwExpMax==0) ? 0 : (double)you.dwExp/you.dwExpMax*100);
- m_lstBase.SetItemText(eExp, 1, strValue);
- strValue.Format("%d/%d (%0.3f%%)", you.dwJobExp, you.dwJobExpMax,
- (you.dwJobExpMax==0) ? 0 : (double)you.dwJobExp/you.dwJobExpMax*100);
- m_lstBase.SetItemText(eJobExp, 1, strValue);
- strValue.Format("%d", you.dwZenny);
- m_lstBase.SetItemText(eZenny, 1, strValue);
- strValue.Format("%d/%d (%0.2f%%)", you.dwWeight/10, you.dwWeightMax/10,
- (you.dwWeightMax==0) ? 0 : (double)you.dwWeight/you.dwWeightMax);
- m_lstBase.SetItemText(eWeight, 1, strValue);
- m_lstBase.Invalidate();
- refreshReq.bYou = false;
- */
- }
- void CDlgYou::OnClickLstInvItems(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- *pResult = 0;
- }