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

📄 char_item.c

📁 石器时代2.0完整版源代码.已经加入新功能. 在REDHAT9下GCC3.4编译成功.
💻 C
📖 第 1 页 / 共 5 页
字号:
		}		if( (amount > money) || (money > MaxGold))	{			if( money > MaxGold )	{				CHAR_setInt( charaindex, CHAR_GOLD, 0 );				print("\n ERR: %s(stone%d) dropMoney%d > CHAR_MAXGOLDHAVE !!",						CHAR_getChar(charaindex, CHAR_CDKEY), money, amount);			}else	{				print("\n ERR: %s dropMoney > CHAR_GOLD !!", CHAR_getChar(charaindex, CHAR_CDKEY));			}			CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD);			return;		}	}	//ANDY_END	for( i  = 0 ; i < 7 ; i  ++ ){		dirx[i+2] = CHAR_getDX( CHAR_getInt(charaindex,CHAR_DIR) + i+1 );		diry[i+2] = CHAR_getDY( CHAR_getInt(charaindex,CHAR_DIR) + i+1 );	}	dirx[0] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR));	diry[0] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR));	dirx[1] = 0;	diry[1] = 0;	for( i = 0 ; i < 9 ; i ++ ){		int x = CHAR_getInt(charaindex,CHAR_X) + dirx[i];		int y = CHAR_getInt(charaindex,CHAR_Y) + diry[i];// CoolFish 2002/04/06 下注处不可丢置石币#ifdef _DROPSTAKENEW		{			int j = 0;			for(j = 0; j < arraysizeof(casinomap); j++)			{				if(CHAR_getInt(charaindex, CHAR_FLOOR) == casinomap[j].casinofl)				{					if (x == casinomap[j].casinox && y == casinomap[j].casinoy)					{						CHAR_talkToCli(charaindex, -1, "这里不能放置石币!", CHAR_COLORYELLOW);						return;					}				}			}		}#endif		ret = CHAR_DropMoneyFXY( charaindex,amount,								 CHAR_getInt(charaindex,CHAR_FLOOR),								 x,y, FALSE, &objindex );		switch( ret ){		case 0:			goto END;			break;		case -1:			return;			break;		case -3:			return;			break;		case -2:		case -4:		case -5:		case -6:			break;		default:			break;		}	}	{		int x = CHAR_getInt(charaindex,CHAR_X) + dirx[1];		int y = CHAR_getInt(charaindex,CHAR_Y) + diry[1];		ret = CHAR_DropMoneyFXY( charaindex,amount,								 CHAR_getInt(charaindex,CHAR_FLOOR),								 x,y, TRUE, &objindex );		switch( ret ){		case 0:			goto END;			break;		case -1:			break;		case -3:			return;			break;		case -2:		case -4:		case -5:			break;		default:			break;		}		return;	}END:	CHAR_sendWatchEvent(objindex,CHAR_ACTSTAND,NULL,0,TRUE );	CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD);	return;}static int CHAR_findEmptyItemBoxNoFromChar( Char* ch ){	int i, j=0;;	for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE  ; i ++ ){		int     itemindex;		itemindex = ch->indexOfExistItems[i];		if( itemindex == -1 )  j++;	}	return j;}int CHAR_findEmptyItemBoxNo( int index ){	Char*   ch;	if( !CHAR_CHECKINDEX( index ) )return -1;	ch = CHAR_getCharPointer(index);	if( ch != NULL )		return CHAR_findEmptyItemBoxNoFromChar( ch );	else		return -1;}// CoolFish: Trade 2001/4/4int CHAR_findTotalEmptyItem( int index ){    int     i, totaleptitem = 0;    Char*   ch;    if( !CHAR_CHECKINDEX( index ) )return -1;    ch = CHAR_getCharPointer(index);    if( ch != NULL ){        for (i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i++){        	int itemindex = 0;                itemindex = ch->indexOfExistItems[i];                if (itemindex == -1) totaleptitem++;        }        return totaleptitem;    }	return -1;}// Robin 0707 petFollowint CHAR_pickupFollowPet( int charaindex, int pickupindex ){	int petindex;	int objindex;	int havepetindex;	char category[3];		if( !CHAR_CHECKINDEX( charaindex ) )	return FALSE;		if( pickupindex != -1 )		petindex = pickupindex;	else		petindex = CHAR_getWorkInt( charaindex, CHAR_WORKPETFOLLOW );			if( !CHAR_CHECKINDEX( petindex ) )	{		CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1 );		return FALSE;	}	havepetindex = CHAR_getCharPetElement( charaindex);	if( havepetindex == -1 ) {		CHAR_talkToCli(charaindex,-1,"宠物栏已满!无法拾回!",CHAR_COLORYELLOW);		return FALSE;	}		objindex = CHAR_getWorkInt( petindex, CHAR_WORKOBJINDEX );	print(" objindex02:%d ", objindex);		if( (pickupindex == -1) || (pickupindex == CHAR_getWorkInt( charaindex, CHAR_WORKPETFOLLOW )   ) )		CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1 );		/* CDKEY 午平乓仿  互域谯仄卅中午五反胶尹卅中 */	if( strcmp( CHAR_getChar( petindex, CHAR_OWNERCDKEY), CHAR_getChar( charaindex, CHAR_CDKEY)) != 0 ||	    strcmp( CHAR_getChar( petindex, CHAR_OWNERCHARANAME), CHAR_getChar( charaindex, CHAR_NAME)) != 0 )	{		//CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1 );				return FALSE;	}		//CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1 );		CHAR_ObjectDelete(objindex);		CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWMODE, CHAR_PETFOLLOW_NONE );			CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, charaindex);	CHAR_setCharPet( charaindex, havepetindex, petindex);#ifdef _PET_TALK	if( CHAR_getInt( petindex, CHAR_PETID) != 718 )	{#endif		CHAR_setChar( petindex, CHAR_OWNERCDKEY, CHAR_getChar( charaindex, CHAR_CDKEY));		CHAR_setChar( petindex, CHAR_OWNERCHARANAME, CHAR_getChar( charaindex, CHAR_NAME));#ifdef _PET_TALK	}#endif	snprintf( category,sizeof( category),"K%d",havepetindex);	CHAR_sendStatusString( charaindex, category);	snprintf( category,sizeof( category),"W%d",havepetindex);	CHAR_sendStatusString( charaindex, category);	CHAR_setInt( petindex, CHAR_PUTPETTIME, 0);	CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT, 0);		CHAR_setWorkInt( petindex, CHAR_WORKOBJINDEX, -1);	{		char    mesg[256];		char    *p = NULL;		p = CHAR_getChar( petindex, CHAR_USERPETNAME);		if( strlen( p) == 0 ) {			p = CHAR_getChar( petindex, CHAR_NAME);		}		snprintf( mesg,sizeof(mesg), "拾回 %s", p);		CHAR_talkToCli(charaindex,-1,mesg,CHAR_COLORYELLOW);	}	// 矢永玄毛胶匀凶夫弘	LogPet(		CHAR_getChar( charaindex, CHAR_NAME ), /* 平乓仿   */		CHAR_getChar( charaindex, CHAR_CDKEY ),		CHAR_getChar( petindex, CHAR_NAME),		CHAR_getInt( petindex, CHAR_LV),		"FollowPickUp(收回溜宠)",		CHAR_getInt( charaindex,CHAR_FLOOR),		CHAR_getInt( charaindex,CHAR_X ),		CHAR_getInt( charaindex,CHAR_Y ),		CHAR_getChar( petindex, CHAR_UNIQUECODE)   // shan 2001/12/14	);	return TRUE;				}#ifdef _GAMBLE_ROULETTEint NPC_MAPCLEANGOLD( int meindex , int floor){	OBJECT  object;	int x,y,fl;	int End_type;	fl = floor;	for( End_type = 0; End_type < arraysizeof(casinomap) ; End_type++ )	{		if( floor != casinomap[ End_type].casinofl )			continue;		x = casinomap[ End_type].casinox;		y = casinomap[ End_type].casinoy;		for( object=MAP_getTopObj(fl,x,y) ; object ; object =  NEXT_OBJECT(object ) )	{			int index = GET_OBJINDEX(object);			int objtype = OBJECT_getType(index);			int itemindex = OBJECT_getIndex( index);			if( objtype == OBJTYPE_NOUSE )continue;			if( objtype == OBJTYPE_ITEM ){				if(ITEM_getInt(itemindex, ITEM_ID) == CASINOTOKENID)	{					ITEM_endExistItemsOne( itemindex);					OBJECT_setIndex( index, 0);					CHAR_ObjectDelete(index);	//清除					print(" clean( %d )", index );				}				break;			}		}		casinomap[End_type].stakenum = 0;	}	return 1;}#endif#ifdef _DROPSTAKENEW// casinotype : flg = 0 不分type,针对整层type做设定;扩充参数// mapdropflag : TRUE = 可以下注;int SetCasinoMap(int npcindex, int casinotype, int mapdropflag){	int npcfloor = CHAR_getInt(npcindex, CHAR_FLOOR);	int i = 0;	if (casinotype < 0 || mapdropflag < 0)		return	-1;	for (i = 0; i < arraysizeof(casinomap); i++)	{		if (npcfloor == casinomap[i].casinofl)		{			if (casinotype != 0)			{				if (casinomap[i].casinotype == casinotype)					casinomap[i].dropflag = mapdropflag;			}			else				casinomap[i].dropflag = mapdropflag;		}	}	return	1;}// 计算积分int CasinoAccumulation(int charindex, int npcindex, int floor, int wincasinotype){	int i = 0;	int accumulation = CHAR_getInt(charindex, CHAR_GAMBLENUM);	char tmpbuf[256];	for (i = 0; i < MAXSTAKENUM; i++)	{		if (CHAR_getWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i) == wincasinotype)		{			int j = 0;			for (j = 0; j < arraysizeof(casinomap); j++)			{				if (casinomap[j].casinotype == wincasinotype)				{ #ifdef _FIX_GAMBLENUM					// 加 原本积分及WIN积分					accumulation = accumulation + casinomap[j].accumulation * 2;#else					accumulation += casinomap[j].accumulation;#endif					CHAR_setWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i, 0);					break;				}			}		}		else if (CHAR_getWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i) != 0)		{			int j = 0;			for (j = 0; j < arraysizeof(casinomap); j++)			{				if (casinomap[j].casinotype == CHAR_getWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i))				{#ifndef _FIX_GAMBLENUM					accumulation -= casinomap[j].accumulation;#endif					CHAR_setWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i, 0);					break;				}			}		}	}	CHAR_setWorkInt(charindex, CHAR_WORKSTAKEFLAG, 0);	if (accumulation < 0)		accumulation = 0;	else if (accumulation > MAXACCUMULATION)		accumulation = MAXACCUMULATION;	CHAR_setInt(charindex, CHAR_GAMBLENUM, accumulation);	snprintf(tmpbuf, sizeof(tmpbuf), "您现在总共有%4d点游乐场积分", accumulation);	CHAR_talkToCli(charindex, npcindex, tmpbuf, CHAR_COLORWHITE);	return 1;}int CasinoPay(int npcindex, int wincasinotype){	int npcfloor = CHAR_getInt(npcindex, CHAR_FLOOR);	int i = 0;	int playernum = CHAR_getPlayerMaxNum();	if (wincasinotype < 0) return FALSE;	for (i = 0; i < playernum; i++)	{		if (CHAR_getCharUse(i) == FALSE) continue;		if (!CHAR_CHECKINDEX(i))	continue;		if (CHAR_getInt(i, CHAR_FLOOR) == npcfloor)		{			// 查询玩家是否有下注			if (CHAR_getWorkInt(i, CHAR_WORKSTAKEFLAG) == 0)				continue;			// 计算积分			CasinoAccumulation(i, npcindex, npcfloor, wincasinotype);		}	}	// 清除此层地面彩券	for (i = 0; i < arraysizeof(casinomap); i++)	{		OBJECT object;		if (casinomap[i].casinofl != npcfloor) continue;		for (object = MAP_getTopObj(casinomap[i].casinofl, casinomap[i].casinox,			casinomap[i].casinoy); object; object = NEXT_OBJECT(object))		{			int index = GET_OBJINDEX(object);			int objtype = OBJECT_getType(index);			int itemindex = OBJECT_getIndex( index);			if (objtype == OBJTYPE_NOUSE) continue;			else if (objtype == OBJTYPE_ITEM)			{				if(ITEM_getInt(itemindex, ITEM_ID) == CASINOTOKENID)				{					OBJECT_setIndex(index, 0);					CHAR_ObjectDelete(index);				}			}		}		casinomap[i].stakenum = 0;	}	return TRUE;}#endif

⌨️ 快捷键说明

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