KItemChangeRes.cpp
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:2k
- //---------------------------------------------------------------------------
- // Sword3 Core (c) 2002 by Kingsoft
- //
- // File: KItemChangeRes.h
- // Date: 2002.12
- // Code: Spe
- // Desc: Header File
- //---------------------------------------------------------------------------
- #include "KCore.h"
- #include "KEngine.h"
- #include "KItemChangeRes.h"
- #include "KItem.h"
- #include "CoreUseNameDef.h"
- KItemChangeRes g_ItemChangeRes;
- BOOL KItemChangeRes::Init()
- {
- if (!m_MeleeWeapon.Load(CHANGERES_MELEE_FILE))
- return FALSE;
- if (!m_RangeWeapon.Load(CHANGERES_RANGE_FILE))
- return FALSE;
- if (!m_Armor.Load(CHANGERES_ARMOR_FILE))
- return FALSE;
- if (!m_Helm.Load(CHANGERES_HELM_FILE))
- return FALSE;
- if (!m_Horse.Load(CHANGERES_HORSE_FILE))
- return FALSE;
- return TRUE;
- }
- int KItemChangeRes::GetWeaponRes(int nDetail, int nParti, int nLevel)
- {
- int nRet;
- if (nLevel == 0)
- {
- m_MeleeWeapon.GetInteger(2, 2, 2, &nRet);
- return nRet - 2;
- }
- int nRow = nParti * 10 + nLevel + 2;
- switch(nDetail)
- {
- case equip_meleeweapon:
- m_MeleeWeapon.GetInteger(nRow, 2, 2, &nRet);
- break;
- case equip_rangeweapon:
- m_RangeWeapon.GetInteger(nRow - 1, 2, 2, &nRet); // 没有默认状态
- break;
- }
- return nRet - 2;
- }
- int KItemChangeRes::GetArmorRes(int nParti, int nLevel)
- {
- int nRet;
- if (nLevel == 0)
- {
- m_Armor.GetInteger(2, 2, 19, &nRet);
- return nRet - 2;
- }
- int nRow = nParti * 10 + nLevel + 2;
- m_Armor.GetInteger(nRow, 2, 19, &nRet);
- return nRet - 2;
- }
- int KItemChangeRes::GetHelmRes(int nParti, int nLevel)
- {
- int nRet;
- if (nLevel == 0)
- {
- m_Helm.GetInteger(2, 2, 19, &nRet);
- return nRet - 2;
- }
- int nRow = nParti * 10 + nLevel + 2;
- m_Helm.GetInteger(nRow, 2, 19, &nRet);
- return nRet - 2;
- }
- int KItemChangeRes::GetHorseRes(int nParti, int nLevel)
- {
- int nRet;
- if (nLevel == 0)
- {
- return -1;
- }
- int nRow = nParti * 10 + nLevel + 2;
- m_Horse.GetInteger(nRow, 2, 2, &nRet);
- return nRet - 2;
- }