summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2009-05-25 22:40:30 +0000
committerFate <fate-tmw@googlemail.com>2009-05-25 22:40:30 +0000
commitabb1b2ad079878b0750054982c95193200dd7bd5 (patch)
tree70ed99df5a07b0d478e5a0a038918371064a2a41 /src/char/char.c
parent208f15dd1bf61cb96df4e85b87e3d60eea55388e (diff)
downloadtmwa-abb1b2ad079878b0750054982c95193200dd7bd5.tar.gz
tmwa-abb1b2ad079878b0750054982c95193200dd7bd5.tar.bz2
tmwa-abb1b2ad079878b0750054982c95193200dd7bd5.tar.xz
tmwa-abb1b2ad079878b0750054982c95193200dd7bd5.zip
Made itemfrob an ladmin command that can be used while running the server
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c46
1 files changed, 45 insertions, 1 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, français, deutsch, español
+// on/off, english, français, 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)