this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

initial parsing of 'Primaries' table done

nnuuvv 7b6a66f1

+333
+23
.github/workflows/test.yml
··· 1 + name: test 2 + 3 + on: 4 + push: 5 + branches: 6 + - master 7 + - main 8 + pull_request: 9 + 10 + jobs: 11 + test: 12 + runs-on: ubuntu-latest 13 + steps: 14 + - uses: actions/checkout@v4 15 + - uses: erlef/setup-beam@v1 16 + with: 17 + otp-version: "27.1.2" 18 + gleam-version: "1.11.1" 19 + rebar3-version: "3" 20 + # elixir-version: "1" 21 + - run: gleam deps download 22 + - run: gleam test 23 + - run: gleam format --check src test
+4
.gitignore
··· 1 + *.beam 2 + *.ez 3 + /build 4 + erl_crash.dump
+24
README.md
··· 1 + # condition_overload 2 + 3 + [![Package Version](https://img.shields.io/hexpm/v/condition_overload)](https://hex.pm/packages/condition_overload) 4 + [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/condition_overload/) 5 + 6 + ```sh 7 + gleam add condition_overload@1 8 + ``` 9 + ```gleam 10 + import condition_overload 11 + 12 + pub fn main() -> Nil { 13 + // TODO: An example of the project in use 14 + } 15 + ``` 16 + 17 + Further documentation can be found at <https://hexdocs.pm/condition_overload>. 18 + 19 + ## Development 20 + 21 + ```sh 22 + gleam run # Run the project 23 + gleam test # Run the tests 24 + ```
+25
gleam.toml
··· 1 + name = "condition_overload" 2 + version = "1.0.0" 3 + 4 + # Fill out these fields if you intend to generate HTML documentation or publish 5 + # your project to the Hex package manager. 6 + # 7 + # description = "" 8 + # licences = ["Apache-2.0"] 9 + # repository = { type = "github", user = "", repo = "" } 10 + # links = [{ title = "Website", href = "" }] 11 + # 12 + # For a full reference of all the available options, you can have a look at 13 + # https://gleam.run/writing-gleam/gleam-toml/. 14 + 15 + [dependencies] 16 + gleam_stdlib = ">= 0.44.0 and < 2.0.0" 17 + gleam_http = ">= 4.1.1 and < 5.0.0" 18 + gleam_httpc = ">= 5.0.0 and < 6.0.0" 19 + gleam_hackney = ">= 1.3.1 and < 2.0.0" 20 + shellout = ">= 1.7.0 and < 2.0.0" 21 + html_parser = ">= 1.0.1 and < 2.0.0" 22 + splitter = ">= 1.0.0 and < 2.0.0" 23 + 24 + [dev-dependencies] 25 + gleeunit = ">= 1.0.0 and < 2.0.0"
+32
manifest.toml
··· 1 + # This file was generated by Gleam 2 + # You typically do not need to edit this file 3 + 4 + packages = [ 5 + { name = "certifi", version = "2.15.0", build_tools = ["rebar3"], requirements = [], otp_app = "certifi", source = "hex", outer_checksum = "B147ED22CE71D72EAFDAD94F055165C1C182F61A2FF49DF28BCC71D1D5B94A60" }, 6 + { name = "gleam_erlang", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "F91CE62A2D011FA13341F3723DB7DB118541AAA5FE7311BD2716D018F01EF9E3" }, 7 + { name = "gleam_hackney", version = "1.3.1", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_stdlib", "hackney"], otp_app = "gleam_hackney", source = "hex", outer_checksum = "0449AADBEBF3E979509A4079EE34B92EEE4162C5A0DC94F3DA2787E4777F6B45" }, 8 + { name = "gleam_http", version = "4.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "DD0271B32C356FB684EC7E9F48B1E835D0480168848581F68983C0CC371405D4" }, 9 + { name = "gleam_httpc", version = "5.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gleam_httpc", source = "hex", outer_checksum = "C545172618D07811494E97AAA4A0FB34DA6F6D0061FDC8041C2F8E3BE2B2E48F" }, 10 + { name = "gleam_stdlib", version = "0.62.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "DC8872BC0B8550F6E22F0F698CFE7F1E4BDA7312FDEB40D6C3F44C5B706C8310" }, 11 + { name = "gleeunit", version = "1.6.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "FDC68A8C492B1E9B429249062CD9BAC9B5538C6FBF584817205D0998C42E1DAC" }, 12 + { name = "hackney", version = "1.25.0", build_tools = ["rebar3"], requirements = ["certifi", "idna", "metrics", "mimerl", "parse_trans", "ssl_verify_fun", "unicode_util_compat"], otp_app = "hackney", source = "hex", outer_checksum = "7209BFD75FD1F42467211FF8F59EA74D6F2A9E81CBCEE95A56711EE79FD6B1D4" }, 13 + { name = "html_parser", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "html_parser", source = "hex", outer_checksum = "EEC0A3891CE99A49A8BB99086A06F56441D2ACF9436CE33ADBE51CE277D2D607" }, 14 + { name = "idna", version = "6.1.1", build_tools = ["rebar3"], requirements = ["unicode_util_compat"], otp_app = "idna", source = "hex", outer_checksum = "92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA" }, 15 + { name = "metrics", version = "1.0.1", build_tools = ["rebar3"], requirements = [], otp_app = "metrics", source = "hex", outer_checksum = "69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16" }, 16 + { name = "mimerl", version = "1.4.0", build_tools = ["rebar3"], requirements = [], otp_app = "mimerl", source = "hex", outer_checksum = "13AF15F9F68C65884ECCA3A3891D50A7B57D82152792F3E19D88650AA126B144" }, 17 + { name = "parse_trans", version = "3.4.1", build_tools = ["rebar3"], requirements = [], otp_app = "parse_trans", source = "hex", outer_checksum = "620A406CE75DADA827B82E453C19CF06776BE266F5A67CFF34E1EF2CBB60E49A" }, 18 + { name = "shellout", version = "1.7.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "shellout", source = "hex", outer_checksum = "1BDC03438FEB97A6AF3E396F4ABEB32BECF20DF2452EC9A8C0ACEB7BDDF70B14" }, 19 + { name = "splitter", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "splitter", source = "hex", outer_checksum = "128FC521EE33B0012E3E64D5B55168586BC1B9C8D7B0D0CA223B68B0D770A547" }, 20 + { name = "ssl_verify_fun", version = "1.1.7", build_tools = ["mix", "rebar3", "make"], requirements = [], otp_app = "ssl_verify_fun", source = "hex", outer_checksum = "FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8" }, 21 + { name = "unicode_util_compat", version = "0.7.1", build_tools = ["rebar3"], requirements = [], otp_app = "unicode_util_compat", source = "hex", outer_checksum = "B3A917854CE3AE233619744AD1E0102E05673136776FB2FA76234F3E03B23642" }, 22 + ] 23 + 24 + [requirements] 25 + gleam_hackney = { version = ">= 1.3.1 and < 2.0.0" } 26 + gleam_http = { version = ">= 4.1.1 and < 5.0.0" } 27 + gleam_httpc = { version = ">= 5.0.0 and < 6.0.0" } 28 + gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" } 29 + gleeunit = { version = ">= 1.0.0 and < 2.0.0" } 30 + html_parser = { version = ">= 1.0.1 and < 2.0.0" } 31 + shellout = { version = ">= 1.7.0 and < 2.0.0" } 32 + splitter = { version = ">= 1.0.0 and < 2.0.0" }
+212
src/condition_overload.gleam
··· 1 + import gleam/http/request 2 + import gleam/httpc 3 + import gleam/list 4 + import gleam/pair 5 + import gleam/result 6 + import gleam/string 7 + import html_parser 8 + import shellout 9 + import splitter 10 + 11 + pub fn main() { 12 + use shell_result <- result.try( 13 + shellout.command( 14 + run: "curl", 15 + with: [ 16 + "https://wiki.warframe.com/w/Condition_Overload_(Mechanic)?action=edit&section=7", 17 + "--silent", 18 + ], 19 + in: ".", 20 + opt: [], 21 + ), 22 + ) 23 + 24 + let _ = 25 + shell_result 26 + |> get_text_area() 27 + |> result.map(parse_text_area) 28 + |> result.unwrap([]) 29 + |> list.map(fn(x) { echo x }) 30 + //|> echo 31 + 32 + Ok(Nil) 33 + } 34 + 35 + // discards the html and returns only the raw text from the textarea 36 + // 37 + fn get_text_area(html_text: String) -> Result(String, Nil) { 38 + html_text 39 + // trim to start of textarea 40 + |> string.split_once("<textarea") 41 + |> result.map(pair.second) 42 + // remove rest of tag 43 + |> result.try(string.split_once(_, "\">")) 44 + |> result.map(pair.second) 45 + // remove stuff after 46 + |> result.try(string.split_once(_, "</textarea>")) 47 + |> result.map(pair.first) 48 + } 49 + 50 + fn parse_text_area(textarea: String) { 51 + textarea 52 + |> string.split("\n") 53 + |> list.map(string.trim) 54 + |> process_lines([]) 55 + } 56 + 57 + type Row { 58 + Row( 59 + names: List(String), 60 + attack: String, 61 + projectile: String, 62 + base_damage: String, 63 + co_bonus_at_100: String, 64 + co_bonos_rel_base: String, 65 + math_behavior: String, 66 + notes: String, 67 + ) 68 + } 69 + 70 + // Parse single line entires into Row type 71 + // 72 + // !Weapon!!Attack Name!!Projectile Type!!Attack Unmodded Damage!!Actual CO Damage Bonus at +100%!!CO Damage Bonus Relative To Base Damage!!Math/Behavior Type!!Notes 73 + // 74 + // single name 75 + // 76 + // |{{Weapon|Ambassador}}||Alt-fire Hitscan AoE||AoE||800||600||75%||Adding||Radial hit only receives CO bonus on target directly hit by laser. CO-bonus scales off hitscan damage. AoE does not scale off multishot. 77 + // 78 + // multi name 79 + // 80 + // |{{Weapon|Braton}}/{{Weapon|MK1-Braton|MK1}}/{{Weapon|Braton Prime|Prime}}/{{Weapon|Braton Vandal|Vandal}}||Incarnon Form AoE||AoE||74||70||95%||Adding||Listed values for Braton Prime with inactive Daring Reverie. Radial hit only receives CO bonus on target directly hit by bullet. AoE does not scale off multishot. 81 + // 82 + fn parse_line(line: String) -> Row { 83 + echo line 84 + let #(names, rest) = parse_names(line, []) 85 + 86 + let sep = splitter.new(["||"]) 87 + 88 + let #(attack, _, rest) = splitter.split(sep, rest) 89 + let #(projectile, _, rest) = splitter.split(sep, rest) 90 + let #(base_damage, _, rest) = splitter.split(sep, rest) 91 + let #(co_bonus_at_100, _, rest) = splitter.split(sep, rest) 92 + let #(co_bonos_rel_base, _, rest) = splitter.split(sep, rest) 93 + let #(math_behavior, _, rest) = splitter.split(sep, rest) 94 + let #(notes, _, _) = splitter.split(sep, rest) 95 + Row( 96 + names:, 97 + attack:, 98 + projectile:, 99 + base_damage:, 100 + co_bonus_at_100:, 101 + co_bonos_rel_base:, 102 + math_behavior:, 103 + notes:, 104 + ) 105 + } 106 + 107 + // Parse data line by line from the following formats: 108 + // 109 + // !Weapon!!Attack Name!!Projectile Type!!Attack Unmodded Damage!!Actual CO Damage Bonus at +100%!!CO Damage Bonus Relative To Base Damage!!Math/Behavior Type!!Notes 110 + // 111 + // single name - one line 112 + // 113 + // |{{Weapon|Ambassador}}||Alt-fire Hitscan AoE||AoE||800||600||75%||Adding||Radial hit only receives CO bonus on target directly hit by laser. CO-bonus scales off hitscan damage. AoE does not scale off multishot. 114 + // |- 115 + // 116 + // multi name - one line 117 + // 118 + // |{{Weapon|Braton}}/{{Weapon|MK1-Braton|MK1}}/{{Weapon|Braton Prime|Prime}}/{{Weapon|Braton Vandal|Vandal}}||Incarnon Form AoE||AoE||74||70||95%||Adding||Listed values for Braton Prime with inactive Daring Reverie. Radial hit only receives CO bonus on target directly hit by bullet. AoE does not scale off multishot. 119 + // |- 120 + // 121 + // multi line - single & multi name 122 + // 123 + // |{{Weapon|Evensong}} 124 + // |Charged Radial Attack 125 + // |AoE 126 + // |150 127 + // |0 128 + // |0% 129 + // |N/A 130 + // |Does not apply 131 + // |- 132 + // 133 + // into row type 134 + // 135 + // |- 136 + // 137 + fn process_lines(lines: List(String), acc: List(Row)) -> List(Row) { 138 + case lines { 139 + ["|{{Weapon|" <> name_line, ..rest] -> { 140 + let row = case rest { 141 + ["|-", ..] -> { 142 + parse_line(name_line) 143 + } 144 + [] | _ -> { 145 + let #(names, _) = parse_names(name_line, []) 146 + let row = parse_values_vertical(names, rest) 147 + row 148 + } 149 + } 150 + 151 + process_lines(rest, [row, ..acc]) 152 + } 153 + [_, ..rest] -> process_lines(rest, acc) 154 + [] -> acc 155 + } 156 + } 157 + 158 + // multi line - single & multi name 159 + // 160 + // |{{Weapon|Evensong}} 161 + // |Charged Radial Attack 162 + // |AoE 163 + // |150 164 + // |0 165 + // |0% 166 + // |N/A 167 + // |Does not apply 168 + // |- 169 + // 170 + fn parse_values_vertical(names: List(String), lines: List(String)) -> Row { 171 + let #(attack, rest) = parse_value(lines) 172 + let #(projectile, rest) = parse_value(rest) 173 + let #(base_damage, rest) = parse_value(rest) 174 + let #(co_bonus_at_100, rest) = parse_value(rest) 175 + let #(co_bonos_rel_base, rest) = parse_value(rest) 176 + let #(math_behavior, rest) = parse_value(rest) 177 + let #(notes, _) = parse_value(rest) 178 + 179 + Row( 180 + names:, 181 + attack:, 182 + projectile:, 183 + base_damage:, 184 + co_bonus_at_100:, 185 + co_bonos_rel_base:, 186 + math_behavior:, 187 + notes:, 188 + ) 189 + } 190 + 191 + // read values one at a time until the next |- 192 + // 193 + fn parse_value(lines: List(String)) { 194 + case lines { 195 + ["|-", ..] -> #("", lines) 196 + ["|" <> value, ..rest] -> #(value, rest) 197 + [] | [_] | [_, _, ..] -> #("", lines) 198 + } 199 + } 200 + 201 + // process the weapon names 202 + // 203 + fn parse_names(line: String, acc) { 204 + let sep = splitter.new(["}}/{{Weapon|", "}}/{{Weapon", "}}||", "}}"]) 205 + 206 + let #(name, split_by, rest) = splitter.split(sep, line) 207 + 208 + case split_by { 209 + "}}/{{Weapon|" | "}}/{{Weapon" -> parse_names(rest, [name, ..acc]) 210 + _ -> #([name, ..acc], rest) 211 + } 212 + }
+13
test/condition_overload_test.gleam
··· 1 + import gleeunit 2 + 3 + pub fn main() -> Nil { 4 + gleeunit.main() 5 + } 6 + 7 + // gleeunit test functions end in `_test` 8 + pub fn hello_world_test() { 9 + let name = "Joe" 10 + let greeting = "Hello, " <> name <> "!" 11 + 12 + assert greeting == "Hello, Joe!" 13 + }