big refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-22 22:30:16 +02:00
parent 3a40cddda1
commit c2cef5b142
8 changed files with 52 additions and 102 deletions
+8 -10
View File
@@ -1,8 +1,6 @@
module 'disenchant'
UNCOMMON = 2
RARE = 3
EPIC = 4
UNCOMMON, RARE, EPIC = 2, 3, 4
do
local data = {
@@ -41,7 +39,7 @@ do
end
function LOAD()
armor = set-from
ARMOR = set-from
'INVTYPE_HEAD'
'INVTYPE_NECK'
'INVTYPE_SHOULDER'
@@ -57,7 +55,7 @@ function LOAD()
'INVTYPE_TRINKET'
'INVTYPE_CLOAK'
'INVTYPE_HOLDABLE'
weapon = set-from
WEAPON = set-from
'INVTYPE_2HWEAPON'
'INVTYPE_WEAPONMAINHAND'
'INVTYPE_WEAPON'
@@ -81,14 +79,14 @@ function public.value(slot, quality, level)
end
function public.distribution(slot, quality, level)
if not (armor(slot) or weapon(slot)) or level == 0 then
return {}
if not (ARMOR[slot] or WEAPON[slot]) or level == 0 then
return tt
end
local function p(probability_armor, probability_weapon)
if armor(slot) then
if ARMOR[slot] then
return probability_armor
elseif weapon(slot) then
elseif WEAPON[slot] then
return probability_weapon
end
end
@@ -193,5 +191,5 @@ function public.distribution(slot, quality, level)
return {{item_id=20725, min_quantity=1, max_quantity=2, probability=1}}
end
end
return {}
return tt
end
+3 -3
View File
@@ -52,7 +52,7 @@ function SlashCmdList.AUX(command)
local realm = GetCVar 'realmName'
_g.aux_characters[realm] = _g.aux_characters[realm] or {}
for i=3,getn(arguments) do
local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
local name = gsub(strlower(arguments[i]), '^%l', strupper)
if not _g.aux_characters[realm][name] then
_g.aux_characters[realm][name] = true
log('Character "'..name..'" added.')
@@ -64,7 +64,7 @@ function SlashCmdList.AUX(command)
return
end
for i=3,getn(arguments) do
local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
local name = gsub(strlower(arguments[i]), '^%l', strupper)
if _g.aux_characters[realm][name] then
_g.aux_characters[realm][name] = nil
log('Character "'..name..'" removed.')
@@ -77,7 +77,7 @@ function SlashCmdList.AUX(command)
tinsert(chars, name)
end
if getn(chars) > 0 then
log('Your characters: "'..table.concat(chars, ', ')..'".')
log('Your characters: "'..join(chars, ', ')..'".')
else
log 'You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".'
end