Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/game_features/features.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ controller:registerEvents(g_game, {
-- g_game.enableFeature(GameKeepUnawareTiles)
-- g_game.enableFeature(GameNegativeOffset)
-- g_game.enableFeature(GameWingsAurasEffectsShader)
-- g_game.enableFeature(GameCreaturePaperdoll)
-- g_game.enableFeature(GameAllowCustomBotScripts)

g_game.enableFeature(GameFormatCreatureName)
Expand Down
1 change: 1 addition & 0 deletions modules/game_interface/interface.otmod
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Module
- game_unjustifiedpoints
- game_shaders
- game_attachedeffects
- game_paperdolls
- game_stash
- game_healthcircle
- game_shop
Expand Down
89 changes: 43 additions & 46 deletions modules/game_outfit/outfit.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local statesOutft ={
local statesOutft = {
available = 0,
store = 1,
goldenOutfitTooltip = 2
Expand Down Expand Up @@ -63,7 +63,7 @@ end

local function attachEffectIfValid(UICreature, value)
local creature = UICreature:getCreature()
if checkPresetsValidity({value}) then
if checkPresetsValidity({ value }) then
if creature then
creature:attachEffect(g_attachedEffects.getById(value))
end
Expand All @@ -72,7 +72,7 @@ end

local function attachOrDetachEffect(Id, attach)
local creature = previewCreature:getCreature()
if checkPresetsValidity({Id}) then
if checkPresetsValidity({ Id }) then
if creature then
if attach then
if not creature:getAttachedEffectById(Id) then
Expand Down Expand Up @@ -108,7 +108,6 @@ local function showSelectionList(data, tempValue, tempField, onSelectCallback)
end
if data and #data > 0 then
for _, itemData in ipairs(data) do

local button = g_ui.createWidget("SelectionButton", window.selectionList)
button:setId(tostring(itemData[1]))

Expand All @@ -117,10 +116,9 @@ local function showSelectionList(data, tempValue, tempField, onSelectCallback)
button.outfit:setOutfit({
type = modules.game_attachedeffects.thingId(itemData[1])
})

button.outfit:setMarginBottom(15)
button.outfit:setCenter(true)

elseif Category == 2 then
button.outfit:setOutfit(previewCreature:getCreature():getOutfit())
button.outfit:getCreature():attachEffect(g_attachedEffects.getById(itemData[1]))
Expand Down Expand Up @@ -149,7 +147,8 @@ local function showSelectionList(data, tempValue, tempField, onSelectCallback)
window.listSearch:show()
end

local AppearanceData = {"preset", "outfit", "mount", "familiar", "wings", "aura", "effects", "shader", "healthBar", "title"}
local AppearanceData = { "preset", "outfit", "mount", "familiar", "wings", "aura", "effects", "shader", "healthBar",
"title" }

function init()
connect(g_game, {
Expand All @@ -172,7 +171,7 @@ function onOutfitChange(creature, outfit, oldOutfit)
end

function onMovementChange(checkBox, checked)
local walkingSpeed = checked and 1000 or 0
local walkingSpeed = checked and 1000 or 0

local mainCreature = previewCreature:getCreature()
if mainCreature then
Expand Down Expand Up @@ -490,22 +489,22 @@ function create(player, outfitList, creatureMount, mountList, familiarList, wing

window.preview.options.showFamiliar:setVisible(g_game.getFeature(GamePlayerFamiliars))
window.appearance.settings.familiar:setVisible(g_game.getFeature(GamePlayerFamiliars))

local checks = {
{window.preview.options.showWings, ServerData.wings},
{window.preview.options.showAura, ServerData.auras},
{window.preview.options.showShader, ServerData.shaders},
{window.preview.options.showBars, ServerData.healthBars},
{window.preview.options.showEffects, ServerData.effects},
{window.preview.options.showTitle, ServerData.title},
{window.preview.options.showFamiliar, ServerData.familiars},
{window.appearance.settings.familiar, ServerData.familiars},
{window.appearance.settings.wings, ServerData.wings},
{window.appearance.settings.aura, ServerData.auras},
{window.appearance.settings.shader, ServerData.shaders},
{window.appearance.settings.healthBar, ServerData.healthBars},
{window.appearance.settings.effects, ServerData.effects},
{window.appearance.settings.title, ServerData.title},
{ window.preview.options.showWings, ServerData.wings },
{ window.preview.options.showAura, ServerData.auras },
{ window.preview.options.showShader, ServerData.shaders },
{ window.preview.options.showBars, ServerData.healthBars },
{ window.preview.options.showEffects, ServerData.effects },
{ window.preview.options.showTitle, ServerData.title },
{ window.preview.options.showFamiliar, ServerData.familiars },
{ window.appearance.settings.familiar, ServerData.familiars },
{ window.appearance.settings.wings, ServerData.wings },
{ window.appearance.settings.aura, ServerData.auras },
{ window.appearance.settings.shader, ServerData.shaders },
{ window.appearance.settings.healthBar, ServerData.healthBars },
{ window.appearance.settings.effects, ServerData.effects },
{ window.appearance.settings.title, ServerData.title },
}

for _, check in ipairs(checks) do
Expand Down Expand Up @@ -671,7 +670,6 @@ function deletePreset()
updateAppearanceText("aura", "None")
updateAppearanceText("wings", "None")
updateAppearanceText("effects", "None")

end

function savePreset()
Expand Down Expand Up @@ -706,7 +704,7 @@ function savePreset()
attachEffectIfValid(window.presetsList[presetId].creature, lastSelectAura)
attachEffectIfValid(window.presetsList[presetId].creature, lastSelectEffects)
attachEffectIfValid(window.presetsList[presetId].creature, lastSelectWings)
local presets = {lastSelectAura, lastSelectEffects, lastSelectWings}
local presets = { lastSelectAura, lastSelectEffects, lastSelectWings }
local hasValidAE = checkPresetsValidity(presets)
local thingType = g_things.getThingType(tempOutfit.type, ThingCategoryCreature)

Expand Down Expand Up @@ -822,7 +820,7 @@ function showPresets()
attachEffectIfValid(presetWidget.creature, preset.effects)
attachEffectIfValid(presetWidget.creature, preset.wings)

local presets = {preset.auras, preset.effects, preset.wings}
local presets = { preset.auras, preset.effects, preset.wings }
local hasValidAE = checkPresetsValidity(presets)
local thingType = g_things.getThingType(tempOutfit.type, ThingCategoryCreature)

Expand All @@ -843,7 +841,6 @@ function showPresets()

if presetId == settings.currentPreset then
focused = presetId

end
end
end
Expand Down Expand Up @@ -952,7 +949,7 @@ function showMounts()
if tempOutfit.mount == mountData[1] then
focused = mountData[1]
end

local state = mountData[3]
if state then
button.state = state
Expand Down Expand Up @@ -1005,11 +1002,11 @@ function showFamiliars()
button.outfit:setOutfit({
type = familiarData[1]
})

button.name:setText(familiarData[2])

button.outfit:setCenter(true)

if tempOutfit.familiar == familiarData[1] then
focused = familiarData[1]
end
Expand Down Expand Up @@ -1073,13 +1070,12 @@ function showShaders()
})

button.outfit:setCenter(true)

button.outfit:getCreature():setShader(shaderData[2])

button.name:setText(shaderData[2])

if tempOutfit.shaders == shaderData[2] then

focused = shaderData[2]
end
end
Expand Down Expand Up @@ -1205,9 +1201,7 @@ function showTitle()
end

function onPresetSelect(list, focusedChild, unfocusedChild, reason)

if focusedChild then

local presetId = tonumber(focusedChild:getId())
local preset = settings.presets[presetId]
tempOutfit = table.copy(preset.outfit)
Expand Down Expand Up @@ -1236,7 +1230,7 @@ function onPresetSelect(list, focusedChild, unfocusedChild, reason)
updateAppearanceText("shader", preset.shaders or "Outfit - Default")
updateAppearanceText("effects", modules.game_attachedeffects.getName(preset.effects))
end

previewCreature:getCreature():clearAttachedEffects()

if settings.showEffects and preset.effects then
Expand Down Expand Up @@ -1275,7 +1269,6 @@ function onPresetSelect(list, focusedChild, unfocusedChild, reason)
lastSelectWings = preset.wings
lastSelectEffects = preset.effects
lastSelectShader = preset.shaders

end
end

Expand Down Expand Up @@ -1361,7 +1354,7 @@ function onAuraSelect(list, focusedChild, unfocusedChild, reason)
if focusedChild then
local auraType = tonumber(focusedChild:getId())

if checkPresetsValidity({auraType}) then
if checkPresetsValidity({ auraType }) then
previewCreature:getCreature():attachEffect(g_attachedEffects.getById(auraType))
lastSelectAura = auraType
tempOutfit.auras = auraType
Expand All @@ -1388,8 +1381,7 @@ function onWingsSelect(list, focusedChild, unfocusedChild, reason)
if focusedChild then
local wingsType = tonumber(focusedChild:getId())

if checkPresetsValidity({wingsType}) then

if checkPresetsValidity({ wingsType }) then
previewCreature:getCreature():attachEffect(g_attachedEffects.getById(wingsType))
lastSelectWings = wingsType
tempOutfit.wings = wingsType
Expand Down Expand Up @@ -1419,7 +1411,7 @@ function onShaderSelect(list, focusedChild, unfocusedChild, reason)
showShaderCheck:setChecked(true)
showShaderCheck.onCheckChange = onShowShaderChange
end

lastSelectShader = shaderType
tempOutfit.shaders = shaderType
creature:setShader(shaderType)
Expand Down Expand Up @@ -1467,7 +1459,7 @@ function onEffectBarSelect(list, focusedChild, unfocusedChild, reason)
if focusedChild then
local effect_id = tonumber(focusedChild:getId())

if checkPresetsValidity({effect_id}) then
if checkPresetsValidity({ effect_id }) then
previewCreature:getCreature():attachEffect(g_attachedEffects.getById(effect_id))
lastSelectEffects = effect_id
tempOutfit.effects = effect_id
Expand Down Expand Up @@ -1691,18 +1683,24 @@ function updatePreview()
previewCreature:setOutfit(previewOutfit)
previewCreature:getCreature():setDirection(direction)

for _, paperdoll in ipairs(g_game.getLocalPlayer():getPaperdolls()) do
if paperdoll:canDrawOnUI() then
local clone = paperdoll:clone()
previewCreature:getCreature():attachPaperdoll(clone)
end
end
end

function rotate(value)
if not previewCreature then
return
end

local creature = previewCreature:getCreature()
if not creature then
return
end

local direction = previewCreature:getDirection()

direction = direction + value
Expand Down Expand Up @@ -1739,7 +1737,6 @@ function onFilterOnlyMine(self, checked)
end)
end


function onFilterSearch()
addEvent(function()
local searchText = window.listSearch.search:getText():lower():trim()
Expand Down Expand Up @@ -1768,7 +1765,7 @@ function saveSettings()
local writeStatus, writeError = pcall(function()
return g_resources.writeFileContents(settingsFile, "[]")
end)

if not writeStatus then
g_logger.debug("Could not create outfit settings file during logout: " .. tostring(writeError))
return
Expand Down Expand Up @@ -1803,7 +1800,7 @@ function saveSettings()
local writeStatus, writeError = pcall(function()
return g_resources.writeFileContents(settingsFile, json.encode(fullSettings))
end)

if not writeStatus then
g_logger.debug("Could not save outfit settings during logout: " .. tostring(writeError))
end
Expand Down
36 changes: 36 additions & 0 deletions modules/game_paperdolls/configs/demon.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--[[
registerThingConfig(thingId, thingType)
set(paperdollId, config)
]]
--
local c = PaperdollManager.registerThingConfig(35)

c:set(1, {
sizeFactor = 1.7,
dirOffset = {
[North] = { 0, 0 },
[East] = { 0, 5 },
[South] = { 5, 0 },
[West] = { 10, 5 }
}
})

c:set(2, {
sizeFactor = 1.7,
dirOffset = {
[North] = { 0, 20, false },
[East] = { -15, 5 },
[South] = { 5, -15 },
[West] = { 5, -15 }
}
})

c:set(3, {
sizeFactor = 1.7,
dirOffset = {
[North] = { 0, -10 },
[East] = { -15, -3 },
[South] = { 0, -10 },
[West] = { -10, -5 }
}
})
Loading
Loading