mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 06:03:50 +01:00
fix sleeve bb
This commit is contained in:
parent
ccbca5c38c
commit
c5cbbb2fbd
@ -34,9 +34,26 @@ export class SleeveBladeburnerWork extends Work {
|
|||||||
process(player: IPlayer, sleeve: Sleeve, cycles: number): number {
|
process(player: IPlayer, sleeve: Sleeve, cycles: number): number {
|
||||||
if (!player.bladeburner) throw new Error("sleeve doing blade work without being a member");
|
if (!player.bladeburner) throw new Error("sleeve doing blade work without being a member");
|
||||||
this.cyclesWorked += cycles;
|
this.cyclesWorked += cycles;
|
||||||
|
const actionIdent = player.bladeburner.getActionIdFromTypeAndName(this.actionType, this.actionName);
|
||||||
|
if (!actionIdent) throw new Error(`Error getting ${this.actionName} action`);
|
||||||
|
if (this.actionType === "Contracts"){
|
||||||
|
const action=player.bladeburner.getActionObject(actionIdent);
|
||||||
|
if (!action) throw new Error(`Error getting ${this.actionName} action object`);
|
||||||
|
if (action.count<=0){
|
||||||
|
sleeve.stopWork(player);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (this.cyclesWorked > this.cyclesNeeded(player, sleeve)) {
|
while (this.cyclesWorked > this.cyclesNeeded(player, sleeve)) {
|
||||||
const actionIdent = player.bladeburner.getActionIdFromTypeAndName(this.actionType, this.actionName);
|
if (this.actionType === "Contracts"){
|
||||||
if (!actionIdent) throw new Error(`Error getting ${this.actionName} action`);
|
const action=player.bladeburner.getActionObject(actionIdent);
|
||||||
|
if (!action) throw new Error(`Error getting ${this.actionName} action object`);
|
||||||
|
if (action.count<=0){
|
||||||
|
sleeve.stopWork(player);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
player.bladeburner.completeAction(player, sleeve, actionIdent, false);
|
player.bladeburner.completeAction(player, sleeve, actionIdent, false);
|
||||||
let exp: WorkStats | undefined;
|
let exp: WorkStats | undefined;
|
||||||
if (this.actionType === "General") {
|
if (this.actionType === "General") {
|
||||||
|
Loading…
Reference in New Issue
Block a user