summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c54
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/chrif.c2
-rw-r--r--src/map/map.c4
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/npc.c9
-rw-r--r--src/map/npc.h16
-rw-r--r--src/map/pc.c76
-rw-r--r--src/map/pc.h1
10 files changed, 29 insertions, 136 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 8a6399568..1f234911e 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3714,16 +3714,6 @@ ACMD(reloadpcdb)
}
/*==========================================
- * @reloadmotd - reloads motd.txt
- *------------------------------------------*/
-ACMD(reloadmotd)
-{
- pc_read_motd();
- clif->message(fd, msg_txt(268));
- return true;
-}
-
-/*==========================================
* @reloadscript - reloads all scripts (npcs, warps, mob spawns, ...)
*------------------------------------------*/
ACMD(reloadscript)
@@ -6593,47 +6583,7 @@ ACMD(identify)
return true;
}
-/*==========================================
- * @gmotd (Global MOTD)
- * by davidsiaw :P
- *------------------------------------------*/
-ACMD(gmotd)
-{
- FILE* fp;
-
- if( ( fp = fopen(motd_txt, "r") ) != NULL )
- {
- char buf[CHAT_SIZE_MAX];
- size_t len;
-
- while( fgets(buf, sizeof(buf), fp) )
- {
- if( buf[0] == '/' && buf[1] == '/' )
- {
- continue;
- }
-
- len = strlen(buf);
-
- while( len && ( buf[len-1] == '\r' || buf[len-1] == '\n' ) )
- {// strip trailing EOL characters
- len--;
- }
-
- if( len )
- {
- buf[len] = 0;
-
- intif_broadcast(buf, len+1, 0);
- }
- }
- fclose(fp);
- }
- return true;
-}
-
-ACMD(misceffect)
-{
+ACMD(misceffect) {
int effect = 0;
nullpo_retr(-1, sd);
if (!message || !*message)
@@ -9553,7 +9503,6 @@ void atcommand_basecommands(void) {
ACMD_DEF(reloadbattleconf),
ACMD_DEF(reloadstatusdb),
ACMD_DEF(reloadpcdb),
- ACMD_DEF(reloadmotd),
ACMD_DEF(mapinfo),
ACMD_DEF(dye),
ACMD_DEF2("hairstyle", hair_style),
@@ -9615,7 +9564,6 @@ void atcommand_basecommands(void) {
ACMD_DEF(refresh),
ACMD_DEF(refreshall),
ACMD_DEF(identify),
- ACMD_DEF(gmotd),
ACMD_DEF(misceffect),
ACMD_DEF(mobsearch),
ACMD_DEF(cleanmap),
diff --git a/src/map/battle.c b/src/map/battle.c
index f6fba5ca5..370adcd02 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -5820,7 +5820,6 @@ static const struct _battle_data {
{ "mobs_level_up_exp_rate", &battle_config.mobs_level_up_exp_rate, 1, 1, INT_MAX, },
{ "pk_min_level", &battle_config.pk_min_level, 55, 1, INT_MAX, },
{ "skill_steal_max_tries", &battle_config.skill_steal_max_tries, 0, 0, UCHAR_MAX, },
- { "motd_type", &battle_config.motd_type, 0, 0, 1, },
{ "finding_ore_rate", &battle_config.finding_ore_rate, 100, 0, INT_MAX, },
{ "exp_calc_type", &battle_config.exp_calc_type, 0, 0, 1, },
{ "exp_bonus_attacker", &battle_config.exp_bonus_attacker, 25, 0, INT_MAX, },
diff --git a/src/map/battle.h b/src/map/battle.h
index 0975d978d..9d578d224 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -322,7 +322,6 @@ struct Battle_Config {
int mobs_level_up_exp_rate; // [Valaris]
int pk_min_level; // [celest]
int skill_steal_max_tries; //max steal skill tries on a mob. if 0, then w/o limit [Lupus]
- int motd_type; // [celest]
int finding_ore_rate; // orn
int exp_calc_type;
int exp_bonus_attacker;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 05f56029b..3ba5a20f6 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -1245,7 +1245,7 @@ int chrif_load_scdata(int fd) {
}
/*==========================================
- * Send rates and motd to char server [Wizputer]
+ * Send rates to char server [Wizputer]
* S 2b16 <base rate>.L <job rate>.L <drop rate>.L
*------------------------------------------*/
int chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate) {
diff --git a/src/map/map.c b/src/map/map.c
index 49aef6c4c..ddd2a9c82 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -151,7 +151,6 @@ struct map_cache_map_info {
};
char db_path[256] = "db";
-char motd_txt[256] = "conf/motd.txt";
char help_txt[256] = "conf/help.txt";
char help2_txt[256] = "conf/help2.txt";
char charhelp_txt[256] = "conf/charhelp.txt";
@@ -3340,8 +3339,6 @@ int map_config_read(char *cfgName)
minsave_interval = 1;
} else if (strcmpi(w1, "save_settings") == 0)
save_settings = atoi(w2);
- else if (strcmpi(w1, "motd_txt") == 0)
- strcpy(motd_txt, w2);
else if (strcmpi(w1, "help_txt") == 0)
strcpy(help_txt, w2);
else if (strcmpi(w1, "help2_txt") == 0)
@@ -5206,6 +5203,7 @@ void load_defaults(void) {
ircbot_defaults();
log_defaults();
map_defaults();
+ npc_defaults();
script_defaults();
searchstore_defaults();
skill_defaults();
diff --git a/src/map/map.h b/src/map/map.h
index a7bcb08db..f524e8840 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -705,7 +705,6 @@ extern int night_flag; // 0=day, 1=night [Yor]
extern int enable_spy; //Determines if @spy commands are active.
extern char db_path[256];
-extern char motd_txt[];
extern char help_txt[];
extern char help2_txt[];
extern char charhelp_txt[];
diff --git a/src/map/npc.c b/src/map/npc.c
index 77ee8d486..913c13e0b 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -3899,6 +3899,8 @@ int npc_reload(void) {
map_zone_init();
+ npc->motd = npc_name2id("HerculesMOTD"); /* [Ind/Hercules] */
+
//Re-read the NPC Script Events cache.
npc_read_event_script();
@@ -4031,6 +4033,8 @@ int do_init_npc(void)
map_zone_init();
+ npc->motd = npc_name2id("HerculesMOTD"); /* [Ind/Hercules] */
+
// set up the events cache
memset(script_event, 0, sizeof(script_event));
npc_read_event_script();
@@ -4062,3 +4066,8 @@ int do_init_npc(void)
return 0;
}
+void npc_defaults(void) {
+ npc = &npc_s;
+
+ npc->motd = NULL;
+}
diff --git a/src/map/npc.h b/src/map/npc.h
index 8800b4e5b..8a8b14d6e 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#ifndef _NPC_H_
#define _NPC_H_
@@ -188,4 +189,15 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c
bool npc_unloadfile( const char* path );
+/* npc.c interface (barely started/WIP) */
+struct npc_interface {
+ /* */
+ struct npc_data *motd;
+ /* */
+} npc_s;
+
+struct npc_interface *npc;
+
+void npc_defaults(void);
+
#endif /* _NPC_H_ */
diff --git a/src/map/pc.c b/src/map/pc.c
index 9b1545c51..0f221f298 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -68,9 +68,6 @@ struct fame_list taekwon_fame_list[MAX_FAME_LIST];
static unsigned short equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_GARMENT,EQP_AMMO};
-#define MOTD_LINE_SIZE 128
-static char motd_text[MOTD_LINE_SIZE][CHAT_SIZE_MAX]; // Message of the day buffer [Valaris]
-
//Links related info to the sd->hate_mob[]/sd->feel_map[] entries
const struct sg_data sg_info[MAX_PC_FEELHATE] = {
{ SG_SUN_ANGER, SG_SUN_BLESS, SG_SUN_COMFORT, "PC_FEEL_SUN", "PC_HATE_MOB_SUN", is_day_of_sun },
@@ -1067,15 +1064,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sprintf(buf,"Unknown Version");
clif->message(sd->fd, buf);
}
-
- // Message of the Day [Valaris]
- for(i=0; motd_text[i][0] && i < MOTD_LINE_SIZE; i++) {
- if (battle_config.motd_type)
- clif->disp_onlyself(sd,motd_text[i],strlen(motd_text[i]));
- else
- clif->message(sd->fd, motd_text[i]);
- }
-
+
// message of the limited time of the account
if (expiration_time != 0) { // don't display if it's unlimited or unknow value
char tmpstr[1024];
@@ -1254,6 +1243,8 @@ int pc_reg_received(struct map_session_data *sd)
clif->changeoption(&sd->bl);
}
+ if( npc->motd ) /* [Ind/Hercules] */
+ run_script(npc->motd->u.scr.script, 0, sd->bl.id, fake_nd->bl.id);
return 1;
}
@@ -9732,66 +9723,6 @@ int pc_readdb(void)
return 0;
}
-// Read MOTD on startup. [Valaris]
-int pc_read_motd(void)
-{
- FILE* fp;
-
- // clear old MOTD
- memset(motd_text, 0, sizeof(motd_text));
-
- // read current MOTD
- if( ( fp = fopen(motd_txt, "r") ) != NULL )
- {
- char* buf, * ptr;
- unsigned int lines = 0, entries = 0;
- size_t len;
-
- while( entries < MOTD_LINE_SIZE && fgets(motd_text[entries], sizeof(motd_text[entries]), fp) )
- {
- lines++;
-
- buf = motd_text[entries];
-
- if( buf[0] == '/' && buf[1] == '/' )
- {
- continue;
- }
-
- len = strlen(buf);
-
- while( len && ( buf[len-1] == '\r' || buf[len-1] == '\n' ) )
- {// strip trailing EOL characters
- len--;
- }
-
- if( len )
- {
- buf[len] = 0;
-
- if( ( ptr = strstr(buf, " :") ) != NULL && ptr-buf >= NAME_LENGTH )
- {// crashes newer clients
- ShowWarning("Found sequence '"CL_WHITE" :"CL_RESET"' on line '"CL_WHITE"%u"CL_RESET"' in '"CL_WHITE"%s"CL_RESET"'. This can cause newer clients to crash.\n", lines, motd_txt);
- }
- }
- else
- {// empty line
- buf[0] = ' ';
- buf[1] = 0;
- }
- entries++;
- }
- fclose(fp);
-
- ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", entries, motd_txt);
- }
- else
- {
- ShowWarning("File '"CL_WHITE"%s"CL_RESET"' not found.\n", motd_txt);
- }
-
- return 0;
-}
void pc_itemcd_do(struct map_session_data *sd, bool load) {
int i,cursor = 0;
struct item_cd* cd = NULL;
@@ -9843,7 +9774,6 @@ int do_init_pc(void) {
itemcd_db = idb_alloc(DB_OPT_RELEASE_DATA);
pc_readdb();
- pc_read_motd(); // Read MOTD [Valaris]
add_timer_func_list(pc_invincible_timer, "pc_invincible_timer");
add_timer_func_list(pc_eventtimer, "pc_eventtimer");
diff --git a/src/map/pc.h b/src/map/pc.h
index 014f93d99..b1fa3e741 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -939,7 +939,6 @@ void pc_inventory_rentals(struct map_session_data *sd);
int pc_inventory_rental_clear(struct map_session_data *sd);
void pc_inventory_rental_add(struct map_session_data *sd, int seconds);
-int pc_read_motd(void); // [Valaris]
int pc_disguise(struct map_session_data *sd, int class_);
bool pc_isautolooting(struct map_session_data *sd, int nameid);