Index: common/mmo.h =================================================================== --- common/mmo.h (revision 150) +++ common/mmo.h (working copy) @@ -301,6 +301,9 @@ int father; int mother; int child; + + //Aura System + int aura; unsigned int base_exp,job_exp; int zeny; Index: map/atcommand.c =================================================================== --- map/atcommand.c (revision 150) +++ map/atcommand.c (working copy) @@ -9060,8 +9060,46 @@ return 0; } +/*========================================== +* Original code by [TwiTerror] +* Redone by Advi +* @auraset (aura) (character) +*------------------------------------------ +*/ +int atcommand_auraset( +const int fd, struct map_session_data* sd, +const char* command, const char* message) +{ +struct map_session_data *pl_sd = 0; +int type = 0; +if (!message || !*message || sscanf(message, "%d %[^\n]", &type, atcmd_player_name) < 2) { +if (!message || !*message || sscanf(message, "%d", &type) < 1) { +clif_displaymessage(fd, "Please, enter at least an option (usage: @auraset )."); +return -1; +} +atcmd_player_name[0] = 0; +pl_sd = sd; +} +if (pl_sd != sd){ +if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL || ((pl_sd = map_id2sd(atoi(atcmd_player_name))) != NULL && pl_sd->state.active)) { +} else { +return -1; +} +} + +pl_sd->status.aura = type; +pc_setglobalreg(pl_sd,"USERAURA",type); + +pc_setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, 3); + +clif_displaymessage(fd, "Aura set."); + +return 0; +} + + /*========================================== * atcommand_info[] structure definition *------------------------------------------*/ @@ -9373,6 +9411,7 @@ { "whosell", 60,99, atcommand_shopsearch }, { "nochat", 0,10, atcommand_nochat}, { "requestgm", 0,10, atcommand_requestgm }, + { "auraset", 60,60, atcommand_auraset }, //Aura System }; Index: map/clif.c =================================================================== --- map/clif.c (revision 150) +++ map/clif.c (working copy) @@ -1077,6 +1077,9 @@ case BL_PC: { TBL_PC *sd = ((TBL_PC*)bl); + + clif_sendauras((TBL_PC*)bl, SELF); //Aura System + if (sd->spiritball > 0) clif_spiritball(sd); if(sd->state.size==2) // tiny/big players [Valaris] @@ -3963,6 +3966,14 @@ if(&sd->bl == bl) break; clif_getareachar_unit(sd,bl); + + //Aura System + if (bl->type == BL_PC) { + struct map_session_data *tsd = (struct map_session_data *)bl; + clif_sendaurastoone(sd,tsd); + clif_sendaurastoone(tsd,sd); + } + break; } return 0; @@ -4047,6 +4058,8 @@ if (sd && sd->fd) { //Tell sd that tbl walked into his view clif_getareachar_unit(sd,tbl); + clif_sendaurastoone(sd,tsd); //Aura System + clif_sendaurastoone(tsd,sd); //Aura System } return 0; } @@ -14369,3 +14382,80 @@ add_timer_func_list(clif_delayquit, "clif_delayquit"); return 0; } + +/*========================================== + * Aura System + *------------------------------------------*/ + +void clif_sendauras( struct map_session_data *sd, int target ) +{ +int effect1; +effect1 = sd->status.aura; + +if (sd->status.option & OPTION_HIDE) +return; + +if (effect1 > 0) +clif_specialeffect(&sd->bl, effect1, target); +} + + +/*========================================== + * Aura System + *------------------------------------------*/ +void clif_sendaurastoone( struct map_session_data *sd, struct map_session_data *dsd ) +{ +int effect1; +effect1 = sd->status.aura; + +if (sd->status.option & OPTION_HIDE) +return; + +if (effect1 > 0) +clif_specialeffecttoone(&sd->bl, &dsd->bl, effect1); +} + +/*========================================== + * Aura System + *------------------------------------------*/ +int clif_specialeffecttoone(struct block_list *bl, struct block_list *dst, int type) { + +struct map_session_data *sd = (struct map_session_data *)dst; + +WFIFOW(sd->fd,0) = 0x1f3; +WFIFOL(sd->fd,2) = bl->id; +WFIFOL(sd->fd,6) = type; +WFIFOSET(sd->fd, packet_len(0x1f3)); + +return 0; + +} + +/*========================================== + * Aura System + *------------------------------------------*/ +void clif_getareachar_char2(struct map_session_data* sd,struct block_list *bl) +{ +map_foreachinarea(clif_insight2, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, BL_PC, bl); +} + +/*========================================== + * Aura System + *------------------------------------------*/ +int clif_insight2(struct block_list *bl,va_list ap) +{ +struct block_list *tbl; +TBL_PC *sd, *tsd; +tbl=va_arg(ap,struct block_list*); + +if (bl == tbl) return 0; + +sd = BL_CAST(BL_PC, bl); +tsd = BL_CAST(BL_PC, tbl); + +if (sd && sd->fd) +{ //Tell sd that tbl walked into his view +clif_getareachar_unit(sd,tbl); +} +return 0; +} Index: map/clif.h =================================================================== --- map/clif.h (revision 150) +++ map/clif.h (working copy) @@ -465,3 +465,10 @@ void clif_progressbar(struct map_session_data * sd, unsigned long color, unsigned int second); void clif_progressbar_abort(struct map_session_data * sd); #endif /* _CLIF_H_ */ + +// Aura System +int clif_specialeffecttoone(struct block_list *bl, struct block_list *dst, int type); +void clif_sendauras( struct map_session_data *sd, int target ); +void clif_sendaurastoone(struct map_session_data *sd, struct map_session_data *dsd); +void clif_getareachar_char2(struct map_session_data* sd,struct block_list *bl); +int clif_insight2(struct block_list *bl,va_list ap); Index: map/pc.c =================================================================== --- map/pc.c (revision 150) +++ map/pc.c (working copy) @@ -1019,6 +1019,9 @@ sd->change_level = pc_readglobalreg(sd,"jobchange_level"); sd->die_counter = pc_readglobalreg(sd,"PC_DIE_COUNTER"); + + //Aura System + sd->status.aura = pc_readglobalreg(sd,"USERAURA"); // Cash shop sd->cashPoints = pc_readaccountreg(sd,"#CASHPOINTS"); Index: map/pc.h =================================================================== --- map/pc.h (revision 150) +++ map/pc.h (working copy) @@ -297,6 +297,9 @@ int hprecov_rate,sprecov_rate; int matk_rate; int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate; + + //Aura System + int aura; int itemid; short itemindex; //Used item's index in sd->inventory [Skotlex] Index: map/status.c =================================================================== --- map/status.c (revision 150) +++ map/status.c (working copy) @@ -5397,6 +5397,14 @@ } break; case SC_HIDING: + + //Aura System + if (sd && sd->status.aura > 0){ + sd->status.aura *= -1; + clif_clearunit_area(&sd->bl, 4); + clif_getareachar_char2(sd, &sd->bl); + } + val2 = tick/1000; tick = 1000; val3 = 0; // unused, previously speed adjustment @@ -6651,6 +6659,13 @@ break; case SC_HIDING: + + //Aura System + if (sd && sd->status.aura < 0){ + sd->status.aura *= -1; + clif_sendauras(sd, AREA_WOS); + } + sc->option &= ~OPTION_HIDE; opt_flag|= 2|4; //Check for warp trigger + AoE trigger break;