Files
mir_server/server/LogicServer/attr/RandAttrSelector.h

85 lines
3.7 KiB
C
Raw Normal View History

2025-01-09 17:45:40 +08:00
#pragma once
/************************************************************************/
/*
/* 随机属性配置选择器
/*
/* 提供基本的随机属性选择功能。随机属性出现在物品、法宝、宠物、坐骑等方面的属性中随机属
/* 性与游戏属性类似,具有属性类型和属性值,不同的是随机属性的属性值具有两个,一个表示下限,
/* 一个表示上限。在依据随机属性项产生实际属性时产生的属性值被规定在随机属性值的下限和上限
/* 之间:
/* (maxValue >= 具体属性值 >= minValue)
/* 在依据随机属性项产生随机属性的期间group属性组非0且值相同的属性只会出现一次
/* 而属性是否能够被选取的依据至少包含几率值大于等于属性项的prob几率值
/*
/************************************************************************/
class RandAttrSelector
{
public:
/*
* Comments:
!!!!!!!!
* Param OUT PACKEDGAMEATTR & packedAttr:
* Param const CUserItem * pUserItem:
* Param int &nSelectIndex: ID,0,1,2
* @Return bool: false
*/
static bool SelectItemSmithAttribute(OUT PACKEDGAMEATTR &packedAttr, const CUserItem* pUserItem,INT_PTR &nSelectIndex);
/*
* Comments:
* Param CUserItem * pUserItem:
* Param bool bReserverOld:
* @Return bool: true,false
*/
static bool ItemSmithAttribute( CUserItem* pUserItem, int nSmithIdx, bool bReserverOld = false);
/*
* Comments:
* Param DataList<RANDOMATTRTERM> * pConfig:
* Param PACKEDGAMEATTR * pAttr:
* Param nAttrTypeMust:
* @Return bool:truefalse
*/
static bool RealSmithAttribute( DataList<RANDOMATTRTERM> * pConfig,PACKEDGAMEATTR* pAttr, unsigned char nAttrTypeMust=0,
unsigned char nJob=0, PACKEDGAMEATTR* pAttrsAll=NULL );
/*
* Comments:useritem.quality!=0,smith未赋值
* Param CUserItem * pUserItem:
* Param nQualityDataIndex:
* @Return bool:
*/
//static bool InitSmithByUserItem( CUserItem * pUserItem, int nQualityDataIndex);
/*
* Comments:
* Param WORD wItemId: id
* Param BYTE btQuality:
* Param int nQualityDataIndex:
* Param int smithArr[CUserItem::MaxSmithAttrCount]:
* @Return void:
*/
//static void InitSmithById(WORD wItemId, BYTE btQuality, int nQualityDataIndex, int smithArr[CUserItem::MaxSmithAttrCount]);
public: //[ZGame]新的从属性库中抽取属性的方法
//从smith属性库中抽取鉴定属性->pUserItem->smithAttrs
static void GenerateItemSmithAttrsInSmith( CUserItem* pUserItem, int nSmithId, int nAttrNum, int nLockTypes[],
unsigned char nJob=0 );
//从极品库中随机抽取属性
static void GenerateAttrsInSmith( int nSmithId, int nAttrNum, unsigned char nJob=0, unsigned char nAttrTypeMust=0 );
//从极品库中随机抽取一条属性
static void GenerateOneAttrInSmith( int nSmithId, unsigned char& nAttrType, int& nAttrValue, unsigned char nJob=0,
unsigned char nAttrTypeMust=0 );
static void GenerateOneAttrInSmithLib( DataList<RANDOMATTRTERM>* pConfig, PACKEDGAMEATTR* pAttrsAll, PACKEDGAMEATTR* pAttr,
unsigned char nLockType=enSmithLockType_No, unsigned char nJob=0);
static unsigned char HasAttrNumInAttrs( PACKEDGAMEATTR* pAttrsAll, unsigned char nAttrType );
};