diff --git a/data/images/game/combatmodes/safefight.png b/data/images/game/combatmodes/safefight.png index a982cf209d..1b7007a3aa 100644 Binary files a/data/images/game/combatmodes/safefight.png and b/data/images/game/combatmodes/safefight.png differ diff --git a/mods/game_bot/executor.lua b/mods/game_bot/executor.lua index 1cce5efeac..56a44957d1 100644 --- a/mods/game_bot/executor.lua +++ b/mods/game_bot/executor.lua @@ -427,11 +427,6 @@ function executeBot(config, storage, tabs, msgCallback, saveConfigCallback, relo callback(iconId, duration) end end, - onSpellCooldown = function(iconId, duration) - for i, callback in ipairs(context._callbacks.onSpellCooldown) do - callback(iconId, duration) - end - end, onInventoryChange = function(player, slot, item, oldItem) for i, callback in ipairs(context._callbacks.onInventoryChange) do callback(player, slot, item, oldItem) diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index 65bfb47bd2..1f32a017d1 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -257,8 +257,9 @@ function controller:onTerminate() panels = {} extraWidgets = {} buttons = {} - Keybind.delete("UI", "Toggle Full Screen") + Keybind.delete("UI", "Toggle Fullscreen") Keybind.delete("UI", "Show/hide Creature Names and Bars") + Keybind.delete("UI", "Show/hide FPS / lag indicator") Keybind.delete("Sound", "Mute/unmute") terminate_binds() diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 209b8d3e0e..42f8eb5e02 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -581,6 +581,9 @@ function clear() channelsWindow:destroy() channelsWindow = nil end + if g_game.getClientVersion() < 862 then + Keybind.delete("Dialogs", "Open Rule Violation") + end end function clearChannel(consoleTabBar) @@ -2077,9 +2080,6 @@ function online() end function offline() - if g_game.getClientVersion() < 862 then - Keybind.delete("Dialogs", "Open Rule Violation") - end clear() end diff --git a/modules/game_console/console.otui b/modules/game_console/console.otui index a78693127b..0ab09dbbe5 100644 --- a/modules/game_console/console.otui +++ b/modules/game_console/console.otui @@ -25,6 +25,7 @@ ConsolePhantomLabel < UILabel ConsoleTabBar < MoveableTabBar height: 28 + phantom: true ConsoleTabBarPanel < MoveableTabBarPanel id: consoleTab diff --git a/modules/game_healthcircle/game_healthcircle.lua b/modules/game_healthcircle/game_healthcircle.lua index 1a57dbb6d9..f3278cc81b 100644 --- a/modules/game_healthcircle/game_healthcircle.lua +++ b/modules/game_healthcircle/game_healthcircle.lua @@ -15,8 +15,6 @@ manaCircle = nil expCircle = nil skillCircle = nil -g_ui.loadUI('game_healthcircle') - healthCircleFront = nil manaCircleFront = nil expCircleFront = nil @@ -39,6 +37,7 @@ distanceFromCenter = g_settings.getNumber('healthcircle_distfromcenter') opacityCircle = g_settings.getNumber('healthcircle_opacity', 0.35) function init() + g_ui.importStyle("game_healthcircle.otui") healthCircle = g_ui.createWidget('HealthCircle', mapPanel) manaCircle = g_ui.createWidget('ManaCircle', mapPanel) expCircle = g_ui.createWidget('ExpCircle', mapPanel) diff --git a/modules/game_interface/widgets/statsbar.lua b/modules/game_interface/widgets/statsbar.lua index 032d2f71ab..e0a9c0aa76 100644 --- a/modules/game_interface/widgets/statsbar.lua +++ b/modules/game_interface/widgets/statsbar.lua @@ -258,6 +258,7 @@ local function loadIcon(bitChanged, content, topmenu) end icon:setTooltip(tooltip) icon:setImageSize(tosize("9 9")) + icon:setMarginRight(-1) if topmenu then icon:setMarginTop(5) icon:setMarginLeft(2) diff --git a/modules/game_inventory/inventory.lua b/modules/game_inventory/inventory.lua index 7e9e5d88ee..ad5870dfe7 100644 --- a/modules/game_inventory/inventory.lua +++ b/modules/game_inventory/inventory.lua @@ -4,6 +4,7 @@ local inventoryShrink = false local itemSlotsWithDuration = {} local updateSlotsDurationEvent = nil local DURATION_UPDATE_INTERVAL = 1000 +local pvpModeRadioGroup = nil local function getInventoryUi() if inventoryShrink then @@ -366,6 +367,13 @@ function inventoryController:onTerminate() iconTopMenu:destroy() iconTopMenu = nil end + if pvpModeRadioGroup then + disconnect(pvpModeRadioGroup, { + onSelectionChange = onSetPVPMode + }) + pvpModeRadioGroup:destroy() + pvpModeRadioGroup = nil + end end function onSetSafeFight(self, checked) diff --git a/modules/game_mainpanel/mainoptionspanel.otui b/modules/game_mainpanel/mainoptionspanel.otui index 5a44811404..53772bbdca 100644 --- a/modules/game_mainpanel/mainoptionspanel.otui +++ b/modules/game_mainpanel/mainoptionspanel.otui @@ -10,22 +10,6 @@ PhantomMiniWindow margin-top: 8 phantom: true - UIWidget - id: store - - image-clip: 0 0 108 20 - anchors.top: parent.top - anchors.left: parent.left - - size: 108 20 - layout: - type: verticalBox - cell-size: 108 20 - cell-spacing: 2 - flow: true - $pressed !disabled: - image-clip: 0 20 108 20 - Button size: 44 20 image-source: /images/options/button_enlarge @@ -46,7 +30,6 @@ PhantomMiniWindow UIWidget id: store - image-clip: 0 0 108 20 anchors.top: parent.top anchors.left: parent.left @@ -65,7 +48,7 @@ PhantomMiniWindow Button id: resizer size: 44 20 - image-source: /images/options/button_shrink + image-source: /images/options/button_enlarge image-clip: 0 0 44 20 anchors.top: parent.top anchors.right: parent.right diff --git a/modules/game_mainpanel/mainpanel.lua b/modules/game_mainpanel/mainpanel.lua index 6058ad6415..192580ffea 100644 --- a/modules/game_mainpanel/mainpanel.lua +++ b/modules/game_mainpanel/mainpanel.lua @@ -14,58 +14,70 @@ local COLORS = { BASE_2 = "#414141" } -function reloadMainPanelSizes() - local main = modules.game_interface.getMainRightPanel() - local rightPanel = modules.game_interface.getRightPanel() +local PANEL_CONSTANTS = { + ICON_WIDTH = 18, + ICON_HEIGHT = 18, + MAX_ICONS_PER_ROW = { + OPTIONS = 5, + SPECIALS = 2, + STORE = 1 + }, + MULTI_STORE_HEIGHT = 20, + HEIGHT_EXTRA_ONPANEL = -5, + HEIGHT_EXTRA_SHRINK = 5 +} - if not main or not rightPanel then - return - end - - local height = 1 - local function calculatePanelHeight(icon_count, max_icons_per_row, icon_size) - local rows = math.ceil(icon_count / max_icons_per_row) - return (rows * icon_size) + (rows * 3) +local optionsShrink = false + +local function calculatePanelHeight(panel, max_icons_per_row) + local icon_count = 0 + for _, icon in ipairs(panel:getChildren()) do + if icon:isVisible() then + icon_count = icon_count + 1 + end end + local rows = math.ceil(icon_count / max_icons_per_row) + local height = (rows * PANEL_CONSTANTS.ICON_HEIGHT) + (rows * 3) + return height, icon_count +end - for _, panel in ipairs(main:getChildren()) do +function reloadMainPanelSizes() + local main_panel = modules.game_interface.getMainRightPanel() + local right_panel = modules.game_interface.getRightPanel() + if not main_panel or not right_panel then + return + end + local total_height = 1 + for _, panel in ipairs(main_panel:getChildren()) do if panel.panelHeight ~= nil then if panel:isVisible() then panel:setHeight(panel.panelHeight) - height = height + panel.panelHeight - - if panel:getId() == 'mainoptionspanel' and panel:isOn() then - - local function calculatePanelHeightFromPanel(panel, icon_width, icon_height, max_icons_per_row) - local icon_count = 0 - for _, icon in ipairs(panel:getChildren()) do - if icon:isVisible() then - icon_count = icon_count + 1 - end + total_height = total_height + panel.panelHeight + if panel:getId() == 'mainoptionspanel' then + if panel:isOn() then + local options_panel = optionsController.ui.onPanel.options + local options_height, options_count = + calculatePanelHeight(options_panel, PANEL_CONSTANTS.MAX_ICONS_PER_ROW.OPTIONS) + local specials_panel = optionsController.ui.onPanel.specials + local specials_height, specials_count = + calculatePanelHeight(specials_panel, PANEL_CONSTANTS.MAX_ICONS_PER_ROW.SPECIALS) + local store_panel = panel.onPanel.store + local store_height, store_count = calculatePanelHeight(store_panel, + PANEL_CONSTANTS.MAX_ICONS_PER_ROW.STORE) + if store_count > 0 then + store_height = store_count * PANEL_CONSTANTS.MULTI_STORE_HEIGHT + (store_count - 1) * 2 end - - local rows = math.ceil(icon_count / max_icons_per_row) - return (rows * icon_height) + (rows * 3) - end - - local options_panel = optionsController.ui.onPanel.options - local options_height = calculatePanelHeightFromPanel(options_panel, 18, 18, 5) - - local specials_panel = optionsController.ui.onPanel.specials - local specials_height = calculatePanelHeightFromPanel(specials_panel, 18, 18, 2) - - local max_panel_height = math.max(options_height, specials_height) - panel:setHeight(panel:getHeight() + max_panel_height + 5) - height = height + options_height - - local store_panel = panel.onPanel.store - local store_height = calculatePanelHeightFromPanel(store_panel, 18, 18, 1) - - store_panel:setHeight(store_height) - height = height + store_height - - if store_panel:getChildCount() >= 2 then - height = height + 15 + local combined_height = store_height + math.max(options_height, specials_height) + local extra_height = PANEL_CONSTANTS.HEIGHT_EXTRA_ONPANEL + if store_count >= 2 then + extra_height = extra_height - (store_count - 1) * 5 + end + combined_height = combined_height + extra_height + store_panel:setHeight(store_height) + panel:setHeight(combined_height + panel.panelHeight) + total_height = total_height + combined_height + else + total_height = total_height + PANEL_CONSTANTS.HEIGHT_EXTRA_SHRINK end end else @@ -73,28 +85,22 @@ function reloadMainPanelSizes() end end end - - main:setHeight(height - 10) - rightPanel:fitAll() + main_panel:setHeight(total_height) + right_panel:fitAll() end --- @ Options -local optionsShrink = false local function refreshOptionsSizes() if optionsShrink then optionsController.ui:setOn(false) - optionsController.ui.onPanel:hide() optionsController.ui.offPanel:show() else optionsController.ui:setOn(true) - optionsController.ui.onPanel:show() optionsController.ui.offPanel:hide() end reloadMainPanelSizes() end local function createButton_large(id, description, image, callback, special, front) - -- fast version local panel = optionsController.ui.onPanel.store storeAmount = storeAmount + 1 @@ -178,7 +184,7 @@ function toggleStore() if g_game.getFeature(GameIngameStore) then modules.game_store.toggle() -- cipsoft packets else - modules.game_shop.toggle() -- custom from v8 + modules.game_shop.toggle() -- custom end end diff --git a/modules/game_outfit/outfit.lua b/modules/game_outfit/outfit.lua index 3426e1594f..82aba9e451 100644 --- a/modules/game_outfit/outfit.lua +++ b/modules/game_outfit/outfit.lua @@ -1,8 +1,3 @@ -local opcodeSystem = { - enable = false, - id = 213 -} - local statesOutft ={ available = 0, store = 1, @@ -150,23 +145,6 @@ end local AppearanceData = {"preset", "outfit", "mount", "familiar", "wings", "aura", "effects", "shader", "healthBar", "title"} function init() - if opcodeSystem.enable then - ProtocolGame.registerExtendedOpcode(opcodeSystem.id, function(protocol, opcode, buffer) - local status, json_data = pcall(json.decode, buffer) - - if not status then - g_logger.error("[Crafting] JSON error: " .. buffer) - return false - end - - ServerData.auras = json_data.action - ServerData.wings = json_data.wings - ServerData.shaders = json_data.shader - ServerData.healthBars = json_data.HealthBar - ServerData.effects = json_data.effect - ServerData.title = json_data.title - end) - end connect(g_game, { onOpenOutfitWindow = create, onGameEnd = destroy @@ -174,9 +152,6 @@ function init() end function terminate() - if opcodeSystem.enable then - ProtocolGame.unregisterExtendedOpcode(opcodeSystem.id) - end disconnect(g_game, { onOpenOutfitWindow = create, onGameEnd = destroy @@ -1786,23 +1761,6 @@ function loadDefaultSettings() settings.currentPreset = 0 end -function sendAction(action, data) - local protocolGame = g_game.getProtocolGame() - - if data == nil then - data = {} - end - - if protocolGame then - protocolGame.sendExtendedJSONOpcode(protocolGame, opcodeSystem.id, { - action = action, - data = data - }) - end - - return -end - function accept() if g_game.getFeature(GamePlayerMounts) then local player = g_game.getLocalPlayer() @@ -1822,14 +1780,5 @@ function accept() end end g_game.changeOutfit(tempOutfit) - if opcodeSystem.enable then - sendAction("changeOutfit", { - wingsName = lastSelectWings, - auraName = lastSelectAura, - shaderName = lastSelectShader, - titleName = lastSelectTitle, - EffectName = lastSelectEffects - }) - end destroy() end diff --git a/modules/game_outfit/serverSIDE/if c++ (protocol)/c++.txt b/modules/game_outfit/serverSIDE/if c++ (protocol)/c++.txt deleted file mode 100644 index 81b3fc18bf..0000000000 --- a/modules/game_outfit/serverSIDE/if c++ (protocol)/c++.txt +++ /dev/null @@ -1,11 +0,0 @@ -Tfs 0.4: - -Tfs 1.5: -- https://github.com/kokekanon/forgottenserver-downgrade/pull/2 -- https://github.com/kokekanon/forgottenserver-downgrade/pull/7 -- https://github.com/kokekanon/forgottenserver-downgrade/pull/9 - -Tfs 1.4.2: -- https://github.com/kokekanon/TFS-1.4.2-Compatible-Aura-Effect-Wings-Shader-MEHAH/commit/77f80d505b01747a7c519e224d11c124de157a8f - -canary: diff --git a/modules/game_outfit/serverSIDE/if lua (opcode)/not yet.txt b/modules/game_outfit/serverSIDE/if lua (opcode)/not yet.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/modules/game_playerdeath/deathwindow.otui b/modules/game_playerdeath/deathwindow.otui index 4f185bf1d2..0f8a6060e5 100644 --- a/modules/game_playerdeath/deathwindow.otui +++ b/modules/game_playerdeath/deathwindow.otui @@ -1,4 +1,4 @@ -DeathWindow < MainWindow +MainWindow id: deathWindow !text: tr('You are dead') &baseWidth: 350 diff --git a/modules/game_playerdeath/playerdeath.lua b/modules/game_playerdeath/playerdeath.lua index 7a7ee08950..8fe6de23ce 100644 --- a/modules/game_playerdeath/playerdeath.lua +++ b/modules/game_playerdeath/playerdeath.lua @@ -17,23 +17,25 @@ local deathTexts = { } deathController = Controller:new() -deathController:setUI('deathwindow') function deathController:onInit() deathController:registerEvents(g_game, { onDeath = display, - onGameEnd = reset }) end function deathController:onTerminate() - reset() + deathController.ui = destroyWindows() end -function reset() - if deathController.ui then +function deathController:onGameEnd() + deathController.ui = destroyWindows() +end + +function destroyWindows() + if deathController.ui and not deathController.ui:isDestroyed() then deathController.ui:destroy() - deathController.ui = nil end + return nil end function display(deathType, penalty) @@ -52,12 +54,8 @@ function displayDeadMessage() end function openWindow(deathType, penalty) - if deathController.ui then - deathController.ui:destroy() - return - end - - deathController.ui = g_ui.createWidget('DeathWindow', rootWidget) + deathController.ui = destroyWindows() + deathController.ui = g_ui.displayUI('deathwindow', rootWidget) local textLabel = deathController.ui:getChildById('labelText') if deathType == DeathType.Regular then @@ -81,13 +79,11 @@ function openWindow(deathType, penalty) local okFunc = function() CharacterList.doLogin() - okButton:getParent():destroy() - deathController.ui = nil + deathController.ui = destroyWindows() end local cancelFunc = function() g_game.safeLogout() - cancelButton:getParent():destroy() - deathController.ui = nil + deathController.ui = destroyWindows() end deathController.ui.onEnter = okFunc @@ -102,10 +98,7 @@ function scheduleReconnect() return end deathController:scheduleEvent(function() - if deathController.ui then - deathController.ui:destroy() - deathController.ui = nil - end + deathController.ui = destroyWindows() g_game.cancelLogin() CharacterList.doLogin() end, 2000, 'scheduleAutoReconnect') diff --git a/modules/game_prey/prey.lua b/modules/game_prey/prey.lua index b7b230bcc6..47e727dfab 100644 --- a/modules/game_prey/prey.lua +++ b/modules/game_prey/prey.lua @@ -34,8 +34,8 @@ function bonusDescription(bonusType, bonusValue, bonusGrade) return 'XP bonus (' .. bonusGrade .. '/10)' elseif bonusType == PREY_BONUS_IMPROVED_LOOT then return 'Loot bonus (' .. bonusGrade .. '/10)' - elseif bonusType == PREY_BONUS_DAMAGE_BOOST then - return '-' + else + return 'Unknown bonus' end return 'Unknown bonus' end diff --git a/modules/game_quickloot/quickloot.lua b/modules/game_quickloot/quickloot.lua index 5ebcbb1646..e91e1824c3 100644 --- a/modules/game_quickloot/quickloot.lua +++ b/modules/game_quickloot/quickloot.lua @@ -51,9 +51,9 @@ function quickLootController:onGameStart() if not g_game.getFeature(GameThingQuickLoot) then return end - - QuickLoot.mouseGrabberWidget = g_ui.createWidget("UIWidget") - + if not QuickLoot.mouseGrabberWidget then + QuickLoot.mouseGrabberWidget = g_ui.createWidget("UIWidget") + end QuickLoot.mouseGrabberWidget:setVisible(false) QuickLoot.mouseGrabberWidget:setFocusable(false) diff --git a/modules/game_screenshot/game_screenshot.lua b/modules/game_screenshot/game_screenshot.lua index 09536df3ff..aa4b6367c2 100644 --- a/modules/game_screenshot/game_screenshot.lua +++ b/modules/game_screenshot/game_screenshot.lua @@ -98,9 +98,9 @@ function screenshotController:onGameStart() end function screenshotController:onGameEnd() - if g_game.getClientVersion() >= 1180 then - g_settings.set("onlyCaptureGameWindow",optionPanel:recursiveGetChildById("onlyCaptureGameWindow"):isChecked()) - g_settings.set("enableScreenshots",optionPanel:recursiveGetChildById("enableScreenshots"):isChecked()) + if g_game.getClientVersion() >= 1180 and optionPanel then + g_settings.set("onlyCaptureGameWindow", optionPanel:recursiveGetChildById("onlyCaptureGameWindow"):isChecked()) + g_settings.set("enableScreenshots", optionPanel:recursiveGetChildById("enableScreenshots"):isChecked()) destroyOptionsModule() end diff --git a/modules/game_shop/game_shop.lua b/modules/game_shop/game_shop.lua index 5a61aa3279..1350148886 100644 --- a/modules/game_shop/game_shop.lua +++ b/modules/game_shop/game_shop.lua @@ -169,7 +169,7 @@ function hideHistory() gameShopWindow:getChildById("history"):hide() end -local entriesPerPage = 26 +local entriesPerPage = 25 local currentPage = 1 local totalPages = 1 @@ -417,28 +417,31 @@ function showOffers(id) widget.categoryId = id local imagePanel = widget:getChildById("imagePanel") + local image = imagePanel:getChildById("image") + local categoryId = offersCache[i].categoryId + local item = imagePanel:getChildById("item") + local outfit = imagePanel:getChildById("outfit") + local mount = imagePanel:getChildById("mount") if type(offersCache[i].id) == "string" then - local image = imagePanel:getChildById("image") image:show() image:setImageSource("/game_shop/images/" .. offersCache[i].id) elseif type(offersCache[i].id) == "number" then - local categoryId = offersCache[i].categoryId widget.offerCategoryId = categoryId if categoryId == CATEGORY_ITEM then - local item = imagePanel:getChildById("item") item:show() item:setItemId(offersCache[i].id) widget:getChildById("count"):show() elseif categoryId == CATEGORY_OUTFIT then - local outfit = imagePanel:getChildById("outfit") currentOutfit.type = offersCache[i].id outfit:show() outfit:setOutfit(currentOutfit) elseif categoryId == CATEGORY_MOUNT then - local mount = imagePanel:getChildById("mount") mount:show() mount:setOutfit({type = offersCache[i].id}) + elseif categoryId == CATEGORY_EXTRAS then + item:show() + item:setItemId(offersCache[i].id) end end @@ -531,7 +534,7 @@ function updateDescription(self) image:setImageSource("/game_shop/images/" .. self.data.id) elseif type(self.data.id) == "number" then local categoryId = self.offerCategoryId or self.data.offerCategoryId - if categoryId == CATEGORY_ITEM then + if table.contains({CATEGORY_ITEM, CATEGORY_EXTRAS}, categoryId) then item:show() item:setItemId(self.data.id) elseif categoryId == CATEGORY_OUTFIT then diff --git a/modules/game_shop/serverSIDE/data/core/mounts.lua b/modules/game_shop/serverSIDE/data/core/mounts.lua new file mode 100644 index 0000000000..e6b656a807 --- /dev/null +++ b/modules/game_shop/serverSIDE/data/core/mounts.lua @@ -0,0 +1,29 @@ +function readFile() + local filePath = "data/XML/mounts.xml" + local file = io.open(filePath, "r") + if not file then + print("Error opening the file: " .. filePath) + return nil + end + local content = file:read("*a") + file:close() + return content +end + +function Game.getMountIdByClientId(clientId) + local content = readFile() + if not content then + return nil + end + + for id, clientid in content:gmatch(' getPoints(player) then + if amountSecond > getSecondCurrency(player) then return errorMsg(player, "You don't have enough points!") end end diff --git a/modules/gamelib/spells.lua b/modules/gamelib/spells.lua index a0cce9f781..e31b840fbd 100644 --- a/modules/gamelib/spells.lua +++ b/modules/gamelib/spells.lua @@ -2893,9 +2893,9 @@ SpellGroups = { [4] = 'Special', [5] = 'Crippling', [6] = 'Focus', - [7] = 'Ultimate Strikes', - [8] = 'Great Beams', - [9] = 'Bursts of Nature' + [7] = 'UltimateStrike', + [8] = 'GreatBeams', + [9] = 'BurstOfNature' } Spells = {}