TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ Click_RandomizePlayer()

void Terraria.GameContent.UI.States.UICharacterCreation.Click_RandomizePlayer ( UIMouseEvent evt,
UIElement listeningElement )
inlineprivate

Definition at line 1122 of file UICharacterCreation.cs.

1123 {
1124 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
1125 //IL_0052: Unknown result type (might be due to invalid IL or missing references)
1126 //IL_0057: Unknown result type (might be due to invalid IL or missing references)
1127 //IL_005f: Unknown result type (might be due to invalid IL or missing references)
1128 //IL_0064: Unknown result type (might be due to invalid IL or missing references)
1129 //IL_0069: Unknown result type (might be due to invalid IL or missing references)
1130 //IL_011d: Unknown result type (might be due to invalid IL or missing references)
1131 //IL_0122: Unknown result type (might be due to invalid IL or missing references)
1132 //IL_0127: Unknown result type (might be due to invalid IL or missing references)
1133 //IL_012d: Unknown result type (might be due to invalid IL or missing references)
1134 //IL_0132: Unknown result type (might be due to invalid IL or missing references)
1135 //IL_0137: Unknown result type (might be due to invalid IL or missing references)
1136 //IL_013d: Unknown result type (might be due to invalid IL or missing references)
1137 //IL_0142: Unknown result type (might be due to invalid IL or missing references)
1138 //IL_0147: Unknown result type (might be due to invalid IL or missing references)
1139 //IL_014d: Unknown result type (might be due to invalid IL or missing references)
1140 //IL_0152: Unknown result type (might be due to invalid IL or missing references)
1141 //IL_0157: Unknown result type (might be due to invalid IL or missing references)
1142 //IL_015d: Unknown result type (might be due to invalid IL or missing references)
1143 //IL_0162: Unknown result type (might be due to invalid IL or missing references)
1144 //IL_0167: Unknown result type (might be due to invalid IL or missing references)
1146 Player player = _player;
1147 int index = Main.rand.Next(Main.Hairstyles.AvailableHairstyles.Count);
1148 player.hair = Main.Hairstyles.AvailableHairstyles[index];
1149 player.eyeColor = ScaledHslToRgb(GetRandomColorVector());
1150 while (((Color)(ref player.eyeColor)).R + ((Color)(ref player.eyeColor)).G + ((Color)(ref player.eyeColor)).B > 300)
1151 {
1152 player.eyeColor = ScaledHslToRgb(GetRandomColorVector());
1153 }
1154 float num = (float)Main.rand.Next(60, 120) * 0.01f;
1155 if (num > 1f)
1156 {
1157 num = 1f;
1158 }
1159 ((Color)(ref player.skinColor)).R = (byte)((float)Main.rand.Next(240, 255) * num);
1160 ((Color)(ref player.skinColor)).G = (byte)((float)Main.rand.Next(110, 140) * num);
1161 ((Color)(ref player.skinColor)).B = (byte)((float)Main.rand.Next(75, 110) * num);
1162 player.hairColor = ScaledHslToRgb(GetRandomColorVector());
1163 player.shirtColor = ScaledHslToRgb(GetRandomColorVector());
1164 player.underShirtColor = ScaledHslToRgb(GetRandomColorVector());
1165 player.pantsColor = ScaledHslToRgb(GetRandomColorVector());
1166 player.shoeColor = ScaledHslToRgb(GetRandomColorVector());
1167 player.skinVariant = _validClothStyles[Main.rand.Next(_validClothStyles.Length)];
1168 switch (player.hair + 1)
1169 {
1170 case 5:
1171 case 6:
1172 case 7:
1173 case 10:
1174 case 12:
1175 case 19:
1176 case 22:
1177 case 23:
1178 case 26:
1179 case 27:
1180 case 30:
1181 case 33:
1182 case 34:
1183 case 35:
1184 case 37:
1185 case 38:
1186 case 39:
1187 case 40:
1188 case 41:
1189 case 44:
1190 case 45:
1191 case 46:
1192 case 47:
1193 case 48:
1194 case 49:
1195 case 51:
1196 case 56:
1197 case 65:
1198 case 66:
1199 case 67:
1200 case 68:
1201 case 69:
1202 case 70:
1203 case 71:
1204 case 72:
1205 case 73:
1206 case 74:
1207 case 79:
1208 case 80:
1209 case 81:
1210 case 82:
1211 case 84:
1212 case 85:
1213 case 86:
1214 case 87:
1215 case 88:
1216 case 90:
1217 case 91:
1218 case 92:
1219 case 93:
1220 case 95:
1221 case 96:
1222 case 98:
1223 case 100:
1224 case 102:
1225 case 104:
1226 case 107:
1227 case 108:
1228 case 113:
1229 case 124:
1230 case 126:
1231 case 133:
1232 case 134:
1233 case 135:
1234 case 144:
1235 case 146:
1236 case 147:
1237 case 163:
1238 case 165:
1239 player.Male = false;
1240 break;
1241 default:
1242 player.Male = true;
1243 break;
1244 }
1245 if (player.hair >= HairID.Count)
1246 {
1247 Player player2 = player;
1248 player2.Male = HairLoader.GetHair(player.hair).RandomizedCharacterCreationGender switch
1249 {
1250 Gender.Male => true,
1251 Gender.Female => false,
1252 Gender.Unspecified => Main.rand.NextBool(),
1253 _ => Main.rand.NextBool(),
1254 };
1255 }
1256 Click_CharClothStyle(null, null);
1259 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
void Click_CharClothStyle(UIMouseEvent evt, UIElement listeningElement)
static readonly int Count
Definition HairID.cs:19
static ModHair GetHair(int type)
Definition HairLoader.cs:21

References Terraria.GameContent.UI.States.UICharacterCreation._player, Terraria.GameContent.UI.States.UICharacterCreation._validClothStyles, Terraria.GameContent.UI.States.UICharacterCreation.Click_CharClothStyle(), Terraria.ID.HairID.Count, Terraria.Player.eyeColor, Terraria.ModLoader.HairLoader.GetHair(), Terraria.GameContent.UI.States.UICharacterCreation.GetRandomColorVector(), Terraria.Player.hair, Terraria.Main.Hairstyles, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, Terraria.GameContent.UI.States.UICharacterCreation.ScaledHslToRgb(), Terraria.Player.skinColor, Terraria.GameContent.UI.States.UICharacterCreation.UpdateColorPickers(), and Terraria.GameContent.UI.States.UICharacterCreation.UpdateSelectedGender().

Referenced by Terraria.GameContent.UI.States.UICharacterCreation.MakeClothStylesMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: