🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

foxhole-warapi

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

foxhole-warapi - npm Package Compare versions

Comparing version
1.5.6
to
1.5.7
+157
index.mjs
var MapIconTypes = /* @__PURE__ */ ((MapIconTypes2) => {
MapIconTypes2[MapIconTypes2["Static_Base_1"] = 5] = "Static_Base_1";
MapIconTypes2[MapIconTypes2["Static_Base_2"] = 6] = "Static_Base_2";
MapIconTypes2[MapIconTypes2["Static_Base_3"] = 7] = "Static_Base_3";
MapIconTypes2[MapIconTypes2["Forward_Base_1"] = 8] = "Forward_Base_1";
MapIconTypes2[MapIconTypes2["Forward_Base_2"] = 9] = "Forward_Base_2";
MapIconTypes2[MapIconTypes2["Forward_Base_3"] = 10] = "Forward_Base_3";
MapIconTypes2[MapIconTypes2["Hospital"] = 11] = "Hospital";
MapIconTypes2[MapIconTypes2["Vehicle_Factory"] = 12] = "Vehicle_Factory";
MapIconTypes2[MapIconTypes2["Armory"] = 13] = "Armory";
MapIconTypes2[MapIconTypes2["Supply_Station"] = 14] = "Supply_Station";
MapIconTypes2[MapIconTypes2["Workshop"] = 15] = "Workshop";
MapIconTypes2[MapIconTypes2["Manufacturing_Plant"] = 16] = "Manufacturing_Plant";
MapIconTypes2[MapIconTypes2["Refinery"] = 17] = "Refinery";
MapIconTypes2[MapIconTypes2["Shipyard"] = 18] = "Shipyard";
MapIconTypes2[MapIconTypes2["Tech_Center"] = 19] = "Tech_Center";
MapIconTypes2[MapIconTypes2["Salvage_Field"] = 20] = "Salvage_Field";
MapIconTypes2[MapIconTypes2["Component_Field"] = 21] = "Component_Field";
MapIconTypes2[MapIconTypes2["Fuel_Field"] = 22] = "Fuel_Field";
MapIconTypes2[MapIconTypes2["Sulfur_Field"] = 23] = "Sulfur_Field";
MapIconTypes2[MapIconTypes2["World_Map_Tent"] = 24] = "World_Map_Tent";
MapIconTypes2[MapIconTypes2["Travel_Tent"] = 25] = "Travel_Tent";
MapIconTypes2[MapIconTypes2["Training_Area"] = 26] = "Training_Area";
MapIconTypes2[MapIconTypes2["Special_Base_Keep"] = 27] = "Special_Base_Keep";
MapIconTypes2[MapIconTypes2["Observation_Tower"] = 28] = "Observation_Tower";
MapIconTypes2[MapIconTypes2["Fort"] = 29] = "Fort";
MapIconTypes2[MapIconTypes2["Troop_Ship"] = 30] = "Troop_Ship";
MapIconTypes2[MapIconTypes2["Sulfur_Mine"] = 32] = "Sulfur_Mine";
MapIconTypes2[MapIconTypes2["Storage_Facility"] = 33] = "Storage_Facility";
MapIconTypes2[MapIconTypes2["Factory"] = 34] = "Factory";
MapIconTypes2[MapIconTypes2["Garrison_Station"] = 35] = "Garrison_Station";
MapIconTypes2[MapIconTypes2["Ammo_Factory"] = 36] = "Ammo_Factory";
MapIconTypes2[MapIconTypes2["Rocket_Site"] = 37] = "Rocket_Site";
MapIconTypes2[MapIconTypes2["Salvage_Mine"] = 38] = "Salvage_Mine";
MapIconTypes2[MapIconTypes2["Construction_Yard"] = 39] = "Construction_Yard";
MapIconTypes2[MapIconTypes2["Component_Mine"] = 40] = "Component_Mine";
MapIconTypes2[MapIconTypes2["Oil_Well"] = 41] = "Oil_Well";
MapIconTypes2[MapIconTypes2["Relic_Base_1"] = 45] = "Relic_Base_1";
MapIconTypes2[MapIconTypes2["Relic_Base_2"] = 46] = "Relic_Base_2";
MapIconTypes2[MapIconTypes2["Relic_Base_3"] = 47] = "Relic_Base_3";
MapIconTypes2[MapIconTypes2["Mass_Production_Factory"] = 51] = "Mass_Production_Factory";
MapIconTypes2[MapIconTypes2["Seaport"] = 52] = "Seaport";
MapIconTypes2[MapIconTypes2["Coastal_Gun"] = 53] = "Coastal_Gun";
MapIconTypes2[MapIconTypes2["Soul_Factory"] = 54] = "Soul_Factory";
MapIconTypes2[MapIconTypes2["Town_Base_1"] = 56] = "Town_Base_1";
MapIconTypes2[MapIconTypes2["Town_Base_2"] = 57] = "Town_Base_2";
MapIconTypes2[MapIconTypes2["Town_Base_3"] = 58] = "Town_Base_3";
MapIconTypes2[MapIconTypes2["Storm_Cannon"] = 59] = "Storm_Cannon";
MapIconTypes2[MapIconTypes2["Intel_Center"] = 60] = "Intel_Center";
MapIconTypes2[MapIconTypes2["Coal_Field"] = 61] = "Coal_Field";
MapIconTypes2[MapIconTypes2["Oil_Field"] = 62] = "Oil_Field";
return MapIconTypes2;
})(MapIconTypes || {});
var MapFlags = /* @__PURE__ */ ((MapFlags2) => {
MapFlags2["IsVictoryBase"] = "IsVictoryBase";
MapFlags2["IsHomeBase"] = "IsHomeBase";
MapFlags2["IsBuildSite"] = "IsBuildSite";
MapFlags2["IsScorched"] = "IsScorched";
MapFlags2["IsTownClaimed"] = "IsTownClaimed";
return MapFlags2;
})(MapFlags || {});
var EventType = /* @__PURE__ */ ((EventType2) => {
EventType2["Lost"] = "Lost";
EventType2["UnderConstruction"] = "UnderConstruction";
EventType2["ConstructionCancelled"] = "ConstructionCancelled";
EventType2["Taken"] = "Taken";
EventType2["Upgraded"] = "Upgraded";
return EventType2;
})(EventType || {});
function distanceBetweenPoints(p1, p2) {
const deltaX = p2.x - p1.x;
const deltaY = p2.y - p1.y;
const distance = Math.sqrt(deltaX ** 2 + deltaY ** 2);
return distance;
}
const mapFlagValues = {
[MapFlags.IsVictoryBase]: 1,
[MapFlags.IsHomeBase]: 2,
[MapFlags.IsBuildSite]: 4,
[MapFlags.IsScorched]: 16,
[MapFlags.IsTownClaimed]: 32
};
function findNearestTextItem(mapItem, mapTextItems) {
const distances = mapTextItems.map((item) => distanceBetweenPoints(mapItem, item));
const closest = [...distances].sort()[0];
return mapTextItems[distances.indexOf(closest)];
}
function combineDynamicWithStaticData(mapItems, mapTextItems) {
return mapItems.map((mapItem) => {
const mapTextItem = findNearestTextItem(mapItem, mapTextItems);
return {
mapItem,
mapTextItem
};
}).filter((item) => item);
}
function hasMapFlag(flags, flag) {
return (flags & mapFlagValues[flag]) !== 0;
}
function getMapFlags(flags) {
return Object.values(MapFlags).filter((flag) => hasMapFlag(flags, flag));
}
function diffCombinedMapData(data1, data2) {
const different = data2.filter((item, index) => {
return item.mapItem.flags !== data1[index].mapItem.flags || item.mapItem.teamId !== data1[index].mapItem.teamId;
});
return different.map((item) => ({
old: data1[data2.indexOf(item)],
new: item
}));
}
function determineEventStatusType(data) {
const oldFlags = getMapFlags(data.old.mapItem.flags);
const newFlags = getMapFlags(data.new.mapItem.flags);
if (oldFlags.includes(MapFlags.IsBuildSite) === false && newFlags.includes(MapFlags.IsBuildSite) === true && data.old.mapItem.teamId === "NONE" && data.new.mapItem.teamId !== "NONE") {
return {
event: EventType.UnderConstruction,
byTeam: data.new.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === true && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId !== "NONE" && data.new.mapItem.teamId !== "NONE" && data.old.mapItem.iconType !== data.new.mapItem.iconType && data.old.mapItem.teamId === data.new.mapItem.teamId) {
return {
event: EventType.Upgraded,
byTeam: data.new.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === false && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId === "NONE" && data.new.mapItem.teamId !== "NONE") {
return {
event: EventType.Taken,
byTeam: data.new.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === true && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId !== "NONE" && data.old.mapItem.teamId === data.new.mapItem.teamId) {
return {
event: EventType.Taken,
byTeam: data.new.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === false && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId !== "NONE" && data.new.mapItem.teamId === "NONE") {
return {
event: EventType.Lost,
byTeam: data.old.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === true && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId !== "NONE" && data.new.mapItem.teamId === "NONE") {
return {
event: EventType.ConstructionCancelled,
byTeam: data.old.mapItem.teamId
};
}
return void 0;
}
export { EventType, MapFlags, MapIconTypes, combineDynamicWithStaticData, determineEventStatusType, diffCombinedMapData, findNearestTextItem, getMapFlags, hasMapFlag };
//# sourceMappingURL=index.mjs.map
+5
-5

@@ -23,3 +23,3 @@ [foxhole-warapi](../README.md) / EventType

[types.ts:127](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L127)
[types.ts:127](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L127)

@@ -34,3 +34,3 @@ ___

[types.ts:125](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L125)
[types.ts:125](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L125)

@@ -45,3 +45,3 @@ ___

[types.ts:128](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L128)
[types.ts:128](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L128)

@@ -56,3 +56,3 @@ ___

[types.ts:126](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L126)
[types.ts:126](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L126)

@@ -67,2 +67,2 @@ ___

[types.ts:129](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L129)
[types.ts:129](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L129)

@@ -23,3 +23,3 @@ [foxhole-warapi](../README.md) / MapFlags

[types.ts:77](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L77)
[types.ts:77](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L77)

@@ -34,3 +34,3 @@ ___

[types.ts:76](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L76)
[types.ts:76](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L76)

@@ -45,3 +45,3 @@ ___

[types.ts:78](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L78)
[types.ts:78](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L78)

@@ -56,3 +56,3 @@ ___

[types.ts:79](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L79)
[types.ts:79](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L79)

@@ -67,2 +67,2 @@ ___

[types.ts:75](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L75)
[types.ts:75](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L75)

@@ -68,3 +68,3 @@ [foxhole-warapi](../README.md) / MapIconTypes

[types.ts:52](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L52)
[types.ts:52](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L52)

@@ -79,3 +79,3 @@ ___

[types.ts:30](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L30)
[types.ts:30](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L30)

@@ -90,3 +90,3 @@ ___

[types.ts:70](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L70)
[types.ts:70](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L70)

@@ -101,3 +101,3 @@ ___

[types.ts:63](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L63)
[types.ts:63](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L63)

@@ -112,3 +112,3 @@ ___

[types.ts:38](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L38)
[types.ts:38](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L38)

@@ -123,3 +123,3 @@ ___

[types.ts:56](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L56)
[types.ts:56](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L56)

@@ -134,3 +134,3 @@ ___

[types.ts:55](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L55)
[types.ts:55](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L55)

@@ -145,3 +145,3 @@ ___

[types.ts:50](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L50)
[types.ts:50](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L50)

@@ -156,3 +156,3 @@ ___

[types.ts:46](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L46)
[types.ts:46](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L46)

@@ -167,3 +167,3 @@ ___

[types.ts:25](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L25)
[types.ts:25](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L25)

@@ -178,3 +178,3 @@ ___

[types.ts:26](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L26)
[types.ts:26](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L26)

@@ -189,3 +189,3 @@ ___

[types.ts:27](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L27)
[types.ts:27](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L27)

@@ -200,3 +200,3 @@ ___

[types.ts:39](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L39)
[types.ts:39](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L39)

@@ -211,3 +211,3 @@ ___

[types.ts:51](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L51)
[types.ts:51](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L51)

@@ -222,3 +222,3 @@ ___

[types.ts:28](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L28)
[types.ts:28](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L28)

@@ -233,3 +233,3 @@ ___

[types.ts:69](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L69)
[types.ts:69](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L69)

@@ -244,3 +244,3 @@ ___

[types.ts:33](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L33)
[types.ts:33](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L33)

@@ -255,3 +255,3 @@ ___

[types.ts:61](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L61)
[types.ts:61](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L61)

@@ -266,3 +266,3 @@ ___

[types.ts:45](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L45)
[types.ts:45](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L45)

@@ -277,3 +277,3 @@ ___

[types.ts:71](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L71)
[types.ts:71](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L71)

@@ -288,3 +288,3 @@ ___

[types.ts:57](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L57)
[types.ts:57](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L57)

@@ -299,3 +299,3 @@ ___

[types.ts:34](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L34)
[types.ts:34](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L34)

@@ -310,3 +310,3 @@ ___

[types.ts:58](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L58)
[types.ts:58](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L58)

@@ -321,3 +321,3 @@ ___

[types.ts:59](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L59)
[types.ts:59](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L59)

@@ -332,3 +332,3 @@ ___

[types.ts:60](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L60)
[types.ts:60](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L60)

@@ -343,3 +343,3 @@ ___

[types.ts:53](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L53)
[types.ts:53](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L53)

@@ -354,3 +354,3 @@ ___

[types.ts:37](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L37)
[types.ts:37](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L37)

@@ -365,3 +365,3 @@ ___

[types.ts:54](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L54)
[types.ts:54](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L54)

@@ -376,3 +376,3 @@ ___

[types.ts:62](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L62)
[types.ts:62](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L62)

@@ -387,3 +387,3 @@ ___

[types.ts:35](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L35)
[types.ts:35](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L35)

@@ -398,3 +398,3 @@ ___

[types.ts:64](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L64)
[types.ts:64](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L64)

@@ -409,3 +409,3 @@ ___

[types.ts:44](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L44)
[types.ts:44](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L44)

@@ -420,3 +420,3 @@ ___

[types.ts:22](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L22)
[types.ts:22](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L22)

@@ -431,3 +431,3 @@ ___

[types.ts:23](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L23)
[types.ts:23](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L23)

@@ -442,3 +442,3 @@ ___

[types.ts:24](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L24)
[types.ts:24](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L24)

@@ -453,3 +453,3 @@ ___

[types.ts:49](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L49)
[types.ts:49](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L49)

@@ -464,3 +464,3 @@ ___

[types.ts:68](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L68)
[types.ts:68](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L68)

@@ -475,3 +475,3 @@ ___

[types.ts:40](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L40)
[types.ts:40](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L40)

@@ -486,3 +486,3 @@ ___

[types.ts:48](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L48)
[types.ts:48](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L48)

@@ -497,3 +497,3 @@ ___

[types.ts:31](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L31)
[types.ts:31](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L31)

@@ -508,3 +508,3 @@ ___

[types.ts:36](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L36)
[types.ts:36](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L36)

@@ -519,3 +519,3 @@ ___

[types.ts:65](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L65)
[types.ts:65](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L65)

@@ -530,3 +530,3 @@ ___

[types.ts:66](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L66)
[types.ts:66](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L66)

@@ -541,3 +541,3 @@ ___

[types.ts:67](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L67)
[types.ts:67](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L67)

@@ -552,3 +552,3 @@ ___

[types.ts:43](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L43)
[types.ts:43](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L43)

@@ -563,3 +563,3 @@ ___

[types.ts:42](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L42)
[types.ts:42](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L42)

@@ -574,3 +574,3 @@ ___

[types.ts:47](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L47)
[types.ts:47](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L47)

@@ -585,3 +585,3 @@ ___

[types.ts:29](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L29)
[types.ts:29](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L29)

@@ -596,3 +596,3 @@ ___

[types.ts:32](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L32)
[types.ts:32](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L32)

@@ -607,2 +607,2 @@ ___

[types.ts:41](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L41)
[types.ts:41](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L41)

@@ -20,3 +20,3 @@ [foxhole-warapi](../README.md) / CombinedMapData

[types.ts:109](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L109)
[types.ts:109](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L109)

@@ -31,2 +31,2 @@ ___

[types.ts:110](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L110)
[types.ts:110](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L110)

@@ -27,3 +27,3 @@ [foxhole-warapi](../README.md) / DiffedMapData

[types.ts:118](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L118)
[types.ts:118](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L118)

@@ -45,2 +45,2 @@ ___

[types.ts:114](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L114)
[types.ts:114](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L114)

@@ -20,3 +20,3 @@ [foxhole-warapi](../README.md) / Event

[types.ts:134](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L134)
[types.ts:134](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L134)

@@ -31,2 +31,2 @@ ___

[types.ts:133](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L133)
[types.ts:133](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L133)

@@ -24,3 +24,3 @@ [foxhole-warapi](../README.md) / MapData

[types.ts:95](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L95)
[types.ts:95](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L95)

@@ -35,3 +35,3 @@ ___

[types.ts:93](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L93)
[types.ts:93](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L93)

@@ -46,3 +46,3 @@ ___

[types.ts:94](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L94)
[types.ts:94](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L94)

@@ -57,3 +57,3 @@ ___

[types.ts:91](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L91)
[types.ts:91](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L91)

@@ -68,3 +68,3 @@ ___

[types.ts:92](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L92)
[types.ts:92](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L92)

@@ -79,2 +79,2 @@ ___

[types.ts:96](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L96)
[types.ts:96](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L96)

@@ -23,3 +23,3 @@ [foxhole-warapi](../README.md) / MapItem

[types.ts:87](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L87)
[types.ts:87](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L87)

@@ -34,3 +34,3 @@ ___

[types.ts:84](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L84)
[types.ts:84](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L84)

@@ -45,3 +45,3 @@ ___

[types.ts:83](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L83)
[types.ts:83](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L83)

@@ -56,3 +56,3 @@ ___

[types.ts:85](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L85)
[types.ts:85](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L85)

@@ -67,2 +67,2 @@ ___

[types.ts:86](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L86)
[types.ts:86](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L86)

@@ -22,3 +22,3 @@ [foxhole-warapi](../README.md) / MapTextItem

[types.ts:105](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L105)
[types.ts:105](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L105)

@@ -33,3 +33,3 @@ ___

[types.ts:102](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L102)
[types.ts:102](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L102)

@@ -44,3 +44,3 @@ ___

[types.ts:103](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L103)
[types.ts:103](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L103)

@@ -55,2 +55,2 @@ ___

[types.ts:104](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L104)
[types.ts:104](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L104)

@@ -25,3 +25,3 @@ [foxhole-warapi](../README.md) / WarInfo

[types.ts:8](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L8)
[types.ts:8](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L8)

@@ -36,3 +36,3 @@ ___

[types.ts:7](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L7)
[types.ts:7](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L7)

@@ -47,3 +47,3 @@ ___

[types.ts:10](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L10)
[types.ts:10](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L10)

@@ -58,3 +58,3 @@ ___

[types.ts:9](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L9)
[types.ts:9](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L9)

@@ -69,3 +69,3 @@ ___

[types.ts:4](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L4)
[types.ts:4](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L4)

@@ -80,3 +80,3 @@ ___

[types.ts:5](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L5)
[types.ts:5](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L5)

@@ -91,2 +91,2 @@ ___

[types.ts:6](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L6)
[types.ts:6](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L6)

@@ -23,3 +23,3 @@ [foxhole-warapi](../README.md) / WarReport

[types.ts:15](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L15)
[types.ts:15](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L15)

@@ -34,3 +34,3 @@ ___

[types.ts:17](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L17)
[types.ts:17](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L17)

@@ -45,3 +45,3 @@ ___

[types.ts:14](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L14)
[types.ts:14](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L14)

@@ -56,3 +56,3 @@ ___

[types.ts:18](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L18)
[types.ts:18](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L18)

@@ -67,2 +67,2 @@ ___

[types.ts:16](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L16)
[types.ts:16](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L16)

@@ -46,3 +46,3 @@ foxhole-warapi

[types.ts:99](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L99)
[types.ts:99](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L99)

@@ -57,3 +57,3 @@ ___

[types.ts:1](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/types.ts#L1)
[types.ts:1](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/types.ts#L1)

@@ -81,3 +81,3 @@ ## Functions

[war-api.ts:24](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/war-api.ts#L24)
[war-api.ts:24](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/war-api.ts#L24)

@@ -102,3 +102,3 @@ ___

[war-api.ts:74](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/war-api.ts#L74)
[war-api.ts:74](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/war-api.ts#L74)

@@ -126,3 +126,3 @@ ___

[war-api.ts:60](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/war-api.ts#L60)
[war-api.ts:60](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/war-api.ts#L60)

@@ -150,3 +150,3 @@ ___

[war-api.ts:15](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/war-api.ts#L15)
[war-api.ts:15](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/war-api.ts#L15)

@@ -173,3 +173,3 @@ ___

[war-api.ts:50](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/war-api.ts#L50)
[war-api.ts:50](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/war-api.ts#L50)

@@ -197,2 +197,2 @@ ___

[war-api.ts:42](https://github.com/art0rz/foxhole-warapi/blob/e697d5c/src/war-api.ts#L42)
[war-api.ts:42](https://github.com/art0rz/foxhole-warapi/blob/58c923c/src/war-api.ts#L42)
+167
-1

@@ -1,1 +0,167 @@

"use strict";var e,t,a,o;exports.MapIconTypes=void 0,(e=exports.MapIconTypes||(exports.MapIconTypes={}))[e.Static_Base_1=5]="Static_Base_1",e[e.Static_Base_2=6]="Static_Base_2",e[e.Static_Base_3=7]="Static_Base_3",e[e.Forward_Base_1=8]="Forward_Base_1",e[e.Forward_Base_2=9]="Forward_Base_2",e[e.Forward_Base_3=10]="Forward_Base_3",e[e.Hospital=11]="Hospital",e[e.Vehicle_Factory=12]="Vehicle_Factory",e[e.Armory=13]="Armory",e[e.Supply_Station=14]="Supply_Station",e[e.Workshop=15]="Workshop",e[e.Manufacturing_Plant=16]="Manufacturing_Plant",e[e.Refinery=17]="Refinery",e[e.Shipyard=18]="Shipyard",e[e.Tech_Center=19]="Tech_Center",e[e.Salvage_Field=20]="Salvage_Field",e[e.Component_Field=21]="Component_Field",e[e.Fuel_Field=22]="Fuel_Field",e[e.Sulfur_Field=23]="Sulfur_Field",e[e.World_Map_Tent=24]="World_Map_Tent",e[e.Travel_Tent=25]="Travel_Tent",e[e.Training_Area=26]="Training_Area",e[e.Special_Base_Keep=27]="Special_Base_Keep",e[e.Observation_Tower=28]="Observation_Tower",e[e.Fort=29]="Fort",e[e.Troop_Ship=30]="Troop_Ship",e[e.Sulfur_Mine=32]="Sulfur_Mine",e[e.Storage_Facility=33]="Storage_Facility",e[e.Factory=34]="Factory",e[e.Garrison_Station=35]="Garrison_Station",e[e.Ammo_Factory=36]="Ammo_Factory",e[e.Rocket_Site=37]="Rocket_Site",e[e.Salvage_Mine=38]="Salvage_Mine",e[e.Construction_Yard=39]="Construction_Yard",e[e.Component_Mine=40]="Component_Mine",e[e.Oil_Well=41]="Oil_Well",e[e.Relic_Base_1=45]="Relic_Base_1",e[e.Relic_Base_2=46]="Relic_Base_2",e[e.Relic_Base_3=47]="Relic_Base_3",e[e.Mass_Production_Factory=51]="Mass_Production_Factory",e[e.Seaport=52]="Seaport",e[e.Coastal_Gun=53]="Coastal_Gun",e[e.Soul_Factory=54]="Soul_Factory",e[e.Town_Base_1=56]="Town_Base_1",e[e.Town_Base_2=57]="Town_Base_2",e[e.Town_Base_3=58]="Town_Base_3",e[e.Storm_Cannon=59]="Storm_Cannon",e[e.Intel_Center=60]="Intel_Center",e[e.Coal_Field=61]="Coal_Field",e[e.Oil_Field=62]="Oil_Field",exports.MapFlags=void 0,(t=exports.MapFlags||(exports.MapFlags={})).IsVictoryBase="IsVictoryBase",t.IsHomeBase="IsHomeBase",t.IsBuildSite="IsBuildSite",t.IsScorched="IsScorched",t.IsTownClaimed="IsTownClaimed",exports.EventType=void 0,(a=exports.EventType||(exports.EventType={})).Lost="Lost",a.UnderConstruction="UnderConstruction",a.ConstructionCancelled="ConstructionCancelled",a.Taken="Taken",a.Upgraded="Upgraded";var n=((o={})[exports.MapFlags.IsVictoryBase]=1,o[exports.MapFlags.IsHomeBase]=2,o[exports.MapFlags.IsBuildSite]=4,o[exports.MapFlags.IsScorched]=16,o[exports.MapFlags.IsTownClaimed]=32,o);function r(e,t){var a=t.map((function(t){return a=e,n=(o=t).x-a.x,r=o.y-a.y,Math.sqrt(Math.pow(n,2)+Math.pow(r,2));var a,o,n,r})),o=function(e,t,a){if(a||2===arguments.length)for(var o,n=0,r=t.length;n<r;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}([],a,!0).sort()[0];return t[a.indexOf(o)]}function s(e,t){return 0!=(e&n[t])}function i(e){return Object.values(exports.MapFlags).filter((function(t){return s(e,t)}))}exports.combineDynamicWithStaticData=function(e,t){return e.map((function(e){return{mapItem:e,mapTextItem:r(e,t)}})).filter((function(e){return e}))},exports.determineEventStatusType=function(e){var t=i(e.old.mapItem.flags),a=i(e.new.mapItem.flags);return!1===t.includes(exports.MapFlags.IsBuildSite)&&!0===a.includes(exports.MapFlags.IsBuildSite)&&"NONE"===e.old.mapItem.teamId&&"NONE"!==e.new.mapItem.teamId?{event:exports.EventType.UnderConstruction,byTeam:e.new.mapItem.teamId}:!0===t.includes(exports.MapFlags.IsBuildSite)&&!1===a.includes(exports.MapFlags.IsBuildSite)&&"NONE"!==e.old.mapItem.teamId&&"NONE"!==e.new.mapItem.teamId&&e.old.mapItem.iconType!==e.new.mapItem.iconType&&e.old.mapItem.teamId===e.new.mapItem.teamId?{event:exports.EventType.Upgraded,byTeam:e.new.mapItem.teamId}:!1===t.includes(exports.MapFlags.IsBuildSite)&&!1===a.includes(exports.MapFlags.IsBuildSite)&&"NONE"===e.old.mapItem.teamId&&"NONE"!==e.new.mapItem.teamId||!0===t.includes(exports.MapFlags.IsBuildSite)&&!1===a.includes(exports.MapFlags.IsBuildSite)&&"NONE"!==e.old.mapItem.teamId&&e.old.mapItem.teamId===e.new.mapItem.teamId?{event:exports.EventType.Taken,byTeam:e.new.mapItem.teamId}:!1===t.includes(exports.MapFlags.IsBuildSite)&&!1===a.includes(exports.MapFlags.IsBuildSite)&&"NONE"!==e.old.mapItem.teamId&&"NONE"===e.new.mapItem.teamId?{event:exports.EventType.Lost,byTeam:e.old.mapItem.teamId}:!0===t.includes(exports.MapFlags.IsBuildSite)&&!1===a.includes(exports.MapFlags.IsBuildSite)&&"NONE"!==e.old.mapItem.teamId&&"NONE"===e.new.mapItem.teamId?{event:exports.EventType.ConstructionCancelled,byTeam:e.old.mapItem.teamId}:void 0},exports.diffCombinedMapData=function(e,t){return t.filter((function(t,a){return t.mapItem.flags!==e[a].mapItem.flags||t.mapItem.teamId!==e[a].mapItem.teamId})).map((function(a){return{old:e[t.indexOf(a)],new:a}}))},exports.findNearestTextItem=r,exports.getMapFlags=i,exports.hasMapFlag=s;
'use strict';
var MapIconTypes = /* @__PURE__ */ ((MapIconTypes2) => {
MapIconTypes2[MapIconTypes2["Static_Base_1"] = 5] = "Static_Base_1";
MapIconTypes2[MapIconTypes2["Static_Base_2"] = 6] = "Static_Base_2";
MapIconTypes2[MapIconTypes2["Static_Base_3"] = 7] = "Static_Base_3";
MapIconTypes2[MapIconTypes2["Forward_Base_1"] = 8] = "Forward_Base_1";
MapIconTypes2[MapIconTypes2["Forward_Base_2"] = 9] = "Forward_Base_2";
MapIconTypes2[MapIconTypes2["Forward_Base_3"] = 10] = "Forward_Base_3";
MapIconTypes2[MapIconTypes2["Hospital"] = 11] = "Hospital";
MapIconTypes2[MapIconTypes2["Vehicle_Factory"] = 12] = "Vehicle_Factory";
MapIconTypes2[MapIconTypes2["Armory"] = 13] = "Armory";
MapIconTypes2[MapIconTypes2["Supply_Station"] = 14] = "Supply_Station";
MapIconTypes2[MapIconTypes2["Workshop"] = 15] = "Workshop";
MapIconTypes2[MapIconTypes2["Manufacturing_Plant"] = 16] = "Manufacturing_Plant";
MapIconTypes2[MapIconTypes2["Refinery"] = 17] = "Refinery";
MapIconTypes2[MapIconTypes2["Shipyard"] = 18] = "Shipyard";
MapIconTypes2[MapIconTypes2["Tech_Center"] = 19] = "Tech_Center";
MapIconTypes2[MapIconTypes2["Salvage_Field"] = 20] = "Salvage_Field";
MapIconTypes2[MapIconTypes2["Component_Field"] = 21] = "Component_Field";
MapIconTypes2[MapIconTypes2["Fuel_Field"] = 22] = "Fuel_Field";
MapIconTypes2[MapIconTypes2["Sulfur_Field"] = 23] = "Sulfur_Field";
MapIconTypes2[MapIconTypes2["World_Map_Tent"] = 24] = "World_Map_Tent";
MapIconTypes2[MapIconTypes2["Travel_Tent"] = 25] = "Travel_Tent";
MapIconTypes2[MapIconTypes2["Training_Area"] = 26] = "Training_Area";
MapIconTypes2[MapIconTypes2["Special_Base_Keep"] = 27] = "Special_Base_Keep";
MapIconTypes2[MapIconTypes2["Observation_Tower"] = 28] = "Observation_Tower";
MapIconTypes2[MapIconTypes2["Fort"] = 29] = "Fort";
MapIconTypes2[MapIconTypes2["Troop_Ship"] = 30] = "Troop_Ship";
MapIconTypes2[MapIconTypes2["Sulfur_Mine"] = 32] = "Sulfur_Mine";
MapIconTypes2[MapIconTypes2["Storage_Facility"] = 33] = "Storage_Facility";
MapIconTypes2[MapIconTypes2["Factory"] = 34] = "Factory";
MapIconTypes2[MapIconTypes2["Garrison_Station"] = 35] = "Garrison_Station";
MapIconTypes2[MapIconTypes2["Ammo_Factory"] = 36] = "Ammo_Factory";
MapIconTypes2[MapIconTypes2["Rocket_Site"] = 37] = "Rocket_Site";
MapIconTypes2[MapIconTypes2["Salvage_Mine"] = 38] = "Salvage_Mine";
MapIconTypes2[MapIconTypes2["Construction_Yard"] = 39] = "Construction_Yard";
MapIconTypes2[MapIconTypes2["Component_Mine"] = 40] = "Component_Mine";
MapIconTypes2[MapIconTypes2["Oil_Well"] = 41] = "Oil_Well";
MapIconTypes2[MapIconTypes2["Relic_Base_1"] = 45] = "Relic_Base_1";
MapIconTypes2[MapIconTypes2["Relic_Base_2"] = 46] = "Relic_Base_2";
MapIconTypes2[MapIconTypes2["Relic_Base_3"] = 47] = "Relic_Base_3";
MapIconTypes2[MapIconTypes2["Mass_Production_Factory"] = 51] = "Mass_Production_Factory";
MapIconTypes2[MapIconTypes2["Seaport"] = 52] = "Seaport";
MapIconTypes2[MapIconTypes2["Coastal_Gun"] = 53] = "Coastal_Gun";
MapIconTypes2[MapIconTypes2["Soul_Factory"] = 54] = "Soul_Factory";
MapIconTypes2[MapIconTypes2["Town_Base_1"] = 56] = "Town_Base_1";
MapIconTypes2[MapIconTypes2["Town_Base_2"] = 57] = "Town_Base_2";
MapIconTypes2[MapIconTypes2["Town_Base_3"] = 58] = "Town_Base_3";
MapIconTypes2[MapIconTypes2["Storm_Cannon"] = 59] = "Storm_Cannon";
MapIconTypes2[MapIconTypes2["Intel_Center"] = 60] = "Intel_Center";
MapIconTypes2[MapIconTypes2["Coal_Field"] = 61] = "Coal_Field";
MapIconTypes2[MapIconTypes2["Oil_Field"] = 62] = "Oil_Field";
return MapIconTypes2;
})(MapIconTypes || {});
var MapFlags = /* @__PURE__ */ ((MapFlags2) => {
MapFlags2["IsVictoryBase"] = "IsVictoryBase";
MapFlags2["IsHomeBase"] = "IsHomeBase";
MapFlags2["IsBuildSite"] = "IsBuildSite";
MapFlags2["IsScorched"] = "IsScorched";
MapFlags2["IsTownClaimed"] = "IsTownClaimed";
return MapFlags2;
})(MapFlags || {});
var EventType = /* @__PURE__ */ ((EventType2) => {
EventType2["Lost"] = "Lost";
EventType2["UnderConstruction"] = "UnderConstruction";
EventType2["ConstructionCancelled"] = "ConstructionCancelled";
EventType2["Taken"] = "Taken";
EventType2["Upgraded"] = "Upgraded";
return EventType2;
})(EventType || {});
function distanceBetweenPoints(p1, p2) {
const deltaX = p2.x - p1.x;
const deltaY = p2.y - p1.y;
const distance = Math.sqrt(deltaX ** 2 + deltaY ** 2);
return distance;
}
const mapFlagValues = {
[MapFlags.IsVictoryBase]: 1,
[MapFlags.IsHomeBase]: 2,
[MapFlags.IsBuildSite]: 4,
[MapFlags.IsScorched]: 16,
[MapFlags.IsTownClaimed]: 32
};
function findNearestTextItem(mapItem, mapTextItems) {
const distances = mapTextItems.map((item) => distanceBetweenPoints(mapItem, item));
const closest = [...distances].sort()[0];
return mapTextItems[distances.indexOf(closest)];
}
function combineDynamicWithStaticData(mapItems, mapTextItems) {
return mapItems.map((mapItem) => {
const mapTextItem = findNearestTextItem(mapItem, mapTextItems);
return {
mapItem,
mapTextItem
};
}).filter((item) => item);
}
function hasMapFlag(flags, flag) {
return (flags & mapFlagValues[flag]) !== 0;
}
function getMapFlags(flags) {
return Object.values(MapFlags).filter((flag) => hasMapFlag(flags, flag));
}
function diffCombinedMapData(data1, data2) {
const different = data2.filter((item, index) => {
return item.mapItem.flags !== data1[index].mapItem.flags || item.mapItem.teamId !== data1[index].mapItem.teamId;
});
return different.map((item) => ({
old: data1[data2.indexOf(item)],
new: item
}));
}
function determineEventStatusType(data) {
const oldFlags = getMapFlags(data.old.mapItem.flags);
const newFlags = getMapFlags(data.new.mapItem.flags);
if (oldFlags.includes(MapFlags.IsBuildSite) === false && newFlags.includes(MapFlags.IsBuildSite) === true && data.old.mapItem.teamId === "NONE" && data.new.mapItem.teamId !== "NONE") {
return {
event: EventType.UnderConstruction,
byTeam: data.new.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === true && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId !== "NONE" && data.new.mapItem.teamId !== "NONE" && data.old.mapItem.iconType !== data.new.mapItem.iconType && data.old.mapItem.teamId === data.new.mapItem.teamId) {
return {
event: EventType.Upgraded,
byTeam: data.new.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === false && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId === "NONE" && data.new.mapItem.teamId !== "NONE") {
return {
event: EventType.Taken,
byTeam: data.new.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === true && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId !== "NONE" && data.old.mapItem.teamId === data.new.mapItem.teamId) {
return {
event: EventType.Taken,
byTeam: data.new.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === false && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId !== "NONE" && data.new.mapItem.teamId === "NONE") {
return {
event: EventType.Lost,
byTeam: data.old.mapItem.teamId
};
}
if (oldFlags.includes(MapFlags.IsBuildSite) === true && newFlags.includes(MapFlags.IsBuildSite) === false && data.old.mapItem.teamId !== "NONE" && data.new.mapItem.teamId === "NONE") {
return {
event: EventType.ConstructionCancelled,
byTeam: data.old.mapItem.teamId
};
}
return void 0;
}
exports.EventType = EventType;
exports.MapFlags = MapFlags;
exports.MapIconTypes = MapIconTypes;
exports.combineDynamicWithStaticData = combineDynamicWithStaticData;
exports.determineEventStatusType = determineEventStatusType;
exports.diffCombinedMapData = diffCombinedMapData;
exports.findNearestTextItem = findNearestTextItem;
exports.getMapFlags = getMapFlags;
exports.hasMapFlag = hasMapFlag;
//# sourceMappingURL=index.js.map
{
"name": "foxhole-warapi",
"version": "1.5.6",
"version": "1.5.7",
"description": "Foxhole WarAPI utilities and types",
"source": "src/index.ts",
"main": "index.js",
"types": "index.d.ts",
"module": "index.es.js",
"browser": "index.browser.js",
"module": "index.mjs",
"scripts": {

@@ -23,4 +23,3 @@ "test": "jest",

"index.d.ts",
"index.es.js",
"index.browser.js",
"index.mjs",
"docs"

@@ -33,4 +32,2 @@ ],

"@commitlint/config-conventional": "^17.4.4",
"@rollup/plugin-terser": "^0.4.0",
"@rollup/plugin-typescript": "^11.0.0",
"@semantic-release/changelog": "^6.0.2",

@@ -61,2 +58,3 @@ "@semantic-release/commit-analyzer": "^9.0.2",

"rollup-plugin-dts": "^5.2.0",
"rollup-plugin-esbuild": "^5.0.0",
"semantic-release": "^20.1.0",

@@ -63,0 +61,0 @@ "tslib": "^2.5.0",

var FoxholeWarAPI=function(e){"use strict";var a,t,n,i;e.MapIconTypes=void 0,(a=e.MapIconTypes||(e.MapIconTypes={}))[a.Static_Base_1=5]="Static_Base_1",a[a.Static_Base_2=6]="Static_Base_2",a[a.Static_Base_3=7]="Static_Base_3",a[a.Forward_Base_1=8]="Forward_Base_1",a[a.Forward_Base_2=9]="Forward_Base_2",a[a.Forward_Base_3=10]="Forward_Base_3",a[a.Hospital=11]="Hospital",a[a.Vehicle_Factory=12]="Vehicle_Factory",a[a.Armory=13]="Armory",a[a.Supply_Station=14]="Supply_Station",a[a.Workshop=15]="Workshop",a[a.Manufacturing_Plant=16]="Manufacturing_Plant",a[a.Refinery=17]="Refinery",a[a.Shipyard=18]="Shipyard",a[a.Tech_Center=19]="Tech_Center",a[a.Salvage_Field=20]="Salvage_Field",a[a.Component_Field=21]="Component_Field",a[a.Fuel_Field=22]="Fuel_Field",a[a.Sulfur_Field=23]="Sulfur_Field",a[a.World_Map_Tent=24]="World_Map_Tent",a[a.Travel_Tent=25]="Travel_Tent",a[a.Training_Area=26]="Training_Area",a[a.Special_Base_Keep=27]="Special_Base_Keep",a[a.Observation_Tower=28]="Observation_Tower",a[a.Fort=29]="Fort",a[a.Troop_Ship=30]="Troop_Ship",a[a.Sulfur_Mine=32]="Sulfur_Mine",a[a.Storage_Facility=33]="Storage_Facility",a[a.Factory=34]="Factory",a[a.Garrison_Station=35]="Garrison_Station",a[a.Ammo_Factory=36]="Ammo_Factory",a[a.Rocket_Site=37]="Rocket_Site",a[a.Salvage_Mine=38]="Salvage_Mine",a[a.Construction_Yard=39]="Construction_Yard",a[a.Component_Mine=40]="Component_Mine",a[a.Oil_Well=41]="Oil_Well",a[a.Relic_Base_1=45]="Relic_Base_1",a[a.Relic_Base_2=46]="Relic_Base_2",a[a.Relic_Base_3=47]="Relic_Base_3",a[a.Mass_Production_Factory=51]="Mass_Production_Factory",a[a.Seaport=52]="Seaport",a[a.Coastal_Gun=53]="Coastal_Gun",a[a.Soul_Factory=54]="Soul_Factory",a[a.Town_Base_1=56]="Town_Base_1",a[a.Town_Base_2=57]="Town_Base_2",a[a.Town_Base_3=58]="Town_Base_3",a[a.Storm_Cannon=59]="Storm_Cannon",a[a.Intel_Center=60]="Intel_Center",a[a.Coal_Field=61]="Coal_Field",a[a.Oil_Field=62]="Oil_Field",e.MapFlags=void 0,(t=e.MapFlags||(e.MapFlags={})).IsVictoryBase="IsVictoryBase",t.IsHomeBase="IsHomeBase",t.IsBuildSite="IsBuildSite",t.IsScorched="IsScorched",t.IsTownClaimed="IsTownClaimed",e.EventType=void 0,(n=e.EventType||(e.EventType={})).Lost="Lost",n.UnderConstruction="UnderConstruction",n.ConstructionCancelled="ConstructionCancelled",n.Taken="Taken",n.Upgraded="Upgraded";var o=((i={})[e.MapFlags.IsVictoryBase]=1,i[e.MapFlags.IsHomeBase]=2,i[e.MapFlags.IsBuildSite]=4,i[e.MapFlags.IsScorched]=16,i[e.MapFlags.IsTownClaimed]=32,i);function l(e,a){var t=a.map((function(a){return t=e,i=(n=a).x-t.x,o=n.y-t.y,Math.sqrt(Math.pow(i,2)+Math.pow(o,2));var t,n,i,o})),n=function(e,a,t){if(t||2===arguments.length)for(var n,i=0,o=a.length;i<o;i++)!n&&i in a||(n||(n=Array.prototype.slice.call(a,0,i)),n[i]=a[i]);return e.concat(n||Array.prototype.slice.call(a))}([],t,!0).sort()[0];return a[t.indexOf(n)]}function r(e,a){return 0!=(e&o[a])}function s(a){return Object.values(e.MapFlags).filter((function(e){return r(a,e)}))}return e.combineDynamicWithStaticData=function(e,a){return e.map((function(e){return{mapItem:e,mapTextItem:l(e,a)}})).filter((function(e){return e}))},e.determineEventStatusType=function(a){var t=s(a.old.mapItem.flags),n=s(a.new.mapItem.flags);return!1===t.includes(e.MapFlags.IsBuildSite)&&!0===n.includes(e.MapFlags.IsBuildSite)&&"NONE"===a.old.mapItem.teamId&&"NONE"!==a.new.mapItem.teamId?{event:e.EventType.UnderConstruction,byTeam:a.new.mapItem.teamId}:!0===t.includes(e.MapFlags.IsBuildSite)&&!1===n.includes(e.MapFlags.IsBuildSite)&&"NONE"!==a.old.mapItem.teamId&&"NONE"!==a.new.mapItem.teamId&&a.old.mapItem.iconType!==a.new.mapItem.iconType&&a.old.mapItem.teamId===a.new.mapItem.teamId?{event:e.EventType.Upgraded,byTeam:a.new.mapItem.teamId}:!1===t.includes(e.MapFlags.IsBuildSite)&&!1===n.includes(e.MapFlags.IsBuildSite)&&"NONE"===a.old.mapItem.teamId&&"NONE"!==a.new.mapItem.teamId||!0===t.includes(e.MapFlags.IsBuildSite)&&!1===n.includes(e.MapFlags.IsBuildSite)&&"NONE"!==a.old.mapItem.teamId&&a.old.mapItem.teamId===a.new.mapItem.teamId?{event:e.EventType.Taken,byTeam:a.new.mapItem.teamId}:!1===t.includes(e.MapFlags.IsBuildSite)&&!1===n.includes(e.MapFlags.IsBuildSite)&&"NONE"!==a.old.mapItem.teamId&&"NONE"===a.new.mapItem.teamId?{event:e.EventType.Lost,byTeam:a.old.mapItem.teamId}:!0===t.includes(e.MapFlags.IsBuildSite)&&!1===n.includes(e.MapFlags.IsBuildSite)&&"NONE"!==a.old.mapItem.teamId&&"NONE"===a.new.mapItem.teamId?{event:e.EventType.ConstructionCancelled,byTeam:a.old.mapItem.teamId}:void 0},e.diffCombinedMapData=function(e,a){return a.filter((function(a,t){return a.mapItem.flags!==e[t].mapItem.flags||a.mapItem.teamId!==e[t].mapItem.teamId})).map((function(t){return{old:e[a.indexOf(t)],new:t}}))},e.findNearestTextItem=l,e.getMapFlags=s,e.hasMapFlag=r,e}({});
var e,t,a,n;!function(e){e[e.Static_Base_1=5]="Static_Base_1",e[e.Static_Base_2=6]="Static_Base_2",e[e.Static_Base_3=7]="Static_Base_3",e[e.Forward_Base_1=8]="Forward_Base_1",e[e.Forward_Base_2=9]="Forward_Base_2",e[e.Forward_Base_3=10]="Forward_Base_3",e[e.Hospital=11]="Hospital",e[e.Vehicle_Factory=12]="Vehicle_Factory",e[e.Armory=13]="Armory",e[e.Supply_Station=14]="Supply_Station",e[e.Workshop=15]="Workshop",e[e.Manufacturing_Plant=16]="Manufacturing_Plant",e[e.Refinery=17]="Refinery",e[e.Shipyard=18]="Shipyard",e[e.Tech_Center=19]="Tech_Center",e[e.Salvage_Field=20]="Salvage_Field",e[e.Component_Field=21]="Component_Field",e[e.Fuel_Field=22]="Fuel_Field",e[e.Sulfur_Field=23]="Sulfur_Field",e[e.World_Map_Tent=24]="World_Map_Tent",e[e.Travel_Tent=25]="Travel_Tent",e[e.Training_Area=26]="Training_Area",e[e.Special_Base_Keep=27]="Special_Base_Keep",e[e.Observation_Tower=28]="Observation_Tower",e[e.Fort=29]="Fort",e[e.Troop_Ship=30]="Troop_Ship",e[e.Sulfur_Mine=32]="Sulfur_Mine",e[e.Storage_Facility=33]="Storage_Facility",e[e.Factory=34]="Factory",e[e.Garrison_Station=35]="Garrison_Station",e[e.Ammo_Factory=36]="Ammo_Factory",e[e.Rocket_Site=37]="Rocket_Site",e[e.Salvage_Mine=38]="Salvage_Mine",e[e.Construction_Yard=39]="Construction_Yard",e[e.Component_Mine=40]="Component_Mine",e[e.Oil_Well=41]="Oil_Well",e[e.Relic_Base_1=45]="Relic_Base_1",e[e.Relic_Base_2=46]="Relic_Base_2",e[e.Relic_Base_3=47]="Relic_Base_3",e[e.Mass_Production_Factory=51]="Mass_Production_Factory",e[e.Seaport=52]="Seaport",e[e.Coastal_Gun=53]="Coastal_Gun",e[e.Soul_Factory=54]="Soul_Factory",e[e.Town_Base_1=56]="Town_Base_1",e[e.Town_Base_2=57]="Town_Base_2",e[e.Town_Base_3=58]="Town_Base_3",e[e.Storm_Cannon=59]="Storm_Cannon",e[e.Intel_Center=60]="Intel_Center",e[e.Coal_Field=61]="Coal_Field",e[e.Oil_Field=62]="Oil_Field"}(e||(e={})),function(e){e.IsVictoryBase="IsVictoryBase",e.IsHomeBase="IsHomeBase",e.IsBuildSite="IsBuildSite",e.IsScorched="IsScorched",e.IsTownClaimed="IsTownClaimed"}(t||(t={})),function(e){e.Lost="Lost",e.UnderConstruction="UnderConstruction",e.ConstructionCancelled="ConstructionCancelled",e.Taken="Taken",e.Upgraded="Upgraded"}(a||(a={}));var i=((n={})[t.IsVictoryBase]=1,n[t.IsHomeBase]=2,n[t.IsBuildSite]=4,n[t.IsScorched]=16,n[t.IsTownClaimed]=32,n);function o(e,t){var a=t.map((function(t){return a=e,i=(n=t).x-a.x,o=n.y-a.y,Math.sqrt(Math.pow(i,2)+Math.pow(o,2));var a,n,i,o})),n=function(e,t,a){if(a||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([],a,!0).sort()[0];return t[a.indexOf(n)]}function r(e,t){return e.map((function(e){return{mapItem:e,mapTextItem:o(e,t)}})).filter((function(e){return e}))}function l(e,t){return 0!=(e&i[t])}function _(e){return Object.values(t).filter((function(t){return l(e,t)}))}function d(e,t){return t.filter((function(t,a){return t.mapItem.flags!==e[a].mapItem.flags||t.mapItem.teamId!==e[a].mapItem.teamId})).map((function(a){return{old:e[t.indexOf(a)],new:a}}))}function m(e){var n=_(e.old.mapItem.flags),i=_(e.new.mapItem.flags);return!1===n.includes(t.IsBuildSite)&&!0===i.includes(t.IsBuildSite)&&"NONE"===e.old.mapItem.teamId&&"NONE"!==e.new.mapItem.teamId?{event:a.UnderConstruction,byTeam:e.new.mapItem.teamId}:!0===n.includes(t.IsBuildSite)&&!1===i.includes(t.IsBuildSite)&&"NONE"!==e.old.mapItem.teamId&&"NONE"!==e.new.mapItem.teamId&&e.old.mapItem.iconType!==e.new.mapItem.iconType&&e.old.mapItem.teamId===e.new.mapItem.teamId?{event:a.Upgraded,byTeam:e.new.mapItem.teamId}:!1===n.includes(t.IsBuildSite)&&!1===i.includes(t.IsBuildSite)&&"NONE"===e.old.mapItem.teamId&&"NONE"!==e.new.mapItem.teamId||!0===n.includes(t.IsBuildSite)&&!1===i.includes(t.IsBuildSite)&&"NONE"!==e.old.mapItem.teamId&&e.old.mapItem.teamId===e.new.mapItem.teamId?{event:a.Taken,byTeam:e.new.mapItem.teamId}:!1===n.includes(t.IsBuildSite)&&!1===i.includes(t.IsBuildSite)&&"NONE"!==e.old.mapItem.teamId&&"NONE"===e.new.mapItem.teamId?{event:a.Lost,byTeam:e.old.mapItem.teamId}:!0===n.includes(t.IsBuildSite)&&!1===i.includes(t.IsBuildSite)&&"NONE"!==e.old.mapItem.teamId&&"NONE"===e.new.mapItem.teamId?{event:a.ConstructionCancelled,byTeam:e.old.mapItem.teamId}:void 0}export{a as EventType,t as MapFlags,e as MapIconTypes,r as combineDynamicWithStaticData,m as determineEventStatusType,d as diffCombinedMapData,o as findNearestTextItem,_ as getMapFlags,l as hasMapFlag};