forked from 0xDC00/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPC_Steam_Unity_Spiritfarer.js
More file actions
140 lines (130 loc) · 4.48 KB
/
Copy pathPC_Steam_Unity_Spiritfarer.js
File metadata and controls
140 lines (130 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// ==UserScript==
// @name Spiritfarer: Farewell Edition
// @version
// @author [DC]
// @description Steam
// * Thunder Lotus Games
// * Unity (JIT)
//
// https://store.steampowered.com/app/972660/Spiritfarer_Farewell_Edition/
// ==/UserScript==
const Mono = require('./libMono.js');
const handlerLine = trans.send((s) => s, '250+');
const handlerLineLast = trans.send((s) => s, 500);
// private void ChangeTextIndex(int index, ConversationBubble bubble, Conversation conversation)
/*
Mono.setHook('', '.ConversationManager', 'ChangeTextIndex', -1, {
onEnter(args) {
if (args[3].isNull() === true) {
return;
}
console.log('onEnter: ConversationManager.ChangeTextIndex');
this.bubble = args[2].wrap();
},
onLeave() {
const s = this.bubble._text.wrap().get_text().readMonoString().replace(/<.*?>/g, '');
handlerLine(s);
}
}); //*/
// public IEnumerator ScrollText(ConversationBubble bubble, float overrideScrollSpeed = -1f)
Mono.setHook('', '.ConversationManager', 'ScrollText', -1, {
onEnter(args) {
console.log('onEnter: ConversationManager.ScrollText');
const bubble = args[1].wrap();
const s = bubble._text.wrap().get_text().readMonoString().replace(/<.*?>/g, '');
handlerLine(s);
}
});
// protected virtual void UpdateDisplay(ItemStack stack)
Mono.setHook('', '.ItemDescriptionPiece', 'UpdateDisplay', -1, {
onEnter(args) {
if (args[1].isNull() === true) {
return;
}
console.log('onEnter: ItemDescriptionPiece.UpdateDisplay');
this.thiz = args[0].wrap();
},
onLeave() {
try {
const title = this.thiz._itemNameText.wrap().get_text().readMonoString();
const desc = this.thiz._itemDescriptionText.wrap().get_text().readMonoString().replace(/<.*?>/g, '');
const s = title + '\r\n' + desc;
handlerLine(s);
}
catch { }
}
});
// public void ActivateHint(HintType hint, HintDisplayOptions options)
Mono.setHook('', '.DynamicHintSystem', 'ActivateHint', 2, {
onEnter(args) {
this.thiz = args[0].wrap();
},
onLeave() {
setTimeout(() => {
if (this.thiz._currentlyShowing.getValue().isNull() === true) {
return;
}
console.log('onEnter: DynamicHintSystem.ActivateHint');
const s = this.thiz._screenSpaceText.wrap().get_text().readMonoString();
handlerLineLast(s);
}, 100);
}
});
{
let hook = null;
Mono.setHook('', '.ChoiceInteractionResponse', 'OnInteractionStart', -1, {
onEnter(args) {
console.log('onEnter: ChoiceInteractionResponse');
hook = Mono.setHook('', '.LocalizedUIText', 'UpdateText', -1, {
onEnter(args) {
console.log('onEnter: LocalizedUIText.UpdateText');
this.thiz = args[0].wrap();
},
onLeave() {
const s = this.thiz.text.wrap().get_text().readMonoString().replace(/<.*?>/g, '');
handlerLine(s);
}
});
}
});
Mono.setHook('', '.ChoiceInteractionResponse', 'OnInteractionEnd', -1, {
onEnter(args) {
if (hook !== null) {
hook.detach();
hook = null;
}
}
});
}
{
let hook = null;
Mono.setHook('', '.InteractionMenuResponse', 'OnInteractionStart', -1, {
onEnter(args) {
console.log('onEnter: InteractionMenuResponse');
hook = Mono.setHook('', '.LocalizedUIText', 'UpdateText', -1, {
onEnter(args) {
console.log('onEnter: LocalizedUIText.UpdateText');
this.thiz = args[0].wrap();
},
onLeave() {
const s = this.thiz.text.wrap().get_text().readMonoString().replace(/<.*?>/g, '');
handlerLine(s);
}
});
}
});
Mono.setHook('', '.InteractionMenuResponse', 'OnInteractionEnd', -1, {
onEnter(args) {
if (hook !== null) {
hook.detach();
hook = null;
}
}
});
}
// // .SaveGame GetMapInfoLinks (string destination) System.Collections.Generic.IEnumerator<SavedMapInfoLink>
// Mono.setHook('', '.SaveGame', 'GetMapInfoLinks', -1, {
// onEnter(args) {
// handlerLineLast(args[1].readMonoString());
// },
// });