Jump to content

Anti Corruption, A Step Taken to Stop Corrupt GMs


Vengeance

Recommended Posts


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   13
  • Joined:  01/08/12
  • Last Seen:  

Hi guys i made this simple modification to stop corruption in my server...

This little snippet would allow you to stop GMs from abusing @monster command.. it will announce the Monster name, Amount and also the location with the GM name so its very easy to know if it was for an Purpose or just for abuse.... :(

/*==========================================
*
*------------------------------------------*/
ACMD_FUNC(monster)
{
char name[NAME_LENGTH];
char monster[NAME_LENGTH];
int mob_id;
int number = 0;
int count;
int i, k, range;
short mx, my;
nullpo_retr(-1, sd);

memset(name, '0', sizeof(name));
memset(monster, '0', sizeof(monster));
memset(atcmd_output, '0', sizeof(atcmd_output));

if (!message || !*message) {
clif_displaymessage(fd, msg_txt(80)); // Give the display name or monster name/id please.
return -1;
}
if (sscanf(message, ""%23[^"]" %23s %d", name, monster, &number) > 1 ||
sscanf(message, "%23s "%23[^"]" %d", monster, name, &number) > 1) {
//All data can be left as it is.
} else if ((count=sscanf(message, "%23s %d %23s", monster, &number, name)) > 1) {
//Here, it is possible name was not given and we are using monster for it.
if (count < 3) //Blank mob's name.
name[0] = '0';
} else if (sscanf(message, "%23s %23s %d", name, monster, &number) > 1) {
//All data can be left as it is.
} else if (sscanf(message, "%23s", monster) > 0) {
//As before, name may be already filled.
name[0] = '0';
} else {
clif_displaymessage(fd, msg_txt(80)); // Give a display name and monster name/id please.
return -1;
}

if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number)
mob_id = mobdb_checkid(atoi(monster));

if (mob_id == 0) {
clif_displaymessage(fd, msg_txt(40)); // Invalid monster ID or name.
return -1;
}

if (mob_id == MOBID_EMPERIUM) {
clif_displaymessage(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned.
return -1;
}

if (number <= 0)
number = 1;

if (strlen(name) < 1)
strcpy(name, "--ja--");

// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
if (battle_config.atc_spawn_quantity_limit && number > battle_config.atc_spawn_quantity_limit)
number = battle_config.atc_spawn_quantity_limit;

if (battle_config.etc_log)
ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y);

count = 0;
range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around)
for (i = 0; i < number; i++) {
map_search_freecell(&sd->bl, 0, &mx,  &my, range, range, 0);
k = mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, "");
count += (k != 0) ? 1 : 0;
}

if (count != 0)
if (number == count){
if(pc_isGM(sd)==99){ // Checks if the GM level is below 99 Announcement is made [Vengeance]
clif_displaymessage(fd, msg_txt(39)); // All monster summoned!
}
else {
sprintf(atcmd_output, "%s summoned %d %s in %s,%d,%d", sd->status.name,number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0);
clif_displaymessage(fd, msg_txt(39)); // All monster summoned!
}
}
else {
sprintf(atcmd_output, "%s summoned %d %s in %s,%d,%d", sd->status.name,number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0);
sprintf(atcmd_output, msg_txt(240), count); // %d monster(s) summoned!
clif_displaymessage(fd, atcmd_output);
}
else {
clif_displaymessage(fd, msg_txt(40)); // Invalid monster ID or name.
return -1;
}

return 0;
}

// small monster spawning [Valaris]
ACMD_FUNC(monstersmall)
{
char name[NAME_LENGTH] = "";
char monster[NAME_LENGTH] = "";
int mob_id = 0;
int number = 0;
int x = 0;
int y = 0;
int count;
int i;

nullpo_retr(-1, sd);

if (!message || !*message) {
clif_displaymessage(fd, "Give a monster name/id please.");
return -1;
}

if (sscanf(message, ""%23[^"]" %23s %d %d %d", name, monster, &number, &x, &y) < 2 &&
sscanf(message, "%23s "%23[^"]" %d %d %d", monster, name, &number, &x, &y) < 2 &&
sscanf(message, "%23s %d %23s %d %d", monster, &number, name, &x, &y) < 1) {
clif_displaymessage(fd, "Give a monster name/id please.");
return -1;
}

// If monster identifier/name argument is a name
if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number)
mob_id = atoi(monster);

if (mob_id == 0) {
clif_displaymessage(fd, msg_txt(40));
return -1;
}

if (mob_id == MOBID_EMPERIUM) {
clif_displaymessage(fd, msg_txt(83)); // Cannot spawn emperium
return -1;
}

if (mobdb_checkid(mob_id) == 0) {
clif_displaymessage(fd, "Invalid monster ID"); // Invalid Monster ID.
return -1;
}

if (number <= 0)
number = 1;

if (strlen(name) < 1)
strcpy(name, "--ja--");

// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
if (battle_config.atc_spawn_quantity_limit >= 1 && number > battle_config.atc_spawn_quantity_limit)
number = battle_config.atc_spawn_quantity_limit;

count = 0;
for (i = 0; i < number; i++) {
int mx, my;
if (x <= 0)
mx = sd->bl.x + (rand() % 11 - 5);
else
mx = x;
if (y <= 0)
my = sd->bl.y + (rand() % 11 - 5);
else
my = y;
count += (mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, "2") != 0) ? 1 : 0;
}

if (count != 0)
{
if(pc_isGM(sd)==99){// Checks if the GM level is below 99 Announcement is made [Vengeance]
clif_displaymessage(fd, msg_txt(39)); // All monster summoned!
}
else{
sprintf(atcmd_output, "%s summoned %d small %s in %s,%d,%d", sd->status.name, number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0);
clif_displaymessage(fd, msg_txt(39)); // Monster Summoned!!
}
}
else
clif_displaymessage(fd, msg_txt(40)); // Invalid Monster ID.

return 0;
}
// big monster spawning [Valaris]
ACMD_FUNC(monsterbig)
{
char name[NAME_LENGTH] = "";
char monster[NAME_LENGTH] = "";
int mob_id = 0;
int number = 0;
int x = 0;
int y = 0;
int count;
int i;

nullpo_retr(-1, sd);

if (!message || !*message) {
clif_displaymessage(fd, "Give a monster name/id please.");
return -1;
}

if (sscanf(message, ""%23[^"]" %23s %d %d %d", name, monster, &number, &x, &y) < 2 &&
sscanf(message, "%23s "%23[^"]" %d %d %d", monster, name, &number, &x, &y) < 2 &&
sscanf(message, "%23s %d %23s %d %d", monster, &number, name, &x, &y) < 1) {
clif_displaymessage(fd, "Give a monster name/id please.");
return -1;
}

// If monster identifier/name argument is a name
if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number)
mob_id = atoi(monster);

if (mob_id == 0) {
clif_displaymessage(fd, msg_txt(40));
return -1;
}

if (mob_id == MOBID_EMPERIUM) {
clif_displaymessage(fd, msg_txt(83)); // Cannot spawn emperium
return -1;
}

if (mobdb_checkid(mob_id) == 0) {
clif_displaymessage(fd, "Invalid monster ID"); // Invalid Monster ID.
return -1;
}

if (number <= 0)
number = 1;

if (strlen(name) < 1)
strcpy(name, "--ja--");

// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
if (battle_config.atc_spawn_quantity_limit >= 1 && number > battle_config.atc_spawn_quantity_limit)
number = battle_config.atc_spawn_quantity_limit;

count = 0;
for (i = 0; i < number; i++) {
int mx, my;
if (x <= 0)
mx = sd->bl.x + (rand() % 11 - 5);
else
mx = x;
if (y <= 0)
my = sd->bl.y + (rand() % 11 - 5);
else
my = y;
count += (mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, "4") != 0) ? 1 : 0;
}

if (count != 0)
{
if(pc_isGM(sd)==99){// Checks if the GM level is below 99 Announcement is made [Vengeance]
clif_displaymessage(fd, msg_txt(39)); // All monster summoned!
}
else{
sprintf(atcmd_output, "%s summoned %d big %s in %s,%d,%d", sd->status.name, number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0);
clif_displaymessage(fd, msg_txt(39)); // Monster Summoned!!
}
}
else
clif_displaymessage(fd, msg_txt(40)); // Invalid Monster ID.

return 0;
}

Just copy paste this Snippet.

Download from here

Edited by Vengeance
  • Upvote 5
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   13
  • Joined:  01/08/12
  • Last Seen:  

thank you please give reviews about the mod to motivate :( so I release more useful mods to the community :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  69
  • Reputation:   15
  • Joined:  12/06/11
  • Last Seen:  

Pretty nice, but it will be better if you set a battle configuration to set the gm level that will broadcast the info and broadcast the spawner gm, would be better.

Tnks in advance, good mod :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   13
  • Joined:  01/08/12
  • Last Seen:  

Well thats possible but I just made it for a request so I thought that this much would be enough...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  01/16/12
  • Last Seen:  

Nice, but i have a question, how install this code in the server, i new in this xD and need help =)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   13
  • Joined:  01/08/12
  • Last Seen:  

You need to copy the code and edit the original monster code and then compile your server

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  12/27/11
  • Last Seen:  

Wow...this is cool....

Sir can u also make a source if a GM creates an item or @item command and only the lvl 99 GM only will see

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

where would i put that?

map.h?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  185
  • Reputation:   26
  • Joined:  12/07/11
  • Last Seen:  

Nice Im Using it Now.. hehe :)

Keep it up!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  83
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

where would i put that?

map.h?

src > map > atcommand.c

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   13
  • Joined:  01/08/12
  • Last Seen:  

Wow...this is cool....

Sir can u also make a source if a GM creates an item or @item command and only the lvl 99 GM only will see

I will try to do that...

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  62
  • Reputation:   5
  • Joined:  08/23/17
  • Last Seen:  

Nice small Snippet. But i mean the most GM spawn with Monster ID. for normal Player looks this abnormal. A Broadcast with GM XX spawned 1002 100 on Map x,x

isn't better to change all id's automatically in monster name? /ok

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  125
  • Reputation:   7
  • Joined:  11/19/11
  • Last Seen:  

Nice small Snippet. But i mean the most GM spawn with Monster ID. for normal Player looks this abnormal. A Broadcast with GM XX spawned 1002 100 on Map x,x

isn't better to change all id's automatically in monster name? :D

it is very simple, see script command below.

*getmonsterinfo(<mob ID>,<type>)
This function will look up the monster with the specified ID number in the
mob database and return the info set by TYPE argument.
It will return -1 if there is no such monster (or the type value is invalid),
or "null" if you requested the monster's name.
Valid types are listed in const.txt:
MOB_NAME 0  MOB_LV 1
MOB_MAXHP 2  MOB_BASEEXP 3
MOB_JOBEXP 4  MOB_ATK1 5
MOB_ATK2 6  MOB_DEF 7
MOB_MDEF 8  MOB_STR 9
MOB_AGI  10  MOB_VIT  11
MOB_INT  12  JOB_DEX  13
MOB_LUK  14  MOB_RANGE 15
MOB_RANGE2 16  MOB_RANGE3 17
MOB_SIZE 18  MOB_RACE 19
MOB_ELEMENT 20  MOB_MODE 21

so you can just replace the part where it will announce the mob id into

"+getmonsterinfo(<mob ID>,0)+"

thanks for the share!

another option is not to let your GM summon any monster at all. imagine summoning 1000 treasure chest

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   28
  • Joined:  01/16/12
  • Last Seen:  

Awesome! I think this should log it into cmd file though, instead of broadcasting it.

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

can you update the @monster patch pls? it isn't compatible with new rathena svn :)

change

if(pc_isGM(sd)==99)

to

if(pc_get_group_level(sd)==99)

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  04/29/12
  • Last Seen:  

Great script :) thanks alot

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Nice small Snippet. But i mean the most GM spawn with Monster ID. for normal Player looks this abnormal. A Broadcast with GM XX spawned 1002 100 on Map x,x

isn't better to change all id's automatically in monster name? :D

it is very simple, see script command below.

*getmonsterinfo(<mob ID>,<type>)
This function will look up the monster with the specified ID number in the
mob database and return the info set by TYPE argument.
It will return -1 if there is no such monster (or the type value is invalid),
or "null" if you requested the monster's name.
Valid types are listed in const.txt:
MOB_NAME 0  MOB_LV 1
MOB_MAXHP 2  MOB_BASEEXP 3
MOB_JOBEXP 4  MOB_ATK1 5
MOB_ATK2 6  MOB_DEF 7
MOB_MDEF 8  MOB_STR 9
MOB_AGI  10  MOB_VIT  11
MOB_INT  12  JOB_DEX  13
MOB_LUK  14  MOB_RANGE 15
MOB_RANGE2 16  MOB_RANGE3 17
MOB_SIZE 18  MOB_RACE 19
MOB_ELEMENT 20  MOB_MODE 21

so you can just replace the part where it will announce the mob id into

"+getmonsterinfo(<mob ID>,0)+"

thanks for the share!

another option is not to let your GM summon any monster at all. imagine summoning 1000 treasure chest

where can I see the "+getmonserinfo"

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  118
  • Topics Per Day:  0.03
  • Content Count:  1942
  • Reputation:   197
  • Joined:  01/08/12
  • Last Seen:  

the patch is now outdated to the latest revision. how to implement this on the latest revision?

bump for this. is there anyone knows how to implement this on the latest version?

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

nice. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  118
  • Topics Per Day:  0.03
  • Content Count:  1942
  • Reputation:   197
  • Joined:  01/08/12
  • Last Seen:  

nice. :)

i think this is not working on the latest revision.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

nice. :)

i think this is not working on the latest revision.

i didnt try yet, i said "nice" for the share, I'll try this soon. and badly I dont use latest revision too. /hmm

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  118
  • Topics Per Day:  0.03
  • Content Count:  1942
  • Reputation:   197
  • Joined:  01/08/12
  • Last Seen:  

nice. :)

i think this is not working on the latest revision.

i didnt try yet, i said "nice" for the share, I'll try this soon. and badly I dont use latest revision too. /hmm

oh ok. goodluck /ic

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

It's work bro /no1 .

u just need patch ur mapserver or open the patch file an rewrite ur atcommand.c file based on @monster patch file.

and edit inside ACMD_FUNC(monster), ACMD_FUNC(monstersmall), ACMD_FUNC(monsterbig)

Link to comment
Share on other sites

  • 11 months later...

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

is there a new version compatible with the new update of rathena?

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
Reply to this topic...

×   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...