koishi-plugin-resonance-columba-bot 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +17 -13
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -4171,7 +4171,7 @@ function apply(ctx, config) {
4171
4171
  if (nameFlag) {
4172
4172
  items_str = items_str + "查询到商品" + goodsName + "\n";
4173
4173
  if (responseData[goodsName]["buy"] != null && Object.keys(responseData[goodsName]["buy"]).length != 0) {
4174
- items_str = items_str + "\n购入:\n";
4174
+ items_str = items_str + "\n商品购入:\n";
4175
4175
  for (var cityName in responseData[goodsName]["buy"]) {
4176
4176
  var trend_updown = responseData[goodsName]["buy"][cityName]["trend"] === "up" ? "↑" : "↓";
4177
4177
  let time2 = intervalTime(responseData[goodsName]["buy"][cityName]["time"]);
@@ -4180,6 +4180,7 @@ function apply(ctx, config) {
4180
4180
  }
4181
4181
  }
4182
4182
  var base_price_list = [];
4183
+ let item_list = {};
4183
4184
  if (buyCity.length != 0) {
4184
4185
  if (buyCity.length > 1) {
4185
4186
  for (var buyCityName in buyCity) {
@@ -4188,22 +4189,22 @@ function apply(ctx, config) {
4188
4189
  } else {
4189
4190
  base_price_list.push(+responseData[goodsName]["buy"][buyCity[0]]["price"]);
4190
4191
  }
4191
- items_str = items_str + "\n购买物出售:\n";
4192
4192
  for (var cityName in responseData[goodsName]["sell"]) {
4193
4193
  if (responseData[goodsName]["sell"][cityName]["variation"] == 0)
4194
4194
  continue;
4195
+ let item_str = "";
4195
4196
  var trend = responseData[goodsName]["sell"][cityName]["variation"] + "%";
4196
4197
  var trend_updown = responseData[goodsName]["sell"][cityName]["trend"] === "up" ? "↑" : "↓";
4197
4198
  var time = intervalTime(responseData[goodsName]["sell"][cityName]["time"]);
4198
- items_str = items_str + cityName + " " + trend + trend_updown + " 时间 " + time + " 利润 ";
4199
+ item_str = cityName + " " + trend + trend_updown + " 时间 " + time + " 利润 ";
4199
4200
  if (base_price_list.length > 1) {
4200
4201
  for (var price in base_price_list) {
4201
- items_str = items_str + cityName[price][0] + (+responseData[goodsName]["sell"][cityName]["price"] - base_price_list[price]) + " ";
4202
+ item_str = item_str + cityName[price][0] + Math.round(+responseData[goodsName]["sell"][cityName]["price"] * 1.2 - base_price_list[price] * 0.8);
4202
4203
  }
4203
- items_str = items_str + "\n";
4204
4204
  } else {
4205
- items_str = items_str + (+responseData[goodsName]["sell"][cityName]["price"] - base_price_list[0]) + "\n";
4205
+ item_str = item_str + Math.round(+responseData[goodsName]["sell"][cityName]["price"] * 1.2 - base_price_list[0] * 0.8);
4206
4206
  }
4207
+ item_list[cityName] = item_str;
4207
4208
  }
4208
4209
  }
4209
4210
  base_price_list = [];
@@ -4229,25 +4230,28 @@ function apply(ctx, config) {
4229
4230
  base_price = base_price + products_default[good]["craft"][craftGood] * craftGoodsPrice;
4230
4231
  }
4231
4232
  base_price_list.push(base_price);
4232
- items_str = items_str + "\n制造物出售:\n";
4233
4233
  for (var cityName in responseData[goodsName]["sell"]) {
4234
4234
  if (responseData[goodsName]["sell"][cityName]["variation"] == 0)
4235
4235
  continue;
4236
4236
  var trend = responseData[goodsName]["sell"][cityName]["variation"] + "%";
4237
4237
  var trend_updown = responseData[goodsName]["sell"][cityName]["trend"] === "up" ? "↑" : "↓";
4238
4238
  var time = intervalTime(responseData[goodsName]["sell"][cityName]["time"]);
4239
- items_str = items_str + cityName + " " + trend + trend_updown + " 时间 " + time + " 利润 ";
4239
+ if (!(cityName in item_list))
4240
+ item_list[cityName] = cityName + " " + trend + trend_updown + " 时间 " + time;
4240
4241
  if (base_price_list.length > 1) {
4241
4242
  for (var price in base_price_list) {
4242
- items_str = items_str + cityName[price][0] + (+responseData[goodsName]["sell"][cityName]["price"] - base_price_list[price]) + " ";
4243
+ item_list[cityName] = item_list[cityName] + " 制造物利润 " + Math.round(+responseData[goodsName]["sell"][cityName]["price"] * 1.2 - base_price_list[price] * 0.8);
4243
4244
  }
4244
- items_str = items_str + "\n";
4245
4245
  } else {
4246
- items_str = items_str + (+responseData[goodsName]["sell"][cityName]["price"] - base_price_list[0]) + "\n";
4246
+ item_list[cityName] = item_list[cityName] + " 制造物利润 " + Math.round(+responseData[goodsName]["sell"][cityName]["price"] * 1.2 - base_price_list[0] * 0.8);
4247
4247
  }
4248
4248
  }
4249
4249
  }
4250
4250
  }
4251
+ items_str = items_str + "\n商品出售:\n";
4252
+ for (let i in item_list) {
4253
+ items_str = items_str + item_list[i] + "\n";
4254
+ }
4251
4255
  break;
4252
4256
  }
4253
4257
  }
@@ -4294,7 +4298,7 @@ function apply(ctx, config) {
4294
4298
  var buyPrice = responseData["沙金"]["buy"]["淘金乐园"].price;
4295
4299
  var buyVariation = +responseData["沙金"]["buy"]["淘金乐园"].variation + "%";
4296
4300
  var buyTrend_updown = responseData["沙金"]["buy"]["淘金乐园"].trend === "up" ? "↑" : "↓";
4297
- var price = sellPrice - buyPrice * 0.75;
4301
+ var price = Math.round(sellPrice * 1.2 - buyPrice * 0.75 * 0.8);
4298
4302
  var needNum = Math.ceil(5e6 / (sellPrice * 1.2 - buyPrice * 0.75 * 0.8));
4299
4303
  var outputStr = "无往不利成就计算\n三级制造台 满抬满砍 未计算副产 未计算垃圾\n";
4300
4304
  outputStr = outputStr + "当前最低沙金 淘金乐园 " + buyVariation + buyTrend_updown + " " + buyPrice + "\n";
@@ -4323,7 +4327,7 @@ function apply(ctx, config) {
4323
4327
  var buyPrice = responseData["沙金"]["buy"]["淘金乐园"].price;
4324
4328
  var buyVariation = +responseData["沙金"]["buy"]["淘金乐园"].variation + "%";
4325
4329
  var buyTrend_updown = responseData["沙金"]["buy"]["淘金乐园"].trend === "up" ? "↑" : "↓";
4326
- var price = sellPrice - buyPrice * 0.75;
4330
+ var price = Math.round(sellPrice * 1.2 - buyPrice * 0.75 * 0.8);
4327
4331
  var needNum = Math.ceil(1e7 / (sellPrice * 1.2 - buyPrice * 0.75 * 0.8));
4328
4332
  var outputStr = "点石成金成就计算\n三级制造台 满抬满砍 未计算副产 未计算垃圾\n\n";
4329
4333
  if (needNum <= 1016) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-resonance-columba-bot",
3
3
  "description": "雷索纳斯科伦巴商会市场查询",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [