summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authormalufett <malufett.eat.my.binaries@gmail.com>2015-04-02 08:51:14 +0800
committermalufett <malufett.eat.my.binaries@gmail.com>2015-04-02 08:51:14 +0800
commit94899de0397d74b0f06bdccdbfc67eabd2d06e38 (patch)
tree322bdaeae036291ab38d535a9c1b2e6e6e2c8366 /src/map
parent19228956cc31c6406366a69d06a76467451def3a (diff)
parent60844f655aaa7adb735674d51bb3a83b90c8c6db (diff)
downloadhercules-94899de0397d74b0f06bdccdbfc67eabd2d06e38.tar.gz
hercules-94899de0397d74b0f06bdccdbfc67eabd2d06e38.tar.bz2
hercules-94899de0397d74b0f06bdccdbfc67eabd2d06e38.tar.xz
hercules-94899de0397d74b0f06bdccdbfc67eabd2d06e38.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules into JobDBRedesign
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c6
-rw-r--r--src/map/channel.c20
-rw-r--r--src/map/channel.h3
-rw-r--r--src/map/clif.c3
-rw-r--r--src/map/skill.c99
-rw-r--r--src/map/status.c7
6 files changed, 69 insertions, 69 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index e983eebc6..539d3516e 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -5902,10 +5902,10 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
{
int index = sd->equip_index[EQI_AMMO];
if (index<0) {
- if (sd->weapontype1 > W_KATAR && sd->weapontype1 < W_HUUMA)
- clif->arrow_fail(sd, 0);
- else
+ if ( sd->weapontype1 > W_KATAR && sd->weapontype1 < W_HUUMA )
clif->skill_fail(sd, 0, USESKILL_FAIL_NEED_MORE_BULLET, 0);
+ else
+ clif->arrow_fail(sd, 0);
return ATK_NONE;
}
//Ammo check by Ishizu-chan
diff --git a/src/map/channel.c b/src/map/channel.c
index 0704bf706..4331f6767 100644
--- a/src/map/channel.c
+++ b/src/map/channel.c
@@ -477,6 +477,17 @@ void channel_map_join(struct map_session_data *sd)
channel->join(map->list[sd->bl.m].channel, sd, NULL, false);
}
+void channel_irc_join(struct map_session_data *sd)
+{
+ struct channel_data *chan = ircbot->channel;
+ if (sd->state.autotrade || sd->state.standalone)
+ return;
+ if (!channel->config->irc_name)
+ return;
+ if (chan)
+ channel->join(chan, sd, NULL, false);
+}
+
/**
* Lets a guild's members join a newly allied guild's channel.
*
@@ -574,7 +585,8 @@ void read_channels_config(void)
int ally_enabled = 0, local_enabled = 0,
local_autojoin = 0, ally_autojoin = 0,
allow_user_channel_creation = 0,
- irc_enabled = 0;
+ irc_enabled = 0,
+ irc_autojoin = 0;
if( !libconfig->setting_lookup_string(settings, "map_local_channel_name", &local_name) )
local_name = "map";
@@ -655,11 +667,14 @@ void read_channels_config(void)
libconfig->setting_lookup_bool(settings, "map_local_channel_autojoin", &local_autojoin);
libconfig->setting_lookup_bool(settings, "ally_channel_autojoin", &ally_autojoin);
+ libconfig->setting_lookup_bool(settings, "irc_channel_autojoin", &irc_autojoin);
if (local_autojoin)
channel->config->local_autojoin = true;
if (ally_autojoin)
channel->config->ally_autojoin = true;
+ if (irc_autojoin)
+ channel->config->irc_autojoin = true;
libconfig->setting_lookup_bool(settings, "allow_user_channel_creation", &allow_user_channel_creation);
@@ -768,7 +783,7 @@ int do_init_channel(bool minimal)
return 0;
channel->db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, HCS_NAME_LENGTH);
- channel->config->ally = channel->config->local = channel->config->irc = channel->config->ally_autojoin = channel->config->local_autojoin = false;
+ channel->config->ally = channel->config->local = channel->config->irc = channel->config->ally_autojoin = channel->config->local_autojoin = channel->config->irc_autojoin = false;
channel->config_read();
return 0;
@@ -828,6 +843,7 @@ void channel_defaults(void)
channel->guild_join_alliance = channel_guild_join_alliance;
channel->guild_leave_alliance = channel_guild_leave_alliance;
channel->quit_guild = channel_quit_guild;
+ channel->irc_join = channel_irc_join;
channel->config_read = read_channels_config;
}
diff --git a/src/map/channel.h b/src/map/channel.h
index ba6aafc79..8fbf08d42 100644
--- a/src/map/channel.h
+++ b/src/map/channel.h
@@ -51,7 +51,7 @@ struct Channel_Config {
char **colors_name;
unsigned char colors_count;
bool local, ally, irc;
- bool local_autojoin, ally_autojoin;
+ bool local_autojoin, ally_autojoin, irc_autojoin;
char local_name[HCS_NAME_LENGTH], ally_name[HCS_NAME_LENGTH], irc_name[HCS_NAME_LENGTH];
unsigned char local_color, ally_color, irc_color;
bool closing;
@@ -106,6 +106,7 @@ struct channel_interface {
void (*guild_join_alliance) (const struct guild *g_source, const struct guild *g_ally);
void (*guild_leave_alliance) (const struct guild *g_source, const struct guild *g_ally);
void (*quit_guild) (struct map_session_data *sd);
+ void (*irc_join) (struct map_session_data *sd);
void (*config_read) (void);
};
diff --git a/src/map/clif.c b/src/map/clif.c
index 22d259006..d28e64cd3 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9265,6 +9265,9 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
if (channel->config->local && channel->config->local_autojoin) {
channel->map_join(sd);
}
+ if (channel->config->irc && channel->config->irc_autojoin) {
+ channel->irc_join(sd);
+ }
}
mail->clear(sd);
diff --git a/src/map/skill.c b/src/map/skill.c
index 793b2f060..4c8ecb40f 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2196,7 +2196,12 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
//Trick Dead protects you from damage, but not from buffs and the like, hence it's placed here.
if (sc && sc->data[SC_TRICKDEAD])
return 0;
-
+ if ( skill_id != HW_GRAVITATION ) {
+ struct status_change *csc = status->get_sc(src);
+ if(csc && csc->data[SC_GRAVITATION] && csc->data[SC_GRAVITATION]->val3 == BCT_SELF )
+ return 0;
+ }
+
dmg = battle->calc_attack(attack_type,src,bl,skill_id,skill_lv,flag&0xFFF);
//Skotlex: Adjusted to the new system
@@ -2530,6 +2535,9 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
case HT_LANDMINE:
dmg.dmotion = clif->skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, -1, type);
break;
+ case HW_GRAVITATION:
+ dmg.dmotion = clif->damage(bl, bl, 0, 0, damage, 1, 4, 0);
+ break;
case WZ_SIGHTBLASTER:
dmg.dmotion = clif->skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, (flag&SD_LEVEL) ? -1 : skill_lv, 5);
break;
@@ -6920,48 +6928,24 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
}
break;
case AM_CP_WEAPON:
- if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_HAND_R]])
- clif->skill_nodamage(src,bl,skill_id,skill_lv,
- sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- else {
- clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map->freeblock_unlock();
- return 0;
- }
- break;
- case AM_CP_SHIELD: {
- int i;
- if(dstsd && (i=dstsd->equip_index[EQI_HAND_L])>=0 && dstsd->inventory_data[i] &&
- dstsd->inventory_data[i]->type==IT_ARMOR)
- clif->skill_nodamage(src,bl,skill_id,skill_lv,
- sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- else {
- clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map->freeblock_unlock();
- return 0;
- }
- }
- break;
+ case AM_CP_SHIELD:
case AM_CP_ARMOR:
- if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_ARMOR]])
- clif->skill_nodamage(src,bl,skill_id,skill_lv,
- sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- else {
- clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map->freeblock_unlock();
- return 0;
- }
- break;
case AM_CP_HELM:
- if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_HEAD_TOP]])
- clif->skill_nodamage(src,bl,skill_id,skill_lv,
- sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- else {
- clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map->freeblock_unlock();
+ {
+ unsigned int equip[] = { EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP };
+ int index;
+ if ( sd && (bl->type != BL_PC || (dstsd && pc->checkequip(dstsd, equip[skill_id - AM_CP_WEAPON]) < 0) ||
+ (dstsd && equip[skill_id - AM_CP_WEAPON] == EQP_SHIELD && pc->checkequip(dstsd, EQP_SHIELD) > 0
+ && (index = dstsd->equip_index[EQI_HAND_L]) >= 0 && dstsd->inventory_data[index]
+ && dstsd->inventory_data[index]->type != IT_ARMOR)) ) {
+ clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
+ map->freeblock_unlock(); // Don't consume item requirements
return 0;
}
+ clif->skill_nodamage(src, bl, skill_id, skill_lv,
+ sc_start(src, bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)));
break;
+ }
case AM_TWILIGHT1:
if (sd) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -7645,27 +7629,24 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
}
break;
// Full Chemical Protection
- case CR_FULLPROTECTION: {
- bool iused=false;
- int i;
- if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_HAND_R]]) {
- iused=true;
- clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTWEAPON,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- } if(dstsd && (i=dstsd->equip_index[EQI_HAND_L])>=0 && dstsd->inventory_data[i] &&
- dstsd->inventory_data[i]->type==IT_ARMOR) {
- iused=true;
- clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTSHIELD,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- } if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_ARMOR]]) {
- iused=true;
- clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTARMOR,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- } if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_HEAD_TOP]]) {
- iused=true;
- clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTHELM,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- } if(iused)
- clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- else {
- clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map->freeblock_unlock();
+ case CR_FULLPROTECTION:
+ {
+ unsigned int equip[] = { EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP };
+ int i, s = 0, skilltime = skill->get_time(skill_id, skill_lv);
+ for ( i = 0; i < 4; i++ ) {
+ if ( bl->type != BL_PC || (dstsd && pc->checkequip(dstsd, equip[i]) < 0) )
+ continue;
+ if ( dstsd && equip[i] == EQP_SHIELD ) {
+ short index = dstsd->equip_index[EQI_HAND_L];
+ if ( index >= 0 && dstsd->inventory_data[index] && dstsd->inventory_data[index]->type != IT_ARMOR )
+ continue;
+ }
+ sc_start(src, bl, (sc_type)(SC_PROTECTWEAPON + i), 100, skill_lv, skilltime);
+ s++;
+ }
+ if ( sd && !s ) {
+ clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
+ map->freeblock_unlock(); // Don't consume item requirements
return 0;
}
}
diff --git a/src/map/status.c b/src/map/status.c
index bc8f289d5..4e4398c49 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1652,7 +1652,6 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
(sc->data[SC_TRICKDEAD] && skill_id != NV_TRICKDEAD)
|| (sc->data[SC_AUTOCOUNTER] && !flag && skill_id)
|| (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF && skill_id != PA_GOSPEL)
- || (sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 == BCT_SELF && flag != 2)
)
return 0;
@@ -5479,8 +5478,8 @@ short status_calc_aspd(struct block_list *bl, struct status_change *sc, short fl
bonus -= sc->data[SC_DEFENDER]->val4 / 10;
if (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_ENEMY) // needs more info
bonus -= 25;
- if (sc->data[SC_GRAVITATION])
- bonus -= sc->data[SC_GRAVITATION]->val2; // needs more info
+ if (sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 != BCT_SELF)
+ bonus -= sc->data[SC_GRAVITATION]->val2 / 10;
if (sc->data[SC_JOINTBEAT]) { // needs more info
if (sc->data[SC_JOINTBEAT]->val2&BREAK_WRIST)
bonus -= 25;
@@ -5641,7 +5640,7 @@ short status_calc_aspd_rate(struct block_list *bl, struct status_change *sc, int
aspd_rate += sc->data[SC_DEFENDER]->val4;
if(sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_ENEMY)
aspd_rate += 250;
- if(sc->data[SC_GRAVITATION])
+ if(sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 != BCT_SELF)
aspd_rate += sc->data[SC_GRAVITATION]->val2;
if(sc->data[SC_JOINTBEAT]) {
if( sc->data[SC_JOINTBEAT]->val2&BREAK_WRIST )