summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/mmo.h7
-rw-r--r--src/config/const.h7
-rw-r--r--src/map/atcommand.c25
-rw-r--r--src/map/clif.c14
-rw-r--r--src/map/pc.c3
-rw-r--r--src/map/script.c3
-rw-r--r--src/map/trade.c35
-rw-r--r--src/map/trade.h21
-rw-r--r--src/map/unit.c2
9 files changed, 84 insertions, 33 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h
index eaffdf7df..8643d2b54 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -54,6 +54,13 @@
// Comment the following line if your client is NOT ragexeRE (required because of conflicting packets in ragexe vs ragexeRE).
#define PACKETVER_RE
+// Client support for experimental RagexeRE UI present in 2012-04-10 and 2012-04-18
+#ifdef PACKETVER_RE
+#if (PACKETVER == 20120410) || (PACKETVER == 20120418)
+ #define PARTY_RECRUIT
+#endif
+#endif
+
// Comment the following line to disable sc_data saving. [Skotlex]
#define ENABLE_SC_SAVING
diff --git a/src/config/const.h b/src/config/const.h
index f4a2821f8..d8e397b1e 100644
--- a/src/config/const.h
+++ b/src/config/const.h
@@ -92,12 +92,7 @@
#else
#define MAX_CARTS 5
#endif
-/* Client Supports Party Recruit or Party Booking? */
-#ifdef PACKETVER_RE
-#if (PACKETVER == 20120410) || (PACKETVER == 20120418)
- #define PARTY_RECRUIT
-#endif
-#endif
+
// Renewal variable cast time reduction
#ifdef RENEWAL_CAST
#define VARCAST_REDUCTION(val){ \
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index d9810e77c..6cda0ad84 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3718,10 +3718,33 @@ ACMD(reloadpcdb)
*------------------------------------------*/
ACMD(reloadscript)
{
+ struct s_mapiterator* iter;
+ struct map_session_data* pl_sd;
+
nullpo_retr(-1, sd);
//atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." );
//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
+ iter = mapit_getallusers();
+ for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) {
+ if (pl_sd->npc_id || pl_sd->npc_shopid) {
+ if (pl_sd->state.using_fake_npc) {
+ clif->clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
+ pl_sd->state.using_fake_npc = 0;
+ }
+ if (pl_sd->state.menu_or_input)
+ pl_sd->state.menu_or_input = 0;
+ if (pl_sd->npc_menu)
+ pl_sd->npc_menu = 0;
+
+ pl_sd->npc_id = 0;
+ pl_sd->npc_shopid = 0;
+ if (pl_sd->st && pl_sd->st->state != END)
+ pl_sd->st->state = END;
+ }
+ }
+ mapit->free(iter);
+
flush_fifos();
iMap->reloadnpc(true); // reload config files seeking for npcs
script_reload();
@@ -6397,7 +6420,7 @@ ACMD(trade)
return false;
}
- trade_traderequest(sd, pl_sd);
+ trade->request(sd, pl_sd);
return true;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 2feb6f4bf..23501d370 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11041,7 +11041,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
return;
}
- trade_traderequest(sd,t_sd);
+ trade->request(sd,t_sd);
}
@@ -11052,7 +11052,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
/// 4 = rejected
void clif_parse_TradeAck(int fd,struct map_session_data *sd)
{
- trade_tradeack(sd,RFIFOB(fd,2));
+ trade->ack(sd,RFIFOB(fd,2));
}
@@ -11064,9 +11064,9 @@ void clif_parse_TradeAddItem(int fd,struct map_session_data *sd)
int amount = RFIFOL(fd,4);
if( index == 0 )
- trade_tradeaddzeny(sd, amount);
+ trade->addzeny(sd, amount);
else
- trade_tradeadditem(sd, index, (short)amount);
+ trade->additem(sd, index, (short)amount);
}
@@ -11074,7 +11074,7 @@ void clif_parse_TradeAddItem(int fd,struct map_session_data *sd)
/// 00eb
void clif_parse_TradeOk(int fd,struct map_session_data *sd)
{
- trade_tradeok(sd);
+ trade->ok(sd);
}
@@ -11082,7 +11082,7 @@ void clif_parse_TradeOk(int fd,struct map_session_data *sd)
/// 00ed
void clif_parse_TradeCancel(int fd,struct map_session_data *sd)
{
- trade_tradecancel(sd);
+ trade->cancel(sd);
}
@@ -11090,7 +11090,7 @@ void clif_parse_TradeCancel(int fd,struct map_session_data *sd)
/// 00ef
void clif_parse_TradeCommit(int fd,struct map_session_data *sd)
{
- trade_tradecommit(sd);
+ trade->commit(sd);
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 155812836..ef70aad97 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -6667,7 +6667,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
npc_script_event(sd,NPCE_DIE);
// Clear anything NPC-related when you die and was interacting with one.
- if (sd->npc_id) {
+ if (sd->npc_id || sd->npc_shopid) {
if (sd->state.using_fake_npc) {
clif->clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
sd->state.using_fake_npc = 0;
@@ -6678,6 +6678,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
sd->npc_menu = 0;
sd->npc_id = 0;
+ sd->npc_shopid = 0;
if (sd->st && sd->st->state != END)
sd->st->state = END;
}
diff --git a/src/map/script.c b/src/map/script.c
index f3bf2470a..2b2628aa3 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7225,6 +7225,9 @@ BUILDIN(successrefitem)
//Logs items, got from (N)PC scripts [Lupus]
logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
+ if (sd->status.inventory[i].refine >= MAX_REFINE)
+ return true;
+
sd->status.inventory[i].refine++;
pc->unequipitem(sd,i,2); // status calc will happen in pc->equipitem() below
diff --git a/src/map/trade.c b/src/map/trade.c
index 8311dbf3d..f469f4b28 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -331,7 +331,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
if( (target_sd = iMap->id2sd(sd->trade_partner)) == NULL )
{
- trade_tradecancel(sd);
+ trade->cancel(sd);
return;
}
@@ -415,13 +415,13 @@ void trade_tradeaddzeny(struct map_session_data* sd, int amount)
if( (target_sd = iMap->id2sd(sd->trade_partner)) == NULL )
{
- trade_tradecancel(sd);
+ trade->cancel(sd);
return;
}
if( amount < 0 || amount > sd->status.zeny || amount > MAX_ZENY - target_sd->status.zeny )
{ // invalid values, no appropriate packet for it => abort
- trade_tradecancel(sd);
+ trade->cancel(sd);
return;
}
@@ -440,7 +440,7 @@ void trade_tradeok(struct map_session_data *sd)
return;
if ((target_sd = iMap->id2sd(sd->trade_partner)) == NULL) {
- trade_tradecancel(sd);
+ trade->cancel(sd);
return;
}
sd->state.deal_locked = 1;
@@ -532,18 +532,18 @@ void trade_tradecommit(struct map_session_data *sd)
//Now is a good time (to save on resources) to check that the trade can indeed be made and it's not exploitable.
// check exploit (trade more items that you have)
- if (impossible_trade_check(sd)) {
- trade_tradecancel(sd);
+ if (trade->check_impossible(sd)) {
+ trade->cancel(sd);
return;
}
// check exploit (trade more items that you have)
- if (impossible_trade_check(tsd)) {
- trade_tradecancel(tsd);
+ if (trade->check_impossible(tsd)) {
+ trade->cancel(tsd);
return;
}
// check for full inventory (can not add traded items)
- if (!trade_check(sd,tsd)) { // check the both players
- trade_tradecancel(sd);
+ if (!trade->check(sd,tsd)) { // check the both players
+ trade->cancel(sd);
return;
}
@@ -607,3 +607,18 @@ void trade_tradecommit(struct map_session_data *sd)
chrif_save(tsd,0);
}
}
+
+void trade_defaults(void)
+{
+ trade = &trade_s;
+
+ trade->request = trade_traderequest;
+ trade->ack = trade_tradeack;
+ trade->check_impossible = impossible_trade_check;
+ trade->check = trade_check;
+ trade->additem = trade_tradeadditem;
+ trade->addzeny = trade_tradeaddzeny;
+ trade->ok = trade_tradeok;
+ trade->cancel = trade_tradecancel;
+ trade->commit = trade_tradecommit;
+} \ No newline at end of file
diff --git a/src/map/trade.h b/src/map/trade.h
index 6bb39936e..6bcefdb96 100644
--- a/src/map/trade.h
+++ b/src/map/trade.h
@@ -7,12 +7,19 @@
//#include "map.h"
struct map_session_data;
-void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd);
-void trade_tradeack(struct map_session_data *sd,int type);
-void trade_tradeadditem(struct map_session_data *sd,short index,short amount);
-void trade_tradeaddzeny(struct map_session_data *sd,int amount);
-void trade_tradeok(struct map_session_data *sd);
-void trade_tradecancel(struct map_session_data *sd);
-void trade_tradecommit(struct map_session_data *sd);
+struct trade_interface {
+ void (*request) (struct map_session_data *sd, struct map_session_data *target_sd);
+ void (*ack) (struct map_session_data *sd,int type);
+ int (*check_impossible) (struct map_session_data *sd);
+ int (*check) (struct map_session_data *sd, struct map_session_data *tsd);
+ void (*additem) (struct map_session_data *sd,short index,short amount);
+ void (*addzeny) (struct map_session_data *sd,int amount);
+ void (*ok) (struct map_session_data *sd);
+ void (*cancel) (struct map_session_data *sd);
+ void (*commit) (struct map_session_data *sd);
+} trade_s;
+
+struct trade_interface *trade;
+void trade_interface(void);
#endif /* _TRADE_H_ */
diff --git a/src/map/unit.c b/src/map/unit.c
index e5637e42d..021859bba 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2104,7 +2104,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
if(sd->chatID)
chat_leavechat(sd,0);
if(sd->trade_partner)
- trade_tradecancel(sd);
+ trade->cancel(sd);
buyingstore->close(sd);
searchstore->close(sd);
if(sd->state.storage_flag == 1)