UNPKG

@2003scape/rsc-client

Version:
1 lines 1.18 MB
!function(){var t=function(t){var e;return function(i){return e||t(e={exports:{},parent:i},e.exports),e.exports}},e=t((function(t,x){t.exports=function(t){const x=((E=e({})).appearance=A({}),E.bank=T({}),E["close-connection"]=k({}),E.death=C({}),E.duel=I({}),E.index=e({}),E.inventory=_({}),E["logout-deny"]=S({}),E.messages=M({}),E["option-list"]=v({}),E["player-stats"]=w({}),E.prayer=b({}),E["region-entity-update"]=y({}),E["region-ground-items"]=g({}),E["region-npc-update"]=m({}),E["region-npcs"]=p({}),E["region-objects"]=d({}),E["region-player-update"]=f({}),E["region-players"]=c({}),E["region-wall-objects"]=l({}),E.settings=u({}),E.shop=a({}),E.sleep=h({}),E.social=o({}),E.sound=s({}),E["teleport-bubble"]=n({}),E.trade=r({}),E["world-info"]=i({}),E);var E;const B={};for(const[e,i]of Object.entries(x))if(!/^_|index/.test(e))for(const[r,n]of Object.entries(i))B[r]=n.bind(t);return B}})),i=t((function(t,e){t.exports={[Jm.WORLD_INFO]:function(t){this.loadingArea=!0,this.localPlayerServerIndex=Ud.getUnsignedShort(t,1),this.planeWidth=Ud.getUnsignedShort(t,3),this.planeHeight=Ud.getUnsignedShort(t,5),this.planeIndex=Ud.getUnsignedShort(t,7),this.planeMultiplier=Ud.getUnsignedShort(t,9),this.planeHeight-=this.planeIndex*this.planeMultiplier}}})),r=t((function(t,e){t.exports={[Jm.TRADE_OPEN]:function(t){const e=Ud.getUnsignedShort(t,1);null!==this.playerServer[e]&&(this.tradeRecipientName=this.playerServer[e].name),this.showDialogTrade=!0,this.tradeRecipientAccepted=!1,this.tradeAccepted=!1,this.tradeItemsCount=0,this.tradeRecipientItemsCount=0},[Jm.TRADE_CLOSE]:function(){this.showDialogTrade=!1,this.showDialogTradeConfirm=!1},[Jm.TRADE_ITEMS]:function(t){this.tradeRecipientItemsCount=255&t[1];let e=2;for(let i=0;i<this.tradeRecipientItemsCount;i++)this.tradeRecipientItems[i]=Ud.getUnsignedShort(t,e),e+=2,this.tradeRecipientItemCount[i]=Ud.getUnsignedInt(t,e),e+=4;this.tradeRecipientAccepted=!1,this.tradeAccepted=!1},[Jm.TRADE_RECIPIENT_STATUS]:function(t){this.tradeRecipientAccepted=!!t[1]},[Jm.TRADE_STATUS]:function(t){this.tradeAccepted=!!t[1]},[Jm.TRADE_CONFIRM_OPEN]:function(t){this.showDialogTradeConfirm=!0,this.tradeConfirmAccepted=!1,this.showDialogTrade=!1;let e=1;this.tradeRecipientConfirmHash=Ud.getUnsignedLong(t,e),e+=8,this.tradeRecipientConfirmItemsCount=255&t[e++];for(let i=0;i<this.tradeRecipientConfirmItemsCount;i++)this.tradeRecipientConfirmItems[i]=Ud.getUnsignedShort(t,e),e+=2,this.tradeRecipientConfirmItemCount[i]=Ud.getUnsignedInt(t,e),e+=4;this.tradeConfirmItemsCount=255&t[e++];for(let i=0;i<this.tradeConfirmItemsCount;i++)this.tradeConfirmItems[i]=Ud.getUnsignedShort(t,e),e+=2,this.tradeConfirmItemCount[i]=Ud.getUnsignedInt(t,e),e+=4}}})),n=t((function(t,e){t.exports={[Jm.TELEPORT_BUBBLE]:function(t){if(this.teleportBubbleCount<50){const e=255&t[1],i=t[2]+this.localRegionX,r=t[3]+this.localRegionY;this.teleportBubbleType[this.teleportBubbleCount]=e,this.teleportBubbleTime[this.teleportBubbleCount]=0,this.teleportBubbleX[this.teleportBubbleCount]=i,this.teleportBubbleY[this.teleportBubbleCount]=r,this.teleportBubbleCount++}}}})),s=t((function(t,e){t.exports={[Jm.SOUND]:function(t,e){const i=(r=t.slice(1,e),Array.from(r).map(t=>String.fromCharCode(t)).join(""));var r;this.playSoundFile(i)}}})),o=t((function(t,e){t.exports={[Jm.FRIEND_LIST]:function(t){this.friendListCount=Ud.getUnsignedByte(t[1]);for(let e=0;e<this.friendListCount;e++)this.friendListHashes[e]=Ud.getUnsignedLong(t,2+9*e),this.friendListOnline[e]=Ud.getUnsignedByte(t[10+9*e]);this.sortFriendsList()},[Jm.FRIEND_STATUS_CHANGE]:function(t){const e=Ud.getUnsignedLong(t,1),i=255&t[9];for(let r=0;r<this.friendListCount;r++)if(this.friendListHashes[r].equals(e))return 0===this.friendListOnline[r]&&0!==i&&this.showServerMessage(`@pri@${Ud.hashToUsername(e)} has logged in`),0!==this.friendListOnline[r]&&0===i&&this.showServerMessage(`@pri@${Ud.hashToUsername(e)} has logged out`),this.friendListOnline[r]=i,void this.sortFriendsList();this.friendListHashes[this.friendListCount]=e,this.friendListOnline[this.friendListCount]=i,this.friendListCount++,this.sortFriendsList()},[Jm.FRIEND_MESSAGE]:function(t,e){const i=Ud.getUnsignedLong(t,1),r=Ud.getUnsignedInt(t,9);for(let s=0;s<this.maxSocialListSize;s++)if(this.messageTokens[s]===r)return;this.messageTokens[this.messageIndex]=r,this.messageIndex=(this.messageIndex+1)%Lp.maxSocialListSize;let n=Fm.descramble(t,13,e-13);this.options.wordFilter&&(n=wm.filter(n)),this.showServerMessage(`@pri@${Ud.hashToUsername(i)}: tells you ${n}`)},[Jm.IGNORE_LIST]:function(t){this.ignoreListCount=Ud.getUnsignedByte(t[1]);for(let e=0;e<this.ignoreListCount;e++)this.ignoreList[e]=Ud.getUnsignedLong(t,2+8*e)}}})),h=t((function(t,e){t.exports={[Jm.SLEEP_OPEN]:function(t){this.isSleeping||(this.fatigueSleeping=this.statFatigue),this.isSleeping=!0,this.inputTextCurrent="",this.inputTextFinal="",this.surface.readSleepWord(this.spriteTexture+1,t),this.sleepingStatusText=null},[Jm.SLEEP_CLOSE]:function(){this.isSleeping=!1},[Jm.SLEEP_INCORRECT]:function(){this.sleepingStatusText="Incorrect - Please wait..."},[Jm.PLAYER_STAT_FATIGUE_ASLEEP]:function(t){this.fatigueSleeping=Ud.getUnsignedShort(t,1)}}})),a=t((function(t,e){t.exports={[Jm.SHOP_OPEN]:function(t){this.showDialogShop=!0;let e=1;const i=255&t[e++],r=t[e++];this.shopSellPriceMod=255&t[e++],this.shopBuyPriceMod=255&t[e++];for(let n=0;n<40;n++)this.shopItem[n]=-1;for(let n=0;n<i;n++)this.shopItem[n]=Ud.getUnsignedShort(t,e),e+=2,this.shopItemCount[n]=Ud.getUnsignedShort(t,e),e+=2,this.shopItemPrice[n]=t[e++];if(1===r){let t=39;for(let e=0;e<this.inventoryItemsCount&&!(t<i);e++){let i=!1;for(let t=0;t<40;t++)if(this.shopItem[t]===this.inventoryItemId[e]){i=!0;break}10===this.inventoryItemId[e]&&(i=!0),i||(this.shopItem[t]=32767&this.inventoryItemId[e],this.shopItemCount[t]=0,this.shopItemPrice[t]=0,t--)}}this.shopSelectedItemIndex>=0&&this.shopSelectedItemIndex<40&&this.shopItem[this.shopSelectedItemIndex]!==this.shopSelectedItemType&&(this.shopSelectedItemIndex=-1,this.shopSelectedItemType=-2)},[Jm.SHOP_CLOSE]:function(){this.showDialogShop=!1}}})),u=t((function(t,e){t.exports={[Jm.PRIVACY_SETTINGS]:function(t){this.settingsBlockChat=t[1],this.settingsBlockPrivate=t[2],this.settingsBlockTrade=t[3],this.settingsBlockDuel=t[4]},[Jm.GAME_SETTINGS]:function(t){this.optionCameraModeAuto=!!Ud.getUnsignedByte(t[1]),this.optionMouseButtonOne=!!Ud.getUnsignedByte(t[2]),this.optionSoundDisabled=!!Ud.getUnsignedByte(t[3])}}})),l=t((function(t,e){t.exports={[Jm.REGION_WALL_OBJECTS]:function(t,e){for(let i=1;i<e;)if(255===Ud.getUnsignedByte(t[i])){let e=0;const r=this.localRegionX+t[i+1]>>3,n=this.localRegionY+t[i+2]>>3;i+=3;for(let t=0;t<this.wallObjectCount;t++){const i=(this.wallObjectX[t]>>3)-r,s=(this.wallObjectY[t]>>3)-n;0!==i||0!==s?(t!==e&&(this.wallObjectModel[e]=this.wallObjectModel[t],this.wallObjectModel[e].key=e+1e4,this.wallObjectX[e]=this.wallObjectX[t],this.wallObjectY[e]=this.wallObjectY[t],this.wallObjectDirection[e]=this.wallObjectDirection[t],this.wallObjectId[e]=this.wallObjectId[t]),e++):(this.scene.removeModel(this.wallObjectModel[t]),this.world.removeWallObject(this.wallObjectX[t],this.wallObjectY[t],this.wallObjectDirection[t],this.wallObjectId[t]))}this.wallObjectCount=e}else{const e=Ud.getUnsignedShort(t,i);i+=2;const r=this.localRegionX+t[i++],n=this.localRegionY+t[i++],s=t[i++];let o=0;for(let t=0;t<this.wallObjectCount;t++)this.wallObjectX[t]!==r||this.wallObjectY[t]!==n||this.wallObjectDirection[t]!==s?(t!==o&&(this.wallObjectModel[o]=this.wallObjectModel[t],this.wallObjectModel[o].key=o+1e4,this.wallObjectX[o]=this.wallObjectX[t],this.wallObjectY[o]=this.wallObjectY[t],this.wallObjectDirection[o]=this.wallObjectDirection[t],this.wallObjectId[o]=this.wallObjectId[t]),o++):(this.scene.removeModel(this.wallObjectModel[t]),this.world.removeWallObject(this.wallObjectX[t],this.wallObjectY[t],this.wallObjectDirection[t],this.wallObjectId[t]));if(this.wallObjectCount=o,65535!==e){this.world._setObjectAdjacency_from4(r,n,s,e);const t=this.createModel(r,n,s,e,this.wallObjectCount);this.wallObjectModel[this.wallObjectCount]=t,this.wallObjectX[this.wallObjectCount]=r,this.wallObjectY[this.wallObjectCount]=n,this.wallObjectId[this.wallObjectCount]=e,this.wallObjectDirection[this.wallObjectCount++]=s}}}}})),c=t((function(t,e){t.exports={[Jm.REGION_PLAYERS]:function(t,e){this.knownPlayerCount=this.playerCount;for(let u=0;u<this.knownPlayerCount;u++)this.knownPlayers[u]=this.players[u];let i=8;this.localRegionX=Ud.getBitMask(t,i,11),i+=11,this.localRegionY=Ud.getBitMask(t,i,13),i+=13;const r=Ud.getBitMask(t,i,4);i+=4;const n=this.loadNextRegion(this.localRegionX,this.localRegionY);this.localRegionX-=this.regionX,this.localRegionY-=this.regionY;const s=this.localRegionX*this.magicLoc+64,o=this.localRegionY*this.magicLoc+64;n&&(this.localPlayer.waypointCurrent=0,this.localPlayer.movingStep=0,this.localPlayer.currentX=this.localPlayer.waypointsX[0]=s,this.localPlayer.currentY=this.localPlayer.waypointsY[0]=o),this.playerCount=0,this.localPlayer=this.createPlayer(this.localPlayerServerIndex,s,o,r);const h=Ud.getBitMask(t,i,8);i+=8;for(let u=0;u<h;u++){const e=this.knownPlayers[u+1],r=Ud.getBitMask(t,i,1);if(i++,0!==r){const r=Ud.getBitMask(t,i,1);if(i++,0===r){const r=Ud.getBitMask(t,i,3);i+=3;let n=e.waypointCurrent,s=e.waypointsX[n],o=e.waypointsY[n];2!==r&&1!==r&&3!==r||(s+=this.magicLoc),6!==r&&5!==r&&7!==r||(s-=this.magicLoc),4!==r&&3!==r&&5!==r||(o+=this.magicLoc),0!==r&&1!==r&&7!==r||(o-=this.magicLoc),e.animationNext=r,e.waypointCurrent=n=(n+1)%10,e.waypointsX[n]=s,e.waypointsY[n]=o}else{if(12==(12&Ud.getBitMask(t,i,4))){i+=2;continue}e.animationNext=Ud.getBitMask(t,i,4),i+=4}}this.players[this.playerCount++]=e}let a=0;for(;i+24<8*e;){const e=Ud.getBitMask(t,i,11);i+=11;let r=Ud.getBitMask(t,i,5);i+=5,r>15&&(r-=32);let n=Ud.getBitMask(t,i,5);i+=5,n>15&&(n-=32);const s=Ud.getBitMask(t,i,4);i+=4;const o=Ud.getBitMask(t,i,1);i++;const h=(this.localRegionX+r)*this.magicLoc+64,u=(this.localRegionY+n)*this.magicLoc+64;this.createPlayer(e,h,u,s),0===o&&(this.playerServerIndexes[a++]=e)}if(a>0){this.packetStream.newPacket(Bp.KNOWN_PLAYERS),this.packetStream.putShort(a);for(let t=0;t<a;t++){const e=this.playerServer[this.playerServerIndexes[t]];this.packetStream.putShort(e.serverIndex),this.packetStream.putShort(e.serverId)}this.packetStream.sendPacket(),a=0}}}})),f=t((function(t,e){t.exports={[Jm.REGION_PLAYER_UPDATE]:function(t){const e=Ud.getUnsignedShort(t,1);let i=3;for(let r=0;r<e;r++){const e=Ud.getUnsignedShort(t,i);i+=2;const r=this.playerServer[e],n=t[i++];if(0===n){const e=Ud.getUnsignedShort(t,i);i+=2,null!==r&&(r.bubbleTimeout=150,r.bubbleItem=e)}else if(1===n){const e=t[i];if(i++,null!==r){let n=Fm.descramble(t,i,e);this.options.wordFilter&&(n=wm.filter(n));let s=!1;for(let t=0;t<this.ignoreListCount;t++)if(this.ignoreList[t]===r.hash){s=!0;break}s||(r.messageTimeout=150,r.message=n,this.showMessage(`${r.name}: ${r.message}`,2))}i+=e}else if(2===n){const e=Ud.getUnsignedByte(t[i++]),n=Ud.getUnsignedByte(t[i++]),s=Ud.getUnsignedByte(t[i++]);null!==r&&(r.damageTaken=e,r.healthCurrent=n,r.healthMax=s,r.combatTimer=200,r===this.localPlayer&&(this.playerStatCurrent[3]=n,this.playerStatBase[3]=s,this.showDialogWelcome=!1,this.showDialogServerMessage=!1))}else if(3===n){const e=Ud.getUnsignedShort(t,i);i+=2;const n=Ud.getUnsignedShort(t,i);i+=2,null!==r&&(r.incomingProjectileSprite=e,r.attackingNpcServerIndex=n,r.attackingPlayerServerIndex=-1,r.projectileRange=this.projectileMaxRange)}else if(4===n){const e=Ud.getUnsignedShort(t,i);i+=2;const n=Ud.getUnsignedShort(t,i);i+=2,null!==r&&(r.incomingProjectileSprite=e,r.attackingPlayerServerIndex=n,r.attackingNpcServerIndex=-1,r.projectileRange=this.projectileMaxRange)}else if(5===n)if(null!==r){r.serverId=Ud.getUnsignedShort(t,i),i+=2,r.hash=Ud.getUnsignedLong(t,i),i+=8,r.name=Ud.hashToUsername(r.hash);const e=Ud.getUnsignedByte(t[i]);i++;for(let n=0;n<e;n++)r.equippedItem[n]=Ud.getUnsignedByte(t[i]),i++;for(let t=e;t<12;t++)r.equippedItem[t]=0;r.colourHair=255&t[i++],r.colourTop=255&t[i++],r.colourBottom=255&t[i++],r.colourSkin=255&t[i++],r.level=255&t[i++],r.skullVisible=255&t[i++]}else i+=14,i+=Ud.getUnsignedByte(t[i])+1;else if(6===n){const e=t[i++];if(null!==r){const n=Fm.descramble(t,i,e);r.messageTimeout=150,r.message=n,r===this.localPlayer&&this.showMessage(`${r.name}: ${r.message}`,5)}i+=e}}}}})),d=t((function(t,e){t.exports={[Jm.REGION_OBJECTS]:function(t,e){for(let i=1;i<e;)if(255===Ud.getUnsignedByte(t[i])){let e=0;const r=this.localRegionX+t[i+1]>>3,n=this.localRegionY+t[i+2]>>3;i+=3;for(let t=0;t<this.objectCount;t++){const i=(this.objectX[t]>>3)-r,s=(this.objectY[t]>>3)-n;0!==i||0!==s?(t!==e&&(this.objectModel[e]=this.objectModel[t],this.objectModel[e].key=e,this.objectX[e]=this.objectX[t],this.objectY[e]=this.objectY[t],this.objectId[e]=this.objectId[t],this.objectDirection[e]=this.objectDirection[t]),e++):(this.scene.removeModel(this.objectModel[t]),this.world.removeObject(this.objectX[t],this.objectY[t],this.objectId[t]))}this.objectCount=e}else{const e=Ud.getUnsignedShort(t,i);i+=2;const r=this.localRegionX+t[i++],n=this.localRegionY+t[i++];let s=0;for(let t=0;t<this.objectCount;t++)this.objectX[t]!==r||this.objectY[t]!==n?(t!==s&&(this.objectModel[s]=this.objectModel[t],this.objectModel[s].key=s,this.objectX[s]=this.objectX[t],this.objectY[s]=this.objectY[t],this.objectId[s]=this.objectId[t],this.objectDirection[s]=this.objectDirection[t]),s++):(this.scene.removeModel(this.objectModel[t]),this.world.removeObject(this.objectX[t],this.objectY[t],this.objectId[t]));if(this.objectCount=s,6e4!==e){const t=this.world.getTileDirection(r,n);let i=0,s=0;0===t||4===t?(i=Np.objectWidth[e],s=Np.objectHeight[e]):(s=Np.objectWidth[e],i=Np.objectHeight[e]);const o=(r+r+i)*this.magicLoc/2|0,h=(n+n+s)*this.magicLoc/2|0,a=Np.objectModelIndex[e],u=this.gameModels[a].copy();this.scene.addModel(u),u.key=this.objectCount,u.rotate(0,32*t,0),u.translate(o,-this.world.getElevation(o,h),h),u._setLight_from6(!0,48,48,-50,-10,-50),this.world.removeObject2(r,n,e),74===e&&u.translate(0,-480,0),this.objectX[this.objectCount]=r,this.objectY[this.objectCount]=n,this.objectId[this.objectCount]=e,this.objectDirection[this.objectCount]=t,this.objectModel[this.objectCount++]=u}}}}})),p=t((function(t,e){t.exports={[Jm.REGION_NPCS]:function(t,e){this.npcCacheCount=this.npcCount,this.npcCount=0;for(let n=0;n<this.npcCacheCount;n++)this.npcsCache[n]=this.npcs[n];let i=8;const r=Ud.getBitMask(t,i,8);i+=8;for(let n=0;n<r;n++){const e=this.npcsCache[n],r=Ud.getBitMask(t,i,1);if(i++,0!==r){const r=Ud.getBitMask(t,i,1);if(i++,0===r){const r=Ud.getBitMask(t,i,3);i+=3;let n=e.waypointCurrent,s=e.waypointsX[n],o=e.waypointsY[n];2!==r&&1!==r&&3!==r||(s+=this.magicLoc),6!==r&&5!==r&&7!==r||(s-=this.magicLoc),4!==r&&3!==r&&5!==r||(o+=this.magicLoc),0!==r&&1!==r&&7!==r||(o-=this.magicLoc),e.animationNext=r,e.waypointCurrent=n=(n+1)%10,e.waypointsX[n]=s,e.waypointsY[n]=o}else{if(12==(12&Ud.getBitMask(t,i,4))){i+=2;continue}e.animationNext=Ud.getBitMask(t,i,4),i+=4}}this.npcs[this.npcCount++]=e}for(;i+34<8*e;){const e=Ud.getBitMask(t,i,12);i+=12;let r=Ud.getBitMask(t,i,5);i+=5,r>15&&(r-=32);let n=Ud.getBitMask(t,i,5);i+=5,n>15&&(n-=32);const s=Ud.getBitMask(t,i,4);i+=4;const o=(this.localRegionX+r)*this.magicLoc+64,h=(this.localRegionY+n)*this.magicLoc+64;let a=Ud.getBitMask(t,i,10);i+=10,a>=Np.npcCount&&(a=24),this.addNpc(e,o,h,s,a)}}}})),m=t((function(t,e){t.exports={[Jm.REGION_NPC_UPDATE]:function(t){const e=Ud.getUnsignedShort(t,1);let i=3;for(let r=0;r<e;r++){const e=Ud.getUnsignedShort(t,i);i+=2;const r=this.npcsServer[e],n=Ud.getUnsignedByte(t[i++]);if(1===n){const e=Ud.getUnsignedShort(t,i);i+=2;const n=t[i++];if(null!==r){const s=Fm.descramble(t,i,n);r.messageTimeout=150,r.message=s,e===this.localPlayer.serverIndex&&this.showMessage(`@yel@${Np.npcName[r.npcId]}: `+r.message,5)}i+=n}else if(2===n){const e=Ud.getUnsignedByte(t[i++]),n=Ud.getUnsignedByte(t[i++]),s=Ud.getUnsignedByte(t[i++]);null!==r&&(r.damageTaken=e,r.healthCurrent=n,r.healthMax=s,r.combatTimer=200)}}}}})),g=t((function(t,e){t.exports={[Jm.REGION_GROUND_ITEMS]:function(t,e){for(let i=1;i<e;)if(255===Ud.getUnsignedByte(t[i])){let e=0;const r=this.localRegionX+t[i+1]>>3,n=this.localRegionY+t[i+2]>>3;i+=3;for(let t=0;t<this.groundItemCount;t++){const i=(this.groundItemX[t]>>3)-r,s=(this.groundItemY[t]>>3)-n;0===i&&0===s||(t!==e&&(this.groundItemX[e]=this.groundItemX[t],this.groundItemY[e]=this.groundItemY[t],this.groundItemID[e]=this.groundItemID[t],this.groundItemZ[e]=this.groundItemZ[t]),e++)}this.groundItemCount=e}else{let e=Ud.getUnsignedShort(t,i);i+=2;const r=this.localRegionX+t[i++],n=this.localRegionY+t[i++];if(0==(32768&e)){this.groundItemX[this.groundItemCount]=r,this.groundItemY[this.groundItemCount]=n,this.groundItemID[this.groundItemCount]=e,this.groundItemZ[this.groundItemCount]=0;for(let t=0;t<this.objectCount;t++)if(this.objectX[t]===r&&this.objectY[t]===n){this.groundItemZ[this.groundItemCount]=Np.objectElevation[this.objectId[t]];break}this.groundItemCount++}else{e&=32767;let t=0;for(let i=0;i<this.groundItemCount;i++)this.groundItemX[i]!==r||this.groundItemY[i]!==n||this.groundItemID[i]!==e?(i!==t&&(this.groundItemX[t]=this.groundItemX[i],this.groundItemY[t]=this.groundItemY[i],this.groundItemID[t]=this.groundItemID[i],this.groundItemZ[t]=this.groundItemZ[i]),t++):e=-123;this.groundItemCount=t}}}}})),y=t((function(t,e){t.exports={[Jm.REGION_ENTITY_UPDATE]:function(t,e){const i=(e-1)/4|0;for(let r=0;r<i;r++){const e=this.localRegionX+Ud.getSignedShort(t,1+4*r)>>3,i=this.localRegionY+Ud.getSignedShort(t,3+4*r)>>3;let n=0;for(let t=0;t<this.groundItemCount;t++){const r=(this.groundItemX[t]>>3)-e,s=(this.groundItemY[t]>>3)-i;0===r&&0===s||(t!==n&&(this.groundItemX[n]=this.groundItemX[t],this.groundItemY[n]=this.groundItemY[t],this.groundItemID[n]=this.groundItemID[t],this.groundItemZ[n]=this.groundItemZ[t]),n++)}this.groundItemCount=n,n=0;for(let t=0;t<this.objectCount;t++){const r=(this.objectX[t]>>3)-e,s=(this.objectY[t]>>3)-i;0!==r||0!==s?(t!==n&&(this.objectModel[n]=this.objectModel[t],this.objectModel[n].key=n,this.objectX[n]=this.objectX[t],this.objectY[n]=this.objectY[t],this.objectId[n]=this.objectId[t],this.objectDirection[n]=this.objectDirection[t]),n++):(this.scene.removeModel(this.objectModel[t]),this.world.removeObject(this.objectX[t],this.objectY[t],this.objectId[t]))}this.objectCount=n,n=0;for(let t=0;t<this.wallObjectCount;t++){const r=(this.wallObjectX[t]>>3)-e,s=(this.wallObjectY[t]>>3)-i;0!==r||0!==s?(t!==n&&(this.wallObjectModel[n]=this.wallObjectModel[t],this.wallObjectModel[n].key=n+1e4,this.wallObjectX[n]=this.wallObjectX[t],this.wallObjectY[n]=this.wallObjectY[t],this.wallObjectDirection[n]=this.wallObjectDirection[t],this.wallObjectId[n]=this.wallObjectId[t]),n++):(this.scene.removeModel(this.wallObjectModel[t]),this.world.removeWallObject(this.wallObjectX[t],this.wallObjectY[t],this.wallObjectDirection[t],this.wallObjectId[t]))}this.wallObjectCount=n}}}})),b=t((function(t,e){t.exports={[Jm.PRAYER_STATUS]:function(t,e){for(let i=0;i<e-1;i++){const e=1===t[i+1];!this.prayerOn[i]&&e&&this.playSoundFile("prayeron"),this.prayerOn[i]&&!e&&this.playSoundFile("prayeroff"),this.prayerOn[i]=e}}}})),w=t((function(t,e){t.exports={[Jm.PLAYER_STAT_LIST]:function(t){let e=1;for(let i=0;i<this.playerStatCurrent.length;i++)this.playerStatCurrent[i]=Ud.getUnsignedByte(t[e++]);for(let i=0;i<this.playerStatBase.length;i++)this.playerStatBase[i]=Ud.getUnsignedByte(t[e++]);for(let i=0;i<this.playerExperience.length;i++)this.playerExperience[i]=Ud.getUnsignedInt(t,e),e+=4;this.playerQuestPoints=Ud.getUnsignedByte(t[e++])},[Jm.PLAYER_STAT_EQUIPMENT_BONUS]:function(t){for(let e=0;e<this.playerStatEquipment.length;e++)this.playerStatEquipment[e]=Ud.getUnsignedByte(t[1+e])},[Jm.PLAYER_STAT_EXPERIENCE_UPDATE]:function(t){const e=255&t[1];this.playerExperience[e]=Ud.getUnsignedInt(t,2)},[Jm.PLAYER_STAT_UPDATE]:function(t){let e=1;const i=255&t[e++];this.playerStatCurrent[i]=Ud.getUnsignedByte(t[e++]),this.playerStatBase[i]=Ud.getUnsignedByte(t[e++]),this.playerExperience[i]=Ud.getUnsignedInt(t,e),e+=4},[Jm.PLAYER_STAT_FATIGUE]:function(t){this.statFatigue=Ud.getUnsignedShort(t,1)},[Jm.PLAYER_QUEST_LIST]:function(t){for(let e=0;e<this.questComplete.length;e++)this.questComplete[e]=!!t[e+1]}}})),v=t((function(t,e){t.exports={[Jm.OPTION_LIST]:function(t){this.showOptionMenu=!0;const e=Ud.getUnsignedByte(t[1]);this.optionMenuCount=e;let i=2;for(let n=0;n<e;n++){const e=Ud.getUnsignedByte(t[i++]);this.optionMenuEntry[n]=(r=t.slice(i,i+e),Array.from(r).map(t=>String.fromCharCode(t)).join("")),i+=e}var r},[Jm.OPTION_LIST_CLOSE]:function(){this.showOptionMenu=!1}}})),M=t((function(t,e){function i(t){return Array.from(t).map(t=>String.fromCharCode(t)).join("")}t.exports={[Jm.MESSAGE]:function(t,e){const r=i(t.slice(1,e));this.showServerMessage(r)},[Jm.SERVER_MESSAGE]:function(t,e){this.serverMessage=i(t.slice(1,e)),this.showDialogServerMessage=!0,this.serverMessageBoxTop=!1},[Jm.SERVER_MESSAGE_ONTOP]:function(t,e){this.serverMessage=i(t.slice(1,e)),this.showDialogServerMessage=!0,this.serverMessageBoxTop=!0},[Jm.WELCOME]:function(t){this.welcomScreenAlreadyShown||(this.welcomeLastLoggedInIP=Ud.getUnsignedInt(t,1),this.welcomeLastLoggedInDays=Ud.getUnsignedShort(t,5),this.welcomeRecoverySetDays=255&t[7],this.welcomeUnreadMessages=Ud.getUnsignedShort(t,8),this.showDialogWelcome=!0,this.welcomScreenAlreadyShown=!0,this.welcomeLastLoggedInHost=null)},[Jm.SYSTEM_UPDATE]:function(t){this.systemUpdate=32*Ud.getUnsignedShort(t,1)}}})),S=t((function(t,e){t.exports={[Jm.LOGOUT_DENY]:function(){this.cantLogout()}}})),_=t((function(t,e){t.exports={[Jm.INVENTORY_ITEMS]:function(t){let e=1;this.inventoryItemsCount=255&t[e++];for(let i=0;i<this.inventoryItemsCount;i++){const r=Ud.getUnsignedShort(t,e);e+=2,this.inventoryItemId[i]=32767&r,this.inventoryEquipped[i]=r/32768|0,0===Np.itemStackable[32767&r]?(this.inventoryItemStackCount[i]=Ud.getStackInt(t,e),this.inventoryItemStackCount[i]>=128?e+=4:e++):this.inventoryItemStackCount[i]=1}},[Jm.INVENTORY_ITEM_UPDATE]:function(t){let e=1,i=1;const r=255&t[e++],n=Ud.getUnsignedShort(t,e);e+=2,0===Np.itemStackable[32767&n]&&((i=Ud.getStackInt(t,e))>=128?e+=4:e++),this.inventoryItemId[r]=32767&n,this.inventoryEquipped[r]=n/32768|0,this.inventoryItemStackCount[r]=i,r>=this.inventoryItemsCount&&(this.inventoryItemsCount=r+1)},[Jm.INVENTORY_ITEM_REMOVE]:function(t){const e=255&t[1];this.inventoryItemsCount--;for(let i=e;i<this.inventoryItemsCount;i++)this.inventoryItemId[i]=this.inventoryItemId[i+1],this.inventoryItemStackCount[i]=this.inventoryItemStackCount[i+1],this.inventoryEquipped[i]=this.inventoryEquipped[i+1]}}})),I=t((function(t,e){t.exports={[Jm.DUEL_OPEN]:function(t){const e=Ud.getUnsignedShort(t,1);this.playerServer[e]&&(this.duelOpponentName=this.playerServer[e].name),this.showDialogDuel=!0,this.duelOfferItemCount=0,this.duelOfferOpponentItemCount=0,this.duelOfferOpponentAccepted=!1,this.duelOfferAccepted=!1,this.duelSettingsRetreat=!1,this.duelSettingsMagic=!1,this.duelSettingsPrayer=!1,this.duelSettingsWeapons=!1},[Jm.DUEL_CLOSE]:function(){this.showDialogDuel=!1,this.showDialogDuelConfirm=!1},[Jm.DUEL_UPDATE]:function(t){this.duelOfferOpponentItemCount=255&t[1];let e=2;for(let i=0;i<this.duelOfferOpponentItemCount;i++)this.duelOfferOpponentItemId[i]=Ud.getUnsignedShort(t,e),e+=2,this.duelOfferOpponentItemStack[i]=Ud.getUnsignedInt(t,e),e+=4;this.duelOfferOpponentAccepted=!1,this.duelOfferAccepted=!1},[Jm.DUEL_SETTINGS]:function(t){this.duelSettingsRetreat=!!t[1],this.duelSettingsMagic=!!t[2],this.duelSettingsPrayer=!!t[3],this.duelSettingsWeapons=!!t[4],this.duelOfferOpponentAccepted=!1,this.duelOfferAccepted=!1},[Jm.DUEL_OPPONENT_ACCEPTED]:function(t){this.duelOfferOpponentAccepted=!!t[1]},[Jm.DUEL_ACCEPTED]:function(t){this.duelOfferAccepted=!!t[1]},[Jm.DUEL_CONFIRM_OPEN]:function(t){this.showDialogDuelConfirm=!0,this.duelAccepted=!1,this.showDialogDuel=!1;let e=1;this.duelOpponentNameHash=Ud.getUnsignedLong(t,e),e+=8,this.duelOpponentItemsCount=255&t[e++];for(let i=0;i<this.duelOpponentItemsCount;i++)this.duelOpponentItems[i]=Ud.getUnsignedShort(t,e),e+=2,this.duelOpponentItemCount[i]=Ud.getUnsignedInt(t,e),e+=4;this.duelItemsCount=255&t[e++];for(let i=0;i<this.duelItemsCount;i++)this.duelItems[i]=Ud.getUnsignedShort(t,e),e+=2,this.duelItemCount[i]=Ud.getUnsignedInt(t,e),e+=4;this.duelOptionRetreat=255&t[e++],this.duelOptionMagic=255&t[e++],this.duelOptionPrayer=255&t[e++],this.duelOptionWeapons=255&t[e++]}}})),C=t((function(t,e){t.exports={[Jm.PLAYER_DIED]:function(){this.deathScreenTimeout=250}}})),k=t((function(t,e){t.exports={[Jm.CLOSE_CONNECTION]:function(){this.closeConnection()}}})),T=t((function(t,e){t.exports={[Jm.BANK_OPEN]:function(t){this.showDialogBank=!0;let e=1;this.newBankItemCount=255&t[e++],this.bankItemsMax=255&t[e++];for(let i=0;i<this.newBankItemCount;i++)this.newBankItems[i]=Ud.getUnsignedShort(t,e),e+=2,this.newBankItemsCount[i]=Ud.getStackInt(t,e),this.newBankItemsCount[i]>=128?e+=4:e++;this.updateBankItems()},[Jm.BANK_CLOSE]:function(){this.showDialogBank=!1},[Jm.BANK_UPDATE]:function(t){let e=1;const i=255&t[e++],r=Ud.getUnsignedShort(t,e);e+=2;const n=Ud.getStackInt(t,e);if(n>=128?e+=4:e++,0===n){this.newBankItemCount--;for(let t=i;t<this.newBankItemCount;t++)this.newBankItems[t]=this.newBankItems[t+1],this.newBankItemsCount[t]=this.newBankItemsCount[t+1]}else this.newBankItems[i]=r,this.newBankItemsCount[i]=n,i>=this.newBankItemCount&&(this.newBankItemCount=i+1);this.updateBankItems()}}})),A=t((function(t,e){t.exports={[Jm.APPEARANCE]:function(){this.showAppearanceChange=!0}}})),x=t((function(t,e){t.exports=function(t){const e=((i=x({}))._colours=it({}),i["appearance-panel"]=et({}),i["bank-dialog"]=tt({}),i["chat-message-tabs"]=Q({}),i["combat-style"]=J({}),i.index=x({}),i["inventory-tab"]=$({}),i["login-panels"]=K({}),i["logout-dialog"]=G({}),i["magic-tab"]=Z({}),i["minimap-tab"]=V({}),i["mobile-ui"]=z({}),i["option-menu"]=q({}),i["options-tab"]=W({}),i["password-dialog"]=H({}),i["player-info-tab"]=F({}),i["recovery-panel"]=N({}),i["report-dialog"]=X({}),i["server-message-dialog"]=U({}),i["set-active-ui-tab"]=Y({}),i["shop-dialog"]=D({}),i.sleep=j({}),i["social-dialog"]=O({}),i["social-tab"]=P({}),i["trade-confirm-dialog"]=R({}),i["trade-dialog"]=L({}),i["welcome-dialog"]=B({}),i["wilderness-dialog"]=E({}),i);var i;for(const[r,n]of Object.entries(e))if(!/^_|index/.test(r))for(const[e,i]of Object.entries(n))t[e]="function"==typeof i?i.bind(t):i}})),E=t((function(t,e){const i=it({});t.exports={showUiWildWarn:0,drawDialogWildWarn:function(){let t=97;this.surface.drawBox(86,77,340,180,i.black),this.surface.drawBoxEdge(86,77,340,180,i.white),this.surface.drawStringCenter("Warning! Proceed with caution",256,t,4,i.red),t+=26,this.surface.drawStringCenter("If you go much further north you will enter the",256,t,1,i.white),t+=13,this.surface.drawStringCenter("wilderness. This a very dangerous area where",256,t,1,i.white),t+=13,this.surface.drawStringCenter("other players can attack you!",256,t,1,i.white),t+=22,this.surface.drawStringCenter("The further north you go the more dangerous it",256,t,1,i.white),t+=13,this.surface.drawStringCenter("becomes, but the more treasure you will find.",256,t,1,i.white),t+=22,this.surface.drawStringCenter("In the wilderness an indicator at the bottom-right",256,t,1,i.white),t+=13,this.surface.drawStringCenter("of the screen will show the current level of danger",256,t,1,i.white),t+=22;let e=i.white;this.mouseY>t-12&&this.mouseY<=t&&this.mouseX>181&&this.mouseX<331&&(e=i.red),this.surface.drawStringCenter("Click here to close window",256,t,1,e),0!==this.mouseButtonClick&&(this.mouseY>t-12&&this.mouseY<=t&&this.mouseX>181&&this.mouseX<331&&(this.showUiWildWarn=2),(this.mouseX<86||this.mouseX>426||this.mouseY<77||this.mouseY>257)&&(this.showUiWildWarn=2),this.mouseButtonClick=0)}}})),B=t((function(t,e){const i=it({});t.exports={drawDialogWelcome:function(){let t=65;201!==this.welcomeRecoverySetDays&&(t+=60),this.welcomeUnreadMessages>0&&(t+=60),0!==this.welcomeLastLoggedInIP&&(t+=45);let e=167-(t/2|0);this.surface.drawBox(56,167-(t/2|0),400,t,0),this.surface.drawBoxEdge(56,167-(t/2|0),400,t,i.white),e+=20,this.surface.drawStringCenter("Welcome to RuneScape "+this.loginUser,256,e,4,i.yellow),e+=30;let r=null;if(r=0===this.welcomeLastLoggedInDays?"earlier today":1===this.welcomeLastLoggedInDays?"yesterday":this.welcomeLastLoggedInDays+" days ago",0!==this.welcomeLastLoggedInIP&&(this.surface.drawStringCenter("You last logged in "+r,256,e,1,i.white),e+=15,null===this.welcomeLastLoggedInHost&&(this.welcomeLastLoggedInHost=this.getHostnameIP(this.welcomeLastLoggedInIP)),this.surface.drawStringCenter("from: "+this.welcomeLastLoggedInHost,256,e,1,i.white),e+=15,e+=15),this.welcomeUnreadMessages>0){const t=i.white;this.surface.drawStringCenter("Jagex staff will NEVER email you. We use the",256,e,1,t),e+=15,this.surface.drawStringCenter("message-centre on this website instead.",256,e,1,t),e+=15,1===this.welcomeUnreadMessages?this.surface.drawStringCenter("You have @yel@0@whi@ unread messages in your message-centre",256,e,1,i.white):this.surface.drawStringCenter("You have @gre@"+(this.welcomeUnreadMessages-1)+" unread messages @whi@in your message-centre",256,e,1,i.white),e+=15,e+=15}if(201!==this.welcomeRecoverySetDays){if(200===this.welcomeRecoverySetDays)this.surface.drawStringCenter("You have not yet set any password recovery questions.",256,e,1,i.orange),e+=15,this.surface.drawStringCenter("We strongly recommend you do so now to secure your account.",256,e,1,i.orange),e+=15,this.surface.drawStringCenter("Do this from the 'account management' area on our front webpage",256,e,1,i.orange),e+=15;else{let t=null;t=0===this.welcomeRecoverySetDays?"Earlier today":1===this.welcomeRecoverySetDays?"Yesterday":this.welcomeRecoverySetDays+" days ago",this.surface.drawStringCenter(t+" you changed your recovery questions",256,e,1,i.orange),e+=15,this.surface.drawStringCenter("If you do not remember making this change then cancel it immediately",256,e,1,i.orange),e+=15,this.surface.drawStringCenter("Do this from the 'account management' area on our front webpage",256,e,1,i.orange),e+=15}e+=15}let n=i.white;this.mouseY>e-12&&this.mouseY<=e&&this.mouseX>106&&this.mouseX<406&&(n=i.red),this.surface.drawStringCenter("Click here to close window",256,e,1,n),1===this.mouseButtonClick&&(n===i.red&&(this.showDialogWelcome=!1),(this.mouseX<86||this.mouseX>426)&&(this.mouseY<167-(t/2|0)||this.mouseY>167+(t/2|0))&&(this.showDialogWelcome=!1)),this.mouseButtonClick=0},showDialogWelcome:!1}})),L=t((function(t,e){const i=it({});t.exports={drawDialogTrade:function(){if(0!==this.mouseButtonClick&&0===this.mouseButtonItemCountIncrement&&(this.mouseButtonItemCountIncrement=1),this.mouseButtonItemCountIncrement>0){const t=this.mouseX-22,e=this.mouseY-36;if(t>=0&&e>=0&&t<468&&e<262){if(t>216&&e>30&&t<462&&e<235){const i=((t-217)/49|0)+5*((e-31)/34|0);if(i>=0&&i<this.inventoryItemsCount){let t=!1,e=0;const r=this.inventoryItemId[i];for(let n=0;n<this.tradeItemsCount;n++)if(this.tradeItems[n]===r)if(0===Np.itemStackable[r])for(let e=0;e<this.mouseButtonItemCountIncrement;e++)this.tradeItemCount[n]<this.inventoryItemStackCount[i]&&this.tradeItemCount[n]++,t=!0;else e++;if(this.getInventoryCount(r)<=e&&(t=!0),1===Np.itemSpecial[r]&&(this.showMessage("This object cannot be traded with other players",3),t=!0),!t&&this.tradeItemsCount<12&&(this.tradeItems[this.tradeItemsCount]=r,this.tradeItemCount[this.tradeItemsCount]=1,this.tradeItemsCount++,t=!0),t){this.packetStream.newPacket(Bp.TRADE_ITEM_UPDATE),this.packetStream.putByte(this.tradeItemsCount);for(let t=0;t<this.tradeItemsCount;t++)this.packetStream.putShort(this.tradeItems[t]),this.packetStream.putInt(this.tradeItemCount[t]);this.packetStream.sendPacket(),this.tradeRecipientAccepted=!1,this.tradeAccepted=!1}}}if(t>8&&e>30&&t<205&&e<133){const i=((t-9)/49|0)+4*((e-31)/34|0);if(i>=0&&i<this.tradeItemsCount){const t=this.tradeItems[i];for(let e=0;e<this.mouseButtonItemCountIncrement;e++){if(!(0===Np.itemStackable[t]&&this.tradeItemCount[i]>1)){this.tradeItemsCount--,this.mouseButtonDownTime=0;for(let t=i;t<this.tradeItemsCount;t++)this.tradeItems[t]=this.tradeItems[t+1],this.tradeItemCount[t]=this.tradeItemCount[t+1];break}this.tradeItemCount[i]--}this.packetStream.newPacket(Bp.TRADE_ITEM_UPDATE),this.packetStream.putByte(this.tradeItemsCount);for(let e=0;e<this.tradeItemsCount;e++)this.packetStream.putShort(this.tradeItems[e]),this.packetStream.putInt(this.tradeItemCount[e]);this.packetStream.sendPacket(),this.tradeRecipientAccepted=!1,this.tradeAccepted=!1}}t>=217&&e>=238&&t<=286&&e<=259&&(this.tradeAccepted=!0,this.packetStream.newPacket(Bp.TRADE_ACCEPT),this.packetStream.sendPacket()),t>=394&&e>=238&&t<463&&e<259&&(this.showDialogTrade=!1,this.packetStream.newPacket(Bp.TRADE_DECLINE),this.packetStream.sendPacket())}else 0!==this.mouseButtonClick&&(this.showDialogTrade=!1,this.packetStream.newPacket(Bp.TRADE_DECLINE),this.packetStream.sendPacket());this.mouseButtonClick=0,this.mouseButtonItemCountIncrement=0}if(this.showDialogTrade){this.surface.drawBox(22,36,468,12,192),this.surface.drawBoxAlpha(22,48,468,18,i.grey,160),this.surface.drawBoxAlpha(22,66,8,248,i.grey,160),this.surface.drawBoxAlpha(227,66,11,248,i.grey,160),this.surface.drawBoxAlpha(484,66,6,248,i.grey,160),this.surface.drawBoxAlpha(30,169,197,22,i.grey,160),this.surface.drawBoxAlpha(30,294,197,20,i.grey,160),this.surface.drawBoxAlpha(238,271,246,43,i.grey,160),this.surface.drawBoxAlpha(30,66,197,103,i.lightGrey2,160),this.surface.drawBoxAlpha(30,191,197,103,i.lightGrey2,160),this.surface.drawBoxAlpha(238,66,246,205,i.lightGrey2,160);for(let t=0;t<4;t++)this.surface.drawLineHoriz(30,66+34*t,197,i.black);for(let t=0;t<4;t++)this.surface.drawLineHoriz(30,191+34*t,197,i.black);for(let t=0;t<7;t++)this.surface.drawLineHoriz(238,66+34*t,246,i.black);for(let t=0;t<6;t++)t<5&&(this.surface.drawLineVert(30+49*t,66,103,i.black),this.surface.drawLineVert(30+49*t,191,103,i.black)),this.surface.drawLineVert(238+49*t,66,205,i.black);this.surface.drawString("Trading with: "+this.tradeRecipientName,23,46,1,i.white),this.surface.drawString("Your Offer",31,63,4,i.white),this.surface.drawString("Opponent's Offer",31,188,4,i.white),this.surface.drawString("Your Inventory",238,63,4,i.white),this.tradeAccepted||this.surface._drawSprite_from3(239,274,this.spriteMedia+25),this.surface._drawSprite_from3(416,274,this.spriteMedia+26),this.tradeRecipientAccepted&&(this.surface.drawStringCenter("Other player",363,282,1,i.white),this.surface.drawStringCenter("has accepted",363,292,1,i.white)),this.tradeAccepted&&(this.surface.drawStringCenter("Waiting for",274,282,1,i.white),this.surface.drawStringCenter("other player",274,292,1,i.white));for(let t=0;t<this.inventoryItemsCount;t++){const e=239+t%5*49,r=67+34*(t/5|0);this.surface._spriteClipping_from9(e,r,48,32,this.spriteItem+Np.itemPicture[this.inventoryItemId[t]],Np.itemMask[this.inventoryItemId[t]],0,0,!1),0===Np.itemStackable[this.inventoryItemId[t]]&&this.surface.drawString(this.inventoryItemStackCount[t].toString(),e+1,r+10,1,i.yellow)}for(let t=0;t<this.tradeItemsCount;t++){const e=31+t%4*49,r=67+34*(t/4|0);this.surface._spriteClipping_from9(e,r,48,32,this.spriteItem+Np.itemPicture[this.tradeItems[t]],Np.itemMask[this.tradeItems[t]],0,0,!1),0===Np.itemStackable[this.tradeItems[t]]&&this.surface.drawString(this.tradeItemCount[t].toString(),e+1,r+10,1,i.yellow),this.mouseX>e&&this.mouseX<e+48&&this.mouseY>r&&this.mouseY<r+32&&this.surface.drawString(Np.itemName[this.tradeItems[t]]+": @whi@"+Np.itemDescription[this.tradeItems[t]],30,309,1,i.yellow)}for(let t=0;t<this.tradeRecipientItemsCount;t++){const e=31+t%4*49,r=192+34*(t/4|0);this.surface._spriteClipping_from9(e,r,48,32,this.spriteItem+Np.itemPicture[this.tradeRecipientItems[t]],Np.itemMask[this.tradeRecipientItems[t]],0,0,!1),0===Np.itemStackable[this.tradeRecipientItems[t]]&&this.surface.drawString(this.tradeRecipientItemCount[t].toString(),e+1,r+10,1,i.yellow),this.mouseX>e&&this.mouseX<e+48&&this.mouseY>r&&this.mouseY<r+32&&this.surface.drawString(Np.itemName[this.tradeRecipientItems[t]]+": @whi@"+Np.itemDescription[this.tradeRecipientItems[t]],30,309,1,i.yellow)}}},showDialogTrade:!1}})),R=t((function(t,e){const i=it({});t.exports={drawDialogTradeConfirm:function(){this.surface.drawBox(22,36,468,16,192),this.surface.drawBoxAlpha(22,52,468,246,i.grey,160),this.surface.drawStringCenter("Please confirm your trade with @yel@"+Ud.hashToUsername(this.tradeRecipientConfirmHash),256,48,1,i.white),this.surface.drawStringCenter("You are about to give:",139,66,1,i.yellow);for(let t=0;t<this.tradeConfirmItemsCount;t++){let e=Np.itemName[this.tradeConfirmItems[t]];0===Np.itemStackable[this.tradeConfirmItems[t]]&&(e+=" x "+Ud.formatConfirmAmount(this.tradeConfirmItemCount[t])),this.surface.drawStringCenter(e,139,78+12*t,1,i.white)}0===this.tradeConfirmItemsCount&&this.surface.drawStringCenter("Nothing!",139,78,1,i.white),this.surface.drawStringCenter("In return you will receive:",373,66,1,i.yellow);for(let t=0;t<this.tradeRecipientConfirmItemsCount;t++){let e=Np.itemName[this.tradeRecipientConfirmItems[t]];0===Np.itemStackable[this.tradeRecipientConfirmItems[t]]&&(e+=" x "+Ud.formatConfirmAmount(this.tradeRecipientConfirmItemCount[t])),this.surface.drawStringCenter(e,373,78+12*t,1,i.white)}0===this.tradeRecipientConfirmItemsCount&&this.surface.drawStringCenter("Nothing!",373,78,1,i.white),this.surface.drawStringCenter("Are you sure you want to do this?",256,236,4,i.cyan),this.surface.drawStringCenter("There is NO WAY to reverse a trade if you change your mind.",256,251,1,i.white),this.surface.drawStringCenter("Remember that not all players are trustworthy",256,266,1,i.white),this.tradeConfirmAccepted?this.surface.drawStringCenter("Waiting for other player...",256,286,1,i.yellow):(this.surface._drawSprite_from3(105,274,this.spriteMedia+25),this.surface._drawSprite_from3(339,274,this.spriteMedia+26)),1===this.mouseButtonClick&&((this.mouseX<22||this.mouseY<36||this.mouseX>490||this.mouseY>298)&&(this.showDialogTradeConfirm=!1,this.packetStream.newPacket(Bp.TRADE_DECLINE),this.packetStream.sendPacket()),this.mouseX>=105&&this.mouseX<=210&&this.mouseY>=274&&this.mouseY<=295&&(this.tradeConfirmAccepted=!0,this.packetStream.newPacket(Bp.TRADE_CONFIRM_ACCEPT),this.packetStream.sendPacket()),this.mouseX>=339&&this.mouseX<=445&&this.mouseY>=274&&this.mouseY<=295&&(this.showDialogTradeConfirm=!1,this.packetStream.newPacket(Bp.TRADE_DECLINE),this.packetStream.sendPacket()),this.mouseButtonClick=0)},showDialogTradeConfirm:!1}})),P=t((function(t,e){const i=it({}),r=["Friends","Ignore"];t.exports={drawUiTabSocial:function(t){let e=this.gameWidth-196-3,n=36;if(this.options.mobile?(e=35,n=this.gameHeight/2-91):this.surface._drawSprite_from3(this.gameWidth-245-3,3,this.spriteMedia+5),this.uiOpenX=e,this.uiOpenY=n,this.uiOpenWidth=196,this.uiOpenHeight=182,this.surface.drawBoxAlpha(e,n+24,196,158,i.lightGrey,128),this.surface.drawLineHoriz(e,n+182-16,196,i.black),this.surface.drawTabs(e,n,196,24,r,this.uiTabSocialSubTab),this.panelSocialList.clearList(this.controlListSocialPlayers),0===this.uiTabSocialSubTab)for(let i=0;i<this.friendListCount;i++){let t=null;t=255===this.friendListOnline[i]?"@gre@":this.friendListOnline[i]>0?"@yel@":"@red@",this.panelSocialList.addListEntry(this.controlListSocialPlayers,i,`${t}${Ud.hashToUsername(this.friendListHashes[i])}~${e+126}~@whi@Remove`)}else if(1===this.uiTabSocialSubTab)for(let i=0;i<this.ignoreListCount;i++)this.panelSocialList.addListEntry(this.controlListSocialPlayers,i,"@yel@"+Ud.hashToUsername(this.ignoreList[i])+`~${e+126}~@whi@Remove`);this.panelSocialList.drawPanel();const s=this.options.mobile?"Tap":"Click";if(0===this.uiTabSocialSubTab){const t=this.panelSocialList.getListEntryIndex(this.controlListSocialPlayers);if(t>=0&&this.mouseX<e+176){const r=Ud.hashToUsername(this.friendListHashes[t]);this.mouseX>e+116?this.surface.drawStringCenter(`${s} to remove ${r}`,e+98,n+35,1,i.white):255===this.friendListOnline[t]?this.surface.drawStringCenter(`${s} to message ${r}`,e+98,n+35,1,i.white):this.friendListOnline[t]>0?this.friendListOnline[t]<200?this.surface.drawStringCenter(r+" is on world "+(this.friendListOnline[t]-9),e+98,n+35,1,i.white):this.surface.drawStringCenter(r+" is on classic "+(this.friendListOnline[t]-219),e+98,n+35,1,i.white):this.surface.drawStringCenter(r+" is offline",e+98,n+35,1,i.white)}else this.surface.drawStringCenter(s+" a name to send a message",e+98,n+35,1,i.white);let r=i.black;r=this.mouseX>e&&this.mouseX<e+196&&this.mouseY>n+182-16&&this.mouseY<n+182?i.yellow:i.white,this.surface.drawStringCenter(s+" here to add a friend",e+98,n+182-3,1,r)}else if(1===this.uiTabSocialSubTab){const t=this.panelSocialList.getListEntryIndex(this.controlListSocialPlayers);t>=0&&this.mouseX<e+176&&this.mouseX>e+116?this.mouseX>e+116&&this.surface.drawStringCenter(s+" to remove "+Ud.hashToUsername(this.ignoreList[t]),e+98,n+35,1,i.white):this.surface.drawStringCenter("Blocking messages from:",e+98,n+35,1,i.white);let r=i.black;r=this.mouseX>e&&this.mouseX<e+196&&this.mouseY>n+182-16&&this.mouseY<n+182?i.yellow:i.white,this.surface.drawStringCenter(s+" here to add a name",e+98,n+182-3,1,r)}if(!t)return;const o=this.mouseX-e,h=this.mouseY-n;if(o>=0&&h>=0&&o<196&&h<182){if(this.panelSocialList.handleMouse(o+e,h+n,this.lastMouseButtonDown,this.mouseButtonDown,this.mouseScrollDelta),h<=24&&1===this.mouseButtonClick&&(o<98&&1===this.uiTabSocialSubTab?(this.uiTabSocialSubTab=0,this.panelSocialList.resetListProps(this.controlListSocialPlayers)):o>98&&0===this.uiTabSocialSubTab&&(this.uiTabSocialSubTab=1,this.panelSocialList.resetListProps(this.controlListSocialPlayers))),1===this.mouseButtonClick&&0===this.uiTabSocialSubTab){const t=this.panelSocialList.getListEntryIndex(this.controlListSocialPlayers);t>=0&&o<176&&(o>116?this.friendRemove(this.friendListHashes[t]):0!==this.friendListOnline[t]&&(this.showDialogSocialInput=2,this.privateMessageTarget=this.friendListHashes[t],this.inputPMCurrent="",this.inputPMFinal=""))}if(1===this.mouseButtonClick&&1===this.uiTabSocialSubTab){const t=this.panelSocialList.getListEntryIndex(this.controlListSocialPlayers);t>=0&&o<176&&o>116&&this.ignoreRemove(this.ignoreList[t])}h>166&&1===this.mouseButtonClick&&(this.inputTextCurrent="",this.inputTextFinal="",0===this.uiTabSocialSubTab?this.showDialogSocialInput=1:1===this.uiTabSocialSubTab&&(this.showDialogSocialInput=3)),this.mouseButtonClick=0}},uiTabSocialSubTab:0}})),O=t((function(t,e){const i=it({});t.exports={drawDialogSocialInput:function(){if(0!==this.mouseButtonClick){if(this.mouseButtonClick=0,1===this.showDialogSocialInput&&(this.mouseX<106||this.mouseY<145||this.mouseX>406||this.mouseY>215))return void(this.showDialogSocialInput=0);if(2===this.showDialogSocialInput&&(this.mouseX<6||this.mouseY<145||this.mouseX>506||this.mouseY>215))return void(this.showDialogSocialInput=0);if(3===this.showDialogSocialInput&&(this.mouseX<106||this.mouseY<145||this.mouseX>406||this.mouseY>215))return void(this.showDialogSocialInput=0);if(this.mouseX>236&&this.mouseX<276&&this.mouseY>193&&this.mouseY<213)return void(this.showDialogSocialInput=0)}let t=145;if(1===this.showDialogSocialInput){if(this.surface.drawBox(106,t,300,70,0),this.surface.drawBoxEdge(106,t,300,70,i.white),t+=20,this.surface.drawStringCenter("Enter name to add to friends list",256,t,4,i.white),t+=20,this.surface.drawStringCenter(this.inputTextCurrent+"*",256,t,4,i.white),this.inputTextFinal.length>0){const t=this.inputTextFinal.trim(),e=Ud.usernameToHash(t);this.inputTextCurrent="",this.inputTextFinal="",this.showDialogSocialInput=0,t.length>0&&!e.equals(this.localPlayer.hash)&&this.friendAdd(t)}}else if(2===this.showDialogSocialInput){this.surface.drawBox(6,t,500,70,0),this.surface.drawBoxEdge(6,t,500,70,i.white),t+=20;const e=Ud.hashToUsername(this.privateMessageTarget);if(this.surface.drawStringCenter("Enter message to send to "+e,256,t,4,i.white),t+=20,this.surface.drawStringCenter(this.inputPMCurrent+"*",256,t,4,i.white),this.inputPMFinal.length>0){let t=this.inputPMFinal;this.inputPMCurrent="",this.inputPMFinal="",this.showDialogSocialInput=0;const i=Fm.scramble(t);this.sendPrivateMessage(this.privateMessageTarget,Fm.scrambledBytes,i),t=Fm.descramble(Fm.scrambledBytes,0,i),this.options.wordFilter&&(t=wm.filter(t)),this.showServerMessage(`@pri@You tell ${e}: ${t}`)}}else if(3===this.showDialogSocialInput&&(this.surface.drawBox(106,t,300,70,0),this.surface.drawBoxEdge(106,t,300,70,i.white),t+=20,this.surface.drawStringCenter("Enter name to add to ignore list",256,t,4,i.white),t+=20,this.surface.drawStringCenter(this.inputTextCurrent+"*",256,t,4,i.white),this.inputTextFinal.length>0)){const t=this.inputTextFinal.trim(),e=Ud.usernameToHash(t);this.inputTextCurrent="",this.inputTextFinal="",this.showDialogSocialInput=0,t.length>0&&!e.equals(this.localPlayer.hash)&&this.ignoreAdd(t)}let e=i.white;this.mouseX>236&&this.mouseX<276&&this.mouseY>193&&this.mouseY<213&&(e=i.yellow),this.surface.drawStringCenter("Cancel",256,208,1,e)},resetPMText:function(){this.inputPMCurrent="",this.inputPMFinal=""},showDialogSocialInput:0}})),j=t((function(t,e){const i=it({});t.exports={drawSleep:function(){this.surface.fadeToBlack(),Math.random()<=.15&&this.surface.drawStringCenter("ZZZ",80*Math.random()|0,Math.random()*this.gameHeight|0,5,Math.random()*i.white|0),Math.random()<=.15&&this.surface.drawStringCenter("ZZZ",this.gameWidth-(80*Math.random()|0),Math.random()*this.gameHeight|0,5,Math.random()*i.white|0),this.surface.drawBox((this.gameWidth/2|0)-100,160,200,40,i.black),this.surface.drawStringCenter("You are sleeping",this.gameWidth/2|0,50,7,i.yellow),this.surface.drawStringCenter(`Fatigue: ${100*this.fatigueSleeping/750|0}%`,this.gameWidth/2|0,90,7,i.yellow),this.surface.drawStringCenter("When you want to wake up just use your",this.gameWidth/2|0,140,5,i.white),this.surface.drawStringCenter("keyboard to type the word in the box below",this.gameWidth/2|0,160,5,i.white),this.surface.drawStringCenter(this.inputTextCurrent+"*",this.gameWidth/2|0,180,5,i.cyan),null===this.sleepingStatusText?this.surface._drawSprite_from3((this.gameWidth/2|0)-127,230,this.spriteTexture+1):this.surface.drawStringCenter(this.sleepingStatusText,this.gameWidth/2|0,260,5,i.red),this.surface.drawBoxEdge((this.gameWidth/2|0)-128,229,257,42,i.white),this.drawChatMessageTabs(),this.surface.drawStringCenter("If you can't read the word",this.gameWidth/2|0,290,1,i.white),this.surface.drawStringCenter(`@yel@${this.options.mobile?"tap":"click"} here@whi@ to get a different one`,this.gameWidth/2|0,305,1,i.white),this.surface.draw(this.graphics,0,0)},handleSleepInput:function(){this.inputTextFinal.length>0&&(/^::lostcon$/i.test(this.inputTextFinal)?this.packetStream.closeStream():/^::closecon$/.test(this.inputTextFinal)?this.closeConnection():(this.packetStream.newPacket(Bp.SLEEP_WORD),this.packetStream.putString(this.inputTextFinal),this.sleepWordDelay||(this.packetStream.putByte(0),this.sleepWordDelay=!0),this.packetStream.sendPacket(),this.inputTextCurrent="",this.inputTextFinal="",this.sleepingStatusText="Please wait...")),1===this.lastMouseButtonDown&&this.mouseY>275&&this.mouseY<310&&this.mouseX>56&&this.mouseX<456&&(this.packetStream.newPacket(Bp.SLEEP_WORD),this.packetStream.putString("-null-"),this.sleepWordDelay||(this.packetStream.putByte(0),this.sleepWordDelay=!0),this.packetStream.sendPacket(),this.inputTextCurrent="",this.inputTextFinal="",this.sleepingStatusText="Please wait..."),this.lastMouseButtonDown=0},isSleeping:!1}})),D=t((function(t,e){const i=it({});t.exports={drawDialogShop:function(){if(0!==this.mouseButtonClick){this.mouseButtonClick=0;const t=this.mouseX-52,e=this.mouseY-44;if(!(t>=0&&e>=12&&t<408&&e<246))return this.packetStream.newPacket(Bp.SHOP_CLOSE),this.packetStream.sendPacket(),void(this.showDialogShop=!1);{let i=0;for(let r=0;r<5;r++)for(let n=0;n<8;n++){const s=7+49*n,o=28+34*r;t>s&&t<s+49&&e>o&&e<o+34&&-1!==this.shopItem[i]&&(this.shopSelectedItemIndex=i,this.shopSelectedItemType=this.shopItem[i]),i++}if(this.shopSelectedItemIndex>=0){const i=this.shopItem[this.shopSelectedItemIndex];if(-1!==i){if(this.shopItemCount[this.shopSelectedItemIndex]>0&&t>298&&e>=204&&t<408&&e<=215){let t=this.shopBuyPriceMod+this.shopItemPrice[this.shopSelectedItemIndex];t<10&&(t=10);const e=t*Np.itemBasePrice[i]/100|0;this.packetStream.newPacket(Bp.SHOP_BUY),this.packetStream.putShort(this.shopItem[this.shopSelectedItemIndex]),this.packetStream.putInt(e),this.packetStream.sendPacket()}if(this.getInventoryCount(i)>0&&t>2&&e>=229&&t<112&&e<=240){let t=this.shopSellPriceMod+this.shopItemPrice[this.shopSelectedItemIndex];t<10&&(t=10);const e=t*Np.itemBasePrice[i]/100|0;this.packetStream.newPacket(Bp.SHOP_SELL),this.packetStream.putShort(this.shopItem[this.shopSelectedItemIndex]),this.packetStream.putInt(e),this.packetStream.sendPacket()}}}}}this.surface.drawBox(52,44,408,12,192),this.surface.drawBoxAlpha(52,56,408,17,i.grey,160),this.surface.drawBoxAlpha(52,73,8,170,i.grey,160),this.surface.drawBoxAlpha(451,73,9,170,i.grey,160),this.surface.drawBoxAlpha(52,243,408,47,i.grey,160),this.surface.drawString("Buying and selling items",53,54,1,i.white);let t=i.white;this.mouseX>372&&this.mouseY>=44&&this.mouseX<460&&this.mouseY<56&&(t=i.red),this.surface.drawStringRight("Close window",458,54,1,t),this.surface.drawString("Shops stock in green",54,68,1,i.green),this.surface.drawString("Number you own in blue",187,68,1,i.cyan),this.surface.drawString(`Your money: ${this.getInventoryCount(10)}gp`,332,68,1,i.yellow);let e=0;for(let n=0;n<5;n++)for(let t=0;t<8;t++){const r=59+49*t,s=72+34*n;this.shopSelectedItemIndex===e?this.surfac