Add: Buy time-limited furniture in dorm.

This commit is contained in:
weeswelai 2023-12-18 10:37:46 +08:00 committed by LmeSzinc
parent 1c9d4efee6
commit 56fe530310
60 changed files with 368 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -1256,6 +1256,11 @@
"Feed": true,
"FeedFilter": "20000 > 10000 > 5000 > 3000 > 2000 > 1000"
},
"BuyFurniture": {
"Enable": false,
"BuyOption": "all",
"LastRun": "2020-01-01 00:00:00"
},
"Storage": {
"Storage": {}
}

View File

@ -6818,6 +6818,25 @@
"value": "20000 > 10000 > 5000 > 3000 > 2000 > 1000"
}
},
"BuyFurniture": {
"Enable": {
"type": "checkbox",
"value": false
},
"BuyOption": {
"type": "select",
"value": "all",
"option": [
"set",
"all"
]
},
"LastRun": {
"type": "datetime",
"value": "2020-01-01 00:00:00",
"validate": "datetime"
}
},
"Storage": {
"Storage": {
"type": "storage",

View File

@ -367,6 +367,13 @@ Dorm:
Collect: true
Feed: true
FeedFilter: 20000 > 10000 > 5000 > 3000 > 2000 > 1000
BuyFurniture:
Enable: false
BuyOption:
type: select
value: all
option: [ set, all ]
LastRun: 2020-01-01 00:00:00
Meowfficer:
BuyAmount: 1
FortChoreMeowfficer: true

View File

@ -203,6 +203,7 @@ Reward:
Dorm:
- Scheduler
- Dorm
- BuyFurniture
Meowfficer:
- Scheduler
- Meowfficer

View File

@ -213,6 +213,11 @@ class GeneratedConfig:
Dorm_Feed = True
Dorm_FeedFilter = '20000 > 10000 > 5000 > 3000 > 2000 > 1000'
# Group `BuyFurniture`
BuyFurniture_Enable = False
BuyFurniture_BuyOption = 'all' # set, all
BuyFurniture_LastRun = datetime.datetime(2020, 1, 1, 0, 0)
# Group `Meowfficer`
Meowfficer_BuyAmount = 1
Meowfficer_FortChoreMeowfficer = True

View File

@ -1392,6 +1392,26 @@
"help": "Generally does not need to be modified or re-arranged but can do so if desired"
}
},
"BuyFurniture": {
"_info": {
"name": "Event furniture Settings",
"help": "Buy time-limited furniture from dorm furniture shop during the event"
},
"Enable": {
"name": "Buy event furniture",
"help": ""
},
"BuyOption": {
"name": "Buy Option",
"help": "buy set: buy one piece for each piece of furniture; buy all: Buy all furniture. Both buy options will remove the set of furniture from the forefront of the store. If buy set, remaining furniture will need to be manually buy. Difference in furniture price between the two options is not significant, Recommended to use buy all. This operation will not buy diamond furniture",
"set": "set",
"all": "all"
},
"LastRun": {
"name": "Last Check Time",
"help": "The time of the last check is recorded here to prevent the task from running repeatedly. Check interval is 7 days. This value is automatically recorded and generally does not need to be modified."
}
},
"Meowfficer": {
"_info": {
"name": "Mewofficer Settings",

View File

@ -1392,6 +1392,26 @@
"help": "Dorm.FeedFilter.help"
}
},
"BuyFurniture": {
"_info": {
"name": "BuyFurniture._info.name",
"help": "BuyFurniture._info.help"
},
"Enable": {
"name": "BuyFurniture.Enable.name",
"help": "BuyFurniture.Enable.help"
},
"BuyOption": {
"name": "BuyFurniture.BuyOption.name",
"help": "BuyFurniture.BuyOption.help",
"set": "set",
"all": "all"
},
"LastRun": {
"name": "BuyFurniture.LastRun.name",
"help": "BuyFurniture.LastRun.help"
}
},
"Meowfficer": {
"_info": {
"name": "Meowfficer._info.name",

View File

@ -1392,6 +1392,26 @@
"help": "一般不需要修改"
}
},
"BuyFurniture": {
"_info": {
"name": "活动家具设置",
"help": "购买活动中后宅家具商城的限时家具"
},
"Enable": {
"name": "购买活动家具",
"help": ""
},
"BuyOption": {
"name": "购买方案",
"help": "购买一套:为每个家具买一件;购买全部:所有家具买到上限。两种购买方案都会将该套家具从家具商店最前端移除,若使用购买一套则剩余家具需手动购买,\n两种方案家具消耗差别不大建议使用购买全部。不会购买钻石家具",
"set": "购买一套",
"all": "购买全部"
},
"LastRun": {
"name": "上次检查时间",
"help": "记录上一次检查的时间以防止任务重复运行检查间隔为7天这个数值是自动记录的一般不需要修改"
}
},
"Meowfficer": {
"_info": {
"name": "指挥喵",

View File

@ -1392,6 +1392,26 @@
"help": "一般不需要修改"
}
},
"BuyFurniture": {
"_info": {
"name": "活動傢俱設定",
"help": "購買活動中後宅傢俱商城的限時傢俱"
},
"Enable": {
"name": "購買活動傢俱",
"help": ""
},
"BuyOption": {
"name": "購買方案",
"help": "購買一套:為每個傢俱買一件;購買全部:所有傢俱買到上限。兩種購買方案都會將該套傢俱從傢俱商店最前端移除,若使用購買一套則剩餘傢俱需手動購買,\n兩種方案傢俱消耗差別不大建議使用購買全部不會購買鑽石傢俱",
"set": "購買一套",
"all": "購買全部"
},
"LastRun": {
"name": "上次檢查時間",
"help": "記錄上一次檢查的時間以防止任務重複執行,這個數值是自動記錄的,一般不需要修改"
}
},
"Meowfficer": {
"_info": {
"name": "指揮喵",

View File

@ -6,7 +6,19 @@ from module.base.template import Template
DORM_FEED_CHECK = Button(area={'cn': (162, 342, 274, 370), 'en': (162, 342, 274, 370), 'jp': (162, 342, 274, 370), 'tw': (162, 342, 274, 370)}, color={'cn': (182, 179, 171), 'en': (182, 179, 171), 'jp': (182, 179, 171), 'tw': (182, 179, 171)}, button={'cn': (162, 342, 274, 370), 'en': (162, 342, 274, 370), 'jp': (162, 342, 274, 370), 'tw': (162, 342, 274, 370)}, file={'cn': './assets/cn/dorm/DORM_FEED_CHECK.png', 'en': './assets/en/dorm/DORM_FEED_CHECK.png', 'jp': './assets/jp/dorm/DORM_FEED_CHECK.png', 'tw': './assets/tw/dorm/DORM_FEED_CHECK.png'})
DORM_FEED_ENTER = Button(area={'cn': (254, 581, 300, 605), 'en': (254, 581, 300, 605), 'jp': (254, 581, 300, 605), 'tw': (254, 581, 300, 605)}, color={'cn': (204, 192, 177), 'en': (204, 192, 177), 'jp': (204, 192, 177), 'tw': (204, 192, 177)}, button={'cn': (254, 581, 300, 605), 'en': (254, 581, 300, 605), 'jp': (254, 581, 300, 605), 'tw': (254, 581, 300, 605)}, file={'cn': './assets/cn/dorm/DORM_FEED_ENTER.png', 'en': './assets/en/dorm/DORM_FEED_ENTER.png', 'jp': './assets/jp/dorm/DORM_FEED_ENTER.png', 'tw': './assets/tw/dorm/DORM_FEED_ENTER.png'})
DORM_FURNITURE_BUY_ALL = Button(area={'cn': (818, 621, 1072, 677), 'en': (819, 621, 1072, 677), 'jp': (820, 621, 1072, 677), 'tw': (818, 621, 1072, 677)}, color={'cn': (249, 202, 66), 'en': (248, 201, 66), 'jp': (247, 201, 66), 'tw': (248, 201, 66)}, button={'cn': (818, 621, 1072, 677), 'en': (819, 621, 1072, 677), 'jp': (820, 621, 1072, 677), 'tw': (818, 621, 1072, 677)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_BUY_ALL.png', 'en': './assets/en/dorm/DORM_FURNITURE_BUY_ALL.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_BUY_ALL.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_BUY_ALL.png'})
DORM_FURNITURE_BUY_CONFIRM = Button(area={'cn': (644, 464, 972, 517), 'en': (645, 464, 971, 518), 'jp': (645, 465, 973, 517), 'tw': (644, 464, 972, 518)}, color={'cn': (251, 204, 66), 'en': (250, 203, 66), 'jp': (250, 203, 66), 'tw': (250, 203, 66)}, button={'cn': (644, 464, 972, 517), 'en': (645, 464, 971, 518), 'jp': (645, 465, 973, 517), 'tw': (644, 464, 972, 518)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_BUY_CONFIRM.png', 'en': './assets/en/dorm/DORM_FURNITURE_BUY_CONFIRM.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_BUY_CONFIRM.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_BUY_CONFIRM.png'})
DORM_FURNITURE_BUY_SET = Button(area={'cn': (505, 621, 759, 677), 'en': (505, 621, 759, 677), 'jp': (505, 621, 760, 677), 'tw': (505, 621, 759, 677)}, color={'cn': (248, 202, 66), 'en': (247, 201, 66), 'jp': (245, 199, 65), 'tw': (247, 201, 66)}, button={'cn': (505, 621, 759, 677), 'en': (505, 621, 759, 677), 'jp': (505, 621, 760, 677), 'tw': (505, 621, 759, 677)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_BUY_SET.png', 'en': './assets/en/dorm/DORM_FURNITURE_BUY_SET.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_BUY_SET.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_BUY_SET.png'})
DORM_FURNITURE_CONFIRM = Button(area={'cn': (614, 476, 667, 503), 'en': (593, 470, 688, 505), 'jp': (614, 476, 667, 503), 'tw': (614, 476, 667, 503)}, color={'cn': (226, 155, 84), 'en': (228, 159, 89), 'jp': (226, 155, 84), 'tw': (226, 155, 84)}, button={'cn': (614, 476, 667, 503), 'en': (593, 470, 688, 505), 'jp': (614, 476, 667, 503), 'tw': (614, 476, 667, 503)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_CONFIRM.png', 'en': './assets/en/dorm/DORM_FURNITURE_CONFIRM.png', 'jp': './assets/cn/dorm/DORM_FURNITURE_CONFIRM.png', 'tw': './assets/cn/dorm/DORM_FURNITURE_CONFIRM.png'})
DORM_FURNITURE_COUNTDOWN = Button(area={'cn': (422, 244, 437, 259), 'en': (422, 244, 437, 259), 'jp': (422, 244, 437, 259), 'tw': (422, 244, 437, 259)}, color={'cn': (222, 222, 224), 'en': (222, 222, 224), 'jp': (222, 222, 224), 'tw': (222, 222, 224)}, button={'cn': (422, 244, 437, 259), 'en': (422, 244, 437, 259), 'jp': (422, 244, 437, 259), 'tw': (422, 244, 437, 259)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_COUNTDOWN.png', 'en': './assets/en/dorm/DORM_FURNITURE_COUNTDOWN.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_COUNTDOWN.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_COUNTDOWN.png'})
DORM_FURNITURE_DETAILS_ENTER = Button(area={'cn': (1003, 444, 1259, 496), 'en': (1003, 444, 1259, 496), 'jp': (1003, 444, 1259, 496), 'tw': (1003, 444, 1258, 496)}, color={'cn': (252, 204, 66), 'en': (251, 204, 66), 'jp': (251, 204, 66), 'tw': (251, 204, 66)}, button={'cn': (1003, 444, 1259, 496), 'en': (1003, 444, 1259, 496), 'jp': (1003, 444, 1259, 496), 'tw': (1003, 444, 1258, 496)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_DETAILS_ENTER.png', 'en': './assets/en/dorm/DORM_FURNITURE_DETAILS_ENTER.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_DETAILS_ENTER.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_DETAILS_ENTER.png'})
DORM_FURNITURE_DETAILS_QUIT = Button(area={'cn': (100, 121, 114, 141), 'en': (100, 121, 114, 141), 'jp': (100, 121, 114, 141), 'tw': (100, 121, 114, 141)}, color={'cn': (255, 224, 131), 'en': (255, 224, 131), 'jp': (255, 224, 131), 'tw': (255, 224, 131)}, button={'cn': (100, 121, 114, 141), 'en': (100, 121, 114, 141), 'jp': (100, 121, 114, 141), 'tw': (100, 121, 114, 141)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_DETAILS_QUIT.png', 'en': './assets/en/dorm/DORM_FURNITURE_DETAILS_QUIT.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_DETAILS_QUIT.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_DETAILS_QUIT.png'})
DORM_FURNITURE_SHOP_ENTER = Button(area={'cn': (1067, 604, 1120, 650), 'en': (1085, 604, 1139, 650), 'jp': (1067, 604, 1120, 650), 'tw': (1067, 604, 1120, 650)}, color={'cn': (255, 226, 130), 'en': (255, 227, 132), 'jp': (255, 226, 130), 'tw': (255, 226, 130)}, button={'cn': (1067, 604, 1120, 650), 'en': (1085, 604, 1139, 650), 'jp': (1067, 604, 1120, 650), 'tw': (1067, 604, 1120, 650)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_SHOP_ENTER.png', 'en': './assets/en/dorm/DORM_FURNITURE_SHOP_ENTER.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_SHOP_ENTER.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_SHOP_ENTER.png'})
DORM_FURNITURE_SHOP_FIRST = Button(area={'cn': (241, 565, 271, 572), 'en': (241, 565, 271, 572), 'jp': (241, 565, 271, 572), 'tw': (241, 565, 271, 572)}, color={'cn': (247, 213, 129), 'en': (247, 213, 129), 'jp': (247, 213, 129), 'tw': (247, 213, 129)}, button={'cn': (241, 565, 271, 572), 'en': (241, 565, 271, 572), 'jp': (241, 565, 271, 572), 'tw': (241, 565, 271, 572)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_SHOP_FIRST.png', 'en': './assets/en/dorm/DORM_FURNITURE_SHOP_FIRST.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_SHOP_FIRST.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_SHOP_FIRST.png'})
DORM_FURNITURE_SHOP_FIRST_SELECTED = Button(area={'cn': (239, 519, 273, 525), 'en': (239, 519, 273, 525), 'jp': (239, 519, 273, 525), 'tw': (239, 519, 273, 525)}, color={'cn': (242, 205, 114), 'en': (242, 205, 114), 'jp': (242, 205, 114), 'tw': (242, 205, 114)}, button={'cn': (239, 519, 273, 525), 'en': (239, 519, 273, 525), 'jp': (239, 519, 273, 525), 'tw': (239, 519, 273, 525)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_SHOP_FIRST_SELECTED.png', 'en': './assets/en/dorm/DORM_FURNITURE_SHOP_FIRST_SELECTED.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_SHOP_FIRST_SELECTED.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_SHOP_FIRST_SELECTED.png'})
DORM_FURNITURE_SHOP_QUIT = Button(area={'cn': (38, 34, 58, 63), 'en': (38, 34, 58, 63), 'jp': (38, 34, 58, 63), 'tw': (38, 34, 58, 63)}, color={'cn': (255, 241, 195), 'en': (255, 241, 195), 'jp': (255, 241, 195), 'tw': (255, 241, 195)}, button={'cn': (38, 34, 58, 63), 'en': (38, 34, 58, 63), 'jp': (38, 34, 58, 63), 'tw': (38, 34, 58, 63)}, file={'cn': './assets/cn/dorm/DORM_FURNITURE_SHOP_QUIT.png', 'en': './assets/en/dorm/DORM_FURNITURE_SHOP_QUIT.png', 'jp': './assets/jp/dorm/DORM_FURNITURE_SHOP_QUIT.png', 'tw': './assets/tw/dorm/DORM_FURNITURE_SHOP_QUIT.png'})
DORM_RED_DOT = Button(area={'cn': (734, 215, 767, 248), 'en': (734, 215, 767, 248), 'jp': (734, 215, 767, 248), 'tw': (734, 215, 767, 248)}, color={'cn': (130, 89, 94), 'en': (130, 89, 94), 'jp': (130, 89, 94), 'tw': (130, 89, 94)}, button={'cn': (734, 215, 767, 248), 'en': (734, 215, 767, 248), 'jp': (734, 215, 767, 248), 'tw': (734, 215, 767, 248)}, file={'cn': './assets/cn/dorm/DORM_RED_DOT.png', 'en': './assets/en/dorm/DORM_RED_DOT.png', 'jp': './assets/jp/dorm/DORM_RED_DOT.png', 'tw': './assets/tw/dorm/DORM_RED_DOT.png'})
OCR_DORM_FILL = Button(area={'cn': (813, 271, 987, 296), 'en': (813, 271, 987, 296), 'jp': (813, 271, 987, 296), 'tw': (813, 271, 987, 296)}, color={'cn': (222, 213, 193), 'en': (222, 213, 193), 'jp': (222, 213, 193), 'tw': (222, 213, 193)}, button={'cn': (813, 271, 987, 296), 'en': (813, 271, 987, 296), 'jp': (813, 271, 987, 296), 'tw': (813, 271, 987, 296)}, file={'cn': './assets/cn/dorm/OCR_DORM_FILL.png', 'en': './assets/en/dorm/OCR_DORM_FILL.png', 'jp': './assets/jp/dorm/OCR_DORM_FILL.png', 'tw': './assets/tw/dorm/OCR_DORM_FILL.png'})
OCR_DORM_FURNITURE_COIN = Button(area={'cn': (897, 20, 988, 49), 'en': (897, 20, 988, 49), 'jp': (897, 20, 988, 49), 'tw': (897, 20, 988, 49)}, color={'cn': (203, 197, 194), 'en': (203, 197, 194), 'jp': (203, 197, 194), 'tw': (203, 197, 194)}, button={'cn': (897, 20, 988, 49), 'en': (897, 20, 988, 49), 'jp': (897, 20, 988, 49), 'tw': (897, 20, 988, 49)}, file={'cn': './assets/cn/dorm/OCR_DORM_FURNITURE_COIN.png', 'en': './assets/en/dorm/OCR_DORM_FURNITURE_COIN.png', 'jp': './assets/jp/dorm/OCR_DORM_FURNITURE_COIN.png', 'tw': './assets/tw/dorm/OCR_DORM_FURNITURE_COIN.png'})
OCR_DORM_FURNITURE_PRICE = Button(area={'cn': (819, 417, 896, 442), 'en': (819, 417, 896, 442), 'jp': (819, 417, 896, 442), 'tw': (819, 417, 896, 442)}, color={'cn': (227, 223, 220), 'en': (227, 223, 220), 'jp': (227, 223, 220), 'tw': (227, 223, 220)}, button={'cn': (819, 417, 896, 442), 'en': (819, 417, 896, 442), 'jp': (819, 417, 896, 442), 'tw': (819, 417, 896, 442)}, file={'cn': './assets/cn/dorm/OCR_DORM_FURNITURE_PRICE.png', 'en': './assets/en/dorm/OCR_DORM_FURNITURE_PRICE.png', 'jp': './assets/jp/dorm/OCR_DORM_FURNITURE_PRICE.png', 'tw': './assets/tw/dorm/OCR_DORM_FURNITURE_PRICE.png'})
OCR_DORM_SLOT = Button(area={'cn': (112, 662, 155, 694), 'en': (112, 662, 155, 694), 'jp': (112, 662, 155, 694), 'tw': (112, 662, 155, 694)}, color={'cn': (217, 217, 217), 'en': (217, 217, 217), 'jp': (217, 217, 217), 'tw': (217, 217, 217)}, button={'cn': (112, 662, 155, 694), 'en': (112, 662, 155, 694), 'jp': (112, 662, 155, 694), 'tw': (112, 662, 155, 694)}, file={'cn': './assets/cn/dorm/OCR_DORM_SLOT.png', 'en': './assets/en/dorm/OCR_DORM_SLOT.png', 'jp': './assets/jp/dorm/OCR_DORM_SLOT.png', 'tw': './assets/tw/dorm/OCR_DORM_SLOT.png'})

View File

@ -0,0 +1,226 @@
from datetime import datetime, timedelta
from module.dorm.assets import *
from module.logger import logger
from module.ocr.ocr import Digit
from module.ui.assets import DORM_CHECK
from module.ui.ui import UI
OCR_FURNITURE_COIN = Digit(OCR_DORM_FURNITURE_COIN, letter=(107, 89, 82), threshold=128, alphabet='0123456789', name='OCR_FURNITURE_COIN')
OCR_FURNITURE_PRICE = Digit(OCR_DORM_FURNITURE_PRICE, letter=(255, 247, 247), threshold=64, alphabet='0123456789', name='OCR_FURNITURE_PRICE')
CHECK_INTERVAL = 7 # Check every 7 days
# Only for click
FURNITURE_BUY_BUTTON = {
"all": DORM_FURNITURE_BUY_ALL,
"set": DORM_FURNITURE_BUY_SET
}
class BuyFurniture(UI):
def enter_first_furniture_details_page(self, skip_first_screenshot=False):
"""
Pages:
in: page_dorm or DORM_FURNITURE_SHOP_ENTER(furniture shop page)
out:
"""
self.interval_clear((DORM_CHECK, DORM_FURNITURE_DETAILS_ENTER,
DORM_FURNITURE_SHOP_FIRST,))
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
if self.ui_additional():
self.interval_clear(DORM_CHECK)
continue
# Enter furniture shop page from page_dorm, only need to enter once
if self.appear(DORM_CHECK, offset=(20, 20), interval=3):
self.device.click(DORM_FURNITURE_SHOP_ENTER)
continue
if self.appear(DORM_FURNITURE_SHOP_FIRST_SELECTED, offset=(20, 20)):
# Enter furniture details page from furniture shop page
if self.appear(DORM_FURNITURE_DETAILS_ENTER, offset=(20, 20), interval=3):
self.device.click(DORM_FURNITURE_DETAILS_ENTER)
continue
# After buy furniture, current furniture in store not first on list below.
# Re select the first piece of furniture on left side of furniture list below.
elif self.appear(DORM_FURNITURE_SHOP_FIRST, offset=(20, 20), interval=3):
self.device.click(DORM_FURNITURE_SHOP_FIRST)
continue
if self.appear(DORM_FURNITURE_DETAILS_QUIT, offset=(20, 20)):
break
def furniture_shop_quit(self, skip_first_screenshot=False):
"""
Pages:
in: DORM_FURNITURE_DETAILS_ENTER (furniture shop page)
out: page_dorm
"""
self.interval_clear(DORM_FURNITURE_DETAILS_ENTER)
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
# End
if self.appear(DORM_CHECK, offset=(20, 20)):
break
if self.appear(DORM_FURNITURE_DETAILS_ENTER, offset=(20, 20), interval=3):
self.device.click(DORM_FURNITURE_SHOP_QUIT)
continue
def furniture_details_page_quit(self, skip_first_screenshot=False):
"""
Pages:
in: DORM_FURNITURE_DETAILS_QUIT (furniture details page)
out: DORM_FURNITURE_DETAILS_ENTER (furniture shop page)
"""
self.interval_clear(DORM_FURNITURE_DETAILS_QUIT)
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
# End
if self.appear(DORM_FURNITURE_DETAILS_ENTER, offset=(20, 20)):
break
if self.appear(DORM_FURNITURE_DETAILS_QUIT, offset=(20, 20), interval=3):
self.device.click(DORM_FURNITURE_DETAILS_QUIT)
continue
def furniture_payment_enter(self, buy_button: Button, skip_first_screenshot=False):
"""
Args:
buy_button(Button): It can only be
DORM_FURNITURE_BUY_SET or DORM_FURNITURE_BUY_ALL
Page:
in: DORM_FURNITURE_DETAILS_QUIT (furniture details page)
out: DORM_FURNITURE_BUY_CONFIRM (furniture payment page)
"""
self.interval_clear(DORM_FURNITURE_DETAILS_QUIT)
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
if self.appear(DORM_FURNITURE_BUY_CONFIRM):
break
if self.appear(DORM_FURNITURE_DETAILS_QUIT, interval=3):
self.device.click(buy_button)
def buy_furniture_confirm(self, skip_first_screenshot=False):
"""
Click DORM_FURNITURE_BUY_CONFIRM and back to furniture details page
Pages:
in: DORM_FURNITURE_BUY_CONFIRM (furniture payment page)
out: DORM_FURNITURE_DETAILS_QUIT (furniture details page)
"""
self.interval_clear(DORM_FURNITURE_BUY_CONFIRM)
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
if self.appear(DORM_FURNITURE_DETAILS_QUIT):
break
if self.appear(DORM_FURNITURE_BUY_CONFIRM, offset=(20, 20), interval=3):
self.device.click(DORM_FURNITURE_BUY_CONFIRM)
def buy_furniture_once(self, buy_option: str):
"""
Args:
buy_option(str): It can only be "all" or "set"
depend on config.BuyFurniture_BuyOption
Returns:
bool: True if furniture coin > furniture price, else False
Pages:
in: DORM_FURNITURE_DETAILS_QUIT (furniture details page)
"""
buy_button: Button = FURNITURE_BUY_BUTTON[buy_option]
coin = OCR_FURNITURE_COIN.ocr(self.device.image)
self.furniture_payment_enter(buy_button, skip_first_screenshot=True)
price = OCR_FURNITURE_PRICE.ocr(self.device.image)
# Successful or failed buy will have popup and back to furniture details page,
# produce the result from furniture coin compare to furniture price.
if coin >= price > 0:
logger.info(f"Enough furniture coin, buy {buy_option}")
buy_successful = True
else:
logger.info(f"Not enough furniture coin, purchase is over")
buy_successful = False
self.buy_furniture_confirm(skip_first_screenshot=True)
self.furniture_details_page_quit(skip_first_screenshot=True)
return buy_successful
def _buy_furniture_run(self):
"""
Enter first furniture details page and check furniture is time-limited,
if appear countdown, buy this furniture.
Return:
bool: True if Successfully bought,
False if Failed buy
"""
self.enter_first_furniture_details_page()
if self.appear(DORM_FURNITURE_COUNTDOWN, offset=(20, 20)):
logger.info("There is a time-limited furniture available for buy")
if self.buy_furniture_once(self.config.BuyFurniture_BuyOption):
logger.info("Find next time-limited furniture")
return True # continue
else:
return False # break
else:
logger.info("No time-limited furniture found")
return False # break
def buy_furniture_run(self):
"""
Pages:
in: DORM_FURNITURE_DETAILS_ENTER (furniture shop page)
out: page_dorm
"""
logger.info("Buy furniture run")
while 1:
if self._buy_furniture_run():
continue
else:
break
# Quit to page_dorm
logger.info("Fallback to dorm_page")
self.furniture_details_page_quit(skip_first_screenshot=True)
self.furniture_shop_quit(skip_first_screenshot=True)
self.config.BuyFurniture_LastRun = datetime.now().replace(microsecond=0)
def run(self):
"""
Run Buy Furniture
"""
logger.attr("BuyFurniture_LastRun", self.config.BuyFurniture_LastRun)
logger.attr("CHECK_INTERVAL", CHECK_INTERVAL)
time_run = self.config.BuyFurniture_LastRun + timedelta(days=CHECK_INTERVAL)
logger.info(f"Task BuyFurniture run time is {time_run}")
if datetime.now().replace(microsecond=0) < time_run:
logger.info("Not running time, skip")
return
self.buy_furniture_run()

View File

@ -8,6 +8,7 @@ from module.base.mask import Mask
from module.base.timer import Timer
from module.base.utils import *
from module.dorm.assets import *
from module.dorm.buy_furniture import BuyFurniture
from module.logger import logger
from module.ocr.ocr import Digit, DigitCounter
from module.template.assets import TEMPLATE_DORM_COIN, TEMPLATE_DORM_LOVE
@ -370,20 +371,20 @@ class RewardDorm(UI):
self.interval_clear(DORM_CHECK)
continue
def dorm_run(self, feed=True, collect=True):
def dorm_run(self, feed=True, collect=True, buy_furniture=False):
"""
Pages:
in: Any page
out: page_dorm
"""
if not feed and not collect:
if not feed and not collect and not buy_furniture:
return
self.ui_ensure(page_dormmenu)
if not self.appear(DORM_RED_DOT, offset=(30, 30)):
logger.info('Nothing to collect. Dorm collecting skipped.')
collect = False
if not feed:
if not feed and not buy_furniture:
return
self.ui_goto(page_dorm, skip_first_screenshot=True)
@ -399,6 +400,10 @@ class RewardDorm(UI):
logger.hr('Dorm collect', level=1)
self.dorm_collect()
if buy_furniture:
logger.hr('Dorm buy furniture', level=1)
BuyFurniture(self.config, self.device).run()
def get_dorm_ship_amount(self, skip_first_screenshot=True):
"""
Args:
@ -482,11 +487,14 @@ class RewardDorm(UI):
in: Any page
out: page_dorm
"""
if not self.config.Dorm_Feed and not self.config.Dorm_Collect:
if not self.config.Dorm_Feed and not self.config.Dorm_Collect \
and not self.config.BuyFurniture_Enable:
self.config.Scheduler_Enable = False
self.config.task_stop()
self.dorm_run(feed=self.config.Dorm_Feed, collect=self.config.Dorm_Collect)
self.dorm_run(feed=self.config.Dorm_Feed,
collect=self.config.Dorm_Collect,
buy_furniture=self.config.BuyFurniture_Enable)
# Scheduler
ships = self.get_dorm_ship_amount()