Added get_guid replicating C# functionality (hopefully)

This commit is contained in:
Dusty.P 2018-05-06 01:16:19 -08:00
parent 8cdca8f704
commit ccf961d22c

View File

@ -3,6 +3,7 @@ import sys
import asyncio import asyncio
import discord import discord
from discord.ext.commands.formatter import Paginator from discord.ext.commands.formatter import Paginator
import numpy as np
class Capturing(list): class Capturing(list):
@ -81,3 +82,20 @@ async def run_command(args):
stdout, stderr = await process.communicate() stdout, stderr = await process.communicate()
# Return stdout # Return stdout
return stdout.decode().strip() return stdout.decode().strip()
def get_guid(id1: int, id2: int):
id_int = (id1 << 32) | (id2 & 0xFFFFFFFF)
b = id_int.to_bytes(16, byteorder='little')
_a = (int(b[3]) << 24) | (int(b[2]) << 16) | (int(b[1]) << 8) | b[0]
_b = np.short((int(b[5]) << 8) | b[4])
_c = np.short((int(b[7]) << 8) | b[6])
_d = b[8]
_e = b[9]
_f = b[10]
_g = b[11]
_h = b[12]
_i = b[13]
_j = b[14]
_k = b[15]
return _a ^ ((int(_b) << 16) | int(np.ushort(_c))) ^ ((int(_f) << 24) | _k)