⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 op_inv.cpp

📁 国内著名网络游戏dragon的服务端完整源码 内附完整数据库结构
💻 CPP
📖 第 1 页 / 共 4 页
字号:
}

int CItem_Cook::UseItem( CHARLIST *ch)
{

	return 1;
}

/////////////////////////////////////////////////////////////////////////////////
// 
//		酒捞袍阑 冈阑 锭狼 某腐磐 瓷仿摹 函拳矫虐绰 酒捞袍 滚枚 窃荐 
//
/////////////////////////////////////////////////////////////////////////////////
//011218 lsw
bool	IsEquipAbleDualStep(const int iDualStep, const CHARLIST *ch)
{
	return ((iDualStep <= ch->GetClassStep())?true:false);
}

bool	IsEquipAbleClass(const int iWarrior,const int iThief,
						 const int iArcher,const int iWizard,
						 const int iPriest,const CHARLIST *ch)
{
	switch(ch->Class)
	{
	case WARRIOR:
		{
			if(!iWarrior){return false;}
		}break;
	case THIEF	:
		{
			if(!iThief){return false;}
		}break;
	case ARCHER	:
		{
			if(!iArcher){return false;}
		}break;
	case WIZARD	:
		{
			if(!iWizard){return false;}
		}break;
	case PRIEST	:
		{
			if(!iPriest){return false;}
		}break;
	default:
		{
			return false;
		}break;
	}
	return true;
}

bool	IsEquipAbleItemKind(const int iItemKind, const CHARLIST *ch)
{
	switch(iItemKind)
	{
	case IK_FALG://标惯老锭 富 救厘阑 瞒绊 乐绢具 茄促
		{
			CItem * t = ItemUnit( ch->equip[WT_SHOES].item_no);
			if(!t)
			{
				return false;
			}
			const int iCmpItemKind= t->GetItemKind();
			if(IK_SADDLE != iCmpItemKind)
			{
				return false;
			}
		}break;
	default:
		{
		}break;
	}
	return true;
}

bool	IsEquipAbleAbilityCheck	(const int iNeedAbility, const int iMyAbility)
{
	if( (!iNeedAbility) || (iNeedAbility<=iMyAbility) )
	{
		return true;
	}
	return false;
}
bool	IsEquipAbleCheckWisInt	(const int iNeedWis, const int iNeedInt, const int iMyWis, const int iMyInt)
{
	if( iNeedWis && (!iNeedInt))//Wis父 夸备 窍搁
	{
		return IsEquipAbleAbilityCheck(iNeedWis,iMyWis);
	}
	if( (!iNeedWis) && iNeedInt)//Int父 夸备 窍搁
	{
		return IsEquipAbleAbilityCheck(iNeedInt,iMyInt);
	}
	if( (!iNeedWis) && (!iNeedInt))//笛促 鞘夸 窍瘤 臼促
	{
		return true;
	}

	if( iNeedWis && iNeedInt )//笛促 夸备 窍搁
	{
		if(IsEquipAbleAbilityCheck(iNeedWis,iMyWis) || IsEquipAbleAbilityCheck(iNeedInt,iMyInt))//笛促 父练 秦具 窃
		{
			return true;
		}
	}
	return false;
}

bool	IsEquipAbleCheckWsPs	(const int iNeedWs, const int iNeedPs, const int iMyWsPs, const int iSpellType)
{
	switch (iSpellType)
	{
		case WIZARD_SPELL:
			{
				if(IsEquipAbleAbilityCheck(iNeedWs,iMyWsPs))
				{
					return true;
				}
			}break;
		case PRIEST_SPELL:
			{
				if(IsEquipAbleAbilityCheck(iNeedPs,iMyWsPs))
				{
					return true;
				}
			}break;
		default:
			{
			}break;
	}
	return false;
}
bool	IsEquipAbleCheckGender	(const int iNeedGender, const int iMyGender)
{
	switch(iNeedGender)
	{
	case 0:
		{
			return true;
		}break;
	case 1:
		{
			if(iMyGender == MALE)
			{
				return true;
			}
		}break;
	case 2:
		{
			if(iMyGender == FEMALE)
			{
				return true;
			}
		}break;
	default :
		{
			return false;
		}break;
	}
	return false;
}
bool	IsEquipAbleCheckMouseMRD	(const int iNeedMouseMRD, const int iMyMouseMRD)// 琶平眉农
{
	if( (iNeedMouseMRD <= 1) || (iNeedMouseMRD <= iMyMouseMRD) )
	{
		return true;
	}
	return false;
}

bool IsEquipAbleCheckAbleDay(const int start, const int end)
{	//< CSD-030812
	if(!start)	{return true;}//力茄 绝澜 
	if(!end)	{return true;}//力茄 绝澜 

	int mon = g_mon+1;
	int day = g_day+1;

	const int FullToday = (mon*100)+day;
	
	if (start <= end)
	{
		if( start <= FullToday && end >= FullToday)
		{
			return true;//馒侩扁埃捞促.
		}
	}
	//< 040102 kyo
	else
	{
		if( start <= FullToday && 1231 >= FullToday)
		{
			return true;
		}
		else if( 101 <= FullToday&& end >= FullToday)
		{
			return true;
		}		
	}
	//> 040102 kyo

	return false;
}	//> CSD-030812

inline bool IsEquipAbleCheckNation(const int iAbleNation, const CHARLIST *ch)//000  100 官捞 10 磊捞 1 老胶
{
	switch(ch->name_status.nation)
	{
	case NW_BY:
		{
			if((iAbleNation%1000)/100)
			{
				return true;
			}
		}break;
	case NW_ZY:
		{
			if((iAbleNation%100)/10)
			{
				return true;
			}
		}break;
	case NW_YL:
		{
			if((iAbleNation%10)/1)
			{
				return true;
			}
		}break;
	default :
		{
			return false;
		}break;
	}
	return false;
}

inline bool IsEquipAbleCheckLv(const int iAbleLv, const CHARLIST *ch)
{	//< CSD-030806
	if (!iAbleLv)
	{
		return true;
	}
	
	if (iAbleLv <= ch->GetLevel())	
	{
		return true;
	}

	return false;
}	//> CSD-030806

inline bool IsEquipAbleCheckFame(const int iAbleFame, const CHARLIST *ch)
{
	if(!iAbleFame){return true;}//し备 
	if( iAbleFame <= ch->fame)
	{
		return true;
	}
	return false;
}

__inline int EatItemCommon(CHARLIST *ch,const int iHp, const int iMp, const int iHungry,const int iLight)
{
//	if	(RareEM.ApplyDynamicRareEffect(ch,DyRare,1,0))//咯扁辑 矫埃捞 悸泼 登绢 乐促
//	{
//		SendRareDisplayEffect(ch);
//	}
	
	int iReturnValue = 0;
	if(iHp)
	{
		iReturnValue = ch->IncLife(iHp);
	}
	if(iMp && ch->Spell == WIZARD_SPELL)
	{
		ch->IncMana(iMp);
		ch->SendCharInfoBasic(MP, ch->Mana);//器记 冈菌阑锭 发栏肺 付唱啊 腹捞 疵绢唱绰 泅惑 荐沥
	}
	if(iHungry)
	{
		ch->IncHungry(iHungry);
	}
	if(iLight)
	{
		WeatherControl.SetChLight(ch,iLight,5*60);
	}//5盒
	return iReturnValue;
}

/*
cure_disease1;//绊蜡 扁瓷 逞滚
cure_disease2;//堡盔 裹困 
cure_disease3;//颇萍俊 康氢
*/

int CItem_Etc::EatItem( CHARLIST *ch )
{
	return EatItemCommon(ch,0,0,0,GetImunityCure2());
}

int CItem_Plant::EatItem( CHARLIST *ch )
{
	return EatItemCommon(ch,hp,mp,ap,GetImunityCure2());
}
///////////////////////////////
int CItem_Herb::EatItem(CHARLIST *ch)
{
	return EatItemCommon(ch,hp,mp,ap,GetImunityCure2());
}

int CItem_Cook::EatItem(CHARLIST *ch)
{
	return EatItemCommon(ch,hp,mp,ap,GetImunityCure2());
}

int CItem_Potion::EatItem(CHARLIST *ch)
{
	return EatItemCommon(ch,hp,mp,ap,GetImunityCure2());
}	

/////////////////////////////////////////////////////////////////////////////////
//	
// 酒捞袍 厘馒俊 蝶弗 某腐磐 瓷仿摹 函拳甫 拌魂窍绰 糕滚 窃荐
//	
/////////////////////////////////////////////////////////////////////////////////

__inline int	IsEquipAbleCommon(const CHARLIST *ch)//020314 lsw
{	//傍烹利栏肺 龋免
	return 1;
}

__inline int	EquipItemCommon(const CHARLIST *ch)//020314 lsw
{	//傍烹利栏肺 龋免
	return 1;
}

__inline int	ReleaseItemCommon(const CHARLIST *ch)//020314 lsw
{	//傍烹利栏肺 龋免
	return 1;
}

__inline int EquipItemSetAbility(CHARLIST *ch,const int iStr	, const int iCon	, const int iDex	, 
								   const int iWis	, const int iInt	, const int iMovp	, 
								   const int iChar	, const int iEndu	, const int iMoral	,const int iLuck)
{

	ch->Strw	+= iStr	;	ch->Conw	+= iCon	;
	ch->Dexw	+= iDex	;	ch->Wisw	+= iWis	;
	ch->Intw	+= iInt	;	ch->MovePw	+= iMovp;
	ch->Charw	+= iChar;	ch->Enduw	+= iEndu;
	ch->Moralw	+= iMoral;	ch->Luckw	+= iLuck;
	return 1;
}

__inline int ReleaseItemSetAbility(CHARLIST *ch,const int iStr	, const int iCon	, const int iDex	, 
								   const int iWis	, const int iInt	, const int iMovp	, 
								   const int iChar	, const int iEndu	, const int iMoral	,const int iLuck)
{
	ch->Strw	-= iStr	;	ch->Conw	-= iCon	;
	ch->Dexw	-= iDex	;	ch->Wisw	-= iWis	;
	ch->Intw	-= iInt	;	ch->MovePw	-= iMovp;
	ch->Charw	-= iChar;	ch->Enduw	-= iEndu;
	ch->Moralw	-= iMoral;	ch->Luckw	-= iLuck;
	return 1;
}

__inline int EquipItemCalcAttackPower(CHARLIST *ch,const int iItem_table_damage)
{
	int iTempDmg =iItem_table_damage;
	if( 100000000 < iTempDmg  ) // 付捞呈胶 单固瘤老 版快
	{
		iTempDmg %= 100000000;
		ch->iPhysicalTotalDamage	-= iTempDmg / 10000 ;
		ch->iPhysicalRandomDamage	-= iTempDmg % 10000 ;
	}
	else if ( 100000000 > iTempDmg ) //敲矾胶 单固瘤 老 版快
	{
		ch->iPhysicalTotalDamage	+= iTempDmg / 10000 ;
		ch->iPhysicalRandomDamage	+= iTempDmg % 10000 ;
	}
	return 0;
}

__inline int ReleaseItemCalcAttackPower(CHARLIST *ch,const int iItem_table_damage)
{
	int iTempDmg =iItem_table_damage;
	if( 100000000 < iTempDmg  ) // 付捞呈胶 单固瘤老 版快
	{
		iTempDmg %= 100000000;
		ch->iPhysicalTotalDamage	+= iTempDmg / 10000 ;
		ch->iPhysicalRandomDamage	+= iTempDmg % 10000 ;
	}
	else if ( 100000000 > iTempDmg ) //敲矾胶 单固瘤 老 版快
	{
		ch->iPhysicalTotalDamage	-= iTempDmg / 10000 ;
		ch->iPhysicalRandomDamage	-= iTempDmg % 10000 ;
	}
	return 0;
}

__inline void EquipItemResist(CHARLIST *ch, const int iRP, const int iRC, const int iRH, 
											const int iRF, const int iRI, const int iRE)
{
	ch->IncExtResist(RT_POISON,	iRP);
	ch->IncExtResist(RT_CURSE,	iRC);
	ch->IncExtResist(RT_HOLY,	iRH);
	ch->IncExtResist(RT_FIRE,	iRF);
	ch->IncExtResist(RT_ICE	,	iRI);
	ch->IncExtResist(RT_ELECT,	iRE);
}

__inline void ReleaseItemResist(CHARLIST *ch, const int iRP, const int iRC, const int iRH, 
											  const int iRF, const int iRI, const int iRE)
{
	ch->DecExtResist(RT_POISON,	iRP);
	ch->DecExtResist(RT_CURSE,	iRC);
	ch->DecExtResist(RT_HOLY,	iRH);
	ch->DecExtResist(RT_FIRE,	iRF);
	ch->DecExtResist(RT_ICE	,	iRI);
	ch->DecExtResist(RT_ELECT,	iRE);
}

__inline void EquipItemHitAndDefenceRate(CHARLIST *ch, const int iHitRate, const int iDefenceRate)
{
	ch->item_Hit_Rate		+= iHitRate;			//	0805 YGI
	ch->item_Deffence_Rate	+= iDefenceRate;
}

__inline void ReleaseItemHitAndDefenceRate(CHARLIST *ch, const int iHitRate, const int iDefenceRate)
{
	ch->item_Hit_Rate		-= iHitRate;			//	0805 YGI
	ch->item_Deffence_Rate	-= iDefenceRate;
}

//010604 lsw	
int CItem_Weapon::EquipItem(CHARLIST *ch )
{	
	EquipItemSetAbility(ch,	Change_str,	Change_con,	Change_dex,	Change_wis,
	Change_int,	Change_Movp, Change_cha, Change_end,	Change_mor,	Change_luc);

	if( ch->Spell )	ch->wspsw += Change_ps;
	else			ch->wspsw += Change_ws;

	EquipItemHitAndDefenceRate(ch, Hit_rate, Defense_rate);//020314 lsw
	EquipItemResist(ch, Increase_Poisoning, Increase_Stone, Increase_Magic, Increase_Fire, Increase_Ice, Increase_lightning);//020314 lsw
	EquipItemCalcAttackPower(ch,GetDamage());//020303 lsw
	
	return EquipItemCommon( ch );			// 001219_2 YGI

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -