Jump to content


Photo

@emotion @heart @show @hold @detach

@emotion @heart @show @hold @detach

  • Please log in to reply
5 replies to this topic

#1 Habilis

Habilis

    Advanced Member

  • Members
  • PipPipPip
  • 80 posts
  • IRC Nickname:Habilis
  • LocationMontreal, Canada
  • Emulator:Hercules

Posted 18 June 2016 - 08:19 PM

Hello, here is the adapted version of 

@emotion @heart @show @hold @detach

commands so popular in the Russian eA, rA, Herc community.

 

I don't claim to be the Author, credit for the work goes to each mod respective Author.

 

I just made all of them into Hercules plugins and changed source code a little...

 

 

 

emotion.c

@emotion 0 - 81 without delay. Now, you can do nasty spam with emotions.

PhrUjcN.jpg

 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "../common/HPMi.h"
#include "../map/clif.h"
#include "../map/atcommand.h"
#include "../map/script.h"
#include "../map/pc.h"
#include "../common/nullpo.h"

#include "../common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo =
{
    "@emotion",		// Plugin name
    SERVER_TYPE_MAP,// Which server types this plugin works with?
    "0.1",			// Plugin version
    HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)
};

/*==========================================
* @emotion X by Anarchist
* => Displays the emotions without delay
*------------------------------------------*/

int emotion_max = 81; // Set las emotion number available forr this command

ACMD(emotion)
{
	nullpo_retr(-1, sd);
	char err_msg[1024];
	
	if(!message || !*message || atoi(message)<0 || atoi(message)>emotion_max)
	{
		sprintf(err_msg, "usage: @emotion 0-%d", emotion_max);
		clif->message(fd, err_msg);
		return -1;
	}
	
	clif->emotion(&sd->bl,atoi(message));
	return 1;
}


/* Server Startup */
HPExport void plugin_init (void)
{
	addAtcommand("emotion",emotion);
}

 

 

 

heart.c

@heart 1 or 2 (heart emotion without delay)

RR1bcJM.jpg

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "../common/HPMi.h"
#include "../map/clif.h"
#include "../map/atcommand.h"
#include "../map/script.h"
#include "../map/pc.h"
#include "../common/nullpo.h"

#include "../common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo =
{
    "@heart",		// Plugin name
    SERVER_TYPE_MAP,// Which server types this plugin works with?
    "0.1",			// Plugin version
    HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)
};

/*==========================================
 @heart X by Anarchist
 => Displays the heart special effect
------------------------------------------
*/

ACMD(heart)
{
	nullpo_retr(-1, sd);

	if(!message || !*message || atoi(message)<0 || atoi(message)>2)
	{
		clif->message(fd, "usage: @heart 1 or 2");
		return -1;
	}
	
	if(atoi(message)==1)
	{
		clif->specialeffect(&sd->bl,364,0);
	} 
	else if(atoi(message)==2)
	{
		clif->specialeffect(&sd->bl,509,0);
	}
	
	return 1;
}


/* Server Startup */
HPExport void plugin_init (void)
{
	addAtcommand("heart",heart);
}

 

 

dance.c

@dance 1 - 8 (character perform different tricks...)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "../common/HPMi.h"
#include "../map/clif.h"
#include "../map/atcommand.h"
#include "../map/script.h"
#include "../map/pc.h"
#include "../common/nullpo.h"

#include "../common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo =
{
    "@dance",		// Plugin name
    SERVER_TYPE_MAP,// Which server types this plugin works with?
    "0.1",			// Plugin version
    HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)
};



/*==========================================
 @dance X by Anarchist
 => Special effects with dance style
------------------------------------------
*/

ACMD(dance)
{
	nullpo_retr(-1, sd);

	if(!message || !*message || atoi(message)<0 || atoi(message)>9)
	{
		clif->message(fd, "usage: @dance 1-9");
		return -1;
	}
	
	switch(atoi(message)) 
	{
		case 1 :
			clif->specialeffect(&sd->bl,413,0);
			break;
		case 2 :
			clif->specialeffect(&sd->bl,414,0);
			break;
		case 3 :
			clif->specialeffect(&sd->bl,415,0);
			break;
		case 4 :
			clif->specialeffect(&sd->bl, 426,0);
			break;
		case 5 :
			clif->specialeffect(&sd->bl,458,0);
			break;
		case 6 :
			clif->specialeffect(&sd->bl,466,0);
			break;
		case 7 :
			clif->specialeffect(&sd->bl,501,0);
			break;
		case 8 :
			clif->specialeffect(&sd->bl,540,0);
			break;
		case 9 :
			clif->specialeffect(&sd->bl,550,0);
			break;
	}
	
	return 1;
}


/* Server Startup */
HPExport void plugin_init (void)
{
	addAtcommand("dance",dance);
}

 

 

show.c

@show X Y (Displays a red dot on the minimap for the given coordinates, useful when searching for quest npc or a merchant selling needed items....)

dNPDi1p.jpg

 

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "../common/HPMi.h"
#include "../map/clif.h"
#include "../map/atcommand.h"
#include "../map/script.h"
#include "../map/pc.h"
#include "../common/nullpo.h"

#include "../common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo =
{
    "@show",		// Plugin name
    SERVER_TYPE_MAP,// Which server types this plugin works with?
    "0.1",			// Plugin version
    HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)
};

/*==========================================
* @show by KarLaeda
* => Displays the point on minimap
*------------------------------------------*/
ACMD(show)
{
	int x = 0, y = 0;
	nullpo_retr(-1, sd);
	
	if(!message || !*message || (sscanf(message, "%d %d", &x, &y) != 2))
	{
		clif->message(fd, "usage: @show <x> <y>");
		return -1;
	}
	
	clif->viewpoint(sd, 1, 1, x, y, 2, 0xFF0000);
	return 1;
}



/* Server Startup */
HPExport void plugin_init (void)
{
	addAtcommand("show",show);
}

 

hold.c

@hold (Disables / Enables character movement, useful on low rates to Archer/Mages when leveling on immobile monsters)

 

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "../common/HPMi.h"
#include "../map/clif.h"
#include "../map/atcommand.h"
#include "../map/script.h"
#include "../map/pc.h"
#include "../common/nullpo.h"

#include "../common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo =
{
    "@hold",		// Plugin name
    SERVER_TYPE_MAP,// Which server types this plugin works with?
    "0.1",			// Plugin version
    HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)
};


/*==========================================
* @hold by Voidless
*==========================================*/
ACMD(hold)
{
	nullpo_retr(-1, sd);
	
	if (!sd->state.blockedmove)
	{
		sd->state.blockedmove=1;
		clif->message(fd, "Character movement turned off");
	}
	else
	{
		sd->state.blockedmove=0;
		clif->message(fd, "Character movement turned on");
	}
	return 1;
}


/* Server Startup */
HPExport void plugin_init (void)
{
	addAtcommand("hold",hold);
}

 

For this plugin, I used the work : http://herc.ws/board...-atcommand-afk/

of Mhalicot : http://herc.ws/board.../1582-mhalicot/

To inspire myself...

detach.c

@detach (leaves character in game while client can be disconnected)

fBMKJSS.jpg

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../common/HPMi.h"
#include "../common/timer.h"
#include "../common/nullpo.h"
#include "../map/channel.h"
#include "../map/script.h"
#include "../map/pc.h"
#include "../map/clif.h"
#include "../map/chat.h"
#include "../map/battle.h"
#include "../map/status.h"
#include "../common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo =
{
    "@detach",		// Plugin name
    SERVER_TYPE_MAP,// Which server types this plugin works with?
    "0.1",			// Plugin version
    HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)
};


/*==========================================
* @detach
*==========================================*/
ACMD(detach) 
{ 
    nullpo_retr(-1, sd);
	
	if( pc_isdead(sd) ) {
        clif->message(fd, "Cannot use @detach if you are dead.");
        return true;
    }
	
	
	if( map->list[sd->bl.m].flag.autotrade == battle->bc->autotrade_mapflag )
    {
        if(map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg){
            clif->message(fd, "You may not use @detach when you are on maps PVP or GVG.");
			return true;
        }
		
		sd->state.monster_ignore = 0;
		sd->state.autotrade = 1;
		chat->create_pc_chat(sd, "DETACH", "", 1, true);
		sd->sc.opt1 = OPT1_STONE;
		pc->setoption(sd, sd->sc.option);
		pc_setsit(sd);
		skill->sit(sd,1);
		clif->sitting(&sd->bl);
		channel->quit(sd);
		clif->authfail_fd(sd->fd, 15);
		return true;

	} 
	else
	{
		clif->message(fd, "@detach is not allowed on this map.");
		return true;
	}
}


/* Server Startup */
HPExport void plugin_init (void)
{
	addAtcommand("detach",detach);
}

 

Put all .c files inside src/plugins

in the file src/plugins/makefile.in include the plugins

 

MYPLUGINS = show heart emotion dance hold detach

 

run commmand : make plugins

 

in file conf/plugins.conf

 

add plugins

 

plugins_list: [
    /* Enable HPMHooking when plugins in use rely on Hooking */
    //"HPMHooking",
    //"db2sql",
    //"sample",
    //"other",
    "show",
    "heart",
    "emotion",
    "dance",
    "hold",
    "detach"
]
 
Start server, enhoy

Edited by Habilis, 24 March 2017 - 05:19 PM.

Doing stuff |||||||||||||||||||||||||||||||||||||||||||||||||| 5% done

 

2017 Hercules Install GUIDE By Habilis


#2 True Zeal

True Zeal

    Advanced Member

  • Members
  • PipPipPip
  • 411 posts
  • LocationAlberta
  • Emulator:Hercules

Posted 14 July 2016 - 08:12 AM

omg no love? very niceeee!


I ask a lot of questions. Prepare to be frustrated.


#3 ucell_uz

ucell_uz

    Advanced Member

  • Members
  • PipPipPip
  • 39 posts
  • Github:https://github.com/HerculesWS/Hercules

Posted 24 March 2017 - 04:39 PM

http://herc.ws/board...afk-hold-heart/



#4 Habilis

Habilis

    Advanced Member

  • Members
  • PipPipPip
  • 80 posts
  • IRC Nickname:Habilis
  • LocationMontreal, Canada
  • Emulator:Hercules

Posted 24 March 2017 - 05:21 PM

Aside from being 6 months old and there could be updates changing the commands mechanism...

 

the only difference I can tell is this constant

ALL_CLIENT

 

as in 

clif->specialeffect(&sd->bl,413,0);

 

would be 

clif->specialeffect(&sd->bl,413,ALL_CLIENT);

 

 

And plugin init is not needed anymore?

/* Server Startup */
HPExport void plugin_init (void)
{
	addAtcommand("dance",dance);
}

 

Anyways my code is cleaner than whatever you posted there.

 

UPD: Soon will be installing fresh latest hercules and test 

All of them one by one.


Edited by Habilis, 24 March 2017 - 05:43 PM.

Doing stuff |||||||||||||||||||||||||||||||||||||||||||||||||| 5% done

 

2017 Hercules Install GUIDE By Habilis


#5 Habilis

Habilis

    Advanced Member

  • Members
  • PipPipPip
  • 80 posts
  • IRC Nickname:Habilis
  • LocationMontreal, Canada
  • Emulator:Hercules

Posted 25 March 2017 - 07:26 PM

 

Tested with latest version of Hercules

Everything works..


Doing stuff |||||||||||||||||||||||||||||||||||||||||||||||||| 5% done

 

2017 Hercules Install GUIDE By Habilis


#6 ucell_uz

ucell_uz

    Advanced Member

  • Members
  • PipPipPip
  • 39 posts
  • Github:https://github.com/HerculesWS/Hercules

Posted 30 March 2017 - 08:26 AM

all working your plugin system thx* )






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


This topic has been visited by 132 user(s)