Fix for Issue #41
This commit is contained in:
parent
92e3c2cbd6
commit
f73b3bbece
|
@ -122,7 +122,7 @@ local function updateOutfit()
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateMount()
|
function updateMount()
|
||||||
if table.empty(mounts) then
|
if table.empty(mounts) or not mount then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local nameMountWidget = outfitWindow:getChildById('mountName')
|
local nameMountWidget = outfitWindow:getChildById('mountName')
|
||||||
|
@ -154,7 +154,9 @@ function Outfit.create(creatureOutfit, outfitList, creatureMount, mountList)
|
||||||
|
|
||||||
outfitWindow = g_ui.displayUI('outfitwindow.otui')
|
outfitWindow = g_ui.displayUI('outfitwindow.otui')
|
||||||
outfit = outfitCreature:getOutfit()
|
outfit = outfitCreature:getOutfit()
|
||||||
mount = mountCreature:getOutfit()
|
if mountCreature then
|
||||||
|
mount = mountCreature:getOutfit()
|
||||||
|
end
|
||||||
|
|
||||||
addons = {
|
addons = {
|
||||||
[1] = {widget = outfitWindow:getChildById('addon1'), value = 1},
|
[1] = {widget = outfitWindow:getChildById('addon1'), value = 1},
|
||||||
|
@ -211,7 +213,7 @@ function Outfit.create(creatureOutfit, outfitList, creatureMount, mountList)
|
||||||
end
|
end
|
||||||
currentMount = 1
|
currentMount = 1
|
||||||
for i=1,#mountList do
|
for i=1,#mountList do
|
||||||
if mountList[i][1] == mount.type then
|
if mount and mountList[i][1] == mount.type then
|
||||||
currentMount = i
|
currentMount = i
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -242,19 +244,22 @@ function Outfit.randomize()
|
||||||
|
|
||||||
for k, section in pairs(outfitTemplate) do
|
for k, section in pairs(outfitTemplate) do
|
||||||
section:setChecked(true)
|
section:setChecked(true)
|
||||||
colorBoxes[math.random(0, #colorBoxes)]:setChecked(true)
|
colorBoxes[math.random(1, #colorBoxes)]:setChecked(true)
|
||||||
section:setChecked(false)
|
section:setChecked(false)
|
||||||
end
|
end
|
||||||
outfitTemplate[1]:setChecked(true)
|
outfitTemplate[1]:setChecked(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.accept()
|
function Outfit.accept()
|
||||||
outfit.mount = mount.type
|
if mount then outfit.mount = mount.type end
|
||||||
g_game.changeOutfit(outfit)
|
g_game.changeOutfit(outfit)
|
||||||
Outfit.destroy()
|
Outfit.destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.nextOutfitType()
|
function Outfit.nextOutfitType()
|
||||||
|
if not outfits then
|
||||||
|
return
|
||||||
|
end
|
||||||
currentOutfit = currentOutfit + 1
|
currentOutfit = currentOutfit + 1
|
||||||
if currentOutfit > #outfits then
|
if currentOutfit > #outfits then
|
||||||
currentOutfit = 1
|
currentOutfit = 1
|
||||||
|
@ -263,6 +268,9 @@ function Outfit.nextOutfitType()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.previousOutfitType()
|
function Outfit.previousOutfitType()
|
||||||
|
if not outfits then
|
||||||
|
return
|
||||||
|
end
|
||||||
currentOutfit = currentOutfit - 1
|
currentOutfit = currentOutfit - 1
|
||||||
if currentOutfit <= 0 then
|
if currentOutfit <= 0 then
|
||||||
currentOutfit = #outfits
|
currentOutfit = #outfits
|
||||||
|
@ -271,6 +279,9 @@ function Outfit.previousOutfitType()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.nextMountType()
|
function Outfit.nextMountType()
|
||||||
|
if not mounts then
|
||||||
|
return
|
||||||
|
end
|
||||||
currentMount = currentMount + 1
|
currentMount = currentMount + 1
|
||||||
if currentMount > #mounts then
|
if currentMount > #mounts then
|
||||||
currentMount = 1
|
currentMount = 1
|
||||||
|
@ -279,6 +290,9 @@ function Outfit.nextMountType()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.previousMountType()
|
function Outfit.previousMountType()
|
||||||
|
if not mounts then
|
||||||
|
return
|
||||||
|
end
|
||||||
currentMount = currentMount - 1
|
currentMount = currentMount - 1
|
||||||
if currentMount <= 0 then
|
if currentMount <= 0 then
|
||||||
currentMount = #mounts
|
currentMount = #mounts
|
||||||
|
|
Loading…
Reference in New Issue