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

◆ AI_007_TownEntities()

void Terraria.NPC.AI_007_TownEntities ( )
inlineprivate

Definition at line 56255 of file NPC.cs.

56256 {
56257 //IL_0ac5: Unknown result type (might be due to invalid IL or missing references)
56258 //IL_066c: Unknown result type (might be due to invalid IL or missing references)
56259 //IL_0671: Unknown result type (might be due to invalid IL or missing references)
56260 //IL_069a: Unknown result type (might be due to invalid IL or missing references)
56261 //IL_06c0: Unknown result type (might be due to invalid IL or missing references)
56262 //IL_06c5: Unknown result type (might be due to invalid IL or missing references)
56263 //IL_06c9: Unknown result type (might be due to invalid IL or missing references)
56264 //IL_06f0: Unknown result type (might be due to invalid IL or missing references)
56265 //IL_0607: Unknown result type (might be due to invalid IL or missing references)
56266 //IL_0730: Unknown result type (might be due to invalid IL or missing references)
56267 //IL_0732: Unknown result type (might be due to invalid IL or missing references)
56268 //IL_0746: Unknown result type (might be due to invalid IL or missing references)
56269 //IL_074b: Unknown result type (might be due to invalid IL or missing references)
56270 //IL_075a: Unknown result type (might be due to invalid IL or missing references)
56271 //IL_075f: Unknown result type (might be due to invalid IL or missing references)
56272 //IL_0773: Unknown result type (might be due to invalid IL or missing references)
56273 //IL_0789: Unknown result type (might be due to invalid IL or missing references)
56274 //IL_078f: Unknown result type (might be due to invalid IL or missing references)
56275 //IL_0791: Unknown result type (might be due to invalid IL or missing references)
56276 //IL_079e: Unknown result type (might be due to invalid IL or missing references)
56277 //IL_07a4: Unknown result type (might be due to invalid IL or missing references)
56278 //IL_0661: Unknown result type (might be due to invalid IL or missing references)
56279 //IL_0666: Unknown result type (might be due to invalid IL or missing references)
56280 //IL_0d24: Unknown result type (might be due to invalid IL or missing references)
56281 //IL_08e6: Unknown result type (might be due to invalid IL or missing references)
56282 //IL_08f1: Unknown result type (might be due to invalid IL or missing references)
56283 //IL_090d: Unknown result type (might be due to invalid IL or missing references)
56284 //IL_0912: Unknown result type (might be due to invalid IL or missing references)
56285 //IL_07f0: Unknown result type (might be due to invalid IL or missing references)
56286 //IL_07f5: Unknown result type (might be due to invalid IL or missing references)
56287 //IL_07fa: Unknown result type (might be due to invalid IL or missing references)
56288 //IL_0809: Unknown result type (might be due to invalid IL or missing references)
56289 //IL_080b: Unknown result type (might be due to invalid IL or missing references)
56290 //IL_0813: Unknown result type (might be due to invalid IL or missing references)
56291 //IL_0815: Unknown result type (might be due to invalid IL or missing references)
56292 //IL_0833: Unknown result type (might be due to invalid IL or missing references)
56293 //IL_0839: Unknown result type (might be due to invalid IL or missing references)
56294 //IL_083b: Unknown result type (might be due to invalid IL or missing references)
56295 //IL_084a: Unknown result type (might be due to invalid IL or missing references)
56296 //IL_084f: Unknown result type (might be due to invalid IL or missing references)
56297 //IL_0dac: Unknown result type (might be due to invalid IL or missing references)
56298 //IL_0dc4: Unknown result type (might be due to invalid IL or missing references)
56299 //IL_0989: Unknown result type (might be due to invalid IL or missing references)
56300 //IL_09a3: Unknown result type (might be due to invalid IL or missing references)
56301 //IL_09a8: Unknown result type (might be due to invalid IL or missing references)
56302 //IL_1008: Unknown result type (might be due to invalid IL or missing references)
56303 //IL_100d: Unknown result type (might be due to invalid IL or missing references)
56304 //IL_1011: Unknown result type (might be due to invalid IL or missing references)
56305 //IL_1c50: Unknown result type (might be due to invalid IL or missing references)
56306 //IL_516e: Unknown result type (might be due to invalid IL or missing references)
56307 //IL_11a1: Unknown result type (might be due to invalid IL or missing references)
56308 //IL_688f: Unknown result type (might be due to invalid IL or missing references)
56309 //IL_5247: Unknown result type (might be due to invalid IL or missing references)
56310 //IL_2f62: Unknown result type (might be due to invalid IL or missing references)
56311 //IL_2f67: Unknown result type (might be due to invalid IL or missing references)
56312 //IL_2f71: Unknown result type (might be due to invalid IL or missing references)
56313 //IL_2f76: Unknown result type (might be due to invalid IL or missing references)
56314 //IL_2f7b: Unknown result type (might be due to invalid IL or missing references)
56315 //IL_2f80: Unknown result type (might be due to invalid IL or missing references)
56316 //IL_2f87: Unknown result type (might be due to invalid IL or missing references)
56317 //IL_2f8e: Unknown result type (might be due to invalid IL or missing references)
56318 //IL_68dd: Unknown result type (might be due to invalid IL or missing references)
56319 //IL_2fc6: Unknown result type (might be due to invalid IL or missing references)
56320 //IL_11e7: Unknown result type (might be due to invalid IL or missing references)
56321 //IL_11f6: Unknown result type (might be due to invalid IL or missing references)
56322 //IL_52b3: Unknown result type (might be due to invalid IL or missing references)
56323 //IL_52b8: Unknown result type (might be due to invalid IL or missing references)
56324 //IL_1236: Unknown result type (might be due to invalid IL or missing references)
56325 //IL_1241: Unknown result type (might be due to invalid IL or missing references)
56326 //IL_52ca: Unknown result type (might be due to invalid IL or missing references)
56327 //IL_52dd: Unknown result type (might be due to invalid IL or missing references)
56328 //IL_196d: Unknown result type (might be due to invalid IL or missing references)
56329 //IL_2230: Unknown result type (might be due to invalid IL or missing references)
56330 //IL_223a: Unknown result type (might be due to invalid IL or missing references)
56331 //IL_223f: Unknown result type (might be due to invalid IL or missing references)
56332 //IL_3154: Unknown result type (might be due to invalid IL or missing references)
56333 //IL_3166: Unknown result type (might be due to invalid IL or missing references)
56334 //IL_3108: Unknown result type (might be due to invalid IL or missing references)
56335 //IL_311a: Unknown result type (might be due to invalid IL or missing references)
56336 //IL_3129: Unknown result type (might be due to invalid IL or missing references)
56337 //IL_546b: Unknown result type (might be due to invalid IL or missing references)
56338 //IL_2c3f: Unknown result type (might be due to invalid IL or missing references)
56339 //IL_50e1: Unknown result type (might be due to invalid IL or missing references)
56340 //IL_50e6: Unknown result type (might be due to invalid IL or missing references)
56341 //IL_50ea: Unknown result type (might be due to invalid IL or missing references)
56342 //IL_50ef: Unknown result type (might be due to invalid IL or missing references)
56343 //IL_50f2: Unknown result type (might be due to invalid IL or missing references)
56344 //IL_50f7: Unknown result type (might be due to invalid IL or missing references)
56345 //IL_50fe: Unknown result type (might be due to invalid IL or missing references)
56346 //IL_5105: Unknown result type (might be due to invalid IL or missing references)
56347 //IL_419a: Unknown result type (might be due to invalid IL or missing references)
56348 //IL_41a9: Unknown result type (might be due to invalid IL or missing references)
56349 //IL_41ae: Unknown result type (might be due to invalid IL or missing references)
56350 //IL_41b3: Unknown result type (might be due to invalid IL or missing references)
56351 //IL_41b8: Unknown result type (might be due to invalid IL or missing references)
56352 //IL_41ba: Unknown result type (might be due to invalid IL or missing references)
56353 //IL_41c3: Unknown result type (might be due to invalid IL or missing references)
56354 //IL_35e3: Unknown result type (might be due to invalid IL or missing references)
56355 //IL_35e8: Unknown result type (might be due to invalid IL or missing references)
56356 //IL_35ed: Unknown result type (might be due to invalid IL or missing references)
56357 //IL_41eb: Unknown result type (might be due to invalid IL or missing references)
56358 //IL_41f2: Unknown result type (might be due to invalid IL or missing references)
56359 //IL_41f7: Unknown result type (might be due to invalid IL or missing references)
56360 //IL_4200: Unknown result type (might be due to invalid IL or missing references)
56361 //IL_4216: Unknown result type (might be due to invalid IL or missing references)
56362 //IL_4226: Unknown result type (might be due to invalid IL or missing references)
56363 //IL_422d: Unknown result type (might be due to invalid IL or missing references)
56364 //IL_36b9: Unknown result type (might be due to invalid IL or missing references)
56365 //IL_59c7: Unknown result type (might be due to invalid IL or missing references)
56366 //IL_36c2: Unknown result type (might be due to invalid IL or missing references)
56367 //IL_360b: Unknown result type (might be due to invalid IL or missing references)
56368 //IL_3626: Unknown result type (might be due to invalid IL or missing references)
56369 //IL_3643: Unknown result type (might be due to invalid IL or missing references)
56370 //IL_3648: Unknown result type (might be due to invalid IL or missing references)
56371 //IL_364d: Unknown result type (might be due to invalid IL or missing references)
56372 //IL_3652: Unknown result type (might be due to invalid IL or missing references)
56373 //IL_5ff3: Unknown result type (might be due to invalid IL or missing references)
56374 //IL_5ff9: Unknown result type (might be due to invalid IL or missing references)
56375 //IL_5db9: Unknown result type (might be due to invalid IL or missing references)
56376 //IL_5dbe: Unknown result type (might be due to invalid IL or missing references)
56377 //IL_5dc8: Unknown result type (might be due to invalid IL or missing references)
56378 //IL_5dcd: Unknown result type (might be due to invalid IL or missing references)
56379 //IL_5dd2: Unknown result type (might be due to invalid IL or missing references)
56380 //IL_5dd7: Unknown result type (might be due to invalid IL or missing references)
56381 //IL_5dd9: Unknown result type (might be due to invalid IL or missing references)
56382 //IL_5de0: Unknown result type (might be due to invalid IL or missing references)
56383 //IL_5ae9: Unknown result type (might be due to invalid IL or missing references)
56384 //IL_59d7: Unknown result type (might be due to invalid IL or missing references)
56385 //IL_59e0: Unknown result type (might be due to invalid IL or missing references)
56386 //IL_3e94: Unknown result type (might be due to invalid IL or missing references)
56387 //IL_3e99: Unknown result type (might be due to invalid IL or missing references)
56388 //IL_36e9: Unknown result type (might be due to invalid IL or missing references)
56389 //IL_36ed: Unknown result type (might be due to invalid IL or missing references)
56390 //IL_36f2: Unknown result type (might be due to invalid IL or missing references)
56391 //IL_36f4: Unknown result type (might be due to invalid IL or missing references)
56392 //IL_3705: Unknown result type (might be due to invalid IL or missing references)
56393 //IL_370a: Unknown result type (might be due to invalid IL or missing references)
56394 //IL_370f: Unknown result type (might be due to invalid IL or missing references)
56395 //IL_3670: Unknown result type (might be due to invalid IL or missing references)
56396 //IL_368b: Unknown result type (might be due to invalid IL or missing references)
56397 //IL_36a8: Unknown result type (might be due to invalid IL or missing references)
56398 //IL_36ad: Unknown result type (might be due to invalid IL or missing references)
56399 //IL_36b2: Unknown result type (might be due to invalid IL or missing references)
56400 //IL_36b7: Unknown result type (might be due to invalid IL or missing references)
56401 //IL_601c: Unknown result type (might be due to invalid IL or missing references)
56402 //IL_6030: Unknown result type (might be due to invalid IL or missing references)
56403 //IL_6035: Unknown result type (might be due to invalid IL or missing references)
56404 //IL_603a: Unknown result type (might be due to invalid IL or missing references)
56405 //IL_603f: Unknown result type (might be due to invalid IL or missing references)
56406 //IL_6041: Unknown result type (might be due to invalid IL or missing references)
56407 //IL_6048: Unknown result type (might be due to invalid IL or missing references)
56408 //IL_5cde: Unknown result type (might be due to invalid IL or missing references)
56409 //IL_5af9: Unknown result type (might be due to invalid IL or missing references)
56410 //IL_5b02: Unknown result type (might be due to invalid IL or missing references)
56411 //IL_4d45: Unknown result type (might be due to invalid IL or missing references)
56412 //IL_4d52: Unknown result type (might be due to invalid IL or missing references)
56413 //IL_4aa9: Unknown result type (might be due to invalid IL or missing references)
56414 //IL_4aae: Unknown result type (might be due to invalid IL or missing references)
56415 //IL_4ab2: Unknown result type (might be due to invalid IL or missing references)
56416 //IL_4ab9: Unknown result type (might be due to invalid IL or missing references)
56417 //IL_4abe: Unknown result type (might be due to invalid IL or missing references)
56418 //IL_4ac1: Unknown result type (might be due to invalid IL or missing references)
56419 //IL_4ac6: Unknown result type (might be due to invalid IL or missing references)
56420 //IL_4acd: Unknown result type (might be due to invalid IL or missing references)
56421 //IL_4ad4: Unknown result type (might be due to invalid IL or missing references)
56422 //IL_455f: Unknown result type (might be due to invalid IL or missing references)
56423 //IL_4564: Unknown result type (might be due to invalid IL or missing references)
56424 //IL_4035: Unknown result type (might be due to invalid IL or missing references)
56425 //IL_403a: Unknown result type (might be due to invalid IL or missing references)
56426 //IL_403f: Unknown result type (might be due to invalid IL or missing references)
56427 //IL_4041: Unknown result type (might be due to invalid IL or missing references)
56428 //IL_3ec7: Unknown result type (might be due to invalid IL or missing references)
56429 //IL_3ea9: Unknown result type (might be due to invalid IL or missing references)
56430 //IL_3eb6: Unknown result type (might be due to invalid IL or missing references)
56431 //IL_3ebb: Unknown result type (might be due to invalid IL or missing references)
56432 //IL_3ec0: Unknown result type (might be due to invalid IL or missing references)
56433 //IL_3ec5: Unknown result type (might be due to invalid IL or missing references)
56434 //IL_37fb: Unknown result type (might be due to invalid IL or missing references)
56435 //IL_3811: Unknown result type (might be due to invalid IL or missing references)
56436 //IL_3821: Unknown result type (might be due to invalid IL or missing references)
56437 //IL_3828: Unknown result type (might be due to invalid IL or missing references)
56438 //IL_605b: Unknown result type (might be due to invalid IL or missing references)
56439 //IL_6062: Unknown result type (might be due to invalid IL or missing references)
56440 //IL_5ee8: Unknown result type (might be due to invalid IL or missing references)
56441 //IL_5eef: Unknown result type (might be due to invalid IL or missing references)
56442 //IL_5cee: Unknown result type (might be due to invalid IL or missing references)
56443 //IL_5cf7: Unknown result type (might be due to invalid IL or missing references)
56444 //IL_45bd: Unknown result type (might be due to invalid IL or missing references)
56445 //IL_4574: Unknown result type (might be due to invalid IL or missing references)
56446 //IL_458f: Unknown result type (might be due to invalid IL or missing references)
56447 //IL_45ac: Unknown result type (might be due to invalid IL or missing references)
56448 //IL_45b1: Unknown result type (might be due to invalid IL or missing references)
56449 //IL_45b6: Unknown result type (might be due to invalid IL or missing references)
56450 //IL_45bb: Unknown result type (might be due to invalid IL or missing references)
56451 //IL_404f: Unknown result type (might be due to invalid IL or missing references)
56452 //IL_3ed0: Unknown result type (might be due to invalid IL or missing references)
56453 //IL_379f: Unknown result type (might be due to invalid IL or missing references)
56454 //IL_37b5: Unknown result type (might be due to invalid IL or missing references)
56455 //IL_37c5: Unknown result type (might be due to invalid IL or missing references)
56456 //IL_37cc: Unknown result type (might be due to invalid IL or missing references)
56457 //IL_3739: Unknown result type (might be due to invalid IL or missing references)
56458 //IL_374f: Unknown result type (might be due to invalid IL or missing references)
56459 //IL_375f: Unknown result type (might be due to invalid IL or missing references)
56460 //IL_3766: Unknown result type (might be due to invalid IL or missing references)
56461 //IL_60b6: Unknown result type (might be due to invalid IL or missing references)
56462 //IL_60bb: Unknown result type (might be due to invalid IL or missing references)
56463 //IL_55b7: Unknown result type (might be due to invalid IL or missing references)
56464 //IL_4ed6: Unknown result type (might be due to invalid IL or missing references)
56465 //IL_4ede: Unknown result type (might be due to invalid IL or missing references)
56466 //IL_4ee3: Unknown result type (might be due to invalid IL or missing references)
56467 //IL_4eeb: Unknown result type (might be due to invalid IL or missing references)
56468 //IL_4ef5: Unknown result type (might be due to invalid IL or missing references)
56469 //IL_4efa: Unknown result type (might be due to invalid IL or missing references)
56470 //IL_45c6: Unknown result type (might be due to invalid IL or missing references)
56471 //IL_4064: Unknown result type (might be due to invalid IL or missing references)
56472 //IL_3ef7: Unknown result type (might be due to invalid IL or missing references)
56473 //IL_3efb: Unknown result type (might be due to invalid IL or missing references)
56474 //IL_3f00: Unknown result type (might be due to invalid IL or missing references)
56475 //IL_3f02: Unknown result type (might be due to invalid IL or missing references)
56476 //IL_3f13: Unknown result type (might be due to invalid IL or missing references)
56477 //IL_3f18: Unknown result type (might be due to invalid IL or missing references)
56478 //IL_3f1d: Unknown result type (might be due to invalid IL or missing references)
56479 //IL_5f71: Unknown result type (might be due to invalid IL or missing references)
56480 //IL_5f85: Unknown result type (might be due to invalid IL or missing references)
56481 //IL_5f8d: Unknown result type (might be due to invalid IL or missing references)
56482 //IL_5f92: Unknown result type (might be due to invalid IL or missing references)
56483 //IL_55cc: Unknown result type (might be due to invalid IL or missing references)
56484 //IL_45ed: Unknown result type (might be due to invalid IL or missing references)
56485 //IL_45f1: Unknown result type (might be due to invalid IL or missing references)
56486 //IL_45f6: Unknown result type (might be due to invalid IL or missing references)
56487 //IL_45f8: Unknown result type (might be due to invalid IL or missing references)
56488 //IL_4609: Unknown result type (might be due to invalid IL or missing references)
56489 //IL_460e: Unknown result type (might be due to invalid IL or missing references)
56490 //IL_4613: Unknown result type (might be due to invalid IL or missing references)
56491 //IL_3fa4: Unknown result type (might be due to invalid IL or missing references)
56492 //IL_3fba: Unknown result type (might be due to invalid IL or missing references)
56493 //IL_3fca: Unknown result type (might be due to invalid IL or missing references)
56494 //IL_3fd1: Unknown result type (might be due to invalid IL or missing references)
56495 //IL_3f3a: Unknown result type (might be due to invalid IL or missing references)
56496 //IL_3f50: Unknown result type (might be due to invalid IL or missing references)
56497 //IL_3f60: Unknown result type (might be due to invalid IL or missing references)
56498 //IL_3f67: Unknown result type (might be due to invalid IL or missing references)
56499 //IL_57cd: Unknown result type (might be due to invalid IL or missing references)
56500 //IL_55df: Unknown result type (might be due to invalid IL or missing references)
56501 //IL_55e8: Unknown result type (might be due to invalid IL or missing references)
56502 //IL_57e2: Unknown result type (might be due to invalid IL or missing references)
56503 //IL_2925: Unknown result type (might be due to invalid IL or missing references)
56504 //IL_293e: Unknown result type (might be due to invalid IL or missing references)
56505 //IL_5e47: Unknown result type (might be due to invalid IL or missing references)
56506 //IL_5e4c: Unknown result type (might be due to invalid IL or missing references)
56507 //IL_5e56: Unknown result type (might be due to invalid IL or missing references)
56508 //IL_5e5b: Unknown result type (might be due to invalid IL or missing references)
56509 //IL_5e60: Unknown result type (might be due to invalid IL or missing references)
56510 //IL_5e65: Unknown result type (might be due to invalid IL or missing references)
56511 //IL_5eb5: Unknown result type (might be due to invalid IL or missing references)
56512 //IL_5eba: Unknown result type (might be due to invalid IL or missing references)
56513 //IL_5ebf: Unknown result type (might be due to invalid IL or missing references)
56514 //IL_57f5: Unknown result type (might be due to invalid IL or missing references)
56515 //IL_57fe: Unknown result type (might be due to invalid IL or missing references)
56516 //IL_471b: Unknown result type (might be due to invalid IL or missing references)
56517 //IL_4728: Unknown result type (might be due to invalid IL or missing references)
56518 //IL_4732: Unknown result type (might be due to invalid IL or missing references)
56519 //IL_4737: Unknown result type (might be due to invalid IL or missing references)
56520 //IL_4744: Unknown result type (might be due to invalid IL or missing references)
56521 //IL_4758: Unknown result type (might be due to invalid IL or missing references)
56522 //IL_475d: Unknown result type (might be due to invalid IL or missing references)
56523 //IL_4767: Unknown result type (might be due to invalid IL or missing references)
56524 //IL_476c: Unknown result type (might be due to invalid IL or missing references)
56525 //IL_4771: Unknown result type (might be due to invalid IL or missing references)
56526 //IL_4656: Unknown result type (might be due to invalid IL or missing references)
56527 //IL_465b: Unknown result type (might be due to invalid IL or missing references)
56528 //IL_4664: Unknown result type (might be due to invalid IL or missing references)
56529 //IL_467a: Unknown result type (might be due to invalid IL or missing references)
56530 //IL_468a: Unknown result type (might be due to invalid IL or missing references)
56531 //IL_4691: Unknown result type (might be due to invalid IL or missing references)
56532 //IL_4699: Unknown result type (might be due to invalid IL or missing references)
56533 //IL_46a0: Unknown result type (might be due to invalid IL or missing references)
56534 //IL_62d6: Unknown result type (might be due to invalid IL or missing references)
56535 //IL_62e5: Unknown result type (might be due to invalid IL or missing references)
56536 //IL_618e: Unknown result type (might be due to invalid IL or missing references)
56537 //IL_61a1: Unknown result type (might be due to invalid IL or missing references)
56538 //IL_4a2e: Unknown result type (might be due to invalid IL or missing references)
56539 //IL_4a44: Unknown result type (might be due to invalid IL or missing references)
56540 //IL_4a54: Unknown result type (might be due to invalid IL or missing references)
56541 //IL_4a5b: Unknown result type (might be due to invalid IL or missing references)
56542 //IL_49b0: Unknown result type (might be due to invalid IL or missing references)
56543 //IL_49c6: Unknown result type (might be due to invalid IL or missing references)
56544 //IL_49d6: Unknown result type (might be due to invalid IL or missing references)
56545 //IL_49dd: Unknown result type (might be due to invalid IL or missing references)
56546 //IL_488b: Unknown result type (might be due to invalid IL or missing references)
56547 //IL_4898: Unknown result type (might be due to invalid IL or missing references)
56548 //IL_48ac: Unknown result type (might be due to invalid IL or missing references)
56549 //IL_48b1: Unknown result type (might be due to invalid IL or missing references)
56550 //IL_48bb: Unknown result type (might be due to invalid IL or missing references)
56551 //IL_48c0: Unknown result type (might be due to invalid IL or missing references)
56552 //IL_48c5: Unknown result type (might be due to invalid IL or missing references)
56553 //IL_3cf3: Unknown result type (might be due to invalid IL or missing references)
56554 //IL_6465: Unknown result type (might be due to invalid IL or missing references)
56555 //IL_6474: Unknown result type (might be due to invalid IL or missing references)
56556 //IL_61be: Unknown result type (might be due to invalid IL or missing references)
56557 //IL_4e0b: Unknown result type (might be due to invalid IL or missing references)
56558 //IL_480f: Unknown result type (might be due to invalid IL or missing references)
56559 //IL_4816: Unknown result type (might be due to invalid IL or missing references)
56560 //IL_47e4: Unknown result type (might be due to invalid IL or missing references)
56561 //IL_47ef: Unknown result type (might be due to invalid IL or missing references)
56562 //IL_65e7: Unknown result type (might be due to invalid IL or missing references)
56563 //IL_65f6: Unknown result type (might be due to invalid IL or missing references)
56564 //IL_64bd: Unknown result type (might be due to invalid IL or missing references)
56565 //IL_64c2: Unknown result type (might be due to invalid IL or missing references)
56566 //IL_64c7: Unknown result type (might be due to invalid IL or missing references)
56567 //IL_64c9: Unknown result type (might be due to invalid IL or missing references)
56568 //IL_6339: Unknown result type (might be due to invalid IL or missing references)
56569 //IL_6346: Unknown result type (might be due to invalid IL or missing references)
56570 //IL_62f9: Unknown result type (might be due to invalid IL or missing references)
56571 //IL_6308: Unknown result type (might be due to invalid IL or missing references)
56572 //IL_4943: Unknown result type (might be due to invalid IL or missing references)
56573 //IL_494a: Unknown result type (might be due to invalid IL or missing references)
56574 //IL_491b: Unknown result type (might be due to invalid IL or missing references)
56575 //IL_4926: Unknown result type (might be due to invalid IL or missing references)
56576 //IL_4787: Unknown result type (might be due to invalid IL or missing references)
56577 //IL_4794: Unknown result type (might be due to invalid IL or missing references)
56578 //IL_479e: Unknown result type (might be due to invalid IL or missing references)
56579 //IL_47a3: Unknown result type (might be due to invalid IL or missing references)
56580 //IL_47b0: Unknown result type (might be due to invalid IL or missing references)
56581 //IL_47c4: Unknown result type (might be due to invalid IL or missing references)
56582 //IL_47c9: Unknown result type (might be due to invalid IL or missing references)
56583 //IL_47d3: Unknown result type (might be due to invalid IL or missing references)
56584 //IL_47d8: Unknown result type (might be due to invalid IL or missing references)
56585 //IL_47dd: Unknown result type (might be due to invalid IL or missing references)
56586 //IL_6785: Unknown result type (might be due to invalid IL or missing references)
56587 //IL_6794: Unknown result type (might be due to invalid IL or missing references)
56588 //IL_64da: Unknown result type (might be due to invalid IL or missing references)
56589 //IL_6488: Unknown result type (might be due to invalid IL or missing references)
56590 //IL_6497: Unknown result type (might be due to invalid IL or missing references)
56591 //IL_4f4f: Unknown result type (might be due to invalid IL or missing references)
56592 //IL_4f5e: Unknown result type (might be due to invalid IL or missing references)
56593 //IL_4e24: Unknown result type (might be due to invalid IL or missing references)
56594 //IL_4e37: Unknown result type (might be due to invalid IL or missing references)
56595 //IL_48da: Unknown result type (might be due to invalid IL or missing references)
56596 //IL_48e7: Unknown result type (might be due to invalid IL or missing references)
56597 //IL_48fb: Unknown result type (might be due to invalid IL or missing references)
56598 //IL_4900: Unknown result type (might be due to invalid IL or missing references)
56599 //IL_490a: Unknown result type (might be due to invalid IL or missing references)
56600 //IL_490f: Unknown result type (might be due to invalid IL or missing references)
56601 //IL_4914: Unknown result type (might be due to invalid IL or missing references)
56602 //IL_660a: Unknown result type (might be due to invalid IL or missing references)
56603 //IL_6619: Unknown result type (might be due to invalid IL or missing references)
56604 //IL_6517: Unknown result type (might be due to invalid IL or missing references)
56605 //IL_67a8: Unknown result type (might be due to invalid IL or missing references)
56606 //IL_67b7: Unknown result type (might be due to invalid IL or missing references)
56607 //IL_4f72: Unknown result type (might be due to invalid IL or missing references)
56608 //IL_4f81: Unknown result type (might be due to invalid IL or missing references)
56610 if (type == 441 && GivenName == "Andrew")
56611 {
56612 defDefense = 200;
56613 }
56614 int num = 300;
56615 if (type == 638 || type == 656 || NPCID.Sets.IsTownSlime[type])
56616 {
56617 num = 0;
56618 }
56619 bool flag = Main.raining;
56620 if (!Main.dayTime)
56621 {
56622 flag = true;
56623 }
56624 if (Main.eclipse)
56625 {
56626 flag = true;
56627 }
56628 if (Main.slimeRain)
56629 {
56630 flag = true;
56631 }
56632 float num42 = 1f;
56633 if (Main.masterMode)
56634 {
56635 defense = (dryadWard ? (defDefense + 14) : defDefense);
56636 }
56637 else if (Main.expertMode)
56638 {
56639 defense = (dryadWard ? (defDefense + 10) : defDefense);
56640 }
56641 else
56642 {
56643 defense = (dryadWard ? (defDefense + 6) : defDefense);
56644 }
56645 if (isLikeATownNPC)
56646 {
56648 {
56649 num42 += 0.2f;
56650 defense += 6;
56651 }
56653 {
56654 num42 += 0.2f;
56655 defense += 6;
56656 }
56657 if (downedBoss1)
56658 {
56659 num42 += 0.1f;
56660 defense += 3;
56661 }
56662 if (downedBoss2)
56663 {
56664 num42 += 0.1f;
56665 defense += 3;
56666 }
56667 if (downedBoss3)
56668 {
56669 num42 += 0.1f;
56670 defense += 3;
56671 }
56672 if (downedQueenBee)
56673 {
56674 num42 += 0.1f;
56675 defense += 3;
56676 }
56677 if (Main.hardMode)
56678 {
56679 num42 += 0.4f;
56680 defense += 12;
56681 }
56682 if (downedQueenSlime)
56683 {
56684 num42 += 0.15f;
56685 defense += 6;
56686 }
56687 if (downedMechBoss1)
56688 {
56689 num42 += 0.15f;
56690 defense += 6;
56691 }
56692 if (downedMechBoss2)
56693 {
56694 num42 += 0.15f;
56695 defense += 6;
56696 }
56697 if (downedMechBoss3)
56698 {
56699 num42 += 0.15f;
56700 defense += 6;
56701 }
56702 if (downedPlantBoss)
56703 {
56704 num42 += 0.15f;
56705 defense += 8;
56706 }
56708 {
56709 num42 += 0.15f;
56710 defense += 8;
56711 }
56712 if (downedGolemBoss)
56713 {
56714 num42 += 0.15f;
56715 defense += 8;
56716 }
56718 {
56719 num42 += 0.15f;
56720 defense += 8;
56721 }
56723 }
56724 if (type == 142 && Main.netMode != 1 && !Main.xMas)
56725 {
56726 StrikeNPCNoInteraction(9999, 0f, 0);
56727 if (Main.netMode == 2)
56728 {
56729 NetMessage.SendData(28, -1, -1, null, whoAmI, 9999f);
56730 }
56731 }
56732 if ((type == 148 || type == 149) && localAI[0] == 0f)
56733 {
56734 localAI[0] = Main.rand.Next(1, 5);
56735 }
56736 if (type == 124)
56737 {
56739 bool flag12 = false;
56740 if (Main.projectile.IndexInRange(num53))
56741 {
56742 Projectile projectile = Main.projectile[num53];
56743 if (projectile.active && projectile.type == 582 && projectile.ai[1] == (float)whoAmI)
56744 {
56745 flag12 = true;
56746 }
56747 }
56748 localAI[0] = flag12.ToInt();
56749 }
56750 if ((type == 362 || type == 364 || type == 602 || type == 608) && Main.netMode != 1 && (velocity.Y > 4f || velocity.Y < -4f || wet))
56751 {
56752 int num64 = direction;
56753 Transform(type + 1);
56754 TargetClosest();
56755 direction = num64;
56756 netUpdate = true;
56757 return;
56758 }
56759 switch (type)
56760 {
56761 case 588:
56762 savedGolfer = true;
56763 break;
56764 case 441:
56765 savedTaxCollector = true;
56766 break;
56767 case 107:
56768 savedGoblin = true;
56769 break;
56770 case 108:
56771 savedWizard = true;
56772 break;
56773 case 124:
56774 savedMech = true;
56775 break;
56776 case 353:
56777 savedStylist = true;
56778 break;
56779 case 369:
56780 savedAngler = true;
56781 break;
56782 case 550:
56783 savedBartender = true;
56784 break;
56785 }
56786 dontTakeDamage = false;
56787 Color newColor;
56788 if (ai[0] == 25f)
56789 {
56790 dontTakeDamage = true;
56791 if (ai[1] == 0f)
56792 {
56793 velocity.X = 0f;
56794 }
56795 shimmerWet = false;
56796 wet = false;
56797 lavaWet = false;
56798 honeyWet = false;
56799 if (ai[1] == 0f && Main.netMode == 1)
56800 {
56801 return;
56802 }
56803 if (ai[1] == 0f && ai[2] < 1f)
56804 {
56806 }
56807 if (ai[2] > 0f)
56808 {
56809 ai[2] -= 1f;
56810 if (ai[2] <= 0f)
56811 {
56812 ai[1] = 1f;
56813 }
56814 return;
56815 }
56816 ai[1] += 1f;
56817 if (ai[1] >= 30f)
56818 {
56819 if (!Collision.WetCollision(position, width, height))
56820 {
56822 }
56823 else
56824 {
56825 ai[1] = 30f;
56826 }
56827 velocity = new Vector2(0f, -4f * shimmerTransparency);
56828 }
56829 Rectangle hitbox = base.Hitbox;
56830 hitbox.Y += 20;
56831 hitbox.Height -= 20;
56832 float num75 = Main.rand.NextFloatDirection();
56833 Vector2 center = base.Center;
56834 newColor = Main.hslToRgb((float)Main.timeForVisualEffects / 360f % 1f, 0.6f, 0.65f);
56835 Lighting.AddLight(center, ((Color)(ref newColor)).ToVector3() * Utils.Remap(ai[1], 30f, 90f, 0f, 0.7f));
56836 if (Main.rand.NextFloat() > Utils.Remap(ai[1], 30f, 60f, 1f, 0.5f))
56837 {
56838 Vector2 val = Main.rand.NextVector2FromRectangle(hitbox) + Main.rand.NextVector2Circular(8f, 0f) + new Vector2(0f, 4f);
56839 Vector2? val2 = Utils.RotatedBy(new Vector2(0f, -2f), num75 * ((float)Math.PI * 2f) * 0.11f);
56840 newColor = default(Color);
56841 Dust.NewDustPerfect(val, 309, val2, 0, newColor, 1.7f - Math.Abs(num75) * 1.3f);
56842 }
56843 if (ai[1] > 60f && Main.rand.Next(15) == 0)
56844 {
56845 for (int i = 0; i < 3; i++)
56846 {
56847 Vector2 vector = Main.rand.NextVector2FromRectangle(base.Hitbox);
56849 {
56850 PositionInWorld = vector,
56851 MovementVector = DirectionTo(vector).RotatedBy((float)Math.PI * 9f / 20f * (float)(Main.rand.Next(2) * 2 - 1)) * Main.rand.NextFloat()
56852 });
56853 }
56854 }
56855 TargetClosest();
56857 if (ai[1] >= 75f && shimmerTransparency <= 0f && Main.netMode != 1)
56858 {
56859 ai[0] = 0f;
56860 ai[1] = 0f;
56861 ai[2] = 0f;
56862 ai[3] = 0f;
56863 Math.Sign(targetData.Center.X - base.Center.X);
56864 velocity = new Vector2(0f, -4f);
56865 localAI[0] = 0f;
56866 localAI[1] = 0f;
56867 localAI[2] = 0f;
56868 localAI[3] = 0f;
56869 netUpdate = true;
56871 NetMessage.SendData(56, -1, -1, null, whoAmI);
56872 Teleport(position, 12);
56874 {
56875 PositionInWorld = base.Center
56876 });
56877 }
56878 return;
56879 }
56880 if (type >= 0 && NPCID.Sets.TownCritter[type] && target == 255)
56881 {
56882 TargetClosest();
56883 if (position.X < Main.player[target].position.X)
56884 {
56885 direction = 1;
56887 }
56888 if (position.X > Main.player[target].position.X)
56889 {
56890 direction = -1;
56892 }
56893 if (homeTileX == -1)
56894 {
56895 UpdateHomeTileState(homeless, (int)((position.X + (float)(width / 2)) / 16f), homeTileY);
56896 }
56897 }
56898 else if (homeTileX == -1 && homeTileY == -1 && velocity.Y == 0f && !shimmering)
56899 {
56900 UpdateHomeTileState(homeless, (int)base.Center.X / 16, (int)(position.Y + (float)height + 4f) / 16);
56901 }
56902 bool flag23 = false;
56903 int num86 = (int)(position.X + (float)(width / 2)) / 16;
56904 int num97 = (int)(position.Y + (float)height + 1f) / 16;
56906 if (type == 441)
56907 {
56908 taxCollector = true;
56909 }
56910 directionY = -1;
56911 if (direction == 0)
56912 {
56913 direction = 1;
56914 }
56915 if (ai[0] != 24f)
56916 {
56917 for (int j = 0; j < 255; j++)
56918 {
56919 if (Main.player[j].active && Main.player[j].talkNPC == whoAmI)
56920 {
56921 flag23 = true;
56922 if (ai[0] != 0f)
56923 {
56924 netUpdate = true;
56925 }
56926 ai[0] = 0f;
56927 ai[1] = 300f;
56928 localAI[3] = 100f;
56929 if (Main.player[j].position.X + (float)(Main.player[j].width / 2) < position.X + (float)(width / 2))
56930 {
56931 direction = -1;
56932 }
56933 else
56934 {
56935 direction = 1;
56936 }
56937 }
56938 }
56939 }
56940 if (ai[3] == 1f)
56941 {
56942 life = -1;
56943 HitEffect();
56944 active = false;
56945 netUpdate = true;
56946 if (type == 37)
56947 {
56948 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
56949 }
56950 return;
56951 }
56952 if (type == 37 && Main.netMode != 1)
56953 {
56954 UpdateHomeTileState(homeless: false, Main.dungeonX, Main.dungeonY);
56955 if (downedBoss3)
56956 {
56957 ai[3] = 1f;
56958 netUpdate = true;
56959 }
56960 }
56961 if (type == 368)
56962 {
56963 homeless = true;
56964 if (!Main.dayTime)
56965 {
56966 if (!shimmering)
56967 {
56968 UpdateHomeTileState(homeless, (int)(base.Center.X / 16f), (int)(position.Y + (float)height + 2f) / 16);
56969 }
56970 if (!flag23 && ai[0] == 0f)
56971 {
56972 ai[0] = 1f;
56973 ai[1] = 200f;
56974 }
56975 flag = false;
56976 }
56977 }
56978 if (type == 369 && homeless && wet)
56979 {
56980 if (base.Center.X / 16f < 380f || base.Center.X / 16f > (float)(Main.maxTilesX - 380))
56981 {
56982 UpdateHomeTileState(homeless, Main.spawnTileX, Main.spawnTileY);
56983 ai[0] = 1f;
56984 ai[1] = 200f;
56985 }
56986 if (position.X / 16f < 300f)
56987 {
56988 direction = 1;
56989 }
56990 else if (position.X / 16f > (float)(Main.maxTilesX - 300))
56991 {
56992 direction = -1;
56993 }
56994 }
56995 if (!WorldGen.InWorld(num86, num97) || (Main.netMode == 1 && !Main.sectionManager.TileLoaded(num86, num97)))
56996 {
56997 return;
56998 }
56999 if (!homeless && Main.netMode != 1 && townNPC && (flag || (type == 37 && Main.tileDungeon[Main.tile[num86, num97].type])) && !AI_007_TownEntities_IsInAGoodRestingSpot(num86, num97, floorX, floorY))
57000 {
57001 bool flag27 = true;
57002 Rectangle rectangle = default(Rectangle);
57003 for (int k = 0; k < 2; k++)
57004 {
57005 if (!flag27)
57006 {
57007 break;
57008 }
57009 ((Rectangle)(ref rectangle))._002Ector((int)(position.X + (float)(width / 2) - (float)(sWidth / 2) - (float)safeRangeX), (int)(position.Y + (float)(height / 2) - (float)(sHeight / 2) - (float)safeRangeY), sWidth + safeRangeX * 2, sHeight + safeRangeY * 2);
57010 if (k == 1)
57011 {
57012 ((Rectangle)(ref rectangle))._002Ector(floorX * 16 + 8 - sWidth / 2 - safeRangeX, floorY * 16 + 8 - sHeight / 2 - safeRangeY, sWidth + safeRangeX * 2, sHeight + safeRangeY * 2);
57013 }
57014 for (int l = 0; l < 255; l++)
57015 {
57016 if (Main.player[l].active)
57017 {
57018 Rectangle val3 = new Rectangle((int)Main.player[l].position.X, (int)Main.player[l].position.Y, Main.player[l].width, Main.player[l].height);
57019 if (((Rectangle)(ref val3)).Intersects(rectangle))
57020 {
57021 flag27 = false;
57022 break;
57023 }
57024 }
57025 }
57026 }
57027 if (flag27)
57028 {
57030 }
57031 }
57032 bool flag28 = type == 300 || type == 447 || type == 610;
57033 bool flag29 = type == 616 || type == 617 || type == 625;
57034 bool flag30 = type == 361 || type == 445 || type == 687;
57037 bool flag32 = flag29 || flag30;
57038 bool flag2 = flag29 || flag30;
57039 bool flag3 = flag31;
57040 bool flag4 = flag31;
57041 float num108 = 200f;
57042 if (NPCID.Sets.DangerDetectRange[type] != -1)
57043 {
57045 }
57046 bool flag5 = false;
57047 bool flag6 = false;
57048 float num119 = -1f;
57049 float num2 = -1f;
57050 int num13 = 0;
57051 int num24 = -1;
57052 int num35 = -1;
57053 bool keepwalking4;
57054 if (!flag29 && Main.netMode != 1 && !flag23)
57055 {
57056 for (int m = 0; m < 200; m++)
57057 {
57058 if (!Main.npc[m].active || Main.npc[m].friendly || Main.npc[m].damage <= 0 || !(Main.npc[m].Distance(base.Center) < num108) || (type == 453 && NPCID.Sets.Skeletons[Main.npc[m].type]) || (!Main.npc[m].noTileCollide && !Collision.CanHit(base.Center, 0, 0, Main.npc[m].Center, 0, 0)) || !NPCLoader.CanHitNPC(Main.npc[m], this))
57059 {
57060 continue;
57061 }
57062 bool flag7 = Main.npc[m].CanBeChasedBy(this);
57063 flag5 = true;
57064 float num36 = Main.npc[m].Center.X - base.Center.X;
57065 if (type == 614)
57066 {
57067 if (num36 < 0f && (num119 == -1f || num36 > num119))
57068 {
57069 num2 = num36;
57070 num35 = m;
57071 }
57072 if (num36 > 0f && (num2 == -1f || num36 < num2))
57073 {
57074 num119 = num36;
57075 num24 = m;
57076 }
57077 continue;
57078 }
57079 if (num36 < 0f && (num119 == -1f || num36 > num119))
57080 {
57081 num119 = num36;
57082 if (flag7)
57083 {
57084 num24 = m;
57085 }
57086 }
57087 if (num36 > 0f && (num2 == -1f || num36 < num2))
57088 {
57089 num2 = num36;
57090 if (flag7)
57091 {
57092 num35 = m;
57093 }
57094 }
57095 }
57096 if (flag5)
57097 {
57098 num13 = ((num119 == -1f) ? 1 : ((num2 != -1f) ? (num2 < 0f - num119).ToDirectionInt() : (-1)));
57099 float num37 = 0f;
57100 if (num119 != -1f)
57101 {
57102 num37 = 0f - num119;
57103 }
57104 if (num37 == 0f || (num2 < num37 && num2 > 0f))
57105 {
57106 num37 = num2;
57107 }
57108 if (ai[0] == 8f)
57109 {
57110 if (direction == -num13)
57111 {
57112 ai[0] = 1f;
57113 ai[1] = 300 + Main.rand.Next(300);
57114 ai[2] = 0f;
57115 localAI[3] = 0f;
57116 netUpdate = true;
57117 }
57118 }
57119 else if (ai[0] != 10f && ai[0] != 12f && ai[0] != 13f && ai[0] != 14f && ai[0] != 15f)
57120 {
57121 if (NPCID.Sets.PrettySafe[type] != -1 && (float)NPCID.Sets.PrettySafe[type] < num37)
57122 {
57123 flag5 = false;
57124 flag6 = NPCID.Sets.AttackType[type] > -1;
57125 }
57126 else if (ai[0] != 1f)
57127 {
57128 int tileX = (int)((position.X + (float)(width / 2) + (float)(15 * direction)) / 16f);
57129 int tileY = (int)((position.Y + (float)height - 16f) / 16f);
57130 bool currentlyDrowning = wet && !flag32;
57132 if (!avoidFalling)
57133 {
57134 if (ai[0] == 3f || ai[0] == 4f || ai[0] == 16f || ai[0] == 17f)
57135 {
57136 NPC nPC = Main.npc[(int)ai[2]];
57137 if (nPC.active)
57138 {
57139 nPC.ai[0] = 1f;
57140 nPC.ai[1] = 120 + Main.rand.Next(120);
57141 nPC.ai[2] = 0f;
57142 nPC.localAI[3] = 0f;
57143 nPC.direction = -num13;
57144 nPC.netUpdate = true;
57145 }
57146 }
57147 ai[0] = 1f;
57148 ai[1] = 120 + Main.rand.Next(120);
57149 ai[2] = 0f;
57150 localAI[3] = 0f;
57151 direction = -num13;
57152 netUpdate = true;
57153 }
57154 }
57155 else if (ai[0] == 1f && direction != -num13)
57156 {
57157 direction = -num13;
57158 netUpdate = true;
57159 }
57160 }
57161 }
57162 }
57163 if (ai[0] == 0f)
57164 {
57165 if (localAI[3] > 0f)
57166 {
57167 localAI[3] -= 1f;
57168 }
57169 int num38 = 120;
57170 if (type == 638)
57171 {
57172 num38 = 60;
57173 }
57174 if ((flag30 || flag31) && wet)
57175 {
57176 ai[0] = 1f;
57177 ai[1] = 200 + Main.rand.Next(500, 700);
57178 ai[2] = 0f;
57179 localAI[3] = 0f;
57180 netUpdate = true;
57181 }
57182 else if (flag && !flag23 && !NPCID.Sets.TownCritter[type])
57183 {
57184 if (Main.netMode != 1)
57185 {
57186 if (num86 == floorX && num97 == floorY)
57187 {
57188 if (velocity.X != 0f)
57189 {
57190 netUpdate = true;
57191 }
57192 if (velocity.X > 0.1f)
57193 {
57194 velocity.X -= 0.1f;
57195 }
57196 else if (velocity.X < -0.1f)
57197 {
57198 velocity.X += 0.1f;
57199 }
57200 else
57201 {
57202 velocity.X = 0f;
57204 }
57205 if (NPCID.Sets.IsTownPet[type])
57206 {
57208 }
57209 }
57210 else
57211 {
57212 if (num86 > floorX)
57213 {
57214 direction = -1;
57215 }
57216 else
57217 {
57218 direction = 1;
57219 }
57220 ai[0] = 1f;
57221 ai[1] = 200 + Main.rand.Next(200);
57222 ai[2] = 0f;
57223 localAI[3] = 0f;
57224 netUpdate = true;
57225 }
57226 }
57227 }
57228 else
57229 {
57230 if (flag28)
57231 {
57232 velocity.X *= 0.5f;
57233 }
57234 if (velocity.X > 0.1f)
57235 {
57236 velocity.X -= 0.1f;
57237 }
57238 else if (velocity.X < -0.1f)
57239 {
57240 velocity.X += 0.1f;
57241 }
57242 else
57243 {
57244 velocity.X = 0f;
57245 }
57246 if (Main.netMode != 1)
57247 {
57248 if (!flag23 && NPCID.Sets.IsTownPet[type] && ai[1] >= 100f && ai[1] <= 150f)
57249 {
57251 }
57252 if (ai[1] > 0f)
57253 {
57254 ai[1] -= 1f;
57255 }
57256 bool flag8 = true;
57257 int tileX2 = (int)((position.X + (float)(width / 2) + (float)(15 * direction)) / 16f);
57258 int tileY2 = (int)((position.Y + (float)height - 16f) / 16f);
57259 bool currentlyDrowning2 = wet && !flag32;
57261 if (wet && !flag32)
57262 {
57263 bool currentlyDrowning3 = Collision.DrownCollision(position, width, height, 1f, includeSlopes: true);
57265 {
57266 ai[0] = 1f;
57267 ai[1] = 200 + Main.rand.Next(300);
57268 ai[2] = 0f;
57270 {
57271 ai[1] += Main.rand.Next(200, 400);
57272 }
57273 localAI[3] = 0f;
57274 netUpdate = true;
57275 }
57276 }
57277 if (avoidFalling2)
57278 {
57279 flag8 = false;
57280 }
57281 if (ai[1] <= 0f)
57282 {
57283 if (flag8 && !avoidFalling2)
57284 {
57285 ai[0] = 1f;
57286 ai[1] = 200 + Main.rand.Next(300);
57287 ai[2] = 0f;
57289 {
57290 ai[1] += Main.rand.Next(200, 400);
57291 }
57292 localAI[3] = 0f;
57293 netUpdate = true;
57294 }
57295 else
57296 {
57297 direction *= -1;
57298 ai[1] = 60 + Main.rand.Next(120);
57299 netUpdate = true;
57300 }
57301 }
57302 }
57303 }
57304 if (Main.netMode != 1 && (!flag || AI_007_TownEntities_IsInAGoodRestingSpot(num86, num97, floorX, floorY)))
57305 {
57307 {
57308 if (localAI[3] == 0f)
57309 {
57310 if (num86 < floorX - 50 && direction == -1)
57311 {
57312 direction = 1;
57313 netUpdate = true;
57314 }
57315 else if (num86 > floorX + 50 && direction == 1)
57316 {
57317 direction = -1;
57318 netUpdate = true;
57319 }
57320 }
57321 }
57322 else if (Main.rand.Next(80) == 0 && localAI[3] == 0f)
57323 {
57324 localAI[3] = 200f;
57325 direction *= -1;
57326 netUpdate = true;
57327 }
57328 }
57329 }
57330 else if (ai[0] == 1f)
57331 {
57333 {
57334 ai[0] = 0f;
57335 ai[1] = 200 + Main.rand.Next(200);
57336 localAI[3] = 60f;
57337 netUpdate = true;
57338 }
57339 else
57340 {
57341 bool flag9 = !flag32 && Collision.DrownCollision(position, width, height, 1f, includeSlopes: true);
57342 if (!flag9)
57343 {
57344 if (Main.netMode != 1 && !homeless && !Main.tileDungeon[Main.tile[num86, num97].type] && (num86 < floorX - 35 || num86 > floorX + 35))
57345 {
57346 if (position.X < (float)(floorX * 16) && direction == -1)
57347 {
57348 ai[1] -= 5f;
57349 }
57350 else if (position.X > (float)(floorX * 16) && direction == 1)
57351 {
57352 ai[1] -= 5f;
57353 }
57354 }
57355 ai[1] -= 1f;
57356 }
57357 if (ai[1] <= 0f)
57358 {
57359 ai[0] = 0f;
57360 ai[1] = 300 + Main.rand.Next(300);
57361 ai[2] = 0f;
57363 {
57364 ai[1] -= Main.rand.Next(100);
57365 }
57366 else
57367 {
57368 ai[1] += Main.rand.Next(900);
57369 }
57370 localAI[3] = 60f;
57371 netUpdate = true;
57372 }
57373 if (closeDoor && ((position.X + (float)(width / 2)) / 16f > (float)(doorX + 2) || (position.X + (float)(width / 2)) / 16f < (float)(doorX - 2)))
57374 {
57375 Tile tileSafely = Framing.GetTileSafely(doorX, doorY);
57377 {
57378 if (WorldGen.CloseDoor(doorX, doorY))
57379 {
57380 closeDoor = false;
57381 NetMessage.SendData(19, -1, -1, null, 1, doorX, doorY, direction);
57382 }
57383 if ((position.X + (float)(width / 2)) / 16f > (float)(doorX + 4) || (position.X + (float)(width / 2)) / 16f < (float)(doorX - 4) || (position.Y + (float)(height / 2)) / 16f > (float)(doorY + 4) || (position.Y + (float)(height / 2)) / 16f < (float)(doorY - 4))
57384 {
57385 closeDoor = false;
57386 }
57387 }
57388 else if (tileSafely.type == 389)
57389 {
57390 if (WorldGen.ShiftTallGate(doorX, doorY, closing: true))
57391 {
57392 closeDoor = false;
57393 NetMessage.SendData(19, -1, -1, null, 5, doorX, doorY);
57394 }
57395 if ((position.X + (float)(width / 2)) / 16f > (float)(doorX + 4) || (position.X + (float)(width / 2)) / 16f < (float)(doorX - 4) || (position.Y + (float)(height / 2)) / 16f > (float)(doorY + 4) || (position.Y + (float)(height / 2)) / 16f < (float)(doorY - 4))
57396 {
57397 closeDoor = false;
57398 }
57399 }
57400 else
57401 {
57402 closeDoor = false;
57403 }
57404 }
57405 float num39 = 1f;
57406 float num40 = 0.07f;
57407 if (type == 614 && flag5)
57408 {
57409 num39 = 1.5f;
57410 num40 = 0.1f;
57411 }
57412 else if (type == 299 || type == 539 || type == 538 || (type >= 639 && type <= 645))
57413 {
57414 num39 = 1.5f;
57415 }
57416 else if (flag29)
57417 {
57418 if (wet)
57419 {
57420 num40 = 1f;
57421 num39 = 2f;
57422 }
57423 else
57424 {
57425 num40 = 0.07f;
57426 num39 = 0.5f;
57427 }
57428 }
57429 if (type == 625)
57430 {
57431 if (wet)
57432 {
57433 num40 = 1f;
57434 num39 = 2.5f;
57435 }
57436 else
57437 {
57438 num40 = 0.07f;
57439 num39 = 0.2f;
57440 }
57441 }
57442 if (flag28)
57443 {
57444 num39 = 2f;
57445 num40 = 1f;
57446 }
57447 if (friendly && (flag5 || flag9))
57448 {
57449 num39 = 1.5f;
57450 float num41 = 1f - (float)life / (float)lifeMax;
57451 num39 += num41 * 0.9f;
57452 num40 = 0.1f;
57453 }
57454 if (flag3 && wet)
57455 {
57456 num39 = 2f;
57457 num40 = 0.2f;
57458 }
57459 if (flag30 && wet)
57460 {
57461 if (Math.Abs(velocity.X) < 0.05f && Math.Abs(velocity.Y) < 0.05f)
57462 {
57463 velocity.X += num39 * 10f * (float)direction;
57464 }
57465 else
57466 {
57467 velocity.X *= 0.9f;
57468 }
57469 }
57470 else if (velocity.X < 0f - num39 || velocity.X > num39)
57471 {
57472 if (velocity.Y == 0f)
57473 {
57474 velocity *= 0.8f;
57475 }
57476 }
57477 else if (velocity.X < num39 && direction == 1)
57478 {
57479 velocity.X += num40;
57480 if (velocity.X > num39)
57481 {
57482 velocity.X = num39;
57483 }
57484 }
57485 else if (velocity.X > 0f - num39 && direction == -1)
57486 {
57487 velocity.X -= num40;
57488 if (velocity.X > num39)
57489 {
57490 velocity.X = num39;
57491 }
57492 }
57493 bool flag10 = true;
57494 if ((float)(homeTileY * 16 - 32) > position.Y)
57495 {
57496 flag10 = false;
57497 }
57498 if (!flag10 && velocity.Y == 0f)
57499 {
57500 Collision.StepDown(ref position, ref velocity, width, height, ref stepSpeed, ref gfxOffY);
57501 }
57502 if (velocity.Y >= 0f)
57503 {
57504 Collision.StepUp(ref position, ref velocity, width, height, ref stepSpeed, ref gfxOffY, 1, flag10, 1);
57505 }
57506 if (velocity.Y == 0f)
57507 {
57508 int num43 = (int)((position.X + (float)(width / 2) + (float)(15 * direction)) / 16f);
57509 int num44 = (int)((position.Y + (float)height - 16f) / 16f);
57510 int num45 = 180;
57512 bool flag11 = false;
57513 bool flag13 = false;
57515 {
57516 avoidFalling3 = true;
57517 localAI[3] = num45;
57518 int num46 = 0;
57519 for (int n = 0; n <= 10 && Framing.GetTileSafely(num43 - direction, num44 - n).liquid != 0; n++)
57520 {
57521 num46++;
57522 }
57523 float num47 = 0.3f;
57524 float num48 = (float)Math.Sqrt((float)(num46 * 16 + 16) * 2f * num47);
57525 if (num48 > 26f)
57526 {
57527 num48 = 26f;
57528 }
57529 velocity.Y = 0f - num48;
57530 localAI[3] = position.X;
57531 flag11 = true;
57532 }
57533 if (avoidFalling3 && !flag11)
57534 {
57535 int num49 = (int)((position.X + (float)(width / 2)) / 16f);
57536 int num50 = 0;
57537 for (int num51 = -1; num51 <= 1; num51++)
57538 {
57539 Tile tileSafely2 = Framing.GetTileSafely(num49 + num51, num44 + 1);
57540 if (tileSafely2.nactive() && Main.tileSolid[tileSafely2.type])
57541 {
57542 num50++;
57543 }
57544 }
57545 if (num50 <= 2)
57546 {
57547 if (velocity.X != 0f)
57548 {
57549 netUpdate = true;
57550 }
57551 keepwalking3 = (avoidFalling3 = false);
57552 ai[0] = 0f;
57553 ai[1] = 50 + Main.rand.Next(50);
57554 ai[2] = 0f;
57555 localAI[3] = 40f;
57556 }
57557 }
57558 if (position.X == localAI[3] && !flag11)
57559 {
57560 direction *= -1;
57561 netUpdate = true;
57562 localAI[3] = num45;
57563 }
57564 if (flag9 && !flag11)
57565 {
57566 if (localAI[3] > (float)num45)
57567 {
57568 localAI[3] = num45;
57569 }
57570 if (localAI[3] > 0f)
57571 {
57572 localAI[3] -= 1f;
57573 }
57574 }
57575 else
57576 {
57577 localAI[3] = -1f;
57578 }
57579 Tile tileSafely3 = Framing.GetTileSafely(num43, num44);
57580 Tile tileSafely4 = Framing.GetTileSafely(num43, num44 - 1);
57581 Tile tileSafely5 = Framing.GetTileSafely(num43, num44 - 2);
57582 bool flag14 = height / 16 < 3;
57583 if ((townNPC || NPCID.Sets.AllowDoorInteraction[type]) && tileSafely5.nactive() && (TileLoader.IsClosedDoor(tileSafely5) || tileSafely5.type == 388) && (Main.rand.Next(10) == 0 || flag))
57584 {
57585 if (Main.netMode != 1)
57586 {
57587 if (WorldGen.OpenDoor(num43, num44 - 2, direction))
57588 {
57589 closeDoor = true;
57590 doorX = num43;
57591 doorY = num44 - 2;
57592 NetMessage.SendData(19, -1, -1, null, 0, num43, num44 - 2, direction);
57593 netUpdate = true;
57594 ai[1] += 80f;
57595 }
57596 else if (WorldGen.OpenDoor(num43, num44 - 2, -direction))
57597 {
57598 closeDoor = true;
57599 doorX = num43;
57600 doorY = num44 - 2;
57601 NetMessage.SendData(19, -1, -1, null, 0, num43, num44 - 2, -direction);
57602 netUpdate = true;
57603 ai[1] += 80f;
57604 }
57605 else if (WorldGen.ShiftTallGate(num43, num44 - 2, closing: false))
57606 {
57607 closeDoor = true;
57608 doorX = num43;
57609 doorY = num44 - 2;
57610 NetMessage.SendData(19, -1, -1, null, 4, num43, num44 - 2);
57611 netUpdate = true;
57612 ai[1] += 80f;
57613 }
57614 else
57615 {
57616 direction *= -1;
57617 netUpdate = true;
57618 }
57619 }
57620 }
57621 else
57622 {
57623 if ((velocity.X < 0f && direction == -1) || (velocity.X > 0f && direction == 1))
57624 {
57625 bool flag15 = false;
57626 bool flag16 = false;
57627 if (tileSafely5.nactive() && Main.tileSolid[tileSafely5.type] && !Main.tileSolidTop[tileSafely5.type] && (!flag14 || (tileSafely4.nactive() && Main.tileSolid[tileSafely4.type] && !Main.tileSolidTop[tileSafely4.type])))
57628 {
57629 if (!Collision.SolidTilesVersatile(num43 - direction * 2, num43 - direction, num44 - 5, num44 - 1) && !Collision.SolidTiles(num43, num43, num44 - 5, num44 - 3))
57630 {
57631 velocity.Y = -6f;
57632 netUpdate = true;
57633 }
57634 else if (flag28)
57635 {
57636 if (WorldGen.SolidTile((int)(base.Center.X / 16f) + direction, (int)(base.Center.Y / 16f)))
57637 {
57638 direction *= -1;
57639 velocity.X *= 0f;
57640 netUpdate = true;
57641 }
57642 }
57643 else if (flag5)
57644 {
57645 flag16 = true;
57646 flag15 = true;
57647 }
57648 else if (!flag13)
57649 {
57650 flag15 = true;
57651 }
57652 }
57653 else if (tileSafely4.nactive() && Main.tileSolid[tileSafely4.type] && !Main.tileSolidTop[tileSafely4.type])
57654 {
57655 if (!Collision.SolidTilesVersatile(num43 - direction * 2, num43 - direction, num44 - 4, num44 - 1) && !Collision.SolidTiles(num43, num43, num44 - 4, num44 - 2))
57656 {
57657 velocity.Y = -5f;
57658 netUpdate = true;
57659 }
57660 else if (flag5)
57661 {
57662 flag16 = true;
57663 flag15 = true;
57664 }
57665 else
57666 {
57667 flag15 = true;
57668 }
57669 }
57670 else if (position.Y + (float)height - (float)(num44 * 16) > 20f && tileSafely3.nactive() && Main.tileSolid[tileSafely3.type] && !tileSafely3.topSlope())
57671 {
57672 if (!Collision.SolidTilesVersatile(num43 - direction * 2, num43, num44 - 3, num44 - 1))
57673 {
57674 velocity.Y = -4.4f;
57675 netUpdate = true;
57676 }
57677 else if (flag5)
57678 {
57679 flag16 = true;
57680 flag15 = true;
57681 }
57682 else
57683 {
57684 flag15 = true;
57685 }
57686 }
57687 else if (avoidFalling3)
57688 {
57689 if (!flag13)
57690 {
57691 flag15 = true;
57692 }
57693 if (flag5)
57694 {
57695 flag16 = true;
57696 }
57697 }
57698 else if (flag4 && !Collision.SolidTilesVersatile(num43 - direction * 2, num43 - direction, num44 - 2, num44 - 1))
57699 {
57700 velocity.Y = -5f;
57701 netUpdate = true;
57702 }
57703 if (flag16)
57704 {
57705 keepwalking3 = false;
57706 velocity.X = 0f;
57707 ai[0] = 8f;
57708 ai[1] = 240f;
57709 netUpdate = true;
57710 }
57711 if (flag15)
57712 {
57713 direction *= -1;
57714 velocity.X *= -1f;
57715 netUpdate = true;
57716 }
57717 if (keepwalking3)
57718 {
57719 ai[1] = 90f;
57720 netUpdate = true;
57721 }
57722 if (velocity.Y < 0f)
57723 {
57724 localAI[3] = position.X;
57725 }
57726 }
57727 if (velocity.Y < 0f && wet)
57728 {
57729 velocity.Y *= 1.2f;
57730 }
57731 if (velocity.Y < 0f && NPCID.Sets.TownCritter[type] && !flag28)
57732 {
57733 velocity.Y *= 1.2f;
57734 }
57735 }
57736 }
57737 else if (flag4 && !wet)
57738 {
57739 int num52 = (int)(base.Center.X / 16f);
57740 int num54 = (int)((position.Y + (float)height - 16f) / 16f);
57741 int num55 = 0;
57742 for (int num56 = -1; num56 <= 1; num56++)
57743 {
57744 for (int num57 = 1; num57 <= 6; num57++)
57745 {
57746 Tile tileSafely6 = Framing.GetTileSafely(num52 + num56, num54 + num57);
57747 if (tileSafely6.liquid > 0 || (tileSafely6.nactive() && Main.tileSolid[tileSafely6.type]))
57748 {
57749 num55++;
57750 }
57751 }
57752 }
57753 if (num55 <= 2)
57754 {
57755 if (velocity.X != 0f)
57756 {
57757 netUpdate = true;
57758 }
57759 velocity.X *= 0.2f;
57760 ai[0] = 0f;
57761 ai[1] = 50 + Main.rand.Next(50);
57762 ai[2] = 0f;
57763 localAI[3] = 40f;
57764 }
57765 }
57766 }
57767 }
57768 else if (ai[0] == 2f || ai[0] == 11f)
57769 {
57770 if (Main.netMode != 1)
57771 {
57772 localAI[3] -= 1f;
57773 if (Main.rand.Next(60) == 0 && localAI[3] == 0f)
57774 {
57775 localAI[3] = 60f;
57776 direction *= -1;
57777 netUpdate = true;
57778 }
57779 }
57780 ai[1] -= 1f;
57781 velocity.X *= 0.8f;
57782 if (ai[1] <= 0f)
57783 {
57784 localAI[3] = 40f;
57785 ai[0] = 0f;
57786 ai[1] = 60 + Main.rand.Next(60);
57787 netUpdate = true;
57788 }
57789 }
57790 else if (ai[0] == 3f || ai[0] == 4f || ai[0] == 5f || ai[0] == 8f || ai[0] == 9f || ai[0] == 16f || ai[0] == 17f || ai[0] == 20f || ai[0] == 21f || ai[0] == 22f || ai[0] == 23f)
57791 {
57792 velocity.X *= 0.8f;
57793 ai[1] -= 1f;
57794 if (ai[0] == 8f && ai[1] < 60f && flag5)
57795 {
57796 ai[1] = 180f;
57797 netUpdate = true;
57798 }
57799 if (ai[0] == 5f)
57800 {
57801 Point coords = (base.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
57802 Tile tile = Main.tile[coords.X, coords.Y];
57803 if (!TileID.Sets.CanBeSatOnForNPCs[tile.type])
57804 {
57805 ai[1] = 0f;
57806 }
57807 else
57808 {
57809 Main.sittingManager.AddNPC(whoAmI, coords);
57810 }
57811 }
57812 if (ai[1] <= 0f)
57813 {
57814 ai[0] = 0f;
57815 ai[1] = 60 + Main.rand.Next(60);
57816 ai[2] = 0f;
57817 localAI[3] = 30 + Main.rand.Next(60);
57818 netUpdate = true;
57819 }
57820 }
57821 else if (ai[0] == 6f || ai[0] == 7f || ai[0] == 18f || ai[0] == 19f)
57822 {
57823 if (ai[0] == 18f && (localAI[3] < 1f || localAI[3] > 2f))
57824 {
57825 localAI[3] = 2f;
57826 }
57827 velocity.X *= 0.8f;
57828 ai[1] -= 1f;
57829 int num58 = (int)ai[2];
57830 if (num58 < 0 || num58 > 255 || !Main.player[num58].CanBeTalkedTo || Main.player[num58].Distance(base.Center) > 200f || !Collision.CanHitLine(base.Top, 0, 0, Main.player[num58].Top, 0, 0))
57831 {
57832 ai[1] = 0f;
57833 }
57834 if (ai[1] > 0f)
57835 {
57836 int num59 = ((base.Center.X < Main.player[num58].Center.X) ? 1 : (-1));
57837 if (num59 != direction)
57838 {
57839 netUpdate = true;
57840 }
57841 direction = num59;
57842 }
57843 else
57844 {
57845 ai[0] = 0f;
57846 ai[1] = 60 + Main.rand.Next(60);
57847 ai[2] = 0f;
57848 localAI[3] = 30 + Main.rand.Next(60);
57849 netUpdate = true;
57850 }
57851 }
57852 else if (ai[0] == 10f)
57853 {
57854 int num60 = 0;
57855 int num61 = 0;
57856 float knockBack = 0f;
57857 float num62 = 0f;
57858 int num63 = 0;
57859 int num65 = 0;
57860 int maxValue = 0;
57861 float num66 = 0f;
57863 float num68 = 0f;
57864 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
57865 {
57866 frameCounter = 0.0;
57867 localAI[3] = 0f;
57868 }
57869 if (type == 38)
57870 {
57871 num60 = 30;
57872 num62 = 6f;
57873 num61 = 20;
57874 num63 = 10;
57875 num65 = 180;
57876 maxValue = 120;
57877 num66 = 16f;
57878 knockBack = 7f;
57879 }
57880 else if (type == 633)
57881 {
57882 num60 = 880;
57883 num62 = 24f;
57884 num61 = 15;
57885 num63 = 1;
57886 num66 = 0f;
57887 knockBack = 7f;
57888 num65 = 15;
57889 maxValue = 10;
57891 {
57892 num60 = 929;
57893 num61 = (int)((float)num61 * 1.5f);
57894 }
57895 }
57896 else if (type == 550)
57897 {
57898 num60 = 669;
57899 num62 = 6f;
57900 num61 = 24;
57901 num63 = 10;
57902 num65 = 120;
57903 maxValue = 60;
57904 num66 = 16f;
57905 knockBack = 9f;
57906 }
57907 else if (type == 588)
57908 {
57909 num60 = 721;
57910 num62 = 8f;
57911 num61 = 15;
57912 num63 = 5;
57913 num65 = 20;
57914 maxValue = 10;
57915 num66 = 16f;
57916 knockBack = 9f;
57917 }
57918 else if (type == 208)
57919 {
57920 num60 = 588;
57921 num62 = 6f;
57922 num61 = 30;
57923 num63 = 10;
57924 num65 = 60;
57925 maxValue = 120;
57926 num66 = 16f;
57927 knockBack = 6f;
57928 }
57929 else if (type == 17)
57930 {
57931 num60 = 48;
57932 num62 = 9f;
57933 num61 = 12;
57934 num63 = 10;
57935 num65 = 60;
57936 maxValue = 60;
57937 num66 = 16f;
57938 knockBack = 1.5f;
57939 }
57940 else if (type == 369)
57941 {
57942 num60 = 520;
57943 num62 = 12f;
57944 num61 = 10;
57945 num63 = 10;
57946 num65 = 0;
57947 maxValue = 1;
57948 num66 = 16f;
57949 knockBack = 3f;
57950 }
57951 else if (type == 453)
57952 {
57953 num60 = 21;
57954 num62 = 14f;
57955 num61 = 14;
57956 num63 = 10;
57957 num65 = 0;
57958 maxValue = 1;
57959 num66 = 16f;
57960 knockBack = 3f;
57961 }
57962 else if (type == 107)
57963 {
57964 num60 = 24;
57965 num62 = 5f;
57966 num61 = 15;
57967 num63 = 10;
57968 num65 = 60;
57969 maxValue = 60;
57970 num66 = 16f;
57971 knockBack = 1f;
57972 }
57973 else if (type == 124)
57974 {
57975 num60 = 582;
57976 num62 = 10f;
57977 num61 = 11;
57978 num63 = 1;
57979 num65 = 30;
57980 maxValue = 30;
57981 knockBack = 3.5f;
57982 }
57983 else if (type == 18)
57984 {
57985 num60 = 583;
57986 num62 = 8f;
57987 num61 = 8;
57988 num63 = 1;
57989 num65 = 15;
57990 maxValue = 10;
57991 knockBack = 2f;
57992 num66 = 10f;
57993 }
57994 else if (type == 142)
57995 {
57996 num60 = 589;
57997 num62 = 7f;
57998 num61 = 22;
57999 num63 = 1;
58000 num65 = 10;
58001 maxValue = 1;
58002 knockBack = 2f;
58003 num66 = 10f;
58004 }
58005 NPCLoader.TownNPCAttackStrength(this, ref num61, ref knockBack);
58009 if (Main.expertMode)
58010 {
58011 num61 = (int)((float)num61 * Main.GameModeInfo.TownNPCDamageMultiplier);
58012 }
58013 num61 = (int)((float)num61 * num42);
58014 velocity.X *= 0.8f;
58015 ai[1] -= 1f;
58016 localAI[3] += 1f;
58017 if (localAI[3] == (float)num63 && Main.netMode != 1)
58018 {
58019 Vector2 vec = -Vector2.UnitY;
58020 if (num13 == 1 && spriteDirection == 1 && num35 != -1)
58021 {
58022 vec = DirectionTo(Main.npc[num35].Center + new Vector2(0f, (0f - num66) * MathHelper.Clamp(Distance(Main.npc[num35].Center) / num67, 0f, 1f)));
58023 }
58024 if (num13 == -1 && spriteDirection == -1 && num24 != -1)
58025 {
58026 vec = DirectionTo(Main.npc[num24].Center + new Vector2(0f, (0f - num66) * MathHelper.Clamp(Distance(Main.npc[num24].Center) / num67, 0f, 1f)));
58027 }
58028 if (vec.HasNaNs() || Math.Sign(vec.X) != spriteDirection)
58029 {
58030 ((Vector2)(ref vec))._002Ector((float)spriteDirection, -1f);
58031 }
58032 vec *= num62;
58033 vec += Utils.RandomVector2(Main.rand, 0f - num68, num68);
58034 int num69 = 1000;
58035 num69 = ((type == 124) ? Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec.X, vec.Y, num60, num61, knockBack, Main.myPlayer, 0f, whoAmI, townNpcVariationIndex) : ((type != 142) ? Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec.X, vec.Y, num60, num61, knockBack, Main.myPlayer) : Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec.X, vec.Y, num60, num61, knockBack, Main.myPlayer, 0f, Main.rand.Next(5))));
58036 Main.projectile[num69].npcProj = true;
58037 Main.projectile[num69].noDropItem = true;
58038 if (type == 588)
58039 {
58040 Main.projectile[num69].timeLeft = 480;
58041 }
58042 }
58043 if (ai[1] <= 0f)
58044 {
58045 ai[0] = ((localAI[2] == 8f && flag5) ? 8 : 0);
58046 ai[1] = num65 + Main.rand.Next(maxValue);
58047 ai[2] = 0f;
58048 localAI[1] = (localAI[3] = num65 / 2 + Main.rand.Next(maxValue));
58049 netUpdate = true;
58050 }
58051 }
58052 else if (ai[0] == 12f)
58053 {
58054 int num70 = 0;
58055 int num71 = 0;
58056 float num72 = 0f;
58057 int num73 = 0;
58058 int num74 = 0;
58059 int maxValue2 = 0;
58060 float knockBack2 = 0f;
58061 float num76 = 0f;
58062 bool flag17 = false;
58063 float num77 = 0f;
58064 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
58065 {
58066 frameCounter = 0.0;
58067 localAI[3] = 0f;
58068 }
58069 int num78 = -1;
58070 if (num13 == 1 && spriteDirection == 1)
58071 {
58072 num78 = num35;
58073 }
58074 if (num13 == -1 && spriteDirection == -1)
58075 {
58076 num78 = num24;
58077 }
58078 if (type == 19)
58079 {
58080 num70 = 14;
58081 num72 = 13f;
58082 num71 = 24;
58083 num74 = 14;
58084 maxValue2 = 4;
58085 knockBack2 = 3f;
58086 num73 = 1;
58087 num77 = 0.5f;
58088 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
58089 {
58090 frameCounter = 0.0;
58091 localAI[3] = 0f;
58092 }
58093 if (Main.hardMode)
58094 {
58095 num71 = 15;
58096 if (localAI[3] > (float)num73)
58097 {
58098 num73 = 10;
58099 flag17 = true;
58100 }
58101 if (localAI[3] > (float)num73)
58102 {
58103 num73 = 20;
58104 flag17 = true;
58105 }
58106 if (localAI[3] > (float)num73)
58107 {
58108 num73 = 30;
58109 flag17 = true;
58110 }
58111 }
58112 }
58113 else if (type == 227)
58114 {
58115 num70 = 587;
58116 num72 = 10f;
58117 num71 = 8;
58118 num74 = 10;
58119 maxValue2 = 1;
58120 knockBack2 = 1.75f;
58121 num73 = 1;
58122 num77 = 0.5f;
58123 if (localAI[3] > (float)num73)
58124 {
58125 num73 = 12;
58126 flag17 = true;
58127 }
58128 if (localAI[3] > (float)num73)
58129 {
58130 num73 = 24;
58131 flag17 = true;
58132 }
58133 if (Main.hardMode)
58134 {
58135 num71 += 2;
58136 }
58137 }
58138 else if (type == 368)
58139 {
58140 num70 = 14;
58141 num72 = 13f;
58142 num71 = 24;
58143 num74 = 12;
58144 maxValue2 = 5;
58145 knockBack2 = 2f;
58146 num73 = 1;
58147 num77 = 0.2f;
58148 if (Main.hardMode)
58149 {
58150 num71 = 30;
58151 num70 = 357;
58152 }
58153 }
58154 else if (type == 22)
58155 {
58156 num72 = 10f;
58157 num71 = 8;
58158 num73 = 1;
58159 if (Main.hardMode)
58160 {
58161 num70 = 2;
58162 num74 = 15;
58163 maxValue2 = 10;
58164 num71 += 6;
58165 }
58166 else
58167 {
58168 num70 = 1;
58169 num74 = 30;
58170 maxValue2 = 20;
58171 }
58172 knockBack2 = 2.75f;
58173 num76 = 4f;
58174 num77 = 0.7f;
58175 }
58176 else if (type == 228)
58177 {
58178 num70 = 267;
58179 num72 = 14f;
58180 num71 = 20;
58181 num73 = 1;
58182 num74 = 10;
58183 maxValue2 = 1;
58184 knockBack2 = 3f;
58185 num76 = 6f;
58186 num77 = 0.4f;
58187 }
58188 else if (type == 178)
58189 {
58190 num70 = 242;
58191 num72 = 13f;
58192 num71 = ((!Main.hardMode) ? 11 : 15);
58193 num74 = 10;
58194 maxValue2 = 1;
58195 knockBack2 = 2f;
58196 num73 = 1;
58197 if (localAI[3] > (float)num73)
58198 {
58199 num73 = 8;
58200 flag17 = true;
58201 }
58202 if (localAI[3] > (float)num73)
58203 {
58204 num73 = 16;
58205 flag17 = true;
58206 }
58207 num77 = 0.3f;
58208 }
58209 else if (type == 229)
58210 {
58211 num70 = 14;
58212 num72 = 14f;
58213 num71 = 24;
58214 num74 = 10;
58215 maxValue2 = 1;
58216 knockBack2 = 2f;
58217 num73 = 1;
58218 num77 = 0.7f;
58219 if (localAI[3] > (float)num73)
58220 {
58221 num73 = 16;
58222 flag17 = true;
58223 }
58224 if (localAI[3] > (float)num73)
58225 {
58226 num73 = 24;
58227 flag17 = true;
58228 }
58229 if (localAI[3] > (float)num73)
58230 {
58231 num73 = 32;
58232 flag17 = true;
58233 }
58234 if (localAI[3] > (float)num73)
58235 {
58236 num73 = 40;
58237 flag17 = true;
58238 }
58239 if (localAI[3] > (float)num73)
58240 {
58241 num73 = 48;
58242 flag17 = true;
58243 }
58244 if (localAI[3] == 0f && num78 != -1 && Distance(Main.npc[num78].Center) < (float)NPCID.Sets.PrettySafe[type])
58245 {
58246 num77 = 0.1f;
58247 num70 = 162;
58248 num71 = 50;
58249 knockBack2 = 10f;
58250 num72 = 24f;
58251 }
58252 }
58253 else if (type == 209)
58254 {
58255 num70 = Utils.SelectRandom<int>(Main.rand, 134, 133, 135);
58256 num73 = 1;
58257 switch (num70)
58258 {
58259 case 135:
58260 num72 = 12f;
58261 num71 = 30;
58262 num74 = 30;
58263 maxValue2 = 10;
58264 knockBack2 = 7f;
58265 num77 = 0.2f;
58266 break;
58267 case 133:
58268 num72 = 10f;
58269 num71 = 25;
58270 num74 = 10;
58271 maxValue2 = 1;
58272 knockBack2 = 6f;
58273 num77 = 0.2f;
58274 break;
58275 case 134:
58276 num72 = 13f;
58277 num71 = 20;
58278 num74 = 20;
58279 maxValue2 = 10;
58280 knockBack2 = 4f;
58281 num77 = 0.1f;
58282 break;
58283 }
58284 }
58290 if (Main.expertMode)
58291 {
58292 num71 = (int)((float)num71 * Main.GameModeInfo.TownNPCDamageMultiplier);
58293 }
58294 num71 = (int)((float)num71 * num42);
58295 velocity.X *= 0.8f;
58296 ai[1] -= 1f;
58297 localAI[3] += 1f;
58298 if (localAI[3] == (float)num73 && Main.netMode != 1)
58299 {
58300 Vector2 vec2 = Vector2.Zero;
58301 if (num78 != -1)
58302 {
58303 vec2 = DirectionTo(Main.npc[num78].Center + new Vector2(0f, 0f - num76));
58304 }
58305 if (vec2.HasNaNs() || Math.Sign(vec2.X) != spriteDirection)
58306 {
58307 ((Vector2)(ref vec2))._002Ector((float)spriteDirection, 0f);
58308 }
58309 vec2 *= num72;
58310 vec2 += Utils.RandomVector2(Main.rand, 0f - num77, num77);
58311 int num79 = 1000;
58312 num79 = ((type != 227) ? Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec2.X, vec2.Y, num70, num71, knockBack2, Main.myPlayer) : Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec2.X, vec2.Y, num70, num71, knockBack2, Main.myPlayer, 0f, (float)Main.rand.Next(12) / 6f));
58313 Main.projectile[num79].npcProj = true;
58314 Main.projectile[num79].noDropItem = true;
58315 }
58316 if (localAI[3] == (float)num73 && flag17 && num78 != -1)
58317 {
58318 Vector2 vector2 = DirectionTo(Main.npc[num78].Center);
58319 if (vector2.Y <= 0.5f && vector2.Y >= -0.5f)
58320 {
58321 ai[2] = vector2.Y;
58322 }
58323 }
58324 if (ai[1] <= 0f)
58325 {
58326 ai[0] = ((localAI[2] == 8f && flag5) ? 8 : 0);
58327 ai[1] = num74 + Main.rand.Next(maxValue2);
58328 ai[2] = 0f;
58329 localAI[1] = (localAI[3] = num74 / 2 + Main.rand.Next(maxValue2));
58330 netUpdate = true;
58331 }
58332 }
58333 else if (ai[0] == 13f)
58334 {
58335 velocity.X *= 0.8f;
58336 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
58337 {
58338 frameCounter = 0.0;
58339 }
58340 ai[1] -= 1f;
58341 localAI[3] += 1f;
58342 if (localAI[3] == 1f && Main.netMode != 1)
58343 {
58344 Vector2 vec3 = DirectionTo(Main.npc[(int)ai[2]].Center + new Vector2(0f, -20f));
58345 if (vec3.HasNaNs() || Math.Sign(vec3.X) == -spriteDirection)
58346 {
58347 ((Vector2)(ref vec3))._002Ector((float)spriteDirection, -1f);
58348 }
58349 vec3 *= 8f;
58350 int num80 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec3.X, vec3.Y, 584, 0, 0f, Main.myPlayer, ai[2]);
58351 Main.projectile[num80].npcProj = true;
58352 Main.projectile[num80].noDropItem = true;
58353 }
58354 if (ai[1] <= 0f)
58355 {
58356 ai[0] = 0f;
58357 ai[1] = 10 + Main.rand.Next(10);
58358 ai[2] = 0f;
58359 localAI[3] = 5 + Main.rand.Next(10);
58360 netUpdate = true;
58361 }
58362 }
58363 else if (ai[0] == 14f)
58364 {
58365 int num81 = 0;
58366 int num82 = 0;
58367 float num83 = 0f;
58368 int num84 = 0;
58369 int num85 = 0;
58370 int maxValue3 = 0;
58371 float knockBack3 = 0f;
58372 float num87 = 0f;
58374 float num89 = 1f;
58375 float num90 = 0f;
58376 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
58377 {
58378 frameCounter = 0.0;
58379 localAI[3] = 0f;
58380 }
58381 int num91 = -1;
58382 if (num13 == 1 && spriteDirection == 1)
58383 {
58384 num91 = num35;
58385 }
58386 if (num13 == -1 && spriteDirection == -1)
58387 {
58388 num91 = num24;
58389 }
58390 if (type == 54)
58391 {
58392 num81 = 585;
58393 num83 = 10f;
58394 num82 = 16;
58395 num84 = 30;
58396 num85 = 20;
58397 maxValue3 = 15;
58398 knockBack3 = 2f;
58399 num90 = 1f;
58400 }
58401 else if (type == 108)
58402 {
58403 num81 = 15;
58404 num83 = 6f;
58405 num82 = 18;
58406 num84 = 15;
58407 num85 = 15;
58408 maxValue3 = 5;
58409 knockBack3 = 3f;
58410 num87 = 20f;
58411 }
58412 else if (type == 160)
58413 {
58414 num81 = 590;
58415 num82 = 40;
58416 num84 = 15;
58417 num85 = 10;
58418 maxValue3 = 1;
58419 knockBack3 = 3f;
58420 for (; localAI[3] > (float)num84; num84 += 15)
58421 {
58422 }
58423 }
58424 else if (type == 663)
58425 {
58426 num81 = 950;
58427 num82 = ((!Main.hardMode) ? 15 : 20);
58428 num84 = 15;
58429 num85 = 0;
58430 maxValue3 = 0;
58431 knockBack3 = 3f;
58432 for (; localAI[3] > (float)num84; num84 += 10)
58433 {
58434 }
58435 }
58436 else if (type == 20)
58437 {
58438 num81 = 586;
58439 num84 = 24;
58440 num85 = 10;
58441 maxValue3 = 1;
58442 knockBack3 = 3f;
58443 }
58449 if (Main.expertMode)
58450 {
58451 num82 = (int)((float)num82 * Main.GameModeInfo.TownNPCDamageMultiplier);
58452 }
58453 num82 = (int)((float)num82 * num42);
58454 velocity.X *= 0.8f;
58455 ai[1] -= 1f;
58456 localAI[3] += 1f;
58457 if (localAI[3] == (float)num84 && Main.netMode != 1)
58458 {
58459 Vector2 vec4 = Vector2.Zero;
58460 if (num91 != -1)
58461 {
58462 vec4 = DirectionTo(Main.npc[num91].Center + new Vector2(0f, (0f - num87) * MathHelper.Clamp(Distance(Main.npc[num91].Center) / num88, 0f, 1f)));
58463 }
58464 if (vec4.HasNaNs() || Math.Sign(vec4.X) != spriteDirection)
58465 {
58466 ((Vector2)(ref vec4))._002Ector((float)spriteDirection, 0f);
58467 }
58468 vec4 *= num83;
58469 vec4 += Utils.RandomVector2(Main.rand, 0f - num90, num90);
58470 if (type == 108)
58471 {
58472 int num92 = Utils.SelectRandom<int>(Main.rand, 1, 1, 1, 1, 2, 2, 3);
58473 for (int num93 = 0; num93 < num92; num93++)
58474 {
58475 Vector2 vector3 = Utils.RandomVector2(Main.rand, -3.4f, 3.4f);
58476 int num94 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec4.X + vector3.X, vec4.Y + vector3.Y, num81, num82, knockBack3, Main.myPlayer, 0f, 0f, townNpcVariationIndex);
58477 Main.projectile[num94].npcProj = true;
58478 Main.projectile[num94].noDropItem = true;
58479 }
58480 }
58481 else if (type == 160)
58482 {
58483 if (num91 != -1)
58484 {
58485 Vector2 vector4 = Main.npc[num91].position - Main.npc[num91].Size * 2f + Main.npc[num91].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 5f;
58486 int num95 = 10;
58487 while (num95 > 0 && WorldGen.SolidTile(Framing.GetTileSafely((int)vector4.X / 16, (int)vector4.Y / 16)))
58488 {
58489 num95--;
58490 vector4 = Main.npc[num91].position - Main.npc[num91].Size * 2f + Main.npc[num91].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 5f;
58491 }
58492 int num96 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector4.X, vector4.Y, 0f, 0f, num81, num82, knockBack3, Main.myPlayer, 0f, 0f, townNpcVariationIndex);
58493 Main.projectile[num96].npcProj = true;
58494 Main.projectile[num96].noDropItem = true;
58495 }
58496 }
58497 else if (type == 663)
58498 {
58499 if (num91 != -1)
58500 {
58501 Vector2 vector5 = Main.npc[num91].position + Main.npc[num91].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 1f;
58502 int num98 = 5;
58503 while (num98 > 0 && WorldGen.SolidTile(Framing.GetTileSafely((int)vector5.X / 16, (int)vector5.Y / 16)))
58504 {
58505 num98--;
58506 vector5 = Main.npc[num91].position + Main.npc[num91].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 1f;
58507 }
58508 int num99 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector5.X, vector5.Y, 0f, 0f, num81, num82, knockBack3, Main.myPlayer, 0f, 0f, townNpcVariationIndex);
58509 Main.projectile[num99].npcProj = true;
58510 Main.projectile[num99].noDropItem = true;
58511 }
58512 }
58513 else if (type == 20)
58514 {
58515 int num100 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec4.X, vec4.Y, num81, num82, knockBack3, Main.myPlayer, 0f, whoAmI, townNpcVariationIndex);
58516 Main.projectile[num100].npcProj = true;
58517 Main.projectile[num100].noDropItem = true;
58518 }
58519 else
58520 {
58521 int num101 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec4.X, vec4.Y, num81, num82, knockBack3, Main.myPlayer);
58522 Main.projectile[num101].npcProj = true;
58523 Main.projectile[num101].noDropItem = true;
58524 }
58525 }
58526 if (num89 > 0f)
58527 {
58529 Vector3 vector6 = ((Color)(ref newColor)).ToVector3() * num89;
58530 Lighting.AddLight(base.Center, vector6.X, vector6.Y, vector6.Z);
58531 }
58532 if (ai[1] <= 0f)
58533 {
58534 ai[0] = ((localAI[2] == 8f && flag5) ? 8 : 0);
58535 ai[1] = num85 + Main.rand.Next(maxValue3);
58536 ai[2] = 0f;
58537 localAI[1] = (localAI[3] = num85 / 2 + Main.rand.Next(maxValue3));
58538 netUpdate = true;
58539 }
58540 }
58541 else if (ai[0] == 15f)
58542 {
58543 int num102 = 0;
58544 int maxValue4 = 0;
58545 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
58546 {
58547 frameCounter = 0.0;
58548 localAI[3] = 0f;
58549 }
58550 int num103 = 0;
58551 float num104 = 0f;
58552 int num105 = 0;
58553 int num106 = 0;
58554 if (num13 == 1)
58555 {
58557 }
58558 if (num13 == -1)
58559 {
58561 }
58562 if (type == 207)
58563 {
58564 num103 = 11;
58565 num105 = (num106 = 32);
58566 num102 = 12;
58567 maxValue4 = 6;
58568 num104 = 4.25f;
58569 }
58570 else if (type == 441)
58571 {
58572 num103 = 9;
58573 num105 = (num106 = 28);
58574 num102 = 9;
58575 maxValue4 = 3;
58576 num104 = 3.5f;
58577 if (GivenName == "Andrew")
58578 {
58579 num103 *= 2;
58580 num104 *= 2f;
58581 }
58582 }
58583 else if (type == 353)
58584 {
58585 num103 = 10;
58586 num105 = (num106 = 32);
58587 num102 = 15;
58588 maxValue4 = 8;
58589 num104 = 5f;
58590 }
58591 else if (NPCID.Sets.IsTownPet[type])
58592 {
58593 num103 = 10;
58594 num105 = (num106 = 32);
58595 num102 = 15;
58596 maxValue4 = 8;
58597 num104 = 3f;
58598 }
58602 if (Main.expertMode)
58603 {
58604 num103 = (int)((float)num103 * Main.GameModeInfo.TownNPCDamageMultiplier);
58605 }
58606 num103 = (int)((float)num103 * num42);
58607 velocity.X *= 0.8f;
58608 ai[1] -= 1f;
58609 if (Main.netMode != 1)
58610 {
58612 Rectangle itemRectangle = default(Rectangle);
58613 ((Rectangle)(ref itemRectangle))._002Ector((int)swingStats.Item1.X, (int)swingStats.Item1.Y, num105, num106);
58614 if (spriteDirection == -1)
58615 {
58616 itemRectangle.X -= num105;
58617 }
58618 itemRectangle.Y -= num106;
58620 int myPlayer = Main.myPlayer;
58621 for (int num107 = 0; num107 < 200; num107++)
58622 {
58623 NPC nPC2 = Main.npc[num107];
58624 if (nPC2.active && nPC2.immune[myPlayer] == 0 && !nPC2.dontTakeDamage && !nPC2.friendly && nPC2.damage > 0 && ((Rectangle)(ref itemRectangle)).Intersects(nPC2.Hitbox) && (nPC2.noTileCollide || Collision.CanHit(position, width, height, nPC2.position, nPC2.width, nPC2.height)))
58625 {
58626 nPC2.StrikeNPCNoInteraction(num103, num104, spriteDirection);
58627 if (Main.netMode != 0)
58628 {
58629 NetMessage.SendData(28, -1, -1, null, num107, num103, num104, spriteDirection);
58630 }
58631 nPC2.netUpdate = true;
58632 nPC2.immune[myPlayer] = (int)ai[1] + 2;
58633 }
58634 }
58635 }
58636 if (ai[1] <= 0f)
58637 {
58638 bool flag18 = false;
58639 if (flag5)
58640 {
58641 int num109 = -num13;
58642 if (!Collision.CanHit(base.Center, 0, 0, base.Center + Vector2.UnitX * (float)num109 * 32f, 0, 0) || localAI[2] == 8f)
58643 {
58644 flag18 = true;
58645 }
58646 if (flag18)
58647 {
58649 int num111 = ((num13 == 1) ? num35 : num24);
58650 int num112 = ((num13 == 1) ? num24 : num35);
58651 if (num111 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num111].Center, 0, 0))
58652 {
58653 num111 = ((num112 == -1 || !Collision.CanHit(base.Center, 0, 0, Main.npc[num112].Center, 0, 0)) ? (-1) : num112);
58654 }
58655 if (num111 != -1)
58656 {
58657 ai[0] = 15f;
58658 ai[1] = num110;
58659 ai[2] = 0f;
58660 localAI[3] = 0f;
58661 direction = ((position.X < Main.npc[num111].position.X) ? 1 : (-1));
58662 netUpdate = true;
58663 }
58664 else
58665 {
58666 flag18 = false;
58667 }
58668 }
58669 }
58670 if (!flag18)
58671 {
58672 ai[0] = ((localAI[2] == 8f && flag5) ? 8 : 0);
58673 ai[1] = num102 + Main.rand.Next(maxValue4);
58674 ai[2] = 0f;
58675 localAI[1] = (localAI[3] = num102 / 2 + Main.rand.Next(maxValue4));
58676 netUpdate = true;
58677 }
58678 }
58679 }
58680 else if (ai[0] == 24f)
58681 {
58682 velocity.X *= 0.8f;
58683 ai[1] -= 1f;
58684 localAI[3] += 1f;
58685 direction = 1;
58686 spriteDirection = 1;
58688 Vector3 vector7 = ((Color)(ref newColor)).ToVector3();
58689 Lighting.AddLight(base.Center, vector7.X, vector7.Y, vector7.Z);
58690 if (ai[1] <= 0f)
58691 {
58692 ai[0] = 0f;
58693 ai[1] = 480f;
58694 ai[2] = 0f;
58695 localAI[1] = 480f;
58696 netUpdate = true;
58697 }
58698 }
58699 if (flag3 && wet)
58700 {
58701 int num113 = (int)(base.Center.X / 16f);
58702 int num114 = 5;
58703 if (collideX || (num113 < num114 && direction == -1) || (num113 > Main.maxTilesX - num114 && direction == 1))
58704 {
58705 direction *= -1;
58706 velocity.X *= -0.25f;
58707 netUpdate = true;
58708 }
58709 velocity.Y *= 0.9f;
58710 velocity.Y -= 0.5f;
58711 if (velocity.Y < -15f)
58712 {
58713 velocity.Y = -15f;
58714 }
58715 }
58716 if (flag2 && wet)
58717 {
58718 if (flag30)
58719 {
58720 ai[1] = 50f;
58721 }
58722 int num115 = (int)(base.Center.X / 16f);
58723 int num116 = 5;
58724 if (collideX || (num115 < num116 && direction == -1) || (num115 > Main.maxTilesX - num116 && direction == 1))
58725 {
58726 direction *= -1;
58727 velocity.X *= -0.25f;
58728 netUpdate = true;
58729 }
58730 if (Collision.GetWaterLine(base.Center.ToTileCoordinates(), out var waterLineHeight))
58731 {
58732 float num117 = base.Center.Y + 1f;
58733 if (base.Center.Y > waterLineHeight)
58734 {
58735 velocity.Y -= 0.8f;
58736 if (velocity.Y < -4f)
58737 {
58738 velocity.Y = -4f;
58739 }
58741 {
58742 velocity.Y = waterLineHeight - num117;
58743 }
58744 }
58745 else
58746 {
58747 velocity.Y = MathHelper.Min(velocity.Y, waterLineHeight - num117);
58748 }
58749 }
58750 else
58751 {
58752 velocity.Y -= 0.2f;
58753 }
58754 }
58755 if (Main.netMode != 1 && isLikeATownNPC && !flag23)
58756 {
58757 bool flag19 = ai[0] < 2f && !flag5 && !wet;
58758 bool flag20 = (ai[0] < 2f || ai[0] == 8f) && (flag5 || flag6);
58759 if (localAI[1] > 0f)
58760 {
58761 localAI[1] -= 1f;
58762 }
58763 if (localAI[1] > 0f)
58764 {
58765 flag20 = false;
58766 }
58767 if (flag20 && type == 124 && localAI[0] == 1f)
58768 {
58769 flag20 = false;
58770 }
58771 if (flag20 && type == 20)
58772 {
58773 flag20 = false;
58774 for (int num118 = 0; num118 < 200; num118++)
58775 {
58776 NPC nPC3 = Main.npc[num118];
58777 if (nPC3.active && nPC3.townNPC && !(Distance(nPC3.Center) > 1200f) && nPC3.FindBuffIndex(165) == -1)
58778 {
58779 flag20 = true;
58780 break;
58781 }
58782 }
58783 }
58784 if (CanTalk && flag19 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(300) == 0)
58785 {
58786 int num120 = 420;
58787 num120 = ((Main.rand.Next(2) != 0) ? (num120 * Main.rand.Next(1, 3)) : (num120 * Main.rand.Next(1, 4)));
58788 int num121 = 100;
58789 int num122 = 20;
58790 for (int num123 = 0; num123 < 200; num123++)
58791 {
58792 NPC nPC4 = Main.npc[num123];
58793 bool flag21 = (nPC4.ai[0] == 1f && nPC4.closeDoor) || (nPC4.ai[0] == 1f && nPC4.ai[1] > 200f) || nPC4.ai[0] > 1f || nPC4.wet;
58794 if (nPC4 != this && nPC4.active && nPC4.CanBeTalkedTo && !flag21 && nPC4.Distance(base.Center) < (float)num121 && nPC4.Distance(base.Center) > (float)num122 && Collision.CanHit(base.Center, 0, 0, nPC4.Center, 0, 0))
58795 {
58796 int num124 = (position.X < nPC4.position.X).ToDirectionInt();
58797 ai[0] = 3f;
58798 ai[1] = num120;
58799 ai[2] = num123;
58800 direction = num124;
58801 netUpdate = true;
58802 nPC4.ai[0] = 4f;
58803 nPC4.ai[1] = num120;
58804 nPC4.ai[2] = whoAmI;
58805 nPC4.direction = -num124;
58806 nPC4.netUpdate = true;
58807 break;
58808 }
58809 }
58810 }
58811 else if (CanTalk && flag19 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(1800) == 0)
58812 {
58813 int num125 = 420;
58814 num125 = ((Main.rand.Next(2) != 0) ? (num125 * Main.rand.Next(1, 3)) : (num125 * Main.rand.Next(1, 4)));
58815 int num126 = 100;
58816 int num127 = 20;
58817 for (int num128 = 0; num128 < 200; num128++)
58818 {
58819 NPC nPC5 = Main.npc[num128];
58820 bool flag22 = (nPC5.ai[0] == 1f && nPC5.closeDoor) || (nPC5.ai[0] == 1f && nPC5.ai[1] > 200f) || nPC5.ai[0] > 1f || nPC5.wet;
58821 if (nPC5 != this && nPC5.active && nPC5.CanBeTalkedTo && !NPCID.Sets.IsTownPet[nPC5.type] && !flag22 && nPC5.Distance(base.Center) < (float)num126 && nPC5.Distance(base.Center) > (float)num127 && Collision.CanHit(base.Center, 0, 0, nPC5.Center, 0, 0))
58822 {
58823 int num129 = (position.X < nPC5.position.X).ToDirectionInt();
58824 ai[0] = 16f;
58825 ai[1] = num125;
58826 ai[2] = num128;
58827 localAI[2] = Main.rand.Next(4);
58828 localAI[3] = Main.rand.Next(3 - (int)localAI[2]);
58829 direction = num129;
58830 netUpdate = true;
58831 nPC5.ai[0] = 17f;
58832 nPC5.ai[1] = num125;
58833 nPC5.ai[2] = whoAmI;
58834 nPC5.localAI[2] = 0f;
58835 nPC5.localAI[3] = 0f;
58836 nPC5.direction = -num129;
58837 nPC5.netUpdate = true;
58838 break;
58839 }
58840 }
58841 }
58842 else if (!NPCID.Sets.IsTownPet[type] && flag19 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(1200) == 0 && (type == 208 || (BirthdayParty.PartyIsUp && NPCID.Sets.AttackType[type] == NPCID.Sets.AttackType[208])))
58843 {
58844 int num3 = 300;
58845 int num4 = 150;
58846 for (int num5 = 0; num5 < 255; num5++)
58847 {
58848 Player player = Main.player[num5];
58849 if (player.active && !player.dead && player.Distance(base.Center) < (float)num4 && Collision.CanHitLine(base.Top, 0, 0, player.Top, 0, 0))
58850 {
58851 int num6 = (position.X < player.position.X).ToDirectionInt();
58852 ai[0] = 6f;
58853 ai[1] = num3;
58854 ai[2] = num5;
58855 direction = num6;
58856 netUpdate = true;
58857 break;
58858 }
58859 }
58860 }
58861 else if (flag19 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(600) == 0 && type == 550)
58862 {
58863 int num7 = 300;
58864 int num8 = 150;
58865 for (int num9 = 0; num9 < 255; num9++)
58866 {
58867 Player player2 = Main.player[num9];
58868 if (player2.active && !player2.dead && player2.Distance(base.Center) < (float)num8 && Collision.CanHitLine(base.Top, 0, 0, player2.Top, 0, 0))
58869 {
58870 int num10 = (position.X < player2.position.X).ToDirectionInt();
58871 ai[0] = 18f;
58872 ai[1] = num7;
58873 ai[2] = num9;
58874 direction = num10;
58875 netUpdate = true;
58876 break;
58877 }
58878 }
58879 }
58880 else if (!NPCID.Sets.IsTownPet[type] && flag19 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(1800) == 0)
58881 {
58882 ai[0] = 2f;
58883 ai[1] = 45 * Main.rand.Next(1, 2);
58884 netUpdate = true;
58885 }
58886 else if (flag19 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(600) == 0 && type == 229 && !flag6)
58887 {
58888 ai[0] = 11f;
58889 ai[1] = 30 * Main.rand.Next(1, 4);
58890 netUpdate = true;
58891 }
58892 else if (flag19 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(1200) == 0)
58893 {
58894 int num11 = 220;
58895 int num12 = 150;
58896 for (int num14 = 0; num14 < 255; num14++)
58897 {
58898 Player player3 = Main.player[num14];
58899 if (player3.CanBeTalkedTo && player3.Distance(base.Center) < (float)num12 && Collision.CanHitLine(base.Top, 0, 0, player3.Top, 0, 0))
58900 {
58901 int num15 = (position.X < player3.position.X).ToDirectionInt();
58902 ai[0] = 7f;
58903 ai[1] = num11;
58904 ai[2] = num14;
58905 direction = num15;
58906 netUpdate = true;
58907 break;
58908 }
58909 }
58910 }
58911 else if (flag19 && ai[0] == 1f && velocity.Y == 0f && num > 0 && Main.rand.Next(num) == 0)
58912 {
58913 Point point = (base.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
58914 bool flag24 = WorldGen.InWorld(point.X, point.Y, 1);
58915 if (flag24)
58916 {
58917 for (int num16 = 0; num16 < 200; num16++)
58918 {
58919 if (Main.npc[num16].active && Main.npc[num16].aiStyle == 7 && Main.npc[num16].townNPC && Main.npc[num16].ai[0] == 5f && (Main.npc[num16].Bottom + Vector2.UnitY * -2f).ToTileCoordinates() == point)
58920 {
58921 flag24 = false;
58922 break;
58923 }
58924 }
58925 for (int num17 = 0; num17 < 255; num17++)
58926 {
58927 if (Main.player[num17].active && Main.player[num17].sitting.isSitting && Main.player[num17].Center.ToTileCoordinates() == point)
58928 {
58929 flag24 = false;
58930 break;
58931 }
58932 }
58933 }
58934 if (flag24)
58935 {
58936 Tile tile2 = Main.tile[point.X, point.Y];
58938 if (flag24 && tile2.type == 15 && tile2.frameY >= 1080 && tile2.frameY <= 1098)
58939 {
58940 flag24 = false;
58941 }
58942 if (flag24)
58943 {
58944 ai[0] = 5f;
58945 ai[1] = 900 + Main.rand.Next(10800);
58946 SitDown(point, out var targetDirection, out var bottom);
58948 base.Bottom = bottom;
58949 velocity = Vector2.Zero;
58950 localAI[3] = 0f;
58951 netUpdate = true;
58952 }
58953 }
58954 }
58955 else if (flag19 && ai[0] == 1f && velocity.Y == 0f && Main.rand.Next(600) == 0 && Utils.PlotTileLine(base.Top, base.Bottom, width, DelegateMethods.SearchAvoidedByNPCs))
58956 {
58957 Point point2 = (base.Center + new Vector2((float)(direction * 10), 0f)).ToTileCoordinates();
58958 bool flag25 = WorldGen.InWorld(point2.X, point2.Y, 1);
58959 if (flag25)
58960 {
58961 Tile tileSafely7 = Framing.GetTileSafely(point2.X, point2.Y);
58962 if (!tileSafely7.nactive() || !TileID.Sets.InteractibleByNPCs[tileSafely7.type])
58963 {
58964 flag25 = false;
58965 }
58966 }
58967 if (flag25)
58968 {
58969 ai[0] = 9f;
58970 ai[1] = 40 + Main.rand.Next(90);
58971 velocity = Vector2.Zero;
58972 localAI[3] = 0f;
58973 netUpdate = true;
58974 }
58975 }
58976 if (Main.netMode != 1 && ai[0] < 2f && velocity.Y == 0f && type == 18 && breath > 0)
58977 {
58978 int num18 = -1;
58979 for (int num19 = 0; num19 < 200; num19++)
58980 {
58981 NPC nPC6 = Main.npc[num19];
58982 if (nPC6.active && nPC6.townNPC && nPC6.life != nPC6.lifeMax && (num18 == -1 || nPC6.lifeMax - nPC6.life > Main.npc[num18].lifeMax - Main.npc[num18].life) && Collision.CanHitLine(position, width, height, nPC6.position, nPC6.width, nPC6.height) && Distance(nPC6.Center) < 500f)
58983 {
58984 num18 = num19;
58985 }
58986 }
58987 if (num18 != -1)
58988 {
58989 ai[0] = 13f;
58990 ai[1] = 34f;
58991 ai[2] = num18;
58992 localAI[3] = 0f;
58993 direction = ((position.X < Main.npc[num18].position.X) ? 1 : (-1));
58994 netUpdate = true;
58995 }
58996 }
58997 if (flag20 && velocity.Y == 0f && NPCID.Sets.AttackType[type] == 0 && NPCID.Sets.AttackAverageChance[type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[type] * 2) == 0)
58998 {
59000 int num21 = ((num13 == 1) ? num35 : num24);
59001 int num22 = ((num13 == 1) ? num24 : num35);
59002 if (num21 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num21].Center, 0, 0))
59003 {
59004 num21 = ((num22 == -1 || !Collision.CanHit(base.Center, 0, 0, Main.npc[num22].Center, 0, 0)) ? (-1) : num22);
59005 }
59006 bool flag26 = num21 != -1;
59007 if (flag26 && type == 633)
59008 {
59009 flag26 = Vector2.Distance(base.Center, Main.npc[num21].Center) <= 50f;
59010 }
59011 if (flag26)
59012 {
59013 localAI[2] = ai[0];
59014 ai[0] = 10f;
59015 ai[1] = num20;
59016 ai[2] = 0f;
59017 localAI[3] = 0f;
59018 direction = ((position.X < Main.npc[num21].position.X) ? 1 : (-1));
59019 netUpdate = true;
59020 }
59021 }
59022 else if (flag20 && velocity.Y == 0f && NPCID.Sets.AttackType[type] == 1 && NPCID.Sets.AttackAverageChance[type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[type] * 2) == 0)
59023 {
59025 int num25 = ((num13 == 1) ? num35 : num24);
59026 int num26 = ((num13 == 1) ? num24 : num35);
59027 if (num25 != -1 && !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num25].Center, 0, 0))
59028 {
59029 num25 = ((num26 == -1 || !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num26].Center, 0, 0)) ? (-1) : num26);
59030 }
59031 if (num25 != -1)
59032 {
59033 Vector2 vector8 = DirectionTo(Main.npc[num25].Center);
59034 if (vector8.Y <= 0.5f && vector8.Y >= -0.5f)
59035 {
59036 localAI[2] = ai[0];
59037 ai[0] = 12f;
59038 ai[1] = num23;
59039 ai[2] = vector8.Y;
59040 localAI[3] = 0f;
59041 direction = ((position.X < Main.npc[num25].position.X) ? 1 : (-1));
59042 netUpdate = true;
59043 }
59044 }
59045 }
59046 if (flag20 && velocity.Y == 0f && NPCID.Sets.AttackType[type] == 2 && NPCID.Sets.AttackAverageChance[type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[type] * 2) == 0)
59047 {
59049 int num28 = ((num13 == 1) ? num35 : num24);
59050 int num29 = ((num13 == 1) ? num24 : num35);
59051 if (num28 != -1 && !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num28].Center, 0, 0))
59052 {
59053 num28 = ((num29 == -1 || !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num29].Center, 0, 0)) ? (-1) : num29);
59054 }
59055 if (num28 != -1)
59056 {
59057 localAI[2] = ai[0];
59058 ai[0] = 14f;
59059 ai[1] = num27;
59060 ai[2] = 0f;
59061 localAI[3] = 0f;
59062 direction = ((position.X < Main.npc[num28].position.X) ? 1 : (-1));
59063 netUpdate = true;
59064 }
59065 else if (type == 20)
59066 {
59067 localAI[2] = ai[0];
59068 ai[0] = 14f;
59069 ai[1] = num27;
59070 ai[2] = 0f;
59071 localAI[3] = 0f;
59072 netUpdate = true;
59073 }
59074 }
59075 if (flag20 && velocity.Y == 0f && NPCID.Sets.AttackType[type] == 3 && NPCID.Sets.AttackAverageChance[type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[type] * 2) == 0)
59076 {
59078 int num31 = ((num13 == 1) ? num35 : num24);
59079 int num32 = ((num13 == 1) ? num24 : num35);
59080 if (num31 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num31].Center, 0, 0))
59081 {
59082 num31 = ((num32 == -1 || !Collision.CanHit(base.Center, 0, 0, Main.npc[num32].Center, 0, 0)) ? (-1) : num32);
59083 }
59084 if (num31 != -1)
59085 {
59086 localAI[2] = ai[0];
59087 ai[0] = 15f;
59088 ai[1] = num30;
59089 ai[2] = 0f;
59090 localAI[3] = 0f;
59091 direction = ((position.X < Main.npc[num31].position.X) ? 1 : (-1));
59092 netUpdate = true;
59093 }
59094 }
59095 }
59096 if (type == 681)
59097 {
59098 float R = 0f;
59099 float G = 0f;
59100 float B = 0f;
59101 TorchID.TorchColor(23, out R, out G, out B);
59102 float num33 = 0.35f;
59103 R *= num33;
59104 G *= num33;
59105 B *= num33;
59106 Lighting.AddLight(base.Center, R, G, B);
59107 }
59108 if (type == 683 || type == 687)
59109 {
59110 float num34 = Utils.WrappedLerp(0.75f, 1f, (float)Main.timeForVisualEffects % 120f / 120f);
59111 Lighting.AddLight(base.Center, 0.25f * num34, 0.25f * num34, 0.1f * num34);
59112 }
59113 }
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 ...
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
bool honeyWet
Definition Entity.cs:61
Vector2 Center
Definition Entity.cs:70
bool shimmerWet
Definition Entity.cs:59
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
float Distance(Vector2 Other)
Definition Entity.cs:275
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
Vector2 DirectionTo(Vector2 Destination)
Definition Entity.cs:289
bool active
If true, the Entity actually exists within the game world. Within the specific entity array,...
Definition Entity.cs:21
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static void BroadcastParticleSpawn(ParticleOrchestraType type, ParticleOrchestraSettings settings)
static void RequestParticleSpawn(bool clientOnly, ParticleOrchestraType type, ParticleOrchestraSettings settings, int? overrideInvokingPlayerIndex=null)
static int[] PrettySafe
The maximum distance in pixels that an enemy can be from this town NPC before they try to attack....
Definition NPCID.cs:524
static bool[] Skeletons
If true for a given NPC type (F:Terraria.NPC.type), then that NPC is a type of skeleton....
Definition NPCID.cs:551
static bool[] TownCritter
If true for a given NPC type (F:Terraria.NPC.type), then that NPC is a critter that can spawn in town...
Definition NPCID.cs:409
static bool[] IsTownPet
If true for a given NPC type (F:Terraria.NPC.type), then that NPC is categorized as a town pet....
Definition NPCID.cs:224
static int[] AttackTime
The duration of this town NPC's attack animation in ticks. Defaults to -1.
Definition NPCID.cs:496
static bool[] IsTownSlime
If true for a given NPC type (F:Terraria.NPC.type), then that NPC is categorized as a town slime....
Definition NPCID.cs:232
static int[] AttackType
Determines how a town NPC with the given NPC type (F:Terraria.NPC.type) attacks. For -1,...
Definition NPCID.cs:518
static int[] AttackAverageChance
The chance that this town NPC attacks if it detects danger. The actual chance is 1 / (retrieved val...
Definition NPCID.cs:503
static bool[] AllowDoorInteraction
Whether or not this NPC can still interact with doors if they use the Vanilla TownNPC aiStyle (AKA ai...
Definition NPCID.cs:660
static int[] DangerDetectRange
The distance, in pixels, that this town NPC will check for enemies to attack. Any enemies beyond this...
Definition NPCID.cs:461
static bool[] CanBeSatOnForNPCs
Definition TileID.cs:181
static bool[] InteractibleByNPCs
Definition TileID.cs:340
static void TorchColor(int torchID, out float R, out float G, out float B)
Definition TorchID.cs:164
static void TownNPCAttackStrength(NPC npc, ref int damage, ref float knockback)
static void TownNPCAttackMagic(NPC npc, ref float auraLightMultiplier)
static void TownNPCAttackProj(NPC npc, ref int projType, ref int attackDelay)
static void TownNPCAttackShoot(NPC npc, ref bool inBetweenShots)
static void TownNPCAttackSwing(NPC npc, ref int itemWidth, ref int itemHeight)
static void TownNPCAttackProjSpeed(NPC npc, ref float multiplier, ref float gravityCorrection, ref float randomOffset)
static void TownNPCAttackCooldown(NPC npc, ref int cooldown, ref int randExtraCooldown)
static bool CanHitNPC(NPC npc, NPC target)
Definition NPCLoader.cs:926
static void BuffTownNPC(ref float damageMult, ref int defense)
This serves as the central class from which NPC-related functions are carried out....
Definition NPCLoader.cs:26
static int CloseDoorID(Tile tile)
static bool IsClosedDoor(Tile tile)
This serves as the central class from which tile-related functions are supported and carried out.
Definition TileLoader.cs:23
int breath
Definition NPC.cs:1207
bool CanTalk
Definition NPC.cs:1325
static bool savedAngler
Definition NPC.cs:732
int defense
How resistant to damage this NPC is. The List of NPCs wiki pagecan be useful for finding appropriat...
Definition NPC.cs:1033
Color GetMagicAuraColor()
Definition NPC.cs:56234
bool ShouldBestiaryGirlBeLycantrope()
Definition NPC.cs:111041
float[] localAI
Acts like F:Terraria.NPC.ai, but does not sync to the server. Many vanilla T:Terraria....
Definition NPC.cs:1003
int spriteDirection
Definition NPC.cs:1143
static bool downedMechBoss2
Denotes whether or not the Twins have been defeated at least once in the current world.
Definition NPC.cs:959
void Teleport(Vector2 newPos, int Style=0, int extraInfo=0)
Definition NPC.cs:91555
bool AI_007_TownEntities_CheckIfWillDrown(bool currentlyDrowning)
Definition NPC.cs:59340
static bool savedTaxCollector
Definition NPC.cs:724
static bool downedBoss2
Denotes whether or not the Eater of Worlds OR the Brain of Cthulhu have been defeated at least once i...
Definition NPC.cs:796
void TweakSwingStats(int swingMax, int swingCurrent, int aimDir, ref Rectangle itemRectangle)
Definition NPC.cs:72060
static bool savedGolfer
Definition NPC.cs:738
int lifeMax
The maximum life of this NPC.
Definition NPC.cs:1077
bool dryadWard
Definition NPC.cs:698
string GivenName
The GIVEN name of this NPC. Can be set directly. Given names are unique to each NPC,...
Definition NPC.cs:1468
bool closeDoor
Definition NPC.cs:1199
float gfxOffY
An offset from the actual position of the npc that will be added to the draw position....
Definition NPC.cs:549
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:83247
static int safeRangeY
Definition NPC.cs:618
static bool savedMech
Definition NPC.cs:730
bool isLikeATownNPC
Definition NPC.cs:1529
static bool downedEmpressOfLight
Denotes whether or not the Empress of Light has been defeated at least once in the current world.
Definition NPC.cs:912
int townNpcVariationIndex
Definition NPC.cs:500
void UpdateHomeTileState(bool homeless, int x, int y)
Definition NPC.cs:56221
static bool savedWizard
Definition NPC.cs:728
NPCAimedTarget GetTargetData(bool ignorePlayerTankPets=true)
Definition NPC.cs:1668
static bool downedBoss1
Denotes whether or not the Eye of Cthulhu has been defeated at least once in the current world.
Definition NPC.cs:790
int defDefense
Stores the value of F:Terraria.NPC.defense at the end of SetDefaults. Useful for scaling defense in A...
Definition NPC.cs:1043
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
Definition NPC.cs:997
static bool savedGoblin
Definition NPC.cs:726
int doorX
Definition NPC.cs:1201
bool AI_007_TownEntities_IsInAGoodRestingSpot(int tileX, int tileY, int idealRestX, int idealRestY)
Definition NPC.cs:56045
static int sWidth
Definition NPC.cs:608
static bool taxCollector
Definition NPC.cs:522
static bool combatBookWasUsed
Denotes whether or not Advanced Combat Techniques has been used in the current world.
Definition NPC.cs:781
static bool[] ShimmeredTownNPCs
Definition NPC.cs:496
int homeTileX
Definition NPC.cs:1180
int doorY
Definition NPC.cs:1203
void SitDown(Point anchorTilePosition, out int direction, out Vector2 bottom)
Helper method for getting the parameters for seating a town NPC. Assumes the tile at anchorTilePositi...
Definition NPC.cs:112547
bool dontTakeDamage
Definition NPC.cs:1160
static bool downedMechBoss3
Denotes whether or not Skeletron Prime has been defeated at least once in the current world.
Definition NPC.cs:964
bool friendly
Indicates that an NPC is friendly to players. If true, a player won't damage the NPC and the NPC won'...
Definition NPC.cs:1197
float stepSpeed
Has nothing to do with the speed that this NPC travels, that is dictated by AI code adjusting F:Terra...
Definition NPC.cs:554
void AI_007_TownEntities_Shimmer_TeleportToLandingSpot()
Definition NPC.cs:59115
void AI_007_TownEntities_GetWalkPrediction(int myTileX, int homeFloorX, bool canBreathUnderWater, bool currentlyDrowning, int tileX, int tileY, out bool keepwalking, out bool avoidFalling)
Definition NPC.cs:59252
bool collideX
Definition NPC.cs:1134
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
static int safeRangeX
Definition NPC.cs:616
static bool downedQueenBee
Denotes whether or not at least one Queen Bee has been defeated in the current world.
Definition NPC.cs:806
double frameCounter
Definition NPC.cs:1081
float shimmerTransparency
Definition NPC.cs:643
bool shimmering
Definition NPC.cs:684
void AI_007_FindGoodRestingSpot(int myTileX, int myTileY, out int floorX, out int floorY)
Definition NPC.cs:56066
void AI_007_AttemptToPlayIdleAnimationsForPets(int petIdleChance)
Definition NPC.cs:59345
static int[] lazyNPCOwnedProjectileSearchArray
Definition NPC.cs:968
static bool combatBookVolumeTwoWasUsed
Definition NPC.cs:783
Tuple< Vector2, float > GetSwingStats(int swingMax, int swingCurrent, int aimDir, int itemWidth, int itemHeight)
Definition NPC.cs:71951
static bool downedGolemBoss
Denotes whether or not Golem has been defeated at least once in the current world.
Definition NPC.cs:842
bool homeless
Definition NPC.cs:1178
static bool downedAncientCultist
Denotes whether or not the Lunatic Cultist has been defeated at least once in the current world.
Definition NPC.cs:882
bool IsShimmerVariant
Definition NPC.cs:1405
static bool downedBoss3
Denotes whether or not Skeletron has been defeated at least once in the current world.
Definition NPC.cs:801
void Transform(int newType)
Definition NPC.cs:91590
int life
The current life of the NPC. Automatically set to the value of F:Terraria.NPC.lifeMax at the end of S...
Definition NPC.cs:1072
IEntitySource GetSpawnSource_ForProjectile()
Definition NPC.cs:107558
static bool downedPlantBoss
Denotes whether or not Plantera has been defeated at least once in the current world.
Definition NPC.cs:837
static bool savedBartender
Definition NPC.cs:736
void AI_007_TownEntities_TeleportToHome(int homeFloorX, int homeFloorY)
Definition NPC.cs:59222
int directionY
Definition NPC.cs:983
static bool downedMechBoss1
Denotes whether or not the Destroyer has been defeated at least once in the current world.
Definition NPC.cs:954
bool netUpdate
Definition NPC.cs:1130
int StrikeNPCNoInteraction(int Damage, float knockBack, int hitDirection)
Definition NPC.cs:91674
void AI_007_TryForcingSitting(int homeFloorX, int homeFloorY)
Definition NPC.cs:56168
int target
Definition NPC.cs:1019
bool townNPC
Definition NPC.cs:1174
static bool downedQueenSlime
Denotes whether or not Queen Slime has been defeated at least once in the current world.
Definition NPC.cs:917
int homeTileY
Definition NPC.cs:1182
void HitEffect(int hitDirection=0, double dmg=10.0, bool? instantKill=null)
Definition NPC.cs:92191
static bool savedStylist
Definition NPC.cs:734
static int sHeight
Definition NPC.cs:610

References Terraria.Entity.active, Terraria.Lighting.AddLight(), Terraria.NPC.ai, Terraria.Projectile.ai, Terraria.NPC.AI_007_AttemptToPlayIdleAnimationsForPets(), Terraria.NPC.AI_007_FindGoodRestingSpot(), Terraria.NPC.AI_007_TownEntities_CheckIfWillDrown(), Terraria.NPC.AI_007_TownEntities_GetWalkPrediction(), Terraria.NPC.AI_007_TownEntities_IsInAGoodRestingSpot(), Terraria.NPC.AI_007_TownEntities_Shimmer_TeleportToLandingSpot(), Terraria.NPC.AI_007_TownEntities_TeleportToHome(), Terraria.NPC.AI_007_TryForcingSitting(), Terraria.ID.NPCID.Sets.AllowDoorInteraction, Terraria.ID.NPCID.Sets.AttackAverageChance, Terraria.ID.NPCID.Sets.AttackTime, Terraria.ID.NPCID.Sets.AttackType, Terraria.NPC.breath, Terraria.GameContent.Drawing.ParticleOrchestrator.BroadcastParticleSpawn(), Terraria.ModLoader.NPCLoader.BuffTownNPC(), Terraria.ID.TileID.Sets.CanBeSatOnForNPCs, Terraria.Collision.CanHit(), Terraria.Collision.CanHitLine(), Terraria.ModLoader.NPCLoader.CanHitNPC(), Terraria.NPC.CanTalk, Terraria.NPC.closeDoor, Terraria.WorldGen.CloseDoor(), Terraria.ModLoader.TileLoader.CloseDoorID(), Terraria.NPC.collideX, Terraria.NPC.combatBookVolumeTwoWasUsed, Terraria.NPC.combatBookWasUsed, Terraria.ID.NPCID.Sets.DangerDetectRange, Terraria.Main.dayTime, Terraria.Player.dead, Terraria.NPC.defDefense, Terraria.NPC.defense, Terraria.Entity.direction, Terraria.Entity.DirectionTo(), Terraria.NPC.directionY, Terraria.Entity.Distance(), Terraria.NPC.dontTakeDamage, Terraria.NPC.doorX, Terraria.NPC.doorY, Terraria.NPC.downedAncientCultist, Terraria.NPC.downedBoss1, Terraria.NPC.downedBoss2, Terraria.NPC.downedBoss3, Terraria.NPC.downedEmpressOfLight, Terraria.NPC.downedGolemBoss, Terraria.NPC.downedMechBoss1, Terraria.NPC.downedMechBoss2, Terraria.NPC.downedMechBoss3, Terraria.NPC.downedPlantBoss, Terraria.NPC.downedQueenBee, Terraria.NPC.downedQueenSlime, Terraria.Collision.DrownCollision(), Terraria.NPC.dryadWard, Terraria.Main.dungeonX, Terraria.Main.dungeonY, Terraria.Main.eclipse, Terraria.Main.expertMode, Terraria.NPC.frameCounter, Terraria.NPC.friendly, Terraria.Main.GameModeInfo, Terraria.NPC.GetMagicAuraColor(), Terraria.NPC.GetSpawnSource_ForProjectile(), Terraria.NPC.GetSwingStats(), Terraria.NPC.GetTargetData(), Terraria.Framing.GetTileSafely(), Terraria.Collision.GetWaterLine(), Terraria.NPC.gfxOffY, Terraria.NPC.GivenName, Terraria.Main.hardMode, Terraria.Entity.height, Terraria.NPC.HitEffect(), Terraria.NPC.homeless, Terraria.NPC.homeTileX, Terraria.NPC.homeTileY, Terraria.Entity.honeyWet, Terraria.Main.hslToRgb(), Terraria.ID.TileID.Sets.InteractibleByNPCs, Terraria.WorldGen.InWorld(), Terraria.ModLoader.TileLoader.IsClosedDoor(), Terraria.NPC.isLikeATownNPC, Terraria.NPC.IsShimmerVariant, Terraria.ID.NPCID.Sets.IsTownPet, Terraria.ID.NPCID.Sets.IsTownSlime, Terraria.Entity.lavaWet, Terraria.NPC.lazyNPCOwnedProjectileSearchArray, Terraria.NPC.life, Terraria.NPC.lifeMax, Terraria.NPC.localAI, Terraria.Main.masterMode, Terraria.Main.maxTilesX, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.NPC.netUpdate, Terraria.Dust.NewDustPerfect(), Terraria.Projectile.NewProjectile(), Terraria.Main.npc, Terraria.WorldGen.OpenDoor(), Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Utils.PlotTileLine(), Terraria.Entity.position, Terraria.ID.NPCID.Sets.PrettySafe, Terraria.Main.projectile, Terraria.Main.raining, Terraria.Main.rand, Terraria.Utils.RandomVector2(), Terraria.Utils.Remap(), Terraria.GameContent.Drawing.ParticleOrchestrator.RequestParticleSpawn(), Terraria.Utils.RotatedBy(), Terraria.NPC.safeRangeX, Terraria.NPC.safeRangeY, Terraria.NPC.savedAngler, Terraria.NPC.savedBartender, Terraria.NPC.savedGoblin, Terraria.NPC.savedGolfer, Terraria.NPC.savedMech, Terraria.NPC.savedStylist, Terraria.NPC.savedTaxCollector, Terraria.NPC.savedWizard, Terraria.DelegateMethods.SearchAvoidedByNPCs(), Terraria.Main.sectionManager, Terraria.NetMessage.SendData(), Terraria.NPC.sHeight, Terraria.WorldGen.ShiftTallGate(), Terraria.NPC.ShimmeredTownNPCs, Terraria.NPC.shimmering, Terraria.NPC.shimmerTransparency, Terraria.Entity.shimmerWet, Terraria.NPC.ShouldBestiaryGirlBeLycantrope(), Terraria.NPC.SitDown(), Terraria.Main.sittingManager, Terraria.ID.NPCID.Sets.Skeletons, Terraria.Main.slimeRain, Terraria.WorldGen.SolidTile(), Terraria.Collision.SolidTiles(), Terraria.Collision.SolidTilesVersatile(), Terraria.Main.spawnTileX, Terraria.Main.spawnTileY, Terraria.NPC.spriteDirection, Terraria.Collision.StepDown(), Terraria.NPC.stepSpeed, Terraria.Collision.StepUp(), Terraria.NPC.StrikeNPCNoInteraction(), Terraria.NPC.sWidth, Terraria.NPC.target, Terraria.NPC.TargetClosest(), Terraria.NPC.taxCollector, Terraria.NPC.Teleport(), Terraria.Main.tile, Terraria.Main.tileDungeon, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, Terraria.Main.timeForVisualEffects, Terraria.Entity.Top, Terraria.ID.TorchID.TorchColor(), Terraria.ID.NPCID.Sets.TownCritter, Terraria.NPC.townNPC, Terraria.ModLoader.NPCLoader.TownNPCAttackCooldown(), Terraria.ModLoader.NPCLoader.TownNPCAttackMagic(), Terraria.ModLoader.NPCLoader.TownNPCAttackProj(), Terraria.ModLoader.NPCLoader.TownNPCAttackProjSpeed(), Terraria.ModLoader.NPCLoader.TownNPCAttackShoot(), Terraria.ModLoader.NPCLoader.TownNPCAttackStrength(), Terraria.ModLoader.NPCLoader.TownNPCAttackSwing(), Terraria.NPC.townNpcVariationIndex, Terraria.NPC.Transform(), Terraria.NPC.TweakSwingStats(), Terraria.NPC.type, Terraria.Projectile.type, Terraria.Tile.type, Terraria.NPC.UpdateHomeTileState(), Terraria.Entity.velocity, Terraria.Entity.wet, Terraria.Collision.WetCollision(), Terraria.Entity.whoAmI, Terraria.Entity.width, Terraria.Utils.WrappedLerp(), and Terraria.Main.xMas.

Referenced by Terraria.NPC.VanillaAI_Inner().

+ Here is the caller graph for this function: