var u_item=null,u_scroll=null,u_offering=null,c_items=e_array(3),c_scroll=null,c_offering=null,c_last=0,e_item=null,p_item=null,l_item=null,s_item=null,cr_items=e_array(9),cr_last=0,ds_item=null; var settings_shown=0; function show_settings() { show_modal($(".basicsettings").html(),{wrap:false,styles:"width:600px",hideinbackground:true}); } var docked=[],cwindows=[]; function close_chat_window(type,id) { var cid=type+(id||""); $("#chatw"+cid).remove(); array_delete(docked,cid); array_delete(cwindows,cid); redock(); } function toggle_chat_window(type,id) { var cid=type+(id||""); if(in_arr(cid,docked)) { array_delete(docked,cid); $(".chatb"+cid).html("#"); $("#chatw"+cid).css("bottom","auto"); $("#chatw"+cid).css("top",400); $("#chatw"+cid).css("left",400); $("#chatw"+cid).css("z-index",70+cwindows.length-docked.length); $("#chatw"+cid).draggable(); $("#chatt"+cid).removeClass("newmessage"); } else { $(".chatb"+cid).html("+"); $("#chatw"+cid).draggable("destroy"); $("#chatw"+cid).css("top","auto"); $("#chatw"+cid).css("left",0); docked.push(cid); } redock(); } function chat_title_click(type,id) { var cid=type+(id||""); if(in_arr(cid,docked)) toggle_chat_window(type,id) } function redock() { for(var i=0;i"; html+="
+ "+name+" x
"; html+="
"; html+="
"; html+=""; $("body").append(html); docked.push(cid); cwindows.push(cid); if(open) toggle_chat_window(type,id); redock(); } function hide_settings() { $("#content").html(""); settings_shown=0; } function prop_line(prop,value,args) { var color="",bold=""; if(!args) args={}; if(args.bold) bold="font-weight: bold;"; if(is_string(args)) color=args,args={}; if(!color) color=args.color||"grey"; return "
"+prop+": "+value+"
" } function prop_remains(remains) { if(remains<=1/60.0) return bold_prop_line("Seconds",to_pretty_float(remains*3600),"gray"); else if(remains<1) return bold_prop_line("Minutes",to_pretty_float(remains*60),"gray"); else return bold_prop_line("Hours",to_pretty_float(remains),"gray"); } function bold_prop_line(prop,value,args) { if(!args) args={}; if(is_string(args)) args={color:args}; if(window.is_bold) args.bold=true; return prop_line(prop,value,args); } function render_party_old(list) { var html="
"; if(list) { html+="
PARTY
"; list.forEach(function(name){ html+="
"+name+"
"; }); html+="
LEAVE
"; } html+="
"; $("#partylist").html(html); if(!list.length) $("#partylist").hide(); else $("#partylist").css("display","inline-block"); } function render_party() { var html=""; for(var name in party) { var member=party[name]; html+="
"; html+=sprite(member.skin,{cx:member.cx||[],rip:member.rip,scale:2,height:50,overflow:true}); if(member.rip) html+="
RIP
"; else html+="
"+name.substr(0,3).toUpperCase()+"
"; html+="
"; } $("#newparty").html(html); if(!party_list.length) $("#newparty").hide(); else $("#newparty").show(); } function duel_click(name) { var sm_target=null; I.A.forEach(function(member){ if(member.name==name) sm_target=member; }); I.B.forEach(function(member){ if(member.name==name) sm_target=member; }); if(sm_target) call_code_function_f("smart_move",sm_target); } function render_member(member,space) { var html=""; if(space) html+="
"; html+="
"; html+=sprite(member.skin,{cx:member.cx||{},rip:member.rip}); if(member.rip || !member.active) { html+="
RIP
"; html+="
"; } else { html+="
"+member.name.substr(0,3).toUpperCase()+"
"; var percent=member.hp/member.max_hp*99; html+="
"; } html+="
"; return html; } function render_map() { // Note: new_map_logic() - includes the initial messages if(current_map=="abtesting" && S.abtesting && !window.abtesting) { $("#topmid").append("
A "+S.abtesting.A+"
5:00
B 0
"); reposition_ui(); window.abtesting=true; } else if(current_map!="abtesting" && window.abtesting) { $("#abtesting").remove(); window.abtesting=false; } if(events.duel && (!I || !I.id || I.id!=events.duel)) { events.duel=false; $("#duelui").remove(); $(".badplaceforaui").html(""); } if(current_map=="duelland" && !events.duel) { events.duel=I.id; $("#topmid").append("
0:60
"); reposition_ui(); } if(events.duel) { if(I.seconds) $(".dueltime").html("0:"+("00"+I.seconds).slice(-2)); else $(".dueltime").remove(); var html=""; m_first=true; I.A.forEach(function(member){ html+=render_member(member,!m_first); m_first=false; }); html+="
vs
"; m_first=true; I.B.forEach(function(member){ html+=render_member(member,!m_first); m_first=false; }); $(".badplaceforaui").html(html); } } function wabbit_click() { if(!S.wabbit.live) add_log("Wabbit spawns in "+parseInt(round(-msince(new Date(S.wabbit.spawn))))+" minutes"); else add_log("Engage Wabbit? Go","gray"); } function emonster_click(id) { if(!S[id] || !S[id].live && !S[id].spawn) add_log(G.monsters[id].name+" hasn't spawned yet!"); else if(!S[id].live) add_log(G.monsters[id].name+" spawns in "+parseInt(round(-msince(new Date(S[id].spawn))))+" minutes"); else add_log("Engage "+G.monsters[id].name+"? Go","gray"); } function render_rewards() { show_json(S.rewards); } function render_server() { var html="",content=false; if(quirks.crypt) { html+="
"; html+="
"+item_container({skin:G.items.cryptkey.skin,bcolor:"black"})+"
"; html+="
INFO
"; html+="
"; content=true; } if(quirks.darkmage) { html+="
"; html+="
"+item_container({skin:G.items.frozenkey.skin,bcolor:"black"})+"
"; html+="
INFO
"; html+="
"; content=true; } if(quirks.fishing) { html+="
"; html+="
"+item_container({skin:G.items.rod.skin,bcolor:"black"})+"
"; html+="
INFO
"; html+="
"; content=true; } if(quirks.mining) { html+="
"; html+="
"+item_container({skin:G.items.pickaxe.skin,bcolor:"black"})+"
"; html+="
INFO
"; html+="
"; content=true; } if(gameplay=="hardcore") { $(".rewardsbutton").css("display","inline-block"); $(".minutesui").css("display","inline-block"); var hours="0"+parseInt(S.minutes/60); var minutes=S.minutes%60; if(!minutes) minutes="00"; else if(minutes<10) minutes="0"+minutes; $(".minutesui").html(hours+":"+minutes); } ["crabxx","goobrawl","abtesting","franky","icegolem"].forEach(function(type){ if(S[type]) { var scolor="#ECECEC",lcolor="#ECECEC",lphrase="EVENT!",s=type; if(type=="goobrawl") lcolor="#FF5D34",s="rgoo"; if(type=="abtesting") lcolor="#E10029",s="thehelmet"; else if(G.monsters[type] && G.monsters[type].announce) lcolor=G.monsters[type].announce; html+="
"; html+=sprite(s,{overflow:true}); html+="
"+lphrase+"
"; html+="
"; content=true; } }); ["wabbit","mrpumpkin","mrgreen","snowman","dragold","grinch","pinkgoo","slenderman","tiger"].forEach(function(type){ if(S[type]) { var scolor="#ECECEC",lcolor="#ECECEC",lphrase="LIVE"; if(type=="snowman") lcolor=colors.xmasgreen,scolor=colors.xmas; if(type=="grinch") scolor=colors.xmasgreen,lcolor=colors.xmas,lphrase="BEWARE"; html+="
"; html+=sprite(type,{overflow:true}); if(!S[type].live) html+="
"+parseInt(round(-msince(new Date(S[type].spawn))))+"M
"; else if(S[type].target) html+="
JOIN
"; else html+="
"+lphrase+"
"; html+="
"; content=true; } }); if(S.halloween) { html+="
"; html+="
"+item_container({skin:"candy0",bcolor:"black"})+"
"; html+="
INFO
"; html+="
"; content=true; } if(S.holidayseason) { html+="
"; html+="
"+item_container({skin:"candycane",bcolor:"black"})+"
"; html+="
INFO
"; html+="
"; content=true; } if(S.lunarnewyear) { html+="
"; html+="
"+item_container({skin:"greenenvelope",bcolor:"black"})+"
"; html+="
INFO
"; html+="
"; content=true; } if(S.egghunt) { html+="
"; html+="
"+item_container({skin:"basketofeggs",bcolor:"black"})+"
"; html+="
INFO
"; html+="
"; content=true; } if(S.valentines) { html+="
"; html+="
"+item_container({skin:"cupid",bcolor:"black"})+"
"; html+="
INFO
"; html+="
"; content=true; } $("#serverinfo").html(html); if(!content) $("#serverinfo").hide(); else $("#serverinfo").show(); } function render_character_sheet() { var html="
"; html+="
Class: "+to_title(character.ctype)+"
"; html+="
Level: "+character.level+"
"; html+="
XP: "+to_pretty_num(character.xp)+" / "+to_pretty_num(character.max_xp)+"
"; var divider=1,disclaimer=""; if(pvp && !(!is_pvp && G.maps[character.map].safe_pvp)) divider=10,disclaimer="(PVP)"; var lost_xp=floor(min(max(character.max_xp*0.01/divider,character.xp*0.02/divider),character.xp)); if(character.ctype!="merchant") html+="
Max XP Loss: "+to_pretty_num(lost_xp)+" "+disclaimer+"
"; if(character.party && party && party[character.name]) html+="
Party: "+round(party[character.name].share*100)+"% (Your Share)
"; if(character.ctype=="merchant") html+="
Tax: "+(character.tax*100)+"%
"; if(character.ctype=="priest") { html+="
Heal: "+character.heal+"
"; } html+="
Attack: "+character.attack+"
"; html+="
Attack Speed: "+round(character.frequency*100)+"
"; html+="
Strength: "+character.str+"
"; html+="
Intelligence: "+character['int']+"
"; html+="
Dexterity: "+character.dex+"
"; html+="
Vitality: "+character.vit+"
"; html+="
Fortitude: "+character['for']+" ("+parseInt((1-damage_multiplier(character['for']*5))*10000.0)/100.0+"%)
"; html+="
Armor: "+character.armor+" ("+parseInt((1-damage_multiplier(character.armor))*10000.0)/100.0+"%)
"; html+="
Resistance: "+character.resistance+" ("+parseInt((1-damage_multiplier(character.resistance))*10000.0)/100.0+"%)
"; html+="
Courage: "+character.courage+" | "+character.mcourage+" | "+character.pcourage+"
"; html+="
Speed: "+character.speed+"
"; html+="
MP Cost: "+character.mp_cost+"
"; if(character.lifesteal) html+="
Lifesteal: "+to_pretty_float(character.lifesteal)+"%
"; if(character.manasteal) html+="
Manasteal: "+to_pretty_float(character.manasteal)+"%
"; if(character.dreturn) html+="
Damage Return: "+to_pretty_float(character.dreturn)+"%
"; if(character.reflection) html+="
Reflection: "+to_pretty_float(character.reflection)+"%
"; if(character.evasion) html+="
Evasion: "+to_pretty_float(character.evasion)+"%
"; if(character.miss) html+="
Miss: "+to_pretty_float(character.miss)+"%
"; if(character.crit) html+="
Crit: "+to_pretty_float(character.crit)+"%
"; if(character.critdamage) html+="
Critical Damage: "+to_pretty_float(200+character.critdamage)+"%
"; if(character.apiercing) html+="
Armor Piercing: "+character.apiercing+"
"; if(character.rpiercing) html+="
Resistance Piercing: "+character.rpiercing+"
"; if(character.goldm!=1) { if(character.party && party && party[character.name] && party[character.name].gold) html+="
Gold: "+round(character.goldm*100-party[character.name].gold)+"% +"+party[character.name].gold+"%
"; else html+="
Gold: "+round(character.goldm*100)+"%
"; } if(character.xpm!=1) { if(character.party && party && party[character.name] && party[character.name].xp) html+="
Experience: "+round(character.xpm*100-party[character.name].xp)+"% +"+party[character.name].xp+"%
"; else html+="
Experience: "+round(character.xpm*100)+"%
"; } if(character.luckm!=1) { if(character.party && party && party[character.name] && party[character.name].luck) html+="
Luck: "+round(character.luckm*100-party[character.name].luck)+"% +"+party[character.name].luck+"%
"; else html+="
Luck: "+round(character.luckm*100)+"%
"; } html+="
"; $("#rightcornerui").html(html); topright_npc="character"; } function render_conditions(player) { var html="
",current=0,rids=[]; for(var condition in player.s) { if(G.skills[condition] && G.skills[condition].ui) { console.log("here"); var def=G.skills[condition],rid=randomStr(30); html+=item_container({skin:def.skin,loader:"cplc"+rid}); rids.push([rid,24000,player.s[condition].ms]); current+=1; continue; } var prop=G.conditions[condition],actual=player.s[condition]; if(!actual.skin && (!prop || (!prop.ui && (!actual.s || actual.s<20)))) continue; if(player.type=="monster" && condition=="poisonous") continue; if(current>0 && !(current%2)) html+="
"; current+=1; html+=item_container({skin:actual.skin||prop.skin,onclick:"condition_click('"+condition+"')"},actual); } for(var event in (player.q||{})) { if(event=="exchange") { var level=0; var name=player.q.exchange.name; var q=undefined; // if(player.q.exchange.s) level=player.q.exchange.s; // if(player.q.exchange.q>1) q=player.q.exchange.q; current+=1; html+=item_container({skin:G.items[name].skin,bcolor:"#E9973A"},{name:name,level:level,q:q}); } } html+="
"; if(current) { if($('.rconditions').length) $('.rconditions').replaceWith(html); else $(".renderedinfo").append(html); if(rids.length) { for(var i=0;i").appendTo("body").click(function(event){ event.stopPropagation(); event.preventDefault(); var elements=document.elementsFromPoint(event.pageX,event.pageY); for(var i=0;i"; if(monster.dead) name+=" X",monster.hp=0; if(monster.level>1) name+=" Lv."+monster.level; var hp=monster.hp,max_hp=monster.max_hp,xp=monster.xp; if(max_hp>=1000000) hp=to_pretty_num(hp),max_hp=to_pretty_num(max_hp); if(xp>=1000000) xp=to_pretty_num(xp); html+=info_line({line:name,color:"gray",onclick:"render_monster_info('"+monster.mtype+"')"}); html+=info_line({name:"HP",color:colors.hp,value:hp+"/"+max_hp,cursed:monster.s.cursed,stunned:!monster.attack&&monster.s.stunned,poisoned:!monster.attack&&monster.s.poisoned}); html+=info_line({name:"XP",color:"green",value:xp}); if(monster.attack) html+=info_line({name:"ATT",color:"#316EE6",value:smart_num(monster.attack,10000),stunned:monster.s.stunned,poisoned:monster.s.poisoned}); if(def.avoidance) html+=info_line({name:"AVOIDANCE",color:"gray",value:def.avoidance+"%"}); if(def.evasion) html+=info_line({name:"EVASION",color:"gray",value:def.evasion+"%"}); if(def.reflection) html+=info_line({name:"REFLECT.",color:"gray",value:def.reflection+"%"}); if(def.dreturn) html+=info_line({name:"D.RETURN",color:"gray",value:def.dreturn+"%"}); if(monster.armor) html+=info_line({name:"ARMOR",color:"gray",value:monster.armor}); if(monster.resistance) html+=info_line({name:"RESIST.",color:"gray",value:monster.resistance}); if(def.rpiercing) html+=info_line({name:"PIERCE.",color:"gray",value:def.rpiercing}); if(def.apiercing) html+=info_line({name:"PIERCE.",color:"gray",value:def.apiercing}); if(def.explosion) html+=info_line({name:"EXPL.",color:"gray",value:def.explosion}); if(monster.lifesteal) html+=info_line({name:"LIFESTEAL",color:colors.lifesteal,value:monster.lifesteal+"%"}); if(monster["1hp"]) html+=info_line({line:"1HP HITS",color:"#AEAEAE"}); if(monster.cooperative) html+=info_line({line:"COOPERATIVE",color:"#AEAEAE"}); if(def.immune) html+=info_line({line:"IMMUNE",color:"#AEAEAE"}); if(def.peaceful) html+=info_line({line:"PEACEFUL",color:"#54B25F"}); if(def.supporter) html+=info_line({line:"SUPPORTER",color:"#CA5931"}); //if (def.spawns) html += info_line({ line: "SPAWNS", color: "#AEAEAE" }); this is just adding an extra line to the mob UI if(def.abilities) { for(var id in def.abilities) { if(!G.skills[id]) continue; html+=info_line({name:def.abilities[id].aura&&"AURA"||"ABILITY",color:"#FC5F39",value:G.skills[id].name.toUpperCase(),onclick:"dialogs_target=xtarget||ctarget; render_skill('#topleftcornerdialog','"+id+"')"}); } } if (def.spawns) { // Collect info const spawnInfo = {}; def.spawns.forEach(function (s) { const condition = s[0]; const name = s[1]; const count = s[2] || 1; if (!spawnInfo[name]) { spawnInfo[name] = { timers: [], thresholds: [] }; } if (typeof condition === "number") { spawnInfo[name].timers.push({ interval: condition, count }); } else if (typeof condition === "string" && condition.startsWith("hp:")) { const threshold = parseFloat(condition.split(":")[1]); spawnInfo[name].thresholds.push({ threshold, count }); } }); // Build lines Object.keys(spawnInfo).forEach((name) => { const info = spawnInfo[name]; let lines = []; // Timers info.timers.forEach(t => { lines.push(`${t.count} ${G.monsters[name].name}${t.count > 1 ? "s" : ""} every ${t.interval}ms`); }); // HP thresholds if (info.thresholds.length === 1) { const t = info.thresholds[0]; lines.push(`${t.count} ${G.monsters[name].name}${t.count > 1 ? "s" : ""} at ${t.threshold * 100}% hp`); } else if (info.thresholds.length > 1) { // Sort thresholds high → low info.thresholds.sort((a, b) => b.threshold - a.threshold); const percents = info.thresholds.map(t => t.threshold * 100); const counts = [...new Set(info.thresholds.map(t => t.count))]; if (counts.length === 1) { // Check if evenly spaced const diffs = percents.map((p, i) => i > 0 ? percents[i - 1] - p : null).slice(1); const allEqual = diffs.every(d => d === diffs[0]); if (allEqual) { // Summarized lines.push(`${counts[0]} ${G.monsters[name].name}${counts[0] > 1 ? "s" : ""} every ${diffs[0]}% hp`); } else { // Generic lines.push(`Spawns ${G.monsters[name].name} at hp thresholds`); } } else { // Generic if counts differ lines.push(`Spawns ${G.monsters[name].name} at hp thresholds`); } } // Add to tooltip lines.forEach(line => { html += info_line({ name: "SPAWNS", color: "#237B2A", value: line, onclick: "render_monster_info('" + name + "')" }); }); }); } if(monster.target) html+=info_line({name:"TRG",color:"orange",value:monster.target}); if(monster.pet) { html+=info_line({name:"NAME",value:monster.name,color:"#5CBD97"}); html+=info_line({name:"PAL",value:monster.owner,color:"#CF539B"}); } if(monster.heal) { html+=info_line({line:"SELF HEALING",color:"#9E6367"}); } if(character) { var diff=calculate_difficulty(monster); if(diff>=2) html+=info_line({name:"DIFF.",color:"gray",value:"Hard",vcolor:"#ED4047"}); else if(diff) html+=info_line({name:"DIFF.",color:"gray",value:"Challenging",vcolor:"#EF9232"}); else html+=info_line({name:"DIFF.",color:"gray",value:"Easy",vcolor:"#8BF54D"}); } if(def.poisonous) { html+=info_line({line:"POISONOUS",color:colors.poison}); } if(def.explanation) { html+=info_line({line:def.explanation,color:"gray"}); } html+=button_line({name:"{}: INSPECT",onclick:"ui_inspect(xtarget||ctarget)",color:colors.inspect}); html+=""; $("#topleftcornerui").html(html); render_conditions(monster); } var cache_bid=-1; function render_character(player) { var html="
",cccx=$('.cccx').length,ihtml="",bhtml="",xhtml="",already=false; if($('.renderedinfo').length && $('.renderedinfo').data('id')==player.id) already=true; html+=info_line({name:player.role&&player.role.toUpperCase()||"NAME",color:player.role&&"#E14F8B"||"gray",value:player.name,onclick:"render_cosmetics(xtarget||ctarget,{toggle:true})"}); html+="
"; ihtml+=info_line({name:"LEVEL",color:"orange",value:player.level,afk:player.afk}); ihtml+=info_line({name:"HP",color:colors.hp,value:player.hp+"/"+player.max_hp}); ihtml+=info_line({name:"MP",color:"#365DC5",value:player.mp+"/"+player.max_mp}); if(player.heal) ihtml+=info_line({name:"HEAL",color:"#CB83AC",value:round(player.heal)}); ihtml+=info_line({name:"ATT",color:"green",value:round(player.attack),cursed:player.s.cursed}); ihtml+=info_line({name:"ATTSPD",color:"gray",value:round(player.frequency*100),poisoned:player.s.poisoned}); ihtml+=info_line({name:"RANGE",color:"gray",value:player.range}); ihtml+=info_line({name:"RUNSPD",color:"gray",value:round(player.speed)}); ihtml+=info_line({name:"ARMOR",color:"gray",value:player.armor||0}); ihtml+=info_line({name:"RESIST.",color:"gray",value:player.resistance||0}); if(player.code) ihtml+=info_line({name:"CODE",color:"gold",value:"Active"}); if(player.party) ihtml+=info_line({name:"PARTY",color:"#FF4C73",value:player.party}); html+=ihtml; html+="
"; html+="
"; xhtml+=button_line({name:"{}: INSPECT",onclick:"ui_inspect(xtarget||ctarget)",color:colors.inspect}); html+=xhtml; html+="
"; var bid=player.party+"|"+player.stand+"|"+(character.slots.trade1!==undefined); html+="
"; if(!player.party && character && !player.me && !player.stand) bhtml+=button_line({name:"PARTY",onclick:"socket.emit('party',{event:'invite',id:'"+player.id+"'}); push_deferred('party')",color:"#6F3F87",pm_onclick:"cpm_window('"+(player.controller||player.name)+"')"}); if(character && !player.me && (character.party && player.party==character.party && party_list.indexOf(character.name)"+info.value+""; if(info.afk && info.afk=="bot") addition=" [BOT]"; else if(info.afk && info.afk=="code") addition=" [CODE]"; else if(info.afk) addition=" [AFK]"; if(info.cursed) addition=" [C]"; if(info.poisoned) addition=" [P]"; if(info.stunned) addition=" [STUN]"; if(info.line) { if(info.onclick) info.line=""+info.line+""; html+=""+info.line+""+addition+"
"; } else if(info.vcolor) html+=""+info.name+": "+info.value+addition+"
"; else html+=""+info.name+": "+info.value+addition+"
"; return html; } function button_line(button,no_newline) { var html="",color=button.color||"white"; html+=""+button.name+" "; if(button.pm_onclick) html+=" PM "; if(!no_newline) html+="
"; return html; } var cache_slots={},cache_sid=-1; function render_slots(player,args) { if(!args) args={}; function render_slot(slot,shade,op) { var ecolor=undefined,chtml="",cached=cache_slots&&cache_slots[slot],cid='slot'+slot; // empty border color if(!window.mode || mode.empty_borders_darker) ecolor="#222424",ecolor="#292929"; //,ecolor="black"; if(!op) op=0.4; if(player.slots[slot]) { var current=player.slots[slot]; var id='item'+randomStr(10),item=G.items[current.name]; if(!item) item=G.items.placeholder_m; var skin=current.skin||item.skin; if(current.expires) skin=item.skin_a; if((current.name=="tristone" || current.name=="darktristone") && (player.skin.startsWith("mm_") || player.skin.startsWith("mf_") || player.skin.startsWith("tm_") || player.skin.startsWith("tf_"))) skin=item.skin_a; chtml+=item_container({skin:skin, onclick:args.merchant&&"mslot_click('"+player.name+"','"+slot+"')"||args.gallery&&window['slots'+player.name]&&"pslot_click('"+player.name+"','"+slot+"')"||args.gallery&&"render_item_info('"+current.name+"',"+current.level+")"||"slot_click('"+slot+"')", def:item,id:id,cid:cid,draggable:player.me, sname:player.me&&slot,shade:shade,s_op:op,slot:slot},current); // num:slot is new [06/08/16] } else if(in_arr(slot,trade_slots) && player.me) chtml+=item_container({size:40,draggable:player.me,shade:shade,s_op:op,slot:slot,cid:cid,onclick:"wishlist_click('"+slot+"')",bcolor:ecolor}); else chtml+=item_container({size:40,draggable:player.me,shade:shade,s_op:op,slot:slot,cid:cid,bcolor:ecolor}); html+=chtml; if(already && !ui_items_same(cached,current)) $('#slot'+slot).replaceWith(chtml); } var my_slots=(player.me && player.slots.trade1!==undefined || (player.slots.trade1||player.slots.trade2||player.slots.trade3||player.slots.trade4)) && !player.stand; var draggable=player.me,already=false,sid=player.stand+"|"+my_slots; if(!args.pure && $('.slots').length && $('.slots').data('id')==player.id && sid==cache_sid) already=true; else cache_slots={}; var html="
"; if(args.pure) html=""; if(player.stand) { var row=4,col=4,found=false; for(var t=30;t>=25;t--) if(("trade"+t) in player.slots) row=5,col=6,found=true; for(var t=24;t>=17;t--) if(!found && ("trade"+t) in player.slots) row=4,col=6,found=true; html+="
" for(var i=0;i{}
" if(args.cx && 0) html+="
COSMETICS
" if(!args.pure) html+="
"; if(!args.pure && !already) { if($('.slots').length) $('.slots').replaceWith(html); else $("#topleftcornerui").append(html); } cache_slots=Object.assign({},player.slots); cache_sid=sid; return html; // for character.html [19/11/18] // console.log(JSON.stringify(collection)); } function render_transports_npc() { reset_inventory(1); topleft_npc="transports"; rendered_target=topleft_npc; e_item=null; var html="
"; html+="
> Mainland
"; html+="
> Winterland
"; // XMAS!! // html+="
> New Town [Very Soon!]
"; // html+="
> Underworld
"; // [Soon!] html+="
> Desertland
"; // [Soon!] // html+="
> Spooky Forest
"; // [Halloween!] if(S.duels) { for(var name in S.duels) { var duel=S.duels[name]; html+="
> Duelland "+duel.challenger+" vs "+duel.vs+"
"; } } html+="
"; $("#topleftcornerui").html(html); } function send_mainframe_command() { var command=$(".maincommand").html(); command=command.replace(" ",""); //show_json(command); socket.emit("eval",{command:command}); $(".maincommand").html(""); setTimeout(function() { $(".maincommand").cfocus(); },0); } function render_mainframe() { reset_inventory(1); topleft_npc="mainframe"; rendered_target=topleft_npc; var html="
"; html+="
mainframe> connected
"; html+="
mainframe>
"; html+="
logout
"; html+="
"; $("#topleftcornerui").html(html); $(".maincommand").keydown(function(e){ if(e.keyCode===13) { send_mainframe_command(); return false; } }); setTimeout(function() { $(".maincommand").cfocus(); },0); } function render_gold_npc() { reset_inventory(1); topleft_npc="gold"; rendered_target=topleft_npc; e_item=null; var html="
"; html+="
GOLD: "+(character.user&&to_pretty_num(character.user.gold)||"Unavailable")+"
"; html+="
Amount:
0
"; html+="
"; if(options.bank_max) html+="
MAX
"; html+="
DEPOSIT
WITHDRAW
"; html+="
"; $("#topleftcornerui").html(html); cfocus('.npcgold'); } var last_rendered_items="items0"; function render_items_npc(pack) { if(!character.user) return; if(!pack) pack=last_rendered_items; if(pack && !character.user[pack]) { render_interaction("unlock_"+pack,undefined,{pack:pack}); topleft_npc="items"; rendered_target=topleft_npc; last_rendered_items=pack; // needs to be after render_interaction return; } last_rendered_items=pack; reset_inventory(1); topleft_npc="items"; rendered_target=topleft_npc; var collection=[],last=0,items=character.user[pack]||[]; var html="
"; for(var i=0;i"; if(c_enabled) { if(is_comm) { html+="
"; // ' html+="SHELLS: "+to_pretty_num(character.cash||0)+"
"; html+="
"; right_style=""; } else if(is_electron) { html+="
"; // ' html+="SHELLS: "+to_pretty_num(character.cash||0)+"
"; right_style=" display: inline-block; float: right"; } else { html+="
"; // onclick='shells_click()' html+="SHELLS: "+to_pretty_num(character.cash||0)+"
"; right_style=" display: inline-block; float: right"; } } html+="
GOLD: "+to_pretty_num(character.gold)+"
"; html+="
"; for(var i=0;i
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; } function render_dismantler() { var shade="fclaw",button="DISMANTLE"; reset_inventory(1); topleft_npc="dismantler"; rendered_target=topleft_npc; ds_item=null; var html="
"; /*html+="
"; html+="
"; html+="
"; //html+="
";*/ html+="
"; html+=item_container({shade:shade,cid:'dsitem',s_op:0.36,draggable:false,droppable:true}); html+="
"; //html+="
"; /*html+="
"; html+="
"; html+="
";*/ html+="
"+button+"
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; } var last_lmode="lock"; function render_locksmith(mode) { if(!mode) mode=last_lmode; last_lmode=mode; var button="LOCK",f="lock_item",shade="shade_seal"; if(mode=="unlock") button="UNLOCK",f="unlock_item",shade="shade_unlock"; if(mode=="seal") button="SEAL",f="seal_item",shade="shade_lock"; reset_inventory(1); topleft_npc="locksmith"; rendered_target=topleft_npc; l_item=null; var html="
"; /*html+="
"; html+="
"; html+="
"; //html+="
";*/ html+="
"; html+=item_container({shade:shade,cid:'litem',s_op:0.4,draggable:false,droppable:true}); html+="
"; //html+="
"; /*html+="
"; html+="
"; html+="
";*/ html+="
"+button+"
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; } function render_scrollsmith() { var button="DE-STAT",f="destat_item",shade="shade_chest"; reset_inventory(1); topleft_npc="scrollsmith"; rendered_target=topleft_npc; s_item=null; var html="
"; /*html+="
"; html+="
"; html+="
"; //html+="
";*/ html+="
"; html+=item_container({shade:shade,cid:'sitem',s_op:0.4,draggable:false,droppable:true}); html+="
"; //html+="
"; /*html+="
"; html+="
"; html+="
";*/ html+="
"+button+"
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; } function render_recipe(element,type,name) { last_selector="#recipe-item"; var html; if(type!="dismantle") { html=render_item("html",{item:G.items[name],name:name,craft:true}); } else { html=render_item("html",{item:G.items[name],name:name,dismantle:true}); } if(element) $("#recipe-item").html(html); else show_modal(html,{wrap:false,hideinbackground:true}); } var r_page={}; function render_recipes(type) { if(!type) type=""; reset_inventory(1); topleft_npc="recipes"; rendered_target=topleft_npc; var last=0,items=[]; var html="
"; if(type=="dismantle") { object_sort(G.dismantle,"gold_value").forEach(function(e){ items.push(e[0]); }); } else { object_sort(G.craft,"gold_value").forEach(function(e){ if((e[1].quest||"")!=type) return; items.push(e[0]); }); } r_page[type]=r_page[type]||0; if(r_page[type]>=1) last+=19+(r_page[type]-1)*18; for(var i=0;i<4;i++) { html+="
" for(var j=0;j<5;j++) { if(i==3 && j==0 && r_page[type]!=0) html+=item_container({skin:"left",onclick:"r_page['"+type+"']="+(r_page[type]-1)+"; render_recipes('"+type+"');"},{q:r_page[type],left:true}); else if(i==3 && j==4 && last"; next_side_interaction=null; $("#topleftcornerui").html(html); } function render_recipes_old(quest) { topleft_npc="recipes"; rendered_target=topleft_npc; i=0; var html="
"; html+="
CRAFT
"; object_sort(G.craft).forEach(function(io){ if(io[1].quest!=quest) return; var name=io[0]; html+=item_container({skin:G.items[name].skin,onclick:"render_recipe(null,'craft','"+name+"')"},{name:name}); i+=1; if(!(i%6)) html+="
"; }); html+="
DISMANTLE
"; i=0; object_sort(G.dismantle).forEach(function(io){ if(io[1].quest!=quest) return; var name=io[0]; html+=item_container({skin:G.items[name].skin,onclick:"render_recipe(null,'dismantle','"+name+"')"},{name:name}); i+=1; if(!(i%6)) html+="
"; }); html+="
"; $("#topleftcornerui").html(html); } function render_exchange_shrine(type) { var shade="shade_exchange",button="EXCHANGE"; var originals=[e_item]; reset_inventory(1); topleft_npc="exchange"; rendered_target=topleft_npc; exchange_type=type; if(type=="leather") shade="leather",button="GIVE"; if(type=="lostearring") shade="lostearring",button="PROVIDE"; if(type=="mistletoe") shade="mistletoe",button="GIVE IT"; if(type=="candycane") shade="candycane",button="FEED"; if(type=="ornament") shade="ornament",button="GIVE"; if(type=="seashell") shade="seashell",button="GIVE"; if(type=="gemfragment") shade="gemfragment",button="PROVIDE"; if(type=="cx") shade="cosmo0",button="SHAZAM"; e_item=null; var html="
"; html+="
"; html+="
"; html+="
"; //html+="
"; if(character.q.exchange) { var level=character.q.exchange.s||0; var name=character.q.exchange.name; var q=undefined; if(character.q.exchange.q>1) q=character.q.exchange.q; html+=item_container({cid:'eitem',draggable:false,droppable:false,skin:G.items[name].skin},{name:name,level:level,q:q}); } else html+=item_container({shade:shade,cid:'eitem',s_op:0.5,draggable:false,droppable:true}); //html+="
"; html+="
"; html+="
"; html+="
"; html+="
"+button+"
"; html+="
"; html+="
"+"
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; return !character.q.exchange&&originals||[]; } function render_pet_shrine() { var button="RELEASE"; var originals=[e_item]; reset_inventory(1); e_item=null; var html="
"; html+="
"; html+="
"; html+="
"; //html+="
"; if(character.q.exchange) { var level=character.q.exchange.s||0; var name=character.q.exchange.name; var q=undefined; if(character.q.exchange.q>1) q=character.q.exchange.q; html+=item_container({cid:'eitem',draggable:false,droppable:false,skin:G.items[name].skin},{name:name,level:level,q:q}); } else { html+=item_container({shade:"pball",cid:'eitem',s_op:0.5,draggable:false,droppable:true}); html+=item_container({shade:"chry",cid:'eitem',s_op:0.5,draggable:false,droppable:true}); } //html+="
"; html+="
"; html+="
"; html+="
"; html+="
RELEASE
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; return !character.q.exchange&&originals||[]; } function render_none_shrine(type) { var shade="cape0",button="POOF"; reset_inventory(1); topleft_npc="none"; rendered_target=topleft_npc; p_item=null; var html="
"; html+="
"; html+="
"; html+="
"; //html+="
"; html+=item_container({shade:shade,cid:'pitem',s_op:0.5,draggable:false,droppable:true}); //html+="
"; html+="
"; html+="
"; html+="
"; html+="
"+button+"
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; } function render_shells_buyer() { topleft_npc="buyshells"; rendered_target=topleft_npc; var html="
",prefix=""; html+="
10 Shells = 1,500,000 BUY
"; html+="
100 Shells = 15,000,000 BUY
"; html+="
500 Shells = 75,000,000 BUY
"; html+="
1,000 Shells = 150,000,000 BUY
"; if(!is_electron) prefix="Buy With $ | " html+="
"+prefix+"Nope
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; } function render_upgrade_shrine(explicit) { reset_inventory(1); var originals=[u_item,u_scroll,u_offering],already=(topleft_npc=="upgrade"); topleft_npc="upgrade"; rendered_target=topleft_npc; u_item=null,u_scroll=null,u_offering=null; var html="
",rid=randomStr(6),core=""; html+="
"; if(character.q.upgrade && character.items[character.q.upgrade.num] && character.items[character.q.upgrade.num].name=="placeholder") { var def=character.items[character.q.upgrade.num].p; core+="
"; core+=item_container({skin:G.items[def.name].skin,pui:def},{name:def.name,level:def.level}); core+="
"; core+="
"; if(def.offering) core+=item_container({skin:G.items[def.offering].skin,loader:!def.scroll&&"theuitem"+rid},{name:def.offering}); else core+=item_container({shade:"shade_offering",s_op:0.36}); if(def.scroll) core+=item_container({skin:G.items[def.scroll].skin,loader:"theuitem"+rid},{name:def.scroll}); else core+=item_container({draggable:false,droppable:true,shade:"shade_scroll",cid:'uscroll',s_op:0.36}); core+="
"; } else { core+="
"; core+=item_container({draggable:false,droppable:true,shade:"shade_uweapon",cid:'uweapon',s_op:0.36,pui:true}); core+="
"; core+="
"; core+=item_container({draggable:false,droppable:true,shade:"shade_offering",cid:'uoffering',s_op:0.36}); // previously 0.24 core+=item_container({draggable:false,droppable:true,shade:"shade_scroll",cid:'uscroll',s_op:0.36}); core+="
"; } html+=core; html+="
"; html+="
RESET
"; html+="
UPGRADE
"; html+="
"; if(already) $("#core").html(core); else $("#topleftcornerui").html(html); if(character.q.upgrade) { $(".loadertheuitem"+rid).css("opacity",0.8); add_tint(".loadertheuitem"+rid,{ms:character.q.upgrade.ms,start:future_ms(character.q.upgrade.ms-character.q.upgrade.len),type:"progress",upgrade:true}); } if(!inventory && explicit) render_inventory(),inventory_opened_for=topleft_npc; return !character.q.upgrade&&originals||[]; } function render_compound_shrine(explicit) { reset_inventory(1); var originals=[c_items[0],c_items[1],c_items[2],c_scroll,c_offering],already=(topleft_npc=="compound"); topleft_npc="compound"; rendered_target=topleft_npc; c_items=e_array(3),c_scroll=null,c_offering=null; c_last=0; var html="
",rid=randomStr(6),core=""; html+="
"; html+="
"; // for pui:true [13/06/19] if(character.q.compound && character.items[character.q.compound.num] && character.items[character.q.compound.num].name=="placeholder") { var def=character.items[character.q.compound.num].p; core+="
"; core+=item_container({skin:G.items[def.name].skin},{name:def.name,level:def.level}); core+=item_container({skin:G.items[def.name].skin},{name:def.name,level:def.level}); core+=item_container({skin:G.items[def.name].skin},{name:def.name,level:def.level}); core+="
"; core+="
"; if(def.offering) core+=item_container({skin:G.items[def.offering].skin},{name:def.offering}); else core+=item_container({shade:"shade_offering",s_op:0.36}); core+=item_container({skin:G.items[def.scroll].skin,pui:def,loader:"theuitem"+rid},{name:def.scroll}); core+="
"; } else { core+="
"; core+=item_container({draggable:false,droppable:true,shade:"shade_cring",cid:'compound0',s_op:0.36}); core+=item_container({draggable:false,droppable:true,shade:"shade_cring",cid:'compound1',s_op:0.36}); core+=item_container({draggable:false,droppable:true,shade:"shade_cring",cid:'compound2',s_op:0.36}); core+="
"; core+="
"; core+=item_container({draggable:false,droppable:true,shade:"shade_offering",cid:'coffering',s_op:0.36}); core+=item_container({draggable:false,droppable:true,shade:"shade_cscroll",cid:'cscroll',s_op:0.36,pui:true}); core+="
"; } html+=core; html+="
"; html+="
"; html+="
RESET
"; html+="
COMBINE
"; html+="
"; if(already) $("#core").html(core); else $("#topleftcornerui").html(html); if(character.q.compound) { $(".loadertheuitem"+rid).css("opacity",0.8); add_tint(".loadertheuitem"+rid,{ms:character.q.compound.ms,start:future_ms(character.q.compound.ms-character.q.compound.len),type:"progress",compound:true}); } if(!inventory && explicit) render_inventory(),inventory_opened_for=topleft_npc; return !character.q.compound&&originals||[]; } var dice_bet={active:false,dir:1}; function on_dice_change() { if(topleft_npc!="dice") return; var num=min(99.99,max(0,parseFloat($(".dicenum").html()))),mult; var gold=parseInt($(".dicegold").html().replace_all(",","")); if(!gold) gold=100000; gold=max(10000,gold); $(".dicegold").html(to_pretty_num(gold)); dice_bet.gold=gold; var hnum=num.toFixed(2); if(hnum.length!=5) hnum="0"+hnum; $(".dicenum").html(hnum); dice_bet.num=hnum; num=parseFloat(hnum); if(dice_bet.dir==1) { mult=100.0/(100.0-num); $(".diceup").css("border-color","#A7C16D"); $(".dicedown").css("border-color","gray"); } else { mult=100.0/num; $(".diceup").css("border-color","gray"); $(".dicedown").css("border-color","#A7C16D"); } mult=min(mult,10000); $(".dicexx").html("FOR "+to_pretty_float(mult)+"X"); if(dice_bet.active) $(".diceb").css("border-color","gold"); else $(".diceb").css("border-color","gray"); } function on_dice_bet() { var num=min(99.99,max(0,parseFloat($(".dicenum").html()))); var gold=parseInt($(".dicegold").html().replace_all(",","")); dice(dice_bet.dir,num,gold); } function render_dice() { var num=dice_bet.num||"50.00"; var gold=dice_bet.gold||100000; reset_inventory(1); topleft_npc="dice"; rendered_target=topleft_npc var html="
"; html+="
"; html+="
NUMBER:
"+num+"
"; html+="
"; html+="
"; html+="
GOLD:
"+to_pretty_num(gold)+"
"; html+="
"; html+="
"; html+="
UP
"; html+="
DOWN
"; html+="
"; html+="
"; html+="
BET FOR 2X
"; html+="
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; on_dice_change(); } function render_tavern_info(data) { topleft_npc="info"; rendered_target=topleft_npc var html="
"; html+="
"; html+="
House Edge
"; html+="
"; html+="
"; html+="
"+data.edge.toFixed(2)+"%
"; html+="
"; html+="
"; html+="
Max. Net Win
"; html+="
"; html+="
"; html+="
"+to_pretty_num(data.max)+"
"; html+="
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; } function on_donate_change() { if(topleft_npc!="donate") return; var gold=parseInt($(".dgold").html().replace_all(",","")); if(!gold) gold=100000; gold=max(1,gold); $(".dgold").html(to_pretty_num(gold)); dice_bet.gold=gold; } function render_donate() { var gold=10000000; reset_inventory(1); topleft_npc="donate"; rendered_target=topleft_npc var html="
"; html+="
"; html+="
GOLD:
"+to_pretty_num(gold)+"
"; html+="
"; html+="
"; html+="
DONATE
"; html+="
"; html+="
"; $("#topleftcornerui").html(html); if(!inventory) render_inventory(),inventory_opened_for=topleft_npc; on_donate_change(); } function render_merchant(npc,premium) { reset_inventory(1); topleft_npc="merchant"; rendered_target=topleft_npc; merchant_id=npc.id; var last=0,collection=[]; var html="
",f="buy_with_gold"; if(premium) f="buy_with_shells"; for(var i=0;i<4;i++) { html+="
" for(var j=0;j<5;j++) { if(last"; next_side_interaction=null; $("#topleftcornerui").html(html); for(var i=0;i=1) last+=19+(t_page[token]-1)*18; for(var i=0;i<4;i++) { html+="
" for(var j=0;j<5;j++) { if(i==3 && j==0 && t_page[token]!=0) html+=item_container({skin:"left",onclick:"t_page['"+token+"']="+(t_page[token]-1)+"; render_token_exchange('"+token+"');"},{q:t_page[token],left:true}); else if(i==3 && j==4 && last"; next_side_interaction=null; $("#topleftcornerui").html(html); for(var i=0;i"; skin="shells"; } else if(def[1]=="gold") { html+="
"+to_shrinked_num(def[2])+"
"; skin="gold"; } if(def[1]=="cx") html+=cx_sprite(def[2],{mright:4}); else if(def[1]=="cxbundle") { G.cosmetics.bundle[def[2]].forEach(function(cid){ html+=cx_sprite(cid,{mright:4}); }); } else html+=""+item_container({skin:skin},actual)+""; if(def[0]*mult>=1) html+="
"+to_pretty_float(def[0]*mult)+" / 1
"; else if(1/(def[0]*mult)>=1.1 && 1/(def[0]*mult)<10 && parseInt(1/(def[0]*mult))*10!=parseInt(10/(def[0]*mult))) html+="
10 / "+to_pretty_num(round(10/(def[0]*mult)))+"
"; else html+="
1 / "+(((1/(def[0]*mult))>=2)&&to_pretty_num(round(1/(def[0]*mult)))||to_pretty_float(1/(def[0]*mult)))+"
"; html+="
"; return html; } function smart_smart_move(type,id) { if(type=="npc") { var npc=G.npcs[id]; show_confirm("Smart move to "+npc.name+"?","Yes","Cancel",function(){ hide_modals(); call_code_function_f("smart_move",id); }); } else if(type=="monster") { var m=G.monsters[id]; show_confirm("Smart move to "+m.name+"'s?","Yes","Cancel",function(){ hide_modals(); call_code_function_f("smart_move",id); }); } else if(type=="map") { var m=G.maps[id]; show_confirm("Smart move to "+m.name+"?","Yes","Cancel",function(){ hide_modals(); call_code_function_f("smart_move",id); }); } } function render_equip_info(name) { var def=G.items[name],html=""; html+="
"; html+="
"+(weapon_types[def.wtype]||offhand_types[def.type]||def.wtype||def.type).toTitleCase()+"
"; ["ranger","rogue","warrior","mage","priest","paladin","merchant"].forEach(function(ctype) { var color="#DDDDDD"; if(window.character && character.ctype==ctype) color="#36813A"; else if(window.character) color="#666870"; if(G.classes[ctype].mainhand[def.wtype||def.type]) { html+="
"; html+="
["+ctype.toTitleCase()+"] Mainhand
"; var s=render_item("html",{item:{},prop:G.classes[ctype].mainhand[def.wtype||def.type],pure:true}); if(!s) html+="
No Modifier
"; else html+=s; html+="
"; } if(G.classes[ctype].doublehand[def.wtype||def.type]) { html+="
"; html+="
["+ctype.toTitleCase()+"] Doublehand
"; var s=render_item("html",{item:{},prop:G.classes[ctype].doublehand[def.wtype||def.type],pure:true}); if(!s) html+="
No Modifier
"; else html+=s; html+="
"; html+="
"; } if(G.classes[ctype].offhand[def.wtype||def.type]) { html+="
"; html+="
["+ctype.toTitleCase()+"] Offhand
"; var s=render_item("html",{item:{},prop:G.classes[ctype].offhand[def.wtype||def.type],pure:true}); if(!s) html+="
No Modifier
"; else html+=s; html+="
"; html+="
"; } }); html+="
"; show_modal(html,{wrap:false,hideinbackground:true}); } function render_item_help(container,name,level,pure) { var html="",names=[name]; html+="
"; for(var depth=0;depth<3;depth++) { for(var dname in G.drops) { if(in_arr(dname,names) || dname=="glitch" || dname=="lglitch") continue; var table=G.drops[dname]; for(var i=0;i
"+sprite(npc.skin,{width:50,height:50})+"
"+npc.name+"
"; }); } if(G.items[name].type=="token") { html+="
Spend At:
"; var npc={},npc_id=null; for(var nname in G.npcs) if(G.npcs[nname].token==name) npc=G.npcs[nname],npc_id=nname; html+="
"; html+="
"+sprite(npc.skin,{width:50,height:50})+"
"+npc.name+"
"; html+="
"; } if(tokens.length) { html+="
Acquirable From:
"; tokens.forEach(function(token){ var npc={},npc_id=null; for(var nname in G.npcs) if(G.npcs[nname].token==token) npc=G.npcs[nname],npc_id=nname; html+="
"; html+="
"+sprite(npc.skin,{width:50,height:50})+"
"+npc.name+"
"; html+="
with
"; html+=item_container({skin:G.items[token].skin,onclick:"stpr(event); render_item_popup('"+token+"')"},{name:token}); html+="
"; }); } if(G.items[name].e) { var npc=G.npcs.exchange,phrase="Exchange From",id="exchange"; for(var nname in G.npcs) if(G.items[name].quest && G.npcs[nname].quest==G.items[name].quest) npc=G.npcs[nname],phrase="Bring To",id=nname; html+="
"+phrase+":
"; html+="
"+sprite(npc.skin,{width:50,height:50})+"
"+npc.name+"
"; html+="
Drop Table:
"; html+=item_container({skin:G.items[name].skin,onclick:"stpr(event); render_exchange_info('"+(name+((G.items[name].upgrade||G.items[name].compound)&&(level||"0")||""))+"')"},{name:name,level:(G.items[name].upgrade||G.items[name].compound)&&level}); } if(G.items[name].upgrade || G.items[name].compound) { var npc=G.npcs.newupgrade,phrase="Upgrade At",id="newupgrade"; if(G.items[name].compound) phrase="Combine 3 At"; html+="
"+phrase+":
"; html+="
"+sprite(npc.skin,{width:50,height:50})+"
"+npc.name+"
"; var phrase="Buy Scrolls From",npc=G.npcs.scrolls,id="scrolls"; html+="
"+phrase+":
"; html+="
"+sprite(npc.skin,{width:50,height:50})+"
"+npc.name+"
"; } if(crafting.length) { html+="
Used For Crafting:
"; crafting.forEach(function(i){ html+=item_container({skin:G.items[i].skin,onclick:"stpr(event); render_recipe(null,'','"+i+"')"},{name:i}); }); } if(collecting.length) { html+="
Collectable For:
"; collecting.forEach(function(i){ html+=item_container({skin:G.items[i].skin,onclick:"stpr(event); render_recipe(null,'mcollector','"+i+"')"},{name:i}); }); } if(G.craft[name]) { var phrase="Craftable At",npc=G.npcs.craftsman,id="craftsman",rphrase="Recipe"; if(G.craft[name].quest=="mcollector") phrase="Obtainable From",npc=G.npcs.mcollector,id="mcollector",rphrase="Materials"; if(G.craft[name].quest=="witch") phrase="Concoctiable At",npc=G.npcs.witch,id="witch",rphrase="Materials"; html+="
"+phrase+":
"; html+="
"+sprite(npc.skin,{width:50,height:50})+"
"+npc.name+"
"; html+=""+bold_prop_line("Show",rphrase,"#6F75DC")+""; } if(G.dismantle[name]) { html+="
Dismantle At:
"; var npc=G.npcs.craftsman,id="craftsman"; html+="
"+sprite(npc.skin,{width:50,height:50})+"
"+npc.name+"
"; } if(monsters.length) { html+="
Drops From:
"; monsters.forEach(function(mo){ var m=mo[0]; html+="
"; html+="
"; html+=sprite(m,{scale:1.5}); html+="
"; if(mo[1]) html+="
"+to_pretty_fraction(mo[1])+"
"; // html+="
"+G.monsters[m].name+"
"; html+="
"; }); } if(maps.length) { html+="
Global Drop At:
"; maps.forEach(function(map){ if(map=="global") html+="
Everywhere
"; else html+="
"+G.maps[map].name+"
"; }); } if(items.length) { html+="
Obtainable From:
"; items.forEach(function(i){ html+=item_container({skin:G.items[i[0]].skin,onclick:"stpr(event); render_item_popup('"+i[0]+"',"+i[1]+")"},{name:i[0],level:i[1]}); }); } html+=""+bold_prop_line("Show","G.items."+name+"",colors.inspect)+""; html+="
"; // $(container).parent().replaceWith(html); if(pure) return html; show_modal(html,{wrap:false,hideinbackground:true}); } function render_item_popup(name,level) { var html=""; html+=render_item("html",{item:G.items[name],actual:{name:name,level:level},name:name}); show_modal(html,{wrap:false,hideinbackground:true}); } function render_item_info(name,level,data) { var html="
"; if(name=="empty") { html+=render_item("html",{item:{name:"Empty",explanation:"Nothing, nada, zilch."},prop:{}}); } else if(name=="shells") { html+=render_item("html",{item:{name:"Shells",explanation:"Premium currency, can be used to buy cosmetics, extra bank storage, or for account operations like transferring a character."},prop:{}}); } else if(name=="gold") { html+=render_item("html",{item:{name:"Gold",explanation:"Just gold"},prop:{}}); } else if(level!==undefined) { html+=render_item("html",{item:G.items[name],actual:{level:level,name:name,data:data},guide:true}); } else if(G.items[name].compound) { for(var i=0;i<=15;i++) { html+="
"+render_item("html",{item:G.items[name],actual:{level:i,name:name},guide:true})+"
"; if(calculate_item_grade(G.items[name],{level:i})==4) break; } } else if(G.items[name].upgrade) { for(var i=0;i<=15;i++) { html+="
"+render_item("html",{item:G.items[name],actual:{level:i,name:name},guide:true})+"
"; if(calculate_item_grade(G.items[name],{level:i})==4) break; } } else { html+=render_item("html",{item:G.items[name],name:name,actual:{name:name},guide:true}); } html+="
"+render_item_help(null,name,level,true)+"
"; html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/guide/all/items/"+name}); } function render_monster_info(name) { var html="
",parsed={},count=0,mcount=0,diff=0,mowner=""; html+="
"+sprite(name,{full:true,scale:3})+"
"; var RF=Object.keys(tracker).length&&tracker||G&&G.drops||{monsters:{},maps:{}},MR=Object.keys(tracker).length&&tracker&&tracker.drops||RF.monsters; if(tracker && tracker.monsters) { count=tracker.monsters[name]||0; diff=tracker.monsters_diff[name]||0; if(tracker.max.monsters[name]) mcount=tracker.max.monsters[name][0],mowner=tracker.max.monsters[name][1]; } html+=render_item("html",{pure:true,item:G.monsters[name],prop:G.monsters[name],monster:name,count:count,mcount:mcount,score:count+diff,mowner:mowner}); if(MR && MR[name] && MR[name].length) { html+="
Drops:
"; MR[name].forEach(function(drop){ html+=render_drop(drop,1,"#858B8E"); }); } object_sort(G.maps).forEach(function(io){ var map=io[1],mname=io[0]; if(map.ignore || !(RF.maps&&RF.maps[mname]||[]).length) return; (map.monsters||[]).forEach(function(pack){ if(parsed[mname]) return; if(pack.type==name) { parsed[mname]=true; html+="
"+map.name+":
"; RF.maps[mname].forEach(function(drop){ html+=render_drop(drop,G.monsters[name].hp/1000.0,"#858B8E"); }); } }); }); if(RF.maps && RF.maps.global_static && RF.maps.global_static.length || RF.maps && RF.maps.global && RF.maps.global.length) { var mult=1; if(G.monsters[name]["1hp"]) mult=1000; html+="
Global:
"; RF.maps.global_static.forEach(function(drop){ html+=render_drop(drop,1*mult,"#858B8E"); }); RF.maps.global.forEach(function(drop){ html+=render_drop(drop,G.monsters[name].hp*mult/1000.0,"#858B8E"); }); } html+="
"; show_modal(html,{wwidth:240,hideinbackground:true,url:"/docs/guide/all/monsters/"+name}); } function render_exchange_info(name,count) { var html="
"; html+=render_drop([1,"open",name],1,"#858B8E"); html+="
"; show_modal(html,{wwidth:240,styles:'max-width: 460px',hideinbackground:true}); } function render_tracker() { var html=""; html+="
"; html+="
Monsters
"; html+="
Exchanges and Quests
"; html+="
"; html+="
"; object_sort(G.monsters,"hpsort").forEach(function(e){ if((e[1].stationary || e[1].cute) && !e[1].achievements || e[1].unlist) return; var count=(tracker.monsters[e[0]]||0)+(tracker.monsters_diff[e[0]]||0),color="#50ADDD"; if(tracker.max.monsters[e[0]] && tracker.max.monsters[e[0]][0]>count) { count=tracker.max.monsters[e[0]][0]; color="#DCC343"; } html+="
"; html+=sprite(e[0],{scale:1.5}); if(!count) { //html+="
?
"; } else { html+="
"+to_shrinked_num(count)+"
"; } if(tracker.drops && tracker.drops[e[0]] && tracker.drops[e[0]].length) html+="
"; html+="
"; }); html+="
"; html+=""; show_modal(html,{wwidth:578,hideinbackground:true}); } function render_computer($element,type="computer",slot=0) { var html=""; html+="
CONNECTED.
"; html+="
> TRADE HISTORY
"; html+="
> TOGGLE STAND
"; if(type == "supercomputer") { html+="
> TRACKER
"; } html+="
> UPGRADE
"; // style='color: #C3C3C3' style='color: #D6D6D6' html+="
> COMPOUND
"; html+="
> EXCHANGE
"; html+="
> LOCKSMITH
"; html+="
> CRAFTING
"; html+="
> POTIONS
"; html+="
> SCROLLS
"; html+="
> BASICS
"; html+="
> PREMIUM
"; $element.html(html); } function render_skill(selector,skill_name,args) { if(!args) args={}; var actual=args.actual||{},html=""; var skill=G.skills[skill_name]; html+="
" if(!skill) html+=skill_name; else { html+="
"+skill.name+"
"; if(skill.explanation) { html+="
"+skill.explanation+"
"; if(skill.mp) html+=bold_prop_line("MP",skill.mp,colors.mp); if(skill.duration) html+=bold_prop_line("Duration",(skill.duration/1000.0)+" seconds","gray"); if(skill.cooldown && (skill.cooldown/1000.0)) html+=bold_prop_line("Cooldown",(skill.cooldown/1000.0)+" seconds","gray"); if(skill.reuse_cooldown && (skill.reuse_cooldown/1000.0)) html+=bold_prop_line("R.Use Cooldown",(skill.reuse_cooldown/1000.0)+" seconds","gray"); if(skill.share) html+=bold_prop_line("Cooldown",to_pretty_float(skill.cooldown_multiplier||1)+"X of "+G.skills[skill.share].name,"gray"); if(skill.range) html+=bold_prop_line("Range",skill.range,"gray"); if(skill.use_range) html+=bold_prop_line("Range","Character Range","gray"); if(skill.range_multiplier && skill.range_bonus) html+=bold_prop_line("Range",to_pretty_float(skill.range_multiplier||1)+"X + "+skill.range_bonus,"gray"); else if(skill.range_multiplier) html+=bold_prop_line("Range",to_pretty_float(skill.range_multiplier||1)+"X of Character Range","gray"); if(skill.level) html+=bold_prop_line("Level Requirement",skill.level,"gray"); if (skill.wtype) html += bold_prop_line("Weapon Requirement", is_array(skill.wtype) ? `"${skill.wtype.join('", "')}"` : `"${skill.wtype}"`, "gray"); if(skill.max) html+=bold_prop_line("Max",skill.max,"gray"); if(skill.type=="passive") html+="
Passive
"; if(skill.damage_type) { if(skill.damage_type=="pure") html+=bold_prop_line("Damage Type","Pure","#AA9B55"); else if(skill.damage_type=="magical") html+=bold_prop_line("Damage Type","Magical","#8998AA"); else if(skill.damage_type=="physical") html+=bold_prop_line("Damage Type","Physical","#93AB98"); } if(skill.condition && G.conditions[skill.condition]) { html+=info_line({name:"Condition",color:"#A59FFF",value:G.conditions[skill.condition].name,onclick:"dialogs_target=xtarget||ctarget; show_json(G.conditions."+skill.condition+",{name:'G.conditions."+skill.condition+"'})"}); } (skill.levels||[]).forEach(function(lv){ var level=lv[0],value=lv[1]; html+=bold_prop_line("Output",value+(level>0&&(" (Lv. "+level+")")),"gray"); }); for(var requirement in (skill.requirements||{})) { var amount=skill.requirements[requirement]; html+=bold_prop_line("Required "+requirement.toTitleCase(),amount,"gray"); } if(skill.consume) { html+="
"+item_container({skin:G.items[skill.consume].skin,def:G.items[skill.consume]});+"
" } html+="
Show: G.skills."+skill_name+"
"; } } html+="
"; if(modal_count) show_modal(html,{wrap:false}); else $(selector).html(html); } function render_computer_network(selector,type,num) { var html="
"; $(selector).html(html); render_computer($(".computernx"),type,num); } function render_secondhands(type) { reset_inventory(1); topleft_npc="secondhands"; if(type) topleft_npc=type; rendered_target=topleft_npc; // merchant_id=npc.id; var last=0,collection=[],f="sh_click"; var html="
"; var items=secondhands; if(type) { items=lostandfound; if(l_page>=1) last+=19+(l_page-1)*18; f="lf_click"; } else { if(s_page>=1) last+=19+(s_page-1)*18; } for(var i=0;i<4;i++) { html+="
" for(var j=0;j<5;j++) { if(!type && i==3 && j==0 && s_page!=0) html+=item_container({skin:"left",onclick:"s_page="+(s_page-1)+"; render_secondhands();"},{q:s_page,left:true}); else if(!type && i==3 && j==4 && last"; next_side_interaction=null; $("#topleftcornerui").html(html); } function old_render_gallery() { var html=""; G.codes.forEach(function(section){ html+="
"+(section.name||section.key)+"
"; }); html+="
"; G.codes[0].list.forEach(function(def){ html+="
"+def[1]+"
"; }); html+="
"; show_modal(html); } function old_render_stepv1(args) { if(!args) args={}; args.title="[1/24] Move"; args.main="Welcome to the first step of the tutorial. In this step, we are going to move! Now move your character near the green goo's by clicking on the map and walking below the town!"; args.code="Using the CODE feature. You can use the `move` function, or, the more costly `smart_move` function."; var html=""; if(args.title) html+="
"+args.title+"
"; if(args.main) html+="
"+args.main+"
"; if(args.code) html+="
"+args.code+"
"; show_modal(html); } function load_documentation(name) { if(in_arr(name,G.docs.documented)) api_call("load_article",{name:name,func:true}); else if(name=="character") show_json(game_stringify(character,'\t')); else if(in_arr(name,G.docs.functions)) render_function_reference(name); else { $(".codesearch").val(name); csearch_logic("ui"); } } function open_article(name,url) { api_call("load_article",{name:name,url:url}); } function open_guide(name,url) { api_call("load_article",{name:name,guide:true,url:url}); } function open_tutorial() { api_call("load_article",{name:G.docs.tutorial[X.tutorial.step].key,tutorial:""+X.tutorial.step}); } var last_rendered_step=0; function render_tutorial(article,step,url) { hide_modals(); last_rendered_step=step; var tutorial=G.docs.tutorial[step],cphrase="CONTINUE"; if(step==G.docs.tutorial.length-1) cphrase="COMPLETE"; var html="
"; html+="
"+tutorial.title+"
["+(step+1)+"/"+G.docs.tutorial.length+"]
"; html+="
"; html+=article; html+="
"; html+="
Completion: "+0+"%
INCOMPLETE
"+cphrase+"
"; html+="
"; show_modal(html,{wrap:false,url:url}); update_tutorial_ui(); $(".code").codemirror({trim:true}); position_modals(); } function render_learn_article(article,args) { var html="
"; html+=article; html+="
"; if(args.prev) html+="
< Previous
"; if(args.next) html+="
Next >
"; html+="
"; show_modal(html,{wrap:false,url:args&&args.url}); $(".code").codemirror({trim:true}); position_modals(); } var render_function_html=""; function render_function_reference(n,f,c) { // hide_modal(); if(n=="character") return show_json(game_stringify(character,'\t')); if(!c) { code_eval("parent.render_function_reference(\""+n+"\",window['"+n+"'],1);"); return; } if(!f && !window[n]) { render_function_html=""; return add_log('Reference not found','gray'); } else if(!f) f=window[n]; var html="",rid=randomStr(10); if(render_function_html) { render_learn_article(render_function_html+"",{url:"/docs/code/functions/"+n}); $(".codemirror"+rid).codemirror({value:"//Source code of: "+n+"\n"+f.toString(),hints:true}); render_function_html=""; } else { html+=""; show_modal(html,{wwidth:min($(window).width()-60,1200),url:"/docs/code/functions/"+n}); $(".codemirror"+rid).codemirror({value:"//Source code of: "+n+"\n"+f.toString(),hints:true}); position_modals(); } } function render_functions_directory() { // hide_modal(); var html="
"; G.docs.functions.forEach(function(n){ if(in_arr(n,G.docs.documented)) html+="
"+n+"
"; else html+="
"+n+"
"; }); html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/code/functions"}); } function render_all_recipes() { var html="
"; // html+="
Work in Progress
"; var xprev=false; object_sort(G.craft,"gold_value").forEach(function(r) { if(xprev) html+="
"; var prev=false,name=r[0],recipe=r[1]; html+="
"; html+=item_container({skin:G.items[name].skin,onclick:"render_item_info('"+name+"')"},{name:name}); html+=" <= "; recipe.items.forEach(function(i){ if(prev) html+=" + "; html+=item_container({skin:G.items[i[1]].skin,onclick:"render_item_info('"+i[1]+"')"},{name:i[1],q:i[0],level:i[2]}); prev=true; }); if(recipe.cost) html+=" + "+to_pretty_num(recipe.cost)+""; html+="
"; xprev=true; }); object_sort(G.dismantle,"gold_value").forEach(function(r) { if(xprev) html+="
"; var prev=false,name=r[0],recipe=r[1]; html+="
"; html+=item_container({skin:G.items[name].skin,onclick:"render_item_info('"+name+"')"},{name:name}); html+=" => "; recipe.items.forEach(function(i){ if(prev) html+=" + "; html+=item_container({skin:G.items[i[1]].skin,onclick:"render_item_info('"+i[1]+"')"},{name:i[1],q:i[0],level:i[2]}); prev=true; }); if(recipe.cost) html+=" - "+to_pretty_num(recipe.cost)+""; html+="
"; xprev=true; }); html+="
" show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/guide/all/recipes"}); } function show_recipe(name) { var html="
"; var prev=false,recipe=G.craft[name]; html+="
"; html+=item_container({skin:G.items[name].skin,onclick:"render_item_info('"+name+"')"},{name:name}); html+=" <= "; recipe.items.forEach(function(i){ if(prev) html+=" + "; html+=item_container({skin:G.items[i[1]].skin,onclick:"render_item_info('"+i[1]+"')"},{name:i[1],q:i[0],level:i[2]}); prev=true; }); if(recipe.cost) html+=" + "+to_pretty_num(recipe.cost)+""; html+="
"; html+="
"; show_modal(html,{hideinbackground:true}); } function render_cx_info(name) { var html="
"; html+="
"+cx_sprite(name,{mleft:4})+"
"; html+=" ID: "+name+"
Type: "+T[name]+"
Slot: "+cxtype_to_slot[T[name]]; html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/guide/all/cosmetics"}); } function render_all_cosmetics() { precompute_image_positions(); var types=[ ["hair","Hairs",[]], ["hat","Hats",[]], ["chin","Chins",[]], ["face","Accents",[]], ["head","Skins",[]], ["armor","Armors",[]], ["body","Bodies",[]], ["character","Characters",[]], ["back","Back",[]], ["gravestone","Gravestones",[]], ["","Others",[]], ]; var visited={},html="
"; object_sort(T).forEach(function(ti){ var val=ti[1],cid=ti[0]; for(var i=0;i"; html+="
"; type[2].forEach(function(cid){ html+=""+cx_sprite(cid,{mright:4,labels:true})+""; }); html+="
"; }); html+="
" show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/guide/all/cosmetics"}); } function render_all_items() { var types=[ ["helmet","Helmets",[]], ["chest","Armors",[]], ["pants","Underarmors",[]], ["gloves","Gloves",[]], ["shoes","Shoes",[]], ["cape","Capes",[]], ["ring","Rings",[]], ["earring","Earrings",[]], ["amulet","Amulets",[]], ["belt","Belts",[]], ["orb","Orbs",[]], ["weapon","Weapons",[]], ["shield","Shields",[]], ["offhand","Offhands",[]], ["elixir","Elixirs",[]], ["pot","Potions",[]], ["scroll","Scrolls",[]], ["material","Crafting and Collecting",[]], ["exchange","Exchangeables",[]], ["key","Keys",[]], ["","Others",[]], ]; var visited={},html="
"; object_sort(G.items,"gold_value").forEach(function(item){ if(item[1].ignore) return; for(var i=0;i"; html+="
"; type[2].forEach(function(item){ html+=item_container({skin:G.items[item[0]].skin,onclick:"render_item_info('"+item[0]+"')"},{name:item[0]}); }); html+="
"; }); html+="
" show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/guide/all/items"}); } function render_all_monsters() { var html=""; html+="
"; object_sort(G.monsters,"hpsort").forEach(function(e){ if((e[1].stationary || e[1].cute) && !e[1].achievements || e[1].hide) return; html+="
"; html+=sprite(e[0],{scale:1.5}); if(G.drops && G.drops.monsters && G.drops.monsters[e[0]] && G.drops.monsters[e[0]].length) html+="
"; html+="
"; }); html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/guide/all/monsters"}); } function render_all_events() { function event_html(e,key) { var ehtml=""; ehtml+="
"; ehtml+=sprite(e.sprite,{overflow:true}); ehtml+="
"+e.name+"
"; ehtml+="
"; return ehtml; } var html=""; html+="
"; html+="
Daily Events
"; object_sort(G.events).forEach(function(e){ if(e[1].type=="daily") html+=event_html(e[1],e[0]); }); html+="
Nightly Events
"; object_sort(G.events).forEach(function(e){ if(e[1].type=="nightly") html+=event_html(e[1],e[0]); }); // html+="
Random Events
"; // object_sort(G.events).forEach(function(e){ // if(e[1].type=="random") // html+=event_html(e[1],e[0]); // }); html+="
Seasonal Events
"; object_sort(G.events).forEach(function(e){ if(e[1].type=="seasonal") html+=event_html(e[1],e[0]); }); html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/guide/all/events"}); } function render_guide(path,title,color) { var more=false,ref=false,suffix=""; docs=G.docs.guide; if(!path || is_string(path)) { path=[],more=true,ref=true; } else { path.forEach(function(step){ for(var i=0;i["+title[0]+"] "+title+"
"; } docs.forEach(function(n){ if(n[4]) { path.push(n[0]); html+="
["+n[1][0]+"] "+n[1]+" ["+n[4].length+"]
"; path.pop(); } else html+="
["+n[1][0]+"] "+n[1]+"
"; index++; }); if(ref && inside!="docs") { // html+="
[C] Code Guide
"; html+="
[X] Code Docs
"; } if(more) html+="
Guide is a Work in Progress!
"; html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/guide"+suffix}); } function render_code_articles(path,title,color) { var more=false,suffix=""; docs=G.docs.articles; if(!path) path=[],more=true; else { path.forEach(function(step){ for(var i=0;i["+title[0]+"] "+title+"
"; } docs.forEach(function(n){ if(n[3]) { path.push(n[0]); html+="
["+n[1][0]+"] "+n[1]+" ["+n[3].length+"]
"; path.pop(); } else html+="
["+n[1][0]+"] "+n[1]+"
"; index++; }); if(more) html+="
More Articles Coming Soon!
"; html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/code/learn"+suffix}); } function render_objects_reference(docs) { // hide_modal(); var html="
"; var index=0; G.docs.objects.forEach(function(n){ html+="
"+n[1]+"
"; index++; }); html+="
Work in Progress
"; html+="
"; show_modal(html,{wrap:false,hideinbackground:true}); } function render_useful_links() { // hide_modal(); var html="
"; html+="JSConsole.com"; html+='
A very practical website to play with Javascript in a Console.
'; html+="Code Academy: Javascript"; html+='
Code Academy\'s Javascript course - If you want to learn Javascript properly first, Code Academy\'s refined course will hopefully be more helpful :]
'; html+="Adventure Land's Github"; html+='
#TODO: Create a gallery of player\'s Github repos
'; html+="#code_beginner on Discord"; html+="
"; show_modal(html,{wrap:false,url:"/docs/code/links"}); } function render_data_reference(path,id) { // if(!id) hide_modal(); if(!id) path=[]; else path.push(id); var data=G,str="G",suffix=""; path.forEach(function(p){ data=data[p]; str=str+"."+p; if(!suffix) suffix+="/"+p; }); if(is_object(data) && path.length<2 && !in_arr(id,["levels"])) { // var html="
"; var html="
"; object_sort(data).forEach(function(nd){ var n=nd[0]; // html+="
"+str+"."+n+"
"; html+="
"+str+"."+n+"
"; }); html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/code/data"+suffix}); } else { show_json(game_stringify_simple(data,'\t')); } } var csearch_value=undefined,codesearch_value=undefined; function csearch_logic(place) { var value="",one=false; if(place=="ui") { value=$('.codesearch').val(); if(value==codesearch_value) return; codesearch_value=value; } else { value=$('.csearchi').val() if(value==csearch_value) return; csearch_value=value; } if(value.length || place=="ui") { var html=""; if(place=="ui") { } else { $('.cdocsbuttons').hide(); $('.cdocssearch').show(); } G.docs.references.forEach(function(ref){ if(ref[2].search(value)!==-1 || place=="ui" && !value) { one=true; if(!place) html+="
[REFERENCE] "+ref[1]+"
"; else html+="
[R] "+ref[1]+"
"; } }); var articles=[]; function parse_articles(article) { if(is_array(article[0])) { article.forEach(function(a){ parse_articles(a); }); } else { if(!article[4]) articles.push(article); else parse_articles(article[4]); } } parse_articles(G.docs.guide); // console.log(articles); articles.forEach(function(article){ if(!article[2]) return; if(article[2].search(value)!==-1 || place=="ui" && !value) { one=true; if(!place) html+="
[ARTICLE] "+article[1]+"
"; else html+="
[A] "+article[1]+"
"; } }); G.docs.javascript.forEach(function(ref){ if(ref[1].search(value)!==-1 || place=="ui" && !value) { one=true; if(!place) html+=""; else html+=""; } }); for(var name in G) { if(name.search(value)!==-1 || value=="[G]" || place=="ui" && !value) { one=true; if(!place) html+="
[GAMEDATA] G."+name+"
"; else html+="
[G] G."+name+"
"; } } G.docs.functions.forEach(function(n){ if(n.search(value)==-1 && value!="[F]" && !(place=="ui" && !value)) return; if(in_arr(n,G.docs.documented)) { if(!place) html+="
[FUNCTION] "+n+"
"; else html+="
[F] "+n+"
"; } else { if(!place) html+="
[FUNCTION] "+n+"
"; else html+="
[F] "+n+"
"; } one=true; }); if(!one && !place) html+="
[NONE FOUND]
"; else if(!one) html+="
[NONE FOUND]
"; if(place=="ui") { last_hint=undefined; $('#codehint').remove() $('#codelog').html(html); } else $('.cdocssearch').html(html); } else { $('.cdocsbuttons').show(); $('.cdocssearch').hide(); position_modals(); } } function render_code_docs() { csearch_value=undefined; var html="
"; //html+="
Learn [Basic to Advanced]
"; html+="
[SEARCH]
"; html+=""; html+="
" html+="
[F] Available Functions
"; html+="
[G] Game Data
"; // html+="
Objects Reference [WIP]
"; html+="
[C] Character Reference
"; html+="
[M] Monster Reference
"; //html+="
Javascript Events [Soon]
"; html+="
[E] Game Events
"; html+="
[C] Character Events
"; html+="
[U] Useful Links
"; html+='
Note: CODE Documentation is a work in progress. You can use Discord/#feedback for ideas/requests.
'; html+="
" html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/code"}); $('.csearchi').bind("propertychange change click keyup input paste", function(event){ csearch_logic(); }); } function render_others() { var html="
"; //html+="
Learn [Basic to Advanced]
"; html+="
" html+="
[S] Skillbar and Keymapping
"; html+="
[B] Using Boosters
"; html+="
[$] About Shells
"; html+="
" html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/ref"}); } function render_wishlist(num,page) { var html="
"; html+="
Wishlist
"; var items=[],last=0; for(var name in G.items) if(!G.items[name].ignore) items.push([name,G.items[name],G.items[name].g||0]); items.sort(function(a,b){return b[2]-a[2];}); if(page>=1) last+=19+(page-1)*18; for(var i=0;i<4;i++) { html+="
" for(var j=0;j<5;j++) { if(i==3 && j==0 && page!=0) html+=item_container({skin:"left",onclick:"render_wishlist("+num+","+(page-1)+");"},{q:page,left:true}); else if(i==3 && j==4 && last"; if(!item) html+="ITEM"; else { if(item.type=="tarot" && item.minor) html+=""; else if(item.type=="tarot") html+=""; color="#E4E4E4"; // previously gray [16/08/16] if(item.grade=="mid") color="blue"; // lol - must be old [13/04/20] if(actual && actual.p && G.titles[actual.p]) item_name=G.titles[actual.p].title+" "+item_name; else if(actual && actual.p) item_name=actual.p.toTitleCase()+" "+item_name; if(prop.level) { if(item.upgrade && prop.level==12) item_name+=" +Z"; else if(item.upgrade && prop.level==11) item_name+=" +Y"; else if(item.upgrade && prop.level==10) item_name+=" +X"; else if(item.compound && prop.level==7) item_name+=" +R"; else if(item.compound && prop.level==6) item_name+=" +S"; else if(item.compound && prop.level==5) item_name+=" +V"; else item_name+=" +"+prop.level; } if(args.thumbnail) { html+="
"+item_container({skin:item.skin,def:item})+"
"; } if(item.card) { html+="
"; html+="
"+item_name+"
"; html+="
"+item.card+"
"; html+="
"; } else if(!args.pure) { html+="
"+item_name+"
"; } if(prop.miss && item.type=="elixir") html+=bold_prop_line("Alcohol",prop.miss+"%","#7CAAF6"); (item.gives||[]).forEach(function(prop){ if(prop[0]=="hp" && prop[1]<0) html+=bold_prop_line("HP",to_pretty_num(prop[1]),colors.hp); else if(prop[0]=="hp") html+=bold_prop_line("HP","+"+to_pretty_num(prop[1]),colors.hp); if(prop[0]=="mp") html+=bold_prop_line("MP","+"+to_pretty_num(prop[1]),colors.mp); }); if(item.debuff) html+=bold_prop_line("Effect","Debuff","#343792"); if(args.monster) { html+=bold_prop_line("Name",item.name); html+=""+bold_prop_line("Show","G.monsters."+args.monster+"",colors.inspect)+""; html+=""+bold_prop_line("Find","\""+args.monster+"\"","#7AD963")+""; } if(prop.gold) html+=bold_prop_line("Gold",(prop.gold>0&&"+"||"")+prop.gold+"%","gold"); if(prop.luck) html+=bold_prop_line("Luck",(prop.luck>0&&"+"||"")+prop.luck+"%","#5DE376"); if(prop.xp) html+=bold_prop_line("XP",(!args.monster&&prop.xp>0&&"+"||"")+prop.xp+(!args.monster&&"%"||""),"#1E73DE"); if(prop.lifesteal) html+=bold_prop_line("Lifesteal",to_pretty_float(prop.lifesteal)+"%",colors.lifesteal); if(prop.manasteal) html+=bold_prop_line("Manasteal",to_pretty_float(prop.manasteal)+"%",colors.manasteal); if(item.goldsteal) html+=bold_prop_line("Goldsteal","Dynamic","gold"); if(prop.evasion) html+=bold_prop_line("Evasion",to_pretty_float(prop.evasion)+"%","#7AC0F5"); if(prop.avoidance) html+=bold_prop_line("Avoidance",to_pretty_float(prop.avoidance)+"%","#7AC0F5"); if(prop.miss && item.type!="elixir") html+=bold_prop_line("Miss",prop.miss+"%","#F36C6E"); if(prop.reflection) html+=bold_prop_line("Reflection",to_pretty_float(prop.reflection)+"%","#B484E5"); if(prop.dreturn) html+=bold_prop_line("D.Return",to_pretty_float(prop.dreturn)+"%","#E94959"); if(prop.crit) html+=bold_prop_line("Crit",to_pretty_float(prop.crit)+"%","#E52967"); if(prop.critdamage) html+=bold_prop_line("Crit Damage","+"+to_pretty_float(prop.critdamage)+"%","#A8214E"); if(prop.attack) html+=bold_prop_line("Damage",prop.attack,colors.attack); if(item.damage_type) { if(item.damage_type=="pure") html+=bold_prop_line("Type","Pure","#AA9B55"); else if(item.damage_type=="magical") html+=bold_prop_line("Type","Magical","#8998AA"); else if(item.damage_type=="physical") html+=bold_prop_line("Type","Physical","#93AB98"); } if(prop.range) html+=bold_prop_line("Range",(!args.monster&&"+"||"")+prop.range,colors.range); if(prop.hp) html+=bold_prop_line("HP",prop.hp,colors.hp); if(prop.str) html+=bold_prop_line("Strength",prop.str,colors.str); if(prop['int']) html+=bold_prop_line("Intelligence",prop['int'],colors['int']); if(prop.dex) html+=bold_prop_line("Dexterity",prop.dex,colors.dex); if(prop.vit) html+=bold_prop_line("Vitality",prop.vit,colors.hp); if(prop['for']) html+=bold_prop_line("Fortitude",prop['for'],colors['for']); if(prop.mp) html+=bold_prop_line("MP",prop.mp,colors.mp); if(prop.mp_cost>0) html+=bold_prop_line("Attack MP Cost","+"+prop.mp_cost,colors.mp); else if(prop.mp_cost) html+=bold_prop_line("Attack MP Cost",prop.mp_cost,colors.mp); if(prop.mp_reduction>0) html+=bold_prop_line("Skill MP Reduction","%"+prop.mp_reduction,colors.mp); else if(prop.mp_reduction) html+=bold_prop_line("Skill MP Increase","%"+(-prop.mp_reduction),colors.mp); if(prop.stat) html+=bold_prop_line("Stat",prop.stat); if(prop.armor) html+=bold_prop_line("Armor",prop.armor,colors.armor); if(prop.apiercing) html+=bold_prop_line("A.Piercing",prop.apiercing,colors.armor); if(prop.rpiercing) html+=bold_prop_line("R.Piercing",prop.rpiercing,colors.resistance); if(prop.resistance) html+=bold_prop_line("Resistance",prop.resistance,colors.resistance); if(prop.pnresistance) html+=bold_prop_line("Poison Res.",prop.pnresistance,"#68B84B"); if(prop.firesistance) html+=bold_prop_line("Fire Res.",prop.firesistance,"#B42B22"); if(prop.fzresistance) html+=bold_prop_line("Freeze Res.",prop.fzresistance,"#69B1B6"); if(prop.phresistance) html+=bold_prop_line("Impact Res.",prop.phresistance,"#69B1B6"); if(prop.stresistance) html+=bold_prop_line("Status Res.",prop.stresistance,"#9FA7B6"); if(item.wspeed) html+=bold_prop_line("Speed",item.wspeed.toTitleCase(),"gray"); if(prop.speed) html+=bold_prop_line(item.wtype&&"Run Speed"||"Speed",(!args.monster&&(prop.speed>0)&&"+"||"")+prop.speed,colors.speed); if(prop.frequency || args.monster) html+=bold_prop_line("A.Speed",(prop.frequency||1)*(args.monster&&100||1),"#3BE681"); if(prop.output) html+=bold_prop_line("Damage Output",(prop.output>0&&"+"||"")+prop.output+"%","#D93319"); if(prop.incdmgamp) html+=bold_prop_line("Incoming Damage",prop.incdmgamp+"%","#D93319"); if(prop.stun) html+=bold_prop_line("Stun",prop.stun+"%","#784224"); if(prop.explosion) html+=bold_prop_line("Explosion",prop.explosion+"%","#782D33"); if(prop.blast) html+=bold_prop_line("Blast",prop.blast+"%","#685079"); if(prop.breaks && prop.breaks>0) html+=bold_prop_line("Breaks",to_pretty_float(prop.breaks)+"%","#782D33"); if(prop.charisma) html+=bold_prop_line("Charisma",prop.charisma,"#4DB174"); if(prop.awesomeness) html+=bold_prop_line("Awesomeness",prop.awesomeness,"#FFDE2F"); if(prop.bling) html+=bold_prop_line("Bling",prop.bling,"#A4E6FF"); if(prop.cuteness) html+=bold_prop_line("Cuteness",prop.cuteness,"#FD82F0"); if(prop.intensity) html+=bold_prop_line("Intensity",prop.intensity,"#786D6A"); if(prop.courage) html+=bold_prop_line("Courage",prop.courage,"#9E1813"); if(prop.mcourage) html+=bold_prop_line("M.Courage",prop.mcourage,"#4628A0"); if(prop.pcourage) html+=bold_prop_line("P.Courage",prop.pcourage,"#D19D32"); if(grade==1 && item.type!="booster") html+=bold_prop_line("Grade","High","#696354"); if(grade==2 && item.type!="booster") html+=bold_prop_line("Grade","Rare","#6668AC"); if(grade==3 && item.type!="booster") html+=bold_prop_line("Grade","Legendary","#39A868"); if(grade==4 && item.type!="booster") html+=bold_prop_line("Grade","Exalted","#2875F9"); // gold: "#E5A818" purple: #8B3EE6" dark-pink: #e84664 if(prop.poisonous) html+="
Poisonous
"; if(prop.cooperative) html+="
Cooperative
"; if(prop.peaceful) html+="
Peaceful
"; if(prop.supporter) html+="
Supporter
"; if(prop.abilities) { for(var id in prop.abilities) { if(!G.skills[id]) continue; html+=info_line({name:prop.abilities[id].aura&&"Aura"||"Ability",color:"#FC5F39",value:G.skills[id].name,onclick:"dialogs_target=xtarget||ctarget; render_skill('#topleftcornerdialog','"+id+"')"}); } } if(prop.spawns) { prop.spawns.forEach(function(s){ html+=info_line({name:"Spawns",color:"#237B2A",value:G.monsters[s[1]].name,onclick:"render_monster_info('"+s[1]+"')"}); }) } for(var mname in G.maps) if(item[mname]) { html+="
Bonus: "+G.maps[mname].name+" [Only]"+"
"; } for(var cname in G.classes) if(item[cname]) { html+="
Bonus: "+cname.toTitleCase()+" [Only]"+"
"; } if(args.count) html+=bold_prop_line("Kills",to_pretty_num(args.count),"#7D0C15"); if(args.score) html+=bold_prop_line("Score",to_pretty_num(args.score),"#C38737"); if(args.mcount) html+=bold_prop_line("Max Score",to_pretty_num(args.mcount)+" ["+args.mowner+"]","#DCC343"); if(args.monster && G.base_gold) { for(mname in G.base_gold[args.monster]) { if(!G.maps[mname] || G.maps[mname].ignore) continue; html+=bold_prop_line("Base Gold",G.base_gold[args.monster][mname]+" ("+G.maps[mname].name+")","gold"); } } if(prop['class']) html+=bold_prop_line("Class",function(a){ var s=""; a.forEach(function(x){if(s.length) s+=", "; s+=x.toTitleCase()}); return(s) }(prop['class']),"gray"); if(actual && item.type=="elixir" && args.slot=="elixir") { var remains=-msince(new Date(actual.expires))/60.0; // html+="
"+remains+" hours
"; html+=prop_remains(remains); } else if(item.type=="elixir") { html+=prop_remains(item.duration); } if(item.achievements) //args.monster { html+="
Achievements:
"; item.achievements.forEach(function(a){ var acolor="white"; if(max(args.score,args.mcount)>=a[0]) acolor="#2EA436"; var an=a[2]; if(an=="frequency") an="a.speed"; html+="
["+to_pretty_num(a[0])+"] "+an.toUpperCase()+" "+a[3]+"
"; }); if(args.count<100 && 0) { html+="
Insight: [LOCKED]
"; html+="
100 kills are needed to discover the monster specific droprates.
"; } } if(item.ability) { if(item.ability=="bash") { html+=bold_prop_line("Ability","Bash",colors.ability); html+="
"+"Stuns the opponent for "+prop.attr1+" seconds with "+prop.attr0+"% chance.
"; } else if(item.ability=="freeze") { html+=bold_prop_line("Ability","Freeze","#2EBCE2"); html+="
"+"Freezes the opponent with a "+prop.attr0+"% chance.
"; } else if(item.ability=="poison") { html+=bold_prop_line("Ability","Poison",colors.poison); html+="
"+"Poisons the opponent with a "+prop.attr0+"% chance.
"; } else if(item.ability=="burn") { html+=bold_prop_line("Ability","Burn","#E03D31"); html+="
"+"Burns the opponent with a "+prop.attr0+"% chance. Deals damage over time.
"; } else if(item.ability=="weave") { html+=bold_prop_line("Ability","Weave","#AAA9D2"); html+="
Each hit slows the opponent more and more.
"; } else if(item.ability=="secondchance") { html+=bold_prop_line("Ability","Second Chance",colors.ability); html+="
"+"Avoid death with a "+prop.attr0+"% chance.
"; } else if(item.ability=="sugarrush") { html+=bold_prop_line("Ability","Sugar Rush","#D64770"); html+="
"+"Trigger a Sugar Rush on attack with "+prop.attr0+"% chance. Gain 240 Attack Speed for 10 seconds!
"; } else if(item.ability=="charm") { html+=bold_prop_line("Ability","Charm","#D64770"); html+="
"+"Charm an enemy with "+prop.attr0+"% chance. Activate the ability from the 'SKILLS' system.
"; } else if(item.ability=="restore_mp") { html+=bold_prop_line("Ability","Restore MP","#5D9ED9"); html+="
"+"Instead of using MP, skills restore 2X the amount with "+prop.attr0+"% chance.
"; } else if(G.skills[item.ability]) { html+=bold_prop_line("Ability",G.skills[item.ability].name,"#E1924D"); if(prop.attr0) html+=bold_prop_line("Chance","%"+prop.attr0); html+="
"+"Activate the ability from the 'SKILLS' system.
"; } } if(item.aura) { if(G.conditions[item.aura]) { html+=bold_prop_line("Aura",G.conditions[item.aura].name,"#E1924D"); if(prop.attr0) html+=bold_prop_line("Amount","%"+prop.attr0); } } if(actual && item.charge && !actual.b) { html+=bold_prop_line("Charge",to_pretty_float((actual.charges||0)/item.charge*100)+"%","#7433A7"); } if(item.explanation) { html+="
"+item.explanation+"
"; } else if(item.type=="material") { html+="
An unknown material, as in, you have no idea what to do with it!
"; } if(item.multiplier && item.multiplier!=1) html+=bold_prop_line("Multiplier",item.multiplier,"gray"); if(prop.set) { html+="
Set: "+G.sets[prop.set].name+"
"; } if(args.minutes!==undefined) { html+=prop_remains(args.minutes/60.0); } if(actual && actual.l) { if(actual.l=="s") html+="
Sealed
"; else if(actual.l=="u") html+="
Unsealing
"; else html+="
Locked
"; } if(actual && actual.acl) { html+="
Account Bound [X]
"; } if(!(args && args.prop)) { var phrase="Information"; if(item.e) phrase="Exchangeable"; else if(item.upgrade && (!actual || actual.level<10)) phrase="Upgradeable"; else if(item.compound) phrase="Compoundable"; else { var done=false; for(var iname in G.craft) { if(G.craft[iname].quest!="mcollector") continue; G.craft[iname].items.forEach(function(i){ if(i[1]==iname) done=true,phrase="Collectable"; }); } if(!done) { for(var iname in G.craft) { if(G.craft[iname].quest=="mcollector") continue; G.craft[iname].items.forEach(function(i){ if(i[1]==iname) done=true,phrase="Useable"; }); } } } if(item.type=="weapon" || offhand_types[item.type]) { var t="",color="#CC3837"; if(0 && parseInt(item.tier)Type: "+t+"
"; } html+="
[i]: "+phrase+"
"; } if(args.inventory_ui!==undefined) { html+=button_line({name:"{}: Inspect",onclick:"show_json(character.items["+args.inventory_ui+"],{inventory_ui:"+args.inventory_ui+"})",color:colors.inspect}); } if(args.trade && actual && character.slots.helmet && character.slots.helmet.name.startsWith("ghat")) { var svalue=2*calculate_item_value(actual); html+="
"; if((actual.q||1)>1) { html+="
Q:
"+actual.q+"
" } html+="
MINUTES:
20
"; html+="
GIVEAWAY!
"; // style='color:#A99A5B' html+="
"; } else if(args.trade && actual) { var svalue=2*calculate_item_value(actual); html+="
"; if((actual.q||1)>1) { html+="
Q:
"+actual.q+"
" } html+="
GOLD"+(((actual.q||1)>1)&&" [EACH]"||"")+":
"+to_pretty_num(svalue)+"
"; html+="
PUT UP FOR SALE
"; // style='color:#A99A5B' html+="
"; } if(actual && actual.name=="cxjar") { precompute_image_positions(); if(!actual.data) { html+="
Empty / Anomaly
"; } else if(!T[actual.data]) { html+="
Invalid / "+actual.data+"
"; } else { html+="
"+cx_sprite(actual.data)+"
"; } } if(actual && actual.name=="emotionjar") { if(!G.emotions[actual.data]) { html+="
Invalid / "+actual.data+"
"; } else html+="
"+bold_prop_line("Includes","G.emotions."+actual.data+"",colors.inspect)+"
"; } if(in_arr(args.slot,trade_slots) && actual && actual.price && args.from_player && !actual.b && !actual.giveaway) { trade_item=true; if((actual.q||1)>1) { html+="
Q:
1
"; } html+="
"+to_pretty_num(actual.price)+" GOLD"+((actual.q||1)>1&&" [EACH]"||"")+"
"; html+="
BUY
"; } if(in_arr(args.slot,trade_slots) && actual && args.from_player && actual.giveaway) { trade_item=true; if(actual.list.length) { html+="
PARTICIPANTS: "+actual.list.join(", ")+"
"; } html+="
MINUTES: "+actual.giveaway+"
"; html+="
JOIN!
"; } if(in_arr(args.slot,trade_slots) && actual && actual.price && args.from_player && actual.b) { var q=false; if((actual.q||1)>1 && item.s) q=true; trade_item=true; if(q) { html+="
Q:
1
"; } html+="
"+to_pretty_num(actual.price)+" GOLD"+(q&&" [EACH]"||"")+"
"; html+="
SELL
"; } if(args.secondhand) { var mult=2; if(item.cash) mult=3; trade_item=true; html+="
"+to_pretty_num(calculate_item_value(actual)*mult*(actual.q||1))+" GOLD
"; html+="
BUY
"; } if(args.lostandfound) { trade_item=true; html+="
"+to_pretty_num(calculate_item_value(actual)*4*(actual.q||1))+" GOLD
"; html+="
BUY
"; } if(value) { var f="buy_with_gold"; if(item.days) html+="
Lasts 30 days
"; if(cash) html+="
"+to_pretty_num(item.cash)+" SHELLS
",f="buy_with_shells"; else html+="
"+to_pretty_num(value)+" GOLD
"; if(cash && character && item.cash>=character.cash) { if(is_electron) { html+="
"; html+="
You can find SHELLS from gems, monsters. In future, from achievements.
"; } else { html+="
"; html+="
You can find SHELLS from gems, monsters. In future, from achievements. For the time being, to receive SHELLS and support our game:
"; html+="BUY or EARN SHELLS "; // onclick='shells_click(); $(this).parent().remove()' // #EB8D3F nice orange - #33BBD6 meh blue - #54C8C1 ok teal } } else { if(item.s) { var q=1; if(item.gives) q=100; html+="
"; html+="Q:
"+q+"
| " html+="BUY "; html+="
"; } else html+="
BUY
"; } } else if(args.guide && actual) { html+="
"+to_pretty_num(calculate_item_value(actual,1))+" GOLD
"; } if(args.token && args.key && args.key!=args.token) { var color="#B6A786",phrase="TOKENS"; var text="#D3D5E0"; if(args.token=="funtoken") color="#AA6AB3"; else if(args.token=="pvptoken") text="#CCAE08"; else if(args.token=="monstertoken") text="#6C531B"; else if(args.token=="friendtoken") text="#AA6AB3"; if(G.tokens[args.token][args.key]==1) phrase="TOKEN"; if(G.tokens[args.token][args.key]<1) html+="
EXCHANGE "+(1/G.tokens[args.token][args.key])+" [1 TOKEN]
"; else html+="
EXCHANGE ["+G.tokens[args.token][args.key]+" "+phrase+"]
"; } if(args.sell && actual) { var value=calculate_item_value(actual); html+="
"+to_pretty_num(value)+" GOLD
"; if(item.s && actual.q) { var q=actual.q; html+="
"; html+="Q:
"+q+"
| " html+="SELL "; html+="
"; } else html+="
SELL
"; } if(args.cancel) { html+="
CLOSE
" } if(in_arr(name,booster_items)) { if(actual && actual.expires) { var remains=round((-msince(new Date(actual.expires)))/(6*24))/10.0; html+="
"+remains+" days
"; } if(!args.sell) html+="
HOW TO USE
"; } if(!value && !args.sell && actual && !trade_item && !args.trade && !args.npc) { if(item.action) { var id=args&&args.slot||args&&args.num; html+='
'+item.action+'
'; } if(item.type=="computer") { html+="
NETWORK
"; } if(item.type=="stand") { html+="
TRADE HISTORY
"; } if(0 && item.type=="computer" && (actual.charges===undefined || actual.charges) && gameplay=="normal") { html+="
UNLOCK
"; } if(item.type=="computer") { html+="
NETWORK
"; } if(item.type=="stand" && !character.stand) { html+="
OPEN
"; } if(item.type=="stand" && character.stand) { html+="
CLOSE
"; } if(item.type=="elixir" && !args.from_player) { var phrase="DRINK"; if(item.eat) phrase="EAT"; html+="
"+phrase+"
"; } if((item.type=="licence" || item.type=="spawner") && !args.from_player) { html+="
USE
"; } if(in_arr(actual.name,["stoneofxp","stoneofgold","stoneofluck"])) { html+="
CONVERT TO SHELLS
"; } if(in_arr(actual.name,booster_items)) { if(actual.expires) html+="
SHIFT
"; else html+="
ACTIVATE
"; } } if(args.craft) { var i=0,phrase="Recipe",action="CRAFT",ecolor="#419FBE"; if(G.craft[name].quest) phrase="Collect",action="EXCHANGE",ecolor="#4DC353"; html+="
"; html+="
"+phrase+"
"; html+="
"; G.craft[name].items.forEach(function(item){ var q=undefined; if(item[0]!=1) q=item[0]; html+=item_container({skin:G.items[item[1]].skin,onclick:"render_item_by_name('"+item[1]+"')"},{name:item[1],q:q,level:item[2]}); i+=1; if(!(i%4)) html+="
"; }); if(G.craft[name].cost) html+=bold_prop_line("Cost",to_pretty_num(G.craft[name].cost),"gold"); html+="
"+action+"
"; } if(args.dismantle) { var i=0; html+="
"; html+="
Dismantles-to
"; html+="
"; G.dismantle[name].items.forEach(function(item){ var q=undefined; if(item[0]!=1) q=item[0]; html+=item_container({skin:G.items[item[1]].skin,onclick:"render_item_by_name('"+item[1]+"')"},{name:item[1],q:q}); i+=1; if(!(i%4)) html+="
"; }); if(G.dismantle[name].cost) html+=bold_prop_line("Cost",to_pretty_num(G.dismantle[name].cost),"gold"); } if(args.condition && args.condition.sn) html+=bold_prop_line("Server",args.condition.sn,"#BED4DE"); if(args.condition && args.condition.f) html+=bold_prop_line("From",args.condition.f,"#BED4DE"); if(args.condition && args.condition.c) html+=bold_prop_line("Count",args.condition.c+" left","#891C13"); if(args.condition && args.condition.sn && args.condition.id) { html+="
"+sprite(args.condition.id)+"
"; } } // html+=JSON.stringify(actual); if(!args.pure) html+="
"; if(selector=="html") return html; else if(modal_count) show_modal(html,{wrap:false}); else $(selector).html(html); } function render_item_by_name(name) { render_item_popup(name); // render_item(null,{skin:G.items[name].skin,item:G.items[name],name:name}); } function wishlist_form(num,name) { wishlist(num,name,$('.wprice').shtml(),$('.wnumq').shtml(),$('.wlevel').shtml()); } function render_wishlist_item(name,num) { var def=G.items[name],html=""; html+="
"; html+="
"+item_container({skin:def.skin,def:def})+"
"; html+="
" html+="
Wishlist
"; html+="
"; html+="
"+def.name+"
"; html+="
"; html+="
Q:
1
"; html+="
GOLD"+(def.s&&" [EACH]"||"")+":
"+(calculate_item_value({name:name})+1)+"
"; if(def.compound||def.upgrade) html+="
LEVEL:
0
"; html+="
WISHLIST
"; html+="
"; $("#topleftcornerdialog").html(html); dialogs_target=character; } function render_set(name) { var set=G.sets[name],selector=last_selector; var html="
"; html+="
"+set.name+"
"; html+="
" set.items.forEach(function(i){ html+=item_container({skin:G.items[i].skin}); }); html+="
"; [1,2,3,4,5,6,7,8].forEach(function(num){ var rep=num; if(num!=set.items.length) rep=num+"+"; if(set[num] && Object.keys(set[num]).length) html+="
["+rep+" Equipped] "+render_item("html",{pure:true,item:set[num],prop:set[num]})+"
"; }); if(set.explanation) { html+="
"+set.explanation+"
"; } html+="
"; if(modal_count) show_modal(html,{wrap:false,hideinbackground:true}); else $(selector).html(html); } function render_condition(selector,name) { var def=G.conditions[name],minutes=0,condition=undefined,target=xtarget||ctarget; if(target && target.s[name] && target.s[name].ms) minutes=target.s[name].ms/6000.0/10.0; if(target && target.s[name]) { def=!def&&{}||clone(def); condition=target.s[name]; for(var p in target.s[name]) { def[p]=target.s[name][p]; } } render_item(selector,{skin:condition&&condition.skin||def&&def.skin,item:def,prop:def,minutes:minutes,condition:condition}); } function render_item_selector(selector,args) { if(args && !args.purpose) purpose="buying"; var items=[],row=0,html="
"; for(var id in G.items) if(!G.items[id].ignore) items.push(G.items[id]); items.sort(function(a,b){return b.g-a.g;}); for(var i=0;i8 || def.compound && actual.level>4)) bcolor=xbcolor; if(bcolor=="gray" && (def.special || calculate_item_grade(actual)==2 || calculate_item_value(actual)>5000000)) { bcolor=xbcolor; pompous=true; } } if(def && actual && def.type=="booster" && actual.level) bcolor=xbcolor; if(item.draggable || !("draggable" in item)) { item_prop+=" draggable='true' ondragstart='on_drag_start(event)'"; container_prop+="ondrop='on_drop(event)' ondragover='allow_drop(event)'"; } if(item.droppable) { item.trigrc=true; container_prop+="ondrop='on_drop(event)' ondragover='allow_drop(event)'"; } if(item.onclick) { if(item.draggable) { container_prop+=' onclick="'+item.onclick+'" class="clickable" '; if(item.onmousedown) container_prop+=' onmousedown="'+item.onmousedown+'"'; // to handle middle clicks } else container_prop+=' onmousedown="'+item.onclick+'" ontouchstart="'+item.onclick+'" class="clickable" '; } // cls="rotate12"; if(item.cnum!=undefined) cnum="data-cnum='"+item.cnum+"' "; if(item.trigrc!=undefined) cnum="data-trigrc='1'"; // on_drop, just trigger on_rclick if(item.strnum!=undefined) cnum="data-strnum='"+item.strnum+"' "; // render_items_npc - slot if(item.slot!=undefined) cnum="data-slot='"+item.slot+"' "; if(item.skid!=undefined) cnum="data-skid='"+item.skid+"' "; if(item.cid) container_prop+=" id='"+item.cid+"' "; if(!item.skin && item.loader) xstyles="overflow: hidden;" html+="
"; if(item.pui) { var chance="%??.??",ccolor="#299C4C",roll="#00.00"; if(item.pui.chance) { var res=set_uchance(item.pui.chance,true); ccolor=res[0]; chance=res[1]; roll=set_uroll(item.pui,true); } //html+="
"+chance+"
"; //html+="
"+roll+"
"; html+="
"+chance+"
"; html+="
"+roll+"
"; } if(item.skid && !item.skin) html+="
"+item.skid+"
"; // Skill ID if(item.shade) { if(!G.positions[item.shade]) item.shade="placeholder"; var spack=G.imagesets[G.positions[item.shade][0]||"pack_20"],sscale=size/spack.size; var sx=G.positions[item.shade][1],sy=G.positions[item.shade][2]; html+="
"; html+="
"; // Previous default s_op was 0.2 [12/07/18] html+=""; html+="
"; html+="
"; } if(item.skin) { if(!G.positions[item.skin]) item.skin="placeholder"; var pack=G.imagesets[G.positions[item.skin][0]||"pack_20"],x=G.positions[item.skin][1],y=G.positions[item.skin][2]; var scale=size/pack.size if(actual && actual.level && actual.level>7) classes+=" glow"+min(item.level,10); if(item.num!=undefined) rclick="class='rclick"+classes+"' data-inum='"+item.num+"'"; if(item.snum!=undefined) rclick="class='rclick"+classes+"' data-snum='"+item.snum+"'";// render_items_npc - item if(item.sname!=undefined) rclick="class='rclick"+classes+"' data-sname='"+item.sname+"'"; if(item.skname!=undefined) rclick="class='rclick"+classes+"' data-skname='"+item.skname+"'"; if(item.on_rclick) rclick="class='rclick"+classes+"' data-onrclick=\""+item.on_rclick+'"'; html+="
"; // overflow:hidden for .skidloader // the "rid" / random id seems to be needed, on_drop gets elements by id - couldn't work around it without a deep re-analysis [22/06/18] html+="
"; html+=""; html+="
"; if(actual && actual.name=="monsterbox") { var xx=G.positions["egg2"][1],yy=G.positions["egg2"][2] html+="
"; html+=""; html+="
"; } if(actual) { var prefix="u"; if(def && def.compound) prefix="c"; if(actual.c) { html+="
"+actual.c+"
"; } else if(actual.q && actual.left) { html+="
"+actual.q+"
"; } else if(actual.q && actual.q!=1) { if(actual.b) html+="
"+actual.q+"
"; else if(def && def.debuff) html+="
"+actual.q+"
"; else if(def && def.gives && def.gives[0] && def.gives[0][0]=="hp") html+="
"+actual.q+"
"; else if(def && def.gives && def.gives[0] && def.gives[0][0]=="mp") html+="
"+actual.q+"
"; else html+="
"+actual.q+"
"; } if(actual.level) { var level=actual.level,clevel=level; if(def.type=="booster") clevel=level=(actual.level==1&&"A"||actual.level==2&&"B"||actual.level==3&&"C"||actual.level==4&&"D"||actual.level==5&&"E"||actual.level>5&&"W"); if(pompous && def.compound && clevel==3) clevel=4; if(pompous && def.upgrade && clevel==7) clevel=8; html+="
"+(level==10&&"X"||level==11&&"Y"||level==12&&"Z"||level==5&&prefix=="c"&&"V"||level==6&&prefix=="c"&&"S"||level==7&&prefix=="c"&&"R"||level)+"
"; } if(actual.s) html+="
"+actual.s+"
"; } if(item.slot && in_arr(item.slot,trade_slots) || item.trade_for_ui) { if(actual && actual.giveaway) html+="
@
"; else if(actual && actual.b) html+="
?
"; else html+="
$
";//€ } else if(actual && actual.l && !item.slot) { if(actual.l=="s") html+="
S
"; else if(actual.l=="u") html+="
U
"; else html+="
X
"; } if(actual && actual.v) html+="

^
"; else if(actual && actual.m) html+="
M
"; if(item.loader) { html+="
" } if(item.skid) // Skill ID { html+="
" html+="
"+item.skid+"
"; if(actual && actual.name=="throw") { html+="
["+(actual.num||0)+"]
"; } } html+="
"; } if(!item.skin && item.loader) { html+="
" } if(!item.skin && item.level) { var level=item.level,clevel=level,def=G.items[item.iname],prefix="u"; if(def && def.compound) prefix="c"; if(def.type=="booster") clevel=level=(level==1&&"A"||level==2&&"B"||level==3&&"C"||level==4&&"D"||level==5&&"E"||level>5&&"W"); if(pompous && def.compound && clevel==3) clevel=4; if(pompous && def.upgrade && clevel==7) clevel=8; html+="
"+(level==10&&"X"||level==11&&"Y"||level==12&&"Z"||level==5&&prefix=="c"&&"V"||level)+"
"; } html+="
"; return html; } function render_skillbar(empty) { if(empty){ $("#skillbar").html("").hide(); return; } // $("#topmid").html(""); var html="
",i=0; skillbar.forEach(function(id){ var current=keymap[id],skin=current; if(current) { if(current && current.skin) skin=current.skin; else if(current.type=="item" && G.items[current.name]) skin=G.items[current.name].skin; else if(G.skills[current.name||current]) skin=G.skills[current.name||current].skin; html+=item_container({skid:id,skin:skin||"",draggable:false,droppable:true,onclick:"on_skill('"+id+"')"},current); } else html+=item_container({skid:id,draggable:false,droppable:true}); if(!(skillbar.length>=8 && !(skillbar.length%2) && !(i%2))) html+="
"; i++; }); html+="
" $("#skillbar").html(html).css("display","inline-block"); restart_skill_tints(); // $("#topmid").show().html(html); } function skill_click(slot) { if(skillsui && keymap[slot]) render_skill("#skills-item",keymap[slot].name||keymap[slot],keymap[slot]); if(G.skills[slot]) render_skill("#skills-item",slot); } var skills_page="I"; function render_skills() { if(skillsui) { $(".skillsui").hide(); $("#theskills").remove(); skillsui=false; render_skillbar(); return; } var last=0,right_style='text-align: right'; var html="
" html+="
"; html+="
MAPPING 1 2 U
"; var km1=["1","2","3","4","5","6","7"],km2=["Q","W","E","R","X","T","B"]; if(skills_page=="II") km1=["8","9","0","G","H","J","K"],km2=["SHIFT","Z","V","M","P","D","BACK"]; if(skills_page=="U") km1=["ESC","A","C","F","I","TAB","ENTER"],km2=["UP","LEFT","DOWN","RIGHT",",","S","U"]; html+="
"; km1.forEach(function(N){ var current=keymap[N],skin=current; if(current && current.skin) skin=current.skin; else if(current && current.type=="item" && G.items[current.name]) skin=G.items[current.name].skin; else if(current && G.skills[current.name||current]) skin=G.skills[current.name||current].skin; html+=item_container({skid:N,skin:skin||"",onclick:"on_skill('"+N+"')"},current); }); html+="
"; html+="
"; km2.forEach(function(N){ var current=keymap[N],skin=current; if(current && current.skin) skin=current.skin; else if(current && current.type=="item" && G.items[current.name]) skin=G.items[current.name].skin; else if(current && G.skills[current.name||current]) skin=G.skills[current.name||current].skin; html+=item_container({skid:N,skin:skin||"",onclick:"on_skill('"+N+"')"},current); }); html+="
"; html+="
SKILLS
"; var s=[],slast=0,a=[],alast=0; object_sort(G.skills).forEach(function(io){ var name=io[0],skill=io[1]; if(skill.slot) { var found=false; skill.slot.forEach(function(p){ if(character.slots[p[0]] && character.slots[p[0]].name==p[1]) found=true; }); if(!found) return; } if(skill.inventory) { var found=false; skill.inventory.forEach(function(p){ for(var i=0;i<42;i++) { if(character && character.items[i] && character.items[i].name==p) found=true; } }); if(!found) return; } if(skill.type=="skill" && (!skill['class'] || in_arr(character.ctype,skill['class']) || character.role=="gm")) s.push({name:name}); if(skill.type=="passive" && (!skill['class'] || in_arr(character.ctype,skill['class']) || character.role=="gm")) s.push({name:name}); if(skill.type=="ability" && (!skill['class'] || in_arr(character.ctype,skill['class']) || character.role=="gm")) a.push({name:name}); if(skill.type=="utility" && skill.ui!==false && (!skill['class'] || in_arr(character.ctype,skill['class']))) a.push({name:name}); }); if(character.role=="gm") a.push({name:"gm"}); // html+="
"; for(var i=0;i<10;i++) { html+="
" for(var j=0;j<7;j++) { if(slast=s.length) break; // i && } html+="
ABILITIES
"; // html+="
"; for(var i=0;i<10;i++) { html+="
" for(var j=0;j<7;j++) { if(alast=a.length) break; } html+="
"; skillsui=true; render_skillbar(1); $("body").append("
"); $(".skillsui").show(); $("#theskills").html(html); restart_skill_tints(); } function show_condition(name) { var def=G.conditions[name]; show_modal(render_item("html",{skin:def.skin,item:def,prop:def}),{wrap:false}); } function render_all_skills_and_conditions() { var last=0,right_style='text-align: right'; var html=""; html+="
"; // html+="
Work in Progress
"; ["ranger","rogue","warrior","mage","priest","paladin","merchant"].forEach(function(ctype){ html+="
"+ctype.toTitleCase()+"
"; object_sort(G.skills).forEach(function(s){ var name=s[0],skill=s[1]; if(skill['class'] && skill['class'].includes(ctype)) { html+=item_container({skin:skill.skin,onclick:"render_skill('','"+s[0]+"')"}); } }); }); html+="
Item Skills
"; object_sort(G.skills).forEach(function(s){ var name=s[0],skill=s[1]; if(skill.slot) { html+=item_container({skin:skill.skin,onclick:"render_skill('','"+s[0]+"')"}); } }); html+="
Abilities and Utilities
"; object_sort(G.skills).forEach(function(s){ var name=s[0],skill=s[1]; if(skill.type=="ability" || skill.type=="utility") { html+=item_container({skin:skill.skin,onclick:"render_skill('','"+s[0]+"')"}); } }); function render_cnd(name,condition) { html+="
"+item_container({skin:condition.skin,onclick:"show_condition('"+name+"')"})+"
"+condition.name+"
\""+name+"\"
"; } html+="
Buffs
"; object_sort(G.conditions).forEach(function(c){ var name=c[0],condition=c[1]; if(condition.buff) render_cnd(name,condition); }); html+="
Debuffs
"; object_sort(G.conditions).forEach(function(c){ var name=c[0],condition=c[1]; if(condition.debuff) render_cnd(name,condition); }); html+="
Conditions
"; object_sort(G.conditions).forEach(function(c){ var name=c[0],condition=c[1]; if(!condition.debuff && !condition.buff && !condition.technical) render_cnd(name,condition); }); html+="
Technical
"; object_sort(G.conditions).forEach(function(c){ var name=c[0],condition=c[1]; if(condition.technical) render_cnd(name,condition); }); html+="
"; show_modal(html,{wrap:false,hideinbackground:true,url:"/docs/guide/all/skills_and_conditions"}); } function render_teleporter() { var html="
"; for(var id in G.maps) { if(!G.maps[id].ignore && !G.maps[id].instance) { html+="
"+G.maps[id].name+"
"; } } html+="
"; if(!$('.cxmodalteleporter').length) show_modal(html,{wrap:false}); } function render_travel(the_map) { var html="
"; var one=false,places=false; if(!the_map) the_map=character['map'],places=true; (G.maps[the_map].npcs||[]).forEach(function(def){ var npc=G.npcs[def.id]; if(!in_arr(npc.role,["citizen","guard","pvp_announcer"])) { if(!one) { one=true; html+="
NPCs in "+G.maps[the_map].name+"
"; } var position=def.position||def.positions[0]; html+="
"+sprite(npc.skin,{width:50,height:50,cx:npc.cx})+"
"+npc.name+"
"; } }); var parsed={},packs={}; object_sort(G.maps,"random").forEach(function(e){ var name=e[0],map=e[1]; if(map.ignore) return; cshuffle(map.monsters||[]).forEach(function(pack){ if(name!=the_map && !pack.boundaries || parsed[pack.type]) return; if(pack.boundaries) { cshuffle(pack.boundaries).forEach(function(b){ if(b[0]!=the_map || parsed[pack.type]) return; parsed[pack.type]=true; packs[pack.type]={type:pack.type,x:b[1],y:b[2],hp:G.monsters[pack.type].hp} }); } else { parsed[pack.type]=true; packs[pack.type]={type:pack.type,x:pack.boundary[0],y:pack.boundary[1],hp:G.monsters[pack.type].hp}; } }); }); if(Object.keys(packs).length) { html+="
Monsters in "+G.maps[the_map].name+"
"; html+="
"; object_sort(packs,"hpsort").forEach(function(e){ if((G.monsters[e[0]].cute || G.monsters[e[0]].stationary) && !G.monsters[e[0]].achievements) return; html+="
"; html+="
"; html+=sprite(e[0],{scale:1.5}); html+="
"; html+="
"+G.monsters[e[0]].name+"
"; html+="
"; }); html+="
"; } if(places) { html+="
Places
"; object_sort(G.maps).forEach(function(io){ var id=io[0]; if(!G.maps[id].ignore && !G.maps[id].unlist && !G.maps[id].instance && !G.maps[id].irregular && (G.maps[id].world||"")==(window.world||"") && (!G.maps[id].event || (G.maps[id].event||"")==(window.current_event||""))) { html+="
"+G.maps[id].name+"
"; } }); } html+="
"; if(!$('.cxmodalteleporter').length) show_modal(html,{wrap:false}); //true,styles:"background-color:#ABACB6",wwidth:420}); } function render_gtravel() // gm monster travel { var html="
",f="render_spawns"; object_sort(G.maps).forEach(function(io){ var id=io[0]; if(!G.maps[id].ignore && !G.maps[id].instance) { html+="
"+G.maps[id].name+"
"; } }); html+="
"; if(!$('.cxmodalteleporter').length) show_modal(html,{wrap:false}); } function render_gmonsters(t) { var html="
"; object_sort(G.monsters).forEach(function(io){ var id=io[0]; html+="
"+G.monsters[id].name+"
"; }); html+="
"; show_modal(html,{wrap:false}); } function render_spawns(id) { var html="
",i=0; G.maps[id].spawns.forEach(function(io){ html+="
"+id+"["+i+"]
"; i++; }); html+="
"; show_modal(html,{wrap:false}); } function render_interaction(type,sub_type,args) { if(!args) args={}; if(sub_type!="return_html") { topleft_npc="interaction"; rendered_target=topleft_npc; rendered_interaction=type; } var left=0,top=0,file="/images/tiles/characters/npc1.png",img_type="normal",pass=false; var html="
"; //face if(type.auto) // likely, this will be the future method [25/07/17] { file=FC[type.skin]; left=FM[type.skin][1]; top=FM[type.skin][0]; img_type=T[type.skin]; if(type.dialog) type=type.dialog; } else if(in_arr(type,["wizard","hardcoretp"])) { left=2; top=0; file="/images/tiles/characters/chara8.png"; } else if(in_arr(type,["santa","candycane_success"])) { left=0; top=0; file="/images/tiles/characters/animationc.png"; img_type="animation"; } else if(in_arr(type,["leathers","leather_success"])) { left=1; top=0; file="/images/tiles/characters/npc5.png"; } else if(in_arr(type,["lostearring","lostearring_success"])) { left=3; top=0; file="/images/tiles/characters/chara8.png"; } else if(in_arr(type,["mistletoe","mistletoe_success"])) { left=0; top=0; file="/images/tiles/characters/chara8.png"; } else if(in_arr(type,["crafting"])) { left=0; top=0; file="/images/tiles/characters/npc5.png"; } else if(in_arr(type,["ornaments","ornament_success"])) { left=1; top=0; file="/images/tiles/characters/chara8.png"; } else if(in_arr(type,["jailer","guard","blocker","test"])) { left=3; top=0; file="/images/tiles/characters/chara5.png"; } else if(in_arr(type,["seashells","seashell_success"])) { left=0; top=1; file="/images/tiles/characters/npc1.png"; } else if(in_arr(type,["lottery"])) { left=3; top=0; file="/images/tiles/characters/npc6.png"; } else if(in_arr(type,["newupgrade"])) { left=3; top=1; file="/images/tiles/characters/chara8.png"; } else if(type=="tavern") { left=0; top=1; file="/images/tiles/characters/custom1.png"; } else if(type=="standmerchant") { left=3; top=0; file="/images/tiles/characters/npc5.png"; } else if(type=="subscribe") { left=3; top=1; file="/images/tiles/characters/chara7.png"; } else if(in_arr(type,["gemfragments","gemfragment_success"])) { left=2; top=1; file="/images/tiles/characters/npc1.png"; } else if(in_arr(type,["buyshells","noshells","yesshells"])) { left=0; top=1; file="/images/tiles/characters/dwarf2.png"; } else if(in_arr(type,["unlock_items2","unlock_items3","unlock_items4","unlock_items5","unlock_items6","unlock_items7"])) { left=3; top=1; file="/images/tiles/characters/npc4.png"; if(type=="unlock_items2") top=1,left=0; if(type=="unlock_items3") top=1,left=0; if(type=="unlock_items4") top=1,left=2; if(type=="unlock_items5") top=1,left=2; if(type=="unlock_items6") top=0,left=1; if(type=="unlock_items7") top=0,left=1; } else if(type.startsWith("unlock_")) pass=true; else return; if(pass); else if(img_type=="normal" || img_type=="full") html+="
"; else html+="
"; if(type.auto) { html+=type.message; if(type.button) interaction_onclick=type.onclick,html+="
"+type.button+"
"; if(type.button2) interaction_onclick2=type.onclick2,html+="
"+type.button2+"
"; } else if(type=="seashells") { html+="Ah, I love the sea, so calming. As a kid, I loved spending time on the beach. Collecting seashells. If you happen to find some, I would love to add them to my collection."; html+="
I HAVE 20!
"; } else if(type=="buyshells") { html+="Yo dawg, I can hook you up with some shells If you want. I get these directly from Wizard in bulk so they are legit."; html+="
HMM, SURE...
"; } else if(type=="noshells") { html+="Ugh, maybe go farm more gold. It's not like they grow on trees. Just kill some puny monsters, you'll have plenty!"; } else if(type=="yesshells") { html+="Please doing business with you! You'll have your shells in a couple of milliseconds!"; } else if(type=="hardcoretp") { html+="Aww, are you stuck here? I can take you places. If you want!"; html+="
TELEPORT
"; } else if(type=="seashell_success") { if(Math.random()<0.001) html+="Awww. Ty. Ty. Ty. Xoxo."; else html+="How kind of you! Please accept this small gift in return."; d_text("+1",get_npc("fisherman"),{color:"#DFE9D9"}); } else if(type=="subscribe") { html+="It's that time of the day! Are you in?!"; html+="
SIGN ME UP!
"; } else if(type=="tavern") { html+="Tavern. A place for adventurers to relax, drink, unwind, play games, wager, challenge each other in friendly games. Currently under construction."; } else if(type=="test") { html+="Greetings! Looking for a good deal on weapons and armor? Then you came to the right place! No one sells better gear than me!"; } else if(type=="newupgrade") { html+="Adventurer! I can upgrade your weapons or armors. Combine 3 accessories to make a stronger one! Tho, beware, the process isn't perfect. Sometimes the items are ... lost."; html+="
UPGRADE
COMBINE
"; } else if(type=="locksmith") { html+="Lock - Prevents anything that can destroy an item, selling, upgrading, you name it! Seal - Locks the item in a way that unlocking it takes two days. Unlock - Frees it. Got it? Good. Cost? 250 big ones."; html+="
LOCK
SEAL
UNLOCK
"; } else if(type=="scrollsmith") { html+="De-stat an item. Give you back the scrolls used on the item, as though the item were level 0. Returns the item back to you along with scrolls. Got it? Good. Cost? Depends on the scroll. 10 times the value of the scrolls that will be returned to you."; html+="
DE-STAT
"; } else if(type=="crafting") { html+="I can craft or dismantle items for you. Price differs from item to item. Check out my recipes if you are interested!"; html+="
RECIPES
RECYCLING
CRAFT
DISMANTLE
"; } else if(type=="wizard") { html+="Well, Hello there! I'm Wizard, I made this game. Hope you enjoy it. If you have any issues, suggestions, feel free to email me at hello@adventure.land!"; } else if(type=="santa") { html+="Happy holidays! Please excuse my companion, he is a bit grumpy. If you happen to find any candy canes, that might cheer him up!"; html+="
I HAVE ONE!
"; } else if(type=="standmerchant") { html+="Anyone can become a merchant and start trading. You only need a merchant stand to display your items on!"; html+="
LET ME BUY ONE!
"; } else if(type=="candycane_success") { html+="Ah! Thanks for cheering him up. Here's something for you in return!"; } else if(type=="lostearring") { html+="Ewww. Ewww. Ewww. These wretched things ate my earrings. Kill them, kill them all. Bring my earrings back!"; html+="
AS YOU WISH
"; } else if(type=="lostearring_success") { html+="You did well. Here's something left from one of my old husbands..."; } else if(type=="mistletoe") { html+="You know, It gets boring in here sometimes ... I'm looking for some excitement. Uhm, Do you have a Mistletoe?"; html+="
OH MY, I DO!
"; } else if(type=="mistletoe_success") { html+="Haha! You thought I was going to give you a kiss?! You wish... Take this instead!"; } else if(type=="ornaments") { html+="Hmm. We should decorate these trees. I need some Ornaments tho. If you happen to collect "+G.items.ornament.e+" of them, let me know!"; html+="
YOU GOT IT!
"; } else if(type=="ornament_success") { html+="Thank you! Here's something in return."; //Great idea! } else if(type=="gemfragment_success") { html+="Bwahahahahah *cough* Ehem.. Thanks! You got a good deal. Keep bringing these fragments to me, don't give them to anyone else."; d_text("+1",get_npc("gemmerchant"),{color:"#E78295"}); } else if(type=="gemfragments") { html+="Back in the day we had miners, then came the moles, they work for free yet retrieving the gems is a challenge. Bring me "+G.items.gemfragment.e+" gem fragments and I can give you something exciting in return, no questions asked."; html+="
I GOT "+G.items.gemfragment.e+"!
"; } else if(type=="leathers") { html+="Hey, hey, hey! What brings you to this cold land? I personally love it here, ideal for my work. If you can bring me "+G.items.leather.e+" Leathers, I can give you one of my products in return."; html+="
I HAVE "+G.items.leather.e+"!
"; } else if(type=="leather_success") { html+="Here you go! Enjoy! Keep bringing leathers to me, I have a lot to offer!"; d_text("+1",get_npc("leathermerchant"),{color:"#DFE9D9"}); } else if(type=="jailer") { html+="Tu-tu-tu. Have you been a bad "+(Math.random()<0.5&&"boy"||"girl")+"? No worries. The lawmakers must see the potential in you, so instead of getting rid of you, they sent you here. You are free to leave whenever you want. But please don't repeat your mistake."; html+="
LEAVE
"; } else if(type=="blocker" || type=="guard") { var roll=Math.random(); if(roll<0.5) html+="Hmm. hmm. hmm. Can't let you pass. Check again later tho!"; else html+="There's some work going on inside. Maybe check back later!"; } else if(type=="lottery") { html+="Hi Dear! The lottery tickets for this week haven't arrived yet. Apologies :)"; } else if(type.startsWith("unlock_")) { var pack=args.pack,gold=bank_packs[pack][1],shells=bank_packs[pack][2]; if(is_electron) { html+="Hello! You don't seem to have an account open with me. Would you like to open one? It costs "+to_pretty_num(gold)+" Gold. We hold onto your items forever."; html+="
PAY "+to_pretty_num(gold)+" GOLD
"; } else { html+="Hello! You don't seem to have an account open with me. Would you like to open one? It costs "+to_pretty_num(gold)+" Gold or "+to_pretty_num(shells)+" Shells. We hold onto your items forever."; html+="
USE GOLD
USE SHELLS
"; } } else return; html+="
"; if(sub_type=="return_html") return html; $("#topleftcornerui").html(html); } function load_nearby(fallback) { friends_inside="nearby"; var html="",someone=false; html+=render_com_buttons(); for(var id in entities) { var player=entities[id]; if(!is_player(player)) continue; someone=true; } if(someone) { html+=""; html+=""; var l=Object.values(entities); l.sort(function(a,b){ if(!a.afk && b.afk) return -1; if(a.afk && !b.afk) return 1; if(a.ageb.age) return 1; if(a.name+FRIEND"; if(!actions) actions="None"; html+=""; }); html+="
NameLevelClassAgeStatusActions
"+player.name+""+player.level+""+player.ctype.toUpperCase()+""+player.age+""+afk+""+actions+"
"; } else { if(fallback) return load_server_list(); html+="
There is no one nearby.
"; } $(".friendslist").html(html); $(".friendslist").parent().find(".active2").removeClass("active2"); $(".fnearby").addClass("active2"); $(".fnearbyx").addClass("active3"); } function load_friends(info) { if(info) { if(friends_inside!="friends") return; var html=""; html+=render_com_buttons(); if(!info.chars.length && !friends.length) html+="
You don't have any friends but it's ok. Hang in there! Be kind to other players, get to know them, then friend them from the 'Nearby' tab. Afterwards, you can see when they are online and where they are.
"; else if(!info.chars.length) html+="
No one online.
"; else { html+=""; html+=""; info.chars.sort(function(a,b){ if(!a.afk && b.afk) return -1; if(a.afk && !b.afk) return 1; if(a.ageb.age) return 1; if(a.name"; }); html+="
NameLevelClassStatusServer
"+player.level+""+player.type.toUpperCase()+""+afk+""+player.server+"
"; } $(".friendslist").html(html); } else { friends_inside="friends"; api_call("pull_friends"); //$(".friendslist").html("
Loading ...
"); $(".friendslist").html(html); } $(".friendslist").parent().find(".active2").removeClass("active2"); $(".ffriends").addClass("active2"); $(".ffriendsx").addClass("active3"); } function load_server_list(info) { if(info) { if(friends_inside!="server") return; var html=""; html+=render_com_buttons(); if(!info.length) html+="
No one discoverable.
"; else { html+=""; html+=""; if(is_pvp) html+=""; html+=""; info.sort(function(a,b){ if(!a.afk && b.afk) return -1; if(a.afk && !b.afk) return 1; if(a.ageb.age) return 1; if(a.nameInvite"; else if(player.name=="Hidden") party="None"; else if(!player.party) party="You"; else party=""+player.party+""; if(player.name!=character.name && player.name!="Hidden") party+=" PM"; if(name=="Hidden") name="Hidden"; html+=""; if(is_pvp) html+=""; html+=""; }); html+="
NameLevelClassAgeStatusPartyKills
"+name+""+player.level+""+player.type.toUpperCase()+""+player.age+""+afk+""+party+""+to_pretty_num(player.kills)+"
"; } $(".friendslist").html(html); } else { friends_inside="server"; socket.emit("players"); //$(".friendslist").html("
Loading ...
"); $(".friendslist").html(html); } $(".friendslist").parent().find(".active2").removeClass("active2"); $(".fserver").addClass("active2"); $(".fserverx").addClass("active3"); } function load_merchants(info) { if(info) { if(friends_inside!="servers") return; var html=""; if(!info.chars.length) html="
No merchants with a stand online.
"; else { html+="
"; info.chars.sort(function(a,b){ if(!a.afk && b.afk) return -1; if(a.afk && !b.afk) return 1; if(a.ageb.age) return 1; if(a.name"; html+="
"+G.maps[player.map].name+": "+parseInt(player.x)+","+parseInt(player.y)+"
"; html+="
"+player.server+"
"; html+="
"; html+="
"; }); html+="
" } $(".friendslist").html(html); } else { friends_inside="servers"; api_call("pull_merchants"); $(".friendslist").html(""); $(".friendslist").parent().find(".active2").removeClass("active2"); $(".fservers").addClass("active2"); } } function load_servers_list(info) { friends_inside="servers"; var html="
"; html+=""; html+=""; html+=""; html+=""; X.servers.forEach(function(server){ var action="Here"; if(!(server_region==server.region && server.name==server_identifier)) action="Switch"; html+=""; }); html+="
Name#Action
All MerchantsNShow
"+server_regions[server.region]+" "+server.name+""+server.players+""+action+"
"; $(".friendslist").html(html); $(".friendslist").parent().find(".active2").removeClass("active2"); $(".fservers").addClass("active2"); } function load_character_list() { friends_inside="characters"; var html=""; html+=""; html+=""; html+=""; X.characters.forEach(function(player){ var afk="AFK",party=player.party,name=player.name,online=false; if(player.online) afk="ONLINE",link="Deployed"; else afk="OFFLINE",link="Deploy"; if(player.name!=character.name && player.name!="Hidden") party+=" PM"; if(name=="Hidden") name="Hidden"; html+=""; html+=""; html+=""; }); html+="
NameLevelClassStatusDeploy
"+name+""+player.level+""+player.type.toUpperCase()+""+afk+""+link+"
"; $(".friendslist").html(html); $(".friendslist").parent().find(".active2").removeClass("active2"); $(".fcharacters").addClass("active2"); } function show_delete_mail(id) { show_confirm("Delete the mail?","Yes","Cancel",function(){ api_call('delete_mail',{mid:id}); hide_modal(); setTimeout(function(){ hide_modal(); },20); setTimeout(function(){ load_mail() },1600); }); } function render_mail(id) { var mail=window.mail[id]; var html="
"; html+="
Delete
"; html+="
From: "+mail.fro+"
"; html+="
To: "+mail.to+"
"; html+="
Subject: "+html_escape(mail.subject)+"
"; html+="
"+html_escape(mail.message).replace_all("\r\n","
").replace_all("\n","
").replace_all("\t","  ")+"
"; if(mail.item) { var item=JSON.parse(mail.item); var take=""; if(!mail.taken) take=" TAKE "; html+="
Item: "+item_container({skin:G.items[item.name].skin,def:G.items[item.name],draggable:false},item)+take+"
"; } html+="
"; show_modal(html); api_call("read_mail",{mail:id},{silent:true}); } function load_mail(info) { var html=""; html+="
Send Mail Cost: 48,000
"; if(info) { if(friends_inside!="mail") return; if(info.cursored) html+="
(Previous emails not shown)
"; if(!info.mail.length && info.cursored) html+="
End of mail.
"; else if(!info.mail.length) html+="
No mail yet.
"; else { html+="
"; window.mail={}; info.mail.forEach(function(mail){ var item_html=""; window.mail[mail.id]=mail; if(mail.item && !mail.taken) { var item=JSON.parse(mail.item); item_html+=" ITEM! "; } html+="
From: "+mail.fro+" To: "+mail.to+" Subject: "+html_escape(mail.subject)+item_html+"
"; }); html+="
" if(!(info.cursor && info.more)) html+="
End of mail.
"; else html+="
Load More
"; } $(".friendslist").html(html); } else { friends_inside="mail"; api_call("pull_mail"); $(".friendslist").html(html); $(".friendslist").parent().find(".active2").removeClass("active2"); $(".fmail").addClass("active2"); } } function load_chat(info,type) { var html=""; if(!type) type="all"; html+="
Global
"; html+="
Party
"; html+="
Private
"; html+="
All Incoming
"; X.servers.forEach(function(server){ html+="
"+server.region+" "+server.name+"
"; }); // html+="
Pull
"; if(info) { if(friends_inside!="chat") return; if(info.cursored) html+="
(Previous messages not shown)
"; if(!info.messages.length && info.cursored) html+="
End of chat.
"; else if(!info.messages.length) html+="
No messages yet.
"; else { html+="
"; window.messages={}; info.messages.forEach(function(message){ var item_html="",server=""; window.messages[message.id]=message; var color="gray"; if(message.type=="private") color="#CD7879",server=" ["+message.to[0]+"]"; if(message.type=="party") color="#5B8DB0"; if(message.type=="ambient" || type=="global") server=" ["+message.server+"]"; html+="
"+html_escape(message.fro)+":"+" "+html_escape(message.message)+server+"
"; }); html+="
" if(!(info.cursor && info.more)) html+="
End of messages.
"; else html+="
Load More
"; } $(".friendslist").html(html); } else { friends_inside="chat"; api_call("pull_messages",{type:type}); $(".friendslist").html(html); $(".friendslist").parent().find(".active2").removeClass("active2"); $(".fchat").addClass("active2"); } } function load_pvp_list(list) { console.log(list); var html="
",pwn=false; list.forEach(function(a_t){ html+="
"+a_t[0]+" pwned "+a_t[1]+"
"; pwn=true; }); if(!pwn) html+="
Noone pwned Anyone
"; html+="
"; show_modal(html,{wwidth:400}); } function load_coming_soon(num) { var message="Coming Sooner!"; $(".friendslist").parent().find(".active2").removeClass("active2"); if(num==1) $(".fserver").addClass("active2"); else if(num==2) $(".fguild").addClass("active2"),message="Coming Soon!"; else if(num==3) $(".fleaders").addClass("active2"),message="Planned, along with achievements, character statistics, weekly, monthly leaderboards"; else if(num==4) $(".fmail").addClass("active2"),message="Coming Soon!"; $(".friendslist").html("
"+message+"
"); } var friends_inside="nearby"; function render_com() { var html=""; var c_count=0; api_call("servers_and_characters"); X.characters.forEach(function(c){if(c.online) c_count+=1;}); html+="
"; //html+="
Friends
"; //html+="
Nearby
"; //html+="
Server
"; html+="
Comrades
"; html+="
Realm
"; html+="
Characters ["+c_count+"/4]
"; html+="
Chat
"; html+="
Mail ["+(window.X && X.unread || 0)+"]
"; // html+="
Guild
Mail
Leaderboards
"; html+="
"; html+="
NOTE: The Communicator is an evolving protoype
"; // html+="
Refresh
"; html+="
"; show_modal(html,{}); //styles:"background: #CACACA; border-color: #4C4C4C" load_nearby(1); } function render_com_buttons() { var html="
"; html+="
Friends
"; html+="
Nearby
"; html+="
Server
"; html+="
" return html; } var IID=null; function precompute_image_positions() { // G.images is new [25/09/18] if(IID) return; if(!window.SS) window.SS={},window.SSU={}; if(!Object.keys(T).length) process_game_data(); IID={}; // IID is reset after game loads, so actual dimensions are live for(var name in G.sprites) { var s_def=G.sprites[name]; if(s_def.skip) continue; var row_num=4,col_num=3,s_type="full"; if(in_arr(s_def.type,["animation"])) row_num=1,s_type=s_def.type; if(in_arr(s_def.type,["tail"])) col_num=4,s_type=s_def.type; if(in_arr(s_def.type,["v_animation","head","hair","hat","s_wings","face","makeup","beard"])) col_num=1,s_type=s_def.type; if(in_arr(s_def.type,["a_makeup","a_hat"])) col_num=3,s_type=s_def.type; if(in_arr(s_def.type,["wings","body","armor","skin","character"])) s_type=s_def.type; if(in_arr(s_def.type,["emblem","gravestone"])) row_num=1,col_num=1,s_type=s_def.type; var matrix=s_def.matrix; var width=G.images[s_def.file.split("?")[0]]&&G.images[s_def.file.split("?")[0]].width||s_def.width||window.C&&C[s_def.file]&&C[s_def.file].width||312; var height=G.images[s_def.file.split("?")[0]]&&G.images[s_def.file.split("?")[0]].height||s_def.height||window.C&&C[s_def.file]&&C[s_def.file].height||288; // if(s_def.columns!=4 || s_def.rows!=2) continue; for(var i=0;i\
"; // Math.ceil((IID[name][4]-width)/2) } catch(e){ console.log(e); } return ""; } function sprite(name,args) { try{ if(!args) args={}; if(is_string(args)) args={cx:args}; if(is_string(args.cx)) args.cx=args.cx.split(","); if(!args.cx) args.cx={}; if(!args.scale) args.scale=1.5; if(G.monsters[name] && G.monsters[name].size) args.scale-=1-G.monsters[name].size; precompute_image_positions(); if(!IID[name] && G.items[name]) return item_container({skin:name,bcolor:"black"}); if(G.monsters[name] && G.monsters[name].skin) name=G.monsters[name].skin; prune_cx(args.cx,name); if(!args.width) args.width=40; if(!args.height) args.height=50; if(!args.rx_disp) args.rx_disp=0; if(args.full) { if(G.dimensions[name]) args.width=(G.dimensions[name][0]+4)*args.scale,args.height=(G.dimensions[name][1]+5)*args.scale; else args.width=IID[name][4]*args.scale,args.height=IID[name][5]*args.scale; } if(G.dimensions[name] && G.dimensions[name][3]) args.rx_disp=-G.dimensions[name][3]*args.scale; var html="
"; var head_y=G.cosmetics.default_head_place; var hair_y=G.cosmetics.default_hair_place; var hat_y=G.cosmetics.default_hat_place; var skin=null,rip=false,cxs=[name],cx_prop={}; for(var n in args.cx) cxs.push(n); cxs.forEach(function(cid){ if(G.cosmetics.prop[cid]) G.cosmetics.prop[cid].forEach(function(p){ cx_prop[p]=true; }) }); var body_type="full"; if(T[name]=="armor") body_type="armor"; else if(T[name]=="body") body_type="body"; else if(T[name]=="character") body_type="character"; if(args.rip) { // originally opacity=0.4 html+=sprite_image(args.cx.gravestone||"gravestone",{cwidth:args.width,scale:args.scale})+"
"; return html; } var opacity=1,j=args.j||0; if(body_type!="full" && !args.cx.head) args.cx.head="makeup117"; if(body_type!="character" && !args.cx.head) args.cx.head="makeup117"; // console.log(!(IID[name][4]%2)+" "+args.x_disp); var head_dy={"large":2,"tall":1,"normal":0,"small":-1,"xsmall":-3,"xxsmall":-4}[SS[name]]; head_y+=head_dy; var head_dh=G.cosmetics.head[args.cx.head]&&G.cosmetics.head[args.cx.head][3]||0; var hair_dy=G.cosmetics.hair[args.cx.hair]&&G.cosmetics.hair[args.cx.hair][0]||0; hair_dy+=head_dh+head_dy; hair_y+=hair_dy; var hair_dh=G.cosmetics.hair[args.cx.hair]&&G.cosmetics.hair[args.cx.hair][1]||0; hat_y+=hair_dh+head_dy; var hat_dy=G.cosmetics.hat[args.cx.hat]||0; hat_dy+=head_dh; hat_y+=hat_dy; var hidden_head=j==3||G.cosmetics.prop[name]&&G.cosmetics.prop[name].includes("covers"); var cx={}; for(var place in args.cx) { var cid=args.cx[place]; if(!cid || !cid.length || !IID[cid]) continue; if(place=="head") { if(body_type!="full" && body_type!="character") cx.head=cid; } else if(place=="hair") { if(body_type!="full" && body_type!="character" && !cx_prop.no_hair) cx.hair=cid; } else if(place=="upper") { if(body_type!="full" && T[cid]=="armor" && SSU[cid]==SSU[name]) cx.upper=cid; } else cx[place]=cid; } if(cx.head && !skin) { skin={ "small":G.cosmetics.head[cx.head]&&G.cosmetics.head[cx.head][0]||"sskin1a", "normal":G.cosmetics.head[cx.head]&&G.cosmetics.head[cx.head][1]||"mskin1a", "tall":G.cosmetics.head[cx.head]&&G.cosmetics.head[cx.head][1]||"mskin1a", "large":G.cosmetics.head[cx.head]&&G.cosmetics.head[cx.head][2]||"lskin1a"}[SS[name]]; } if(cx.head && hidden_head) html+=sprite_image(cx.head,{p:head_y,cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(cx.back && j!=3) html+=sprite_image(cx.back,{cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(skin) html+=sprite_image(skin,{cwidth:args.width,scale:args.scale,opacity:opacity,j:j,x_disp:args.x_disp}); if(!(IID[name][4]%2)) html+=sprite_image(name,{cwidth:args.width,scale:args.scale,opacity:opacity,j:j,x_disp:args.rx_disp+-0.5});// old 26px width frame else html+=sprite_image(name,{cwidth:args.width,scale:args.scale,opacity:opacity,j:j,x_disp:args.rx_disp}); if(cx.upper) html+=sprite_image(cx.upper,{cwidth:args.width,scale:args.scale,opacity:opacity,j:j,rheight:8}); if(cx.head && !hidden_head) html+=sprite_image(cx.head,{p:head_y,cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(j!=3 && cx.makeup) html+=sprite_image(cx.makeup,{p:head_y+G.cosmetics.default_makeup_position,cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(cx.hair) html+=sprite_image(cx.hair,{p:hair_y,cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(j!=3 && cx.face) html+=sprite_image(cx.face,{p:head_y+G.cosmetics.default_face_position,cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(j!=3 && cx.chin) html+=sprite_image(cx.chin,{p:head_y+G.cosmetics.default_beard_position,cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(cx.tail) html+=sprite_image(cx.tail,{p:0,cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(cx.hat) html+=sprite_image(cx.hat,{p:hat_y,cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(cx.back && j==3) html+=sprite_image(cx.back,{cwidth:args.width,scale:args.scale,opacity:opacity,j:j}); if(rip) html+=sprite_image(rip,{cwidth:args.width,scale:args.scale,j:j}); html+="
"; return html; }catch(e){ console.log(e) } return ""; } function cx_sprite(name,args) { if(!args) args={}; function render_cosmetic(slot,rargs) { if(!rargs) rargs={}; if(!rargs.color && (cx[slot] || slot=="skin")) rargs.color="#17B8E3"; else if(!rargs.color) rargs.color="#5DBA50"; rargs.bg="#D5D5D5"; rargs.bg="#504254"; var width=rargs.width||49,height=48,labels=""; if(rargs.rip) height=48; rargs.scale=rargs.scale||2; rargs.j=rargs.j||0; if(args.labels) { var drop=false,mdrop=false,ccx=false,icx=false; for(var dname in G.drops) { if(!(G.items[dname] && G.items[dname].e)) continue; G.drops[dname].forEach(function(t){ if(t[1]=="cx" && t[2]==name) drop=true; }) } for(var mname in G.monsters) { if(!(G.drops && G.drops.monsters && G.drops.monsters[mname])) continue; G.drops.monsters[mname].forEach(function(t){ if(t[1]=="cxjar" && t[3]==name) mdrop=true; }) } for(var cname in G.classes) { if((G.classes[cname].xcx||[]).includes(name)) ccx=true; } for(var iname in G.items) { if((G.items[iname].xcx||[]).includes(name)) icx=true; } if(drop) labels+="E"; if(mdrop) labels+="M"; if(ccx) labels+="C"; if(icx) labels+="I"; if(!labels) labels+="X"; } html+="
"; html+="
"; if(args.labels) html+="
"+labels+"
"; html+="
"+sprite(rargs.skin,{cx:rargs.cx,scale:rargs.scale,height:rargs.height*rargs.scale+20*rargs.scale,j:rargs.j,width:width,rip:rargs.rip})+"
"; html+="
"+(rargs.text||slot).toUpperCase()+"
"; html+="
" html+="
"; } var html=""; precompute_image_positions(); if(["hair","face","head","makeup","a_makeup"].includes(T[name])) { var cx={head:T[name]=="head"&&name||"bwhead"}; cx[cxtype_to_slot[T[name]]]=name; render_cosmetic(T[name],{skin:T[name]=="head"&&"nothing"||"mabw",top:50+(T[name]=="head"&&-6||0),scale:3,cx:cx,height:16,aheight:4}); return html; } else if(["hat","a_hat"].includes(T[name])) { var cx={head:"bwhead"}; cx[cxtype_to_slot[T[name]]]=name; render_cosmetic(T[name],{skin:"mabw",top:50,scale:3,cx:cx,height:16,aheight:4}); return html; } else if(["beard","mask"].includes(T[name])) { var cx={head:"bwhead"}; cx[cxtype_to_slot[T[name]]]=name; render_cosmetic(T[name],{skin:"mabw",top:30,scale:3,cx:cx,height:16}); return html; } else if(["armor","body","character"].includes(T[name])) { var cx={head:"bwhead"}; cx[cxtype_to_slot[T[name]]]=name; render_cosmetic(T[name]=="character"&&"char"||T[name],{skin:name,top:-7,scale:2,cx:cx,height:36,aheight:16}); return html; } else if(["gravestone"].includes(T[name])) { var cx={head:"bwhead"}; cx[cxtype_to_slot[T[name]]]=name; render_cosmetic("stone",{skin:"mabw",top:-7,scale:2,cx:cx,height:36,aheight:16,rip:true}); return html; } else if(["s_wings","tail"].includes(T[name])) { var cx={head:"bwhead"}; cx[cxtype_to_slot[T[name]]]=name; render_cosmetic(T[name],{skin:"mabw",j:3,top:-7,width:59,scale:2,cx:cx,height:36,aheight:16}); return html; } else { return sprite(name,{cx:{head:"bwhead"}}); } } function cx_move(x,y) { last_cx_d[0]+=x; last_cx_d[1]+=y; var skin=character.skin,cx=character.cx; if(!textures.naked) generate_textures("naked","full"); character.skin="naked"; character.cx={}; cosmetics_logic(character); character.skin=skin; character.cx=cx; cosmetics_logic(character); for(var n in character.cxc) { if(character.cxc[n].skin==last_cx_name) { character.cxc[n].x+=last_cx_d[0]; character.cxc[n].y+=last_cx_d[1]; character.cxc[n].moved=true; } } var log=last_cx_name+":"; if(!last_cx_d[0] && !last_cx_d[1]) log+=" default position"; if(last_cx_d[0]<0) log+=" [move left "+(-last_cx_d[0])+"px]"; if(last_cx_d[0]>0) log+=" [move right "+(last_cx_d[0])+"px]"; if(last_cx_d[1]<0) log+=" [move up "+(-last_cx_d[1])+"px]"; if(last_cx_d[1]>0) log+=" [move down "+(last_cx_d[1])+"px]"; add_log(log,"#BD6BB6"); } function insert_cx_tuners() { var html="
"; html+="
UP
"; html+="
DOWN
"; html+="
LEFT
"; html+="
RIGHT
"; html+="
" $("body").append(html); } var last_cx_slot="",last_cx_name="",last_cx_d=[0,0]; function render_cgallery(skin,cx,slot) { cx=clone(cx); var html="",types=[],a=[],b=[],n=null,s,old=null,j=0,cx_count=all_cx(character,1),cx_map=map_cx(character),me=false; if((xtarget||target).me) me=true; var bg="#504254"; function render_cosmetic(reset) { var width=47,height=64,html=""; var aheight=32; if(cx.hat || reset && slot=="hat") height+=12,aheight+=6; if(slot=="gravestone") height=48; var scale=2,found=false,onclick="onclick='if(!(xtarget||target).me) socket.emit(\"send\",{name:(xtarget||target).name,cx:\""+s[0]+"\"}),push_deferred(\"send\"); else socket.emit(\"cx\",{slot:\""+slot+"\",name:\""+s[0]+"\"}),last_cx_slot=\""+slot+"\",last_cx_name=\""+s[0]+"\",last_cx_d=[0,0],push_deferred(\"cx\"); hide_modal();' class='clickable'"; if(!me && cx_map[s[0]] && cx_count[cx_map[s[0]]]>0 || me && cx_count[s[0]]!==undefined || me && character.role==="cx" || reset) found=true; else onclick=""; html+="
"; if(mode.cosmetics) html+="
"+s[0]+"
"; html+="
"; html+="
"+sprite(skin,{cx:cx,scale:scale,height:aheight*scale+20*scale,j:j,width:width,rip:(slot=="gravestone")})+"
"; html+="
" html+="
"; if(reset) n=html; else if(found) a.push(html); else b.push(html); } for(var cxt in cxtype_to_slot) { if(cxtype_to_slot[cxt]==slot) types.push(cxt); } if(slot=="upper") types=["body","armor"]; if(slot=="back") types.push("tail"); // synced with server.js/'cx' if(slot=="face") types.push("makeup"),types.push("a_makeup"); if(slot=="tail" || slot=="back") j=3; object_sort(T).forEach(function(x){ s=x; if(in_arr(s[1],types)) { if(T[skin]=="full" && slot=="head") return; if(slot=="upper" && (T[skin]=="full" || SSU[s[0]]!=SSU[skin] || skin==s[0] || T[s[0]]!="armor")) return; if(cxtype_to_slot[s[1]]=="skin") skin=s[0]; else if(slot=="upper") cx.upper=s[0]; else { types.forEach(function(t){ delete cx[cxtype_to_slot[t]]; }) cx[cxtype_to_slot[s[1]]]=s[0]; } render_cosmetic(); } }); if((a.length || b.length) && slot!="skin") { s=[""]; types.forEach(function(t){ delete cx[cxtype_to_slot[t]]; }) render_cosmetic(1); } if(a.length || b.length) { a.forEach(function(h){html+=h;}); if(n) html+=n; b.forEach(function(h){html+=h;}); show_modal(html,{wrap:false,styles:"max-width:400px"}); } else show_modal("
No Alternatives
",{wrap:false,styles:"max-width:400px"}); } var last_cx={},last_skin=""; function render_cosmetics(player,args) { if(!args) args={}; last_cx=player.cx; last_skin=player.skin; if(args.toggle && $('.cccx').html()) return $("#topleftcornerdialog").html(""); function render_cosmetic(slot,rargs) { if(!rargs) rargs={}; if(!rargs.color && (player.cx[slot] || slot=="skin")) rargs.color="#17B8E3"; else if(!rargs.color) rargs.color="#5DBA50"; rargs.bg="#D5D5D5"; rargs.bg="#504254"; var width=39,height=48; if(rargs.size=="big") { rargs.scale=3; width=91,height=118; rargs.top=12; } if(rargs.rip) height=48; rargs.scale=rargs.scale||2; rargs.j=rargs.j||0; html+="
"; html+="
"+(rargs.text||slot).toUpperCase()+"
"; html+="
"; else html+=">"; html+="
"; html+="
"+sprite(player.skin,{cx:rargs.cx,scale:rargs.scale,height:player.aheight*rargs.scale+20*rargs.scale,j:rargs.j,width:width,rip:rargs.rip})+"
"; html+="
" html+="
"; } var html="
"; var color=""; html+="
"; html+="
"; if(IID[player.skin][8]=="full") color="#BB2242"; render_cosmetic("head",{text:"skin",top:-9,scale:3,color:color,cx:{head:player.cx.head}}); render_cosmetic("hair",{top:6,scale:3,mleft:8,color:color,cx:{head:player.cx.head,hair:player.cx.hair||"bwhair"}}); color=""; render_cosmetic("hat",{top:12,scale:3,mleft:8,color:color,cx:{head:player.cx.head,hair:player.cx.hair,hat:player.cx.hat||"bwhat"}}); html+="
"; html+="
"; render_cosmetic("face",{top:-9,scale:3,cx:{head:player.cx.head,hair:player.cx.hair,face:player.cx.face||"bwglasses"}}); var cx=clone(player.cx); delete cx.upper; delete cx.back; render_cosmetic("skin",{text:"ATTIRE",top:-12,scale:2,mleft:8,cx:cx}); if(IID[player.skin][8]=="full") color="#BB2242"; var cx=clone(player.cx); delete cx.back; render_cosmetic("upper",{top:-5,scale:2,mleft:8,color:color,cx:cx}); color=""; html+="
"; html+="
"; render_cosmetic("chin",{top:-20,scale:3,cx:{head:player.cx.head,hair:player.cx.hair,chin:player.cx.chin||"beard112"}}); render_cosmetic("special",{top:10,text:"sp. fx",cx:player.cx,scale:1,mleft:8,bg:"#E3B245"}); var cx=clone(player.cx); delete cx.tail; render_cosmetic("back",{top:-2,j:3,scale:1.5,mleft:8,cx:cx}); //var cx=clone(player.cx); delete cx.back; //render_cosmetic("tail",{top:-20,j:3,scale:2,mleft:8,cx:cx}); html+="
"; html+="
"; html+="
"; html+="
"; render_cosmetic("skin",{text:"looks",cx:player.cx,size:"big",mleft:8}); html+="
"; html+="
"; render_cosmetic("gravestone",{text:"RIP",top:-16,scale:1.75,mleft:8,cx:cx,rip:true,bg:"#8cb0bb"}); render_cosmetic("EMOTES",{top:10,j:3,scale:1,mleft:8,cx:cx,bg:"#8756ff"}); html+="
"; html+="
"; html+="
"; dialogs_target=xtarget||ctarget; $("#topleftcornerdialog").html(html); } function load_class_info(name,look) { var html=""; name=name||window.chartype||"warrior"; if(!G.classes[name]) return; look=nunv(look,nunv(window.thelooks,0)); if(!G.classes[name].looks[look]) look=0; //html+="
"; html+="
"+sprite(G.classes[name].looks[look][0],{cx:G.classes[name].looks[look][1],scale:2,height:72,width:52})+"
"; html+="
Class: "+name.toTitleCase()+"
"; html+="
Primary Attribute: "+G.classes[name].main_stat.toTitleCase()+"
"; if(G.classes[name].side_stat) html+="
Secondary Attribute: "+G.classes[name].side_stat.toTitleCase()+"
"; html+="
Description: "+G.classes[name].description+"
"; $("#features").css("height",208).html(html); // $(".salesui").css("bottom",208+36); } function to_pretty_fraction(num) { var html="IMPL"; [[1000000000,"1B","#B30000"],[100000000,"100M","#825CD5"],[10000000,"10M","#825CD5"],[1000000,"1M","#825CD5"],[100000,"100K","#5090D3"],[10000,"10K","#5090D3"],[1000,"1K","#5090D3"],[100,"100","#909090"],[10,"10","#909090"],[1,"1","#64C287"]].forEach(function(l){ if(num*l[0]>1) html=to_pretty_float(num*l[0])+"/"+l[1]+""; }); return html; }