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.
#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)
#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....)
#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)
#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