- Fixed @statall giving you +99 stats instead of setting them to 99

- Fixed npctalk and @npctalk displaying the # part of the name

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10619 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-05-25 20:54:47 +00:00
parent ffbf79b895
commit 0b618b9425
3 changed files with 21 additions and 13 deletions

View File

@ -3,6 +3,10 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/05/25
* Fixed @statall giving you +99 stats instead of setting them to 99
* Fixed npctalk and @npctalk displaying the # part of the name
(client filters these when you request the name of the npc, btw...)
2007/05/23 2007/05/23
* Added new flag to skill_castnodex.txt, to allow per-skill tweaking * Added new flag to skill_castnodex.txt, to allow per-skill tweaking
of cast time and delay reducibility by item scripts (cards and such) of cast time and delay reducibility by item scripts (cards and such)

View File

@ -3950,7 +3950,7 @@ int atcommand_param(const int fd, struct map_session_data* sd, const char* comma
*------------------------------------------*/ *------------------------------------------*/
int atcommand_stat_all(const int fd, struct map_session_data* sd, const char* command, const char* message) int atcommand_stat_all(const int fd, struct map_session_data* sd, const char* command, const char* message)
{ {
int index, count, value = 0, max, new_value; int index, count, value, max, new_value;
short* status[6]; short* status[6];
//we don't use direct initialization because it isn't part of the c standard. //we don't use direct initialization because it isn't part of the c standard.
nullpo_retr(-1, sd); nullpo_retr(-1, sd);
@ -3962,11 +3962,14 @@ int atcommand_stat_all(const int fd, struct map_session_data* sd, const char* co
status[4] = &sd->status.dex; status[4] = &sd->status.dex;
status[5] = &sd->status.luk; status[5] = &sd->status.luk;
if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) {
value = pc_maxparameter(sd); value = pc_maxparameter(sd);
max = pc_maxparameter(sd);
} else {
max = SHRT_MAX;
}
count = 0; count = 0;
max = SHRT_MAX;
for (index = 0; index < (int)(sizeof(status) / sizeof(status[0])); index++) { for (index = 0; index < (int)(sizeof(status) / sizeof(status[0])); index++) {
if (value > 0 && *status[index] > max - value) if (value > 0 && *status[index] > max - value)
@ -7315,18 +7318,18 @@ int atcommand_npctalk(const int fd, struct map_session_data* sd, const char* com
(sd->sc.data[SC_NOCHAT].timer != -1 && sd->sc.data[SC_NOCHAT].val1&MANNER_NOCHAT))) (sd->sc.data[SC_NOCHAT].timer != -1 && sd->sc.data[SC_NOCHAT].val1&MANNER_NOCHAT)))
return -1; return -1;
if (!message || !*message || sscanf(message, "%23[^,],%99[^\n]", name, mes) < 2) { if (!message || !*message || sscanf(message, "%23[^,], %99[^\n]", name, mes) < 2) {
clif_displaymessage(fd, "Please, enter the correct info (usage: @npctalk <npc name> <message>)."); clif_displaymessage(fd, "Please, enter the correct info (usage: @npctalk <npc name>, <message>).");
return -1; return -1;
} }
if (!(nd = npc_name2id(name))) if (!(nd = npc_name2id(name))) {
{
clif_displaymessage(fd, msg_txt(111)); // This NPC doesn't exist clif_displaymessage(fd, msg_txt(111)); // This NPC doesn't exist
return -1; return -1;
} }
snprintf(temp, sizeof temp ,"%s: %s",name,mes); strtok(name, "#"); // discard extra name identifier if present
snprintf(temp, sizeof(temp), "%s : %s", name, mes);
clif_message(&nd->bl, temp); clif_message(&nd->bl, temp);
return 0; return 0;

View File

@ -11006,16 +11006,17 @@ BUILDIN_FUNC(message)
*------------------------------------------*/ *------------------------------------------*/
BUILDIN_FUNC(npctalk) BUILDIN_FUNC(npctalk)
{ {
const char *str; const char* str;
char message[255]; char message[255];
struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid); struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
str=script_getstr(st,2); str = script_getstr(st,2);
if(nd) { if(nd) {
memcpy(message, nd->name, NAME_LENGTH); memcpy(message, nd->name, NAME_LENGTH);
strcat(message," : "); strtok(message, "#"); // discard extra name identifier if present
strncat(message,str, 254); //Prevent overflow possibility. [Skotlex] strcat(message, " : ");
strncat(message, str, 254); //Prevent overflow possibility. [Skotlex]
clif_message(&(nd->bl), message); clif_message(&(nd->bl), message);
} }