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AC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;iBACvH;gBAAC,OAAO,CAAC,EAAE;oBACR,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBACpB;aACJ;iBAAM;gBACH,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;aACrC;SACJ;KACJ;IACD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AACrC,CAAC;AApCD,wDAoCC","file":"","sourceRoot":"/","sourcesContent":["import { ConditionItem, ConditionOprandType, ConditionOperator, ConditionExpression, ConditionRelation } from \"../model/ConditionModel\";\nimport { GameRecord } from \"../game-data/GameRecord\";\nimport { uniqArray, DeepReadonly } from \"simba-utils\";\nimport { ConfigManager } from \"../../common/gameplay/managers/ConfigManager\";\n\nfunction evalConditionItem(item: ConditionItem) {\n let op1 = GameRecord.getVariableValue(item.target);\n let op2: string | number;\n if (item.oprand.type === ConditionOprandType.Const) {\n op2 = item.target;\n } else {\n op2 = GameRecord.getVariableValue(item.target)\n }\n switch (item.operator) {\n case ConditionOperator.Equal:\n return op1 == op2;\n case ConditionOperator.Greater:\n return op1 > op2;\n case ConditionOperator.GreaterOrEqual:\n return op1 >= op2;\n case ConditionOperator.Less:\n return op1 < op2;\n case ConditionOperator.LessOrEqual:\n return op1 <= op2;\n case ConditionOperator.NotEqual:\n return op1 != op2;\n }\n}\n\nexport function evalConditionExpr(condition: DeepReadonly<ConditionExpression>): boolean {\n let ret = condition.relation === ConditionRelation.Or ? false : true;\n for (let group of condition.groups) {\n for (let item of group.items) {\n ret = evalConditionItem(item);\n if ((ret && group.relation === ConditionRelation.Or) || (!ret && group.relation === ConditionRelation.And)) {\n break;\n }\n }\n if ((ret && condition.relation === ConditionRelation.Or) || (!ret && condition.relation === ConditionRelation.And)) {\n break;\n }\n }\n return ret;\n}\n\nexport function parseTextWithVariables(text: string) {\n if (text.charCodeAt(0) !== 1) return { parsedText: text, variables: [] };\n text = text.substr(1);\n let parsedText = text;\n let matches = parsedText.match(/\\${(.*?)}/g);\n if (!matches) return { parsedText: text, variables: [] };\n let matchVars = uniqArray(matches);\n let variables = matchVars.map(v => v.substring(2, v.length - 1));\n for (let i = 0; i < matchVars.length; i++) {\n let varName = variables[i];\n if (/^[gr]\\./.test(varName)) {\n parsedText = parsedText.replace(new RegExp(matchVars[i].replace(/\\./gm, \"\\\\.\").replace(/\\$/gm, \"\\\\$\"), \"gm\"), GameRecord.getVariableValue(varName).toString());\n } else { // value from table\n let index = varName.indexOf(\".\");\n let index1 = varName.indexOf(\"[\");\n if (index >= 0) {\n let tableName = varName.substring(0, index1);\n let valueId = parseInt(varName.substring(index1 + 1, index - 1));\n let fieldName = varName.substring(index + 1);\n try {\n let text = ConfigManager.getConfig<any>({ name: tableName }, valueId)[fieldName];\n if (typeof text === \"number\") {\n text = text.toString();\n } else {\n text = parseTextWithVariables(text);\n }\n parsedText = parsedText.replace(new RegExp(matchVars[i].replace(/\\./gm, \"\\\\.\").replace(/\\$/gm, \"\\\\$\"), \"gm\"), text);\n } catch (e) {\n console.error(e);\n }\n } else {\n console.error(\"Invalid variable\");\n }\n }\n }\n return { parsedText, variables };\n}"]}