summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c26
-rw-r--r--src/map/skill.c18
-rw-r--r--src/map/trade.c32
3 files changed, 56 insertions, 20 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 73b3b6e89..377785fe4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7571,6 +7571,14 @@ int buildin_sc_start(struct script_state *st)
tick/=2; //Thrown potions only last half.
val4 = 1; //Mark that this was a thrown sc_effect
}
+ if (type >= 0 && type < SC_MAX && val1 && !tick)
+ { //When there isn't a duration specified, try to get it from the skill_db
+ tick = StatusSkillChangeTable[type];
+ if (tick)
+ tick = skill_get_time(tick,val1);
+ else //Failed to retrieve duration, reset to what it was.
+ tick = 0;
+ }
if (bl)
status_change_start(bl,type,10000,val1,0,0,val4,tick,11);
return 0;
@@ -7593,6 +7601,15 @@ int buildin_sc_start2(struct script_state *st)
else
bl = map_id2bl(st->rid);
+ if (type >= 0 && type < SC_MAX && val1 && !tick)
+ { //When there isn't a duration specified, try to get it from the skill_db
+ tick = StatusSkillChangeTable[type];
+ if (tick)
+ tick = skill_get_time(tick,val1);
+ else //Failed to retrieve duration, reset to what it was.
+ tick = 0;
+ }
+
if (potion_flag==1 && potion_target) {
bl = map_id2bl(potion_target);
tick/=2;
@@ -7625,6 +7642,15 @@ int buildin_sc_start4(struct script_state *st)
else
bl = map_id2bl(st->rid);
+ if (type >= 0 && type < SC_MAX && val1 && !tick)
+ { //When there isn't a duration specified, try to get it from the skill_db
+ tick = StatusSkillChangeTable[type];
+ if (tick)
+ tick = skill_get_time(tick,val1);
+ else //Failed to retrieve duration, reset to what it was.
+ tick = 0;
+ }
+
if (potion_flag==1 && potion_target) {
bl = map_id2bl(potion_target);
tick/=2;
diff --git a/src/map/skill.c b/src/map/skill.c
index 3d7435dbe..8691aaff0 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -760,6 +760,20 @@ int skill_get_range2 (struct block_list *bl, int id, int lv)
return status_get_range(bl);
range *=-1;
}
+
+ if(!range && !(skill_get_inf(id)&INF_SELF_SKILL))
+ { //Use weapon's basic range.
+ if (bl->type==BL_PC) {
+ struct map_session_data *sd = (TBL_PC*)bl;
+ range = sd->equip_index[EQI_HAND_R];
+ if (range >= 0 && sd->inventory_data[range])
+ range = sd->inventory_data[range]->range;
+ else
+ range = 1; //Assume fist range.
+ } else
+ range = status_get_range(bl);
+ }
+
//TODO: Find a way better than hardcoding the list of skills affected by AC_VULTURE
switch (id) {
case AC_SHOWER:
@@ -10876,8 +10890,8 @@ void skill_init_unit_layout (void)
}
case NJ_KAENSIN:
{
- static const int dx[] = {-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,};
- static const int dy[] = { 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,};
+ static const int dx[] = {-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2};
+ static const int dy[] = { 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2};
skill_unit_layout[pos].count = 24;
memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
diff --git a/src/map/trade.c b/src/map/trade.c
index 3bbf4385b..93f8490d4 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -86,7 +86,10 @@ void trade_tradeack(struct map_session_data *sd, int type) {
sd->trade_partner=0;
return;
}
-
+
+ if (target_sd->state.trading || target_sd->trade_partner != sd->bl.id)
+ return; //Already trading or wrong partner.
+
//Copied here as well since the original character could had warped.
if (type == 3 && pc_isGM(target_sd) < lowest_gm_level && (sd->bl.m != target_sd->bl.m ||
(sd->bl.x - target_sd->bl.x <= -5 || sd->bl.x - target_sd->bl.x >= 5) ||
@@ -97,14 +100,15 @@ void trade_tradeack(struct map_session_data *sd, int type) {
clif_tradestart(sd, 0); // too far
return;
}
-
- clif_tradestart(target_sd, type);
- clif_tradestart(sd, type);
+
+ //TODO: Type 4/3? What would 1/2 and the rest do?
if (type == 4) { // Cancel
sd->state.deal_locked = 0;
sd->trade_partner = 0;
target_sd->state.deal_locked = 0;
target_sd->trade_partner = 0;
+ clif_tradestart(target_sd, type);
+ clif_tradestart(sd, type);
}
if (type == 3) { //Initiate trade
@@ -112,21 +116,13 @@ void trade_tradeack(struct map_session_data *sd, int type) {
target_sd->state.trading = 1;
memset(&sd->deal, 0, sizeof(sd->deal));
memset(&target_sd->deal, 0, sizeof(target_sd->deal));
+ clif_tradestart(target_sd, type);
+ clif_tradestart(sd, type);
+ if (sd->npc_id)
+ npc_event_dequeue(sd);
+ if (target_sd->npc_id)
+ npc_event_dequeue(target_sd);
}
-
- if (sd->npc_id)
- npc_event_dequeue(sd);
- if (target_sd->npc_id)
- npc_event_dequeue(target_sd);
-
- /* Why? It should be allowed to bring items from storage to inventory for trading, but not the other way around
- * (this is blocked on clif.c) [Skotlex]
- //close STORAGE window if it's open. It protects from spooffing packets [Lupus]
- if (sd->state.storage_flag == 1)
- storage_storageclose(sd);
- else if (sd->state.storage_flag == 2)
- storage_guild_storageclose(sd);
- */
}
/*==========================================