MCPcopy Create free account
hub / github.com/Semporia/Scripts / pickUpComponent

Function pickUpComponent

jd_factory_component.js:198–218  ·  view source on GitHub ↗
(placeId, pin, isMe)

Source from the content-addressed store, hash-verified

196}
197
198function pickUpComponent(placeId, pin, isMe) {
199 return new Promise(async resolve => {
200 $.get(taskUrl('usermaterial/PickUpComponent', `pin=${pin}&placeId=${placeId}`, '_time,pin,placeId,zone'), (err, resp, data) => {
201 try {
202 const { msg, data: { increaseElectric } = {} } = JSON.parse(data);
203 $.log(
204 `\n拾取${isMe ? '自己' : '好友'}零件:${msg},获得电力 ${increaseElectric || 0}\n${$.showLog ? data : ''}`,
205 );
206 if (!increaseElectric) {
207 resolve(true);
208 } else {
209 resolve(false);
210 }
211 } catch (e) {
212 $.logErr(e, resp);
213 } finally {
214 resolve();
215 }
216 });
217 });
218}
219
220function upgradeUserLevel() {
221 return new Promise(async resolve => {

Callers 1

pickUserComponentsFunction · 0.85

Calls 4

taskUrlFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected