本文整理汇总了C++中CHAR_getItemIndex函数的典型用法代码示例。如果您正苦于以下问题:C++ CHAR_getItemIndex函数的具体用法?C++ CHAR_getItemIndex怎么用?C++ CHAR_getItemIndex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHAR_getItemIndex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NPC_Util_RemoveItemByID
/*
* キャラクターがもっているアイテムを1個抹消する。そのアイテムは
* アイテムIDで指定する。アイテム表を前から検索していって、
* 最初にヒットしたやつを削除する。
*
* int charindex : キャラクタのindex
* int itemid : アイテムのID . itemset.txt に記述されている。
* BOOL net: ネットワークをするかどうか。TRUEだとする。
*
* アイテムをもっていて削除できたら TRUE , 削除できなかったらFALSE
*/
BOOL NPC_Util_RemoveItemByID( int charindex, int itemid, BOOL net )
{
int i;
for(i=0;i<CHAR_MAXITEMHAVE;i++){
int ii = CHAR_getItemIndex( charindex , i);
if( ITEM_CHECKINDEX(ii)
&& ITEM_getInt( ii, ITEM_ID ) == itemid){
/* キャラクタがもっているアイテムを*/
CHAR_setItemIndex( charindex , i , -1 );
/*
* そのアイテムを世界から消去する。
* つまりアイテム表から抹消する
*/
ITEM_endExistItemsOne( ii );
/* 両手持ち武器 */
if( ii == CHAR_ARM1 && CHAR_getItemIndex(charindex,CHAR_ARM2)
== -2 )
CHAR_setItemIndex(charindex,CHAR_ARM2,-1);
if(net)CHAR_sendStatusString( charindex, "I");
return TRUE;
}
}
return FALSE;
}
示例2: NPC_SimpleShopGetEscapedItemString
/*
* TK¤ÇÁ÷¤ë¤¿¤á¤Î »ú ¤ò¤Ä¤¯¤ë¡e
*/
static void NPC_SimpleShopGetEscapedItemString( int shopindex,
int cliindex, char *str )
{
int i, cost, cl, imageno, itemindex;
char *itemname;
char tmp[1024];
char escapedname[256];
// char *oli; /* oli means onelineinfo */
str[0] = '\0';
/* ¤Þ¤ºÅ¹¤Î ¤Á ¤Î¥ê¥¹¥È */
for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
itemindex=CHAR_getItemIndex( shopindex , i );
if( ITEM_CHECKINDEX(itemindex) ){
itemname = ITEM_getChar( itemindex, ITEM_SECRETNAME );
makeEscapeString( itemname, escapedname, sizeof(escapedname));
cost = ITEM_getInt( itemindex, ITEM_COST );
/* ¶â³Û¤ÎÄ´À°¡eMERCHANTLEVEL¤Ë¤è¤Ã¤Æ ¤ï¤ë¡e */
cost *= NPC_Util_buyRate(cliindex);
cl = ITEM_getInt( itemindex, ITEM_LEVEL );
imageno = ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER );
//oli = ITEM_getMemo( itemindex );
#if 0
snprintf( tmp, sizeof(tmp), "|%s|%d|%d|%d|%s",
escapedname, cost, cl, imageno, oli );
#endif
snprintf( tmp, sizeof(tmp), "|%s|%d|%d|%d|",
escapedname, cost, cl, imageno );
strcat( str, tmp );
}
}
/* ±¤Ë¡bµÒ¤Î ¤Á ¤Î¥ê¥¹¥È */
for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
itemindex=CHAR_getItemIndex( cliindex , i );
if( ITEM_CHECKINDEX(itemindex) ){
cost = ITEM_getInt( itemindex, ITEM_COST );
/* ¶â³Û¤ÎÄ´À°¡eMERCHANTLEVEL¤Ë¤è¤Ã¤Æ ¤ï¤ë¡e */
cost *=NPC_Util_sellRate(cliindex);
snprintf( tmp, sizeof(tmp), "|%d", cost );
strcat( str, tmp );
}else{
/* ¥¢¥¤ ¥à¤ò ¤Ã¤Æ¤Ê¤¤¾ì½ê¤Ë¤Ï0¤ò¤¤¤ì¤ë */
strcat( str, "|0" );
}
}
}
示例3: NPC_PAGetMyLimtItem
int NPC_PAGetMyLimtItem(int talker, char *argstr, char* token, int sizes)
{
char token2[NPC_UTIL_GETARGSTR_LINEMAX];
int i=1;
int itemindex;
int flg=0;
flg = 0;
for( i=CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE ; i++ ){
itemindex = CHAR_getItemIndex( talker , i );
if( ITEM_CHECKINDEX( itemindex) ){
//==
char escapedname[256];
char *eff;
char name[256];
int cost = ITEM_getInt( itemindex, ITEM_COST);
//int rate = 1;
//cost = (int)(cost * rate);
strcpy( escapedname, ITEM_getChar( itemindex, ITEM_SECRETNAME));
makeEscapeString( escapedname, name, sizeof( name));
eff=ITEM_getChar(itemindex, ITEM_EFFECTSTRING);
makeEscapeString( eff, escapedname, sizeof(escapedname));
sprintf(token2,"%s|%d|%d|%d|%s|%d|",
name, flg, cost, ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER),
escapedname, i
);
//==
strncat( token, token2, sizeof( token2));
}
}
return 1;
}
示例4: NPC_reCheckItemPilenum
//»¹ÔÌúǹÈþ¶Ñµþ
void NPC_reCheckItemPilenum( int meindex, int toindex)
{
int i, itemindex;
for( i=0; i<CHAR_MAXITEMHAVE; i++){
itemindex = CHAR_getItemIndex( toindex , i );
if( !ITEM_CHECKINDEX( itemindex) ) continue;//ITEM_USEPILENUMS
if( ITEM_getInt( itemindex, ITEM_ID) != 20284 ) continue;
if( ITEM_getInt( itemindex, ITEM_CANBEPILE) != 1 ) continue;
if( ITEM_getInt( itemindex, ITEM_USEPILENUMS) > 1 ){
int itemID, pilenum=1, newindex;
itemID = ITEM_getInt( itemindex, ITEM_ID);
if( !ITEM_CHECKITEMTABLE( itemID) ) continue;
pilenum = ITEM_getInt( itemindex, ITEM_USEPILENUMS);
while( pilenum > 1 ){
int ti = CHAR_findEmptyItemBox( toindex);
if( ti == -1 ){
CHAR_sendItemDataOne( toindex, i);
CHAR_talkToCli( toindex, -1, "µÀ¾ßÀ¸Î»ÒÑÂú¡£", CHAR_COLORYELLOW);
return;
}
newindex = ITEM_makeItemAndRegist( itemID);
if( !ITEM_CHECKINDEX( newindex) ) break;
CHAR_setItemIndex( toindex , ti, newindex);
CHAR_sendItemDataOne( toindex, ti);
pilenum--;
ITEM_setInt( itemindex, ITEM_USEPILENUMS, pilenum);
}
if( ITEM_getInt( itemindex, ITEM_CANBEPILE) != ITEMTBL_getInt( itemID, ITEM_CANBEPILE) )
ITEM_setInt( itemindex, ITEM_CANBEPILE, ITEMTBL_getInt( itemID, ITEM_CANBEPILE) );
CHAR_sendItemDataOne( toindex, i);
}
}
CHAR_talkToCli( toindex, -1, "ÌúǹÈþ´¦ÀíÍê±Ï¡£", CHAR_COLORYELLOW);
}
示例5: ITEM_contract
void ITEM_contract( int charaindex, int toindex, int haveitemindex)
{
int itemindex;
int conindex;
char data[2048+1024];
if( !CHAR_CHECKINDEX( charaindex ) ) return;
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if( !ITEM_CHECKINDEX(itemindex) ) return;
//conindex = atoi( ITEM_getChar( itemundex, ITEM_CONTRACTNUM));
conindex = atoi( ITEM_getChar( itemindex, ITEM_ARGUMENT));
sprintf( data, "%s|%d|%s|%s", ITEM_contractTbl[conindex].detail,
ITEM_contractTbl[conindex].argnum,
ITEM_getChar( itemindex, ITEM_CONTRACTARG),
ITEM_getChar( itemindex, ITEM_CONTRACTTIME) );
print("\n contract_send:%s\n", data);
lssproto_WN_send( getfdFromCharaIndex( charaindex), WINDOW_MESSAGETYPE_CONTRACT,
WINDOW_BUTTONTYPE_YESNO,
CHAR_WINDOWTYPE_CONTRACT_ANSWER,
itemindex,
data );
}
示例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_BusCheckDeniedItem
/**************************************
* ϶�ý�ľ��ʧ�� ةë �Ȼ����¾�������������
* �Ȼ������շֻ�
**************************************/
static BOOL NPC_BusCheckDeniedItem( int meindex, int charaindex, char *argstr)
{
char buf[1024];
BOOL found = TRUE;
if( NPC_Util_GetStrFromStrWithDelim( argstr, "denieditem", buf, sizeof( buf))
!= NULL )
{
int i;
int ret;
for( i = 1; ; i ++) {
int itemid;
char buf2[64];
int j;
ret = getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof(buf2));
if( ret == FALSE ) break;
itemid = atoi( buf2);
for( j = 0; j < CHAR_MAXITEMHAVE; j ++) {
int itemindex = CHAR_getItemIndex( charaindex, j);
if( ITEM_CHECKINDEX( itemindex)) {
if( ITEM_getInt( itemindex, ITEM_ID) == itemid) {
found = FALSE;
break;
}
}
}
}
}
return found;
}
示例8: NPC_SimpleShopProcessBuyMsg
static BOOL NPC_SimpleShopProcessBuyMsg(char *msg, int shopindex,
int playerindex )
{
int shopwindowindex, itemtableindex,itemind;
int price, tmpgold;
char buf[64];
if(!CHAR_CHECKINDEX(shopindex)||!CHAR_CHECKINDEX(playerindex))
return -1;
if( !getStringFromIndexWithDelim( msg,"|",4,buf,sizeof(buf) )){
return -1;
}
shopwindowindex = atoi(buf);
itemtableindex=NPC_ShopWindowIndexToItemTableIndex( shopindex, shopwindowindex );
itemind = CHAR_getItemIndex(shopindex,itemtableindex );
if( ! ITEM_CHECKINDEX(itemind) ) return -1;
price = ITEM_getInt( itemind, ITEM_COST )
* NPC_Util_buyRate(playerindex);
tmpgold = CHAR_getInt(playerindex,CHAR_GOLD);
if( tmpgold < price ){
return -2;
}
if( ! NPC_Util_moveItemToChar(playerindex,itemind,TRUE ) ){
return -3;
}
CHAR_AddGold( playerindex, price );
CHAR_sendStatusString( playerindex , "P");
return 1;
}
示例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: ITEM_useFieldChange_Battle
//--------------------------------------------------------------
// ¥Õ¥£¡¼¥ë¥É°À ¹¹¥¢¥¤ ¥à¤ò»È¤Ã¤¿¾ì¹ç¤Î½è
//--------------------------------------------------------------
// Àï ¤Î¾ì¹ç
void ITEM_useFieldChange_Battle(
int charaindex, // »È¤Ã¤¿¿Í¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
int toNo, // »È¤ï¤ì¤ë¿Í¤Î ¹æ
int haveitemindex // »È¤¦¿Í¤Î¥¢¥¤ ¥à¤Î ¹æ
)
{
int itemindex;
char *pArg;
// ¥¢¥¤ ¥à¤¬¤¢¤ë¤«¤É¤¦¤«
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
//------- ¤³¤³¤«¤é½è -----------
// ¥Ñ¥é¥á¡¼¥¿¤ò¼è
pArg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
// ¥Ñ¥é¥á¡¼¥¿ ¤¤¤Î¤Ç¼º
if( pArg == NULL )return ;
BATTLE_FieldAttChange( charaindex, pArg );
// Àï ¤Ë¥¢¥¤ ¥à¤¬¾Ã¤¨¤¿¾ì¹ç¤Î¶¦Ä̽è
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
示例11: NPC_PoolItemShop_MakeItemString_Pool
static void NPC_PoolItemShop_MakeItemString_Pool( int meindex, int talkerindex,
char *retstring,int retstringlen)
{
int i;
int itemindex;
int pos = 0;
char buff[1024];
retstring[0] = '\0';
for( i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++ ) {
itemindex = CHAR_getItemIndex( talkerindex, i);
if( ITEM_CHECKINDEX( itemindex)) {
int poolflg = FALSE;
if( ITEM_getInt( itemindex, ITEM_DROPATLOGOUT) ||
ITEM_getInt( itemindex, ITEM_VANISHATDROP) ||
!ITEM_getInt( itemindex, ITEM_CANPETMAIL)){
poolflg = TRUE;
}
snprintf( buff, sizeof( buff),
"%s|%d|%d|%d|%s|%d|",
ITEM_getChar( itemindex, ITEM_SECRETNAME),
poolflg,CHAR_getWorkInt( meindex, NPC_WORK_COST),
ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER),
ITEM_getChar( itemindex, ITEM_EFFECTSTRING),
i + 1 );
if( pos +strlen( buff)>= retstringlen) {
fprint( "buffer over err\n");
break;
}
strcpy( &retstring[pos], buff);
pos += strlen( buff);
}
}
}
示例12: NPCEnemy_WarpManReduce
BOOL NPCEnemy_WarpManReduce(int meindex,int talker,char *buf)
{
char buf2[512];
char buf3[256];
int id=0;
int i;
int itemindex;
int itemno;
int kosuu;
int cnt=0;
getStringFromIndexWithDelim(buf,"=",2,buf2,sizeof(buf2));
getStringFromIndexWithDelim(buf2,"*",1,buf3,sizeof(buf3));
itemno = atoi(buf3);
getStringFromIndexWithDelim(buf2,"*",2,buf3,sizeof(buf3));
kosuu = atoi(buf3);
for( i=0 ; i < CHAR_MAXITEMHAVE;i++ ){
itemindex=CHAR_getItemIndex( talker , i );
if( ITEM_CHECKINDEX(itemindex) ){
id=ITEM_getInt(itemindex ,ITEM_ID );
if(itemno==id){
cnt++;
if(cnt==kosuu){
return TRUE;
}
}
}
}
return FALSE;
}
示例13: NPC_QuizItemFullCheck
BOOL NPC_QuizItemFullCheck(int meindex,int talker)
{
int i;
int itemindex;
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
char buf2[32];
for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) {
itemindex = CHAR_getItemIndex( talker , i );
if( !ITEM_CHECKINDEX( itemindex) ) {
return TRUE;
}
}
if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL)
{
print("GetArgstrErr:Quiz %s",CHAR_getChar( meindex, CHAR_NAME));
}
if(NPC_Util_GetStrFromStrWithDelim( argstr,"EntryItem", buf2, sizeof( buf2)) != NULL)
{
if(NPC_EntryItemCheck( talker, buf2) == FALSE) {
NPC_Quiz_selectWindow( meindex, talker, 3);
return FALSE;
} else {
return TRUE;
}
}
return FALSE;
}
示例14: ITEM_useAttReverse_Battle
//--------------------------------------------------------------
// ���� ��ʧ�� ةë��������������
//--------------------------------------------------------------
// �� ������
void ITEM_useAttReverse_Battle(
int charaindex, // �������м��̼������͵�
int toNo, // ����ľ���м� į
int haveitemindex // �����м�ʧ�� ة�� į
)
{
int itemindex, battleindex, attackNo;
// ʧ�� ة��ؤ�¾�������
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
//------- ������� -----------
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
// �幻
BATTLE_MultiAttReverse( battleindex, attackNo, toNo,
SPR_item3, SPR_kyu );
// �� ��ʧ�� ة����������������ɧ��
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
示例15: ITEM_useFieldChange_Battle
//--------------------------------------------------------------
// ��ū���������� ��ʧ�� ةë��������������
//--------------------------------------------------------------
// �� ������
void ITEM_useFieldChange_Battle(
int charaindex, // �������м��̼������͵�
int toNo, // ����ľ���м� į
int haveitemindex // �����м�ʧ�� ة�� į
)
{
int itemindex;
char *pArg;
// ʧ�� ة��ؤ�¾�������
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
//------- ������� -----------
// �ɷ¶�����ë��
pArg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
// �ɷ¶����� �м�ƥ��
if( pArg == NULL )return ;
BATTLE_FieldAttChange( charaindex, pArg );
// �� ��ʧ�� ة����������������ɧ��
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}