summaryrefslogtreecommitdiff
path: root/src/map/trade.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-10 14:25:32 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-10 14:25:32 +0000
commit5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf (patch)
tree17dffecbf004bda824dc805f29e0bc71a128c2dd /src/map/trade.c
parent911c7aa759e427e78185e370512886c36dfab83f (diff)
downloadhercules-5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf.tar.gz
hercules-5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf.tar.bz2
hercules-5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf.tar.xz
hercules-5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf.zip
- Fixed two instances in the login-sql server where the ip in the log-login table was being stored backwards.
- Now when a skill's range is 0 and the skill is NOT casted on self, it will take the basic weapon's range (without Vulture/Snake Eye bonus). - Now when a duration is not specified, sc_start/sc_start2/sc_start4 will try to guess the duration by extracting it from the skill_db (it uses skill_get_time on whatever skill is associated to the status-change using val1 as skill-level) - Corrected that extra comma at the end of the Kaensin layout setup. - Some cleanups on trade_tradeaccept to prevent packets being resent when they shouldn't. - Corrected that ALLOW NULL thingie on main.sql git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8229 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/trade.c')
-rw-r--r--src/map/trade.c32
1 files changed, 14 insertions, 18 deletions
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);
- */
}
/*==========================================