koishi-plugin-resonance-columba-bot 2.0.2 → 3.0.0

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.
@@ -159,6 +159,9 @@ export declare var role_resonanceskills: {
159
159
  涟: {
160
160
  resonance: number;
161
161
  };
162
+ 马吉拉·星仪: {
163
+ resonance: number;
164
+ };
162
165
  };
163
166
  export declare var ROLE_RESONANCE_SKILLS: {
164
167
  [role: string]: ResonanceSkills;
package/lib/index.d.ts CHANGED
@@ -9,8 +9,10 @@ export interface Config {
9
9
  BigPrice: number;
10
10
  LowSmallPrice: number;
11
11
  LowBigPrice: number;
12
+ ShortTeamList: Array<string>;
12
13
  TeamList: Array<string>;
13
14
  ErrorTeamList: Array<string>;
15
+ MaxTeamList: Array<string>;
14
16
  ErrorItemList: Array<string>;
15
17
  ItemSendList: Dict<Dict<ConfigItemList, string>, string>;
16
18
  StartUrl: string;
package/lib/index.js CHANGED
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  Config: () => Config,
34
34
  ConfigItemList: () => ConfigItemList,
35
35
  apply: () => apply,
@@ -39,7 +39,7 @@ __export(src_exports, {
39
39
  responseData: () => responseData,
40
40
  send_error: () => send_error
41
41
  });
42
- module.exports = __toCommonJS(src_exports);
42
+ module.exports = __toCommonJS(index_exports);
43
43
  var import_koishi = require("koishi");
44
44
 
45
45
  // src/data/cicies.ts
@@ -74,7 +74,9 @@ var cityList = [
74
74
  "汇流塔",
75
75
  "远星大桥",
76
76
  "栖羽站",
77
- "岚心城"
77
+ "岚心城",
78
+ "塔图站",
79
+ "黑月游乐城"
78
80
  ];
79
81
  var cityItemList = {};
80
82
  var CITIES = cityList;
@@ -209,6 +211,7 @@ var calculatePrice = /* @__PURE__ */ __name((pdtName, city, type, variation) =>
209
211
  var EVENTS = [
210
212
  // 红茶战争 2024/03/21 - 2024/04/11
211
213
  // 红茶战争 2024/07/30 - 2024/08/20
214
+ // 红茶战争 常驻
212
215
  {
213
216
  name: "红茶战争",
214
217
  description: "红茶购买量+50%, 红茶税率-5%",
@@ -705,6 +708,9 @@ var role_resonanceskills = {
705
708
  },
706
709
  涟: {
707
710
  resonance: 5
711
+ },
712
+ "马吉拉·星仪": {
713
+ resonance: 5
708
714
  }
709
715
  };
710
716
  var ROLE_RESONANCE_SKILLS = import_columbabuild3.RESONANCE_SKILLS;
@@ -748,6 +754,7 @@ var calculateOneGraphBuyCombinations = /* @__PURE__ */ __name((prices, maxLot, b
748
754
  const priceData = prices[name2];
749
755
  let buyPrice = priceData?.["buy"]?.[fromCity]?.price ?? 0;
750
756
  if (buyPrice === 0) {
757
+ console.warn(`No buy price data for ${name2} in ${fromCity}`);
751
758
  return [];
752
759
  }
753
760
  let buyLot = product.buyLot?.[fromCity] ?? 0;
@@ -1157,13 +1164,11 @@ var https = require("https");
1157
1164
  var vm = require("vm");
1158
1165
  async function updata_columba_data(ctx, startUrl = "", flag = false) {
1159
1166
  const result = await ctx.http("https://unpkg.com/resonance-data-columba/dist/columbabuild.js", { redirect: "manual" });
1160
- console.log(result.headers.get("location"));
1161
1167
  if (errorNum != 0) {
1162
1168
  var loca = result.headers.get("location");
1163
1169
  let locaNum = loca.match(/\d+(\.\d+)?/g);
1164
1170
  let num = Number(locaNum[1]) - errorNum;
1165
1171
  loca = loca.replace(locaNum[1], String(num));
1166
- console.log(loca);
1167
1172
  var url = "https://unpkg.com" + loca;
1168
1173
  console.log("尝试使用旧版本数据源 版本号 " + locaNum[0] + "." + num);
1169
1174
  send_error("尝试使用旧版本数据源 版本号 " + locaNum[0] + "." + num);
@@ -1173,7 +1178,6 @@ async function updata_columba_data(ctx, startUrl = "", flag = false) {
1173
1178
  if (startUrl != "" && startUrl != void 0) {
1174
1179
  url = startUrl;
1175
1180
  }
1176
- console.log(url);
1177
1181
  try {
1178
1182
  https.get(url, (res) => {
1179
1183
  let data = "";
@@ -1233,10 +1237,10 @@ __name(toSimplified, "toSimplified");
1233
1237
 
1234
1238
  // src/index.ts
1235
1239
  var name = "resonance-columba-bot";
1236
- var min = 0;
1237
- var errorNum = 0;
1238
1240
  var qqID = "";
1239
1241
  var getDataUrl = "";
1242
+ var min = 0;
1243
+ var errorNum = 0;
1240
1244
  var low_min = 0;
1241
1245
  var ConfigItemList = import_koishi.Schema.object({
1242
1246
  variation: import_koishi.Schema.array(import_koishi.Schema.number()).description("幅度阈值"),
@@ -1462,7 +1466,7 @@ function get_generalProfitIndex(maxRestock, onegraphBuyCombinationsGo, onegraphB
1462
1466
  }
1463
1467
  __name(get_generalProfitIndex, "get_generalProfitIndex");
1464
1468
  var ctx_send;
1465
- function flagMaxTimer() {
1469
+ function flagMaxTimer(flag) {
1466
1470
  send_flag_max = true;
1467
1471
  }
1468
1472
  __name(flagMaxTimer, "flagMaxTimer");
@@ -1876,7 +1880,7 @@ function apply(ctx, config) {
1876
1880
  getDataUrl = ctx.config.DataUrl;
1877
1881
  console.log("插件启动");
1878
1882
  console.log("行情刷新时间为:", time, "毫秒");
1879
- if (ctx.config.StartUrl != "" && ctx.config.StartUrl != void 0)
1883
+ if (ctx.config.StartUrl != "" && ctx.config.StartUrl != null)
1880
1884
  updata_columba_data(ctx, ctx.config.StartUrl, true);
1881
1885
  else
1882
1886
  updata_columba_data(ctx, "", true);
@@ -1959,6 +1963,15 @@ function apply(ctx, config) {
1959
1963
  if (nameFlag) {
1960
1964
  items_str = items_str + "查询到商品" + goodsName + "\n";
1961
1965
  short_items_str = goodsName;
1966
+ if (responseData[goodsName]["buy"] != null && Object.keys(responseData[goodsName]["buy"]).length != 0) {
1967
+ items_str = items_str + "\n商品购入:\n";
1968
+ for (var cityName in responseData[goodsName]["buy"]) {
1969
+ var trend_updown = responseData[goodsName]["buy"][cityName]["trend"] === "up" ? "↑" : "↓";
1970
+ let time2 = intervalTime(responseData[goodsName]["buy"][cityName]["time"]);
1971
+ items_str = items_str + cityName + " " + responseData[goodsName]["buy"][cityName]["variation"] + "%" + trend_updown + " 时间 " + time2 + " " + responseData[goodsName]["buy"][cityName]["price"].toString() + "\n";
1972
+ buyCity.push(cityName);
1973
+ }
1974
+ }
1962
1975
  var city_list = [];
1963
1976
  for (var i = 0; i < 3; i++) {
1964
1977
  let max_price = 0;
@@ -1992,13 +2005,13 @@ function apply(ctx, config) {
1992
2005
  var trend = responseData[goodsName]["sell"][cityName2]["variation"] + "%";
1993
2006
  var trend_updown = responseData[goodsName]["sell"][cityName2]["trend"] === "up" ? "↑" : "↓";
1994
2007
  var time = intervalTime(responseData[goodsName]["sell"][cityName2]["time"]);
1995
- item_str = cityName2 + " " + trend + trend_updown + " 时间 " + time + " 售价 ";
2008
+ item_str = cityName2 + " " + trend + trend_updown + " 时间 " + time + " 利润 ";
1996
2009
  if (base_price_list.length > 1) {
1997
2010
  for (var price in base_price_list) {
1998
- item_str = item_str + buyCity[price][0] + Math.round(+responseData[goodsName]["sell"][cityName2]["price"]);
2011
+ item_str = item_str + buyCity[price][0] + Math.round(+responseData[goodsName]["sell"][cityName2]["price"] * 1.2 - base_price_list[price] * 0.8) + " ";
1999
2012
  }
2000
2013
  } else {
2001
- item_str = item_str + Math.round(+responseData[goodsName]["sell"][cityName2]["price"]);
2014
+ item_str = item_str + Math.round(+responseData[goodsName]["sell"][cityName2]["price"] * 1.2 - base_price_list[0] * 0.8);
2002
2015
  }
2003
2016
  item_list[cityName2] = item_str;
2004
2017
  }
@@ -2014,7 +2027,52 @@ function apply(ctx, config) {
2014
2027
  item_list[cityName2] = item_str;
2015
2028
  }
2016
2029
  }
2017
- items_str = items_str + "商品出售:\n";
2030
+ base_price_list = [];
2031
+ var base_price = 0;
2032
+ for (var good in PRODUCTS) {
2033
+ if (PRODUCTS[good].name === goodsName) {
2034
+ if (PRODUCTS[good].craft == null)
2035
+ break;
2036
+ items_str = items_str + "\n原材料购入:\n";
2037
+ for (var craftGood in PRODUCTS[good]["craft"]) {
2038
+ var craftBuyCity = "";
2039
+ var craftGoodsPrice = 99999;
2040
+ if (craftGood in responseData && Object.keys(responseData[craftGood]["buy"]).length != 0) {
2041
+ for (var cityName in responseData[craftGood]["buy"]) {
2042
+ if (responseData[craftGood]["buy"][cityName].price < craftGoodsPrice) {
2043
+ let trend2 = responseData[craftGood]["buy"][cityName]["variation"] + "%";
2044
+ let trend_updown2 = responseData[craftGood]["buy"][cityName]["trend"] === "up" ? "↑" : "↓";
2045
+ let time2 = intervalTime(responseData[craftGood]["buy"][cityName]["time"]);
2046
+ craftBuyCity = cityName;
2047
+ craftGoodsPrice = responseData[craftGood]["buy"][cityName].price;
2048
+ items_str = items_str + craftGood + " " + cityName + " " + trend2 + trend_updown2 + " 时间 " + time2 + " " + craftGoodsPrice + "\n";
2049
+ }
2050
+ }
2051
+ base_price = base_price + PRODUCTS[good]["craft"][craftGood] * craftGoodsPrice;
2052
+ } else {
2053
+ items_str = items_str + craftGood + " 无出售数据,未计入成本。\n";
2054
+ }
2055
+ }
2056
+ base_price_list.push(base_price);
2057
+ for (let cityName2 of city_list) {
2058
+ if (responseData[goodsName]["sell"][cityName2]["variation"] == 0)
2059
+ continue;
2060
+ var trend = responseData[goodsName]["sell"][cityName2]["variation"] + "%";
2061
+ var trend_updown = responseData[goodsName]["sell"][cityName2]["trend"] === "up" ? "↑" : "↓";
2062
+ var time = intervalTime(responseData[goodsName]["sell"][cityName2]["time"]);
2063
+ if (!(cityName2 in item_list))
2064
+ item_list[cityName2] = cityName2 + " " + trend + trend_updown + " 时间 " + time;
2065
+ if (base_price_list.length > 1) {
2066
+ for (var price in base_price_list) {
2067
+ item_list[cityName2] = item_list[cityName2] + " 制造物利润 " + Math.round(+responseData[goodsName]["sell"][cityName2]["price"] * 1.2 - base_price_list[price] * 0.8);
2068
+ }
2069
+ } else {
2070
+ item_list[cityName2] = item_list[cityName2] + " 制造物利润 " + Math.round(+responseData[goodsName]["sell"][cityName2]["price"] * 1.2 - base_price_list[0] * 0.8);
2071
+ }
2072
+ }
2073
+ }
2074
+ }
2075
+ items_str = items_str + "\n商品出售:\n";
2018
2076
  short_items_str = short_items_str + "出售\n";
2019
2077
  for (let i2 in item_list) {
2020
2078
  items_str = items_str + item_list[i2] + "\n";
@@ -1,6 +1,6 @@
1
1
  import { CityName } from "../data/cicies";
2
2
  import { GetPricesProducts } from "../interfaces/get-prices";
3
- import { PlayerConfig, PlayerConfigBargain, PlayerConfigEvents, PlayerConfigPrestige, PlayerConfigProductUnlockStatus, PlayerConfigRoles } from "../interfaces/player-config";
3
+ import { PlayerConfig, PlayerConfigBargain, PlayerConfigPrestige, PlayerConfigProductUnlockStatus, PlayerConfigRoles, PlayerConfigEvents } from "../interfaces/player-config";
4
4
  import { Product } from "../interfaces/product";
5
5
  import { CityGroupedExchanges, Exchange, OnegraphBuyCombinationStats, OnegraphBuyCombinations } from "../interfaces/route-page";
6
6
  export declare const GENERAL_PROFIT_INDEX_RESTOCK_FATIGUE_CONSTANT = 33;
@@ -8,7 +8,8 @@ export declare const calculateGeneralProfitIndex: (profit: number, fatigue: numb
8
8
  export declare const calculateExchanges: (playerConfig: PlayerConfig, fromCities: CityName[], toCities: CityName[], prices: GetPricesProducts) => Exchange[];
9
9
  export declare const groupeExchangesByCity: (exchanges: Exchange[]) => CityGroupedExchanges;
10
10
  export declare const calculateAccumulatedValues: (playerConfig: PlayerConfig, cityGroupedExchanges: CityGroupedExchanges) => void;
11
- export declare const getBestRoutesByNumberOfBuyingProductTypes: (fromCity: CityName, nbOfType: number, cityGroupedExchanges: CityGroupedExchanges, playerConfig: PlayerConfig) => any[];
11
+ export declare const getBestRoutesByNumberOfBuyingProductTypes: (fromCity: CityName, nbOfType: number, // number of different kind of product to buy from the same city
12
+ cityGroupedExchanges: CityGroupedExchanges, playerConfig: PlayerConfig) => any[];
12
13
  export declare const calculateOneGraphBuyCombinations: (prices: GetPricesProducts, maxLot: number, bargain: PlayerConfigBargain, prestige: PlayerConfigPrestige, roles: PlayerConfigRoles, productUnlockStatus: PlayerConfigProductUnlockStatus, playerConfigEvents: PlayerConfigEvents) => OnegraphBuyCombinations;
13
14
  export declare const getOneGraphRecommendation: (restock: number, goAndReturn: boolean, fromCity: CityName, toCity: CityName, buyCombinationsGo: OnegraphBuyCombinations, buyCombinationsRt?: OnegraphBuyCombinations) => OnegraphBuyCombinationStats[];
14
15
  export declare const getResonanceSkillBuyMorePercent: (roles: PlayerConfigRoles, product: Product, fromCity: CityName) => number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-resonance-columba-bot",
3
- "description": "雷索纳斯综合功能插件-娃娃鱼报社版",
4
- "version": "2.0.2",
3
+ "description": "雷索纳斯科伦巴商会市场查询",
4
+ "version": "3.0.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -20,6 +20,6 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "axios": "^1.7.7",
23
- "resonance-data-columba": "^1.3.105"
23
+ "resonance-data-columba": "^1.3.3"
24
24
  }
25
25
  }