diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ast/item.cpp | 1 | ||||
-rw-r--r-- | src/ast/item.hpp | 1 | ||||
-rw-r--r-- | src/ast/item_test.cpp | 8 | ||||
-rw-r--r-- | src/map/atcommand.cpp | 22 | ||||
-rw-r--r-- | src/map/chrif.cpp | 2 | ||||
-rw-r--r-- | src/map/clif.cpp | 12 | ||||
-rw-r--r-- | src/map/intif.cpp | 2 | ||||
-rw-r--r-- | src/map/itemdb.cpp | 1 | ||||
-rw-r--r-- | src/map/itemdb.hpp | 2 | ||||
-rw-r--r-- | src/map/map.cpp | 2 | ||||
-rw-r--r-- | src/map/pc.cpp | 16 | ||||
-rw-r--r-- | src/map/script-fun.cpp | 69 |
12 files changed, 27 insertions, 111 deletions
diff --git a/src/ast/item.cpp b/src/ast/item.cpp index bd4f295..d27e231 100644 --- a/src/ast/item.cpp +++ b/src/ast/item.cpp @@ -128,7 +128,6 @@ namespace item Item item; SPAN_EXTRACT(first, item.id); SPAN_EXTRACT(TRY_UNWRAP(lex_nonscript(lr, false), return EOL_ERROR(lr)), item.name); - SPAN_EXTRACT(TRY_UNWRAP(lex_nonscript(lr, false), return EOL_ERROR(lr)), item.jname); SPAN_EXTRACT(TRY_UNWRAP(lex_nonscript(lr, false), return EOL_ERROR(lr)), item.type); SPAN_EXTRACT(TRY_UNWRAP(lex_nonscript(lr, false), return EOL_ERROR(lr)), item.buy_price); SPAN_EXTRACT(TRY_UNWRAP(lex_nonscript(lr, false), return EOL_ERROR(lr)), item.sell_price); diff --git a/src/ast/item.hpp b/src/ast/item.hpp index a8fe908..c772655 100644 --- a/src/ast/item.hpp +++ b/src/ast/item.hpp @@ -49,7 +49,6 @@ namespace item { Spanned<ItemNameId> id; Spanned<ItemName> name; - Spanned<ItemName> jname; Spanned<ItemType> type; Spanned<int> buy_price; Spanned<int> sell_price; diff --git a/src/ast/item_test.cpp b/src/ast/item_test.cpp index a77662e..6e2cee7 100644 --- a/src/ast/item_test.cpp +++ b/src/ast/item_test.cpp @@ -89,9 +89,9 @@ namespace item { // 1 2 3 4 5 //2345678901234567890123456789012345678901234567890123456789 - "1,abc , def,3,4,5,6,7,8,9,10,xx,2,16,12,13,11, {end;}, {}"_s, - "1,abc , def,3,4,5,6,7,8,9,10,xx,2,16,12,13,11, {end;}, {}\n"_s, - "1,abc , def,3,4,5,6,7,8,9,10,xx,2,16,12,13,11, {end;}, {}\nabc"_s, + "1,abc , 3,4,5,6,7,8,9,10,xx,2,16,12,13,11, {end;}, {}"_s, + "1,abc , 3,4,5,6,7,8,9,10,xx,2,16,12,13,11, {end;}, {}\n"_s, + "1,abc , 3,4,5,6,7,8,9,10,xx,2,16,12,13,11, {end;}, {}\nabc"_s, }; for (auto input : inputs) { @@ -108,8 +108,6 @@ namespace item EXPECT_EQ(p->id.data, wrap<ItemNameId>(1)); EXPECT_SPAN(p->name.span, 1,3, 1,6); EXPECT_EQ(p->name.data, stringish<ItemName>("abc "_s)); - EXPECT_SPAN(p->jname.span, 1,10, 1,12); - EXPECT_EQ(p->jname.data, stringish<ItemName>("def"_s)); EXPECT_SPAN(p->type.span, 1,14, 1,14); EXPECT_EQ(p->type.data, ItemType::JUNK); EXPECT_SPAN(p->buy_price.span, 1,16, 1,16); diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 7739966..63a1159 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -2498,7 +2498,7 @@ ATCE atcommand_doom(Session *s, dumb_ptr<map_session_data> sd, if (!s2) continue; dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); - if (pl_sd + if (pl_sd && !pl_sd->state.connect_new && pl_sd->state.auth && s2 != s && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -2522,7 +2522,7 @@ ATCE atcommand_doommap(Session *s, dumb_ptr<map_session_data> sd, if (!s2) continue; dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); - if (pl_sd + if (pl_sd && !pl_sd->state.connect_new && pl_sd->state.auth && s2 != s && sd->bl_m == pl_sd->bl_m && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -3037,10 +3037,10 @@ ATCE atcommand_idsearch(Session *s, dumb_ptr<map_session_data>, for (ItemNameId i = wrap<ItemNameId>(0); i < wrap<ItemNameId>(-1); i = next(i)) { P<struct item_data> item = TRY_UNWRAP(itemdb_exists(i), continue); - if (item->jname.contains_seq(item_name)) + if (item->name.contains_seq(item_name)) { match++; - output = STRPRINTF("%s: %d"_fmt, item->jname, item->nameid); + output = STRPRINTF("%s: %d"_fmt, item->name, item->nameid); clif_displaymessage(s, output); } } @@ -3474,7 +3474,7 @@ ATCE atcommand_partyrecall(Session *s, dumb_ptr<map_session_data> sd, if (!s2) continue; dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); - if (pl_sd && pl_sd->state.auth + if (pl_sd && pl_sd->state.auth && !pl_sd->state.connect_new && sd->status_key.account_id != pl_sd->status_key.account_id && pl_sd->status.party_id == p.party_id) { @@ -3889,7 +3889,7 @@ ATCE atcommand_effect(Session *s, dumb_ptr<map_session_data> sd, if (!s2) continue; dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); - if (pl_sd && pl_sd->state.auth) + if (pl_sd && pl_sd->state.auth && !pl_sd->state.connect_new) { clif_specialeffect(pl_sd, type, flag); clif_displaymessage(pl_sd->sess, "Your Effect Has Changed."_s); @@ -3975,9 +3975,9 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd, AString output; if (true) - output = STRPRINTF("%d %s (%s, id: %d) %s"_fmt, + output = STRPRINTF("%d %s (id: %d) %s"_fmt, pl_sd->status.inventory[i].amount, - item_data->name, item_data->jname, + item_data->name, pl_sd->status.inventory[i].nameid, AString(equipstr)); clif_displaymessage(s, output); @@ -4051,9 +4051,9 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd, } AString output; if (true) - output = STRPRINTF("%d %s (%s, id: %d)"_fmt, + output = STRPRINTF("%d %s (id: %d)"_fmt, stor->storage_[i].amount, - item_data->name, item_data->jname, + item_data->name, stor->storage_[i].nameid); clif_displaymessage(s, output); } @@ -4920,7 +4920,7 @@ ATCE atcommand_doomspot(Session *s, dumb_ptr<map_session_data> sd, if (!s2) continue; dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); - if (pl_sd + if (pl_sd && !pl_sd->state.connect_new && pl_sd->state.auth && s2 != s && sd->bl_m == pl_sd->bl_m && sd->bl_x == pl_sd->bl_x && sd->bl_y == pl_sd->bl_y && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index 2606911..8127f20 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -1037,7 +1037,7 @@ void send_users_tochar(TimerData *, tick_t) if (!s) continue; dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); - if (sd && sd->state.auth && + if (sd && sd->state.auth && !sd->state.connect_new && !((battle_config.hide_GM_session || sd->state.shroud_active || bool(sd->status.option & Opt0::HIDE)) && pc_isGM(sd))) diff --git a/src/map/clif.cpp b/src/map/clif.cpp index d327286..6074c43 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -165,7 +165,7 @@ int clif_countusers(void) if (!s) continue; dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); - if (sd && sd->state.auth && !(battle_config.hide_GM_session && pc_isGM(sd))) + if (sd && sd->state.auth && !sd->state.connect_new && !(battle_config.hide_GM_session && pc_isGM(sd))) users++; } return users; @@ -183,7 +183,7 @@ int clif_foreachclient(std::function<void (dumb_ptr<map_session_data>)> func) if (!s) continue; dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); - if (sd && sd->state.auth) + if (sd && sd->state.auth && !sd->state.connect_new) func(sd); } return 0; @@ -295,7 +295,7 @@ int clif_send(const Buffer& buf, dumb_ptr<block_list> bl, SendWho type) if (!s) continue; dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); - if (sd && sd->state.auth) + if (sd && sd->state.auth && !sd->state.connect_new) { { send_buffer(s, buf); @@ -310,7 +310,7 @@ int clif_send(const Buffer& buf, dumb_ptr<block_list> bl, SendWho type) if (!s) continue; dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); - if (sd && sd->state.auth && sd->bl_m == bl->bl_m) + if (sd && sd->state.auth && !sd->state.connect_new && sd->bl_m == bl->bl_m) { { send_buffer(s, buf); @@ -388,7 +388,7 @@ int clif_send(const Buffer& buf, dumb_ptr<block_list> bl, SendWho type) if (!s) continue; dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); - if (sd && sd->state.auth) + if (sd && sd->state.auth && !sd->state.connect_new) { if (sd->partyspy == p.party_id) { @@ -3221,7 +3221,7 @@ int clif_specialeffect(dumb_ptr<block_list> bl, int type, int flag) if (!s) continue; dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); - if (sd && sd->state.auth && sd->bl_m == bl->bl_m) + if (sd && sd->state.auth && !sd->state.connect_new && sd->bl_m == bl->bl_m) clif_specialeffect(sd, type, 1); } } diff --git a/src/map/intif.cpp b/src/map/intif.cpp index a5709ef..d08b94f 100644 --- a/src/map/intif.cpp +++ b/src/map/intif.cpp @@ -359,7 +359,7 @@ void mapif_parse_WisToGM(Session *, const Packet_Head<0x3803>& head, AString& me if (!s2) continue; dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); - if (pl_sd && pl_sd->state.auth) + if (pl_sd && pl_sd->state.auth && !pl_sd->state.connect_new) { if (pc_isGM(pl_sd).satisfies(min_gm_level)) clif_wis_message(s2, Wisp_name, message); diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp index 7dd725e..7b23503 100644 --- a/src/map/itemdb.cpp +++ b/src/map/itemdb.cpp @@ -188,7 +188,6 @@ bool itemdb_readdb(ZString filename) item_data idv {}; idv.nameid = item.id.data; idv.name = item.name.data; - idv.jname = item.jname.data; idv.type = item.type.data; idv.value_buy = item.buy_price.data ?: item.sell_price.data * 2; idv.value_sell = item.sell_price.data ?: item.buy_price.data / 2; diff --git a/src/map/itemdb.hpp b/src/map/itemdb.hpp index 5e19c0b..19f40a8 100644 --- a/src/map/itemdb.hpp +++ b/src/map/itemdb.hpp @@ -36,7 +36,7 @@ namespace map struct item_data { ItemNameId nameid; - ItemName name, jname; + ItemName name; int value_buy; int value_sell; ItemType type; diff --git a/src/map/map.cpp b/src/map/map.cpp index c1d760a..7d219a9 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -913,7 +913,7 @@ dumb_ptr<map_session_data> map_get_session(io::FD i) if (!s) return nullptr; map_session_data *d = static_cast<map_session_data *>(s->session_data.get()); - if (d && d->state.auth) + if (d && d->state.auth && !d->state.connect_new) return dumb_ptr<map_session_data>(d); } diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 6fa35b0..1179792 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -517,6 +517,7 @@ int pc_setnewpc(dumb_ptr<map_session_data> sd, AccountId account_id, CharId char (void)client_tick; sd->sex = sex; sd->state.auth = 0; + sd->state.connect_new = 0; sd->bl_type = BL::PC; sd->canact_tick = sd->canmove_tick = gettick(); sd->canlog_tick = gettick(); @@ -795,14 +796,11 @@ int pc_authok(AccountId id, int login_id2, pc_calcstatus(sd, 1); - npc_event_doall_l(stringish<ScriptLabel>("OnPCLoginEvent"_s), sd->bl_id, nullptr); // Init Quest Log clif_sendallquest(sd); return 0; } -// TODO fix this to cache and use inotify -// this is far from the only such thing, but most of the others are logs void pc_show_motd(dumb_ptr<map_session_data> sd) { // Attention all forks: DO NOT REMOVE THIS NOTICE. @@ -811,18 +809,10 @@ void pc_show_motd(dumb_ptr<map_session_data> sd) // If you remove the sending of this message, // the license does not permit you to publicly use this software. - clif_displaymessage(sd->sess, "This server is Free Software, for details type @source in chat or use the tmwa-source tool"_s); + clif_displaymessage(sd->sess, "##7Server : This server is Free Software, for details type @source in chat or use the tmwa-source tool"_s); + npc_event_doall_l(stringish<ScriptLabel>("OnPCLoginEvent"_s), sd->bl_id, nullptr); sd->state.seen_motd = true; - io::ReadFile in(map_conf.motd_txt); - if (in.is_open()) - { - AString buf; - while (in.getline(buf)) - { - clif_displaymessage(sd->sess, buf); - } - } } /*========================================== diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 4c20555..744f2c3 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -1124,45 +1124,6 @@ void builtin_freeloop(ScriptState *st) } /*========================================== - * 装備名文字列(精錬メニュー用) - *------------------------------------------ - */ -static -void builtin_getequipname(ScriptState *st) -{ - int num; - dumb_ptr<map_session_data> sd; - - AString buf; - - sd = script_rid2sd(st); - num = conv_num(st, &AARG(0)); - IOff0 i = pc_checkequip(sd, equip[num - 1]); - if (i.ok()) - { - Option<P<struct item_data>> item_ = sd->inventory_data[i]; - OMATCH_BEGIN (item_) - { - OMATCH_CASE_SOME (item) - { - buf = STRPRINTF("%s-[%s]"_fmt, pos_str[num - 1], item->jname); - } - OMATCH_CASE_NONE () - { - buf = STRPRINTF("%s-[%s]"_fmt, pos_str[num - 1], pos_str[10]); - } - } - OMATCH_END (); - } - else - { - buf = STRPRINTF("%s-[%s]"_fmt, pos_str[num - 1], pos_str[10]); - } - push_str<ScriptDataStr>(st->stack, buf); - -} - -/*========================================== * 装備品による能力値ボーナス *------------------------------------------ */ @@ -2258,34 +2219,6 @@ void builtin_divorce(ScriptState *st) push_int<ScriptDataInt>(st->stack, 1); } -/*========================================== - * IDからItem名 - *------------------------------------------ - */ -static -void builtin_getitemname(ScriptState *st) -{ - Option<P<struct item_data>> i_data = None; - struct script_data *data; - - data = &AARG(0); - get_val(st, data); - if (data->is<ScriptDataStr>()) - { - ZString name = ZString(conv_str(st, data)); - i_data = itemdb_searchname(name); - } - else - { - ItemNameId item_id = wrap<ItemNameId>(conv_num(st, data)); - i_data = Some(itemdb_search(item_id)); - } - - RString item_name = i_data.pmd_pget(&item_data::jname).copy_or(stringish<ItemName>("Unknown Item"_s)); - - push_str<ScriptDataStr>(st->stack, item_name); -} - static void builtin_getitemlink(ScriptState *st) { @@ -3097,7 +3030,6 @@ BuiltinFunction builtin_functions[] = BUILTIN(getcharid, "i?"_s, 'i'), BUILTIN(strcharinfo, "i"_s, 's'), BUILTIN(getequipid, "i"_s, 'i'), - BUILTIN(getequipname, "i"_s, 's'), BUILTIN(bonus, "ii"_s, '\0'), BUILTIN(bonus2, "iii"_s, '\0'), BUILTIN(skill, "ii?"_s, '\0'), @@ -3152,7 +3084,6 @@ BuiltinFunction builtin_functions[] = BUILTIN(mobcount, "ME"_s, 'i'), BUILTIN(marriage, "P"_s, 'i'), BUILTIN(divorce, ""_s, 'i'), - BUILTIN(getitemname, "I"_s, 's'), BUILTIN(getitemlink, "I"_s, 's'), BUILTIN(getspellinvocation, "s"_s, 's'), BUILTIN(getpartnerid2, ""_s, 'i'), |