Skip to content

Commit

Permalink
add close=1
Browse files Browse the repository at this point in the history
  • Loading branch information
etorth committed Jan 14, 2025
1 parent 9cc6269 commit 1112893
Show file tree
Hide file tree
Showing 40 changed files with 201 additions and 208 deletions.
9 changes: 1 addition & 8 deletions client/src/gui/npcchatboard/npcchatboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,7 @@ NPCChatBoard::NPCChatBoard(ProcessRun *proc, Widget *pwidget, bool autoDelete)
if(const auto id = LayoutBoard::findAttrValue(attrList, "id", nullptr)){
const auto autoClose = [id, closeAttr = LayoutBoard::findAttrValue(attrList, "close", nullptr)]() -> bool
{
if(closeAttr){
for(const auto trueStr: {"1", "TRUE" }){ if(str_toupper(closeAttr) == trueStr){ return true ; }}
for(const auto falseStr: {"0", "FALSE"}){ if(str_toupper(closeAttr) == falseStr){ return false; }}
throw fflerror("invalid close attribute: %s", to_cstr(closeAttr));
}
else{
return to_sv(id) == SYS_EXIT;
}
return closeAttr ? to_parsedbool(closeAttr) : false;
}();
onClickEvent(LayoutBoard::findAttrValue(attrList, "path", m_eventPath.c_str()), id, LayoutBoard::findAttrValue(attrList, "args", nullptr), autoClose);
}
Expand Down
6 changes: 3 additions & 3 deletions common/src/totype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ template<typename T> int to_boolint(T t)
inline bool to_parsedbool(const char *s)
{
if(!s){
throw std::runtime_error("to_bool: null string");
throw std::runtime_error("to_parsedbool: null string");
}

if(s[0] == '\0'){
throw std::runtime_error("to_bool: zero-length string");
throw std::runtime_error("to_parsedbool: zero-length string");
}

if(false
Expand All @@ -227,7 +227,7 @@ inline bool to_parsedbool(const char *s)
return false;
}

throw std::runtime_error(std::string("to_bool: invalid boolean string: ") + s);
throw std::runtime_error(std::string("to_parsedbool: invalid boolean string: ") + s);
}

inline bool to_parsedbool(const std::string &s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setEventHandler(
<layout>
<par>我不愿意和你这样丧尽天良的人进行交易。</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], SYS_EXIT)
else
Expand All @@ -19,7 +19,7 @@ setEventHandler(
<par></par>
<par><event id="npc_goto_buy" >购买</event>物品</par>
<par><event id="npc_goto_sell">出售</event>物品</par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], getSubukGuildName(), SYS_EXIT)
end
Expand All @@ -42,7 +42,7 @@ setEventHandler(
<layout>
<par>请把不用的东西卖给我,我给你个合理的价钱。</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ eventHandlerTable[SYS_ENTER] = function(uid, value)
<par></par>
<par align="justify">%s</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], uidQueryName(uid), getNPCName(), table.concat(monsterNameList), SYS_EXIT)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ setEventHandler(
<par>呵!今天好想喝酒啊!</par>
<par>可是你兜里空空的,怎么让你给我买酒呢?</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], SYS_EXIT)
else
Expand All @@ -19,7 +19,7 @@ setEventHandler(
<par>又想要给我点什么了吧!唔,那就给我买一瓶酒吧?!</par>
<par>不!尽管这样也要有卫士的尊严啊!</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], SYS_EXIT)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setEventHandler(
<par>我是这比奇省里资历最深的卫士。</par>
<par>嗯...虽说什么,那也不是特别的...</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setEventHandler(
<par>我现在不再制作药了,制作要的话去找隔壁的老黄吧。</par>
<par>你找我有什么事情吗?</par>
<par></par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setEventHandler(
<par>你是来卖肉的?</par>
<par></par>
<par><event id="npc_goto_sell">卖</event>肉</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -20,7 +20,7 @@ setEventHandler(
<par>沾上土的或被火烧过的肉廉价收购。</par>
<par></par>
<par><event id="%s">前一步</event></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], SYS_ENTER, SYS_EXIT)
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ setEventHandler(
<par>客官%s你好我是%s,%s<emoji id="0"/></par>
<par></par>
<par><event id="event_post_sell">购买武器</event></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], uidQueryName(uid), getNPCName(), randomHeadString(), SYS_EXIT))
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ setEventHandler(
<par>我不想和你这种坏人做生意。</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], SYS_EXIT)

Expand All @@ -20,7 +20,7 @@ setEventHandler(
<par></par>
<par><event id="npc_goto_special_repair">特殊修理</event>武器</par>
<par><event id="npc_goto_unequip_weapon">请求把剑从手分离开</event></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], SYS_EXIT)
end
Expand Down Expand Up @@ -57,7 +57,7 @@ setEventHandler(
<par>今天没事情可拜托你了。</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ eventHandlerTable[SYS_ENTER] = function(uid, value)
<par></par>
<par align="justify">%s</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], uidQueryName(uid), getNPCName(), table.concat(monsterNameList), SYS_EXIT)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ eventHandlerTable[SYS_ENTER] = function(uid, value)
<par></par>
<par align="justify">%s</par>
<par></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]], uidQueryName(uid), getNPCName(), table.concat(monsterNameList), SYS_EXIT)
end
Expand Down
44 changes: 22 additions & 22 deletions server/script/npc/道馆_1.万事通_1.GLOC_398_127_0.LOOK_2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ local quest_config = {
<layout>
<par>你还没有开始完成乞丐任务呢!</par>
<par>在比奇省东海客栈工作的客栈店员最近好像有点棘手的事情,去看看吧!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -50,7 +50,7 @@ local quest_config = {
<par>你辛苦了。</par>
<par>像你这样热心帮助别人的好心人,一定有好报的...</par>
<par></par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -76,7 +76,7 @@ local quest_config = {
<layout>
<par>你还没有开始苍蝇拍任务呢!</par>
<par>比奇省经营肉铺店的金氏正在因为没有苍蝇拍的事儿而苦恼呢!去看看怎么回事吧!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -86,7 +86,7 @@ local quest_config = {
[[
<layout>
<par>金氏拿到苍蝇拍以后,对你非常感激。</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -111,7 +111,7 @@ local quest_config = {
<layout>
<par>你还没有开始石母任务呢!</par>
<par>最近,在比奇省东边的公园常传出隐约的抽泣声。前去调查一番吧!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -121,7 +121,7 @@ local quest_config = {
[[
<layout>
<par>哦?原来石母就是那童子像的母亲石啊!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down Expand Up @@ -162,7 +162,7 @@ local quest_config = {
<par>王大人任务是去帮助王大人将比奇省商界掌握在比奇商会手中。</par>
<par>完成任务后,凭借你与王大人的交情将会对完成以后的任务有很大帮助!</par>
<par>那么,先去王大人那儿走走吧。</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -173,7 +173,7 @@ local quest_config = {
<layout>
<par>很好,现在比奇省商界的势力就要改朝换代了!</par>
<par>从王大人的话中得知好像也要得到比奇城城主的信任才行!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down Expand Up @@ -214,7 +214,7 @@ local quest_config = {
<par>你还没有开始轻型盔甲任务呢!</par>
<par>去找一找在比奇省经营布店的怡美,她会向你提出一个请求。</par>
<par>如果完成了她拜托你办的事情的话,你会得到她送给你的礼物哦。</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -225,7 +225,7 @@ local quest_config = {
<layout>
<par>你辛苦了!</par>
<par>得到特制的轻型盔甲,辛苦总算没有白费啊!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down Expand Up @@ -265,7 +265,7 @@ local quest_config = {
<par>你还没有开始半兽任务呢!</par>
<par>半兽任务是制止以半兽勇士为中心集结起来的半兽人纠合势力使用古代魔法的阴谋。</par>
<par>前往比奇省内城找比奇城城主看看,他好像要拜托你帮助他阻止半兽人的阴谋。</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -276,7 +276,7 @@ local quest_config = {
<layout>
<par>太辛苦你了!</par>
<par>托你的福,来自半兽人的威胁已经大大减轻了。</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down Expand Up @@ -316,7 +316,7 @@ local quest_config = {
<par>你还没有开始被盗灵魂任务呢!</par>
<par>最近比奇省的贩牛商王小二的独生女王丽灵突然被发现一夕之间变成了白痴。好像是最近盗取百姓灵魂的妖怪干的好事!灵魂任务就是揭开这个妖怪的真面目。</par>
<par>先去王小二的亲戚王大人家了解一些情况吧。</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -327,7 +327,7 @@ local quest_config = {
<layout>
<par>再晚到一步,就让邪恶的道士偷到不死牌了!</par>
<par>你救出了王丽灵小姐,并揭开妖怪的真面目,真的很不错啊!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down Expand Up @@ -367,7 +367,7 @@ local quest_config = {
<par>你还没有开始千年毒蛇任务呢!</par>
<par>毒蛇山谷中出现了传说中的蛇,叫做珍珍的小孩好像已经中毒了!当务之急就是找那条传说中的蛇取得解毒剂。</par>
<par>先去毒蛇山谷去见珍珍的毒蛇山谷老太吧!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -378,7 +378,7 @@ local quest_config = {
<layout>
<par>幸亏你及时找到药,毒蛇山谷的珍珍现在已经平安无恙了!</par>
<par>辛苦你了!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down Expand Up @@ -416,7 +416,7 @@ local quest_config = {
<par>你还没有开始堕落道士任务呢!</par>
<par>经过浴血奋战从半兽人手中拿到的不死牌,却被某个道士给偷走了。 因此必须粉碎这个堕落道士计划利用不死牌进行的邪恶阴谋!</par>
<par>去向曾经保管不死牌的比奇城城主打听具体的情况吧!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -426,7 +426,7 @@ local quest_config = {
[[
<layout>
<par>你做得很棒!由于你的努力堕落道士引发的灾难终于到此结束了!</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -452,7 +452,7 @@ local quest_config = {
<layout>
<par>抱歉,对于这个任务我几乎一无所知。</par>
<par>我只是听说过去曾经追随沃玛教主的沃玛教最后幸存者为了弥补过去的罪过而与邪恶势力在孤军奋战。去帮助他破坏沃玛教主在地上发挥力量的根源---灵魂明珠,并处决沃玛教主好让那些惨死的冤魂们升天。</par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand All @@ -469,7 +469,7 @@ setEventHandler(
<par></par>
<par><event id="npc_show_quest_list">询问一般的任务</event></par>
<par><event id="npc_daily_quest">对今日的任务进行了解</event></par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
end,
Expand Down Expand Up @@ -503,7 +503,7 @@ setEventHandler(
<par></par>
<par><event id="%s">前一步</event></par>
<par><event id="%s">关闭</event></par>
<par><event id="%s" close="1">关闭</event></par>
</layout>
]],

Expand Down Expand Up @@ -534,7 +534,7 @@ setEventHandler(
<layout>
<par>你还没有足够能力执行此任务,修炼到7级后,再来找我吧。</par>
<par></par>
<par><event id="%s">结束</event></par>
<par><event id="%s" close="1">结束</event></par>
</layout>
]], SYS_EXIT)
else
Expand Down
Loading

0 comments on commit 1112893

Please sign in to comment.