summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c42
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h16
-rw-r--r--src/map/clif.c46
-rw-r--r--src/map/script.c16
-rw-r--r--src/map/skill.c1
-rw-r--r--src/map/status.c5
-rw-r--r--src/map/unit.c2
8 files changed, 96 insertions, 33 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 19128083d..7d4008faf 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -7606,36 +7606,39 @@ ACMD(cash)
return false;
}
- if( !strcmpi(command+1,"cash") )
- {
+ if( !strcmpi(command+1,"cash") ) {
if( value > 0 ) {
if( (ret=pc->getcash(sd, value, 0)) >= 0){
- sprintf(output, msg_txt(505), ret, sd->cashPoints);
- clif->disp_onlyself(sd, output, strlen(output));
- }
- else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
+ // If this option is set, the message is already sent by pc function
+ if( !battle_config.cashshop_show_points ){
+ sprintf(output, msg_txt(505), ret, sd->cashPoints);
+ clif->disp_onlyself(sd, output, strlen(output));
+ }
+ } else
+ clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
if( (ret=pc->paycash(sd, -value, 0)) >= 0){
sprintf(output, msg_txt(410), ret, sd->cashPoints);
clif->disp_onlyself(sd, output, strlen(output));
- }
- else clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
+ } else
+ clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
- }
- else
- { // @points
+ } else { // @points
if( value > 0 ) {
- if( (ret=pc->getcash(sd, 0, value)) >= 0){
- sprintf(output, msg_txt(506), ret, sd->kafraPoints);
- clif->disp_onlyself(sd, output, strlen(output));
- }
- else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
+ if( (ret=pc->getcash(sd, 0, value)) >= 0) {
+ // If this option is set, the message is already sent by pc function
+ if( !battle_config.cashshop_show_points ){
+ sprintf(output, msg_txt(506), ret, sd->kafraPoints);
+ clif->disp_onlyself(sd, output, strlen(output));
+ }
+ } else
+ clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
if( (ret=pc->paycash(sd, -value, -value)) >= 0){
sprintf(output, msg_txt(411), ret, sd->kafraPoints);
clif->disp_onlyself(sd, output, strlen(output));
- }
- else clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
+ } else
+ clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
}
@@ -9664,6 +9667,9 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
sprintf(atcmd_msg, "%s", message);
}
+ if( battle_config.idletime_criteria & BCIDLE_ATCOMMAND )
+ sd->idletime = last_tick;
+
//Clearing these to be used once more.
memset(command, '\0', sizeof(command));
memset(params, '\0', sizeof(params));
diff --git a/src/map/battle.c b/src/map/battle.c
index 0406500b7..050f3f26e 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6470,6 +6470,7 @@ static const struct _battle_data {
{ "guild_notice_changemap", &battle_config.guild_notice_changemap, 2, 0, 2, },
{ "feature.banking", &battle_config.feature_banking, 1, 0, 1, },
{ "feature.auction", &battle_config.feature_auction, 0, 0, 2, },
+ { "idletime_criteria", &battle_config.idletime_criteria, 0x25, 1, INT_MAX, },
{ "mon_trans_disable_in_gvg", &battle_config.mon_trans_disable_in_gvg, 0, 0, 1, },
};
diff --git a/src/map/battle.h b/src/map/battle.h
index 1aa07b2be..a2212a647 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -454,7 +454,7 @@ struct Battle_Config {
int max_walk_path;
int item_enabled_npc;
int packet_obfuscation;
-
+ int idletime_criteria;
int gm_ignore_warpable_area;
int client_accept_chatdori; // [Ai4rei/Mirei]
@@ -467,6 +467,20 @@ struct Battle_Config {
int mon_trans_disable_in_gvg;
} battle_config;
+/* criteria for battle_config.idletime_critera */
+enum e_battle_config_idletime {
+ BCIDLE_WALK = 0x001,
+ BCIDLE_USESKILLTOID = 0x002,
+ BCIDLE_USESKILLTOPOS = 0x004,
+ BCIDLE_USEITEM = 0x008,
+ BCIDLE_ATTACK = 0x010,
+ BCIDLE_CHAT = 0x020,
+ BCIDLE_SIT = 0x040,
+ BCIDLE_EMOTION = 0x080,
+ BCIDLE_DROPITEM = 0x100,
+ BCIDLE_ATCOMMAND = 0x200,
+};
+
// Dammage delayed info
struct delay_damage {
int src_id;
diff --git a/src/map/clif.c b/src/map/clif.c
index 7aacd8e90..9c740d607 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9917,6 +9917,9 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
}
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
if( sd->gcbind ) {
clif->chsys_send(sd->gcbind,sd,message);
return;
@@ -10077,6 +10080,9 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd)
return;
}
sd->emotionlasttime = time(NULL);
+
+ if( battle_config.idletime_criteria & BCIDLE_EMOTION )
+ sd->idletime = last_tick;
if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) {// re-roll dice
emoticon = rnd()%6+E_DICE1;
@@ -10151,7 +10157,8 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
}
pc->delinvincibletimer(sd);
- sd->idletime = last_tick;
+ if( battle_config.idletime_criteria & BCIDLE_ATTACK )
+ sd->idletime = last_tick;
unit->attack(&sd->bl, target_id, action_type != 0);
break;
case 0x02: // sitdown
@@ -10175,6 +10182,9 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
)) //No sitting during these states either.
break;
+ if( battle_config.idletime_criteria & BCIDLE_SIT )
+ sd->idletime = last_tick;
+
pc_setsit(sd);
skill->sit(sd,1);
clif->sitting(&sd->bl);
@@ -10185,6 +10195,10 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
clif->standing(&sd->bl);
return;
}
+
+ if( battle_config.idletime_criteria & BCIDLE_SIT )
+ sd->idletime = last_tick;
+
pc->setstand(sd);
skill->sit(sd,0);
clif->standing(&sd->bl);
@@ -10376,6 +10390,9 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
// Chat logging type 'W' / Whisper
logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, target, message);
@@ -10594,6 +10611,9 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
if (!pc->dropitem(sd, item_index, item_amount))
break;
+ if( battle_config.idletime_criteria & BCIDLE_DROPITEM )
+ sd->idletime = last_tick;
+
return;
}
@@ -10619,7 +10639,8 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
return;
//Whether the item is used or not is irrelevant, the char ain't idle. [Skotlex]
- sd->idletime = last_tick;
+ if( battle_config.idletime_criteria & BCIDLE_USEITEM )
+ sd->idletime = last_tick;
n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2;
if(n <0 || n >= MAX_INVENTORY)
@@ -10664,6 +10685,9 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
return;
}
+ if( battle_config.idletime_criteria & BCIDLE_USEITEM )
+ sd->idletime = last_tick;
+
//Client doesn't send the position for ammo.
if(sd->inventory_data[index]->type == IT_AMMO)
pc->equipitem(sd,index,EQP_AMMO);
@@ -10781,6 +10805,9 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
index = RFIFOW(fd,2)-2;
+ if( battle_config.idletime_criteria & BCIDLE_USEITEM )
+ sd->idletime = last_tick;
+
pc->unequipitem(sd,index,1);
}
@@ -11330,7 +11357,8 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
}
// Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
- sd->idletime = last_tick;
+ if( battle_config.idletime_criteria & BCIDLE_USESKILLTOID )
+ sd->idletime = last_tick;
if( sd->npc_id || sd->state.workinprogress&1 ){
#ifdef RENEWAL
@@ -11430,7 +11458,8 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
#endif
//Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
- sd->idletime = last_tick;
+ if( battle_config.idletime_criteria & BCIDLE_USESKILLTOPOS )
+ sd->idletime = last_tick;
if( skill->not_ok(skill_id, sd) )
return;
@@ -12185,6 +12214,9 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
party->send_message(sd, text, textlen);
}
@@ -13140,6 +13172,9 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd)
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
if( sd->bg_id )
bg->send_message(sd, text, textlen);
else
@@ -16077,6 +16112,9 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd)
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
bg->send_message(sd, text, textlen);
}
diff --git a/src/map/script.c b/src/map/script.c
index e6d23541a..3c0742405 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5639,7 +5639,7 @@ BUILDIN(checkweight2)
int nb_it, nb_nb; //array size
TBL_PC *sd = script->rid2sd(st);
- nullpo_retr(1,sd);
+ nullpo_retr(false,sd);
data_it = script_getdata(st, 2);
data_nb = script_getdata(st, 3);
@@ -8995,8 +8995,8 @@ BUILDIN(itemeffect) {
struct script_data *data;
struct item_data *item_data;
- nullpo_retr( 1, ( sd = script->rid2sd( st ) ) );
- nullpo_retr( 1, ( nd = (TBL_NPC *)map->id2bl( sd->npc_id ) ) );
+ nullpo_retr( false, ( sd = script->rid2sd( st ) ) );
+ nullpo_retr( false, ( nd = (TBL_NPC *)map->id2bl( sd->npc_id ) ) );
data = script_getdata( st, 2 );
script->get_val( st, data );
@@ -15456,7 +15456,7 @@ BUILDIN(readbook)
BUILDIN(setquest)
{
struct map_session_data *sd = script->rid2sd(st);
- nullpo_ret(sd);
+ nullpo_retr(false,sd);
quest->add(sd, script_getnum(st, 2));
return true;
@@ -15465,7 +15465,7 @@ BUILDIN(setquest)
BUILDIN(erasequest)
{
struct map_session_data *sd = script->rid2sd(st);
- nullpo_ret(sd);
+ nullpo_retr(false,sd);
quest->delete(sd, script_getnum(st, 2));
return true;
@@ -15474,7 +15474,7 @@ BUILDIN(erasequest)
BUILDIN(completequest)
{
struct map_session_data *sd = script->rid2sd(st);
- nullpo_ret(sd);
+ nullpo_retr(false,sd);
quest->update_status(sd, script_getnum(st, 2), Q_COMPLETE);
return true;
@@ -15483,7 +15483,7 @@ BUILDIN(completequest)
BUILDIN(changequest)
{
struct map_session_data *sd = script->rid2sd(st);
- nullpo_ret(sd);
+ nullpo_retr(false,sd);
quest->change(sd, script_getnum(st, 2),script_getnum(st, 3));
return true;
@@ -15494,7 +15494,7 @@ BUILDIN(checkquest)
struct map_session_data *sd = script->rid2sd(st);
quest_check_type type = HAVEQUEST;
- nullpo_ret(sd);
+ nullpo_retr(false,sd);
if( script_hasdata(st, 3) )
type = (quest_check_type)script_getnum(st, 3);
diff --git a/src/map/skill.c b/src/map/skill.c
index 366a30ff1..36a509876 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -17690,6 +17690,7 @@ bool skill_parse_row_skilldb(char* split[], int columns, int current) {
safestrncpy(skill->db[idx].name, trim(split[15]), sizeof(skill->db[idx].name));
safestrncpy(skill->db[idx].desc, trim(split[16]), sizeof(skill->db[idx].desc));
strdb_iput(skill->name2id_db, skill->db[idx].name, skill_id);
+ script->set_constant2(skill->db[idx].name,(int)skill_id,0);
return true;
}
diff --git a/src/map/status.c b/src/map/status.c
index 4c40b1a2f..5f6444971 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -8439,6 +8439,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val2 = 180; // Watk. TODO: Renewal (Atk2)
val3 = MG_FIREBOLT;
break;
+ case SC_AQUAPLAY_OPTION:
+ val2 = 40;
+ break;
case SC_COOLER_OPTION:
val2 = 80; // % Freezing chance
val3 = 33; // % increased damage
@@ -8726,7 +8729,6 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val_flag |= 1|2|4;
break;
case SC_CRESCENTELBOW:
- val2 = 94 + val1;
val_flag |= 1|2;
break;
case SC_LIGHTNINGWALK:
@@ -8774,6 +8776,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_CASH_PLUSEXP:
case SC_CASH_PLUSONLYJOBEXP:
case SC_MONSTER_TRANSFORM:
+ case SC_CASH_RECEIVEITEM:
val_flag |= 1;
break;
}
diff --git a/src/map/unit.c b/src/map/unit.c
index a7aca10b9..a9cbd605e 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1915,7 +1915,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
}
if(ud->state.attack_continue) {
- if( src->type == BL_PC )
+ if( src->type == BL_PC && battle_config.idletime_criteria & BCIDLE_ATTACK )
((TBL_PC*)src)->idletime = last_tick;
ud->attacktimer = timer->add(ud->attackabletime,unit->attack_timer,src->id,0);
}