diff options
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 46 | ||||
-rw-r--r-- | src/char/int_storage.c | 9 | ||||
-rw-r--r-- | src/char/int_storage.h | 1 |
3 files changed, 54 insertions, 2 deletions
diff --git a/src/char/char.c b/src/char/char.c index b8ce145..b14f25c 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1778,6 +1778,50 @@ int parse_tologin(int fd) { } break; + case 0x7924: { // [Fate] Itemfrob package: forwarded from login-server + if (RFIFOREST(fd) < 10) + return 0; + int source_id = RFIFOL(fd, 2); + int dest_id = RFIFOL(fd, 6); + unsigned char buf[10]; + + WBUFW(buf, 0) = 0x2afa; + WBUFL(buf, 2) = source_id; + WBUFL(buf, 6) = dest_id; + + mapif_sendall(buf, 10); // forward package to map servers + for (i = 0; i < char_num; i++) { + struct mmo_charstatus *c = char_dat + i; + struct storage *s = account2maybe_storage(c->account_id); + int changes = 0; + int j; +#define FIX(v) if (v == source_id) {v = dest_id; ++changes; } + for (j = 0; j < MAX_INVENTORY; j++) + FIX(c->inventory[j].nameid); + for (j = 0; j < MAX_CART; j++) + FIX(c->cart[j].nameid); + FIX(c->weapon); + FIX(c->shield); + FIX(c->head_top); + FIX(c->head_mid); + FIX(c->head_bottom); + + if (s) + for (j = 0; j < s->storage_amount; j++) + FIX(s->storage[j].nameid); +#undef FIX + if (changes) + char_log("itemfrob(%d -> %d): `%s'(%d, account %d): changed %d times\n", source_id, dest_id, + c->name, c->char_id, c->account_id, changes); + + } + + mmo_char_sync(); + inter_storage_save(); + RFIFOSKIP(fd,10); + break; + } + // Account deletion notification (from login-server) case 0x2730: if (RFIFOREST(fd) < 6) @@ -2954,7 +2998,7 @@ int check_connect_login_server(int tid, unsigned int tick, int id, int data) { //---------------------------------------------------------- // Return numerical value of a switch configuration by [Yor] -// on/off, english, franais, deutsch, espaol +// on/off, english, franais, deutsch, espanol //---------------------------------------------------------- int config_switch(const char *str) { if (strcmpi(str, "on") == 0 || strcmpi(str, "yes") == 0 || strcmpi(str, "oui") == 0 || strcmpi(str, "ja") == 0 || strcmpi(str, "si") == 0) diff --git a/src/char/int_storage.c b/src/char/int_storage.c index b84b586..0774370 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -190,10 +190,17 @@ int guild_storage_fromstr(char *str,struct guild_storage *p) } // AJEgqɃf[^CfbNXiVKqɒlj\j -struct storage *account2storage(int account_id) +struct storage *account2maybe_storage(int account_id) { struct storage *s; s=numdb_search(storage_db,account_id); + return s; +} + +struct storage *account2storage(int account_id) +{ + struct storage *s = account2maybe_storage(account_id); + if(s == NULL) { s = calloc(sizeof(struct storage), 1); if(s==NULL){ diff --git a/src/char/int_storage.h b/src/char/int_storage.h index d918f5f..59f56c6 100644 --- a/src/char/int_storage.h +++ b/src/char/int_storage.h @@ -7,6 +7,7 @@ int inter_storage_save(); int inter_guild_storage_save(); int inter_storage_delete(int account_id); int inter_guild_storage_delete(int guild_id); +struct storage *account2maybe_storage(int account_id); int inter_storage_parse_frommap(int fd); |