Guest User

Untitled

a guest
Oct 10th, 2018
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. private string CheckTargetLocation(BasePlayer player, Vector3 targetLocation, bool build, bool owner)
  2. {
  3. BuildingBlock buildingBlock1 = (BuildingBlock)null;
  4. BuildingPrivlidge cup = (BuildingPrivlidge)null;
  5. var entities = Pool.GetList<BuildingBlock>();
  6.  
  7. Vis.Entities(targetLocation, 0.1f, entities, blockLayer);
  8. var cups = false;
  9. for (int index = 0; index < entities.Count; ++index)
  10. {
  11. BuildingBlock buildingBlock2 = entities[index];
  12. if (buildingBlock2.IsOlderThan((BaseEntity)buildingBlock1))
  13. {
  14. BuildingManager.Building building = buildingBlock2.GetBuilding();
  15. if (building != null)
  16. {
  17. BuildingPrivlidge buildingPrivilege = building.GetDominatingBuildingPrivilege();
  18. if (!((UnityEngine.Object)buildingPrivilege == (UnityEngine.Object)null))
  19. {
  20. buildingBlock1 = buildingBlock2;
  21. cup = buildingPrivilege;
  22. }
  23. }
  24. }
  25. }
  26. if (cup == null)
  27. {
  28. return null;
  29. }
  30. cups = true;
  31. if (owner)
  32. {
  33. var returnhook = BuildingOwners?.Call("FindBlockData", buildingBlock1);
  34. if (returnhook is string)
  35. {
  36. string ownerid = (string) returnhook;
  37. if (player.userID.ToString() == ownerid)
  38. {
  39. Pool.FreeList(ref entities);
  40. return null;
  41. }
  42.  
  43. var returnHasFriend = Clans?.CallHook("HasFriend", Convert.ToUInt64(ownerid), player.userID);
  44. if (returnHasFriend != null && (bool)returnHasFriend)
  45. {
  46. Pool.FreeList(ref entities);
  47. return null;
  48. }
  49. }
  50.  
  51. if (returnhook is bool || returnhook == null)
  52. {
  53. if (player.userID == cup.OwnerID)
  54. {
  55. Pool.FreeList(ref entities);
  56. return null;
  57. }
  58.  
  59. var hasFriend = Clans?.CallHook("HasFriend", cup.OwnerID, player.userID);
  60. if (hasFriend != null && (bool)hasFriend)
  61. {
  62. Pool.FreeList(ref entities);
  63. return null;
  64. }
  65. }
  66. }
  67. if (cup.IsAuthed(player))
  68. {
  69. Pool.FreeList(ref entities);
  70. return null;
  71. }
  72. Pool.FreeList(ref entities);
  73. return cups && !build ? "TPIntoBuildingBlocked" : null;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment