mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 19:45:50 +00:00
2 lines
6.6 KiB
JavaScript
2 lines
6.6 KiB
JavaScript
const _0x38c295=_0x4996;(function(_0x2379d5,_0x3b247a){const _0x3ffd16=_0x4996,_0x1451c5=_0x2379d5();while(!![]){try{const _0x3e8606=parseInt(_0x3ffd16(0x141))/0x1*(parseInt(_0x3ffd16(0x131))/0x2)+-parseInt(_0x3ffd16(0x151))/0x3*(parseInt(_0x3ffd16(0x143))/0x4)+parseInt(_0x3ffd16(0x138))/0x5+parseInt(_0x3ffd16(0x142))/0x6+parseInt(_0x3ffd16(0x136))/0x7+parseInt(_0x3ffd16(0x146))/0x8*(parseInt(_0x3ffd16(0x133))/0x9)+parseInt(_0x3ffd16(0x158))/0xa*(-parseInt(_0x3ffd16(0x140))/0xb);if(_0x3e8606===_0x3b247a)break;else _0x1451c5['push'](_0x1451c5['shift']());}catch(_0x1b32fd){_0x1451c5['push'](_0x1451c5['shift']());}}}(_0x1549,0x22a34));function _0x4996(_0xd6cad5,_0x535f66){const _0x15498d=_0x1549();return _0x4996=function(_0x4996a1,_0x4d2986){_0x4996a1=_0x4996a1-0x12f;let _0x2a8a22=_0x15498d[_0x4996a1];return _0x2a8a22;},_0x4996(_0xd6cad5,_0x535f66);}const DEBUG_MODE=!![],SCRIPT_ID_PREFIX=_0x38c295(0x148);export function logDebug(..._0x195e75){const _0x78f1c2=_0x38c295;DEBUG_MODE&&console[_0x78f1c2(0x149)]('['+SCRIPT_ID_PREFIX+']',..._0x195e75);}export function logError(..._0xa9201a){console['error']('['+SCRIPT_ID_PREFIX+']',..._0xa9201a);}export function isCwbEnabled(){const _0x5d1fc6=_0x38c295;try{const _0x1adfe7=JSON[_0x5d1fc6(0x14f)](localStorage[_0x5d1fc6(0x159)](_0x5d1fc6(0x13d))||'{}');if(_0x1adfe7[_0x5d1fc6(0x155)]!==undefined)return _0x1adfe7[_0x5d1fc6(0x155)]===!![];const _0x58cc23=localStorage[_0x5d1fc6(0x159)](_0x5d1fc6(0x14b));if(_0x58cc23){const _0x4a7ebc=JSON[_0x5d1fc6(0x14f)](_0x58cc23);if(_0x4a7ebc?.[_0x5d1fc6(0x155)]!==undefined)return _0x4a7ebc[_0x5d1fc6(0x155)]===!![];}return!![];}catch(_0x4313de){return console[_0x5d1fc6(0x134)](_0x5d1fc6(0x13a),_0x4313de),!![];}}export function checkCwbEnabled(_0xf3ff4a='操作'){const _0x2b1478=_0x38c295;if(!isCwbEnabled())return console[_0x2b1478(0x149)]('['+SCRIPT_ID_PREFIX+']\x20'+_0xf3ff4a+'被跳过\x20-\x20CharacterWorldBook总开关已关闭'),![];return!![];}export function showToastr(_0x2ab4ee,_0x5849b6,_0x663368={}){const _0x39b1a9=_0x38c295;if(!isCwbEnabled())return;window[_0x39b1a9(0x14c)]?(window[_0x39b1a9(0x14c)]['clear'](),window['toastr'][_0x2ab4ee](_0x5849b6,_0x39b1a9(0x137),_0x663368)):logDebug(_0x39b1a9(0x15a)+_0x2ab4ee+'):\x20'+_0x5849b6);}function _0x1549(){const _0x556ba4=['cwb_boolean_settings_override','max','test','5724070tKaHcb','258DOyUvN','612336dNleve','232AtInHR','call','match','8xjPbsr','isArray','CWB','log','includes','extensions_settings_ST-Amily2-Chat-Optimisation','toastr','\x0a[--Amily2::CHAR_END--]','[--Amily2::CHAR_START--]\x0a','parse','hasOwnProperty','11226KEcRws','split','map','unknown_chat_source','cwb_master_enabled','object','filter','10AqRsCy','getItem','Toastr\x20(','forEach','prototype','1052yhndcO','trim','2438532yFrnEz','error',''','1103074vqsqoZ','角色世界书','1064940WbgcVO','length','[CWB]\x20Error\x20reading\x20master\x20switch\x20state:','replace','string'];_0x1549=function(){return _0x556ba4;};return _0x1549();}export function escapeHtml(_0x478b0e){const _0x1c1d17=_0x38c295;if(typeof _0x478b0e!==_0x1c1d17(0x13c))return'';return _0x478b0e[_0x1c1d17(0x13b)](/&/g,'&')['replace'](/</g,'<')[_0x1c1d17(0x13b)](/>/g,'>')['replace'](/"/g,'\x22')['replace'](/'/g,_0x1c1d17(0x135));}export function cleanChatName(_0x52de28){const _0x1e52ab=_0x38c295;if(!_0x52de28||typeof _0x52de28!==_0x1e52ab(0x13c))return _0x1e52ab(0x154);let _0x4f5583=_0x52de28;if(_0x52de28[_0x1e52ab(0x14a)]('/')||_0x52de28[_0x1e52ab(0x14a)]('\x5c')){const _0x1201ba=_0x52de28['split'](/[\\/]/);_0x4f5583=_0x1201ba[_0x1201ba[_0x1e52ab(0x139)]-0x1];}return _0x4f5583[_0x1e52ab(0x13b)](/\.jsonl$/,'')[_0x1e52ab(0x13b)](/\.json$/,'');}export function compareVersions(_0x1076b2,_0x3e0dea){const _0x2d3335=_0x38c295,_0x4a0322=String(_0x1076b2)[_0x2d3335(0x152)]('.')[_0x2d3335(0x153)](Number),_0x3ca967=String(_0x3e0dea)[_0x2d3335(0x152)]('.')[_0x2d3335(0x153)](Number);for(let _0xa41569=0x0;_0xa41569<Math[_0x2d3335(0x13e)](_0x4a0322['length'],_0x3ca967[_0x2d3335(0x139)]);_0xa41569++){const _0x44b8c0=_0x4a0322[_0xa41569]||0x0,_0x9e1f93=_0x3ca967[_0xa41569]||0x0;if(_0x44b8c0>_0x9e1f93)return 0x1;if(_0x44b8c0<_0x9e1f93)return-0x1;}return 0x0;}export function parseCustomFormat(_0x53ab0b){const _0x1c8852=_0x38c295,_0x265bf9={};if(typeof _0x53ab0b!==_0x1c8852(0x13c))return _0x265bf9;const _0x4e0c7b=_0x53ab0b[_0x1c8852(0x145)](/\[--Amily2::CHAR_START--\]([\s\S]*?)\[--Amily2::CHAR_END--\]/);if(!_0x4e0c7b||!_0x4e0c7b[0x1])return _0x265bf9;const _0x342192=_0x4e0c7b[0x1],_0x12eba0=(_0x26b008,_0x4580d9,_0x4e7136)=>{const _0xef770b=_0x1c8852,_0x3c3e76=_0x4580d9[_0xef770b(0x152)]('.');let _0x40a0db=_0x26b008;for(let _0x5c49fd=0x0;_0x5c49fd<_0x3c3e76['length']-0x1;_0x5c49fd++){const _0x2283bb=_0x3c3e76[_0x5c49fd],_0x400a83=_0x3c3e76[_0x5c49fd+0x1],_0x5ae114=/^\d+$/[_0xef770b(0x13f)](_0x400a83);!_0x40a0db[_0x2283bb]&&(_0x40a0db[_0x2283bb]=_0x5ae114?[]:{}),_0x40a0db=_0x40a0db[_0x2283bb];}const _0x35e568=_0x3c3e76[_0x3c3e76[_0xef770b(0x139)]-0x1];/^\d+$/[_0xef770b(0x13f)](_0x35e568)&&Array['isArray'](_0x40a0db)?_0x40a0db[parseInt(_0x35e568,0xa)]=_0x4e7136:_0x40a0db[_0x35e568]=_0x4e7136;},_0x5e994f=_0x342192[_0x1c8852(0x152)]('\x0a')[_0x1c8852(0x157)](_0x843880=>_0x843880[_0x1c8852(0x132)]()!=='');return _0x5e994f[_0x1c8852(0x12f)](_0x3c7e74=>{const _0x27a6b3=_0x1c8852,_0x544c6f=_0x3c7e74['match'](/^\[{1,2}(.*?)\]{1,2}:([\s\S]*)$/);if(_0x544c6f){const _0x2f5e8b=_0x544c6f[0x1],_0x45271e=_0x544c6f[0x2][_0x27a6b3(0x132)]();_0x12eba0(_0x265bf9,_0x2f5e8b,_0x45271e);}}),_0x265bf9;}function buildCustomFormatRecursive(_0x4b3004,_0x35c1fa=''){const _0x7d17d9=_0x38c295;let _0x108b43='';for(const _0x12bb5c in _0x4b3004){if(Object[_0x7d17d9(0x130)][_0x7d17d9(0x150)][_0x7d17d9(0x144)](_0x4b3004,_0x12bb5c)){const _0x255cd5=_0x35c1fa?_0x35c1fa+'.'+_0x12bb5c:_0x12bb5c,_0x115a84=_0x4b3004[_0x12bb5c];if(_0x115a84===null||_0x115a84===undefined)continue;if(typeof _0x115a84==='object'&&!Array[_0x7d17d9(0x147)](_0x115a84))_0x108b43+=buildCustomFormatRecursive(_0x115a84,_0x255cd5);else Array[_0x7d17d9(0x147)](_0x115a84)?_0x115a84[_0x7d17d9(0x139)]>0x0&&typeof _0x115a84[0x0]===_0x7d17d9(0x156)&&_0x115a84[0x0]!==null?_0x115a84['forEach']((_0x167804,_0x46eedf)=>{_0x108b43+=buildCustomFormatRecursive(_0x167804,_0x255cd5+'.'+_0x46eedf);}):_0x115a84[_0x7d17d9(0x12f)]((_0x425283,_0x6020b5)=>{_0x108b43+='['+_0x255cd5+'.'+_0x6020b5+']:'+_0x425283+'\x0a';}):_0x108b43+='['+_0x255cd5+']:'+_0x115a84+'\x0a';}}return _0x108b43;}export function buildCustomFormat(_0x40e36c){const _0x3af960=_0x38c295;let _0x44c89a=buildCustomFormatRecursive(_0x40e36c);return _0x44c89a=_0x44c89a[_0x3af960(0x152)]('\x0a')[_0x3af960(0x157)](_0x2fb3e9=>_0x2fb3e9[_0x3af960(0x145)](/^\[.*?]:.+/))['join']('\x0a'),_0x3af960(0x14e)+_0x44c89a['trim']()+_0x3af960(0x14d);}
|