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),
724 mandrake = (currency == CurrencyType.Money3)
753 owner.c_IDTState = 0;
773 if (
card.Thing.isEquipped &&
card.GetBool(135))
777 else if (
card.Thing.isEquipped &&
card.Thing.IsEquipmentOrRanged &&
card.Thing.IsCursed)
785 forceGive.card =
card;
799 card2.
Say(
"angry", card2);
801 card2.
Talk(
"noGiveRing");
806 forceGive.card =
null;
809 card.isGifted =
false;
810 card.isNPCProperty =
false;
811 card2.
Talk(flag2 ?
"forceGiveCurrency" :
"forceGive");
812 int num = ((!flag2) ? 1 : 3);
813 if (
card.id ==
"money")
815 num += card.Num / 1000;
876 card2.
Talk(
"noGive");
887 if (button.
card !=
null)
901 if (pressedTimer > 2f)
905 else if (pressedTimer > 4f)
909 else if (pressedTimer > 6f)
917 if (button.
card !=
null)
944 if (topLayer ==
null)
965 if ((thing.
parent == container || thing == container) && !thing.
IsHotItem)
1013 if (
card !=
null &&
card.c_isImportant)
1019 if (shitDestOwner ==
null)
1049 LayerInventory.highlightInv = shitDestOwner;
1056 return "actTransfer".lang();
1079 return "actSplit".lang();
1106 return "actDrop".lang();
1135 thing.invY = from.
invY;
1144 thing.invX = from.
invX;
1148 WidgetCurrentTool.dirty =
true;
1162 WidgetEquip.dragEquip = from.
thing;
1219 flag = transaction2.
IsValid();
1223 return transaction2.
Process();
1234 if (execute && to.
thing !=
null)
1258 if (to.
thing !=
null)
1286 flag = transaction3.
IsValid();
1290 return transaction3.
Process();
1321 return listInteraction;
1326 return listInteraction;
1328 listInteraction.thing = t;
1335 return listInteraction;
1339 listInteraction.
Add(
"actContainer", 10, delegate
1367 if (Container.isNPCProperty)
1369 Dialog.TryWarnCrime(delegate
1398 listInteraction.
Add(listInteraction[0]);
1399 listInteraction.RemoveAt(0);
1412 if (t.trait.HoldAsDefaultInteraction)
1414 listInteraction.Remove(
item);
1415 listInteraction.Insert(0,
item);
1417 if (t.trait.CanBeHeldAsFurniture)
1419 listInteraction.Add(
"actHoldTool", 70, delegate
1425 HotItemHeld.disableTool = true;
1430 HotItemHeld.disableTool =
true;
1441 listInteraction.Add(
"actSplit", 50, delegate
1448 listInteraction.Add(flag ?
"dragForget" :
"actDrop", 300, delegate
1458 listInteraction.Add(t.c_isImportant ?
"important_off" :
"important_on", 299, delegate
1460 t.c_isImportant = !t.c_isImportant;
1461 LayerInventory.SetDirty(t);
1465 if (!flag4 && t.c_isImportant)
1467 listInteraction.Add(t.c_isImportant ?
"important_off" :
"important_on", 299, delegate
1469 t.c_isImportant = !t.c_isImportant;
1470 LayerInventory.SetDirty(t);
1475 return listInteraction;
1480 if (!AllowHold(t) || t.
isEquipped || HasTrader)
1508 if (CanOpenContainer(t) && !list.
Contains(
"actContainer"))
1512 (t.trait as TraitContainer).TryOpen();
1528 list.
Add(
"invEquip", 90, delegate
1530 if (slot.
thing !=
null)
1532 if (slot.thing.blessedState <= BlessedState.Cursed)
1534 Msg.Say(
"unequipCursed", slot.thing);
1540 Msg.Say(
"isSleepLock", slot.thing);
1547 EClass.pc.PickHeld();
1550 body.
Equip(t, slot);
1554 if (tParent !=
null)
1562 thing.parent.RemoveCard(thing);
1563 EClass.pc.Pick(thing);
1569 trait.OnListInteraction(list, b, context);
1574 if (button ==
null || button.gameObject ==
null)
1583 list.Insert(0,
item);
1590 if (interaction.
name ==
"actPick" || interaction.
name ==
"actHold" || interaction.
name ==
"actHoldTool")
1597 if (a.
name ==
"actPick" || a.
name ==
"actHold" || a.
name ==
"actHoldTool")
1602 if (list.Count == 0)
1606 if (list[0].name ==
"actTransfer")
1610 return list[0].
name.lang();
1625 ListInteraction listInteraction = ListInteractions(button, context:
false);
1626 if (listInteraction.Count == 0)
1635 listInteraction.Insert(0,
item);
1639 if (!repeat || listInteraction[0].repeatable)
1641 listInteraction[0].action();
1652 ListInteraction listInteraction = ListInteractions(button, context:
true);
1653 if (listInteraction.Count == 0)
1662 uIContextMenu.AddButton(
item.name,
item.action);
1664 uIContextMenu.Show();
1674 int price = GetPrice(t,
currency, num, sell);
1676 string ref2 = ((price == 0) ?
"" :
"invInteraction3".lang(price.ToFormat() ??
"", @ref));
1677 string text =
"invInteraction1".lang(num.ToString() ??
"", ref2, (sell ?
"invSell" :
"invBuy").lang());
1689 bool flag = HasTrader && Trader.currency != CurrencyType.None && (destInvOwner != Trader || Trader.AllowSell || (
ShopTransaction.
current?.
CanSellBack(t) ??
false));
1699 string id = IDCostIcon(t);
1700 int price = transaction.
GetPrice();
1703 uIItem.
image1.SetNativeSize();
1710 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
Dictionary< string, CardRow > map
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)