summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/Makefile.in9
-rw-r--r--src/map/atcommand.c102
-rw-r--r--src/map/battle.c75
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/chrif.c57
-rw-r--r--src/map/clif.c46
-rw-r--r--src/map/guild.c1
-rw-r--r--src/map/map.c8
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/npc.c17
-rw-r--r--src/map/pc.c33
-rw-r--r--src/map/pc.h28
-rw-r--r--src/map/script.c17
-rw-r--r--src/map/trade.h4
-rw-r--r--src/map/vending.h4
15 files changed, 225 insertions, 179 deletions
diff --git a/src/map/Makefile.in b/src/map/Makefile.in
index e3a47abeb..e4f2d9953 100644
--- a/src/map/Makefile.in
+++ b/src/map/Makefile.in
@@ -1,9 +1,12 @@
+# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+# See the LICENSE file
CONFIG_D = ../config
CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h)
COMMON_D = ../common
COMMON_H = $(wildcard $(COMMON_D)/*.h)
+SYSINFO_INC = $(COMMON_D)/sysinfo.inc
LIBCONFIG_D = ../../3rdparty/libconfig
LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
@@ -33,7 +36,7 @@ MAP_H = atcommand.h battle.h battleground.h buyingstore.h chat.h chrif.h \
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- MAP_SERVER_SQL_DEPENDS=$(MAP_OBJ) $(COMMON_D)/obj_sql/common_sql.a $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ)
+ MAP_SERVER_SQL_DEPENDS=$(MAP_OBJ) $(COMMON_D)/obj_sql/common_sql.a $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ $(SYSINFO_INC))
else
MAP_SERVER_SQL_DEPENDS=needs_mysql
endif
@@ -79,6 +82,10 @@ help:
Makefile: Makefile.in
@$(MAKE) -C ../.. src/map/Makefile
+$(SYSINFO_INC): $(MAP_C) $(MAP_H) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H)
+ @echo " MAKE $@"
+ @$(MAKE) -C ../.. sysinfo
+
needs_mysql:
@echo "MySQL not found or disabled by the configure script"
@exit 1
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 09159c3f7..5fd0faf86 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -14,6 +14,7 @@
#include "../common/strlib.h"
#include "../common/utils.h"
#include "../common/conf.h"
+#include "../common/sysinfo.h"
#include "atcommand.h"
#include "battle.h"
@@ -403,6 +404,11 @@ ACMD(mapmove) {
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
+
+ if( sd->bl.m == m && sd->bl.x == x && sd->bl.y == y ) {
+ clif->message(fd, msg_txt(253)); // You already are at your destination!
+ return false;
+ }
if ((x || y) && map->getcell(m, x, y, CELL_CHKNOPASS) && pc_get_group_level(sd) < battle_config.gm_ignore_warpable_area) {
//This is to prevent the pc->setpos call from printing an error.
@@ -460,12 +466,22 @@ ACMD(where) {
*------------------------------------------*/
ACMD(jumpto) {
struct map_session_data *pl_sd = NULL;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(911)); // Please enter a player name (usage: @jumpto/@warpto/@goto <char name/ID>).
return false;
}
-
+
+ if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
+ clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map.
+ return false;
+ }
+
+ if( pc_isdead(sd) ) {
+ clif->message(fd, msg_txt(864)); // "You cannot use this command when dead."
+ return false;
+ }
+
if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -475,21 +491,16 @@ ACMD(jumpto) {
clif->message(fd, msg_txt(247)); // You are not authorized to warp to this map.
return false;
}
-
- if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
- clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map.
- return false;
- }
-
- if( pc_isdead(sd) ) {
- clif->message(fd, msg_txt(864)); // "You cannot use this command when dead."
+
+ if( pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y ) {
+ clif->message(fd, msg_txt(253)); // You already are at your destination!
return false;
}
-
+
pc->setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(4), pl_sd->status.name); // Jumped to %s
- clif->message(fd, atcmd_output);
-
+ clif->message(fd, atcmd_output);
+
return true;
}
@@ -520,6 +531,11 @@ ACMD(jump)
if (!map->search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
}
+
+ if( x && y && sd->bl.x == x && sd->bl.y == y ) {
+ clif->message(fd, msg_txt(253)); // You already are at your destination!
+ return false;
+ }
pc->setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jumped to %d %d
@@ -824,7 +840,11 @@ ACMD(guildstorage)
return false;
}
- gstorage->open(sd);
+ if( gstorage->open(sd) ) {
+ clif->message(fd, msg_txt(1201)); // Your guild's storage has already been opened by another member, try again later.
+ return false;
+ }
+
clif->message(fd, msg_txt(920)); // Guild storage opened.
return true;
}
@@ -2353,7 +2373,11 @@ ACMD(zeny)
if((ret=pc->payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
- if(!ret) clif->message(fd, msg_txt(176)); //ret=0 mean cmd success
+
+ if( ret ) //ret != 0 means cmd failure
+ return false;
+
+ clif->message(fd, msg_txt(176));
return true;
}
@@ -5183,9 +5207,10 @@ ACMD(clearcart)
return false;
}
- if (sd->state.vending == 1) { //Somehow...
- return false;
- }
+ if( sd->state.vending == 1 ) {
+ clif->message(fd, msg_txt(548)); // You can't clean a cart while vending!
+ return false;
+ }
for( i = 0; i < MAX_CART; i++ )
if(sd->status.cart[i].nameid > 0)
@@ -6673,20 +6698,29 @@ ACMD(showmobs)
int number = 0;
struct s_mapiterator* it;
- if(sscanf(message, "%99[^\n]", mob_name) < 0)
+ if( sscanf(message, "%99[^\n]", mob_name) < 0 ) {
+ clif->message(fd, msg_txt(546)); // Please enter a mob name/id (usage: @showmobs <mob name/id>)
return false;
-
- if((mob_id = atoi(mob_name)) == 0)
+ }
+
+ if( (mob_id = atoi(mob_name)) == 0 )
mob_id = mob->db_searchname(mob_name);
+
+ if( mob_id == 0 ) {
+ snprintf(atcmd_output, sizeof atcmd_output, msg_txt(547), mob_name); // Invalid mob name %s!
+ clif->message(fd, atcmd_output);
+ return false;
+ }
+
if(mob_id > 0 && mob->db_checkid(mob_id) == 0){
snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1250),mob_name); // Invalid mob id %s!
clif->message(fd, atcmd_output);
- return true;
+ return false;
}
if(mob->db(mob_id)->status.mode&MD_BOSS && !pc_has_permission(sd, PC_PERM_SHOW_BOSS)){ // If player group does not have access to boss mobs.
clif->message(fd, msg_txt(1251)); // Can't show boss mobs!
- return true;
+ return false;
}
if(mob_id == atoi(mob_name) && mob->db(mob_id)->jname)
@@ -7208,18 +7242,11 @@ ACMD(whereis)
}
ACMD(version) {
- const char *git = get_git_hash();
- const char *svn = get_svn_revision();
-
- if ( git[0] != HERC_UNKNOWN_VER ) {
- sprintf(atcmd_output,msg_txt(1295),git); // Git Hash '%s'
- clif->message(fd,atcmd_output);
- } else if ( svn[0] != HERC_UNKNOWN_VER ) {
- sprintf(atcmd_output,msg_txt(1294),git); // SVN r%s
- clif->message(fd,atcmd_output);
- } else
- clif->message(fd,msg_txt(1296)); // Cannot determine version
-
+ sprintf(atcmd_output, msg_txt(1296), sysinfo->is64bit() ? 64 : 32, sysinfo->platform()); // Hercules %d-bit for %s
+ clif->message(fd, atcmd_output);
+ sprintf(atcmd_output, msg_txt(1295), sysinfo->vcstype(), sysinfo->vcsrevision_src(), sysinfo->vcsrevision_scripts()); // %s revision '%s' (src) / '%s' (scripts)
+ clif->message(fd, atcmd_output);
+
return true;
}
@@ -9954,6 +9981,11 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
//Attempt to use the command
if ( (info->func(fd, (*atcmd_msg == atcommand->at_symbol) ? sd : ssd, command, params,info) != true) ) {
+#ifdef AUTOTRADE_PERSISTENCY
+ // Autotrade was successful if standalone is set
+ if( ((*atcmd_msg == atcommand->at_symbol) ? sd->state.standalone : ssd->state.standalone) )
+ return true;
+#endif
sprintf(output,msg_txt(154), command); // %s failed.
clif->message(fd, output);
return true;
diff --git a/src/map/battle.c b/src/map/battle.c
index 2217ccecc..001553f1c 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -12,6 +12,7 @@
#include "../common/socket.h"
#include "../common/strlib.h"
#include "../common/utils.h"
+#include "../common/sysinfo.h"
#include "../common/HPM.h"
#include "map.h"
@@ -6711,8 +6712,9 @@ static const struct _battle_data {
/**
* rAthena
**/
- { "max_third_parameter", &battle_config.max_third_parameter, 120, 10, 10000, },
- { "max_baby_third_parameter", &battle_config.max_baby_third_parameter, 108, 10, 10000, },
+ { "max_third_parameter", &battle_config.max_third_parameter, 130, 10, 10000, },
+ { "max_baby_third_parameter", &battle_config.max_baby_third_parameter, 117, 10, 10000, },
+ { "max_extended_parameter", &battle_config.max_extended_parameter, 125, 10, 10000, },
{ "atcommand_max_stat_bypass", &battle_config.atcommand_max_stat_bypass, 0, 0, 100, },
{ "skill_amotion_leniency", &battle_config.skill_amotion_leniency, 90, 0, 300 },
{ "mvp_tomb_enabled", &battle_config.mvp_tomb_enabled, 1, 0, 1 },
@@ -6748,8 +6750,6 @@ static const struct _battle_data {
void Hercules_report(char* date, char *time_c) {
int i, bd_size = ARRAYLENGTH(battle_data);
unsigned int config = 0;
- const char *svn = get_svn_revision();
- const char *git = get_git_hash();
char timestring[25];
time_t curtime;
char* buf;
@@ -6757,7 +6757,7 @@ void Hercules_report(char* date, char *time_c) {
enum config_table {
C_CIRCULAR_AREA = 0x0001,
C_CELLNOSTACK = 0x0002,
- C_CONSOLE_INPUT = 0x0004,
+ C_CONSOLE_INPUT = 0x0004,
C_SCRIPT_CALLFUNC_CHECK = 0x0008,
C_OFFICIAL_WALKPATH = 0x0010,
C_RENEWAL = 0x0020,
@@ -6768,12 +6768,15 @@ void Hercules_report(char* date, char *time_c) {
C_RENEWAL_EDP = 0x0400,
C_RENEWAL_ASPD = 0x0800,
C_SECURE_NPCTIMEOUT = 0x1000,
- C_SQL_DBS = 0x2000,
+ C_SQL_DB_ITEM = 0x2000,
C_SQL_LOGS = 0x4000,
- C_MEMWATCH = 0x8000,
- C_DMALLOC = 0x10000,
- C_GCOLLECT = 0x20000,
- C_SEND_SHORTLIST = 0x40000,
+ C_MEMWATCH = 0x8000,
+ C_DMALLOC = 0x10000,
+ C_GCOLLECT = 0x20000,
+ C_SEND_SHORTLIST = 0x40000,
+ C_SQL_DB_MOB = 0x80000,
+ C_SQL_DB_MOBSKILL = 0x100000,
+ C_PACKETVER_RE = 0x200000,
};
/* we get the current time */
@@ -6831,10 +6834,18 @@ void Hercules_report(char* date, char *time_c) {
#ifdef SECURE_NPCTIMEOUT
config |= C_SECURE_NPCTIMEOUT;
#endif
+
+#ifdef PACKETVER_RE
+ config |= C_PACKETVER_RE
+#endif
/* non-define part */
- if( map->db_use_sql_item_db || map->db_use_sql_mob_db || map->db_use_sql_mob_skill_db )
- config |= C_SQL_DBS; //TODO: split this config into three.
+ if( map->db_use_sql_item_db )
+ config |= C_SQL_DB_ITEM;
+ if( map->db_use_sql_mob_db )
+ config |= C_SQL_DB_MOB;
+ if( map->db_use_sql_mob_skill_db )
+ config |= C_SQL_DB_MOBSKILL;
if( logs->config.sql_logs )
config |= C_SQL_LOGS;
@@ -6855,30 +6866,40 @@ void Hercules_report(char* date, char *time_c) {
#define BFLAG_LENGTH 35
- CREATE(buf, char, 6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) + 1 );
+ CREATE(buf, char, 262 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) + 1 );
/* build packet */
WBUFW(buf,0) = 0x3000;
- WBUFW(buf,2) = 6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + ( bd_size * ( BFLAG_LENGTH + 4 ) );
- WBUFW(buf,4) = 0x9e;
+ WBUFW(buf,2) = 262 + ( bd_size * ( BFLAG_LENGTH + 4 ) );
+ WBUFW(buf,4) = 0x9f;
safestrncpy((char*)WBUFP(buf,6), date, 12);
- safestrncpy((char*)WBUFP(buf,6 + 12), time_c, 9);
- safestrncpy((char*)WBUFP(buf,6 + 12 + 9), timestring, 24);
-
- safestrncpy((char*)WBUFP(buf,6 + 12 + 9 + 24), git[0] != HERC_UNKNOWN_VER ? git : svn[0] != HERC_UNKNOWN_VER ? svn : "Unknown", 41);
- WBUFL(buf,6 + 12 + 9 + 24 + 41) = map->getusers();
-
- WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4) = config;
- WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4 + 4) = bd_size;
-
+ safestrncpy((char*)WBUFP(buf,18), time_c, 9);
+ safestrncpy((char*)WBUFP(buf,27), timestring, 24);
+
+ safestrncpy((char*)WBUFP(buf,51), sysinfo->platform(), 16);
+ safestrncpy((char*)WBUFP(buf,67), sysinfo->osversion(), 50);
+ safestrncpy((char*)WBUFP(buf,117), sysinfo->cpu(), 32);
+ WBUFL(buf,149) = sysinfo->cpucores();
+ safestrncpy((char*)WBUFP(buf,153), sysinfo->arch(), 8);
+ WBUFB(buf,161) = sysinfo->vcstypeid();
+ WBUFB(buf,162) = sysinfo->is64bit();
+ safestrncpy((char*)WBUFP(buf,163), sysinfo->vcsrevision_src(), 41);
+ safestrncpy((char*)WBUFP(buf,204), sysinfo->vcsrevision_scripts(), 41);
+ WBUFB(buf,245) = (sysinfo->is_superuser()? 1 : 0);
+ WBUFL(buf,246) = map->getusers();
+
+ WBUFL(buf,250) = config;
+ WBUFL(buf,254) = PACKETVER;
+
+ WBUFL(buf,258) = bd_size;
for( i = 0; i < bd_size; i++ ) {
- safestrncpy((char*)WBUFP(buf,6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + ( i * ( BFLAG_LENGTH + 4 ) ) ), battle_data[i].str, 35);
- WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + BFLAG_LENGTH + ( i * ( BFLAG_LENGTH + 4 ) ) ) = *battle_data[i].val;
+ safestrncpy((char*)WBUFP(buf,262 + ( i * ( BFLAG_LENGTH + 4 ) ) ), battle_data[i].str, BFLAG_LENGTH);
+ WBUFL(buf,262 + BFLAG_LENGTH + ( i * ( BFLAG_LENGTH + 4 ) ) ) = *battle_data[i].val;
}
- chrif->send_report(buf, 6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) );
+ chrif->send_report(buf, 262 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) );
aFree(buf);
diff --git a/src/map/battle.h b/src/map/battle.h
index b57476cb4..88038ddb4 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -437,6 +437,7 @@ struct Battle_Config {
// rAthena
int max_third_parameter;
int max_baby_third_parameter;
+ int max_extended_parameter;
int atcommand_max_stat_bypass;
int max_third_aspd;
int vcast_stat_scale;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 80ee50a20..99a1935fd 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -841,57 +841,18 @@ bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, u
* Request char server to change sex of char (modified by Yor)
*------------------------------------------*/
void chrif_changedsex(int fd) {
- int acc, sex;
- struct map_session_data *sd;
-
- acc = RFIFOL(fd,2);
- sex = RFIFOL(fd,6);
+ int acc = RFIFOL(fd,2);
+ //int sex = RFIFOL(fd,6); // Dead store. Uncomment if needed again.
if ( battle_config.etc_log )
ShowNotice("chrif_changedsex %d.\n", acc);
-
- sd = map->id2sd(acc);
- if ( sd ) { //Normally there should not be a char logged on right now!
- if ( sd->status.sex == sex )
- return; //Do nothing? Likely safe.
- sd->status.sex = !sd->status.sex;
-
- // reset skill of some job
- if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER) {
- int i, idx = 0;
- // remove specifical skills of Bard classes
- for(i = 315; i <= 322; i++) {
- idx = skill->get_index(i);
- if (sd->status.skill[idx].id > 0 && sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) {
- sd->status.skill_point += sd->status.skill[idx].lv;
- sd->status.skill[idx].id = 0;
- sd->status.skill[idx].lv = 0;
- }
- }
- // remove specifical skills of Dancer classes
- for(i = 323; i <= 330; i++) {
- idx = skill->get_index(i);
- if (sd->status.skill[idx].id > 0 && sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) {
- sd->status.skill_point += sd->status.skill[idx].lv;
- sd->status.skill[idx].id = 0;
- sd->status.skill[idx].lv = 0;
- }
- }
- clif->updatestatus(sd, SP_SKILLPOINT);
- // change job if necessary
- if (sd->status.sex) //Changed from Dancer
- sd->status.class_ -= 1;
- else //Changed from Bard
- sd->status.class_ += 1;
- //sd->class_ needs not be updated as both Dancer/Bard are the same.
- }
- // save character
- sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
- // do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it)
- clif->message(sd->fd, msg_txt(409)); //"Your sex has been changed (disconnection required to complete the process)..."
- set_eof(sd->fd); // forced to disconnect for the change
- map->quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
- }
+
+ // Path to activate this response:
+ // Map(start) (0x2b0e) -> Char(0x2727) -> Login
+ // Login(0x2723) [ALL] -> Char (0x2b0d)[ALL] -> Map (HERE)
+ // Char will usually be "logged in" despite being forced to log-out in the begining
+ // of this process, but there's no need to perform map-server specific response
+ // as everything should've been changed through char-server [Panikon]
}
/*==========================================
* Request Char Server to Divorce Players
diff --git a/src/map/clif.c b/src/map/clif.c
index 2dbe7cb96..d0fb08486 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -3204,6 +3204,12 @@ void clif_changelook(struct block_list *bl,int type,int val)
break;
case LOOK_BASE:
if( !sd ) break;
+ // We shouldn't update LOOK_BASE if the player is disguised
+ // if we do so the client will think that the player class
+ // is really a mob and issues like 7725 will happen in every
+ // SC_ that alters class_ in any way [Panikon]
+ if( sd->disguise != -1 )
+ return;
if( sd->sc.option&OPTION_COSTUME )
vd->weapon = vd->shield = 0;
@@ -8474,6 +8480,26 @@ void clif_refresh(struct map_session_data *sd)
pc->disguise(sd, disguise);
}
+ // Notify the client that the storage is open
+ if( sd->state.storage_flag == 1 ) {
+ storage->sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
+ clif->storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
+ clif->updatestorageamount(sd, sd->status.storage.storage_amount, MAX_STORAGE);
+ }
+ // Notify the client that the gstorage is open otherwise it will
+ // remain locked forever and nobody will be able to access it
+ if( sd->state.storage_flag == 2 ) {
+ struct guild_storage *gstor;
+ if( (gstor = gstorage->id2storage2(sd->status.guild_id)) == NULL) {
+ // Shouldn't happen... The information should already be at the map-server
+ intif->request_guild_storage(sd->status.account_id,sd->status.guild_id);
+ } else {
+ storage->sortitem(gstor->items, ARRAYLENGTH(gstor->items));
+ clif->storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items));
+ clif->updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE);
+ }
+ }
+
}
@@ -9231,6 +9257,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
#if PACKETVER >= 20090218
int i;
#endif
+ bool first_time = false;
if(sd->bl.prev != NULL)
return;
@@ -9391,6 +9418,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
if(sd->state.connect_new) {
int lv;
+ first_time = true;
sd->state.connect_new = 0;
clif->skillinfoblock(sd);
clif->hotkeys(sd);
@@ -9531,6 +9559,10 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
clif->weather_check(sd);
+ // This should be displayed last
+ if( sd->guild && first_time )
+ clif->guild_notice(sd, sd->guild);
+
// For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first)
if (map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC))
npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y);
@@ -10089,7 +10121,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
return;
}
- if( pc_cant_act(sd) || sd->sc.option&OPTION_HIDE )
+ if( pc_cant_act(sd) || pc_issit(sd) || sd->sc.option&OPTION_HIDE )
return;
if( sd->sc.option&OPTION_COSTUME )
@@ -11321,8 +11353,18 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
#endif
return;
}
- if( pc_cant_act(sd) && skill_id != RK_REFRESH && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) )
+
+ if( pc_cant_act(sd)
+ && skill_id != RK_REFRESH
+ && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN))
+ && ( sd->state.storage_flag && !(tmp&INF_SELF_SKILL) ) // SELF skills can be used with the storage open, issue: 8027
+ )
return;
+
+ // Some self skills need to close the storage to work properly
+ if( skill_id == AL_TELEPORT && sd->state.storage_flag )
+ storage->close(sd);
+
if( pc_issit(sd) )
return;
diff --git a/src/map/guild.c b/src/map/guild.c
index 15d13da0b..99c74c217 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -954,7 +954,6 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online)
if(sd->state.connect_new)
{ //Note that this works because it is invoked in parse_LoadEndAck before connect_new is cleared.
clif->guild_belonginfo(sd,g);
- clif->guild_notice(sd,g);
sd->guild_emblem_id = g->emblem_id;
}
return 0;
diff --git a/src/map/map.c b/src/map/map.c
index 9e41bdca3..04ac8a239 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3765,10 +3765,9 @@ struct map_zone_data *map_merge_zone(struct map_zone_data *main, struct map_zone
CREATE(zone->capped_skills, struct map_zone_skill_damage_cap_entry *, zone->capped_skills_count);
-
for(i = 0, cursor = 0; i < main->capped_skills_count; i++, cursor++ ) {
CREATE(zone->capped_skills[cursor], struct map_zone_skill_damage_cap_entry, 1);
- memcpy(zone->capped_skills[cursor], main->disabled_commands[i], sizeof(struct map_zone_skill_damage_cap_entry));
+ memcpy(zone->capped_skills[cursor], main->capped_skills[i], sizeof(struct map_zone_skill_damage_cap_entry));
}
for(i = 0; i < other->capped_skills_count; i++, cursor++ ) {
@@ -5373,9 +5372,6 @@ void map_helpscreen(bool do_exit)
* Map-Server Version Screen [MC Cameri]
*------------------------------------------------------*/
void map_versionscreen(bool do_exit) {
- const char *svn = get_svn_revision();
- const char *git = get_git_hash();
- ShowInfo(CL_WHITE"Hercules version: %s" CL_RESET"\n", git[0] != HERC_UNKNOWN_VER ? git : svn[0] != HERC_UNKNOWN_VER ? svn : "Unknown");
ShowInfo(CL_GREEN"Website/Forum:"CL_RESET"\thttp://hercules.ws/\n");
ShowInfo(CL_GREEN"IRC Channel:"CL_RESET"\tirc://irc.rizon.net/#Hercules\n");
ShowInfo("Open "CL_WHITE"readme.txt"CL_RESET" for more information.\n");
@@ -5808,7 +5804,7 @@ int do_init(int argc, char *argv[])
if (load_extras) {
aFree(load_extras);
load_extras = NULL;
- load_extras_count = 0;
+ //load_extras_count = 0; // Dead store. Uncomment if needed again.
}
if( minimal ) {
diff --git a/src/map/map.h b/src/map/map.h
index c1eaeb40d..7373b516d 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -36,7 +36,7 @@ enum E_MAPSERVER_ST {
#define NATURAL_HEAL_INTERVAL 500
#define MIN_FLOORITEM 2
#define MAX_FLOORITEM START_ACCOUNT_NUM
-#define MAX_LEVEL 150
+#define MAX_LEVEL 175
#define MAX_IGNORE_LIST 20 // official is 14
#define MAX_VENDING 12
#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo]
diff --git a/src/map/npc.c b/src/map/npc.c
index 3018cceeb..ae374e961 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1146,13 +1146,24 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd)
{
nullpo_retr(1, sd);
+ // This usually happens when the player clicked on a NPC that has the view id
+ // of a mob, to activate this kind of npc it's needed to be in a 2,2 range
+ // from it. If the OnTouch area of a npc, coincides with the 2,2 range of
+ // another it's expected that the OnTouch event be put first in stack, because
+ // unit_walktoxy_timer is executed before any other function in this case.
+ // So it's best practice to put an 'end;' before OnTouch events in npcs that
+ // have view ids of mobs to avoid this "issue" [Panikon]
if (sd->npc_id != 0) {
- ShowError("npc_click: npc_id != 0\n");
+ // The player clicked a npc after entering an OnTouch area
+ if( sd->areanpc_id != sd->npc_id )
+ ShowError("npc_click: npc_id != 0\n");
+
return 1;
}
- if(!nd) return 1;
-
+ if( !nd )
+ return 1;
+
if ((nd = npc->checknear(sd,&nd->bl)) == NULL)
return 1;
diff --git a/src/map/pc.c b/src/map/pc.c
index f5327e0bd..ba66bf7db 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -14,6 +14,7 @@
#include "../common/utils.h"
#include "../common/conf.h"
#include "../common/mmo.h" //NAME_LENGTH
+#include "../common/sysinfo.h"
#include "pc.h"
#include "atcommand.h" // get_atcommand_level()
@@ -1147,15 +1148,8 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
if( !changing_mapservers ) {
if (battle_config.display_version == 1) {
- const char* svn = get_svn_revision();
- const char* git = get_git_hash();
char buf[256];
- if( git[0] != HERC_UNKNOWN_VER )
- sprintf(buf,"Git Hash: %s", git);
- else if( svn[0] != HERC_UNKNOWN_VER )
- sprintf(buf,"SVN Revision: %s", svn);
- else
- sprintf(buf,"Unknown Version");
+ sprintf(buf, msg_txt(1295), sysinfo->vcstype(), sysinfo->vcsrevision_src(), sysinfo->vcsrevision_scripts()); // %s revision '%s' (src) / '%s' (scripts)
clif->message(sd->fd, buf);
}
@@ -1758,6 +1752,13 @@ int pc_disguise(struct map_session_data *sd, int class_) {
status->set_viewdata(&sd->bl, class_);
clif->changeoption(&sd->bl);
+ // We need to update the client so it knows that a costume is being used
+ if( sd->sc.option&OPTION_COSTUME ) {
+ clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_);
+ clif->changelook(&sd->bl,LOOK_WEAPON,0);
+ clif->changelook(&sd->bl,LOOK_SHIELD,0);
+ clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
+ }
if (sd->bl.prev != NULL) {
clif->spawn(&sd->bl);
@@ -6832,13 +6833,14 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
int i=0,j=0;
int64 tick = timer->gettick();
- for(j = 0; j < 5; j++)
+ for(j = 0; j < 5; j++) {
if (sd->devotion[j]){
struct map_session_data *devsd = map->id2sd(sd->devotion[j]);
if (devsd)
status_change_end(&devsd->bl, SC_DEVOTION, INVALID_TIMER);
sd->devotion[j] = 0;
}
+ }
if(sd->status.pet_id > 0 && sd->pd) {
struct pet_data *pd = sd->pd;
@@ -7136,6 +7138,17 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
}
}
}
+
+ // Remove autotrade to prevent autotrading from save point
+ if( (sd->state.standalone || sd->state.autotrade)
+ && (map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg)
+ ) {
+ sd->state.autotrade = 0;
+ sd->state.standalone = 0;
+ pc->autotrade_update(sd,PAUC_REMOVE);
+ map->quit(sd);
+ }
+
// pvp
// disable certain pvp functions on pk_mode [Valaris]
if( map->list[sd->bl.m].flag.pvp && !battle_config.pk_mode && !map->list[sd->bl.m].flag.pvp_nocalcrank ) {
@@ -7165,10 +7178,10 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
}
}
-
//Reset "can log out" tick.
if( battle_config.prevent_logout )
sd->canlog_tick = timer->gettick() - battle_config.prevent_logout;
+
return 1;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 90448fa1d..70df9ca56 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -545,32 +545,6 @@ struct map_session_data {
};
-//Equip position constants
-enum equip_pos {
- EQP_HEAD_LOW = 0x000001,
- EQP_HEAD_MID = 0x000200, //512
- EQP_HEAD_TOP = 0x000100, //256
- EQP_HAND_R = 0x000002, //2
- EQP_HAND_L = 0x000020, //32
- EQP_ARMOR = 0x000010, //16
- EQP_SHOES = 0x000040, //64
- EQP_GARMENT = 0x000004, //4
- EQP_ACC_L = 0x000008, //8
- EQP_ACC_R = 0x000080, //128
- EQP_COSTUME_HEAD_TOP = 0x000400, //1024
- EQP_COSTUME_HEAD_MID = 0x000800, //2048
- EQP_COSTUME_HEAD_LOW = 0x001000, //4096
- EQP_COSTUME_GARMENT = 0x002000, //8192
- //UNUSED_COSTUME_FLOOR = 0x004000, //16384
- EQP_AMMO = 0x008000, //32768
- EQP_SHADOW_ARMOR = 0x010000, //65536
- EQP_SHADOW_WEAPON = 0x020000, //131072
- EQP_SHADOW_SHIELD = 0x040000, //262144
- EQP_SHADOW_SHOES = 0x080000, //524288
- EQP_SHADOW_ACC_R = 0x100000, //1048576
- EQP_SHADOW_ACC_L = 0x200000, //2097152
-};
-
#define EQP_WEAPON EQP_HAND_R
#define EQP_SHIELD EQP_HAND_L
#define EQP_ARMS (EQP_HAND_R|EQP_HAND_L)
@@ -615,7 +589,7 @@ enum equip_pos {
#define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE )
#define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle_config.natural_heal_weight_rate )
#define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 )
-#define pc_maxparameter(sd) ( ((((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO) || (((sd)->class_&MAPID_UPPERMASK) == MAPID_REBELLION) || (sd)->class_&JOBL_THIRD ? ((sd)->class_&JOBL_BABY ? battle_config.max_baby_third_parameter : battle_config.max_third_parameter) : ((sd)->class_&JOBL_BABY ? battle_config.max_baby_parameter : battle_config.max_parameter)) )
+#define pc_maxparameter(sd) ( (((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO || ((sd)->class_&MAPID_UPPERMASK) == MAPID_REBELLION || ((sd)->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E) ? battle_config.max_extended_parameter : (sd)->class_&JOBL_THIRD ? ((sd)->class_&JOBL_BABY ? battle_config.max_baby_third_parameter : battle_config.max_third_parameter) : ((sd)->class_&JOBL_BABY ? battle_config.max_baby_parameter : battle_config.max_parameter) )
/**
* Ranger
**/
diff --git a/src/map/script.c b/src/map/script.c
index 312e40696..8ac657f93 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -12,6 +12,7 @@
#include "../common/strlib.h"
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../common/sysinfo.h"
#include "map.h"
#include "path.h"
@@ -4499,6 +4500,8 @@ int script_reload(void) {
itemdb->name_constants();
+ sysinfo->vcsrevision_reload();
+
return 0;
}
/* returns name of current function being run, from within the stack [Ind/Hercules] */
@@ -17315,19 +17318,6 @@ BUILDIN(is_function) {
return true;
}
/**
- * get_revision() -> retrieves the current svn revision (if available)
- **/
-BUILDIN(get_revision) {
- const char *svn = get_svn_revision();
-
- if ( svn[0] != HERC_UNKNOWN_VER )
- script_pushint(st,atoi(svn));
- else
- script_pushint(st,-1);//unknown
-
- return true;
-}
-/**
* freeloop(<toggle>) -> toggles this script instance's looping-check ability
**/
BUILDIN(freeloop) {
@@ -19152,7 +19142,6 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getargcount,""),
BUILDIN_DEF(getcharip,"?"),
BUILDIN_DEF(is_function,"s"),
- BUILDIN_DEF(get_revision,""),
BUILDIN_DEF(freeloop,"i"),
BUILDIN_DEF(getrandgroupitem,"ii"),
BUILDIN_DEF(cleanmap,"s"),
diff --git a/src/map/trade.h b/src/map/trade.h
index f2c0d4622..143f26d74 100644
--- a/src/map/trade.h
+++ b/src/map/trade.h
@@ -2,8 +2,8 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#ifndef _MAP_TRADE_H_
-#define _MAP_TRADE_H_
+#ifndef _MAP_TRADE_H_
+#define _MAP_TRADE_H_
//Max distance from traders to enable a trade to take place.
//TODO: battle_config candidate?
diff --git a/src/map/vending.h b/src/map/vending.h
index b2ba22955..a212f8385 100644
--- a/src/map/vending.h
+++ b/src/map/vending.h
@@ -2,8 +2,8 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#ifndef _MAP_VENDING_H_
-#define _MAP_VENDING_H_
+#ifndef _MAP_VENDING_H_
+#define _MAP_VENDING_H_
#include "../common/cbasetypes.h"
#include "../common/db.h"