Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function showInventory(temp.bag) {
- this.bagOpen = true;
- if ( isObject("Inventory_Window") ) {
- Inventory_Window.destroy();
- }
- play("necro_scroll-1_1.wav");
- new GuiWindowCtrl("Inventory_Window") {
- profile = Necro_Window;
- profile.modal = false;
- profile.cankeyfocus = false;
- profile.makefirstresponder = false;
- width = 360;
- x = screenwidth - 362;
- text = "Inventory - Bag " @ temp.bag;
- canclose = canminimize = canmaximize = canmove = canresize = false;
- new GuiScrollCtrl("Inventory_Scroll") {
- profile = Necro_Scroll;
- useownprofile = true;
- profile.modal = true;
- profile.cankeyfocus = false;
- profile.makefirstresponder = false;
- x = 11;
- y = 29;
- width = 340;
- hScrollBar = "alwaysOff";
- vScrollBar = "alwaysOff";
- this.clearControls();
- thiso.catchEvent(this, "onMouseDown", "onSelectItem");
- thiso.catchEvent(this, "onRightMouseDown", "onDisplayOptions");
- //Item Box Display
- for (temp.i = 0; temp.i <= thiso.items.size(); temp.i ++) {
- new GuiControl("Inventory_Item_" @ temp.i) {
- width = height = 32;
- x = 12 + (40 * (temp.i % 8));
- y = 8 + (40 * int(temp.i / 8));
- useownprofile = true;
- profile.modal = false;
- profile.cankeyfocus = false;
- profile.makefirstresponder = false;
- new GuiBitmapCtrl("Inventory_Item_" @ temp.i @ "_box") {
- bitmap = "necro_gui_iconbox.gif";
- x = y = 0;
- width = height = 32;
- useownprofile = true;
- profile.modal = false;
- profile.cankeyfocus = false;
- profile.makefirstresponder = false;
- }
- Inventory_Window.height = ((round(temp.i / 8)) * 40) + 53;
- Inventory_Scroll.height = Inventory_Window.height - 40;
- Inventory_Window.y = screenheight - 70 - Inventory_Window.height;
- }
- }
- //Item Display
- temp.getItems = makevar("clientr.items"@ thiso.backpack).size();
- for (temp.v = 0; temp.v <= temp.getItems; temp.v ++ ) {
- temp.itemName = makevar("clientr.items"@ thiso.backpack)[v];
- temp.itemIcon = makevar("clientr.item_"@ temp.itemName)[3];
- temp.itemAmount = makevar("clientr.item_amount_"@ temp.itemName);
- new GuiBitmapCtrl("Inventory_Item_" @ temp.v @ "_Icon") {
- bitmap = temp.itemIcon;
- x = 12 + (40 * (temp.v % 8));
- y = 8 + (40 * int(temp.v / 8));
- width = height = 32;
- useownprofile = true;
- profile.modal = false;
- profile.cankeyfocus = false;
- profile.makefirstresponder = false;
- }
- new GuiTextCtrl("Inventory_Item_" @ temp.v @ "_Amount") {
- profile = Necro_Text;
- profile.modal = false;
- profile.active = false;
- profile.cankeyfocus = false;
- profile.makefirstresponder = false;
- useownprofile = true;
- profile.fontSize = 10;
- width = 80;
- height = 16;
- x = 13 + (40 * (temp.v % 8));
- y = 26 + (40 * int(temp.v / 8));
- alpha = 0.8;
- text = (temp.itemAmount == 0 ? "" : temp.itemAmount);
- style = "bc";
- }
- }
- }
- }
- with (Inventory_Window.createAnimation()) {
- transition = "fadein";
- duration = 0.2;
- }
- with (Inventory_Window.createAnimation()) {
- transition = "moveinbottom";
- duration = 0.2;
- timing = "sinus";
- }
- onTimeOut();
- }
- function onTimeOut() {
- temp.local = Inventory_Scroll.globaltolocalcoord({mousescreenx, mousescreeny});
- temp.index_row = int(temp.local[1] / 40) + 1;
- temp.index_col = int(temp.local[0] / 40);
- temp.cell = 8 * temp.index_row - 8 + temp.index_col;
- temp.cell_up = 8 * (temp.index_row - 1) - 8 + temp.index_col;
- temp.cell_left = 8 * temp.index_row - 8 + (temp.index_col - 1);
- temp.cell_down = 8 * (temp.index_row + 1) - 8 + temp.index_col;
- temp.cell_right = 8 * temp.index_row - 8 + (temp.index_col + 1);
- for (temp.i = 0; temp.i <= thiso.items.size(); temp.i ++) {
- ("Inventory_Item_" @ temp.i @ "_box").alpha = 0.8;
- ("Inventory_Item_" @ temp.i @ "_Icon").alpha = 0.6;
- ("Inventory_Item_" @ temp.i @ "_Amount").alpha = 0.6;
- ("Inventory_Item_" @ temp.i @ "_box").bitmap = "necro_gui_iconbox.gif";
- switch (temp.i) {
- case temp.cell:
- ("Inventory_Item_" @ temp.i @ "_box").alpha = 1;
- ("Inventory_Item_" @ temp.i @ "_Icon").alpha = 1;
- ("Inventory_Item_" @ temp.i @ "_Amount").alpha = 1;
- ("Inventory_Item_" @ temp.i @ "_box").bitmap = "necro_gui_iconbox2.gif";
- break;
- case temp.cell_up:
- case temp.cell_left:
- case temp.cell_down:
- case temp.cell_right:
- ("Inventory_Item_" @ temp.i @ "_box").alpha = 0.4;
- ("Inventory_Item_" @ temp.i @ "_Icon").alpha = 0.4;
- ("Inventory_Item_" @ temp.i @ "_Amount").alpha = 0.4;
- break;
- }
- }
- this.cell_selected = temp.cell;
- setTimer(0.05);
- }
- function onSelectItem() {
- temp.slot = this.cell_selected;
- if (temp.slot <= this.items.size()) {
- play("necro_click2.wav");
- temp.itemName = makevar("clientr.items"@ thiso.backpack)[slot];
- temp.itemRealName = makevar("clientr.item_"@ temp.itemName)[1];
- if ( temp.itemRealName != NULL ) player.chat = "Debug:"SPC (temp.slot+1) SPC temp.itemRealName;
- }
- }
- function onDisplayOptions() {
- setTimer(0);
- ("Inventory_Window").modal = false;
- ("Inventory_Window").active = false;
- ("Inventory_Scroll").modal = false;
- ("Inventory_Scroll").active = false;
- temp.slot = this.cell_selected;
- if (temp.slot <= this.items.size()) {
- play("necro_click2.wav");
- temp.itemName = makevar("clientr.items"@ thiso.backpack)[slot];
- if ( temp.itemName == NULL ) return;
- }
- if ( isObject("ItemOptions_Menu") ) {
- ItemOptions_Menu.destroy();
- }
- new GuiContextMenuCtrl("ItemOptions_Menu") {
- profile = "Necro_TextEdit";
- useownprofile = true;
- profile.modal = true;
- profile.active = true;
- profile.cankeyfocus = true;
- profile.canstealfocus = true;
- profile.makefirstresponder = true;
- textprofile = "Necro_Text";
- text = "Options";
- width = 20;
- clearRows();
- addRow(0, "Options");
- addrow(-1, "-");
- for (temp.I = 0; temp.I < thiso.options.size(); temp.I++)
- {
- addRow(temp.I + 1, thiso.options[temp.I]);
- }
- open(mousescreenx, mousescreeny);
- }
- ("ItemOptions_Menu").modal = true;
- ("ItemOptions_Menu").active = true;
- }
- function Options_Menu.onSelect(entryid, text) {
- temp.slot = this.cell_selected;
- if (temp.slot <= this.items.size()) {
- play("necro_click2.wav");
- temp.itemName = makevar("clientr.items"@ thiso.backpack)[slot];
- temp.itemRealName = makevar("clientr.item_"@ temp.itemName)[1];
- if ( temp.itemName == NULL ) {
- if ( isObject("ItemOptions_Menu") )
- ItemOptions_Menu.destroy();
- return;
- }
- }
- switch (text) {
- case "Equip": {
- player.chat = "Equip"SPC temp.itemRealName @"!";
- break;
- }
- case "Drop": {
- player.chat = "Drop"SPC temp.itemRealName @"!";
- break;
- }
- case "Destroy": {
- player.chat = "Destroy"SPC temp.itemRealName @"!";
- break;
- }
- }
- ("ItemOptions_Menu").modal = false;
- ("ItemOptions_Menu").active = false;
- ("Inventory_Window").modal = true;
- ("Inventory_Window").active = true;
- ("Inventory_Scroll").modal = true;
- ("Inventory_Scroll").active = true;
- setTimer(0.05);
- }
Advertisement
Add Comment
Please, Sign In to add comment