@emotion @heart @show @hold @detach

Habilis

New member
Messages
225
Points
0
Age
36
Location
Montreal, Canada
IRC Nickname
Habilis
Emulator
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/topic/2615-atcommand-afk/

of Mhalicot : http://herc.ws/board/user/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
 
Last edited by a moderator:
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.

 
Last edited by a moderator:
Updated to make them compile under new Hercules version 

@emotion added disabled emotions feature (with @emotion 34 players can use mute emote or fake a dice game by dropping a particular dice side....)

emotion.c

#include "common/hercules.h"

#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?
"1.2", // 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 last available emotion number available for this command.
// Clients < 2013 support way less emotions.

ACMD(emotion)
{
char err_msg[1024];
// Disabled emotions 34 = mute; [58 to 63] = dice particular sides
int rEmoArray[] = {34, 58, 59, 60, 61, 62, 63};
int rEmoArraySize = sizeof(rEmoArray) / sizeof(rEmoArray[0]);

if(!*message || atoi(message) < 0 || atoi(message) > emotion_max)
{
sprintf(err_msg, "Usage: @emotion 0-%d", emotion_max);
clif->message(fd, err_msg);
return -1;
}

for (int i = 0; i < rEmoArraySize; i++)
{
if (rEmoArray == atoi(message))
{
sprintf(err_msg, "This emotion is disabled.");
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

#include "common/hercules.h"

#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?
"1.2", // Plugin version
HPM_VERSION, // HPM Version (don't change, macro is automatically updated)
};

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

ACMD(heart)
{

if(!*message || atoi(message) < 1 || 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

#include "common/hercules.h"

#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?
"1.2", // Plugin version
HPM_VERSION, // HPM Version (don't change, macro is automatically updated)
};



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

ACMD(dance)
{

if(!*message || atoi(message) < 1 || 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

#include "common/hercules.h"

#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?
"1.2", // 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;

if(!*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

#include "common/hercules.h"

#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?
"1.2", // Plugin version
HPM_VERSION, // HPM Version (don't change, macro is automatically updated)
};


/*==========================================
* @hold by Voidless
*==========================================*/
ACMD(hold)
{

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);
}


detach.c

Code:
#include "common/hercules.h"

#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?
    "1.1",			// Plugin version
    HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)
};


/*==========================================
* @detach
*==========================================*/
ACMD(detach) 
{
	
	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);
}
 
А как можно использовать команду make plugins в visual studio 2013?

 
Back
Top