10 public static bool HasTrader
14 return InvOwner.Trader !=
null;
20 public static bool FreeTransfer
24 return !InvOwner.HasTrader || InvOwner.Trader.currency == CurrencyType.None;
30 public virtual bool AllowAutouse
40 public virtual bool AllowContext
50 public virtual bool AllowSell
54 return this.currency == CurrencyType.None || this.owner.trait.AllowSell;
59 public virtual bool AllowHold(
Thing t)
61 if (!t.trait.CanBeDropped)
65 if (t.isEquipped && t.IsCursed)
69 if (this.Container.isChara && !
this.Container.IsPC)
71 return !(t.id ==
"money") && (!t.isEquipped && !t.isGifted) && !t.isNPCProperty;
73 return !t.trait.CanOnlyCarry && (!this.Container.isNPCProperty || !
InvOwner.FreeTransfer);
77 public virtual bool AllowMoved(
Thing t)
84 public virtual bool AlwaysShowTooltip
94 public virtual bool UseGuide
103 public virtual bool ShouldShowGuide(
Thing t)
110 public virtual bool AllowTransfer
114 return this.Container.isChara || !this.Container.isNPCProperty;
120 public virtual bool AllowDropOnDrag
129 public virtual bool AllowDrop(
Thing t)
131 return !EClass._zone.IsRegion || t.trait is
TraitAbility;
136 public virtual string langTransfer
140 return "actTransfer";
146 public virtual int destInvY
155 public virtual Thing CreateDefaultContainer()
157 return ThingGen.Create(
"chest3", -1, -1);
162 public virtual bool HasTransaction
172 public virtual bool CopyOnTransfer
182 public virtual bool SingleTarget
191 public virtual void BuildUICurrency(
UICurrency uiCurrency,
bool canReroll =
false)
193 bool flag = this.Container.isChara && !this.Container.IsPC;
194 uiCurrency.SetActive(this.currency > CurrencyType.None || flag);
195 uiCurrency.target = this.owner;
196 if (this.currency > CurrencyType.None || flag)
201 money = (this.currency == CurrencyType.Money),
202 plat = (this.currency == CurrencyType.Plat),
203 medal = (this.currency == CurrencyType.Medal),
204 money2 = (this.currency == CurrencyType.Money2),
205 influence = (this.currency == CurrencyType.Influence),
206 casino = (this.currency == CurrencyType.Casino_coin),
207 ecopo = (this.currency == CurrencyType.Ecopo)
214 public bool UseHomeResource
218 return this.homeResource !=
null;
224 public bool IsMagicChest
234 public List<Thing> Things
238 if (!this.Container.things.HasGrid)
240 return this.Container.things;
242 return this.Container.things.grid;
252 return this.owner as
Chara;
258 public ContainerType ContainerType
262 return this.Container.trait.ContainerType;
268 public virtual bool InvertSell
278 public virtual int numDragGrid
288 public virtual bool ShowNew
292 return this.owner.IsPC;
298 public virtual bool DenyImportant
307 public bool IsWeightOver(
Thing t)
318 if (!this.owner.IsPC)
327 public InvOwner(
Card owner,
Card container =
null, CurrencyType _currency = CurrencyType.None, PriceType _price = PriceType.Default)
329 this.currency = _currency;
330 this.priceType = _price;
332 this.Container = (container ?? owner);
333 if (this.currency == CurrencyType.BranchMoney)
335 this.homeResource =
EClass.BranchOrHomeBranch.resources.money;
342 if (this.owner ==
null)
345 this.owner = this.CreateDefaultContainer();
346 this.owner.c_lockLv = 0;
347 this.owner.c_IDTState = 0;
348 this.Container = (this.Container ?? this.owner);
355 public virtual void OnInit()
360 public virtual void OnClick(
ButtonGrid button)
362 Card card = button.card;
363 Card card2 = button.invOwner.owner;
364 if (card !=
null &&
EClass.ui.currentDrag ==
null)
367 if (card.Thing.isEquipped && card.Thing.IsEquipmentOrRanged && card.Thing.IsCursed)
371 else if (!this.AllowHold(card.Thing) && card2.isChara && !card2.IsPC && card2.IsPCFaction)
373 if (
InvOwner.forceGive.card != card)
375 InvOwner.forceGive.card = card;
376 InvOwner.forceGive.tries = 0;
380 if (!EInput.isShiftDown)
386 if (card.HasTag(CTAG.gift) && card.isGifted)
389 card2.Say(
"angry", card2,
null,
null);
390 card2.ShowEmo(Emo.angry, 0f,
true);
391 card2.Talk(
"noGiveRing",
null,
null,
false);
392 card2.Chara.ModAffinity(
EClass.pc, -30,
true);
393 card2.Chara.InstantEat(card.Thing,
true);
396 InvOwner.forceGive.card =
null;
398 card.isGifted =
false;
399 card.isNPCProperty =
false;
400 card2.Talk(flag2 ?
"forceGiveCurrency" :
"forceGive",
null,
null,
false);
401 int num = flag2 ? 3 : 1;
402 if (card.id ==
"money")
404 num += card.Num / 1000;
410 EClass.player.ModKarma(-num);
411 EClass.pc.Pick(card.Thing,
true,
true);
416 if (this.AllowHold(card.Thing) || flag)
418 if (EInput.isAltDown)
420 if (this.CanAltClick(button))
422 this.OnAltClick(button);
428 else if (EInput.isCtrlDown)
430 if (this.CanCtrlClick(button))
432 this.OnCtrlClick(button);
438 else if (EInput.isShiftDown)
440 if (this.CanShiftClick(button,
false))
442 this.OnShiftClick(button,
false);
450 if (!this.owner.IsPC)
455 if (button.card !=
null &&
this.IsFailByCurse(button.card.Thing))
466 if (card2.isChara && !card2.IsPC)
468 card2.Talk(
"noGive",
null,
null,
false);
475 public virtual void OnRightClick(
ButtonGrid button)
477 if (!this.AllowAutouse)
479 this.OnClick(button);
481 if (button.card ==
null)
485 this.AutoUse(button,
false);
489 public virtual void OnRightPressed(
ButtonGrid button)
491 if (!EInput.rightMouse.pressedLong)
496 float pressedTimer = EInput.rightMouse.pressedTimer;
497 if (pressedTimer > 2f)
501 else if (pressedTimer > 4f)
505 else if (pressedTimer > 6f)
509 InvOwner.clickTimer -= Core.delta * num;
512 InvOwner.clickTimer = 0.1f;
513 if (button.card !=
null)
515 this.AutoUse(button,
true);
523 Thing thing = b.card.Thing;
524 if (rightMouse && !b.invOwner.owner.IsPC)
535 if (b.invOwner.owner.IsPC)
537 if (!
InvOwner.Trader.Container.things.IsFull(thing,
true,
true))
546 if (topLayer ==
null)
556 if (topLayer2 ==
null)
560 return topLayer2.Inv;
565 public virtual void OnShiftClick(
ButtonGrid b,
bool rightMouse =
false)
567 InvOwner shitDestOwner = this.GetShitDestOwner(b, rightMouse);
568 Thing thing = b.card.Thing;
569 Card container = shitDestOwner.Container;
570 if (rightMouse && !this.owner.IsPC)
572 EClass.pc.Pick(thing,
false,
true);
575 if ((thing.parent == container || thing == container) && !thing.IsHotItem)
577 if (EInput.isShiftDown)
583 thing.PlaySoundDrop(
false);
584 if (thing.IsHotItem && thing.parent == container)
586 container.RemoveCard(thing);
588 if (container.things.CanStack(thing, -1, -1) != thing)
590 container.things.TryStack(thing, -1, -1);
593 container.AddThing(thing,
true, -1, -1);
597 public virtual bool CanShiftClick(
ButtonGrid b,
bool rightMouse =
false)
599 if (!EInput.isShiftDown && !rightMouse)
603 if (!
EClass.pc.HasNoGoal ||
this.Container.isNPCProperty ||
this.currency != CurrencyType.None)
607 if (rightMouse && !
InvOwner.HasTrader)
617 if (
InvOwner.Trader.Container.isChara)
622 if (card !=
null && card.c_isImportant)
627 InvOwner shitDestOwner = this.GetShitDestOwner(b, rightMouse);
628 if (shitDestOwner ==
null)
632 Thing thing = b.card.Thing;
633 if (thing.trait.IsContainer && thing.things.Count > 0)
637 if (!this.AllowHold(thing))
647 if (!
InvOwner.Trader.AllowMoved(thing))
652 if (shitDestOwner.Container.isChara && !shitDestOwner.owner.IsPC && !shitDestOwner.owner.Chara.CanAcceptItem(thing, -1))
656 if (b.invOwner.owner.isChara && b.invOwner.owner.Chara.IsPCFaction && !b.invOwner.owner.IsPC && thing.IsRangedWeapon)
658 thing.ammoData =
null;
661 if (EInput.isShiftDown)
663 LayerInventory.highlightInv = shitDestOwner;
669 public virtual string GetTextShiftClick(
ButtonGrid b)
671 return "actTransfer".lang();
675 public virtual void OnCtrlClick(
ButtonGrid button)
677 button.card.Thing.ShowSplitMenu(button, this.HasTransaction ?
new InvOwner.
Transaction(button, 1,
null) :
null);
681 public virtual bool CanCtrlClick(
ButtonGrid b)
683 return EInput.isCtrlDown && EClass.pc.HasNoGoal && !this.Container.isNPCProperty && b.card.Num > 1;
687 public virtual string GetTextCtrlClick(
ButtonGrid b)
689 return "actSplit".lang();
693 public virtual void OnAltClick(
ButtonGrid button)
695 EClass.pc.DropThing(button.card.Thing, -1);
701 return EInput.isAltDown && EClass.pc.HasNoGoal && !this.Container.isNPCProperty && this.currency == CurrencyType.None && this.AllowDrop(b.card.Thing);
705 public virtual string GetTextAltClick(
ButtonGrid b)
707 return "actDrop".lang();
713 bool isEquipped = from.thing.isEquipped;
716 from.invOwner.owner.Chara.body.Unequip(from.thing,
true);
718 from.invOwner.Container.RemoveCard(from.thing);
729 Thing thing = from.thing;
730 if (from.invY == 1 && from.container.things.IsOccupied(from.invX, from.invY))
732 return EClass.pc.Pick(thing,
false,
true);
734 if (from.container.things.IsFull(thing,
false,
false))
736 return EClass.pc.Pick(thing,
false,
true);
738 thing.invY = from.invY;
739 thing = from.container.AddThing(thing,
true, from.invX, from.invY);
740 if (from.equippedSlot !=
null)
742 from.invOwner.owner.Chara.body.Equip(thing, from.equippedSlot,
true);
747 thing.invX = from.invX;
751 WidgetCurrentTool.dirty =
true;
759 from.thing.PlaySoundDrop(
false);
760 if (from.thing.parent !=
null)
764 if (from.thing.IsEquipment)
766 WidgetEquip.dragEquip = from.thing;
774 if (this.Container.isNPCProperty)
787 return this.OnCancelDrag(from);
796 if (!
EClass.ui.isPointerOverUI && !
EClass._zone.IsRegion)
798 flag = this.AllowDropOnDrag;
799 text = ((!this.AllowDropOnDrag) ?
"" : ((from.thing.trait is
TraitAbility) ?
"dragForget" :
"dragDropThing"));
802 if (!this.AllowDropOnDrag || from.thing.c_isImportant)
804 return this.OnCancelDrag(from);
806 EClass.pc.DropThing(from.thing, -1);
810 else if (!
EClass.core.config.game.useGrid && componentOf)
812 if (to.button && to.invOwner !=
null && to.thing !=
null && to.thing.CanStackTo(from.thing))
815 flag = transaction.IsValid();
816 text = transaction.GetTextDetail();
819 return transaction.Process(
false);
825 flag = transaction2.IsValid();
826 text = transaction2.GetTextDetail();
829 return transaction2.Process(
false);
833 else if (to.button && to.invOwner !=
null && to.button.interactable)
838 Chara chara = invOwnerEquip.owner.Chara;
840 if (execute && to.thing !=
null && to.thing.blessedState <= BlessedState.Cursed)
842 Msg.Say(
"unequipCursed", to.thing,
null,
null,
null);
845 if (from.thing.category.slot == slot.elementId)
851 if (!chara.body.IsEquippable(from.thing, slot,
true))
855 chara.AddCard(from.thing);
856 if (to.thing !=
null)
861 chara.body.Equip(from.thing, invOwnerEquip.slot,
true);
862 EClass.Sound.Play(
"equip");
868 to.invOwner.OnProcess(from.thing);
875 if (to.invOwner is
InvOwnerCopyShop && !to.invOwner.owner.trait.CanCopy(from.thing))
879 if (!to.invOwner.AllowTransfer)
884 flag = transaction3.IsValid();
885 text = transaction3.GetTextDetail();
888 return transaction3.Process(
false);
892 EClass.ui.hud.SetDragText(flag ? text :
"", (from.thing.Num > 1) ? (from.thing.Num.ToString() ??
"") :
null);
893 CursorSystem.SetCursor(flag ?
null : CursorSystem.Invalid, 100);
898 public virtual void OnProcess(
Thing t)
903 public bool CanOpenContainer(
Thing t)
905 if (!t.trait.CanOpenContainer)
909 if (t.parent !=
EClass.pc)
912 return ((thing !=
null) ? thing.trait :
null) is
TraitToolBelt;
921 if (b ==
null || b.card ==
null ||
this is
InvOwnerAlly)
923 return listInteraction;
925 Thing t = b.card.Thing;
928 return listInteraction;
930 Trait trait = t.trait;
934 if (
InvOwner.Trader ==
null ||
this.destInvOwner ==
null)
936 return listInteraction;
938 if (this.CanOpenContainer(t))
940 listInteraction.Add(
"actContainer", 10, delegate()
945 bool flag2 = !flag && !trait.CanOnlyCarry && (!this.destInvOwner.UseGuide || this.destInvOwner.ShouldShowGuide(t));
946 bool flag3 = ShopTransaction.current !=
null &&
ShopTransaction.current.CanSellBack(t, -1);
947 if (this.destInvOwner ==
InvOwner.Trader && !
InvOwner.Trader.AllowSell && !flag3)
951 if (!this.AllowHold(t))
959 if (flag2 && (!t.c_isImportant || !
this.destInvOwner.DenyImportant))
961 if (!flag3 && (
InvOwner.Trader.currency == CurrencyType.None || t.GetPrice(CurrencyType.Money,
false, PriceType.Default,
null) == 0))
967 listInteraction.Add(this.Container.isNPCProperty ?
"actSteal".lang().TagColor(FontColor.Bad, SkinManager.DarkColors) :
this.destInvOwner.langTransfer, 0, delegate()
969 if (this.Container.isNPCProperty)
972 if ((action = <>9__5) ==
null)
974 action = (<>9__5 = delegate()
976 trans.Process(
false);
979 Dialog.TryWarnCrime(action);
982 trans.Process(
false);
988 bool isShiftDown = EInput.isShiftDown;
990 listInteraction.Add(trans.GetTextDetail(), 0, delegate()
992 trans.Process(
false);
993 }).repeatable =
true;
997 listInteraction.Add(trans2.GetTextDetail(), 10, delegate()
999 trans2.Process(
false);
1003 listInteraction.Add(listInteraction[0]);
1004 listInteraction.RemoveAt(0);
1010 this.ListInteractions(listInteraction, t, trait, b, context);
1011 if (this.AllowHold(t) && !t.isEquipped && !
InvOwner.HasTrader)
1017 if (t.trait.HoldAsDefaultInteraction)
1019 listInteraction.Remove(item);
1020 listInteraction.Insert(0, item);
1022 if (t.trait.CanBeHeldAsFurniture)
1024 listInteraction.Add(
"actHoldTool", 70, delegate()
1028 if (this.TryHold(t))
1030 HotItemHeld.disableTool =
true;
1036 HotItemHeld.disableTool =
true;
1041 if (context && this.AllowHold(t) && !this.Container.isNPCProperty)
1045 listInteraction.Add(
"actSplit", 50, delegate()
1047 t.ShowSplitMenu(b, (
InvOwner.HasTrader &&
this.currency != CurrencyType.None && !
this.owner.IsPC) ?
new InvOwner.
Transaction(b, 1,
null) :
null);
1050 if (this.owner.IsPC &&
this.AllowDrop(t))
1052 if (
EClass.core.config.game.advancedMenu)
1054 listInteraction.Add(t.c_isImportant ?
"important_off" :
"important_on", 299, delegate()
1056 t.c_isImportant = !t.c_isImportant;
1061 if (!
EClass._zone.IsRegion)
1063 listInteraction.Add(flag ?
"dragForget" :
"actDrop", 300, delegate()
1065 EClass.pc.DropThing(t, -1);
1070 return listInteraction;
1074 public bool TryHold(
Thing t)
1076 if (!this.AllowHold(t) || t.isEquipped ||
InvOwner.HasTrader)
1082 if (t.trait.CanOnlyCarry)
1087 EClass.pc.PickHeld(
false);
1091 EClass.pc.HoldCard(t, -1);
1093 EClass.player.RefreshCurrentHotItem();
1101 if (this.owner.IsPC)
1103 if (this.CanOpenContainer(t) && !list.Contains(
"actContainer"))
1105 list.Add(
LayerInventory.IsOpen(t) ?
"close" :
"actContainer", 100, delegate()
1113 BodySlot slot = body.GetSlot(t,
false, EInput.isShiftDown);
1116 Card tParent = t.parentCard;
1121 list.Add(
"invEquip", 90, delegate()
1123 if (slot.thing !=
null && slot.thing.blessedState <= BlessedState.Cursed)
1125 Msg.Say(
"unequipCursed", slot.thing,
null,
null,
null);
1131 EClass.pc.PickHeld(
false);
1133 Thing thing = slot.thing;
1134 body.Equip(t, slot,
true);
1135 EClass.Sound.Play(
"equip");
1138 if (tParent !=
null)
1140 tParent.AddThing(thing,
true, -1, -1);
1145 if (thing.parent is
Card && (thing.parent as
Card).things.IsOverflowing())
1147 thing.parent.RemoveCard(thing);
1148 EClass.pc.Pick(thing,
true,
true);
1154 if (trait.CanRead(
EClass.pc))
1156 list.Add(
"invRead", 110, delegate()
1164 if (trait.CanUse(
EClass.pc))
1166 list.Add(trait.LangUse, 120, delegate()
1168 if (trait.OnUse(
EClass.pc))
1170 EClass.player.EndTurn(
true);
1174 if (trait.CanDrink(
EClass.pc))
1176 list.Add(
"invDrink", 130, delegate()
1184 if (trait.CanEat(
EClass.pc))
1186 list.Add(
"invFood", 140, delegate()
1197 if (trait.IsBlendBase)
1199 list.Add(
"invBlend", 150, delegate()
1206 list.Add(
"invCollect", 150, delegate()
1213 Action<bool, string> <>9__9;
1214 list.Add(
"changeName", 200, delegate()
1216 string langDetail =
"dialogChangeName";
1217 string text2 = t.c_refText.IsEmpty(
"");
1218 Action<bool, string> onClose;
1219 if ((onClose = <>9__9) ==
null)
1221 onClose = (<>9__9 = delegate(
bool cancel,
string text)
1229 Dialog.InputName(langDetail, text2, onClose,
Dialog.InputType.Default);
1238 public virtual string GetAutoUseLang(
ButtonGrid button)
1240 if (button ==
null || button.gameObject ==
null)
1245 if (button.card.trait.HoldAsDefaultInteraction && list.Count > 0)
1248 if (interaction.name ==
"actPick" || interaction.name ==
"actHold" || interaction.name ==
"actHoldTool")
1255 if (a.name ==
"actPick" || a.name ==
"actHold" || a.name ==
"actHoldTool")
1260 if (list.Count == 0)
1264 if (list[0].name ==
"actTransfer")
1268 return list[0].name.lang();
1272 public void AutoUse(
ButtonGrid button,
bool repeat =
false)
1274 Card card = button.card;
1279 if (!
EClass.pc.HasNoGoal)
1285 if (listInteraction.Count == 0)
1290 if (repeat && !listInteraction[0].repeatable)
1294 listInteraction[0].action();
1298 public void ShowContextMenu(
ButtonGrid button)
1300 if (!
EClass.pc.HasNoGoal)
1306 if (listInteraction.Count == 0)
1311 UIContextMenu uicontextMenu =
EClass.ui.CreateContextMenuInteraction();
1315 uicontextMenu.AddButton(interaction.name, interaction.action,
true);
1317 uicontextMenu.Show();
1321 public virtual int GetPrice(
Thing t, CurrencyType currency,
int num,
bool sell)
1327 public virtual string GetTextDetail(
Thing t, CurrencyType currency,
int num,
bool sell)
1329 int price = this.GetPrice(t, currency, num, sell);
1330 string @ref = InvOwner.Trader.UseHomeResource ? InvOwner.Trader.homeResource.Name : ((currency == CurrencyType.Influence) ?
"influence".lang() :
EClass.sources.things.map[
this.IDCurrency].GetName());
1331 string ref2 = (price == 0) ?
"" :
"invInteraction3".lang(price.ToString() ??
"", @ref, null, null, null);
1332 string text =
"invInteraction1".lang(num.ToString() ??
"", ref2, (sell ?
"invSell" :
"invBuy").lang(),
null,
null);
1333 if (!sell &&
EClass.pc.GetCurrency(
Currency.ToID(currency)) < price)
1335 text = text.TagColor(FontColor.Bad, SkinManager.DarkColors);
1341 public virtual void OnWriteNote(
ButtonGrid button, UINote n)
1351 if (this.destInvOwner ==
InvOwner.Trader)
1356 flag = (current !=
null && current.CanSellBack(thing, -1));
1373 if (flag2 &&
InvOwner.Trader.UseGuide && !
InvOwner.Trader.ShouldShowGuide(thing))
1381 UIItem uiitem = n.AddExtra<UIItem>(
"costPrice");
1382 string id = this.IDCostIcon(thing);
1383 int price = transaction.GetPrice();
1384 uiitem.text1.SetText(Lang._currency(price,
false, 14), transaction.IsValid() ? FontColor.Good : FontColor.Bad);
1385 uiitem.image1.sprite = (InvOwner.Trader.UseHomeResource ? InvOwner.Trader.homeResource.Sprite : SpriteSheet.Get(
id));
1390 public virtual string IDCostIcon(
Thing t)
1392 return "icon_" + this.IDCurrency;
1397 public string IDCurrency
1406 public virtual bool IsFailByCurse(
Thing t)
1421 public static float clickTimer;
1424 public bool includeChildren;
1427 public CurrencyType currency;
1430 public PriceType priceType;
1439 public Card Container;
1442 public List<ButtonGrid> buttons =
new List<ButtonGrid>();
1448 public void Set(
string _lang,
Card c =
null,
string _sound =
"beep_small")
1455 this.sound = _sound;
1459 public string sound =
"beep_small";
1462 public string lang =
"";
1487 if (this.to !=
null)
1489 return this.to.invOwner;
1491 if (this.destUIInv !=
null)
1493 return this.destUIInv.owner;
1495 if (!this.inv.owner.IsPC)
1509 return (!this.destInv.InvertSell && !
this.destInv.owner.IsPC) || (this.destInv.InvertSell && this.destInv.owner.IsPC);
1515 public string IDCurrency
1519 return this.currency.ToString().ToLower();
1525 public CurrencyType currency
1535 public bool FreeTrade
1539 return !InvOwner.HasTrader || this.currency == CurrencyType.None || (this.to !=
null && this.to.invOwner.owner ==
EClass.pc) || (this.destUIInv && this.destUIInv.owner.owner ==
EClass.pc);
1547 this.button = from.button;
1548 this.thing = from.thing;
1550 this.inv = from.invOwner;
1551 this.destUIInv = destUIInv;
1559 this.button = from.button;
1560 this.thing = from.thing;
1562 this.inv = from.invOwner;
1568 this.button = button;
1569 this.thing = (button.card as
Thing);
1571 this.inv = (owner ?? button.invOwner);
1575 public bool Process(
bool startTransaction =
false)
1581 if (!this.IsValid())
1590 if (this.inv.IsFailByCurse(
this.thing))
1594 if (this.destInv.CopyOnTransfer)
1596 int num = this.thing.Num;
1597 if (this.from !=
null && !(this.from.invOwner is
InvOwnerAlly))
1599 this.thing = this.from.invOwner.PutBack(this.from);
1601 else if (this.thing.parent !=
this.inv.Container)
1603 this.thing = this.inv.Container.AddThing(this.thing,
true, -1, -1);
1605 if (num != this.thing.Num)
1607 this.thing = this.thing.Split(num);
1608 this.thing =
EClass.pc.Pick(this.thing,
false,
false);
1610 if (this.destInv.SingleTarget)
1612 this.thing = this.thing.Split(1);
1614 if (this.to !=
null)
1616 this.to.button.SetCardGrid(this.thing, this.to.button.invOwner);
1621 this.destInv.buttons[currentIndex].SetCardGrid(this.thing, this.destInv.buttons[currentIndex].invOwner);
1623 this.destInv.OnProcess(this.thing);
1624 if (this.GetPrice() != 0)
1627 EClass.pc.ModCurrency(this.GetPrice() * -1, this.IDCurrency);
1631 if (!startTransaction && this.to ==
null && (this.destInv.owner.IsPC ?
EClass.pc :
this.destInv.Container).things.IsFull(
this.thing,
true,
true))
1633 if (this.destInv.owner ==
EClass.pc)
1641 if (thing !=
null && thing.isNPCProperty)
1643 Msg.Say(
"steal_container", thing, this.thing,
null,
null);
1644 this.thing.isNPCProperty =
false;
1645 EClass.player.ModKarma(-1);
1646 EClass.pc.pos.TryWitnessCrime(
EClass.pc,
null, 4,
null);
1649 Thing thing2 = this.thing.Split(this.num);
1657 SE.Play(this.sell ?
"sell" :
"buy");
1658 int price = this.GetPrice();
1659 if (
InvOwner.Trader.UseHomeResource)
1661 InvOwner.Trader.homeResource.Mod(this.sell ? price : (-price),
true);
1667 EClass.pc.ModCurrency(price, this.IDCurrency);
1671 EClass.pc.ModCurrency(-price, this.IDCurrency);
1674 Msg.Say(this.sell ?
"sold" :
"bought", thing2, Lang._currency(Mathf.Abs(price),
this.IDCurrency),
null,
null);
1675 if (thing2.id ==
"statue_weird" &&
this.sell)
1677 EClass.pc.Say(
"statue_install",
null,
null);
1681 if (this.destInv.Container.isChara && !
this.destInv.owner.IsPC && !
this.destInv.owner.Chara.CanAcceptItem(thing2, -1))
1683 this.destInv.owner.Chara.Talk(
"tooHeavy",
null,
null,
false);
1686 if (thing2.c_isImportant && !
this.destInv.owner.IsPC &&
this.destInv.DenyImportant)
1688 Msg.Say(
"markedImportant");
1691 if (this.inv.owner.isChara &&
this.inv.owner.Chara.IsPCFaction && !
this.inv.owner.IsPC && thing2.IsRangedWeapon)
1693 thing2.ammoData =
null;
1696 if (startTransaction)
1698 dragItemCard.from.thing = thing2;
1699 EClass.ui.StartDrag(dragItemCard);
1704 if (this.to !=
null)
1706 thing2.invY = this.to.invY;
1707 thing3 = this.to.container.AddThing(thing2,
true, this.to.invX,
this.to.invY);
1708 if (thing3 == thing2)
1710 if (this.to.thing !=
null)
1712 if (this.FreeTrade && !this.destInv.IsMagicChest)
1714 EClass.ui.nextDrag =
new DragItemCard(this.to.button,
true);
1715 this.to.invOwner.Grab(this.to);
1718 else if (this.destInv.Container != thing2.parent)
1720 thing3 = this.destInv.Container.AddThing(thing2,
true, -1, -1);
1723 this.to.grid[this.to.invX] = thing2;
1724 thing2.invX = this.to.invX;
1725 this.to.button.card = thing2;
1730 bool useGrid =
EClass.game.UseGrid;
1731 if (!
EClass.game.UseGrid &&
this.destUIInv)
1733 RectTransform rectTransform =
new GameObject().AddComponent<RectTransform>();
1734 rectTransform.SetParent(this.destUIInv.list.transform);
1735 rectTransform.SetAnchor(0f, 0f, 0f, 0f);
1736 rectTransform.localScale = Vector3.one;
1737 rectTransform.sizeDelta = Vector3.one;
1738 rectTransform.position = Input.mousePosition;
1739 this.from.thing.posInvX = (int)rectTransform.anchoredPosition.x;
1740 this.from.thing.posInvY = (int)rectTransform.anchoredPosition.y;
1742 if (this.destInv.owner.IsPC)
1744 thing3 =
EClass.pc.Pick(thing2,
false,
true);
1748 thing3 = this.destInv.Container.AddThing(thing2, useGrid, -1, -1);
1751 this.destInv.OnProcess(thing3);
1755 thing2.SetInt(102,
EClass._zone.uid);
1759 thing2.SetInt(102, 0);
1761 Chara chara = this.destInv.Container.Chara;
1762 if (chara !=
null && !chara.IsPC)
1764 chara.TryEquip(thing2,
false);
1765 if (thing2.id ==
"lovepotion" || thing2.id ==
"dreambug")
1767 EClass.pc.GiveLovePotion(chara, thing2);
1772 if (thing2.id ==
"statue_weird")
1774 if (!this.destInv.owner.IsPC)
1776 EClass.pc.Say(
"statue_sell",
null,
null);
1778 else if (thing ==
null || thing.GetRootCard() !=
EClass.pc)
1780 EClass.pc.Say(
"statue_pick",
null,
null);
1791 public int GetPrice()
1795 return InvOwner.Trader.GetPrice(this.thing, this.currency, this.num, this.sell);
1801 public bool IsValid()
1807 if (this.destInv.UseGuide && !
this.destInv.ShouldShowGuide(
this.thing))
1811 if (this.destInv.Container.c_lockLv != 0)
1819 if (this.destInv.CopyOnTransfer &&
this.to !=
null &&
this.to.button.index !=
LayerDragGrid.Instance.currentIndex)
1823 if (!this.destInv.AllowTransfer)
1827 if (this.thing.trait.IsContainer &&
this.destInv.Container !=
EClass.pc && !(
this.destInv.Container.trait is
TraitToolBelt) &&
this.thing.things.Count > 0 && (!
this.destInv.CopyOnTransfer || !
this.destInv.ShouldShowGuide(
this.thing)) && (
this.destInv !=
InvOwner.Trader ||
ShopTransaction.current ==
null || !
ShopTransaction.current.HasBought(
this.thing)))
1834 int price = this.GetPrice();
1837 if (this.destInv.destInvY == 0 &&
this.destInv.Container.things.IsFull(
this.thing,
true,
true))
1841 if (this.thing.c_isImportant)
1851 if (!this.FreeTrade && price == 0)
1857 else if (!this.FreeTrade)
1859 if (
InvOwner.Trader.UseHomeResource)
1861 if (
InvOwner.Trader.homeResource.value < price)
1866 else if (
EClass.pc.GetCurrency(
this.IDCurrency) < price)
1872 if (this.to !=
null)
1874 if (this.to.invOwner.IsMagicChest &&
this.to.container.things.IsFull(0))
1878 if (this.to.thing !=
null && !
this.to.thing.isDestroyed && !
this.destInv.AllowHold(
this.to.thing))
1883 if (this.destInv.owner.IsPC && !
this.destInv.Container.IsPC &&
this.destInv.IsWeightOver(
this.thing))
1892 public string GetTextDetail()
1894 if (this.FreeTrade || (this.destInv.UseGuide && !
this.destInv.ShouldShowGuide(
this.thing)))
1898 return this.destInv.GetTextDetail(this.thing, this.currency, this.num, this.sell);
1933 public Action action;
1936 public int priority;
1939 public bool repeatable;
1951 priority = priority,
1954 base.Add(interaction);
1959 public bool Contains(
string s)
1963 while (enumerator.MoveNext())
1965 if (enumerator.Current.name == s)