var /**int Control index for commands that are sent to the server.*/ nextCmdId = 0; var /**boolean Whether the card's details should be shown or not. */ detailsShown = false; var /**String Temporary storage variable for Avatar loading info. ** DEPRECATED ** */ loadAvatarString = ''; var /**Array Quick access Array for mapping type to resulting action id on the server. */ rowTypeActionMapping = { 0 : 40, 1 : 41, 3 : 43, 2 : 42 }; // Card Flipping //------------------------------------- /** * Utility function for showing a card's details. ** DEPRECATED ** * @returns Returns false regardless of how function runs. */ function showCardDetails() { document.getElementById('carddetails').style.display = 'block'; document.getElementById('cardpreview').style.display = 'none'; outSwitch('previewButtonImg', 'previewButton'); overSwitch('detailsButtonImg', 'detailsButton'); detailsShown = true; return false; } /** * Utility function for showing a card's preview. ** DEPRECATED ** * @returns Returns false regardless of how function runs. */ function showCardPreview() { document.getElementById('carddetails').style.display = 'none'; document.getElementById('cardpreview').style.display = 'block'; overSwitch('previewButtonImg', 'previewButton'); outSwitch('detailsButtonImg', 'detailsButton'); detailsShown = false; return false; } // Core AJAX Object //------------------------------------- /** * Gets a HTTP request object depending on the browser being used. * @returns A XMLHTTPRequest for Mozilla/Safari/Chrome browsers or a ActiveXObject with the property XMLHTTP object for IE browsers. */ function getHttpRequestObject() { if (window.XMLHttpRequest) // Mozilla, Safari,... { httpRequest = new XMLHttpRequest(); if (httpRequest.overrideMimeType) { httpRequest.overrideMimeType('text/xml'); // See note below about this line } } else if (window.ActiveXObject) // IE { try { httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!httpRequest) { return null; } return httpRequest; } /** * Utility function for resetting the current deck with the current resultSet data. * *@param r A JSON ResultSet from the server. */ function reloadDeck(/**Object*/r){ var i = 0, endhtml = [], str = '', cLen = r.runes[0].general[0].championsTotal, sLen = r.runes[0].general[0].spellsTotal, rLen = r.runes[0].general[0].relicsTotal, eLen = r.runes[0].general[0].equipmentTotal, avg = r.runes[0].general[0].avgCost, fac = r.runes[0].general[0].factions, bns = r.runes[0].general[0].bonuses; if(cLen > 0){ for(i = 0; i < cLen; i++){ endhtml.push(r.runes[1].champions[i].rune); } } if(sLen > 0){ for(i = 0; i < sLen; i++){ endhtml.push(r.runes[2].spells[i].rune); } } if(rLen > 0){ for(i = 0; i < rLen; i++){ endhtml.push(r.runes[3].relics[i].rune); } } if(eLen > 0){ for(i = 0; i < eLen; i++){ endhtml.push(r.runes[4].equipment[i].rune); } } str = endhtml.join(''); $("#rune_dock_t_champs").html(cLen); $("#rune_dock_t_spells").html(sLen); $("#rune_dock_t_relics").html(rLen); $("#rune_dock_t_equip").html(eLen); $("#avg_nora_vals").html(avg); $("#factionCounts").html(fac); $("#runesArea").html(str); $("#bgroups_avatar").html(bns); $("#runesArea .tooltip .tooltiptext").tipTip(); } /** * Adds or removes rune from the current deck depending on whether is already part of the * deck, although the current code just sets the r object to * * NOTE: This function makes an AJAX (GET) call. * * @param runeId The id of the rune that is to added or removed. * @param type The id of the type of rune it is. ** NOT USED ** * @param action The id of the action that should be used with the rune to add/remove it. ** NOT USED ** * @param slot The slot where the rune can be found in the current runes array. ** NOT USED ** * @returns Returns false regardless of how the function runs. */ function addRemoveRune(/**int*/runeId, /**int*/type, /**int*/action, /**int*/slot){ var r = []; $.ajax({ url: "/runes/manager.do?a=0", type: "GET", cache: false, dataType: "json", success:function(json){r=json;}, error:function(e){d("error"+e)}, async: false }); reloadDeck(r); return false; } /** * This function makes the necessary AJAX call to the server to activate or deactivate * a rune in the current deck. * * NOTE: This function makes an AJAX (GET) call. * * @param runeId The id of the rune that is to be activated or deactivated in the current deck. * @param type The id of the type of rune that it is. * @param action The specific action to take on the rune (0 = deactivate, 1 = activate). * @param special A special status flag for this rune. * @param slot The slot in the current rune Array where this rune can be found. */ function ActivateRuneCmd(/**int*/runeId, /**int*/type, /**int*/action, /**boolean*/special, /**int*/slot) { this.id = ++nextCmdId; $("#tiptip_holder").css("display","none"); this.go = function() { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; httpRequest.onreadystatechange = function() { processActivateRune(httpRequest, runeId, type, action, special,slot); }; httpRequest.open('GET','/runes/activate.do?r=' + runeId + '&t=' + type + '&a=' + action, true); httpRequest.send(null); }; } /** * This function pulls the needed row for adding to the current battlegroup information. * * NOTE: This function makes an AJAX (GET) call. * * @param action The id of the action that is to be used to get the row of data from the battlegroup. */ function GetRuneRowCmd(/**int*/action) { this.id = ++nextCmdId; $("#tiptip_holder").css("display","none"); this.go = function() { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; httpRequest.onreadystatechange = function() { processGetRuneRowCmd(httpRequest); }; httpRequest.open('GET','/runes/manager.do?&a=' + action, true); httpRequest.send(null); }; } /** * Resets the status of the passed in rune id. * * NOTE: This function makes an AJAX (GET) call. * * @param runeId The id of the rune to be reset. */ function ResetRuneCmd(/**int*/runeId) { this.id = ++nextCmdId; this.go = function() { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; httpRequest.onreadystatechange = function() { processResetRune(httpRequest, runeId); }; httpRequest.open('GET', '/manager/reset.do?i=' + runeId+ '&ignoreMe=' + new Date().getTime(), true); httpRequest.send(null); } } /** * Resets the rune data via the Mutex connection with the server. * * @param runeId the id of the rune to be reset. * @returns Returns false regardless of how the function runs. */ function resetRune(/**int*/runeId) { document.getElementById(activateCell).innerHTML = ''; new Mutex(new ResetRuneCmd(runeId), "go"); return false; } /** * Processing function for the result from the server when a rune is requested to be * reset. * * @param httpRequest The HTTP Request object that contains the state of the request as well as the returned data. * @param runeId The id of the rune that is being reset. */ function processResetRune(/**Object*/httpRequest, /**int*/runeId) { if (httpRequest.readyState == 4) // Done reading processing { if (httpRequest.status == 200) { var xmldoc = httpRequest.responseXML; var returnCodeNode = xmldoc.getElementsByTagName('returnCode')[0]; var returnCode = returnCodeNode.firstChild.data-0; var errorDiv = document.getElementById("errorMsgs"); var goodDiv = document.getElementById("goodMsgs"); if (returnCode != 0) { var ul = errorDiv.getElementsByTagName('ul')[0]; ul.innerHTML = '
  • A problem was encountered while attempting to reset the champion specified. Please try again later.
  • '; goodDiv.style.display = 'none'; errorDiv.style.display = 'block'; } else { var ul = goodDiv.getElementsByTagName('ul')[0]; ul.innerHTML = '
  • The champion specified has been successfully reset.
  • '; document.getElementById('resetImg' + runeId).innerHTML = ''; errorDiv.style.display = 'none'; goodDiv.style.display = 'block'; hideMessage(); } } } } //return activateRune(1902889 , 0 , 1 , false , 1 ) // activateRune(2077533, 0 , 0 , false,false /** * Activates/Deactivates the passed in rune information visually then sends it to the server * via the Mutex connection. * * @param runeId The id of the rune to be activated/deactivated. * @param type The id of the type of rune that being updated. * @param action The action to be taken on the rune (0=deactivate, 1=activate). * @param special Indicates if this rune is special. * @param deck Boolean inidicating if this one is already in the deck. * @param listView An int indicating if the view is currently in list view or not (1=list view, 0/null= not). * @returns Returns false regardless of how the function runs. */ function activateRune(/**int*/runeId, /**int*/type, /**int*/action, /**boolean*/special , /**boolean*/deck, /**int*/listview) { var activateCell = false; if(runeId.num != undefined){ var slot = runeId.num, runeId = runeId.id; } if (type == 0) { activateCell = 'champActivateCell' + runeId; } else if (type == 1) { activateCell = 'spellActivateCell' + runeId; } else if (type == 3) { activateCell = 'equipmentActivateCell' + runeId; } else { activateCell = 'relicActivateCell' + runeId; } //resets the deck champion if found inside the current group if(!deck){ if(action == 0){ if(listview == 1){ setActivatedList(runeId,true,type); }else{ $("#"+activateCell+" .active-button").html(''); setActivated(runeId,true,type); } }else{ setActivatedList(runeId,false,type); } }else{ if($("#"+activateCell).length != 0){ setButtonForRune(runeId,type); setActivated(runeId,false,type); setActivatedList(runeId,false,type); } } new Mutex(new ActivateRuneCmd(runeId, type, action, special), "go"); return false; } /** * Processing function for handling activation of rune requests. * * @param httpRequest httpRequest The HTTP Request object that contains the state of the request as well as the returned data. * @param id The id of the rune that is being activated/deactivated. * @param type The type id of the rune that is being processed. * @param action The type of action to be performed (0=deactivate, 1=activate) * @param special Boolean indicating if this is a special rune or not. * @param slot The slot id that the rune can be found out in the runes array. * @returns True/False on whether it was successful in updating the rune. */ function processActivateRune(/**Object*/httpRequest, /**int*/id, /**int*/type, /**int*/action, /**bolean*/special, /**int*/slot) { if (httpRequest.readyState == 4) // Done reading processing { addRemoveRune(id, type, action, slot); if (httpRequest.status == 200) { if (action == 1) { if (document.getElementById('validMessage')) document.getElementById('validMessage').style.display = 'block'; } if(document.getElementById('goodMsgs')) document.getElementById('goodMsgs').style.display = 'none'; var xmldoc = httpRequest.responseXML; var statusNode = xmldoc.getElementsByTagName('status')[0]; var countChangeNode = xmldoc.getElementsByTagName('countChange')[0]; var returnCodeNode = xmldoc.getElementsByTagName('returnCode')[0]; var status = statusNode.firstChild.data-0; // subtract 0 to cast to int var countChange = countChangeNode.firstChild.data-0; // subtract 0 to cast to int var returnCode = returnCodeNode.firstChild.data-0; if (returnCode == 0) var errorMsg = xmldoc.getElementsByTagName('errorMsg')[0].firstChild.data; else var errorMsg = ''; // Get appropriate table var table = false; var cellPrefix = false; var rowPrefix = false; var imgPart = false; var lockedPrefix = false; var runeString = ''; //check if the current rune collection contains the add button for it //attachButton(runeId) // Update button if (status == 0) { if (special == false) { // handling list aspects var handleRow = $("#u" + id + "_list"); if (handleRow && !_currentChampsActive){ handleRow.remove(); } } else { alert("cellPrefix: " + rowPrefix + " : " + id); var row = document.getElementById(rowPrefix + id); table.deleteRow(row.rowIndex-1); table.deleteRow(row.rowIndex); clearTableSelections(); if (runeCount == 0) document.getElementById('runePreview').innerHTML = document.getElementById('runeNone').innerHTML; else loadAvatar(loadAvatarString, -1, 1); if((_countArray[0] - 0) + countChange == 0 ) //if((_countArray[0].innerHTML - 0) + countChange == 0 ) // if they've deleted the last row, replace table with the following ( - 0 casts to int) { table.style.display = 'none'; } } setState("active", id, undefined, false); } else if (status == 1) { // handling list aspects //new Mutex(new GetRuneRowCmd(rowTypeActionMapping[type]), "go"); } var $errorEl = $("#error-modal"); setButtonForRune(id, type); if (returnCode == 0) { $errorEl.find("p").html(errorMsg); $errorEl.modal({ opacity: 80, overlayCss: { backgroundColor: "#000000" }, close: true, overlayClose: true, zIndex: 9999 }); setActivated(id,false,type); setActivatedList(id,false,type); return true; } else { $errorEl.hide(); return false; } } else { // TODO Handle error document.getElementById('runePreview').innerHTML = "An error occured"; return false; } return false; } } /** * Processing function for getting the row of runes that are contained in the deck. * * @param httpRequest httpRequest The HTTP Request object that contains the state of the request as well as the returned data. * @returns Returns false regardless of how the function runs. */ function processGetRuneRowCmd(/**Object*/httpRequest){ if (httpRequest.readyState == 4) // Done reading processing { var text = httpRequest.responseText.replace(/\r\n/g, ""); $("#currentChamps").html($(text)); } return false; } /** * Hides the current error message div being displayed to the user. */ function killmessage(){ $("#errorMsgs").hide(); } /** * Updates the rune count for the section that it is found in. * * @param count The number of runes found. */ function updateRuneCounts(/**int*/count) { for (i=0; i<4; i++) { var table = false; var tableId = ''; if (i == 0) tableId = 'champListTable'; else if (i == 1) tableId = 'spellListTable'; else if (i == 2) tableId = 'equipmentListTable'; else if (i == 3) tableId = 'relicListTable'; table = document.getElementById(tableId); if (table != null) { // Update the count var countCell = table.rows[1].cells[table.rows[1].cells.length-2]; // did this to accomodate the total activated rune count that's now in this cell var _countArray = new Array(); //_countArray = countCell.getElementsByTagName("span");//countCell.innerHTML.split(' '); _countArray = countCell.innerHTML.split(' '); //countCell.innerHTML = "" + ((_countArray[0].innerHTML - 0) + countChange) + "" + "" + " (" + runeCount + ")" + ""; countCell.innerHTML = ((_countArray[0] - 0)) + " (" + (count) + ")"; } } } /** * Loads the base equipment data for the current selected rune for eventually * placing in the deck. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the equipment that information is needed for. * @param baseId The base id of the equipment being requested. * @param active Boolean indicating if the rune is on the current active page. * @returns Returns false if successful, or true if the http object was null. */ function loadBaseEquipment(/**int*/id, /**int*/baseId, /**boolean*/active) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; document.getElementById('runePreview').style.display = 'none'; document.getElementById('runeLoading').style.display = 'block'; clearTableSelections(); httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 'equipmentRow', id); }; httpRequest.open('GET', '/runes/select.do?t=7&r=' + baseId + '&d=' + (detailsShown ? 1 : 0) + '&a=' + active+ '&ignoreMe=' + new Date().getTime(), true); httpRequest.send(null); return false; } /** * Loads the data for the current selected rune for eventually placing in the deck. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the equipment that information is needed for. * @param baseId The base id of the equipment being requested. * @param active Boolean indicating if the rune is on the current active page. * @returns Returns false if successful, or true if the http object was null. */ function loadEquipment(/**int*/id, /**int*/baseId) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 3); }; httpRequest.open('GET', '/runes/select.do?t=3&r=' + id+ '&ignoreMe=' + new Date().getTime()); httpRequest.send(null); return false; } /** * Loads the data relating the current players shrine. ** DEPRECATED ** * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the shrine to be loaded. * @param count Unsure what count is relation to shrines. * @returns Returns false if successful, or true if the http object was null. */ function loadShrine(/**int*/id, /**int*/count) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; document.getElementById('runePreview').style.display = 'none'; document.getElementById('runeLoading').style.display = 'block'; clearTableSelections(); httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 'shrineRow', id); }; httpRequest.open('GET', '/runes/select.do?t=8&r=' + id + '&count=' + count+ '&ignoreMe=' + new Date().getTime(), true); httpRequest.send(null); return false; } /** * Loads the Relic information based on the id based in. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the Relic. * @param baseId The base id of the Relic that is to be retrieved. * @returns Returns false if successful, or true if the http object was null. */ function loadRelic(/**int*/id, /**int*/baseId) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 2); }; httpRequest.open('GET', '/runes/select.do?t=2&r=' + id+ '&ignoreMe=' + new Date().getTime()); httpRequest.send(null); return false; } /** * Loads the base information for Relic based on the passed in id. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the Relic to be retrieved. * @param baseId The base id of the Relic to be retrieved. * @param active Boolean indicating if it is in the active page or not. * @returns Returns false if successful, or true if the http object was null. */ function loadBaseRelic(/**int*/id, /**int*/baseId, /**boolean*/active) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; document.getElementById('runePreview').style.display = 'none'; document.getElementById('runeLoading').style.display = 'block'; clearTableSelections(); httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 'relicRow', id); }; httpRequest.open('GET', '/runes/select.do?t=6&r=' + baseId + '&d=' + (detailsShown ? 1 : 0) + '&a=' + active+ '&ignoreMe=' + new Date().getTime(), true); httpRequest.send(null); return false; } /** * Loads the information on the fragment from the database. ** DEPRECATED ** * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the Fragment to be loaded. * @param baseId The base id of the Fragment to be loaded. * @param active Boolean indicating if it is active in the deck. * @returns Returns false if successful, or true if the http object was null. */ function loadFragment(/**int*/id, /**int*/baseId, /**boolean*/active) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; clearTableSelections(); httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 9); }; httpRequest.open('GET', '/runes/select.do?t=9&r=' + id+ '&ignoreMe=' + new Date().getTime()); httpRequest.send(null); return false; } /** * Loads the base Avatar information for the passed in id from the server. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the Avatar to be loaded. * @param baseId The base id of the Avatar to be loaded. * @param active Whether this is active in the current deck or not. * @returns Returns false if successful, or true if the http object was null. */ function loadBaseAvatar(/**int*/id, /**int*/baseId, /**boolean*/active) { alert(id + ", " + baseId); /*var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; document.getElementById('runePreview').style.display = 'none'; document.getElementById('runeLoading').style.display = 'block'; clearTableSelections(); httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 'champRow', id); }; httpRequest.open('GET', '/runes/select.do?t=11&r=' + baseId + '&d=' + (detailsShown ? 1 : 0) + '&a=' + active, true); httpRequest.send(null); */ return false; } /** * Loads the Avatar information for the passed in id from the server. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the Avatar to be loaded. * @param baseId The base id of the Avatar to be loaded. * @returns Returns false if successful, or true if the http object was null. */ function loadAvatar(/**int*/id, /**int*/baseId) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; clearTableSelections(); httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 10); }; httpRequest.open('GET', '/runes/select.do?t=10&r=' + id+ '&ignoreMe=' + new Date().getTime()); httpRequest.send(null); return false; } /** * Loads the Spell information for the passed in id from the server. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the Spell to be loaded. * @param baseId The base id of the Spell to be loaded. * @returns Returns false if successful, or true if the http object was null. */ function loadSpell(/**int*/id, /**int*/baseId) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 1); }; httpRequest.open('GET', '/runes/select.do?t=1&r=' + id+ '&ignoreMe=' + new Date().getTime()); httpRequest.send(null); return false; } /** * Loads the base Spell information for the passed in id from the server. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the Spell to be loaded. * @param baseId The base id of the Spell to be loaded. * @param active Whether this is active in the current deck or not. * @returns Returns false if successful, or true if the http object was null. */ function loadBaseSpell(/**int*/id, /**int*/baseId, /**boolean*/active) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 'spellRow', id); }; httpRequest.open('GET', '/runes/select.do?t=5&r=' + baseId + '&d=' + (detailsShown ? 1 : 0) + '&a=' + active+ '&ignoreMe=' + new Date().getTime(), true); httpRequest.send(null); return false; } /** * Loads the Champion information for the passed in id from the server. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the Champion to be loaded. * @param baseId The base id of the Champion to be loaded. * @returns Returns false if successful, or true if the http object was null. */ function loadChampion(/**int*/id, /**int*/baseId) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 0); }; httpRequest.open('GET', '/runes/select.do?t=0&r=' + id+ '&ignoreMe=' + new Date().getTime()); httpRequest.send(null); return false; } /** * Loads the base Champion information for the passed in id from the server. * * NOTE: This function makes an AJAX (GET) call. * * @param id The id of the Champion to be loaded. * @param baseId The base id of the Champion to be loaded. * @returns Returns false if successful, or true if the http object was null. */ function loadBaseChampion(/**int*/id, /**int*/baseId) { var httpRequest = getHttpRequestObject(); if (httpRequest == null) return true; httpRequest.onreadystatechange = function() { processRunePreviewChange(httpRequest, id, 4); }; httpRequest.open('GET', '/runes/select.do?t=4&r=' + baseId+ '&ignoreMe=' + new Date().getTime(), true); httpRequest.send(null); return false; } /** * Processing function for handling rune preview updates. ** DEPRECATED ** * * @param httpRequest httpRequest The HTTP Request object that contains the state of the request as well as the returned data. * @param id The id of the rune that needs it's preview updated. * @param type The id of the type of rune it is. */ function processRunePreviewChange(/**Object*/httpRequest, /**int*/id, /**int*/type) { if (httpRequest.readyState == 4) // Done reading processing { if (httpRequest.status == 200) { loadDetails(type,id); } else { alert("An error occured"); } } } /** * Resets all of the current table lists. */ function clearTableSelections() { clearTableSelection('equipmentListTable'); clearTableSelection('spellListTable'); clearTableSelection('champListTable'); clearTableSelection('relicListTable'); clearTableSelection('shrineListTable'); clearTableSelection('fragmentListTable'); } /** * Resets the list tables information if it is found. * * @param tableId The name of the table to be processed. */ function clearTableSelection(/**String*/tableId) { var table = document.getElementById(tableId); if (table) { var i = 0; for (r=3; r < table.rows.length; r += 2) { var cellCount = 0; var row = table.rows[r]; if (i % 2 == 0) row.className = "type_light"; else row.className = "type_dark"; i++; } } } /** * Sets the passed in row id to be selected. * * @param row The id of the row that is to be marked as selected. */ function selectTableRow(/**String*/row) { var selectedRow = document.getElementById(row); if (selectedRow) selectedRow.className = "type_selected"; } /** * Creates a dialog window for the Avatar forge feature. ** DEPRECATED ** * * @param id The id of the Avatar to be modified. */ function openAvatarForge(/**int*/id) { window.open("/runes/avatarforge.do?id=" + id, 'avatarforge', "dependent=yes,width=750,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); } /** * Creates a dialog window and places the passed in id in the forge environment. ** DEPRECATED ** * * @param id The id of the rune to be forged. */ function openForge(/**int*/id) { window.open("/runes/forge.do?id=" + id, 'forge', "dependent=yes,width=750,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); } /** * Creates a dialog window and places the passed in id in the forge enviroment and focuses the window ** DEPRECATED ** * * @param id The id of the rune to be forged. * @param focus Boolean indicating whether the forge should have focus or not. */ function openForgeFocus(/**int*/id, /**boolean*/focus) { window.open("/runes/forge.do?id=" + id + "&st=" + focus, 'forge', "dependent=yes,width=750,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); } /** * Utility function for double checking if the click on the mass selection * was performed. */ function checkClick() { checks=""; for(i=1; i<=25; i++) { element = document.MassSelectForm.elements[i]; if(element != null) if(element.checked == true) { if(checks=="") checks=document.MassSelectForm.elements[i].name; else checks=checks+","+document.MassSelectForm.elements[i].name; } } document.forms["MassSelectForm"].ids.value=checks; } /** * Opens the sacrificial altar dialog. ** DEPRECATED ** * * @param type The type of items to be sacrificed. * @param id The id of the rune to be sacrificied. */ function openAltar(/**int*/type, /**int*/id) { window.open("/runes/sacrificialaltar.do?t=" + type + "&r=" + id, 'altar', "dependent=yes,width=920,height=620,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); } /** * This function handles displaying the Ability description tooltips to the player. * * @param abilityId The id of the ability being displayed. Corresponds to a unique id in the html. * @param e The Mouse Event object which contains the current pose position information. */ function showDescription(/**int*/abilityId, /**Object*/e) { var inner = document.getElementById('abilityDesc' + abilityId).innerHTML; if (document.all) { // if IE // grab the x-y pos.s if browser is IE tempX = event.clientX+ document.documentElement.scrollLeft; tempY = event.clientY + document.documentElement.scrollTop; } else { // grab the x-y pos.s if browser is NS tempX = e.pageX; tempY = e.pageY; } // catch possible negative values in NS4 if (tempX < 0){tempX = 0;} if (tempY < 0){tempY = 0;} document.getElementById('abilityTooltipContent').innerHTML = inner;// + "" + tempX + ", " + tempY; var obj = document.getElementById('abilityTooltip'); obj.style.left = (tempX+15) + 'px'; obj.style.top = (tempY+15) + 'px'; obj.style.display = 'block'; } /** * Hides the Ability tooltip. * * @param abilityId The id of the ability being displayed. Corresponds to a unique id in the html. */ function hideDescription(/**int*/abilityId) { var objName = 'abilityDesc' + abilityId; var obj = document.getElementById('abilityTooltip'); obj.style.display = 'none'; } /** * Handles displaying a tooltip to the user that explains what each icon means. * * @param whichIcon the name of the icon to be displayed. * @param e The Mouse Event object which contains the current pose position information. */ function explainIcon(/**String*/whichIcon, /**Object*/e) { var inner = "HI"; if (document.all) { // if IE // grab the x-y pos.s if browser is IE tempX = event.clientX+ document.documentElement.scrollLeft; tempY = event.clientY + document.documentElement.scrollTop; } else { // grab the x-y pos.s if browser is NS tempX = e.pageX; tempY = e.pageY; } // catch possible negative values in NS4 if (tempX < 0){tempX = 0;} if (tempY < 0){tempY = 0;} document.getElementById('iconTooltipContent').innerHTML = inner;// + "" + tempX + ", " + tempY; var obj = document.getElementById('iconTooltip'); obj.style.left = (tempX-150-5) + 'px'; obj.style.top = (tempY+5) + 'px'; obj.style.display = 'block'; } /** * Hides the icon tooltip. */ function hideExplainIcon() { var obj = document.getElementById('iconTooltip'); obj.style.display = 'none'; } /** * Displays a message to the user based on their interaction. * * @param content The message to be displayed to the Player. * @param e The Mouse Event object which contains the current pose position information. */ function showMessage(/**String*/content, /**Object*/e) { if (document.all) { // if IE // grab the x-y pos.s if browser is IE tempX = event.clientX+ document.documentElement.scrollLeft; tempY = event.clientY + document.documentElement.scrollTop; } else { // grab the x-y pos.s if browser is NS tempX = e.pageX; tempY = e.pageY; } // catch possible negative values in NS4 if (tempX < 0){tempX = 0;} if (tempY < 0){tempY = 0;} document.getElementById('factionTooltipContent').innerHTML = content; var obj = document.getElementById('factionTooltip'); obj.style.left = (tempX-150-5) + 'px'; obj.style.top = (tempY+5) + 'px'; obj.style.display = 'block'; } /** * Hides the message window. */ function hideMessage() { var obj = document.getElementById('factionTooltip'); obj.style.display = 'none'; } /** * Displays Faction information to the user based on their interaction. * * @param factionId The Faction id to be displayed, corresponds to a unique id in the HTML. * @param e The Mouse Event object which contains the current pose position information. */ function showFaction(factionId, e) { var inner = document.getElementById('faction' + factionId).innerHTML; if (document.all) { // if IE // grab the x-y pos.s if browser is IE tempX = event.clientX+ document.documentElement.scrollLeft; tempY = event.clientY + document.documentElement.scrollTop; } else { // grab the x-y pos.s if browser is NS tempX = e.pageX; tempY = e.pageY; } // catch possible negative values in NS4 if (tempX < 0){tempX = 0;} if (tempY < 0){tempY = 0;} document.getElementById('factionTooltipContent').innerHTML = inner;// + "" + tempX + ", " + tempY; var obj = document.getElementById('factionTooltip'); obj.style.left = (tempX-150-5) + 'px'; obj.style.top = (tempY+5) + 'px'; obj.style.display = 'block'; } /** * Hides the Faction information window. * * @param factionId The Faction id to be displayed, corresponds to a unique id in the HTML. */ function hideFaction(factionId) { var obj = document.getElementById('factionTooltip'); obj.style.display = 'none'; } /** * Displays Rarity information to the user based on their interaction. * * @param rarityId The Rarity id to be displayed, corresponds to a unique id in the HTML. * @param e The Mouse Event object which contains the current pose position information. */ function showRarity(rarityId, e) { var inner = document.getElementById('rarity' + rarityId).innerHTML; if (document.all) { // if IE // grab the x-y pos.s if browser is IE tempX = event.clientX+ document.documentElement.scrollLeft; tempY = event.clientY + document.documentElement.scrollTop; } else { // grab the x-y pos.s if browser is NS tempX = e.pageX; tempY = e.pageY; } // catch possible negative values in NS4 if (tempX < 0){tempX = 0;} if (tempY < 0){tempY = 0;} document.getElementById('factionTooltipContent').innerHTML = inner;// + "" + tempX + ", " + tempY; var obj = document.getElementById('factionTooltip'); obj.style.left = (tempX+5) + 'px'; obj.style.top = (tempY+5) + 'px'; obj.style.display = 'block'; } /** * Hides Rarity information window. * * @param rarityId The Rarity id to be displayed, corresponds to a unique id in the HTML. */ function hideRarity(rarityId) { var obj = document.getElementById('factionTooltip'); obj.style.display = 'none'; } var /**int Position in rune array to start at. */ runeStartY = null; var /**int Timer id created by the system. */ floatRuneTimer; /** * This function floats the rune. ** DEPRECATED ** */ function floatRune() { var preview = document.getElementById('runePreview'); var loading = document.getElementById('runeLoading'); var sibling = document.getElementById('runeList');//preview.nextSibling;//preview.parentNode.parentNode.childNodes[1]; if (document.all) { newY = document.body.scrollTop; windowHeight = document.body.offsetHeight; } else{ newY = window.pageYOffset; windowHeight = window.innerHeight; } var height = preview.offsetHeight; var siblingHeight = sibling.offsetHeight; if (height < siblingHeight) { if (height <= windowHeight) { if (newY - runeStartY + height > siblingHeight) newY = runeStartY + siblingHeight - height; if (newY < runeStartY) newY = runeStartY; preview.style.position = 'absolute'; if (!runeStartY) runeStartY = preview.offsetTop; preview.style.top = '' + newY + 'px'; loading.style.position = 'absolute'; loading.style.top = preview.style.top; } else { if (preview.style.position == 'absolute') { preview.style.position = 'absolute'; preview.style.top = '' + runeStartY + 'px'; loading.style.position = 'absolute'; loading.style.top = preview.style.top; } } } document.getElementById('unfloatItLink').style.display = 'inline'; document.getElementById('floatItLink').style.display = 'none'; floatRuneTimer = setTimeout('floatRune()',50); //alert('' + runeStartY); } /** * This function stops the floating of the rune. ** DEPRECATED ** */ function unfloatRune() { clearTimeout(floatRuneTimer); var preview = document.getElementById('runePreview'); var loading = document.getElementById('runeLoading'); if (preview.style.position == 'absolute') { preview.style.top = '' + runeStartY + 'px'; loading.style.top = '' + runeStartY + 'px'; } document.getElementById('unfloatItLink').style.display = 'none'; document.getElementById('floatItLink').style.display = 'inline'; } /** * This function redirects the user to he appropriate alpha letter in * the current view. * * @param val The letter that we are to be redirected to. * @param sub Additional parameter strings. * @param v The param id of the alpha string. * @param base The base url. ** NO LONGER USED ** * @returns Returns false regardless of how function runs. */ function gotoAlpha(/**String*/val, /**String*/sub, /**String*/v, /**String*/base){ //gotoAlpha(valueOfSelection,9,'alpha','?a=9&') var env = '/runes/manager.do?a='; var isfb = gup("fb"); if(isfb != ""){ isfb = "&fb=1"; } window.location.replace(env+sub+"&"+v+"="+val+isfb); return false; } /** * Adds debug content to a special debug element if it can be found. * * @param content The data to be appended to the debug element. */ function debug(/**String*/content) { var debug = document.getElementById('debug'); debug.style.display = 'block'; debug.innerHTML += (content + '
    '); } /** * Clears the debug element of contents. */ function clearDebug() { document.getElementById('debug').innerHTML = ''; } /** * Sets the Avatar string that is intended to be loaded. ** DEPRECATED ** * * @param text The string of the Avatar information to be loaded. */ function setLoadAvatarString(/**String*/text) { loadAvatarString = text; }