本文整理汇总了C++中CHAR_getChar函数的典型用法代码示例。如果您正苦于以下问题:C++ CHAR_getChar函数的具体用法?C++ CHAR_getChar怎么用?C++ CHAR_getChar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHAR_getChar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PET_CHECKFreePetIsIt
void PET_CHECKFreePetIsIt( int petindex)
{
int petputtime, defmaxtime;
defmaxtime = getPetdeletetime();
petputtime = CHAR_getInt( petindex, CHAR_PUTPETTIME);
if( NowTime.tv_sec < ( petputtime + getPetdeletetime() ) ) return;
#ifdef _PET_LOSTPET
// CHAR_CharSaveLostPet( petindex, 0);
#endif
LogPet(
"系统",
"Watchfunc",
CHAR_getChar( petindex, CHAR_NAME),
CHAR_getInt( petindex, CHAR_LV),
"timeout_lost(系统清除-地上自由宠)",
CHAR_getInt( petindex, CHAR_FLOOR),
CHAR_getInt( petindex,CHAR_X ),
CHAR_getInt( petindex,CHAR_Y ),
CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14
);
CHAR_CharaDelete(petindex);
}
示例2: PET_CleanPetdeletetime
int PET_CleanPetdeletetime( int objmeindex)
{
int pindex;
if( OBJECT_getType(objmeindex) != OBJTYPE_CHARA ) return 0;
pindex = OBJECT_getIndex( objmeindex);
if( CHAR_getInt( pindex, CHAR_WHICHTYPE) != CHAR_TYPEPET) return 0;
if( CHAR_getInt( pindex, CHAR_MAILMODE) != CHAR_PETMAIL_NONE) {
}else if( CHAR_getWorkInt( pindex, CHAR_WORKPETFOLLOWMODE) == CHAR_PETFOLLOW_NOW ){
}else {
#ifdef _PET_LOSTPET
// CHAR_CharSaveLostPet( pindex, 0);
#endif
LogPet(
"系统",
"Watchfunc",
CHAR_getChar( pindex, CHAR_NAME),
CHAR_getInt( pindex, CHAR_LV),
"timeout_lost(系统清除-地上自由宠)",
CHAR_getInt( pindex, CHAR_FLOOR),
CHAR_getInt( pindex,CHAR_X ),
CHAR_getInt( pindex,CHAR_Y ),
CHAR_getChar( pindex, CHAR_UNIQUECODE) // shan 2001/12/14
);
CHAR_CharaDelete(pindex);
return 1;
}
return 0;
}
示例3: ADDRESSBOOK_AutoaddAddressBook
BOOL ADDRESSBOOK_AutoaddAddressBook( int meindex, int toindex)
{
int hisblank;
int myblank;
int myaddindex, toaddindex;
char *cdkey;
myblank = ADDRESSBOOK_findBlankEntry( meindex );
hisblank = ADDRESSBOOK_findBlankEntry( toindex );
if( hisblank < 0 || myblank < 0) { //"¦W¤ù§X¤wº¡¡C"
return FALSE;
}
cdkey = CHAR_getChar( toindex, CHAR_CDKEY);
myaddindex = ADDRESSBOOK_getIndexInAddressbook( meindex, cdkey,
CHAR_getChar( toindex, CHAR_NAME));
cdkey = CHAR_getChar( meindex, CHAR_CDKEY);
toaddindex = ADDRESSBOOK_getIndexInAddressbook( toindex, cdkey,
CHAR_getChar(meindex, CHAR_NAME));
if( myaddindex < 0 ){
ADDRESSBOOK_entry meae;
ADDRESSBOOK_entry hisentry;
if( ADDRESSBOOK_makeEntryFromCharaindex(toindex,&hisentry) == FALSE ||
ADDRESSBOOK_makeEntryFromCharaindex(meindex,&meae) == FALSE ){
return FALSE;
}
CHAR_setAddressbookEntry( meindex, myblank,&hisentry );
CHAR_setAddressbookEntry( toindex, hisblank,&meae );
ADDRESSBOOK_sendAddressbookTableOne( meindex, myblank);
ADDRESSBOOK_sendAddressbookTableOne( toindex , hisblank);
}
return TRUE;
}
示例4: mproto_Que_Send
void mproto_Que_Send( int fd, int uid, int index, char* question)
{
char buffer[65500], wheres[256];
int checksum=0, floor, x, y;
char *cdkey = CHAR_getChar( index, CHAR_CDKEY);
char *charname = CHAR_getChar( index, CHAR_NAME);
if( strlen( question) <= 0 ){
CHAR_talkToCli( index, -1, "字串长度不足!", CHAR_COLORYELLOW);
return;
}
memset( wheres, 0, sizeof( wheres));
floor = CHAR_getInt( index, CHAR_FLOOR);
x = CHAR_getInt( index, CHAR_X);
y = CHAR_getInt( index, CHAR_Y);
sprintf( wheres, "%d,%d,%d", floor, x, y);
memset( buffer, 0, sizeof( buffer));
strcpy(PersonalKey, MSPERSIONALKEY);
checksum += util_mkint(buffer, uid);
checksum += util_mkstring(buffer, cdkey);
checksum += util_mkstring(buffer, charname);
checksum += util_mkstring(buffer, question);
checksum += util_mkstring(buffer, wheres);
util_mkint(buffer, checksum);
util_SendMesg(fd, MPROTO_QUE_SEND, buffer);
}
示例5: NPC_PairRegister
BOOL NPC_PairRegister( int toindex)
{
char *cdKey = CHAR_getChar( toindex, CHAR_CDKEY);
char *name = CHAR_getChar( toindex, CHAR_NAME);
int space=-1,i;
int Psex = CHAR_getSexInt( CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) );
Psex = (Psex==1)?0:1;
for( i=0; i<MAXPAIRNUMS; i++) {
if( PairList[Psex][i].use <= 0 ){
if( space == -1 ) space = i;
continue;
}
if( !strcmp( cdKey, PairList[Psex][i].cdKey) )
break;
}
if( i>=MAXPAIRNUMS){
if( space != -1 && CHAR_getWorkInt( toindex, CHAR_MYPAIRCODE) > 0 ){
PairList[Psex][space].use = 1;
PairList[Psex][space].forindex = -1;
sprintf( PairList[Psex][space].cdKey, "%s", cdKey);
sprintf( PairList[Psex][space].name, "%s", name);
PairList[Psex][space].pindex = toindex;
PairList[Psex][space].code = CHAR_getWorkInt( toindex, CHAR_MYPAIRCODE);
CHAR_talkToCli( toindex, -1, "新增至配对名单。", CHAR_COLORYELLOW);
return TRUE;
}
}
return FALSE;
}
示例6: BATTLE_ItemUseDelete
int BATTLE_ItemUseDelete(
int charaindex,
int haveitemindex
)
{
int itemindex;
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if( ITEM_CHECKINDEX( itemindex ) == FALSE ) return 0;
{
LogItem(
CHAR_getChar( charaindex, CHAR_NAME ),
CHAR_getChar( charaindex, CHAR_CDKEY ),
#ifdef _add_item_log_name // WON ADD ¦bitemªºlog¤¤¼W¥[item¦WºÙ
itemindex,
#else
ITEM_getInt( itemindex, ITEM_ID ),
#endif
"BattleUse(¾Ô°«¤¤¨Ï¥Î±¼ªº¹D¨ã)",
CHAR_getInt( charaindex,CHAR_FLOOR),
CHAR_getInt( charaindex,CHAR_X ),
CHAR_getInt( charaindex,CHAR_Y ),
ITEM_getChar( itemindex, ITEM_UNIQUECODE),
ITEM_getChar( itemindex, ITEM_NAME),
ITEM_getInt( itemindex, ITEM_ID)
);
}
CHAR_DelItemMess( charaindex, haveitemindex, 0);
return 0;
}
示例7: NPC_RoomAdminNew_DspNextAuction
/*-----------------------------------------------
* ¼¡²ó³«ºÅ»þ´Ö¡¤Éô²°¤ò¸À¤¦
*----------------------------------------------*/
static void NPC_RoomAdminNew_DspNextAuction( int meindex, int talkerindex)
{
char msgbuf[2048];
time_t closetime;
closetime = CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME);
/* ¼¡¤Î³«ºÅ»þ´Ö¤¬·è¤Þ¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¡Ö·è¤Þ¤Ã¤Æ¤Þ¤»¤ó¡£¡×¥á¥Ã¥»¡¼¥¸*/
if( closetime == 0 ) {
snprintf( msgbuf, sizeof( msgbuf),
NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION_NONE
);
CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR);
}
else {
int doorindex;
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
char explain[1024]; /*ÀâÌÀ*/
char buff[16];
struct tm tmwk;
int difftime;
/* Éô²°¾ðÊó¤ò¼èÆÀ */
doorindex = NPC_DoorSearchByName(
CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM));
NPC_Util_GetArgStr( doorindex, argstr, sizeof( argstr));
getStringFromIndexWithDelim(argstr, "|" , 9 , explain,sizeof(explain));
/* Éô²°¾ðÊó*/
if( strlen(CHAR_getChar( doorindex, CHAR_NAME) ) != 0 ) {
strcpy( buff, "¸¹«Ç");
}
else {
buff[0] = '\0';
}
snprintf( msgbuf, sizeof( msgbuf),
NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION1,
explain,
CHAR_getChar( doorindex, CHAR_NAME),
buff
);
CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR);
/* Äù¤áÀÚ¤ê»þ´Ö */
memcpy( &tmwk, localtime( &closetime), sizeof( tmwk));
difftime = closetime - NowTime.tv_sec;
snprintf( msgbuf, sizeof( msgbuf),
NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION2,
tmwk.tm_hour,
tmwk.tm_min,
difftime / 3600,
(difftime % 3600) / 60
);
CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR);
/* ²¼¸Â¶â³Û */
snprintf( msgbuf, sizeof( msgbuf),
NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION3,
CHAR_getWorkChar( doorindex, CHAR_WORKDOORGOLDLIMIT)
);
CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR);
}
}
示例8: ADDRESSBOOK_makeEntryFromCharaindex
static BOOL ADDRESSBOOK_makeEntryFromCharaindex( int charaindex,
ADDRESSBOOK_entry* ae)
{
char *cdkey;
if( !CHAR_CHECKINDEX(charaindex) ) return FALSE;
memset( ae,0,sizeof(ADDRESSBOOK_entry) );
cdkey = CHAR_getChar( charaindex, CHAR_CDKEY);
if( cdkey == NULL ){
print( "ADDRESSBOOK_makeEntryFromCharaindex:"
" strange! getcdkeyFromCharaIndex returns NULL!"
" charaindex: %d\n" , charaindex );
return FALSE;
}
strcpysafe( ae->cdkey , sizeof( ae->cdkey ),cdkey);
strcpysafe( ae->charname,sizeof( ae->charname),
CHAR_getChar(charaindex,CHAR_NAME) );
ae->level = CHAR_getInt( charaindex , CHAR_LV );
ae->duelpoint = CHAR_getInt( charaindex, CHAR_DUELPOINT);
ae->graphicsno = CHAR_getInt( charaindex , CHAR_FACEIMAGENUMBER );
ae->online = getServernumber();
ae->use = TRUE;
ae->transmigration = CHAR_getInt( charaindex, CHAR_TRANSMIGRATION);
return TRUE;
}
示例9: BATTLE_ItemUseDelete
int BATTLE_ItemUseDelete(
int charaindex,
int haveitemindex
)
{
int itemindex;
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if( ITEM_CHECKINDEX( itemindex ) == FALSE ) return 0;
{
LogItem(
CHAR_getChar( charaindex, CHAR_NAME ),
CHAR_getChar( charaindex, CHAR_CDKEY ),
#ifdef _add_item_log_name // WON ADD ��item��log������item����
itemindex,
#else
ITEM_getInt( itemindex, ITEM_ID ),
#endif
"BattleUse(ս����ʹ�õ��ĵ���)",
CHAR_getInt( charaindex,CHAR_FLOOR),
CHAR_getInt( charaindex,CHAR_X ),
CHAR_getInt( charaindex,CHAR_Y ),
ITEM_getChar( itemindex, ITEM_UNIQUECODE),
ITEM_getChar( itemindex, ITEM_NAME),
ITEM_getInt( itemindex, ITEM_ID)
);
}
CHAR_DelItemMess( charaindex, haveitemindex, 0);
return 0;
}
示例10: ChatRoom_Refresh
void ChatRoom_Refresh ( int Num )
{
int fd , i , RoomLeader = -1 ;
char token[2048] ;
char token2[2096] ;
char buf[64] ;
if ( ChatRoom[ Num ].useFlag == TRUE ) {
sprintf ( token , "R|r%d|%s|%d|%s|p%d|" ,
Num ,
ChatRoom[ Num ].RoomName ,
ChatRoom[ Num ].Maker ,
CHAR_getChar ( ChatRoom[ Num ].Maker , CHAR_NAME ) ,
ChatRoom[ Num ].NowPeople );
for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) {
if ( ChatRoom[ Num ].MemberList[ i ] != -1 ) {
sprintf( buf , "I%d|%s|%s|" ,
ChatRoom[ Num ].MemberList[ i ] ,
CHAR_getChar ( ChatRoom[ Num ].MemberList[ i ] , CHAR_NAME ) ,
CHAR_getChar ( ChatRoom[ Num ].MemberList[ i ] , CHAR_OWNTITLE )
);
strncat ( token , buf , sizeof ( buf ) ) ;
}
}
}
for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) {
if ( ChatRoom[ Num ].MemberList[ i ] != -1 ) {
if ( CHAR_getWorkInt ( ChatRoom[ Num ].MemberList[ i ] , CHAR_WORKCHATROOMTYPE ) == 1 ) RoomLeader = 1;
else RoomLeader = 0 ;
sprintf ( token2 , "%s%d|" , token , RoomLeader ) ;
fd= getfdFromCharaIndex ( ChatRoom[ Num ].MemberList[ i ] );
lssproto_CHATROOM_send ( fd , token2 ) ;
}
}
}
示例11: NPC_PairForage
BOOL NPC_PairForage( int meindex, int toindex, char *arg, char *token)
{
char buf1[256];
int i;
int codes = CHAR_getWorkInt( toindex, CHAR_MYPAIRCODE);
int Psex = CHAR_getSexInt( CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) );
Psex = (Psex==1)?1:0;
for( i=0; i<MAXPAIRNUMS; i++) {//forindex
char *name;
char *cdKey;
int fd;
char buf[256];
if( PairList[Psex][i].use <= 0 ) continue;
if( !CHAR_CHECKINDEX( PairList[Psex][i].pindex) ) continue;
if( CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE )
continue;
if( codes != CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRCODE) ) continue;
if( CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRFLG) > 0 ) continue;
name = CHAR_getChar( PairList[Psex][i].pindex, CHAR_NAME);
cdKey = CHAR_getChar( PairList[Psex][i].pindex, CHAR_CDKEY);
if( strcmp( PairList[Psex][i].name, name) || strcmp( PairList[Psex][i].cdKey, cdKey) ){
PairList[Psex][i].use = -1;
PairList[Psex][i].forindex = -1;
continue;
}
sprintf( token, "你的配对对象为: %s\n已送出邀请,请等候对方回应。", name);
if( NPC_Util_GetStrFromStrWithDelim( arg, "InviteMsg", buf1, sizeof( buf1) ) == NULL){
break;
}
PairList[Psex][i].forindex = toindex;
fd = getfdFromCharaIndex( PairList[Psex][i].pindex);
CHAR_setWorkInt( toindex, CHAR_MYPAIRFLG, 1);
CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, PairList[Psex][i].pindex);
CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRFLG, 2);
CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRINDEX, toindex);
name = CHAR_getChar( toindex, CHAR_NAME);
sprintf( buf, "%s:\n玩家%s\n%s", CHAR_getChar( meindex, CHAR_NAME),name, buf1);
lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OKCANCEL, WINDOW_TALKPAIR,
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), buf);
break;
}
if( i>= MAXPAIRNUMS ) {
if( NPC_Util_GetStrFromStrWithDelim( arg, "NoPairMsg", buf1, sizeof( buf1) ) != NULL){
sprintf( token, "%s",buf1);
}else {
sprintf( token, "没有找到对象。");
}
if( CHAR_getWorkInt( toindex, CHAR_MYPAIRFLG) <= 0 ) {
NPC_PairRegister( toindex);
}
return FALSE;
}
return TRUE;
}
示例12: NPC_DepotPet_Get
void NPC_DepotPet_Get( int meindex, int talker, int select, char *token)
{
int petindex;
int selectpet;
int emptyindex;
char szPet[128];
int workindex[CHAR_MAXPOOLPETHAVE];
int i;
int cnt;
selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) ;
petindex = CHAR_getDepotPetIndex( talker, selectpet);
if( !CHAR_CHECKINDEX( petindex) ) return;
emptyindex = CHAR_getCharPetElement( talker);
if( emptyindex == -1 ) {
fprint( "err\n");
return;
}
CHAR_setCharPet( talker, emptyindex, petindex);
CHAR_setChar( petindex, CHAR_OWNERCHARANAME, CHAR_getChar( talker, CHAR_NAME));
CHAR_setDepotPetIndex( talker, selectpet, -1);
NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_POOLTHANKS, token);
snprintf( szPet, sizeof( szPet ), "K%d", emptyindex);
CHAR_sendStatusString( talker, szPet );
snprintf( szPet, sizeof( szPet), "W%d",emptyindex);
CHAR_sendStatusString( talker, szPet );
for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) {
workindex[i] = -1;
}
cnt = 0;
for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) {
int petindex = CHAR_getDepotPetIndex( talker, i);
if( CHAR_CHECKINDEX( petindex) ) {
workindex[cnt++] = petindex;
}
}
for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) {
CHAR_setDepotPetIndex( talker, i, workindex[i]);
}
LogPet(
CHAR_getChar( talker, CHAR_NAME ),
CHAR_getChar( talker, CHAR_CDKEY ),
CHAR_getChar( petindex, CHAR_NAME),
CHAR_getInt( petindex, CHAR_LV),
"draw(ÁìÈ¡²Ö¿â³èÎï)",
CHAR_getInt( talker,CHAR_FLOOR),
CHAR_getInt( talker,CHAR_X ),
CHAR_getInt( talker,CHAR_Y ),
CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14
);
#ifdef _PET_EVOLUTION
if( CHAR_getInt( petindex, CHAR_FUSIONBEIT) == 1 &&
CHAR_getInt( petindex, CHAR_FUSIONRAISE) > 0 ){//¼ì²éÊÇ·ñΪÈںϳè
CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, (int)time( NULL));
}
#endif
}
示例13: ITEM_useAddexp_Effect
void ITEM_useAddexp_Effect( charaindex, toindex, haveitemindex)
{
int itemindex,power,vtime;
//,pindex
char *p = NULL, *arg;
char szBuffer[1024]="";
itemindex = CHAR_getItemIndex(charaindex,haveitemindex);
// Àˬdª««~
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
if( (p = strstr( arg, "¼W" )) != NULL ){
sscanf( p+2, "%d", &power );
}
if( (p = strstr( arg, "¤À" )) != NULL ){
sscanf( p+2, "%d", &vtime );
}
if( p == NULL )return;
#ifdef _ITEM_ADDEXP2 // ´¼ªG®É¶¡¥i¥H²Ö¥[
{
int point;
point = CHAR_getWorkInt( charaindex, CHAR_WORKITEM_ADDEXP)
* (int)(CHAR_getWorkInt( charaindex, CHAR_WORKITEM_ADDEXPTIME)/60);
if( point >= 72000) {
CHAR_talkToCli( charaindex, -1, "´¼¼z¤§ªG²Öp®É¶¡¤Î®ÄªG¤w¹F¤W¡C", CHAR_COLORYELLOW);
return;
}
point += (power * vtime);
point = min( point, 72000);
vtime = (int)(point / power);
#ifdef _LOG_OTHER
sprintf( szBuffer, "¨Ï¥Î´¼¼z¤§ªG %d\t²Ö¿n®ÄªG= ¤À¼Æ%d ¯à¤O%d¢H ®É¶¡%d¤À ",
ITEM_getInt( itemindex, ITEM_ID ), point, power, vtime);
LogOther(
CHAR_getChar( charaindex, CHAR_CDKEY),
CHAR_getChar( charaindex, CHAR_NAME),
szBuffer );
#endif
//CHAR_setInt( charaindex, CHAR_ADDEXPPOWER, power);
//CHAR_setInt( charaindex, CHAR_ADDEXPTIME,vtime*60 );
//sprintf(szBuffer, "´ú¸Õ°T®§¡G¥Ø«e¤À¼Æ%d ®É¶¡%d¬í¡C", point, vtime*60);
//CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORRED);
}
#endif
CHAR_setWorkInt( charaindex, CHAR_WORKITEM_ADDEXP, power);
CHAR_setWorkInt( charaindex, CHAR_WORKITEM_ADDEXPTIME,vtime*60 );
//²M°£¹D¨ã
BATTLE_ItemUseDelete(charaindex,haveitemindex);
//sprintf(szBuffer, "¾Ç²ß¸gÅ窺¯à¤O´£¤É¤F%d¢H", power);
sprintf(szBuffer, "¾Ç²ß¸gÅ窺¯à¤O´£¤É¤F%d¢H¡A®É®Ä³Ñ¾l%d¤ÀÄÁ¡C", power, vtime);
CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORYELLOW);
}
示例14: ITEM_useAddexp_Effect
void ITEM_useAddexp_Effect( charaindex, toindex, haveitemindex)
{
int itemindex,power,vtime;
//,pindex
char *p = NULL, *arg;
char szBuffer[1024]="";
itemindex = CHAR_getItemIndex(charaindex,haveitemindex);
// �����Ʒ
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
if( (p = strstr( arg, "��" )) != NULL ){
sscanf( p+2, "%d", &power );
}
if( (p = strstr( arg, "��" )) != NULL ){
sscanf( p+2, "%d", &vtime );
}
if( p == NULL )return;
#ifdef _ITEM_ADDEXP2 // �ǹ�ʱ������ۼ�
{
int point;
point = CHAR_getWorkInt( charaindex, CHAR_WORKITEM_ADDEXP)
* (int)(CHAR_getWorkInt( charaindex, CHAR_WORKITEM_ADDEXPTIME)/60);
if( point >= 72000) {
CHAR_talkToCli( charaindex, -1, "�ǻ�֮���ۼ�ʱ�估Ч���Ѵ����ޡ�", CHAR_COLORYELLOW);
return;
}
point += (power * vtime);
point = min( point, 72000);
vtime = (int)(point / power);
#ifdef _LOG_OTHER
sprintf( szBuffer, "ʹ���ǻ�֮�� %d\t�ۻ�Ч��= ����%d ����%d�� ʱ��%d�� ",
ITEM_getInt( itemindex, ITEM_ID ), point, power, vtime);
LogOther(
CHAR_getChar( charaindex, CHAR_CDKEY),
CHAR_getChar( charaindex, CHAR_NAME),
szBuffer );
#endif
//CHAR_setInt( charaindex, CHAR_ADDEXPPOWER, power);
//CHAR_setInt( charaindex, CHAR_ADDEXPTIME,vtime*60 );
//sprintf(szBuffer, "����ѶϢ��Ŀǰ����%d ʱ��%d�롣", point, vtime*60);
//CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORRED);
}
#endif
CHAR_setWorkInt( charaindex, CHAR_WORKITEM_ADDEXP, power);
CHAR_setWorkInt( charaindex, CHAR_WORKITEM_ADDEXPTIME,vtime*60 );
//�������
BATTLE_ItemUseDelete(charaindex,haveitemindex);
//sprintf(szBuffer, "ѧϰ���������������%d��", power);
sprintf(szBuffer, "ѧϰ���������������%d����ʱЧʣ��%d���ӡ�", power, vtime);
CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORYELLOW);
}
示例15: NPC_CHECKFREEPETSKILL
BOOL NPC_CHECKFREEPETSKILL( int toindex, int petindex, int skillID)
{
int skillindex=-1;
char SCode[256];
char Free[256];
int i, petID;
skillindex = PETSKILL_getPetskillArray( skillID );
memset( Free, 0, sizeof( Free));
if( !PETSKILL_CHECKINDEX( skillindex) ) {
return FALSE;
}
petID = CHAR_getInt( petindex, CHAR_PETID);
sprintf( SCode, "%s", PETSKILL_getChar( skillindex, PETSKILL_KINDCODE));
sprintf( Free, "%s", PETSKILL_getChar( skillindex, PETSKILL_FREE));
//CHECK CODE
if( !strcmp( SCode, "\0")) {
return TRUE;
}
for( i=0; i<arraysizeof( Code_skill); i++) {
if( Code_skill[i].PetId == petID ) {
break;
}
}
//找不到這只寵物
if( i == arraysizeof( Code_skill) ) {
{
char buff1[256];
sprintf( buff1, "%s不能學特殊技能!!", CHAR_getChar( petindex, CHAR_NAME));
CHAR_talkToCli( toindex, -1, buff1, CHAR_COLORYELLOW);
}
return FALSE;
}
if( strstr( Code_skill[i].Code, SCode ) != NULL ) {
if( NPC_SkillShopPetCheck( toindex, petindex, skillID) == FALSE ) {
char buff1[256];
sprintf( buff1, "%s現在還不能學%s!", CHAR_getChar( petindex, CHAR_NAME),
PETSKILL_getChar( skillindex, PETSKILL_NAME) );
CHAR_talkToCli( toindex, -1, buff1, CHAR_COLORYELLOW);
return FALSE;
}
return TRUE;
}else {
char buff1[256];
sprintf( buff1, "%s不能學%s!!", CHAR_getChar( petindex, CHAR_NAME),
PETSKILL_getChar( skillindex, PETSKILL_NAME) );
CHAR_talkToCli( toindex, -1, buff1, CHAR_COLORYELLOW);
}
return FALSE;
}