?? itemtable.cpp
字號:
{ //< 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 + -