Greasy Fork is available in English.

better cow

better cow zzz

بۇ قوليازمىنى بىۋاسىتە قاچىلاشقا بولمايدۇ. بۇ باشقا قوليازمىلارنىڭ ئىشلىتىشى ئۈچۈن تەمىنلەنگەن ئامبار بولۇپ، ئىشلىتىش ئۈچۈن مېتا كۆرسەتمىسىگە قىستۇرىدىغان كود: // @require https://update.greatest.deepsurf.us/scripts/482127/1295114/better%20cow.js

  1. /******/
  2. (function() { // webpackBootstrap
  3. /******/
  4. "use strict";
  5. /******/
  6. var __webpack_modules__ = ({
  7. /***/
  8. "./src/Cow.js":
  9. /*!********************!*\
  10. !*** ./src/Cow.js ***!
  11. \********************/
  12. /***/
  13. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  14. __webpack_require__.r(__webpack_exports__);
  15. /* harmony import */
  16. var _config_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./config.json */ "./src/config.json");
  17. /* harmony import */
  18. var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./constants.js */ "./src/constants.js");
  19. /* harmony import */
  20. var _modules_entities_Player_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./modules/entities/Player.js */ "./src/modules/entities/Player.js");
  21. /* harmony import */
  22. var _modules_plugins_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./modules/plugins/index.js */ "./src/modules/plugins/index.js");
  23. /* harmony import */
  24. var _game_configs_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./game_configs/index.js */ "./src/game_configs/index.js");
  25. class Cow {
  26. constructor() {
  27. this.config = _config_json__WEBPACK_IMPORTED_MODULE_0__
  28. this.items = _game_configs_index_js__WEBPACK_IMPORTED_MODULE_4__
  29. this.codec = _constants_js__WEBPACK_IMPORTED_MODULE_1__.codec
  30. this.socket = _constants_js__WEBPACK_IMPORTED_MODULE_1__.socket
  31. this.playersManager = _constants_js__WEBPACK_IMPORTED_MODULE_1__.playersManager
  32. this.objectsManager = _constants_js__WEBPACK_IMPORTED_MODULE_1__.objectsManager
  33. this.animalsManager = _constants_js__WEBPACK_IMPORTED_MODULE_1__.animalsManager
  34. this.ticker = _constants_js__WEBPACK_IMPORTED_MODULE_1__.ticker
  35. this.camera = _constants_js__WEBPACK_IMPORTED_MODULE_1__.camera
  36. this.renderer = _constants_js__WEBPACK_IMPORTED_MODULE_1__.renderer
  37. this.input = _constants_js__WEBPACK_IMPORTED_MODULE_1__.input
  38. this.placement = _constants_js__WEBPACK_IMPORTED_MODULE_1__.placement
  39. this.player = void 0
  40. this.inGame = false
  41. this._plugins = new Map([
  42. ["auto-reconect", new _modules_plugins_index_js__WEBPACK_IMPORTED_MODULE_3__.AutoReconect()]
  43. ])
  44. }
  45. onPacket(packetName, listener) {
  46. this.socket.handler.onPacket(packetName, listener)
  47. }
  48. onKeyboard(keyName, listener, options) {
  49. return this.input.keyboard.on(keyName, listener, options)
  50. }
  51. sendPacket(packetName, ...content) {
  52. this.socket.send(packetName, content)
  53. }
  54. placeItem(groupIndex, {
  55. angle
  56. } = {}) {
  57. this.placement.placeItem(groupIndex, {
  58. angle
  59. })
  60. }
  61. addRender(renderKey, renderFunc) {
  62. this.renderer.addRender(renderKey, renderFunc)
  63. }
  64. deleteRender(renderKey) {
  65. this.renderer.renders.delete(renderKey)
  66. }
  67. setInGame(_inGame) {
  68. if (typeof _inGame !== 'boolean') return
  69. this._inGame = _inGame
  70. }
  71. getNearPlayer(checkEnemy) {
  72. if (!this.player) return
  73. const {
  74. CowUtils
  75. } = window
  76. let players = this.playersManager.list
  77. if (checkEnemy) {
  78. players = players.filter((player) => !player.isAlly)
  79. }
  80. return players.sort((a, b) => {
  81. a = CowUtils.getDistance(a, this.player)
  82. b = CowUtils.getDistance(b, this.player)
  83. return a - b
  84. })[0]
  85. }
  86. getNearEnemy() {
  87. return this.getNearPlayer(true)
  88. }
  89. setPlayer(player) {
  90. this.camera.setTo(player.x, player.y)
  91. if (!(player instanceof _modules_entities_Player_js__WEBPACK_IMPORTED_MODULE_2__["default"]) || typeof this.player !== 'undefined') return
  92. this.player = player
  93. }
  94. setPluginState(pluginName, state) {
  95. if (!this._plugins.has(pluginName)) return
  96. const plugin = this._plugins.get(pluginName)
  97. plugin.setActiveState(state)
  98. }
  99. executePlugin(pluginName) {
  100. if (!this._plugins.has(pluginName)) return
  101. const plugin = this._plugins.get(pluginName)
  102. if (!plugin.isActiveState) return
  103. plugin.execute()
  104. }
  105. }
  106. /* harmony default export */
  107. __webpack_exports__["default"] = (Cow);
  108. /***/
  109. }),
  110. /***/
  111. "./src/constants.js":
  112. /*!**************************!*\
  113. !*** ./src/constants.js ***!
  114. \**************************/
  115. /***/
  116. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  117. __webpack_require__.r(__webpack_exports__);
  118. /* harmony export */
  119. __webpack_require__.d(__webpack_exports__, {
  120. /* harmony export */
  121. animalsManager: function() {
  122. return /* binding */ animalsManager;
  123. },
  124. /* harmony export */
  125. camera: function() {
  126. return /* binding */ camera;
  127. },
  128. /* harmony export */
  129. codec: function() {
  130. return /* binding */ codec;
  131. },
  132. /* harmony export */
  133. cow: function() {
  134. return /* binding */ cow;
  135. },
  136. /* harmony export */
  137. input: function() {
  138. return /* binding */ input;
  139. },
  140. /* harmony export */
  141. objectsManager: function() {
  142. return /* binding */ objectsManager;
  143. },
  144. /* harmony export */
  145. placement: function() {
  146. return /* binding */ placement;
  147. },
  148. /* harmony export */
  149. playersManager: function() {
  150. return /* binding */ playersManager;
  151. },
  152. /* harmony export */
  153. renderer: function() {
  154. return /* binding */ renderer;
  155. },
  156. /* harmony export */
  157. socket: function() {
  158. return /* binding */ socket;
  159. },
  160. /* harmony export */
  161. ticker: function() {
  162. return /* binding */ ticker;
  163. }
  164. /* harmony export */
  165. });
  166. /* harmony import */
  167. var _Cow_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Cow.js */ "./src/Cow.js");
  168. /* harmony import */
  169. var _modules_Placement_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./modules/Placement.js */ "./src/modules/Placement.js");
  170. /* harmony import */
  171. var _modules_Ticker_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./modules/Ticker.js */ "./src/modules/Ticker.js");
  172. /* harmony import */
  173. var _modules_input_Input_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./modules/input/Input.js */ "./src/modules/input/Input.js");
  174. /* harmony import */
  175. var _modules_managers_AnimalsManager_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./modules/managers/AnimalsManager.js */ "./src/modules/managers/AnimalsManager.js");
  176. /* harmony import */
  177. var _modules_managers_ObjectsManager_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ./modules/managers/ObjectsManager.js */ "./src/modules/managers/ObjectsManager.js");
  178. /* harmony import */
  179. var _modules_managers_PlayersManager_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__( /*! ./modules/managers/PlayersManager.js */ "./src/modules/managers/PlayersManager.js");
  180. /* harmony import */
  181. var _modules_render_Camera_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__( /*! ./modules/render/Camera.js */ "./src/modules/render/Camera.js");
  182. /* harmony import */
  183. var _modules_render_Renderer_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__( /*! ./modules/render/Renderer.js */ "./src/modules/render/Renderer.js");
  184. /* harmony import */
  185. var _modules_socket_Socket_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__( /*! ./modules/socket/Socket.js */ "./src/modules/socket/Socket.js");
  186. const codec = {
  187. decoder: void 0,
  188. encoder: void 0,
  189. isReady: false
  190. }
  191. const socket = new _modules_socket_Socket_js__WEBPACK_IMPORTED_MODULE_9__["default"]()
  192. const playersManager = new _modules_managers_PlayersManager_js__WEBPACK_IMPORTED_MODULE_6__["default"]()
  193. const objectsManager = new _modules_managers_ObjectsManager_js__WEBPACK_IMPORTED_MODULE_5__["default"]()
  194. const animalsManager = new _modules_managers_AnimalsManager_js__WEBPACK_IMPORTED_MODULE_4__["default"]()
  195. const ticker = new _modules_Ticker_js__WEBPACK_IMPORTED_MODULE_2__["default"]()
  196. const camera = new _modules_render_Camera_js__WEBPACK_IMPORTED_MODULE_7__["default"]()
  197. const renderer = new _modules_render_Renderer_js__WEBPACK_IMPORTED_MODULE_8__["default"]()
  198. const input = new _modules_input_Input_js__WEBPACK_IMPORTED_MODULE_3__["default"]()
  199. const placement = new _modules_Placement_js__WEBPACK_IMPORTED_MODULE_1__["default"]()
  200. const cow = new _Cow_js__WEBPACK_IMPORTED_MODULE_0__["default"]()
  201. /***/
  202. }),
  203. /***/
  204. "./src/game_configs/accessories.js":
  205. /*!*****************************************!*\
  206. !*** ./src/game_configs/accessories.js ***!
  207. \*****************************************/
  208. /***/
  209. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  210. __webpack_require__.r(__webpack_exports__);
  211. const accessories = [{
  212. id: 12,
  213. name: "Snowball",
  214. price: 1e3,
  215. scale: 105,
  216. xOff: 18,
  217. desc: "no effect"
  218. }, {
  219. id: 9,
  220. name: "Tree Cape",
  221. price: 1e3,
  222. scale: 90,
  223. desc: "no effect"
  224. }, {
  225. id: 10,
  226. name: "Stone Cape",
  227. price: 1e3,
  228. scale: 90,
  229. desc: "no effect"
  230. }, {
  231. id: 3,
  232. name: "Cookie Cape",
  233. price: 1500,
  234. scale: 90,
  235. desc: "no effect"
  236. }, {
  237. id: 8,
  238. name: "Cow Cape",
  239. price: 2e3,
  240. scale: 90,
  241. desc: "no effect"
  242. }, {
  243. id: 11,
  244. name: "Monkey Tail",
  245. price: 2e3,
  246. scale: 97,
  247. xOff: 25,
  248. desc: "Super speed but reduced damage",
  249. spdMult: 1.35,
  250. dmgMultO: .2
  251. }, {
  252. id: 17,
  253. name: "Apple Basket",
  254. price: 3e3,
  255. scale: 80,
  256. xOff: 12,
  257. desc: "slowly regenerates health over time",
  258. healthRegen: 1
  259. }, {
  260. id: 6,
  261. name: "Winter Cape",
  262. price: 3e3,
  263. scale: 90,
  264. desc: "no effect"
  265. }, {
  266. id: 4,
  267. name: "Skull Cape",
  268. price: 4e3,
  269. scale: 90,
  270. desc: "no effect"
  271. }, {
  272. id: 5,
  273. name: "Dash Cape",
  274. price: 5e3,
  275. scale: 90,
  276. desc: "no effect"
  277. }, {
  278. id: 2,
  279. name: "Dragon Cape",
  280. price: 6e3,
  281. scale: 90,
  282. desc: "no effect"
  283. }, {
  284. id: 1,
  285. name: "Super Cape",
  286. price: 8e3,
  287. scale: 90,
  288. desc: "no effect"
  289. }, {
  290. id: 7,
  291. name: "Troll Cape",
  292. price: 8e3,
  293. scale: 90,
  294. desc: "no effect"
  295. }, {
  296. id: 14,
  297. name: "Thorns",
  298. price: 1e4,
  299. scale: 115,
  300. xOff: 20,
  301. desc: "no effect"
  302. }, {
  303. id: 15,
  304. name: "Blockades",
  305. price: 1e4,
  306. scale: 95,
  307. xOff: 15,
  308. desc: "no effect"
  309. }, {
  310. id: 20,
  311. name: "Devils Tail",
  312. price: 1e4,
  313. scale: 95,
  314. xOff: 20,
  315. desc: "no effect"
  316. }, {
  317. id: 16,
  318. name: "Sawblade",
  319. price: 12e3,
  320. scale: 90,
  321. spin: !0,
  322. xOff: 0,
  323. desc: "deal damage to players that damage you",
  324. dmg: .15
  325. }, {
  326. id: 13,
  327. name: "Angel Wings",
  328. price: 15e3,
  329. scale: 138,
  330. xOff: 22,
  331. desc: "slowly regenerates health over time",
  332. healthRegen: 3
  333. }, {
  334. id: 19,
  335. name: "Shadow Wings",
  336. price: 15e3,
  337. scale: 138,
  338. xOff: 22,
  339. desc: "increased movement speed",
  340. spdMult: 1.1
  341. }, {
  342. id: 18,
  343. name: "Blood Wings",
  344. price: 2e4,
  345. scale: 178,
  346. xOff: 26,
  347. desc: "restores health when you deal damage",
  348. healD: .2
  349. }, {
  350. id: 21,
  351. name: "Corrupt X Wings",
  352. price: 2e4,
  353. scale: 178,
  354. xOff: 26,
  355. desc: "deal damage to players that damage you",
  356. dmg: .25
  357. }]
  358. accessories.searchById = function(id) {
  359. return this.find((accessory) => accessory.id === id)
  360. }
  361. /* harmony default export */
  362. __webpack_exports__["default"] = (accessories);
  363. /***/
  364. }),
  365. /***/
  366. "./src/game_configs/aiTypes.js":
  367. /*!*************************************!*\
  368. !*** ./src/game_configs/aiTypes.js ***!
  369. \*************************************/
  370. /***/
  371. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  372. __webpack_require__.r(__webpack_exports__);
  373. /* harmony default export */
  374. __webpack_exports__["default"] = ([{
  375. id: 0,
  376. src: "cow_1",
  377. killScore: 150,
  378. health: 500,
  379. weightM: 0.8,
  380. speed: 0.00095,
  381. turnSpeed: 0.001,
  382. scale: 72,
  383. drop: ["food", 50]
  384. }, {
  385. id: 1,
  386. src: "pig_1",
  387. killScore: 200,
  388. health: 800,
  389. weightM: 0.6,
  390. speed: 0.00085,
  391. turnSpeed: 0.001,
  392. scale: 72,
  393. drop: ["food", 80]
  394. }, {
  395. id: 2,
  396. name: "Bull",
  397. src: "bull_2",
  398. hostile: true,
  399. dmg: 20,
  400. killScore: 1000,
  401. health: 1800,
  402. weightM: 0.5,
  403. speed: 0.00094,
  404. turnSpeed: 0.00074,
  405. scale: 78,
  406. viewRange: 800,
  407. chargePlayer: true,
  408. drop: ["food", 100]
  409. }, {
  410. id: 3,
  411. name: "Bully",
  412. src: "bull_1",
  413. hostile: true,
  414. dmg: 20,
  415. killScore: 2000,
  416. health: 2800,
  417. weightM: 0.45,
  418. speed: 0.001,
  419. turnSpeed: 0.0008,
  420. scale: 90,
  421. viewRange: 900,
  422. chargePlayer: true,
  423. drop: ["food", 400]
  424. }, {
  425. id: 4,
  426. name: "Wolf",
  427. src: "wolf_1",
  428. hostile: true,
  429. dmg: 8,
  430. killScore: 500,
  431. health: 300,
  432. weightM: 0.45,
  433. speed: 0.001,
  434. turnSpeed: 0.002,
  435. scale: 84,
  436. viewRange: 800,
  437. chargePlayer: true,
  438. drop: ["food", 200]
  439. }, {
  440. id: 5,
  441. name: "Quack",
  442. src: "chicken_1",
  443. dmg: 8,
  444. killScore: 2000,
  445. noTrap: true,
  446. health: 300,
  447. weightM: 0.2,
  448. speed: 0.0018,
  449. turnSpeed: 0.006,
  450. scale: 70,
  451. drop: ["food", 100]
  452. }, {
  453. id: 6,
  454. name: "MOOSTAFA",
  455. nameScale: 50,
  456. src: "enemy",
  457. hostile: true,
  458. dontRun: true,
  459. fixedSpawn: true,
  460. spawnDelay: 60000,
  461. noTrap: true,
  462. colDmg: 100,
  463. dmg: 40,
  464. killScore: 8000,
  465. health: 18000,
  466. weightM: 0.4,
  467. speed: 0.0007,
  468. turnSpeed: 0.01,
  469. scale: 80,
  470. spriteMlt: 1.8,
  471. leapForce: 0.9,
  472. viewRange: 1000,
  473. hitRange: 210,
  474. hitDelay: 1000,
  475. chargePlayer: true,
  476. drop: ["food", 100]
  477. }, {
  478. id: 7,
  479. name: "Treasure",
  480. hostile: true,
  481. nameScale: 35,
  482. src: "crate_1",
  483. fixedSpawn: true,
  484. spawnDelay: 120000,
  485. colDmg: 200,
  486. killScore: 5000,
  487. health: 20000,
  488. weightM: 0.1,
  489. speed: 0.0,
  490. turnSpeed: 0.0,
  491. scale: 70,
  492. spriteMlt: 1.0
  493. }, {
  494. id: 8,
  495. name: "MOOFIE",
  496. src: "wolf_2",
  497. hostile: true,
  498. fixedSpawn: true,
  499. dontRun: true,
  500. hitScare: 4,
  501. spawnDelay: 30000,
  502. noTrap: true,
  503. nameScale: 35,
  504. dmg: 10,
  505. colDmg: 100,
  506. killScore: 3000,
  507. health: 7000,
  508. weightM: 0.45,
  509. speed: 0.0015,
  510. turnSpeed: 0.002,
  511. scale: 90,
  512. viewRange: 800,
  513. chargePlayer: true,
  514. drop: ["food", 1000]
  515. }]);
  516. /***/
  517. }),
  518. /***/
  519. "./src/game_configs/groups.js":
  520. /*!************************************!*\
  521. !*** ./src/game_configs/groups.js ***!
  522. \************************************/
  523. /***/
  524. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  525. __webpack_require__.r(__webpack_exports__);
  526. /* harmony default export */
  527. __webpack_exports__["default"] = ([{
  528. id: 0,
  529. name: "food",
  530. layer: 0
  531. }, {
  532. id: 1,
  533. name: "walls",
  534. place: !0,
  535. limit: 30,
  536. layer: 0
  537. }, {
  538. id: 2,
  539. name: "spikes",
  540. place: !0,
  541. limit: 15,
  542. layer: 0
  543. }, {
  544. id: 3,
  545. name: "mill",
  546. place: !0,
  547. limit: 7,
  548. sandboxLimit: 299,
  549. layer: 1
  550. }, {
  551. id: 4,
  552. name: "mine",
  553. place: !0,
  554. limit: 1,
  555. layer: 0
  556. }, {
  557. id: 5,
  558. name: "trap",
  559. place: !0,
  560. limit: 6,
  561. layer: -1
  562. }, {
  563. id: 6,
  564. name: "booster",
  565. place: !0,
  566. limit: 12,
  567. sandboxLimit: 299,
  568. layer: -1
  569. }, {
  570. id: 7,
  571. name: "turret",
  572. place: !0,
  573. limit: 2,
  574. layer: 1
  575. }, {
  576. id: 8,
  577. name: "watchtower",
  578. place: !0,
  579. limit: 12,
  580. layer: 1
  581. }, {
  582. id: 9,
  583. name: "buff",
  584. place: !0,
  585. limit: 4,
  586. layer: -1
  587. }, {
  588. id: 10,
  589. name: "spawn",
  590. place: !0,
  591. limit: 1,
  592. layer: -1
  593. }, {
  594. id: 11,
  595. name: "sapling",
  596. place: !0,
  597. limit: 2,
  598. layer: 0
  599. }, {
  600. id: 12,
  601. name: "blocker",
  602. place: !0,
  603. limit: 3,
  604. layer: -1
  605. }, {
  606. id: 13,
  607. name: "teleporter",
  608. place: !0,
  609. limit: 2,
  610. sandboxLimit: 299,
  611. layer: -1
  612. }]);
  613. /***/
  614. }),
  615. /***/
  616. "./src/game_configs/hats.js":
  617. /*!**********************************!*\
  618. !*** ./src/game_configs/hats.js ***!
  619. \**********************************/
  620. /***/
  621. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  622. __webpack_require__.r(__webpack_exports__);
  623. const hats = [{
  624. id: 45,
  625. name: "Shame!",
  626. dontSell: !0,
  627. price: 0,
  628. scale: 120,
  629. desc: "hacks are for losers"
  630. }, {
  631. id: 51,
  632. name: "Moo Cap",
  633. price: 0,
  634. scale: 120,
  635. desc: "coolest mooer around"
  636. }, {
  637. id: 50,
  638. name: "Apple Cap",
  639. price: 0,
  640. scale: 120,
  641. desc: "apple farms remembers"
  642. }, {
  643. id: 28,
  644. name: "Moo Head",
  645. price: 0,
  646. scale: 120,
  647. desc: "no effect"
  648. }, {
  649. id: 29,
  650. name: "Pig Head",
  651. price: 0,
  652. scale: 120,
  653. desc: "no effect"
  654. }, {
  655. id: 30,
  656. name: "Fluff Head",
  657. price: 0,
  658. scale: 120,
  659. desc: "no effect"
  660. }, {
  661. id: 36,
  662. name: "Pandou Head",
  663. price: 0,
  664. scale: 120,
  665. desc: "no effect"
  666. }, {
  667. id: 37,
  668. name: "Bear Head",
  669. price: 0,
  670. scale: 120,
  671. desc: "no effect"
  672. }, {
  673. id: 38,
  674. name: "Monkey Head",
  675. price: 0,
  676. scale: 120,
  677. desc: "no effect"
  678. }, {
  679. id: 44,
  680. name: "Polar Head",
  681. price: 0,
  682. scale: 120,
  683. desc: "no effect"
  684. }, {
  685. id: 35,
  686. name: "Fez Hat",
  687. price: 0,
  688. scale: 120,
  689. desc: "no effect"
  690. }, {
  691. id: 42,
  692. name: "Enigma Hat",
  693. price: 0,
  694. scale: 120,
  695. desc: "join the enigma army"
  696. }, {
  697. id: 43,
  698. name: "Blitz Hat",
  699. price: 0,
  700. scale: 120,
  701. desc: "hey everybody i'm blitz"
  702. }, {
  703. id: 49,
  704. name: "Bob XIII Hat",
  705. price: 0,
  706. scale: 120,
  707. desc: "like and subscribe"
  708. }, {
  709. id: 57,
  710. name: "Pumpkin",
  711. price: 50,
  712. scale: 120,
  713. desc: "Spooooky"
  714. }, {
  715. id: 8,
  716. name: "Bummle Hat",
  717. price: 100,
  718. scale: 120,
  719. desc: "no effect"
  720. }, {
  721. id: 2,
  722. name: "Straw Hat",
  723. price: 500,
  724. scale: 120,
  725. desc: "no effect"
  726. }, {
  727. id: 15,
  728. name: "Winter Cap",
  729. price: 600,
  730. scale: 120,
  731. desc: "allows you to move at normal speed in snow",
  732. coldM: 1
  733. }, {
  734. id: 5,
  735. name: "Cowboy Hat",
  736. price: 1e3,
  737. scale: 120,
  738. desc: "no effect"
  739. }, {
  740. id: 4,
  741. name: "Ranger Hat",
  742. price: 2e3,
  743. scale: 120,
  744. desc: "no effect"
  745. }, {
  746. id: 18,
  747. name: "Explorer Hat",
  748. price: 2e3,
  749. scale: 120,
  750. desc: "no effect"
  751. }, {
  752. id: 31,
  753. name: "Flipper Hat",
  754. price: 2500,
  755. scale: 120,
  756. desc: "have more control while in water",
  757. watrImm: !0
  758. }, {
  759. id: 1,
  760. name: "Marksman Cap",
  761. price: 3e3,
  762. scale: 120,
  763. desc: "increases arrow speed and range",
  764. aMlt: 1.3
  765. }, {
  766. id: 10,
  767. name: "Bush Gear",
  768. price: 3e3,
  769. scale: 160,
  770. desc: "allows you to disguise yourself as a bush"
  771. }, {
  772. id: 48,
  773. name: "Halo",
  774. price: 3e3,
  775. scale: 120,
  776. desc: "no effect"
  777. }, {
  778. id: 6,
  779. name: "Soldier Helmet",
  780. price: 4e3,
  781. scale: 120,
  782. desc: "reduces damage taken but slows movement",
  783. spdMult: .94,
  784. dmgMult: .75
  785. }, {
  786. id: 23,
  787. name: "Anti Venom Gear",
  788. price: 4e3,
  789. scale: 120,
  790. desc: "makes you immune to poison",
  791. poisonRes: 1
  792. }, {
  793. id: 13,
  794. name: "Medic Gear",
  795. price: 5e3,
  796. scale: 110,
  797. desc: "slowly regenerates health over time",
  798. healthRegen: 3
  799. }, {
  800. id: 9,
  801. name: "Miners Helmet",
  802. price: 5e3,
  803. scale: 120,
  804. desc: "earn 1 extra gold per resource",
  805. extraGold: 1
  806. }, {
  807. id: 32,
  808. name: "Musketeer Hat",
  809. price: 5e3,
  810. scale: 120,
  811. desc: "reduces cost of projectiles",
  812. projCost: .5
  813. }, {
  814. id: 7,
  815. name: "Bull Helmet",
  816. price: 6e3,
  817. scale: 120,
  818. desc: "increases damage done but drains health",
  819. healthRegen: -5,
  820. dmgMultO: 1.5,
  821. spdMult: .96
  822. }, {
  823. id: 22,
  824. name: "Emp Helmet",
  825. price: 6e3,
  826. scale: 120,
  827. desc: "turrets won't attack but you move slower",
  828. antiTurret: 1,
  829. spdMult: .7
  830. }, {
  831. id: 12,
  832. name: "Booster Hat",
  833. price: 6e3,
  834. scale: 120,
  835. desc: "increases your movement speed",
  836. spdMult: 1.16
  837. }, {
  838. id: 26,
  839. name: "Barbarian Armor",
  840. price: 8e3,
  841. scale: 120,
  842. desc: "knocks back enemies that attack you",
  843. dmgK: .6
  844. }, {
  845. id: 21,
  846. name: "Plague Mask",
  847. price: 1e4,
  848. scale: 120,
  849. desc: "melee attacks deal poison damage",
  850. poisonDmg: 5,
  851. poisonTime: 6
  852. }, {
  853. id: 46,
  854. name: "Bull Mask",
  855. price: 1e4,
  856. scale: 120,
  857. desc: "bulls won't target you unless you attack them",
  858. bullRepel: 1
  859. }, {
  860. id: 14,
  861. name: "Windmill Hat",
  862. topSprite: !0,
  863. price: 1e4,
  864. scale: 120,
  865. desc: "generates points while worn",
  866. pps: 1.5
  867. }, {
  868. id: 11,
  869. name: "Spike Gear",
  870. topSprite: !0,
  871. price: 1e4,
  872. scale: 120,
  873. desc: "deal damage to players that damage you",
  874. dmg: .45
  875. }, {
  876. id: 53,
  877. name: "Turret Gear",
  878. topSprite: !0,
  879. price: 1e4,
  880. scale: 120,
  881. desc: "you become a walking turret",
  882. turret: {
  883. proj: 1,
  884. range: 700,
  885. rate: 2500
  886. },
  887. spdMult: .7
  888. }, {
  889. id: 20,
  890. name: "Samurai Armor",
  891. price: 12e3,
  892. scale: 120,
  893. desc: "increased attack speed and fire rate",
  894. atkSpd: .78
  895. }, {
  896. id: 58,
  897. name: "Dark Knight",
  898. price: 12e3,
  899. scale: 120,
  900. desc: "restores health when you deal damage",
  901. healD: .4
  902. }, {
  903. id: 27,
  904. name: "Scavenger Gear",
  905. price: 15e3,
  906. scale: 120,
  907. desc: "earn double points for each kill",
  908. kScrM: 2
  909. }, {
  910. id: 40,
  911. name: "Tank Gear",
  912. price: 15e3,
  913. scale: 120,
  914. desc: "increased damage to buildings but slower movement",
  915. spdMult: .3,
  916. bDmg: 3.3
  917. }, {
  918. id: 52,
  919. name: "Thief Gear",
  920. price: 15e3,
  921. scale: 120,
  922. desc: "steal half of a players gold when you kill them",
  923. goldSteal: .5
  924. }, {
  925. id: 55,
  926. name: "Bloodthirster",
  927. price: 2e4,
  928. scale: 120,
  929. desc: "Restore Health when dealing damage. And increased damage",
  930. healD: .25,
  931. dmgMultO: 1.2
  932. }, {
  933. id: 56,
  934. name: "Assassin Gear",
  935. price: 2e4,
  936. scale: 120,
  937. desc: "Go invisible when not moving. Can't eat. Increased speed",
  938. noEat: !0,
  939. spdMult: 1.1,
  940. invisTimer: 1e3
  941. }]
  942. hats.searchById = function(id) {
  943. return this.find((hat) => hat.id === id)
  944. }
  945. /* harmony default export */
  946. __webpack_exports__["default"] = (hats);
  947. /***/
  948. }),
  949. /***/
  950. "./src/game_configs/index.js":
  951. /*!***********************************!*\
  952. !*** ./src/game_configs/index.js ***!
  953. \***********************************/
  954. /***/
  955. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  956. __webpack_require__.r(__webpack_exports__);
  957. /* harmony export */
  958. __webpack_require__.d(__webpack_exports__, {
  959. /* harmony export */
  960. accessories: function() {
  961. return /* reexport safe */ _accessories_js__WEBPACK_IMPORTED_MODULE_0__["default"];
  962. },
  963. /* harmony export */
  964. aiTypes: function() {
  965. return /* reexport safe */ _aiTypes_js__WEBPACK_IMPORTED_MODULE_1__["default"];
  966. },
  967. /* harmony export */
  968. groups: function() {
  969. return /* reexport safe */ _groups_js__WEBPACK_IMPORTED_MODULE_2__["default"];
  970. },
  971. /* harmony export */
  972. hats: function() {
  973. return /* reexport safe */ _hats_js__WEBPACK_IMPORTED_MODULE_3__["default"];
  974. },
  975. /* harmony export */
  976. list: function() {
  977. return /* reexport safe */ _list_js__WEBPACK_IMPORTED_MODULE_4__["default"];
  978. },
  979. /* harmony export */
  980. projectiles: function() {
  981. return /* reexport safe */ _projectiles_js__WEBPACK_IMPORTED_MODULE_5__["default"];
  982. },
  983. /* harmony export */
  984. variants: function() {
  985. return /* reexport safe */ _variants_js__WEBPACK_IMPORTED_MODULE_6__["default"];
  986. },
  987. /* harmony export */
  988. weapons: function() {
  989. return /* reexport safe */ _weapons_js__WEBPACK_IMPORTED_MODULE_7__["default"];
  990. }
  991. /* harmony export */
  992. });
  993. /* harmony import */
  994. var _accessories_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./accessories.js */ "./src/game_configs/accessories.js");
  995. /* harmony import */
  996. var _aiTypes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./aiTypes.js */ "./src/game_configs/aiTypes.js");
  997. /* harmony import */
  998. var _groups_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./groups.js */ "./src/game_configs/groups.js");
  999. /* harmony import */
  1000. var _hats_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./hats.js */ "./src/game_configs/hats.js");
  1001. /* harmony import */
  1002. var _list_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./list.js */ "./src/game_configs/list.js");
  1003. /* harmony import */
  1004. var _projectiles_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ./projectiles.js */ "./src/game_configs/projectiles.js");
  1005. /* harmony import */
  1006. var _variants_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__( /*! ./variants.js */ "./src/game_configs/variants.js");
  1007. /* harmony import */
  1008. var _weapons_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__( /*! ./weapons.js */ "./src/game_configs/weapons.js");
  1009. /***/
  1010. }),
  1011. /***/
  1012. "./src/game_configs/list.js":
  1013. /*!**********************************!*\
  1014. !*** ./src/game_configs/list.js ***!
  1015. \**********************************/
  1016. /***/
  1017. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1018. __webpack_require__.r(__webpack_exports__);
  1019. /* harmony import */
  1020. var _groups_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./groups.js */ "./src/game_configs/groups.js");
  1021. const list = [{
  1022. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][0],
  1023. name: "apple",
  1024. desc: "restores 20 health when consumed",
  1025. req: ["food", 10],
  1026. consume: function(e) {
  1027. return e.changeHealth(20, e)
  1028. },
  1029. scale: 22,
  1030. holdOffset: 15
  1031. }, {
  1032. age: 3,
  1033. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][0],
  1034. name: "cookie",
  1035. desc: "restores 40 health when consumed",
  1036. req: ["food", 15],
  1037. consume: function(e) {
  1038. return e.changeHealth(40, e)
  1039. },
  1040. scale: 27,
  1041. holdOffset: 15
  1042. }, {
  1043. age: 7,
  1044. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][0],
  1045. name: "cheese",
  1046. desc: "restores 30 health and another 50 over 5 seconds",
  1047. req: ["food", 25],
  1048. consume: function(e) {
  1049. return e.changeHealth(30, e) || e.health < 100 ? (e.dmgOverTime.dmg = -10,
  1050. e.dmgOverTime.doer = e,
  1051. e.dmgOverTime.time = 5,
  1052. !0) : !1
  1053. },
  1054. scale: 27,
  1055. holdOffset: 15
  1056. }, {
  1057. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][1],
  1058. name: "wood wall",
  1059. desc: "provides protection for your village",
  1060. req: ["wood", 10],
  1061. projDmg: !0,
  1062. health: 380,
  1063. scale: 50,
  1064. holdOffset: 20,
  1065. placeOffset: -5
  1066. }, {
  1067. age: 3,
  1068. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][1],
  1069. name: "stone wall",
  1070. desc: "provides improved protection for your village",
  1071. req: ["stone", 25],
  1072. health: 900,
  1073. scale: 50,
  1074. holdOffset: 20,
  1075. placeOffset: -5
  1076. }, {
  1077. age: 7,
  1078. pre: 1,
  1079. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][1],
  1080. name: "castle wall",
  1081. desc: "provides powerful protection for your village",
  1082. req: ["stone", 35],
  1083. health: 1500,
  1084. scale: 52,
  1085. holdOffset: 20,
  1086. placeOffset: -5
  1087. }, {
  1088. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][2],
  1089. name: "spikes",
  1090. desc: "damages enemies when they touch them",
  1091. req: ["wood", 20, "stone", 5],
  1092. health: 400,
  1093. dmg: 20,
  1094. scale: 49,
  1095. spritePadding: -23,
  1096. holdOffset: 8,
  1097. placeOffset: -5
  1098. }, {
  1099. age: 5,
  1100. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][2],
  1101. name: "greater spikes",
  1102. desc: "damages enemies when they touch them",
  1103. req: ["wood", 30, "stone", 10],
  1104. health: 500,
  1105. dmg: 35,
  1106. scale: 52,
  1107. spritePadding: -23,
  1108. holdOffset: 8,
  1109. placeOffset: -5
  1110. }, {
  1111. age: 9,
  1112. pre: 1,
  1113. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][2],
  1114. name: "poison spikes",
  1115. desc: "poisons enemies when they touch them",
  1116. req: ["wood", 35, "stone", 15],
  1117. health: 600,
  1118. dmg: 30,
  1119. pDmg: 5,
  1120. scale: 52,
  1121. spritePadding: -23,
  1122. holdOffset: 8,
  1123. placeOffset: -5
  1124. }, {
  1125. age: 9,
  1126. pre: 2,
  1127. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][2],
  1128. name: "spinning spikes",
  1129. desc: "damages enemies when they touch them",
  1130. req: ["wood", 30, "stone", 20],
  1131. health: 500,
  1132. dmg: 45,
  1133. turnSpeed: .003,
  1134. scale: 52,
  1135. spritePadding: -23,
  1136. holdOffset: 8,
  1137. placeOffset: -5
  1138. }, {
  1139. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][3],
  1140. name: "windmill",
  1141. desc: "generates gold over time",
  1142. req: ["wood", 50, "stone", 10],
  1143. health: 400,
  1144. pps: 1,
  1145. turnSpeed: .0016,
  1146. spritePadding: 25,
  1147. iconLineMult: 12,
  1148. scale: 45,
  1149. holdOffset: 20,
  1150. placeOffset: 5
  1151. }, {
  1152. age: 5,
  1153. pre: 1,
  1154. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][3],
  1155. name: "faster windmill",
  1156. desc: "generates more gold over time",
  1157. req: ["wood", 60, "stone", 20],
  1158. health: 500,
  1159. pps: 1.5,
  1160. turnSpeed: .0025,
  1161. spritePadding: 25,
  1162. iconLineMult: 12,
  1163. scale: 47,
  1164. holdOffset: 20,
  1165. placeOffset: 5
  1166. }, {
  1167. age: 8,
  1168. pre: 1,
  1169. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][3],
  1170. name: "power mill",
  1171. desc: "generates more gold over time",
  1172. req: ["wood", 100, "stone", 50],
  1173. health: 800,
  1174. pps: 2,
  1175. turnSpeed: .005,
  1176. spritePadding: 25,
  1177. iconLineMult: 12,
  1178. scale: 47,
  1179. holdOffset: 20,
  1180. placeOffset: 5
  1181. }, {
  1182. age: 5,
  1183. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][4],
  1184. type: 2,
  1185. name: "mine",
  1186. desc: "allows you to mine stone",
  1187. req: ["wood", 20, "stone", 100],
  1188. iconLineMult: 12,
  1189. scale: 65,
  1190. holdOffset: 20,
  1191. placeOffset: 0
  1192. }, {
  1193. age: 5,
  1194. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][11],
  1195. type: 0,
  1196. name: "sapling",
  1197. desc: "allows you to farm wood",
  1198. req: ["wood", 150],
  1199. iconLineMult: 12,
  1200. colDiv: .5,
  1201. scale: 110,
  1202. holdOffset: 50,
  1203. placeOffset: -15
  1204. }, {
  1205. age: 4,
  1206. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][5],
  1207. name: "pit trap",
  1208. desc: "pit that traps enemies if they walk over it",
  1209. req: ["wood", 30, "stone", 30],
  1210. trap: !0,
  1211. ignoreCollision: !0,
  1212. hideFromEnemy: !0,
  1213. health: 500,
  1214. colDiv: .2,
  1215. scale: 50,
  1216. holdOffset: 20,
  1217. placeOffset: -5
  1218. }, {
  1219. age: 4,
  1220. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][6],
  1221. name: "boost pad",
  1222. desc: "provides boost when stepped on",
  1223. req: ["stone", 20, "wood", 5],
  1224. ignoreCollision: !0,
  1225. boostSpeed: 1.5,
  1226. health: 150,
  1227. colDiv: .7,
  1228. scale: 45,
  1229. holdOffset: 20,
  1230. placeOffset: -5
  1231. }, {
  1232. age: 7,
  1233. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][7],
  1234. doUpdate: !0,
  1235. name: "turret",
  1236. desc: "defensive structure that shoots at enemies",
  1237. req: ["wood", 200, "stone", 150],
  1238. health: 800,
  1239. projectile: 1,
  1240. shootRange: 700,
  1241. shootRate: 2200,
  1242. scale: 43,
  1243. holdOffset: 20,
  1244. placeOffset: -5
  1245. }, {
  1246. age: 7,
  1247. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][8],
  1248. name: "platform",
  1249. desc: "platform to shoot over walls and cross over water",
  1250. req: ["wood", 20],
  1251. ignoreCollision: !0,
  1252. zIndex: 1,
  1253. health: 300,
  1254. scale: 43,
  1255. holdOffset: 20,
  1256. placeOffset: -5
  1257. }, {
  1258. age: 7,
  1259. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][9],
  1260. name: "healing pad",
  1261. desc: "standing on it will slowly heal you",
  1262. req: ["wood", 30, "food", 10],
  1263. ignoreCollision: !0,
  1264. healCol: 15,
  1265. health: 400,
  1266. colDiv: .7,
  1267. scale: 45,
  1268. holdOffset: 20,
  1269. placeOffset: -5
  1270. }, {
  1271. age: 9,
  1272. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][10],
  1273. name: "spawn pad",
  1274. desc: "you will spawn here when you die but it will dissapear",
  1275. req: ["wood", 100, "stone", 100],
  1276. health: 400,
  1277. ignoreCollision: !0,
  1278. spawnPoint: !0,
  1279. scale: 45,
  1280. holdOffset: 20,
  1281. placeOffset: -5
  1282. }, {
  1283. age: 7,
  1284. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][12],
  1285. name: "blocker",
  1286. desc: "blocks building in radius",
  1287. req: ["wood", 30, "stone", 25],
  1288. ignoreCollision: !0,
  1289. blocker: 300,
  1290. health: 400,
  1291. colDiv: .7,
  1292. scale: 45,
  1293. holdOffset: 20,
  1294. placeOffset: -5
  1295. }, {
  1296. age: 7,
  1297. group: _groups_js__WEBPACK_IMPORTED_MODULE_0__["default"][13],
  1298. name: "teleporter",
  1299. desc: "teleports you to a random point on the map",
  1300. req: ["wood", 60, "stone", 60],
  1301. ignoreCollision: !0,
  1302. teleport: !0,
  1303. health: 200,
  1304. colDiv: .7,
  1305. scale: 45,
  1306. holdOffset: 20,
  1307. placeOffset: -5
  1308. }]
  1309. for (var i = 0; i < list.length; ++i) {
  1310. list[i].id = i
  1311. if (list[i].pre) {
  1312. list[i].pre = i - list[i].pre
  1313. }
  1314. }
  1315. /* harmony default export */
  1316. __webpack_exports__["default"] = (list);
  1317. /***/
  1318. }),
  1319. /***/
  1320. "./src/game_configs/projectiles.js":
  1321. /*!*****************************************!*\
  1322. !*** ./src/game_configs/projectiles.js ***!
  1323. \*****************************************/
  1324. /***/
  1325. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1326. __webpack_require__.r(__webpack_exports__);
  1327. /* harmony default export */
  1328. __webpack_exports__["default"] = ([{
  1329. indx: 0,
  1330. layer: 0,
  1331. src: "arrow_1",
  1332. dmg: 25,
  1333. speed: 1.6,
  1334. scale: 103,
  1335. range: 1e3
  1336. }, {
  1337. indx: 1,
  1338. layer: 1,
  1339. dmg: 25,
  1340. scale: 20
  1341. }, {
  1342. indx: 0,
  1343. layer: 0,
  1344. src: "arrow_1",
  1345. dmg: 35,
  1346. speed: 2.5,
  1347. scale: 103,
  1348. range: 1200
  1349. }, {
  1350. indx: 0,
  1351. layer: 0,
  1352. src: "arrow_1",
  1353. dmg: 30,
  1354. speed: 2,
  1355. scale: 103,
  1356. range: 1200
  1357. }, {
  1358. indx: 1,
  1359. layer: 1,
  1360. dmg: 16,
  1361. scale: 20
  1362. }, {
  1363. indx: 0,
  1364. layer: 0,
  1365. src: "bullet_1",
  1366. dmg: 50,
  1367. speed: 3.6,
  1368. scale: 160,
  1369. range: 1400
  1370. }]);
  1371. /***/
  1372. }),
  1373. /***/
  1374. "./src/game_configs/variants.js":
  1375. /*!**************************************!*\
  1376. !*** ./src/game_configs/variants.js ***!
  1377. \**************************************/
  1378. /***/
  1379. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1380. __webpack_require__.r(__webpack_exports__);
  1381. /* harmony default export */
  1382. __webpack_exports__["default"] = ([{
  1383. id: 0,
  1384. src: "",
  1385. xp: 0,
  1386. val: 1
  1387. }, {
  1388. id: 1,
  1389. src: "_g",
  1390. xp: 3000,
  1391. val: 1.1
  1392. }, {
  1393. id: 2,
  1394. src: "_d",
  1395. xp: 7000,
  1396. val: 1.18
  1397. }, {
  1398. id: 3,
  1399. src: "_r",
  1400. poison: true,
  1401. xp: 12000,
  1402. val: 1.18
  1403. }]);
  1404. /***/
  1405. }),
  1406. /***/
  1407. "./src/game_configs/weapons.js":
  1408. /*!*************************************!*\
  1409. !*** ./src/game_configs/weapons.js ***!
  1410. \*************************************/
  1411. /***/
  1412. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1413. __webpack_require__.r(__webpack_exports__);
  1414. /* harmony default export */
  1415. __webpack_exports__["default"] = ([{
  1416. id: 0,
  1417. type: 0,
  1418. name: "tool hammer",
  1419. desc: "tool for gathering all resources",
  1420. src: "hammer_1",
  1421. length: 140,
  1422. width: 140,
  1423. xOff: -3,
  1424. yOff: 18,
  1425. dmg: 25,
  1426. range: 65,
  1427. gather: 1,
  1428. speed: 300
  1429. }, {
  1430. id: 1,
  1431. type: 0,
  1432. age: 2,
  1433. name: "hand axe",
  1434. desc: "gathers resources at a higher rate",
  1435. src: "axe_1",
  1436. length: 140,
  1437. width: 140,
  1438. xOff: 3,
  1439. yOff: 24,
  1440. dmg: 30,
  1441. spdMult: 1,
  1442. range: 70,
  1443. gather: 2,
  1444. speed: 400
  1445. }, {
  1446. id: 2,
  1447. type: 0,
  1448. age: 8,
  1449. pre: 1,
  1450. name: "great axe",
  1451. desc: "deal more damage and gather more resources",
  1452. src: "great_axe_1",
  1453. length: 140,
  1454. width: 140,
  1455. xOff: -8,
  1456. yOff: 25,
  1457. dmg: 35,
  1458. spdMult: 1,
  1459. range: 75,
  1460. gather: 4,
  1461. speed: 400
  1462. }, {
  1463. id: 3,
  1464. type: 0,
  1465. age: 2,
  1466. name: "short sword",
  1467. desc: "increased attack power but slower move speed",
  1468. src: "sword_1",
  1469. iPad: 1.3,
  1470. length: 130,
  1471. width: 210,
  1472. xOff: -8,
  1473. yOff: 46,
  1474. dmg: 35,
  1475. spdMult: .85,
  1476. range: 110,
  1477. gather: 1,
  1478. speed: 300
  1479. }, {
  1480. id: 4,
  1481. type: 0,
  1482. age: 8,
  1483. pre: 3,
  1484. name: "katana",
  1485. desc: "greater range and damage",
  1486. src: "samurai_1",
  1487. iPad: 1.3,
  1488. length: 130,
  1489. width: 210,
  1490. xOff: -8,
  1491. yOff: 59,
  1492. dmg: 40,
  1493. spdMult: .8,
  1494. range: 118,
  1495. gather: 1,
  1496. speed: 300
  1497. }, {
  1498. id: 5,
  1499. type: 0,
  1500. age: 2,
  1501. name: "polearm",
  1502. desc: "long range melee weapon",
  1503. src: "spear_1",
  1504. iPad: 1.3,
  1505. length: 130,
  1506. width: 210,
  1507. xOff: -8,
  1508. yOff: 53,
  1509. dmg: 45,
  1510. knock: .2,
  1511. spdMult: .82,
  1512. range: 142,
  1513. gather: 1,
  1514. speed: 700
  1515. }, {
  1516. id: 6,
  1517. type: 0,
  1518. age: 2,
  1519. name: "bat",
  1520. desc: "fast long range melee weapon",
  1521. src: "bat_1",
  1522. iPad: 1.3,
  1523. length: 110,
  1524. width: 180,
  1525. xOff: -8,
  1526. yOff: 53,
  1527. dmg: 20,
  1528. knock: .7,
  1529. range: 110,
  1530. gather: 1,
  1531. speed: 300
  1532. }, {
  1533. id: 7,
  1534. type: 0,
  1535. age: 2,
  1536. name: "daggers",
  1537. desc: "really fast short range weapon",
  1538. src: "dagger_1",
  1539. iPad: .8,
  1540. length: 110,
  1541. width: 110,
  1542. xOff: 18,
  1543. yOff: 0,
  1544. dmg: 20,
  1545. knock: .1,
  1546. range: 65,
  1547. gather: 1,
  1548. hitSlow: .1,
  1549. spdMult: 1.13,
  1550. speed: 100
  1551. }, {
  1552. id: 8,
  1553. type: 0,
  1554. age: 2,
  1555. name: "stick",
  1556. desc: "great for gathering but very weak",
  1557. src: "stick_1",
  1558. length: 140,
  1559. width: 140,
  1560. xOff: 3,
  1561. yOff: 24,
  1562. dmg: 1,
  1563. spdMult: 1,
  1564. range: 70,
  1565. gather: 7,
  1566. speed: 400
  1567. }, {
  1568. id: 9,
  1569. type: 1,
  1570. age: 6,
  1571. name: "hunting bow",
  1572. desc: "bow used for ranged combat and hunting",
  1573. src: "bow_1",
  1574. req: ["wood", 4],
  1575. length: 120,
  1576. width: 120,
  1577. xOff: -6,
  1578. yOff: 0,
  1579. projectile: 0,
  1580. spdMult: .75,
  1581. speed: 600
  1582. }, {
  1583. id: 10,
  1584. type: 1,
  1585. age: 6,
  1586. name: "great hammer",
  1587. desc: "hammer used for destroying structures",
  1588. src: "great_hammer_1",
  1589. length: 140,
  1590. width: 140,
  1591. xOff: -9,
  1592. yOff: 25,
  1593. dmg: 10,
  1594. spdMult: .88,
  1595. range: 75,
  1596. sDmg: 7.5,
  1597. gather: 1,
  1598. speed: 400
  1599. }, {
  1600. id: 11,
  1601. type: 1,
  1602. age: 6,
  1603. name: "wooden shield",
  1604. desc: "blocks projectiles and reduces melee damage",
  1605. src: "shield_1",
  1606. length: 120,
  1607. width: 120,
  1608. shield: .2,
  1609. xOff: 6,
  1610. yOff: 0,
  1611. spdMult: .7
  1612. }, {
  1613. id: 12,
  1614. type: 1,
  1615. age: 8,
  1616. pre: 9,
  1617. name: "crossbow",
  1618. desc: "deals more damage and has greater range",
  1619. src: "crossbow_1",
  1620. req: ["wood", 5],
  1621. aboveHand: !0,
  1622. armS: .75,
  1623. length: 120,
  1624. width: 120,
  1625. xOff: -4,
  1626. yOff: 0,
  1627. projectile: 2,
  1628. spdMult: .7,
  1629. speed: 700
  1630. }, {
  1631. id: 13,
  1632. type: 1,
  1633. age: 9,
  1634. pre: 12,
  1635. name: "repeater crossbow",
  1636. desc: "high firerate crossbow with reduced damage",
  1637. src: "crossbow_2",
  1638. req: ["wood", 10],
  1639. aboveHand: !0,
  1640. armS: .75,
  1641. length: 120,
  1642. width: 120,
  1643. xOff: -4,
  1644. yOff: 0,
  1645. projectile: 3,
  1646. spdMult: .7,
  1647. speed: 230
  1648. }, {
  1649. id: 14,
  1650. type: 1,
  1651. age: 6,
  1652. name: "mc grabby",
  1653. desc: "steals resources from enemies",
  1654. src: "grab_1",
  1655. length: 130,
  1656. width: 210,
  1657. xOff: -8,
  1658. yOff: 53,
  1659. dmg: 0,
  1660. steal: 250,
  1661. knock: .2,
  1662. spdMult: 1.05,
  1663. range: 125,
  1664. gather: 0,
  1665. speed: 700
  1666. }, {
  1667. id: 15,
  1668. type: 1,
  1669. age: 9,
  1670. pre: 12,
  1671. name: "musket",
  1672. desc: "slow firerate but high damage and range",
  1673. src: "musket_1",
  1674. req: ["stone", 10],
  1675. aboveHand: !0,
  1676. rec: .35,
  1677. armS: .6,
  1678. hndS: .3,
  1679. hndD: 1.6,
  1680. length: 205,
  1681. width: 205,
  1682. xOff: 25,
  1683. yOff: 0,
  1684. projectile: 5,
  1685. hideProjectile: !0,
  1686. spdMult: .6,
  1687. speed: 1500
  1688. }]);
  1689. /***/
  1690. }),
  1691. /***/
  1692. "./src/hooks.js":
  1693. /*!**********************!*\
  1694. !*** ./src/hooks.js ***!
  1695. \**********************/
  1696. /***/
  1697. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1698. __webpack_require__.r(__webpack_exports__);
  1699. /* harmony import */
  1700. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./constants.js */ "./src/constants.js");
  1701. /* harmony import */
  1702. var _utils_CowUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./utils/CowUtils.js */ "./src/utils/CowUtils.js");
  1703. // define codec
  1704. _utils_CowUtils_js__WEBPACK_IMPORTED_MODULE_1__["default"].createHook({
  1705. property: "extensionCodec",
  1706. setter: (instance) => {
  1707. if (typeof _constants_js__WEBPACK_IMPORTED_MODULE_0__.codec.encoder !== 'undefined') {
  1708. _constants_js__WEBPACK_IMPORTED_MODULE_0__.codec.decoder = instance
  1709. _constants_js__WEBPACK_IMPORTED_MODULE_0__.codec.isReady = true
  1710. return
  1711. }
  1712. _constants_js__WEBPACK_IMPORTED_MODULE_0__.codec.encoder = instance
  1713. }
  1714. })
  1715. // define websocket
  1716. WebSocket.prototype.send = new Proxy(window.WebSocket.prototype.send, {
  1717. apply(target, instance, args) {
  1718. if (!_constants_js__WEBPACK_IMPORTED_MODULE_0__.socket.isReady) {
  1719. _constants_js__WEBPACK_IMPORTED_MODULE_0__.socket.setWebSocket(instance)
  1720. }
  1721. return target.apply(instance, args)
  1722. }
  1723. })
  1724. /***/
  1725. }),
  1726. /***/
  1727. "./src/modules/Placement.js":
  1728. /*!**********************************!*\
  1729. !*** ./src/modules/Placement.js ***!
  1730. \**********************************/
  1731. /***/
  1732. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1733. __webpack_require__.r(__webpack_exports__);
  1734. /* harmony import */
  1735. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../constants.js */ "./src/constants.js");
  1736. class Placement {
  1737. constructor() {
  1738. this.delay = 0
  1739. this.lastPlaceTick = 0
  1740. }
  1741. setDelay(_delay) {
  1742. this.delay = _delay
  1743. }
  1744. sendPlace(id, angle) {
  1745. const timeSincePlace = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.ticker.ticks - this.lastPlaceTick
  1746. if (timeSincePlace < this.delay) return
  1747. const {
  1748. packets
  1749. } = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.designations
  1750. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.sendPacket(packets.SELECT_BUILD, id)
  1751. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.sendPacket(packets.ATTACK_STATE, 1, angle)
  1752. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.sendPacket(packets.ATTACK_STATE, 0, angle)
  1753. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.sendPacket(packets.SELECT_BUILD, _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.weapons[0], true)
  1754. this.lastPlaceTick = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.ticker.ticks
  1755. }
  1756. placeItem(groupIndex, {
  1757. angle
  1758. } = {}) {
  1759. if (!_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player?.alive) return
  1760. const itemIndex = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.items[groupIndex]
  1761. if (typeof itemIndex === 'undefined') return
  1762. const item = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.items.list[itemIndex]
  1763. if (!_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.isCanBuild(item)) return
  1764. angle = typeof angle === 'undefined' ? _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.lookAngle : angle
  1765. const scale = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.scale + item.scale + (item.placeOffset || 0)
  1766. const placeX = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.x2 + (scale * Math.cos(angle))
  1767. const placeY = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.y2 + (scale * Math.sin(angle))
  1768. const isCanPlace = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.objectsManager.checkItemLocation(placeX, placeY, item.scale, 0.6, item.id, false)
  1769. if (!(item.consume && (_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.skin && _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.skin?.noEat)) && (item.consume || isCanPlace)) {
  1770. this.sendPlace(item.id, angle)
  1771. }
  1772. }
  1773. }
  1774. /* harmony default export */
  1775. __webpack_exports__["default"] = (Placement);
  1776. /***/
  1777. }),
  1778. /***/
  1779. "./src/modules/Ticker.js":
  1780. /*!*******************************!*\
  1781. !*** ./src/modules/Ticker.js ***!
  1782. \*******************************/
  1783. /***/
  1784. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1785. __webpack_require__.r(__webpack_exports__);
  1786. class Ticker {
  1787. constructor() {
  1788. this.ticks = 0
  1789. this.tickTasks = []
  1790. this.isClear = false
  1791. }
  1792. clear() {
  1793. this.tickTasks = []
  1794. this.isClear = true
  1795. }
  1796. addTickTask(callback) {
  1797. if (!(callback instanceof Function)) return
  1798. this.tasks.push(callback)
  1799. }
  1800. updateTicks() {
  1801. this.ticks += 1
  1802. if (this.isClear) {
  1803. this.isClear = false
  1804. return
  1805. }
  1806. if (this.tickTasks.length) {
  1807. this.tickTasks[0]()
  1808. this.tickTasks.shift()
  1809. }
  1810. }
  1811. }
  1812. /* harmony default export */
  1813. __webpack_exports__["default"] = (Ticker);
  1814. /***/
  1815. }),
  1816. /***/
  1817. "./src/modules/entities/Animal.js":
  1818. /*!****************************************!*\
  1819. !*** ./src/modules/entities/Animal.js ***!
  1820. \****************************************/
  1821. /***/
  1822. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1823. __webpack_require__.r(__webpack_exports__);
  1824. /* harmony import */
  1825. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  1826. /* harmony import */
  1827. var _Entity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./Entity.js */ "./src/modules/entities/Entity.js");
  1828. class Animal extends _Entity_js__WEBPACK_IMPORTED_MODULE_1__["default"] {
  1829. constructor({
  1830. sid,
  1831. index,
  1832. x,
  1833. y,
  1834. dir
  1835. }) {
  1836. super({
  1837. sid
  1838. })
  1839. const {
  1840. CowUtils
  1841. } = window
  1842. const data = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.items.aiTypes[index]
  1843. if (!data) data = {}
  1844. this.sid = sid
  1845. this.x = x
  1846. this.y = y
  1847. this.name = data.name || data.src
  1848. this.startX = data?.fixedSpawn ? x : null
  1849. this.startY = data?.fixedSpawn ? y : null
  1850. this.xVel = 0
  1851. this.yVel = 0
  1852. this.zIndex = 0
  1853. this.dir = CowUtils.fixAngle(dir)
  1854. this.dirPlus = 0
  1855. this.index = index
  1856. this.src = data.src
  1857. this.weightM = data.weightM
  1858. this.speed = data.speed
  1859. this.killScore = data.killScore
  1860. this.turnSpeed = data.turnSpeed
  1861. this.scale = data.scale
  1862. this.maxHealth = data.health
  1863. this.leapForce = data.leapForce
  1864. this.health = this.maxHealth
  1865. this.chargePlayer = data.chargePlayer
  1866. this.viewRange = data.viewRange
  1867. this.drop = data.drop
  1868. this.dmg = data.dmg
  1869. this.hostile = data.hostile
  1870. this.dontRun = data.dontRun
  1871. this.hitRange = data.hitRange
  1872. this.hitDelay = data.hitDelay
  1873. this.hitScare = data.hitScare
  1874. this.spriteMlt = data.spriteMlt
  1875. this.nameScale = data.nameScale
  1876. this.colDmg = data.colDmg
  1877. this.noTrap = data.noTrap
  1878. this.spawnDelay = data.spawnDelay
  1879. this.hitWait = 0
  1880. this.waitCount = 1000
  1881. this.moveCount = 0
  1882. this.targetDir = 0
  1883. this.runFrom = null
  1884. this.chargeTarget = null
  1885. this.dmgOverTime = {}
  1886. this.visible = true
  1887. }
  1888. disable() {
  1889. this.visible = false
  1890. }
  1891. setTickData(data) {
  1892. const time = Date.now()
  1893. this.index = data[1]
  1894. this.time1 = (this.time2 === undefined) ? time : this.time2
  1895. this.time2 = time
  1896. this.x1 = this.x
  1897. this.y1 = this.y
  1898. this.x2 = data[2]
  1899. this.y2 = data[3]
  1900. this.dir1 = (this.dir2 === undefined) ? data[4] : this.dir2
  1901. this.dir2 = data[4]
  1902. this.dir = this.dir2
  1903. this.health = data[5]
  1904. this.dt = 0
  1905. this.visible = true
  1906. }
  1907. }
  1908. /* harmony default export */
  1909. __webpack_exports__["default"] = (Animal);
  1910. /***/
  1911. }),
  1912. /***/
  1913. "./src/modules/entities/Entity.js":
  1914. /*!****************************************!*\
  1915. !*** ./src/modules/entities/Entity.js ***!
  1916. \****************************************/
  1917. /***/
  1918. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1919. __webpack_require__.r(__webpack_exports__);
  1920. /* harmony import */
  1921. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  1922. class Entity {
  1923. constructor({
  1924. id,
  1925. sid
  1926. }) {
  1927. this.id = id
  1928. this.sid = sid
  1929. this.name = "unknown"
  1930. this.dt = 0
  1931. this.x = 0
  1932. this.y = 0
  1933. this.x1 = this.x
  1934. this.y1 = this.y
  1935. this.x2 = this.x1
  1936. this.y2 = this.y1
  1937. this.dir = 0
  1938. this.dir1 = 0
  1939. this.dir2 = this.dir1
  1940. this.health = 100
  1941. this.maxHealth = this.health
  1942. this.scale = 35
  1943. this.zIndex = 0
  1944. }
  1945. get renderX() {
  1946. return this.x - _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.camera.xOffset
  1947. }
  1948. get renderY() {
  1949. return this.y - _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.camera.yOffset
  1950. }
  1951. setInitData(data) {
  1952. if (!Array.isArray(data) || !data?.length) return
  1953. this.id = data[0]
  1954. this.sid = data[1]
  1955. this.name = data[2]
  1956. this.x = data[3]
  1957. this.y = data[4]
  1958. this.dir = data[5]
  1959. this.health = data[6]
  1960. this.maxHealth = data[7]
  1961. this.scale = data[8]
  1962. if (typeof data[9] !== 'undefined') {
  1963. this.skinColor = data[9]
  1964. }
  1965. this.visible = false
  1966. }
  1967. setTo(x, y) {
  1968. if (typeof x !== 'number' || typeof y !== 'number') return
  1969. if (isNaN(x) || isNaN(y)) return
  1970. this.x = x
  1971. this.y = y
  1972. }
  1973. }
  1974. /* harmony default export */
  1975. __webpack_exports__["default"] = (Entity);
  1976. /***/
  1977. }),
  1978. /***/
  1979. "./src/modules/entities/GameObject.js":
  1980. /*!********************************************!*\
  1981. !*** ./src/modules/entities/GameObject.js ***!
  1982. \********************************************/
  1983. /***/
  1984. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1985. __webpack_require__.r(__webpack_exports__);
  1986. /* harmony import */
  1987. var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants */ "./src/constants.js");
  1988. class GameObject {
  1989. constructor({
  1990. sid
  1991. }) {
  1992. const {
  1993. CowUtils
  1994. } = window
  1995. this.sid = sid
  1996. this.init = function(x, y, dir, scale, type, data, owner) {
  1997. data = typeof data === 'undefined' ? {} : data
  1998. this.x = x
  1999. this.y = y
  2000. this.dir = CowUtils.fixAngle(dir)
  2001. this.xWiggle = 0
  2002. this.yWiggle = 0
  2003. this.scale = scale
  2004. this.type = type
  2005. this.id = data.id
  2006. this.owner = owner
  2007. this.name = data.name
  2008. this.isItem = Boolean(this.id !== undefined)
  2009. this.group = data.group
  2010. this.health = data.health
  2011. this.maxHealth = data.health
  2012. this.layer = this.group !== undefined ? this.group.layer : this.type === 0 ? 3 : this.type === 2 ? 0 : this.type === 4 ? -1 : 2
  2013. this.sentTo = {}
  2014. this.gridLocations = []
  2015. this.doUpdate = data.doUpdate
  2016. this.colDiv = data.colDiv || 1
  2017. this.blocker = data.blocker
  2018. this.ignoreCollision = data.ignoreCollision
  2019. this.dontGather = data.dontGather
  2020. this.hideFromEnemy = data.hideFromEnemy
  2021. this.friction = data.friction
  2022. this.projDmg = data.projDmg
  2023. this.dmg = data.dmg
  2024. this.pDmg = data.pDmg
  2025. this.pps = data.pps
  2026. this.zIndex = data.zIndex || 0
  2027. this.turnSpeed = data.turnSpeed
  2028. this.req = data.req
  2029. this.trap = data.trap
  2030. this.healCol = data.healCol
  2031. this.teleport = data.teleport
  2032. this.boostSpeed = data.boostSpeed
  2033. this.projectile = data.projectile
  2034. this.shootRange = data.shootRange
  2035. this.shootRate = data.shootRate
  2036. this.shootCount = this.shootRate
  2037. this.spawnPoint = data.spawnPoint
  2038. this.visible = true
  2039. this.active = true
  2040. }
  2041. }
  2042. get renderX() {
  2043. return this.x + Number(this.xWiggle) - _constants__WEBPACK_IMPORTED_MODULE_0__.cow.camera.xOffset
  2044. }
  2045. get renderY() {
  2046. return this.y + Number(this.yWiggle) - _constants__WEBPACK_IMPORTED_MODULE_0__.cow.camera.yOffset
  2047. }
  2048. setVisible(_visible) {
  2049. if (typeof _visible !== 'boolean') return
  2050. this.visible = _visible
  2051. }
  2052. setActive(_active) {
  2053. if (typeof _active !== 'boolean') return
  2054. this.active = _active
  2055. }
  2056. getScale(scaleMult, hasColDiv) {
  2057. scaleMult = scaleMult || 1
  2058. const isVolume = this.isItem || this.type == 2 || this.type == 3 || this.type == 4
  2059. return this.scale * (isVolume ? 1 : (0.6 * scaleMult)) * (hasColDiv ? 1 : this.colDiv)
  2060. }
  2061. changeHealth(amount) {
  2062. amount = parseInt(amount)
  2063. this.health += amount
  2064. return this.health <= 0
  2065. }
  2066. doWiggle(dir) {
  2067. this.xWiggle += _constants__WEBPACK_IMPORTED_MODULE_0__.cow.config.gatherWiggle * Math.cos(dir)
  2068. this.yWiggle += _constants__WEBPACK_IMPORTED_MODULE_0__.cow.config.gatherWiggle * Math.sin(dir)
  2069. }
  2070. update() {
  2071. if (!this.visible) return
  2072. const {
  2073. renderer
  2074. } = _constants__WEBPACK_IMPORTED_MODULE_0__.cow
  2075. if (this.xWiggle) {
  2076. this.xWiggle *= Math.pow(0.99, renderer.delta)
  2077. }
  2078. if (this.yWiggle) {
  2079. this.yWiggle *= Math.pow(0.99, renderer.delta)
  2080. }
  2081. if (this.turnSpeed) {
  2082. this.dir += this.turnSpeed * renderer.delta
  2083. }
  2084. }
  2085. }
  2086. /* harmony default export */
  2087. __webpack_exports__["default"] = (GameObject);
  2088. /***/
  2089. }),
  2090. /***/
  2091. "./src/modules/entities/Player.js":
  2092. /*!****************************************!*\
  2093. !*** ./src/modules/entities/Player.js ***!
  2094. \****************************************/
  2095. /***/
  2096. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2097. __webpack_require__.r(__webpack_exports__);
  2098. /* harmony import */
  2099. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  2100. /* harmony import */
  2101. var _Entity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./Entity.js */ "./src/modules/entities/Entity.js");
  2102. /* harmony import */
  2103. var _reloads_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./reloads.js */ "./src/modules/entities/reloads.js");
  2104. class Player extends _Entity_js__WEBPACK_IMPORTED_MODULE_1__["default"] {
  2105. constructor({
  2106. id,
  2107. sid
  2108. }) {
  2109. super({
  2110. id,
  2111. sid
  2112. })
  2113. this.skinColor = void 0
  2114. this.buildIndex = -1
  2115. this.weaponIndex = 0
  2116. this.weaponVariant = 0
  2117. this.team = ""
  2118. this.skinIndex = 0
  2119. this.tailIndex = 0
  2120. this.isLeader = false
  2121. this.iconIndex = 0
  2122. this.items = [0, 3, 6, 10]
  2123. this.weapons = [0]
  2124. this.skins = {}
  2125. this.tails = {}
  2126. const defineFreeCaps = (config, capType) => {
  2127. for (let i = 0; i < config.length; ++i) {
  2128. const cap = config[i]
  2129. if (cap.price > 0) continue
  2130. this[capType][cap.id] = true
  2131. }
  2132. }
  2133. defineFreeCaps(_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.items.hats, "skins")
  2134. defineFreeCaps(_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.items.accessories, "tails")
  2135. this.itemCounts = {}
  2136. this.gold = 100
  2137. this.stone = 100
  2138. this.wood = 100
  2139. this.food = 100
  2140. this.reloads = new _reloads_js__WEBPACK_IMPORTED_MODULE_2__["default"]()
  2141. this.maxXP = 300
  2142. this.XP = 0
  2143. this.age = 1
  2144. this.kills = 0
  2145. this.upgrAge = 2
  2146. this.upgradePoints = 0
  2147. this.hitTime = null
  2148. this.shameCount = 0
  2149. this.shameTimer = 0
  2150. this.speed = 0
  2151. this.moveDir = 0
  2152. this.isPlayer = true
  2153. this.lastDeath = {}
  2154. this.createdInstance = {}
  2155. this._updateCreatedInstance()
  2156. }
  2157. get isMe() {
  2158. return Boolean(this.sid === _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player?.sid && _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player?.alive)
  2159. }
  2160. get isAlly() {
  2161. return Boolean((this.sid === _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player?.sid) || (this.team && this.team === _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.team))
  2162. }
  2163. get weapon() {
  2164. return _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.items.weapons[this.weaponIndex]
  2165. }
  2166. get lookAngle() {
  2167. return this.isMe ? _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.input.mouse.angle : (this.dir || this.dir2)
  2168. }
  2169. get skin() {
  2170. return _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.items.hats.searchById(this.skinIndex)
  2171. }
  2172. get tail() {
  2173. return _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.items.accessories.searchById(this.tailIndex)
  2174. }
  2175. _updateCreatedInstance() {
  2176. this.createdInstance = {}
  2177. const ignoreKeys = ["skins", "tails", "sid", "id", "lastDeath", "reloads"]
  2178. for (const key in this) {
  2179. if (key === "createdInstance") continue
  2180. if (ignoreKeys.includes(key)) continue
  2181. this.createdInstance[key] = this[key]
  2182. }
  2183. }
  2184. spawn() {
  2185. this.alive = true
  2186. if (!this.isMe) return
  2187. for (const key in this.createdInstance) {
  2188. const value = this.createdInstance[key]
  2189. this[key] = value
  2190. }
  2191. this._updateCreatedInstance()
  2192. this.reloads = new _reloads_js__WEBPACK_IMPORTED_MODULE_2__["default"]()
  2193. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.setInGame(true)
  2194. }
  2195. kill() {
  2196. if (!this.isMe) return
  2197. this.alive = false
  2198. this.lastDeath = {
  2199. x: this.x,
  2200. y: this.y
  2201. }
  2202. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.setInGame(false)
  2203. }
  2204. disable() {
  2205. this.visible = false
  2206. }
  2207. hasResources(item) {
  2208. for (let i = 0; i < item.req.length; i += 2) {
  2209. if (this[item.req[i]] >= Math.round(item.req[i + 1])) continue
  2210. return false
  2211. }
  2212. return true
  2213. }
  2214. isCanBuild(item) {
  2215. return this.hasResources(item)
  2216. }
  2217. setTickData(data) {
  2218. if (!Array.isArray(data) || !data?.length) return
  2219. const {
  2220. CowUtils
  2221. } = window
  2222. this.dt = 0
  2223. this.x1 = this.x
  2224. this.y1 = this.y
  2225. this.speed = CowUtils.getDistance(this.x2, this.y2, data[1], data[2])
  2226. this.x2 = data[1]
  2227. this.y2 = data[2]
  2228. this.moveDir = CowUtils.getDirection(this.x1, this.y1, this.x2, this.y2)
  2229. this.dir1 = this.dir2 !== null ? this.dir2 : data[3]
  2230. this.dir2 = data[3]
  2231. this.time1 = this.time2 !== null ? this.time2 : Date.now()
  2232. this.time2 = Date.now()
  2233. this.buildIndex = data[4]
  2234. this.weaponIndex = data[5]
  2235. this.weaponVariant = data[6]
  2236. this.team = data[7]
  2237. this.isLeader = data[8]
  2238. this.skinIndex = data[9]
  2239. this.tailIndex = data[10]
  2240. this.iconIndex = data[11]
  2241. this.zIndex = data[12]
  2242. this.visible = true
  2243. this.tick()
  2244. }
  2245. updateShame() {
  2246. const timeSinceHit = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.ticker.ticks - this.hitTime
  2247. if (timeSinceHit < 2) {
  2248. this.shameCount += 1
  2249. if (this.shameCount >= 8) {
  2250. this.shameTimer = 30000
  2251. this.shameCount = 0
  2252. }
  2253. } else {
  2254. this.shameCount = Math.max(0, this.shameCount - 2)
  2255. }
  2256. }
  2257. changeHealth(_health) {
  2258. if (this.health > _health) {
  2259. this.updateShame()
  2260. this.hitTime = 0
  2261. } else {
  2262. this.hitTime = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.ticker.ticks
  2263. }
  2264. this.health = _health
  2265. }
  2266. onGather(didHit, weaponIndex) {
  2267. const reloadType = weaponIndex > 8 ? "secondary" : "primary"
  2268. const currentReload = this.reloads[reloadType]
  2269. currentReload.count = 0
  2270. currentReload.date = Date.now()
  2271. if (didHit) {
  2272. const {
  2273. CowUtils
  2274. } = window
  2275. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.objectsManager.eachVisible((gameObject) => {
  2276. if (!gameObject.isItem || gameObject.dontGather) return
  2277. const scale = gameObject.scale || gameObject.getScale()
  2278. const distance = CowUtils.getDistance(this, gameObject) - scale
  2279. const angle = CowUtils.getDirection(gameObject, this)
  2280. const angleDistance = CowUtils.getAngleDist(angle, this.dir2)
  2281. const isInAngle = angleDistance <= _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.gatherAngle
  2282. const isInRange = distance <= this.weapon.range
  2283. if (!isInAngle || !isInRange) return
  2284. const damage = this.weapon.dmg * _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.items.variants[this.weaponVariant].val
  2285. const damageAmount = damage * (this.weapon.sDmg || 1) * (this.skin?.id === 40 ? 3.3 : 1)
  2286. gameObject.changeHealth(-damageAmount)
  2287. })
  2288. }
  2289. }
  2290. updateReloads() {
  2291. const reloadType = this.weaponIndex > 8 ? "secondary" : "primary"
  2292. const currentReload = this.reloads[reloadType]
  2293. if (currentReload.id != this.weapon.id) {
  2294. currentReload.setData(this.weapon, this.weaponVariant)
  2295. }
  2296. if (this.weaponVariant != currentReload.rarity) {
  2297. currentReload.rarity = this.weaponVariant
  2298. }
  2299. if (this.weaponIndex === currentReload.id) {
  2300. if (currentReload.count < currentReload.max && this.buildIndex === -1) {
  2301. currentReload.add()
  2302. }
  2303. }
  2304. this.reloads[reloadType] = currentReload
  2305. if (this.reloads.turret.count < this.reloads.turret.max) {
  2306. this.reloads.turret.add()
  2307. }
  2308. }
  2309. tick() {
  2310. this.updateReloads()
  2311. if (this.skinIndex != 45) {
  2312. if (this.shameCount === 8) {
  2313. this.shameTimer = 0
  2314. this.shameCont = 0
  2315. }
  2316. if (this.shameTimer > 0) this.shameTimer = 0
  2317. } else {
  2318. if (this.shameCount != 8) {
  2319. this.shameCount = 8
  2320. this.shameTimer = 270
  2321. }
  2322. if (this.shameTimer > 0) this.shameTimer -= 1
  2323. }
  2324. }
  2325. canSee(other) {
  2326. if (!other) return false
  2327. const dx = Math.abs(other.x - this.x) - other.scale
  2328. const dy = Math.abs(other.y - this.y) - other.scale
  2329. return dx <= (_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.maxScreenWidth / 2) * 1.3 && dy <= (_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.maxScreenHeight / 2) * 1.3
  2330. }
  2331. }
  2332. /* harmony default export */
  2333. __webpack_exports__["default"] = (Player);
  2334. /***/
  2335. }),
  2336. /***/
  2337. "./src/modules/entities/reloads.js":
  2338. /*!*****************************************!*\
  2339. !*** ./src/modules/entities/reloads.js ***!
  2340. \*****************************************/
  2341. /***/
  2342. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2343. __webpack_require__.r(__webpack_exports__);
  2344. class Reload {
  2345. constructor(id, speed, ticks) {
  2346. const tick = 111
  2347. ticks = ticks || Math.ceil(speed / tick)
  2348. this.id = id
  2349. this.count = ticks
  2350. this.date = 0
  2351. this.date2 = this.date
  2352. this.max = ticks
  2353. this.max2 = speed
  2354. this.rarity = 0
  2355. this.done = true
  2356. this.active = false
  2357. const {
  2358. CowUtils
  2359. } = window
  2360. this._default = CowUtils.removeProto(this)
  2361. }
  2362. get dif() {
  2363. return this.count / this.max
  2364. }
  2365. get smoothValue() {
  2366. if (this.done) return 1
  2367. return (this.date2 - this.date) / this.max2
  2368. }
  2369. setData(weapon, weaponVariant) {
  2370. this.id = weapon.id
  2371. this.max = weapon.speed ? Math.ceil(weapon.speed / (1e3 / 9)) : 0
  2372. this.max2 = weapon.speed
  2373. this.count = parseInt(this.max)
  2374. this.done = true
  2375. this.rarity = weaponVariant
  2376. this.active = true
  2377. }
  2378. add() {
  2379. this.count += 1
  2380. this.count = parseInt(this.count)
  2381. this.done = this.count === this.max
  2382. }
  2383. clear() {
  2384. this.count = 0
  2385. this.done = false
  2386. this.date = Date.now()
  2387. }
  2388. }
  2389. class Reloads {
  2390. constructor() {
  2391. this.primary = new Reload(5, 300),
  2392. this.secondary = new Reload(15, 1500),
  2393. this.turret = new Reload(null, 2500, 23)
  2394. }
  2395. }
  2396. /* harmony default export */
  2397. __webpack_exports__["default"] = (Reloads);
  2398. /***/
  2399. }),
  2400. /***/
  2401. "./src/modules/input/Input.js":
  2402. /*!************************************!*\
  2403. !*** ./src/modules/input/Input.js ***!
  2404. \************************************/
  2405. /***/
  2406. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2407. __webpack_require__.r(__webpack_exports__);
  2408. /* harmony import */
  2409. var _Keyboard_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Keyboard.js */ "./src/modules/input/Keyboard.js");
  2410. /* harmony import */
  2411. var _Mouse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./Mouse.js */ "./src/modules/input/Mouse.js");
  2412. class Input {
  2413. constructor() {
  2414. this.keyboard = new _Keyboard_js__WEBPACK_IMPORTED_MODULE_0__["default"]()
  2415. this.mouse = new _Mouse_js__WEBPACK_IMPORTED_MODULE_1__["default"]()
  2416. }
  2417. }
  2418. /* harmony default export */
  2419. __webpack_exports__["default"] = (Input);
  2420. /***/
  2421. }),
  2422. /***/
  2423. "./src/modules/input/Keyboard.js":
  2424. /*!***************************************!*\
  2425. !*** ./src/modules/input/Keyboard.js ***!
  2426. \***************************************/
  2427. /***/
  2428. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2429. __webpack_require__.r(__webpack_exports__);
  2430. class Keyboard {
  2431. constructor() {
  2432. this.activeKeys = new Map()
  2433. this.events = new Map()
  2434. this.init()
  2435. }
  2436. on(keyName, listener, options = {
  2437. repeat: true
  2438. }) {
  2439. if (typeof keyName !== 'string') return
  2440. if (!(listener instanceof Function)) return
  2441. if (!this.events.has(keyName)) {
  2442. this.events.set(keyName, new Map())
  2443. }
  2444. const listeners = this.events.get(keyName)
  2445. const id = parseInt(Date.now() / 1000 + (Math.random() * 100e3))
  2446. const value = {
  2447. listener,
  2448. options
  2449. }
  2450. listeners.set(id, value)
  2451. return {
  2452. rebind: (newKeyName) => {
  2453. const listener = this.events.get(keyName).get(id)
  2454. if (this.events.get(keyName).has(id)) {
  2455. this.events.get(keyName).delete(id)
  2456. }
  2457. return this.on(newKeyName, listener.listener, listener.options)
  2458. }
  2459. }
  2460. }
  2461. trigger(code, doRepeat) {
  2462. this.events.forEach((eventsChunk, keyName) => {
  2463. if (!eventsChunk.size || keyName !== code) return
  2464. eventsChunk.forEach((event) => {
  2465. if (!event?.options?.repeat && doRepeat) return
  2466. event.listener()
  2467. })
  2468. })
  2469. }
  2470. onKeydown(event) {
  2471. if (!this.activeKeys.get(event.code)) {
  2472. this.activeKeys.set(event.code, true)
  2473. this.trigger(event.code)
  2474. }
  2475. }
  2476. onKeyup(event) {
  2477. if (this.activeKeys.get(event.code)) {
  2478. this.activeKeys.set(event.code, false)
  2479. }
  2480. }
  2481. update() {
  2482. this.activeKeys.forEach((state, keyName) => {
  2483. if (!state) return
  2484. this.trigger(keyName, true)
  2485. })
  2486. }
  2487. init() {
  2488. window.addEventListener("keydown", this.onKeydown.bind(this))
  2489. window.addEventListener("keyup", this.onKeyup.bind(this))
  2490. }
  2491. }
  2492. /* harmony default export */
  2493. __webpack_exports__["default"] = (Keyboard);
  2494. /***/
  2495. }),
  2496. /***/
  2497. "./src/modules/input/Mouse.js":
  2498. /*!************************************!*\
  2499. !*** ./src/modules/input/Mouse.js ***!
  2500. \************************************/
  2501. /***/
  2502. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2503. __webpack_require__.r(__webpack_exports__);
  2504. /* harmony import */
  2505. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  2506. class Mouse {
  2507. constructor() {
  2508. this.x = void 0
  2509. this.y = void 0
  2510. this.isDown = false
  2511. this.isUp = !this.isDown
  2512. this.lastClick = null
  2513. this.lastMove = null
  2514. window.addEventListener("load", this.init.bind(this))
  2515. }
  2516. get angle() {
  2517. const canvas = document.getElementById("gameCanvas") || _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.renderer.canvas
  2518. if (!canvas) return
  2519. const width = canvas.clientWidth / 2
  2520. const height = canvas.clientHeight / 2
  2521. return Math.atan2(this.y - height, this.x - width)
  2522. }
  2523. setTo(x, y) {
  2524. if (typeof x !== 'number' || typeof y !== 'number') return
  2525. this.x = x
  2526. this.y = y
  2527. this.lastMove = Date.now()
  2528. }
  2529. setState(_isDown) {
  2530. this.isDown = _isDown
  2531. this.isUp = !_isDown
  2532. this.lastClick = Date.now()
  2533. }
  2534. onMousemove(event) {
  2535. this.setTo(event.clientX, event.clientY)
  2536. }
  2537. onMousedown() {
  2538. this.setState(true)
  2539. }
  2540. onMouseup() {
  2541. this.setState(false)
  2542. }
  2543. init() {
  2544. const touchControls = document.getElementById("touch-controls-fullscreen")
  2545. touchControls.addEventListener("mousemove", this.onMousemove.bind(this))
  2546. touchControls.addEventListener("mousedown", this.onMousedown.bind(this))
  2547. touchControls.addEventListener("mouseup", this.onMouseup.bind(this))
  2548. }
  2549. }
  2550. /* harmony default export */
  2551. __webpack_exports__["default"] = (Mouse);
  2552. /***/
  2553. }),
  2554. /***/
  2555. "./src/modules/managers/AnimalsManager.js":
  2556. /*!************************************************!*\
  2557. !*** ./src/modules/managers/AnimalsManager.js ***!
  2558. \************************************************/
  2559. /***/
  2560. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2561. __webpack_require__.r(__webpack_exports__);
  2562. /* harmony import */
  2563. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  2564. /* harmony import */
  2565. var _entities_Animal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../entities/Animal.js */ "./src/modules/entities/Animal.js");
  2566. /* harmony import */
  2567. var _entities_Player_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../entities/Player.js */ "./src/modules/entities/Player.js");
  2568. class AnimalsManager {
  2569. constructor() {
  2570. this.animals = new Map()
  2571. this.animalsInStream = 0
  2572. }
  2573. get list() {
  2574. return [...this.animals.values()]
  2575. }
  2576. getById(sid) {
  2577. return this.animals.get(sid)
  2578. }
  2579. each(callback) {
  2580. this.animals.forEach(callback)
  2581. }
  2582. eachVisible(callback) {
  2583. this.each((animal) => {
  2584. if (!animal.visible) return
  2585. callback(animal)
  2586. })
  2587. }
  2588. updateAnimals(content) {
  2589. const chunkSize = 7
  2590. this.animalsInStream = 0
  2591. this.each((animal) => {
  2592. animal.disable()
  2593. })
  2594. for (let i = 0; i < content.length; i += chunkSize) {
  2595. const chunk = content.slice(i, i + chunkSize)
  2596. this.animalsInStream += 1
  2597. if (!this.animals.has(chunk[0])) {
  2598. const animal = new _entities_Animal_js__WEBPACK_IMPORTED_MODULE_1__["default"]({
  2599. sid: chunk[0],
  2600. index: chunk[1],
  2601. x: chunk[2],
  2602. y: chunk[3],
  2603. dir: chunk[4]
  2604. })
  2605. this.animals.set(chunk[0], animal)
  2606. continue
  2607. }
  2608. const animal = this.animals.get(chunk[0])
  2609. animal.setTickData(chunk)
  2610. }
  2611. }
  2612. interpolate() {
  2613. const {
  2614. renderer
  2615. } = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow
  2616. const lastTime = renderer.nowUpdate - (1000 / (window.config.serverUpdateRate || 10))
  2617. this.eachVisible((animal) => {
  2618. animal.dt += renderer.delta
  2619. const rate = 170
  2620. const tmpRate = Math.min(1.7, animal.dt / rate)
  2621. const xDif = animal.x2 - animal.x1
  2622. const yDif = animal.y2 - animal.y1
  2623. animal.setTo(
  2624. animal.x1 + (xDif * tmpRate),
  2625. animal.y1 + (yDif * tmpRate)
  2626. )
  2627. })
  2628. }
  2629. update() {
  2630. this.interpolate()
  2631. }
  2632. }
  2633. /* harmony default export */
  2634. __webpack_exports__["default"] = (AnimalsManager);
  2635. /***/
  2636. }),
  2637. /***/
  2638. "./src/modules/managers/ObjectsManager.js":
  2639. /*!************************************************!*\
  2640. !*** ./src/modules/managers/ObjectsManager.js ***!
  2641. \************************************************/
  2642. /***/
  2643. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2644. __webpack_require__.r(__webpack_exports__);
  2645. /* harmony import */
  2646. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  2647. /* harmony import */
  2648. var _entities_GameObject_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../entities/GameObject.js */ "./src/modules/entities/GameObject.js");
  2649. class ObjectsManager {
  2650. constructor() {
  2651. this.objects = new Map()
  2652. this.objectsInStream = 0
  2653. }
  2654. get list() {
  2655. return [...this.objects.values()]
  2656. }
  2657. getById(sid) {
  2658. return this.objects.get(sid)
  2659. }
  2660. each(callback) {
  2661. this.objects.forEach(callback)
  2662. }
  2663. eachVisible(callback) {
  2664. const visibleObjects = this.list.filter((object) => object.active && object.visible)
  2665. for (let i = 0; i < visibleObjects.length; i++) {
  2666. const gameObject = visibleObjects[i]
  2667. if (!gameObject.visible || !gameObject.active) return
  2668. callback(gameObject)
  2669. }
  2670. }
  2671. disableAllObjects(sid) {
  2672. this.each((gameObject) => {
  2673. if (!gameObject.owner || gameObject.owner.sid !== sid) return
  2674. this.objects.delete(gameObject.sid)
  2675. })
  2676. }
  2677. add(sid, x, y, dir, scale, type, data, setSID, owner) {
  2678. let tmpObject = this.getById(sid)
  2679. if (!tmpObject) {
  2680. tmpObject = new _entities_GameObject_js__WEBPACK_IMPORTED_MODULE_1__["default"]({
  2681. sid
  2682. })
  2683. this.objects.set(sid, tmpObject)
  2684. }
  2685. if (setSID) tmpObject.sid = sid
  2686. tmpObject.init(x, y, dir, scale, type, data, setSID, owner)
  2687. }
  2688. checkItemLocation(x, y, scale, scaleMult, indx, ignoreWater) {
  2689. const {
  2690. CowUtils
  2691. } = window
  2692. const position = {
  2693. x,
  2694. y
  2695. }
  2696. let isCanPlace = true
  2697. this.eachVisible((gameObject) => {
  2698. if (!isCanPlace) return
  2699. const blockScale = (gameObject.blocker ? gameObject.blocker : gameObject.getScale(scaleMult, gameObject.isItem))
  2700. if (CowUtils.getDistance(position, gameObject) < (scale + blockScale)) {
  2701. isCanPlace = false
  2702. }
  2703. })
  2704. if (
  2705. !ignoreWater && indx != 18 &&
  2706. y >= (_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.mapScale / 2) - (_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.riverWidth / 2) &&
  2707. y <= (_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.mapScale / 2) + (_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.riverWidth / 2)
  2708. ) {
  2709. isCanPlace = false
  2710. }
  2711. return isCanPlace
  2712. }
  2713. update() {
  2714. this.objectsInStream = 0
  2715. this.each((gameObject) => {
  2716. if (!_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.canSee(gameObject)) {
  2717. return gameObject.setVisible(false)
  2718. }
  2719. gameObject.setVisible(true)
  2720. this.objectsInStream += 1
  2721. // if (!gameObject.doUpdate) return
  2722. gameObject.update()
  2723. })
  2724. }
  2725. }
  2726. /* harmony default export */
  2727. __webpack_exports__["default"] = (ObjectsManager);
  2728. /***/
  2729. }),
  2730. /***/
  2731. "./src/modules/managers/PlayersManager.js":
  2732. /*!************************************************!*\
  2733. !*** ./src/modules/managers/PlayersManager.js ***!
  2734. \************************************************/
  2735. /***/
  2736. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2737. __webpack_require__.r(__webpack_exports__);
  2738. /* harmony import */
  2739. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  2740. /* harmony import */
  2741. var _entities_Player_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../entities/Player.js */ "./src/modules/entities/Player.js");
  2742. class PlayersManager {
  2743. constructor() {
  2744. this.players = new Map()
  2745. this.playersInStream = 0
  2746. }
  2747. get list() {
  2748. return [...this.players.values()]
  2749. }
  2750. getById(sid) {
  2751. return this.players.get(sid)
  2752. }
  2753. each(callback) {
  2754. this.players.forEach(callback)
  2755. }
  2756. eachVisible(callback) {
  2757. this.each((player) => {
  2758. if (!player.visible) return
  2759. callback(player)
  2760. })
  2761. }
  2762. addPlayer(content, isYou) {
  2763. if (!this.players.has(content[1])) {
  2764. this.players.set(content[1], new _entities_Player_js__WEBPACK_IMPORTED_MODULE_1__["default"]({
  2765. id: content[0],
  2766. sid: content[1]
  2767. }))
  2768. }
  2769. const player = this.players.get(content[1])
  2770. player.visible = false
  2771. player.x2 = void 0
  2772. player.y2 = void 0
  2773. player.spawn()
  2774. player.setInitData(content)
  2775. if (isYou) {
  2776. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.setPlayer(player)
  2777. }
  2778. }
  2779. removePlayer(sid) {
  2780. if (!this.players.has(sid)) return
  2781. this.players.delete(sid)
  2782. }
  2783. updatePlayers(content) {
  2784. const chunkSize = 13
  2785. this.playersInStream = 0
  2786. this.eachVisible((player) => {
  2787. player.disable()
  2788. })
  2789. for (let i = 0; i < content.length; i += chunkSize) {
  2790. const chunk = content.slice(i, i + chunkSize)
  2791. if (!this.players.has(chunk[0])) continue
  2792. const player = this.players.get(chunk[0])
  2793. player.setTickData(chunk)
  2794. this.playersInStream += 1
  2795. }
  2796. }
  2797. interpolate() {
  2798. const {
  2799. CowUtils
  2800. } = window
  2801. const {
  2802. renderer
  2803. } = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow
  2804. const lastTime = renderer.nowUpdate - (1000 / (window.config.serverUpdateRate || 10))
  2805. this.eachVisible((player) => {
  2806. player.dt += renderer.delta
  2807. const total = player.time2 - player.time1
  2808. const fraction = lastTime - player.time1
  2809. const ratio = total / fraction
  2810. const rate = 170
  2811. const tmpRate = Math.min(1.7, player.dt / rate)
  2812. const xDif = player.x2 - player.x1
  2813. const yDif = player.y2 - player.y1
  2814. player.setTo(
  2815. player.x1 + (xDif * tmpRate),
  2816. player.y1 + (yDif * tmpRate)
  2817. )
  2818. player.dir = CowUtils.lerpAngle(player.dir2, player.dir1, Math.min(1.2, ratio))
  2819. })
  2820. }
  2821. update() {
  2822. this.interpolate()
  2823. this.eachVisible((player) => {
  2824. const reloadType = player.weaponIndex > 8 ? "secondary" : "primary"
  2825. const currentReload = player.reloads[reloadType]
  2826. if (player.weaponIndex === currentReload.id) {
  2827. if (currentReload.count < currentReload.max && player.buildIndex === -1) {
  2828. currentReload.date2 = Date.now()
  2829. }
  2830. }
  2831. })
  2832. }
  2833. }
  2834. /* harmony default export */
  2835. __webpack_exports__["default"] = (PlayersManager);
  2836. /***/
  2837. }),
  2838. /***/
  2839. "./src/modules/plugins/AutoReconect.js":
  2840. /*!*********************************************!*\
  2841. !*** ./src/modules/plugins/AutoReconect.js ***!
  2842. \*********************************************/
  2843. /***/
  2844. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2845. __webpack_require__.r(__webpack_exports__);
  2846. /* harmony import */
  2847. var _Plugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Plugin.js */ "./src/modules/plugins/Plugin.js");
  2848. class AutoReconect extends _Plugin_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
  2849. constructor() {
  2850. super({
  2851. name: "auto-reconect",
  2852. description: "Automatically reloads the page after the connection is closed or the game could not be logged in",
  2853. once: true
  2854. })
  2855. }
  2856. execute() {
  2857. super.execute(() => {
  2858. location.reload()
  2859. })
  2860. }
  2861. }
  2862. /* harmony default export */
  2863. __webpack_exports__["default"] = (AutoReconect);
  2864. /***/
  2865. }),
  2866. /***/
  2867. "./src/modules/plugins/Plugin.js":
  2868. /*!***************************************!*\
  2869. !*** ./src/modules/plugins/Plugin.js ***!
  2870. \***************************************/
  2871. /***/
  2872. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2873. __webpack_require__.r(__webpack_exports__);
  2874. class Plugin {
  2875. constructor({
  2876. name,
  2877. description,
  2878. once,
  2879. isCanChangeActiveState = true
  2880. }) {
  2881. this.name = name
  2882. this.description = description
  2883. this.once = once
  2884. this._isCanChangeActiveState = isCanChangeActiveState
  2885. this.isActiveState = false
  2886. this.lastActive = null
  2887. }
  2888. setActiveState(state) {
  2889. if (!this._isCanChangeActiveState) return
  2890. this.isActiveState = state
  2891. }
  2892. execute(callback) {
  2893. if (this.once && this.lastActive) return
  2894. if (callback instanceof Function) {
  2895. callback()
  2896. }
  2897. this.lastActive = Date.now()
  2898. }
  2899. }
  2900. /* harmony default export */
  2901. __webpack_exports__["default"] = (Plugin);
  2902. /***/
  2903. }),
  2904. /***/
  2905. "./src/modules/plugins/index.js":
  2906. /*!**************************************!*\
  2907. !*** ./src/modules/plugins/index.js ***!
  2908. \**************************************/
  2909. /***/
  2910. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2911. __webpack_require__.r(__webpack_exports__);
  2912. /* harmony export */
  2913. __webpack_require__.d(__webpack_exports__, {
  2914. /* harmony export */
  2915. AutoReconect: function() {
  2916. return /* reexport safe */ _AutoReconect_js__WEBPACK_IMPORTED_MODULE_0__["default"];
  2917. }
  2918. /* harmony export */
  2919. });
  2920. /* harmony import */
  2921. var _AutoReconect_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AutoReconect.js */ "./src/modules/plugins/AutoReconect.js");
  2922. /***/
  2923. }),
  2924. /***/
  2925. "./src/modules/render/Camera.js":
  2926. /*!**************************************!*\
  2927. !*** ./src/modules/render/Camera.js ***!
  2928. \**************************************/
  2929. /***/
  2930. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2931. __webpack_require__.r(__webpack_exports__);
  2932. /* harmony import */
  2933. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  2934. class Camera {
  2935. constructor() {
  2936. this.x = 0
  2937. this.y = 0
  2938. this.distance = 0
  2939. this.angle = 0
  2940. this.speed = 0
  2941. this.xOffset = 0
  2942. this.yOffset = 0
  2943. }
  2944. setTo(x, y) {
  2945. this.x = x
  2946. this.y = y
  2947. }
  2948. update() {
  2949. if (_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player?.alive) {
  2950. const {
  2951. CowUtils
  2952. } = window
  2953. this.distance = CowUtils.getDistance(this, _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player)
  2954. this.angle = CowUtils.getDirection(_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player, this)
  2955. this.speed = Math.min(this.distance * .01 * _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.renderer.delta, this.distance)
  2956. if (this.distance > .05) {
  2957. this.x += this.speed * Math.cos(this.angle)
  2958. this.y += this.speed * Math.sin(this.angle)
  2959. } else {
  2960. this.setTo(
  2961. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.x,
  2962. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.y
  2963. )
  2964. }
  2965. } else {
  2966. this.setTo(
  2967. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.mapScale / 2,
  2968. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.mapScale / 2
  2969. )
  2970. }
  2971. this.xOffset = this.x - _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.maxScreenWidth / 2
  2972. this.yOffset = this.y - _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.maxScreenHeight / 2
  2973. }
  2974. }
  2975. /* harmony default export */
  2976. __webpack_exports__["default"] = (Camera);
  2977. /***/
  2978. }),
  2979. /***/
  2980. "./src/modules/render/Renderer.js":
  2981. /*!****************************************!*\
  2982. !*** ./src/modules/render/Renderer.js ***!
  2983. \****************************************/
  2984. /***/
  2985. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  2986. __webpack_require__.r(__webpack_exports__);
  2987. /* harmony import */
  2988. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  2989. class Renderer {
  2990. constructor() {
  2991. this.canvas = void 0
  2992. this.context = void 0
  2993. this.renders = new Map()
  2994. this.nowUpdate = void 0
  2995. this.lastUpdate = this.nowUpdate
  2996. this.delta = 0
  2997. window.addEventListener("load", this.init.bind(this))
  2998. }
  2999. addRender(renderKey, renderFunc) {
  3000. if (typeof renderKey !== 'string') return
  3001. if (!(renderFunc instanceof Function)) return
  3002. if (!this.renders.has(renderKey)) {
  3003. this.renders.set(renderKey, new Map())
  3004. }
  3005. const rendersChunk = this.renders.get(renderKey)
  3006. rendersChunk.set(rendersChunk.size + 1, renderFunc)
  3007. }
  3008. _updateAll() {
  3009. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.camera.update()
  3010. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.playersManager.update()
  3011. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.objectsManager.update()
  3012. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.animalsManager.update()
  3013. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.input.keyboard.update()
  3014. }
  3015. updateFrame() {
  3016. this.nowUpdate = Date.now()
  3017. this.delta = this.nowUpdate - this.lastUpdate
  3018. this.lastUpdate = this.nowUpdate
  3019. requestAnimationFrame(this.updateFrame.bind(this))
  3020. this._updateAll()
  3021. if (!_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player) return
  3022. this.renders.forEach((rendersChunk) => {
  3023. if (!rendersChunk.size) return
  3024. rendersChunk.forEach((render) => {
  3025. render()
  3026. })
  3027. })
  3028. }
  3029. init() {
  3030. this.canvas = document.getElementById("gameCanvas")
  3031. this.context = this.canvas.getContext("2d")
  3032. this.updateFrame()
  3033. }
  3034. }
  3035. /* harmony default export */
  3036. __webpack_exports__["default"] = (Renderer);
  3037. /***/
  3038. }),
  3039. /***/
  3040. "./src/modules/socket/Handler.js":
  3041. /*!***************************************!*\
  3042. !*** ./src/modules/socket/Handler.js ***!
  3043. \***************************************/
  3044. /***/
  3045. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3046. __webpack_require__.r(__webpack_exports__);
  3047. /* harmony import */
  3048. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  3049. /* harmony import */
  3050. var _events_getEvents_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./events/getEvents.js */ "./src/modules/socket/events/getEvents.js");
  3051. class Handler {
  3052. static handlerKeys = {
  3053. "socket-open": "onSocketOpen",
  3054. "socket-message": "onSocketMessage",
  3055. "socket-close": "onSocketClose"
  3056. }
  3057. constructor({
  3058. socket
  3059. }) {
  3060. this.socket = socket
  3061. this.packetsListeners = new Map()
  3062. this.firstMessage = false
  3063. }
  3064. onPacket(packetName, listener) {
  3065. if (typeof packetName !== 'string') return
  3066. if (!(listener instanceof Function)) return
  3067. if (!this.packetsListeners.has(packetName)) {
  3068. this.packetsListeners.set(packetName, new Map())
  3069. }
  3070. const listeners = this.packetsListeners.get(packetName)
  3071. listeners.set(listeners.size + 1, listener)
  3072. }
  3073. onSocketOpen() {}
  3074. onSocketMessage(event) {
  3075. if (!this.firstMessage) {
  3076. const events = (0, _events_getEvents_js__WEBPACK_IMPORTED_MODULE_1__["default"])()
  3077. for (const event in events) {
  3078. this.onPacket(event, events[event])
  3079. }
  3080. this.firstMessage = true
  3081. }
  3082. const {
  3083. data
  3084. } = event
  3085. if (!(data instanceof ArrayBuffer)) return
  3086. const binary = new Uint8Array(data)
  3087. const decoded = _constants_js__WEBPACK_IMPORTED_MODULE_0__.codec.decoder.decode(binary)
  3088. if (!decoded.length) return
  3089. const type = decoded[0]
  3090. const content = decoded[1]
  3091. this.packetsListeners.forEach((packetListeners, packetName) => {
  3092. if (!packetListeners.size) return
  3093. if (packetName !== type) return
  3094. packetListeners.forEach((packetListener) => {
  3095. packetListener(...content)
  3096. })
  3097. })
  3098. }
  3099. onSocketClose() {
  3100. const {
  3101. plugins
  3102. } = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.designations
  3103. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.executePlugin(plugins.AUTO_RECONECT)
  3104. }
  3105. handle(handlerKey, event) {
  3106. const listenerName = Handler.handlerKeys[handlerKey]
  3107. if (typeof listenerName === 'undefined') return
  3108. const listener = this[listenerName]
  3109. if (!(listener instanceof Function)) return
  3110. listener.call(this, event)
  3111. }
  3112. }
  3113. /* harmony default export */
  3114. __webpack_exports__["default"] = (Handler);
  3115. /***/
  3116. }),
  3117. /***/
  3118. "./src/modules/socket/Manager.js":
  3119. /*!***************************************!*\
  3120. !*** ./src/modules/socket/Manager.js ***!
  3121. \***************************************/
  3122. /***/
  3123. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3124. __webpack_require__.r(__webpack_exports__);
  3125. class Manager {
  3126. static triggerKeys = {
  3127. "set-websocket": "onWebSocketSetted"
  3128. }
  3129. constructor({
  3130. socket
  3131. }) {
  3132. this.socket = socket
  3133. }
  3134. onWebSocketSetted() {
  3135. const {
  3136. handler
  3137. } = this.socket
  3138. this.socket.onEvent("open", handler.handle.bind(handler, "socket-open"))
  3139. this.socket.onEvent("message", handler.handle.bind(handler, "socket-message"))
  3140. this.socket.onEvent("close", handler.handle.bind(handler, "socket-close"))
  3141. }
  3142. trigger(triggerKey, ...props) {
  3143. const listenerName = Manager.triggerKeys[triggerKey]
  3144. if (typeof listenerName === 'undefined') return
  3145. const listener = this[listenerName]
  3146. if (!(listener instanceof Function)) return
  3147. listener.call(this, ...props)
  3148. }
  3149. }
  3150. /* harmony default export */
  3151. __webpack_exports__["default"] = (Manager);
  3152. /***/
  3153. }),
  3154. /***/
  3155. "./src/modules/socket/Socket.js":
  3156. /*!**************************************!*\
  3157. !*** ./src/modules/socket/Socket.js ***!
  3158. \**************************************/
  3159. /***/
  3160. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3161. __webpack_require__.r(__webpack_exports__);
  3162. /* harmony import */
  3163. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../constants.js */ "./src/constants.js");
  3164. /* harmony import */
  3165. var _Handler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./Handler.js */ "./src/modules/socket/Handler.js");
  3166. /* harmony import */
  3167. var _Manager_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./Manager.js */ "./src/modules/socket/Manager.js");
  3168. class Socket {
  3169. constructor() {
  3170. this.websocket = void 0
  3171. this.socketId = void 0
  3172. this.handler = new _Handler_js__WEBPACK_IMPORTED_MODULE_1__["default"]({
  3173. socket: this
  3174. })
  3175. this.manager = new _Manager_js__WEBPACK_IMPORTED_MODULE_2__["default"]({
  3176. socket: this
  3177. })
  3178. }
  3179. get isCreated() {
  3180. return Boolean(typeof this.websocket !== 'undefined')
  3181. }
  3182. get isReady() {
  3183. return Boolean(this.websocket?.readyState === 1)
  3184. }
  3185. send(type, content) {
  3186. if (!this.isReady) return
  3187. const encoded = _constants_js__WEBPACK_IMPORTED_MODULE_0__.codec.encoder.encode([type, content])
  3188. this.websocket.send(encoded)
  3189. }
  3190. onEvent(eventKey, listener) {
  3191. if (!this.isCreated) return
  3192. if (eventKey.startsWith("on")) {
  3193. this.websocket[eventKey] = listener
  3194. return
  3195. }
  3196. this.websocket.addEventListener(eventKey, listener)
  3197. }
  3198. setSocketId(_socketId) {
  3199. if (typeof _socketId !== 'number') return
  3200. this.socketId = _socketId
  3201. }
  3202. setWebSocket(_websocket) {
  3203. if (!_constants_js__WEBPACK_IMPORTED_MODULE_0__.codec.isReady) return
  3204. if (this.websocket instanceof WebSocket) return
  3205. if (!(_websocket instanceof WebSocket)) return
  3206. if (!/moomoo/.test(_websocket.url)) return
  3207. this.websocket = _websocket
  3208. this.manager.trigger("set-websocket")
  3209. }
  3210. }
  3211. /* harmony default export */
  3212. __webpack_exports__["default"] = (Socket);
  3213. /***/
  3214. }),
  3215. /***/
  3216. "./src/modules/socket/events/animals/loadAI.js":
  3217. /*!*****************************************************!*\
  3218. !*** ./src/modules/socket/events/animals/loadAI.js ***!
  3219. \*****************************************************/
  3220. /***/
  3221. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3222. __webpack_require__.r(__webpack_exports__);
  3223. /* harmony import */
  3224. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3225.  
  3226. function loadAI(content) {
  3227. if (!content?.length) return
  3228. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.animalsManager.updateAnimals(content)
  3229. }
  3230. /* harmony default export */
  3231. __webpack_exports__["default"] = (loadAI);
  3232. /***/
  3233. }),
  3234. /***/
  3235. "./src/modules/socket/events/game_object/addProjectile.js":
  3236. /*!****************************************************************!*\
  3237. !*** ./src/modules/socket/events/game_object/addProjectile.js ***!
  3238. \****************************************************************/
  3239. /***/
  3240. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3241. __webpack_require__.r(__webpack_exports__);
  3242. /* harmony import */
  3243. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3244.  
  3245. function addProjectile(x, y, dir, range, speed, indx, layer, sid) {
  3246. const isTurret = Number(range == 700 && speed == 1.5)
  3247. const position = {
  3248. x,
  3249. y
  3250. }
  3251. const {
  3252. CowUtils
  3253. } = window
  3254. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.playersManager.eachVisible((player) => {
  3255. const distance = Math.round(CowUtils.getDistance(player, position)) - player.scale
  3256. const isSameDir = player.dir2 - dir < .6
  3257. const isProjectileInDistance = distance <= 135
  3258. const isOwnTurret = isTurret && player.reloads.turret.done && player.skinIndex === 53 && distance <= 10
  3259. const isOwnSecondary = !isTurret && player.reloads.secondary.done && player.weapon.projectile !== undefined && isSameDir && isProjectileInDistance
  3260. const reloadType = isTurret ? "turret" : "secondary"
  3261. if (!isOwnTurret && !isOwnSecondary) return
  3262. player.reloads[reloadType].clear()
  3263. })
  3264. }
  3265. /* harmony default export */
  3266. __webpack_exports__["default"] = (addProjectile);
  3267. /***/
  3268. }),
  3269. /***/
  3270. "./src/modules/socket/events/game_object/killObject.js":
  3271. /*!*************************************************************!*\
  3272. !*** ./src/modules/socket/events/game_object/killObject.js ***!
  3273. \*************************************************************/
  3274. /***/
  3275. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3276. __webpack_require__.r(__webpack_exports__);
  3277. /* harmony import */
  3278. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3279.  
  3280. function killObject(sid) {
  3281. const gameObject = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.objectsManager.getById(sid)
  3282. if (!gameObject) return
  3283. gameObject.setActive(false)
  3284. }
  3285. /* harmony default export */
  3286. __webpack_exports__["default"] = (killObject);
  3287. /***/
  3288. }),
  3289. /***/
  3290. "./src/modules/socket/events/game_object/killObjects.js":
  3291. /*!**************************************************************!*\
  3292. !*** ./src/modules/socket/events/game_object/killObjects.js ***!
  3293. \**************************************************************/
  3294. /***/
  3295. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3296. __webpack_require__.r(__webpack_exports__);
  3297. /* harmony import */
  3298. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3299.  
  3300. function killObjects(sid) {
  3301. if (!sid) return
  3302. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.objectsManager.disableAllObjects(sid)
  3303. }
  3304. /* harmony default export */
  3305. __webpack_exports__["default"] = (killObjects);
  3306. /***/
  3307. }),
  3308. /***/
  3309. "./src/modules/socket/events/game_object/loadGameObject.js":
  3310. /*!*****************************************************************!*\
  3311. !*** ./src/modules/socket/events/game_object/loadGameObject.js ***!
  3312. \*****************************************************************/
  3313. /***/
  3314. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3315. __webpack_require__.r(__webpack_exports__);
  3316. /* harmony import */
  3317. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3318.  
  3319. function loadGameObject(content) {
  3320. const chunkSize = 8
  3321. for (let i = 0; i < content.length; i += chunkSize) {
  3322. const chunk = content.slice(i, i + chunkSize)
  3323. chunk[6] = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.items.list[chunk[6]]
  3324. if (chunk[7] >= 0) {
  3325. chunk[7] = {
  3326. sid: chunk[7]
  3327. }
  3328. }
  3329. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.objectsManager.add(...chunk)
  3330. }
  3331. }
  3332. /* harmony default export */
  3333. __webpack_exports__["default"] = (loadGameObject);
  3334. /***/
  3335. }),
  3336. /***/
  3337. "./src/modules/socket/events/game_object/wiggleGameObject.js":
  3338. /*!*******************************************************************!*\
  3339. !*** ./src/modules/socket/events/game_object/wiggleGameObject.js ***!
  3340. \*******************************************************************/
  3341. /***/
  3342. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3343. __webpack_require__.r(__webpack_exports__);
  3344. /* harmony import */
  3345. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3346.  
  3347. function wiggleGameObject(dir, sid) {
  3348. const gameObject = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.objectsManager.getById(sid)
  3349. if (!gameObject) return
  3350. gameObject.doWiggle(dir)
  3351. }
  3352. /* harmony default export */
  3353. __webpack_exports__["default"] = (wiggleGameObject);
  3354. /***/
  3355. }),
  3356. /***/
  3357. "./src/modules/socket/events/getEvents.js":
  3358. /*!************************************************!*\
  3359. !*** ./src/modules/socket/events/getEvents.js ***!
  3360. \************************************************/
  3361. /***/
  3362. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3363. __webpack_require__.r(__webpack_exports__);
  3364. /* harmony import */
  3365. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../constants.js */ "./src/constants.js");
  3366. /* harmony import */
  3367. var _animals_loadAI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./animals/loadAI.js */ "./src/modules/socket/events/animals/loadAI.js");
  3368. /* harmony import */
  3369. var _game_object_addProjectile_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./game_object/addProjectile.js */ "./src/modules/socket/events/game_object/addProjectile.js");
  3370. /* harmony import */
  3371. var _game_object_killObject_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./game_object/killObject.js */ "./src/modules/socket/events/game_object/killObject.js");
  3372. /* harmony import */
  3373. var _game_object_killObjects_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./game_object/killObjects.js */ "./src/modules/socket/events/game_object/killObjects.js");
  3374. /* harmony import */
  3375. var _game_object_loadGameObject_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ./game_object/loadGameObject.js */ "./src/modules/socket/events/game_object/loadGameObject.js");
  3376. /* harmony import */
  3377. var _game_object_wiggleGameObject_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__( /*! ./game_object/wiggleGameObject.js */ "./src/modules/socket/events/game_object/wiggleGameObject.js");
  3378. /* harmony import */
  3379. var _player_addPlayer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__( /*! ./player/addPlayer.js */ "./src/modules/socket/events/player/addPlayer.js");
  3380. /* harmony import */
  3381. var _player_gatherAnimation_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__( /*! ./player/gatherAnimation.js */ "./src/modules/socket/events/player/gatherAnimation.js");
  3382. /* harmony import */
  3383. var _player_killPlayer_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__( /*! ./player/killPlayer.js */ "./src/modules/socket/events/player/killPlayer.js");
  3384. /* harmony import */
  3385. var _player_removePlayer_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__( /*! ./player/removePlayer.js */ "./src/modules/socket/events/player/removePlayer.js");
  3386. /* harmony import */
  3387. var _player_updateHealth_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__( /*! ./player/updateHealth.js */ "./src/modules/socket/events/player/updateHealth.js");
  3388. /* harmony import */
  3389. var _player_updatePlayers_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__( /*! ./player/updatePlayers.js */ "./src/modules/socket/events/player/updatePlayers.js");
  3390. /* harmony import */
  3391. var _stats_updateItemCounts_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__( /*! ./stats/updateItemCounts.js */ "./src/modules/socket/events/stats/updateItemCounts.js");
  3392. /* harmony import */
  3393. var _stats_updateItems_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__( /*! ./stats/updateItems.js */ "./src/modules/socket/events/stats/updateItems.js");
  3394. /* harmony import */
  3395. var _stats_updatePlayerValue_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__( /*! ./stats/updatePlayerValue.js */ "./src/modules/socket/events/stats/updatePlayerValue.js");
  3396. /* harmony import */
  3397. var _system_setupGame_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__( /*! ./system/setupGame.js */ "./src/modules/socket/events/system/setupGame.js");
  3398.  
  3399. function getEvents() {
  3400. const events = {}
  3401. const {
  3402. packets
  3403. } = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.designations
  3404. events[packets.SETUP_GAME] = _system_setupGame_js__WEBPACK_IMPORTED_MODULE_16__["default"]
  3405. events[packets.ADD_PLAYER] = _player_addPlayer_js__WEBPACK_IMPORTED_MODULE_7__["default"]
  3406. events[packets.KILL_PLAYER] = _player_killPlayer_js__WEBPACK_IMPORTED_MODULE_9__["default"]
  3407. events[packets.REMOVE_PLAYER] = _player_removePlayer_js__WEBPACK_IMPORTED_MODULE_10__["default"]
  3408. events[packets.UPDATE_PLAYERS] = _player_updatePlayers_js__WEBPACK_IMPORTED_MODULE_12__["default"]
  3409. events[packets.UPDATE_ITEM_COUNTS] = _stats_updateItemCounts_js__WEBPACK_IMPORTED_MODULE_13__["default"]
  3410. events[packets.UPDATE_PLAYER_VALUE] = _stats_updatePlayerValue_js__WEBPACK_IMPORTED_MODULE_15__["default"]
  3411. events[packets.UPDATE_HEALTH] = _player_updateHealth_js__WEBPACK_IMPORTED_MODULE_11__["default"]
  3412. events[packets.UPDATE_ITEMS] = _stats_updateItems_js__WEBPACK_IMPORTED_MODULE_14__["default"]
  3413. events[packets.GATHER_ANIMATION] = _player_gatherAnimation_js__WEBPACK_IMPORTED_MODULE_8__["default"]
  3414. events[packets.ADD_PROJECTILE] = _game_object_addProjectile_js__WEBPACK_IMPORTED_MODULE_2__["default"]
  3415. events[packets.LOAD_GAME_OBJECT] = _game_object_loadGameObject_js__WEBPACK_IMPORTED_MODULE_5__["default"]
  3416. events[packets.KILL_OBJECT] = _game_object_killObject_js__WEBPACK_IMPORTED_MODULE_3__["default"]
  3417. events[packets.KILL_OBJECTS] = _game_object_killObjects_js__WEBPACK_IMPORTED_MODULE_4__["default"]
  3418. events[packets.WIGGLE_GAME_OBJECT] = _game_object_wiggleGameObject_js__WEBPACK_IMPORTED_MODULE_6__["default"]
  3419. events[packets.LOAD_AI] = _animals_loadAI_js__WEBPACK_IMPORTED_MODULE_1__["default"]
  3420. return events
  3421. }
  3422. /* harmony default export */
  3423. __webpack_exports__["default"] = (getEvents);
  3424. /***/
  3425. }),
  3426. /***/
  3427. "./src/modules/socket/events/player/addPlayer.js":
  3428. /*!*******************************************************!*\
  3429. !*** ./src/modules/socket/events/player/addPlayer.js ***!
  3430. \*******************************************************/
  3431. /***/
  3432. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3433. __webpack_require__.r(__webpack_exports__);
  3434. /* harmony import */
  3435. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3436.  
  3437. function addPlayer(content, isYou) {
  3438. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.playersManager.addPlayer(content, isYou)
  3439. }
  3440. /* harmony default export */
  3441. __webpack_exports__["default"] = (addPlayer);
  3442. /***/
  3443. }),
  3444. /***/
  3445. "./src/modules/socket/events/player/gatherAnimation.js":
  3446. /*!*************************************************************!*\
  3447. !*** ./src/modules/socket/events/player/gatherAnimation.js ***!
  3448. \*************************************************************/
  3449. /***/
  3450. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3451. __webpack_require__.r(__webpack_exports__);
  3452. /* harmony import */
  3453. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3454.  
  3455. function gatherAnimation(sid, didHit, index) {
  3456. const player = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.playersManager.getById(sid)
  3457. if (!player) return
  3458. player.onGather(didHit, index)
  3459. }
  3460. /* harmony default export */
  3461. __webpack_exports__["default"] = (gatherAnimation);
  3462. /***/
  3463. }),
  3464. /***/
  3465. "./src/modules/socket/events/player/killPlayer.js":
  3466. /*!********************************************************!*\
  3467. !*** ./src/modules/socket/events/player/killPlayer.js ***!
  3468. \********************************************************/
  3469. /***/
  3470. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3471. __webpack_require__.r(__webpack_exports__);
  3472. /* harmony import */
  3473. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3474.  
  3475. function killPlayer() {
  3476. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.kill()
  3477. }
  3478. /* harmony default export */
  3479. __webpack_exports__["default"] = (killPlayer);
  3480. /***/
  3481. }),
  3482. /***/
  3483. "./src/modules/socket/events/player/removePlayer.js":
  3484. /*!**********************************************************!*\
  3485. !*** ./src/modules/socket/events/player/removePlayer.js ***!
  3486. \**********************************************************/
  3487. /***/
  3488. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3489. __webpack_require__.r(__webpack_exports__);
  3490. /* harmony import */
  3491. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3492.  
  3493. function removePlayer(id) {
  3494. if (_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.playersManager.players.size <= 1) return
  3495. const player = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.playersManager.list.find((player) => player.id === id)
  3496. if (!player) return
  3497. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.playersManager.removePlayer(player.sid)
  3498. }
  3499. /* harmony default export */
  3500. __webpack_exports__["default"] = (removePlayer);
  3501. /***/
  3502. }),
  3503. /***/
  3504. "./src/modules/socket/events/player/updateHealth.js":
  3505. /*!**********************************************************!*\
  3506. !*** ./src/modules/socket/events/player/updateHealth.js ***!
  3507. \**********************************************************/
  3508. /***/
  3509. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3510. __webpack_require__.r(__webpack_exports__);
  3511. /* harmony import */
  3512. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3513.  
  3514. function updateHealth(sid, value) {
  3515. const player = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.playersManager.getById(sid)
  3516. if (!player) return
  3517. player.changeHealth(value)
  3518. }
  3519. /* harmony default export */
  3520. __webpack_exports__["default"] = (updateHealth);
  3521. /***/
  3522. }),
  3523. /***/
  3524. "./src/modules/socket/events/player/updatePlayers.js":
  3525. /*!***********************************************************!*\
  3526. !*** ./src/modules/socket/events/player/updatePlayers.js ***!
  3527. \***********************************************************/
  3528. /***/
  3529. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3530. __webpack_require__.r(__webpack_exports__);
  3531. /* harmony import */
  3532. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3533.  
  3534. function updatePlayers(content) {
  3535. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.playersManager.updatePlayers(content)
  3536. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.ticker.updateTicks()
  3537. }
  3538. /* harmony default export */
  3539. __webpack_exports__["default"] = (updatePlayers);
  3540. /***/
  3541. }),
  3542. /***/
  3543. "./src/modules/socket/events/stats/updateItemCounts.js":
  3544. /*!*************************************************************!*\
  3545. !*** ./src/modules/socket/events/stats/updateItemCounts.js ***!
  3546. \*************************************************************/
  3547. /***/
  3548. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3549. __webpack_require__.r(__webpack_exports__);
  3550. /* harmony import */
  3551. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3552.  
  3553. function updateItemCounts(index, value) {
  3554. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player.itemCounts[index] = value
  3555. }
  3556. /* harmony default export */
  3557. __webpack_exports__["default"] = (updateItemCounts);
  3558. /***/
  3559. }),
  3560. /***/
  3561. "./src/modules/socket/events/stats/updateItems.js":
  3562. /*!********************************************************!*\
  3563. !*** ./src/modules/socket/events/stats/updateItems.js ***!
  3564. \********************************************************/
  3565. /***/
  3566. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3567. __webpack_require__.r(__webpack_exports__);
  3568. /* harmony import */
  3569. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3570.  
  3571. function updateItems(data, isWeapon) {
  3572. if (!data?.length) return
  3573. const type = isWeapon ? "weapons" : "items"
  3574. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player[type] = data
  3575. }
  3576. /* harmony default export */
  3577. __webpack_exports__["default"] = (updateItems);
  3578. /***/
  3579. }),
  3580. /***/
  3581. "./src/modules/socket/events/stats/updatePlayerValue.js":
  3582. /*!**************************************************************!*\
  3583. !*** ./src/modules/socket/events/stats/updatePlayerValue.js ***!
  3584. \**************************************************************/
  3585. /***/
  3586. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3587. __webpack_require__.r(__webpack_exports__);
  3588. /* harmony import */
  3589. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3590.  
  3591. function updatePlayerValue(index, value, updateView) {
  3592. if (!_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player) return
  3593. _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.player[index] = value
  3594. }
  3595. /* harmony default export */
  3596. __webpack_exports__["default"] = (updatePlayerValue);
  3597. /***/
  3598. }),
  3599. /***/
  3600. "./src/modules/socket/events/system/setupGame.js":
  3601. /*!*******************************************************!*\
  3602. !*** ./src/modules/socket/events/system/setupGame.js ***!
  3603. \*******************************************************/
  3604. /***/
  3605. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3606. __webpack_require__.r(__webpack_exports__);
  3607. /* harmony import */
  3608. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../constants.js */ "./src/constants.js");
  3609.  
  3610. function setupGame(socketId) {
  3611. _constants_js__WEBPACK_IMPORTED_MODULE_0__.socket.setSocketId(socketId)
  3612. }
  3613. /* harmony default export */
  3614. __webpack_exports__["default"] = (setupGame);
  3615. /***/
  3616. }),
  3617. /***/
  3618. "./src/utils/CowUtils.js":
  3619. /*!*******************************!*\
  3620. !*** ./src/utils/CowUtils.js ***!
  3621. \*******************************/
  3622. /***/
  3623. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  3624. __webpack_require__.r(__webpack_exports__);
  3625. class CowUtils {
  3626. static removeProto(object) {
  3627. if (!(object instanceof Object)) return
  3628. return JSON.parse(JSON.stringify(object))
  3629. }
  3630. static randInt(min, max) {
  3631. return Math.floor(CowUtils.randFloat(min, max))
  3632. }
  3633. static randFloat(min, max) {
  3634. if (typeof max === 'undefined') {
  3635. max = min
  3636. min = 0
  3637. }
  3638. return (Math.random() * (max - min + 1)) + min
  3639. }
  3640. static lerp(value1, value2, amount) {
  3641. return value1 + (value2 - value1) * amount
  3642. }
  3643. static kFormat(value) {
  3644. value = parseFloat(value)
  3645. return value > 999 ? `${(value / 1000).toFixed(1)}k` : value
  3646. }
  3647. static fixAngle(angle) {
  3648. return Math.atan2(Math.cos(angle), Math.sin(angle))
  3649. }
  3650. static getDistance(x1, y1, x2, y2) {
  3651. if (x1 instanceof Object && y1 instanceof Object) {
  3652. return Math.hypot(x1.y - y1.y, x1.x - y1.x)
  3653. }
  3654. return Math.hypot(y1 - y2, x1 - x2)
  3655. }
  3656. static getDirection(x1, y1, x2, y2) {
  3657. if (x1 instanceof Object && y1 instanceof Object) {
  3658. return Math.atan2(x1.y - y1.y, x1.x - y1.x)
  3659. }
  3660. return Math.atan2(y1 - y2, x1 - x2)
  3661. }
  3662. static getAngleDist(angleBetween, targetLookDir) {
  3663. const difference = Math.abs(targetLookDir - angleBetween) % (Math.PI * 2)
  3664. return (difference > Math.PI ? (Math.PI * 2) - difference : difference)
  3665. }
  3666. static lerpAngle(value1, value2, amount) {
  3667. const difference = Math.abs(value2 - value1)
  3668. if (difference > Math.PI) {
  3669. if (value1 > value2) {
  3670. value2 += Math.PI * 2
  3671. } else {
  3672. value1 += Math.PI * 2
  3673. }
  3674. }
  3675. const value = value2 + ((value1 - value2) * amount)
  3676. if (value >= 0 && value <= (Math.PI * 2)) return value
  3677. return (value % (Math.PI * 2))
  3678. }
  3679. static createHook({
  3680. property,
  3681. proto = Object.prototype,
  3682. setter,
  3683. getter
  3684. }) {
  3685. const symbol = Symbol(property)
  3686. Object.defineProperty(proto, property, {
  3687. get() {
  3688. typeof getter === 'function' && getter(this, this[symbol])
  3689. return this[symbol]
  3690. },
  3691. set(value) {
  3692. typeof setter === 'function' && setter(this, value)
  3693. this[symbol] = value
  3694. }
  3695. })
  3696. return symbol
  3697. }
  3698. }
  3699. /* harmony default export */
  3700. __webpack_exports__["default"] = (CowUtils);
  3701. /***/
  3702. }),
  3703. /***/
  3704. "./src/config.json":
  3705. /*!*************************!*\
  3706. !*** ./src/config.json ***!
  3707. \*************************/
  3708. /***/
  3709. (function(module) {
  3710. module.exports = JSON.parse('{"NAME":"Cow.JS","VERSION":"1.0.0","maxScreenWidth":1920,"maxScreenHeight":1080,"mapScale":14400,"riverWidth":724,"gatherAngle":1.208304866765305,"hitAngle":1.5707963267948966,"shieldAngle":1.0471975511965976,"gatherWiggle":10,"designations":{"plugins":{"AUTO_RECONECT":"auto-reconect","CHECK_PLACEMENT":"check-placement"},"packets":{"INIT_DATA":"A","DISCONNECT":"B","SETUP_GAME":"C","ADD_PLAYER":"D","REMOVE_PLAYER":"E","UPDATE_PLAYERS":"a","UPDATE_LEADERBOARD":"G","LOAD_GAME_OBJECT":"H","LOAD_AI":"I","ANIMATE_AI":"J","GATHER_ANIMATION":"K","WIGGLE_GAME_OBJECT":"L","SHOOT_TURRET":"M","UPDATE_PLAYER_VALUE":"N","UPDATE_HEALTH":"O","KILL_PLAYER":"P","KILL_OBJECT":"Q","KILL_OBJECTS":"R","UPDATE_ITEM_COUNTS":"S","UPDATE_AGE":"T","UPDATE_UPGRADES":"U","UPDATE_ITEMS":"V","ADD_PROJECTILE":"X","REMOVE_PROJECTILE":"Y","SERVER_SHUTDOWN_NOTICE":"Z","ADD_ALLIANCE":"g","DELETE_ALLIANCE":"1","ALLIANCE_NOTIFICATION":"2","SET_PLAYER_TEAM":"3","SET_ALLIANCE_PLAYERS":"4","UPDATE_STORE_ITEMS":"5","RECEIVE_CHAT":"6","UPDATE_MINIMAP":"7","SHOW_TEXT":"8","PING_MAP":"9","PING_SOCKET_RESPONSE":"0","ALLIANCE_JOIN_REQUEST":"P","KICK_FROM_CLAN":"Q","SEND_ALLIANCE_JOIN":"b","CREATE_ALLIANCE":"L","LEAVE_ALLIANCE":"N","STORE_EQUIP":"c","CHAT_MESSAGE":"6","RMD":"E","ATTACK_STATE":"d","MOVE_DIR":"a","MAP_PING":"S","AUTO_ATTACK":"K","SELECT_BUILD":"G","SPAWN":"M","SELECT_UPGRADE":"H","LOOK_DIR":"D","PING_SOCKET":"0"},"items":{"FOOD":0,"WALL":1,"SPIKE":2,"MILL":3,"TRAP":4,"TURRET":5}}}');
  3711. /***/
  3712. })
  3713. /******/
  3714. });
  3715. /************************************************************************/
  3716. /******/ // The module cache
  3717. /******/
  3718. var __webpack_module_cache__ = {};
  3719. /******/
  3720. /******/ // The require function
  3721. /******/
  3722. function __webpack_require__(moduleId) {
  3723. /******/ // Check if module is in cache
  3724. /******/
  3725. var cachedModule = __webpack_module_cache__[moduleId];
  3726. /******/
  3727. if (cachedModule !== undefined) {
  3728. /******/
  3729. return cachedModule.exports;
  3730. /******/
  3731. }
  3732. /******/ // Create a new module (and put it into the cache)
  3733. /******/
  3734. var module = __webpack_module_cache__[moduleId] = {
  3735. /******/ // no module.id needed
  3736. /******/ // no module.loaded needed
  3737. /******/
  3738. exports: {}
  3739. /******/
  3740. };
  3741. /******/
  3742. /******/ // Execute the module function
  3743. /******/
  3744. __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  3745. /******/
  3746. /******/ // Return the exports of the module
  3747. /******/
  3748. return module.exports;
  3749. /******/
  3750. }
  3751. /******/
  3752. /************************************************************************/
  3753. /******/
  3754. /* webpack/runtime/define property getters */
  3755. /******/
  3756. ! function() {
  3757. /******/ // define getter functions for harmony exports
  3758. /******/
  3759. __webpack_require__.d = function(exports, definition) {
  3760. /******/
  3761. for (var key in definition) {
  3762. /******/
  3763. if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  3764. /******/
  3765. Object.defineProperty(exports, key, {
  3766. enumerable: true,
  3767. get: definition[key]
  3768. });
  3769. /******/
  3770. }
  3771. /******/
  3772. }
  3773. /******/
  3774. };
  3775. /******/
  3776. }();
  3777. /******/
  3778. /******/
  3779. /* webpack/runtime/hasOwnProperty shorthand */
  3780. /******/
  3781. ! function() {
  3782. /******/
  3783. __webpack_require__.o = function(obj, prop) {
  3784. return Object.prototype.hasOwnProperty.call(obj, prop);
  3785. }
  3786. /******/
  3787. }();
  3788. /******/
  3789. /******/
  3790. /* webpack/runtime/make namespace object */
  3791. /******/
  3792. ! function() {
  3793. /******/ // define __esModule on exports
  3794. /******/
  3795. __webpack_require__.r = function(exports) {
  3796. /******/
  3797. if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  3798. /******/
  3799. Object.defineProperty(exports, Symbol.toStringTag, {
  3800. value: 'Module'
  3801. });
  3802. /******/
  3803. }
  3804. /******/
  3805. Object.defineProperty(exports, '__esModule', {
  3806. value: true
  3807. });
  3808. /******/
  3809. };
  3810. /******/
  3811. }();
  3812. /******/
  3813. /************************************************************************/
  3814. var __webpack_exports__ = {};
  3815. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  3816. ! function() {
  3817. /*!**********************!*\
  3818. !*** ./src/index.js ***!
  3819. \**********************/
  3820. __webpack_require__.r(__webpack_exports__);
  3821. /* harmony import */
  3822. var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./constants.js */ "./src/constants.js");
  3823. /* harmony import */
  3824. var _utils_CowUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./utils/CowUtils.js */ "./src/utils/CowUtils.js");
  3825. /* harmony import */
  3826. var _hooks_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./hooks.js */ "./src/hooks.js");
  3827. const watermark = setInterval(() => {
  3828. const linksContainer = document.getElementById("linksContainer2")
  3829. if (!linksContainer) return
  3830. const html = linksContainer.innerHTML
  3831. linksContainer.innerHTML = html.replace(/(v\d\.\d\.\d)/gi, `$1 </a> | <a href="#" target="_blank" class="menuLink" style="color: #9f1a1a">${_constants_js__WEBPACK_IMPORTED_MODULE_0__.cow.config.NAME}</a>`)
  3832. clearInterval(watermark)
  3833. })
  3834. setTimeout(() => clearInterval(watermark), 30e3)
  3835. window.CowUtils = _utils_CowUtils_js__WEBPACK_IMPORTED_MODULE_1__["default"]
  3836. window.Cow = _constants_js__WEBPACK_IMPORTED_MODULE_0__.cow
  3837. }();
  3838. /******/
  3839. })();
  3840. //# sourceMappingURL=bundle.js.map