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>();
704 uiCurrency.target =
owner;
710 money = (currency == CurrencyType.Money),
711 plat = (currency == CurrencyType.Plat),
712 medal = (currency == CurrencyType.Medal),
713 money2 = (currency == CurrencyType.Money2),
714 influence = (currency == CurrencyType.Influence),
715 casino = (currency == CurrencyType.Casino_coin),
716 ecopo = (currency == CurrencyType.Ecopo)
745 owner.c_IDTState = 0;
765 if (
card.Thing.isEquipped &&
card.Thing.IsEquipmentOrRanged &&
card.Thing.IsCursed)
773 forceGive.card =
card;
787 card2.
Say(
"angry", card2);
789 card2.
Talk(
"noGiveRing");
794 forceGive.card =
null;
797 card.isGifted =
false;
798 card.isNPCProperty =
false;
799 card2.
Talk(flag2 ?
"forceGiveCurrency" :
"forceGive");
800 int num = ((!flag2) ? 1 : 3);
801 if (
card.id ==
"money")
803 num += card.Num / 1000;
864 card2.
Talk(
"noGive");
875 if (button.
card !=
null)
889 if (pressedTimer > 2f)
893 else if (pressedTimer > 4f)
897 else if (pressedTimer > 6f)
905 if (button.
card !=
null)
932 if (topLayer ==
null)
953 if ((thing.
parent == container || thing == container) && !thing.
IsHotItem)
1001 if (
card !=
null &&
card.c_isImportant)
1007 if (shitDestOwner ==
null)
1037 LayerInventory.highlightInv = shitDestOwner;
1044 return "actTransfer".lang();
1067 return "actSplit".lang();
1094 return "actDrop".lang();
1123 thing.invY = from.
invY;
1132 thing.invX = from.
invX;
1136 WidgetCurrentTool.dirty =
true;
1150 WidgetEquip.dragEquip = from.
thing;
1207 flag = transaction2.
IsValid();
1211 return transaction2.
Process();
1238 if (to.
thing !=
null)
1266 flag = transaction3.
IsValid();
1270 return transaction3.
Process();
1301 return listInteraction;
1306 return listInteraction;
1308 listInteraction.thing = t;
1315 return listInteraction;
1319 listInteraction.
Add(
"actContainer", 10, delegate
1347 if (Container.isNPCProperty)
1349 Dialog.TryWarnCrime(delegate
1378 listInteraction.
Add(listInteraction[0]);
1379 listInteraction.RemoveAt(0);
1388 listInteraction.Add(
"customBrightness", 300, delegate
1393 EClass.player.customLightMod = (int)b;
1395 }, 1f, 6f, isInt:
true, hideOther:
false);
1396 uIContextMenu.
Show();
1405 if (t.trait.HoldAsDefaultInteraction)
1407 listInteraction.Remove(
item);
1408 listInteraction.Insert(0,
item);
1410 if (t.trait.CanBeHeldAsFurniture)
1412 listInteraction.Add(
"actHoldTool", 70, delegate
1418 HotItemHeld.disableTool =
true;
1423 HotItemHeld.disableTool =
true;
1435 listInteraction.Add(
"actSplit", 50, delegate
1443 listInteraction.Add(t.c_isImportant ?
"important_off" :
"important_on", 299, delegate
1445 t.c_isImportant = !t.c_isImportant;
1451 listInteraction.Add(flag ?
"dragForget" :
"actDrop", 300, delegate
1458 if (!flag4 && t.c_isImportant)
1460 listInteraction.Add(t.c_isImportant ?
"important_off" :
"important_on", 299, delegate
1462 t.c_isImportant = !t.c_isImportant;
1468 return listInteraction;
1473 if (!AllowHold(t) || t.
isEquipped || HasTrader)
1501 if (CanOpenContainer(t) && !list.
Contains(
"actContainer"))
1505 (t.trait as TraitContainer).TryOpen();
1521 list.
Add(
"invEquip", 90, delegate
1525 Msg.Say(
"unequipCursed", slot.thing);
1530 if (EClass.pc.held == t)
1532 EClass.pc.PickHeld();
1535 body.
Equip(t, slot);
1539 if (tParent !=
null)
1547 thing.parent.RemoveCard(thing);
1548 EClass.pc.Pick(thing);
1557 list.Add(
"invRead", 110, delegate
1567 list.Add(trait.LangUse, 120, delegate
1569 if (trait.OnUse(EClass.pc))
1571 EClass.player.EndTurn();
1577 list.Add(
"invDrink", 130, delegate
1587 list.Add(
"invFood", 140, delegate
1596 if (trait.IsBlendBase)
1598 list.Add(
"invBlend", 150, delegate
1609 list.Add(
"invCollect", 150, delegate
1618 list.Add(
"changeName", 200, delegate
1620 Dialog.
InputName(
"dialogChangeName", t.c_refText.IsEmpty(
""), delegate(
bool cancel,
string text)
1632 if (button ==
null || button.gameObject ==
null)
1641 list.Insert(0,
item);
1648 if (interaction.
name ==
"actPick" || interaction.
name ==
"actHold" || interaction.
name ==
"actHoldTool")
1655 if (a.
name ==
"actPick" || a.
name ==
"actHold" || a.
name ==
"actHoldTool")
1660 if (list.Count == 0)
1664 if (list[0].name ==
"actTransfer")
1668 return list[0].
name.lang();
1683 ListInteraction listInteraction = ListInteractions(button, context:
false);
1684 if (listInteraction.Count == 0)
1693 listInteraction.Insert(0,
item);
1697 if (!repeat || listInteraction[0].repeatable)
1699 listInteraction[0].action();
1710 ListInteraction listInteraction = ListInteractions(button, context:
true);
1711 if (listInteraction.Count == 0)
1722 uIContextMenu.
Show();
1732 int price = GetPrice(t,
currency, num, sell);
1734 string ref2 = ((price == 0) ?
"" :
"invInteraction3".lang(price.ToFormat() ??
"", @ref));
1735 string text =
"invInteraction1".lang(num.ToString() ??
"", ref2, (sell ?
"invSell" :
"invBuy").lang());
1757 string id = IDCostIcon(t);
1758 int price = transaction.
GetPrice();
1760 uIItem.image1.sprite = (Trader.UseHomeResource ? Trader.homeResource.Sprite :
SpriteSheet.
Get(
id));
1767 return "icon_" + IDCurrency;
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
bool CanForceTradeEquip()
void SetInt(int id, int value=0)
static void SetNormalRarity(bool fixedMat=false)
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
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)
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 void Collect(Thing t)
static string ToID(CurrencyType currency)
static CursorInfo Invalid
static void SetCursor(CursorInfo info=null, int _priority=0)
static Dialog InputName(string langDetail, string text, Action< bool, string > onClose, InputType inputType=InputType.Default)
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 Create(InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)
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 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)