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");
261 thing2.ammoData =
null;
264 if (startTransaction)
266 dragItemCard.from.thing = thing2;
273 thing2.invY =
to.invY;
274 thing3 =
to.container.AddThing(thing2, tryStack:
true,
to.invX,
to.invY);
275 if (thing3 == thing2)
277 if (
to.thing !=
null)
284 to.invOwner.Grab(
to);
293 to.grid[
to.invX] = thing2;
294 thing2.invX =
to.invX;
295 to.button.card = thing2;
303 RectTransform rectTransform =
new GameObject().AddComponent<RectTransform>();
305 rectTransform.SetAnchor(0f, 0f, 0f, 0f);
306 rectTransform.localScale = Vector3.one;
307 rectTransform.sizeDelta = Vector3.one;
308 rectTransform.position = Input.mousePosition;
309 from.thing.posInvX = (int)rectTransform.anchoredPosition.x;
310 from.thing.posInvY = (
int)rectTransform.anchoredPosition.y;
325 if (chara !=
null && !chara.
IsPC)
328 if (thing2.
id ==
"lovepotion" || thing2.
id ==
"dreambug")
335 if (thing2.
id ==
"statue_weird")
435 if (
to.invOwner.IsMagicChest &&
to.container.things.IsFull())
479 public Interaction Add(
string s,
int priority, Action action,
string idPriority =
null)
485 idPriority = idPriority,
488 if (!idPriority.IsEmpty())
490 if (idPriority ==
"remove")
508 using (Enumerator enumerator = GetEnumerator())
510 while (enumerator.MoveNext())
512 if (enumerator.Current.name == s)
542 public List<ButtonGrid>
buttons =
new List<ButtonGrid>();
709 uiCurrency.target =
owner;
715 money = (currency == CurrencyType.Money),
716 plat = (currency == CurrencyType.Plat),
717 medal = (currency == CurrencyType.Medal),
718 money2 = (currency == CurrencyType.Money2),
719 influence = (currency == CurrencyType.Influence),
720 casino = (currency == CurrencyType.Casino_coin),
721 ecopo = (currency == CurrencyType.Ecopo)
750 owner.c_IDTState = 0;
770 if (
card.Thing.isEquipped &&
card.Thing.IsEquipmentOrRanged &&
card.Thing.IsCursed)
778 forceGive.card =
card;
792 card2.
Say(
"angry", card2);
794 card2.
Talk(
"noGiveRing");
799 forceGive.card =
null;
802 card.isGifted =
false;
803 card.isNPCProperty =
false;
804 card2.
Talk(flag2 ?
"forceGiveCurrency" :
"forceGive");
805 int num = ((!flag2) ? 1 : 3);
806 if (
card.id ==
"money")
808 num += card.Num / 1000;
869 card2.
Talk(
"noGive");
880 if (button.
card !=
null)
894 if (pressedTimer > 2f)
898 else if (pressedTimer > 4f)
902 else if (pressedTimer > 6f)
910 if (button.
card !=
null)
937 if (topLayer ==
null)
958 if ((thing.
parent == container || thing == container) && !thing.
IsHotItem)
1006 if (
card !=
null &&
card.c_isImportant)
1012 if (shitDestOwner ==
null)
1042 thing.ammoData =
null;
1047 LayerInventory.highlightInv = shitDestOwner;
1054 return "actTransfer".lang();
1077 return "actSplit".lang();
1104 return "actDrop".lang();
1133 thing.invY = from.
invY;
1142 thing.invX = from.
invX;
1146 WidgetCurrentTool.dirty =
true;
1160 WidgetEquip.dragEquip = from.
thing;
1217 flag = transaction2.
IsValid();
1221 return transaction2.
Process();
1248 if (to.
thing !=
null)
1276 flag = transaction3.
IsValid();
1280 return transaction3.
Process();
1311 return listInteraction;
1316 return listInteraction;
1318 listInteraction.thing = t;
1325 return listInteraction;
1329 listInteraction.
Add(
"actContainer", 10, delegate
1357 if (Container.isNPCProperty)
1359 Dialog.TryWarnCrime(delegate
1388 listInteraction.
Add(listInteraction[0]);
1389 listInteraction.RemoveAt(0);
1398 listInteraction.Add(
"customBrightness", 300, delegate
1403 EClass.player.customLightMod = (int)b;
1405 }, 1f, 6f, isInt:
true, hideOther:
false);
1406 uIContextMenu.
Show();
1415 if (t.trait.HoldAsDefaultInteraction)
1417 listInteraction.Remove(
item);
1418 listInteraction.Insert(0,
item);
1420 if (t.trait.CanBeHeldAsFurniture)
1422 listInteraction.Add(
"actHoldTool", 70, delegate
1428 HotItemHeld.disableTool =
true;
1433 HotItemHeld.disableTool =
true;
1445 listInteraction.Add(
"actSplit", 50, delegate
1453 listInteraction.Add(t.c_isImportant ?
"important_off" :
"important_on", 299, delegate
1455 t.c_isImportant = !t.c_isImportant;
1461 listInteraction.Add(flag ?
"dragForget" :
"actDrop", 300, delegate
1468 if (!flag4 && t.c_isImportant)
1470 listInteraction.Add(t.c_isImportant ?
"important_off" :
"important_on", 299, delegate
1472 t.c_isImportant = !t.c_isImportant;
1478 return listInteraction;
1483 if (!AllowHold(t) || t.
isEquipped || HasTrader)
1511 if (CanOpenContainer(t) && !list.
Contains(
"actContainer"))
1515 (t.trait as TraitContainer).TryOpen();
1531 list.
Add(
"invEquip", 90, delegate
1535 Msg.Say(
"unequipCursed", slot.thing);
1540 if (EClass.pc.held == t)
1542 EClass.pc.PickHeld();
1545 body.
Equip(t, slot);
1549 if (tParent !=
null)
1557 thing.parent.RemoveCard(thing);
1558 EClass.pc.Pick(thing);
1567 list.Add(
"invRead", 110, delegate
1577 list.Add(trait.LangUse, 120, delegate
1579 if (trait.OnUse(EClass.pc))
1581 EClass.player.EndTurn();
1587 list.Add(
"invDrink", 130, delegate
1597 list.Add(
"invFood", 140, delegate
1606 if (trait.IsBlendBase)
1608 list.Add(
"invBlend", 150, delegate
1619 list.Add(
"invCollect", 150, delegate
1628 list.Add(
"changeName", 200, delegate
1630 Dialog.
InputName(
"dialogChangeName", t.c_refText.IsEmpty(
""), delegate(
bool cancel,
string text)
1642 if (button ==
null || button.gameObject ==
null)
1651 list.Insert(0,
item);
1658 if (interaction.
name ==
"actPick" || interaction.
name ==
"actHold" || interaction.
name ==
"actHoldTool")
1665 if (a.
name ==
"actPick" || a.
name ==
"actHold" || a.
name ==
"actHoldTool")
1670 if (list.Count == 0)
1674 if (list[0].name ==
"actTransfer")
1678 return list[0].
name.lang();
1693 ListInteraction listInteraction = ListInteractions(button, context:
false);
1694 if (listInteraction.Count == 0)
1703 listInteraction.Insert(0,
item);
1707 if (!repeat || listInteraction[0].repeatable)
1709 listInteraction[0].action();
1720 ListInteraction listInteraction = ListInteractions(button, context:
true);
1721 if (listInteraction.Count == 0)
1732 uIContextMenu.
Show();
1742 int price = GetPrice(t,
currency, num, sell);
1744 string ref2 = ((price == 0) ?
"" :
"invInteraction3".lang(price.ToFormat() ??
"", @ref));
1745 string text =
"invInteraction1".lang(num.ToString() ??
"", ref2, (sell ?
"invSell" :
"invBuy").lang());
1767 string id = IDCostIcon(t);
1768 int price = transaction.
GetPrice();
1770 uIItem.image1.sprite = (Trader.UseHomeResource ? Trader.homeResource.Sprite :
SpriteSheet.
Get(
id));
1777 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)
override bool IsPCFaction
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)