本文整理汇总了C++中CHAR_getWorkInt函数的典型用法代码示例。如果您正苦于以下问题:C++ CHAR_getWorkInt函数的具体用法?C++ CHAR_getWorkInt怎么用?C++ CHAR_getWorkInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHAR_getWorkInt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MAGIC_DirectUse
int MAGIC_DirectUse(
int charaindex,
int magicid,
int toindex,
int itemnum
)
{
MAGIC_CALLFUNC func;
int mp, ret, marray;
int itemindex=-1;
#ifdef _MAGIC_NOCAST//沉默狀態無法施法
if( CHAR_getWorkInt( charaindex, CHAR_WORKNOCAST ) > 0 ){
CHAR_talkToCli(charaindex, -1, "沉默中無法吟唱咒術", CHAR_COLORYELLOW);
return FALSE;
}
#endif
if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){
itemindex = CHAR_getItemIndex( charaindex, itemnum);
if( !ITEM_CHECKINDEX( itemindex) ){
print("ANDY err MAGIC_DirectUse() itemindex:%d !\n", itemindex);
return FALSE;
}
}else{
itemindex = itemnum;
}
marray = MAGIC_getMagicArray( magicid );
func = MAGIC_getMagicFuncPointer( MAGIC_getChar( marray, MAGIC_FUNCNAME ) );
if( (mp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP )) < 0 ){
}
// shan add begin
if( CHAR_getInt( charaindex, CHAR_FMINDEX ) >= 1 ){
// 光精
if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 0){
if( (marray >=0 && marray <=31) )
mp *= MP_RATE;
}
// 暗精
if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 1){
if( marray >=32 && marray <=81 )
mp *= MP_RATE;
}
}
if( func ) {
ret = func( charaindex, toindex, marray, mp );
}
else {
ret = FALSE;
}
return ret;
}
示例2: NPC_ActionWatch
/*********************************
* watch質
*********************************/
void NPC_ActionWatch( int meobjindex, int objindex, CHAR_ACTION act,
int x,int y,int dir, int* opt,int optlen )
{
int meindex;
int index;
char argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
char *argstr;
char buf[64];
int i;
struct {
CHAR_ACTION act;
char *string;
}searchtbl[] = {
{ CHAR_ACTATTACK, "attack"},
{ CHAR_ACTDAMAGE, "damage"},
{ CHAR_ACTDOWN, "down"},
{ CHAR_ACTSIT, "sit"},
{ CHAR_ACTHAND, "hand"},
{ CHAR_ACTPLEASURE, "pleasure"},
{ CHAR_ACTANGRY, "angry"},
{ CHAR_ACTSAD, "sad"},
{ CHAR_ACTGUARD, "guard"},
{ CHAR_ACTNOD, "nod"},
{ CHAR_ACTTHROW, "throw"},
};
if( OBJECT_getType( objindex) != OBJTYPE_CHARA) return;
index = OBJECT_getIndex( objindex);
/* 皿伊奶乩□卞及心 殺允月 */
if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return;
meindex = OBJECT_getIndex( meobjindex);
/* 輊五寧勻化ㄠ弘伉永玉匹卅中午 殺仄卅中 */
if( NPC_Util_isFaceToFace( meindex, index, 1 ) != TRUE ) return;
argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));
for( i = 0; i < arraysizeof( searchtbl); i ++ ) {
if( searchtbl[i].act == act) {
if( NPC_Util_GetStrFromStrWithDelim( argstr,
searchtbl[i].string,
buf, sizeof( buf))
!= NULL )
{
CHAR_talkToCli( index, meindex ,buf ,
CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR ));
break;
}
}
}
}
示例3: ITEM_useImprecate
void ITEM_useImprecate( int charaindex, int toNo, int haveitemindex )
{
int i;
int battleindex, attackNo,itemindex;
char *arg;
char buf[256];
struct tagImprecate {
char fun[256];
int intfun;
};
struct tagImprecate ImList[3] ={
{"©G",BD_KIND_CURSE},{"®¦",BD_KIND_BESTOW},{"¯¬",BD_KIND_WISHES} };
if( !CHAR_CHECKINDEX( charaindex) ) return;
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
if( (attackNo = BATTLE_Index2No( battleindex, charaindex )) < 0 ){
print( "ANDY attackNo=%d\n", attackNo);
return;
}
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
if( arg == NULL ){
print( "ANDY ITEM id:%d=>arg err\n", ITEM_getInt( itemindex, ITEM_ID));
return;
}
for( i=0; i<3; i++) {
if( strstr( arg, ImList[i].fun ) != 0 ) {
char buf1[256];
int kind,powers, rounds, HealedEffect;
if( NPC_Util_GetStrFromStrWithDelim( arg, ImList[i].fun, buf, sizeof( buf)) == NULL )continue;
kind = ImList[i].intfun;
if( getStringFromIndexWithDelim( buf,"x", 1, buf1, sizeof( buf1)) == FALSE ) continue;
powers = atoi( buf1);
if( getStringFromIndexWithDelim( buf,"x", 2, buf1, sizeof( buf1)) == FALSE ) continue;
rounds = atoi( buf1);
HealedEffect = SPR_hoshi;
BATTLE_ImprecateRecovery(
battleindex, attackNo, toNo, kind, powers,
rounds, SPR_item3, HealedEffect );
CHAR_setItemIndex(charaindex, haveitemindex ,-1);
CHAR_sendItemDataOne( charaindex, haveitemindex);
ITEM_endExistItemsOne( itemindex );
break;
}
}
}
示例4: NPC_PetFusion_selectWindow
static void NPC_PetFusion_selectWindow( int meindex, int toindex, int num,int select)
{
char npcarg1[NPC_UTIL_GETARGSTR_BUFSIZE];
char *npcarg;
char token[256];
int buttontype = 0, windowtype = 0, windowno = 0;
int fd = getfdFromCharaIndex( toindex);
windowtype = WINDOW_MESSAGETYPE_MESSAGE;
if( Action_PartyCheck( meindex, toindex) == FALSE) {
CHAR_talkToCli( toindex, meindex, "請一個一個來!", CHAR_COLORYELLOW);
return;
}
//memset( npcarg, 0, sizeof( npcarg));
if((npcarg = NPC_Util_GetArgStr( meindex, npcarg1, sizeof(npcarg1)))==NULL){
print("err NPC_MakePairMan: GetArgStrErr!!");
return;
}
memset( token, 0, sizeof( token));
switch( num){
case WINDOW_START:
if( NPC_Util_GetStrFromStrWithDelim( npcarg, "StartMsg", token, sizeof( token) ) == NULL){
return;
}
buttontype = WINDOW_BUTTONTYPE_YESNO;
windowno = WINDOW_TALKSTART;
break;
case WINDOW_SELECT:
if( ActionNpc_CheckFree( meindex, toindex, npcarg) == FALSE ) {
buttontype = WINDOW_BUTTONTYPE_OK;
windowno = WINDOW_TALKEND;
}else {
if( NPC_Util_GetStrFromStrWithDelim( npcarg, "SelectMsg", token, sizeof( token) ) == NULL){
return;
}
windowtype = WINDOWS_MESSAGETYPE_PETFUSION;
buttontype = WINDOW_BUTTONTYPE_YESNO;
windowno = WINDOW_TALKSELECT;
}
break;
case WINDOW_FUSION:
//融合處理
break;
case WINDOW_WARP:
break;
case WINDOW_END:
break;
}
CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, windowno);
lssproto_WN_send( fd, windowtype, buttontype, windowno,
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token);
}
示例5: NPC_DengonLooked
void NPC_DengonLooked( int meindex, int lookedindex )
{
int maxid;
char buf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW*2];
if( NPC_Util_CharDistance( lookedindex, meindex ) > 1) return;
maxid = CHAR_getWorkInt( meindex, CHAR_WORKDENGONMAXID );
if( NPC_DengonReadString( meindex, maxid, NPC_sendbuf ) ){
int fd;
fd = getfdFromCharaIndex( lookedindex );
if( fd == -1 )return;
lssproto_WN_send(fd, WINDOW_MESSAGETYPE_WIDEMESSAGEANDLINEINPUT,
WINDOW_BUTTONTYPE_OKCANCEL|
WINDOW_BUTTONTYPE_PREV,
CHAR_WINDOWTYPE_DENGON,
CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
makeEscapeString( NPC_sendbuf, buf, sizeof(buf)));
CHAR_setWorkInt( lookedindex, CHAR_WORKSHOPRELEVANT, maxid);
}
}
示例6: MAGIC_Recovery
int MAGIC_Recovery( int charaindex, int toindex, int marray, int mp )
{
int battlemode;
if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE;
battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
if( battlemode == BATTLE_CHARMODE_INIT ) {
return FALSE;
}
if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
CHAR_setInt( charaindex, CHAR_MP,
CHAR_getInt( charaindex, CHAR_MP ) - mp );
if( IsBATTLING( charaindex ) == TRUE ) {
#ifdef _PREVENT_TEAMATTACK //¶÷»Ý²»µÃ ʹÓõз½
int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER &&
BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ) {
if( BATTLE_CheckSameSide( charaindex, toindex) == 0 ) { //²»Í¬±ß
int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) );
CHAR_talkToCli( charaindex, -1, "¶÷»Ý¾«Áé..²»µÃÊ©Óè·ÇÍæ¼ÒµÐ·½¡£", CHAR_COLORYELLOW);
return FALSE;
}
}
#endif
if (toindex==22) {
print("jinchao err\n"); // shan(¶ÔÈ«ÌåʹÓÃħ·¨µÄbug)£¬ÐÞ¸ÄÕßjinchao+2001/12/07
return FALSE;
}
MAGIC_Recovery_Battle( charaindex, toindex, marray, mp );
} else {
if( CHAR_CHECKINDEX( toindex ) == FALSE )return FALSE; // shan(¶ÔÈ«ÌåʹÓÃħ·¨µÄbug)£¬ÐÞ¸ÄÕßjinchao+2001/12/07
MAGIC_Recovery_Field( charaindex, marray);
}
return TRUE;
}
示例7: CHAR_talkToFloor
void CHAR_talkToFloor(int floor, int talkindex, char *message, CHAR_COLOR color) {
int i = 0;
int playernum = CHAR_getPlayerMaxNum();
for(i = 0; i < playernum; i++) {
if(CHAR_getCharUse(i) == FALSE) continue;
if(!CHAR_CHECKINDEX(i))
continue;
if(CHAR_getInt(i, CHAR_FLOOR) == floor) {
if(CHAR_getWorkInt(i, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE)
CHAR_talkToCli(i, talkindex, message, color);
}
}
}
示例8: NPCS_getUserPartyAmount
int NPCS_getUserPartyAmount( int charaindex )
{
int partys=0,pindex;
int leaderindex=-1;
leaderindex = charaindex;
if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ){
return 0;
}else if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ){
leaderindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1);
}
if( CHAR_getWorkInt( leaderindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_LEADER ){
int i;
for( i=0; i<5; i++) {
pindex = CHAR_getWorkInt( leaderindex, CHAR_WORKPARTYINDEX1+i);
if( !CHAR_CHECKINDEX( pindex) )
partys++;
}
}
return partys;
}
示例9: NPC_WindowHealerLevelCheck
/*-------------------------------------
伊矛伙民尼永弁
伊矛伙毛葦化澀爛伊矛伙方曰斕仃木壬 卞允月
曰襖
澀爛伊矛伙 TRUE
澀爛伊矛伙動曉卅日 FALSE
---------------------------------------*/
BOOL NPC_WindowHealerLevelCheck(int meindex,int talker)
{
int level;
level=CHAR_getWorkInt(meindex,CHAR_WORK_LEVEL);
if(level > CHAR_getInt(talker,CHAR_LV)){
return TRUE;
}
return FALSE;
}
示例10: NPC_WindowCostCheckMp
/*-----------------------------------------
竣 戊旦玄及煌遙
------------------------------------------*/
int NPC_WindowCostCheckMp(int meindex,int talker)
{
int cost;
double drate;
int rate;
rate=CHAR_getWorkInt(meindex,CHAR_WORK_MP);
drate=(double) rate / 1000 ;
cost=CHAR_getInt(talker,CHAR_LV);
cost=(int)cost*drate;
if(cost==0) cost=1;
return cost;
}
示例11: ITEM_useRessurect
//--------------------------------------------------------------
// µ¤À䤫¤éÉü³è¤ò»È¤Ã¤¿¾ì¹ç¤Î½è
//--------------------------------------------------------------
// Àï ¤Î¾ì¹ç
void ITEM_useRessurect(
int charaindex, // »È¤Ã¤¿¿Í¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
int toNo, // »È¤ï¤ì¤ë¿Í¤Î ¹æ
int haveitemindex // »È¤¦¿Í¤Î¥¢¥¤ ¥à¤Î ¹æ
)
{
int itemindex, battleindex, attackNo, par = 0, pow = 0, ReceveEffect;
char *pszP = NULL;
// ¥¢¥¤ ¥à¤¬¤¢¤ë¤«¤É¤¦¤«
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
//------- ¤³¤³¤«¤é½è -----------
pszP = ITEM_getChar(itemindex, ITEM_ARGUMENT );
if( strstr( pszP, "%" ) ){ // ¤³¤Î¾ì¹ç¤Ï¡ó·×»»
par = 1;
}
if( sscanf( pszP, "%d", &pow ) != 1 ){
// ²¿¥Ý¥¤¥ó¥È²óÉü¤¹¤ë¤«¡ª
pow = 0; // £°¤Î¾ì¹ç¤Ï´°Á´²óÉü
}
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
if( pow <= 0 ){
ReceveEffect = SPR_fukkatu3;
}else
if( pow <= 100 ){
ReceveEffect = SPR_fukkatu1;
}else
if( pow <= 300 ){
ReceveEffect = SPR_fukkatu2;
}else{
ReceveEffect = SPR_fukkatu3;
}
// Á´°÷
BATTLE_MultiRessurect( battleindex, attackNo, toNo,
pow, par, SPR_item3, ReceveEffect );
// Àï ¤Ë¥¢¥¤ ¥à¤¬¾Ã¤¨¤¿¾ì¹ç¤Î¶¦Ä̽è
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
示例12: ITEM_useRessurect
//--------------------------------------------------------------
// ��姾�������ë��������������
//--------------------------------------------------------------
// �� ������
void ITEM_useRessurect(
int charaindex, // �������м��̼������͵�
int toNo, // ����ľ���м� į
int haveitemindex // �����м�ʧ�� ة�� į
)
{
int itemindex, battleindex, attackNo, par = 0, pow = 0, ReceveEffect;
char *pszP = NULL;
// ʧ�� ة��ؤ�¾�������
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
//------- ������� -----------
pszP = ITEM_getChar(itemindex, ITEM_ARGUMENT );
if( strstr( pszP, "%" ) ){ // ���������ѻ�ң
par = 1;
}
if( sscanf( pszP, "%d", &pow ) != 1 ){
// �Ϻ��̼����������¾���
pow = 0; // ���������������
}
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
if( pow <= 0 ){
ReceveEffect = SPR_fukkatu3;
}else
if( pow <= 100 ){
ReceveEffect = SPR_fukkatu1;
}else
if( pow <= 300 ){
ReceveEffect = SPR_fukkatu2;
}else{
ReceveEffect = SPR_fukkatu3;
}
// �幻
BATTLE_MultiRessurect( battleindex, attackNo, toNo,
pow, par, SPR_item3, ReceveEffect );
// �� ��ʧ�� ة����������������ɧ��
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
示例13: NPC_TimeManTalked
void NPC_TimeManTalked( int meindex , int talkerindex , char *msg ,int color )
{
char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
char token[512];
char buf[512];
int tokennum=0;
int i;
if(NPC_Util_isFaceToFace( meindex ,talkerindex ,2)==FALSE){
if( NPC_Util_CharDistance( talkerindex ,meindex ) > 1) return;
}
if(CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)==9999){
/*--壅尹化中月乒□玉--*/
return;
}
if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
print("GetArgStrErr");
return;
}
if( CHAR_getInt(talkerindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER )return;
if( NPC_Util_charIsInFrontOfChar( talkerindex, meindex, 3 ) ==FALSE) return;
if(CHAR_getWorkInt(meindex,E_INT_MODE)==0){
/*--丢永本□斥毛忒允 */
NPC_Util_GetStrFromStrWithDelim(argstr,"main_msg",buf,sizeof( buf) );
}else{
NPC_Util_GetStrFromStrWithDelim(argstr,"change_msg",buf,sizeof( buf) );
}
tokennum = 1;
/* 戊件穴匹嗉濠日木凶玄□弁件互窒仇丐月井醒尹月 */
for( i=0;buf[i]!='\0';i++ ){
if( buf[i] == ',' ) tokennum++;
}
getStringFromIndexWithDelim( buf,",", rand()%tokennum+1,token, sizeof(token));
/*--仄扎屯月--*/
CHAR_talkToCli( talkerindex, meindex, token, CHAR_COLORWHITE );
}
示例14: NPC_DengonReadString
static int NPC_DengonReadString( int meindex, int id, char *str )
{
char filename[256];
snprintf(filename, sizeof(filename), "%s/%s/%d_%d_%d", getDataDir(), DENGONFILEDIR, CHAR_getInt(meindex, CHAR_FLOOR), CHAR_getInt(meindex, CHAR_X), CHAR_getInt(meindex, CHAR_Y));
char readbuf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW];
FILE *f;
int maxid, i, sendid, len;
char *writeptr, *readptr;
maxid = CHAR_getWorkInt( meindex, CHAR_WORKDENGONMAXID );
if( id > maxid ) id = maxid;
sendid = id - MESSAGEINONEWINDOW + 1;
if( sendid < maxid - DENGONFILELINENUM + 1 ){
sendid = maxid - DENGONFILELINENUM + 1;
}
if( sendid < 1 ) sendid = 1;
writeptr = str;
strcpy( writeptr, " 传言板\n");
len = strlen(writeptr);
writeptr += len;
f = fopen( filename, "r" );
if( !f ) return FALSE;
{
char buf[DENGONFILEENTRYSIZE];
int wptr = 0;
readbuf[0] = '\0';
for( i = 0; i < MESSAGEINONEWINDOW; i ++ ) {
fseek( f, ((sendid+i)%DENGONFILELINENUM)*DENGONFILEENTRYSIZE, SEEK_SET );
fread( buf, sizeof(char),
DENGONFILEENTRYSIZE , f );
memcpy( &readbuf[wptr], buf,sizeof( buf));
wptr += DENGONFILEENTRYSIZE;
}
}
fclose(f);
readptr = readbuf + DENGONFILECOUNTERSIZE;
for( i=0;i<MESSAGEINONEWINDOW;i++ ){
snprintf( writeptr, DENGONFILESTRINGSIZE, "%s\n", readptr );
writeptr+= strlen(readptr)+1;
readptr+=DENGONFILEENTRYSIZE;
}
return TRUE;
}
示例15: NPC_findRacePetIndex
void NPC_findRacePetIndex(int meindex, int floor)
{
int i = 0, j = 0;
time_t t1;
time(&t1);
if (CHAR_getWorkInt(meindex, NPC_WORK_FINDPETFLAG) == 0)
{
for (i = 0; i < CHAR_getCharNum(); i++)
{
if (CHAR_getInt(i, CHAR_FLOOR) == floor)
{
if (CHAR_getInt(i, CHAR_WHICHTYPE) == CHAR_PETRACEPET)
{
for (j = 0; j < PETRACEPETNUM; j++)
{
if (CHAR_getWorkInt(meindex, NPC_WORK_PET1 + j) == 0)
{
CHAR_setWorkInt(meindex, NPC_WORK_PET1 + j, i);
CHAR_setWorkInt(i, CHAR_NPCWORKINT2, meindex);
break;
}
}
}
}
}
if (CHAR_getWorkInt(meindex, NPC_WORK_PET1) > 0
&& CHAR_getWorkInt(meindex, NPC_WORK_PET2) > 0
&& CHAR_getWorkInt(meindex, NPC_WORK_PET3) > 0)
{
CHAR_setWorkInt(meindex, NPC_WORK_FINDPETFLAG, 1);
CHAR_setWorkInt(meindex, NPC_WORK_STATE, NPC_State_WaitDropStake);
CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEMASTER_WAITDROPI_LOOPTIME);
CHAR_setWorkInt(meindex, NPC_WORK_STATECHANGE, t1 + PETRACEDROPSTAKETIME);
}
else CHAR_setWorkInt(meindex, NPC_WORK_FINDPETFLAG, 0);
}
}