12 public string[] Params
16 if (!this.owner.c_editorTraitVal.IsEmpty())
18 return (
"," + this.owner.c_editorTraitVal).Split(
',', StringSplitOptions.None);
20 return this.owner.sourceCard.trait;
25 public string GetParam(
int i,
string def =
null)
27 if (i < this.Params.Length)
29 return this.Params[i];
35 public int GetParamInt(
int i,
int def)
37 if (i < this.Params.Length)
39 return this.Params[i].ToInt();
46 public virtual byte WeightMod
56 public virtual string Name
60 return this.owner.NameSimple;
67 return r.idFactory == ((this.owner.sourceCard.origin !=
null) ? this.owner.sourceCard.origin.id : this.owner.id);
76 return this.owner.TileType;
82 public virtual RefCardName RefCardName
86 return RefCardName.Default;
92 public virtual bool IsBlockPath
96 return this.tileType.IsBlockPass;
102 public virtual bool IsBlockSight
106 return this.tileType.IsBlockSight;
112 public virtual bool IsDoor
122 public virtual bool IsOpenSight
132 public virtual bool IsOpenPath
142 public virtual bool IsFloating
152 public virtual bool IsGround
162 public virtual bool InvertHeldSprite
172 public virtual bool IsChangeFloorHeight
176 return this.owner.Pref.Surface;
182 public virtual bool ShouldRefreshTile
186 return this.IsBlockPath || this.IsOpenSight || this.IsBlockSight;
192 public virtual bool ShouldTryRefreshRoom
202 public virtual bool CanHarvest
212 public virtual int radius
222 public virtual bool CanUseRoomRadius
232 public virtual int GuidePriotiy
242 public virtual int Electricity
246 if (!this.owner.isThing)
250 return this.owner.Thing.source.electricity;
256 public virtual bool IgnoreLastStackHeight
266 public virtual int Decay
270 return this.owner.material.decay;
276 public virtual int DecaySpeed
286 public virtual int DecaySpeedChild
296 public virtual bool IsFridge
305 public virtual int GetValue()
307 return this.owner.sourceCard.value;
312 public virtual int DefaultStock
322 public virtual bool HoldAsDefaultInteraction
332 public virtual int CraftNum
342 public virtual bool ShowOrbit
352 public virtual bool HaveUpdate
362 public virtual bool IsSpot
366 return this.radius > 0;
372 public virtual bool IsFactory
382 public virtual bool CanAutofire
392 public virtual bool CanName
402 public virtual bool CanPutAway
412 public virtual bool CanStack
416 return this.owner.category.maxStack > 1;
422 public virtual bool CanCopyInBlueprint
426 return this.owner.rarity <= Rarity.Superior && this.owner.sourceCard.value > 0 && this.CanBeDestroyed;
431 public virtual bool CanStackTo(
Thing to)
433 return this.CanStack;
438 public virtual bool CanBeAttacked
448 public virtual bool CanExtendBuild
458 public virtual string langNote
468 public virtual string IDInvStyle
478 public virtual string IDActorEx
482 return this.owner.Thing.source.idActorEx;
487 public virtual string GetHoverText()
494 public virtual bool MaskOnBuild
504 public virtual bool ShowContextOnPick
514 public virtual bool IsThrowMainAction
518 return this.owner.HasTag(CTAG.throwWeapon) || this.owner.IsMeleeWeapon;
524 public virtual bool LevelAsQuality
534 public virtual bool UseDummyTile
544 public virtual bool RequireFullStackCheck
553 public virtual Action GetHealAction(
Chara c)
560 public virtual InvGridSize InvGridSize
564 if (!this.owner.IsPC)
566 return InvGridSize.Default;
568 return InvGridSize.Backpack;
574 public virtual bool IsContainer
584 public virtual bool CanOpenContainer
588 return this.IsContainer && !this.owner.isNPCProperty;
594 public virtual bool IsSpecialContainer
604 public virtual ContainerType ContainerType
608 return ContainerType.Default;
614 public virtual ThrowType ThrowType
618 return ThrowType.Default;
624 public virtual EffectDead EffectDead
628 return EffectDead.Default;
634 public virtual bool IsHomeItem
644 public virtual bool IsAltar
654 public virtual bool IsRestSpot
664 public virtual bool CanBeMasked
674 public virtual bool IsBlendBase
683 public virtual bool CanBlend(
Thing t)
695 public virtual bool CanBeOnlyBuiltInHome
705 public virtual bool CanBuildInTown
709 return !this.owner.TileType.IsBlockPass && !this.owner.TileType.IsBlockSight;
715 public virtual bool CanBeHeld
719 return this.ReqHarvest ==
null;
725 public virtual bool CanBeStolen
729 return !this.CanOnlyCarry && this.CanBeHeld;
735 public virtual bool CanOnlyCarry
745 public virtual bool CanBeDestroyed
755 public virtual bool CanBeHallucinated
765 public virtual bool CanSearchContents
775 public virtual bool CanBeDropped
785 public virtual string ReqHarvest
795 public virtual bool CanBeDisassembled
799 return this.CanBeDestroyed && !(
this is
TraitTrap) && this.owner.things.Count == 0 &&
this.owner.rarity < Rarity.Artifact;
805 public virtual bool CanBeShipped
809 return !this.owner.IsImportant && !this.owner.IsUnique;
815 public virtual bool HasCharges
825 public virtual bool ShowCharges
829 return this.HasCharges;
835 public virtual bool ShowChildrenNumber
839 return this.IsContainer;
844 public virtual int GetActDuration(
Chara c)
851 public virtual bool ShowAsTool
861 public virtual bool CanBeHeldAsFurniture
865 return this is
TraitTool || this.IsThrowMainAction;
871 public virtual bool HideInAdv
881 public virtual bool NoHeldDir
891 public virtual bool AlwaysHideOnLowWall
906 public virtual Sprite GetRefSprite()
913 public bool ExistsOnMap
917 return this.owner.ExistsOnMap;
923 public virtual bool RenderExtra
933 public virtual float DropChance
943 public virtual string IdNoRestock
947 return this.owner.id;
957 public virtual Emo2 GetHeldEmo(
Chara c)
963 public virtual void SetOwner(
Card _owner)
970 public virtual bool IdleUse(
Chara c,
int dist)
977 public virtual int IdleUseChance
986 public virtual void OnSetOwner()
991 public virtual void OnImportMap()
996 public virtual void SetParams(params
string[] s)
1001 public virtual void OnCrafted(
Recipe recipe)
1006 public virtual void OnCreate(
int lv)
1011 public virtual void OnChangePlaceState(PlaceState state)
1016 public virtual void OnAddedToZone()
1021 public virtual void OnRemovedFromZone()
1026 public virtual void OnSimulateHour(
VirtualDate date)
1031 public virtual string GetName()
1033 return this.owner.sourceCard.GetText(
"name",
false);
1037 public virtual void SetName(ref
string s)
1042 public unsafe
virtual void OnRenderTile(
Point point, HitResult result,
int dir)
1044 if (this.radius == 0)
1048 Vector3 vector = *point.Position();
1049 vector.z +=
EClass.setting.render.thingZ;
1050 foreach (
Point point2
in this.ListPoints(point,
true))
1052 Vector3 vector2 = *point2.Position();
1053 EClass.screen.guide.passGuideFloor.Add(vector2.x, vector2.y, vector2.z, 10f, 0.3f);
1058 public virtual int CompareTo(
Card b)
1064 public virtual bool CanBuiltAt(
Point p)
1070 public virtual void Update()
1075 public Point GetPoint()
1077 return this.owner.pos;
1081 public Point GetRandomPoint(Func<Point, bool> func =
null)
1083 if (this.radius == 0)
1085 return this.owner.pos;
1087 List<Point> list = this.ListPoints(
null,
true);
1088 for (
int i = 0; i < 50; i++)
1091 if (point.IsValid && (func ==
null || func(point)))
1100 public virtual List<Point> ListPoints(
Point center =
null,
bool onlyPassable =
true)
1102 Trait.listRadiusPoints.Clear();
1105 center = this.owner.pos;
1107 if (this.radius == 0)
1109 Trait.listRadiusPoints.Add(center.Copy());
1110 return Trait.listRadiusPoints;
1112 Room room = center.cell.room;
1113 if (room !=
null && this.CanUseRoomRadius)
1115 using (List<Point>.Enumerator enumerator = room.points.GetEnumerator())
1117 while (enumerator.MoveNext())
1119 Point point = enumerator.Current;
1120 if ((!onlyPassable || !point.cell.blocked) && !point.cell.HasBlock && point.cell.HasFloor)
1122 Trait.listRadiusPoints.Add(point.Copy());
1128 EClass._map.ForeachSphere(center.x, center.z, (
float)(
this.radius + 1), delegate(
Point p)
1130 if (onlyPassable && p.cell.blocked)
1134 if (!p.cell.HasBlock && p.cell.HasFloor && (!onlyPassable ||
Los.IsVisible(center, p,
null)))
1136 Trait.listRadiusPoints.Add(p.Copy());
1140 if (
Trait.listRadiusPoints.Count == 0)
1142 Trait.listRadiusPoints.Add(center.Copy());
1144 return Trait.listRadiusPoints;
1148 public virtual Recipe GetRecipe()
1150 return Recipe.Create(this.owner.Thing);
1154 public virtual Recipe GetBuildModeRecipe()
1156 return Recipe.Create(this.owner.Thing);
1161 public virtual string RecipeCat
1165 return this.owner.sourceCard.RecipeCat;
1170 public virtual bool CanCook(
Card c)
1172 return c !=
null && this.ExistsOnMap && c.trait is
TraitFood;
1176 public void CookProgress()
1178 if (!this.ExistsOnMap)
1182 foreach (
Card card
in this.owner.pos.ListCards(
false))
1184 this.owner.PlaySound(
"cook", 1f,
true);
1185 card.renderer.PlayAnime(AnimeID.Jump,
default(Vector3),
false);
1190 public virtual bool CanOffer(
Card tg)
1192 return tg !=
null && !tg.isChara && !tg.trait.CanOnlyCarry && tg.rarity != Rarity.Artifact;
1196 public void OfferProcess(
Chara cc)
1198 if (!this.ExistsOnMap)
1203 string @ref = row.GetTextArray(
"name2")[1];
1204 string ref2 = row.GetTextArray(
"name2")[0];
1207 cc.Talk(
"offer", @ref, ref2,
false);
1209 foreach (
Card card
in this.owner.pos.ListCards(
false))
1211 if (this.CanOffer(card))
1213 card.renderer.PlayAnime(AnimeID.Shiver,
default(Vector3),
false);
1219 public void Offer(
Chara cc)
1221 if (!this.ExistsOnMap)
1225 foreach (
Card card
in this.owner.pos.ListCards(
false))
1227 if (this.CanOffer(card))
1230 cc.depression.Mod(100);
1231 this.owner.PlaySound(
"offering", 1f,
true);
1237 public virtual bool TryProgress(
AIProgress p)
1243 public virtual LockOpenState TryOpenLock(
Chara cc,
bool msgFail =
true)
1246 int num = (thing ==
null) ? (cc.Evalue(280) / 2 + 2) : (cc.Evalue(280) + 10);
1247 int num2 = this.owner.c_lockLv;
1251 num2 = num / 4 * 3 - 1;
1253 if (num <= num2 && cc.IsPC)
1255 cc.PlaySound(
"lock", 1f,
true);
1256 cc.Say(
"openLockFail2",
null,
null);
1257 this.owner.PlayAnime(AnimeID.Shiver,
false);
1258 return LockOpenState.NotEnoughSkill;
1260 if (thing !=
null && !flag)
1262 thing.ModCharge(-1,
true);
1264 if (
EClass.rnd(num + 6) > num2 + 5 || (!cc.IsPC &&
EClass.rnd(20) == 0) ||
EClass.rnd(200) == 0)
1266 cc.PlaySound(
"lock_open", 1f,
true);
1267 cc.Say(
"lockpick_success", cc, this.owner,
null,
null);
1268 int num3 = 100 + num2 * 10;
1269 if (this.owner.c_lockedHard)
1273 cc.ModExp(280, num3);
1274 this.owner.c_lockLv = 0;
1275 if (this.owner.c_lockedHard)
1277 this.owner.c_lockedHard =
false;
1278 this.owner.c_priceAdd = 0;
1280 if (cc.IsPC &&
this.owner.isLostProperty)
1282 EClass.player.ModKarma(-8);
1284 this.owner.isLostProperty =
false;
1285 return LockOpenState.Success;
1287 cc.PlaySound(
"lock", 1f,
true);
1290 cc.Say(
"openLockFail",
null,
null);
1292 cc.ModExp(280, (thing !=
null) ? 50 : 30);
1293 if (thing ==
null |
EClass.rnd(2) == 0)
1297 return LockOpenState.Fail;
1301 public virtual void WriteNote(UINote n,
bool identified)
1306 public int GetSortVal(UIList.SortMode m)
1308 return this.owner.sourceCard._index;
1312 public virtual HotItem GetHotItem()
1319 public virtual bool IsTool
1328 public virtual bool CanRead(
Chara c)
1334 public virtual void OnRead(
Chara c)
1339 public virtual bool CanEat(
Chara c)
1341 return this.owner.HasElement(10, 1);
1345 public virtual void OnEat(
Chara c)
1350 public virtual bool CanDrink(
Chara c)
1356 public virtual void OnDrink(
Chara c)
1361 public virtual void OnThrowGround(
Chara c,
Point p)
1367 public virtual string LangUse
1376 public virtual bool CanUse(
Chara c)
1382 public virtual bool CanUse(
Chara c,
Card tg)
1394 public virtual bool OnUse(
Chara c)
1396 if (c.held !=
this.owner)
1398 c.TryHoldCard(this.owner, -1,
false);
1404 public virtual bool OnUse(
Chara c,
Card tg)
1416 public virtual void TrySetAct(
ActPlan p)
1418 if (this.CanUse(this.owner.Chara))
1420 p.TrySetAct(this.LangUse, () => this.OnUse(p.cc),
this.owner,
null, 1,
false,
true,
false);
1425 public virtual void TrySetHeldAct(
ActPlan p)
1430 public virtual void OnHeld()
1435 public virtual void OnTickHeld()
1440 public virtual void OnSetCurrentItem()
1445 public virtual void OnUnsetCurrentItem()
1450 public virtual bool OnChildDecay(
Card c)
1456 public virtual bool CanChildDecay(
Card c)
1462 public virtual void OnSetCardGrid(
ButtonGrid b)
1467 public virtual void OnStepped(
Chara c)
1472 public virtual void OnSteppedOut(
Chara c)
1477 public virtual void OnOpenDoor(
Chara c)
1482 public void Install(
bool byPlayer)
1484 if (this.Electricity != 0)
1486 EClass._zone.dirtyElectricity =
true;
1487 if (this.Electricity > 0)
1489 EClass._zone.electricity += this.Electricity;
1490 EClass.pc.PlaySound(
"electricity_on", 1f,
true);
1494 this.owner.RecalculateFOV();
1495 if (
EClass._zone.isStarted &&
this.ToggleType == ToggleType.Fire &&
this.owner.isOn)
1497 this.owner.PlaySound(
"fire", 1f,
true);
1499 this.OnInstall(byPlayer);
1503 public void Uninstall()
1505 if (this.Electricity != 0)
1507 if (this.owner.isOn)
1509 this.Toggle(
false,
true);
1511 EClass._zone.dirtyElectricity =
true;
1512 if (this.Electricity > 0)
1514 EClass._zone.electricity -= this.Electricity;
1515 EClass.pc.PlaySound(
"electricity_off", 1f,
true);
1522 public virtual void OnInstall(
bool byPlayer)
1527 public virtual void OnUninstall()
1533 public virtual bool IsOn
1537 return this.owner.isOn;
1543 public virtual bool IsAnimeOn
1547 return this.IsOn || !this.IsToggle;
1553 public bool IsToggle
1557 return this.ToggleType > ToggleType.None;
1563 public virtual bool AutoToggle
1567 return (this.IsLighting || this.ToggleType == ToggleType.Curtain ||
this.ToggleType == ToggleType.Electronics) && !this.owner.disableAutoToggle;
1573 public bool IsLighting
1577 return this.ToggleType == ToggleType.Fire || this.ToggleType == ToggleType.Light;
1583 public virtual bool IsLightOn
1587 return this.owner.isChara || this.owner.isOn;
1593 public virtual bool IsNightOnlyLight
1597 return this.ToggleType != ToggleType.Electronics && this.IsToggle && !this.owner.isRoofItem;
1603 public virtual Trait.TileMode tileMode
1607 return Trait.TileMode.Default;
1613 public virtual bool UseAltTiles
1617 return this.owner.isOn;
1623 public virtual bool UseLowblock
1633 public virtual bool UseExtra
1643 public virtual bool UseLightColor
1653 public virtual Color? ColorExtra
1663 public virtual int MaxFuel
1667 if (this.ToggleType != ToggleType.Fire)
1677 public virtual int FuelCost
1687 public virtual bool ShowFuelWindow
1697 public bool IsRequireFuel
1701 return this.MaxFuel > 0;
1707 public string IdToggleExtra
1711 Thing thing = this.owner.Thing;
1716 return thing.source.idToggleExtra;
1722 public virtual ToggleType ToggleType
1726 if (this.Electricity >= 0)
1728 return ToggleType.None;
1730 return ToggleType.Electronics;
1735 public virtual void TryToggle()
1737 if (!this.owner.IsInstalled)
1741 if (this.Electricity < 0 && this.owner.isOn &&
EClass._zone.electricity < 0)
1743 this.Toggle(
false,
true);
1746 if (this.AutoToggle)
1748 int hour =
EClass.world.date.hour;
1749 bool on = !this.IsNightOnlyLight || hour >= 17 || hour <= 5 ||
EClass._map.IsIndoor;
1750 if (this.ToggleType == ToggleType.Fire &&
EClass.world.weather.IsRaining && !
EClass._map.IsIndoor && !
this.owner.Cell.HasRoof)
1754 this.Toggle(on,
true);
1759 public virtual void Toggle(
bool on,
bool silent =
false)
1761 if (this.owner.isOn == on)
1765 if (this.Electricity < 0)
1769 if (
EClass._zone.electricity +
this.Electricity < 0)
1771 if (
EClass._zone.isStarted)
1775 this.owner.Say(
"notEnoughElectricity", this.owner,
null,
null);
1777 this.owner.PlaySound(
"electricity_insufficient", 1f,
true);
1781 EClass._zone.electricity += this.Electricity;
1785 EClass._zone.electricity -= this.Electricity;
1788 this.owner.isOn = on;
1789 bool flag = this.ToggleType == ToggleType.Fire;
1790 ToggleType toggleType = this.ToggleType;
1791 if (toggleType != ToggleType.None)
1793 if (toggleType != ToggleType.Curtain)
1795 if (toggleType == ToggleType.Lever)
1799 this.owner.Say(
"lever",
EClass.pc,
this.owner,
null,
null);
1800 this.owner.PlaySound(
"switch_lever", 1f,
true);
1807 this.owner.Say(flag ?
"toggle_fire" :
"toggle_ele",
EClass.pc,
this.owner,
null,
null);
1808 this.owner.PlaySound((this.Electricity < 0) ?
"switch_on_electricity" : (flag ?
"torch_lit" :
"switch_on"), 1f,
true);
1810 this.RefreshRenderer();
1811 this.owner.RecalculateFOV();
1817 this.owner.PlaySound((this.Electricity < 0) ?
"switch_off_electricity" : (flag ?
"torch_unlit" :
"switch_off"), 1f,
true);
1819 this.RefreshRenderer();
1820 this.owner.RecalculateFOV();
1827 this.owner.Say(on ?
"close" :
"open",
EClass.pc,
this.owner,
null,
null);
1828 this.owner.PlaySound(
"Material/leather_drop", 1f,
true);
1830 this.owner.pos.RefreshNeighborTiles();
1831 EClass.pc.RecalculateFOV();
1838 public virtual void OnToggle()
1843 public virtual void TrySetToggleAct(
ActPlan p)
1845 if (!p.IsSelfOrNeighbor)
1849 switch (this.ToggleType)
1851 case ToggleType.Fire:
1852 case ToggleType.Light:
1853 case ToggleType.Electronics:
1855 bool flag = this.ToggleType == ToggleType.Fire;
1856 if (
EClass._zone.IsPCFaction || p.altAction ||
this is
TraitCrafter ||
this.Electricity < 0)
1858 if (this.owner.isOn)
1862 p.TrySetAct(flag ?
"ActExtinguishTorch" :
"ActToggleOff", delegate()
1864 this.Toggle(
false,
false);
1866 }, this.owner,
null, 1,
false,
true,
false);
1871 p.TrySetAct(flag ?
"ActTorch" :
"ActToggleOn", delegate()
1873 this.Toggle(
true,
false);
1875 }, this.owner,
null, 1,
false,
true,
false);
1877 if (this.IsRequireFuel && ((p.altAction &&
this.owner.c_charges <
this.MaxFuel) || (!
this.owner.isOn &&
this.owner.c_charges == 0)) &&
this.ShowFuelWindow)
1879 p.TrySetAct(
"ActFuel", delegate()
1883 }, this.owner,
null, 1,
false,
true,
false);
1888 p.TrySetAct(
"disableAutoToggle".lang((this.owner.disableAutoToggle ?
"off" :
"on").lang(),
null,
null,
null,
null), delegate()
1890 this.owner.disableAutoToggle = !this.owner.disableAutoToggle;
1893 }, this.owner,
null, 1,
false,
true,
false);
1897 case ToggleType.Curtain:
1898 p.TrySetAct(this.owner.isOn ?
"actOpen" :
"actClose", delegate()
1900 this.Toggle(!this.owner.isOn,
false);
1902 }, this.owner,
null, 1,
false,
true,
false);
1904 case ToggleType.Lever:
1905 p.TrySetAct(
"ActToggleLever", delegate()
1907 this.Toggle(!this.owner.isOn,
false);
1909 }, this.owner,
null, 1,
false,
true,
false);
1917 public bool IsFuelEnough(
int num = 1, List<Thing> excludes =
null,
bool tryRefuel =
true)
1919 if (!this.IsRequireFuel)
1923 if (this.owner.c_charges >=
this.FuelCost * num)
1927 if (this.owner.autoRefuel)
1929 this.TryRefuel(this.FuelCost * num - this.owner.c_charges, excludes);
1931 return this.owner.c_charges >= this.FuelCost * num;
1935 public bool IsFuel(
string s)
1937 return this.GetFuelValue(s) > 0;
1941 public bool IsFuel(
Thing t)
1943 return this.GetFuelValue(t) > 0;
1947 public int GetFuelValue(
Thing t)
1949 return this.GetFuelValue(t.id);
1953 public int GetFuelValue(
string id)
1955 if (this.ToggleType == ToggleType.Electronics)
1957 if (
id ==
"battery")
1977 public void Refuel(
Thing t)
1979 t.PlaySoundDrop(
false);
1980 this.owner.ModCharge(t.Num *
this.GetFuelValue(t),
false);
1981 Msg.Say(
"fueled", t,
null,
null,
null);
1982 if (!this.owner.isOn)
1984 this.owner.trait.Toggle(
true,
false);
1987 this.owner.renderer.PlayAnime(AnimeID.Shiver,
default(Vector3),
false);
1991 public void TryRefuel(
int dest, List<Thing> excludes)
1993 Trait.<>c__DisplayClass305_0 CS$<>8__locals1 =
new Trait.<>c__DisplayClass305_0();
1994 CS$<>8__locals1.dest = dest;
1995 CS$<>8__locals1.<>4__this =
this;
1996 CS$<>8__locals1.excludes = excludes;
1997 if (CS$<>8__locals1.<TryRefuel>g__FindFuel|0(
false))
1999 CS$<>8__locals1.<TryRefuel>g__FindFuel|0(
true);
2004 public virtual void OnEnterScreen()
2006 this.RefreshRenderer();
2010 public virtual void RefreshRenderer()
2012 if (!this.owner.renderer.isSynced ||
this.IdToggleExtra.IsEmpty())
2016 if (this.owner.isOn)
2018 this.owner.renderer.AddExtra(this.IdToggleExtra);
2021 this.owner.renderer.RemoveExtra(this.IdToggleExtra);
2025 public virtual void SetMainText(UIText t,
bool hotitem)
2027 if (this.owner.isThing && !
this.owner.Thing.source.attackType.IsEmpty() &&
this.owner.ammoData !=
null)
2029 string text = this.owner.c_ammo.ToString() ??
"";
2030 t.SetText(text ??
"", FontColor.Charge);
2034 if (this.owner.Num == 1 &&
this.ShowCharges &&
this.owner.IsIdentified)
2036 t.SetText(this.owner.c_charges.ToString() ??
"", FontColor.Charge);
2040 string text2 = (this.owner.Num >= 1000000) ? ((this.owner.Num / 1000000).ToString() +
"M") : ((this.owner.Num >= 1000) ? ((this.owner.Num / 1000).ToString() +
"K") : (this.owner.Num.ToString() ??
""));
2041 t.SetText(text2 ??
"", FontColor.ButtonGrid);
2042 t.SetActive(this.owner.Num > 1);
2047 public virtual int ShopLv
2051 return EClass._zone.development / 10 + this.owner.c_invest + 1;
2056 public virtual bool CanCopy(
Thing t)
2063 public virtual Trait.CopyShopType CopyShop
2067 return Trait.CopyShopType.None;
2073 public virtual int NumCopyItem
2077 return 2 + Mathf.Min(this.owner.c_invest / 10, 3);
2083 public virtual ShopType ShopType
2087 return ShopType.None;
2093 public virtual CurrencyType CurrencyType
2097 return CurrencyType.Money;
2103 public virtual PriceType PriceType
2107 return PriceType.Default;
2113 public virtual bool AllowSell
2117 return this.CurrencyType == CurrencyType.Money || this.CurrencyType == CurrencyType.None;
2123 public virtual int CostRerollShop
2127 if (this.CurrencyType == CurrencyType.Money ||
this.CurrencyType == CurrencyType.Influence)
2137 public virtual bool AllowCriminal
2141 return this.owner.isThing;
2147 public virtual int RestockDay
2157 public virtual SlaverType SlaverType
2161 return SlaverType.None;
2167 public virtual string LangBarter
2177 public string TextNextRestock
2181 return this.GetTextRestock(this.LangBarter,
false);
2187 public string TextNextRestockPet
2191 return this.GetTextRestock((this.SlaverType == SlaverType.Slave) ?
"daBuySlave" :
"daBuyPet",
true);
2196 public string GetTextRestock(
string lang,
bool pet)
2198 int rawDeadLine = 0;
2204 rawDeadLine = obj.dateRefresh;
2209 rawDeadLine = this.owner.c_dateStockExpire;
2211 int remainingHours =
EClass.world.date.GetRemainingHours(rawDeadLine);
2212 if (remainingHours > 0)
2214 return "nextRestock".lang(lang.lang(),
Date.GetText(remainingHours) ??
"",
null,
null,
null);
2220 public Emo2 GetRestockedIcon()
2222 if (this.SlaverType != SlaverType.None)
2225 if (obj !=
null &&
EClass.world.date.IsExpired(obj.dateRefresh))
2227 return Emo2.restock;
2230 int c_dateStockExpire = this.owner.c_dateStockExpire;
2231 if (c_dateStockExpire == 0 || !
EClass.world.date.IsExpired(c_dateStockExpire))
2235 if (this.ShopType == ShopType.None)
2237 return Emo2.blessing;
2239 return Emo2.restock;
2243 public Thing FindShopChest()
2245 return this.owner.things.Find(
"chest_merchant", -1, -1);
2249 public void OnBarter()
2251 Trait.<>c__DisplayClass342_0 CS$<>8__locals1;
2252 CS$<>8__locals1.<>4__this =
this;
2253 CS$<>8__locals1.t = this.owner.things.Find(
"chest_merchant", -1, -1);
2254 if (CS$<>8__locals1.t ==
null)
2256 CS$<>8__locals1.t =
ThingGen.Create(
"chest_merchant", -1, -1);
2257 this.owner.AddThing(CS$<>8__locals1.t,
true, -1, -1);
2259 if (!
EClass.world.date.IsExpired(
this.owner.c_dateStockExpire))
2263 this.owner.c_dateStockExpire =
EClass.world.date.GetRaw(24 * this.RestockDay);
2264 this.owner.isRestocking =
true;
2265 CS$<>8__locals1.t.things.DestroyAll((
Thing _t) => _t.GetInt(101,
null) != 0);
2266 foreach (
Thing thing
in CS$<>8__locals1.t.things)
2270 ShopType shopType = this.ShopType;
2274 case ShopType.Medal:
2275 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"sword_dragon", -1, -1), ref CS$<>8__locals1);
2276 this.<OnBarter>g__Add|342_0(
"sword_dragon", 1, 0, ref CS$<>8__locals1).SetReplica(
true);
2277 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"axe_destruction", -1, -1), ref CS$<>8__locals1);
2278 this.<OnBarter>g__Add|342_0(
"axe_destruction", 1, 0, ref CS$<>8__locals1).SetReplica(
true);
2279 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"blunt_bonehammer", -1, -1), ref CS$<>8__locals1);
2280 this.<OnBarter>g__Add|342_0(
"blunt_bonehammer", 1, 0, ref CS$<>8__locals1).SetReplica(
true);
2281 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"pole_gunlance", -1, -1), ref CS$<>8__locals1);
2282 this.<OnBarter>g__Add|342_0(
"pole_gunlance", 1, 0, ref CS$<>8__locals1).SetReplica(
true);
2283 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"sword_muramasa", -1, -1), ref CS$<>8__locals1);
2284 this.<OnBarter>g__Add|342_0(
"sword_muramasa", 1, 0, ref CS$<>8__locals1).SetReplica(
true);
2285 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"sword_forgetmenot", -1, -1), ref CS$<>8__locals1);
2286 this.<OnBarter>g__Add|342_0(
"sword_forgetmenot", 1, 0, ref CS$<>8__locals1).SetReplica(
true);
2287 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"dagger_fish", -1, -1), ref CS$<>8__locals1);
2288 this.<OnBarter>g__Add|342_0(
"dagger_fish", 1, 0, ref CS$<>8__locals1).SetReplica(
true);
2289 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"sword_zephir", -1, -1), ref CS$<>8__locals1);
2290 this.<OnBarter>g__Add|342_0(
"sword_zephir", 1, 0, ref CS$<>8__locals1).SetReplica(
true);
2291 this.<OnBarter>g__Add|342_0(
"helm_sage", 1, 0, ref CS$<>8__locals1);
2292 this.<OnBarter>g__Add|342_0(
"diary_sister", 1, 0, ref CS$<>8__locals1);
2293 this.<OnBarter>g__Add|342_0(
"diary_catsister", 1, 0, ref CS$<>8__locals1);
2294 this.<OnBarter>g__Add|342_0(
"diary_lady", 1, 0, ref CS$<>8__locals1);
2295 this.<OnBarter>g__Add|342_0(
"1165", 1, 0, ref CS$<>8__locals1).SetNum(5);
2296 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateScroll(9160, 1).SetNum(5), ref CS$<>8__locals1);
2297 this.<OnBarter>g__Add|342_0(
"monsterball", 1, 0, ref CS$<>8__locals1).SetNum(3).SetLv(20);
2298 this.<OnBarter>g__Add|342_0(
"monsterball", 1, 0, ref CS$<>8__locals1).SetNum(3).SetLv(40);
2299 this.<OnBarter>g__Add|342_0(
"bill_tax", 1, 0, ref CS$<>8__locals1).c_bill = 1;
2300 this.<OnBarter>g__Add|342_0(
"bill_tax", 1, 0, ref CS$<>8__locals1).c_bill = 1;
2301 this.<OnBarter>g__Add|342_0(
"bill_tax", 1, 0, ref CS$<>8__locals1).c_bill = 1;
2302 this.<OnBarter>g__Add|342_0(
"container_magic", 1, 0, ref CS$<>8__locals1);
2303 this.<OnBarter>g__Add|342_0(
"container_magic", 1, 0, ref CS$<>8__locals1).ChangeMaterial(
"iron").idSkin = 1;
2304 this.<OnBarter>g__Add|342_0(
"container_magic", 1, 0, ref CS$<>8__locals1).ChangeMaterial(
"bamboo").idSkin = 2;
2305 this.<OnBarter>g__Add|342_0(
"wrench_bed", 1, 0, ref CS$<>8__locals1).SetNum(20);
2306 this.<OnBarter>g__Add|342_0(
"wrench_storage", 1, 0, ref CS$<>8__locals1).SetNum(10);
2307 this.<OnBarter>g__Add|342_0(
"wrench_fridge", 1, 0, ref CS$<>8__locals1).SetNum(1);
2308 this.<OnBarter>g__Add|342_0(
"wrench_extend_v", 1, 0, ref CS$<>8__locals1).SetNum(2);
2309 this.<OnBarter>g__Add|342_0(
"wrench_extend_h", 1, 0, ref CS$<>8__locals1).SetNum(2);
2311 case ShopType.CaravanMaster:
2313 case ShopType.Starter:
2314 case ShopType.StarterEx:
2315 this.<OnBarter>g__Add|342_0(
"board_home", 1, 0, ref CS$<>8__locals1);
2316 this.<OnBarter>g__Add|342_0(
"board_resident", 1, 0, ref CS$<>8__locals1);
2317 this.<OnBarter>g__Add|342_0(
"1", 1, 0, ref CS$<>8__locals1);
2318 this.<OnBarter>g__Add|342_0(
"2", 1, 0, ref CS$<>8__locals1);
2319 if (this.ShopType == ShopType.StarterEx)
2321 this.<OnBarter>g__Add|342_0(
"board_expedition", 1, 0, ref CS$<>8__locals1);
2322 this.<OnBarter>g__Add|342_0(
"mailpost", 1, 0, ref CS$<>8__locals1);
2323 this.<OnBarter>g__Add|342_0(
"record", 1, 0, ref CS$<>8__locals1);
2324 this.<OnBarter>g__Add|342_0(
"tent2", 1, 0, ref CS$<>8__locals1);
2325 this.<OnBarter>g__Add|342_0(
"tent1", 1, 0, ref CS$<>8__locals1);
2326 this.<OnBarter>g__Add|342_0(
"wagon1", 1, 0, ref CS$<>8__locals1);
2327 this.<OnBarter>g__Add|342_0(
"wagon_big", 1, 0, ref CS$<>8__locals1);
2328 this.<OnBarter>g__Add|342_0(
"wagon_big2", 1, 0, ref CS$<>8__locals1);
2329 this.<OnBarter>g__Add|342_0(
"wagon_big3", 1, 0, ref CS$<>8__locals1);
2330 this.<OnBarter>g__Add|342_0(
"wagon_big4", 1, 0, ref CS$<>8__locals1);
2331 this.<OnBarter>g__Add|342_0(
"wagon_big5", 1, 0, ref CS$<>8__locals1);
2332 this.<OnBarter>g__Add|342_0(
"teleporter", 1, 0, ref CS$<>8__locals1);
2333 this.<OnBarter>g__Add|342_0(
"teleporter2", 1, 0, ref CS$<>8__locals1);
2334 this.<OnBarter>g__Add|342_0(
"recharger", 1, 0, ref CS$<>8__locals1);
2335 this.<OnBarter>g__Add|342_0(
"machine_gene2", 1, 0, ref CS$<>8__locals1);
2336 this.<OnBarter>g__NoRestock|342_2(
ThingGen.CreateRecipe(
"torch_wall"), ref CS$<>8__locals1);
2337 this.<OnBarter>g__NoRestock|342_2(
ThingGen.CreateRecipe(
"factory_sign"), ref CS$<>8__locals1);
2338 this.<OnBarter>g__NoRestock|342_2(
ThingGen.CreateRecipe(
"beehive"), ref CS$<>8__locals1);
2339 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"rp_food", -1, -1).SetNum(5).SetLv(10).Thing, ref CS$<>8__locals1);
2342 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePlan(2119), ref CS$<>8__locals1);
2343 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"rp_food", -1, -1).SetNum(5).SetLv(5).Thing, ref CS$<>8__locals1);
2345 case ShopType.Farris:
2346 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateScroll(8220, 4 +
EClass.rnd(6)), ref CS$<>8__locals1);
2347 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateScroll(8221, 4 +
EClass.rnd(6)), ref CS$<>8__locals1);
2348 this.<OnBarter>g__Add|342_0(
"drawing_paper", 10, 0, ref CS$<>8__locals1);
2349 this.<OnBarter>g__Add|342_0(
"drawing_paper2", 10, 0, ref CS$<>8__locals1);
2350 this.<OnBarter>g__Add|342_0(
"stethoscope", 1, 0, ref CS$<>8__locals1);
2351 this.<OnBarter>g__Add|342_0(
"whip_love", 1, 0, ref CS$<>8__locals1);
2352 this.<OnBarter>g__Add|342_0(
"whip_interest", 1, 0, ref CS$<>8__locals1);
2357 case ShopType.Guild:
2360 this.<OnBarter>g__Add|342_0(
"flyer", 1, 0, ref CS$<>8__locals1).SetNum(99);
2364 case ShopType.Exotic:
2367 case ShopType.Healer:
2369 case ShopType.Ecopo:
2371 case ShopType.Influence:
2373 bool flag = this.owner.id ==
"big_sister";
2374 TraitTicketFurniture.SetZone(flag ?
EClass.game.spatials.Find(
"little_garden") :
EClass._zone,
this.<OnBarter>g__Add|342_0(
"ticket_furniture", 1, 0, ref CS$<>8__locals1).SetNum(99));
2377 this.<OnBarter>g__Add|342_0(
"littleball", 10, 0, ref CS$<>8__locals1);
2380 for (
int i = 0; i < 10; i++)
2384 this.<OnBarter>g__AddThing|342_1(thing2, ref CS$<>8__locals1);
2391 this.<OnBarter>g__AddThing|342_1(
TraitSeed.MakeSeed(
"rice"), ref CS$<>8__locals1).SetNum(4 +
EClass.rnd(4));
2392 this.<OnBarter>g__AddThing|342_1(
TraitSeed.MakeSeed(
"cabbage"), ref CS$<>8__locals1).SetNum(4 +
EClass.rnd(4));
2393 this.<OnBarter>g__AddThing|342_1(
TraitSeed.MakeSeed(
"carrot"), ref CS$<>8__locals1).SetNum(4 +
EClass.rnd(4));
2394 this.<OnBarter>g__AddThing|342_1(
TraitSeed.MakeSeed(
"potato"), ref CS$<>8__locals1).SetNum(4 +
EClass.rnd(4));
2395 this.<OnBarter>g__AddThing|342_1(
TraitSeed.MakeSeed(
"corn"), ref CS$<>8__locals1).SetNum(4 +
EClass.rnd(4));
2396 for (
int j = 0; j <
EClass.rnd(3) + 1; j++)
2398 this.<OnBarter>g__Add|342_0(
"462", 1, 0, ref CS$<>8__locals1);
2400 for (
int k = 0; k <
EClass.rnd(3) + 1; k++)
2402 this.<OnBarter>g__Add|342_0(
"1167", 1, 0, ref CS$<>8__locals1);
2405 case ShopType.RedBook:
2406 for (
int l = 0; l < 30; l++)
2408 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateFromCategory(
"book", -1), ref CS$<>8__locals1);
2411 case ShopType.Casino:
2412 this.<OnBarter>g__Add|342_0(
"chest_tax", 1, 0, ref CS$<>8__locals1);
2413 this.<OnBarter>g__Add|342_0(
"1165", 1, 0, ref CS$<>8__locals1);
2414 this.<OnBarter>g__Add|342_0(
"monsterball", 1, 0, ref CS$<>8__locals1).SetNum(3).SetLv(10);
2415 this.<OnBarter>g__Add|342_0(
"1175", 1, 0, ref CS$<>8__locals1);
2416 this.<OnBarter>g__Add|342_0(
"1176", 1, 0, ref CS$<>8__locals1);
2417 this.<OnBarter>g__Add|342_0(
"pillow_ehekatl", 1, 0, ref CS$<>8__locals1);
2418 this.<OnBarter>g__Add|342_0(
"grave_dagger1", 1, 0, ref CS$<>8__locals1);
2419 this.<OnBarter>g__Add|342_0(
"grave_dagger2", 1, 0, ref CS$<>8__locals1);
2420 this.<OnBarter>g__Add|342_0(
"434", 1, 0, ref CS$<>8__locals1);
2421 this.<OnBarter>g__Add|342_0(
"433", 1, 0, ref CS$<>8__locals1);
2422 this.<OnBarter>g__Add|342_0(
"714", 1, 0, ref CS$<>8__locals1);
2423 this.<OnBarter>g__Add|342_0(
"1017", 1, 0, ref CS$<>8__locals1);
2424 this.<OnBarter>g__Add|342_0(
"1155", 1, 0, ref CS$<>8__locals1);
2425 this.<OnBarter>g__Add|342_0(
"1011", 1, 0, ref CS$<>8__locals1);
2426 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePerfume(9500, 5), ref CS$<>8__locals1);
2427 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePerfume(9501, 5), ref CS$<>8__locals1);
2428 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePerfume(9502, 5), ref CS$<>8__locals1);
2429 for (
int m = 0; m < 5; m++)
2431 Thing thing3 =
ThingGen.CreateFromCategory(
"seasoning", -1).SetNum(10);
2432 thing3.elements.SetBase(2, 40, 0);
2433 thing3.c_priceFix = 1000;
2434 this.<OnBarter>g__AddThing|342_1(thing3, ref CS$<>8__locals1);
2437 case ShopType.Loytel:
2438 this.<OnBarter>g__Add|342_0(
"board_map", 1, 0, ref CS$<>8__locals1);
2439 this.<OnBarter>g__Add|342_0(
"board_build", 1, 0, ref CS$<>8__locals1);
2440 this.<OnBarter>g__Add|342_0(
"book_resident", 1, 0, ref CS$<>8__locals1);
2441 this.<OnBarter>g__Add|342_0(
"3", 1, 0, ref CS$<>8__locals1);
2442 this.<OnBarter>g__Add|342_0(
"4", 1, 0, ref CS$<>8__locals1);
2443 this.<OnBarter>g__Add|342_0(
"5", 1, 0, ref CS$<>8__locals1);
2444 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePlan(2512), ref CS$<>8__locals1);
2445 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePlan(2810), ref CS$<>8__locals1);
2446 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"rp_block", -1, -1).SetLv(1).SetNum(10), ref CS$<>8__locals1);
2449 this.<OnBarter>g__NoRestock|342_2(
ThingGen.CreateRecipe(
"explosive"), ref CS$<>8__locals1);
2453 case ShopType.Specific:
2457 Thing c_copyContainer = this.owner.c_copyContainer;
2458 if (c_copyContainer ==
null)
2463 using (List<Thing>.Enumerator enumerator = c_copyContainer.things.GetEnumerator())
2465 while (enumerator.MoveNext())
2467 Thing thing4 = enumerator.Current;
2468 if (this.owner.trait.CanCopy(thing4))
2470 Thing thing5 = thing4.Duplicate(1);
2471 thing5.isStolen =
false;
2472 thing5.isCopy =
true;
2474 Trait.CopyShopType copyShop = this.owner.trait.CopyShop;
2475 if (copyShop !=
Trait.CopyShopType.Item)
2477 if (copyShop ==
Trait.CopyShopType.Spellbook)
2479 thing5.c_charges = thing4.c_charges;
2484 num2 = (1000 + this.owner.c_invest * 100) / (thing5.GetPrice(CurrencyType.Money,
false, PriceType.Default,
null) + 50);
2485 foreach (
int ele
in new int[]
2493 if (thing5.HasElement(ele, 1))
2499 if (num2 > 1 && thing5.trait.CanStack)
2501 thing5.SetNum(num2);
2503 this.<OnBarter>g__AddThing|342_1(thing5, ref CS$<>8__locals1);
2505 if (num > this.owner.trait.NumCopyItem)
2516 this.<OnBarter>g__NoRestock|342_2(
ThingGen.Create(
"lucky_coin", -1, -1).SetNum(10), ref CS$<>8__locals1);
2524 this.<OnBarter>g__AddThing|342_1(
ThingGen.Create(
"casino_coin", -1, -1).SetNum(5000), ref CS$<>8__locals1);
2527 if (!(
id ==
"felmera"))
2531 using (List<Thing>.Enumerator enumerator =
new DramaOutcome().ListFelmeraBarter().GetEnumerator())
2533 while (enumerator.MoveNext())
2535 Thing t = enumerator.Current;
2536 this.<OnBarter>g__AddThing|342_1(t, ref CS$<>8__locals1);
2541 this.<OnBarter>g__Add|342_0(
"deed", 1, 0, ref CS$<>8__locals1);
2542 this.<OnBarter>g__Add|342_0(
"deed_move", 2 +
EClass.rnd(5), 0, ref CS$<>8__locals1);
2543 this.<OnBarter>g__Add|342_0(
"license_void", 1, 0, ref CS$<>8__locals1);
2544 this.<OnBarter>g__Add|342_0(
"license_adv", 1, 0, ref CS$<>8__locals1);
2548 float num3 = (float)(3 + Mathf.Min(
this.ShopLv / 5, 10)) + Mathf.Sqrt((
float)this.ShopLv);
2549 num3 = num3 * (float)(100 +
EClass.pc.Evalue(1406) * 5) / 100f;
2551 while ((
float)num4 < num3)
2553 Thing thing6 = this.CreateStock();
2554 if ((!(thing6.trait is
TraitRod) || thing6.c_charges != 0) && thing6.GetPrice(CurrencyType.Money,
false, PriceType.Default,
null) > 0)
2556 CS$<>8__locals1.t.AddThing(thing6,
true, -1, -1);
2563 if (!recipeSource.row.recipeKey.IsEmpty())
2565 string[] recipeKey = recipeSource.row.recipeKey;
2566 for (
int n = 0; n < recipeKey.Length; n++)
2568 if (recipeKey[n] == this.ShopType.ToString())
2570 this.<OnBarter>g__NoRestock|342_2(
ThingGen.CreateRecipe(recipeSource.id), ref CS$<>8__locals1);
2576 shopType = this.ShopType;
2577 if (shopType <= ShopType.Festival)
2579 if (shopType <= ShopType.Junk)
2581 if (shopType != ShopType.Magic)
2583 if (shopType != ShopType.Junk)
2590 if ((
EClass._zone.id ==
"lumiest" &&
EClass._zone.lv == 0) || (
EClass._zone.id !=
"lumiest" &&
EClass.rnd(4) == 0))
2592 CS$<>8__locals1.t.AddThing(
ThingGen.Create(
"letter_trial", -1, -1),
true, -1, -1);
2600 if (shopType == ShopType.Food)
2602 this.<OnBarter>g__Add|342_0(
"ration", 15 +
EClass.rnd(15), 0, ref CS$<>8__locals1);
2605 if (shopType != ShopType.Festival)
2609 if (!
EClass._zone.IsFestival)
2613 this.<OnBarter>g__Add|342_0(
"1085", 1, 0, ref CS$<>8__locals1);
2614 if (
EClass._zone.id ==
"noyel")
2616 this.<OnBarter>g__Add|342_0(
"holyFeather", 1, 0, ref CS$<>8__locals1);
2622 else if (shopType <= ShopType.Healer)
2624 if (shopType == ShopType.Gun)
2626 this.<OnBarter>g__Add|342_0(
"bullet", 1, 0, ref CS$<>8__locals1).SetNum(300 +
EClass.rnd(100)).ChangeMaterial(
"iron");
2627 this.<OnBarter>g__Add|342_0(
"bullet_energy", 1, 0, ref CS$<>8__locals1).SetNum(100 +
EClass.rnd(100)).ChangeMaterial(
"iron");
2630 if (shopType != ShopType.Healer)
2634 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePotion(8400, 1).SetNum(4 +
EClass.rnd(6)), ref CS$<>8__locals1);
2635 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePotion(8401, 1).SetNum(2 +
EClass.rnd(4)), ref CS$<>8__locals1);
2636 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePotion(8402, 1).SetNum(1 +
EClass.rnd(3)), ref CS$<>8__locals1);
2641 if (shopType == ShopType.Ecopo)
2643 this.<OnBarter>g__Add|342_0(
"ecomark", 5, 0, ref CS$<>8__locals1);
2644 this.<OnBarter>g__Add|342_0(
"1165", 1, 0, ref CS$<>8__locals1);
2645 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateScroll(9160, 1).SetNum(5), ref CS$<>8__locals1);
2648 if (shopType != ShopType.LoytelMart)
2653 if (this.ShopType == ShopType.LoytelMart)
2655 this.<OnBarter>g__Add|342_0(
"ticket_massage", 1, 0, ref CS$<>8__locals1);
2656 this.<OnBarter>g__Add|342_0(
"ticket_armpillow", 1, 0, ref CS$<>8__locals1);
2657 this.<OnBarter>g__Add|342_0(
"ticket_champagne", 1, 0, ref CS$<>8__locals1);
2659 for (
int num5 = 0; num5 < (EClass.debug.enable ? 30 : 3); num5++)
2663 TreasureType treasureType = (
EClass.rnd(10) == 0) ? TreasureType.BossNefia : ((
EClass.rnd(10) == 0) ? TreasureType.Map : TreasureType.RandomChest);
2664 int num6 =
EClass.rnd(
EClass.rnd(
this.ShopLv + (
EClass.debug.enable ? 200 : 50)) + 1) + 1;
2665 Thing thing7 =
ThingGen.Create((treasureType == TreasureType.BossNefia) ?
"chest_boss" : ((treasureType == TreasureType.Map) ?
"chest_treasure" :
"chest3"), -1, -1);
2666 thing7.c_lockedHard =
true;
2667 thing7.c_lockLv = num6;
2668 thing7.c_priceAdd = 2000 + num6 * 250 * ((treasureType != TreasureType.RandomChest) ? 5 : 1);
2669 thing7.c_revealLock =
true;
2670 ThingGen.CreateTreasureContent(thing7, num6, treasureType,
true);
2671 this.<OnBarter>g__AddThing|342_1(thing7, ref CS$<>8__locals1);
2675 shopType = this.ShopType;
2676 if (shopType == ShopType.General || shopType == ShopType.Food || shopType == ShopType.Festival)
2678 for (
int num7 = 0; num7 < (EClass.debug.enable ? 30 : 3); num7++)
2682 int lv =
EClass.rnd(
EClass.rnd(
this.ShopLv + (
EClass.debug.enable ? 200 : 50)) + 1) + 1;
2684 this.<OnBarter>g__AddThing|342_1(t2, ref CS$<>8__locals1);
2689 if (!(
id ==
"rodwyn"))
2691 if (!(
id ==
"girl_blue"))
2695 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateRecipe(
"ic").SetPriceFix(400), ref CS$<>8__locals1);
2696 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateRecipe(
"bullet").SetPriceFix(300), ref CS$<>8__locals1);
2697 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateRecipe(
"break_powder").SetPriceFix(1000), ref CS$<>8__locals1);
2698 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateRecipe(
"quarrel").SetPriceFix(100), ref CS$<>8__locals1);
2699 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateRecipe(
"1099").SetPriceFix(400), ref CS$<>8__locals1);
2700 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateRecipe(
"detector").SetPriceFix(700), ref CS$<>8__locals1);
2701 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePlan(2710), ref CS$<>8__locals1).SetPriceFix(-100);
2706 this.<OnBarter>g__Add|342_0(
"779", 1 +
EClass.rnd(3), 0, ref CS$<>8__locals1);
2711 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateSpellbook(8790, 1), ref CS$<>8__locals1);
2712 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreatePotion(8791, 1).SetNum(3 +
EClass.rnd(3)), ref CS$<>8__locals1);
2714 if (
Guild.Thief.IsCurrentZone)
2716 this.<OnBarter>g__Add|342_0(
"lockpick", 1, 0, ref CS$<>8__locals1);
2719 this.<OnBarter>g__Add|342_0(
"lockpick", 1, 0, ref CS$<>8__locals1);
2721 this.<OnBarter>g__AddThing|342_1(
ThingGen.CreateScroll(8780,
EClass.rndHalf(5)), ref CS$<>8__locals1);
2723 foreach (
Thing thing8
in CS$<>8__locals1.t.things)
2725 thing8.c_idBacker = 0;
2726 if (this.ShopType != ShopType.Copy)
2728 thing8.TryMakeRandomItem(this.ShopLv);
2729 if (thing8.Num == 1)
2731 thing8.SetNum(thing8.trait.DefaultStock);
2735 CraftUtil.MakeDish(thing8, this.ShopLv);
2737 if (thing8.IsFood &&
this.owner.id ==
"rodwyn")
2740 where !e.foodEffect.IsEmpty() && e.category !=
"feat"
2742 thing8.elements.SetBase(row.id, 10 +
EClass.rnd(10), 0);
2745 if (this.CurrencyType == CurrencyType.Casino_coin)
2747 thing8.noSell =
true;
2749 if (
Guild.Thief.IsCurrentZone)
2751 thing8.isStolen =
true;
2753 if (this.CurrencyType == CurrencyType.Money || !thing8.IsUnique)
2755 thing8.c_IDTState = 0;
2757 if (this.CurrencyType == CurrencyType.Money && (thing8.category.IsChildOf(
"meal") || thing8.category.IsChildOf(
"preserved")))
2759 thing8.c_priceFix = -70;
2763 thing8.c_IDTState = 5;
2765 if (thing8.IsContainer && !thing8.c_revealLock)
2767 thing8.RemoveThings();
2768 CS$<>8__locals1.t.c_lockLv = 0;
2771 if (CS$<>8__locals1.t.things.Count > CS$<>8__locals1.t.things.GridSize)
2773 int num8 = CS$<>8__locals1.t.things.width * 10;
2774 if (CS$<>8__locals1.t.things.Count > num8)
2776 int num9 = CS$<>8__locals1.t.things.Count - num8;
2777 for (
int num10 = 0; num10 < num9; num10++)
2779 CS$<>8__locals1.t.things.LastItem<
Thing>().Destroy();
2782 CS$<>8__locals1.t.things.ChangeSize(CS$<>8__locals1.t.things.width, Mathf.Min(CS$<>8__locals1.t.things.Count / CS$<>8__locals1.t.things.width + 1, 10));
2787 public Thing CreateStock()
2789 switch (this.ShopType)
2791 case ShopType.GeneralExotic:
2792 return this.<CreateStock>g__FromFilter|343_1(
"shop_generalExotic");
2794 return ThingGen.CreateMap(
null, -1);
2796 return this.<CreateStock>g__Create|343_3(
"book_plan");
2797 case ShopType.Weapon:
2798 return this.<CreateStock>g__FromFilter|343_1(
"shop_weapon");
2799 case ShopType.Bread:
2802 return this.<CreateStock>g__Create|343_3(
"dough");
2804 return this.<CreateStock>g__FromFilter|343_1(
"shop_bread");
2805 case ShopType.Furniture:
2806 return this.<CreateStock>g__FromFilter|343_1(
"shop_furniture");
2807 case ShopType.Magic:
2808 return this.<CreateStock>g__FromFilter|343_1(
"shop_magic");
2809 case ShopType.Blackmarket:
2810 case ShopType.Exotic:
2813 if (
Guild.Thief.IsCurrentZone)
2817 if (
Guild.Merchant.IsCurrentZone)
2821 CardBlueprint.SetRarity((
EClass.rnd(a) == 0) ? Rarity.Legendary : ((
EClass.rnd(5) == 0) ? Rarity.Superior : Rarity.Normal));
2822 return this.<CreateStock>g__FromFilter|343_1(
"shop_blackmarket");
2827 return this.<CreateStock>g__Create|343_3(
"seasoning");
2829 return this.<CreateStock>g__FromFilter|343_1(
"shop_meat");
2833 return this.<CreateStock>g__Create|343_3(
"bait");
2837 return this.<CreateStock>g__Create|343_3(
"fishingRod");
2839 return this.<CreateStock>g__FromFilter|343_1(
"shop_fish");
2841 return this.<CreateStock>g__FromFilter|343_1(
"shop_book");
2842 case ShopType.Souvenir:
2843 return this.<CreateStock>g__FromFilter|343_1(
"shop_souvenir");
2845 return this.<CreateStock>g__FromFilter|343_1(
"shop_junk");
2847 return this.<CreateStock>g__FromFilter|343_1(
"shop_drug");
2848 case ShopType.Drink:
2849 return this.<CreateStock>g__FromFilter|343_1(
"shop_drink");
2850 case ShopType.Fruit:
2851 return this.<CreateStock>g__FromFilter|343_1(
"shop_fruit");
2852 case ShopType.Booze:
2853 return this.<CreateStock>g__FromFilter|343_1(
"shop_booze");
2857 return this.<CreateStock>g__Create|343_3(
"seasoning");
2859 return this.<CreateStock>g__FromFilter|343_1(
"shop_food");
2860 case ShopType.VMachine:
2863 return this.<CreateStock>g__Create|343_3(
"panty");
2867 return this.<CreateStock>g__Create|343_3(
"234");
2869 return this.<CreateStock>g__FromFilter|343_1(
"shop_drink");
2870 case ShopType.Festival:
2873 if (
Trait.<CreateStock>g__IsFestival|343_0(
"olvina"))
2875 return this.<CreateStock>g__Create|343_3(
new string[]
2879 }.RandomItem<
string>());
2881 if (
Trait.<CreateStock>g__IsFestival|343_0(
"yowyn"))
2883 return this.<CreateStock>g__Create|343_3(
new string[]
2888 }.RandomItem<
string>());
2890 if (
Trait.<CreateStock>g__IsFestival|343_0(
"noyel"))
2892 return this.<CreateStock>g__Create|343_3(
new string[]
2896 }.RandomItem<
string>());
2901 return this.<CreateStock>g__Create|343_3(
new string[]
2907 }.RandomItem<
string>());
2911 return this.<CreateStock>g__FromFilter|343_1(
"shop_junk");
2913 return this.<CreateStock>g__FromFilter|343_1(
"shop_souvenir");
2914 case ShopType.Fireworks:
2917 return this.<CreateStock>g__Create|343_3(
"firework_launcher");
2919 return this.<CreateStock>g__Create|343_3(
"firework");
2923 if (
Trait.<CreateStock>g__IsFestival|343_0(
"kapul"))
2925 return this.<CreateStock>g__Create|343_3(
new string[]
2933 }.RandomItem<
string>());
2935 if (
Trait.<CreateStock>g__IsFestival|343_0(
"yowyn"))
2937 return this.<CreateStock>g__Create|343_3(
new string[]
2941 }.RandomItem<
string>());
2943 if (
Trait.<CreateStock>g__IsFestival|343_0(
"noyel"))
2945 return this.<CreateStock>g__Create|343_3(
new string[]
2948 }.RandomItem<
string>());
2950 if (
Trait.<CreateStock>g__IsFestival|343_0(
"olvina"))
2952 return this.<CreateStock>g__Create|343_3(
new string[]
2956 }.RandomItem<
string>());
2961 return this.<CreateStock>g__Create|343_3(
new string[]
2967 }.RandomItem<
string>());
2969 return this.<CreateStock>g__FromFilter|343_1(
"shop_lamp");
2973 return this.<CreateStock>g__Create|343_3(
"mod_ranged");
2975 return this.<CreateStock>g__FromFilter|343_1(
"shop_gun");
2982 case ShopType.Healer:
2984 Thing thing2 =
null;
2985 for (
int i = 0; i < 1000; i++)
2987 thing2 = this.<CreateStock>g__FromFilter|343_1(
"shop_healer");
2989 if (traitScroll !=
null && traitScroll.source !=
null)
2991 if (!(traitScroll.source.aliasParent !=
"WIL"))
2993 if (!(traitScroll.source.categorySub ==
"attack"))
3002 if (traitPotionRandom !=
null && traitPotionRandom.source !=
null)
3004 if (!(traitPotionRandom.source.aliasParent !=
"WIL") && !(traitPotionRandom.source.categorySub ==
"attack"))
3006 thing2.SetNum(
EClass.rnd(5) + 1);
3013 if (traitRodRandom !=
null && traitRodRandom.source !=
null && !(traitRodRandom.source.aliasParent !=
"WIL") && !(traitRodRandom.source.categorySub ==
"attack"))
3026 thing3.MakeRefFrom((from r in
EClass.sources.charas.rows
3027 where r.race ==
"mifu" || r.race ==
"nefu"
3032 return this.<CreateStock>g__Create|343_3(
"milk");
3033 case ShopType.Ecopo:
3039 case ShopType.LoytelMart:
3040 if (
EClass.player.flags.loytelMartLv >= 1)
3044 return this.<CreateStock>g__Create|343_3(
"monsterball").SetLv(40 +
EClass.rnd(
this.ShopLv)).Thing;
3048 return ThingGen.Create(
"rp_random", -1, this.ShopLv + 10);
3050 if (
EClass.rnd(100) == 0)
3052 return ThingGen.Create(
"map_treasure", -1,
EClass.rndHalf(
this.ShopLv));
3056 return this.<CreateStock>g__Create|343_3(
"water").SetPriceFix(1000);
3060 return this.<CreateStock>g__Create|343_3(
"1165");
3063 return this.<CreateStock>g__FromFilter|343_1(
"shop_junk");
3064 case ShopType.StrangeGirl:
3065 return DNA.GenerateGene(
SpawnList.Get(
"chara",
null,
null).Select(
this.ShopLv + 10, -1),
new DNA.Type?(
DNA.Type.Brain), -1, -1);
3067 if (
EClass.rnd(100) == 0)
3069 return this.<CreateStock>g__Create|343_3(
"lockpick");
3071 return this.<CreateStock>g__FromFilter|343_1(
"shop_general");
3076 private Thing <OnBarter>g__Add|342_0(
string id,
int a,
int idSkin, ref
Trait.<>c__DisplayClass342_0 A_4)
3079 Thing thing =
ThingGen.Create(
id, -1, this.ShopLv).SetNum(a);
3080 thing.idSkin = idSkin;
3081 return A_4.t.AddThing(thing,
true, -1, -1);
3086 private Thing <OnBarter>g__AddThing|342_1(
Thing _t, ref
Trait.<>c__DisplayClass342_0 A_2)
3088 return A_2.t.AddThing(_t,
true, -1, -1);
3093 private void <OnBarter>g__NoRestock|342_2(
Thing _t, ref
Trait.<>c__DisplayClass342_0 A_2)
3095 HashSet<string> hashSet =
EClass.player.noRestocks.TryGetValue(this.owner.id,
null);
3096 if (hashSet ==
null)
3098 hashSet =
new HashSet<string>();
3100 if (hashSet.Contains(_t.trait.IdNoRestock))
3104 hashSet.Add(_t.trait.IdNoRestock);
3105 EClass.player.noRestocks[this.owner.id] = hashSet;
3107 this.<OnBarter>g__AddThing|342_1(_t, ref A_2);
3112 internal static bool <CreateStock>g__IsFestival|343_0(
string id)
3114 return EClass._zone.id ==
id &&
EClass._zone.IsFestival;
3119 private Thing <CreateStock>g__FromFilter|343_1(
string s)
3121 return ThingGen.CreateFromFilter(s, this.ShopLv);
3126 private Thing <CreateStock>g__FromCat|343_2(
string s)
3128 return ThingGen.CreateFromCategory(s, this.ShopLv);
3133 private Thing <CreateStock>g__Create|343_3(
string s)
3135 return ThingGen.Create(s, -1, this.ShopLv);
3145 protected static List<Point> listRadiusPoints =
new List<Point>();
3148 public enum TileMode
3161 public enum CopyShopType