2using System.Collections.Generic;
37 if (
source.substats.Length == 0)
69 return (
int)((long)(base.isWeightChanged ? base.c_weight :
source.weight) * (long)base.material.weight / 100);
71 if (!base.isWeightChanged)
101 if (base.IsContainer && base.c_lockLv == 0 && !base.isNPCProperty)
113 if (base.IsContainer && base.c_lockLv == 0 && !base.isNPCProperty)
161 return 50 + base.LV * 10 + base.encLV * 10 + (int)base.rarity * 10 + (
int)base.blessedState * 10;
174 Debug.LogWarning(
"Thing " +
id +
" not found");
186 else if (base.category.ignoreBless == 0 &&
bp.
rarity ==
Rarity.Random && base.rarity !=
Rarity.Artifact)
196 else if (
EClass.
rnd(50) == 0 && base.category.slot != 0)
206 if (text ==
"bill_tax" || text ==
"bill")
210 if (base.category.slot != 0)
213 if (base.rarity ==
Rarity.Superior)
217 else if (base.rarity ==
Rarity.Legendary)
221 else if (base.rarity ==
Rarity.Mythical)
225 else if (base.rarity >=
Rarity.Artifact)
231 for (
int i = 0; i < num; i++)
247 int num3 = ((
EClass.
rnd(10) == 0) ? 1 : 0);
248 if (base.rarity ==
Rarity.Superior)
252 else if (base.rarity ==
Rarity.Legendary)
256 else if (base.rarity ==
Rarity.Mythical)
260 else if (base.rarity >=
Rarity.Artifact)
264 if (
id ==
"bow_vindale")
270 for (
int j = 0; j < num2; j++)
276 for (
int k = 0; k <
EClass.
rnd(num2 + 1); k++)
288 if (
id ==
"shield_flower")
363 base.isReplica =
true;
368 bool flag = (base.isFireproof =
false);
369 base.isAcidproof = flag;
377 if (
source.offense.Length != 0)
379 base.c_diceDim =
source.offense[1];
381 if (
source.offense.Length > 2)
383 SetBase(66,
source.offense[2]);
385 if (
source.offense.Length > 3)
387 SetBase(67,
source.offense[3]);
389 if (
source.defense.Length != 0)
391 SetBase(64,
source.defense[0]);
393 if (
source.defense.Length > 1)
395 SetBase(65,
source.defense[1]);
401 bool flag3 = !base.IsAmmo;
402 if (base.rarity <=
Rarity.Crude)
406 else if (base.rarity ==
Rarity.Superior)
410 else if (base.rarity >=
Rarity.Legendary)
414 if (
source.offense.Length != 0)
416 base.c_diceDim =
source.offense[1] * base.material.dice / (num + (flag3 ?
EClass.
rnd(25) : 0));
418 if (
source.offense.Length > 2)
420 SetBase(66,
source.offense[2] * base.material.atk * 9 / (num - (flag3 ?
EClass.
rnd(30) : 0)));
422 if (
source.offense.Length > 3)
424 SetBase(67,
source.offense[3] * base.material.dmg * 5 / (num - (flag3 ?
EClass.
rnd(30) : 0)));
426 if (
source.defense.Length != 0)
428 SetBase(64,
source.defense[0] * base.material.dv * 7 / (num - (flag3 ?
EClass.
rnd(30) : 0)));
430 if (
source.defense.Length > 1)
432 SetBase(65,
source.defense[1] * base.material.pv * 9 / (num - (flag3 ?
EClass.
rnd(30) : 0)));
437 if (
source.offense.Length != 0)
439 base.c_diceDim = Mathf.Max(
source.offense[1] / 3, 1);
441 if (
source.offense.Length > 2)
443 SetBase(66,
source.offense[2] / 3);
445 if (
source.offense.Length > 3)
447 SetBase(67,
source.offense[3] / 3);
449 if (
source.defense.Length != 0)
451 SetBase(64,
source.defense[0] / 3);
453 if (
source.defense.Length > 1)
455 SetBase(65,
source.defense[1] / 3);
458 if (base.IsEquipmentOrRangedOrAmmo)
460 if (base.IsWeapon || base.IsAmmo)
474 for (
int i = 0; i <
sockets.Count; i++)
477 int num3 = num2 / 1000;
478 if (num3 == 67 && dmgSet)
482 if (num3 == 66 && hitSet)
486 if (num3 == 65 && pvSet)
492 if (base.material ==
null || base.material.elements ==
null)
494 Debug.Log(base.idMaterial +
"/" + base.material?.name +
"/" + base.material?.elements);
497 string[] bits = base.material.bits;
498 foreach (
string text
in bits)
500 if (!(text ==
"fire"))
504 base.isAcidproof =
true;
509 base.isFireproof =
true;
512 if (base.rarity >=
Rarity.Artifact)
514 bool flag = (base.isFireproof =
true);
515 base.isAcidproof = flag;
518 void SetBase(
int ele,
int a)
538 int num = ((_num == -1) ? base.Num : _num);
545 string text6 =
source.GetText(
"unit");
547 bool num2 = base.IsIdentified ||
source.unknown.IsEmpty();
548 bool isEquipmentOrRangedOrAmmo = base.IsEquipmentOrRangedOrAmmo;
549 bool flag = Lang.setting.nameStyle == 0;
552 if (base.c_idRefCard.IsEmpty() && !base.c_altName.IsEmpty())
554 text = base.c_altName;
560 if (array.Length > 1)
569 if (isEquipmentOrRangedOrAmmo && base.IsIdentified && base.rarity >=
Rarity.Legendary)
571 if (base.rarity !=
Rarity.Artifact && !base.material.GetTextArray(
"altName").IsEmpty())
573 text = base.material.GetTextArray(
"altName")[0] + Lang.space + text;
577 if (
source.naming ==
"m" || (
source.naming ==
"ms" && base.material !=
source.DefaultMaterial))
579 if (isEquipmentOrRangedOrAmmo)
581 string[] textArray = base.material.GetTextArray(
"altName");
582 if (textArray !=
null && textArray.Length >= 2)
584 text = base.material.GetTextArray(
"altName")[1] + Lang.space + text;
588 text =
"_of2".lang(base.material.GetName(), text);
593 string idUnknown =
source.GetText(
"unknown");
594 if (idUnknown.StartsWith(
"#"))
598 idUnknown =
Lang.
GetList(idUnknown.Remove(0, 1)).RandomItem();
606 text =
"_halfeaten".lang(text);
608 if (base.c_bill != 0)
610 text =
"_of".lang(
Lang.
_currency(base.c_bill, showUnit:
true, 0), text);
615 text =
Lang.
GetList((base.category.id ==
"fish") ?
"quality_fish" :
"quality_general")[Mathf.Clamp(base.tier, 0, 3)] + text;
625 if (!base.c_refText.IsEmpty())
627 text =
"_named".lang(base.c_refText, text);
629 if (base.IsIdentified)
633 if ((base.IsMeleeWeapon || base.IsRangedWeapon || base.IsAmmo || hIT != 0 || dMG != 0) && source.offense.Length != 0)
636 if (
source.offense[0] != 0)
638 text7 = text7 +
source.offense[0] +
"d" + base.c_diceDim;
642 text7 += ((base.IsMeleeWeapon || base.IsRangedWeapon || base.IsAmmo) ? dMG.ToText() : (dMG.ToString() ??
""));
646 text7 = text7 + ((dMG != 0 ||
source.offense[0] != 0) ?
", " :
"") + hIT;
648 text2 = text2 +
" (" + text7.IsEmpty(
" - ") +
")";
652 if (dV != 0 || pV != 0)
655 text2 = text2 + dV +
", " + pV;
660 text2 = text2 +
" " +
"itemCharges".lang(base.c_charges.ToString() ??
"");
663 else if (base.c_IDTState == 3 || base.c_IDTState == 1)
665 text2 = Lang.space +
"(" + base.TextRarity.ToTitleCase() +
")";
669 text =
"rotten".lang() + text;
671 else if (base.IsRotting)
673 text =
"rotting".lang() + text;
675 if (base.IsIdentified)
679 text4 = (
"bs" + base.blessedState).lang();
686 text = (isEquipmentOrRangedOrAmmo ? text.Bracket(3) : text);
692 if (isEquipmentOrRangedOrAmmo)
696 sig = AliasGen.GetRandomAlias(builtin:
true).Bracket((base.rarity ==
Rarity.Mythical) ? 3 : 2);
698 sig = Lang.space + sig;
705 if (base.category.tag.Contains(
"enc"))
707 if (base.c_altName.IsEmpty())
710 text =
"_qualityFurniture".lang(list[Mathf.Clamp(base.encLV - 1, 0, list.Length - 1)], text);
715 sig = sig + Lang.space + ((base.encLV > 0) ? (
"+" + base.encLV) : (base.encLV.ToString() ??
""));
718 if (base.c_lockLv != 0 && base.c_revealLock)
720 sig = sig + Lang.space +
"+" + base.c_lockLv;
722 if (base.isLostProperty)
724 text =
"_lostproperty".lang(text);
728 text5 +=
"equippedItem".lang();
732 string text8 = base.c_note;
733 if (text8.StartsWith(
'@'))
735 text8 =
Lang.
Note.map.TryGetValue(text8.TrimStart(
'@'))?.GetText(
"text") ?? base.c_note;
737 string text9 = (base.category.IsChildOf(
"book") ?
"_written" :
"_engraved");
738 if (
id ==
"grave_dagger1" ||
id ==
"grave_dagger2")
740 text9 =
"_daggerGrave";
742 text = ((!text8.Contains(
"_bracketLeft".lang())) ? text9.lang(text8, text) : (text9 +
"Alt").lang(text8, text));
744 text = (flag ? ((num <= 1) ? (text4 + text) :
"_unit".lang(num.ToFormat() ??
"", text4 + text, text6)) : ((
trait is
TraitAbility) ? text.ToTitleCase(wholeText:
true) : ((!text6.IsEmpty() && (base.IsIdentified ||
source.unknown.IsEmpty())) ?
"_unit".lang((num == 1) ?
"" : (num.ToFormat() ??
""), text, (text4 + text6).AddArticle(num, style2,
source.unit)) : (text4 + text).AddArticle(num, style2,
source.name))));
745 if (base.rarity >=
Rarity.Legendary)
747 text = text.ToTitleCase(wholeText:
true);
756 text5 =
"_limitedStock".lang(text5);
758 return text5 + text3 + text + sig + text2 + text10;
762 if (
source.naming ==
"ma")
764 text = base.material.GetName();
768 if (!base.c_idRefCard.IsEmpty() && trait.RefCardName !=
RefCardName.None)
770 string text11 = base.c_altName.IsEmpty(base.refCard.GetName());
771 if (!base.c_idRefCard2.IsEmpty())
773 text11 =
"_and".lang(text11, base.c_altName2.IsEmpty(base.refCard2.GetName()));
775 if (!(text11 ==
"*r"))
777 text = ((!
source.name2.IsEmpty()) ?
source.GetTextArray(
"name2")[0].Replace(
"#1g",
EClass.
pc.
faith.
NameShort).Replace(
"#1b", base.c_extraNameRef.IsEmpty((base.refCard ==
null) ? text11 : (base.refCard.isChara ? base.refCard.GetName() : base.refCard.GetText()))).Replace(
"#1", base.c_extraNameRef.IsEmpty(text11)) : (
source.naming.Contains(
"last") ? (text + Lang.space + text11) : (
source.naming.Contains(
"first") ? (text11 + Lang.space + text) : ((!
source.naming.Contains(
"of")) ? (text6.IsEmpty() ?
"_of3" :
"_of2").lang(text11, text) :
"_of".lang(text11, text)))));
781 string text12 = base.refCard.GetText(
"aka");
782 if (!text12.IsEmpty())
784 text =
"_of".lang(text12, text);
794 text = text +
" <size=14>(" +
Lang.
_weight(base.ChildrenAndSelfWeight) +
")</size> ";
797 text += Environment.NewLine;
798 text = text +
"id:" +
id +
" tile:" + source.idRenderData +
"/" + ((source.tiles.Length != 0) ? ((
object)source.
tiles[0]) :
"-")?.ToString() +
" num:" + base.Num +
" lv:" + base.LV +
" enc:" + base.encLV +
" / " + base.material.alias;
800 string hoverText = trait.GetHoverText();
801 if (!hoverText.IsEmpty())
803 text = text + Environment.NewLine + hoverText;
805 return base.GetHoverText() + text;
813 if (things.Count > 0)
815 text +=
"childCount".lang(things.Count.ToString() ??
"");
817 else if (trait.CanOpenContainer)
819 text +=
"empty".lang();
824 Room room = pos.cell.room;
835 int price = base.GetPrice(
currency, sell, priceType, c);
836 string str = GetStr(
"price_calc_override");
843 rarity = base.rarityLv
845 if (str.TryEvaluateAsCalc(out
int result, (
object)args))
855 List<Element> list =
new List<Element>();
856 if (base.ShowFoodEnc)
858 foreach (
Element value
in elements.dict.Values)
866 if (limit && list.Count > 5)
868 int num = list.Count - 5;
869 for (
int num2 = 0; num2 < num; num2++)
871 list.RemoveAt(list.Count - 1);
880 List<Element> list = ListLimitedValidTraits(limit);
881 bool showFoodEnc = base.ShowFoodEnc;
885 foreach (
Element value
in elements.dict.Values)
893 foreach (
Element value2
in elements.dict.Values)
905 if (sourceCard.
_origin ==
"dish")
913 bool showEQStats = base.IsEquipmentOrRangedOrAmmo;
915 bool flag2 = base.IsIdentified || flag;
917 if (base.rarity ==
Rarity.Legendary || base.rarity ==
Rarity.Mythical)
919 string text3 = (text2.Contains(
"『") ?
"『" : (text2.Contains(
"《") ?
"《" :
""));
922 string[] array = text2.Split(text3);
923 text2 = array[0] + Environment.NewLine + text3 + array[1];
930 text2 = recipe.GetName();
932 if (trait.CraftNum > 1)
934 text2 = text2 +
" x " + trait.CraftNum;
947 uIItem.
image2.Rect().pivot =
new Vector2(0.5f, 0.5f);
948 string text4 = base.Num.ToFormat() ??
"";
949 string text5 = (0.01f * (float)base.ChildrenAndSelfWeight * 0.1f).ToString((base.ChildrenAndSelfWeight == 0) ?
"F0" : ((base.ChildrenAndSelfWeight >= 1000) ?
"F1" :
"F2")) +
"s";
950 if (things.Count > 0)
952 text4 = text4 +
" (" + things.Count +
")";
954 if (base.ChildrenAndSelfWeight != SelfWeight)
956 text5 = text5 +
" (" + (Mathf.Ceil(0.01f * (
float)SelfWeight) * 0.1f).ToString(
"F1") +
"s)";
958 text2 =
"_quantity".lang(text4 ??
"", text5);
961 text2 = text2 +
"(" + base.ChildrenAndSelfWeight +
")";
965 text2 = text2 +
" " +
"_recipe_lv".lang(recipe.RecipeLv.ToString() ??
"");
968 if (showEQStats && flag2)
971 if (DV != 0 || PV != 0 || base.HIT != 0 || base.DMG != 0 || Penetration != 0)
975 text2 = text2 +
"DMG".lang() + ((base.DMG > 0) ?
"+" :
"") + base.DMG +
", ";
979 text2 = text2 +
"HIT".lang() + ((base.HIT > 0) ?
"+" :
"") + base.HIT +
", ";
983 text2 = text2 +
"DV".lang() + ((DV > 0) ?
"+" :
"") + DV +
", ";
987 text2 = text2 +
"PV".lang() + ((PV > 0) ?
"+" :
"") + PV +
", ";
989 if (Penetration != 0)
991 text2 = text2 +
"PEN".lang() + ((Penetration > 0) ?
"+" :
"") + Penetration +
"%, ";
993 text2 = text2.TrimEnd(
' ').TrimEnd(
',');
995 if (!text2.IsEmpty())
997 n.
AddText(
"NoteText_eqstats", text2);
1001 n.
AddText(
"NoteText_eqstats",
"tip_range".lang(traitToolRange.BestDist.ToString() ??
""));
1009 int totalQuality = GetTotalQuality();
1010 int totalQuality2 = GetTotalQuality(applyBonus:
false);
1011 text6 = text6 +
"Lv. " + base.LV +
" TQ. " + GetTotalQuality() + ((totalQuality == totalQuality2) ?
"" : (
" (" + totalQuality2 +
")"));
1015 text6 = text6 + (text6.IsEmpty() ?
"" :
" ") +
"_nutrition".lang(Evalue(10).ToFormat() ??
"");
1017 if ((base.category.IsChildOf(
"throw") || base.category.IsChildOf(
"resource") || trait.IsTool) && !(trait is
TraitAbility))
1019 text6 = text6 + (text6.IsEmpty() ?
"" :
" ") +
"_hardness".lang(base.material.hardness.ToString() ??
"");
1023 text6 = text6 + (text6.IsEmpty() ?
"" :
" ") +
"_max_quality".lang(recipe.GetQualityBonus().ToString() ??
"");
1025 if (!text6.IsEmpty())
1027 n.
AddText(
"NoteText_eqstats", text6);
1031 string detail = GetDetail();
1032 if (!detail.IsEmpty())
1034 LayoutElement component = n.
AddText(
"NoteText_flavor", detail).GetComponent<LayoutElement>();
1037 component.preferredWidth = 400f;
1045 n.
AddText(
"NoteText_flavor", traitBookPlan.
source.GetDetail());
1048 if (traitAbility !=
null)
1059 n.
AddText(
"(id:" +
id +
" tile:" + (source.
tiles.IsEmpty() ?
"-" : ((
object)source.
tiles[0]))?.ToString() +
") lv:" + base.LV +
" price:" + GetPrice());
1061 Card root = GetRootCard();
1070 AddText(
"isCategorized".lang(base.category.GetText()),
FontColor.Default);
1071 if (base.category.skill != 0)
1073 int key = base.category.skill;
1075 if (base.IsRangedWeapon && !base.IsMeleeWeapon)
1083 if (Evalue(482) > 0)
1090 if (base.IsContainer)
1092 AddText(
"isContainer".lang(things.MaxCapacity.ToString() ??
""),
FontColor.Default);
1094 if (base.c_lockLv != 0)
1096 AddText((base.c_lockedHard ?
"isLockedHard" :
"isLocked").lang(base.c_lockLv.ToString() ??
""),
FontColor.Warning);
1098 if (base.isCrafted && recipe ==
null)
1100 AddText(
"isCrafted".lang(),
FontColor.Default);
1102 if (trait.Decay > 0)
1105 text7 = (base.IsDecayed ?
"isRotten" : (base.IsRotting ?
"isRotting" : ((!base.IsFresn) ?
"isNotFresh" :
"isFresh")));
1106 AddText(text7.lang(),
FontColor.Default);
1110 AddText(
"isDyed".lang(base.DyeMat.GetName() ??
""),
FontColor.Default);
1112 if (base.IsEquipment)
1114 text2 =
"isEquipable".lang(
Element.
Get(base.category.slot).GetText());
1117 if (base.isFireproof)
1119 AddText(
"isFreproof",
FontColor.Default);
1121 if (base.isAcidproof)
1123 AddText(
"isAcidproof",
FontColor.Default);
1125 if (trait.OriginalElectricity > 0)
1127 AddText(
"isGenerateElectricity".lang(trait.OriginalElectricity.ToString() ??
""),
FontColor.Default);
1129 if (trait.OriginalElectricity < 0)
1131 AddText(
"isConsumeElectricity".lang(Mathf.Abs(trait.OriginalElectricity).ToString() ??
""),
FontColor.Default);
1135 AddText(
"isPrecious",
FontColor.Default);
1141 if (flag && HasTag(
CTAG.noMix))
1145 if (!trait.CanBeDestroyed)
1147 AddText(
"isIndestructable",
FontColor.Default);
1149 if (GetInt(107) > 0)
1157 if (!base.c_idDeity.IsEmpty())
1162 if (base.c_uidAttune != 0)
1169 AddText(
"isPartyFood",
FontColor.Ether);
1171 if (base.isGifted && GetRoot() !=
EClass.
pc)
1175 if (base.isNPCProperty)
1177 AddText(
"isNPCProperty",
FontColor.Ether);
1179 if (base.c_priceFix != 0)
1181 AddText(((base.c_priceFix > 0) ?
"isPriceUp" :
"isPriceDown").lang(Mathf.Abs(base.c_priceFix).ToString() ??
""),
FontColor.Ether);
1187 if (trait.IsOnlyUsableByPc)
1189 AddText(
"isOnlyUsableByPC",
FontColor.Ether);
1195 if (base.c_isImportant)
1197 AddText(
"isMarkedImportant",
FontColor.Ether);
1199 if (GetInt(25) != 0)
1201 AddText(
"isDangerLv".lang((GetInt(25) + 1).ToString() ??
"", (
EClass.
pc.
FameLv + 10).ToString() ??
""),
FontColor.Default);
1206 AddText(
"canPryOpen", col);
1210 if (HasElement(220))
1212 AddText(
"canMine".lang(), col);
1214 if (HasElement(225))
1216 AddText(
"canLumberjack".lang(), col);
1217 AddText(
"canLumberjack2".lang(), col);
1219 if (HasElement(230))
1221 AddText(
"canDig", col);
1223 if (HasElement(286))
1225 AddText(
"canFarm", col);
1227 if (HasElement(245))
1229 AddText(
"canFish", col);
1231 if (HasElement(237))
1233 AddText(
"canTame", col);
1238 AddText(
"canPlayMusic".lang(), col);
1240 if (
Lang.
Has(
"hint_" + trait.ToString()))
1242 AddText(
"hint_" + trait.ToString(),
FontColor.Util);
1244 if (
Lang.
Has(
"hint_" + trait.ToString() +
"2"))
1246 AddText(
"hint_" + trait.ToString() +
"2",
FontColor.Util);
1248 if (HasTag(
CTAG.tourism))
1252 string langPlaceType = base.TileType.LangPlaceType;
1253 if (langPlaceType ==
"place_Door" || langPlaceType ==
"place_WallMount")
1255 AddText(base.TileType.LangPlaceType +
"_hint".lang(),
FontColor.Util);
1257 if (trait.IsHomeItem)
1259 AddText(
"isHomeItem".lang(),
FontColor.Util);
1261 if (HasTag(
CTAG.throwWeapon))
1263 AddText(
"isThrowWeapon",
FontColor.Default);
1267 AddText(
"isThrowWeaponEnemy",
FontColor.Default);
1271 AddText(
"isNoProcessIng",
FontColor.Default);
1275 AddText(
"isDrinkable",
FontColor.Default);
1283 AddText(
"isLeftoverable",
FontColor.Default);
1285 if (HasTag(
CTAG.rareResource))
1287 AddText(
"isRareResource",
FontColor.Great);
1291 AddText(
"isBed".lang(traitBed.MaxHolders.ToString() ??
""),
FontColor.Default);
1293 bool showAsEquipment = base.IsEquipmentOrRangedOrAmmo || base.IsThrownWeapon || trait is
TraitToolMusic;
1294 bool showTraits = !showAsEquipment || base.ShowFoodEnc;
1296 List<Element> listTrait = ListValidTraits(isCraft:
false, !infoMode);
1297 List<Element> list = ListValidTraits(isCraft:
false, limit:
false);
1298 if (list.Count - listTrait.Count <= 1)
1304 Element element = elements.GetElement(653);
1305 if (element !=
null)
1307 AddText(
"isAlive".lang(element.
vBase.ToString() ??
"", (element.
vExp / 10).ToString() ??
"", (element.
ExpToNext / 10).ToString() ??
""),
FontColor.Great);
1309 string[] rangedSubCats =
new string[2] {
"eleConvert",
"eleAttack" };
1310 elements.AddNote(n, delegate(
Element e)
1312 if (!showAsEquipment && !e.
HasTag(
"itemEnc"))
1320 if (e.
IsTrait || (showTraits && listTrait.Contains(e)))
1326 bool flag4 = base.IsWeapon || base.IsRangedWeapon || base.IsAmmo || base.IsThrownWeapon || trait is TraitToolMusic;
1327 if (base.IsEquipment && base.category.slot != 35 && source.elementMap.ContainsKey(e.id))
1331 if (e.
source.tag.Contains(
"weaponEnc") && !flag4)
1335 if (e.
source.IsWeaponEnc && !(base.category.IsChildOf(
"shield") || flag4))
1340 return (!showEQStats || (e.
id != 64 && e.
id != 65 && e.
id != 66 && e.
id != 67)) ?
true :
false;
1348 if (e.
source.IsWeaponEnc && (!e.
source.tag.Contains(
"modRanged") || e.
id == 609) && isEquipped && root.
isChara)
1351 if (num2 != 482 && (uint)(num2 - 660) > 2u && num2 != 666)
1356 string text9 =
" (" + e.Value + ((e.Value == num) ?
"" : (
" → " + num)) +
")";
1357 string text10 =
"_bracketLeft3".lang() + e.Name +
"_bracketRight3".lang();
1358 return s + text9 +
" " + text10;
1360 if (sockets !=
null)
1362 foreach (
int socket
in sockets)
1364 AddText((socket == 0) ?
"emptySocket".lang() :
"socket".lang(
EClass.
sources.
elements.map[socket / 1000].GetName(), (socket % 1000).ToString() ??
""),
FontColor.Gray);
1368 trait.WriteNote(n, flag2);
1369 if (base.c_DNA !=
null)
1371 bool flag3 =
EClass.
pc.
HasElement(1274) && !LayerDragGrid.Instance && base.category.id !=
"relic";
1372 if (base.c_DNA.cost > 0)
1374 n.AddText(
"NoteText_enc",
"isCostFeatPoint".lang((flag3 ? (base.c_DNA.cost *
EClass.
pc.
GeneCostMTP / 100 +
" (" + base.c_DNA.cost +
")") : ((
object)base.c_DNA.cost))?.ToString() ??
""));
1378 n.AddText(
"NoteText_enc",
"duration:" + base.c_DNA.GetDurationHour());
1380 base.c_DNA.WriteNote(n,
this, flag3 ?
EClass.
pc :
null);
1383 base.c_DNA.WriteNoteExtra(n,
this,
EClass.
pc);
1393 if (listTrait.Count != list.Count)
1395 AddText(
"traitOther".lang((list.Count - listTrait.Count).ToString() ??
""),
FontColor.Default);
1398 if (base.c_mixedFoodData !=
null)
1400 n.AddHeader(
"isMixedFood");
1401 foreach (
string text12
in base.c_mixedFoodData.texts)
1403 AddText(
"_bullet".lang() + text12 + text,
FontColor.Default);
1409 AddText(
"isUnidentified".lang(),
FontColor.Flavor);
1410 if (base.c_IDTState == 1)
1412 AddText(
"isUnidentified2".lang(),
FontColor.Flavor);
1417 n.AddHeader(
"HeaderAdditionalTrait",
"additional_trait");
1425 n.AddText(
"decay:" + base.decay);
1426 n.AddText(base.isDyed +
"/" +
id +
"/" + base.refVal +
"/" + base.LV +
"/" + trait);
1427 if (source.
origin !=
null)
1432 if (
id ==
"statue_weird")
1434 AddText(
"weirdStatue",
FontColor.Default);
1438 AddText(
"isReplica",
FontColor.Passive);
1447 if (base.c_equippedSlot != 0 && base.category.slot == 35 && chara2 !=
null)
1449 AddAttackEvaluation(n, chara2,
this);
1451 if (base.IsThrownWeapon || base.IsRangedWeapon || (base.IsMeleeWeapon && base.c_equippedSlot == 0))
1453 n.AddHeader(
"headerAttackEval");
1456 text8 = text8.TagColor(() =>
true);
1460 if (base.ammoData !=
null)
1462 n.AddHeader(
"headerAttackAmmo");
1463 n.AddText(base.ammoData.Name);
1465 onWriteNote?.Invoke(n);
1468 AddText(
"isProductWarning",
FontColor.Default);
1476 foreach (
Element value
in elements.dict.Values)
1482 void AddText(
string text9,
FontColor color)
1484 n.AddText(
"NoteText_enc", text9, color);
1486 void AddTextWithIcon(
string text9, Sprite sprite,
FontColor color)
1488 UIItem uIItem2 = n.AddText(
"NoteText_enc", text9, color);
1489 uIItem2.
image1.SetActive(enable:
true);
1490 uIItem2.image1.sprite = sprite;
1492 string GetTextTrait(
Element e)
1494 string text9 = e.
source.GetText(
"textExtra");
1495 if (text9.IsEmpty())
1501 text9 = text9.Replace(
"#1",
$"{0.1f * (float)(e.Value + 10):F1}");
1506 int num = recipe.GetQualityBonus() / 10;
1511 text10 =
"qualityLimit".lang(num.ToString() ??
"");
1513 int num2 = e.Value / 10;
1514 num2 = ((e.Value < 0) ? (num2 - 1) : (num2 + 1));
1515 string text11 = num2.ToString() ??
"";
1518 text11 = (int)((
float)num2 * 0.1f * (float)(Evalue(710) + 10)) +
" (" + num2 +
")";
1520 text9 =
"Lv." + text11 + text10 +
" " + text9;
1523 text9 +=
"traitAdditive".lang();
1525 return (
" <size=12>" + text9 +
"</size>").TagColor(
FontColor.Passive);
1533 foreach (
BodySlot slot
in chara.body.slots)
1541 if (slot.
thing == current)
1543 text = text.TagColor(() =>
true);
1552 text2 = text2.TagColor(() =>
true);
1559 p.matColor = base.colorInt;
1560 p.mat = base.material;
1561 if (!renderer.usePass)
1565 switch (trait.tileMode)
1568 if (source.
_altTiles.Length != 0 && trait.UseAltTiles)
1570 p.tile = source.
_altTiles[base.dir % source.
_altTiles.Length] * ((!flipX) ? 1 : (-1));
1574 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1583 p.color += 1572864f;
1594 if (source.
_altTiles.Length != 0 && trait.UseAltTiles)
1596 p.tile = source.
_altTiles[base.dir % source.
_altTiles.Length] * ((!flipX) ? 1 : (-1));
1600 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1602 if (animeCounter > 0f && source.
anime.Length != 0)
1604 animeCounter += Time.deltaTime;
1605 int num3 = (int)(animeCounter / (0.001f * (
float)source.
anime[1]));
1606 if (num3 > ((source.
anime.Length > 2) ? source.
anime[2] : source.
anime[0]))
1612 p.tile += num3 % source.
anime[0] * ((!flipX) ? 1 : (-1));
1617 if (base.isOn || base.isRoofItem)
1619 int num4 = (int)((
float)base.uid + Time.realtimeSinceStartup * 5f);
1620 int num5 = (int)(Time.realtimeSinceStartup * 5f);
1621 p.tile = (sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] + num4 % 3 + 1) * ((!flipX) ? 1 : (-1));
1626 else if (num5 % 11 == 0)
1632 p.color = 13107200f;
1637 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1641 if (source.
_altTiles.Length != 0 && trait.UseAltTiles)
1643 p.tile = source.
_altTiles[base.dir % source.
_altTiles.Length] * ((!flipX) ? 1 : (-1));
1647 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1649 if (parent is
Zone && pos.cell.HasFullBlock)
1651 p.tile += ((p.tile < 0f) ? (-64) : 64);
1655 p.tile += ((!(p.tile < 0f)) ? 1 : (-1));
1660 if (source.
_altTiles.Length != 0 && trait.UseAltTiles)
1662 p.tile = source.
_altTiles[base.dir % source.
_altTiles.Length] * ((!flipX) ? 1 : (-1));
1666 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1668 float time = Time.realtimeSinceStartup;
1676 if (source.
anime.Length == 0 || !trait.IsAnimeOn)
1680 if (source.
anime.Length > 2)
1682 int num = (int)(time * 1000f / (
float)source.
anime[1] % (float)source.
anime[2]);
1683 if (num == source.
anime[0] - 1 && source.
anime.Length > 3)
1685 PlaySound(
"anime_sound" + source.
anime[3]);
1687 if (num < source.
anime[0])
1689 p.tile += num * ((!(p.tile < 0f)) ? 1 : (-1));
1694 int num2 = (int)(time * 1000f / (
float)source.
anime[1] % (float)source.
anime[0]);
1695 p.tile += num2 * ((!(p.tile < 0f)) ? 1 : (-1));
1700 if (trait.IdSkin != 0 && sourceCard.
skins.Length != 0)
1702 int num6 = sourceCard.
skins.TryGet(trait.IdSkin - 1);
1704 p.tile += ((p.tile < 0f) ? (-num6) : num6);
1713 if (!renderer.data.subCrate.enable)
1717 return renderer.data.subCrate;
1740 if (!trait.CanStackTo(to))
1744 if (base.noSell != to.
noSell || base.isCopy != to.
isCopy)
1772 if (trait.IsRequireFuel && base.c_charges != to.
c_charges)
1780 if (base.Num + to.
Num <= 0)
1788 if (windowSaveData !=
null && windowSaveData.
compress)
1795 if (base.encLV != to.
encLV && !base.IsFood)
1803 foreach (
Element value
in elements.dict.Values)
1806 if (element ==
null)
1816 int num = (to.encLV = Mathf.CeilToInt(
MathEx.
ClampToInt(((
long)base.encLV * (
long)base.Num + (
long)to.
encLV * (
long)to.
Num) / ((
long)base.Num + (
long)to.
Num))));
1818 foreach (
Element value2
in elements.dict.Values)
1821 value2.vBase = (element2.vBase =
MathEx.
ClampToInt(((
long)value2.vBase * (long)base.Num + (
long)element2.vBase * (long)to.
Num) / ((long)base.Num + (
long)to.
Num)));
1825 if (base.encLV != to.
encLV)
1833 foreach (
Element value3
in elements.dict.Values)
1835 Element element3 = to.elements.GetElement(value3.
id);
1836 if (element3 ==
null || value3.
vBase / 10 * 10 != element3.
vBase / 10 * 10)
1846 if (ing.CanSetThing(
this))
1850 if (things.Count <= 0 || base.c_lockLv != 0 || base.isNPCProperty)
1854 foreach (
Thing thing
in things)
1866 if (GetRootCard().Dist(
EClass.
pc) > 1 || !ing.CanSetThing(
this))
1889 bool buy = trans !=
null;
1891 UIItem itemSlider =
null;
1900 }, 1f, base.Num, isInt:
true, hideOther:
false, useInput:
true).GetComponent<UIItem>();
1903 buttonBuy = m.
AddButton(
"invBuy", delegate
1908 m.onDestroy = delegate
1910 if ((!buy || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) && !m.
wasCanceled)
1916 if ((
bool)buttonBuy)
1918 buttonBuy.gameObject.AddComponent<CanvasGroup>();
1925 Debug.Log(
"Split bug1");
1929 Debug.Log(
"Split bug2");
1933 Debug.Log(
"Split bug3");
1935 else if (count != 0 && !Input.GetMouseButton(1))
1939 trans.Process(startTransaction:
true);
1944 if (count != base.Num)
1948 thing.invX = dragItemCard.
from.
invX;
1949 thing.invY = dragItemCard.
from.
invY;
1959 itemSlider.text1.text = GetName(
NameStyle.FullNoArticle, 1);
1960 itemSlider.text2.text =
Lang.
_weight(SelfWeight * count);
1961 if ((
bool)buttonBuy)
1963 buttonBuy.mainText.SetText(trans.GetTextDetail());
1964 buttonBuy.mainText.RebuildLayoutTo<
UIButton>();
1965 buttonBuy.interactable = trans.IsValid();
1966 buttonBuy.RebuildLayout(recursive:
true);
1967 buttonBuy.gameObject.GetComponent<CanvasGroup>().alpha = (trans.IsValid() ? 1f : 0.9f);
1977 UIItem itemSlider =
null;
1982 }, 1f, base.Num, isInt:
true, hideOther:
false, useInput:
true).GetComponent<UIItem>();
1983 buttonBuy = m.
AddButton(
"invBuy", delegate
1987 m.onDestroy = delegate
1989 if ((Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) && !m.
wasCanceled)
1995 if ((
bool)buttonBuy)
1997 buttonBuy.gameObject.AddComponent<CanvasGroup>();
2004 Debug.Log(
"Split bug1");
2008 Debug.Log(
"Split bug2");
2012 Debug.Log(
"Split bug3");
2014 else if (count != 0 && !Input.GetMouseButton(1))
2016 onSplit?.Invoke(count);
2021 itemSlider.text1.text = GetName(
NameStyle.FullNoArticle, 1);
2022 itemSlider.text2.text =
Lang.
_weight(SelfWeight * count);
2025 buttonBuy.interactable =
true;
2026 buttonBuy.RebuildLayout(recursive:
true);
2055 if ((!
neg || !row.tag.Contains(
"flag")) && func(row) && row.LV < num2)
2069 num4 +=
item.chance;
2073 bool flag = text ==
"skill" || text ==
"attribute" || text ==
"resist";
2074 float num5 = 3f + Mathf.Min(lv / 10, 15f) + Mathf.Sqrt(lv *
item.encFactor / 100);
2075 int num6 = (item.mtp +
EClass.
rnd(
item.mtp + (
int)num5)) / item.mtp * ((!(flag &&
neg)) ? 1 : (-1));
2076 if (
item.encFactor == 0 && num6 > 25)
2088 if (!base.IsEquipment || base.IsCursed || base.rarity <=
Rarity.Normal || GetInt(107) > 0)
2098 c.
Say(
"lick", c,
this);
2099 PlaySound(
"offering");
2100 PlayEffect(
"mutation");
2102 Element element = AddEnchant(base.LV);
2103 if (element !=
null)
2105 SetInt(107, element.
id);
2111 List<Element> list =
new List<Element>();
2112 foreach (
Element value
in elements.dict.Values)
2114 if (value.
id != 67 && value.
id != 66 && value.
id != 64 && value.
id != 65)
2121 Element element2 = list.RandomItem();
2122 elements.ModBase(element2.
id, Mathf.Max(
EClass.
rnd(Mathf.Abs(element2.
vBase / 5)), 1));
2123 SetInt(107, element2.
id);
2127 c.
Say(
"lick2", c, tg, slot.
name.ToLower());
2128 tg.PlaySound(
"offering");
2129 tg.PlayEffect(
"mutation");
2137 if (base.IsToolbelt || base.IsLightsource)
2142 if (enchant ==
null)
2146 return elements.ModBase(enchant.Item1.id, enchant.Item2);
2155 Msg.
Say(
"attuned",
this, c);
2156 base.c_uidAttune = c.
uid;
2161 if (base.IsIdentified)
2169 @ref = GetName(
NameStyle.Full, base.Num);
2171 Rarity rarity = idtSource
switch
2173 IDTSource.SkillHigh =>
Rarity.Legendary,
2174 IDTSource.Skill =>
Rarity.Superior,
2177 if (rarity !=
Rarity.Normal && ((base.IsEquipmentOrRangedOrAmmo && base.rarity >= rarity) || base.rarity >=
Rarity.Mythical))
2179 base.c_IDTState = 3;
2181 else if (base.rarity >=
Rarity.Mythical && idtSource !=
IDTSource.SuperiorIdentify)
2183 base.c_IDTState = 1;
2187 base.c_IDTState = 0;
2191 text = GetName(
NameStyle.Full, base.Num);
2192 if (base.c_IDTState == 0)
2194 Msg.
Say(
"identified", @ref, text);
2198 Msg.
Say((idtSource ==
IDTSource.Skill) ?
"identified3" :
"identified2", @ref, text, base.TextRarity);
2201 if (base.IsIdentified)
2203 GetRootCard()?.TryStack(
this);
2213 DNA dNA = base.c_DNA;
2218 for (
int i = 0; i < dNA.
vals.Count; i += 2)
2221 if (row.
name.ToLower().Contains(s))
2225 if (row.
GetName().ToLower().Contains(s))
2233 if (!base.IsIdentified)
2237 foreach (
Element value
in elements.dict.Values)
2239 if (value.
Value != 0)
2241 if (value.
source.name.ToLower().Contains(s))
2245 if (value.
source.GetName().ToLower().Contains(s))
void SetTurbo(int mtp=-1)
void Prepare(Chara _CC, Thing _weapon, Card _TC=null, Point _TP=null, int _attackIndex=0, bool _isThrow=false)
static AttackProcess Current
static int GetTwoHandEncBonus(Chara CC, Thing w)
BlessedState? blesstedState
GlobalCharaList globalCharas
ElementContainerCard elements
Thing AddThing(string id, int lv=-1)
void ApplySocket(Thing t)
string GetStr(string id, string defaultStr=null)
virtual void SetBlessedState(BlessedState s)
BlessedState blessedState
int ChildrenAndSelfWeight
int GetInt(string id, int? defaultInt=null)
bool HasElement(int ele, bool includeNagative=false)
void Say(string lang, string ref1=null, string ref2=null)
bool IsTooHeavyToEquip(Thing thing)
override bool IsPCFaction
BackerContentConfig backer
static int rndSqrt(int a)
static SourceManager sources
static GameSetting setting
static int GetSortVal(Element a)
Dictionary< int, Element > dict
void ApplyMaterialElementMap(Thing t, bool invert=false)
Element ModBase(int ele, int v)
Element SetBase(string alias, int v, int potential=0)
Element GetOrCreateElement(Element ele)
Element GetElement(string alias)
static SourceElement.Row GetRandomElement(int lv=1, bool useWeight=true)
void _WriteNote(UINote n, Chara c, Act act)
static SourceElement.Row Get(int id)
static bool IsLeftoverable(Thing food)
ReligionManager religions
virtual void OnWriteNote(Thing t, UINote n)
static bool IsValidRangedMod(Thing t, SourceElement.Row row)
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
static string[] GetList(string id)
static string _currency(object a, string IDCurrency)
static bool Has(string id)
static LayerCraft Instance
static LayerDragGrid Instance
static void SetDirty(Thing t)
static int ClampToInt(long a)
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
static void UseSeed(int seed, Action action)
static void SetSeed(int a=-1)
Dictionary< string, CardRow > firstVariations
override string GetName()
SourceCategory categories
static SubPassData Default
const string potionCureCorruption
void GetDisassembles(List< Thing > list)
void GetIngredients(Recipe.Ingredient ing, List< Thing > list)
override void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
void GetRecipes(HashSet< Recipe > recipes)
static Tuple< SourceElement.Row, int > GetEnchant(long lv, Func< SourceElement.Row, bool > func, bool neg)
bool IsValidIngredient(Recipe.Ingredient ing)
override void SetRenderParam(RenderParam p)
void ShowSplitMenu(ButtonGrid button, InvOwner.Transaction trans=null)
void TryLickEnchant(Chara c, bool msg=true, Chara tg=null, BodySlot slot=null)
void ShowSplitMenu2(ButtonGrid button, string lang, Action< int > onSplit=null)
override void SetSource()
override SubPassData GetSubPassData()
override bool MatchEncSearch(string s)
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Element AddEnchant(int lv=-1)
override void ApplyMaterialElements(bool remove)
override string GetExtraName()
List< Element > ListLimitedValidTraits(bool limit)
override string GetName(NameStyle style, int _num=-1)
override void ApplyMaterial(bool remove=false)
override string GetHoverText()
const int MaxFurnitureEnc
static void AddAttackEvaluation(UINote n, Chara chara, Thing current=null)
override CardRow sourceCard
override void OnCreate(int genLv)
bool CanAutoFire(Chara c, Card tg, bool reloading=false)
override bool CanStackTo(Thing to)
List< Element > ListValidTraits(bool isCraft, bool limit)
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
override SourceElement.Row source
static bool CanTagSale(Card t, bool insideContainer=false)
virtual bool Contains(RecipeSource r)
virtual bool CanSearchContent
virtual SourcePref GetPref()
virtual void SetName(ref string s)
UIItem AddHeaderCard(string text, Sprite sprite=null)
UIItem AddHeader(string text, Sprite sprite=null)
UIItem AddText(string text, FontColor color=FontColor.DontChange)
void Space(int sizeY=0, int sizeX=1)