2using System.Collections.Generic;
9 public string sound =
"beep_small";
15 public void Set(
string _lang,
Card c =
null,
string _sound =
"beep_small")
99 return destUIInv.owner.owner ==
EClass.
pc;
135 public bool Process(
bool startTransaction =
false)
159 this.thing =
from.invOwner.PutBack(
from);
165 if (
num != this.thing.
Num)
168 this.thing =
EClass.
pc.
Pick(this.thing, msg:
false, tryStack:
false);
172 this.thing = this.thing.
Split(1);
204 this.thing.isNPCProperty =
false;
210 Thing thing3 = thing2;
218 SE.Play(
sell ?
"sell" :
"buy");
243 if (thing2.
id ==
"statue_weird" &&
sell)
256 Msg.
Say(
"markedImportant");
259 if (startTransaction)
261 dragItemCard.from.thing = thing2;
268 thing2.invY =
to.invY;
269 thing3 =
to.container.AddThing(thing2, tryStack:
true,
to.invX,
to.invY);
270 if (thing3 == thing2)
272 if (
to.thing !=
null)
279 to.invOwner.Grab(
to);
288 to.grid[
to.invX] = thing2;
289 thing2.invX =
to.invX;
290 to.button.card = thing2;
298 RectTransform rectTransform =
new GameObject().AddComponent<RectTransform>();
300 rectTransform.SetAnchor(0f, 0f, 0f, 0f);
301 rectTransform.localScale = Vector3.one;
302 rectTransform.sizeDelta = Vector3.one;
303 rectTransform.position = Input.mousePosition;
304 from.thing.posInvX = (int)rectTransform.anchoredPosition.x;
305 from.thing.posInvY = (
int)rectTransform.anchoredPosition.y;
320 if (chara !=
null && !chara.
IsPC)
323 if (thing2.
id ==
"lovepotion" || thing2.
id ==
"dreambug")
330 if (thing2.
id ==
"statue_weird")
430 if (
to.invOwner.IsMagicChest &&
to.container.things.IsFull())
474 public Interaction Add(
string s,
int priority, Action action,
string idPriority =
null)
480 idPriority = idPriority,
483 if (!idPriority.IsEmpty())
485 if (idPriority ==
"remove")
503 using (Enumerator enumerator = GetEnumerator())
505 while (enumerator.MoveNext())
507 if (enumerator.Current.name == s)
537 public List<ButtonGrid>
buttons =
new List<ButtonGrid>();
711 uiCurrency.target =
owner;
717 money = (currency == CurrencyType.Money),
718 plat = (currency == CurrencyType.Plat),
719 medal = (currency == CurrencyType.Medal),
720 money2 = (currency == CurrencyType.Money2),
721 influence = (currency == CurrencyType.Influence),
722 casino = (currency == CurrencyType.Casino_coin),
723 ecopo = (currency == CurrencyType.Ecopo)
752 owner.c_IDTState = 0;
772 if (
card.Thing.isEquipped &&
card.GetBool(135))
776 else if (
card.Thing.isEquipped &&
card.Thing.IsEquipmentOrRanged &&
card.Thing.IsCursed)
784 forceGive.card =
card;
798 card2.
Say(
"angry", card2);
800 card2.
Talk(
"noGiveRing");
805 forceGive.card =
null;
808 card.isGifted =
false;
809 card.isNPCProperty =
false;
810 card2.
Talk(flag2 ?
"forceGiveCurrency" :
"forceGive");
811 int num = ((!flag2) ? 1 : 3);
812 if (
card.id ==
"money")
814 num += card.Num / 1000;
875 card2.
Talk(
"noGive");
886 if (button.
card !=
null)
900 if (pressedTimer > 2f)
904 else if (pressedTimer > 4f)
908 else if (pressedTimer > 6f)
916 if (button.
card !=
null)
943 if (topLayer ==
null)
964 if ((thing.
parent == container || thing == container) && !thing.
IsHotItem)
1012 if (
card !=
null &&
card.c_isImportant)
1018 if (shitDestOwner ==
null)
1048 LayerInventory.highlightInv = shitDestOwner;
1055 return "actTransfer".lang();
1078 return "actSplit".lang();
1105 return "actDrop".lang();
1134 thing.invY = from.
invY;
1143 thing.invX = from.
invX;
1147 WidgetCurrentTool.dirty =
true;
1161 WidgetEquip.dragEquip = from.
thing;
1218 flag = transaction2.
IsValid();
1222 return transaction2.
Process();
1233 if (execute && to.
thing !=
null)
1257 if (to.
thing !=
null)
1285 flag = transaction3.
IsValid();
1289 return transaction3.
Process();
1320 return listInteraction;
1325 return listInteraction;
1327 listInteraction.thing = t;
1334 return listInteraction;
1338 listInteraction.
Add(
"actContainer", 10, delegate
1366 if (Container.isNPCProperty)
1368 Dialog.TryWarnCrime(delegate
1397 listInteraction.
Add(listInteraction[0]);
1398 listInteraction.RemoveAt(0);
1411 if (t.trait.HoldAsDefaultInteraction)
1413 listInteraction.Remove(
item);
1414 listInteraction.Insert(0,
item);
1416 if (t.trait.CanBeHeldAsFurniture)
1418 listInteraction.Add(
"actHoldTool", 70, delegate
1424 HotItemHeld.disableTool = true;
1429 HotItemHeld.disableTool =
true;
1440 listInteraction.Add(
"actSplit", 50, delegate
1447 listInteraction.Add(flag ?
"dragForget" :
"actDrop", 300, delegate
1457 listInteraction.Add(t.c_isImportant ?
"important_off" :
"important_on", 299, delegate
1459 t.c_isImportant = !t.c_isImportant;
1460 LayerInventory.SetDirty(t);
1464 if (!flag4 && t.c_isImportant)
1466 listInteraction.Add(t.c_isImportant ?
"important_off" :
"important_on", 299, delegate
1468 t.c_isImportant = !t.c_isImportant;
1469 LayerInventory.SetDirty(t);
1474 return listInteraction;
1479 if (!AllowHold(t) || t.
isEquipped || HasTrader)
1507 if (CanOpenContainer(t) && !list.
Contains(
"actContainer"))
1511 (t.trait as TraitContainer).TryOpen();
1527 list.
Add(
"invEquip", 90, delegate
1529 if (slot.
thing !=
null)
1531 if (slot.thing.blessedState <= BlessedState.Cursed)
1533 Msg.Say(
"unequipCursed", slot.thing);
1539 Msg.Say(
"isSleepLock", slot.thing);
1546 EClass.pc.PickHeld();
1549 body.
Equip(t, slot);
1553 if (tParent !=
null)
1561 thing.parent.RemoveCard(thing);
1562 EClass.pc.Pick(thing);
1568 trait.OnListInteraction(list, b, context);
1573 if (button ==
null || button.gameObject ==
null)
1582 list.Insert(0,
item);
1589 if (interaction.
name ==
"actPick" || interaction.
name ==
"actHold" || interaction.
name ==
"actHoldTool")
1596 if (a.
name ==
"actPick" || a.
name ==
"actHold" || a.
name ==
"actHoldTool")
1601 if (list.Count == 0)
1605 if (list[0].name ==
"actTransfer")
1609 return list[0].
name.lang();
1624 ListInteraction listInteraction = ListInteractions(button, context:
false);
1625 if (listInteraction.Count == 0)
1634 listInteraction.Insert(0,
item);
1638 if (!repeat || listInteraction[0].repeatable)
1640 listInteraction[0].action();
1651 ListInteraction listInteraction = ListInteractions(button, context:
true);
1652 if (listInteraction.Count == 0)
1661 uIContextMenu.AddButton(
item.name,
item.action);
1663 uIContextMenu.Show();
1673 int price = GetPrice(t,
currency, num, sell);
1675 string ref2 = ((price == 0) ?
"" :
"invInteraction3".lang(price.ToFormat() ??
"", @ref));
1676 string text =
"invInteraction1".lang(num.ToString() ??
"", ref2, (sell ?
"invSell" :
"invBuy").lang());
1688 bool flag = HasTrader && Trader.currency != CurrencyType.None && (destInvOwner != Trader || Trader.AllowSell || (
ShopTransaction.
current?.
CanSellBack(t) ??
false));
1698 string id = IDCostIcon(t);
1699 int price = transaction.
GetPrice();
1701 uIItem.image1.sprite = (Trader.UseHomeResource ? Trader.homeResource.Sprite :
SpriteSheet.
Get(
id));
1708 return "icon_" + IDCurrency;
bool CanForceTradeEquip()
static void SetNormalRarity(bool fixedMat=false)
void SetInt(string id, int value=0)
Thing AddThing(string id, int lv=-1)
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
int GetCurrency(string id="money")
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
void ModCurrency(int a, string id="money")
BlessedState blessedState
void PlaySoundDrop(bool spatial=true)
SourceCategory.Row category
void Say(string lang, string ref1=null, string ref2=null)
void Unequip(Thing thing, bool refresh=true)
bool IsEquippable(Thing thing, BodySlot slot, bool text=true)
bool Equip(Thing thing, BodySlot slot=null, bool msg=true)
BodySlot GetSlot(Thing t, bool onlyEmpty=false, bool secondSlot=false)
void InstantEat(Thing t=null, bool sound=true)
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
bool CanAcceptItem(Card t, int num=-1, bool skipImportantCheck=false)
void HoldCard(Card t, int num=-1)
void PickHeld(bool msg=false)
void GiveLovePotion(Chara c, Thing t)
void DropThing(Thing t, int num=-1)
bool TryEquip(Thing t, bool useFav=false)
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
static string ToID(CurrencyType currency)
static CursorInfo Invalid
static void SetCursor(CursorInfo info=null, int _priority=0)
static SourceManager sources
static FactionBranch BranchOrHomeBranch
static SoundManager Sound
HomeResourceManager resources
override void Mod(int a, bool popText=true)
void Set(string _lang, Card c=null, string _sound="beep_small")
Interaction Add(string s, int priority, Action action, string idPriority=null)
Transaction(DragItemCard.DragInfo from, DragItemCard.DragInfo to, int num=1)
Transaction(ButtonGrid button, int num=1, InvOwner owner=null)
static ErrorMessage error
bool Process(bool startTransaction=false)
DragItemCard.DragInfo from
Transaction(DragItemCard.DragInfo from, UIInventory destUIInv, int num=1)
virtual bool AllowDropOnDrag
void Grab(DragItemCard.DragInfo from)
virtual bool OnCancelDrag(DragItemCard.DragInfo from)
virtual bool CanCtrlClick(ButtonGrid b)
virtual void BuildUICurrency(UICurrency uiCurrency, bool canReroll=false)
virtual void OnShiftClick(ButtonGrid b, bool rightMouse=false)
virtual bool DenyImportant
InvOwner GetShitDestOwner(ButtonGrid b, bool rightMouse=false)
virtual void OnProcess(Thing t)
void ShowContextMenu(ButtonGrid button)
virtual string GetTextDetail(Thing t, CurrencyType currency, int num, bool sell)
virtual bool AllowHold(Thing t)
virtual bool AlwaysShowTooltip
virtual void OnCtrlClick(ButtonGrid button)
virtual int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
virtual bool AllowTransfer
InvOwner(Card owner, Card container=null, CurrencyType _currency=CurrencyType.None, PriceType _price=PriceType.Default)
virtual void OnAltClick(ButtonGrid button)
void AutoUse(ButtonGrid button, bool repeat=false)
virtual string GetTextAltClick(ButtonGrid b)
virtual Thing CreateDefaultContainer()
virtual bool IsFailByCurse(Thing t)
virtual string GetTextCtrlClick(ButtonGrid b)
bool IsWeightOver(Thing t)
virtual bool AllowMoved(Thing t)
virtual bool SingleTarget
virtual void OnRightClick(ButtonGrid button)
List< ButtonGrid > buttons
virtual bool OnDrag(DragItemCard.DragInfo from, DragItemCard.DragInfo to, bool execute, bool cancel=false)
ListInteraction ListInteractions(ButtonGrid b, bool context)
virtual bool CanAltClick(ButtonGrid b)
virtual bool AllowDrop(Thing t)
virtual void ListInteractions(ListInteraction list, Thing t, Trait trait, ButtonGrid b, bool context)
static ForceGiveData forceGive
virtual void OnRightPressed(ButtonGrid button)
virtual void OnClick(ButtonGrid button)
virtual void OnWriteNote(ButtonGrid button, UINote n)
bool CanOpenContainer(Thing t)
void OnStartDrag(DragItemCard.DragInfo from)
virtual string GetTextShiftClick(ButtonGrid b)
virtual string GetAutoUseLang(ButtonGrid button)
virtual bool CanShiftClick(ButtonGrid b, bool rightMouse=false)
virtual string IDCostIcon(Thing t)
virtual string langTransfer
virtual bool AllowContext
Thing PutBack(DragItemCard.DragInfo from)
virtual bool ShouldShowGuide(Thing t)
HomeResource homeResource
virtual bool CopyOnTransfer
virtual bool HasTransaction
virtual bool AllowAutouse
static string _currency(object a, string IDCurrency)
static LayerDragGrid Instance
static void SetDirty(Thing t)
static LayerInventory GetPCLayer()
static bool IsOpen(Thing t)
static LayerInventory GetTopLayer(Thing t, bool includePlayer=false, InvOwner exclude=null)
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
bool IsPriorityAction(string id, Thing t)
void SetPriorityAction(string id, Thing t)
void RefreshCurrentHotItem()
bool TryWitnessCrime(Chara criminal, Chara target=null, int radius=4, Func< Chara, bool > funcWitness=null)
static ShopTransaction current
bool CanSellBack(Thing t, int num=-1)
int GetPrice(Thing t, int n, bool sell)
void Process(Thing t, int n, bool sell)
static SkinColorProfile DarkColors
static Sprite Get(string id)
Thing TryStack(Thing target, int destInvX=-1, int destInvY=-1)
bool IsOccupied(int x, int y)
Thing CanStack(Thing target, int destInvX=-1, int destInvY=-1)
static Thing Create(string id, int idMat=-1, int lv=-1)
void ShowSplitMenu(ButtonGrid button, InvOwner.Transaction trans=null)
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
override bool CanStackTo(Thing to)
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
virtual bool HoldAsDefaultInteraction
virtual bool CanOpenContainer
virtual bool CanCopy(Thing t)
virtual ContainerType ContainerType
virtual bool CanBeDropped
virtual bool CanOnlyCarry
void Build(Options _options)
void Space(int sizeY=0, int sizeX=1)