Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onActionServerSide()
- {
- switch( params[ 0])
- {
- // trigger to the weapon so it equips / wears or whatever it must do
- case "selectItem":
- if ( clientr.stats_hp_c > NULL)
- if ( makevar( "clientr.itemc." @ params[ 1]) > NULL) triggerAction( 0, 0, "clientside", params[ 1], "equip");
- break;
- // gets info from the database: info_db about an item
- case "getInfo":
- with( findNPC( "info_db"))
- thiso.INFO = makevar( "this.info." @ params[ 1]);
- client.item_info = thiso.INFO;
- if ( client.item_info = NULL) client.item_info = { { "No info available yet!", "Excuses."}, "None"};
- triggerAction( 0, 0, "clientside", "-System/Menu", "view_info", params[ 2], params[ 1]);
- break;
- // item drop
- case "drop_item":
- if ( makevar( "clientr.itemc." @ params[ 2]) >= params[ 1])
- {
- types = { clientr.wear_weapon[ 4], clientr.wear_belt[ 6], clientr.wear_shield[ 6], clientr.wear_boots[ 6], clientr.wear_armor[ 6],
- clientr.wear_gloves[ 6], clientr.wear_ring[ 6], clientr.wear_necklance[ 6], clientr.wear_spell[ 0]};
- if ( ( (!contains( types, params[2])) || ( makevar( "clientr.itemc." @ params[ 2]) > params[ 1])) && (!params[ 2].starts("Staff/"))) {
- saveLog2( "endora_droplog.rtf", player.account @ " dropped " @ params[1] @ " " @ params[2] @ "(s) in level " @ player.level @ "!");
- putnpc2( player.x + .5 + vecx( player.dir) * 2, player.y + 1 + vecy( player.dir) * 2, "join(\"item_dropped\");");
- with( npcs[ npcscount - 1]) {
- this.amm = params[ 1];
- this.nam = params[ 2];
- this.img = params[ 3];
- this.own = params[ 4];
- }
- //This is for the hat system
- if (params[2].starts("Items/Hat"))
- {
- client.player_messages.add( { "You have dropped your hat, therefor it has been taken off your head!", 1, 0, 0});
- player.attr[1] = "";
- makevar("clientr.itemc." @ params[ 2]) -= params[1];
- player.updateItems();
- break;
- }
- if ( params[ 2] = "Valuables/Money")
- player.rupees -= params[ 1];
- else
- makevar("clientr.itemc." @ params[ 2]) -= params[1];
- player.updateItems();
- }
- else if (contains(types,params[2]))
- client.player_messages.add( { "You will have to unequip the item before you drop it!", 1, 1, 1});
- else if (params[2].starts("Staff/") && player.account != "tstre")
- client.player_messages.add( { "You can NOT drop Staff items!", 1, 1, 1});
- }
- else {
- client.player_messages.add( { "Trying to Dupe items is illegal! A log has been sent to RC.", 1, 0, 0});
- saveLog2( "droplog.rtf", player.account @ " tried to dupe item: " @ params[ 2] @ "!");
- echo( "*Report: " @ player.account @ " tried to dupe item: " @ params[ 2] @ "! Please take nesessary actions.");
- }
- break;
- }
- }
- //#CLIENTSIDE
- function onActionClientSide()
- {
- if (params[0] == "firenpc") {
- client.qo = 1 - client.qo;
- }
- if ( params[ 0] = "view_info")
- {
- if ( params[ 1] != NULL)
- {
- this.click_x = screenwidth / 2;
- this.click_y = screenheight / 2;
- this.infoItemIcon = params[ 1];
- this.infoItemName = params[ 2];
- }
- this.viewingInfo = 1;
- }
- else
- this.menuTabs.add( "Staff");
- onTimeout();
- }
- function onCreated()
- {
- this.scrollRow = 0;
- this.menuTabSelected = "Items";
- this.headImage = "endora_menu_main.png";
- this.menuTabs = { "Items", "Supplies", "Provisions", "Valuables", "Weapons", "Armor", "Tools", "Spells", "Events"};
- //this.menuTabs = { "Items", "Supplies", "Provisions", "Valuables", "Weapons", "Armor", "Tools", "Spells", "Events","Staff"};
- this.menuAdminTabs = { "Items", "Supplies", "Provisions", "Valuables", "Weapons", "Armor", "Tools", "Spells", "Events","Staff"};
- // drawing of player
- new GuiShowImgCtrl( Character) {
- width = 46;
- height = 53;
- offsetx = NULL;
- offsety = NULL;
- ani = player.ani;
- dir = player.dir;
- playerlook = false;
- }
- Character.x = screenwidth + 75;
- Character.y = screenheight + 75;
- onTimeout();
- }
- function onKeyPressed( code, key)
- {
- client.( "hotKey.w") = NULL;
- client.( "hotKey.e") = NULL;
- // disabling of default menu + opening/closing of new menu + hotkey settings
- 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};
- if ( key = "q")
- {
- client.wo = NULL;
- if ( !player.level.starts( "tre_"))
- if ( !player.level.starts( "tre_inside_"))
- client.qo = 1 - client.qo;
- if ( client.qo = 1) this.dropping = NULL;
- }
- else if ( contains( this.hawtKeys, key))
- {
- if ( this.hotkeyPress > NULL)
- {
- if ( makevar( "client.hotKey." @ key) = this.hotkeyItem)
- {
- makevar( "client.hotKey." @ key) = NULL;
- client.player_messages.add( { "Hotkey '" @ key @ "' cleared!", 1, 1, 1});
- }
- else {
- makevar( "client.hotKey." @ key) = this.hotkeyItem;
- client.player_messages.add( { "Hotkey '" @ key @ "' set to item: " @ this.hotkeyItem @ "!", 1, 1, 1});
- }
- this.hotkeyPress = NULL;
- this.hotkeyItem = NULL;
- }
- else if ( makevar( "client.hotKey." @ key) != NULL) {
- triggeraction( 0, 0, "serverside", "-System/Menu", "selectItem", makevar( "client.hotKey." @ key));
- }
- } else if ( ( this.hotkeyPress > NULL) && ( key != "a"))
- {
- client.player_messages.add( { "Not a valid key for hotkeys!", 1, 1, 1});
- this.hotkeyPress = NULL;
- this.hotkeyItem = NULL;
- }
- onTimeout();
- }
- function onTimeout()
- {
- if ( client.wo || client.mo || client.eo)
- client.qo = NULL;
- enableFeatures( allFeatures - 1 - 2 - 4 - 8 - 0x100 - 0x200 - 0x800);
- /*
- *
- * 1 - M key (map)
- * 2 - P key (pause)
- * 4 - Q key (weapon select)
- * 8 - R key (show ratings)
- * 0x10 - S+A key combination for dropping items
- * 0x20 - S+D key combination for switching weapons
- * 0x40 - TAB key (if disabled then you cannot switch to the chat field with TAB)
- * 0x80 - display of chat text
- * 0x100 - display of the hearts over player heads
- * 0x200 - display of nicknames
- * 0x400 - toall/PM-icons on the minimap
- * 0x800 - right-click on players opens their profile
- * 0x1000 - emoticons (disable it if you want to do other stuff with control+keys)
- * 0x2000 - Alt+5 for making snapshots
- * 0x4000 - Alt+8/9 for zooming
- *
- */
- // all the show functions that call for things to show
- if ( client.qo = 1)
- {
- if ( mousewheeldelta > NULL) onScrollDown();
- else if ( mousewheeldelta < NULL) onScrollUp();
- onShowMainGraphics();
- onShowEquipedItems();
- onShowPlayerInfo();
- onShowMenuItems();
- if ( this.dropping = NULL)
- onShowMenuTabs();
- if ( this.dropping > NULL)
- this.viewingInfo = NULL;
- }
- else
- onHideAll();
- if ( this.viewingInfo = NULL)
- onHideItemInfo();
- else
- onShowItemInfo();
- setTimer( 0.05);
- }
- function onShowMainGraphics()
- {
- // head img
- this.headImg_x = screenwidth / 2 - ( imgwidth( image) / 2);
- this.headImg_y = screenheight / 2 - ( imgheight( image) / 2);
- showImg( 200, this.headImage, this.headImg_x, this.headImg_y);
- changeImgVis( 200, 5);
- // boxes showing
- for ( i = NULL; i < 20; i ++)
- {
- this.boxes_x = this.headImg_x + 150 + (( i % 5) * ( 1 + imgwidth( image)));
- this.boxes_y = this.headImg_y + 190 + (( 1 + imgheight( image)) * int(i / 5));
- showImg( 201 + i, "endora_menu_box.png", this.boxes_x, this.boxes_y);
- changeImgVis( 201 + i, 6);
- }
- // shows message
- if ( this.viewingInfo = 1) this.menuMessage = NULL;
- if ( this.menuMessage != NULL)
- {
- this.msg_x = this.headImg_x + (imgwidth( endora_menu_main.png) / 2) - ( imgwidth( image) / 2);
- this.msg_y = this.headImg_y + imgheight( endora_menu_main.png);
- showImg( 271, "endora_menu_msg.png", this.msg_x, this.msg_y);
- changeImgVis( 271, 5);
- showText( 272, this.msg_x + ( imgwidth( endora_menu_msg.png) / 2), this.msg_y + 10, "Arial", "c", this.menuMessage);
- changeImgColors( 272, 1, .8, NULL, 1);
- changeImgZoom( 272, .8);
- changeImgVis( 272, 6);
- }
- else hideImgs( 271, 272);
- if ( this.messageTime > NULL) this.messageTime -= 0.05;
- else this.menuMessage = NULL;
- if ( mx in | this.headImg_x + 126, this.headImg_x + 139| && my in | this.headImg_y + 187, this.headImg_y + 197|)
- {
- this.menuMessage = "Click to Scroll up.";
- this.messageTime = .1;
- }
- if ( mx in | this.headImg_x + 126, this.headImg_x + 139| && my in | this.headImg_y + 337, this.headImg_y + 349|)
- {
- this.menuMessage = "Click to Scroll down.";
- this.messageTime = .1;
- }
- if ( mx in | this.headImg_x + 338, this.headImg_x + 359| && my in | this.headImg_y, this.headImg_y + 22|)
- {
- this.menuMessage = "Click to Close the menu.";
- this.messageTime = .1;
- }
- // draws player inside the box
- onUpdateCharacter();
- Character.x = this.headImg_x + 19;
- Character.y = this.headImg_y + 16;
- Character.dir = player.dir;
- if ( Character.ani != player.ani)
- Character.ani = player.ani;
- }
- function onShowEquipedItems()
- {
- // showing of the equiped items
- this.wearing_items = { "shield", "weapon", "armor", "necklance", "boots", "gloves", "belt", "ring"};
- for ( j = NULL; j < this.wearing_items.size(); j ++)
- {
- this.var_1 = makevar( "clientr.wear_" @ this.wearing_items[ j])[0];
- this.var_2 = this.var_1.substring( NULL, this.var_1.pos( ".png"));
- if ( j = 1)
- {
- this.var_1 = makevar( "clientr.wear_" @ this.wearing_items[ j])[2];
- this.var_4 = this.var_1.substring( this.var_1.pos( "."), 4);
- this.var_2 = this.var_1.substring( NULL, this.var_1.pos( ".")) @ "_icon" @ this.var_4;
- }
- this.wearing_x = this.headImg_x + 159 + (( j % 4) * 45);
- this.wearing_y = this.headImg_y + 102 + ( 40 * int( j / 4));
- showImg( 221 + j, this.var_2, this.wearing_x, this.wearing_y);
- changeImgVis( 221 + j, 7);
- if ( this.var_2 = NULL) hideImg( 221 + j);
- if ( mx in | this.wearing_x, this.wearing_x + 32| && my in | this.wearing_y, this.wearing_y + 32|)
- {
- this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[6];
- if ( j = 1)
- this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[4];
- if ( (this.var_3 != NULL) && ( this.var_3 != "Punch"))
- {
- this.menuMessage = this.var_3;
- this.messageTime = .1;
- }
- }
- }
- }
- function onShowPlayerInfo()
- {
- // showing some info in the menu about player stats
- this.ep_var = clientr.stats_ep_c > NULL ? clientr.stats_ep_c : "0";
- this.info =
- {
- { "Hp: ", clientr.stats_hp_c @ " / " @ clientr.stats_hp_m + int( clientr.stats_bonus_hpc)},
- { "Mp: ", clientr.stats_mp_c @ " / " @ clientr.stats_mp_m + int( clientr.stats_bonus_mpc)},
- { "Dam: ", client.profile_damage - 1 @ " - " @ client.profile_damage + 1},
- { "Exp: ", client.profile_exp}
- };
- if ( client.skill_readied = "magic")
- {
- bonus = int( clientr.stats_bonus_dam / 3);
- bonus += int( clientr.skill.magic.level / 5);
- power = client.spell_readied[ 2] + bonus;
- if ( client.spell_readied[ 7] = "heal")
- power = client.spell_readied[ 2] - bonus ;
- if ( power < NULL)
- this.info[ 2] = { "Dam: ", power.substring( 1) @ " (Heal)"};
- }
- for (info = 0; info < this.info.size(); info ++) {
- this.info_x = this.headImg_x + 75;
- this.info_y = this.headImg_y + ( info * 17) + 7;
- this.info_x2 = this.headImg_x + 125;
- showtext( 500 + info, this.info_x, this.info_y, "Arial", "", this.info[info][0]);
- changeImgColors( 500 + info, 1, .8, NULL, 1);
- changeimgzoom( 500 + info, .8);
- changeimgvis( 500 + info, 6);
- showtext( 506 + info, this.info_x2, this.info_y, "Arial", "", this.info[info][1]);
- changeImgColors( 506 + info, 1, .8, NULL, 1);
- changeimgzoom( 506 + info, .8);
- changeimgvis( 506 + info, 6);
- }
- this.info2 =
- {
- { "Kills: ", player.kills},
- { "Deaths: ", player.deaths},
- { "Level: ", clientr.stats_level}
- };
- for (info2 = 0; info2 < this.info2.size(); info2 ++) {
- this.info2_x = this.headImg_x + 200;
- this.info2_y = this.headImg_y + ( info2 * 17) + 7;
- this.info2_x2 = this.headImg_x + 265;
- showtext( 520 + info2, this.info2_x, this.info2_y, "Arial", "", this.info2[info2][0]);
- changeImgColors( 520 + info2, 1, .8, NULL, 1);
- changeimgzoom( 520 + info2, .8);
- changeimgvis( 520 + info2, 6);
- showtext( 526 + info2, this.info2_x2, this.info2_y, "Arial", "", this.info2[info2][1]);
- changeImgColors( 526 + info2, 1, .8, NULL, 1);
- changeimgzoom( 526 + info2, .8);
- changeimgvis( 526 + info2, 6);
- }
- }
- function onShowMenuItems()
- {
- // drawing of the items
- this.itemsDraw.clear();
- this.itemsDrawImg.clear();
- for (k = NULL; k < player.weapons.size(); k ++)
- {
- if (player.weapons[ k].name.starts(this.menuTabSelected))
- {
- this.itemsDraw.add( player.weapons[ k].name);
- this.itemsDrawImg.add( player.weapons[ k].image);
- }
- }
- this.scrollMax = this.itemsDraw.size();
- this.scrollPos = this.scrollMax - (this.scrollRow * 5);
- this.wepPos = this.scrollMax - this.scrollPos;
- this.maxShow = min( 20, this.scrollPos);
- hideImgs( 250, 270);
- hideImgs( 600, 601);
- for (m = NULL; m < this.maxShow; m ++)
- {
- this.items_x = this.headImg_x + 153 + (( m % 5) * ( 1 + imgwidth( endora_menu_box.png)));
- this.items_y = this.headImg_y + 193 + (( 1 + imgheight( endora_menu_box.png)) * int(m / 5));
- showImg( 250 + m, this.itemsDrawImg[ m + this.wepPos], this.items_x, this.items_y);
- changeImgVis( 250 + m, 7);
- mx = mousescreenx; my = mousescreeny;
- if ( mx in | this.items_x, this.items_x + 32| && my in | this.items_y, this.items_y + 32|)
- {
- temp.item = this.itemsDraw[ m + this.wepPos].substring( this.itemsDraw[ m + this.wepPos].pos( "/") + 1);
- temp.itemAmm = makevar( "clientr.itemc." @ this.itemsDraw[ m + this.wepPos]);
- this.menuMessage = temp.item @ " - " @ temp.itemAmm;
- this.messageTime = 0.1;
- if (leftmousebutton)
- {
- if (this.dropping = 0)
- {
- this.drop_index = m;
- this.startX = mousescreenx;
- this.startY = mousescreeny;
- this.drop_name = this.itemsDraw[m + this.wepPos];
- this.drop_img = this.itemsDrawImg[m + this.wepPos];
- this.drop_x = mousescreenx - this.items_x;
- this.drop_y = mousescreeny - this.items_y;
- this.drop_cur = 1;
- this.dropping = 1;
- }
- }
- }
- }
- if (this.dropping > 0)
- {
- if ( ( this.startX != mousescreenx) || ( this.startY != mousescreeny)) hideImg( 250 + this.drop_index);
- showimg( 600, this.drop_img, mousescreenx - this.drop_x, mousescreeny - this.drop_y);
- if (mousescreenx in | this.headImg_x, this.headImg_x + imgwidth( endora_menu_main.png) |
- && mousescreeny in | this.headImg_y, this.headImg_y + imgheight( endora_menu_main.png) | )
- changeimgvis( 600, 8);
- else if (this.dropping = 1) this.dropping = 2;
- if (this.dropping = 2) {
- freezeplayer( .1);
- Character.x = screenwidth + 75;
- Character.y = screenheight + 75;
- this.drop_max = makevar( "clientr.itemc." @ this.drop_name);
- if (mousex in | player.x - 2, player.x + 4 | && mousey in | player.y - 2, player.y + 5 | )
- {
- player.dir = getdir( mousex - 2 - player.x, mousey - 2 - player.y);
- setani( "grab", "");
- }
- else setani( clientr.wear_weapon[ 3] @ "idle", "");
- if (keydown( 0))
- {
- this.upTime += 0.05;
- this.countSpeed = 1;
- if ( this.upTime > 9) this.countSpeed = 5;
- if ( this.upTime > 19) this.countSpeed = 10;
- if ( this.upTime > 29) this.countSpeed = 20;
- if ( this.upTime > 49) this.countSpeed = 100;
- if ( ( this.drop_cur + this.countSpeed) =< this.drop_max) this.drop_cur = this.drop_cur + this.countSpeed;
- else this.drop_cur = min( this.drop_max, this.drop_cur + this.countSpeed);
- }
- if ( !keydown( 0))
- this.upTime = NULL;
- if (keydown( 2))
- {
- this.countSpeed = 1;
- this.downTime += 0.05;
- if ( this.downTime > 9) this.countSpeed = 5;
- if ( this.downTime > 19) this.countSpeed = 10;
- if ( this.downTime > 29) this.countSpeed = 20;
- if ( this.downTime > 49) this.countSpeed = 100;
- this.countSpeed = min( this.drop_cur - 1, this.countSpeed);
- this.drop_cur -= this.countSpeed;
- }
- if ( !keydown( 2))
- this.downTime = NULL;
- showtext( 601, ( mousescreenx - this.drop_x) + 32, ( mousescreeny - this.drop_y) + 32, "Arial", "", this.drop_cur);
- changeimgzoom( 601, .7);
- changeimgvis( 601, 6);
- changeimgvis( 600, 6);
- hideimgs( 200, 599);
- }
- }
- if (!leftmousebutton)
- {
- if (this.dropping = 1)
- this.dropping = 0;
- if (this.dropping = 2)
- {
- client.qo = NULL;
- if (mousex in | player.x - 2, player.x + 4 | && mousey in | player.y - 2, player.y + 5 | )
- {
- triggeraction( 0, 0, "serverside", "-System/Menu", "drop_item", this.drop_cur, this.drop_name, this.drop_img, player.account);
- play( "put.wav");
- }
- setani( clientr.wear_weapon[ 3] @ "idle", "");
- this.dropping = 0;
- }
- }
- }
- function onUpdateCharacter()
- {
- // updating of the character
- thiso.wep_equip = clientr.wear_weapon[2];
- thiso.changes = { "headimg", "bodyimg", "shield"};
- thiso.looks = {
- player.colors[0],
- player.colors[1],
- player.colors[2],
- player.colors[3],
- player.colors[4],
- player.headimg,
- player.bodyimg,
- player.shieldimg,
- player.attr[1]
- };
- with ( Character) {
- for (a = 0; a < 5; a++) {
- actor.colors[a] = thiso.looks[a];
- }
- for (a: thiso.changes) {
- makevar("actor." @ a) = thiso.looks[thiso.changes.index(a) + 5];
- }
- actor.attr[1] = thiso.looks[thiso.looks.size() - 1];
- actor.attr[2] = thiso.wep_equip;
- }
- }
- function onGetItemInfo( item)
- {
- this.click_x = mx;
- this.click_y = my;
- this.viewingInfo = 1;
- client.item_info = { { "Loading..."}, "None"};
- triggerAction( 0, 0, "serverside", "-System/Menu", "getInfo", item);
- }
- function onShowItemInfo()
- {
- // draws the item info
- hideImgs( 300, 310);
- this.show_x = this.click_x - ( imgwidth( endora_menu_info.png) / 2);
- this.show_y = this.click_y - ( imgheight( endora_menu_info.png) / 2);
- showImg( 300, "endora_menu_info.png", this.show_x, this.show_y);
- changeImgVis( 300, 8);
- showImg( 301, this.infoItemIcon, this.show_x + 24, this.show_y + 24);
- changeImgVis( 301, 9);
- if ( this.infoItemName.length() > 14) this.infoItemName = this.infoItemName.substring( 0, 14) @ "...";
- showText( 302, this.show_x + 75, this.show_y + 30, "Arial", "", this.infoItemName);
- changeImgColors( 302, 1, .8, NULL, 1);
- changeImgZoom( 302, .9);
- changeImgVis( 302, 9);
- for ( o = NULL; o < min( 6, client.item_info[ 0].size()); o ++)
- {
- showText( 303 + o, this.show_x + 128, this.show_y + 75 + ( o * 17), "Arial", "c", client.item_info[ 0][ o]);
- changeImgColors( 303 + o, 1, .8, NULL, 1);
- changeImgZoom( 303 + o, .9);
- changeImgVis( 303 + o, 9);
- }
- showText( 310, this.show_x + 128, this.show_y + 208, "Arial", "c", client.item_info[ 1]);
- changeImgColors( 310, 1, .8, NULL, 1);
- changeImgZoom( 310, .9);
- changeImgVis( 310, 9);
- }
- function onHideItemInfo()
- hideImgs( 300, 310);
- function onShowMenuTabs()
- {
- // drawing of the tabs
- if ( client.qo > NULL)
- {
- for ( h = NULL; h < this.menuTabs.size(); h ++)
- {
- mx = mousescreenx; my = mousescreeny;
- tx = this.headImg_x + 60; ty = this.headImg_y + 132 + ( h * 17);
- showText( 230 + h, tx, ty, "Arial", "c", this.menuTabs[ h]);
- changeImgColors( 230 + h, 1, .8, NULL, 1);
- changeImgZoom( 230 + h, .8);
- changeImgVis( 230 + h, 6);
- if ( this.menuTabs[ h] = this.menuTabSelected) changeImgZoom( 230 + h, .9);
- if ( mx in | tx - 40, tx + 40| && my in | ty - 6, ty + 10|)
- {
- changeImgZoom( 230 + h, .9);
- this.menuMessage = "Click to open the tab.";
- this.messageTime = 0.1;
- }
- }
- }
- if ( player.account == "tstre" ) {
- TestAlf();
- }
- }
- function TestAlf()
- {
- if ( client.qo > NULL)
- {
- for ( h = NULL; h < this.menuAdminTabs.size(); h ++)
- {
- mx = mousescreenx; my = mousescreeny;
- tx = this.headImg_x + 60; ty = this.headImg_y + 132 + ( h * 17);
- showText( 230 + h, tx, ty, "Arial", "c", this.menuAdminTabs[ h]);
- changeImgColors( 230 + h, 1, .8, NULL, 1);
- changeImgZoom( 230 + h, .8);
- changeImgVis( 230 + h, 6);
- if ( this.menuAdminTabs[ h] = this.menuAdminTabSelected) changeImgZoom( 230 + h, .9);
- if ( mx in | tx - 40, tx + 40| && my in | ty - 6, ty + 10|)
- {
- changeImgZoom( 230 + h, .9);
- this.menuMessage = "Click to open the tab.";
- this.messageTime = 0.1;
- }
- }
- }
- }
- function onHideAll()
- {
- hideImgs( 200, 299); hideImgs( 311, 601);
- Character.x = screenwidth + 75;
- Character.y = screenheight + 75;
- }
- function onMouseDown( button)
- {
- // functions that go via mouse clicks
- mx = mousescreenx; my = mousescreeny;
- if ( ( client.qo = 1) && ( this.viewingInfo = NULL))
- {
- switch( button)
- {
- case "double":
- // item selecting
- for (s = NULL; s < this.maxShow; s ++)
- {
- this.items_x = this.headImg_x + 153 + (( s % 5) * ( 1 + imgwidth( image)));
- this.items_y = this.headImg_y + 193 + (( 1 + imgheight( image)) * int( s / 5));
- if ( mx in | this.items_x, this.items_x + 32| && my in | this.items_y, this.items_y + 32|)
- {
- if ( keydown( 6))
- {
- if (makevar( "clientr.itemc.Items/Hotkeys") > NULL)
- {
- client.player_messages.add( { "Press a key to set as Hotkey for " @ this.itemsDraw[ s + this.wepPos] @ "!", 1, 1, 1});
- this.hotkeyItem = this.itemsDraw[ s + this.wepPos];
- this.hotkeyPress = 1;
- }
- else
- client.player_messages.add( { "You need Items/Hotkeys to use Hotkeys!", 1, 1, 1});
- }
- else
- onSelectItem( this.itemsDraw[ s + this.wepPos]);
- }
- }
- break;
- case "left":
- // selecting of tabs
- for ( h = NULL; h < this.menuTabs.size(); h ++)
- {
- tx = this.headImg_x + 60; ty = this.headImg_y + 132 + ( h * 17);
- if ( mx in | tx - 40, tx + 40| && my in | ty - 6, ty + 10|)
- {
- this.menuTabSelected = this.menuTabs[ h];
- this.scrollRow = NULL;
- }
- }
- // unequiping items out of the equiped section
- for ( j = NULL; j < this.wearing_items.size(); j ++)
- {
- this.wearing_x = this.headImg_x + 159 + (( j % 4) * 45);
- this.wearing_y = this.headImg_y + 102 + ( 40 * int( j / 4));
- if ( mx in | this.wearing_x, this.wearing_x + 32| && my in | this.wearing_y, this.wearing_y + 32|)
- {
- this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[6];
- if ( j = 1)
- this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[4];
- if ( (this.var_3 != NULL) && ( this.var_3 != "Weapons/Punch"))
- {
- onSelectItem( this.var_3);
- }
- }
- }
- // scroll buttons
- if ( mx in | this.headImg_x + 126, this.headImg_x + 139| && my in | this.headImg_y + 187, this.headImg_y + 197|) onScrollUp();
- if ( mx in | this.headImg_x + 126, this.headImg_x + 139| && my in | this.headImg_y + 337, this.headImg_y + 349|) onScrollDown();
- // close button
- if ( mx in | this.headImg_x + 338, this.headImg_x + 359| && my in | this.headImg_y, this.headImg_y + 22|)
- client.qo = 1 - client.qo;
- break;
- case "right":
- // selects an item to get info of
- for (u = NULL; u < this.maxShow; u ++)
- {
- this.items_x = this.headImg_x + 153 + (( u % 5) * ( 1 + imgwidth( image)));
- this.items_y = this.headImg_y + 193 + (( 1 + imgheight( image)) * int(u / 5));
- if ( mx in | this.items_x, this.items_x + 32| && my in | this.items_y, this.items_y + 32|)
- {
- onGetItemInfo( this.itemsDraw[ u + this.wepPos]);
- this.infoItemName = this.itemsDraw[ u + this.wepPos];
- this.infoItemIcon = this.itemsDrawImg[ u + this.wepPos];
- }
- }
- // getting info about items out of the equiped section
- for ( j = NULL; j < this.wearing_items.size(); j ++)
- {
- this.wearing_x = this.headImg_x + 159 + (( j % 4) * 45);
- this.wearing_y = this.headImg_y + 102 + ( 40 * int( j / 4));
- if ( mx in | this.wearing_x, this.wearing_x + 32| && my in | this.wearing_y, this.wearing_y + 32|)
- {
- this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[6];
- if ( j = 1)
- this.var_3 = makevar( "clientr.wear_" @ this.wearing_items[ j])[4];
- if ( (this.var_3 != NULL) && ( this.var_3 != "Weapons/Punch"))
- {
- this.var_1 = makevar( "clientr.wear_" @ this.wearing_items[ j])[0];
- this.var_2 = this.var_1.substring( NULL, this.var_1.pos( ".png"));
- if ( j = 1)
- {
- this.var_1 = makevar( "clientr.wear_" @ this.wearing_items[ j])[2];
- this.var_2 = this.var_1.substring( NULL, this.var_1.pos( ".png")) @ "_icon.png";
- }
- this.infoItemName = this.var_3;
- this.infoItemIcon = this.var_2;
- onGetItemInfo( this.var_3);
- }
- }
- }
- break;
- }
- }
- else if ( client.qo = 1)
- {
- if ( button = "left")
- {
- if ( mx in | this.show_x + 235, this.show_x + 256| && my in | this.show_y, this.show_y + 22|)
- this.viewingInfo = NULL;
- }
- }
- if ( client.qo = NULL)
- {
- if ( button = "left")
- {
- if ( mx in | this.show_x + 235, this.show_x + 256| && my in | this.show_y, this.show_y + 22|)
- this.viewingInfo = NULL;
- }
- }
- }
- function onSelectItem( item)
- triggerAction( 0, 0, "serverside", "-System/Menu", "selectItem", item);
- function onScrollDown()
- {
- if (this.scrollPos - 5 > 0) this.scrollRow ++;
- this.scrollPos = this.scrollMax - (this.scrollRow * 5);
- }
- function onScrollUp()
- {
- if (this.scrollRow > 0) this.scrollRow -= 1;
- this.scrollPos = this.scrollMax - (this.scrollRow * 5);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement