diff --git a/resources/image/shop_icon/mysterious_potion.png b/resources/image/shop_icon/mysterious_potion.png
deleted file mode 100644
index 6393be13..00000000
Binary files a/resources/image/shop_icon/mysterious_potion.png and /dev/null differ
diff --git a/resources/template/shop/main.css b/resources/template/shop/main.css
deleted file mode 100644
index c8ac81e6..00000000
--- a/resources/template/shop/main.css
+++ /dev/null
@@ -1,321 +0,0 @@
-@font-face {
- font-family: fzrzFont;
- /* 导入的字体文件 */
- src: url("../../font/fzrzExtraBold.ttf");
-}
-
-@font-face {
- font-family: msyhFont;
- /* 导入的字体文件 */
- src: url("../../font/msyh.ttf");
-}
-@font-face {
- font-family: hywhFont;
- /* 导入的字体文件 */
- src: url("../../font/HYWenHei-85W.ttf");
-}
-@font-face {
- font-family: syhtFont;
- /* 导入的字体文件 */
- src: url("../../font/syht.otf");
-}
-
-body {
- position: absolute;
- left: -8px;
- top: -8px;
-}
-
-.wrapper {
- width: 850px;
- font-family: "hywhFont";
- padding: 10px 0;
- background-color: #fbe4e4;
- box-sizing: border-box;
-}
-
-.top-title {
- color: #e87692;
- font-size: 85px;
- text-align: center;
- font-family: "fzrzFont";
- margin-bottom: -30px;
-}
-
-.split {
- background-image: url("./res/img/split.png");
- background-repeat: no-repeat;
- background-position: center;
- height: 15px;
- margin-top: 70px;
- margin-bottom: 30px;
-}
-
-.top-head {
- background-image: url("./res/img/head.png");
- background-size: contain;
- background-repeat: no-repeat;
- background-position: center;
- height: 586px;
-}
-
-.top-aaaa {
- font-family: 'syhtFont';
- font-size: 34px;
- text-align: center;
- color: #E87692;
- height: 50px;
-}
-
-.shop-border {
- margin-bottom: 50px;
-}
-
-.shop-item {
- padding-top: 100px;
- box-sizing: border-box;
-}
-
-.shop-item-border {
- display: flex;
- position: relative;
-}
-
-.shop-item-title {
- background-image: url("./res/img/title-bk.png");
- background-size: contain;
- background-repeat: no-repeat;
- background-position: center;
- height: 100px;
- margin-bottom: 20px;
- display: flex;
- justify-content: center;
-}
-
-.shop-item-title-text {
- color: white;
- font-size: 30px;
- margin-top: 13px;
-}
-
-.shop-item-left {
- min-height: 460px;
- position: relative;
- width: 158px;
-}
-
-.shop-item-left-qq {
- position: absolute;
- height: 100px;
-}
-
-.left-img {
- position: absolute;
- left: 5px;
- z-index: 10;
-}
-
-.shop-item-right {
- width: 210px;
- position: relative;
-}
-
-.shop-item-right-zx {
- height: 460px;
- position: absolute;
- z-index: 3;
- top: 10px;
-}
-
-.right-img {
- position: absolute;
- right: -2px;
- z-index: 10;
-}
-
-.shop-item-mid {
- width: 480px;
- box-sizing: border-box;
- padding-top: 20px;
- position: relative;
-}
-
-.shop-item-mid-bk-inner {
- width: 520px;
- box-sizing: border-box;
- padding-top: 30px;
- background-color: #be5972;
- border: 1px solid #b14b5f;
- border-radius: 10px;
- position: absolute;
- right: -50px;
- top: 10px;
- z-index: 1;
- height: calc(100% - 20px);
-}
-
-.shop-item-mid-bk-out {
- width: 520px;
- box-sizing: border-box;
- background-color: #f096a8;
- border: 1px solid #812528;
- border-radius: 10px;
- height: 100%;
- z-index: 2;
- position: relative;
- padding: 30px;
-}
-
-.goods-item {
- background-color: #f8cfd8;
- width: 100%;
- min-height: 130px;
- border-radius: 10px;
- padding: 10px;
- display: flex;
- position: relative;
- border: 1px solid #994446;
- margin-bottom: 10px;
-}
-
-.goods-id {
- position: absolute;
- color: white;
- font-size: 15px;
- border-top-left-radius: 10px;
- top: 0;
- left: 0;
- border-right: 60px solid transparent;
- border-bottom: 60px solid transparent;
- border-top: 60px solid #ea7492;
-}
-
-.goods-id-text {
- position: absolute;
- top: -54px;
- left: 9px;
- color: white;
- font-size: 16px;
- font-family: "fzrzFont";
- transform: rotate(-45deg);
-}
-
-.goods-item-left {
- height: 100%;
- min-height: 130px;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- padding-top: 30px;
- box-sizing: border-box;
-}
-
-.goods-item-left-o {
- height: 24px;
- width: 20px;
- background-color: #e99eab;
- border-radius: 40%;
- border: 1px solid #994446;
-}
-
-.goods-item-icon {
- background-color: #fefefe;
- border: 1px solid #994446;
- margin-left: 20px;
- width: 120px;
- border-radius: 10px;
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-.goods-item-icon-img {
- height: 104px;
- width: 104px;
-}
-
-.goods-item-right-des {
- width: 272px;
- min-height: 80px;
- background-color: #fefefe;
- border: 1px solid #994446;
- margin-left: 10px;
- border-radius: 10px;
- padding: 5px;
- font-family: "msyhFont";
-}
-
-.goods-item-right-price {
- min-height: 30px;
- background-color: #fefefe;
- border-radius: 30px;
- border: 1px solid #994446;
- height: 20px;
- margin-left: 10px;
- margin-top: 5px;
- font-size: 15px;
- font-family: "msyhFont";
- display: flex;
- align-items: center;
- padding-left: 10px;
- position: relative;
-}
-
-.goods-item-right-btn {
- min-height: 30px;
- background-color: #bf9ac6;
- color: white;
- border-radius: 30px;
- position: absolute;
- right: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 0 10px;
-}
-
-.goods-item-right-btn-line {
- width: 1px;
- height: 20px;
- background-color: #994446;
- margin: 0 10px;
-}
-
-.shop-item-mid-bag1 {
- position: absolute;
- width: 70px;
- height: 78px;
- bottom: -35px;
- left: -35px;
- z-index: 4;
-}
-
-.shop-item-mid-bag2 {
- position: absolute;
- width: 121px;
- height: 89px;
- right: -35px;
- bottom: -35px;
- z-index: 4;
-}
-
-.goods-item-name {
- font-size: 18px;
- font-family: "syhtFont";
-}
-
-.goods-item-name-line {
- height: 2px;
- width: 100%;
- margin: 3px 0;
- background-color: #731c1c;
- border-radius: 10px;
-}
-
-.create-text {
- position: absolute;
- bottom: 1px;
- right: 10px;
- color: #97979c;
- font-size: 15px;
-}
\ No newline at end of file
diff --git a/resources/template/shop/main.html b/resources/template/shop/main.html
deleted file mode 100644
index 6534234c..00000000
--- a/resources/template/shop/main.html
+++ /dev/null
@@ -1,128 +0,0 @@
-
-
-
-
-
-
-
- test
-
-
-
-
-
-
-
- {{name}}的神秘商店
-
-
“使用 '购买道具 [道具ID/道具名称]' 购买道具”
-
-
-
- {% for data in data_list %}
-
-
- {{data.partition}}
-
-
-
-
-
-
-
- {% for goods in data['goods_list'] %}
-
-
-
-
-

-
-
-
-
- {{goods.name}}
-
-
- {{goods.description}}
-
-
- {{goods.price}}金币
-
- 立即购买
-
- 限购: {{goods.daily_limit}}
-
-
-
-
- {% endfor %}
-
-

-

-
-
-
-
-
-
-
- {% endfor %}
-
-
-
Create By ZhenXun
-
-
-
-
-
\ No newline at end of file
diff --git a/resources/template/shop/main.js b/resources/template/shop/main.js
deleted file mode 100644
index 10bae963..00000000
--- a/resources/template/shop/main.js
+++ /dev/null
@@ -1,183 +0,0 @@
-const leftElements = document.getElementsByClassName("shop-item-left")
-const rightElements = document.getElementsByClassName("shop-item-right")
-
-const defaultList = [
- "1.png",
- "2.png",
- "3.png",
- "4.png",
- "5.png",
- "qq.png",
- "xx1.png",
- "xx2.png",
-]
-
-const leftRightImgList = ["1.png", "2.png", "3.png", "4.png", "5.png"]
-
-const leftRightImgList2 = ["qq.png", "xx1.png", "xx2.png"]
-
-var leftRightImg = null
-var leftRightImg2 = null
-
-function randomImg() {
- const randomIndex = Math.floor(Math.random() * leftRightImgList.length)
- const randImg = leftRightImgList[randomIndex]
- if (leftRightImg == randImg) {
- return randomImg()
- }
- leftRightImg = randImg
- return randImg
-}
-
-function randomImg2() {
- const randomIndex = Math.floor(Math.random() * leftRightImgList2.length)
- const randImg = leftRightImgList2[randomIndex]
- if (leftRightImg == randImg) {
- return randomImg2()
- }
- leftRightImg2 = randImg
- return randImg
-}
-
-function getRandomInt(min, max) {
- const mathMin = Math.ceil(min)
- const mathMax = Math.floor(max)
- return Math.floor(Math.random() * (mathMax - mathMin + 1)) + mathMin
-}
-
-function createImgElement(is_qq, is_left, start_height, height) {
- const imgElement = document.createElement("img")
- const className = is_left ? "left-img" : "right-img"
- if (is_qq) {
- imgElement.className = "shop-item-left-qq " + className
- imgElement.src = "./res/img/left_right/" + randomImg2()
- imgElement.style.top = getRandomInt(start_height, height - 20) + "px"
- if (is_left) {
- imgElement.style.left = getRandomInt(10, 40) + "px"
- } else {
- imgElement.style.right = getRandomInt(10, 40) + "px"
- }
- imgElement.style.height = getRandomInt(80, 120) + "px"
- imgElement.style.transform = "rotate(" + getRandomInt(0, 45) + "deg)"
- } else {
- imgElement.className = "shop-item-right-zx " + className
- imgElement.src = "./res/img/left_right/" + randomImg()
- imgElement.style.top = getRandomInt(start_height, height - 20) + "px"
- }
-
- return imgElement
-}
-
-function getTop(dom) {
- return parseInt(dom.style.top.slice(0, -2))
-}
-
-const randomIndex = Math.floor(Math.random() * defaultList.length)
-const leftImg = defaultList[randomIndex]
-
-var start = true
-
-if (["qq.png", "xx1.png", "xx2.png"].includes(leftImg)) {
- start = true
-} else {
- start = false
-}
-
-for (let i = 0; i < leftElements.length; i++) {
- leftHeight = leftElements[i].offsetHeight
-
- if (leftHeight <= 1000) {
- // 长度不够,只增加一个
- if (start) {
- leftElements[i].appendChild(
- createImgElement(true, true, 20, leftHeight - 50)
- )
- rightElements[i].appendChild(createImgElement(false, false, 10, 60))
- } else {
- leftElements[i].appendChild(createImgElement(false, true, 10, 60))
- rightElements[i].appendChild(
- createImgElement(true, false, 20, leftHeight - 50)
- )
- }
- } else {
- // 先添加一个气球
- const firstDom = createImgElement(true, true, 20, 200)
- leftElements[i].appendChild(firstDom)
- let startHeight = 100 + getTop(firstDom)
- let endHeight = 300 + getTop(firstDom)
- let firstIsQq = false
- let inx = 0
- while (leftHeight - endHeight >= 200) {
- // 避免过多重复
- rand = Math.random()
- if (inx >= 2) {
- rand = 0.4
- inx = 0
- }
- if (inx <= -1) {
- rand = 0.6
- inx = 0
- }
- // 真寻和气球随机加
- if (rand > 0.5) {
- firstIsQq = true
- inx += 1
- const imgDom = createImgElement(true, true, startHeight, endHeight)
- leftElements[i].appendChild(imgDom)
- startHeight = getRandomInt(250, 350) + getTop(imgDom)
- endHeight = getRandomInt(450, 500) + getTop(imgDom)
- } else {
- if (leftHeight - startHeight < 700) {
- continue
- }
- inx -= 1
- const imgDom = createImgElement(false, true, startHeight, endHeight)
- leftElements[i].appendChild(imgDom)
- startHeight = getRandomInt(400, 700) + getTop(imgDom)
- endHeight = getRandomInt(600, 900) + getTop(imgDom)
- if (leftHeight - startHeight < 900) {
- break
- }
- }
- }
- startHeight = 10
- endHeight = 200
- inx = 0
- while (leftHeight - endHeight >= 200) {
- // 真寻和气球随机加
- rand = Math.random()
- if (rand > 0.5 && firstIsQq) {
- firstIsQq = false
- rand = 0.4
- }
- // 避免过多重复
- if (inx >= 2) {
- rand = 0.4
- inx = 0
- }
- if (inx <= -1) {
- rand = 0.6
- inx = 0
- }
-
- if (rand > 0.5) {
- inx += 1
- const imgDom = createImgElement(true, false, startHeight, endHeight)
- rightElements[i].appendChild(imgDom)
- startHeight = getRandomInt(250, 350) + getTop(imgDom)
- endHeight = getRandomInt(450, 500) + getTop(imgDom)
- } else {
- if (leftHeight - startHeight < 700) {
- continue
- }
- inx -= 1
- const imgDom = createImgElement(false, false, startHeight, endHeight)
- rightElements[i].appendChild(imgDom)
- startHeight = getRandomInt(400, 700) + getTop(imgDom)
- endHeight = getRandomInt(600, 900) + getTop(imgDom)
- }
- }
- }
-
- start = !start
-}
diff --git a/resources/template/shop/res/img/bag1.png b/resources/template/shop/res/img/bag1.png
deleted file mode 100644
index 806b3316..00000000
Binary files a/resources/template/shop/res/img/bag1.png and /dev/null differ
diff --git a/resources/template/shop/res/img/bag2.png b/resources/template/shop/res/img/bag2.png
deleted file mode 100644
index d02d1b20..00000000
Binary files a/resources/template/shop/res/img/bag2.png and /dev/null differ
diff --git a/resources/template/shop/res/img/bag3.png b/resources/template/shop/res/img/bag3.png
deleted file mode 100644
index e8cff836..00000000
Binary files a/resources/template/shop/res/img/bag3.png and /dev/null differ
diff --git a/resources/template/shop/res/img/head.png b/resources/template/shop/res/img/head.png
deleted file mode 100644
index e240972c..00000000
Binary files a/resources/template/shop/res/img/head.png and /dev/null differ
diff --git a/resources/template/shop/res/img/item-bk1.png b/resources/template/shop/res/img/item-bk1.png
deleted file mode 100644
index 2a72b00a..00000000
Binary files a/resources/template/shop/res/img/item-bk1.png and /dev/null differ
diff --git a/resources/template/shop/res/img/item-bk2.png b/resources/template/shop/res/img/item-bk2.png
deleted file mode 100644
index c6480ce2..00000000
Binary files a/resources/template/shop/res/img/item-bk2.png and /dev/null differ
diff --git a/resources/template/shop/res/img/item-bk3.png b/resources/template/shop/res/img/item-bk3.png
deleted file mode 100644
index 29543cb1..00000000
Binary files a/resources/template/shop/res/img/item-bk3.png and /dev/null differ
diff --git a/resources/template/shop/res/img/left_right/1.png b/resources/template/shop/res/img/left_right/1.png
deleted file mode 100644
index 331ee5ea..00000000
Binary files a/resources/template/shop/res/img/left_right/1.png and /dev/null differ
diff --git a/resources/template/shop/res/img/left_right/2.png b/resources/template/shop/res/img/left_right/2.png
deleted file mode 100644
index f8c22f5e..00000000
Binary files a/resources/template/shop/res/img/left_right/2.png and /dev/null differ
diff --git a/resources/template/shop/res/img/left_right/3.png b/resources/template/shop/res/img/left_right/3.png
deleted file mode 100644
index 5490b4dc..00000000
Binary files a/resources/template/shop/res/img/left_right/3.png and /dev/null differ
diff --git a/resources/template/shop/res/img/left_right/4.png b/resources/template/shop/res/img/left_right/4.png
deleted file mode 100644
index f617d3b2..00000000
Binary files a/resources/template/shop/res/img/left_right/4.png and /dev/null differ
diff --git a/resources/template/shop/res/img/left_right/5.png b/resources/template/shop/res/img/left_right/5.png
deleted file mode 100644
index 8a012d9d..00000000
Binary files a/resources/template/shop/res/img/left_right/5.png and /dev/null differ
diff --git a/resources/template/shop/res/img/left_right/qq.png b/resources/template/shop/res/img/left_right/qq.png
deleted file mode 100644
index 2faf9e7c..00000000
Binary files a/resources/template/shop/res/img/left_right/qq.png and /dev/null differ
diff --git a/resources/template/shop/res/img/left_right/xx1.png b/resources/template/shop/res/img/left_right/xx1.png
deleted file mode 100644
index 859a6738..00000000
Binary files a/resources/template/shop/res/img/left_right/xx1.png and /dev/null differ
diff --git a/resources/template/shop/res/img/left_right/xx2.png b/resources/template/shop/res/img/left_right/xx2.png
deleted file mode 100644
index c2c279e7..00000000
Binary files a/resources/template/shop/res/img/left_right/xx2.png and /dev/null differ
diff --git a/resources/template/shop/res/img/split.png b/resources/template/shop/res/img/split.png
deleted file mode 100644
index 129e05d9..00000000
Binary files a/resources/template/shop/res/img/split.png and /dev/null differ
diff --git a/resources/template/shop/res/img/title-bk.png b/resources/template/shop/res/img/title-bk.png
deleted file mode 100644
index 6c49f190..00000000
Binary files a/resources/template/shop/res/img/title-bk.png and /dev/null differ
diff --git a/zhenxun/builtin_plugins/shop/html_image.py b/zhenxun/builtin_plugins/shop/html_image.py
index 8042c6c3..7651608e 100644
--- a/zhenxun/builtin_plugins/shop/html_image.py
+++ b/zhenxun/builtin_plugins/shop/html_image.py
@@ -33,10 +33,10 @@ async def html_image() -> bytes:
partition_dict[goods[1].partition] = []
icon = None
if goods[1].icon:
- icon = (
- "data:image/png;base64,"
- + BuildImage.open(ICON_PATH / goods[1].icon).pic2bs4()[9:]
- )
+ path = ICON_PATH / goods[1].icon
+ if path.exists():
+ icon = "data:image/png;base64,"
+ f"{BuildImage.open(ICON_PATH / goods[1].icon).pic2bs4()[9:]}"
partition_dict[goods[1].partition].append(
{
"id": goods[0],
@@ -47,15 +47,10 @@ async def html_image() -> bytes:
"description": goods[1].goods_description,
}
)
- data_list = []
- for partition in partition_dict:
- data_list.append(
- GoodsItem(
- goods_list=partition_dict[partition],
- partition=partition,
- )
- )
-
+ data_list = [
+ GoodsItem(goods_list=value, partition=partition)
+ for partition, value in partition_dict.items()
+ ]
return await template_to_pic(
template_path=str((TEMPLATE_PATH / "shop").absolute()),
template_name="main.html",