Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.03 KB | None | 0 0
  1. package com.company.assembleegameclient.game {
  2. import com.company.assembleegameclient.map.Square;
  3. import com.company.assembleegameclient.objects.GameObject;
  4. import com.company.assembleegameclient.objects.ObjectLibrary;
  5. import com.company.assembleegameclient.objects.Player;
  6. import com.company.assembleegameclient.parameters.Parameters;
  7. import com.company.assembleegameclient.tutorial.Tutorial;
  8. import com.company.assembleegameclient.tutorial.doneAction;
  9. import com.company.assembleegameclient.ui.options.Options;
  10. import com.company.assembleegameclient.util.TextureRedrawer;
  11. import com.company.util.KeyCodes;
  12. import flash.utils.Timer;
  13. import flash.events.TimerEvent;
  14.  
  15. import flash.display.Stage;
  16. import flash.display.StageDisplayState;
  17. import flash.events.Event;
  18. import flash.events.KeyboardEvent;
  19. import flash.events.MouseEvent;
  20. import flash.system.Capabilities;
  21.  
  22. import kabam.rotmg.application.api.ApplicationSetup;
  23. import kabam.rotmg.chat.model.ChatMessage;
  24. import kabam.rotmg.constants.GeneralConstants;
  25. import kabam.rotmg.constants.UseType;
  26. import kabam.rotmg.core.StaticInjectorContext;
  27. import kabam.rotmg.core.view.Layers;
  28. import kabam.rotmg.dialogs.control.CloseDialogsSignal;
  29. import kabam.rotmg.dialogs.control.OpenDialogSignal;
  30. import kabam.rotmg.friends.view.FriendListView;
  31. import kabam.rotmg.game.model.PotionInventoryModel;
  32. import kabam.rotmg.game.model.UseBuyPotionVO;
  33. import kabam.rotmg.game.signals.AddTextLineSignal;
  34. import kabam.rotmg.game.signals.ExitGameSignal;
  35. import kabam.rotmg.game.signals.GiftStatusUpdateSignal;
  36. import kabam.rotmg.game.signals.SetTextBoxVisibilitySignal;
  37. import kabam.rotmg.game.signals.UseBuyPotionSignal;
  38. import kabam.rotmg.game.view.components.StatsTabHotKeyInputSignal;
  39. import kabam.rotmg.messaging.impl.GameServerConnection;
  40. import kabam.rotmg.minimap.control.MiniMapZoomSignal;
  41. import kabam.rotmg.pets.controller.reskin.ReskinPetFlowStartSignal;
  42. import kabam.rotmg.ui.UIUtils;
  43. import kabam.rotmg.ui.model.TabStripModel;
  44.  
  45. import net.hires.debug.Stats;
  46.  
  47. import org.swiftsuspenders.Injector;
  48.  
  49. public class MapUserInput {
  50.  
  51. private static const MOUSE_DOWN_WAIT_PERIOD:uint = 175;
  52.  
  53. private static var stats_:Stats = new Stats();
  54. private static var arrowWarning_:Boolean = false;
  55. var delay = 100000;
  56. var timer:Timer = new Timer(delay, 1);
  57. public var gs_:GameSprite;
  58. private var moveLeft_:Boolean = false;
  59. private var moveRight_:Boolean = false;
  60. private var moveUp_:Boolean = false;
  61. private var moveDown_:Boolean = false;
  62. private var rotateLeft_:Boolean = false;
  63. private var rotateRight_:Boolean = false;
  64. private var mouseDown_:Boolean = false;
  65. private var autofire_:Boolean = false;
  66. private var currentString:String = "";
  67. private var specialKeyDown_:Boolean = false;
  68. private var enablePlayerInput_:Boolean = true;
  69. private var giftStatusUpdateSignal:GiftStatusUpdateSignal;
  70. private var addTextLine:AddTextLineSignal;
  71. private var setTextBoxVisibility:SetTextBoxVisibilitySignal;
  72. private var statsTabHotKeyInputSignal:StatsTabHotKeyInputSignal;
  73. private var miniMapZoom:MiniMapZoomSignal;
  74. private var useBuyPotionSignal:UseBuyPotionSignal;
  75. private var potionInventoryModel:PotionInventoryModel;
  76. private var openDialogSignal:OpenDialogSignal;
  77. private var closeDialogSignal:CloseDialogsSignal;
  78. private var tabStripModel:TabStripModel;
  79. private var layers:Layers;
  80. private var exitGame:ExitGameSignal;
  81. private var areFKeysAvailable:Boolean;
  82. private var reskinPetFlowStart:ReskinPetFlowStartSignal;
  83.  
  84. public function MapUserInput(_arg1:GameSprite) {
  85. this.gs_ = _arg1;
  86. this.gs_.addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
  87. this.gs_.addEventListener(Event.REMOVED_FROM_STAGE, this.onRemovedFromStage);
  88. var _local2:Injector = StaticInjectorContext.getInjector();
  89. this.giftStatusUpdateSignal = _local2.getInstance(GiftStatusUpdateSignal);
  90. this.reskinPetFlowStart = _local2.getInstance(ReskinPetFlowStartSignal);
  91. this.addTextLine = _local2.getInstance(AddTextLineSignal);
  92. this.setTextBoxVisibility = _local2.getInstance(SetTextBoxVisibilitySignal);
  93. this.miniMapZoom = _local2.getInstance(MiniMapZoomSignal);
  94. this.useBuyPotionSignal = _local2.getInstance(UseBuyPotionSignal);
  95. this.potionInventoryModel = _local2.getInstance(PotionInventoryModel);
  96. this.tabStripModel = _local2.getInstance(TabStripModel);
  97. this.layers = _local2.getInstance(Layers);
  98. this.statsTabHotKeyInputSignal = _local2.getInstance(StatsTabHotKeyInputSignal);
  99. this.exitGame = _local2.getInstance(ExitGameSignal);
  100. this.openDialogSignal = _local2.getInstance(OpenDialogSignal);
  101. this.closeDialogSignal = _local2.getInstance(CloseDialogsSignal);
  102. var _local3:ApplicationSetup = _local2.getInstance(ApplicationSetup);
  103. this.areFKeysAvailable = _local3.areDeveloperHotkeysEnabled();
  104. this.gs_.map.signalRenderSwitch.add(this.onRenderSwitch);
  105. }
  106.  
  107. public function onRenderSwitch(_arg1:Boolean):void {
  108. if (_arg1) {
  109. this.gs_.stage.removeEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
  110. this.gs_.stage.removeEventListener(MouseEvent.MOUSE_UP, this.onMouseUp);
  111. this.gs_.map.addEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
  112. this.gs_.map.addEventListener(MouseEvent.MOUSE_UP, this.onMouseUp);
  113. }
  114. else {
  115. this.gs_.map.removeEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
  116. this.gs_.map.removeEventListener(MouseEvent.MOUSE_UP, this.onMouseUp);
  117. this.gs_.stage.addEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
  118. this.gs_.stage.addEventListener(MouseEvent.MOUSE_UP, this.onMouseUp);
  119. }
  120. }
  121.  
  122. public function clearInput():void {
  123. this.moveLeft_ = false;
  124. this.moveRight_ = false;
  125. this.moveUp_ = false;
  126. this.moveDown_ = false;
  127. this.rotateLeft_ = false;
  128. this.rotateRight_ = false;
  129. this.mouseDown_ = false;
  130. this.autofire_ = false;
  131. this.setPlayerMovement();
  132. }
  133.  
  134. public function setEnablePlayerInput(_arg1:Boolean):void {
  135. if (this.enablePlayerInput_ != _arg1) {
  136. this.enablePlayerInput_ = _arg1;
  137. this.clearInput();
  138. }
  139. }
  140.  
  141. private function onAddedToStage(_arg1:Event):void {
  142. var _local2:Stage = this.gs_.stage;
  143. _local2.addEventListener(Event.ACTIVATE, this.onActivate);
  144. _local2.addEventListener(Event.DEACTIVATE, this.onDeactivate);
  145. _local2.addEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDown);
  146. _local2.addEventListener(KeyboardEvent.KEY_UP, this.onKeyUp);
  147. _local2.addEventListener(MouseEvent.MOUSE_WHEEL, this.onMouseWheel);
  148. if (Parameters.isGpuRender()) {
  149. _local2.addEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
  150. _local2.addEventListener(MouseEvent.MOUSE_UP, this.onMouseUp);
  151. }
  152. else {
  153. this.gs_.map.addEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
  154. this.gs_.map.addEventListener(MouseEvent.MOUSE_UP, this.onMouseUp);
  155. }
  156. _local2.addEventListener(Event.ENTER_FRAME, this.onEnterFrame);
  157. _local2.addEventListener(MouseEvent.RIGHT_CLICK, this.disableRightClick);
  158. }
  159.  
  160. public function disableRightClick(_arg1:MouseEvent):void {
  161. }
  162.  
  163. private function onRemovedFromStage(_arg1:Event):void {
  164. var _local2:Stage = this.gs_.stage;
  165. _local2.removeEventListener(Event.ACTIVATE, this.onActivate);
  166. _local2.removeEventListener(Event.DEACTIVATE, this.onDeactivate);
  167. _local2.removeEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDown);
  168. _local2.removeEventListener(KeyboardEvent.KEY_UP, this.onKeyUp);
  169. _local2.removeEventListener(MouseEvent.MOUSE_WHEEL, this.onMouseWheel);
  170. if (Parameters.isGpuRender()) {
  171. _local2.removeEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
  172. _local2.removeEventListener(MouseEvent.MOUSE_UP, this.onMouseUp);
  173. }
  174. else {
  175. this.gs_.map.removeEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
  176. this.gs_.map.removeEventListener(MouseEvent.MOUSE_UP, this.onMouseUp);
  177. }
  178. _local2.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
  179. _local2.removeEventListener(MouseEvent.RIGHT_CLICK, this.disableRightClick);
  180. }
  181.  
  182. private function onActivate(_arg1:Event):void {
  183. }
  184.  
  185. private function onDeactivate(_arg1:Event):void {
  186. this.clearInput();
  187. }
  188.  
  189. public function onMouseDown(_arg1:MouseEvent):void {
  190. var _local3:Number;
  191. var _local4:int;
  192. var _local5:XML;
  193. var _local6:Number;
  194. var _local7:Number;
  195. var _local2:Player = this.gs_.map.player_;
  196. if (_local2 == null) {
  197. return;
  198. }
  199. if (!this.enablePlayerInput_) {
  200. return;
  201. }
  202. if (_arg1.shiftKey) {
  203. _local4 = _local2.equipment_[1];
  204. if (_local4 == -1) {
  205. return;
  206. }
  207. _local5 = ObjectLibrary.xmlLibrary_[_local4];
  208. if ((((_local5 == null)) || (_local5.hasOwnProperty("EndMpCost")))) {
  209. return;
  210. }
  211. if (_local2.isUnstable()) {
  212. _local6 = ((Math.random() * 600) - 300);
  213. _local7 = ((Math.random() * 600) - 325);
  214. }
  215. else {
  216. _local6 = this.gs_.map.mouseX;
  217. _local7 = this.gs_.map.mouseY;
  218. }
  219. if (Parameters.isGpuRender()) {
  220. if ((((((_arg1.currentTarget == _arg1.target)) || ((_arg1.target == this.gs_.map)))) || ((_arg1.target == this.gs_)))) {
  221. _local2.useAltWeapon(_local6, _local7, UseType.START_USE);
  222. }
  223. }
  224. else {
  225. _local2.useAltWeapon(_local6, _local7, UseType.START_USE);
  226. }
  227. return;
  228. }
  229. if (Parameters.isGpuRender()) {
  230. if ((((((((_arg1.currentTarget == _arg1.target)) || ((_arg1.target == this.gs_.map)))) || ((_arg1.target == this.gs_)))) || ((_arg1.currentTarget == this.gs_.chatBox_.list)))) {
  231. _local3 = Math.atan2(this.gs_.map.mouseY, this.gs_.map.mouseX);
  232. }
  233. else {
  234. return;
  235. }
  236. }
  237. else {
  238. _local3 = Math.atan2(this.gs_.map.mouseY, this.gs_.map.mouseX);
  239. }
  240. doneAction(this.gs_, Tutorial.ATTACK_ACTION);
  241. if (_local2.isUnstable()) {
  242. _local2.attemptAttackAngle((Math.random() * 360));
  243. }
  244. else {
  245. _local2.attemptAttackAngle(_local3);
  246. }
  247. this.mouseDown_ = true;
  248. }
  249.  
  250. public function onMouseUp(_arg1:MouseEvent):void {
  251. this.mouseDown_ = false;
  252. var _local2:Player = this.gs_.map.player_;
  253. if (_local2 == null) {
  254. return;
  255. }
  256. _local2.isShooting = false;
  257. }
  258.  
  259. private function onMouseWheel(_arg1:MouseEvent):void {
  260. if (_arg1.delta > 0) {
  261. this.miniMapZoom.dispatch(MiniMapZoomSignal.IN);
  262. }
  263. else {
  264. this.miniMapZoom.dispatch(MiniMapZoomSignal.OUT);
  265. }
  266. }
  267.  
  268. private function onEnterFrame(_arg1:Event):void {
  269. var _local2:Player;
  270. var _local3:Number;
  271. doneAction(this.gs_, Tutorial.UPDATE_ACTION);
  272. if (((this.enablePlayerInput_) && (((this.mouseDown_) || (this.autofire_))))) {
  273. _local2 = this.gs_.map.player_;
  274. if (_local2 != null) {
  275. if (_local2.isUnstable()) {
  276. _local2.attemptAttackAngle((Math.random() * 360));
  277. }
  278. else {
  279. _local3 = Math.atan2(this.gs_.map.mouseY, this.gs_.map.mouseX);
  280. _local2.attemptAttackAngle(_local3);
  281. }
  282. }
  283. }
  284. }
  285.  
  286. private function onKeyDown(_arg1:KeyboardEvent):void {
  287. var _local4:AddTextLineSignal;
  288. var _local5:ChatMessage;
  289. var _local6:GameObject;
  290. var _local7:Number;
  291. var _local8:Number;
  292. var _local9:Boolean;
  293. var _local10:Square;
  294. var _local2:Stage = this.gs_.stage;
  295. this.currentString = (this.currentString + String.fromCharCode(_arg1.keyCode).toLowerCase());
  296. if (this.currentString == UIUtils.EXPERIMENTAL_MENU_PASSWORD.slice(0, this.currentString.length)) {
  297. if (this.currentString.length == UIUtils.EXPERIMENTAL_MENU_PASSWORD.length) {
  298. _local4 = StaticInjectorContext.getInjector().getInstance(AddTextLineSignal);
  299. _local5 = new ChatMessage();
  300. _local5.name = Parameters.SERVER_CHAT_NAME;
  301. this.currentString = "";
  302. UIUtils.SHOW_EXPERIMENTAL_MENU = !(UIUtils.SHOW_EXPERIMENTAL_MENU);
  303. _local5.text = ((UIUtils.SHOW_EXPERIMENTAL_MENU) ? "Experimental menu activated" : "Experimental menu deactivated");
  304. _local4.dispatch(_local5);
  305. }
  306. }
  307. else {
  308. this.currentString = "";
  309. }
  310. switch (_arg1.keyCode) {
  311. case KeyCodes.F1:
  312. case KeyCodes.F2:
  313. case KeyCodes.F3:
  314. case KeyCodes.F4:
  315. case KeyCodes.F5:
  316. case KeyCodes.F6:
  317. case KeyCodes.F7:
  318. case KeyCodes.F8:
  319. case KeyCodes.F9:
  320. case KeyCodes.F10:
  321. case KeyCodes.F11:
  322. case KeyCodes.F12:
  323. case KeyCodes.INSERT:
  324. case KeyCodes.ALTERNATE:
  325. break;
  326. default:
  327. if (_local2.focus != null) {
  328. return;
  329. }
  330. }
  331. var _local3:Player = this.gs_.map.player_;
  332. switch (_arg1.keyCode) {
  333. case Parameters.data_.moveUp:
  334. doneAction(this.gs_, Tutorial.MOVE_FORWARD_ACTION);
  335. this.moveUp_ = true;
  336. break;
  337. case Parameters.data_.moveDown:
  338. doneAction(this.gs_, Tutorial.MOVE_BACKWARD_ACTION);
  339. this.moveDown_ = true;
  340. break;
  341. case Parameters.data_.moveLeft:
  342. doneAction(this.gs_, Tutorial.MOVE_LEFT_ACTION);
  343. this.moveLeft_ = true;
  344. break;
  345. case Parameters.data_.moveRight:
  346. doneAction(this.gs_, Tutorial.MOVE_RIGHT_ACTION);
  347. this.moveRight_ = true;
  348. break;
  349. case Parameters.data_.rotateLeft:
  350. if (!Parameters.data_.allowRotation) break;
  351. doneAction(this.gs_, Tutorial.ROTATE_LEFT_ACTION);
  352. this.rotateLeft_ = true;
  353. break;
  354. case Parameters.data_.rotateRight:
  355. if (!Parameters.data_.allowRotation) break;
  356. doneAction(this.gs_, Tutorial.ROTATE_RIGHT_ACTION);
  357. this.rotateRight_ = true;
  358. break;
  359. case Parameters.data_.resetToDefaultCameraAngle:
  360. Parameters.data_.cameraAngle = Parameters.data_.defaultCameraAngle;
  361. Parameters.save();
  362. break;
  363. case Parameters.data_.useSpecial:
  364. _local6 = this.gs_.map.player_;
  365. if (_local6 == null) break;
  366. if (!this.specialKeyDown_) {
  367. if (_local3.isUnstable()) {
  368. _local7 = ((Math.random() * 600) - 300);
  369. _local8 = ((Math.random() * 600) - 325);
  370. }
  371. else {
  372. _local7 = this.gs_.map.mouseX;
  373. _local8 = this.gs_.map.mouseY;
  374. }
  375. _local9 = _local3.useAltWeapon(_local7, _local8, UseType.START_USE);
  376. if (_local9) {
  377. this.specialKeyDown_ = true;
  378. }
  379. }
  380. break;
  381. case Parameters.data_.autofireToggle:
  382. this.gs_.map.player_.isShooting = (this.autofire_ = !(this.autofire_));
  383. break;
  384. case Parameters.data_.toggleHPBar:
  385. Parameters.data_.HPBar = !(Parameters.data_.HPBar);
  386. break;
  387. case Parameters.data_.useInvSlot1:
  388. this.useItem(4);
  389. break;
  390. case Parameters.data_.useInvSlot2:
  391. this.useItem(5);
  392. break;
  393. case Parameters.data_.useInvSlot3:
  394. this.useItem(6);
  395. break;
  396. case Parameters.data_.useInvSlot4:
  397. this.useItem(7);
  398. break;
  399. case Parameters.data_.useInvSlot5:
  400. this.useItem(8);
  401. break;
  402. case Parameters.data_.useInvSlot6:
  403. this.useItem(9);
  404. break;
  405. case Parameters.data_.useInvSlot7:
  406. this.useItem(10);
  407. break;
  408. case Parameters.data_.useInvSlot8:
  409. this.useItem(11);
  410. break;
  411. case Parameters.data_.useHealthPotion:
  412. if (this.potionInventoryModel.getPotionModel(PotionInventoryModel.HEALTH_POTION_ID).available) {
  413. this.useBuyPotionSignal.dispatch(new UseBuyPotionVO(PotionInventoryModel.HEALTH_POTION_ID, UseBuyPotionVO.CONTEXTBUY));
  414. }
  415. break;
  416. case Parameters.data_.GPURenderToggle:
  417. Parameters.data_.GPURender = !(Parameters.data_.GPURender);
  418. break;
  419. case Parameters.data_.useMagicPotion:
  420. if (this.potionInventoryModel.getPotionModel(PotionInventoryModel.MAGIC_POTION_ID).available) {
  421. this.useBuyPotionSignal.dispatch(new UseBuyPotionVO(PotionInventoryModel.MAGIC_POTION_ID, UseBuyPotionVO.CONTEXTBUY));
  422. }
  423. break;
  424. case Parameters.data_.miniMapZoomOut:
  425. this.miniMapZoom.dispatch(MiniMapZoomSignal.OUT);
  426. break;
  427. case Parameters.data_.miniMapZoomIn:
  428. this.miniMapZoom.dispatch(MiniMapZoomSignal.IN);
  429. break;
  430. case Parameters.data_.togglePerformanceStats:
  431. this.togglePerformanceStats();
  432. break;
  433. case Parameters.data_.escapeToNexus:
  434. case Parameters.data_.escapeToNexus2:
  435. this.exitGame.dispatch();
  436. this.gs_.gsc_.escape();
  437. Parameters.data_.needsRandomRealm = false;
  438. Parameters.save();
  439. break;
  440. case Parameters.data_.friendList:
  441. Parameters.data_.friendListDisplayFlag = !(Parameters.data_.friendListDisplayFlag);
  442. if (Parameters.data_.friendListDisplayFlag) {
  443. this.openDialogSignal.dispatch(new FriendListView());
  444. }
  445. else {
  446. this.closeDialogSignal.dispatch();
  447. }
  448. break;
  449. case Parameters.data_.options:
  450. this.clearInput();
  451. this.layers.overlay.addChild(new Options(this.gs_));
  452. break;
  453. case Parameters.data_.toggleCentering:
  454. Parameters.data_.centerOnPlayer = !(Parameters.data_.centerOnPlayer);
  455. Parameters.save();
  456. break;
  457. case Parameters.data_.toggleFullscreen:
  458. if (Capabilities.playerType == "Desktop") {
  459. Parameters.data_.fullscreenMode = !(Parameters.data_.fullscreenMode);
  460. Parameters.save();
  461. _local2.displayState = ((Parameters.data_.fullscreenMode) ? "fullScreenInteractive" : StageDisplayState.NORMAL);
  462. }
  463. break;
  464. case Parameters.data_.switchTabs:
  465. this.statsTabHotKeyInputSignal.dispatch();
  466. break;
  467. case Parameters.data_.testOne:
  468. break;
  469. }
  470. if (Parameters.ALLOW_SCREENSHOT_MODE) {
  471. switch (_arg1.keyCode) {
  472. case KeyCodes.F2:
  473. this.toggleScreenShotMode();
  474. break;
  475. case KeyCodes.F3:
  476. Parameters.screenShotSlimMode_ = !(Parameters.screenShotSlimMode_);
  477. break;
  478. case KeyCodes.F4:
  479. this.gs_.map.mapOverlay_.visible = !(this.gs_.map.mapOverlay_.visible);
  480. this.gs_.map.partyOverlay_.visible = !(this.gs_.map.partyOverlay_.visible);
  481. break;
  482. }
  483. }
  484. if (this.areFKeysAvailable) {
  485. switch (_arg1.keyCode) {
  486. case KeyCodes.F6:
  487. TextureRedrawer.clearCache();
  488. Parameters.projColorType_ = ((Parameters.projColorType_ + 1) % 7);
  489. this.addTextLine.dispatch(ChatMessage.make(Parameters.ERROR_CHAT_NAME, ("Projectile Color Type: " + Parameters.projColorType_)));
  490. break;
  491. case KeyCodes.F7:
  492. for each (_local10 in this.gs_.map.squares_) {
  493. if (_local10 != null) {
  494. _local10.faces_.length = 0;
  495. }
  496. }
  497. Parameters.blendType_ = ((Parameters.blendType_ + 1) % 2);
  498. this.addTextLine.dispatch(ChatMessage.make(Parameters.CLIENT_CHAT_NAME, ("Blend type: " + Parameters.blendType_)));
  499. break;
  500. case KeyCodes.F8:
  501. Parameters.data_.surveyDate = 0;
  502. Parameters.data_.needsSurvey = true;
  503. Parameters.data_.playTimeLeftTillSurvey = 5;
  504. Parameters.data_.surveyGroup = "testing";
  505. break;
  506. case KeyCodes.F9:
  507. Parameters.drawProj_ = !(Parameters.drawProj_);
  508. break;
  509. }
  510. }
  511. this.setPlayerMovement();
  512. }
  513.  
  514. private function onKeyUp(_arg1:KeyboardEvent):void {
  515. var _local2:Number;
  516. var _local3:Number;
  517. switch (_arg1.keyCode) {
  518. case Parameters.data_.moveUp:
  519. this.moveUp_ = false;
  520. break;
  521. case Parameters.data_.moveDown:
  522. this.moveDown_ = false;
  523. break;
  524. case Parameters.data_.moveLeft:
  525. this.moveLeft_ = false;
  526. break;
  527. case Parameters.data_.moveRight:
  528. this.moveRight_ = false;
  529. break;
  530. case Parameters.data_.rotateLeft:
  531. this.rotateLeft_ = false;
  532. break;
  533. case Parameters.data_.rotateRight:
  534. this.rotateRight_ = false;
  535. break;
  536. case Parameters.data_.useSpecial:
  537. if (this.specialKeyDown_) {
  538. this.specialKeyDown_ = false;
  539. if (this.gs_.map.player_.isUnstable()) {
  540. _local2 = ((Math.random() * 600) - 300);
  541. _local3 = ((Math.random() * 600) - 325);
  542. }
  543. else {
  544. _local2 = this.gs_.map.mouseX;
  545. _local3 = this.gs_.map.mouseY;
  546. }
  547. this.gs_.map.player_.useAltWeapon(this.gs_.map.mouseX, this.gs_.map.mouseY, UseType.END_USE);
  548. }
  549. break;
  550. }
  551. this.setPlayerMovement();
  552. }
  553.  
  554. private function setPlayerMovement():void {
  555. var _local1:Player = this.gs_.map.player_;
  556. if (_local1 != null) {
  557. if (this.enablePlayerInput_) {
  558. _local1.setRelativeMovement((((this.rotateRight_) ? 1 : 0) - ((this.rotateLeft_) ? 1 : 0)), (((this.moveRight_) ? 1 : 0) - ((this.moveLeft_) ? 1 : 0)), (((this.moveDown_) ? 1 : 0) - ((this.moveUp_) ? 1 : 0)));
  559. }
  560. else {
  561. _local1.setRelativeMovement(0, 0, 0);
  562. }
  563. }
  564. }
  565.  
  566. private function useItem(slot:int):void {
  567. if (this.tabStripModel.currentSelection == TabStripModel.BACKPACK) {
  568. slot = slot + GeneralConstants.NUM_INVENTORY_SLOTS;
  569. }
  570. var slotIndex:int =
  571. ObjectLibrary.getMatchingSlotIndex(this.gs_.map.player_.equipment_[slot], this.gs_.map.player_);
  572. if (slotIndex != -1) {
  573. GameServerConnection.instance.invSwap(
  574. this.gs_.map.player_,
  575. this.gs_.map.player_, slot,
  576. this.gs_.map.player_.equipment_[slot],
  577. this.gs_.map.player_, slotIndex,
  578. this.gs_.map.player_.equipment_[slotIndex]);
  579. ////THIS METHOD IS LIKE WHERE ITEMS GET SWAPPED SO IF A DELAY IS HERE IT SHOULD WORK!!
  580. }
  581. else {
  582. GameServerConnection.instance.useItem_new(this.gs_.map.player_, slot);
  583. }
  584. }
  585.  
  586.  
  587.  
  588. private function togglePerformanceStats():void {
  589. if (this.gs_.contains(stats_)) {
  590. this.gs_.removeChild(stats_);
  591. this.gs_.removeChild(this.gs_.gsc_.jitterWatcher_);
  592. this.gs_.gsc_.disableJitterWatcher();
  593. }
  594. else {
  595. this.gs_.addChild(stats_);
  596. this.gs_.gsc_.enableJitterWatcher();
  597. this.gs_.gsc_.jitterWatcher_.y = stats_.height;
  598. this.gs_.addChild(this.gs_.gsc_.jitterWatcher_);
  599. }
  600. }
  601.  
  602. private function toggleScreenShotMode():void {
  603. Parameters.screenShotMode_ = !(Parameters.screenShotMode_);
  604. if (Parameters.screenShotMode_) {
  605. this.gs_.hudView.visible = false;
  606. this.setTextBoxVisibility.dispatch(false);
  607. }
  608. else {
  609. this.gs_.hudView.visible = true;
  610. this.setTextBoxVisibility.dispatch(true);
  611. }
  612. }
  613.  
  614.  
  615. }
  616. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement