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

📄 itemtable.cpp

📁 网络游戏龙族 完整的登陆器 C++ 源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
				{	//< CSD-031201 : 努扼捞攫飘 角青矫 农贰浆登绢 阜澜
					/*
					FILE *fp = fopen( filename, "wt" );
					if( fp )
					{
						for( int i=0; i<MAX_SKILL; i++ )
						{
							if( skill[i].num )
							fprintf( fp, "%d	%s	%s	%d	%d	%d	%d	%s\n", 
								skill[i].num, skill[i].name, skill[i].han_name, skill[i].inclusive,
								skill[i].series, skill[i].money, skill[i].skillable, skill[i].explain );							
						}
						fclose( fp );
					}*/
				}	//> CSD-031201
#endif
			}
		}
		else return 0;
	}

	CalcGuildToSkill( );		// 器褒利 胶懦寸 技何 胶懦肺 盒幅茄促.

	ConvertSkillTable( );		// skillmain苞 蔼阑 悼扁拳 茄促.
	return 1;
}

////////////////////////////////////////////////
//
//	SkillMain苞 嘎冕促.
void ConvertSkillTable( )
{
	for( int i=0; i<MAX_SKILL_; i++ )
	{
		skill[i].inclusive	= SkillTable[i].MotherSkillType;
		skill[i].money		= SkillTable[i].money;
		skill[i].skillable	= SkillTable[i].need_exp;
		skill[i].targettype	= SkillTable[i].Howto;
	}
}

bool ReadSkillIcon( int num )
{
	char filename[MAX_FILENAME];
	FILE *fp;
	Spr *s;

	sprintf( filename, "./Skill/s%03d.csp", num );
	s = &skill_spr[num];

	if( fp = Fopen(filename, "rb" ) )
	{
		fread( &s->xl, sizeof( short ), 1, fp);
		fread( &s->yl, sizeof( short ), 1, fp);
		fread( &s->ox, sizeof( short ), 1, fp);
		fread( &s->oy, sizeof( short ), 1, fp);
		fread( &s->size, sizeof( unsigned int ), 1, fp);
		MemFree( s->img );
		MemAlloc( s->img, s->size );
		fread(s->img, s->size, 1, fp);
		convert565to555( s );
		fclose(fp);
	}
	else return 0;

	return 1;
}


void PutSkillIcon( int x, int y, int num, int flag, int flag2 )
{
	Spr *s;
	s = &skill_spr[num];
	if(!s->img) return ;
	if( flag ) PutCompressedImageFX(x, y, s, flag, flag2);
	else PutCompressedImage(x, y, s);
}



#define MAX_SKILL_OF_KIND		20
//
//	漂沥 胶懦辆幅俊 加秦 乐绰 葛电 胶懦 锅龋甫 啊廉柯促.
//	para : 33俺 楼府 胶懦 辆幅, 弊 胶懦 锅龋甫 淬酒哎 硅凯, 弊 农扁
//
int GetSkillMother( int kind , int skill_mother[], int max )
{
	memset( skill_mother, 0, sizeof( int )*max );
	int count = 0;
	for( int i=0; i<MAX_SKILL; i++ )
	{
		if( skill[i].num )
		{
			if( skill[i].inclusive == kind )
			{
				skill_mother[count++] = skill[i].num;
				if( count >= max ) break;
			}
		}
	}
	return count;
}

/*
int skill_mother[32][2] = {	{1,3},   {3,5},   {5,8},   {8,10},  {10,16}, {16,19}, {19,21}, {21,25}, {25,28}, {28,32},
							{32,34}, {34,35}, {35,38}, {38,42}, {42,43}, {43,44}, {44,45}, {45,48}, {48,50}, {50,53},
							{53,55}, {55,56}, {56,57}, {57,64}, {64,67}, {67,73}, {73,75}, {75,76}, {76,78}, {78,86},
							{86,87}, {87,101}	};
*/	
extern int SkillInventory[2][2][4];
extern int SkillInventory2[2][2][4];
void ChangeSkillMenuInventory( int x )
{
	int i, ct;
	memset( SkillInventory, 0 , sizeof( int[2][2][4] ) );
	memset( SkillInventory2, 0 , sizeof( int[2][2][4] ) );

	int skill_mother[MAX_SKILL_OF_KIND];
	int count = GetSkillMother( x, skill_mother, MAX_SKILL_OF_KIND );		// 鞍篮 辆幅狼 胶懦阑 茫绰促.
	
	for( ct=0; ct<count; ct++ )
	{
		i = skill_mother[ct];
		if( SCharacterData.SkillId[i] ) SkillInventory[0][ct/4][ct%4] = i;
		else SkillInventory2[0][ct/4][ct%4] = i;
	}

	count = GetSkillMother( x+1, skill_mother, MAX_SKILL_OF_KIND );		// 鞍篮 辆幅狼 胶懦阑 茫绰促.
	for( ct=0; ct<count; ct++ )
	{
		i = skill_mother[ct];
		if( SCharacterData.SkillId[i] ) SkillInventory[1][ct/4][ct%4] = i;
		else SkillInventory2[1][ct/4][ct%4] = i;
	}
}

bool	IsEquipAbleItemKind(const int iItemKind)
{
	if (IK_FALG == iItemKind)
	{
		CItem * t = ItemUnit( EquipItemAttr[WT_SHOES].item_no);
		if(!t)
		{
			return false;
		}
		const int iCmpItemKind= t->GetItemKind();
		if(IK_SADDLE != iCmpItemKind)
		{
			return false;
		}
	}	
	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;
}

inline bool IsEquipAbleCheckNation(const int iAbleNation, const CHARACTER *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 CHARACTER *ch)
{
	if(!iAbleLv){return true;}//し备 
	if( iAbleLv <= ch->lv)
	{
		return true;
	}
	return false;
}

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

bool	IsEquipAbleDualStep(const int iDualStep, const CHARACTER *ch)
{
	return ((iDualStep <= ch->aStepInfo[CLS_STEP])?true:false);
}

bool	IsEquipAbleClass(const int iWarrior,const int iThief,
						 const int iArcher,const int iWizard,
						 const int iPriest,const CHARACTER *ch)
{
	switch(ch->class_type)
	{
	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;
}

//################################## 厘馒 啊瓷 魄窜 窃荐 #########################################
int CItem_Weapon::is_equipable()
{
	if(!IsEquipAbleAbilityCheck	(Need3_str	, Hero_Ability[STR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_con	, Hero_Ability[CON]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_dex	, Hero_Ability[DEX]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_end	, Hero_Ability[ENDU]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_cha	, Hero_Ability[CHA]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_mor	, Hero_Ability[MOR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_Movp	, Hero_Ability[MOVP]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_luc	, Hero_Ability[LUCK]))	{return 0;}

	if(!IsEquipAbleCheckMouseMRD(Mouse_MRD	, SCharacterData.SkillId[Skill_Ability])){return 0;}
	if(!IsEquipAbleCheckWisInt	(Need3_wis	, Need3_int, Hero_Ability[WIS],Hero_Ability[INT_]) ){return 0;}
	if(!IsEquipAbleCheckWsPs	(Need3_ws	, Need3_ps, Hero_Ability[WSPS], Hero->spell) ){return 0;}
	if(!IsEquipAbleCheckGender	(Need3_gender, SCharacterData.nCharacterData[GENDER]) )			{return 0;}
	if(!IsEquipAbleCheckAbleDay	(Repair_Skill2_min,Repair_Res1) )		{return 0;}
	if(!IsEquipAbleCheckNation(Imunity_Cure_4, Hero))		{return 0;}
	if(!IsEquipAbleCheckLv(Imunity_Cure_5, Hero))		{return 0;}
	if(!IsEquipAbleCheckFame(Imunity_Cure_6, Hero))		{return 0;}
	if(!IsEquipAbleItemKind(GetItemKind())) {return 0;}
	if(!IsEquipAbleDualStep(GetNeedDualStep(),Hero)){return 0;}
	if(!IsEquipAbleClass(
		GetClassWarriorAble(),GetClassThiefAble(),
		GetClassArcherAble(),GetClassWizardAble(),
		GetClassClericAble(),Hero)){return 0;}//021113 lsw
	return 1;
}

int CItem_Tool::is_equipable()
{
	return 1;
}

int CItem_Armor::is_equipable()
{
	if( SysInfo.notconectserver ) return 1;
	if(!IsEquipAbleAbilityCheck	(Need3_str	, Hero_Ability[STR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_con	, Hero_Ability[CON]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_dex	, Hero_Ability[DEX]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_end	, Hero_Ability[ENDU]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_cha	, Hero_Ability[CHA]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_mor	, Hero_Ability[MOR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_Movp	, Hero_Ability[MOVP]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_luc	, Hero_Ability[LUCK]))	{return 0;}

	if(!IsEquipAbleCheckMouseMRD(Mouse_MRD	, SCharacterData.SkillId[Skill_Ability])){return 0;}
	if(!IsEquipAbleCheckWisInt	(Need3_wis	, Need3_int, Hero_Ability[WIS],Hero_Ability[INT_]) ){return 0;}
	if(!IsEquipAbleCheckWsPs	(Need3_ws	, Need3_ps, Hero_Ability[WSPS], Hero->spell) ){return 0;}
	if(!IsEquipAbleCheckGender	(Need3_gender, SCharacterData.nCharacterData[GENDER]) )			{return 0;}
	if(!IsEquipAbleCheckAbleDay	(Repair_Skill2_min,Repair_Res1) )		{return 0;}
	if(!IsEquipAbleCheckNation(Imunity_Cure_4, Hero))		{return 0;}
	if(!IsEquipAbleCheckLv(Imunity_Cure_5, Hero))		{return 0;}
	if(!IsEquipAbleCheckFame(Imunity_Cure_6, Hero))		{return 0;}
	if(!IsEquipAbleItemKind(GetItemKind())){return 0;}
	if(!IsEquipAbleDualStep(GetNeedDualStep(),Hero)){return 0;}
	if(!IsEquipAbleClass(
		GetClassWarriorAble(),GetClassThiefAble(),
		GetClassArcherAble(),GetClassWizardAble(),
		GetClassClericAble(),Hero)){return 0;}//021113 lsw
	return 1;
}

int CItem_Disposable::is_equipable()
{
	if( SysInfo.notconectserver ) return 1;
	if(!IsEquipAbleAbilityCheck	(Need3_str	, Hero_Ability[STR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_con	, Hero_Ability[CON]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_dex	, Hero_Ability[DEX]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_end	, Hero_Ability[ENDU]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_cha	, Hero_Ability[CHA]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_mor	, Hero_Ability[MOR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_Movp	, Hero_Ability[MOVP]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_luc	, Hero_Ability[LUCK]))	{return 0;}

	if(!IsEquipAbleCheckMouseMRD(Mouse_MRD	, SCharacterData.SkillId[Skill_Ability])){return 0;}
	if(!IsEquipAbleCheckWisInt	(Need3_wis	, Need3_int, Hero_Ability[WIS],Hero_Ability[INT_]) ){return 0;}
	if(!IsEquipAbleCheckWsPs	(Need3_ws	, Need3_ps, Hero_Ability[WSPS], Hero->spell) ){return 0;}
	if(!IsEquipAbleCheckGender	(Need3_gender, SCharacterData.nCharacterData[GENDER]) )			{return 0;}
//	if(!IsEquipAbleCheckAbleDay	(Repair_Skill2_min,Repair_Res1) )		{return 0;}
//	if(!IsEquipAbleCheckNation(Imunity_Cure_4, Hero))		{return 0;}
//	if(!IsEquipAbleCheckLv(Imunity_Cure_5, Hero))		{return 0;}
//	if(!IsEquipAbleCheckFame(Imunity_Cure_6, Hero))		{return 0;}
	if(!IsEquipAbleItemKind(GetItemKind())){return 0;}
	return 1;
}
int CItem_Accessory::is_equipable()
{
	if( SysInfo.notconectserver ) return 1;
		if(!IsEquipAbleAbilityCheck	(Need3_str	, Hero_Ability[STR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_con	, Hero_Ability[CON]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_dex	, Hero_Ability[DEX]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_end	, Hero_Ability[ENDU]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_cha	, Hero_Ability[CHA]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_mor	, Hero_Ability[MOR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_Movp	, Hero_Ability[MOVP]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_luc	, Hero_Ability[LUCK]))	{return 0;}

	if(!IsEquipAbleCheckMouseMRD(Mouse_MRD	, SCharacterData.SkillId[Skill_Ability])){return 0;}
	if(!IsEquipAbleCheckWisInt	(Need3_wis	, Need3_int, Hero_Ability[WIS],Hero_Ability[INT_]) ){return 0;}
	if(!IsEquipAbleCheckWsPs	(Need3_ws	, Need3_ps, Hero_Ability[WSPS], Hero->spell) ){return 0;}
	if(!IsEquipAbleCheckGender	(Need3_gender, SCharacterData.nCharacterData[GENDER]) )			{return 0;}
	if(!IsEquipAbleCheckAbleDay	(Repair_Skill2_min,Repair_Res1) )		{return 0;}
	if(!IsEquipAbleCheckNation(Imunity_Cure_4, Hero))		{return 0;}
	if(!IsEquipAbleCheckLv(Imunity_Cure_5, Hero))		{return 0;}
	if(!IsEquipAbleCheckFame(Imunity_Cure_6, Hero))		{return 0;}
	if(!IsEquipAbleItemKind(GetItemKind())){return 0;}
	if(!IsEquipAbleDualStep(GetNeedDualStep(),Hero)){return 0;}
	if(!IsEquipAbleClass(
		GetClassWarriorAble(),GetClassThiefAble(),
		GetClassArcherAble(),GetClassWizardAble(),
		GetClassClericAble(),Hero)){return 0;}//021113 lsw
	return 1;
}

int CItem_Etc::is_equipable()
{
	if( SysInfo.notconectserver ) return 1;
	if(!IsEquipAbleAbilityCheck	(Need3_str	, Hero_Ability[STR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_con	, Hero_Ability[CON]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_dex	, Hero_Ability[DEX]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_end	, Hero_Ability[ENDU]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_cha	, Hero_Ability[CHA]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_mor	, Hero_Ability[MOR]))		{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_Movp	, Hero_Ability[MOVP]))	{return 0;}
	if(!IsEquipAbleAbilityCheck	(Need3_luc	, Hero_Ability[LUCK]))	{return 0;}

	if(!IsEquipAbleCheckMouseMRD(Mouse_MRD	, SCharacterData.SkillId[Skill_Ability])){return 0;}
	if(!IsEquipAbleCheckWisInt	(Need3_wis	, Need3_int, Hero_Ability[WIS],Hero_Ability[INT_]) ){return 0;}
	if(!IsEquipAbleCheckWsPs	(Need3_ws	, Need3_ps, Hero_Ability[WSPS], Hero->spell) ){return 0;}
	if(!IsEquipAbleCheckGende

⌨️ 快捷键说明

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