Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pkmn/protocol

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pkmn/protocol - npm Package Compare versions

Comparing version 0.6.16 to 0.6.17

build/chunk-AOPJI3RU.mjs

4

build/index.js
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkKG2Q3BKOjs = require('./chunk-KG2Q3BKO.js');
var _chunkMJQWQGPXjs = require('./chunk-MJQWQGPX.js');
exports.Protocol = _chunkKG2Q3BKOjs.Protocol;
exports.Protocol = _chunkMJQWQGPXjs.Protocol;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

window.pkmn=window.pkmn||{};window.pkmn.protocol=(()=>{var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var A=(o,e)=>{for(var t in e)d(o,t,{get:e[t],enumerable:!0})},f=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of g(e))!u.call(o,a)&&a!==t&&d(o,a,{get:()=>e[a],enumerable:!(r=y(e,a))||r.enumerable});return o};var N=o=>f(d({},"__esModule",{value:!0}),o);var T={};A(T,{Protocol:()=>c});function p(o){return(""+o).toLowerCase().replace(/[^a-z0-9]+/g,"")}var c=new class{constructor(){this.ARGS={"|init|":1,"|title|":1,"|userlist|":1,"||":1,"|html|":1,"|uhtml|":1,"|uhtmlchange|":1,"|join|":1,"|leave|":1,"|name|":1,"|chat|":1,"|notify|":1,"|:|":1,"|c:|":1,"|t:|":1,"|battle|":1,"|popup|":1,"|pm|":1,"|usercount|":1,"|nametaken|":1,"|challstr|":1,"|updateuser|":1,"|formats|":1,"|updatesearch|":1,"|message|":1,"|updatechallenges|":1,"|queryresponse|":1,"|unlink|":1,"|raw|":1,"|error|":1,"|bigerror|":1,"|chatmsg|":1,"|chatmsg-raw|":1,"|controlshtml|":1,"|fieldhtml|":1,"|debug|":1,"|deinit|":1,"|selectorhtml|":1,"|refresh|":1,"|tempnotify|":1,"|tempnotifyoff|":1,"|noinit|":1,"|hidelines|":1,"|expire|":1,"|askreg|":1,"|tournament|create|":1,"|tournament|update|":1,"|tournament|updateEnd|":1,"|tournament|error|":1,"|tournament|forceend|":1,"|tournament|join|":1,"|tournament|leave|":1,"|tournament|replace|":1,"|tournament|start|":1,"|tournament|disqualify|":1,"|tournament|battlestart|":1,"|tournament|battleend|":1,"|tournament|end|":1,"|tournament|scouting|":1,"|tournament|autostart|":1,"|tournament|autodq|":1,"|player|":1,"|teamsize|":1,"|gametype|":1,"|gen|":1,"|tier|":1,"|rated|":1,"|seed|":1,"|rule|":1,"|teampreview|":1,"|clearpoke|":1,"|poke|":1,"|start|":1,"|done|":1,"|request|":1,"|inactive|":1,"|inactiveoff|":1,"|upkeep|":1,"|turn|":1,"|win|":1,"|tie|":1,"|move|":1,"|switch|":1,"|drag|":1,"|detailschange|":1,"|replace|":1,"|swap|":1,"|cant|":1,"|faint|":1,"|-formechange|":1,"|-fail|":1,"|-block|":1,"|-notarget|":1,"|-miss|":1,"|-damage|":1,"|-heal|":1,"|-sethp|":1,"|-status|":1,"|-curestatus|":1,"|-cureteam|":1,"|-boost|":1,"|-unboost|":1,"|-setboost|":1,"|-swapboost|":1,"|-invertboost|":1,"|-clearboost|":1,"|-clearallboost|":1,"|-clearpositiveboost|":1,"|-ohko|":1,"|-clearnegativeboost|":1,"|-copyboost|":1,"|-weather|":1,"|-fieldstart|":1,"|-fieldend|":1,"|-sidestart|":1,"|-sideend|":1,"|-start|":1,"|-end|":1,"|-crit|":1,"|-supereffective|":1,"|-resisted|":1,"|-immune|":1,"|-item|":1,"|-enditem|":1,"|-ability|":1,"|-endability|":1,"|-transform|":1,"|-mega|":1,"|-primal|":1,"|-burst|":1,"|-zpower|":1,"|-zbroken|":1,"|-activate|":1,"|-fieldactivate|":1,"|-hint|":1,"|-center|":1,"|-message|":1,"|-combine|":1,"|-waiting|":1,"|-prepare|":1,"|-mustrecharge|":1,"|-hitcount|":1,"|-singlemove|":1,"|-singleturn|":1,"|-anim|":1,"|warning|":1,"|-candynamax|":1,"|updatepoke|":1,"|-swapsideconditions|":1,"|-terastallize|":1};this.ARGS_WITH_KWARGS={"|move|":1,"|detailschange|":1,"|cant|":1,"|-formechange|":1,"|-fail|":1,"|-block|":1,"|-damage|":1,"|-heal|":1,"|-sethp|":1,"|-status|":1,"|swap|":1,"|-curestatus|":1,"|-cureteam|":1,"|-boost|":1,"|-unboost|":1,"|-setboost|":1,"|-swapboost|":1,"|-invertboost|":1,"|-clearnegativeboost|":1,"|-weather|":1,"|-fieldactivate|":1,"|-fieldstart|":1,"|-fieldend|":1,"|-sidestart|":1,"|-sideend|":1,"|-start|":1,"|-end|":1,"|-immune|":1,"|-item|":1,"|-enditem|":1,"|-ability|":1,"|-endability|":1,"|-transform|":1,"|-activate|":1,"|-singleturn|":1,"|-miss|":1,"|-clearallboost|":1,"|-anim|":1,"|-copyboost|":1,"|-clearboost|":1,"|-clearpositiveboost|":1,"|-singlemove|":1,"|switch|":1}}*parse(o){let e=o.split(`
`),t="";for(let[r,a]of e.entries())if(r===0&&a[0]===">"){t=a.slice(1);continue}else if(a){let{args:n,kwArgs:s}=this.parseBattleLine(a);yield{roomid:t,args:n,kwArgs:s}}}key(o){let e=o[0]==="tournament"?`|${o[0]}|${o[1]}|`:`|${o[0]}|`;return e in this.ARGS?e:void 0}parseLine(o,e){if(!o.startsWith("|"))return["",o];if(o==="|")return["done"];let t=o.indexOf("|",1),r=o.slice(1,t);switch(r){case"chatmsg":case"chatmsg-raw":case"raw":case"error":case"html":case"inactive":case"inactiveoff":case"warning":case"fieldhtml":case"controlshtml":case"bigerror":case"debug":case"tier":case"challstr":case"popup":case"":return m([r,o.slice(t+1)]);case"c":case"chat":case"uhtml":case"uhtmlchange":let a=o.indexOf("|",t+1);return m([r,o.slice(t+1,a),o.slice(a+1)]);case"c:":case"pm":let n=o.indexOf("|",t+1),s=o.indexOf("|",n+1);return m([r,o.slice(t+1,n),o.slice(n+1,s),o.slice(s+1)])}return e?null:m(o.slice(1).split("|"))}parseBattleLine(o){let e=c.parseLine(o,!0);if(e)return{args:e,kwArgs:{}};e=o.slice(1).split("|");let t={};for(;e.length>1;){let r=e[e.length-1];if(r.charAt(0)!=="[")break;let a=r.indexOf("]");if(a<=0)break;t[r.slice(1,a)]=r.slice(a+1).trim()||!0,e.pop()}return I({args:m(e),kwArgs:t})}parsePokemonIdent(o){let e=o.indexOf(":"),t=o.slice(0,e),r=o.slice(e+2),a,n;return t.length<3?(a=t,n=null):(a=t.slice(0,2),n=t.charAt(2)),{player:a,position:n,name:r}}parseDetails(o,e,t="",r={}){r.details=t;let a=!o;r.name=o,r.speciesForme=o,r.level=100,r.shiny=!1,r.gender=void 0,r.ident=a?"":e,r.searchid=a?"":`${e}|${t}`;let n=t.split(", ");n[n.length-1].startsWith("tera:")&&(r.terastallized=n[n.length-1].slice(5),n.pop()),n[n.length-1]==="shiny"&&(r.shiny=!0,n.pop());let s=n[n.length-1];return(s==="M"||s==="F")&&(r.gender=s,n.pop()),n[1]&&(r.level=parseInt(n[1].substr(1))||100),n[0]&&(r.speciesForme=n[0]),r}parseHealth(o,e={}){let[t,r]=o.split(" ");if(e.hpcolor="",t==="0"||t==="0.0")e.maxhp||(e.maxhp=100),e.hp=0;else if(t.indexOf("/")>0){let[a,n]=t.split("/");if(isNaN(parseFloat(a))||isNaN(parseFloat(n)))return null;e.hp=parseFloat(a),e.maxhp=parseFloat(n),e.hp>e.maxhp&&(e.hp=e.maxhp);let s=n.slice(-1);(s==="y"||s==="g")&&(e.hpcolor=s)}else isNaN(parseFloat(t))||(e.maxhp||(e.maxhp=100),e.hp=e.maxhp*parseFloat(t)/100);return r?r==="par"||r==="brn"||r==="slp"||r==="frz"||r==="tox"||r==="psn"&&e.status!=="tox"?e.status=r:r==="fnt"&&(e.hp=0,e.fainted=!0):e.status=void 0,e}parseEffect(o,e=t=>t.trim()){return o?o.startsWith("item:")||o.startsWith("move:")?{name:e(o.slice(5)),type:o.slice(0,4)}:o.startsWith("ability:")?{name:e(o.slice(8)),type:"ability"}:{name:e(o)}:{name:e("")}}parseRequest(o){let e=JSON.parse(o);if(e.requestType||(e.requestType="move",e.forceSwitch?e.requestType="switch":e.teamPreview?e.requestType="team":e.wait&&(e.requestType="wait")),e.requestType==="wait"&&(e.noCancel=!0),e.side)for(let t of e.side.pokemon)this.parseDetails(t.ident.substr(4),t.ident,t.details,t),this.parseHealth(t.condition,t),t.ability=t.ability||t.baseAbility;if(e.active){e.active=e.active.map((t,r)=>e.side.pokemon[r].fainted?null:t);for(let t of e.active)if(t){for(let r of t.moves)r.move&&(r.name=r.move),r.id=p(r.name);if(t.maxMoves){t.maxMoves.maxMoves&&(t.canGigantamax=t.maxMoves.gigantamax,t.maxMoves=t.maxMoves.maxMoves);for(let r of t.maxMoves)r.id=r.move}if(t.canZMove){t.zMoves=t.canZMove;for(let r of t.zMoves)r&&(r.move&&(r.name=r.move),r.id=p(r.name))}}}return e}parseChallenges(o){return JSON.parse(o)}parseSearchState(o){return JSON.parse(o)}parseTournamentUpdate(o){return JSON.parse(o)}parseNameParts(o){let e="";/[A-Za-z0-9]/.test(o.charAt(0))||(e=o.charAt(0),o=o.slice(1));let t=o,r=o.indexOf("@"),a="",n=!1;return r>0&&(t=o.slice(0,r),a=o.slice(r+1),a.startsWith("!")&&(n=!0,a=a.slice(1))),{group:e,name:t,away:n,status:a}}};function m(o){switch(o[0]){case"name":case"n":case"N":{let[e,t,r]=o;return["name",t,r,e==="N"]}case"chat":case"c":{let[,e,t]=o;return["chat",e,t]}case"join":case"j":case"J":{let[e,t]=o;return["join",t,e==="J"]}case"leave":case"l":case"L":{let[e,t]=o;return["leave",t,e==="L"]}case"battle":case"b":{let[,e,t,r]=o;return["battle",e,t,r]}}return o}var P=new Set(["ingrain","quickguard","wideguard","craftyshield","matblock","protect","mist","safeguard","electricterrain","mistyterrain","psychicterrain","telepathy","stickyhold","suctioncups","aromaveil","flowerveil","sweetveil","disguise","safetygoggles","protectivepads"]),h=new Set(["ability: Damp","ability: Dazzling","ability: Queenly Majesty","ability: Armor Tail"]),x=new Set(["thundercage","clamp","whirlpool","firespin","magmastorm","sandtomb","infestation","trapped","bind","snaptrap","wrap"]),k=new Set(["eeriespell","gmaxdepletion","spite","grudge","forewarn","sketch","leppaberry","mysteryberry"]),b=new Set(["dryskin","eartheater","voltabsorb","waterabsorb"]);function I({args:o,kwArgs:e}){switch(o[0]){case"-activate":{if(e.item||e.move||e.number||e.ability)return{args:o,kwArgs:e};let[,t,r,a,n]=o,s=r,i=e.of,l=c.parseEffect(s,p).name;if(e.block)return{args:["-fail",t],kwArgs:e};if(l==="sturdy")return{args:["-activate",t,"ability: Sturdy"],kwArgs:e};if(l==="wonderguard")return{args:["-immune",t],kwArgs:{from:"ability: Wonder Guard"}};if(l==="beatup"&&e.of)return{args:o,kwArgs:{name:e.of}};if(P.has(l))return i?(e.of=t,{args:["-block",i,s,a||""],kwArgs:e}):{args:["-block",t,s,a||""],kwArgs:e};if(l==="charge")return{args:["-singlemove",t,"Charge"],kwArgs:{of:i||void 0}};if(x.has(l))return{args:["-start",t,s],kwArgs:{of:i||""}};if(l==="fairylock")return{args:["-fieldactivate",s],kwArgs:{}};if(l==="symbiosis"||l==="poltergeist")e.item=a;else if(l==="magnitude")e.number=a;else if(l==="skillswap"||l==="mummy"||l==="lingeringaroma")e.ability=a,e.ability2=n;else if(l==="wanderingspirit")if(a)e.ability=a,e.ability2=n;else return{args:["-ability",t,"Wandering Spirit"],kwArgs:{}};else k.has(l)&&(e.move=a,e.number=n);return{args:["-activate",t,s,i||""],kwArgs:e}}case"-start":{(e.from==="Protean"||e.from==="Color Change")&&(e.from="ability:"+e.from);break}case"move":{e.from==="Magic Bounce"&&(e.from="ability: Magic Bounce");break}case"cant":{let[,t,r,a]=o;if(h.has(r))return{args:["-block",t,r,a,e.of||""],kwArgs:{}};break}case"-heal":{let t=c.parseEffect(e.from,p).name;b.has(t)&&(e.of="");break}case"gen":{let[,t]=o;return{args:["gen",Number(t)],kwArgs:{}}}case"-nothing":o=["-activate","","move: Splash"]}return{args:o,kwArgs:e}}return N(T);})();
window.pkmn=window.pkmn||{};window.pkmn.protocol=(()=>{var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var A=(o,e)=>{for(var t in e)d(o,t,{get:e[t],enumerable:!0})},f=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of g(e))!u.call(o,a)&&a!==t&&d(o,a,{get:()=>e[a],enumerable:!(r=y(e,a))||r.enumerable});return o};var N=o=>f(d({},"__esModule",{value:!0}),o);var T={};A(T,{Protocol:()=>c});function p(o){return(""+o).toLowerCase().replace(/[^a-z0-9]+/g,"")}var c=new class{constructor(){this.ARGS={"|init|":1,"|title|":1,"|userlist|":1,"||":1,"|html|":1,"|uhtml|":1,"|uhtmlchange|":1,"|join|":1,"|leave|":1,"|name|":1,"|chat|":1,"|notify|":1,"|:|":1,"|c:|":1,"|t:|":1,"|battle|":1,"|popup|":1,"|pm|":1,"|usercount|":1,"|nametaken|":1,"|challstr|":1,"|updateuser|":1,"|formats|":1,"|updatesearch|":1,"|message|":1,"|updatechallenges|":1,"|queryresponse|":1,"|unlink|":1,"|raw|":1,"|error|":1,"|bigerror|":1,"|chatmsg|":1,"|chatmsg-raw|":1,"|controlshtml|":1,"|fieldhtml|":1,"|debug|":1,"|deinit|":1,"|selectorhtml|":1,"|refresh|":1,"|tempnotify|":1,"|tempnotifyoff|":1,"|noinit|":1,"|hidelines|":1,"|expire|":1,"|askreg|":1,"|tournament|create|":1,"|tournament|update|":1,"|tournament|updateEnd|":1,"|tournament|error|":1,"|tournament|forceend|":1,"|tournament|join|":1,"|tournament|leave|":1,"|tournament|replace|":1,"|tournament|start|":1,"|tournament|disqualify|":1,"|tournament|battlestart|":1,"|tournament|battleend|":1,"|tournament|end|":1,"|tournament|scouting|":1,"|tournament|autostart|":1,"|tournament|autodq|":1,"|player|":1,"|teamsize|":1,"|gametype|":1,"|gen|":1,"|tier|":1,"|rated|":1,"|seed|":1,"|rule|":1,"|teampreview|":1,"|clearpoke|":1,"|poke|":1,"|start|":1,"|done|":1,"|request|":1,"|inactive|":1,"|inactiveoff|":1,"|upkeep|":1,"|turn|":1,"|win|":1,"|tie|":1,"|move|":1,"|switch|":1,"|drag|":1,"|detailschange|":1,"|replace|":1,"|swap|":1,"|cant|":1,"|faint|":1,"|-formechange|":1,"|-fail|":1,"|-block|":1,"|-notarget|":1,"|-miss|":1,"|-damage|":1,"|-heal|":1,"|-sethp|":1,"|-status|":1,"|-curestatus|":1,"|-cureteam|":1,"|-boost|":1,"|-unboost|":1,"|-setboost|":1,"|-swapboost|":1,"|-invertboost|":1,"|-clearboost|":1,"|-clearallboost|":1,"|-clearpositiveboost|":1,"|-ohko|":1,"|-clearnegativeboost|":1,"|-copyboost|":1,"|-weather|":1,"|-fieldstart|":1,"|-fieldend|":1,"|-sidestart|":1,"|-sideend|":1,"|-start|":1,"|-end|":1,"|-crit|":1,"|-supereffective|":1,"|-resisted|":1,"|-immune|":1,"|-item|":1,"|-enditem|":1,"|-ability|":1,"|-endability|":1,"|-transform|":1,"|-mega|":1,"|-primal|":1,"|-burst|":1,"|-zpower|":1,"|-zbroken|":1,"|-activate|":1,"|-fieldactivate|":1,"|-hint|":1,"|-center|":1,"|-message|":1,"|-combine|":1,"|-waiting|":1,"|-prepare|":1,"|-mustrecharge|":1,"|-hitcount|":1,"|-singlemove|":1,"|-singleturn|":1,"|-anim|":1,"|warning|":1,"|-candynamax|":1,"|updatepoke|":1,"|-swapsideconditions|":1,"|-terastallize|":1};this.ARGS_WITH_KWARGS={"|move|":1,"|switch|":1,"|cant|":1,"|-formechange|":1,"|-fail|":1,"|-block|":1,"|-damage|":1,"|-heal|":1,"|-sethp|":1,"|-status|":1,"|swap|":1,"|-curestatus|":1,"|-cureteam|":1,"|-boost|":1,"|-unboost|":1,"|-setboost|":1,"|-swapboost|":1,"|-invertboost|":1,"|-clearnegativeboost|":1,"|-weather|":1,"|-fieldstart|":1,"|-fieldend|":1,"|-sidestart|":1,"|-singlemove|":1,"|-sideend|":1,"|-start|":1,"|-end|":1,"|-immune|":1,"|-item|":1,"|-enditem|":1,"|-ability|":1,"|-endability|":1,"|-transform|":1,"|-activate|":1,"|-singleturn|":1,"|-clearallboost|":1,"|-anim|":1,"|-copyboost|":1,"|-clearboost|":1,"|-miss|":1}}*parse(o){let e=o.split(`
`),t="";for(let[r,a]of e.entries())if(r===0&&a[0]===">"){t=a.slice(1);continue}else if(a){let{args:n,kwArgs:s}=this.parseBattleLine(a);yield{roomid:t,args:n,kwArgs:s}}}key(o,e=!1){let t=o[0]==="tournament"?`|${o[0]}|${o[1]}|`:`|${o[0]}|`;return e||t in this.ARGS?t:void 0}parseLine(o,e){if(!o.startsWith("|"))return["",o];if(o==="|")return["done"];let t=o.indexOf("|",1),r=o.slice(1,t);switch(r){case"chatmsg":case"chatmsg-raw":case"raw":case"error":case"html":case"inactive":case"inactiveoff":case"warning":case"fieldhtml":case"controlshtml":case"bigerror":case"debug":case"tier":case"challstr":case"popup":case"":return m([r,o.slice(t+1)]);case"c":case"chat":case"uhtml":case"uhtmlchange":let a=o.indexOf("|",t+1);return m([r,o.slice(t+1,a),o.slice(a+1)]);case"c:":case"pm":let n=o.indexOf("|",t+1),s=o.indexOf("|",n+1);return m([r,o.slice(t+1,n),o.slice(n+1,s),o.slice(s+1)])}return e?null:m(o.slice(1).split("|"))}parseBattleLine(o){let e=c.parseLine(o,!0);if(e)return{args:e,kwArgs:{}};e=o.slice(1).split("|");let t={};for(;e.length>1;){let r=e[e.length-1];if(r.charAt(0)!=="[")break;let a=r.indexOf("]");if(a<=0)break;t[r.slice(1,a)]=r.slice(a+1).trim()||!0,e.pop()}return I({args:m(e),kwArgs:t})}parsePokemonIdent(o){let e=o.indexOf(":"),t=o.slice(0,e),r=o.slice(e+2),a,n;return t.length<3?(a=t,n=null):(a=t.slice(0,2),n=t.charAt(2)),{player:a,position:n,name:r}}parseDetails(o,e,t="",r={}){r.details=t;let a=!o;r.name=o,r.speciesForme=o,r.level=100,r.shiny=!1,r.gender=void 0,r.ident=a?"":e,r.searchid=a?"":`${e}|${t}`;let n=t.split(", ");n[n.length-1].startsWith("tera:")&&(r.terastallized=n[n.length-1].slice(5),n.pop()),n[n.length-1]==="shiny"&&(r.shiny=!0,n.pop());let s=n[n.length-1];return(s==="M"||s==="F")&&(r.gender=s,n.pop()),n[1]&&(r.level=parseInt(n[1].substr(1))||100),n[0]&&(r.speciesForme=n[0]),r}parseHealth(o,e={}){let[t,r]=o.split(" ");if(e.hpcolor="",t==="0"||t==="0.0")e.maxhp||(e.maxhp=100),e.hp=0;else if(t.indexOf("/")>0){let[a,n]=t.split("/");if(isNaN(parseFloat(a))||isNaN(parseFloat(n)))return null;e.hp=parseFloat(a),e.maxhp=parseFloat(n),e.hp>e.maxhp&&(e.hp=e.maxhp);let s=n.slice(-1);(s==="y"||s==="g")&&(e.hpcolor=s)}else isNaN(parseFloat(t))||(e.maxhp||(e.maxhp=100),e.hp=e.maxhp*parseFloat(t)/100);return r?r==="par"||r==="brn"||r==="slp"||r==="frz"||r==="tox"||r==="psn"&&e.status!=="tox"?e.status=r:r==="fnt"&&(e.hp=0,e.fainted=!0):e.status=void 0,e}parseEffect(o,e=t=>t.trim()){return o?o.startsWith("item:")||o.startsWith("move:")?{name:e(o.slice(5)),type:o.slice(0,4)}:o.startsWith("ability:")?{name:e(o.slice(8)),type:"ability"}:{name:e(o)}:{name:e("")}}parseRequest(o){let e=JSON.parse(o);if(e.requestType||(e.requestType="move",e.forceSwitch?e.requestType="switch":e.teamPreview?e.requestType="team":e.wait&&(e.requestType="wait")),e.requestType==="wait"&&(e.noCancel=!0),e.side)for(let t of e.side.pokemon)this.parseDetails(t.ident.substr(4),t.ident,t.details,t),this.parseHealth(t.condition,t),t.ability=t.ability||t.baseAbility;if(e.active){e.active=e.active.map((t,r)=>e.side.pokemon[r].fainted?null:t);for(let t of e.active)if(t){for(let r of t.moves)r.move&&(r.name=r.move),r.id=p(r.name);if(t.maxMoves){t.maxMoves.maxMoves&&(t.canGigantamax=t.maxMoves.gigantamax,t.maxMoves=t.maxMoves.maxMoves);for(let r of t.maxMoves)r.id=r.move}if(t.canZMove){t.zMoves=t.canZMove;for(let r of t.zMoves)r&&(r.move&&(r.name=r.move),r.id=p(r.name))}}}return e}parseChallenges(o){return JSON.parse(o)}parseSearchState(o){return JSON.parse(o)}parseTournamentUpdate(o){return JSON.parse(o)}parseNameParts(o){let e="";/[A-Za-z0-9]/.test(o.charAt(0))||(e=o.charAt(0),o=o.slice(1));let t=o,r=o.indexOf("@"),a="",n=!1;return r>0&&(t=o.slice(0,r),a=o.slice(r+1),a.startsWith("!")&&(n=!0,a=a.slice(1))),{group:e,name:t,away:n,status:a}}};function m(o){switch(o[0]){case"name":case"n":case"N":{let[e,t,r]=o;return["name",t,r,e==="N"]}case"chat":case"c":{let[,e,t]=o;return["chat",e,t]}case"join":case"j":case"J":{let[e,t]=o;return["join",t,e==="J"]}case"leave":case"l":case"L":{let[e,t]=o;return["leave",t,e==="L"]}case"battle":case"b":{let[,e,t,r]=o;return["battle",e,t,r]}}return o}var P=new Set(["ingrain","quickguard","wideguard","craftyshield","matblock","protect","mist","safeguard","electricterrain","mistyterrain","psychicterrain","telepathy","stickyhold","suctioncups","aromaveil","flowerveil","sweetveil","disguise","safetygoggles","protectivepads"]),h=new Set(["ability: Damp","ability: Dazzling","ability: Queenly Majesty","ability: Armor Tail"]),x=new Set(["thundercage","clamp","whirlpool","firespin","magmastorm","sandtomb","infestation","trapped","bind","snaptrap","wrap"]),k=new Set(["eeriespell","gmaxdepletion","spite","grudge","forewarn","sketch","leppaberry","mysteryberry"]),b=new Set(["dryskin","eartheater","voltabsorb","waterabsorb"]);function I({args:o,kwArgs:e}){switch(o[0]){case"-activate":{if(e.item||e.move||e.number||e.ability)return{args:o,kwArgs:e};let[,t,r,a,n]=o,s=r,i=e.of,l=c.parseEffect(s,p).name;if(e.block)return{args:["-fail",t],kwArgs:e};if(l==="sturdy")return{args:["-activate",t,"ability: Sturdy"],kwArgs:e};if(l==="wonderguard")return{args:["-immune",t],kwArgs:{from:"ability: Wonder Guard"}};if(l==="beatup"&&e.of)return{args:o,kwArgs:{name:e.of}};if(P.has(l))return i?(e.of=t,{args:["-block",i,s,a||""],kwArgs:e}):{args:["-block",t,s,a||""],kwArgs:e};if(l==="charge")return{args:["-singlemove",t,"Charge"],kwArgs:{of:i||void 0}};if(x.has(l))return{args:["-start",t,s],kwArgs:{of:i||""}};if(l==="fairylock")return{args:["-fieldactivate",s],kwArgs:{}};if(l==="symbiosis"||l==="poltergeist")e.item=a;else if(l==="magnitude")e.number=a;else if(l==="skillswap"||l==="mummy"||l==="lingeringaroma")e.ability=a,e.ability2=n;else if(l==="wanderingspirit")if(a)e.ability=a,e.ability2=n;else return{args:["-ability",t,"Wandering Spirit"],kwArgs:{}};else k.has(l)&&(e.move=a,e.number=n);return{args:["-activate",t,s,i||""],kwArgs:e}}case"-start":{(e.from==="Protean"||e.from==="Color Change")&&(e.from="ability:"+e.from);break}case"move":{e.from==="Magic Bounce"&&(e.from="ability: Magic Bounce");break}case"cant":{let[,t,r,a]=o;if(h.has(r))return{args:["-block",t,r,a,e.of||""],kwArgs:{}};break}case"-heal":{let t=c.parseEffect(e.from,p).name;b.has(t)&&(e.of="");break}case"gen":{let[,t]=o;return{args:["gen",Number(t)],kwArgs:{}}}case"-restoreboost":{o[0]="-clearnegativeboost";break}case"-nothing":o=["-activate","","move: Splash"]}return{args:o,kwArgs:e}}return N(T);})();

@@ -0,5 +1,6 @@

import { GenerationNum } from '@pkmn/types';
import { Protocol, Args, KWArgs } from '../index.js';
import '@pkmn/types';
interface Generation {
num: GenerationNum;
abilities: API;

@@ -16,3 +17,4 @@ items: API;

private readonly gen?;
constructor(gen?: Generation);
private readonly raw;
constructor(gen?: Generation, raw?: boolean);
'|init|'(args: Args['|init|']): boolean;

@@ -104,3 +106,3 @@ '|title|'(args: Args['|title|']): boolean;

'|drag|'(args: Args['|drag|']): boolean;
'|detailschange|'(args: Args['|detailschange|'], kwArgs: KWArgs['|detailschange|']): boolean;
'|detailschange|'(args: Args['|detailschange|']): boolean;
'|replace|'(args: Args['|replace|']): boolean;

@@ -114,3 +116,3 @@ '|swap|'(args: Args['|swap|'], kwArgs: KWArgs['|swap|']): boolean;

'|-notarget|'(args: Args['|-notarget|']): boolean;
'|-miss|'(args: Args['|-miss|'], kwArgs: KWArgs['|-miss|']): boolean;
'|-miss|'(args: Args['|-miss|']): boolean;
'|-damage|'(args: Args['|-damage|'], kwArgs: KWArgs['|-damage|']): boolean;

@@ -129,3 +131,3 @@ '|-heal|'(args: Args['|-heal|'], kwArgs: KWArgs['|-heal|']): boolean;

'|-clearallboost|'(args: Args['|-clearallboost|'], kwArgs: KWArgs['|-clearallboost|']): boolean;
'|-clearpositiveboost|'(args: Args['|-clearpositiveboost|'], kwArgs: KWArgs['|-clearpositiveboost|']): boolean;
'|-clearpositiveboost|'(args: Args['|-clearpositiveboost|']): boolean;
'|-ohko|'(args: Args['|-ohko|']): boolean;

@@ -159,3 +161,3 @@ '|-candynamax|'(args: Args['|-candynamax|']): boolean;

'|-activate|'(args: Args['|-activate|'], kwArgs: KWArgs['|-activate|']): boolean;
'|-fieldactivate|'(args: Args['|-fieldactivate|'], kwArgs: KWArgs['|-fieldactivate|']): boolean;
'|-fieldactivate|'(args: Args['|-fieldactivate|']): boolean;
'|-hint|'(args: Args['|-hint|']): boolean;

@@ -172,9 +174,11 @@ '|-center|'(args: Args['|-center|']): boolean;

'|-anim|'(args: Args['|-anim|'], kwArgs: KWArgs['|-anim|']): boolean;
'|-nothing|'(args: string[]): boolean;
}
declare class Verifier {
handler: Handler;
raw?: Handler;
static EXISTS: (d: {
exists: boolean;
}) => boolean;
constructor(gen?: Generation);
constructor(gen?: Generation, raw?: boolean);
verify(data: string): string | undefined;

@@ -185,5 +189,5 @@ verifyLine(line: string): {

} | undefined;
dispatch(args: Protocol.ArgType, kwArgs: Protocol.BattleArgsKWArgType): boolean;
dispatch(args: Protocol.ArgType, kwArgs: Protocol.BattleArgsKWArgType, raw?: boolean): any;
}
export { Verifier };
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkKG2Q3BKOjs = require('../chunk-KG2Q3BKO.js');
var _chunkMJQWQGPXjs = require('../chunk-MJQWQGPX.js');

@@ -51,5 +51,5 @@ // src/verifier/index.ts

"RainDance",
"Hail",
"Sandstorm",
"SunnyDay",
"Hail",
"PrimordialSea",

@@ -61,3 +61,3 @@ "DesolateLand",

var FIELD_CONDITIONS = ["Misty Terrain"];
var SIDE_CONDTIONS = [
var SIDE_CONDITIONS = [
"Mist",

@@ -83,2 +83,3 @@ "Spikes",

var SSA = ["Shell Side Arm Physical", "Shell Side Arm Special"];
var IVY_CUDGEL = ["Ivy Cudgel Water", "Ivy Cudgel Fire", "Ivy Cudgel Rock"];
function verifyRoomID(roomid) {

@@ -103,3 +104,3 @@ return /^[-a-z0-9]+$/.test(roomid);

function verifySideCondition(name) {
return SIDE_CONDTIONS.includes(name);
return SIDE_CONDITIONS.includes(name);
}

@@ -127,3 +128,3 @@ function verifyType(name, gen) {

function verifyAnimationName(name, gen) {
return verifyName(name) && (!gen || SSA.includes(name) || verifyMoveName(name, gen));
return verifyName(name) && (!gen || IVY_CUDGEL.includes(name) || SSA.includes(name) || verifyMoveName(name, gen));
}

@@ -234,5 +235,5 @@ function verifySpeciesName(name, gen) {

var Handler = class {
// TODO ?
constructor(gen) {
constructor(gen, raw) {
this.gen = gen;
this.raw = !!raw;
}

@@ -483,11 +484,19 @@ "|init|"(args) {

"|teampreview|"(args) {
if (this.gen && this.gen.num < 5)
return false;
return args.length === 1 || args.length === 2 && verifyNum(args[1]);
}
"|updatepoke|"(args) {
if (this.gen && this.gen.num < 8)
return false;
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonDetails(args[2], this.gen);
}
"|clearpoke|"(args) {
if (this.gen && this.gen.num < 5)
return false;
return args.length === 1;
}
"|poke|"(args) {
if (this.gen && this.gen.num < 5)
return false;
return args.length === 4 && verifyPlayer(args[1]) && verifyPokemonDetails(args[2], this.gen) && POKE_ITEMS.includes(args[3]);

@@ -522,27 +531,96 @@ }

}
// TODO
"|move|"(args, kwArgs) {
const keys = [...KWARGS, "anim", "miss", "notarget", "prepare", "spread", "zeffect"];
if (!(verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, keys, this.gen)))
var _a;
if (!verifyPokemonIdent(args[1]))
return false;
if (args.length === 3)
return verifyMoveName(args[2], this.gen);
return args.length === 4 && (args[2] === "recharge" || verifyMoveName(args[2], this.gen)) && (args[3] === "" || args[3] === "null" || verifyPokemonIdent(args[3]));
if (!(args[2] === "recharge" || verifyMoveName(args[2], this.gen)))
return false;
switch (((_a = this.gen) == null ? void 0 : _a.num) || 0) {
case 1:
case 2: {
return args.length === 4 && (args[3] === "" || args[3] !== "null" && verifyPokemonIdent(args[3])) && verifyKWArgs(kwArgs, ["miss", "still", "from"], this.gen) && (!kwArgs.from || verifyMoveName(kwArgs.from, this.gen));
}
case 3: {
return args.length === 4 && (args[3] === "" || (args[3] === "null" ? ["Helping Hand"].includes(args[2]) : verifyPokemonIdent(args[3]))) && verifyKWArgs(kwArgs, ["miss", "still", "from", "notarget", "spread"], this.gen) && (!kwArgs.from || kwArgs.from === "lockedmove" || verifyMoveName(kwArgs.from, this.gen));
}
case 4: {
const from = [
"move: Metronome",
"move: Mirror Move",
"move: Sleep Talk",
"Snatch",
"move: Assist",
"move: Copycat",
"Magic Coat",
"lockedmove",
"move: Me First",
"move: Nature Power",
"Pursuit"
];
return args.length === 4 && (args[3] === "" || (args[3] === "null" ? ["Helping Hand"].includes(args[2]) : verifyPokemonIdent(args[3]))) && verifyKWArgs(kwArgs, ["miss", "still", "from", "notarget", "spread"], this.gen) && (!kwArgs.from || from.includes(kwArgs.from));
}
default: {
const keys = [...KWARGS, "anim", "miss", "notarget", "prepare", "spread", "zeffect"];
if (!verifyKWArgs(kwArgs, keys, this.gen))
return false;
return args.length === 3 || args.length === 4 && (args[3] === "" || args[3] === "null" || verifyPokemonIdent(args[3]));
}
}
}
"|switch|"(args, kwArgs) {
return args.length === 4 && verifyPokemonIdent(args[1]) && verifyPokemonDetails(args[2], this.gen) && verifyPokemonHPStatus(args[3]) && verifyKWArgs(kwArgs, KWARGS, this.gen);
const valid = args.length === 4 && verifyPokemonIdent(args[1]) && verifyPokemonDetails(args[2], this.gen) && verifyPokemonHPStatus(args[3]);
if (!valid)
return false;
if (!this.gen)
return verifyKWArgs(kwArgs, KWARGS, this.gen);
if (this.gen.num === 1)
return !Object.keys(kwArgs).length;
const from = [
"Baton Pass",
"U-turn",
"Volt Switch",
"Parting Shot",
"Flip Turn",
"Teleport",
"Chilly Reception",
"Shed Tail"
];
const to = [0, 0, 1, 1, 2, 3, 4, 4, 6, 8];
if (!verifyKWArgs(kwArgs, ["from"], this.gen))
return false;
return !kwArgs.from || from.slice(0, to[this.gen.num]).includes(kwArgs.from);
}
"|drag|"(args) {
if (this.gen && this.gen.num < 2)
return false;
return args.length === 4 && verifyPokemonIdent(args[1]) && verifyPokemonDetails(args[2], this.gen) && verifyPokemonHPStatus(args[3]);
}
"|detailschange|"(args, kwArgs) {
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonDetails(args[2], this.gen) && verifyKWArgs(kwArgs, [...KWARGS, "msg"], this.gen);
"|detailschange|"(args) {
if (this.gen && this.gen.num < 4)
return false;
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonDetails(args[2], this.gen);
}
"|replace|"(args) {
if (this.gen && this.gen.num < 5)
return false;
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonDetails(args[2], this.gen);
}
"|swap|"(args, kwArgs) {
return args.length === 3 && verifyKWArgs(kwArgs, KWARGS, this.gen) && verifyPokemonIdent(args[1]) && (verifyNum(args[2]) || verifyPokemonIdent(args[2]));
if (this.gen && this.gen.num < 5)
return false;
return args.length === 3 && verifyKWArgs(kwArgs, ["from"], this.gen) && verifyPokemonIdent(args[1]) && verifyNum(args[2]) && kwArgs.from === "move: Ally Switch";
}
// TODO
"|cant|"(args, kwArgs) {
return (args.length === 3 || args.length === 4) && verifyPokemonIdent(args[1]) && (REASONS.includes(args[2]) || verifyEffectName(args[2], this.gen) || verifyAbilityName(args[2], this.gen) || verifyMoveName(args[2], this.gen)) && (!args[3] || verifyEffectName(args[3], this.gen) || verifyMoveName(args[3], this.gen)) && verifyKWArgs(kwArgs, KWARGS, this.gen);
var _a;
if (!verifyPokemonIdent(args[1]))
return false;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1) {
const reasons = ["Disable", "flinch", "slp", "frz", "par", "partiallytrapped", "recharge"];
if (!reasons.includes(args[2]) || Object.keys(kwArgs).length)
return false;
return args[2] === "Disable" ? args.length === 4 && verifyMoveName(args[3], this.gen) : args.length === 3;
}
return (args.length === 3 || args.length === 4) && (REASONS.includes(args[2]) || verifyEffectName(args[2], this.gen) || verifyAbilityName(args[2], this.gen) || verifyMoveName(args[2], this.gen)) && (!args[3] || verifyEffectName(args[3], this.gen) || verifyMoveName(args[3], this.gen)) && verifyKWArgs(kwArgs, KWARGS, this.gen);
}

@@ -553,8 +631,33 @@ "|faint|"(args) {

"|-formechange|"(args, kwArgs) {
if (!(verifyPokemonIdent(args[1]) && verifySpeciesName(args[2], this.gen) && verifyKWArgs(kwArgs, [...KWARGS, "msg"], this.gen))) {
var _a;
if (this.gen && this.gen.num < 3)
return false;
const valid = verifyPokemonIdent(args[1]) && verifySpeciesName(args[2], this.gen) && args.length === 3 || args.length === 4 && args[3] === "";
if (!valid)
return false;
switch (((_a = this.gen) == null ? void 0 : _a.num) || 0) {
case 3: {
return verifyKWArgs(kwArgs, ["msg", "from"], this.gen) && !!kwArgs.msg && kwArgs.from === "ability: Forecast";
}
case 4: {
return !Object.keys(kwArgs).length || verifyKWArgs(kwArgs, ["msg", "from"], this.gen) && !!kwArgs.msg && (kwArgs.from === "ability: Forecast" || kwArgs.from === "ability: Flower Gift");
}
default:
return verifyKWArgs(kwArgs, [...KWARGS, "msg"], this.gen);
}
return args.length === 3 || args.length === 4 && args[3] === "";
}
// TODO
"|-fail|"(args, kwArgs) {
var _a;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1) {
const valid = verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, ["weak"], this.gen);
if (!valid || args.length > 3)
return false;
if (args.length === 2)
return true;
const reasons = ["move: Substitute", "par", "psn", "slp", "tox"];
if (!reasons.includes(args[2]))
return false;
return !kwArgs.weak || args[2] === "move: Substitute";
}
const keys = [...KWARGS, "forme", "heavy", "msg", "weak", "fail", "block"];

@@ -571,3 +674,8 @@ if (!verifyKWArgs(kwArgs, keys, this.gen)) {

}
// TODO FIXME
"|-block|"(args, kwArgs) {
var _a;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1) {
return args.length === 4 && verifyPokemonIdent(args[1]) && !Object.keys(kwArgs).length && args[2] === "move: Mist" && args[3] === "";
}
if (!verifyKWArgs(kwArgs, KWARGS, this.gen))

@@ -585,60 +693,219 @@ return false;

"|-notarget|"(args) {
return args.length === 1 || args.length === 2 && verifyPokemonIdent(args[1]);
if (this.gen && this.gen.num < 3)
return false;
if (args.length === 2 && verifyPokemonIdent(args[1]))
return true;
return !this.gen && args.length === 1;
}
"|-miss|"(args, kwArgs) {
if (!verifyKWArgs(kwArgs, KWARGS, this.gen))
"|-miss|"(args) {
var _a;
if (!verifyPokemonIdent(args[1]))
return false;
if (args.length === 2)
return verifyPokemonIdent(args[1]);
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonIdent(args[2]);
return !this.gen || this.gen.num <= 2;
return ((_a = this.gen) == null ? void 0 : _a.num) !== 1 && args.length === 3 && verifyPokemonIdent(args[2]);
}
// TODO
"|-damage|"(args, kwArgs) {
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonHPStatus(args[2]) && verifyKWArgs(kwArgs, [...KWARGS, "partiallytrapped"], this.gen);
var _a;
const valid = args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonHPStatus(args[2]);
if (!valid)
return false;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1) {
if (!verifyKWArgs(kwArgs, ["from", "of"], this.gen))
return false;
return !kwArgs.from || (kwArgs.of ? ["brn", "psn", "Leech Seed", "Recoil"] : ["brn", "psn", "confusion"]).includes(kwArgs.from);
}
return verifyKWArgs(kwArgs, [...KWARGS, "partiallytrapped"], this.gen);
}
// TODO
"|-heal|"(args, kwArgs) {
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonHPStatus(args[2]) && verifyKWArgs(kwArgs, [...KWARGS, "wisher", "zeffect"], this.gen);
var _a;
const valid = args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonHPStatus(args[2]);
if (!valid)
return false;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1) {
if (!verifyKWArgs(kwArgs, ["from", "of", "silent"], this.gen))
return false;
if (!Object.keys(kwArgs).length)
return true;
return kwArgs.silent ? !(kwArgs.from || kwArgs.of) : kwArgs.from === "drain" && !!kwArgs.of;
}
return verifyKWArgs(kwArgs, [...KWARGS, "wisher", "zeffect"], this.gen);
}
"|-sethp|"(args, kwArgs) {
if (!verifyKWArgs(kwArgs, KWARGS, this.gen))
var _a;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1)
return false;
if (args.length === 3)
return verifyPokemonIdent(args[1]) && verifyPokemonHPStatus(args[2]);
return args.length === 5 && verifyPokemonIdent(args[1]) && verifyNum(args[2]) && verifyPokemonIdent(args[3]) && verifyNum(args[4]);
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonHPStatus(args[2]) && verifyKWArgs(kwArgs, ["from", "silent"], this.gen) && kwArgs.from === "move: Pain Split";
}
// TODO
"|-status|"(args, kwArgs) {
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyStatusName(args[2]) && verifyKWArgs(kwArgs, KWARGS, this.gen);
var _a, _b, _c, _d;
const valid = args.length === 3 && verifyPokemonIdent(args[1]) && verifyStatusName(args[2]);
if (!valid)
return false;
switch (((_a = this.gen) == null ? void 0 : _a.num) || 0) {
case 1:
case 2: {
if (!verifyKWArgs(kwArgs, ["from", "silent"], this.gen))
return false;
if (kwArgs.from) {
return !kwArgs.silent && args[2] === "slp" && kwArgs.from.startsWith("move: ");
}
return !kwArgs.silent || args[2] === "psn";
}
case 3: {
if (["frz", "tox"].includes(args[2]))
return !Object.keys(kwArgs).length;
if (!verifyKWArgs(kwArgs, ["from", "of"], this.gen))
return false;
if (args[2] === "slp") {
return !kwArgs.of && (!kwArgs.from || ((_b = kwArgs.from) == null ? void 0 : _b.startsWith("move: ")));
}
return !kwArgs.from || kwArgs.from.startsWith("ability: ") && !!kwArgs.of;
}
case 4: {
if (args[2] === "frz")
return !Object.keys(kwArgs).length;
if (!verifyKWArgs(kwArgs, ["from", "of"], this.gen))
return false;
if (args[2] === "slp") {
return !kwArgs.of && (!kwArgs.from || ((_c = kwArgs.from) == null ? void 0 : _c.startsWith("move: ")));
}
if ((_d = kwArgs.from) == null ? void 0 : _d.startsWith("item: ")) {
return ["brn", "tox"].includes(args[2]) && !kwArgs.of;
}
return !kwArgs.from || kwArgs.from.startsWith("ability: ") && !!kwArgs.of;
}
default:
return verifyKWArgs(kwArgs, KWARGS, this.gen);
}
}
// TODO
"|-curestatus|"(args, kwArgs) {
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyStatusName(args[2]) && verifyKWArgs(kwArgs, [...KWARGS, "thaw", "msg"], this.gen);
var _a;
const valid = args.length === 3 && verifyPokemonIdent(args[1]) && verifyStatusName(args[2]);
if (!valid)
return false;
switch (((_a = this.gen) == null ? void 0 : _a.num) || 0) {
case 1: {
if (!verifyKWArgs(kwArgs, ["msg", "silent"], this.gen))
return false;
if (kwArgs.msg)
return ["slp", "frz"].includes(args[2]);
return !!kwArgs.silent;
}
case 2:
return verifyKWArgs(kwArgs, ["msg"], this.gen) && !!kwArgs.msg;
case 3:
case 4: {
if (!verifyKWArgs(kwArgs, ["msg", "silent", "from"], this.gen))
return false;
if (Object.keys(kwArgs).length > 1)
return false;
if (!kwArgs.from)
return true;
if (args[2] === "frz") {
if (kwArgs.silent)
return false;
} else {
return kwArgs.from === "ability: Natural Cure";
}
const from = ["move: Flame Wheel", "move: Sacred Fire", "ability: Natural Cure"];
if (this.gen.num === 4)
from.push("move: Flare Blitz");
return from.includes(kwArgs.from);
}
default:
return verifyKWArgs(kwArgs, [...KWARGS, "thaw", "msg"], this.gen);
}
}
"|-cureteam|"(args, kwArgs) {
return args.length === 2 && verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, KWARGS, this.gen);
if (this.gen && (this.gen.num < 2 || this.gen.num > 4))
return false;
const valid = args.length === 2 && verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, ["from"], this.gen);
if (!valid)
return false;
if (!this.gen)
return true;
return kwArgs.from === (this.gen.num === 2 ? "move: Heal Bell" : "move: Aromatherapy");
}
// TODO gen 2/3/4
"|-boost|"(args, kwArgs) {
return args.length === 4 && verifyPokemonIdent(args[1]) && verifyBoostID(args[2]) && verifyNum(args[3]) && verifyKWArgs(kwArgs, [...KWARGS, "multiple", "zeffect"], this.gen);
var _a;
const valid = args.length === 4 && verifyPokemonIdent(args[1]) && verifyBoostID(args[2]) && verifyNum(args[3]);
if (!valid)
return false;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1) {
if (kwArgs.from === "Rage" && args[2] === "atk")
return true;
return !Object.keys(kwArgs).length;
}
return verifyKWArgs(kwArgs, [...KWARGS, "multiple", "zeffect"], this.gen);
}
// TODO gen 2/3/4
"|-unboost|"(args, kwArgs) {
return args.length === 4 && verifyPokemonIdent(args[1]) && verifyBoostID(args[2]) && verifyNum(args[3]) && verifyKWArgs(kwArgs, [...KWARGS, "multiple", "zeffect"], this.gen);
var _a;
const valid = args.length === 4 && verifyPokemonIdent(args[1]) && verifyBoostID(args[2]) && verifyNum(args[3]);
if (!valid)
return false;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1)
return !Object.keys(kwArgs).length;
return verifyKWArgs(kwArgs, [...KWARGS, "multiple", "zeffect"], this.gen);
}
"|-setboost|"(args, kwArgs) {
return args.length === 4 && verifyPokemonIdent(args[1]) && verifyBoostID(args[2]) && verifyNum(args[3]) && verifyKWArgs(kwArgs, KWARGS, this.gen);
var _a;
if (this.gen && this.gen.num < 2)
return false;
const from = ((_a = this.gen) == null ? void 0 : _a.num) === 2 ? ["move: Belly Drum"] : ["move: Belly Drum", "ability: Anger Point"];
return args.length === 4 && verifyPokemonIdent(args[1]) && args[2] === "atk" && verifyNum(args[3]) && verifyKWArgs(kwArgs, ["from"], this.gen) && from.includes(kwArgs.from);
}
"|-swapboost|"(args, kwArgs) {
if (!verifyKWArgs(kwArgs, KWARGS, this.gen))
return false;
if (!(verifyPokemonIdent(args[1]) && verifyPokemonIdent(args[2])))
return false;
return args.length === 3 || args.length === 4 && verifyBoostIDs(args[3]);
if (!verifyKWArgs(kwArgs, ["from"], this.gen))
return false;
if (!this.gen)
return args.length === 3 || args.length === 4 && verifyBoostIDs(args[3]);
if (this.gen.num < 4)
return false;
switch (kwArgs.from) {
case "move: Heart Swap":
return args.length === 3;
case "move: Power Swap":
return args.length === 4 && args[3] === "atk, spa";
case "move: Guard Swap":
return args.length === 4 && args[3] === "def, spd";
default:
return false;
}
}
"|-invertboost|"(args, kwArgs) {
return args.length === 2 && verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, KWARGS, this.gen);
if (this.gen && this.gen.num < 6)
return false;
return args.length === 2 && verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, ["from"], this.gen) && kwArgs.from === "move: Topsy-Turvy";
}
"|-clearboost|"(args, kwArgs) {
return args.length === 2 && verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, [...KWARGS, "zeffect"], this.gen);
if (!(args.length === 2 && verifyPokemonIdent(args[1])))
return false;
if (!this.gen)
return verifyKWArgs(kwArgs, [...KWARGS], this.gen);
if (this.gen.num < 5)
return false;
if (this.gen.num < 8)
return !Object.keys(kwArgs).length;
return verifyKWArgs(kwArgs, ["from", "of"], this.gen) && !kwArgs.from || kwArgs.from === "ability: Curious Medicine" && !!kwArgs.of;
}
"|-clearallboost|"(args, kwArgs) {
return args.length === 1 && verifyKWArgs(kwArgs, [...KWARGS, "zeffect"], this.gen);
if (args.length !== 1 || !verifyKWArgs(kwArgs, ["silent"], this.gen))
return false;
if (!this.gen)
return true;
return this.gen.num === 1 ? kwArgs.silent === true : !Object.keys(kwArgs).length;
}
"|-clearpositiveboost|"(args, kwArgs) {
return args.length === 4 && verifyPokemonIdent(args[1]) && verifyPokemonIdent(args[2]) && verifyEffectName(args[3], this.gen) && verifyKWArgs(kwArgs, [...KWARGS, "zeffect"], this.gen);
"|-clearpositiveboost|"(args) {
if (this.gen && this.gen.num < 7)
return false;
return args.length === 4 && verifyPokemonIdent(args[1]) && verifyPokemonIdent(args[2]) && args[3] === "move: Spectral Thief";
}

@@ -649,40 +916,181 @@ "|-ohko|"(args) {

"|-candynamax|"(args) {
if (this.gen && this.gen.num < 8)
return false;
return args.length === 2 && verifyPlayer(args[1]);
}
"|-terastallize|"(args) {
if (this.gen && this.gen.num < 9)
return false;
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyType(args[2]);
}
"|-clearnegativeboost|"(args, kwArgs) {
return args.length === 2 && verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, [...KWARGS, "zeffect"], this.gen);
if (this.gen && this.gen.num < 3)
return false;
return args.length === 2 && verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, ["silent", "zeffect"], this.gen) && Object.keys(kwArgs).length === 1;
}
"|-copyboost|"(args, kwArgs) {
if (!(verifyPokemonIdent(args[1]) && verifyPokemonIdent(args[2]) && verifyKWArgs(kwArgs, [...KWARGS, "zeffect"], this.gen))) {
var _a;
if (this.gen && this.gen.num < 2)
return false;
}
return args.length === 3 || args.length === 4 && verifyBoostIDs(args[3]);
const from = ((_a = this.gen) == null ? void 0 : _a.num) === 2 ? ["move: Psych Up"] : ["move: Psych Up", "ability: Costar"];
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonIdent(args[2]) && verifyKWArgs(kwArgs, ["from"], this.gen) && from.includes(kwArgs.from);
}
"|-weather|"(args, kwArgs) {
return args.length === 2 && (args[1] === "none" || verifyWeather(args[1])) && verifyKWArgs(kwArgs, [...KWARGS, "upkeep"], this.gen);
var _a;
if (args.length !== 2)
return false;
if (args[1] === "none")
return !Object.keys(kwArgs).length;
const weather = [0, 0, 3, 4, 4, 4, 7, 7, 7, 8];
const to = [0, 0, 0, 3, 4, 4, 7, 7, 8, 9];
const abilities = [
"ability: Drizzle",
"ability: Sand Stream",
"ability: Drought",
"ability: Snow Warning",
"ability: Primordial Sea",
"ability: Desolate Land",
"ability: Delta Stream",
"ability: Sand Spit",
"ability: Orichalcum Pulse"
];
switch (((_a = this.gen) == null ? void 0 : _a.num) || 0) {
case 1:
return false;
case 2: {
return WEATHER.slice(0, 3).includes(args[1]) && verifyKWArgs(kwArgs, ["upkeep"], this.gen);
}
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9: {
if (!WEATHER.slice(0, weather[this.gen.num]).includes(args[1]))
return false;
if (this.gen.num === 9 && args[1] === "Hail")
return false;
if (!verifyKWArgs(kwArgs, ["upkeep", "from", "of"], this.gen))
return false;
if (!Object.keys(kwArgs).length)
return true;
if (kwArgs.upkeep)
return Object.keys(kwArgs).length === 1;
return !!kwArgs.of && abilities.slice(0, to[this.gen.num]).includes(kwArgs.from);
}
default: {
return verifyWeather(args[1]) && verifyKWArgs(kwArgs, [...KWARGS, "upkeep"], this.gen);
}
}
}
// TODO DEBUG
"|-fieldstart|"(args, kwArgs) {
if (this.gen && this.gen.num < 4)
return false;
return args.length === 2 && (verifyMoveEffectName(args[1], this.gen) || verifyFieldCondition(args[1])) && verifyKWArgs(kwArgs, KWARGS, this.gen);
}
// TODO DEBUG
"|-fieldend|"(args, kwArgs) {
if (this.gen && this.gen.num < 4)
return false;
return args.length === 2 && (verifyMoveEffectName(args[1], this.gen) || verifyFieldCondition(args[1])) && verifyKWArgs(kwArgs, KWARGS, this.gen);
}
"|-sidestart|"(args, kwArgs) {
return args.length === 3 && verifySide(args[1]) && (verifyMoveEffectName(args[2], this.gen) || verifySideCondition(args[2])) && verifyKWArgs(kwArgs, ["silent"], this.gen);
var _a;
const valid = args.length === 3 && verifySide(args[1]) && (!this.gen || this.gen.num >= 8 ? verifyKWArgs(kwArgs, ["silent"], this.gen) : !Object.keys(kwArgs).length);
if (!valid)
return false;
const modern = [
"Reflect",
"Safeguard",
"move: Light Screen",
"Spikes",
"Mist",
"move: Lucky Chant",
"move: Stealth Rock",
"move: Tailwind",
"move: Toxic Spikes",
"Grass Pledge",
"Fire Pledge",
"Water Pledge",
"move: Sticky Web",
"move: Aurora Veil"
];
const classic = modern.slice(0, 9);
classic[2] = "Light Screen";
const dexit = modern.slice(0);
dexit.splice(5, 1);
const gen8 = [
...dexit,
"G-Max Volcalith",
"G-Max Wildfire",
"G-Max Cannonade",
"G-Max Steelsurge",
"G-Max Vine Lash"
];
switch (((_a = this.gen) == null ? void 0 : _a.num) || 0) {
case 1:
return false;
case 2:
return modern.slice(0, 4).includes(args[2]);
case 3:
return classic.slice(0, 5).includes(args[2]);
case 4:
return classic.includes(args[2]);
case 5:
return modern.slice(0, 12).includes(args[2]);
case 6:
return modern.slice(0, 13).includes(args[2]);
case 7:
return modern.includes(args[2]);
case 8:
return gen8.includes(args[2]);
case 9:
return dexit.includes(args[2]);
default: {
return verifyMoveEffectName(args[2], this.gen) || verifySideCondition(args[2]);
}
}
}
// TODO
"|-sideend|"(args, kwArgs) {
if (this.gen && this.gen.num < 2)
return false;
return args.length === 3 && verifySide(args[1]) && (verifyMoveEffectName(args[2], this.gen) || verifySideCondition(args[2])) && verifyKWArgs(kwArgs, KWARGS, this.gen);
}
"|-swapsideconditions|"(args) {
if (this.gen && this.gen.num < 8)
return false;
return args.length === 1;
}
// TODO
"|-start|"(args, kwArgs) {
var _a;
if (!verifyPokemonIdent(args[1]) || args.length > 4)
return false;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1) {
if (args.length === 3) {
const reasons = [
"Bide",
"Light Screen",
"Mist",
"Reflect",
"Substitute",
"confusion",
"move: Focus Energy",
"move: Leech Seed"
];
return reasons.includes(args[2]) && (!Object.keys(kwArgs).length || !!kwArgs.silent && args[2] === "confusion");
} else if (args.length === 4) {
if (args[2] === "typechange") {
return verifyTypes(args[3], this.gen) && verifyKWArgs(kwArgs, ["from", "of"], this.gen) && kwArgs.from === "move: Conversion";
} else {
return ["Disable", "Mimic"].includes(args[2]) && !Object.keys(kwArgs).length && verifyMoveName(args[3], this.gen);
}
}
}
const keys = [...KWARGS, "already", "damage", "block", "fatigue", "upkeep", "zeffect"];
if (!verifyKWArgs(kwArgs, keys, this.gen))
return false;
if (!verifyPokemonIdent(args[1]))
return false;
if (args[2] === "Dynamax") {

@@ -702,3 +1110,26 @@ return args.length === 3 || args.length === 4 && (args[3] === "Gmax" || args[3] === "");

}
// TODO
"|-end|"(args, kwArgs) {
var _a;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1) {
const valid = args.length === 3 && verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, ["silent"], this.gen);
if (!valid)
return false;
return (kwArgs.silent ? [
"Disable",
"confusion",
"Mist",
"move: Focus Energy",
"move: Leech Seed",
"Toxic counter",
"Light Screen",
"Reflect",
"move: Bide"
] : [
"Disable",
"confusion",
"Bide",
"Substitute"
]).includes(args[2]);
}
return args.length === 3 && verifyPokemonIdent(args[1]) && (verifyEffectName(args[2], this.gen) || verifyMoveName(args[2], this.gen) || verifyAbilityName(args[2], this.gen)) && verifyKWArgs(kwArgs, [...KWARGS, "partiallytrapped", "interrupt"], this.gen);

@@ -715,15 +1146,46 @@ }

}
// TODO DEBUG
"|-immune|"(args, kwArgs) {
if (!(verifyPokemonIdent(args[1]) && verifyKWArgs(kwArgs, [...KWARGS, "ohko"], this.gen))) {
var _a;
if (!verifyPokemonIdent(args[1]))
return false;
switch (((_a = this.gen) == null ? void 0 : _a.num) || 0) {
case 1:
return args.length === 2 && verifyKWArgs(kwArgs, ["ohko"], this.gen);
case 2:
return args.length === 2 && verifyKWArgs(kwArgs, ["ohko"], this.gen);
case 3:
case 4: {
if (args.length === 3) {
return args[2] === "confusion" && Object.keys(kwArgs).length === 1 && kwArgs.from === "ability: Own Tempo";
}
if (!(args.length === 2 && verifyKWArgs(kwArgs, ["from", "ohko"], this.gen)))
return false;
if (Object.keys(kwArgs).length > 1)
return false;
return !kwArgs.from || (kwArgs.from.startsWith("ability: ") || this.gen.num === 4 && kwArgs.from === "Oblivious");
}
default: {
if (!verifyKWArgs(kwArgs, [...KWARGS, "ohko"], this.gen))
return false;
return args.length === 2 || args.length === 3 && args[2] === "confusion";
}
}
return args.length === 2 || args.length === 3 && args[2] === "confusion";
}
// TODO
"|-item|"(args, kwArgs) {
if (this.gen && this.gen.num < 2)
return false;
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyItemName(args[2], this.gen) && verifyKWArgs(kwArgs, [...KWARGS, "identify"], this.gen);
}
// TODO
"|-enditem|"(args, kwArgs) {
if (this.gen && this.gen.num < 2)
return false;
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyItemName(args[2], this.gen) && verifyKWArgs(kwArgs, [...KWARGS, "eat", "move", "weaken"], this.gen);
}
// TODO
"|-ability|"(args, kwArgs) {
if (this.gen && this.gen.num < 3)
return false;
if (!verifyKWArgs(kwArgs, [...KWARGS, "move", "weaken", "fail"], this.gen))

@@ -740,3 +1202,6 @@ return false;

}
// TODO
"|-endability|"(args, kwArgs) {
if (this.gen && this.gen.num < 3)
return false;
if (!verifyKWArgs(kwArgs, KWARGS, this.gen))

@@ -749,20 +1214,45 @@ return false;

"|-transform|"(args, kwArgs) {
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonIdent(args[2]) && verifyKWArgs(kwArgs, [...KWARGS, "msg"], this.gen);
const valid = args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonIdent(args[2]);
if (!valid)
return false;
if (this.gen && this.gen.num < 5)
return !Object.keys(kwArgs).length;
return verifyKWArgs(kwArgs, ["from"], this.gen) && (!kwArgs.from || kwArgs.from === "ability: Imposter");
}
"|-mega|"(args) {
if (this.gen && (this.gen.num < 6 || this.gen.num > 7))
return false;
return args.length === 4 && verifyPokemonIdent(args[1]) && verifySpeciesName(args[2], this.gen) && (args[3] === "" || verifyItemName(args[3], this.gen));
}
"|-primal|"(args) {
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyItemName(args[2]);
if (this.gen && this.gen.num < 6)
return false;
return args.length === 3 && verifyPokemonIdent(args[1]) && ["Blue Orb", "Red Orb"].includes(args[2]);
}
"|-burst|"(args) {
if (this.gen && this.gen.num < 7)
return false;
return args.length === 4 && verifyPokemonIdent(args[1]) && verifySpeciesName(args[2], this.gen) && verifyItemName(args[3], this.gen);
}
"|-zpower|"(args) {
if (this.gen && this.gen.num < 7)
return false;
return args.length === 2 && verifyPokemonIdent(args[1]);
}
"|-zbroken|"(args) {
if (this.gen && this.gen.num < 7)
return false;
return args.length === 2 && verifyPokemonIdent(args[1]);
}
// TODO
"|-activate|"(args, kwArgs) {
var _a;
if (((_a = this.gen) == null ? void 0 : _a.num) === 1) {
const valid = (args.length === 3 || args.length === 4 && args[3] === "") && verifyKWArgs(kwArgs, ["damage"], this.gen);
if (!valid)
return false;
if (args[1] === "")
return args[2] === "move: Splash";
return verifyPokemonIdent(args[1]) && (kwArgs.damage ? args[2] === "Substitute" : ["Bide", "confusion", "move: Haze", "move: Mist", "move: Struggle"].includes(args[2]));
}
const keys = [

@@ -797,5 +1287,17 @@ ...KWARGS,

}
"|-fieldactivate|"(args, kwArgs) {
return args.length === 2 && // fucking gag me
(args[1] === "Delta Stream" || verifyEffectName(args[1], this.gen)) && verifyKWArgs(kwArgs, KWARGS, this.gen);
"|-fieldactivate|"(args) {
if (args.length !== 2)
return false;
if (!this.gen)
return args[1] === "Delta Stream" || verifyEffectName(args[1], this.gen);
const effects = [
"move: Pay Day",
"move: Perish Song",
"move: Fairy Lock",
"move: Ion Deluge",
"Delta Stream",
"move: Teatime"
];
const to = [0, 1, 2, 2, 2, 2, 5, 5, 6, 6];
return effects.slice(this.gen.num >= 5 ? 1 : 0, to[this.gen.num]).includes(args[1]);
}

@@ -806,2 +1308,4 @@ "|-hint|"(args) {

"|-center|"(args) {
if (this.gen && this.gen.num < 5)
return false;
return args.length === 1;

@@ -813,5 +1317,9 @@ }

"|-combine|"(args) {
if (this.gen && this.gen.num < 5)
return false;
return args.length === 1;
}
"|-waiting|"(args) {
if (this.gen && this.gen.num < 5)
return false;
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyPokemonIdent(args[2]);

@@ -822,3 +1330,5 @@ }

return false;
return args.length === 3 || args.length === 4 && verifyPokemonIdent(args[3]);
if (this.gen && this.gen.num < 5)
return args.length === 3;
return args[2] === "Sky Drop" ? args.length === 4 && verifyPokemonIdent(args[3]) : args.length === 3;
}

@@ -832,6 +1342,62 @@ "|-mustrecharge|"(args) {

"|-singlemove|"(args, kwArgs) {
return args.length === 3 && verifyPokemonIdent(args[1]) && verifyMoveName(args[2], this.gen) && verifyKWArgs(kwArgs, [...KWARGS, "zeffect"], this.gen);
var _a;
const valid = args.length === 3 && verifyPokemonIdent(args[1]);
if (!valid)
return false;
switch (((_a = this.gen) == null ? void 0 : _a.num) || 0) {
case 1:
return false;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7: {
const reasons = ["Destiny Bond", "Rage"];
if (this.gen.num >= 3)
reasons.push("Grudge");
return !Object.keys(kwArgs).length && reasons.includes(args[2]);
}
case 8: {
const reasons = ["Destiny Bond", "Grudge"];
return !Object.keys(kwArgs).length && reasons.includes(args[2]);
}
case 9: {
return Object.keys(kwArgs).length ? args[2] === "Glaive Rush" && verifyKWArgs(kwArgs, ["silent"], this.gen) && kwArgs.silent === true : args[2] === "Destiny Bond" && !Object.keys(kwArgs).length;
}
default: {
return verifyMoveName(args[2], this.gen) && verifyKWArgs(kwArgs, ["silent"], this.gen);
}
}
}
// TODO DEBUG
"|-singleturn|"(args, kwArgs) {
return args.length === 3 && verifyPokemonIdent(args[1]) && (verifyMoveEffectName(args[2], this.gen) || verifyMoveName(args[2], this.gen)) && verifyKWArgs(kwArgs, [...KWARGS, "zeffect"], this.gen);
var _a;
const valid = args.length === 3 && verifyPokemonIdent(args[1]);
if (!valid)
return false;
switch (((_a = this.gen) == null ? void 0 : _a.num) || 0) {
case 1:
return false;
case 2:
case 3:
case 4: {
const reasons = ["Protect", "move: Endure"];
if (this.gen.num >= 3) {
reasons.push("Snatch", "move: Focus Punch", "move: Follow Me", "Helping Hand");
}
if (this.gen.num >= 4)
reasons.push("move: Roost");
if (!reasons.includes(args[2]))
return false;
if (this.gen.num === 2 && Object.keys(kwArgs).length)
return false;
if (!verifyKWArgs(kwArgs, ["of"], this.gen))
return false;
return !kwArgs.of || args[2] === "Helping Hand";
}
default: {
return (verifyMoveEffectName(args[2], this.gen) || verifyMoveName(args[2], this.gen)) && verifyKWArgs(kwArgs, [...KWARGS, "zeffect"], this.gen);
}
}
}

@@ -841,12 +1407,19 @@ "|-anim|"(args, kwArgs) {

}
"|-nothing|"(args) {
if (!this.raw)
throw new Error("Encountered non-upgraded |-nothing arg");
return args.length === 1;
}
};
var Verifier = class {
constructor(gen) {
constructor(gen, raw) {
this.handler = new Handler(gen);
if (raw)
this.raw = new Handler(gen, raw);
}
verify(data) {
for (const { roomid, args, kwArgs } of _chunkKG2Q3BKOjs.Protocol.parse(data)) {
for (const { roomid, args, kwArgs } of _chunkMJQWQGPXjs.Protocol.parse(data)) {
if (!verifyRoomID(roomid))
return data;
if (!this.dispatch(args, kwArgs))
if (!this.dispatch(args, kwArgs, false))
return data;

@@ -857,15 +1430,15 @@ }

verifyLine(line) {
const parsed = _chunkKG2Q3BKOjs.Protocol.parseBattleLine(line);
const { args, kwArgs } = parsed;
return this.dispatch(args, kwArgs) ? void 0 : parsed;
const parsed = _chunkMJQWQGPXjs.Protocol.parseBattleLine(line);
if (!this.dispatch(parsed.args, parsed.kwArgs, false))
return parsed;
return void 0;
}
dispatch(args, kwArgs) {
const key = _chunkKG2Q3BKOjs.Protocol.key(args);
if (!key || !this.handler[key])
dispatch(args, kwArgs, raw = false) {
const handler = raw && this.raw ? this.raw : this.handler;
const key = _chunkMJQWQGPXjs.Protocol.key(args, raw);
if (!key || !handler[key])
return false;
if (Object.keys(kwArgs).length && !(key in _chunkKG2Q3BKOjs.Protocol.ARGS_WITH_KWARGS))
if (Object.keys(kwArgs).length && !(key in _chunkMJQWQGPXjs.Protocol.ARGS_WITH_KWARGS))
return false;
if (!this.handler[key](args, kwArgs))
return false;
return true;
return handler[key](args, kwArgs);
}

@@ -872,0 +1445,0 @@ };

{
"name": "@pkmn/protocol",
"version": "0.6.16",
"version": "0.6.17",
"description": "Parsing logic for Pokémon Showdown's PROTOCOL and SIM-PROTOCOL",

@@ -40,7 +40,7 @@ "repository": "github:pkmn/ps",

"dependencies": {
"@pkmn/types": "^3.0.0"
"@pkmn/types": "^4.0.0"
},
"devDependencies": {
"@pkmn/dex": "^0.7.53",
"@pkmn/data": "^0.7.53"
"@pkmn/dex": "^0.8.0",
"@pkmn/data": "^0.8.0"
},

@@ -47,0 +47,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc