16 return this.dist == 0;
22 public bool IsSelfOrNeighbor
26 return this._canInteractNeighbor;
32 public bool IsNeighborBlocked
36 return !this._canInteractNeighbor && this.dist == 1;
46 return this.list.Count == 1 && this.list[0].act.CanPressRepeat;
61 public string GetText(
bool showName)
63 if (this.list.Count == 0)
67 if (this.list.Count == 1)
69 return this.list[0].GetText(showName);
71 return "+" + this.list.Count.ToString() + ((this.HasMultipleTargets || this.list[0].tc ==
null) ? (
"\n<size=28>(" +
"multipleTargets".lang() +
")</size>") : (
"\n<size=28>" + this.list[0].tc.Name +
this.list[0].tc.GetExtraName() +
"</size>"));
76 public CursorInfo CursorIcon
80 if (this.list.Count == 0)
84 if (this.list.Count <= 1)
86 return this.list[0].act.GetCursorIcon(this.list[0].tc);
88 return CursorSystem.Notice;
94 public bool WillEndTurn
98 return this.list.Count > 0 && this.list[0].act.WillEndTurn;
104 public bool HideRightInfo
108 return this.list.Count > 0 && this.list[0].act.HideRightInfo;
118 return this.list.Count > 0;
128 return this.HasAct && this.lastAct != this.list[0].act && this.list[0].act.ShowMouseHint(this.list[0].tc);
134 public bool HasMultipleTargets
138 return this.list.Count > 1 && this.list[0].tc != this.list.LastItem<
ActPlan.
Item>().tc;
143 public Func<bool> GetAction()
145 if (this.list.Count == 0)
149 if (this.list.Count > 1)
157 this.ShowContextMenu();
164 if (this.performed && !item.act.CanPressRepeat)
168 this.performed =
true;
169 this.lastAct = item.act;
170 return item.Perform(this.performed);
175 public void ShowContextMenu()
177 UIContextMenu uicontextMenu =
EClass.ui.CreateContextMenuInteraction();
179 bool flag = this.showOrder;
180 using (
List<
ActPlan.
Item>.Enumerator enumerator = this.list.GetEnumerator())
182 while (enumerator.MoveNext())
185 string text = i.GetTextContext(this.HasMultipleTargets);
186 text = text.Replace(
"\n",
" ").Replace(Environment.NewLine,
" ");
187 uicontextMenu.AddButton(text, delegate()
189 this.performed =
true;
190 if (i.Perform(
false))
192 EClass.player.EndTurn(
true);
202 uicontextMenu.Show();
203 EClass.ui.hud.HideMouseInfo();
207 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)
209 return this.TrySetAct(
new DynamicAct(lang, onPerform,
false)
213 isHostileAct = isHostileAct,
215 cursor = ((cursor == CursorSystem.Arrow) ? null : cursor),
216 canRepeat = (() => canRepeat)
221 public bool TrySetAct(
string lang, Func<bool> onPerform, CursorInfo cursor =
null,
int dist = 1)
223 return this.TrySetAct(
new DynamicAct(lang, onPerform,
false)
227 cursor = ((cursor == CursorSystem.Arrow) ? null : cursor)
232 public bool TrySetAct(
Act _act,
Card _tc =
null)
234 if (!this.ignoreAdddCondition && !_act.CanPerform(
this.cc, _tc,
this.pos))
242 pos = this.pos.Copy()
251 this.pos.IsValid =
false;
261 this._Update(target);
264 Color effectColor = (this.list.Count == 1) ? this.list[0].act.GetActPlanColor() :
EClass.Colors.colorAct;
265 if (this.input == ActInput.LeftMouse ||
this.input == ActInput.Key)
267 EClass.ui.hud.textLeft.SetText(this.GetText(
true));
268 Outline[] components =
EClass.ui.hud.textLeft.GetComponents<Outline>();
269 for (
int i = 0; i < components.Length; i++)
271 components[i].effectColor = effectColor;
275 if (this.input == ActInput.RightMouse)
277 EClass.player.currentHotItem.SetImage(
EClass.ui.hud.imageRight);
278 EClass.ui.hud.imageRight.rectTransform.localScale =
new Vector3(2f, 2f, 1f);
279 EClass.ui.hud.textRight.SetText(this.GetText(
true));
280 Outline[] components =
EClass.ui.hud.textRight.GetComponents<Outline>();
281 for (
int i = 0; i < components.Length; i++)
283 components[i].effectColor = effectColor;
292 this.showOrder =
false;
293 this.performed =
false;
295 this.listPick.Clear();
296 if (!this.pos.Equals(target.pos))
300 this.pos.Set(target.pos);
301 this.dist = this.cc.pos.Distance(this.pos);
302 if (!this.pos.IsValid ||
EClass.pc.isDead)
307 Cell cell = target.pos.cell;
308 bool flag = this.input == ActInput.Key;
309 this.altAction = ((EInput.isShiftDown && !EInput.isAltDown && !flag) || this.input == ActInput.AllAction);
310 this._canInteractNeighbor = (this.dist == 0 || (this.dist == 1 && this.cc.CanInteractTo(_pos)));
311 if (
EClass.pc.isBlind && !_pos.Equals(
EClass.pc.pos) && !flag &&
this.input != ActInput.LeftMouse)
315 if (!flag && this.input != ActInput.LeftMouse &&
this.input != ActInput.AllAction)
317 if (this.input == ActInput.RightMouse)
319 if (this.pos.cell.outOfBounds ||
EClass.ui.IsDragging)
324 if (!hotItem.IsGameAction)
326 this.TrySetAct(hotItem.Name, delegate()
328 hotItem.OnClick(hotItem.button, hotItem.hotbar);
334 hotItem.TrySetAct(
this);
336 bool flag2 = EClass.game.config.autoCombat.enable && EClass.scene.mouseTarget.TargetChara !=
null;
337 Thing thing = hotItem.Thing;
344 Chara targetChara =
EClass.scene.mouseTarget.TargetChara;
346 if (targetChara.hostility >= Hostility.Friend)
350 if (targetChara.hostility == Hostility.Neutral &&
EClass.game.config.autoCombat.bDontAutoAttackNeutral)
354 if (this.list.Count >= 2)
358 if (this.list.Count == 1)
360 if (targetChara.hostility >= Hostility.Neutral)
364 if (!this.list[0].act.ShowAuto)
368 if (
EClass.player.currentHotItem is
HotItemNoItem && targetChara.hostility <= Hostility.Enemy)
379 if (this.list.Count == 0)
394 if (_pos.cell.outOfBounds)
396 if (
EClass.player.CanExitBorder(_pos))
398 EClass.player.ExitBorder(
this);
402 if (!flag && _pos.Equals(
this.cc.pos) &&
EClass._zone.IsRegion)
404 this.TrySetAct(
"actNewZone", delegate()
406 EClass.player.EnterLocalZone(
false);
408 }, CursorSystem.MoveZone, 1);
409 if (this.input == ActInput.AllAction)
411 this.TrySetAct(
"LayerTravel", delegate()
415 },
null, CursorSystem.MoveZone, 1,
false,
false,
false);
418 foreach (
Card card
in _pos.ListCards(
false))
420 Chara chara = card.Chara;
421 if (chara !=
null && !chara.IsPC &&
EClass.pc.CanSee(chara))
423 int num = chara.Dist(
EClass.pc);
424 if (num <= 1 || !
EClass.pc.isBlind)
426 if (!
EClass.pc.isBlind && !chara.IsHostile() && (
this.input == ActInput.AllAction || (!chara.IsPCParty && !chara.IsMinion && !flag)) && (
this.input == ActInput.AllAction || !chara.IsNeutral() || chara.quest !=
null ||
EClass.game.quests.IsDeliverTarget(chara)) && chara.isSynced && num <= 2 && ((!chara.HasCondition<
ConSuspend>() && (!chara.isRestrained || !chara.IsPCFaction)) ||
this.altAction))
428 if (
EClass.pc.HasElement(1216, 1) && chara.HasCondition<
ConSleep>())
436 this.TrySetAct(
ACT.Chat, chara);
438 if (chara.host !=
EClass.pc)
440 if (chara.IsRestrainedResident)
447 else if ((chara.IsHostile() ||
this.altAction || chara.isRestrained) && chara.IsAliveInCurrentZone)
449 this.TrySetAct(
ACT.Melee, chara);
455 if (_pos.IsHidden || !
this.IsSelfOrNeighbor)
459 foreach (
Card card2
in _pos.ListCards(
false))
461 Chara c = card2.Chara;
464 bool flag4 =
EClass.pc.CanSee(c);
467 if (this.input == ActInput.LeftMouse && c.IsPCFaction && !c.IsPC &&
this.pos.FindThing<
TraitHitchingPost>() !=
null)
470 List<string> list =
EClass.core.pccs.sets[
"ride"].map[
"body"].map.Keys.ToList<
string>();
471 int index = list.IndexOf(ride.c_idRidePCC);
476 Func<float, string> <>9__14;
477 Action<float> <>9__15;
478 this.TrySetAct(
"ActChangeRideSkin", delegate()
480 UIContextMenu uicontextMenu =
EClass.ui.CreateContextMenuInteraction();
481 string text =
"rideSkin";
482 Func<float, string> textFunc;
483 if ((textFunc = <>9__14) ==
null)
485 textFunc = (<>9__14 = ((
float a) => list[(int)a].Split(
'-', StringSplitOptions.None)[0] ??
""));
487 float value = (float)index;
488 Action<float> action;
489 if ((action = <>9__15) ==
null)
491 action = (<>9__15 = delegate(
float a)
493 ride.c_idRidePCC = list[(int)a];
494 ride._CreateRenderer();
497 uicontextMenu.AddSlider(text, textFunc, value, action, 0f, (
float)(list.Count - 1),
true,
false,
false);
498 uicontextMenu.Show();
500 }, c,
null, 1,
false,
true,
false);
502 if (!c.IsPC && ((c.IsPCFaction && !c.IsDisabled) ||
EClass.debug.enable) &&
this.input == ActInput.AllAction)
504 this.TrySetAct(
"actTrade", delegate()
508 }, c,
null, 1,
false,
true,
false);
513 this.TrySetAct(c.IsPC ?
"actPour" :
"ActThrow", delegate()
517 },
EClass.pc.held,
null, 1,
false,
true,
false);
519 if (!c.IsPC && c.host ==
null && ((!
EClass.pc.isBlind && flag4) ||
this.input != ActInput.AllAction))
521 if (c.isRestrained && (
this.input == ActInput.AllAction || (!c.IsRestrainedResident && !c.IsHostile())))
523 this.TrySetAct(
"ActUnrestrain", delegate()
525 c.TryUnrestrain(
true,
EClass.pc);
527 }, c,
null, 1,
false,
true,
false);
529 if (!
EClass.pc.isBlind && flag4 &&
this.input == ActInput.AllAction)
531 this.TrySetAct(
ACT.Kick, c);
534 this.TrySetAct(
"ActCuddle", delegate()
536 EClass.pc.Cuddle(c,
false);
538 }, c,
null, 1,
false,
true,
false);
540 if (
EClass.debug.showExtra)
542 this.TrySetAct(
"inspect", delegate()
546 }, c,
null, 1,
false,
true,
false);
548 if (c.IsPCPartyMinion && !c.Chara.IsEscorted())
550 this.TrySetAct(
"ActBanishSummon", delegate()
552 EClass.pc.Say(
"summon_vanish", c,
null,
null);
553 c.pos.PlayEffect(
"vanish");
554 c.pos.PlaySound(
"vanish",
true, 1f,
true);
555 c.pos.PlayEffect(
"teleport");
558 }, c,
null, 1,
false,
true,
false);
563 else if (card2.isThing)
567 Thing t = card2.Thing;
568 if (this.input == ActInput.AllAction)
572 if (t.LightData !=
null)
574 if (t.c_lightColor != 0)
576 this.TrySetAct(
"(debug) Clear Light", delegate()
586 }, t,
null, 1,
false,
true,
false);
588 Action<PickerState, Color> <>9__20;
589 this.TrySetAct(
"(debug) Set Light", delegate()
591 Color lightColor = t.LightColor;
593 Color startColor = lightColor;
594 Color resetColor = lightColor;
595 Action<PickerState, Color> onChangeColor;
596 if ((onChangeColor = <>9__20) ==
null)
598 onChangeColor = (<>9__20 = delegate(PickerState state, Color _c)
600 t.c_lightColor = (int)((
byte)Mathf.Clamp(_c.r * 32f, 1f, 31f)) * 1024 + (int)((
byte)Mathf.Clamp(_c.g * 32f, 1f, 31f) * 32) + (int)((
byte)Mathf.Clamp(_c.b * 32f, 1f, 31f));
610 layerColorPicker.SetColor(startColor, resetColor, onChangeColor);
612 }, t,
null, 1,
false,
true,
false);
614 if (this.pos.cell.IsTopWater)
616 this.TrySetAct(
"(debug) Toggle Float", delegate()
618 t.isFloating = !t.isFloating;
620 }, t,
null, 1,
false,
true,
false);
623 if (t.trait.CanEat(
EClass.pc))
630 if (t.trait.CanDrink(
EClass.pc))
637 if (t.trait.CanRead(
EClass.pc))
644 if (t.trait.IsBlendBase)
646 this.TrySetAct(
"invBlend", delegate()
650 }, t,
null, 1,
false,
true,
false);
655 if (t.trait.CanBeAttacked)
661 if (t.placeState == PlaceState.roaming && (_pos.cell.blocked || t.ignoreAutoPick ||
this.altAction ||
this.input == ActInput.AllAction || _pos.Equals(
EClass.pc.pos)) &&
EClass.pc.CanPick(t))
663 this.listPick.Add(t);
667 if (t.trait.IsFactory && !
EClass.game.altCraft)
670 this.TrySetAct(
"craft", delegate()
672 if (
EClass.player.recipes.ListSources(_t,
null).Count > 0)
678 Msg.Say(
"noRecipes");
681 }, _t, CursorSystem.Craft, 1,
false,
true,
false);
683 bool canBeAttacked = t.trait.CanBeAttacked;
684 t.trait.TrySetToggleAct(
this);
685 t.trait.TrySetAct(
this);
691 if (this.listPick.Count > 0)
693 if (this.listPick.Count == 1)
695 Thing _t = this.listPick[0];
696 if (!
EClass._zone.IsRegion || (!_t.ignoreAutoPick && _t.pos.Equals(
EClass.pc.pos)) ||
this.altAction)
698 this.TrySetAct(
"actPickOne", delegate()
700 EClass.pc.Pick(_t,
true,
true);
702 }, this.listPick[0], CursorSystem.Hand, 1,
false,
false,
false);
707 this.TrySetAct(
"actPickAll", delegate()
709 foreach (
Card card3
in _pos.ListCards(
false))
711 if (card3.isThing && card3.placeState == PlaceState.roaming)
713 EClass.pc.Pick(card3.Thing,
true,
true);
717 },
null, CursorSystem.Hand, 1,
false,
false,
false);
720 if (this.input == ActInput.AllAction &&
this.pos.IsSky)
722 this.TrySetAct(
"actSkyJump", delegate()
728 if (_pos.Equals(
this.cc.pos))
730 if (this.cc.held !=
null && !
this.cc.held.IsHotItem)
732 this.TrySetAct(
"actPick", delegate()
734 Card held = this.cc.held;
735 this.cc.PickHeld(
true);
737 }, this.cc.held, CursorSystem.Inventory, 1,
false,
false,
false);
739 else if (!this.HasAct && !this.cc.isRestrained)
741 this.TrySetAct(
ACT.Wait,
null);
743 if (
EClass.pc.party.members.Count > 1)
745 this.showOrder =
true;
747 if (this.input == ActInput.AllAction &&
EClass.pc.held !=
null)
749 this.TrySetAct(
"actDrop", delegate()
755 if (this.cc.isRestrained)
757 this.TrySetAct(
"ActUnrestrain", delegate()
759 this.cc.TryUnrestrain(
true,
EClass.pc);
761 }, this.cc,
null, 1,
false,
true,
false);
767 public static bool warning;
773 public ActInput input;
776 public bool performed;
779 public bool altAction;
782 public bool ignoreAdddCondition;
785 private bool _canInteractNeighbor;
788 private bool showOrder;
809 public void Add(
Act a,
string s =
"")
837 return EClass.pc.isBlind || (this.tc !=
null && this.tc.isChara && !
EClass.pc.CanSee(this.tc));
842 public string GetText(
bool showName)
844 return this.act.GetText(
"") + ((showName && this.act.GetTextSmall(this.tc) !=
null) ? (
"\n<size=28>" + this.act.GetTextSmall(
this.tc) +
"</size>") :
"");
848 public string GetTextContext(
bool showName)
850 return this.act.GetText(
"") + ((showName && this.tc !=
null && !this.HideHint) ? (
"<size=13> (" + this.tc.Name +
")</size>") :
"");
854 public bool Perform(
bool repeated =
false)
858 ActPlan.warning =
true;
862 if (
EClass._zone.IsCrime(
EClass.pc,
this.act) &&
this.act.ID !=
"actContainer")
864 Dialog.TryWarnCrime(delegate
869 if (this.Perform(
false))
871 EClass.player.EndTurn(
true);
878 Dialog.TryWarnDisassemble(delegate
883 if (this.Perform(
false))
885 EClass.player.EndTurn(
true);
891 ActPlan.warning =
false;
892 int num = this.cc.pos.Distance(this.pos);
893 bool flag = num == 1 && this.cc.CanInteractTo(this.pos);
899 if (this.cc.ai.GetType() ==
this.act.GetType() &&
this.cc.ai.IsRunning)
904 if (!this.act.CanPerform())
906 this.cc.SetAI(
Chara._NoGoalRepeat);
912 task.isDestroyed =
false;
914 if (
EClass.scene.mouseTarget.isValid && taskPoint !=
null)
916 taskPoint.isRepeated =
true;
917 taskPoint.pos =
EClass.scene.mouseTarget.pos.Copy();
921 this.cc.SetAIImmediate(aiact);
922 ActionMode.Adv.SetTurbo(aiact.UseTurbo ? -1 : 0);
925 if (this.act.PerformDistance != -1 && (num >
this.act.PerformDistance || (num == 1 && !flag)))
927 this.cc.SetAIImmediate(
new DynamicAIAct(this.act.GetText(
""), () =>
this.act.Perform(
this.cc,
this.tc,
this.pos),
false)
929 pos = this.pos.Copy()
933 bool flag2 = this.act.Perform(this.cc, this.tc, this.pos);
934 if (flag2 && !
EClass.pc.HasNoGoal)
938 return flag2 &&
EClass.pc.HasNoGoal;