summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-06 21:49:00 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-06 21:49:00 +0000
commitd32e2b4c2c8f40f9acd6b88a45729010d758b118 (patch)
treeb0040b116d347c6ab1ca876ca9cf4e75f30baf9b
parent0f79342a3fe4ce80a37f6792d4154fa97c8560b0 (diff)
downloadhercules-d32e2b4c2c8f40f9acd6b88a45729010d758b118.tar.gz
hercules-d32e2b4c2c8f40f9acd6b88a45729010d758b118.tar.bz2
hercules-d32e2b4c2c8f40f9acd6b88a45729010d758b118.tar.xz
hercules-d32e2b4c2c8f40f9acd6b88a45729010d758b118.zip
- Moved define CHAT_SIZE to clif.c, added define CHATBOX_SIZE to specify that 70 char limit of the input area.
- Fixed #lvup having the gm level check backwards. - Fixed the stormgust freeze counter going up even if the attack is blocked/cancelled. - Updated mes_len_check to receive max expected size as well (clif.c) - Cleaned up parsing functions for /mm, /resetskill, /resetstate, /item, /monster, /hide - git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9811 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--src/map/atcommand.c12
-rw-r--r--src/map/charcommand.c2
-rw-r--r--src/map/clif.c163
-rw-r--r--src/map/map.h4
-rw-r--r--src/map/skill.c9
6 files changed, 100 insertions, 93 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index a5eedba06..d882cd00f 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/02/06
+ * Fixed #lvup having the gm level check backwards.
+ * Fixed the stormgust freeze counter going up even if the attack is
+ blocked/cancelled.
* Cleaned up homunc attack request parsing. Homunculus no longer goes into
auto-attack (ctrl+click) mode since the client does every attack request
individually.
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 7304990d6..016801119 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1030,15 +1030,15 @@ int atcommand_config_read(const char *cfgName)
*/
int atcommand_commands(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
- char cz_line_buff[CHAT_SIZE+1];
+ char cz_line_buff[CHATBOX_SIZE+1];
register char *lpcz_cur = cz_line_buff;
register unsigned int ui_slen;
int i_cur_cmd,gm_lvl = pc_isGM(sd), count = 0;
- memset(cz_line_buff,' ',CHAT_SIZE);
- cz_line_buff[CHAT_SIZE] = 0;
+ memset(cz_line_buff,' ',CHATBOX_SIZE);
+ cz_line_buff[CHATBOX_SIZE] = 0;
clif_displaymessage(fd, msg_txt(273));
@@ -1051,12 +1051,12 @@ int atcommand_commands(const int fd, struct map_session_data* sd, const char* co
ui_slen = (unsigned int)strlen(atcommand_info[i_cur_cmd].command);
//remember not <= bc we need null terminator
- if(((CHAT_SIZE+(int)cz_line_buff)-(int)lpcz_cur) < (int)ui_slen)
+ if(((CHATBOX_SIZE+(int)cz_line_buff)-(int)lpcz_cur) < (int)ui_slen)
{
clif_displaymessage(fd,(char*)cz_line_buff);
lpcz_cur = cz_line_buff;
- memset(cz_line_buff,' ',CHAT_SIZE);
- cz_line_buff[CHAT_SIZE] = 0;
+ memset(cz_line_buff,' ',CHATBOX_SIZE);
+ cz_line_buff[CHATBOX_SIZE] = 0;
}
memcpy(lpcz_cur,atcommand_info[i_cur_cmd].command,ui_slen);
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 30afa278d..a3c546ab7 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -1302,7 +1302,7 @@ int charcommand_baselevel(
clif_displaymessage(fd, msg_table[3]); // Character not found.
return -1;
}
- if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change base level only lower or same gm level
+ if (pc_isGM(sd) < pc_isGM(pl_sd)) { // you can change base level only lower or same gm level
clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
return -1;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 12603bdf7..d7358d13f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4,6 +4,9 @@
#define DUMP_UNKNOWN_PACKET 0
#define DUMP_ALL_PACKETS 0
+//Talk max size: <name> : <message of 70> [Skotlex]
+#define CHAT_SIZE (NAME_LENGTH + 3 + CHATBOX_SIZE)
+
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
@@ -94,7 +97,7 @@ struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB];
#define disguised(bl) (bl->type==BL_PC && ((TBL_PC*)bl)->disguise)
//Guarantees that the given string does not exceeds the allowed size, as well as making sure it's null terminated. [Skotlex\]
-#define mes_len_check(mes, len) if (len > CHAT_SIZE) { mes[CHAT_SIZE-1] = '\0'; len = CHAT_SIZE; } else mes[len-1] = '\0';
+#define mes_len_check(mes, len, max) if (len > max) { mes[max-1] = '\0'; len = max; } else mes[len-1] = '\0';
static char map_ip_str[128];
static in_addr_t map_ip;
static in_addr_t bind_ip = INADDR_ANY;
@@ -8665,23 +8668,25 @@ int clif_message(struct block_list *bl, char* msg)
*/
void clif_parse_MapMove(int fd, struct map_session_data *sd) {
// /m /mapmove (as @rura GM command)
- char output[30]; // 17+4+4=26, 30 max.
- char message[34]; // "/mm "+output
- char map_name[MAP_NAME_LENGTH]; //Err... map names are 15+'\0' in size, not 16+'\0' [Skotlex]
+ char output[MAP_NAME_LENGTH+15]; // Max length of a short: ' -6XXXX' -> 7 digits
+ char message[MAP_NAME_LENGTH+15+5]; // "/mm "+output
+ char *map_name;
RFIFOHEAD(fd);
- if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
- (pc_isGM(sd) >= get_atcommand_level(AtCommand_MapMove))) {
- memcpy(map_name, RFIFOP(fd,2), MAP_NAME_LENGTH-1);
- map_name[MAP_NAME_LENGTH-1]='\0';
- sprintf(output, "%s %d %d", map_name, RFIFOW(fd,18), RFIFOW(fd,20));
- atcommand_rura(fd, sd, "@rura", output);
- if((log_config.gm) && (get_atcommand_level(AtCommand_MapMove) >= log_config.gm)) {
- sprintf(message, "/mm %s", output);
- log_atcommand(sd, message);
- }
- }
+ if (battle_config.atc_gmonly && !pc_isGM(sd))
+ return;
+ if(pc_isGM(sd) < get_atcommand_level(AtCommand_MapMove))
+ return;
+ map_name = RFIFOP(fd,2);
+ map_name[MAP_NAME_LENGTH-1]='\0';
+ sprintf(output, "%s %d %d", map_name, RFIFOW(fd,18), RFIFOW(fd,20));
+ atcommand_rura(fd, sd, "@rura", output);
+ if(log_config.gm && get_atcommand_level(AtCommand_MapMove) >= log_config.gm)
+ {
+ sprintf(message, "/mm %s", output);
+ log_atcommand(sd, message);
+ }
return;
}
@@ -8950,7 +8955,8 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
msg = command;
msg+= sprintf(command, "%s : ", sd->status.name);
memcpy(msg, RFIFOP(fd, 28), len);
- mes_len_check(msg, len);
+ mes_len_check(msg, len, CHATBOX_SIZE);
+
if ((is_charcommand(fd, sd, command) != CharCommand_None) ||
(is_atcommand(fd, sd, command) != AtCommand_None)) {
aFree(command);
@@ -9118,7 +9124,7 @@ void clif_parse_GMmessage(int fd, struct map_session_data *sd) {
size = WFIFOW(fd,2)-4;
mes = RFIFOP(fd,4);
- mes_len_check(mes, size);
+ mes_len_check(mes, size, CHAT_SIZE);
intif_GMmessage(mes, size, 0);
if(log_config.gm && lv >= log_config.gm) {
@@ -10097,20 +10103,18 @@ void clif_parse_SolveCharName(int fd, struct map_session_data *sd) {
*/
void clif_parse_ResetChar(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
- if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
- pc_isGM(sd) >= get_atcommand_level(AtCommand_ResetState)) {
- switch(RFIFOW(fd,2)){
- case 0:
- pc_resetstate(sd);
- break;
- case 1:
- pc_resetskill(sd,1);
- break;
- }
- if((log_config.gm) && (get_atcommand_level(AtCommand_ResetState) >= log_config.gm)) {
- log_atcommand(sd, RFIFOW(fd,2) ? "/resetskill" : "/resetstate");
- }
- }
+ if (battle_config.atc_gmonly && !pc_isGM(sd))
+ return;
+ if (pc_isGM(sd) < get_atcommand_level(AtCommand_ResetState))
+ return;
+
+ if (RFIFOW(fd,2))
+ pc_resetskill(sd,1);
+ else
+ pc_resetstate(sd);
+
+ if(log_config.gm && get_atcommand_level(AtCommand_ResetState >= log_config.gm))
+ log_atcommand(sd, RFIFOW(fd,2) ? "/resetskill" : "/resetstate");
}
/*==========================================
@@ -10130,7 +10134,7 @@ void clif_parse_LGMmessage(int fd, struct map_session_data *sd) {
len = RFIFOW(fd,2) - 4;
mes = RFIFOP(fd,4);
- mes_len_check(mes, len);
+ mes_len_check(mes, len, CHAT_SIZE);
WBUFW(buf,0) = 0x9a;
WBUFW(buf,2) = len+4;
@@ -10364,7 +10368,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
len = RFIFOW(fd,2) - 4;
mes = RFIFOP(fd,4);
- mes_len_check(mes, len);
+ mes_len_check(mes, len, CHAT_SIZE);
if (is_charcommand(fd, sd, mes) != CharCommand_None ||
is_atcommand(fd, sd, mes) != AtCommand_None)
@@ -10641,7 +10645,7 @@ void clif_parse_GuildMessage(int fd,struct map_session_data *sd) {
RFIFOHEAD(fd);
len = RFIFOW(fd,2) - 4;
mes = RFIFOP(fd,4);
- mes_len_check(mes, len);
+ mes_len_check(mes, len, CHAT_SIZE);
if (is_charcommand(fd, sd, mes) != CharCommand_None ||
is_atcommand(fd, sd, mes) != AtCommand_None)
@@ -10894,64 +10898,65 @@ void clif_parse_Recall(int fd, struct map_session_data *sd) { // Added by RoVeRT
}
/*==========================================
- * /monster /item rewriten by [Yor]
+ * /monster /item
*------------------------------------------
*/
void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) {
- char monster_item_name[NAME_LENGTH+10]; //Additional space is for logging, eg: "@monster Poring"
+ char *monster_item_name;
+ char message[NAME_LENGTH+10]; //For logging.
int level;
+ RFIFOHEAD(fd);
- memset(monster_item_name, '\0', sizeof(monster_item_name));
+ if (battle_config.atc_gmonly && !pc_isGM(sd))
+ return;
- if (battle_config.atc_gmonly == 0 || pc_isGM(sd)) {
- RFIFOHEAD(fd);
- memcpy(monster_item_name, RFIFOP(fd,2), NAME_LENGTH);
+ monster_item_name = RFIFOP(fd,2);
+ monster_item_name[NAME_LENGTH-1] = '\0';
- if (mobdb_searchname(monster_item_name) != 0) {
- if (pc_isGM(sd) >= (level =get_atcommand_level(AtCommand_Spawn))) // changed from AtCommand_Monster for Skots [Reddozen]
- {
- atcommand_monster(fd, sd, "@spawn", monster_item_name); // as @spawn
- if(log_config.gm && level >= log_config.gm)
- { //Log action. [Skotlex]
- snprintf(monster_item_name, sizeof(monster_item_name)-1, "@spawn %s", RFIFOP(fd,2));
- log_atcommand(sd, monster_item_name);
- }
- }
- } else if (itemdb_searchname(monster_item_name) != NULL) {
- if (pc_isGM(sd) >= (level = get_atcommand_level(AtCommand_Item)))
- {
- atcommand_item(fd, sd, "@item", monster_item_name); // as @item
- if(log_config.gm && level >= log_config.gm)
- { //Log action. [Skotlex]
- snprintf(monster_item_name, sizeof(monster_item_name)-1, "@item %s", RFIFOP(fd,2));
- log_atcommand(sd, monster_item_name);
- }
- }
+ if (mobdb_searchname(monster_item_name)) {
+ if (pc_isGM(sd) < (level=get_atcommand_level(AtCommand_Spawn)))
+ return;
+ atcommand_monster(fd, sd, "@spawn", monster_item_name); // as @spawn
+ if(log_config.gm && level >= log_config.gm)
+ { //Log action. [Skotlex]
+ snprintf(message, sizeof(message)-1, "@spawn %s", monster_item_name);
+ log_atcommand(sd, message);
}
+ return;
+ }
+ if (itemdb_searchname(monster_item_name) == NULL)
+ return;
+ if (pc_isGM(sd) < (level = get_atcommand_level(AtCommand_Item)))
+ return;
+ atcommand_item(fd, sd, "@item", monster_item_name); // as @item
+ if(log_config.gm && level >= log_config.gm)
+ { //Log action. [Skotlex]
+ sprintf(message, "@item %s", monster_item_name);
+ log_atcommand(sd, message);
}
}
void clif_parse_GMHide(int fd, struct map_session_data *sd) { // Modified by [Yor]
- if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
- (pc_isGM(sd) >= get_atcommand_level(AtCommand_Hide))) {
- if (sd->sc.option & OPTION_INVISIBLE) {
- sd->sc.option &= ~OPTION_INVISIBLE;
- if (sd->disguise)
- status_set_viewdata(&sd->bl, sd->disguise);
- else
- status_set_viewdata(&sd->bl, sd->status.class_);
- clif_displaymessage(fd, "Invisible: Off.");
- } else {
- sd->sc.option |= OPTION_INVISIBLE;
- //Experimental hidden mode, changes your view class to invisible [Skotlex]
- sd->vd.class_ = INVISIBLE_CLASS;
- clif_displaymessage(fd, "Invisible: On.");
- if((log_config.gm) && (get_atcommand_level(AtCommand_Hide) >= log_config.gm)) {
- log_atcommand(sd, "/hide");
- }
- }
- clif_changeoption(&sd->bl);
+ if (battle_config.atc_gmonly && !pc_isGM(sd))
+ return;
+ if (pc_isGM(sd) < get_atcommand_level(AtCommand_Hide))
+ return;
+
+ if (sd->sc.option & OPTION_INVISIBLE) {
+ sd->sc.option &= ~OPTION_INVISIBLE;
+ if (sd->disguise)
+ status_set_viewdata(&sd->bl, sd->disguise);
+ else
+ status_set_viewdata(&sd->bl, sd->status.class_);
+ clif_displaymessage(fd, "Invisible: Off.");
+ } else {
+ sd->sc.option |= OPTION_INVISIBLE;
+ sd->vd.class_ = INVISIBLE_CLASS;
+ clif_displaymessage(fd, "Invisible: On.");
+ if(log_config.gm && get_atcommand_level(AtCommand_Hide) >= log_config.gm)
+ log_atcommand(sd, "/hide");
}
+ clif_changeoption(&sd->bl);
}
/*==========================================
diff --git a/src/map/map.h b/src/map/map.h
index a547af985..b227ed4f3 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -159,11 +159,11 @@ enum {
MAPID_BABY_SOUL_LINKER,
};
-//Talk max size: <name> : <message of 70> [Skotlex]
-#define CHAT_SIZE (NAME_LENGTH + 3 + 70)
//Max size when inputting a string with those 'npc input boxes'
//(also used for Graffiti, Talkie Box, Vending, and Chatrooms)
#define MESSAGE_SIZE 80
+//String length you can write in the 'talking box'
+#define CHATBOX_SIZE 70
#define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000
diff --git a/src/map/skill.c b/src/map/skill.c
index 9dd1a6c6c..17123f72d 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -7130,11 +7130,9 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
skill_attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
break;
case WZ_STORMGUST:
- if (tsc)
- { //This should be safe as skill_additional_effect
- //won't be triggered if the attack is absorbed. [Skotlex]
- //And if the target is already frozen,
- //the counter is reset when it ends.
+ if (skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0) > 0
+ && tsc)
+ { //Increase freeze counter if attack connects.
if (tsc->data[SC_FREEZE].val4 == sg->group_id)
tsc->data[SC_FREEZE].val3++; //SG hit counter.
else { //New SG
@@ -7142,6 +7140,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
tsc->data[SC_FREEZE].val3 = 1;
}
}
+ break;
default:
skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
}