Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Sal7one/6b5f6b438bc7248b3619bd932b9d9a37 to your computer and use it in GitHub Desktop.
Save Sal7one/6b5f6b438bc7248b3619bd932b9d9a37 to your computer and use it in GitHub Desktop.
Hotline Miami 2 Vita. custom bullet calculator
<!-- Google fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Balsamiq+Sans:wght@700&display=swap" rel="stylesheet">
<h1 class="neon-button">Enter your bullet count:
<h1 />
<input id="bullet" class="neon-button" type="number" max="128"></input>
<h1 id="hex" class="neon-button">
<h1 />
<h3>Hotline Maimi 2 hex finder. By: <a href="https://github.com/sal7one" style="color:gold;"> Github Sal7one<a /></h3>
<script src="https://code.jquery.com/jquery-1.12.3.js" integrity="sha256-1XMpEtA4eKXNNpXcJ1pmMPs8JV+nwLdEqwiJeCQEkyc=" crossorigin="anonymous"></script>
var Bullet = document.querySelector("#bullet");
$("#bullet").on("input", function () {
GetHexFromBullet(Bullet.value);
});
function GetHexFromBullet(Bullet) {
// HTML ELEMENT
var hextext = document.querySelector("#hex");
var userAmmo = Bullet;
if (userAmmo == 1 || userAmmo == 2) {
userAmmo == 1
? (hextext.innerText = ` Miami 1 Bullet hex: 3FF0000 Search that in vita cheat`)
: (hextext.innerText = ` Miami 2 Bullet hex: 4000000 Search that in vita cheat`);
} else if (userAmmo > 128 || userAmmo < 1) {
hextext.innerText = ` No weapons have more than 100 by default :P (128 is max)`;
} else {
var power = powersoftwo(Bullet);
var increaseby = 0;
// If ammo > power increase by lower power
// ammo = 17, increase by 1, ammo > 4^4 = 16
// The starting point of increasing
// 16368 - > 3FF0 = Starting point
var miamidecmial = 16368 + 16 * (power - 2);
switch (power) {
case 2:
increaseby = 8;
break;
case 3:
increaseby = 4;
break;
case 4:
increaseby = 2;
break;
case 5:
increaseby = 1;
break;
case 6:
increaseby = 8;
miamidecmial = 262912;
break;
case 7:
increaseby = 4;
miamidecmial = 263168;
break;
}
var HexNum = increase(increaseby, miamidecmial, Bullet);
if (HexNum.charAt(0) == "0") {
HexNum = HexNum.substr(1);
HexNum += "0000";
} else {
HexNum += "000";
}
hextext.innerText = ` hex of ${Bullet} bullet is ${HexNum} (hex) Search that in vita cheat`;
}
}
// This function gets possible powers of 2 for a number
// Which is important for how hotline miami works
function powersoftwo(thenumber) {
var poweroftwo = 1;
while (thenumber > Math.pow(2, poweroftwo)) {
poweroftwo++;
}
return poweroftwo;
}
// Increase depnding on where the power resides
function increase(increaseby, miamiDecmial, userAmmo) {
for (i = 0; i < userAmmo; i++) {
miamiDecmial += increaseby;
}
return decToHex(miamiDecmial);
}
function decToHex(dec) {
return (dec + Math.pow(16, 6)).toString(16).substr(-5).toUpperCase();
}
:root {
--clr-neon: hsl(317 100% 54%);
--clr-bg: hsl(323 21% 16%);
}
body {
min-height: 50vh;
place-items: center;
background: var(--clr-bg);
font-family: "Balsamiq Sans", cursive;
color: var(--clr-neon);
padding-right: 10rem;
}
.neon-button {
font-size: 2rem;
margin: 15px;
display: inline-block;
cursor: pointer;
text-decoration: none;
color: var(--clr-neon);
border: var(--clr-neon) 0.125em solid;
padding: 0.25em 1em;
border-radius: 0.25em;
text-shadow: 0 0 0.125em hsl(0 0% 100% / 0.3), 0 0 0.45em currentColor;
box-shadow: inset 0 0 0.5em 0 var(--clr-neon), 0 0 0.5em 0 var(--clr-neon);
position: relative;
}
.neon-button::before {
pointer-events: none;
content: "";
position: absolute;
background: var(--clr-neon);
top: 120%;
left: 0;
width: 50%;
height: 50%;
transform: perspective(1em) rotateX(40deg) scale(1, 0.35);
filter: blur(1em);
opacity: 0.7;
}
.neon-button::after {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
box-shadow: 0 0 2em 0.5em var(--clr-neon);
opacity: 0;
background-color: var(--clr-neon);
z-index: -1;
transition: opacity 100ms linear;
}
.neon-button:hover,
.neon-button:focus {
color: var(--clr-bg);
text-shadow: none;
}
.neon-button:hover::before,
.neon-button:focus::before {
opacity: 1;
}
.neon-button:hover::after,
.neon-button:focus::after {
opacity: 1;
}
h1 {
display: inline-block;
}
#bullet {
display: inline-block;
}
input {
outline: none;
}
#hex::before {
background: cyan;
}
#hex {
color: cyan;
background: black;
border-color: cyan;
text-shadow: none;
box-shadow: none;
}
#hex:hover,
#hex:focus {
color: cyan;
text-shadow: none;
}
#hex:hover::before,
#hex:focus::before,
#hex::after {
opacity: 0;
}
#hex:hover::after,
#hex:focus::after {
opacity: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment