Code format
This commit is contained in:
@@ -1,6 +1,60 @@
|
||||
local cc =
|
||||
{
|
||||
"Gnaw", "Hungering Cold", "Bash", "Cyclone", "Entangling Roots", "Hibernate", "Maim", "Pounce", "Entrapment", "Freezing Trap", "Pin", "Scare Beast", "Scatter Shot", "Intimidation", "Ravage", "Sonic Blast", "Wyvern Sting", "Deep Freeze", "Dragon's Breath", "Frost Nova", "Polymorph", "Shattered Barrier", "Slow", "Frostbolt", "Hammer of Justice", "Holy Wrath", "Repentance", "Seal of Justice", "Turn Evil", "Mind Control", "Psychic Horror", "Psychic Scream", "Shackle Undead", "Holy Word: Chastise", "Sin and Punishment", "Blind", "Cheap Shot", "Gouge", "Kidney Shot", "Sap", "Earthbind Totem", "Stoneclaw Totem", "Hex", "Banish", "Death Coil", "Fear", "Howl of Terror", "Intercept", "Seduction", "Shadowfury", "Charge", "Concussion Blow", "Hamstring", "Improved Hamstring", "Intimidating Shout", "Shockwave"
|
||||
local cc = {
|
||||
"Gnaw",
|
||||
"Hungering Cold",
|
||||
"Bash",
|
||||
"Cyclone",
|
||||
"Entangling Roots",
|
||||
"Hibernate",
|
||||
"Maim",
|
||||
"Pounce",
|
||||
"Entrapment",
|
||||
"Freezing Trap",
|
||||
"Pin",
|
||||
"Scare Beast",
|
||||
"Scatter Shot",
|
||||
"Intimidation",
|
||||
"Ravage",
|
||||
"Sonic Blast",
|
||||
"Wyvern Sting",
|
||||
"Deep Freeze",
|
||||
"Dragon's Breath",
|
||||
"Frost Nova",
|
||||
"Polymorph",
|
||||
"Shattered Barrier",
|
||||
"Slow",
|
||||
"Frostbolt",
|
||||
"Hammer of Justice",
|
||||
"Holy Wrath",
|
||||
"Repentance",
|
||||
"Seal of Justice",
|
||||
"Turn Evil",
|
||||
"Mind Control",
|
||||
"Psychic Horror",
|
||||
"Psychic Scream",
|
||||
"Shackle Undead",
|
||||
"Holy Word: Chastise",
|
||||
"Sin and Punishment",
|
||||
"Blind",
|
||||
"Cheap Shot",
|
||||
"Gouge",
|
||||
"Kidney Shot",
|
||||
"Sap",
|
||||
"Earthbind Totem",
|
||||
"Stoneclaw Totem",
|
||||
"Hex",
|
||||
"Banish",
|
||||
"Death Coil",
|
||||
"Fear",
|
||||
"Howl of Terror",
|
||||
"Intercept",
|
||||
"Seduction",
|
||||
"Shadowfury",
|
||||
"Charge",
|
||||
"Concussion Blow",
|
||||
"Hamstring",
|
||||
"Improved Hamstring",
|
||||
"Intimidating Shout",
|
||||
"Shockwave",
|
||||
}
|
||||
local hashtable = {}
|
||||
local spellarray = {}
|
||||
@@ -78,7 +132,7 @@ end
|
||||
|
||||
local function findcollision(hash_table, array)
|
||||
local collisions = 0
|
||||
for k,v in ipairs(hash_table) do
|
||||
for k, v in ipairs(hash_table) do
|
||||
for i = 1, table.getn(hash_table) do
|
||||
if i ~= k then
|
||||
if hash_table[i] == hash_table[k] then
|
||||
@@ -98,7 +152,7 @@ local function tohash(tempvar)
|
||||
charTable[#charTable + 1] = char
|
||||
hash = hash + tonum(char)
|
||||
hash = hash / table.getn(charTable)
|
||||
end
|
||||
end
|
||||
hash = math.floor(hash * 10000)
|
||||
return hash
|
||||
--print(spellarray[hash], hash)
|
||||
@@ -109,9 +163,9 @@ local function checkbase(spell)
|
||||
if spellarray[tohash(spell)] == spell then return 1 end
|
||||
end
|
||||
|
||||
for k,v in ipairs(cc) do
|
||||
for k, v in ipairs(cc) do
|
||||
local hash = tohash(v)
|
||||
hashtable[#hashtable] = hash
|
||||
spellarray[hash] = v
|
||||
end
|
||||
findcollision(hashtable, cc)
|
||||
findcollision(hashtable, cc)
|
||||
|
||||
Reference in New Issue
Block a user