Index: map/atcommand.c =================================================================== --- map/atcommand.c (revision 17088) +++ map/atcommand.c (working copy) @@ -8811,6 +8811,37 @@ #undef MC_CART_MDFY } +ACMD_FUNC(auraset) { + 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->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; +} + /** * Fills the reference of available commands in atcommand DBMap **/ @@ -8822,6 +8853,7 @@ **/ AtCommandInfo atcommand_base[] = { ACMD_DEF2("warp", mapmove), + ACMD_DEF(auraset), ACMD_DEF(where), ACMD_DEF(jumpto), ACMD_DEF(jump), Index: map/clif.c =================================================================== --- map/clif.c (revision 17088) +++ map/clif.c (working copy) @@ -1354,6 +1354,8 @@ { TBL_PC *sd = ((TBL_PC*)bl); int i; + + clif_sendauras((TBL_PC*)bl, SELF); if (sd->spiritball > 0) clif_spiritball(&sd->bl); if(sd->state.size==SZ_BIG) // tiny/big players [Valaris] @@ -4504,6 +4506,12 @@ 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; @@ -4595,6 +4603,11 @@ if (sd && sd->fd) { //Tell sd that tbl walked into his view clif_getareachar_unit(sd,tbl); + if(tsd) + { + clif_sendaurastoone(sd,tsd); //Aura System + clif_sendaurastoone(tsd,sd); //Aura System + } } return 0; } @@ -17126,3 +17139,181 @@ void do_final_clif(void) { ers_destroy(delay_clearunit_ers); } + +/*========================================== + * Aura System + *------------------------------------------*/ + + static int auraTable[][3] = { + { -1, -1, -1 }, + // Reserved for PK Mode + { 586, -1, -1 }, // LH + { 586, 362, -1 }, // LH Mvp + { 586, 362, 240 }, // 1? PK Place + // Basic Auras + { 418, -1, -1 }, // Red Fury + { 486, -1, -1 }, // Blue Fury + { 485, -1, -1 }, // White Fury + { 239, -1, -1 }, // Aura Red + { 240, -1, -1 }, // Aura White + { 241, -1, -1 }, // Aura Yellow + { 620, -1, -1 }, // Aura Blue + { 202, -1, -1 }, // Lvl 99 Bubbles + { 362, -1, -1 }, // Advanced Lvl 99 Bubbles + { 678, -1, -1 }, // Brazil Aura Bubbles + { 679, -1, -1 }, // Brazil Aura + { 680, -1, -1 }, // Brazil Aura Floor + // 2 Sets + { 239, 418, -1 }, + { 239, 486, -1 }, + { 239, 485, -1 }, + { 240, 418, -1 }, + { 240, 486, -1 }, + { 240, 485, -1 }, + { 241, 418, -1 }, + { 241, 486, -1 }, + { 241, 485, -1 }, + { 620, 418, -1 }, + { 620, 486, -1 }, + { 620, 485, -1 }, + // Full Sets + { 239, 418, 202 }, + { 239, 486, 202 }, + { 239, 485, 202 }, + { 240, 418, 202 }, + { 240, 486, 202 }, + { 240, 485, 202 }, + { 241, 418, 202 }, + { 241, 486, 202 }, + { 241, 485, 202 }, + { 620, 418, 202 }, + { 620, 486, 202 }, + { 620, 485, 202 }, + { 239, 418, 362 }, + { 239, 486, 362 }, + { 239, 485, 362 }, + { 240, 418, 362 }, + { 240, 486, 362 }, + { 240, 485, 362 }, + { 241, 418, 362 }, + { 241, 486, 362 }, + { 241, 485, 362 }, + { 620, 418, 362 }, + { 620, 486, 362 }, + { 620, 485, 362 }, + { 239, 418, 678 }, + { 239, 486, 678 }, + { 239, 485, 678 }, + { 240, 418, 678 }, + { 240, 486, 678 }, + { 240, 485, 678 }, + { 241, 418, 678 }, + { 241, 486, 678 }, + { 241, 485, 678 }, + { 620, 418, 678 }, + { 620, 486, 678 }, + { 620, 485, 678 }, + // Oficial Set + { 680, 679, 678 }, + { -1, -1, -1 } +}; + +int aura_getSize() +{ + return sizeof(auraTable)/(sizeof(int) * 3) - 1; +} + +int aura_getAuraEffect(struct map_session_data *sd, short pos) +{ + int aura = sd->aura; + + if (pos < 0 || pos > 2) + return -1; + + if (aura > aura_getSize() || aura < 0) + return -1; + + return auraTable[aura][pos]; +} + +void clif_sendauras( struct map_session_data *sd, int target ) +{ + int effect1, effect2, effect3; + effect1 = aura_getAuraEffect(sd, 0); + effect2 = aura_getAuraEffect(sd, 1); + effect3 = aura_getAuraEffect(sd, 2); + if (sd->status.option & OPTION_HIDE) + return; + + if (effect1 > 0) + clif_specialeffect(&sd->bl, effect1, target); + if (effect2 > 0) + clif_specialeffect(&sd->bl, effect2, target); + if (effect3 > 0) + clif_specialeffect(&sd->bl, effect3, target); +} + +/*========================================== + * Aura System + *------------------------------------------*/ +void clif_sendaurastoone( struct map_session_data *sd, struct map_session_data *dsd ) +{ + int effect1, effect2, effect3; + effect1 = aura_getAuraEffect(sd, 0); + effect2 = aura_getAuraEffect(sd, 1); + effect3 = aura_getAuraEffect(sd, 2); + + if (sd->status.option & OPTION_HIDE) + return; + + if (effect1 > 0) + clif_specialeffecttoone(&sd->bl, &dsd->bl, effect1); + if (effect2 > 0) + clif_specialeffecttoone(&sd->bl, &dsd->bl, effect2); + if (effect3 > 0) + clif_specialeffecttoone(&sd->bl, &dsd->bl, effect3); +} + +/*========================================== + * 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; +} \ No newline at end of file Index: map/clif.h =================================================================== --- map/clif.h (revision 17088) +++ map/clif.h (working copy) @@ -756,6 +756,12 @@ void clif_snap( struct block_list *bl, short x, short y ); void clif_monster_hp_bar( struct mob_data* md, int fd ); +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); + /** * Color Table **/ Index: map/pc.c =================================================================== --- map/pc.c (revision 17088) +++ map/pc.c (working copy) @@ -1163,6 +1163,9 @@ sd->cashPoints = pc_readaccountreg(sd,"#CASHPOINTS"); sd->kafraPoints = pc_readaccountreg(sd,"#KAFRAPOINTS"); + //Aura System + sd->aura = pc_readglobalreg(sd,"USERAURA"); + // Cooking Exp sd->cook_mastery = pc_readglobalreg(sd,"COOK_MASTERY"); Index: map/pc.h =================================================================== --- map/pc.h (revision 17088) +++ map/pc.h (working copy) @@ -330,6 +330,9 @@ 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 17088) +++ map/status.c (working copy) @@ -7484,6 +7484,11 @@ } break; case SC_HIDING: + if (sd && sd->aura > 0){ + sd->aura *= -1; + clif_clearunit_area(&sd->bl, 4); + clif_getareachar_char2(sd, &sd->bl); + } val2 = tick/1000; tick_time = 1000; // [GodLesZ] tick time val3 = 0; // unused, previously speed adjustment @@ -9602,6 +9607,11 @@ break; case SC_HIDING: + //Aura System + if (sd && sd->aura < 0){ + sd->aura *= -1; + clif_sendauras(sd, AREA_WOS); + } sc->option &= ~OPTION_HIDE; opt_flag|= 2|4; //Check for warp trigger + AoE trigger break;