0xecc60439…2cdbsent to0xa7d8d9ef…d270·#13,206,739·view on Etherscan
const f=4095;const C=t=>.5*(1-Math.cos(t*Math.PI));let E;function r(t,e=0,i=0){if(null==E){E=new Array(1+f);for(let t=0;t<1+f;t++)E[t]=R()}t<0&&(t=-t),e<0&&(e=-e),i<0&&(i=-i);let s=Math.floor(t),h=Math.floor(e),o=Math.floor(i),n=t-s,a=e-h,r=i-o;var l,p;let c=0,d=.5;for(let t=0;t<4;t++){var u=s+(h<<4)+(o<<8),m=C(n),M=C(a),w=E[u&f];w+=m*(E[u+1&f]-w),l=E[u+16&f],w+=M*((l+=m*(E[u+16+1&f]-l))-w),u+=256,l=E[u&f],l+=m*(E[u+1&f]-l),p=E[u+16&f],l+=M*((p+=m*(E[u+16+1&f]-p))-l),w+=C(r)*(l-w),c+=w*d,d*=.5,s<<=1,n*=2,h<<=1,a*=2,o<<=1,r*=2,1<=n&&(s++,n--),1<=a&&(h++,a--),1<=r&&(o++,r--)}return c}const l=function(t,e,i,s,h){return(t-e)/(i-e)*(h-s)+s};function z(t,e){return e?Number(Math.round(t+"e"+e)+"e-"+e):Math.round(t)}const e=[];for(let t=0;t<32;t++)e.push(tokenData.hash.slice(2+2*t,4+2*t));const p=e.map(t=>parseInt(t,16));!function(t){const e=(()=>{const e=4294967296;let i,s;return{setSeed(t){s=i=(null==t?R()*e:t)>>>0},getSeed(){return i},rand(){return s=(1664525*s+1013904223)%e,s/e}}})();e.setSeed(t),E=new Array(1+f);for(let t=0;t<1+f;t++)E[t]=e.rand()}(parseInt(tokenData.hash.slice(2,10),16)),S=Uint32Array.from([0,1,s=t=2,3].map(t=>parseInt(tokenData.hash.substr(8*t+2,8),16))),R=e=>(t=S[3],S[3]=S[2],S[2]=S[1],S[1]=s=S[0],t^=t<<11,S[0]^=t^t>>>8^s>>>19,S[0]/2**32);const y=new THREE.Scene,n=120,k=n/240,b=n/40,W=n/n;let i=window.innerWidth/window.innerHeight,a=!0;const h=1.5*n;var o=Rt(p[1]);let c;c=o<.4?n/4:o<.8?n/8:n/16;let d=c;const u=new THREE.PerspectiveCamera(75,i,.1,7*n),m=new THREE.OrthographicCamera(-d*i,d*i,d,-d,1,3*n);let M=a?m:u;const w="mixed",g=Rt(p[13]),x=[.25,.5,1];let v=[.28,.56,.84,1];g<.6&&(x.push(0),v=[.25,.5,.75,.85,1]);o=[...x,w];function T(t){var e=Object.keys(t);return t[e[e.length*R()<<0]]}function H(t,e){var i=Object.keys(t);return t[i[(i.length-1e-9)*Rt(p[e])<<0]]}function I(t,e,i){var s=Rt(p[t]);for(let t=0;t<e.length;t++)if(s<=e[t])return i[t]}const P=H({BW:[1315860,15987699],REEF:[867683,1938037,2471875,15721901,14897443],BRICK:[5649953,13585211,15515822,10852495,13996659],DOLPHIN:[1126479,3560792,7192023,14213854,16711421],OAXACA:[14964526,1556155,3024938,16438096,7778369],WHO_ATE_THE_CRANS:[16752562,16506082,708095,6335386,10582712],MOSS_AGATE:[16120815,9612692,7637877,13037440,5258562],FIREWATER:[15770114,5775128,15828997,14245177,2108505],BRINKMAN:[15885963,2344921,4774308,15908647,7960952],TOMATO_TOMATO:[7829180,13486053,16776155,16772177,16738125],THE_PINK_ONE:[7816112,6440803,12988005,16364497,14039801],DROPDOWN:[15385653,3430805,14942310,249508,16469309]},0),D=I(10,v,o),B=new THREE.WebGLRenderer({powerPreference:"high-performance",antialias:!0,alpha:!0});let A=!1;const X=new THREE.Color(O());function L(t,e){return R()*(e-t)+t}B.setSize(window.innerWidth,window.innerHeight),B.shadowMap.enabled=!0,B.shadowMap.autoUpdate=!1,B.shadowMap.needsUpdate=!0,B.shadowMap.type=THREE.PCFSoftShadowMap,document.body.appendChild(B.domElement),function(t,i){const e=document.body.querySelectorAll(t);e.forEach(e=>{Object.keys(i).forEach(t=>{e.style[t]=i[t]})})}("canvas",{touchAction:"none",cursor:"pointer","-webkit-tap-highlight-color":"transparent"});const G=[];function O(t,e=D){return!t||R()<e?P[Math.floor(R()*P.length)]:t}class Z{constructor(t,e,i,s,h,o,n,a){this.x=t,this.z=e,this.width=i,this.depth=s,this.boxes=[],this.colorCohesion=D===w?x[Math.floor(R()*x.length)]:D,this.stepBackPercent=R(),this.repeatWidth=h,this.repeatDepth=o,this.numRepeatWidth=n,this.numRepeatDepth=a}display(){this.boxes=this.makeStructure(this.x,this.z,this.width,this.depth,0,null,0,this.repeatWidth,this.repeatDepth,this.numRepeatWidth,this.numRepeatDepth,!1)}makeStructure(h,o,n,a,r,l,p=0,c=[],d=[],u=[],m=[],t){var e=R();let{splitWidthChance:i,splitDepthChance:s,splitRepeatChance:M,splitWhere:w,createLevelChance:f,numRepetitionsX:C,numRepetitionsZ:E}=tt.attributes.buildingSplitChances(h,o,n,a,p);t&&(t=i,y=s,g=M,x={splitWidthChance:t+=(x=t/(t+y))*g,splitDepthChance:y+=(1-x)*g,splitRepeatChance:g=0},i=x.splitWidthChance,s=x.splitDepthChance,M=x.splitRepeatChance);var y=i+s,g=e<=i,x=e<=y&&e>i,y=e<=y+M&&y<e;let b=[];if(g&&n>k){e=this.makeStructure(h,o,n*w,a,r,l,p,c,d,u,m,!1),g=this.makeStructure(h+n*w,o,n*(1-w),a,r,l,p,c,d,u,m,!1);b=[...e,...g]}else if(x&&a>k){var v=this.makeStructure(h,o,n,a*w,r,l,p,c,d,u,m,!1),T=this.makeStructure(h,o+a*w,n,a*(1-w),r,l,p,c,d,u,m,!1);b=[...v,...T]}else if(y&&a>k&&n>k){var H,S=n/C,I=a/E,P=this.makeStructure(h,o,S,I,r,l,p,[...c,S],[...d,I],[...u,C],[...m,E],!0);for(let i=0;i<C;i++)for(let e=0;e<E;e++)for(let t=0;t<P.length;t++)0===i&&0===e||((H=P[t]).width>S&&0<i||H.depth>I&&0<e||(b.push({x:H.x+S*i,y:H.y,z:H.z+I*e,width:H.width,height:H.height,depth:H.depth,color:H.color}),H=new THREE.Color(H.color),G.push(H.r),G.push(H.g),G.push(H.b)));b=[...P,...b]}else{v=tt.attributes.buildingHeightGenerator(h,r,o,n,a,p),T=O(l,this.colorCohesion);let t=n,e=c.length-1;for(;z(t,10)===z(c[e],10);)t*=u[e],e--;let i=a;for(e=d.length-1;z(i,10)===z(d[e],10);)i*=m[e],e--;y={x:h+t/2,y:r+v/2,z:o+i/2,width:t,height:v,depth:i,color:T},l=new THREE.Color(T);G.push(l.r),G.push(l.g),G.push(l.b);let s=[];n>W&&a>W&&R()<=f?R()<this.stepBackPercent||tt.type===Q.MONOLITH&&p<5?(l=Math.min(n,a)/Math.floor(L(10,20)),s=this.makeStructure(h+l,o+l,n-2*l,a-2*l,v+r,T,p+1,c,d,u,m,!1),_(h,r,o,t,i,v,s)):s=this.makeStructure(h,o,n,a,v+r,T,p+1,c,d,u,m,!1):_(h,r,o,t,i,v,s),b=[y,...s]}return b}}function _(t,e,i,s,h,o,n){var a=L(.02,.06);et.weather.snow&&e+o>et.weather.flood.waterDepth&&e+o+a>et.weather.flood.waterDepth+et.weather.flood.snowHeight&&R()<.7&&(n.push({x:t+s/2,y:e+o+a/2,z:i+h/2,width:s,height:a,depth:h,color:15592941}),h=new THREE.Color(15592941),G.push(h.r),G.push(h.g),G.push(h.b))}class Y{constructor(t,e,i,s){this.x=t,this.z=e,this.width=i,this.depth=s,this.boxes=[]}display(){this.splitBlock(this.x,this.z,this.width,this.depth)}splitBlock(t,e,i,s,h=0){var o=R(),{splitWidthChance:n,splitDepthChance:a,splitRepeatChance:r,splitWhere:l,numRepetitionsX:p,numRepetitionsZ:c}=tt.attributes.blockSplitChances(t,e,i,s,h),d=n+a,a=o<=d&&n<o,d=o<=d+r&&d<o;if(o<=n&&i>k)this.splitBlock(t,e,i*l,s,h+1),this.splitBlock(t+i*l,e,i*(1-l),s,h+1);else if(a&&s>k)this.splitBlock(t,e,i,s*l,h+1),this.splitBlock(t,e+s*l,i,s*(1-l),h+1);else if(d&&s>k&&i>k){var u=i/p,m=s/c;const f=new Z(t,e,u,m,[u],[m],[p],[c]);f.display();var M,w=f.boxes;const C=[];for(let i=0;i<p;i++)for(let e=0;e<c;e++)for(let t=0;t<w.length;t++)0===i&&0===e||((M=w[t]).width>u&&0<i||M.depth>m&&0<e||(C.push({x:M.x+u*i,y:M.y,z:M.z+m*e,width:M.width,height:M.height,depth:M.depth,color:M.color}),M=new THREE.Color(M.color),G.push(M.r),G.push(M.g),G.push(M.b)));this.boxes=[...this.boxes,...w,...C]}else{const E=new Z(t,e,i,s);E.display(),this.boxes=[...this.boxes,...E.boxes]}}}class F{constructor(t,e,i,s,h){this.x=t,this.z=e,this.width=i,this.depth=s,this.color=h,this.types={SQUARE:"square",PYRAMID:"pyramid",STAGE:"stage"},this.type=H(this.types,12)}display(){if(this.type===this.types.SQUARE){var t=new THREE.BoxBufferGeometry(this.width,1e3,this.depth),e=new THREE.MeshStandardMaterial({color:this.color});const h=new THREE.Mesh(t,e);h.receiveShadow=!0,h.position.x=this.x+this.width/2,h.position.z=this.z+this.depth/2,h.position.y=-500,y.add(h)}else if(this.type===this.types.PYRAMID){var i=new THREE.ConeGeometry(this.width*Math.sin(Math.PI/4),50,4),s=new THREE.MeshStandardMaterial({color:this.color});const o=new THREE.Mesh(i,s);o.receiveShadow=!0,o.rotation.x=Math.PI,o.rotation.y=Math.PI/4,o.position.x=this.x+this.width/2,o.position.y=-25,o.position.z=this.z+this.depth/2,y.add(o)}else if(this.type===this.types.STAGE){i=this.width*Math.sin(Math.PI/4),s=new THREE.CylinderGeometry(i,.15*i,50,4),i=new THREE.MeshStandardMaterial({color:this.color});const n=new THREE.Mesh(s,i);n.receiveShadow=!0,n.rotation.y=Math.PI/4,n.position.x=this.x+this.width/2,n.position.y=-25,n.position.z=this.z+this.depth/2,y.add(n)}}}class N{constructor(t,e,i,s){this.x=t,this.z=e,this.width=i,this.depth=s,this.boxes=[],this.baseColor=O()}display(){this.subdivideStreets(this.x,this.z,this.width,this.depth);const t=new F(this.x,this.z,this.width,this.depth,this.baseColor);t.display()}subdivideStreets(t,e,i,s,h=0){var o=R(),n=tt.attributes.streetSizeGenerator(h),{splitWidthChance:a,splitDepthChance:r,splitRepeatChance:l,splitChoices:p,numRepetitionsX:c,numRepetitionsZ:d}=tt.attributes.streetGenerationChances(t,e,i,s,h,n),u=a+r,r=o<=a,a=o<=u&&a<o,o=o<=u+l&&u<o,p=p[Math.floor(R()*p.length)];if(r&&i>b){if(0===h&&2<=n){const C=new j(t+i*p,e+s/2,n,s);this.boxes=C.display()}this.subdivideStreets(t,e,i*p-n/2,s,h+1),this.subdivideStreets(t+i*p+n/2,e,i*(1-p)-n/2,s,h+1)}else if(a&&s>b){if(0===h&&2<=n){const E=new j(t+i/2,e+s*p,i,n);this.boxes=E.display()}this.subdivideStreets(t,e,i,s*p-n/2,h+1),this.subdivideStreets(t,e+s*p+n/2,i,s*(1-p)-n/2,h+1)}else if(o&&s>b&&i>b){var m=(i-n*(c-1))/c,M=(s-n*(d-1))/d;const y=new Y(t,e,m,M);y.display();var w,f=y.boxes;const g=[];for(let i=0;i<c;i++)for(let e=0;e<d;e++)for(let t=0;t<f.length;t++)0===i&&0===e||(w=f[t],g.push({x:w.x+(m+n)*i,y:w.y,z:w.z+(M+n)*e,width:w.width,height:w.height,depth:w.depth,color:w.color}),w=new THREE.Color(w.color),G.push(w.r),G.push(w.g),G.push(w.b));this.boxes=[...this.boxes,...f,...g]}else{const x=new Y(t,e,i,s);x.display(),this.boxes=[...this.boxes,...x.boxes]}}}class j{constructor(t,e,i,s){this.x=t,this.z=e,this.color=O(),this.direction=s<i?1:0,this.streetSize=Math.min(.75*Math.min(i,s),4),this.width=this.direction?i:this.streetSize,this.depth=this.direction?this.streetSize:s}display(){if(.5<Rt(p[15]))return[];var t=new THREE.BoxBufferGeometry(this.width,.5,this.depth),e=new THREE.MeshStandardMaterial({color:O(this.color)});const i=new THREE.Mesh(t,e),s=[];_(this.x-this.width/2,1.25,this.z-this.depth/2,this.width,this.depth,.25,s),i.receiveShadow=!0,i.castShadow=!0,i.position.x=this.x,i.position.y=1.25,i.position.z=this.z,y.add(i);var h=Math.max(this.width,this.depth)/12;let o=h;for(;o<=11*h;){var n={x:this.x+(this.direction?o-this.width/2:0),y:.5,z:this.z+(this.direction?0:o-this.depth/2),width:1,height:1,depth:1,color:O(this.color)};s.push(n);n=new THREE.Color(n.color);G.push(n.r),G.push(n.g),G.push(n.b),o+=h}return s}}class U{constructor(t,e,i,s,h,o){this.rainCells=h,this.x=t,this.y=e,this.z=i,this.rainDensity=o,this.rainGeo=new THREE.BufferGeometry,this.particles=[],this.scale=s,this.orthoRainSize=2,this.perspectiveRainSize=.2,this.snowTimeToRepeat=5,this.rainTimeToRepeat=1,this.timeToRepeat=et.weather.snow?this.snowTimeToRepeat:this.rainTimeToRepeat;s=Rt(p[14]);const n=new THREE.Color(et.weather.snow?15592941:s<.1?O():11591423);.1<=s&&n.lerp(new THREE.Color(et.sun.skyColor),.25),this.rainMaterial=new THREE.PointsMaterial({color:n,size:a?this.orthoRainSize:this.perspectiveRainSize,transparent:!0,opacity:et.weather.snow?.8:.4}),this.addParticles(),this.updateGeometry(),this.rain=new THREE.Points(this.rainGeo,this.rainMaterial),y.add(this.rain)}updateSize(){this.rainMaterial.size=a?this.orthoRainSize:this.perspectiveRainSize,this.rainMaterial.needsUpdate=!0}addParticles(){for(let t=0;t<Object.keys(this.rainCells).length*this.rainDensity;t++){var e=T(this.rainCells)["position"],i=e[1]*this.scale+this.y-this.scale/2,s=new THREE.Vector3(e[0]*this.scale+th