Design change for paginated text blobs
fix for !accounts; Warning: spammy, if there are many accounts! display loot comment in roll list
This commit is contained in:
+1
-1
@@ -42,7 +42,7 @@ class IgnCore:
|
|||||||
self.last_timer_event = 0
|
self.last_timer_event = 0
|
||||||
self.start_time = int(time.time())
|
self.start_time = int(time.time())
|
||||||
self.major_version = "IGNCore v2.6"
|
self.major_version = "IGNCore v2.6"
|
||||||
self.minor_version = "3"
|
self.minor_version = "4"
|
||||||
self.incoming_queue = FifoQueue()
|
self.incoming_queue = FifoQueue()
|
||||||
self.mass_message_queue = None
|
self.mass_message_queue = None
|
||||||
self.conns = DictObject()
|
self.conns = DictObject()
|
||||||
|
|||||||
+4
-2
@@ -203,11 +203,13 @@ class Text:
|
|||||||
|
|
||||||
def mapper(tup):
|
def mapper(tup):
|
||||||
page, index = tup
|
page, index = tup
|
||||||
|
suffix = ""
|
||||||
if num_pages == 1:
|
if num_pages == 1:
|
||||||
label2 = self.format_message(label)
|
label2 = self.format_message(label)
|
||||||
else:
|
else:
|
||||||
label2 = self.format_message(label) + " (Page " + str(index) + " / " + str(num_pages) + ")"
|
label2 = self.format_message(label)
|
||||||
return self.format_message(chatblob.page_prefix) + self.format_page(label2, page) + self.format_message(chatblob.page_postfix)
|
suffix = " (Page " + str(index) + " / " + str(num_pages) + ")"
|
||||||
|
return self.format_message(chatblob.page_prefix) + self.format_page(label2, page) + suffix + self.format_message(chatblob.page_postfix)
|
||||||
|
|
||||||
return list(map(mapper, zip(pages, range(1, num_pages + 1))))
|
return list(map(mapper, zip(pages, range(1, num_pages + 1))))
|
||||||
|
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ class AccountService:
|
|||||||
f"LEFT JOIN (SELECT * FROM online WHERE bot=?) o ON a.char_id=o.char_id "
|
f"LEFT JOIN (SELECT * FROM online WHERE bot=?) o ON a.char_id=o.char_id "
|
||||||
f"WHERE a.char_id NOT IN (SELECT char_id from org_bots) "
|
f"WHERE a.char_id NOT IN (SELECT char_id from org_bots) "
|
||||||
f"and a.disabled = 0 {'and o.char_id is not null' if online_only else ''} "
|
f"and a.disabled = 0 {'and o.char_id is not null' if online_only else ''} "
|
||||||
f"group by o.char_id order by a.main, a.main=a.char_id desc, p.level desc, p.ai_level desc",
|
f"group by a.char_id order by a.main, a.main=a.char_id desc, p.level desc, p.ai_level desc",
|
||||||
[self.bot.get_char_id()])
|
[self.bot.get_char_id()])
|
||||||
|
|
||||||
def get_by_group(self, group) -> List[DictObject]:
|
def get_by_group(self, group) -> List[DictObject]:
|
||||||
|
|||||||
@@ -353,22 +353,23 @@ class LootListsController:
|
|||||||
blob += "<header2>%s<end>\n" % category if category is not None else ""
|
blob += "<header2>%s<end>\n" % category if category is not None else ""
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
item.id = self.text.make_item(item.low_id, item.high_id, item.ql, item.name)
|
comment = f" ({item.comment})" if item.comment != "" else ""
|
||||||
if item.multiloot > 1:
|
item.id = self.text.make_item(item.low_id, item.high_id, item.ql, item.name + comment)
|
||||||
single_link = self.text.make_chatcmd("Add to loot", "/tell <myname> loot %s 1" % item.id)
|
|
||||||
single_link1 = self.text.make_chatcmd("Add to auction", "/tell <myname> auction prepare %s " % item.id)
|
|
||||||
multi_link = self.text.make_chatcmd(
|
|
||||||
"Add x%d to loot" % item.multiloot, "/tell <myname> loot %s %d" % (item.id, item.multiloot))
|
|
||||||
multi_link2 = self.text.make_chatcmd(
|
|
||||||
"Add x%d to auction" % item.multiloot, "/tell <myname> auction prepare %s (ALL)" % item.id)
|
|
||||||
add_links = "└ [%s] [%s]<br> └ [%s] [%s (ALL) - One Winner]" % (
|
|
||||||
single_link, multi_link, single_link1, multi_link2)
|
|
||||||
else:
|
|
||||||
add_links = "└ [%s]<br> └ [%s]" % (
|
|
||||||
self.text.make_chatcmd("Add to loot", "/tell <myname> loot %s 1" % item.id),
|
|
||||||
self.text.make_chatcmd("Add to auction", "/tell <myname> auction prepare %s" % item.id))
|
|
||||||
|
|
||||||
comment = " (%s)" % item.comment if item.comment != "" else ""
|
if item.multiloot > 1:
|
||||||
|
print(item)
|
||||||
|
single_link = self.text.make_chatcmd("Add to loot", f"/tell <myname> loot {item.id}")
|
||||||
|
single_link1 = self.text.make_chatcmd("Add to auction", f"/tell <myname> auction prepare {item.id} ")
|
||||||
|
multi_link = self.text.make_chatcmd(
|
||||||
|
f"Add x{item.multiloot:d} to loot", f"/tell <myname> loot {item.id} {item.multiloot}")
|
||||||
|
multi_link2 = self.text.make_chatcmd(
|
||||||
|
f"Add x{item.multiloot:d} to auction", f"/tell <myname> auction prepare {item.id} (ALL)")
|
||||||
|
add_links = f"└ [{single_link}] [{multi_link}]<br> └ [{single_link1}] [{multi_link2} (ALL) - One Winner]"
|
||||||
|
else:
|
||||||
|
add_links = f"└ [{self.text.make_chatcmd('Add to loot', f'/tell <myname> loot {item.id} {comment}')}]<br> " \
|
||||||
|
f"└ [{self.text.make_chatcmd('Add to auction', f'/tell <myname> auction prepare {item.id}')}]"
|
||||||
|
|
||||||
|
# comment = f" ({item.comment})" if item.comment != "" else ""
|
||||||
|
|
||||||
if self.setting_service.get("use_item_icons").get_value():
|
if self.setting_service.get("use_item_icons").get_value():
|
||||||
item_link = self.text.make_item(item.low_id, item.high_id, item.ql, "<img src=rdb://%s>" % item.icon)
|
item_link = self.text.make_item(item.low_id, item.high_id, item.ql, "<img src=rdb://%s>" % item.icon)
|
||||||
|
|||||||
Reference in New Issue
Block a user