2using System.Collections.Generic;
37 if (
source.substats.Length == 0)
91 return (
int)((long)(base.isWeightChanged ? base.c_weight :
source.weight) * (long)base.material.weight / 100);
93 if (!base.isWeightChanged)
107 if (base.IsContainer && base.c_lockLv == 0 && !base.isNPCProperty)
119 if (base.IsContainer && base.c_lockLv == 0 && !base.isNPCProperty)
167 return 50 + base.LV * 10 + base.encLV * 10 + (int)base.rarity * 10 + (
int)base.blessedState * 10;
180 Debug.LogWarning(
"Thing " +
id +
" not found");
192 else if (base.category.ignoreBless == 0 &&
bp.
rarity ==
Rarity.Random && base.rarity !=
Rarity.Artifact)
202 else if (
EClass.
rnd(50) == 0 && base.category.slot != 0)
212 if (text ==
"bill_tax" || text ==
"bill")
216 if (base.category.slot != 0)
219 if (base.rarity ==
Rarity.Superior)
223 else if (base.rarity ==
Rarity.Legendary)
227 else if (base.rarity ==
Rarity.Mythical)
231 else if (base.rarity >=
Rarity.Artifact)
237 for (
int i = 0; i < num; i++)
253 int num3 = ((
EClass.
rnd(10) == 0) ? 1 : 0);
254 if (base.rarity ==
Rarity.Superior)
258 else if (base.rarity ==
Rarity.Legendary)
262 else if (base.rarity ==
Rarity.Mythical)
266 else if (base.rarity >=
Rarity.Artifact)
270 if (
id ==
"bow_vindale")
276 for (
int j = 0; j < num2; j++)
282 for (
int k = 0; k <
EClass.
rnd(num2 + 1); k++)
294 if (
id ==
"shield_flower")
365 base.isReplica =
true;
370 bool flag2 = (base.isFireproof =
false);
371 base.isAcidproof = flag2;
379 if (
source.offense.Length != 0)
381 base.c_diceDim =
source.offense[1];
383 if (
source.offense.Length > 2)
385 SetBase(66,
source.offense[2]);
387 if (
source.offense.Length > 3)
389 SetBase(67,
source.offense[3]);
391 if (
source.defense.Length != 0)
393 SetBase(64,
source.defense[0]);
395 if (
source.defense.Length > 1)
397 SetBase(65,
source.defense[1]);
403 bool flag3 = !base.IsAmmo;
404 if (base.rarity <=
Rarity.Crude)
408 else if (base.rarity ==
Rarity.Superior)
412 else if (base.rarity >=
Rarity.Legendary)
416 if (
source.offense.Length != 0)
418 base.c_diceDim =
source.offense[1] * base.material.dice / (num + (flag3 ?
EClass.
rnd(25) : 0));
420 if (
source.offense.Length > 2)
422 SetBase(66,
source.offense[2] * base.material.atk * 9 / (num - (flag3 ?
EClass.
rnd(30) : 0)));
424 if (
source.offense.Length > 3)
426 SetBase(67,
source.offense[3] * base.material.dmg * 5 / (num - (flag3 ?
EClass.
rnd(30) : 0)));
428 if (
source.defense.Length != 0)
430 SetBase(64,
source.defense[0] * base.material.dv * 7 / (num - (flag3 ?
EClass.
rnd(30) : 0)));
432 if (
source.defense.Length > 1)
434 SetBase(65,
source.defense[1] * base.material.pv * 9 / (num - (flag3 ?
EClass.
rnd(30) : 0)));
439 if (
source.offense.Length != 0)
441 base.c_diceDim = Mathf.Max(
source.offense[1] / 3, 1);
443 if (
source.offense.Length > 2)
445 SetBase(66,
source.offense[2] / 3);
447 if (
source.offense.Length > 3)
449 SetBase(67,
source.offense[3] / 3);
451 if (
source.defense.Length != 0)
453 SetBase(64,
source.defense[0] / 3);
455 if (
source.defense.Length > 1)
457 SetBase(65,
source.defense[1] / 3);
460 if (base.IsEquipmentOrRangedOrAmmo)
462 if (base.IsWeapon || base.IsAmmo)
476 for (
int i = 0; i <
sockets.Count; i++)
479 int num3 = num2 / 1000;
480 if (num3 == 67 && dmgSet)
484 if (num3 == 66 && hitSet)
488 if (num3 == 65 && pvSet)
494 if (base.material ==
null || base.material.elements ==
null)
496 Debug.Log(base.idMaterial +
"/" + base.material?.name +
"/" + base.material?.elements);
499 string[] bits = base.material.bits;
500 foreach (
string text
in bits)
502 if (!(text ==
"fire"))
506 base.isAcidproof =
true;
511 base.isFireproof =
true;
514 if (base.rarity >=
Rarity.Artifact)
516 bool flag2 = (base.isFireproof =
true);
517 base.isAcidproof = flag2;
520 void SetBase(
int ele,
int a)
540 int num = ((_num == -1) ? base.Num : _num);
547 string text6 =
source.GetText(
"unit");
549 bool num2 = base.IsIdentified ||
source.unknown.IsEmpty();
550 bool isEquipmentOrRangedOrAmmo = base.IsEquipmentOrRangedOrAmmo;
551 bool flag = Lang.setting.nameStyle == 0;
554 if (base.c_idRefCard.IsEmpty() && !base.c_altName.IsEmpty())
556 text = base.c_altName;
562 if (array.Length > 1)
571 if (isEquipmentOrRangedOrAmmo && base.IsIdentified && base.rarity >=
Rarity.Legendary)
573 if (base.rarity !=
Rarity.Artifact && !base.material.GetTextArray(
"altName").IsEmpty())
575 text = base.material.GetTextArray(
"altName")[0] + Lang.space + text;
579 if (
source.naming ==
"m" || (
source.naming ==
"ms" && base.material !=
source.DefaultMaterial))
581 if (isEquipmentOrRangedOrAmmo)
583 string[] textArray = base.material.GetTextArray(
"altName");
584 if (textArray !=
null && textArray.Length >= 2)
586 text = base.material.GetTextArray(
"altName")[1] + Lang.space + text;
590 text =
"_of2".lang(base.material.GetName(), text);
595 string idUnknown =
source.GetText(
"unknown");
596 if (idUnknown.StartsWith(
"#"))
600 idUnknown =
Lang.
GetList(idUnknown.Remove(0, 1)).RandomItem();
608 text =
"_halfeaten".lang(text);
610 if (base.c_bill != 0)
612 text =
"_of".lang(
Lang.
_currency(base.c_bill, showUnit:
true, 0), text);
617 text =
Lang.
GetList((base.category.id ==
"fish") ?
"quality_fish" :
"quality_general")[Mathf.Clamp(base.tier, 0, 3)] + text;
627 if (!base.c_refText.IsEmpty())
629 text =
"_named".lang(base.c_refText, text);
631 if (base.IsIdentified)
635 if ((base.IsMeleeWeapon || base.IsRangedWeapon || base.IsAmmo || hIT != 0 || dMG != 0) && source.offense.Length != 0)
638 if (
source.offense[0] != 0)
640 text7 = text7 +
source.offense[0] +
"d" + base.c_diceDim;
644 text7 += ((base.IsMeleeWeapon || base.IsRangedWeapon || base.IsAmmo) ? dMG.ToText() : (dMG.ToString() ??
""));
648 text7 = text7 + ((dMG != 0 ||
source.offense[0] != 0) ?
", " :
"") + hIT;
650 text2 = text2 +
" (" + text7.IsEmpty(
" - ") +
") ";
654 if (dV != 0 || pV != 0)
657 text2 = text2 + dV +
", " + pV;
662 text2 = text2 +
" " +
"itemCharges".lang(base.c_charges.ToString() ??
"");
665 else if (base.c_IDTState == 3 || base.c_IDTState == 1)
667 text2 = Lang.space +
"(" + base.TextRarity.ToTitleCase() +
")";
671 text =
"rotten".lang() + text;
673 else if (base.IsRotting)
675 text =
"rotting".lang() + text;
677 if (base.IsIdentified)
679 if (base.blessedState != 0)
681 text4 = (
"bs" + base.blessedState).lang();
688 text = (isEquipmentOrRangedOrAmmo ? text.Bracket(3) : text);
694 if (isEquipmentOrRangedOrAmmo)
698 sig = AliasGen.GetRandomAlias().Bracket((base.rarity ==
Rarity.Mythical) ? 3 : 2);
700 sig = Lang.space + sig;
707 if (base.category.tag.Contains(
"enc"))
709 if (base.c_altName.IsEmpty())
712 text =
"_qualityFurniture".lang(list[Mathf.Clamp(base.encLV - 1, 0, list.Length - 1)], text);
717 sig = sig + Lang.space + ((base.encLV > 0) ? (
"+" + base.encLV) : (base.encLV.ToString() ??
""));
720 if (base.c_lockLv != 0 && base.c_revealLock)
722 sig = sig + Lang.space +
"+" + base.c_lockLv;
724 if (base.isLostProperty)
726 text =
"_lostproperty".lang(text);
730 text5 +=
"equippedItem".lang();
734 string text8 = base.c_note;
735 if (text8.StartsWith(
'@'))
737 text8 =
Lang.
Note.map.TryGetValue(text8.TrimStart(
'@'))?.GetText(
"text") ?? base.c_note;
739 string text9 = (base.category.IsChildOf(
"book") ?
"_written" :
"_engraved");
740 if (
id ==
"grave_dagger1" ||
id ==
"grave_dagger2")
742 text9 =
"_daggerGrave";
744 text = ((!text8.Contains(
"_bracketLeft".lang())) ? text9.lang(text8, text) : (text9 +
"Alt").lang(text8, text));
746 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))));
747 if (base.rarity >=
Rarity.Legendary)
749 text = text.ToTitleCase(wholeText:
true);
758 text5 =
"_limitedStock".lang(text5);
760 return text5 + text3 + text + sig + text2 + text10;
764 if (
source.naming ==
"ma")
766 text = base.material.GetName();
770 if (!base.c_idRefCard.IsEmpty() && trait.RefCardName !=
RefCardName.None)
772 string text11 = base.c_altName.IsEmpty(base.refCard.GetName());
773 if (!base.c_idRefCard2.IsEmpty())
775 text11 =
"_and".lang(text11, base.c_altName2.IsEmpty(base.refCard2.GetName()));
777 if (!(text11 ==
"*r"))
779 text = ((!
source.name2.IsEmpty()) ?
source.GetTextArray(
"name2")[0].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)))));
783 string text12 = base.refCard.GetText(
"aka");
784 if (!text12.IsEmpty())
786 text =
"_of".lang(text12, text);
796 text = text +
" <size=14>(" +
Lang.
_weight(base.ChildrenAndSelfWeight) +
")</size> ";
799 text += Environment.NewLine;
800 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;
802 string hoverText = trait.GetHoverText();
803 if (!hoverText.IsEmpty())
805 text = text + Environment.NewLine + hoverText;
807 return base.GetHoverText() + text;
815 if (things.Count > 0)
817 text +=
"childCount".lang(things.Count.ToString() ??
"");
819 else if (trait.CanOpenContainer)
821 text +=
"empty".lang();
826 Room room = pos.cell.room;
837 List<Element> list =
new List<Element>();
838 if (base.ShowFoodEnc)
840 foreach (
Element value
in elements.dict.Values)
848 if (limit && list.Count > 5)
850 int num = list.Count - 5;
851 for (
int i = 0; i < num; i++)
853 list.RemoveAt(list.Count - 1);
862 List<Element> list = ListLimitedValidTraits(limit);
863 bool showFoodEnc = base.ShowFoodEnc;
867 foreach (
Element value
in elements.dict.Values)
875 foreach (
Element value2
in elements.dict.Values)
887 if (sourceCard.
_origin ==
"dish")
895 bool showEQStats = base.IsEquipmentOrRangedOrAmmo;
897 bool flag2 = base.IsIdentified || flag;
899 if (base.rarity ==
Rarity.Legendary || base.rarity ==
Rarity.Mythical)
901 string text4 = (text3.Contains(
"『") ?
"『" : (text3.Contains(
"《") ?
"《" :
""));
904 string[] array = text3.Split(text4);
905 text3 = array[0] + Environment.NewLine + text4 + array[1];
912 text3 = recipe.GetName();
914 if (trait.CraftNum > 1)
916 text3 = text3 +
" x " + trait.CraftNum;
929 uIItem.
image2.Rect().pivot =
new Vector2(0.5f, 0.5f);
930 string text5 = base.Num.ToFormat() ??
"";
931 string text6 = (Mathf.Ceil(0.01f * (
float)base.ChildrenAndSelfWeight) * 0.1f).ToString(
"F1") +
"s";
932 if (things.Count > 0)
934 text5 = text5 +
" (" + things.Count +
")";
936 if (base.ChildrenAndSelfWeight != SelfWeight)
938 text6 = text6 +
" (" + (Mathf.Ceil(0.01f * (
float)SelfWeight) * 0.1f).ToString(
"F1") +
"s)";
940 text3 =
"_quantity".lang(text5 ??
"", text6);
943 text3 = text3 +
" " +
"_recipe_lv".lang(recipe.RecipeLv.ToString() ??
"");
946 if (showEQStats && flag2)
949 if (DV != 0 || PV != 0 || base.HIT != 0 || base.DMG != 0 || Penetration != 0)
953 text3 = text3 +
"DMG".lang() + ((base.DMG > 0) ?
"+" :
"") + base.DMG +
", ";
957 text3 = text3 +
"HIT".lang() + ((base.HIT > 0) ?
"+" :
"") + base.HIT +
", ";
961 text3 = text3 +
"DV".lang() + ((DV > 0) ?
"+" :
"") + DV +
", ";
965 text3 = text3 +
"PV".lang() + ((PV > 0) ?
"+" :
"") + PV +
", ";
967 if (Penetration != 0)
969 text3 = text3 +
"PEN".lang() + ((Penetration > 0) ?
"+" :
"") + Penetration +
"%, ";
971 text3 = text3.TrimEnd(
' ').TrimEnd(
',');
973 if (!text3.IsEmpty())
975 n.
AddText(
"NoteText_eqstats", text3);
979 n.
AddText(
"NoteText_eqstats",
"tip_range".lang(traitToolRange.BestDist.ToString() ??
""));
987 int totalQuality = GetTotalQuality();
988 int totalQuality2 = GetTotalQuality(applyBonus:
false);
989 text7 = text7 +
"Lv. " + base.LV +
" TQ. " + GetTotalQuality() + ((totalQuality == totalQuality2) ?
"" : (
" (" + totalQuality2 +
")"));
993 text7 = text7 + (text7.IsEmpty() ?
"" :
" ") +
"_nutrition".lang(Evalue(10).ToFormat() ??
"");
995 if ((base.category.IsChildOf(
"throw") || base.category.IsChildOf(
"resource") || trait.IsTool) && !(trait is
TraitAbility))
997 text7 = text7 + (text7.IsEmpty() ?
"" :
" ") +
"_hardness".lang(base.material.hardness.ToString() ??
"");
1001 text7 = text7 + (text7.IsEmpty() ?
"" :
" ") +
"_max_quality".lang(recipe.GetQualityBonus().ToString() ??
"");
1003 if (!text7.IsEmpty())
1005 n.
AddText(
"NoteText_eqstats", text7);
1009 string detail = GetDetail();
1010 if (!detail.IsEmpty())
1012 LayoutElement component = n.
AddText(
"NoteText_flavor", detail).GetComponent<LayoutElement>();
1015 component.preferredWidth = 400f;
1023 n.
AddText(
"NoteText_flavor", traitBookPlan.
source.GetDetail());
1026 if (traitAbility !=
null)
1037 n.
AddText(
"(id:" +
id +
" tile:" + (source.
tiles.IsEmpty() ?
"-" : ((
object)source.
tiles[0]))?.ToString() +
") lv:" + base.LV +
" price:" + GetPrice());
1039 Card root = GetRootCard();
1048 AddText(
"isCategorized".lang(base.category.GetText()),
FontColor.Default);
1049 if (base.category.skill != 0)
1051 int key = base.category.skill;
1053 if (base.IsRangedWeapon && !base.IsMeleeWeapon)
1061 if (Evalue(482) > 0)
1068 if (base.IsContainer)
1070 AddText(
"isContainer".lang(things.MaxCapacity.ToString() ??
""),
FontColor.Default);
1072 if (base.c_lockLv != 0)
1074 AddText((base.c_lockedHard ?
"isLockedHard" :
"isLocked").lang(base.c_lockLv.ToString() ??
""),
FontColor.Warning);
1076 if (base.isCrafted && recipe ==
null)
1078 AddText(
"isCrafted".lang(),
FontColor.Default);
1080 if (trait.Decay > 0)
1083 text8 = (base.IsDecayed ?
"isRotten" : (base.IsRotting ?
"isRotting" : ((!base.IsFresn) ?
"isNotFresh" :
"isFresh")));
1084 AddText(text8.lang(),
FontColor.Default);
1088 AddText(
"isDyed".lang(base.DyeMat.GetName() ??
""),
FontColor.Default);
1090 if (base.IsEquipment)
1092 text3 =
"isEquipable".lang(
Element.
Get(base.category.slot).GetText());
1095 if (base.isFireproof)
1097 AddText(
"isFreproof",
FontColor.Default);
1099 if (base.isAcidproof)
1101 AddText(
"isAcidproof",
FontColor.Default);
1103 if (trait.OriginalElectricity > 0)
1105 AddText(
"isGenerateElectricity".lang(trait.OriginalElectricity.ToString() ??
""),
FontColor.Default);
1107 if (trait.OriginalElectricity < 0)
1109 AddText(
"isConsumeElectricity".lang(Mathf.Abs(trait.OriginalElectricity).ToString() ??
""),
FontColor.Default);
1113 AddText(
"isPrecious",
FontColor.Default);
1119 if (flag && HasTag(
CTAG.noMix))
1123 if (!trait.CanBeDestroyed)
1125 AddText(
"isIndestructable",
FontColor.Default);
1127 if (GetInt(107) > 0)
1135 if (!base.c_idDeity.IsEmpty())
1140 if (base.isGifted && GetRoot() !=
EClass.
pc)
1144 if (base.isNPCProperty)
1146 AddText(
"isNPCProperty",
FontColor.Ether);
1148 if (base.c_priceFix != 0)
1150 AddText(((base.c_priceFix > 0) ?
"isPriceUp" :
"isPriceDown").lang(Mathf.Abs(base.c_priceFix).ToString() ??
""),
FontColor.Ether);
1156 if (trait.IsOnlyUsableByPc)
1158 AddText(
"isOnlyUsableByPC",
FontColor.Ether);
1164 if (base.c_isImportant)
1166 AddText(
"isMarkedImportant",
FontColor.Ether);
1168 if (GetInt(25) != 0)
1170 AddText(
"isDangerLv".lang((GetInt(25) + 1).ToString() ??
"", (
EClass.
pc.
FameLv + 10).ToString() ??
""),
FontColor.Default);
1175 if (HasElement(220))
1177 AddText(
"canMine".lang(), col2);
1179 if (HasElement(225))
1181 AddText(
"canLumberjack".lang(), col2);
1182 AddText(
"canLumberjack2".lang(), col2);
1184 if (HasElement(230))
1186 AddText(
"canDig", col2);
1188 if (HasElement(286))
1190 AddText(
"canFarm", col2);
1192 if (HasElement(245))
1194 AddText(
"canFish", col2);
1196 if (HasElement(237))
1198 AddText(
"canTame", col2);
1203 AddText(
"canPlayMusic".lang(), col2);
1205 if (
Lang.
Has(
"hint_" + trait.ToString()))
1207 AddText(
"hint_" + trait.ToString(),
FontColor.Util);
1209 if (
Lang.
Has(
"hint_" + trait.ToString() +
"2"))
1211 AddText(
"hint_" + trait.ToString() +
"2",
FontColor.Util);
1213 if (HasTag(
CTAG.tourism))
1217 string langPlaceType = base.TileType.LangPlaceType;
1218 if (langPlaceType ==
"place_Door" || langPlaceType ==
"place_WallMount")
1220 AddText(base.TileType.LangPlaceType +
"_hint".lang(),
FontColor.Util);
1222 if (trait.IsHomeItem)
1224 AddText(
"isHomeItem".lang(),
FontColor.Util);
1226 if (HasTag(
CTAG.throwWeapon))
1228 AddText(
"isThrowWeapon",
FontColor.Default);
1232 AddText(
"isThrowWeaponEnemy",
FontColor.Default);
1236 AddText(
"isNoProcessIng",
FontColor.Default);
1244 AddText(
"isLeftoverable",
FontColor.Default);
1246 if (HasTag(
CTAG.rareResource))
1248 AddText(
"isRareResource",
FontColor.Great);
1252 AddText(
"isBed".lang(traitBed.MaxHolders.ToString() ??
""),
FontColor.Default);
1254 bool showAsEquipment = base.IsEquipmentOrRangedOrAmmo || base.IsThrownWeapon || trait is
TraitToolMusic;
1255 bool showTraits = !showAsEquipment || base.ShowFoodEnc;
1257 List<Element> listTrait = ListValidTraits(isCraft:
false, !infoMode);
1258 List<Element> list = ListValidTraits(isCraft:
false, limit:
false);
1259 if (list.Count - listTrait.Count <= 1)
1265 Element element = elements.GetElement(653);
1266 if (element !=
null)
1268 AddText(
"isAlive".lang(element.
vBase.ToString() ??
"", (element.
vExp / 10).ToString() ??
"", (element.
ExpToNext / 10).ToString() ??
""),
FontColor.Great);
1270 string[] rangedSubCats =
new string[2] {
"eleConvert",
"eleAttack" };
1271 elements.AddNote(n, delegate(
Element e)
1273 if (!showAsEquipment && !e.
HasTag(
"itemEnc"))
1281 if (e.
IsTrait || (showTraits && listTrait.Contains(e)))
1287 if (e.source.tag.Contains(
"weaponEnc") && !base.IsWeapon && !base.IsRangedWeapon && !base.IsAmmo && !base.IsThrownWeapon && !(trait is TraitToolMusic))
1291 if (e.
source.IsWeaponEnc && !base.category.IsChildOf(
"shield") && !base.IsWeapon && !base.IsRangedWeapon && !base.IsAmmo && !base.IsThrownWeapon && !(trait is
TraitToolMusic))
1296 return (!showEQStats || (e.
id != 64 && e.
id != 65 && e.
id != 66 && e.
id != 67)) ?
true :
false;
1304 if (e.
source.IsWeaponEnc && (!e.
source.tag.Contains(
"modRanged") || e.
id == 609) && isEquipped && root.
isChara)
1307 if (num4 != 482 && (uint)(num4 - 660) > 2u && num4 != 666)
1312 string text13 =
" (" + e.Value + ((e.Value == num3) ?
"" : (
" → " + num3)) +
")";
1313 string text14 =
"_bracketLeft3".lang() + e.Name +
"_bracketRight3".lang();
1314 return s + text13 +
" " + text14;
1316 if (sockets !=
null)
1318 foreach (
int socket
in sockets)
1320 AddText((socket == 0) ?
"emptySocket".lang() :
"socket".lang(
EClass.
sources.
elements.map[socket / 1000].GetName(), (socket % 1000).ToString() ??
""),
FontColor.Gray);
1324 trait.WriteNote(n, flag2);
1332 if (listTrait.Count != list.Count)
1334 AddText(
"traitOther".lang((list.Count - listTrait.Count).ToString() ??
""),
FontColor.Default);
1337 if (base.c_mixedFoodData !=
null)
1339 n.AddHeader(
"isMixedFood");
1340 foreach (
string text15
in base.c_mixedFoodData.texts)
1342 AddText(
"_bullet".lang() + text15 + text2,
FontColor.Default);
1348 AddText(
"isUnidentified".lang(),
FontColor.Flavor);
1349 if (base.c_IDTState == 1)
1351 AddText(
"isUnidentified2".lang(),
FontColor.Flavor);
1356 n.AddHeader(
"HeaderAdditionalTrait",
"additional_trait");
1364 n.AddText(
"decay:" + base.decay);
1365 n.AddText(base.isDyed +
"/" +
id +
"/" + base.refVal +
"/" + base.LV +
"/" + trait);
1366 if (source.
origin !=
null)
1371 if (
id ==
"statue_weird")
1373 AddText(
"weirdStatue",
FontColor.Default);
1377 AddText(
"isReplica",
FontColor.Passive);
1386 if (base.c_equippedSlot != 0 && base.category.slot == 35 && chara !=
null)
1388 AddAttackEvaluation(n, chara,
this);
1390 if (base.IsThrownWeapon || base.IsRangedWeapon || (base.IsMeleeWeapon && base.c_equippedSlot == 0))
1392 n.AddHeader(
"headerAttackEval");
1395 text9 = text9.TagColor(() =>
true);
1399 if (base.ammoData !=
null)
1401 n.AddHeader(
"headerAttackAmmo");
1402 n.AddText(base.ammoData.Name);
1404 onWriteNote?.Invoke(n);
1407 AddText(
"isProductWarning",
FontColor.Default);
1415 foreach (
Element value
in elements.dict.Values)
1421 void AddText(
string text,
FontColor col)
1423 n.AddText(
"NoteText_enc", text, col);
1425 void AddTextWithIcon(
string text, Sprite sprite,
FontColor col)
1427 UIItem uIItem2 = n.AddText(
"NoteText_enc", text, col);
1428 uIItem2.
image1.SetActive(enable:
true);
1429 uIItem2.image1.sprite = sprite;
1431 string GetTextTrait(
Element e)
1433 string text10 = e.
source.GetText(
"textExtra");
1434 if (text10.IsEmpty())
1440 text10 = text10.Replace(
"#1",
$"{0.1f * (float)(e.Value + 10):F1}");
1445 int num = recipe.GetQualityBonus() / 10;
1450 text11 =
"qualityLimit".lang(num.ToString() ??
"");
1452 int num2 = e.Value / 10;
1453 num2 = ((e.Value < 0) ? (num2 - 1) : (num2 + 1));
1454 string text12 = num2.ToString() ??
"";
1457 text12 = (int)((
float)num2 * 0.1f * (float)(Evalue(710) + 10)) +
" (" + num2 +
")";
1459 text10 =
"Lv." + text12 + text11 +
" " + text10;
1462 text10 +=
"traitAdditive".lang();
1464 return (
" <size=12>" + text10 +
"</size>").TagColor(
FontColor.Passive);
1480 if (slot.
thing == current)
1482 text = text.TagColor(() =>
true);
1491 text2 = text2.TagColor(() =>
true);
1498 p.matColor = base.colorInt;
1499 p.mat = base.material;
1500 if (!renderer.usePass)
1504 switch (trait.tileMode)
1507 if (source.
_altTiles.Length != 0 && trait.UseAltTiles)
1509 p.tile = source.
_altTiles[base.dir % source.
_altTiles.Length] * ((!flipX) ? 1 : (-1));
1513 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1518 p.color += 1572864f;
1524 if (source.
_altTiles.Length != 0 && trait.UseAltTiles)
1526 p.tile = source.
_altTiles[base.dir % source.
_altTiles.Length] * ((!flipX) ? 1 : (-1));
1530 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1532 if (animeCounter > 0f && source.
anime.Length != 0)
1534 animeCounter += Time.deltaTime;
1535 int num3 = (int)(animeCounter / (0.001f * (
float)source.
anime[1]));
1536 if (num3 > ((source.
anime.Length > 2) ? source.
anime[2] : source.
anime[0]))
1542 p.tile += num3 % source.
anime[0] * ((!flipX) ? 1 : (-1));
1547 if (base.isOn || base.isRoofItem)
1549 int num4 = (int)((
float)base.uid + Time.realtimeSinceStartup * 5f);
1550 int num5 = (int)(Time.realtimeSinceStartup * 5f);
1551 p.tile = (sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] + num4 % 3 + 1) * ((!flipX) ? 1 : (-1));
1556 else if (num5 % 11 == 0)
1562 p.color = 13107200f;
1567 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1571 if (source.
_altTiles.Length != 0 && trait.UseAltTiles)
1573 p.tile = source.
_altTiles[base.dir % source.
_altTiles.Length] * ((!flipX) ? 1 : (-1));
1577 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1579 if (parent is
Zone && pos.cell.HasFullBlock)
1581 p.tile += ((p.tile < 0f) ? (-64) : 64);
1585 p.tile += ((!(p.tile < 0f)) ? 1 : (-1));
1590 if (source.
_altTiles.Length != 0 && trait.UseAltTiles)
1592 p.tile = source.
_altTiles[base.dir % source.
_altTiles.Length] * ((!flipX) ? 1 : (-1));
1596 p.tile = sourceCard.
_tiles[base.dir % sourceCard.
_tiles.Length] * ((!flipX) ? 1 : (-1));
1598 float time = Time.realtimeSinceStartup;
1606 if (source.
anime.Length == 0 || !trait.IsAnimeOn)
1610 if (source.
anime.Length > 2)
1612 int num = (int)(time * 1000f / (
float)source.
anime[1] % (float)source.
anime[2]);
1613 if (num == source.
anime[0] - 1 && source.
anime.Length > 3)
1615 PlaySound(
"anime_sound" + source.
anime[3]);
1617 if (num < source.
anime[0])
1619 p.tile += num * ((!(p.tile < 0f)) ? 1 : (-1));
1624 int num2 = (int)(time * 1000f / (
float)source.
anime[1] % (float)source.
anime[0]);
1625 p.tile += num2 * ((!(p.tile < 0f)) ? 1 : (-1));
1630 if (trait.IdSkin != 0 && sourceCard.
skins.Length != 0)
1632 int num6 = sourceCard.
skins.TryGet(trait.IdSkin - 1);
1634 p.tile += ((p.tile < 0f) ? (-num6) : num6);
1643 if (!renderer.data.subCrate.enable)
1647 return renderer.data.subCrate;
1670 if (!trait.CanStackTo(to))
1674 if (base.noSell != to.
noSell || base.isCopy != to.
isCopy)
1702 if (trait.IsRequireFuel && base.c_charges != to.
c_charges)
1710 if (base.Num + to.
Num <= 0)
1718 if (windowSaveData !=
null && windowSaveData.
compress)
1725 if (base.encLV != to.
encLV && !base.IsFood)
1733 foreach (
Element value
in elements.dict.Values)
1740 int num2 = (to.encLV = Mathf.CeilToInt(1f * (
float)(base.encLV * base.Num + to.encLV * to.
Num) / (
float)(base.Num + to.
Num)));
1742 foreach (
Element value2
in elements.dict.Values)
1745 value2.vBase = (element.vBase = (value2.vBase * base.Num + element.vBase * to.
Num) / (base.Num + to.
Num));
1749 if (base.encLV != to.
encLV)
1757 foreach (
Element value3
in elements.dict.Values)
1759 Element element2 = to.elements.GetElement(value3.
id);
1760 if (element2 ==
null || value3.
vBase / 10 * 10 != element2.
vBase / 10 * 10)
1770 if (ing.CanSetThing(
this))
1774 if (things.Count <= 0 || base.c_lockLv != 0 || base.isNPCProperty)
1778 foreach (
Thing thing
in things)
1790 if (GetRootCard().Dist(
EClass.
pc) > 1 || !ing.CanSetThing(
this))
1813 bool buy = trans !=
null;
1815 UIItem itemSlider =
null;
1824 }, 1f, base.Num, isInt:
true, hideOther:
false, useInput:
true).GetComponent<UIItem>();
1827 buttonBuy = i.
AddButton(
"invBuy", delegate
1832 i.onDestroy = delegate
1834 if ((!buy || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) && !i.
wasCanceled)
1840 if ((
bool)buttonBuy)
1842 buttonBuy.gameObject.AddComponent<CanvasGroup>();
1849 Debug.Log(
"Split bug1");
1853 Debug.Log(
"Split bug2");
1857 Debug.Log(
"Split bug3");
1859 else if (count != 0 && !Input.GetMouseButton(1))
1863 trans.Process(startTransaction:
true);
1868 if (count != base.Num)
1872 thing.invX = dragItemCard.
from.
invX;
1873 thing.invY = dragItemCard.
from.
invY;
1883 itemSlider.text1.text = GetName(
NameStyle.FullNoArticle, 1);
1884 itemSlider.text2.text =
Lang.
_weight(SelfWeight * count);
1885 if ((
bool)buttonBuy)
1887 buttonBuy.mainText.SetText(trans.GetTextDetail());
1888 buttonBuy.mainText.RebuildLayoutTo<
UIButton>();
1889 buttonBuy.interactable = trans.IsValid();
1890 buttonBuy.RebuildLayout(recursive:
true);
1891 buttonBuy.gameObject.GetComponent<CanvasGroup>().alpha = (trans.IsValid() ? 1f : 0.9f);
1901 UIItem itemSlider =
null;
1906 }, 1f, base.Num, isInt:
true, hideOther:
false, useInput:
true).GetComponent<UIItem>();
1907 buttonBuy = i.
AddButton(
"invBuy", delegate
1911 i.onDestroy = delegate
1913 if ((Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) && !i.
wasCanceled)
1919 if ((
bool)buttonBuy)
1921 buttonBuy.gameObject.AddComponent<CanvasGroup>();
1928 Debug.Log(
"Split bug1");
1932 Debug.Log(
"Split bug2");
1936 Debug.Log(
"Split bug3");
1938 else if (count != 0 && !Input.GetMouseButton(1))
1940 onSplit?.Invoke(count);
1945 itemSlider.text1.text = GetName(
NameStyle.FullNoArticle, 1);
1946 itemSlider.text2.text =
Lang.
_weight(SelfWeight * count);
1949 buttonBuy.interactable =
true;
1950 buttonBuy.RebuildLayout(recursive:
true);
1979 if ((!
neg || !row.tag.Contains(
"flag")) && func(row) && row.LV < num2)
1993 num4 +=
item.chance;
1997 bool flag = text ==
"skill" || text ==
"attribute" || text ==
"resist";
1998 float num5 = 3f + Mathf.Min(lv / 10, 15f) + Mathf.Sqrt(lv *
item.encFactor / 100);
1999 int num6 = (item.mtp +
EClass.
rnd(
item.mtp + (
int)num5)) / item.mtp * ((!(flag &&
neg)) ? 1 : (-1));
2000 if (
item.encFactor == 0 && num6 > 25)
2012 if (!base.IsEquipment || base.IsCursed || base.rarity <=
Rarity.Normal || GetInt(107) > 0)
2022 c.
Say(
"lick", c,
this);
2023 PlaySound(
"offering");
2024 PlayEffect(
"mutation");
2026 Element element = AddEnchant(base.LV);
2027 if (element !=
null)
2029 SetInt(107, element.
id);
2035 List<Element> list =
new List<Element>();
2036 foreach (
Element value
in elements.dict.Values)
2038 if (value.
id != 67 && value.
id != 66 && value.
id != 64 && value.
id != 65)
2045 Element element2 = list.RandomItem();
2046 elements.ModBase(element2.
id, Mathf.Max(
EClass.
rnd(Mathf.Abs(element2.
vBase / 5)), 1));
2047 SetInt(107, element2.
id);
2051 c.
Say(
"lick2", c, tg, slot.
name.ToLower());
2052 tg.PlaySound(
"offering");
2053 tg.PlayEffect(
"mutation");
2061 if (base.IsToolbelt || base.IsLightsource)
2066 if (enchant ==
null)
2070 return elements.ModBase(enchant.Item1.id, enchant.Item2);
2079 if (base.IsIdentified)
2087 @ref = GetName(
NameStyle.Full, base.Num);
2089 Rarity rarity = idtSource
switch
2091 IDTSource.SkillHigh =>
Rarity.Legendary,
2092 IDTSource.Skill =>
Rarity.Superior,
2095 if (rarity != 0 && ((base.IsEquipmentOrRangedOrAmmo && base.rarity >= rarity) || base.rarity >=
Rarity.Mythical))
2097 base.c_IDTState = 3;
2099 else if (base.rarity >=
Rarity.Mythical && idtSource !=
IDTSource.SuperiorIdentify)
2101 base.c_IDTState = 1;
2105 base.c_IDTState = 0;
2109 text = GetName(
NameStyle.Full, base.Num);
2110 if (base.c_IDTState == 0)
2112 Msg.
Say(
"identified", @ref, text);
2116 Msg.
Say((idtSource ==
IDTSource.Skill) ?
"identified3" :
"identified2", @ref, text, base.TextRarity);
2119 if (base.IsIdentified)
2121 GetRootCard()?.TryStack(
this);
2131 DNA dNA = base.c_DNA;
2136 for (
int i = 0; i < dNA.
vals.Count; i += 2)
2139 if (row.
name.ToLower().Contains(s))
2143 if (row.
GetName().ToLower().Contains(s))
2151 if (!base.IsIdentified)
2155 foreach (
Element value
in elements.dict.Values)
2157 if (value.
Value != 0)
2159 if (value.
source.name.ToLower().Contains(s))
2163 if (value.
source.GetName().ToLower().Contains(s))
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
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)
string GetStr(int id, string defaultStr=null)
int GetInt(int id, int? defaultInt=null)
BlessedState? blesstedState
ElementContainerCard elements
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 ApplySocket(Thing t)
virtual void SetBlessedState(BlessedState s)
BlessedState blessedState
int ChildrenAndSelfWeight
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 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)
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 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)