Skip to content
This repository has been archived by the owner on Jan 1, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/V0.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
MoeHero committed Dec 9, 2017
2 parents fedf6e6 + 18b90b6 commit 8fafbca
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 46 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@
[![license](https://img.shields.io/badge/license-MPL--2.0-blue.svg)](https://github.com/MoeHero/BilibiliHelper/blob/master/LICENSE)

## 更新日志
`新增` 支持自动领取丰实之仓
`修复` 某些情况下插件无法使用的问题
`修复` 自动领瓜子界面替换失败的问题
`修复` 弹出菜单中重置插件功能失效的问题
`优化` 自动领瓜子的用户交互
`修复` 一次性赠送多个小电视时获得奖励显示错误的问题
`修复` 设置界面字体出错的问题
`优化` 活动抽奖可以支持今后大部分活动并且无需更新
`警告` 部分通知设置不可用

## TODO List
### 计划功能
- [ ] 赠送礼物增强

### 后续版本功能
- [ ] 屏蔽主站广告
- [ ] 主站功能

### 已完成功能
- [x] 右上角图标弹出菜单
- [x] 领取小电视
- [x] 自动小电视抽奖
- [x] 自动活动抽奖
- [x] 自动领瓜子
- [x] 自动签到

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bilibili-helper",
"description": "Bilibili Helper",
"version": "0.1.2",
"version": "0.1.3",
"author": "MoeHero",
"license": "MPL-2.0",
"homepage": "https://github.com/MoeHero/BilibiliHelper#readme",
Expand Down
42 changes: 23 additions & 19 deletions src/live/ALPlugin_Activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class ALPlugin_Activity {
Helper.sendMessage({cmd: 'set', type: 'Activity', showID: Helper.showID});
$(document).on('DOMNodeInserted', '.system-msg.news', function() {
let info = $(this).find('div a');
let roomID = info.attr('href').match(/\/(\d+)/);
if(info.text().includes('丰收祭典')) {
let roomID = info.attr('href').match(/\/(\d+)$/);
if(roomID != null) {
$this.join(roomID[1]);
} else if(info.text().includes('丰实之仓')) {
$this.getReceiveGift(roomID[1]);
}
}// else if(info.text().includes('丰实之仓')) {
// $this.getReceiveGift(roomID[1]);
// }
});
ModuleNotify.activity('enabled');
ModuleConsole.activity('enabled');
Expand All @@ -47,22 +47,23 @@ class ALPlugin_Activity {
});
}

static getReceiveGift(roomID) {
$.getJSON('//api.live.bilibili.com/activity/v1/Common/getReceiveGift', {roomid: roomID}).done(result => {
switch(result.code) {
case 0:
break;
default:
console.log(result);
break;
}
}).fail(() => Helper.countdown(2, () => this.getReceiveGift(roomID)));
}
// static getReceiveGift(roomID) {
// $.getJSON('//api.live.bilibili.com/activity/v1/Common/getReceiveGift', {roomid: roomID}).done(result => {
// switch(result.code) {
// case 0:
// break;
// default:
// console.log(result);
// break;
// }
// }).fail(() => Helper.countdown(2, () => this.getReceiveGift(roomID)));
// }
static join(roomID) {
$.getJSON('//api.live.bilibili.com/activity/v1/Raffle/check', {roomid: roomID}).done(r1 => {
if(r1.code === 0) {
for(let data of r1.data) {
if(this.list[data.raffleId] === undefined) {
this.list[data.raffleId] = 0;
$.getJSON('//api.live.bilibili.com/activity/v1/Raffle/join', {roomid: roomID, raffleId: data.raffleId}).done(r2 => {
switch(r2.code) {
case 0:
Expand All @@ -74,7 +75,10 @@ class ALPlugin_Activity {
console.log(r2);
break;
}
}).fail(() => Helper.countdown(2, () => this.join(roomID)));
}).fail(() => {
this.list[data.raffleId] = undefined;
Helper.countdown(2, () => this.join(roomID));
});
}
}
} else {
Expand All @@ -87,7 +91,7 @@ class ALPlugin_Activity {
switch(result.code) {
case 0:
delete this.list[raffleID];
let award = {awardNumber: result.data.gift_num, awardName: result.data.gift_name};
let award = {awardNumber: result.data.gift_num, awardName: result.data.gift_name, roomID, raffleID};
// ModuleStore.addStatinfo('smallTV', result.reward.id, result.reward.num);
// ModuleStore.addTimes('smallTV', 1);
// ModuleNotify.activity('award', award);
Expand All @@ -100,7 +104,7 @@ class ALPlugin_Activity {
// }
break;
case -400: //正在开奖
Helper.countdown(10, () => this.getAward(roomID, raffleID));
Helper.countdown(30, () => this.getAward(roomID, raffleID));
break;
default:
console.log(result);
Expand Down
16 changes: 10 additions & 6 deletions src/live/ALPlugin_SmallTV.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class ALPlugin_SmallTV {
if(r1.code === 0) {
for(let data of r1.data) {
if(this.list[data.raffleId] === undefined) {
this.list[data.raffleId] = 0;
$.getJSON('//api.live.bilibili.com/gift/v2/smalltv/join', {roomid: roomID, raffleId: data.raffleId}).done(r2 => {
switch(r2.code) {
case 0:
Expand All @@ -102,7 +103,10 @@ class ALPlugin_SmallTV {
console.log(r2);
break;
}
}).fail(() => Helper.countdown(2, () => this.join(roomID)));
}).fail(() => {
this.list[data.raffleId] = undefined;
Helper.countdown(2, () => this.join(roomID));
});
}
}
} else {
Expand All @@ -122,17 +126,17 @@ class ALPlugin_SmallTV {
}
static getAward(roomID, raffleID) {
$.getJSON('//api.live.bilibili.com/gift/v2/smalltv/notice', {roomid: roomID, raffleId: raffleID}).done(result => {
switch(result.code) {
case 0:
switch(result.data.status) {
case 2:
delete this.list[raffleID];
let award = {awardNumber: result.data.gift_num, awardName: result.data.gift_name};
let award = {awardNumber: result.data.gift_num, awardName: result.data.gift_name, roomID, raffleID};
// ModuleStore.addStatinfo('smallTV', result.reward.id, result.reward.num);
// ModuleStore.addTimes('smallTV', 1);
// Helper.option['notify_autoSmallTV_award_' + result.data.gift_id] && ModuleNotify.smallTV('award', award);
ModuleConsole.smallTV('award', award);
break;
case -400: //正在开奖
Helper.countdown(10, () => this.getAward(roomID, raffleID));
case 3: //正在开奖
Helper.countdown(30, () => this.getAward(roomID, raffleID));
break;
default:
console.log(result);
Expand Down
4 changes: 2 additions & 2 deletions src/live/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ Helper.localize = {//TODO 重构 去除不必要文本
smallTV: {
title: '自动小电视',
action: {
award: '获得${awardName}x${awardNumber}',
award: '获得${awardName}x${awardNumber} RaffleID:${raffleID} RoomID:${roomID}',
}
},
activity: {
title: '活动抽奖',
action: {
award: '获得${awardName}x${awardNumber}',
award: '获得${awardName}x${awardNumber} RaffleID:${raffleID} RoomID:${roomID}',
}
}
};
Expand Down
6 changes: 6 additions & 0 deletions src/options/updatelog.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<h1>更新日志</h1>
<h2>V0.1.3</h2>
<p><code>修复</code> 一次性赠送多个小电视时获得奖励显示错误的问题</p>
<p><code>修复</code> 设置界面字体出错的问题</p>
<p><code>优化</code> 活动抽奖可以支持今后大部分活动并且无需更新</p>
<p><code>警告</code> 部分通知设置不可用</p>
<hr>
<h2>V0.1.2</h2>
<p><code>新增</code> 支持自动领取丰实之仓</p>
<p><code>修复</code> 某些情况下插件无法使用的问题</p>
Expand Down
2 changes: 1 addition & 1 deletion src/resources/css/bootstrap.min.css

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,10 @@ braces@^1.8.2:
repeat-element "^1.1.2"

browserslist@^2.1.2:
version "2.7.0"
resolved "http://registry.npm.taobao.org/browserslist/download/browserslist-2.7.0.tgz#dc375dc70048fec3d989042a35022342902eff00"
version "2.8.0"
resolved "http://registry.npm.taobao.org/browserslist/download/browserslist-2.8.0.tgz#27d64028130a2e8585ca96f7c3b7730eff4de493"
dependencies:
caniuse-lite "^1.0.30000757"
caniuse-lite "^1.0.30000758"
electron-to-chromium "^1.3.27"

buffer-crc32@~0.2.3:
Expand All @@ -718,9 +718,9 @@ camel-case@3.0.x:
no-case "^2.2.0"
upper-case "^1.1.1"

caniuse-lite@^1.0.30000757:
version "1.0.30000758"
resolved "http://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30000758.tgz#e261140076651049cf6891ed4bc649b5c8c26c69"
caniuse-lite@^1.0.30000758:
version "1.0.30000760"
resolved "http://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30000760.tgz#ec720395742f1c7ec8947fd6dd2604e77a8f98ff"

chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
version "1.1.3"
Expand Down Expand Up @@ -762,8 +762,8 @@ clone@^0.2.0:
resolved "http://registry.npm.taobao.org/clone/download/clone-0.2.0.tgz#c6126a90ad4f72dbf5acdb243cc37724fe93fc1f"

clone@^1.0.0, clone@^1.0.2:
version "1.0.2"
resolved "http://registry.npm.taobao.org/clone/download/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149"
version "1.0.3"
resolved "http://registry.npm.taobao.org/clone/download/clone-1.0.3.tgz#298d7e2231660f40c003c2ed3140decf3f53085f"

clone@^2.1.1:
version "2.1.1"
Expand Down Expand Up @@ -1089,8 +1089,8 @@ glob2base@^0.0.12:
find-index "^0.1.1"

glob@^4.3.1:
version "4.3.5"
resolved "http://registry.npm.taobao.org/glob/download/glob-4.3.5.tgz#80fbb08ca540f238acce5d11d1e9bc41e75173d3"
version "4.5.3"
resolved "http://registry.npm.taobao.org/glob/download/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f"
dependencies:
inflight "^1.0.4"
inherits "2"
Expand Down

0 comments on commit 8fafbca

Please sign in to comment.