Jump to content
  • 0

Add @aura Command


Ahmed

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  07/20/16
  • Last Seen:  

Hello,

How to add @aura Command please?

and what files should I change ?

must i recompile rathena or only use @reloadatcommand ?

Thanks  /lv

Edited by Ahmed
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  94
  • Reputation:   5
  • Joined:  06/30/16
  • Last Seen:  

Index: src/map/atcommand.c
===================================================================
--- src/map/atcommand.c	(revision 17146)
+++ src/map/atcommand.c	(working copy)
@@ -8840,6 +8840,39 @@
 	#undef MC_CART_MDFY
 }
 
+// Aura System
+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 <aura> <char>).");
+			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
  **/
@@ -9100,7 +9133,8 @@
 		ACMD_DEF2("rmvperm", addperm),
 		ACMD_DEF(unloadnpcfile),
 		ACMD_DEF(cart),
-		ACMD_DEF(mount2)
+		ACMD_DEF(mount2),
+		ACMD_DEF(auraset)	// Aura System
 	};
 	AtCommandInfo* atcommand;
 	int i;
Index: src/map/clif.c
===================================================================
--- src/map/clif.c	(revision 17146)
+++ src/map/clif.c	(working copy)
@@ -1353,6 +1353,7 @@
 		{
 			TBL_PC *sd = ((TBL_PC*)bl);
 			int i;
+			clif_sendauras((TBL_PC*)bl, SELF);	// Aura System
 			if (sd->spiritball > 0)
 				clif_spiritball(&sd->bl);
 			if(sd->state.size==SZ_BIG) // tiny/big players [Valaris]
@@ -4502,6 +4503,13 @@
 		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;
@@ -4593,6 +4601,12 @@
 	if (sd && sd->fd)
 	{	//Tell sd that tbl walked into his view
 		clif_getareachar_unit(sd,tbl);
+		//Aura System
+		if(tsd)
+		{
+			clif_sendaurastoone(sd,tsd);
+			clif_sendaurastoone(tsd,sd);
+		}
 	}
 	return 0;
 }
@@ -16365,6 +16379,183 @@
 }
 
 /*==========================================
+ * 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, enum send_target 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;
+}
+
+/*==========================================
  * Main client packet processing function
  *------------------------------------------*/
 static int clif_parse(int fd)
Index: src/map/clif.h
===================================================================
--- src/map/clif.h	(revision 17146)
+++ src/map/clif.h	(working copy)
@@ -756,6 +756,13 @@
 void clif_snap( struct block_list *bl, short x, short y );
 void clif_monster_hp_bar( struct mob_data* md, int fd );
 
+// Aura System
+int clif_specialeffecttoone(struct block_list *bl, struct block_list *dst, enum send_target target);
+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: src/map/pc.c
===================================================================
--- src/map/pc.c	(revision 17146)
+++ src/map/pc.c	(working copy)
@@ -1154,6 +1154,9 @@
 	// Cooking Exp
 	sd->cook_mastery = pc_readglobalreg(sd,"COOK_MASTERY");
 
+	//Aura System
+	sd->aura = pc_readglobalreg(sd,"USERAURA");
+
 	if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON )
 	{ // Better check for class rather than skill to prevent "skill resets" from unsetting this
 		sd->mission_mobid = pc_readglobalreg(sd,"TK_MISSION_ID");
Index: src/map/pc.h
===================================================================
--- src/map/pc.h	(revision 17146)
+++ src/map/pc.h	(working copy)
@@ -475,6 +475,9 @@
 
 	int shadowform_id;
 
+	//Aura System
+	int aura;
+
 	// temporary debugging of bug #3504
 	const char* delunit_prevfile;
 	int delunit_prevline;
Index: src/map/status.c
===================================================================
--- src/map/status.c	(revision 17146)
+++ src/map/status.c	(working copy)
@@ -7490,12 +7490,24 @@
 			}
 			break;
 		case SC_HIDING:
+			// Aura System
+			if (sd && sd->aura > 0){
+				sd->aura *= -1;
+				clif_clearunit_area(&sd->bl, (clr_type)4);
+				clif_getareachar_char2(sd, &sd->bl);
+			}
 			val2 = tick/1000;
 			tick_time = 1000; // [GodLesZ] tick time
 			val3 = 0; // unused, previously speed adjustment
 			val4 = val1+3; //Seconds before SP substraction happen.
 			break;
 		case SC_CHASEWALK:
+			// Aura System
+			if (sd && sd->aura > 0){
+				sd->aura *= -1;
+				clif_clearunit_area(&sd->bl, (clr_type)4);
+				clif_getareachar_char2(sd, &sd->bl);
+			}
 			val2 = tick>0?tick:10000; //Interval at which SP is drained.
 			val3 = 35 - 5 * val1; //Speed adjustment.
 			if (sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_ROGUE)
@@ -7504,6 +7516,12 @@
 			if (map_flag_gvg(bl->m) || map[bl->m].flag.battleground) val4 *= 5;
 			break;
 		case SC_CLOAKING:
+			// Aura System
+			if (sd && sd->aura > 0){
+				sd->aura *= -1;
+				clif_clearunit_area(&sd->bl, (clr_type)4);
+				clif_getareachar_char2(sd, &sd->bl);
+			}
 			if (!sd) //Monsters should be able to walk with no penalties. [Skotlex]
 				val1 = 10;
 			tick_time = val2 = tick>0?tick:60000; //SP consumption rate.
@@ -8112,6 +8130,12 @@
 			val_flag |= 1;
 			break;
 		case SC_CLOAKINGEXCEED:
+			// Aura System
+			if (sd && sd->aura > 0){
+				sd->aura *= -1;
+				clif_clearunit_area(&sd->bl, (clr_type)4);
+				clif_getareachar_char2(sd, &sd->bl);
+			}
 			val2 = ( val1 + 1 ) / 2; // Hits
 			val3 = 90 + val1 * 10; // Walk speed
 			val_flag |= 1|2|4;
@@ -8170,6 +8194,12 @@
 			tick_time = 1000; // [GodLesZ] tick time
 			break;
 		case SC_CAMOUFLAGE:
+			// Aura System
+			if (sd && sd->aura > 0){
+				sd->aura *= -1;
+				clif_clearunit_area(&sd->bl, (clr_type)4);
+				clif_getareachar_char2(sd, &sd->bl);
+			}
 			val4 = tick/1000;
 			tick_time = 1000; // [GodLesZ] tick time
 			break;
@@ -9615,6 +9645,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;
@@ -9623,9 +9658,19 @@
 	case SC__INVISIBILITY:
 		sc->option &= ~OPTION_CLOAK;
 	case SC_CAMOUFLAGE:
+		//Aura System
+		if (sd && sd->aura < 0){
+			sd->aura *= -1;
+			clif_sendauras(sd, AREA_WOS);
+		}
 		opt_flag|= 2;
 		break;
 	case SC_CHASEWALK:
+		//Aura System
+		if (sd && sd->aura < 0){
+			sd->aura *= -1;
+			clif_sendauras(sd, AREA_WOS);
+		}
 		sc->option &= ~(OPTION_CHASEWALK|OPTION_CLOAK);
 		opt_flag|= 2;
 		break;

+ >> add.

- >> delete.

 

change in atcommand.c

pc_setglobalreg(pl_sd,"USERAURA",type);

to

pc_setglobalreg(pl_sd, addstr("USERAURA"),type);

Change in pc.c

pc_readglobalreg(sd,"USERAURA");

to

pc_readglobalreg(sd,adstr("USERAURA"));

Add effect in clif.c

{ <effect 1>, <effect 2>,  <effect 3> }

-1 if you want it to do nothing.

 

Save>> Recompile

 

Command in game:

@auraset number (default max 64)

That's is what i do. Worked fine for me.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  07/20/16
  • Last Seen:  

Thanks i will do that  /no1

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...