72 lines
2.0 KiB
Python
72 lines
2.0 KiB
Python
# 解锁一些东西的外部代码
|
|
|
|
from loguru import logger
|
|
|
|
from MyConfig import testUid8
|
|
from HelperLogInOut import apiLogin, apiLogout, generateTimestamp
|
|
from HelperUnlockThing import implUnlockThing
|
|
|
|
|
|
def implUnlockMultiItem(
|
|
itemKind: int,
|
|
userId: int,
|
|
currentLoginTimestamp: int,
|
|
currentLoginResult,
|
|
*itemIds: int,
|
|
) -> str:
|
|
if not itemIds:
|
|
logger.info("无操作,跳过处理!")
|
|
return
|
|
"""
|
|
发单个东西,比如搭档 10
|
|
"""
|
|
userItemList = [
|
|
{"itemKind": itemKind, "itemId": itemId, "stock": 1, "isValid": True}
|
|
for itemId in itemIds
|
|
]
|
|
unlockThingResult = implUnlockThing(
|
|
userItemList, userId, currentLoginTimestamp, currentLoginResult
|
|
)
|
|
return unlockThingResult
|
|
|
|
|
|
def implUnlockMusic(
|
|
musicToBeUnlocked: int, userId: int, currentLoginTimestamp: int, currentLoginResult
|
|
) -> str:
|
|
"""
|
|
解锁乐曲
|
|
"""
|
|
userItemList = [
|
|
{"itemKind": 5, "itemId": musicToBeUnlocked, "stock": 1, "isValid": True},
|
|
{"itemKind": 6, "itemId": musicToBeUnlocked, "stock": 1, "isValid": True},
|
|
]
|
|
unlockThingResult = implUnlockThing(
|
|
userItemList, userId, currentLoginTimestamp, currentLoginResult
|
|
)
|
|
return unlockThingResult
|
|
|
|
|
|
if __name__ == "__main__":
|
|
userId = int(input("type user id: ").strip() or "0") or testUid8
|
|
currentLoginTimestamp = generateTimestamp()
|
|
loginResult = apiLogin(currentLoginTimestamp, userId)
|
|
|
|
if loginResult["returnCode"] != 1:
|
|
logger.info("登录失败")
|
|
exit()
|
|
try:
|
|
items = range(11, 33) # all partners
|
|
logger.info(
|
|
implUnlockMultiItem(
|
|
10,
|
|
userId,
|
|
currentLoginTimestamp,
|
|
loginResult,
|
|
*items,
|
|
)
|
|
)
|
|
logger.info(apiLogout(currentLoginTimestamp, userId))
|
|
finally:
|
|
logger.info(apiLogout(currentLoginTimestamp, userId))
|
|
# logger.warning("Error")
|