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

◆ TryPurchasing()

static bool Terraria.Player.TryPurchasing ( long price,
List< Item[]> inv,
List< Point > slotCoins,
List< Point > slotsEmpty,
List< Point > slotEmptyBank,
List< Point > slotEmptyBank2,
List< Point > slotEmptyBank3,
List< Point > slotEmptyBank4 )
inlinestaticprivate

Definition at line 34242 of file Player.cs.

34243 {
34244 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
34245 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
34246 //IL_003c: Unknown result type (might be due to invalid IL or missing references)
34247 //IL_0048: Unknown result type (might be due to invalid IL or missing references)
34248 //IL_0065: Unknown result type (might be due to invalid IL or missing references)
34249 //IL_0068: Unknown result type (might be due to invalid IL or missing references)
34250 //IL_0074: Unknown result type (might be due to invalid IL or missing references)
34251 //IL_0089: Unknown result type (might be due to invalid IL or missing references)
34252 //IL_0095: Unknown result type (might be due to invalid IL or missing references)
34253 //IL_0612: Unknown result type (might be due to invalid IL or missing references)
34254 //IL_0623: Unknown result type (might be due to invalid IL or missing references)
34255 //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
34256 //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
34257 //IL_00e7: Unknown result type (might be due to invalid IL or missing references)
34258 //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
34259 //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
34260 //IL_00f1: Unknown result type (might be due to invalid IL or missing references)
34261 //IL_00fe: Unknown result type (might be due to invalid IL or missing references)
34262 //IL_010a: Unknown result type (might be due to invalid IL or missing references)
34263 //IL_0356: Unknown result type (might be due to invalid IL or missing references)
34264 //IL_0360: Unknown result type (might be due to invalid IL or missing references)
34265 //IL_0386: Unknown result type (might be due to invalid IL or missing references)
34266 //IL_056b: Unknown result type (might be due to invalid IL or missing references)
34267 //IL_0393: Unknown result type (might be due to invalid IL or missing references)
34268 //IL_0575: Unknown result type (might be due to invalid IL or missing references)
34269 //IL_01a8: Unknown result type (might be due to invalid IL or missing references)
34270 //IL_01ad: Unknown result type (might be due to invalid IL or missing references)
34271 //IL_01af: Unknown result type (might be due to invalid IL or missing references)
34272 //IL_0580: Unknown result type (might be due to invalid IL or missing references)
34273 //IL_01be: Unknown result type (might be due to invalid IL or missing references)
34274 //IL_01ca: Unknown result type (might be due to invalid IL or missing references)
34275 //IL_01e2: Unknown result type (might be due to invalid IL or missing references)
34276 //IL_01ee: Unknown result type (might be due to invalid IL or missing references)
34277 //IL_03af: Unknown result type (might be due to invalid IL or missing references)
34278 //IL_03b4: Unknown result type (might be due to invalid IL or missing references)
34279 //IL_03b6: Unknown result type (might be due to invalid IL or missing references)
34280 //IL_03c5: Unknown result type (might be due to invalid IL or missing references)
34281 //IL_03d1: Unknown result type (might be due to invalid IL or missing references)
34282 //IL_03e9: Unknown result type (might be due to invalid IL or missing references)
34283 //IL_03f5: Unknown result type (might be due to invalid IL or missing references)
34284 //IL_0251: Unknown result type (might be due to invalid IL or missing references)
34285 //IL_025d: Unknown result type (might be due to invalid IL or missing references)
34286 //IL_02a3: Unknown result type (might be due to invalid IL or missing references)
34287 //IL_02ac: Unknown result type (might be due to invalid IL or missing references)
34288 //IL_02be: Unknown result type (might be due to invalid IL or missing references)
34289 //IL_02d7: Unknown result type (might be due to invalid IL or missing references)
34290 //IL_02e9: Unknown result type (might be due to invalid IL or missing references)
34291 //IL_0302: Unknown result type (might be due to invalid IL or missing references)
34292 //IL_0314: Unknown result type (might be due to invalid IL or missing references)
34293 //IL_0329: Unknown result type (might be due to invalid IL or missing references)
34294 //IL_032e: Unknown result type (might be due to invalid IL or missing references)
34295 //IL_027c: Unknown result type (might be due to invalid IL or missing references)
34296 //IL_0288: Unknown result type (might be due to invalid IL or missing references)
34297 //IL_0298: Unknown result type (might be due to invalid IL or missing references)
34298 //IL_0458: Unknown result type (might be due to invalid IL or missing references)
34299 //IL_0464: Unknown result type (might be due to invalid IL or missing references)
34300 //IL_04aa: Unknown result type (might be due to invalid IL or missing references)
34301 //IL_04b3: Unknown result type (might be due to invalid IL or missing references)
34302 //IL_04c5: Unknown result type (might be due to invalid IL or missing references)
34303 //IL_04de: Unknown result type (might be due to invalid IL or missing references)
34304 //IL_04f0: Unknown result type (might be due to invalid IL or missing references)
34305 //IL_0509: Unknown result type (might be due to invalid IL or missing references)
34306 //IL_051b: Unknown result type (might be due to invalid IL or missing references)
34307 //IL_0530: Unknown result type (might be due to invalid IL or missing references)
34308 //IL_0535: Unknown result type (might be due to invalid IL or missing references)
34309 //IL_0483: Unknown result type (might be due to invalid IL or missing references)
34310 //IL_048f: Unknown result type (might be due to invalid IL or missing references)
34311 //IL_049f: Unknown result type (might be due to invalid IL or missing references)
34312 long num = price;
34314 bool result = false;
34315 Point item = default(Point);
34316 while (num > 0)
34317 {
34318 long num2 = 1000000L;
34319 for (int i = 0; i < 4; i++)
34320 {
34321 if (num >= num2)
34322 {
34323 foreach (Point slotCoin in slotCoins)
34324 {
34325 if (inv[slotCoin.X][slotCoin.Y].type == 74 - i)
34326 {
34327 long num3 = num / num2;
34328 dictionary[slotCoin] = inv[slotCoin.X][slotCoin.Y].Clone();
34329 if (num3 < inv[slotCoin.X][slotCoin.Y].stack)
34330 {
34331 inv[slotCoin.X][slotCoin.Y].stack -= (int)num3;
34332 }
34333 else
34334 {
34335 inv[slotCoin.X][slotCoin.Y].SetDefaults();
34336 slotsEmpty.Add(slotCoin);
34337 }
34338 num -= num2 * (dictionary[slotCoin].stack - inv[slotCoin.X][slotCoin.Y].stack);
34339 }
34340 }
34341 }
34342 num2 /= 100;
34343 }
34344 if (num <= 0)
34345 {
34346 continue;
34347 }
34348 if (slotsEmpty.Count > 0)
34349 {
34350 slotsEmpty.Sort(DelegateMethods.CompareYReverse);
34351 ((Point)(ref item))._002Ector(-1, -1);
34352 for (int j = 0; j < inv.Count; j++)
34353 {
34354 num2 = 10000L;
34355 for (int k = 0; k < 3; k++)
34356 {
34357 if (num >= num2)
34358 {
34359 foreach (Point slotCoin2 in slotCoins)
34360 {
34361 if (slotCoin2.X == j && inv[slotCoin2.X][slotCoin2.Y].type == 74 - k && inv[slotCoin2.X][slotCoin2.Y].stack >= 1)
34362 {
34363 List<Point> list = slotsEmpty;
34364 if (j == 1 && slotEmptyBank.Count > 0)
34365 {
34366 list = slotEmptyBank;
34367 }
34368 if (j == 2 && slotEmptyBank2.Count > 0)
34369 {
34370 list = slotEmptyBank2;
34371 }
34372 if (j == 3 && slotEmptyBank3.Count > 0)
34373 {
34374 list = slotEmptyBank3;
34375 }
34376 if (j == 4 && slotEmptyBank4.Count > 0)
34377 {
34378 list = slotEmptyBank4;
34379 }
34380 if (--inv[slotCoin2.X][slotCoin2.Y].stack <= 0)
34381 {
34382 inv[slotCoin2.X][slotCoin2.Y].SetDefaults();
34383 list.Add(slotCoin2);
34384 }
34385 dictionary[list[0]] = inv[list[0].X][list[0].Y].Clone();
34386 inv[list[0].X][list[0].Y].SetDefaults(73 - k);
34387 inv[list[0].X][list[0].Y].stack = 100;
34388 item = list[0];
34389 list.RemoveAt(0);
34390 break;
34391 }
34392 }
34393 }
34394 if (item.X != -1 || item.Y != -1)
34395 {
34396 break;
34397 }
34398 num2 /= 100;
34399 }
34400 for (int l = 0; l < 2; l++)
34401 {
34402 if (item.X != -1 || item.Y != -1)
34403 {
34404 continue;
34405 }
34406 foreach (Point slotCoin3 in slotCoins)
34407 {
34408 if (slotCoin3.X == j && inv[slotCoin3.X][slotCoin3.Y].type == 73 + l && inv[slotCoin3.X][slotCoin3.Y].stack >= 1)
34409 {
34411 if (j == 1 && slotEmptyBank.Count > 0)
34412 {
34414 }
34415 if (j == 2 && slotEmptyBank2.Count > 0)
34416 {
34418 }
34419 if (j == 3 && slotEmptyBank3.Count > 0)
34420 {
34422 }
34423 if (j == 4 && slotEmptyBank4.Count > 0)
34424 {
34426 }
34427 if (--inv[slotCoin3.X][slotCoin3.Y].stack <= 0)
34428 {
34429 inv[slotCoin3.X][slotCoin3.Y].SetDefaults();
34430 list2.Add(slotCoin3);
34431 }
34432 dictionary[list2[0]] = inv[list2[0].X][list2[0].Y].Clone();
34433 inv[list2[0].X][list2[0].Y].SetDefaults(72 + l);
34434 inv[list2[0].X][list2[0].Y].stack = 100;
34435 item = list2[0];
34436 list2.RemoveAt(0);
34437 break;
34438 }
34439 }
34440 }
34441 if (item.X != -1 && item.Y != -1)
34442 {
34443 slotCoins.Add(item);
34444 break;
34445 }
34446 }
34447 slotsEmpty.Sort(DelegateMethods.CompareYReverse);
34448 slotEmptyBank.Sort(DelegateMethods.CompareYReverse);
34449 slotEmptyBank2.Sort(DelegateMethods.CompareYReverse);
34450 slotEmptyBank3.Sort(DelegateMethods.CompareYReverse);
34451 slotEmptyBank4.Sort(DelegateMethods.CompareYReverse);
34452 continue;
34453 }
34454 foreach (KeyValuePair<Point, Item> item2 in dictionary)
34455 {
34456 inv[item2.Key.X][item2.Key.Y] = item2.Value.Clone();
34457 }
34458 result = true;
34459 break;
34460 }
34461 return result;
34462 }

References Terraria.DelegateMethods.CompareYReverse().

Referenced by Terraria.Player.PayCurrency().

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