diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/mapindex.c | 2 | ||||
-rw-r--r-- | src/map/atcommand.c | 56 | ||||
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 1 | ||||
-rw-r--r-- | src/map/chrif.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 16 | ||||
-rw-r--r-- | src/map/map.c | 4 | ||||
-rw-r--r-- | src/map/map.h | 1 | ||||
-rw-r--r-- | src/map/npc.c | 9 | ||||
-rw-r--r-- | src/map/npc.h | 16 | ||||
-rw-r--r-- | src/map/party.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 92 | ||||
-rw-r--r-- | src/map/pc.h | 1 |
13 files changed, 53 insertions, 150 deletions
diff --git a/src/common/mapindex.c b/src/common/mapindex.c index 4649e299d..83de21b2b 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -148,7 +148,7 @@ void mapindex_init(void) { exit(EXIT_FAILURE); //Server can't really run without this file. } memset (&indexes, 0, sizeof (indexes)); - mapindex_db = strdb_alloc(DB_RELEASE_KEY, MAP_NAME_LENGTH); + mapindex_db = strdb_alloc(DB_OPT_DUP_KEY, MAP_NAME_LENGTH); while(fgets(line, sizeof(line), fp)) { if(line[0] == '/' && line[1] == '/') continue; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index d923027dd..65da7aa24 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) @@ -7472,7 +7422,7 @@ ACMD(sizeguild) struct guild *g; nullpo_retr(-1, sd); - memset(guild, '\0', sizeof(guild)); + memset(guild_name, '\0', sizeof(guild_name)); if( !message || !*message || sscanf(message, "%d %23[^\n]", &size, guild_name) < 2 ) { clif->message(fd, msg_txt(1304)); // Please enter guild name/ID (usage: @sizeguild <size> <guild name/ID>). @@ -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 efe976942..06956e731 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/clif.c b/src/map/clif.c index 0c5143ffd..2f69ce2fd 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1136,9 +1136,9 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { p.isBoss = 0; } #endif - clif->send(&p,sizeof(p),bl,target); - if( disguised(bl) ) { + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); #if PACKETVER >= 20071106 p.objecttype = pcdb_checkid(status_get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; @@ -1146,7 +1146,8 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { p.GID = -bl->id; #endif clif->send(&p,sizeof(p),bl,SELF); - } + } else + clif->send(&p,sizeof(p),bl,target); } @@ -9836,10 +9837,11 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) } int clif_undisguise_timer(int tid, unsigned int tick, int id, intptr_t data) { struct map_session_data * sd; - if( (sd = map_id2sd(id)) && sd->fontcolor && sd->disguise == sd->status.class_ ) { - pc_disguise(sd,-1); + if( (sd = map_id2sd(id)) ) { + sd->fontcolor_tid = INVALID_TIMER; + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc_disguise(sd,-1); } - sd->fontcolor_tid = INVALID_TIMER; return 0; } @@ -9880,10 +9882,10 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) unsigned char mylen = 1; if( sd->disguise == -1 ) { + sd->fontcolor_tid = add_timer(gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); pc_disguise(sd,sd->status.class_); if( pc_isdead(sd) ) clif_clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); - sd->fontcolor_tid = add_timer(gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != INVALID_TIMER ) { const struct TimerData *timer; if( (timer = get_timer(sd->fontcolor_tid)) ) { diff --git a/src/map/map.c b/src/map/map.c index 6f61375fe..d4c15cd6e 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 090c03e58..7d0d5c6e1 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/party.c b/src/map/party.c index d8bb321f1..8a632a8ef 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -481,7 +481,6 @@ int party_member_added(int party_id,int account_id,int char_id, int flag) sd->status.party_id = party_id; clif->party_member_info(p,sd); - clif->party_option(p,sd,0x100); clif->party_info(p,sd); if( sd2 != NULL ) @@ -732,7 +731,6 @@ void party_send_movemap(struct map_session_data *sd) if(sd->state.connect_new) { //Note that this works because this function is invoked before connect_new is cleared. - clif->party_option(p,sd,0x100); clif->party_info(p,sd); clif->party_member_info(p,sd); } diff --git a/src/map/pc.c b/src/map/pc.c index 9b1545c51..55ce993b4 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; } @@ -1651,8 +1642,12 @@ int pc_disguise(struct map_session_data *sd, int class_) { } if (sd->bl.prev != NULL) { - pc_stop_walking(sd, 0); - clif->clearunit_area(&sd->bl, CLR_OUTSIGHT); + if( class_ == -1 && sd->disguise == sd->status.class_ ) { + clif->clearunit_single(-sd->bl.id,CLR_OUTSIGHT,sd->fd); + } else if ( class_ != sd->status.class_ ) { + pc_stop_walking(sd, 0); + clif->clearunit_area(&sd->bl, CLR_OUTSIGHT); + } } if (class_ == -1) { @@ -7551,7 +7546,13 @@ int pc_changelook(struct map_session_data *sd,int type,int val) switch(type){ case LOOK_BASE: - sd->vd.class_ = val; + status_set_viewdata(&sd->bl, val); + clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); + clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); + if (sd->vd.cloth_color) + clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); + clif->skillinfoblock(sd); + return 0; break; case LOOK_HAIR: //Use the battle_config limits! [Skotlex] val = cap_value(val, MIN_HAIR_STYLE, MAX_HAIR_STYLE); @@ -9732,66 +9733,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 +9784,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); |