Advertisement
Guest User

ObjectManager.java

a guest
Jan 24th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.90 KB | None | 0 0
  1. package com.judgment.rs2.entity.object;
  2.  
  3. import java.util.Deque;
  4. import java.util.Iterator;
  5. import java.util.LinkedList;
  6. import java.util.List;
  7. import java.util.Queue;
  8. import java.util.concurrent.ConcurrentLinkedQueue;
  9. import java.util.logging.Logger;
  10.  
  11. import com.judgment.core.cache.map.MapLoading;
  12. import com.judgment.core.cache.map.RSObject;
  13. import com.judgment.core.cache.map.Region;
  14. import com.judgment.rs2.content.skill.firemaking.FireColor;
  15. import com.judgment.rs2.entity.Location;
  16. import com.judgment.rs2.entity.World;
  17. import com.judgment.rs2.entity.player.Player;
  18.  
  19. @SuppressWarnings("all")
  20. public class ObjectManager {
  21.  
  22. public static final int BLANK_OBJECT_ID = 2376;
  23.  
  24. private static final List<GameObject> active = new LinkedList<GameObject>();
  25. private static final Deque<GameObject> register = new LinkedList<GameObject>();
  26.  
  27. private static final Queue<GameObject> send = new ConcurrentLinkedQueue<GameObject>();
  28.  
  29. public static void add(GameObject o) {
  30. active.add(o);
  31. }
  32.  
  33. public static void addClippedObject(GameObject o) {
  34. register.add(o);
  35. }
  36.  
  37. public static void declare() {
  38.  
  39. for (GameObject i : active) {
  40. send(getBlankObject(i.getLocation()));
  41. }
  42.  
  43. //active.clear();
  44.  
  45. /** Home Area */
  46. spawnWithObject(410, 3078, 3484, 0, 10, 0);//Lunar Altar
  47. spawnWithObject(6552, 3084, 3483, 0, 10, 0);//Ancient Altar
  48. spawnWithObject(409, 3088, 3483, 0, 10, 0);//Altar
  49. spawnWithObject(4875, 3084, 3488, 0, 10, 5);//Food stall
  50. spawnWithObject(4876, 3084, 3489, 0, 10, 5);//General stall
  51. spawnWithObject(4874, 3084, 3490, 0, 10, 5);//Crafting stall
  52. spawnWithObject(4877, 3084, 3491, 0, 10, 5);//Magic stall
  53. spawnWithObject(4878, 3084, 3492, 0, 10, 5);//Scimitar stall
  54. spawnWithObject(2191, 3084, 3494, 0, 10, 5);//Crystal Chest
  55.  
  56. /* Membership Area */
  57. deleteWithObject(2822, 3356, 0);
  58. deleteWithObject(2822, 3355, 0);
  59. deleteWithObject(2822, 3351, 0);
  60. deleteWithObject(2822, 3350, 0);
  61. deleteWithObject(2818, 3351, 0);
  62. deleteWithObject(2818, 3355, 0);
  63. deleteWithObject(2817, 3355, 0);
  64. deleteWithObject(2816, 3354, 0);
  65. deleteWithObject(2818, 3356, 0);
  66. deleteWithObject(2816, 3352, 0);
  67. deleteWithObject(2817, 3353, 0);
  68. deleteWithObject(2816, 3351, 0);
  69. deleteWithObject(2821, 3357, 0);
  70. deleteWithObject(2822, 3360, 0);
  71. deleteWithObject(2822, 3361, 0);
  72. deleteWithObject(2821, 3360, 0);
  73. deleteWithObject(2821, 3361, 0);
  74. deleteWithObject(2820, 3360, 0);
  75. deleteWithObject(2820, 3361, 0);
  76. deleteWithObject(2819, 3360, 0);
  77. deleteWithObject(2819, 3361, 0);
  78. deleteWithObject(2818, 3360, 0);
  79. deleteWithObject(2818, 3361, 0);
  80. deleteWithObject(2817, 3360, 0);
  81. deleteWithObject(2817, 3361, 0);
  82. deleteWithObject(2817, 3359, 0);
  83. deleteWithObject(2817, 3358, 0);
  84. deleteWithObject(2817, 3357, 0);
  85. deleteWithObject(2857, 3338, 0);
  86. deleteWithObject(2859, 3338, 0);
  87. deleteWithObject(2860, 3338, 0);
  88. deleteWithObject(2862, 3338, 0);
  89. deleteWithObject(2861, 3335, 0);
  90. deleteWithObject(2862, 3335, 0);
  91. deleteWithObject(2844, 3333, 0);
  92. deleteWithObject(2845, 3337, 0);
  93. deleteWithObject(2844, 3337, 0);
  94. deleteWithObject(2845, 3338, 0);
  95. deleteWithObject(2844, 3338, 0);
  96. deleteWithObject(2853, 3355, 0);
  97. deleteWithObject(2853, 3353, 0);
  98. deleteWithObject(2849, 3353, 0);
  99. deleteWithObject(2849, 3354, 0);
  100. deleteWithObject(2849, 3355, 0);
  101. deleteWithObject(2851, 3353, 0);
  102. deleteWithObject(2809, 3341, 0);
  103. deleteWithObject(2812, 3341, 0);
  104. deleteWithObject(2812, 3343, 0);
  105. deleteWithObject(2810, 3342, 0);
  106. deleteWithObject(2808, 3343, 0);
  107. deleteWithObject(2808, 3346, 0);
  108. deleteWithObject(2809, 3346, 0);
  109. deleteWithObject(2810, 3346, 0);
  110. deleteWithObject(2812, 3346, 0);
  111. deleteWithObject(2807, 3354, 0);
  112. deleteWithObject(2807, 3355, 0);
  113. deleteWithObject(2806, 3355, 0);
  114. deleteWithObject(2806, 3356, 0);
  115. deleteWithObject(2807, 3356, 0);
  116. deleteWithObject(2808, 3356, 0);
  117. deleteWithObject(2830, 3350, 0);
  118. deleteWithObject(2831, 3348, 0);
  119. deleteWithObject(2830, 3349, 0);
  120. deleteWithObject(2816, 3361, 0);
  121. deleteWithObject(2812, 3364, 0);
  122. deleteWithObject(2814, 3364, 0);
  123. deleteWithObject(2816, 3363, 0);
  124. deleteWithObject(2818, 3363, 0);
  125. deleteWithObject(2819, 3362, 0);
  126. deleteWithObject(2815, 3358, 0);
  127. deleteWithObject(2814, 3357, 0);
  128. deleteWithObject(2835, 3355, 0);
  129. spawnWithObject(6943, 2816, 3358, 0, 10, 3);//Banks
  130. spawnWithObject(6943, 2816, 3357, 0, 10, 3);//Banks
  131. spawnWithObject(6943, 2810, 3343, 0, 10, 3);//Banks
  132. spawnWithObject(6943, 2874, 3339, 0, 10, 3);//Banks
  133. spawnWithObject(6943, 2874, 3340, 0, 10, 3);//Banks
  134. spawnWithObject(6943, 2829, 3351, 0, 10, 3);//Banks
  135. spawnWithObject(6943, 2816, 3356, 0, 10, 3);//Banks
  136. spawnWithObject(6943, 2816, 3355, 0, 10, 3);//Banks
  137. spawnWithObject(6943, 2816, 3354, 0, 10, 3);//Banks
  138. spawnWithObject(6943, 2816, 3353, 0, 10, 3);//Banks
  139. spawnWithObject(6943, 2816, 3352, 0, 10, 3);//Banks
  140. spawnWithObject(6943, 2816, 3351, 0, 10, 3);//Banks
  141. spawnWithObject(6943, 2809, 3347, 0, 10, 0);//Banks
  142. spawnWithObject(6943, 2827, 3355, 0, 10, 0);//Banks
  143. //spawnWithObject(9472, 2818, 3351, 0, 10, 5);//Shop Exchange
  144. spawnWithObject(6943, 2857, 3338, 0, 10, 0);//Banks
  145. spawnWithObject(4875, 2863, 3338, 0, 10, 5);//Food stall
  146. spawnWithObject(4876, 2862, 3338, 0, 10, 5);//General stall
  147. spawnWithObject(4874, 2861, 3338, 0, 10, 5);//Crafting stall
  148. spawnWithObject(4877, 2860, 3338, 0, 10, 5);//Magic stall
  149. spawnWithObject(4878, 2859, 3338, 0, 10, 5);//Scmitar stall
  150. spawnWithObject(26181, 2874, 3333, 0, 10, 0);//Range
  151. spawnWithObject(4309, 2847, 3333, 0, 10, 2);//Spinning wheel
  152. spawnWithObject(11601, 2845, 3333, 0, 10, 3);//Pottery
  153. spawnWithObject(22472, 2844, 3338, 0, 10, 2);//Tab creation
  154. spawnWithObject(13618, 2850, 3355, 0, 10, 0);//Wyvern teleport
  155. spawnWithObject(13619, 2853, 3353, 0, 10, 1);//Fountain of rune teleport
  156. spawnWithObject(2191, 2818, 3356, 0, 10, 4);//Crystal chest
  157. spawnWithObject(18772, 2821, 3358, 0, 10, 1);//MysteryBox chest
  158. spawnWithObject(2097, 2830, 3349, 0, 10, 1);//Anvil
  159. spawnWithObject(11764, 2811, 3361, 0, 10, 1);//Magic Tree
  160. spawnWithObject(11764, 2810, 3359, 0, 10, 1);//Magic Tree
  161. spawnWithObject(11764, 2815, 3361, 0, 10, 1);//Magic Tree
  162. spawnWithObject(11764, 2815, 3359, 0, 10, 1);//Magic Tree
  163. spawnWithObject(11764, 2812, 3364, 0, 10, 1);//Magic Tree
  164. spawnWithObject(11764, 2814, 3364, 0, 10, 1);//Magic Tree
  165. spawnWithObject(11758, 2809, 3356, 0, 10, 1);//Yew Tree
  166. spawnWithObject(11758, 2809, 3353, 0, 10, 1);//Yew Tree
  167. spawnWithObject(11758, 2809, 3350, 0, 10, 1);//Yew Tree
  168. spawnWithObject(11762, 2804, 3344, 0, 10, 1);//Maple Tree
  169. spawnWithObject(11762, 2804, 3346, 0, 10, 1);//Maple Tree
  170. spawnWithObject(11762, 2806, 3348, 0, 10, 1);//Maple Tree
  171. spawnWithObject(11762, 2806, 3351, 0, 10, 1);//Maple Tree
  172. spawnWithObject(11762, 2805, 3353, 0, 10, 1);//Maple Tree
  173. spawnWithObject(14175, 2824, 3359, 0, 10, 1);//Rune Ore
  174. spawnWithObject(14175, 2824, 3358, 0, 10, 1);//Rune Ore
  175. spawnWithObject(14175, 2824, 3357, 0, 10, 1);//Rune Ore
  176. spawnWithObject(14175, 2826, 3359, 0, 10, 1);//Rune Ore
  177. spawnWithObject(14175, 2825, 3356, 0, 10, 1);//Rune Ore
  178. spawnWithObject(13720, 2828, 3358, 0, 10, 1);//Adamant Ore
  179. spawnWithObject(13720, 2829, 3358, 0, 10, 1);//Adamant Ore
  180. spawnWithObject(13720, 2830, 3358, 0, 10, 1);//Adamant Ore
  181. spawnWithObject(13720, 2831, 3357, 0, 10, 1);//Adamant Ore
  182. spawnWithObject(13720, 2831, 3356, 0, 10, 1);//Adamant Ore
  183. spawnWithObject(13707, 2830, 3354, 0, 10, 1);//Gold Ore
  184. spawnWithObject(13707, 2831, 3354, 0, 10, 1);//Gold Ore
  185. spawnWithObject(13707, 2832, 3354, 0, 10, 1);//Gold Ore
  186. spawnWithObject(13707, 2833, 3354, 0, 10, 1);//Gold Ore
  187. spawnWithObject(13706, 2833, 3356, 0, 10, 1);//Coal
  188. spawnWithObject(13706, 2834, 3356, 0, 10, 1);//Coal
  189. spawnWithObject(13706, 2835, 3356, 0, 10, 1);//Coal
  190. spawnWithObject(13706, 2835, 3354, 0, 10, 1);//Coal
  191.  
  192.  
  193. /* Wilderness Resource Arena */
  194. spawnWithObject(14175, 3195, 3942, 0, 10, 3);
  195. spawnWithObject(14175, 3194, 3943, 0, 10, 3);
  196. spawnWithObject(14175, 3175, 3937, 0, 10, 3);
  197. spawnWithObject(14175, 3175, 3943, 0, 10, 3);
  198.  
  199. /* Blood crafting */
  200. spawnWithObject(4090, 2792, 3322, 0, 10, 0);//Altar
  201.  
  202. /* Crafting */
  203. spawnWithObject(4309, 2751, 3446, 0, 10, 3);//Spinning wheel
  204. spawnWithObject(11601, 2751, 3449, 0, 10, 2);//Pottery
  205.  
  206. /** Rune ores at mining */
  207. spawnWithObject(14175, 3051, 9765, 0, 10, 3);
  208. spawnWithObject(14175, 3052, 9766, 0, 10, 3);
  209.  
  210. /** Smelting furnace */
  211. spawnWithObject(2030, 3191, 3425, 0, 10, 0);
  212.  
  213. /** Weapon Game **/
  214. deleteWithObject(1863, 5328, 0);
  215. deleteWithObject(1863, 5326, 0);
  216. deleteWithObject(1863, 5323, 0);
  217. deleteWithObject(1862, 5327, 0);
  218. deleteWithObject(1862, 5326, 0);
  219. deleteWithObject(1862, 5325, 0);
  220. deleteWithObject(1865, 5325, 0);
  221. deleteWithObject(1863, 5321, 0);
  222. deleteWithObject(1865, 5321, 0);
  223. deleteWithObject(1865, 5323, 0);
  224. deleteWithObject(1863, 5319, 0);
  225. deleteWithObject(1862, 5319, 0);
  226. deleteWithObject(1863, 5317, 0);
  227. deleteWithObject(1865, 5319, 0);
  228. deleteWithObject(1862, 5321, 0);
  229. deleteWithObject(1862, 5323, 0);
  230. spawnWithObject(1, 1866, 5323, 0, 10, 0);//Barrier
  231. spawnWithObject(1, 1865, 5323, 0, 10, 0);//Barrier
  232. spawnWithObject(11005, 1864, 5323, 0, 10, 1);//Barrier
  233. spawnWithObject(11005, 1863, 5323, 0, 10, 1);//Barrier
  234. spawnWithObject(1, 1862, 5323, 0, 10, 0);//Barrier
  235. spawnWithObject(1, 1861, 5323, 0, 10, 0);//Barrier
  236. spawnWithObject(6943, 1861, 5330, 0, 10, 0);//Barrier
  237. spawnWithObject(6943, 1862, 5330, 0, 10, 0);//Barrier
  238. spawnWithObject(6943, 1863, 5330, 0, 10, 0);//Barrier
  239. spawnWithObject(6943, 1864, 5330, 0, 10, 0);//Barrier
  240. spawnWithObject(6943, 1865, 5330, 0, 10, 0);//Barrier
  241. spawnWithObject(6943, 1866, 5330, 0, 10, 0);//Barrier
  242.  
  243. /** Duel Arena */
  244. spawnWithObject(409, 3366, 3271, 0, 10, 10);//Altar
  245. spawnWithObject(6552, 3370, 3271, 0, 10, 10);//Ancient Altar
  246.  
  247. /* Crafting Area */
  248. spawnWithObject(6943, 2748, 3451, 0, 10, 0);// Banks
  249.  
  250. /** Farming Areas */
  251. spawnWithObject(6943, 2804, 3463, 0, 10, 1);// Catherby Banks
  252. spawnWithObject(6943, 3599, 3522, 0, 10, 0);// Banks
  253. spawnWithObject(6943, 3056, 3311, 0, 10, 0);// Banks
  254. spawnWithObject(6943, 2662, 3375, 0, 10, 0);// Banks
  255.  
  256. /** Mining banks */
  257. spawnWithObject(6943, 3047, 9765, 0, 10, 0);
  258. spawnWithObject(6943, 3045, 9765, 0, 10, 0);
  259. spawnWithObject(6943, 3044, 9776, 0, 10, 0);
  260. spawnWithObject(6943, 3045, 9776, 0, 10, 0);
  261. spawnWithObject(6943, 3046, 9776, 0, 10, 0);
  262. spawnWithObject(6943, 2930, 4821, 0, 10, 0);// Essences
  263.  
  264. /** Deleting Objects */
  265. delete(3079, 3501, 0);//Home gate
  266. delete(3080, 3501, 0);//Home gate
  267. delete(3445, 3554, 2);//Slayer tower door
  268.  
  269. /** New Home */
  270. deleteWithObject(3284, 3510, 0);
  271. deleteWithObject(3286, 3497, 0);
  272. deleteWithObject(3286, 3498, 0);
  273. deleteWithObject(3286, 3500, 0);
  274. deleteWithObject(3288, 3502, 0);
  275. deleteWithObject(3288, 3497, 0);
  276. deleteWithObject(3286, 3502, 0);
  277. deleteWithObject(3287, 3498, 0);
  278. deleteWithObject(3287, 3500, 0);
  279. deleteWithObject(3284, 3510, 0);
  280. deleteWithObject(3282, 3497, 0);
  281. deleteWithObject(3283, 3497, 0);
  282. deleteWithObject(3283, 3500, 0);
  283. deleteWithObject(3283, 3500, 0);
  284. deleteWithObject(3277, 3498, 0);
  285. deleteWithObject(3278, 3497, 0);
  286. deleteWithObject(3277, 3497, 0);
  287. deleteWithObject(3278, 3500, 0);
  288. deleteWithObject(3277, 3500, 0);
  289. deleteWithObject(3282, 3499, 0);
  290. deleteWithObject(3277, 3493, 0);
  291. deleteWithObject(3279, 3493, 0);
  292. deleteWithObject(3276, 3493, 0);
  293. deleteWithObject(3276, 3494, 0);
  294. deleteWithObject(3278, 3492, 0);
  295. deleteWithObject(3282, 3493, 0);
  296. deleteWithObject(3282, 3495, 0);
  297. deleteWithObject(3283, 3495, 0);
  298. deleteWithObject(3285, 3493, 0);
  299. deleteWithObject(3284, 3503, 0);
  300. deleteWithObject(3285, 3503, 0);
  301. deleteWithObject(3286, 3503, 0);
  302. deleteWithObject(3286, 3504, 0);
  303. deleteWithObject(3287, 3504, 0);
  304. deleteWithObject(3288, 3504, 0);
  305. deleteWithObject(3284, 3504, 0);
  306. deleteWithObject(3276, 3503, 0);
  307. deleteWithObject(3277, 3503, 0);
  308. deleteWithObject(3278, 3503, 0);
  309. deleteWithObject(3282, 3498, 0);
  310. deleteWithObject(3284, 3501, 0);
  311. deleteWithObject(3284, 3496, 0);
  312. deleteWithObject(3282, 3500, 0);
  313. deleteWithObject(3277, 3496, 0);
  314.  
  315. deleteWithObject(3278, 3504, 0);
  316. deleteWithObject(3276, 3504, 0);
  317. deleteWithObject(3275, 3496, 0);
  318. deleteWithObject(3275, 3497, 0);
  319. deleteWithObject(3277, 3501, 0);
  320.  
  321. remove(3286, 3508, 0);
  322. remove(3286, 3509, 0);
  323. remove(3286, 3510, 0);
  324. remove(3275, 3509, 0);
  325. remove(3275, 3510, 0);
  326. remove(3276, 3510, 0);
  327.  
  328. spawnWithObject(6943, 3287, 3502, 0, 10, 1);// Banks
  329. spawnWithObject(6943, 3287, 3501, 0, 10, 1);// Banks
  330. spawnWithObject(6943, 3287, 3500, 0, 10, 1);// Banks
  331. spawnWithObject(6943, 3287, 3499, 0, 10, 1);// Banks
  332. spawnWithObject(6943, 3287, 3498, 0, 10, 1);// Banks
  333. spawnWithObject(6943, 3287, 3497, 0, 10, 1);// Banks
  334. //spawnWithObject(9472, 3286, 3495, 0, 10, 5);//Shop Exchange
  335. //spawnWithObject(8720, 3286, 3494, 0, 10, 2);//Vote
  336. spawnWithObject(4875, 3282, 3507, 0, 10, 5);//Food stall
  337. spawnWithObject(4876, 3283, 3507, 0, 10, 5);//General stall
  338. spawnWithObject(4874, 3284, 3507, 0, 10, 5);//Crafting stall
  339. spawnWithObject(4877, 3285, 3507, 0, 10, 5);//Magic stall
  340. spawnWithObject(4878, 3286, 3507, 0, 10, 5);//Scimitar stall
  341.  
  342.  
  343. spawnWithObject(409, 3275, 3508, 0, 10, 1);//Altar
  344.  
  345. spawnWithObject(412, 3277, 3507, 0, 10, 10);//Ancient Altar
  346.  
  347. /*//Edgeville Banks
  348. spawnWithObject(6943, 3098, 3493, 0, 10, 1);// Banks
  349. spawnWithObject(6943, 3096, 3493, 0, 10, 1);// Banks
  350. spawnWithObject(6943, 3095, 3491, 0, 10, 1);// Banks
  351. spawnWithObject(6943, 3095, 3489, 0, 10, 1);// Banks
  352. */
  353.  
  354. /** Webs */
  355. delete(3105, 3958, 0);
  356. delete(3106, 3958, 0);
  357. delete(3093, 3957, 0);
  358. delete(3095, 3957, 0);
  359. delete(3092, 3957, 0);
  360. delete(3158, 3951, 0);
  361. deleteWithObject(2543, 4715, 0);
  362. spawnWithObject(734, 3105, 3958, 0, 10, 3);
  363. spawnWithObject(734, 3106, 3958, 0, 10, 3);
  364. spawnWithObject(734, 3158, 3951, 0, 10, 1);
  365. spawnWithObject(734, 3093, 3957, 0, 10, 0);
  366. spawnWithObject(734, 3095, 3957, 0, 10, 0);
  367. delete(2543, 4715, 0);
  368. delete(2855, 3546, 0);
  369. delete(2854, 3546, 0);
  370.  
  371. /** Clipping */
  372. setClipToZero(3445, 3554, 2);
  373. setClipToZero(3119, 9850, 0);
  374. setClipToZero(3002, 3961, 0);
  375. setClipToZero(3002, 3960, 0);
  376. setClipToZero(2539, 4716, 0);
  377. setClipToZero(3068, 10255, 0);
  378. setClipToZero(3068, 10256, 0);
  379. setClipToZero(3068, 10258, 0);
  380. setClipToZero(3067, 10255, 0);
  381. setClipToZero(3066, 10256, 0);
  382. setClipToZero(3426, 3555, 1);
  383. setClipToZero(3427, 3555, 1);
  384. setClipToZero(3005, 3953, 0);
  385. setClipToZero(3005, 3952, 0);
  386. setClipToZero(2551, 3554, 0);
  387. setClipToZero(2551, 3555, 0);
  388. setClipToZero(2833, 3352, 0);
  389. setClipToZero(2996, 3960, 0);
  390.  
  391. for (GameObject i : active) {
  392. send(i);
  393. }
  394.  
  395. logger.info("All object spawns have been loaded successfully.");
  396. }
  397.  
  398. private static Logger logger = Logger.getLogger(MapLoading.class.getSimpleName());
  399.  
  400. private static final void delete(int x, int y, int z) {
  401. RSObject object = Region.getObject(x, y, z);
  402.  
  403. if (Region.getDoor(x, y, z) != null) {
  404. Region.removeDoor(x, y, z);
  405. }
  406.  
  407. if (object == null) {
  408. if (z > 0)
  409. active.add(new GameObject(2376, x, y, z, 10, 0));
  410. return;
  411. }
  412.  
  413. MapLoading.removeObject(object.getId(), x, y, z, object.getType(), object.getFace());
  414.  
  415. if ((object.getType() != 10) || (z > 0))
  416. active.add(new GameObject(2376, x, y, z, object.getType(), 0));
  417. }
  418.  
  419. private static final void deleteWithObject(int x, int y, int z) {
  420. RSObject object = Region.getObject(x, y, z);
  421.  
  422. if (Region.getDoor(x, y, z) != null) {
  423. Region.removeDoor(x, y, z);
  424. }
  425.  
  426. if (object == null) {
  427. active.add(new GameObject(2376, x, y, z, 10, 0));
  428. return;
  429. }
  430.  
  431. MapLoading.removeObject(object.getId(), x, y, z, object.getType(), object.getFace());
  432.  
  433. active.add(new GameObject(2376, x, y, z, object.getType(), 0));
  434. }
  435.  
  436. private static final void remove(int x, int y, int z) {
  437. RSObject object = Region.getObject(x, y, z);
  438.  
  439. if (Region.getDoor(x, y, z) != null) {
  440. Region.removeDoor(x, y, z);
  441. }
  442.  
  443. if (object == null) {
  444. active.add(new GameObject(2376, x, y, z, 10, 0));
  445. return;
  446. }
  447.  
  448. MapLoading.removeObject(object.getId(), x, y, z, object.getType(), object.getFace());
  449.  
  450. active.add(new GameObject(2376, x, y, z, object.getType(), 0));
  451. Region region = Region.getRegion(x, y);
  452.  
  453. region.setClipToZero(x, y, z);
  454. }
  455.  
  456.  
  457. private static final void deleteWithObject(int x, int y, int z, int type) {
  458. active.add(new GameObject(2376, x, y, z, type, 0));
  459. }
  460.  
  461. public static List<GameObject> getActive() {
  462. return active;
  463. }
  464.  
  465. public static final GameObject getBlankObject(Location p) {
  466. return new GameObject(2376, p.getX(), p.getY(), p.getZ(), 10, 0, false);
  467. }
  468.  
  469. public static GameObject getBlankObject(Location p, int type) {
  470. return new GameObject(2376, p.getX(), p.getY(), p.getZ(), type, 0, false);
  471. }
  472.  
  473. public static GameObject getGameObject(int x, int y, int z) {
  474. int index = active.indexOf(new GameObject(x, y, z));
  475.  
  476. if (index == -1) {
  477. return null;
  478. }
  479.  
  480. return active.get(index);
  481. }
  482.  
  483. public static Queue<GameObject> getSend() {
  484. return send;
  485. }
  486.  
  487. public static boolean objectExists(Location location) {
  488. for (GameObject object : active) {
  489. if (location.equals(object.getLocation())) {
  490. return true;
  491. }
  492. }
  493. return false;
  494. }
  495.  
  496. public static void process() {
  497. for (Iterator<GameObject> i = register.iterator(); i.hasNext();) {
  498. GameObject reg = i.next();
  499. active.remove(reg);
  500. active.add(reg);
  501. send.add(reg);
  502.  
  503. i.remove();
  504. }
  505. }
  506.  
  507. public static void queueSend(GameObject o) {
  508. send.add(o);
  509. }
  510.  
  511. public static void register(GameObject o) {
  512. register.add(o);
  513. }
  514.  
  515. public static void remove(GameObject o) {
  516. removeFromList(o);
  517. send.add(getBlankObject(o.getLocation(), o.getType()));
  518. }
  519.  
  520. public static void remove2(GameObject o) {
  521. send.add(getBlankObject(o.getLocation(), o.getType()));
  522. }
  523.  
  524. public static void removeFromList(GameObject o) {
  525. active.remove(o);
  526. }
  527.  
  528. private static final void removeWithoutClip(int x, int y, int z, int type) {
  529. }
  530.  
  531. public static void send(GameObject o) {
  532. for (Player player : World.getPlayers())
  533. if ((player != null) && (player.isActive())) {
  534. if ((player.withinRegion(o.getLocation())) && (player.getLocation().getZ() % 4 == o.getLocation().getZ() % 4))
  535. player.getObjects().add(o);
  536. }
  537. }
  538.  
  539. public static void setClipToZero(int x, int y, int z) {
  540. Region region = Region.getRegion(x, y);
  541.  
  542. region.setClipToZero(x, y, z);
  543. }
  544.  
  545. public static void setClipped(int x, int y, int z) {
  546. Region region = Region.getRegion(x, y);
  547.  
  548. region.setClipping(x, y, z, 0x12801ff);
  549. }
  550.  
  551. public static void setProjecileClipToInfinity(int x, int y, int z) {
  552. Region region = Region.getRegion(x, y);
  553.  
  554. region.setProjecileClipToInfinity(x, y, z);
  555. }
  556.  
  557. private static final void spawn(int id, int x, int y, int z, int type, int face) {
  558. MapLoading.addObject(false, id, x, y, z, type, face);
  559. }
  560.  
  561. public static final void spawnWithObject(int id, Location location, int type, int face) {
  562. active.add(new GameObject(id, location.getX(), location.getY(), location.getZ(), type, face));
  563. MapLoading.addObject(false, id, location.getX(), location.getY(), location.getZ(), type, face);
  564.  
  565. send(new GameObject(id, location.getX(), location.getY(), location.getZ(), type, face));
  566. }
  567.  
  568. public static final void spawnWithObject(int id, int x, int y, int z, int type, int face) {
  569. active.add(new GameObject(id, x, y, z, type, face));
  570. MapLoading.addObject(false, id, x, y, z, type, face);
  571.  
  572. send(new GameObject(id, x, y, z, type, face));
  573. }
  574. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement