Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.96 KB | None | 0 0
  1. function onActionServerSide()
  2. {
  3. switch( params[ 0])
  4. {
  5. // trigger to the weapon so it equips / wears or whatever it must do
  6. case "selectItem":
  7. if ( clientr.stats_hp_c > NULL)
  8. if ( makevar( "clientr.itemc." @ params[ 1]) > NULL) triggerAction( 0, 0, "clientside", params[ 1], "equip");
  9. break;
  10.  
  11. // gets info from the database: info_db about an item
  12. case "getInfo":
  13. with( findNPC( "info_db"))
  14. thiso.INFO = makevar( "this.info." @ params[ 1]);
  15. client.item_info = thiso.INFO;
  16. if ( client.item_info = NULL) client.item_info = { { "No info available yet!", "Excuses."}, "None"};
  17. triggerAction( 0, 0, "clientside", "-System/Menu", "view_info", params[ 2], params[ 1]);
  18. break;
  19. // item drop
  20. case "drop_item":
  21. if ( makevar( "clientr.itemc." @ params[ 2]) >= params[ 1])
  22. {
  23. types = { clientr.wear_weapon[ 4], clientr.wear_belt[ 6], clientr.wear_shield[ 6], clientr.wear_boots[ 6], clientr.wear_armor[ 6],
  24. clientr.wear_gloves[ 6], clientr.wear_ring[ 6], clientr.wear_necklance[ 6], clientr.wear_spell[ 0]};
  25.  
  26. if ( ( (!contains( types, params[2])) || ( makevar( "clientr.itemc." @ params[ 2]) > params[ 1])) && (!params[ 2].starts("Staff/"))) {
  27. saveLog2( "endora_droplog.rtf", player.account @ " dropped " @ params[1] @ " " @ params[2] @ "(s) in level " @ player.level @ "!");
  28. putnpc2( player.x + .5 + vecx( player.dir) * 2, player.y + 1 + vecy( player.dir) * 2, "join(\"item_dropped\");");
  29. with( npcs[ npcscount - 1]) {
  30. this.amm = params[ 1];
  31. this.nam = params[ 2];
  32. this.img = params[ 3];
  33. this.own = params[ 4];
  34. }
  35. //This is for the hat system
  36. if (params[2].starts("Items/Hat"))
  37. {
  38. client.player_messages.add( { "You have dropped your hat, therefor it has been taken off your head!", 1, 0, 0});
  39. player.attr[1] = "";
  40. makevar("clientr.itemc." @ params[ 2]) -= params[1];
  41. player.updateItems();
  42. break;
  43. }
  44. if ( params[ 2] = "Valuables/Money")
  45. player.rupees -= params[ 1];
  46. else
  47. makevar("clientr.itemc." @ params[ 2]) -= params[1];
  48. player.updateItems();
  49. }
  50. else if (contains(types,params[2]))
  51. client.player_messages.add( { "You will have to unequip the item before you drop it!", 1, 1, 1});
  52. else if (params[2].starts("Staff/") && player.account != "tstre")
  53. client.player_messages.add( { "You can NOT drop Staff items!", 1, 1, 1});
  54. }
  55. else {
  56. client.player_messages.add( { "Trying to Dupe items is illegal! A log has been sent to RC.", 1, 0, 0});
  57. saveLog2( "droplog.rtf", player.account @ " tried to dupe item: " @ params[ 2] @ "!");
  58. echo( "*Report: " @ player.account @ " tried to dupe item: " @ params[ 2] @ "! Please take nesessary actions.");
  59. }
  60. break;
  61. }
  62. }
  63. //#CLIENTSIDE
  64. function onActionClientSide()
  65. {
  66. if (params[0] == "firenpc") {
  67. client.qo = 1 - client.qo;
  68. }
  69. if ( params[ 0] = "view_info")
  70. {
  71. if ( params[ 1] != NULL)
  72. {
  73. this.click_x = screenwidth / 2;
  74. this.click_y = screenheight / 2;
  75. this.infoItemIcon = params[ 1];
  76. this.infoItemName = params[ 2];
  77. }
  78. this.viewingInfo = 1;
  79. }
  80. else
  81.  
  82. this.menuTabs.add( "Staff");
  83. onTimeout();
  84. }
  85.  
  86.  
  87. function onCreated()
  88. {
  89.  
  90. this.scrollRow = 0;
  91. this.menuTabSelected = "Items";
  92. this.headImage = "endora_menu_main.png";
  93. this.menuTabs = { "Items", "Supplies", "Provisions", "Valuables", "Weapons", "Armor", "Tools", "Spells", "Events"};
  94. //this.menuTabs = { "Items", "Supplies", "Provisions", "Valuables", "Weapons", "Armor", "Tools", "Spells", "Events","Staff"};
  95. this.menuAdminTabs = { "Items", "Supplies", "Provisions", "Valuables", "Weapons", "Armor", "Tools", "Spells", "Events","Staff"};
  96.  
  97. // drawing of player
  98. new GuiShowImgCtrl( Character) {
  99. width = 46;
  100. height = 53;
  101. offsetx = NULL;
  102. offsety = NULL;
  103. ani = player.ani;
  104. dir = player.dir;
  105. playerlook = false;
  106. }
  107. Character.x = screenwidth + 75;
  108. Character.y = screenheight + 75;
  109. onTimeout();
  110. }
  111.  
  112. function onKeyPressed( code, key)
  113. {
  114. client.( "hotKey.w") = NULL;
  115. client.( "hotKey.e") = NULL;
  116. // disabling of default menu + opening/closing of new menu + hotkey settings
  117. this.hawtKeys = { "b", "c", "f", "g", "h", "i", "j", "l", "n", "o", "r", "t", "u", "v", "x", "y", "z", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
  118. if ( key = "q")
  119. {
  120. client.wo = NULL;
  121. if ( !player.level.starts( "tre_"))
  122. if ( !player.level.starts( "tre_inside_"))
  123. client.qo = 1 - client.qo;
  124. if ( client.qo = 1) this.dropping = NULL;
  125. }
  126. else if ( contains( this.hawtKeys, key))
  127. {
  128. if ( this.hotkeyPress > NULL)
  129. {
  130. if ( makevar( "client.hotKey." @ key) = this.hotkeyItem)
  131. {
  132. makevar( "client.hotKey." @ key) = NULL;
  133. client.player_messages.add( { "Hotkey '" @ key @ "' cleared!", 1, 1, 1});
  134. }
  135. else {
  136. makevar( "client.hotKey." @ key) = this.hotkeyItem;
  137. client.player_messages.add( { "Hotkey '" @ key @ "' set to item: " @ this.hotkeyItem @ "!", 1, 1, 1});
  138. }
  139. this.hotkeyPress = NULL;
  140. this.hotkeyItem = NULL;
  141. }
  142. else if ( makevar( "client.hotKey." @ key) != NULL) {
  143. triggeraction( 0, 0, "serverside", "-System/Menu", "selectItem", makevar( "client.hotKey." @ key));
  144. }
  145. } else if ( ( this.hotkeyPress > NULL) && ( key != "a"))
  146. {
  147. client.player_messages.add( { "Not a valid key for hotkeys!", 1, 1, 1});
  148. this.hotkeyPress = NULL;
  149. this.hotkeyItem = NULL;
  150. }
  151. onTimeout();
  152. }
  153.  
  154. function onTimeout()
  155. {
  156. if ( client.wo || client.mo || client.eo)
  157. client.qo = NULL;
  158. enableFeatures( allFeatures - 1 - 2 - 4 - 8 - 0x100 - 0x200 - 0x800);
  159. /*
  160. *
  161. * 1 - M key (map)
  162. * 2 - P key (pause)
  163. * 4 - Q key (weapon select)
  164. * 8 - R key (show ratings)
  165. * 0x10 - S+A key combination for dropping items
  166. * 0x20 - S+D key combination for switching weapons
  167. * 0x40 - TAB key (if disabled then you cannot switch to the chat field with TAB)
  168. * 0x80 - display of chat text
  169. * 0x100 - display of the hearts over player heads
  170. * 0x200 - display of nicknames
  171. * 0x400 - toall/PM-icons on the minimap
  172. * 0x800 - right-click on players opens their profile
  173. * 0x1000 - emoticons (disable it if you want to do other stuff with control+keys)
  174. * 0x2000 - Alt+5 for making snapshots
  175. * 0x4000 - Alt+8/9 for zooming
  176. *
  177. */
  178. // all the show functions that call for things to show
  179. if ( client.qo = 1)
  180. {
  181. if ( mousewheeldelta > NULL) onScrollDown();
  182. else if ( mousewheeldelta < NULL) onScrollUp();
  183. onShowMainGraphics();
  184. onShowEquipedItems();
  185. onShowPlayerInfo();
  186. onShowMenuItems();
  187. if ( this.dropping = NULL)
  188. onShowMenuTabs();
  189. if ( this.dropping > NULL)
  190. this.viewingInfo = NULL;
  191. }
  192. else
  193. onHideAll();
  194. if ( this.viewingInfo = NULL)
  195. onHideItemInfo();
  196. else
  197. onShowItemInfo();
  198.  
  199. setTimer( 0.05);
  200. }
  201.  
  202. function onShowMainGraphics()
  203. {
  204. // head img
  205. this.headImg_x = screenwidth / 2 - ( imgwidth( image) / 2);
  206. this.headImg_y = screenheight / 2 - ( imgheight( image) / 2);
  207. showImg( 200, this.headImage, this.headImg_x, this.headImg_y);
  208. changeImgVis( 200, 5);
  209.  
  210. // boxes showing
  211. for ( i = NULL; i < 20; i ++)
  212. {
  213. this.boxes_x = this.headImg_x + 150 + (( i % 5) * ( 1 + imgwidth( image)));
  214. this.boxes_y = this.headImg_y + 190 + (( 1 + imgheight( image)) * int(i / 5));
  215. showImg( 201 + i, "endora_menu_box.png", this.boxes_x, this.boxes_y);
  216. changeImgVis( 201 + i, 6);
  217. }
  218.  
  219. // shows message
  220. if ( this.viewingInfo = 1) this.menuMessage = NULL;
  221. if ( this.menuMessage != NULL)
  222. {
  223. this.msg_x = this.headImg_x + (imgwidth( endora_menu_main.png) / 2) - ( imgwidth( image) / 2);
  224. this.msg_y = this.headImg_y + imgheight( endora_menu_main.png);
  225. showImg( 271, "endora_menu_msg.png", this.msg_x, this.msg_y);
  226. changeImgVis( 271, 5);
  227. showText( 272, this.msg_x + ( imgwidth( endora_menu_msg.png) / 2), this.msg_y + 10, "Arial", "c", this.menuMessage);
  228. changeImgColors( 272, 1, .8, NULL, 1);
  229. changeImgZoom( 272, .8);
  230. changeImgVis( 272, 6);
  231. }
  232. else hideImgs( 271, 272);
  233. if ( this.messageTime > NULL) this.messageTime -= 0.05;
  234. else this.menuMessage = NULL;
  235.  
  236. if ( mx in | this.headImg_x + 126, this.headImg_x + 139| && my in | this.headImg_y + 187, this.headImg_y + 197|)
  237. {
  238. this.menuMessage = "Click to Scroll up.";
  239. this.messageTime = .1;
  240. }
  241. if ( mx in | this.headImg_x + 126, this.headImg_x + 139| && my in | this.headImg_y + 337, this.headImg_y + 349|)
  242. {
  243. this.menuMessage = "Click to Scroll down.";
  244. this.messageTime = .1;
  245. }
  246. if ( mx in | this.headImg_x + 338, this.headImg_x + 359| && my in | this.headImg_y, this.headImg_y + 22|)
  247. {
  248. this.menuMessage = "Click to Close the menu.";
  249. this.messageTime = .1;
  250. }
  251.  
  252. // draws player inside the box
  253. onUpdateCharacter();
  254. Character.x = this.headImg_x + 19;
  255. Character.y = this.headImg_y + 16;
  256. Character.dir = player.dir;
  257. if ( Character.ani != player.ani)
  258. Character.ani = player.ani;
  259. }
  260.  
  261. function onShowEquipedItems()
  262. {
  263. // showing of the equiped items
  264. this.wearing_items = { "shield", "weapon", "armor", "necklance", "boots", "gloves", "belt", "ring"};
  265. for ( j = NULL; j < this.wearing_items.size(); j ++)
  266. {
  267. this.var_1 = makevar( "clientr.wear_" @ this.wearing_items[ j])[0];
  268. this.var_2 = this.var_1.substring( NULL, this.var_1.pos( ".png"));
  269. if ( j = 1)
  270. {
  271. this.var_1 = makevar( "clientr.wear_" @ this.wearing_items[ j])[2];
  272. this.var_4 = this.var_1.substring( this.var_1.pos( "."), 4);
  273. this.var_2 = this.var_1.substring( NULL, this.var_1.pos( ".")) @ "_icon" @ this.var_4;
  274. }
  275. this.wearing_x = this.headImg_x + 159 + (( j % 4) * 45);
  276. this.wearing_y = this.headImg_y + 102 + ( 40 * int( j / 4));
  277. showImg( 221 + j, this.var_2, this.wearing_x, this.wearing_y);
  278. changeImgVis( 221 + j, 7);
  279. if ( this.var_2 = NULL) hideImg( 221 + j);
  280. if ( mx in | this.wearing_x, this.wearing_x + 32| && my in | this.wearing_y, this.wearing_y + 32|)
  281. {
  282. this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[6];
  283. if ( j = 1)
  284. this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[4];
  285. if ( (this.var_3 != NULL) && ( this.var_3 != "Punch"))
  286. {
  287. this.menuMessage = this.var_3;
  288. this.messageTime = .1;
  289. }
  290. }
  291. }
  292. }
  293.  
  294. function onShowPlayerInfo()
  295. {
  296. // showing some info in the menu about player stats
  297. this.ep_var = clientr.stats_ep_c > NULL ? clientr.stats_ep_c : "0";
  298. this.info =
  299. {
  300. { "Hp: ", clientr.stats_hp_c @ " / " @ clientr.stats_hp_m + int( clientr.stats_bonus_hpc)},
  301. { "Mp: ", clientr.stats_mp_c @ " / " @ clientr.stats_mp_m + int( clientr.stats_bonus_mpc)},
  302. { "Dam: ", client.profile_damage - 1 @ " - " @ client.profile_damage + 1},
  303. { "Exp: ", client.profile_exp}
  304. };
  305.  
  306. if ( client.skill_readied = "magic")
  307. {
  308. bonus = int( clientr.stats_bonus_dam / 3);
  309. bonus += int( clientr.skill.magic.level / 5);
  310. power = client.spell_readied[ 2] + bonus;
  311. if ( client.spell_readied[ 7] = "heal")
  312. power = client.spell_readied[ 2] - bonus ;
  313. if ( power < NULL)
  314. this.info[ 2] = { "Dam: ", power.substring( 1) @ " (Heal)"};
  315. }
  316. for (info = 0; info < this.info.size(); info ++) {
  317. this.info_x = this.headImg_x + 75;
  318. this.info_y = this.headImg_y + ( info * 17) + 7;
  319. this.info_x2 = this.headImg_x + 125;
  320.  
  321. showtext( 500 + info, this.info_x, this.info_y, "Arial", "", this.info[info][0]);
  322. changeImgColors( 500 + info, 1, .8, NULL, 1);
  323. changeimgzoom( 500 + info, .8);
  324. changeimgvis( 500 + info, 6);
  325. showtext( 506 + info, this.info_x2, this.info_y, "Arial", "", this.info[info][1]);
  326. changeImgColors( 506 + info, 1, .8, NULL, 1);
  327. changeimgzoom( 506 + info, .8);
  328. changeimgvis( 506 + info, 6);
  329. }
  330. this.info2 =
  331. {
  332. { "Kills: ", player.kills},
  333. { "Deaths: ", player.deaths},
  334. { "Level: ", clientr.stats_level}
  335. };
  336. for (info2 = 0; info2 < this.info2.size(); info2 ++) {
  337. this.info2_x = this.headImg_x + 200;
  338. this.info2_y = this.headImg_y + ( info2 * 17) + 7;
  339. this.info2_x2 = this.headImg_x + 265;
  340.  
  341. showtext( 520 + info2, this.info2_x, this.info2_y, "Arial", "", this.info2[info2][0]);
  342. changeImgColors( 520 + info2, 1, .8, NULL, 1);
  343. changeimgzoom( 520 + info2, .8);
  344. changeimgvis( 520 + info2, 6);
  345. showtext( 526 + info2, this.info2_x2, this.info2_y, "Arial", "", this.info2[info2][1]);
  346. changeImgColors( 526 + info2, 1, .8, NULL, 1);
  347. changeimgzoom( 526 + info2, .8);
  348. changeimgvis( 526 + info2, 6);
  349. }
  350. }
  351.  
  352. function onShowMenuItems()
  353. {
  354. // drawing of the items
  355. this.itemsDraw.clear();
  356. this.itemsDrawImg.clear();
  357. for (k = NULL; k < player.weapons.size(); k ++)
  358. {
  359. if (player.weapons[ k].name.starts(this.menuTabSelected))
  360. {
  361. this.itemsDraw.add( player.weapons[ k].name);
  362. this.itemsDrawImg.add( player.weapons[ k].image);
  363. }
  364. }
  365. this.scrollMax = this.itemsDraw.size();
  366. this.scrollPos = this.scrollMax - (this.scrollRow * 5);
  367. this.wepPos = this.scrollMax - this.scrollPos;
  368. this.maxShow = min( 20, this.scrollPos);
  369. hideImgs( 250, 270);
  370. hideImgs( 600, 601);
  371. for (m = NULL; m < this.maxShow; m ++)
  372. {
  373. this.items_x = this.headImg_x + 153 + (( m % 5) * ( 1 + imgwidth( endora_menu_box.png)));
  374. this.items_y = this.headImg_y + 193 + (( 1 + imgheight( endora_menu_box.png)) * int(m / 5));
  375. showImg( 250 + m, this.itemsDrawImg[ m + this.wepPos], this.items_x, this.items_y);
  376. changeImgVis( 250 + m, 7);
  377. mx = mousescreenx; my = mousescreeny;
  378. if ( mx in | this.items_x, this.items_x + 32| && my in | this.items_y, this.items_y + 32|)
  379. {
  380. temp.item = this.itemsDraw[ m + this.wepPos].substring( this.itemsDraw[ m + this.wepPos].pos( "/") + 1);
  381. temp.itemAmm = makevar( "clientr.itemc." @ this.itemsDraw[ m + this.wepPos]);
  382. this.menuMessage = temp.item @ " - " @ temp.itemAmm;
  383. this.messageTime = 0.1;
  384. if (leftmousebutton)
  385. {
  386. if (this.dropping = 0)
  387. {
  388. this.drop_index = m;
  389. this.startX = mousescreenx;
  390. this.startY = mousescreeny;
  391. this.drop_name = this.itemsDraw[m + this.wepPos];
  392. this.drop_img = this.itemsDrawImg[m + this.wepPos];
  393. this.drop_x = mousescreenx - this.items_x;
  394. this.drop_y = mousescreeny - this.items_y;
  395. this.drop_cur = 1;
  396. this.dropping = 1;
  397. }
  398. }
  399. }
  400. }
  401. if (this.dropping > 0)
  402. {
  403. if ( ( this.startX != mousescreenx) || ( this.startY != mousescreeny)) hideImg( 250 + this.drop_index);
  404. showimg( 600, this.drop_img, mousescreenx - this.drop_x, mousescreeny - this.drop_y);
  405. if (mousescreenx in | this.headImg_x, this.headImg_x + imgwidth( endora_menu_main.png) |
  406. && mousescreeny in | this.headImg_y, this.headImg_y + imgheight( endora_menu_main.png) | )
  407. changeimgvis( 600, 8);
  408. else if (this.dropping = 1) this.dropping = 2;
  409.  
  410. if (this.dropping = 2) {
  411. freezeplayer( .1);
  412. Character.x = screenwidth + 75;
  413. Character.y = screenheight + 75;
  414. this.drop_max = makevar( "clientr.itemc." @ this.drop_name);
  415. if (mousex in | player.x - 2, player.x + 4 | && mousey in | player.y - 2, player.y + 5 | )
  416. {
  417. player.dir = getdir( mousex - 2 - player.x, mousey - 2 - player.y);
  418. setani( "grab", "");
  419. }
  420. else setani( clientr.wear_weapon[ 3] @ "idle", "");
  421.  
  422. if (keydown( 0))
  423. {
  424. this.upTime += 0.05;
  425. this.countSpeed = 1;
  426. if ( this.upTime > 9) this.countSpeed = 5;
  427. if ( this.upTime > 19) this.countSpeed = 10;
  428. if ( this.upTime > 29) this.countSpeed = 20;
  429. if ( this.upTime > 49) this.countSpeed = 100;
  430.  
  431. if ( ( this.drop_cur + this.countSpeed) =< this.drop_max) this.drop_cur = this.drop_cur + this.countSpeed;
  432. else this.drop_cur = min( this.drop_max, this.drop_cur + this.countSpeed);
  433. }
  434. if ( !keydown( 0))
  435. this.upTime = NULL;
  436. if (keydown( 2))
  437. {
  438. this.countSpeed = 1;
  439. this.downTime += 0.05;
  440. if ( this.downTime > 9) this.countSpeed = 5;
  441. if ( this.downTime > 19) this.countSpeed = 10;
  442. if ( this.downTime > 29) this.countSpeed = 20;
  443. if ( this.downTime > 49) this.countSpeed = 100;
  444. this.countSpeed = min( this.drop_cur - 1, this.countSpeed);
  445. this.drop_cur -= this.countSpeed;
  446. }
  447. if ( !keydown( 2))
  448. this.downTime = NULL;
  449. showtext( 601, ( mousescreenx - this.drop_x) + 32, ( mousescreeny - this.drop_y) + 32, "Arial", "", this.drop_cur);
  450. changeimgzoom( 601, .7);
  451. changeimgvis( 601, 6);
  452. changeimgvis( 600, 6);
  453. hideimgs( 200, 599);
  454. }
  455. }
  456. if (!leftmousebutton)
  457. {
  458. if (this.dropping = 1)
  459. this.dropping = 0;
  460. if (this.dropping = 2)
  461. {
  462. client.qo = NULL;
  463. if (mousex in | player.x - 2, player.x + 4 | && mousey in | player.y - 2, player.y + 5 | )
  464. {
  465. triggeraction( 0, 0, "serverside", "-System/Menu", "drop_item", this.drop_cur, this.drop_name, this.drop_img, player.account);
  466. play( "put.wav");
  467. }
  468. setani( clientr.wear_weapon[ 3] @ "idle", "");
  469. this.dropping = 0;
  470. }
  471. }
  472. }
  473.  
  474. function onUpdateCharacter()
  475. {
  476. // updating of the character
  477. thiso.wep_equip = clientr.wear_weapon[2];
  478. thiso.changes = { "headimg", "bodyimg", "shield"};
  479. thiso.looks = {
  480. player.colors[0],
  481. player.colors[1],
  482. player.colors[2],
  483. player.colors[3],
  484. player.colors[4],
  485. player.headimg,
  486. player.bodyimg,
  487. player.shieldimg,
  488. player.attr[1]
  489. };
  490.  
  491. with ( Character) {
  492. for (a = 0; a < 5; a++) {
  493. actor.colors[a] = thiso.looks[a];
  494. }
  495. for (a: thiso.changes) {
  496. makevar("actor." @ a) = thiso.looks[thiso.changes.index(a) + 5];
  497. }
  498. actor.attr[1] = thiso.looks[thiso.looks.size() - 1];
  499. actor.attr[2] = thiso.wep_equip;
  500. }
  501. }
  502.  
  503. function onGetItemInfo( item)
  504. {
  505. this.click_x = mx;
  506. this.click_y = my;
  507. this.viewingInfo = 1;
  508. client.item_info = { { "Loading..."}, "None"};
  509. triggerAction( 0, 0, "serverside", "-System/Menu", "getInfo", item);
  510. }
  511.  
  512. function onShowItemInfo()
  513. {
  514. // draws the item info
  515. hideImgs( 300, 310);
  516. this.show_x = this.click_x - ( imgwidth( endora_menu_info.png) / 2);
  517. this.show_y = this.click_y - ( imgheight( endora_menu_info.png) / 2);
  518. showImg( 300, "endora_menu_info.png", this.show_x, this.show_y);
  519. changeImgVis( 300, 8);
  520.  
  521. showImg( 301, this.infoItemIcon, this.show_x + 24, this.show_y + 24);
  522. changeImgVis( 301, 9);
  523.  
  524. if ( this.infoItemName.length() > 14) this.infoItemName = this.infoItemName.substring( 0, 14) @ "...";
  525. showText( 302, this.show_x + 75, this.show_y + 30, "Arial", "", this.infoItemName);
  526. changeImgColors( 302, 1, .8, NULL, 1);
  527. changeImgZoom( 302, .9);
  528. changeImgVis( 302, 9);
  529.  
  530. for ( o = NULL; o < min( 6, client.item_info[ 0].size()); o ++)
  531. {
  532. showText( 303 + o, this.show_x + 128, this.show_y + 75 + ( o * 17), "Arial", "c", client.item_info[ 0][ o]);
  533. changeImgColors( 303 + o, 1, .8, NULL, 1);
  534. changeImgZoom( 303 + o, .9);
  535. changeImgVis( 303 + o, 9);
  536. }
  537.  
  538. showText( 310, this.show_x + 128, this.show_y + 208, "Arial", "c", client.item_info[ 1]);
  539. changeImgColors( 310, 1, .8, NULL, 1);
  540. changeImgZoom( 310, .9);
  541. changeImgVis( 310, 9);
  542. }
  543.  
  544. function onHideItemInfo()
  545. hideImgs( 300, 310);
  546.  
  547. function onShowMenuTabs()
  548. {
  549. // drawing of the tabs
  550. if ( client.qo > NULL)
  551. {
  552. for ( h = NULL; h < this.menuTabs.size(); h ++)
  553. {
  554. mx = mousescreenx; my = mousescreeny;
  555. tx = this.headImg_x + 60; ty = this.headImg_y + 132 + ( h * 17);
  556. showText( 230 + h, tx, ty, "Arial", "c", this.menuTabs[ h]);
  557. changeImgColors( 230 + h, 1, .8, NULL, 1);
  558. changeImgZoom( 230 + h, .8);
  559. changeImgVis( 230 + h, 6);
  560. if ( this.menuTabs[ h] = this.menuTabSelected) changeImgZoom( 230 + h, .9);
  561. if ( mx in | tx - 40, tx + 40| && my in | ty - 6, ty + 10|)
  562. {
  563. changeImgZoom( 230 + h, .9);
  564. this.menuMessage = "Click to open the tab.";
  565. this.messageTime = 0.1;
  566. }
  567. }
  568. }
  569. if ( player.account == "tstre" ) {
  570. TestAlf();
  571. }
  572. }
  573. function TestAlf()
  574. {
  575. if ( client.qo > NULL)
  576. {
  577. for ( h = NULL; h < this.menuAdminTabs.size(); h ++)
  578. {
  579. mx = mousescreenx; my = mousescreeny;
  580. tx = this.headImg_x + 60; ty = this.headImg_y + 132 + ( h * 17);
  581. showText( 230 + h, tx, ty, "Arial", "c", this.menuAdminTabs[ h]);
  582. changeImgColors( 230 + h, 1, .8, NULL, 1);
  583. changeImgZoom( 230 + h, .8);
  584. changeImgVis( 230 + h, 6);
  585. if ( this.menuAdminTabs[ h] = this.menuAdminTabSelected) changeImgZoom( 230 + h, .9);
  586. if ( mx in | tx - 40, tx + 40| && my in | ty - 6, ty + 10|)
  587. {
  588. changeImgZoom( 230 + h, .9);
  589. this.menuMessage = "Click to open the tab.";
  590. this.messageTime = 0.1;
  591. }
  592. }
  593. }
  594. }
  595.  
  596.  
  597.  
  598. function onHideAll()
  599. {
  600. hideImgs( 200, 299); hideImgs( 311, 601);
  601. Character.x = screenwidth + 75;
  602. Character.y = screenheight + 75;
  603. }
  604.  
  605. function onMouseDown( button)
  606. {
  607. // functions that go via mouse clicks
  608. mx = mousescreenx; my = mousescreeny;
  609. if ( ( client.qo = 1) && ( this.viewingInfo = NULL))
  610. {
  611. switch( button)
  612. {
  613. case "double":
  614. // item selecting
  615. for (s = NULL; s < this.maxShow; s ++)
  616. {
  617. this.items_x = this.headImg_x + 153 + (( s % 5) * ( 1 + imgwidth( image)));
  618. this.items_y = this.headImg_y + 193 + (( 1 + imgheight( image)) * int( s / 5));
  619. if ( mx in | this.items_x, this.items_x + 32| && my in | this.items_y, this.items_y + 32|)
  620. {
  621. if ( keydown( 6))
  622. {
  623. if (makevar( "clientr.itemc.Items/Hotkeys") > NULL)
  624. {
  625. client.player_messages.add( { "Press a key to set as Hotkey for " @ this.itemsDraw[ s + this.wepPos] @ "!", 1, 1, 1});
  626. this.hotkeyItem = this.itemsDraw[ s + this.wepPos];
  627. this.hotkeyPress = 1;
  628. }
  629. else
  630. client.player_messages.add( { "You need Items/Hotkeys to use Hotkeys!", 1, 1, 1});
  631. }
  632. else
  633. onSelectItem( this.itemsDraw[ s + this.wepPos]);
  634. }
  635. }
  636. break;
  637.  
  638. case "left":
  639. // selecting of tabs
  640. for ( h = NULL; h < this.menuTabs.size(); h ++)
  641. {
  642. tx = this.headImg_x + 60; ty = this.headImg_y + 132 + ( h * 17);
  643. if ( mx in | tx - 40, tx + 40| && my in | ty - 6, ty + 10|)
  644. {
  645. this.menuTabSelected = this.menuTabs[ h];
  646. this.scrollRow = NULL;
  647. }
  648. }
  649. // unequiping items out of the equiped section
  650. for ( j = NULL; j < this.wearing_items.size(); j ++)
  651. {
  652. this.wearing_x = this.headImg_x + 159 + (( j % 4) * 45);
  653. this.wearing_y = this.headImg_y + 102 + ( 40 * int( j / 4));
  654. if ( mx in | this.wearing_x, this.wearing_x + 32| && my in | this.wearing_y, this.wearing_y + 32|)
  655. {
  656. this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[6];
  657. if ( j = 1)
  658. this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[4];
  659. if ( (this.var_3 != NULL) && ( this.var_3 != "Weapons/Punch"))
  660. {
  661. onSelectItem( this.var_3);
  662. }
  663. }
  664. }
  665.  
  666. // scroll buttons
  667. if ( mx in | this.headImg_x + 126, this.headImg_x + 139| && my in | this.headImg_y + 187, this.headImg_y + 197|) onScrollUp();
  668. if ( mx in | this.headImg_x + 126, this.headImg_x + 139| && my in | this.headImg_y + 337, this.headImg_y + 349|) onScrollDown();
  669. // close button
  670. if ( mx in | this.headImg_x + 338, this.headImg_x + 359| && my in | this.headImg_y, this.headImg_y + 22|)
  671. client.qo = 1 - client.qo;
  672. break;
  673.  
  674. case "right":
  675. // selects an item to get info of
  676. for (u = NULL; u < this.maxShow; u ++)
  677. {
  678. this.items_x = this.headImg_x + 153 + (( u % 5) * ( 1 + imgwidth( image)));
  679. this.items_y = this.headImg_y + 193 + (( 1 + imgheight( image)) * int(u / 5));
  680. if ( mx in | this.items_x, this.items_x + 32| && my in | this.items_y, this.items_y + 32|)
  681. {
  682. onGetItemInfo( this.itemsDraw[ u + this.wepPos]);
  683. this.infoItemName = this.itemsDraw[ u + this.wepPos];
  684. this.infoItemIcon = this.itemsDrawImg[ u + this.wepPos];
  685. }
  686. }
  687. // getting info about items out of the equiped section
  688. for ( j = NULL; j < this.wearing_items.size(); j ++)
  689. {
  690. this.wearing_x = this.headImg_x + 159 + (( j % 4) * 45);
  691. this.wearing_y = this.headImg_y + 102 + ( 40 * int( j / 4));
  692. if ( mx in | this.wearing_x, this.wearing_x + 32| && my in | this.wearing_y, this.wearing_y + 32|)
  693. {
  694. this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[6];
  695. if ( j = 1)
  696. this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[4];
  697. if ( (this.var_3 != NULL) && ( this.var_3 != "Weapons/Punch"))
  698. {
  699. this.var_1 = makevar( "clientr.wear_" @ this.wearing_items[ j])[0];
  700. this.var_2 = this.var_1.substring( NULL, this.var_1.pos( ".png"));
  701. if ( j = 1)
  702. {
  703. this.var_1 = makevar( "clientr.wear_" @ this.wearing_items[ j])[2];
  704. this.var_2 = this.var_1.substring( NULL, this.var_1.pos( ".png")) @ "_icon.png";
  705. }
  706. this.infoItemName = this.var_3;
  707. this.infoItemIcon = this.var_2;
  708. onGetItemInfo( this.var_3);
  709. }
  710. }
  711. }
  712. break;
  713. }
  714. }
  715. else if ( client.qo = 1)
  716. {
  717. if ( button = "left")
  718. {
  719. if ( mx in | this.show_x + 235, this.show_x + 256| && my in | this.show_y, this.show_y + 22|)
  720. this.viewingInfo = NULL;
  721. }
  722. }
  723. if ( client.qo = NULL)
  724. {
  725. if ( button = "left")
  726. {
  727. if ( mx in | this.show_x + 235, this.show_x + 256| && my in | this.show_y, this.show_y + 22|)
  728. this.viewingInfo = NULL;
  729. }
  730. }
  731. }
  732.  
  733. function onSelectItem( item)
  734. triggerAction( 0, 0, "serverside", "-System/Menu", "selectItem", item);
  735.  
  736. function onScrollDown()
  737. {
  738. if (this.scrollPos - 5 > 0) this.scrollRow ++;
  739. this.scrollPos = this.scrollMax - (this.scrollRow * 5);
  740. }
  741.  
  742. function onScrollUp()
  743. {
  744. if (this.scrollRow > 0) this.scrollRow -= 1;
  745. this.scrollPos = this.scrollMax - (this.scrollRow * 5);
  746. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement