Elin Decompiled Documentation EA 23.282 Stable Patch 3
Loading...
Searching...
No Matches
DramaManager.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Globalization;
4using System.Linq;
5using DG.Tweening;
6using UnityEngine;
7using UnityEngine.UI;
8
9public class DramaManager : EMono
10{
11 public static Chara TG;
12
14
15 public CanvasGroup cg;
16
17 public CanvasGroup cgCover;
18
20
21 public Transform actorPos;
22
23 public Transform endroll;
24
26
28
30
32
34
35 public GameObject goSkip;
36
37 public Image imageBG;
38
39 public Image imageCover;
40
41 public Font[] fonts;
42
43 public Person tg;
44
45 public bool bgmChanged;
46
47 private List<DramaEvent> customEvents = new List<DramaEvent>();
48
49 public List<DramaChoice> _choices = new List<DramaChoice>();
50
51 public Dictionary<string, string> customTalkTopics = new Dictionary<string, string>();
52
53 public Dictionary<string, string> dictLocalize = new Dictionary<string, string>();
54
55 public float creditSpeed;
56
57 private string lastIF;
58
59 private string lastIF2;
60
62
63 public bool enableTone;
64
65 public bool customEventsAdded;
66
67 public bool idDefaultPassed;
68
69 public int countLine;
70
71 private string idDefault;
72
73 private string textReplace;
74
75 public static Dictionary<string, ExcelData> dictCache = new Dictionary<string, ExcelData>();
76
77 public bool keepAmbientBGM => !bgmChanged;
78
80
81 private void Update()
82 {
83 if (sequence != null)
84 {
86 }
87 }
88
90 {
91 this.setup = setup;
92 cgCover.SetActive(enable: false);
93 endroll.SetActive(enable: false);
94 tg = setup.person;
95 SetDialog();
97 {
98 setup = setup,
99 manager = this,
100 id = setup.sheet
101 };
102 Load();
103 sequence.lastStep = (sequence.lastlastStep = setup.step);
104 if (!setup.forceJump.IsEmpty())
105 {
107 }
108 else
109 {
110 sequence.Play();
111 }
112 return sequence;
113 }
114
116 {
117 sequence.Clear();
118 customEvents.Clear();
119 customTalkTopics.Clear();
120 moldActor = actorPos.CreateMold<DramaActor>();
121 if (tg != null)
122 {
123 sequence.AddActor("tg", tg);
124 }
125 sequence.AddActor("pc", new Person(EMono.pc));
126 string text = CorePath.DramaData + setup.book + ".xlsx";
127 ExcelData excelData = dictCache.TryGetValue(text);
128 if (excelData != null && excelData.IsModified())
129 {
130 excelData = null;
131 }
132 if (excelData == null)
133 {
134 excelData = new ExcelData();
135 }
136 excelData.maxEmptyRows = 10;
137 excelData.path = text;
138 List<Dictionary<string, string>> list = excelData.BuildList(setup.sheet);
139 if (!Lang.isBuiltin && dictLocalize.Count == 0)
140 {
141 foreach (Dictionary<string, string> item in new ExcelData
142 {
143 maxEmptyRows = 10,
144 path = CorePath.DramaDataLocal + setup.book + ".xlsx"
146 {
147 string text2 = item["id"];
148 if (!text2.IsEmpty() && !item["text"].IsEmpty())
149 {
150 dictLocalize.Add(text2, item["text"]);
151 }
152 }
153 }
154 dictCache[text] = excelData;
156 lastTalk = null;
158 countLine = 0;
159 for (int i = 0; i < list.Count; i++)
160 {
161 ParseLine(list[i]);
162 countLine++;
163 }
165 sequence.steps["end"] = 99999;
166 sequence.AddActor("narrator", new Person("narrator"));
167 return sequence;
168 }
169
170 public void AddCustomEvents(string idCustom = "Resident")
171 {
173 {
174 return;
175 }
176 DramaCustomSequence dramaCustomSequence = new DramaCustomSequence
177 {
178 manager = this,
180 idCustom = idCustom,
181 events = customEvents,
184 };
185 CustomEvent(delegate
186 {
187 sequence.Exit();
188 });
189 if (tg != null && tg.hasChara)
190 {
191 TG = tg.chara;
192 dramaCustomSequence.Build(tg.chara);
193 }
194 if (!sequence.setup.textData.IsEmpty())
195 {
196 dramaCustomSequence.BuildTextData();
197 }
198 foreach (DramaEvent customEvent in customEvents)
199 {
200 AddEvent(customEvent);
201 }
202 customEventsAdded = true;
203 }
204
205 public void ParseLine(Dictionary<string, string> item)
206 {
207 string[] array = (item.ContainsKey("action") ? item["action"].Split('/') : null);
208 string action = ((array != null) ? array[0] : null);
209 string text2 = (item.ContainsKey("step") ? item["step"] : null);
210 if (text2 == "//")
211 {
212 return;
213 }
214 if (text2 == idDefault)
215 {
216 idDefaultPassed = true;
217 }
218 string actor = (item.ContainsKey("actor") ? item["actor"] : "#1");
219 string[] p = (item.ContainsKey("param") ? item["param"].Split(',') : new string[0]);
220 string p2 = ((p.Length != 0) ? p[0] : "");
221 string p3 = ((p.Length > 1) ? p[1] : "");
222 string p4 = ((p.Length > 2) ? p[2] : "");
223 float.TryParse(p2, out var p0f);
224 float.TryParse(p3, out var result);
225 bool flag = !item["text_JP"].IsEmpty();
226 item.TryGetValue("text_JP");
227 string text = null;
228 if (flag)
229 {
230 if (!Lang.isBuiltin)
231 {
232 string key = item["id"];
233 if (dictLocalize.ContainsKey(key))
234 {
235 text = dictLocalize[key];
236 }
237 else
238 {
239 text = item.TryGetValue("text_EN");
240 }
241 }
242 else
243 {
244 text = item["text_" + Lang.langCode];
245 }
246 }
247 if (flag && text.StartsWith("$") && tg != null && tg.hasChara)
248 {
249 string text3 = text.Split(' ')[0];
250 text = text.Replace(text3, tg.chara.GetTalkText(text3.Remove(0, 1)));
251 }
252 string jump = (item.ContainsKey("jump") ? item["jump"] : null);
253 string text4 = (item.ContainsKey("if") ? item["if"] : null);
254 string iF = (item.ContainsKey("if2") ? item["if2"] : null);
255 string cHECK = (item.ContainsKey("check") ? item["check"] : null);
256 bool flag2 = false;
257 if (text2 != null && !sequence.steps.ContainsKey(text2) && action != "choice" && action != "cancel")
258 {
259 sequence.steps.Add(text2, sequence.events.Count);
260 }
261 if (text4 == "*")
262 {
263 text4 = lastIF;
264 iF = lastIF2;
265 }
266 else
267 {
268 lastIF = text4;
269 lastIF2 = iF;
270 }
271 if (!CheckIF(text4) || !CheckIF(iF))
272 {
273 if (action == "reload")
274 {
275 string id = "flag" + countLine;
276 sequence.AddStep(id);
277 }
278 return;
279 }
280 if (LayerDrama.fromBook && action == "editPlaylist")
281 {
282 action = "BGM";
283 }
284 switch (action)
285 {
286 case "disableFullPortrait":
287 AddEvent(delegate
288 {
289 sequence.fullPortrait = false;
290 });
291 break;
292 case "enableTone":
293 enableTone = true;
294 break;
295 case "canSkip":
296 AddEvent(delegate
297 {
298 sequence.skipJump = p2;
299 });
300 break;
301 case "screenLock":
303 break;
304 case "haltBGM":
305 EMono.Sound.haltUpdate = true;
306 break;
307 case "forceBGM":
308 AddEvent(delegate
309 {
310 SoundManager.ForceBGM();
311 });
312 break;
313 case "setFlag":
314 AddEvent(delegate
315 {
316 if (p2.StartsWith("*"))
317 {
318 Quest quest3 = EMono.game.quests.Get(p2.TrimStart('*'));
319 quest3?.ChangePhase(p3.ToInt(quest3.GetType()));
320 }
321 else
322 {
323 EMono.player.dialogFlags[p2] = (p3.IsEmpty() ? 1 : int.Parse(p3));
324 }
325 });
326 break;
327 case "reload":
328 {
329 string __step = "flag" + countLine;
330 AddEvent(delegate
331 {
332 Load();
333 sequence.Play(jump.IsEmpty(__step));
334 }, 0.01f, halt: true);
335 sequence.AddStep(__step);
336 break;
337 }
338 case "inject":
339 {
340 DramaEventTalk dramaEventTalk = lastTalk;
341 if (idDefaultPassed)
342 {
343 AddCustomEvents(p2);
344 }
345 lastTalk = dramaEventTalk;
346 break;
347 }
348 case "topic":
349 customTalkTopics[p2] = text;
350 break;
351 case "cancel":
352 lastTalk.canCancel = true;
353 lastTalk.idCancelJump = jump;
354 break;
355 case "_choices":
356 foreach (DramaChoice choice in _choices)
357 {
358 lastTalk.AddChoice(choice);
359 }
360 break;
361 case "choice":
362 if (!CheckIF(text4) || !CheckIF(iF))
363 {
364 break;
365 }
366 if (array.Length > 1)
367 {
368 switch (array[1])
369 {
370 case "quest":
371 text = "deQuest".lang();
372 jump = "_quest";
373 break;
374 case "depart":
375 text = "depart".lang();
376 jump = "_depart";
377 break;
378 case "rumor":
379 text = "letsTalk".lang();
380 jump = "_rumor";
381 break;
382 case "buy":
383 text = "daBuy".lang();
384 jump = "_buy";
385 break;
386 case "sell":
387 text = "daSell".lang();
388 jump = "_sell";
389 break;
390 case "give":
391 text = "daGive".lang();
392 jump = "_give";
393 break;
394 case "trade":
395 text = "daTrade".lang();
396 jump = "_trade";
397 break;
398 case "bye":
399 text = "bye".lang();
400 jump = "_bye";
401 break;
402 }
403 }
404 flag2 = true;
405 lastTalk.AddChoice(new DramaChoice(text, jump, p2, cHECK, text4));
406 break;
407 case "addTempActor":
408 {
409 Person person = new Person(actor);
410 Chara chara = EMono.game.cards.globalCharas.Find(actor) ?? EMono._map.FindChara(actor);
411 if (chara != null)
412 {
413 person.SetChara(chara);
414 }
415 sequence.AddActor(actor, person);
416 break;
417 }
418 case "addActor":
419 {
420 if (actor == "god")
421 {
423 break;
424 }
425 DramaActor dramaActor = sequence.AddActor(actor, new Person(actor));
426 if (!text.IsEmpty())
427 {
428 dramaActor.owner.tempName = text;
429 }
430 break;
431 }
432 case "invoke":
434 {
435 break;
436 }
437 if (jump.IsEmpty())
438 {
439 AddEvent(delegate
440 {
441 typeof(DramaOutcome).GetMethod(p[0]).Invoke(outcome, null);
442 });
443 break;
444 }
445 AddEvent(delegate
446 {
447 }, () => (!(bool)typeof(DramaOutcome).GetMethod(p[0]).Invoke(outcome, null)) ? "" : jump);
448 flag2 = true;
449 break;
450 case "refAction1":
451 AddEvent(delegate
452 {
454 });
455 break;
456 case "refAction2":
457 AddEvent(delegate
458 {
460 });
461 break;
462 case "setBG":
463 AddEvent(delegate
464 {
465 if (p2.IsEmpty())
466 {
467 imageBG.enabled = false;
468 }
469 else
470 {
471 imageBG.enabled = true;
472 imageBG.sprite = Resources.Load<Sprite>("Media/Graphics/Image/Drama/" + p2);
473 }
474 });
475 break;
476 case "setBG2":
477 AddEvent(delegate
478 {
479 Util.Instantiate<Transform>("Media/Graphics/Image/Drama/" + p2, layer).SetAsFirstSibling();
480 });
481 break;
482 case "setAdvBG":
483 AddEvent(delegate
484 {
485 if (p2.IsEmpty())
486 {
487 dialog.imageBgAdv.enabled = false;
488 }
489 else
490 {
491 dialog.imageBgAdv.enabled = true;
492 dialog.imageBgAdv.sprite = Resources.Load<Sprite>("Media/Graphics/Image/Drama/" + p2);
493 }
494 });
495 break;
496 case "glitch":
497 AddEvent(delegate
498 {
499 DramaActor.useGlitch = true;
500 });
501 break;
502 case "setDialog":
503 AddEvent(delegate
504 {
505 SetDialog(p2.IsEmpty("Default"));
506 });
507 break;
508 case "Playlist":
509 AddEvent(delegate
510 {
511 LayerDrama.haltPlaylist = false;
512 EMono.Sound.StopBGM();
513 EMono.Sound.currentBGM = null;
514 bgmChanged = true;
515 });
516 break;
517 case "editPlaylist":
518 AddEvent(delegate
519 {
520 List<int> list = new List<int>();
521 string[] array2 = p;
522 foreach (string s in array2)
523 {
524 list.Add(int.Parse(s));
525 }
526 EMono._zone.SetBGM(list);
527 });
528 break;
529 case "BGM":
530 AddEvent(delegate
531 {
532 LayerDrama.haltPlaylist = true;
533 LayerDrama.maxBGMVolume = true;
534 EMono.Sound.PlayBGM(EMono.core.refs.dictBGM[p2.ToInt()]);
535 bgmChanged = true;
536 });
537 break;
538 case "BGMStay":
539 AddEvent(delegate
540 {
541 EMono.Sound.PlayBGM(EMono.core.refs.dictBGM[p2.ToInt()]);
542 });
543 break;
544 case "lastBGM":
545 AddEvent(delegate
546 {
547 EMono.Sound.StopBGM(p0f, playLastBGM: true);
548 });
549 break;
550 case "stopBGM":
551 AddEvent(delegate
552 {
553 LayerDrama.haltPlaylist = true;
554 EMono.Sound.StopBGM(p0f);
555 EMono.Sound.currentBGM = null;
556 });
557 break;
558 case "sound":
559 AddEvent(delegate
560 {
561 if (p3 != "")
562 {
563 SoundManager.current.MuteBGMFor(float.Parse(p3, CultureInfo.InvariantCulture));
564 }
565 EMono.Sound.Play(p2);
566 });
567 break;
568 case "haltPlaylist":
569 LayerDrama.haltPlaylist = true;
570 break;
571 case "keepBGM":
572 LayerDrama.keepBGM = true;
573 break;
574 case "alphaInOut":
575 AddEvent(delegate
576 {
577 DOTween.Kill(cg);
578 cg.alpha = 1f;
579 cg.DOFade(0f, p0f).SetDelay(0.1f);
580 }, p0f, halt: true);
581 AddEvent(new DramaEventWait((result == 0f) ? 0.1f : result));
582 AddEvent(delegate
583 {
584 DOTween.Kill(cg);
585 cg.alpha = 0f;
586 cg.DOFade(1f, p0f).SetDelay(0.1f);
587 }, p0f);
588 break;
589 case "alphaIn":
590 AddEvent(delegate
591 {
592 DOTween.Kill(cg);
593 cg.alpha = 0f;
594 cg.DOFade(1f, p0f).SetDelay(0.1f);
595 }, p0f);
596 break;
597 case "alphaOut":
598 AddEvent(delegate
599 {
600 DOTween.Kill(cg);
601 cg.alpha = 1f;
602 cg.DOFade(0f, p0f).SetDelay(0.1f);
603 }, p0f, halt: true);
604 break;
605 case "fadeIn":
606 AddEvent(delegate
607 {
608 imageCover.color = ((p3 != null && p3 == "white") ? Color.white : Color.black);
609 cgCover.SetActive(enable: true);
610 cgCover.alpha = 1f;
611 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
612 }, p0f);
613 break;
614 case "fadeOut":
615 AddEvent(delegate
616 {
617 imageCover.color = ((p3 != null && p3 == "white") ? Color.white : Color.black);
618 cgCover.SetActive(enable: true);
619 cgCover.alpha = 0f;
620 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
621 }, p0f, halt: true);
622 break;
623 case "fadeInOut":
624 AddEvent(delegate
625 {
626 imageCover.color = ((p4 != null && p4 == "white") ? Color.white : Color.black);
627 cgCover.SetActive(enable: true);
628 cgCover.alpha = 0f;
629 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
630 }, p0f, halt: true);
631 AddEvent(new DramaEventWait((result == 0f) ? 0.1f : result));
632 AddEvent(delegate
633 {
634 imageCover.color = ((p4 != null && p4 == "white") ? Color.white : Color.black);
635 cgCover.SetActive(enable: true);
636 cgCover.alpha = 1f;
637 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
638 }, p0f);
639 break;
640 case "hideUI":
641 AddEvent(delegate
642 {
643 EMono.ui.Hide(p0f);
644 });
645 break;
646 case "hideDialog":
647 AddEvent(delegate
648 {
649 dialog.SetActive(enable: false);
650 });
651 break;
652 case "fadeEnd":
653 if (p0f == 0f)
654 {
655 p0f = 1f;
656 }
657 AddEvent(delegate
658 {
659 imageCover.color = Color.black;
660 cgCover.SetActive(enable: true);
661 cgCover.alpha = 0f;
662 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
663 }, p0f, halt: true);
664 AddEvent(delegate
665 {
666 dialog.SetActive(enable: false);
667 imageBG.enabled = false;
668 });
669 AddEvent(delegate
670 {
671 DOTween.Kill(cg);
672 cg.alpha = 1f;
673 cg.DOFade(0f, p0f).SetDelay(0.1f);
674 }, p0f, halt: true);
675 break;
676 case "endroll":
678 break;
679 case "showSkip":
680 goSkip.SetActive(value: true);
681 break;
682 case "canCancel":
683 AddEvent(delegate
684 {
685 sequence.canCancel = bool.Parse(p2);
686 });
687 break;
688 case "wait":
689 AddEvent(new DramaEventWait(p0f));
690 break;
691 case "end":
693 break;
694 case "modAffinity":
695 AddEvent(delegate
696 {
697 int num = int.Parse(p2);
698 if (EMono.debug.enable)
699 {
700 num *= 10;
701 }
703 });
704 break;
705 case "acceptQuest":
707 {
708 break;
709 }
710 AddEvent(delegate
711 {
712 Quest quest = EMono.game.quests.globalList.Where((Quest a) => a.source.id == p2).First();
713 EMono.game.quests.globalList.Remove(quest);
714 EMono.game.quests.Start(quest);
715 });
716 break;
717 case "startQuest":
718 AddEvent(delegate
719 {
720 Quest quest2 = Quest.Create(p2);
721 if (!quest2.HasDLC)
722 {
723 Msg.Say("(Failed DLC check)");
724 }
725 else
726 {
727 EMono.game.quests.Start(quest2);
728 LayerDrama.currentQuest = quest2;
729 if (tg != null && tg.chara != null)
730 {
731 Debug.Log("Starting Quest:" + quest2?.ToString() + "/" + tg.chara.quest?.ToString() + "/" + (quest2 == tg.chara.quest));
732 }
733 }
734 });
735 break;
736 case "setQuestClient":
737 AddEvent(delegate
738 {
739 if (LayerDrama.currentQuest != null)
740 {
741 LayerDrama.currentQuest.SetClient(tg.chara, assignQuest: false);
742 }
743 });
744 break;
745 case "updateJournal":
746 AddEvent(delegate
747 {
749 });
750 break;
751 case "addKeyItem":
752 if (!LayerDrama.fromBook)
753 {
754 AddEvent(delegate
755 {
756 int num2 = p3.ToInt();
757 EMono.player.ModKeyItem(p2, (num2 == 0) ? 1 : num2);
758 });
759 }
760 break;
761 case "drop":
762 if (!LayerDrama.fromBook)
763 {
764 AddEvent(delegate
765 {
766 Msg.Say("dropReward");
768 Thing t = ThingGen.Create(p2);
770 });
771 }
772 break;
773 case "completeQuest":
774 if (!LayerDrama.fromBook)
775 {
776 AddEvent(delegate
777 {
780 });
781 }
782 break;
783 case "nextPhase":
784 if (!LayerDrama.fromBook)
785 {
786 AddEvent(delegate
787 {
788 EMono.game.quests.Get(p2).NextPhase();
789 });
790 }
791 break;
792 case "changePhase":
793 if (!LayerDrama.fromBook)
794 {
795 AddEvent(delegate
796 {
797 EMono.game.quests.Get(p2).ChangePhase(p3.ToInt());
798 });
799 }
800 break;
801 case "addResource":
802 AddEvent(delegate
803 {
804 EMono.BranchOrHomeBranch.resources.Get(p2).Mod(p3.ToInt());
805 });
806 break;
807 case "bossText":
808 AddEvent(delegate
809 {
810 foreach (Chara chara3 in EMono._map.charas)
811 {
812 if (chara3.bossText)
813 {
814 chara3.renderer.ShowBossText();
815 }
816 }
817 });
818 break;
819 case "shake":
820 AddEvent(delegate
821 {
823 });
824 break;
825 case "tutorial":
827 {
828 Tutorial.Play(p2);
829 });
830 break;
831 case "slap":
832 AddEvent(delegate
833 {
835 {
837 });
838 });
839 break;
840 case "removeItem":
841 AddEvent(delegate
842 {
843 Thing thing = EMono.pc.things.Find(p2);
844 int num3 = p3.ToInt();
845 thing?.ModNum((num3 == 0) ? (-1) : (-num3));
846 });
847 break;
848 case "destroyItem":
849 AddEvent(delegate
850 {
851 EMono.pc.things.Find(p2).Destroy();
852 });
853 break;
854 case "focus":
855 AddEvent(delegate
856 {
858 EMono.scene.screenElin.focusOption = new BaseGameScreen.FocusOption
859 {
860 pos = pos
861 };
862 });
863 break;
864 case "focusChara":
865 AddEvent(delegate
866 {
867 Point pos2 = EMono._map.FindChara(p2).pos.Copy();
869 {
870 pos = pos2,
871 speed = p3.IsEmpty("2").ToFloat()
872 };
873 });
874 break;
875 case "focusPC":
876 AddEvent(delegate
877 {
878 EMono.scene.screenElin.focusOption = new BaseGameScreen.FocusOption
879 {
880 player = true,
881 speed = p2.IsEmpty("2").ToFloat()
882 };
883 });
884 break;
885 case "focusPos":
886 AddEvent(delegate
887 {
888 EMono.scene.screenElin.focusOption = new BaseGameScreen.FocusOption
889 {
890 pos = new Point(p2.ToInt(), p3.ToInt()),
891 speed = p4.IsEmpty("2").ToFloat()
892 };
893 });
894 break;
895 case "unfocus":
896 AddEvent(delegate
897 {
898 EMono.scene.screenElin.focusOption = null;
899 });
900 break;
901 case "setAlwaysVisible":
902 AddEvent(delegate
903 {
904 LayerDrama.alwaysVisible = EMono._map.FindChara(p2);
905 });
906 break;
907 case "effect":
908 AddEvent(delegate
909 {
910 Point from = new Point(p[1].ToInt(), p[2].ToInt());
911 Effect.Get(p2).Play(from);
912 });
913 break;
914 case "effectEmbarkIn":
915 AddEvent(delegate
916 {
918 Util.Instantiate("UI/Layer/LayerEmbark/EmbarkActor_crystal");
919 });
920 break;
921 case "effectEmbarkOut":
922 AddEvent(delegate
923 {
924 UnityEngine.Object.FindObjectOfType<EmbarkActor>().Hide();
925 });
926 break;
927 case "propEnter":
928 AddEvent(delegate
929 {
930 DramaProp component = Util.Instantiate("Media/Drama/Prop/" + p2).GetComponent<DramaProp>();
931 component.name = p2;
932 if (p3.IsEmpty())
933 {
934 component.transform.position = EMono.scene.cam.transform.position;
935 }
936 else
937 {
938 Point point = new Point(p[1].ToInt(), p[2].ToInt());
939 component.transform.position = point.PositionCenter();
940 }
941 component.Enter();
942 });
943 break;
944 case "propLeave":
945 AddEvent(delegate
946 {
947 GameObject.Find(p2).GetComponent<DramaProp>().Leave();
948 });
949 break;
950 case "destroy":
951 AddEvent(delegate
952 {
953 Chara chara2 = EMono._map.FindChara(p2);
954 if (chara2 != null)
955 {
956 chara2.Destroy();
957 }
958 else
959 {
960 Debug.Log("Drama.destroy chara not found:" + p2);
961 }
962 });
963 break;
964 case "bout_win":
965 case "bout_lose":
966 AddEvent(delegate
967 {
969 {
971 if (action == "bout_win")
972 {
974 {
975 target = tg.chara
976 });
977 }
978 EMono.pc.MoveZone(zone);
979 });
980 });
981 break;
982 case "moveZone":
983 AddEvent(delegate
984 {
986 });
987 break;
988 case "save":
989 AddEvent(delegate
990 {
991 EMono.game.Save(isAutoSave: false, silent: true);
992 });
993 break;
994 case "setHour":
995 AddEvent(delegate
996 {
997 EMono.world.date.hour = (int)p0f;
998 EMono.world.date.min = 0;
1002 });
1003 break;
1004 case "%worship":
1005 AddEvent(delegate
1006 {
1008 Tutorial.Reserve("faith");
1009 });
1010 break;
1011 case "replace":
1012 AddEvent(delegate
1013 {
1014 textReplace = text;
1015 });
1016 break;
1017 default:
1018 if (!flag)
1019 {
1020 break;
1021 }
1022 lastTalk = AddEvent(new DramaEventTalk(actor, delegate
1023 {
1024 if (!textReplace.IsEmpty())
1025 {
1026 text = textReplace;
1027 textReplace = null;
1028 }
1029 if (tg != null && (actor == "tg" || actor.IsEmpty()))
1030 {
1031 text = (enableTone ? tg.ApplyTone(text) : text);
1032 }
1033 return text;
1034 })) as DramaEventTalk;
1035 lastTalk.center = p2 == "center";
1036 break;
1037 case "new":
1038 case "saveBGM":
1039 case "checkAffinity":
1040 break;
1041 }
1042 if (!string.IsNullOrEmpty(jump) && !flag2)
1044 AddEvent(new DramaEventGoto(jump));
1045 }
1046 }
1047
1048 public DramaActor GetActor(string id)
1049 {
1050 return sequence.GetActor(id);
1051 }
1052
1054 {
1055 return sequence.AddEvent(e);
1056 }
1057
1058 public DramaEventMethod AddEvent(Action func, float duration = 0f, bool halt = false)
1059 {
1060 return AddEvent(new DramaEventMethod(func, duration, halt)) as DramaEventMethod;
1061 }
1062
1063 public DramaEventMethod AddEvent(Action func, Func<string> funcJump)
1064 {
1065 return AddEvent(new DramaEventMethod(func)
1067 jumpFunc = funcJump
1068 }) as DramaEventMethod;
1069 }
1070
1071 public DramaEvent CustomEvent(Action func, string step = null, float duration = 0f, bool halt = false)
1072 {
1073 DramaEventMethod dramaEventMethod = new DramaEventMethod(func, duration, halt)
1074 {
1075 step = step
1077 customEvents.Add(dramaEventMethod);
1078 return dramaEventMethod;
1079 }
1080
1081 public void SetDialog(string id = "Default")
1082 {
1083 DialogDrama[] componentsInChildren = GetComponentsInChildren<DialogDrama>(includeInactive: true);
1084 foreach (DialogDrama dialogDrama in componentsInChildren)
1085 {
1086 if ((bool)dialogDrama.portrait)
1087 {
1088 dialogDrama.portrait.imageFull.SetActive(enable: false);
1089 }
1090 dialogDrama.SetActive(enable: false);
1091 if (dialogDrama.name == "Dialog" + id)
1092 {
1093 dialog = dialogDrama;
1094 }
1095 }
1096 }
1097
1098 public bool CheckIF(string IF)
1099 {
1100 if (IF == null || IF.IsEmpty())
1101 {
1102 return true;
1103 }
1104 string[] array = IF.Split(',');
1105 switch (array[0])
1106 {
1107 case "garden_bloom":
1108 foreach (Chara member in EMono.pc.party.members)
1109 {
1110 if (member.CanBloom())
1111 {
1112 return true;
1113 }
1114 }
1115 return false;
1116 case "wedding_whoring":
1117 return false;
1118 case "duponne_mino":
1119 return EMono.pc.things.Find("minohorn") != null;
1120 case "duponne_rescued":
1122 {
1123 return EMono._map.FindChara("lurie_boss") != null;
1124 }
1125 return false;
1126 case "duponne_gone":
1128 {
1129 return EMono.pc.things.Find("duponneball") == null;
1130 }
1131 return false;
1132 case "duponne_killed":
1134 {
1136 }
1137 return false;
1138 case "survival":
1139 return EMono.game.IsSurvival;
1140 case "!survival":
1141 return !EMono.game.IsSurvival;
1142 case "fromBook":
1143 return LayerDrama.fromBook;
1144 case "nerun_nadenade":
1145 if (!EMono.game.startVersion.IsBelow(0, 23, 232))
1146 {
1147 return EMono.player.stats.death2 == 0;
1148 }
1149 return false;
1150 case "nerun_nadenade2":
1151 GameLang.refDrama1 = EMono.player.stats.death2.ToString() ?? "";
1152 return EMono.player.stats.death2 >= 100;
1153 case "!fromBook":
1154 return !LayerDrama.fromBook;
1155 case "WindRest":
1156 return EMono._zone is Zone_WindRest;
1157 case "guild_promote":
1158 return Guild.CurrentDrama.relation.exp >= Guild.CurrentDrama.relation.ExpToNext;
1159 case "guild_maxpromote":
1160 return Guild.CurrentDrama.relation.rank >= Guild.CurrentDrama.relation.MaxRank;
1161 case "scratch_check":
1162 return EMono.game.dateScratch > EMono.game.world.date.GetRaw();
1163 case "sister_money":
1164 return EMono.pc.GetCurrency() >= 10000;
1165 case "fiamaPet":
1166 if (EMono.pc.homeBranch != null)
1167 {
1168 foreach (Chara member2 in EMono.pc.homeBranch.members)
1169 {
1170 if (member2.isDead && member2.CanRevive() && member2.GetInt(100) != 0)
1171 {
1172 return true;
1173 }
1174 }
1175 }
1176 return false;
1177 case "hasMelilithCurse":
1178 return EMono.pc.HasElement(1206);
1179 case "merchant":
1180 return Guild.CurrentDrama == Guild.Merchant;
1181 case "fighter":
1182 return Guild.CurrentDrama == Guild.Fighter;
1183 case "thief":
1184 return Guild.CurrentDrama == Guild.Thief;
1185 case "mage":
1186 return Guild.CurrentDrama == Guild.Mage;
1187 case "hasDLC":
1188 return Steam.HasDLC(array[1].ToEnum<ID_DLC>());
1189 case "hasFlag":
1190 return EMono.player.dialogFlags.TryGetValue(array[1], 0) != 0;
1191 case "!hasFlag":
1192 return EMono.player.dialogFlags.TryGetValue(array[1], 0) == 0;
1193 case "!hasMiscreation":
1194 return !EMono.pc.party.HasElement(1248, excludePC: true);
1195 case "hasItem":
1196 return EMono.pc.things.Find(array[1]) != null;
1197 case "nasuDeliver":
1198 if (EMono.game.quests.GetPhase<QuestNasu>() == 2)
1199 {
1200 return EMono.pc.things.Find("backpack_holding") != null;
1201 }
1202 return false;
1203 case "isCompleted":
1204 return EMono.game.quests.IsCompleted(array[1]);
1205 case "costRecruit":
1206 if (EMono.Branch != null && EMono.Branch.IsRecruit(tg.chara))
1207 {
1208 return EMono.pc.GetCurrency("money2") >= CalcGold.Hire(tg.chara);
1209 }
1210 return true;
1211 case "costRecruitTicket":
1212 if (EMono.Branch != null && EMono.Branch.IsRecruit(tg.chara))
1213 {
1214 return EMono.pc.things.Find("ticket_resident") != null;
1215 }
1216 return false;
1217 case "letterTrial":
1219 {
1220 return EMono.pc.things.Find("letter_trial") != null;
1221 }
1222 return false;
1223 default:
1224 if (array.Length > 2)
1225 {
1226 int value;
1227 bool flag = EMono.player.dialogFlags.TryGetValue(array[1], out value);
1228 int num = 0;
1229 if (array[1].StartsWith("*"))
1230 {
1231 string text = array[1].TrimStart('*');
1232 Quest quest = EMono.game.quests.Get(text);
1233 if (text == "guild")
1234 {
1235 quest = Guild.CurrentQuest;
1236 }
1237 flag = quest != null;
1238 if (!EMono.game.quests.completedIDs.Contains(text))
1239 {
1240 value = quest?.phase ?? (-1);
1241 }
1242 else
1243 {
1244 value = 999;
1245 flag = true;
1246 }
1247 num = ((!int.TryParse(array[2], out var result)) ? ((quest != null) ? array[2].ToInt(quest.GetType()) : 0) : result);
1248 }
1249 else
1250 {
1251 num = int.Parse(array[2]);
1252 }
1253 switch (array[0])
1254 {
1255 case "=":
1256 if (!flag && num == -1)
1257 {
1258 return true;
1259 }
1260 if (flag && value == num)
1261 {
1262 return true;
1263 }
1264 break;
1265 case "!":
1266 if (!flag || value != num)
1267 {
1268 return true;
1269 }
1270 break;
1271 case ">":
1272 if (flag && value > num)
1273 {
1274 return true;
1275 }
1276 break;
1277 case ">=":
1278 if (flag && value >= num)
1279 {
1280 return true;
1281 }
1282 break;
1283 case "<":
1284 if (!flag || value < num)
1285 {
1286 return true;
1287 }
1288 break;
1289 case "<=":
1290 if (!flag || value <= num)
1291 {
1292 return true;
1293 }
1294 break;
1295 }
1296 return false;
1298 return setup.tag == IF;
1299 }
1300 }
1301
1302 public void Show()
1303 {
1304 SE.PopDrama();
1305 layer.SetActive(enable: true);
1306 layer.cg.alpha = 0f;
1307 layer.cg.DOFade(1f, 0.3f);
1308 }
1309
1310 public void Hide()
1311 {
1312 layer.SetActive(enable: false);
1313 }
1314}
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
FocusOption focusOption
static int Hire(Chara c)
Definition: CalcGold.cs:8
static void SetNormalRarity(bool fixedMat=false)
Chara Find(string id)
Definition: CardManager.cs:20
GlobalCharaList globalCharas
Definition: CardManager.cs:46
int GetCurrency(string id="money")
Definition: Card.cs:4029
void RecalculateFOV()
Definition: Card.cs:6559
string GetTalkText(string idTopic, bool stripPun=false, bool useDefault=true)
Definition: Card.cs:7047
Point pos
Definition: Card.cs:60
void Destroy()
Definition: Card.cs:5132
ThingContainer things
Definition: Card.cs:39
void ModNum(int a, bool notify=true)
Definition: Card.cs:3569
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6090
Definition: Chara.cs:10
bool CanRevive()
Definition: Chara.cs:5197
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:8084
Party party
Definition: Chara.cs:43
void Slap(Chara c, bool slapToDeath=false)
Definition: Chara.cs:6403
Zone currentZone
Definition: Chara.cs:257
bool CanBloom()
Definition: Chara.cs:8814
FactionBranch homeBranch
Definition: Chara.cs:1080
bool isDead
Definition: Chara.cs:391
void MoveZone(string alias)
Definition: Chara.cs:3366
bool enable
Definition: CoreDebug.cs:286
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:385
CoreRef refs
Definition: Core.cs:51
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
Portrait portrait
Definition: DialogDrama.cs:41
void AddChoice(DramaChoice choice)
Dictionary< string, string > dictLocalize
Definition: DramaManager.cs:53
DramaSequence sequence
Definition: DramaManager.cs:27
DramaOutcome outcome
Definition: DramaManager.cs:29
bool customEventsAdded
Definition: DramaManager.cs:65
string lastIF2
Definition: DramaManager.cs:59
DramaEventMethod AddEvent(Action func, float duration=0f, bool halt=false)
string textReplace
Definition: DramaManager.cs:73
CanvasGroup cg
Definition: DramaManager.cs:15
DramaEvent CustomEvent(Action func, string step=null, float duration=0f, bool halt=false)
LayerDrama layer
Definition: DramaManager.cs:13
CanvasGroup cgCover
Definition: DramaManager.cs:17
DialogDrama dialog
Definition: DramaManager.cs:31
Font[] fonts
Definition: DramaManager.cs:41
static Dictionary< string, ExcelData > dictCache
Definition: DramaManager.cs:75
DramaSequence Load()
Transform actorPos
Definition: DramaManager.cs:21
bool CheckIF(string IF)
bool idDefaultPassed
Definition: DramaManager.cs:67
void ParseLine(Dictionary< string, string > item)
void AddCustomEvents(string idCustom="Resident")
DramaEventMethod AddEvent(Action func, Func< string > funcJump)
UIDynamicList listCredit
Definition: DramaManager.cs:19
void SetDialog(string id="Default")
List< DramaChoice > _choices
Definition: DramaManager.cs:49
Dictionary< string, string > customTalkTopics
Definition: DramaManager.cs:51
DramaActor moldActor
Definition: DramaManager.cs:25
Image imageCover
Definition: DramaManager.cs:39
string idDefault
Definition: DramaManager.cs:71
List< DramaEvent > customEvents
Definition: DramaManager.cs:47
DramaEventTalk lastTalk
Definition: DramaManager.cs:61
Transform endroll
Definition: DramaManager.cs:23
string lastIF
Definition: DramaManager.cs:57
DramaSequence Play(DramaSetup setup)
Definition: DramaManager.cs:89
bool keepAmbientBGM
Definition: DramaManager.cs:77
float creditSpeed
Definition: DramaManager.cs:55
DramaEvent AddEvent(DramaEvent e)
static Chara TG
Definition: DramaManager.cs:11
void Update()
Definition: DramaManager.cs:81
GameObject goSkip
Definition: DramaManager.cs:35
DramaSetup setup
Definition: DramaManager.cs:33
DramaActor tgActor
Definition: DramaManager.cs:79
void Enter()
Definition: DramaProp.cs:11
DramaSetup setup
List< DramaEvent > events
DramaActor AddActor(string id, Person person)
DramaActor GetActor(string id)
DramaEvent AddEvent(DramaEvent e)
void Play(string id)
void AddStep(string id)
Dictionary< string, int > steps
string sheet
Definition: DramaSetup.cs:5
string step
Definition: DramaSetup.cs:7
Person person
Definition: DramaSetup.cs:19
string textData
Definition: DramaSetup.cs:11
string forceJump
Definition: DramaSetup.cs:13
Definition: EMono.cs:4
static Core core
Definition: EMono.cs:5
static Chara pc
Definition: EMono.cs:13
static Player player
Definition: EMono.cs:11
static Zone _zone
Definition: EMono.cs:19
static FactionBranch BranchOrHomeBranch
Definition: EMono.cs:23
static Game game
Definition: EMono.cs:7
static Scene scene
Definition: EMono.cs:27
static UI ui
Definition: EMono.cs:15
static SoundManager Sound
Definition: EMono.cs:39
static FactionBranch Branch
Definition: EMono.cs:21
static Map _map
Definition: EMono.cs:17
static CoreDebug debug
Definition: EMono.cs:45
Definition: Effect.cs:7
static Effect Get(Effect original)
Definition: Effect.cs:85
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:100
bool IsModified()
Definition: ExcelData.cs:72
List< Dictionary< string, string > > BuildList(string sheetName="_default")
Definition: ExcelData.cs:92
bool IsRecruit(Chara c)
List< Chara > members
HomeResourceManager resources
FactionRelation relation
Definition: FACTION.cs:126
bool Save(bool isAutoSave=false, bool silent=false)
Definition: Game.cs:1035
SpatialManager spatials
Definition: Game.cs:153
CardManager cards
Definition: Game.cs:156
bool IsSurvival
Definition: Game.cs:276
Version startVersion
Definition: Game.cs:171
new World world
Definition: Game.cs:177
QuestManager quests
Definition: Game.cs:183
Definition: Guild.cs:2
static Guild CurrentDrama
Definition: Guild.cs:24
static GuildMerchant Merchant
Definition: Guild.cs:62
static QuestGuild CurrentQuest
Definition: Guild.cs:64
static GuildMage Mage
Definition: Guild.cs:58
static GuildFighter Fighter
Definition: Guild.cs:56
static GuildThief Thief
Definition: Guild.cs:60
Definition: Hide.cs:4
BaseHomeResource Get(string id)
Definition: Lang.cs:6
static string langCode
Definition: Lang.cs:28
static bool isBuiltin
Definition: Lang.cs:42
CanvasGroup cg
Definition: LayerDrama.cs:30
static LayerDrama Instance
Definition: LayerDrama.cs:20
static bool fromBook
Definition: LayerDrama.cs:16
static Quest currentQuest
Definition: LayerDrama.cs:6
static Religion currentReligion
Definition: LayerDrama.cs:8
static Action refAction2
Definition: LayerDrama.cs:26
static Action refAction1
Definition: LayerDrama.cs:24
void ShowScreenLock(string id)
Definition: Layer.cs:207
Layer SetOnKill(Action action)
Definition: Layer.cs:579
Chara FindChara(string id)
Definition: Map.cs:2568
List< Chara > charas
Definition: Map.cs:81
void RevealAll(bool reveal=true)
Definition: Map.cs:905
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
bool HasElement(int ele, bool excludePC=false)
Definition: Party.cs:194
List< Chara > members
Definition: Party.cs:19
Definition: Person.cs:6
bool hasChara
Definition: Person.cs:38
void SetChara(Chara c)
Definition: Person.cs:88
Chara chara
Definition: Person.cs:36
bool killedDuponne
Definition: Player.cs:574
int death2
Definition: Player.cs:108
Flags flags
Definition: Player.cs:1117
Stats stats
Definition: Player.cs:1039
Dictionary< string, int > dialogFlags
Definition: Player.cs:1063
void ModKeyItem(string alias, int num=1, bool msg=true)
Definition: Player.cs:2161
void MoveZone(Zone z)
Definition: Player.cs:2054
Definition: Point.cs:9
Point Copy()
Definition: Point.cs:491
Image imageFull
Definition: Portrait.cs:30
HashSet< string > completedIDs
Definition: QuestManager.cs:17
int GetPhase(string id)
void Complete(Quest q)
Definition: QuestManager.cs:98
bool IsCompleted(string id)
void UpdateJournal()
Quest Start(string id, string idGlobalChara)
Definition: QuestManager.cs:41
List< Quest > globalList
Definition: QuestManager.cs:14
Quest Get(string id)
Definition: Quest.cs:7
virtual bool HasDLC
Definition: Quest.cs:147
static Quest Create(string _id, string _idPerson=null, Chara c=null, bool assignQuest=true)
Definition: Quest.cs:241
int phase
Definition: Quest.cs:40
virtual SourceQuest.Row source
Definition: Quest.cs:107
void JoinFaith(Chara c, ConvertType type=ConvertType.Default)
Definition: Religion.cs:407
GameScreen screenElin
Definition: Scene.cs:93
void OnChangeHour()
Definition: Scene.cs:777
Definition: Shaker.cs:5
static void ShakeCam(string id="default", float magnitude=1f)
Definition: Shaker.cs:25
Zone Find(string id)
Definition: Steam.cs:10
static bool HasDLC(ID_DLC id)
Definition: Steam.cs:41
Thing Find(int uid)
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
static void Reserve(string idStep, Action onBeforePlay=null)
Definition: Tutorial.cs:55
static void Play(string idStep)
Definition: Tutorial.cs:7
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67
GameDate date
Definition: World.cs:6
void AddPreEnter(ZonePreEnterEvent e, bool executeIfActiveZone=true)
Definition: Zone.cs:12
ZoneEventManager events
Definition: Zone.cs:40
void SetBGM(List< int > ids, bool refresh=true, float fadeDuration=0f)
Definition: Zone.cs:3003
ZoneInstance instance
Definition: Zone.cs:55
Card AddCard(Card t, Point point)
Definition: Zone.cs:1994
bool IsBelow(int _major, int _minor, int _batch)
Definition: Version.cs:31