| | |
| | | plusPieList.append((specRate, info))
|
| | | return plusPieList
|
| | |
|
| | | ## 从列表中产生物品,[[几率,object], ....], 万分率
|
| | | # @param itemList 待选列表
|
| | | # @return 抽中索引, 抽中元素 索引-1代表没有抽中
|
| | | def GetResultIndexByRandomList(randList):
|
| | | if not randList:
|
| | | return -1, None
|
| | | randRate = random.randint(0, randList[-1][0])
|
| | | for index in range(0, len(randList)):
|
| | | element = randList[index]
|
| | | if not element:
|
| | | continue
|
| | | |
| | | cmpRate = element[0]
|
| | | if randRate > cmpRate:
|
| | | continue
|
| | | |
| | | return index, element[1]
|
| | | |
| | | return -1, None
|
| | |
|
| | | ## 从列表中产生物品,[[几率,object], ....],万分率
|
| | | # @param itemList 待选列表
|
| | | # @return object
|