Elin Decompiled Documentation EA 23.290 Nightly
Loading...
Searching...
No Matches
ActPlan.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using UnityEngine;
5using UnityEngine.UI;
6
7public class ActPlan : EClass
8{
9 public class List : List<Item>
10 {
11 public void Add(Act a, string s = "")
12 {
13 Add(new Item
14 {
15 act = a
16 });
17 }
18 }
19
20 public class Item
21 {
22 public Act act;
23
24 public Card tc;
25
26 public Point pos;
27
28 public Chara cc => EClass.pc;
29
30 public bool HideHint
31 {
32 get
33 {
34 if (!EClass.pc.isBlind)
35 {
36 if (tc != null && tc.isChara)
37 {
38 return !EClass.pc.CanSee(tc);
39 }
40 return false;
41 }
42 return true;
43 }
44 }
45
46 public string GetText(bool showName)
47 {
48 return act.GetText() + ((showName && act.GetTextSmall(tc) != null) ? ("\n<size=28>" + act.GetTextSmall(tc) + "</size>") : "");
49 }
50
51 public string GetTextContext(bool showName)
52 {
53 return act.GetText() + ((showName && tc != null && !HideHint) ? ("<size=13> (" + tc.Name + ")</size>") : "");
54 }
55
56 public bool Perform(bool repeated = false)
57 {
58 if (AM_Adv.actCount == 0 && !Dialog.warned)
59 {
60 warning = true;
61 Card lastMouseCard = EClass.scene.mouseTarget.card;
62 Chara _CC = Act.CC;
63 Card _TC = Act.TC;
64 Point _TP = new Point(Act.TP);
65 if (EClass._zone.IsCrime(EClass.pc, act) && act.ID != "actContainer")
66 {
67 Dialog.TryWarnCrime(delegate
68 {
69 Act.CC = _CC;
70 Act.TC = _TC;
71 Act.TP.Set(_TP);
72 EClass.scene.mouseTarget.card = lastMouseCard;
73 if (Perform())
74 {
76 }
77 });
78 return false;
79 }
80 if (act is TaskHarvest && (act as TaskHarvest).mode == BaseTaskHarvest.HarvestType.Disassemble)
81 {
83 {
84 Act.CC = _CC;
85 Act.TC = _TC;
86 Act.TP.Set(_TP);
87 if (Perform())
88 {
90 }
91 });
92 return false;
93 }
94 }
95 warning = false;
96 int num = cc.pos.Distance(pos);
97 bool flag = num == 1 && cc.CanInteractTo(pos);
98 AIAct aIAct = act as AIAct;
99 if (act.IsAct)
100 {
101 Act.CC = EClass.pc;
102 if (act.PerformDistance != -1 && (num > act.PerformDistance || (num == 1 && !flag)))
103 {
105 {
106 pos = pos.Copy()
107 });
108 return false;
109 }
110 bool num2 = act.Perform(cc, tc, pos);
111 if (num2 && !EClass.pc.HasNoGoal)
112 {
114 }
115 if (num2)
116 {
117 return EClass.pc.HasNoGoal;
118 }
119 return false;
120 }
121 if (repeated)
122 {
123 if (cc.ai.GetType() == act.GetType() && cc.ai.IsRunning)
124 {
125 return false;
126 }
127 aIAct.Reset();
128 if (!act.CanPerform())
129 {
131 return false;
132 }
133 if (aIAct is Task task)
134 {
135 task.isDestroyed = false;
136 TaskPoint taskPoint = task as TaskPoint;
137 if (EClass.scene.mouseTarget.isValid && taskPoint != null)
138 {
139 taskPoint.isRepeated = true;
140 taskPoint.pos = EClass.scene.mouseTarget.pos.Copy();
141 }
142 }
143 }
144 cc.SetAIImmediate(aIAct);
145 ActionMode.Adv.SetTurbo(aIAct.UseTurbo ? (-1) : 0);
146 return false;
147 }
148 }
149
150 public static bool warning;
151
152 public Point pos = new Point();
153
155
156 public bool performed;
157
158 public bool altAction;
159
161
163
164 private bool showOrder;
165
166 public List list = new List();
167
168 public int dist;
169
170 public Thing tool;
171
173
174 public Act lastAct;
175
176 public bool IsSelf => dist == 0;
177
179
181 {
182 get
183 {
185 {
186 return dist == 1;
187 }
188 return false;
189 }
190 }
191
192 public bool canRepeat
193 {
194 get
195 {
196 if (list.Count == 1)
197 {
198 return list[0].act.CanPressRepeat;
199 }
200 return false;
201 }
202 }
203
204 public Chara cc => EClass.pc;
205
207 {
208 get
209 {
210 if (list.Count != 0)
211 {
212 if (list.Count <= 1)
213 {
214 return list[0].act.GetCursorIcon(list[0].tc);
215 }
216 return CursorSystem.Notice;
217 }
218 return null;
219 }
220 }
221
222 public bool WillEndTurn
223 {
224 get
225 {
226 if (list.Count > 0)
227 {
228 return list[0].act.WillEndTurn;
229 }
230 return false;
231 }
232 }
233
234 public bool HideRightInfo
235 {
236 get
237 {
238 if (list.Count > 0)
239 {
240 return list[0].act.HideRightInfo;
241 }
242 return false;
243 }
244 }
245
246 public bool HasAct => list.Count > 0;
247
248 public bool ShowAct
249 {
250 get
251 {
252 if (HasAct)
253 {
254 if (lastAct != list[0].act)
255 {
256 return list[0].act.ShowMouseHint(list[0].tc);
257 }
258 return false;
259 }
260 return false;
261 }
262 }
263
265 {
266 get
267 {
268 if (list.Count > 1)
269 {
270 return list[0].tc != list.LastItem().tc;
271 }
272 return false;
273 }
274 }
275
276 public string GetText(bool showName)
277 {
278 if (list.Count == 0)
279 {
280 return "";
281 }
282 if (list.Count == 1)
283 {
284 return list[0].GetText(showName);
285 }
286 return "+" + list.Count + ((HasMultipleTargets || list[0].tc == null) ? ("\n<size=28>(" + "multipleTargets".lang() + ")</size>") : ("\n<size=28>" + list[0].tc.Name + list[0].tc.GetExtraName() + "</size>"));
287 }
288
289 public Func<bool> GetAction()
290 {
291 if (list.Count == 0)
292 {
293 return () => false;
294 }
295 if (list.Count > 1)
296 {
297 return delegate
298 {
300 {
301 return false;
302 }
304 return false;
305 };
306 }
307 Item item = list[0];
308 return delegate
309 {
310 if (item.act is AIAct)
311 {
312 (item.act as AIAct).owner = EClass.pc;
313 }
314 if (performed && !item.act.CanPressRepeat)
315 {
316 return false;
317 }
318 performed = true;
319 lastAct = item.act;
320 return item.Perform(performed);
321 };
322 }
323
324 public void Order(string id)
325 {
326 EClass.player.forceTalk = true;
327 EClass.pc.SayRaw(id.lang());
328 }
329
330 public void ShowContextMenu()
331 {
332 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
333 int num = 1;
334 if (showOrder)
335 {
336 UIContextMenu uIContextMenu2 = uIContextMenu.AddChild("order_ally");
337 uIContextMenu2.AddButton("order_fight", delegate
338 {
339 Order("order_fight");
340 });
341 uIContextMenu2.AddButton("order_heal", delegate
342 {
343 Order("order_heal");
344 });
345 uIContextMenu2.AddButton("order_wait", delegate
346 {
347 Order("order_wait");
348 });
349 }
350 foreach (Item i in list)
351 {
352 string textContext = i.GetTextContext(HasMultipleTargets);
353 textContext = textContext.Replace("\n", " ").Replace(Environment.NewLine, " ");
354 uIContextMenu.AddButton(textContext, delegate
355 {
356 performed = true;
357 if (i.Perform())
358 {
360 }
361 });
362 num++;
363 if (num >= 21)
364 {
365 break;
366 }
367 }
368 uIContextMenu.Show();
369 EClass.ui.hud.HideMouseInfo();
370 }
371
372 public bool TrySetAct(string lang, Func<bool> onPerform, Card tc, CursorInfo cursor = null, int dist = 1, bool isHostileAct = false, bool localAct = true, bool canRepeat = false)
373 {
374 return TrySetAct(new DynamicAct(lang, onPerform)
375 {
376 id = lang,
377 dist = dist,
378 isHostileAct = isHostileAct,
379 localAct = localAct,
380 cursor = ((cursor == CursorSystem.Arrow) ? null : cursor),
381 canRepeat = () => canRepeat
382 }, tc);
383 }
384
385 public bool TrySetAct(string lang, Func<bool> onPerform, CursorInfo cursor = null, int dist = 1)
386 {
387 return TrySetAct(new DynamicAct(lang, onPerform)
388 {
389 id = lang,
390 dist = dist,
391 cursor = ((cursor == CursorSystem.Arrow) ? null : cursor)
392 });
393 }
394
395 public bool TrySetAct(Act _act, Card _tc = null)
396 {
397 if (!ignoreAddCondition && !_act.CanPerform(cc, _tc, pos))
398 {
399 return false;
400 }
401 Item item = new Item
402 {
403 act = _act,
404 tc = _tc,
405 pos = pos.Copy()
406 };
407 if (_tc != null && _tc.isChara)
408 {
409 int num = -1;
410 for (int i = 0; i < list.Count; i++)
411 {
412 if (list[i].tc == _tc)
413 {
414 num = i;
415 }
416 }
417 if (num != -1)
418 {
419 list.Insert(num + 1, item);
420 }
421 else
422 {
423 list.Add(item);
424 }
425 }
426 else
427 {
428 list.Add(item);
429 }
430 return true;
431 }
432
433 public void Clear()
434 {
435 list.Clear();
436 pos.IsValid = false;
437 }
438
439 public void Update(PointTarget target)
440 {
441 if (warning)
442 {
443 return;
444 }
445 _Update(target);
446 if (!HasAct)
447 {
448 return;
449 }
450 Color effectColor = ((list.Count == 1) ? list[0].act.GetActPlanColor() : EClass.Colors.colorAct);
451 if (input == ActInput.LeftMouse || input == ActInput.Key)
452 {
453 EClass.ui.hud.textLeft.SetText(GetText(showName: true));
454 Outline[] components = EClass.ui.hud.textLeft.GetComponents<Outline>();
455 for (int i = 0; i < components.Length; i++)
456 {
457 components[i].effectColor = effectColor;
458 }
459 }
460 else if (input == ActInput.RightMouse)
461 {
463 EClass.ui.hud.imageRight.rectTransform.localScale = new Vector3(2f, 2f, 1f);
464 EClass.ui.hud.textRight.SetText(GetText(showName: true));
465 Outline[] components = EClass.ui.hud.textRight.GetComponents<Outline>();
466 for (int i = 0; i < components.Length; i++)
467 {
468 components[i].effectColor = effectColor;
469 }
470 }
471 }
472
473 public void _Update(PointTarget target)
474 {
475 showOrder = false;
476 performed = false;
477 list.Clear();
478 listPick.Clear();
479 if (!pos.Equals(target.pos))
480 {
481 lastAct = null;
482 }
483 pos.Set(target.pos);
485 if (!pos.IsValid || EClass.pc.isDead)
486 {
487 return;
488 }
489 Point _pos = new Point(pos);
490 _ = target.pos.cell;
491 List<Card> items = _pos.ListCards();
492 bool isKey = input == ActInput.Key;
493 altAction = (EInput.isShiftDown && !EInput.isAltDown && !isKey) || input == ActInput.AllAction;
494 _canInteractNeighbor = dist == 0 || (dist == 1 && cc.CanInteractTo(_pos));
495 if (EClass.pc.isBlind && !_pos.Equals(EClass.pc.pos) && !isKey && input != 0)
496 {
497 return;
498 }
499 if (isKey || input == ActInput.LeftMouse || input == ActInput.AllAction)
500 {
501 if (EClass.ui.IsDragging)
502 {
503 return;
504 }
505 if (_pos.cell.outOfBounds)
506 {
507 if (EClass.player.CanExitBorder(_pos))
508 {
510 }
511 return;
512 }
513 if (!isKey && _pos.Equals(cc.pos) && EClass._zone.IsRegion)
514 {
515 TrySetAct("actNewZone", delegate
516 {
518 return false;
520 if (input == ActInput.AllAction)
521 {
522 TrySetAct("LayerTravel", delegate
523 {
524 EClass.ui.AddLayer<LayerTravel>();
525 return false;
526 }, null, CursorSystem.MoveZone, 1, isHostileAct: false, localAct: false);
527 }
528 }
529 items.ForeachReverse(delegate(Card _c)
530 {
531 Chara c2 = _c.Chara;
532 if (c2 != null && !c2.IsPC && EClass.pc.CanSee(c2))
533 {
534 int num = c2.Dist(EClass.pc);
535 if (num <= 1 || !EClass.pc.isBlind)
536 {
537 if (c2.mimicry != null && !c2.IsPCParty)
538 {
539 if (num <= 1)
540 {
541 c2.mimicry.TrySetAct(this);
542 }
543 }
544 else
545 {
546 if (!EClass.pc.isBlind && !c2.IsHostile() && (input == ActInput.AllAction || !(c2.IsPCParty || c2.IsMinion || isKey)) && (input == ActInput.AllAction || !c2.IsNeutral() || c2.quest != null || EClass.game.quests.IsDeliverTarget(c2)) && c2.isSynced && num <= 2)
547 {
548 bool flag5 = !c2.HasCondition<ConSuspend>() && (!c2.isRestrained || !c2.IsPCFaction);
550 {
551 flag5 = false;
552 }
553 if (flag5 || altAction)
554 {
555 if (EClass.pc.HasElement(1216) && c2.HasCondition<ConSleep>())
556 {
558 {
559 target = c2,
560 variation = AI_Fuck.Variation.Succubus
561 }, c2);
562 }
563 TrySetAct(ACT.Chat, c2);
564 }
565 }
566 if (!c2.IsPC && num <= 2 && ((c2.IsPCFaction && !c2.IsDisabled) || EClass.debug.enable) && input == ActInput.AllAction)
567 {
568 TrySetAct("actTrade", delegate
569 {
571 return false;
572 }, c2, null, 2);
573 }
574 if (c2.host != EClass.pc)
575 {
576 TraitShackle traitShackle = c2.pos.FindThing<TraitShackle>();
578 {
579 if (traitShackle != null && traitShackle.AllowTraining)
580 {
582 {
583 target = c2
584 });
585 }
586 }
587 else if ((c2.IsHostile() || altAction || c2.isRestrained) && c2.IsAliveInCurrentZone)
588 {
589 TrySetAct(ACT.Melee, c2);
590 }
591 }
592 if (c2.IsPCPartyMinion && !c2.Chara.IsEscorted() && altAction)
593 {
594 TrySetAct("ActBanishSummon", delegate
595 {
596 c2.Banish(EClass.pc);
597 return true;
598 }, c2, null, 99);
599 List<Chara> list2 = new List<Chara>();
600 foreach (Chara chara in EClass._map.charas)
601 {
602 if (chara.IsPCFactionMinion && !chara.IsEscorted())
603 {
604 list2.Add(chara);
605 }
606 }
607 if (list2.Count > 1)
608 {
609 TrySetAct("ActBanishSummonAll", delegate
610 {
611 foreach (Chara item in list2)
612 {
613 item.Banish(EClass.pc);
614 }
615 return true;
616 }, c2, null, 99);
617 }
618 }
619 }
620 }
621 }
622 });
623 if (_pos.IsHidden)
624 {
625 return;
626 }
628 {
629 items.ForeachReverse(delegate(Card _c)
630 {
631 Chara c = _c.Chara;
632 if (c != null && (c.mimicry == null || c.IsPCParty))
633 {
634 bool flag3 = EClass.pc.CanSee(c);
635 if (flag3)
636 {
637 if (input == ActInput.LeftMouse && c.IsPCFaction && !c.IsPC && pos.FindThing<TraitHitchingPost>() != null)
638 {
639 Chara ride = c;
640 List<string> list = EClass.core.pccs.sets["ride"].map["body"].map.Keys.ToList();
641 int index = list.IndexOf(ride.c_idRidePCC);
642 if (index == -1)
643 {
644 index = 0;
645 }
646 TrySetAct("ActChangeRideSkin", delegate
647 {
648 UIContextMenu uIContextMenu = EClass.ui.CreateContextMenuInteraction();
649 uIContextMenu.AddSlider("rideSkin", (float a) => list[(int)a].Split('-')[0] ?? "", index, delegate(float a)
650 {
651 ride.c_idRidePCC = list[(int)a];
652 ride._CreateRenderer();
653 }, 0f, list.Count - 1, isInt: true, hideOther: false);
654 uIContextMenu.Show();
655 return false;
656 }, c);
657 }
658 if (c.host != null && EClass.pc.held != null && altAction)
659 {
660 bool flag4 = true;
662 {
663 flag4 = false;
664 }
665 if (!c.IsDisabled && flag4 && c.CanAcceptGift(EClass.pc, EClass.pc.held))
666 {
667 string lang = "actGive";
668 if (c.Evalue(1232) > 0 && EClass.pc.held.trait is TraitDrinkMilkMother)
669 {
670 lang = "actMilk";
671 }
672 TrySetAct(lang, delegate
673 {
674 if (!c.IsValidGiftWeight(EClass.pc.held, 1))
675 {
676 c.Talk("tooHeavy");
677 return true;
678 }
680 {
681 Dialog.YesNo("dialogGive".lang(EClass.pc.held.GetName(NameStyle.Full, 1)), func);
682 }
683 else
684 {
685 func();
686 }
687 return true;
688 }, c);
689 }
690 }
691 }
692 if (input == ActInput.AllAction && EClass.pc.held != null && EClass.pc.held.trait is TraitDrink)
693 {
694 TrySetAct(c.IsPC ? "actPour" : "ActThrow", delegate
695 {
696 ActThrow.Throw(EClass.pc, c.pos, c, EClass.pc.held.Split(1));
697 return true;
698 }, (c.host != null) ? c : EClass.pc.held);
699 }
700 if (!c.IsPC && c.host == null && ((!EClass.pc.isBlind && flag3) || input != ActInput.AllAction))
701 {
702 if (c.isRestrained && (input == ActInput.AllAction || (!c.IsRestrainedResident && !c.IsHostile())))
703 {
704 TrySetAct("ActUnrestrain", delegate
705 {
706 c.TryUnrestrain(force: true, EClass.pc);
707 return true;
708 }, c);
709 }
710 if (!EClass.pc.isBlind && flag3 && input == ActInput.AllAction)
711 {
712 TrySetAct(ACT.Kick, c);
713 if (c.IsMofuable)
714 {
715 TrySetAct("ActCuddle", delegate
716 {
717 EClass.pc.Cuddle(c);
718 return true;
719 }, c);
720 }
722 {
723 TrySetAct("inspect", delegate
724 {
725 c.Inspect();
726 return false;
727 }, c);
728 }
729 }
730 }
731 }
732 else if (_c.isThing)
733 {
734 if (!EClass.pc.isBlind)
735 {
736 Thing t = _c.Thing;
737 if (EClass._zone.HasField(10001) && t.trait.CanEat(EClass.pc))
738 {
739 TrySetAct(new AI_Eat
740 {
741 target = t
742 }, t);
743 }
744 if (input == ActInput.AllAction)
745 {
746 if ((EClass.debug.enable || EClass.player.HasKeyItem("license_illumination")) && t.LightData != null)
747 {
748 if (t.c_lightColor != 0)
749 {
750 TrySetAct("actClearLight", delegate
751 {
752 t.c_lightColor = 0;
753 t.RecalculateFOV();
754 t.renderer.GetTC<TCExtra>()?.RefreshColor();
755 return false;
756 }, t);
757 }
758 TrySetAct("actSetLight", delegate
759 {
760 Color lightColor = t.LightColor;
761 EClass.ui.AddLayer<LayerColorPicker>().SetColor(lightColor, lightColor, delegate(PickerState state, Color _c)
762 {
763 if (state == PickerState.Cancel)
764 {
765 t.c_lightColor = 0;
766 }
767 else
768 {
769 t.c_lightColor = (byte)Mathf.Clamp(_c.r * 32f, 1f, 31f) * 1024 + (byte)Mathf.Clamp(_c.g * 32f, 1f, 31f) * 32 + (byte)Mathf.Clamp(_c.b * 32f, 1f, 31f);
770 }
771 t.RecalculateFOV();
773 });
774 return false;
775 }, t);
776 }
778 {
779 TrySetAct("(debug) Toggle Float", delegate
780 {
781 t.isFloating = !t.isFloating;
782 return false;
783 }, t);
784 }
786 {
787 if (t.trait.CanEat(EClass.pc))
788 {
789 TrySetAct(new AI_Eat
790 {
791 target = t
792 }, t);
793 }
794 if (t.trait.CanDrink(EClass.pc))
795 {
797 {
798 target = t
799 }, t);
800 }
801 if (t.trait.CanRead(EClass.pc))
802 {
804 {
805 target = t
806 }, t);
807 }
808 if (t.trait.IsBlendBase)
809 {
810 TrySetAct("invBlend", delegate
811 {
813 return true;
814 }, t);
815 }
816 if (t.trait.CanName)
817 {
818 TrySetAct("changeName", delegate
819 {
820 Dialog.InputName("dialogChangeName", t.c_refText.IsEmpty(""), delegate(bool cancel, string text)
821 {
822 if (!cancel)
823 {
824 t.c_refText = text;
825 }
826 });
827 return false;
828 }, t);
829 }
830 }
831 }
832 if (isKey)
833 {
834 _ = t.trait.CanBeAttacked;
835 }
836 else
837 {
838 if (t.placeState == PlaceState.roaming && (_pos.cell.blocked || t.ignoreAutoPick || altAction || input == ActInput.AllAction || _pos.Equals(EClass.pc.pos)) && EClass.pc.CanPick(t))
839 {
840 listPick.Add(t);
841 }
842 if (t.IsInstalled)
843 {
844 t.trait.TrySetToggleAct(this);
845 t.trait.TrySetAct(this);
846 }
847 }
848 }
849 }
850 void func()
851 {
853 }
854 });
855 if (listPick.Count > 0)
856 {
857 if (listPick.Count == 1)
858 {
859 Thing _t = listPick[0];
861 {
862 TrySetAct("actPickOne", delegate
863 {
864 EClass.pc.Pick(_t);
865 return true;
866 }, listPick[0], CursorSystem.Hand, 1, isHostileAct: false, localAct: false);
867 }
868 }
869 else
870 {
871 IList<Card> _cards = items.Copy();
872 TrySetAct("actPickAll", delegate
873 {
874 foreach (Card item2 in _cards)
875 {
876 if (item2.isThing && item2.placeState == PlaceState.roaming)
877 {
878 EClass.pc.Pick(item2.Thing);
879 }
880 }
881 return true;
882 }, null, CursorSystem.Hand, 1, isHostileAct: false, localAct: false);
883 }
884 }
885 if (input == ActInput.AllAction && pos.IsSky && !EClass.game.IsSurvival)
886 {
887 TrySetAct("actSkyJump", delegate
888 {
890 return false;
891 });
892 }
893 if (_pos.Equals(cc.pos))
894 {
895 if (cc.held != null && !cc.held.IsHotItem)
896 {
897 TrySetAct("actPick", delegate
898 {
899 _ = cc.held;
900 cc.PickHeld(msg: true);
901 ActionMode.AdvOrRegion.updatePlans = true;
902 return false;
903 }, cc.held, CursorSystem.Inventory, 1, isHostileAct: false, localAct: false);
904 }
905 else if (!HasAct && !cc.isRestrained)
906 {
908 }
909 if (EClass.debug.enable)
910 {
911 showOrder = true;
912 }
913 if (input == ActInput.AllAction && EClass.pc.held != null && !EClass.pc.held.trait.CanOnlyCarry)
914 {
915 TrySetAct("actDrop", delegate
916 {
918 return true;
919 });
920 }
921 if (cc.isRestrained)
922 {
923 TrySetAct("ActUnrestrain", delegate
924 {
925 cc.TryUnrestrain(force: true, EClass.pc);
926 return true;
927 }, cc);
928 }
929 }
930 }
931 if (list.Count == 0 && input == ActInput.AllAction && EClass.pc.held == null && pos.cell.IsSnowTile && !pos.IsBlocked && !pos.HasObj && !pos.HasThing)
932 {
934 {
935 pos = pos.Copy()
936 });
937 }
938 if (list.Count != 0 && input != ActInput.AllAction)
939 {
940 return;
941 }
942 items.ForeachReverse(delegate(Card _c)
943 {
944 if (_c.isThing && _c.trait.CanBeAttacked && !(_c.trait is TraitTrainingDummy))
945 {
946 TrySetAct(ACT.Melee, _c);
947 }
948 });
949 }
950 else
951 {
952 if (input != ActInput.RightMouse)
953 {
954 return;
955 }
956 if (pos.cell.outOfBounds || EClass.ui.IsDragging)
957 {
958 return;
959 }
961 if (!hotItem.IsGameAction)
962 {
963 TrySetAct(hotItem.Name, delegate
964 {
965 hotItem.OnClick(hotItem.button, hotItem.hotbar);
966 return false;
967 }, null, -1);
968 }
969 else
970 {
971 hotItem.TrySetAct(this);
972 }
973 bool flag = EClass.game.config.autoCombat.enable && EClass.scene.mouseTarget.TargetChara != null && EClass.scene.mouseTarget.TargetChara.mimicry == null;
974 if (hotItem.Thing != null && hotItem.Thing.trait.DisableAutoCombat)
975 {
976 flag = false;
977 }
978 if (flag)
979 {
981 bool flag2 = true;
982 if (targetChara.hostility >= Hostility.Friend)
983 {
984 flag2 = false;
985 }
987 {
988 flag2 = false;
989 }
990 if (list.Count >= 2)
991 {
992 flag2 = false;
993 }
994 if (list.Count == 1)
995 {
996 if (targetChara.hostility >= Hostility.Neutral)
997 {
998 flag2 = false;
999 }
1000 if (!list[0].act.ShowAuto)
1001 {
1002 flag2 = false;
1003 }
1004 if (EClass.player.currentHotItem is HotItemNoItem && targetChara.hostility <= Hostility.Enemy)
1005 {
1006 flag2 = true;
1007 }
1008 }
1009 if (flag2)
1010 {
1011 list.Clear();
1012 TrySetAct(new GoalAutoCombat(targetChara));
1013 }
1014 }
1015 if (list.Count == 0 && !EClass.core.config.test.toolNoPick)
1016 {
1018 }
1019 if ((bool)WidgetCurrentTool.Instance)
1020 {
1022 }
1023 }
1024 }
1025}
ActInput
Definition: ActInput.cs:2
Hostility
Definition: Hostility.cs:2
PickerState
Definition: PickerState.cs:2
PlaceState
Definition: PlaceState.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
Definition: ACT.cs:6
static ActChat Chat
Definition: ACT.cs:9
static new ActWait Wait
Definition: ACT.cs:7
static ActKick Kick
Definition: ACT.cs:13
static ActMelee Melee
Definition: ACT.cs:15
Definition: AIAct.cs:6
virtual bool UseTurbo
Definition: AIAct.cs:88
virtual bool IsRunning
Definition: AIAct.cs:31
void Reset()
Definition: AIAct.cs:340
Definition: AI_Eat.cs:5
Definition: AM_Adv.cs:7
static int actCount
Definition: AM_Adv.cs:102
void SetTurbo(int mtp=-1)
Definition: AM_Adv.cs:1086
string GetText(bool showName)
Definition: ActPlan.cs:46
Card tc
Definition: ActPlan.cs:24
bool HideHint
Definition: ActPlan.cs:31
Point pos
Definition: ActPlan.cs:26
bool Perform(bool repeated=false)
Definition: ActPlan.cs:56
string GetTextContext(bool showName)
Definition: ActPlan.cs:51
Chara cc
Definition: ActPlan.cs:28
void Add(Act a, string s="")
Definition: ActPlan.cs:11
int dist
Definition: ActPlan.cs:168
bool _canInteractNeighbor
Definition: ActPlan.cs:162
bool HideRightInfo
Definition: ActPlan.cs:235
bool altAction
Definition: ActPlan.cs:158
bool showOrder
Definition: ActPlan.cs:164
bool ShowAct
Definition: ActPlan.cs:249
Thing tool
Definition: ActPlan.cs:170
Chara cc
Definition: ActPlan.cs:204
Act lastAct
Definition: ActPlan.cs:174
static bool warning
Definition: ActPlan.cs:150
bool HasMultipleTargets
Definition: ActPlan.cs:265
bool ignoreAddCondition
Definition: ActPlan.cs:160
bool IsNeighborBlocked
Definition: ActPlan.cs:181
CursorInfo CursorIcon
Definition: ActPlan.cs:207
ActInput input
Definition: ActPlan.cs:154
string GetText(bool showName)
Definition: ActPlan.cs:276
Point pos
Definition: ActPlan.cs:152
void Update(PointTarget target)
Definition: ActPlan.cs:439
Func< bool > GetAction()
Definition: ActPlan.cs:289
void Order(string id)
Definition: ActPlan.cs:324
bool IsSelfOrNeighbor
Definition: ActPlan.cs:178
bool IsSelf
Definition: ActPlan.cs:176
bool TrySetAct(Act _act, Card _tc=null)
Definition: ActPlan.cs:395
void ShowContextMenu()
Definition: ActPlan.cs:330
List< Thing > listPick
Definition: ActPlan.cs:172
List list
Definition: ActPlan.cs:166
bool WillEndTurn
Definition: ActPlan.cs:223
void _Update(PointTarget target)
Definition: ActPlan.cs:473
void Clear()
Definition: ActPlan.cs:433
bool TrySetAct(string lang, Func< bool > onPerform, Card tc, CursorInfo cursor=null, int dist=1, bool isHostileAct=false, bool localAct=true, bool canRepeat=false)
Definition: ActPlan.cs:372
bool TrySetAct(string lang, Func< bool > onPerform, CursorInfo cursor=null, int dist=1)
Definition: ActPlan.cs:385
bool performed
Definition: ActPlan.cs:156
bool canRepeat
Definition: ActPlan.cs:193
bool HasAct
Definition: ActPlan.cs:246
static bool SearchMedal(Chara c, Point p)
Definition: ActWait.cs:22
Definition: ACT.cs:62
virtual bool Perform()
Definition: ACT.cs:266
static Card TC
Definition: ACT.cs:79
virtual bool IsAct
Definition: ACT.cs:101
static Point TP
Definition: ACT.cs:81
virtual int PerformDistance
Definition: ACT.cs:139
static Chara CC
Definition: ACT.cs:77
virtual string ID
Definition: ACT.cs:99
virtual string GetTextSmall(Card c)
Definition: ACT.cs:232
virtual string GetText(string str="")
Definition: ACT.cs:215
virtual bool CanPerform()
Definition: ACT.cs:321
static AM_Adv Adv
Definition: ActionMode.cs:15
TC GetTC(string id)
Definition: Card.cs:11
bool IsPCFactionOrMinion
Definition: Card.cs:2312
virtual bool isThing
Definition: Card.cs:2119
virtual Chara Chara
Definition: Card.cs:2108
bool isNPCProperty
Definition: Card.cs:555
bool IsRestrainedResident
Definition: Card.cs:2298
bool isFloating
Definition: Card.cs:651
bool isRestrained
Definition: Card.cs:567
bool ignoreAutoPick
Definition: Card.cs:507
string c_refText
Definition: Card.cs:1655
string Name
Definition: Card.cs:2177
bool IsHotItem
Definition: Card.cs:120
PlaceState placeState
Definition: Card.cs:84
void RecalculateFOV()
Definition: Card.cs:6621
Point pos
Definition: Card.cs:60
int c_lightColor
Definition: Card.cs:1109
Trait trait
Definition: Card.cs:54
string c_idRidePCC
Definition: Card.cs:1679
bool IsInstalled
Definition: Card.cs:2421
virtual bool isChara
Definition: Card.cs:2121
virtual Thing Thing
Definition: Card.cs:2096
int Evalue(int ele)
Definition: Card.cs:2611
int Dist(Card c)
Definition: Card.cs:7949
LightData LightData
Definition: Card.cs:2470
void TryUnrestrain(bool force=false, Chara c=null)
Definition: Card.cs:7362
Color LightColor
Definition: Card.cs:1121
void Inspect()
Definition: Card.cs:8134
void SayRaw(string text, string ref1=null, string ref2=null)
Definition: Card.cs:7061
CardRenderer renderer
Definition: Card.cs:62
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6152
bool IsSnowTile
Definition: Cell.cs:782
bool IsTopWater
Definition: Cell.cs:700
bool outOfBounds
Definition: Cell.cs:414
Definition: Chara.cs:10
override bool IsAliveInCurrentZone
Definition: Chara.cs:563
Card held
Definition: Chara.cs:70
bool CanAcceptGift(Chara c, Card t)
Definition: Chara.cs:8415
AIAct ai
Definition: Chara.cs:204
void Cuddle(Chara c, bool headpat=false)
Definition: Chara.cs:6358
bool CanPick(Card c)
Definition: Chara.cs:4343
override bool IsPC
Definition: Chara.cs:626
Chara host
Definition: Chara.cs:33
bool IsValidGiftWeight(Card t, int num=-1)
Definition: Chara.cs:8384
bool IsMofuable
Definition: Chara.cs:1125
override bool IsPCParty
Definition: Chara.cs:629
void PickHeld(bool msg=false)
Definition: Chara.cs:4600
bool HasCondition(string alias)
Definition: Chara.cs:9614
void Banish(Chara owner)
Definition: Chara.cs:2391
AIAct SetAI(AIAct g)
Definition: Chara.cs:9083
override bool IsDisabled
Definition: Chara.cs:587
override bool IsMinion
Definition: Chara.cs:641
override bool isSynced
Definition: Chara.cs:705
ConTransmuteMimic mimicry
Definition: Chara.cs:106
override CardRenderer _CreateRenderer()
Definition: Chara.cs:6788
override bool IsPCFaction
Definition: Chara.cs:685
override bool IsPCPartyMinion
Definition: Chara.cs:653
bool CanSee(Card c)
Definition: Chara.cs:1244
override bool IsPCFactionMinion
Definition: Chara.cs:669
void SetAIImmediate(AIAct g)
Definition: Chara.cs:9115
bool CanInteractTo(Card c)
Definition: Chara.cs:2594
static NoGoal _NoGoalRepeat
Definition: Chara.cs:200
bool HasNoGoal
Definition: Chara.cs:1014
void DropThing(Thing t, int num=-1)
Definition: Chara.cs:4697
void GiveGift(Chara c, Thing t)
Definition: Chara.cs:8440
Quest quest
Definition: Chara.cs:24
bool isBlind
Definition: Chara.cs:132
void FallFromZone()
Definition: Chara.cs:3563
Hostility hostility
Definition: Chara.cs:293
Card SplitHeld(int a)
Definition: Chara.cs:4660
bool IsHostile()
Definition: Chara.cs:6671
bool isDead
Definition: Chara.cs:391
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4381
bool IsEscorted()
Definition: Chara.cs:2471
bool IsNeutral()
Definition: Chara.cs:6718
virtual void TrySetAct(ActPlan p)
new GameConfig game
Definition: CoreConfig.cs:609
bool showExtra
Definition: CoreDebug.cs:168
bool enable
Definition: CoreDebug.cs:286
PCCManager pccs
Definition: Core.cs:41
CoreConfig config
Definition: Core.cs:70
static CursorInfo Arrow
Definition: CursorSystem.cs:46
static CursorInfo Hand
Definition: CursorSystem.cs:60
static CursorInfo Inventory
Definition: CursorSystem.cs:92
static CursorInfo Notice
Definition: CursorSystem.cs:76
static CursorInfo MoveZone
Definition: CursorSystem.cs:86
Definition: Dialog.cs:7
static bool warned
Definition: Dialog.cs:50
static Dialog InputName(string langDetail, string text, Action< bool, string > onClose, InputType inputType=InputType.Default)
Definition: Dialog.cs:536
static void TryWarnDisassemble(Action action)
Definition: Dialog.cs:414
static void TryWarnCrime(Action action)
Definition: Dialog.cs:384
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Scene scene
Definition: EClass.cs:31
static ColorProfile Colors
Definition: EClass.cs:39
static Core core
Definition: EClass.cs:7
static Zone _zone
Definition: EClass.cs:21
static Map _map
Definition: EClass.cs:19
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static UI ui
Definition: EClass.cs:17
ConfigAutoCombat autoCombat
Definition: Game.cs:94
bool IsSurvival
Definition: Game.cs:276
Config config
Definition: Game.cs:219
QuestManager quests
Definition: Game.cs:183
static bool disableTool
Definition: HotItemHeld.cs:11
static bool _TrySetAct(ActPlan p)
virtual void SetImage(Image icon)
Definition: HotItem.cs:91
virtual bool TrySetAct(ActPlan p)
Definition: HotItem.cs:107
virtual bool IsGameAction
Definition: HotItem.cs:46
virtual Thing Thing
Definition: HotItem.cs:38
static LayerDragGrid Create(InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)
static LayerInventory CreateContainer(Card owner)
List< Chara > charas
Definition: Map.cs:81
bool CanExitBorder(Point p)
Definition: Player.cs:1949
bool HasKeyItem(string alias)
Definition: Player.cs:2223
void EndTurn(bool consume=true)
Definition: Player.cs:2141
void EnterLocalZone(bool encounter=false, Chara mob=null)
Definition: Player.cs:2006
void ExitBorder(ActPlan p=null)
Definition: Player.cs:1907
HotItem currentHotItem
Definition: Player.cs:1155
bool isValid
Definition: PointTarget.cs:30
Chara TargetChara
Definition: PointTarget.cs:41
Definition: Point.cs:9
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1051
Point Copy()
Definition: Point.cs:491
bool IsSky
Definition: Point.cs:224
Point Set(int _x, int _z)
Definition: Point.cs:503
bool IsBlocked
Definition: Point.cs:363
bool HasThing
Definition: Point.cs:251
bool Equals(int _x, int _z)
Definition: Point.cs:960
bool IsValid
Definition: Point.cs:88
bool HasObj
Definition: Point.cs:137
int Distance(Point p)
Definition: Point.cs:989
bool IsHidden
Definition: Point.cs:347
Cell cell
Definition: Point.cs:51
Thing FindThing(Func< Thing, bool > func)
Definition: Point.cs:1140
bool IsDeliverTarget(Chara c)
PointTarget mouseTarget
Definition: Scene.cs:135
virtual bool IsRegion
Definition: Spatial.cs:515
void RefreshColor()
Definition: TCExtra.cs:171
Definition: Task.cs:4
Definition: Thing.cs:8
virtual bool AllowTraining
Definition: TraitShackle.cs:15
virtual bool IsBlendBase
Definition: Trait.cs:275
virtual bool CanBeAttacked
Definition: Trait.cs:177
virtual bool IsTool
Definition: Trait.cs:379
virtual void TrySetAct(ActPlan p)
Definition: Trait.cs:1060
virtual bool CanRead(Chara c)
Definition: Trait.cs:995
virtual void TrySetToggleAct(ActPlan p)
Definition: Trait.cs:1266
virtual bool CanName
Definition: Trait.cs:147
virtual bool CanEat(Chara c)
Definition: Trait.cs:1004
virtual bool DisableAutoCombat
Definition: Trait.cs:211
virtual bool CanDrink(Chara c)
Definition: Trait.cs:1013
virtual bool CanOnlyCarry
Definition: Trait.cs:305
virtual string Name
Definition: UIButton.cs:19
void Show(UIItem i)
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
void AddButton(Func< string > funcText, UnityAction action=null)
UIContextMenu AddChild(string idLang, TextAnchor anchor)
static WidgetCurrentTool Instance
UIPlaceHelper placer
bool HasField(int idEle)
Definition: Zone.cs:2946
virtual bool IsUserZone
Definition: Zone.cs:273
ZoneInstance instance
Definition: Zone.cs:55
bool IsCrime(Chara c, Act act)
Definition: Zone.cs:3613