|
|
|
@ -149,20 +149,23 @@ class GameMap extends React.Component {
|
|
|
|
|
<h1 id="gameMapTitle">Metaverse Map</h1>
|
|
|
|
|
<div id="gameStats">
|
|
|
|
|
<ul>
|
|
|
|
|
<li><span className="squares" style={{backgroundColor: 'white'}}></span> _ Alive Unaboomers: {this.state.unaboomerSupply - this.state.unaboomersKilled}</li>
|
|
|
|
|
<li><span className="squares" style={{backgroundColor: 'black'}}></span> _ Dead Unaboomers: {this.state.unaboomersKilled}</li>
|
|
|
|
|
<li><span className="dots" style={{backgroundColor: 'yellow'}}></span> _ Active Bombs: {this.state.bombSupply - this.state.bombsExploded}</li>
|
|
|
|
|
<li><span className="dots" style={{backgroundColor: 'cyan'}}></span> _ Exploded Bombs: {this.state.bombsExploded}</li>
|
|
|
|
|
<li><span className="dots" style={{backgroundColor: 'red'}}></span> _ Dud Bombs: {this.state.bombsExploded}</li>
|
|
|
|
|
<li>Active Unaboomers: {this.state.unaboomerSupply - this.state.unaboomersKilled}</li>
|
|
|
|
|
<li>Dead Unaboomers: {this.state.unaboomersKilled}</li>
|
|
|
|
|
<li><p className="dots" style={{backgroundColor: 'white'}}></p> _ Active Bombs: {this.state.bombSupply - this.state.bombsExploded}</li>
|
|
|
|
|
<li><p className="dots" style={{backgroundColor: '#5BC66E'}}></p> _ Exploded Bombs: {this.state.bombsExploded}</li>
|
|
|
|
|
<li><p className="dots" style={{backgroundColor: '#c65bb3'}}></p> _ Dud Bombs: {this.state.bombsExploded}</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="killLeader">
|
|
|
|
|
<img src={Boomer} width="50px" />
|
|
|
|
|
<p>Kill Leader: {this.props.killLeader}</p>
|
|
|
|
|
<p>{this.props.killLeaderCount} kills</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="map">
|
|
|
|
|
<img src={Map} />
|
|
|
|
|
<GenerateBombOverlay amount={this.state.unaboomerSupply - this.state.unaboomersKilled} color={'white'} type={'squares'} />
|
|
|
|
|
<GenerateBombOverlay amount={this.state.unaboomersKilled} color={'black'} type={'squares'} />
|
|
|
|
|
<GenerateBombOverlay amount={this.state.bombSupply - this.state.bombsExploded} color={'yellow'} type={'dots'} />
|
|
|
|
|
<GenerateBombOverlay amount={this.state.bombsExploded} color={'cyan'} type={'dots'} />
|
|
|
|
|
<GenerateBombOverlay amount={this.state.bombsExploded} color={'red'} type={'dots'} />
|
|
|
|
|
<GenerateBombOverlay amount={this.state.bombSupply - this.state.bombsExploded} color={'white'} type={'dots'} />
|
|
|
|
|
<GenerateBombOverlay amount={this.state.bombsExploded} color={'#5BC66E'} type={'dots'} />
|
|
|
|
|
<GenerateBombOverlay amount={this.state.bombsExploded} color={'#c65bb3'} type={'dots'} />
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
@ -182,6 +185,9 @@ function Section3() {
|
|
|
|
|
bombSupply: 0,
|
|
|
|
|
bombsExploded: 0,
|
|
|
|
|
unaboomersKilled: 0,
|
|
|
|
|
leaderboardPointer: 0,
|
|
|
|
|
killLeader: '',
|
|
|
|
|
killLeaderCount: 0,
|
|
|
|
|
results: [],
|
|
|
|
|
tokensKilled: []
|
|
|
|
|
});
|
|
|
|
@ -189,57 +195,50 @@ function Section3() {
|
|
|
|
|
setOptions(preState => ({...preState , ...obj}))
|
|
|
|
|
}
|
|
|
|
|
const { isConnected, address } = useAccount();
|
|
|
|
|
const defOpt = {
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
enabled: isConnected
|
|
|
|
|
}
|
|
|
|
|
useContractReads({
|
|
|
|
|
contracts: [
|
|
|
|
|
{
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
...defOpt,
|
|
|
|
|
functionName: 'unaboomerPrice'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
...defOpt,
|
|
|
|
|
functionName: 'bombPrice'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
...defOpt,
|
|
|
|
|
functionName: 'unaboomerBalance',
|
|
|
|
|
args: [address]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
...defOpt,
|
|
|
|
|
functionName: 'bombBalance',
|
|
|
|
|
args: [address]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
...defOpt,
|
|
|
|
|
functionName: 'unaboomerSupply'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
...defOpt,
|
|
|
|
|
functionName: 'bombSupply'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
...defOpt,
|
|
|
|
|
functionName: 'bombsExploded'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
...defOpt,
|
|
|
|
|
functionName: 'unaboomersKilled'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
...defOpt,
|
|
|
|
|
functionName: 'leaderboardPointer'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
watch: true,
|
|
|
|
@ -254,6 +253,41 @@ function Section3() {
|
|
|
|
|
bombSupply: data[5].toString(),
|
|
|
|
|
bombsExploded: data[6].toString(),
|
|
|
|
|
unaboomersKilled: data[7].toString(),
|
|
|
|
|
leaderboardPointer: data[8].toString()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
useContractReads({
|
|
|
|
|
contracts: [
|
|
|
|
|
{
|
|
|
|
|
...defOpt,
|
|
|
|
|
enabled: options.leaderboardPointer > 0,
|
|
|
|
|
functionName: 'leaderboard',
|
|
|
|
|
args: [options.leaderboardPointer]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
watch: true,
|
|
|
|
|
cacheTime: 10000,
|
|
|
|
|
onSuccess(data) {
|
|
|
|
|
handleStateChange({
|
|
|
|
|
killLeader: data[0].toString(),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
useContractReads({
|
|
|
|
|
contracts: [
|
|
|
|
|
{
|
|
|
|
|
...defOpt,
|
|
|
|
|
enabled: options.killLeader.length > 0,
|
|
|
|
|
functionName: 'killCount',
|
|
|
|
|
args: [options.killLeader]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
watch: true,
|
|
|
|
|
cacheTime: 10000,
|
|
|
|
|
onSuccess(data) {
|
|
|
|
|
handleStateChange({
|
|
|
|
|
killLeaderCount: data[0].toString(),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -298,7 +332,6 @@ function Section3() {
|
|
|
|
|
log.topics[0] === '0x38c7e2e8001cefb27535bd6bcc6363c6d6a6a83dbb77f092b78956334596f9ed'
|
|
|
|
|
).map((log) => {
|
|
|
|
|
const res = iface.decodeEventLog("SentBomb", log.data, log.topics);
|
|
|
|
|
console.log(res);
|
|
|
|
|
if (res.hit) {
|
|
|
|
|
if (res.owned) {
|
|
|
|
|
NotificationManager.error(`Your bomb exploded during assembly and killed your Unaboomer ${res.tokenId.toString()}`, 'oof', 10000);
|
|
|
|
@ -361,6 +394,8 @@ function Section3() {
|
|
|
|
|
bombsExploded={options.bombsExploded}
|
|
|
|
|
unaboomerSupply={options.unaboomerSupply}
|
|
|
|
|
unaboomersKilled={options.unaboomersKilled}
|
|
|
|
|
killLeader={options.killLeader}
|
|
|
|
|
killLeaderCount={options.killLeaderCount}
|
|
|
|
|
/>
|
|
|
|
|
</>
|
|
|
|
|
||
|
|
|
|
|