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

📄 itemtable.cpp

📁 网络游戏龙族 完整的登陆器 C++ 源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		case 10 :	s = &Icon11[index][0]; break;
		case 11 :	s = &Icon12[index][0]; break;
		case 12 :	s = &Icon13[index][0]; break;


		default :	JustMsg( "if(!s->img) : Error " );		break;
	}
	if(!s->img) 
	{
		LoadItemIconData(s, image);
	}
	if( delay ) PutCompressedImageFX(x, y, s, delay, effect);
	else
	{
		PutCompressedImage(x, y, s);
		/*if( GetItemAttrWeapon(item_number) && is_not_equip==0 ) PutCompressedImage(x, y, s);
		else 
		{
			PutCompressedImageBlendRGB( x, y, s, RGB( 0,0,200 ) );
			PutCompressedImageFX( x, y, s, 10, 2);
		}*/
	}
}

void PutItemIconAni( int x, int y, int item_number )
{
	int image;					// 酒捞袍捞 啊瘤绊 乐绰 捞固瘤
	int kind;						// 酒捞能 弊覆 鸥涝
	int index;

	static int ct=0;
	static int flag=0;
	
	GetItemNumber(item_number, kind, index);

	CItem *t = ItemUnit( kind , index );
	if( !t ) return;
	image = t->GetImageNumber();

	image+=ct;

	GetItemNumber((int)image/100, kind, index);

	Spr* s;

	if( GetSysInfo( SI_GAME_MAKE_MODE ) )
	if( index >= ITEM_MAX ) 
	{
		JustMsg( lan->OutputMessage(6,69), item_number  );//010215 lsw
	}
	switch(kind)
	{
		case 0 :	s = &Icon1[index][ct]; break;
		case 1 :	s = &Icon2[index][ct]; break;
		case 2 :	s = &Icon3[index][ct]; break;
		case 3 :	s = &Icon4[index][ct]; break;
		case 4 :	s = &Icon5[index][ct]; break;
		case 5 :	s = &Icon6[index][ct]; break;
		case 6 :	s = &Icon7[index][ct]; break;
		case 7 :	s = &Icon8[index][ct]; break;
		case 8 :	s = &Icon9[index][ct]; break;
		case 9 :	s = &Icon10[index][ct]; break;
		case 10 :	s = &Icon11[index][ct]; break;
		case 11 :	s = &Icon12[index][ct]; break;
		case 12 :	s = &Icon13[index][ct]; break;



		default :	JustMsg( "if(!s->img) : Error " );		break;
	}
	if(!s->img)
	{
		LoadItemIconData(s, image);
	}
	PutCompressedImage(x, y, s);
	flag++;
	if( !(flag%3) ) ct++;
	ct %=4;
}


char explain_tactics[13][20] = {0,/*	"林冈拜捧"		,
									"茄颊八"		,	
									"劝筋扁"		 ,
									"奇教八"		,
									"枚硼拜捧"		,
									"芒骂福扁"		,
									"豪倒府扁"		,
									"厚八带瘤扁"		,
									"规菩规绢"		,
									"剧颊八"		,
									"剧颊档尝"		,
									"傍拜付过款侩"	,
									"焊龋脚过款侩"	,
									*/
								  };



////////////////////////////////////////////////////////////////////////
char *GetItemName( int item_id )
{
	int type = item_id;
	int num = item_id;
	GetItemNumber( item_id , type, num );

	CItem *t = ItemUnit( type , num );
	if( t ) return t->GetItemHanName();
	else return temp_menu_string;
}

char *GetItemHanName( int item_id )
{
	int type = item_id;
	int num = item_id;
	GetItemNumber( item_id , type, num );

	CItem *t = ItemUnit( type , num );
	if( t ) return t->GetItemHanName();
	else return NULL;
}


int GetItemAttr2(int gender, int item_id, int attr )
{
	int type;
	int num;
	GetItemNumber( item_id , type, num );

	int is_man = gender;

	CItem *t = ItemUnit( type, num );
	if( !t ) return 0;

	switch(attr)
	{
		case WEAR_ABLE	:	return t->GetItemClass();
		case WEIGHT		:	return t->GetItemWeight();
		case VALUE		:	if( !t->curr_value ) ReqItemValue(item_id);
							return t->curr_value;

///		case VALUE_SELL	:	if( !t->curr_value_sell ) ReqItemValue_Sell(item_id);
//							return t->curr_value_sell;

		case VALUE_REPAIR:	return t->curr_value_repair;
		case DURATION	:	return t->GetItemDuration();
		case ITEMSHOW	:	return t->GetItemShow( is_man );
		case EQUIPABLE	:	return t->is_equipable();
		case DO_RBUTTON :	return t->GetRButton();
		case USE_JUNK	: 	return t->GetUseJunk();
		case RBUTTON_WAVE : return t->GetRButtonSound();
		case ITEM_KIND	:	return t->GetItemKind();
		case ITEM_LIMIT :	return t->GetLimit() ;
		case IMAGE_NUMBER : return t->GetImageNumber();
		case REPAIR_ABLE :	return t->GetRepairAble();
		case OBJECT_IMAGE : return t->GetObjectNumber();
		case ITEM_COLOR   :  return t->GetItemColor();		// 011018 KHS 噶肚
	}	
	return 0;
}

int GetItemAttr( int item_id, int attr )
{
	return GetItemAttr2( SCharacterData.nCharacterData[GENDER], item_id, attr );
}

int GetItemValueBuy( int item_id )
{
	int type = item_id;
	int num = item_id;
	GetItemNumber( item_id , type, num );
	CItem *t= ItemUnit( type , num );
	if( t ) return t->GetItemValue();
	else return 0;

}

int GetItemValueSell( ItemAttr item )
{
	int type;
	int num; 
	GetItemNumber( item.item_no, type, num );

	CItem *t = ItemUnit( type , num );
	if( t ) //020925 lsw
	{
		int price = 0;
		const int base = t->curr_value;//GetItemAttr( item.item_no, VALUE );
		if( type == DISPOSABLE )
		{
			int much = t->GetQuantity();
			if( !much ) much = 1;
			price = (int)(
				((float)base * 0.9+0.5)* (float)item.attr[IATTR_MUCH] / (float)much);//020820 lsw
			return price; 
		}
		else if( GetItemAttr( item.item_no, DO_RBUTTON )==DIVIDE_ITEM )		// 荐樊阑 狼固...
		{
			int much = t->GetItemDuration();
			if( !much ) much = 1;
			price = (int)(
				((float)base * 0.9+0.5)* (float)item.attr[IATTR_MUCH] / (float)much);//020820 lsw
			return price;
		}

		WORD d_curr, d_max;
		GetItemDuration( item, d_curr, d_max );		// d_max => 泅犁 郴备档 弥措蔼
		WORD o_d_max = t->GetItemDuration();		// o_d_max => 角力 郴备档 弥措蔼
		if( d_max < o_d_max ) d_max = o_d_max;		// d_max俊 歹 奴 荐甫 持绰促.

		if( d_max )
		{	
			if( (item.attr[IATTR_LIMIT]-g_curr_time) > 0 )		// 蜡烹扁茄捞 巢酒 乐绢具 茄促.
			{
				price = (int)( (base)*((float)d_curr/(float)d_max*.9)+.5 );
				return price;
			}
			// 蜡烹扁茄阑 持具 茄促.
			price = (int)( (base)*((float)d_curr/(float)d_max*.9)+.5 );		// 烙矫 
			return price;
		}
	}
	
	return 0;
}

void SetItemPos(int type, POS* IP_set)
{
	IP_set->type = (char)type;
	IP_set->p1 = 0;
	IP_set->p2 = 0;
	IP_set->p3 = 0;
}

void SetItemPos(int type, int p, POS* IP_set)
{
	IP_set->type = (char)type;
	IP_set->p1 = 0;
	IP_set->p2 = 0;
	IP_set->p3 = (short int)p;
}

void SetItemPos(int type, int p1, int p2, int p3, POS* IP_set)
{
	IP_set->type = ( char )type;
	IP_set->p1 = (short int)p1;
	IP_set->p2 = (short int)p2;
	IP_set->p3 = (short int)p3;
}

//extern int		aItemInventory[3][3][8];
//extern int		aAccelInventory[6];
//extern int		aArmor_Inventory[8];

//extern ItemAttr InvItemAttr[3][3][8];
//extern ItemAttr EquipItemAttr[8];
//extern ItemAttr QuickItemAttr[7];

//extern int WearAble[9];


void SendMoveItem( int item_no, POS s, POS t, bool sound )
{
	t_packet	packet;

	packet.h.header.type = CMD_ITEM_EXCHANGE;
	packet.h.header.size = sizeof( t_item_exchange );

	packet.u.item_exchange.item_no  = item_no;
	packet.u.item_exchange.pos_s  = s;
	packet.u.item_exchange.pos_t  = t;

	QueuePacket( &packet, 1 );
	
	if( sound )
	{
		if( t.type == HAND ) ItemSoundOfGetItem( item_no );
		else if( t.type == EQUIP || t.type == INV ) EquipSound( item_no );
		else if( s.type == HAND ) DropItemSound( item_no );
	}
	
	int type = WearAble[GetItemAttr( item_no, WEAR_ABLE)];
	ChangeEquip( Hero, EquipItemAttr, type );
}


void RecvChrItemInfo_0( t_chr_item_info0 *i )
{//021022 lsw
	int a = i->ar0;
	int b = i->ar1;
	int ct = (a*3)+b;

	for(int c=0;c<8;c++)
	{
		InvItemAttr[a][b][c] = i->inv[c];
	}
	ct++;
	if( !g_StartMenuOn )
	{
		if( ct==9 )
		{
			SendReCallItemFromServer( CMD_RESEND_ITEM_EQUIP );
			ct= 0;
		}
	}
	else
	{
		if( ct==9 )
		{
			ReqMagicInfo();
			ct = 0;
		}
		else
		{
			ReqItemInfo2( ct );
		}
	}
}

void RecvChrItemInfo_1( t_chr_item_info1 *i )
{	//< CSD-031001
	const WORD idWeaponItem = i->equip[WT_WEAPON].item_no;
	
	if (idWeaponItem/1000 == 6)
	{	//< CSD-031101
		CItem_Weapon* pWeapon = static_cast<CItem_Weapon*>(ItemUnit(idWeaponItem));

		if (pWeapon != NULL)
		{
			const int nEffect = pWeapon->effect;

			if (nEffect > 0)
			{
				LoadHeroClothAccessoryDataOne(Hero->sprno, nEffect);
			}

			switch (Hero->sprno)
			{
			case 0: LoadHeroClothAccessoryDataOne(Hero->sprno, pWeapon->shape_woman); break;
			case 1: LoadHeroClothAccessoryDataOne(Hero->sprno, pWeapon->shape_man); break;
			}
		}
	}	//> CSD-031101

	Hero->idWeaponItem = idWeaponItem;
	//> CSD-031001
	for(int a = 0; a < 8; ++a)
	{
		EquipItemAttr[a] = i->equip[a];
//		CallItemVirtualFunction( VF_EQUIP_ITEM, EquipItemAttr[a].item_no );
	}
	
	CheckAbility();

	g_SokSungFlag = 0;			// 加己 眉农
	
	for (int t = 0; t < 8; ++t)
	{
		if (EquipItemAttr[t].attr[IATTR_RARE_MAIN])
		{
			g_SokSungFlag = 1;
			break;
		}
	}

	if (!g_StartMenuOn)
	{
		SendReCallItemFromServer( CMD_RESEND_ITEM_QUICK );
	}
	else
	{
		ReqItemInfo2(0);
	}
	// 011018 KHS 噶肚
	// Hero狼 厘馒茄 Item栏肺 贸府且巴篮 咯扁辑 茄促. 
	Hero->mantle = EquipItemAttr[ WT_NECK].item_no;
	Hero->mantlecolor	= GetItemAttr( Hero->mantle, ITEM_COLOR );

	if (Hero->mantle)
	{
		LoadHeroClothAccessoryDataOne(Hero->sprno, GetItemAttr2(Hero->sprno, Hero->mantle, ITEMSHOW));
	}
	// 011030 KHS JJING
	const int jjing = ((RareMain*)&EquipItemAttr[WT_ARMOR].attr[IATTR_RARE_MAIN])->grade;

	if (jjing >= 5)
	{
		Hero->jjing = jjing;
		LoadHeroClothAccessoryDataOne( Hero->sprno, GetItemAttr( EquipItemAttr[ WT_ARMOR].item_no, ITEMSHOW )+200);
	}
}

void RecvChrItemInfo_2( t_chr_item_info2 *i )
{
	int a; 

	for(a=0;a<6;a++)
	{
		QuickItemAttr[a] = i->quick[a];
	}

	//soto-1.02
	if(QuickItemAttr[5].item_no)
	{
		g_SymBolMgr.SetDualItem(QuickItemAttr[5].item_no,QuickItemAttr[5].attr[0]);
	}
	//soto-1.02

	if( g_StartMenuOn ) ReqItemInfo1( );
}

void RecvItemEquip( t_chr_status_info *chr )
{
	if( chr->fStr ) { SCharacterData.nCharacterAbility[STR] = chr->Str; } 
	if(	chr->fCon ) { SCharacterData.nCharacterAbility[CON] = chr->Con; } 
	if( chr->fDex ) { SCharacterData.nCharacterAbility[DEX] = chr->Dex; } 
	if(	chr->fWis ) { SCharacterData.nCharacterAbility[WIS] = chr->Wis; } 
	if(	chr->fInt ) { SCharacterData.nCharacterAbility[INT_] = chr->Int; } 
	if(	chr->fMoveP ) { SCharacterData.nCharacterAbility[MOVP] = chr->MoveP; } 
	if(	chr->fChar ) { SCharacterData.nCharacterAbility[CHA] = chr->Char; } 
	if(	chr->fEndu ) { SCharacterData.nCharacterAbility[ENDU] = chr->Endu; } 
	if(	chr->fHealth ) { SCharacterData.nCharacterAbility[HEALTH] = chr->Health; } 
	if(	chr->fMoral ) { SCharacterData.nCharacterAbility[MOR] = chr->Moral; } 
	if(	chr->fLuck ) { SCharacterData.nCharacterAbility[LUCK] = chr->Luck; } 
	if(	chr->fHp ) { SCharacterData.nCharacterHP = chr->Hp; } 
	if(	chr->fAp ) { SCharacterData.nCharacterSP = chr->Ap; } 
	if(	chr->fMp ) { SCharacterData.nCharacterMP = chr->Mp; } 
	if(	chr->fAc ) { SCharacterData.nCharacterAbility[AC] = chr->Ac; } 

	if(	chr->fDamage ) { SCharacterData.nCharacterAbility[DAMAGE] = chr->Dam_Min*1000 + chr->Dam_Max;} 
	if( chr->fHit ) { SCharacterData.nCharacterAbility[HIT] = chr->Hit; } 
	if(	chr->fWsPs ) { SCharacterData.nCharacterAbility[WSPS] = chr->WsPs; } 

	
//  俊聪皋捞记 锅龋甫  old 单捞磐客 厚背窍咯 促福搁 辑滚肺 沥焊甫 焊郴霖促.
//	SendAnimationInfo( );
//
}


//############################ 概流 酒捞能 抛捞喉 肺靛棺 捞固瘤 肺靛  ##########################//
CMagic magic[MAX_MAGIC_];
Spr		magic_spr[MAGIC_SPR_MAX];

void CMagic::LoadExplain(int num, FILE *fp)
{
	char temp[MAX_STRING_];
	char *token;

	fgets( temp, MAX_STRING_, fp );

	token = strtok(temp, "\t\n");
	token = strtok(NULL, "\t\n");
	token = strtok(NULL, "\t\n");
	if( token )	SetExplain(token);
}

bool ReadMagicExplain()
{
	char filename[MAX_FILENAME];
	FILE *fp;
	int num;

	if( SCharacterData.nCharacterData[SPELL] )
		sprintf(filename, "./magic/priest_ex.txt");
	else
		sprintf(filename, "./magic/wizard_ex.txt");

	if( fp=Fopen(filename, "rt") )
	{
		while( !feof(fp) )
		{

⌨️ 快捷键说明

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