From e6c9e78935bb7dbb1e116bcc8a71d6d31ab993b7 Mon Sep 17 00:00:00 2001 From: Jacek Wielemborek Date: Sat, 18 Jan 2014 15:09:26 +0100 Subject: [PATCH] Get rid of trailing whitespace. Commit generated by command: find -type f ! -path '*.git*' ! -path '*.png' ! -path '*.ico' ! -path \ '*.ogg' | xargs -I '{}' sed -i '{}' -e 's/\t*$//g' -e 's/ *$//g' --- data/locales/es.lua | 6 +- data/styles/30-minimap.otui | 4 +- modules/client/client.lua | 6 +- modules/client_entergame/characterlist.lua | 2 +- modules/client_entergame/characterlist.otui | 2 +- modules/client_entergame/entergame.lua | 2 +- modules/client_options/graphics.otui | 4 +- modules/client_serverlist/serverlist.lua | 2 +- modules/client_terminal/terminal.lua | 6 +- modules/corelib/table.lua | 6 +- modules/corelib/ui/uiminiwindow.lua | 2 +- modules/corelib/ui/uimovabletabbar.lua | 10 +- modules/corelib/ui/uiradiogroup.lua | 2 +- modules/game_battle/battle.lua | 36 ++-- modules/game_battle/battle.otui | 6 +- .../game_combatcontrols/combatcontrols.lua | 22 +-- .../game_combatcontrols/combatcontrols.otui | 4 +- modules/game_console/communicationwindow.otui | 34 ++-- modules/game_console/console.lua | 50 +++--- modules/game_console/console.otui | 2 +- modules/game_cooldown/cooldown.lua | 12 +- modules/game_cooldown/cooldown.otui | 8 +- modules/game_healthinfo/healthinfo.otui | 2 +- modules/game_hotkeys/hotkeys_manager.lua | 10 +- modules/game_interface/gameinterface.lua | 8 +- modules/game_interface/widgets/uigamemap.lua | 10 +- modules/game_market/market.lua | 14 +- modules/game_minimap/flagwindow.otui | 6 +- modules/game_modaldialog/modaldialog.lua | 12 +- modules/game_npctrade/npctrade.lua | 6 +- modules/game_outfit/outfit.lua | 2 +- modules/game_skills/skills.lua | 2 +- modules/game_spelllist/spelllist.lua | 78 ++++----- modules/game_viplist/editvip.otui | 2 +- modules/game_viplist/viplist.lua | 18 +- modules/gamelib/game.lua | 2 +- modules/gamelib/gamelib.otmod | 2 +- modules/gamelib/player.lua | 2 +- modules/gamelib/protocollogin.lua | 6 +- modules/gamelib/spells.lua | 154 +++++++++--------- modules/gamelib/ui/uicreaturebutton.lua | 8 +- modules/gamelib/ui/uiminimap.lua | 12 +- src/client/houses.h | 2 +- src/client/mapview.cpp | 2 +- src/client/minimap.cpp | 2 +- src/client/tile.cpp | 4 +- src/client/uiminimap.cpp | 2 +- src/framework/CMakeLists.txt | 2 +- src/framework/cmake/FindDirectX.cmake | 18 +- src/framework/cmake/FindPkgMacros.cmake | 2 +- src/framework/platform/win32platform.cpp | 2 +- src/framework/sound/soundmanager.cpp | 6 +- src/framework/stdext/shared_object.h | 2 +- src/framework/stdext/shared_ptr.h | 4 +- tools/tfs_extendedopcode.patch | 50 +++--- 55 files changed, 341 insertions(+), 341 deletions(-) diff --git a/data/locales/es.lua b/data/locales/es.lua index d8c99de0..cbfff372 100644 --- a/data/locales/es.lua +++ b/data/locales/es.lua @@ -6,7 +6,7 @@ locale = { name = "es", charset = "cp1252", languageName = "Español", - + translation = { ["1a) Offensive Name"] = "1a) Nombre ofensivo", ["1b) Invalid Name Format"] = "1b) Formato invalido para nombre", @@ -154,7 +154,7 @@ locale = { ["Hide spells for higher exp. levels"] = "Ocultar hechizos para niveles mas altos que tu experiencia.", ["Hide spells for other vocations"] = "Ocultar hechizos que sean para otra vocación", ["Hit Points"] = "Puntos de vida", - ["Hold left mouse button to navigate\nScroll mouse middle button to zoom\nRight mouse button to create map marks"] = "Mantenga presionado el botón derecho del ratón para navegar\nDezplaze la rueda central del ratón para ampliar\nbotón derecho del mouse para crear marcas del mapa", + ["Hold left mouse button to navigate\nScroll mouse middle button to zoom\nRight mouse button to create map marks"] = "Mantenga presionado el botón derecho del ratón para navegar\nDezplaze la rueda central del ratón para ampliar\nbotón derecho del mouse para crear marcas del mapa", ["Hotkeys"] = "Hotkeys", ["If you shut down the program, your character might stay in the game.\nClick on 'Logout' to ensure that you character leaves the game properly.\nClick on 'Exit' if you want to exit the program without logging out your character."] = "Si se cierra el programa, tu personaje puede permanecer en el juego.\nHaga clic en 'Salir' para asegurarse de que personaje deja el juego correctamente.\nHaga click en 'Salir' si desea salir del programa sin tener que salir de tu personaje.", ["Ignore"] = "Ignorar", @@ -374,5 +374,5 @@ locale = { ["Don't stretch or shrink Game Window"] = "No estirar o encoger Ventana de Juego" } } - + modules.client_locales.installLocale(locale) \ No newline at end of file diff --git a/data/styles/30-minimap.otui b/data/styles/30-minimap.otui index 3a2c9b9e..1bfa4c82 100644 --- a/data/styles/30-minimap.otui +++ b/data/styles/30-minimap.otui @@ -146,7 +146,7 @@ MinimapFlagWindow < MainWindow anchors.left: parent.left anchors.top: prev.bottom margin-top: 6 - margin-left: 0 + margin-left: 0 MinimapFlagCheckBox id: flag1 @@ -190,7 +190,7 @@ MinimapFlagWindow < MainWindow anchors.left: parent.left anchors.top: prev.bottom margin-top: 6 - margin-left: 0 + margin-left: 0 MinimapFlagCheckBox id: flag11 diff --git a/modules/client/client.lua b/modules/client/client.lua index 155f24f6..97ac544c 100644 --- a/modules/client/client.lua +++ b/modules/client/client.lua @@ -53,7 +53,7 @@ function startup() end function init() - connect(g_app, { onRun = startup, + connect(g_app, { onRun = startup, onExit = exit }) g_window.setMinimumSize({ width = 600, height = 480 }) @@ -94,11 +94,11 @@ function init() if not g_crypt.setMachineUUID(g_configs.get('uuid')) then g_configs.set('uuid', g_crypt.getMachineUUID()) g_configs.save() - end + end end function terminate() - disconnect(g_app, { onRun = startup, + disconnect(g_app, { onRun = startup, onExit = exit }) -- save window configs g_settings.set('window-size', g_window.getUnmaximizedSize()) diff --git a/modules/client_entergame/characterlist.lua b/modules/client_entergame/characterlist.lua index fd771d96..79648077 100644 --- a/modules/client_entergame/characterlist.lua +++ b/modules/client_entergame/characterlist.lua @@ -243,7 +243,7 @@ function CharacterList.create(characters, account, otui) else accountStatusLabel:setText(tr('Free Account')) end - + if account.premDays > 0 and account.premDays <= 7 then accountStatusLabel:setOn(true) else diff --git a/modules/client_entergame/characterlist.otui b/modules/client_entergame/characterlist.otui index 42e8f907..745e819b 100644 --- a/modules/client_entergame/characterlist.otui +++ b/modules/client_entergame/characterlist.otui @@ -81,7 +81,7 @@ MainWindow anchors.right: parent.right anchors.bottom: next.top margin-bottom: 1 - + Label id: accountStatusLabel !text: tr('Free Account') diff --git a/modules/client_entergame/entergame.lua b/modules/client_entergame/entergame.lua index 6fee2f48..9015f198 100644 --- a/modules/client_entergame/entergame.lua +++ b/modules/client_entergame/entergame.lua @@ -225,7 +225,7 @@ function EnterGame.doLogin() g_settings.set('host', G.host) g_settings.set('port', G.port) - g_settings.set('client-version', clientVersion) + g_settings.set('client-version', clientVersion) protocolLogin = ProtocolLogin.create() protocolLogin.onLoginError = onError diff --git a/modules/client_options/graphics.otui b/modules/client_options/graphics.otui index 56a919b3..e754690c 100644 --- a/modules/client_options/graphics.otui +++ b/modules/client_options/graphics.otui @@ -39,10 +39,10 @@ Panel id: fullscreen !text: tr('Fullscreen') tooltip: Ctrl+Shift+F - + OptionCheckBox id: dontStretchShrink - !text: tr('Don\'t stretch/shrink Game Window') + !text: tr('Don\'t stretch/shrink Game Window') Label id: backgroundFrameRateLabel diff --git a/modules/client_serverlist/serverlist.lua b/modules/client_serverlist/serverlist.lua index 20a7f023..2f084548 100644 --- a/modules/client_serverlist/serverlist.lua +++ b/modules/client_serverlist/serverlist.lua @@ -50,7 +50,7 @@ function ServerList.add(host, port, protocol, load) end local widget = g_ui.createWidget('ServerWidget', serverTextList) widget:setId(host) - + if not load then servers[host] = { port = port, diff --git a/modules/client_terminal/terminal.lua b/modules/client_terminal/terminal.lua index df42daf3..6022fd6c 100644 --- a/modules/client_terminal/terminal.lua +++ b/modules/client_terminal/terminal.lua @@ -131,11 +131,11 @@ function init() commandTextEdit = terminalWindow:getChildById('commandTextEdit') g_keyboard.bindKeyPress('Up', function() navigateCommand(1) end, commandTextEdit) g_keyboard.bindKeyPress('Down', function() navigateCommand(-1) end, commandTextEdit) - g_keyboard.bindKeyPress('Ctrl+C', - function() + g_keyboard.bindKeyPress('Ctrl+C', + function() if commandTextEdit:hasSelection() or not terminalSelectText:hasSelection() then return false end g_window.setClipboardText(terminalSelectText:getSelection()) - return true + return true end, commandTextEdit) g_keyboard.bindKeyDown('Tab', completeCommand, commandTextEdit) g_keyboard.bindKeyDown('Enter', doCommand, commandTextEdit) diff --git a/modules/corelib/table.lua b/modules/corelib/table.lua index d9a56293..044a0c4b 100644 --- a/modules/corelib/table.lua +++ b/modules/corelib/table.lua @@ -55,7 +55,7 @@ end function table.find(t, value, lowercase) for k,v in pairs(t) do - if lowercase and type(value) == 'string' and type(v) == 'string' then + if lowercase and type(value) == 'string' and type(v) == 'string' then if v:lower() == value:lower() then return k end end if v == value then return k end @@ -64,7 +64,7 @@ end function table.findbykey(t, key, lowercase) for k,v in pairs(t) do - if lowercase and type(key) == 'string' and type(k) == 'string' then + if lowercase and type(key) == 'string' and type(k) == 'string' then if k:lower() == key:lower() then return v end end if k == key then return v end @@ -149,7 +149,7 @@ function table.size(t) for i, n in pairs(t) do size = size + 1 end - + return size end diff --git a/modules/corelib/ui/uiminiwindow.lua b/modules/corelib/ui/uiminiwindow.lua index 785a52be..c46511d9 100644 --- a/modules/corelib/ui/uiminiwindow.lua +++ b/modules/corelib/ui/uiminiwindow.lua @@ -81,7 +81,7 @@ function UIMiniWindow:setup() self:minimize() end end - + self:getChildById('miniwindowTopBar').onDoubleClick = function() if self:isOn() then diff --git a/modules/corelib/ui/uimovabletabbar.lua b/modules/corelib/ui/uimovabletabbar.lua index b60a1c77..081fc43b 100644 --- a/modules/corelib/ui/uimovabletabbar.lua +++ b/modules/corelib/ui/uimovabletabbar.lua @@ -8,7 +8,7 @@ end local function updateMargins(tabBar, ignored) if #tabBar.tabs == 0 then return end - + local currentMargin = 0 for i = 1, #tabBar.tabs do tabBar.tabs[i]:setMarginLeft(currentMargin) @@ -279,17 +279,17 @@ end function UIMoveableTabBar:moveTab(tab, units) local index = table.find(self.tabs, tab) if index == nil then return end - + local focus = false if self.currentTab == tab then self:selectPrevTab() focus = true end - + table.remove(self.tabs, index) - + local newIndex = math.min(#self.tabs+1, math.max(index + units, 1)) - table.insert(self.tabs, newIndex, tab) + table.insert(self.tabs, newIndex, tab) if focus then self:selectTab(tab) end updateMargins(self) return newIndex diff --git a/modules/corelib/ui/uiradiogroup.lua b/modules/corelib/ui/uiradiogroup.lua index fbf13784..b3f5bc70 100644 --- a/modules/corelib/ui/uiradiogroup.lua +++ b/modules/corelib/ui/uiradiogroup.lua @@ -47,7 +47,7 @@ end function UIRadioGroup:clearSelected() if not self.selectedWidget then return end - + local previousSelectedWidget = self.selectedWidget self.selectedWidget:setChecked(false) self.selectedWidget = nil diff --git a/modules/game_battle/battle.lua b/modules/game_battle/battle.lua index b391d57e..6ea6ef7d 100644 --- a/modules/game_battle/battle.lua +++ b/modules/game_battle/battle.lua @@ -32,11 +32,11 @@ function init() filterPanel = battleWindow:recursiveGetChildById('filterPanel') toggleFilterButton = battleWindow:recursiveGetChildById('toggleFilterButton') - + if isHidingFilters() then hideFilterPanel() end - + sortTypeBox = battleWindow:recursiveGetChildById('sortTypeBox') sortOrderBox = battleWindow:recursiveGetChildById('sortOrderBox') hidePlayersButton = battleWindow:recursiveGetChildById('hidePlayers') @@ -63,7 +63,7 @@ function init() sortOrderBox:addOption('Desc.', 'desc') sortOrderBox:setCurrentOptionByData(getSortOrder()) sortOrderBox.onOptionChange = onChangeSortOrder - + connect(Creature, { onSkullChange = updateCreatureSkull, onEmblemChange = updateCreatureEmblem, @@ -73,7 +73,7 @@ function init() onAppear = onCreatureAppear, onDisappear = onCreatureDisappear }) - + connect(LocalPlayer, { onPositionChange = onCreaturePositionChange }) @@ -95,7 +95,7 @@ function terminate() battleWindow:destroy() mouseWidget:destroy() - disconnect(Creature, { + disconnect(Creature, { onSkullChange = updateCreatureSkull, onEmblemChange = updateCreatureEmblem, onOutfitChange = onCreatureOutfitChange, @@ -108,7 +108,7 @@ function terminate() disconnect(LocalPlayer, { onPositionChange = onCreaturePositionChange }) - + disconnect(g_game, { onAttackingCreatureChange = onAttack, onFollowingCreatureChange = onFollow, @@ -296,17 +296,17 @@ function onCreaturePositionChange(creature, newPos, oldPos) for id, creatureButton in pairs(battleButtonsByCreaturesList) do table.insert(distanceList, {distance = getDistanceBetween(newPos, creatureButton.creature:getPosition()), widget = creatureButton}) end - + if isSortAsc() then table.sort(distanceList, function(a, b) return a.distance < b.distance end) else - table.sort(distanceList, function(a, b) return a.distance > b.distance end) + table.sort(distanceList, function(a, b) return a.distance > b.distance end) end - + for i = 1, #distanceList do battlePanel:moveChildToIndex(distanceList[i].widget, i) end - end + end for id, creatureButton in pairs(battleButtonsByCreaturesList) do addCreature(creatureButton.creature) @@ -356,7 +356,7 @@ function addCreature(creature) if not creatureAgeList[creatureId] then creatureAgeList[creatureId] = os.time() end - + if not battleButton then battleButton = g_ui.createWidget('BattleButton') battleButton:setup(creature) @@ -373,14 +373,14 @@ function addCreature(creature) if creature == g_game.getFollowingCreature() then onFollow(creature) end - + local inserted = false local nameLower = creature:getName():lower() local healthPercent = creature:getHealthPercent() local playerPosition = g_game.getLocalPlayer():getPosition() local distance = getDistanceBetween(playerPosition, creature:getPosition()) local age = creatureAgeList[creatureId] - + local childCount = battlePanel:getChildCount() for i = 1, childCount do local child = battlePanel:getChildByIndex(i) @@ -412,9 +412,9 @@ function addCreature(creature) break elseif healthPercent == childHealth then equal = true - end + end end - + -- If any other sort type is selected and values are equal, sort it by name also if getSortType() == 'name' or equal then local length = math.min(childName:len(), nameLower:len()) @@ -425,7 +425,7 @@ function addCreature(creature) break elseif (nameLower:byte(j) > childName:byte(j) and isSortAsc()) or (nameLower:byte(j) < childName:byte(j) and isSortDesc()) then break - elseif j == nameLower:len() and isSortAsc() then + elseif j == nameLower:len() and isSortAsc() then battlePanel:insertChild(i, battleButton) inserted = true elseif j == childName:len() and isSortDesc() then @@ -439,7 +439,7 @@ function addCreature(creature) break end end - + -- Insert at the end if no other place is found if not inserted then battlePanel:insertChild(childCount + 1, battleButton) @@ -478,7 +478,7 @@ function onBattleButtonMouseRelease(self, mousePosition, mouseButton) mouseWidget.cancelNextRelease = false return false end - if ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) + if ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) or (g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then mouseWidget.cancelNextRelease = true g_game.look(self.creature) diff --git a/modules/game_battle/battle.otui b/modules/game_battle/battle.otui index 1dd0e2b4..64ed4ec6 100644 --- a/modules/game_battle/battle.otui +++ b/modules/game_battle/battle.otui @@ -92,7 +92,7 @@ MiniWindow height: 20 width: 128 margin-top: 6 - + ComboBox id: sortTypeBox width: 74 @@ -107,7 +107,7 @@ MiniWindow anchors.top: parent.top anchors.left: prev.right margin-left: 4 - + Panel height: 18 anchors.top: prev.bottom @@ -132,7 +132,7 @@ MiniWindow anchors.right: miniwindowScrollBar.left margin-right: 1 margin-top: 11 - + MiniWindowContents anchors.top: prev.bottom margin-top: 6 diff --git a/modules/game_combatcontrols/combatcontrols.lua b/modules/game_combatcontrols/combatcontrols.lua index 10c54479..85b4d02f 100644 --- a/modules/game_combatcontrols/combatcontrols.lua +++ b/modules/game_combatcontrols/combatcontrols.lua @@ -23,15 +23,15 @@ function init() fightOffensiveBox = combatControlsWindow:recursiveGetChildById('fightOffensiveBox') fightBalancedBox = combatControlsWindow:recursiveGetChildById('fightBalancedBox') fightDefensiveBox = combatControlsWindow:recursiveGetChildById('fightDefensiveBox') - + chaseModeButton = combatControlsWindow:recursiveGetChildById('chaseModeBox') safeFightButton = combatControlsWindow:recursiveGetChildById('safeFightBox') - + mountButton = combatControlsWindow:recursiveGetChildById('mountButton') mountButton.onClick = onMountButtonClick - + pvpModesPanel = combatControlsWindow:recursiveGetChildById('pvpModesPanel') - + whiteDoveBox = combatControlsWindow:recursiveGetChildById('whiteDoveBox') whiteHandBox = combatControlsWindow:recursiveGetChildById('whiteHandBox') yellowHandBox = combatControlsWindow:recursiveGetChildById('yellowHandBox') @@ -41,7 +41,7 @@ function init() fightModeRadioGroup:addWidget(fightOffensiveBox) fightModeRadioGroup:addWidget(fightBalancedBox) fightModeRadioGroup:addWidget(fightDefensiveBox) - + pvpModeRadioGroup = UIRadioGroup.create() pvpModeRadioGroup:addWidget(whiteDoveBox) pvpModeRadioGroup:addWidget(whiteHandBox) @@ -62,7 +62,7 @@ function init() onWalk = check, onAutoWalk = check }) - + connect(LocalPlayer, { onOutfitChange = onOutfitChange }) if g_game.isOnline() then @@ -92,7 +92,7 @@ function terminate() onWalk = check, onAutoWalk = check }) - + disconnect(LocalPlayer, { onOutfitChange = onOutfitChange }) end @@ -111,7 +111,7 @@ function update() local safeFight = g_game.isSafeFight() safeFightButton:setChecked(not safeFight) - + if g_game.getFeature(GamePVPMode) then local pvpMode = g_game.getPVPMode() local pvpWidget = getPVPBoxByMode(pvpMode) @@ -153,7 +153,7 @@ function online() else mountButton:setVisible(false) end - + if g_game.getFeature(GamePVPMode) then pvpModesPanel:setVisible(true) combatControlsWindow:setHeight(combatControlsWindow.extendedControlsHeight) @@ -232,7 +232,7 @@ function onSetPVPMode(self, selectedPVPButton) if selectedPVPButton == nil then return end - + local buttonId = selectedPVPButton:getId() local pvpMode = PVPWhiteDove if buttonId == 'whiteDoveBox' then @@ -263,7 +263,7 @@ function onOutfitChange(localPlayer, outfit, oldOutfit) if outfit.mount == oldOutfit.mount then return end - + mountButton:setChecked(outfit.mount ~= nil and outfit.mount > 0) end diff --git a/modules/game_combatcontrols/combatcontrols.otui b/modules/game_combatcontrols/combatcontrols.otui index 57e92da2..e769954f 100644 --- a/modules/game_combatcontrols/combatcontrols.otui +++ b/modules/game_combatcontrols/combatcontrols.otui @@ -16,7 +16,7 @@ ChaseModeBox < CombatBox image-source: /images/game/combatmodes/chasemode SafeFightBox < CombatBox image-source: /images/game/combatmodes/safefight - + MountButton < CombatBox image-source: /images/game/combatmodes/mount @@ -73,7 +73,7 @@ MiniWindow anchors.right: parent.right anchors.bottom: parent.bottom height: 20 - + WhiteDoveBox id: whiteDoveBox anchors.left: parent.left diff --git a/modules/game_console/communicationwindow.otui b/modules/game_console/communicationwindow.otui index 751323ee..c5e44c05 100644 --- a/modules/game_console/communicationwindow.otui +++ b/modules/game_console/communicationwindow.otui @@ -33,13 +33,13 @@ MainWindow anchors.left: parent.left anchors.top: parent.top width: 180 - + Label !text: tr('Ignored Players:') anchors.left: parent.left anchors.top: prev.bottom margin-top: 10 - + TextList id: ignoreList vertical-scrollbar: ignoreListScrollBar @@ -51,14 +51,14 @@ MainWindow margin-top: 3 padding: 1 focusable: false - + TextEdit id: ignoreNameEdit anchors.top: prev.bottom anchors.left: parent.left width: 110 margin-top: 5 - + Button id: buttonIgnoreAdd !text: tr('Add') @@ -67,7 +67,7 @@ MainWindow margin-left: 5 anchors.top: prev.top anchors.left: prev.right - + Button id: buttonIgnoreRemove !text: tr('Remove') @@ -90,7 +90,7 @@ MainWindow anchors.top: prev.bottom width: 180 margin-top: 5 - + CheckBox id: checkboxIgnoreYelling !text: tr('Ignore Yelling') @@ -98,7 +98,7 @@ MainWindow anchors.top: prev.bottom width: 180 margin-top: 5 - + CheckBox id: checkboxUseWhiteList !text: tr('Activate whitelist') @@ -106,13 +106,13 @@ MainWindow anchors.left: ignoreList.right margin-left: 20 width: 180 - + Label !text: tr('Allowed Players:') anchors.top: prev.bottom anchors.left: prev.left margin-top: 10 - + TextList id: whiteList vertical-scrollbar: whiteListScrollBar @@ -124,14 +124,14 @@ MainWindow margin-top: 3 padding: 1 focusable: false - + TextEdit id: whitelistNameEdit anchors.top: prev.bottom anchors.left: prev.left width: 110 margin-top: 5 - + Button id: buttonWhitelistAdd !text: tr('Add') @@ -140,7 +140,7 @@ MainWindow margin-left: 5 anchors.top: prev.top anchors.left: prev.right - + Button id: buttonWhitelistRemove !text: tr('Remove') @@ -149,7 +149,7 @@ MainWindow margin-left: 5 anchors.top: prev.top anchors.left: prev.right - + Label !text: tr('Global whitelist settings') anchors.left: whiteList.left @@ -163,17 +163,17 @@ MainWindow anchors.top: prev.bottom width: 180 margin-top: 5 - + Panel anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right height: 30 - + Panel size: 160 30 anchors.horizontalCenter: parent.horizontalCenter - + Button id: buttonSave !text: tr('Save') @@ -196,7 +196,7 @@ MainWindow anchors.right: ignoreList.right step: 14 pixels-scroll: true - + VerticalScrollBar id: whiteListScrollBar anchors.top: whiteList.top diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 35c9ffbb..924c4bf5 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -175,7 +175,7 @@ end function disableChat() local gameInterface = modules.game_interface - + consoleTextEdit:setVisible(false) consoleTextEdit:setText("") @@ -220,11 +220,11 @@ function terminate() g_keyboard.unbindKeyDown('Ctrl+H') saveCommunicationSettings() - + if channelsWindow then channelsWindow:destroy() end - + if communicationWindow then communicationWindow:destroy() end @@ -232,7 +232,7 @@ function terminate() if violationWindow then violationWindow:destroy() end - + consolePanel:destroy() ownPrivateName = nil @@ -363,7 +363,7 @@ function addTab(name, focus) end function removeTab(tab) - if type(tab) == 'string' then + if type(tab) == 'string' then tab = consoleTabBar:getTab(tab) end @@ -824,7 +824,7 @@ function onTalk(name, level, mode, message, channelId, creaturePos) end if ignoreNpcMessages and mode == MessageModes.NpcFrom then return end - + speaktype = SpeakTypes[mode] if not speaktype then @@ -833,10 +833,10 @@ function onTalk(name, level, mode, message, channelId, creaturePos) end local localPlayer = g_game.getLocalPlayer() - if name ~= g_game.getCharacterName() - and isUsingIgnoreList() + if name ~= g_game.getCharacterName() + and isUsingIgnoreList() and not(isUsingWhiteList()) or (isUsingWhiteList() and not(isWhitelisted(name)) and not(isAllowingVIPs() and localPlayer:hasVip(name))) then - + if mode == MessageModes.Yell and isIgnoringYelling() then return elseif speaktype.private and isIgnoringPrivate() and mode ~= MessageModes.NpcFrom then @@ -1042,16 +1042,16 @@ end function saveCommunicationSettings() local tmpIgnoreList = {} local ignoredPlayers = getIgnoredPlayers() - for i = 1, #ignoredPlayers do + for i = 1, #ignoredPlayers do table.insert(tmpIgnoreList, ignoredPlayers[i]) end local tmpWhiteList = {} local whitelistedPlayers = getWhitelistedPlayers() - for i = 1, #whitelistedPlayers do + for i = 1, #whitelistedPlayers do table.insert(tmpWhiteList, whitelistedPlayers[i]) end - + g_settings.set('UseIgnoreList', communicationSettings.useIgnoreList) g_settings.set('UseWhiteList', communicationSettings.useWhiteList) g_settings.set('IgnorePrivateMessages', communicationSettings.privateMessages) @@ -1119,7 +1119,7 @@ function onClickIgnoreButton() local ignoreListPanel = communicationWindow:getChildById('ignoreList') local whiteListPanel = communicationWindow:getChildById('whiteList') communicationWindow.onDestroy = function() communicationWindow = nil end - + local useIgnoreListBox = communicationWindow:getChildById('checkboxUseIgnoreList') useIgnoreListBox:setChecked(communicationSettings.useIgnoreList) local useWhiteListBox = communicationWindow:getChildById('checkboxUseWhiteList') @@ -1128,8 +1128,8 @@ function onClickIgnoreButton() local removeIgnoreButton = communicationWindow:getChildById('buttonIgnoreRemove') removeIgnoreButton:disable() ignoreListPanel.onChildFocusChange = function() removeIgnoreButton:enable() end - removeIgnoreButton.onClick = function() - local selection = ignoreListPanel:getFocusedChild() + removeIgnoreButton.onClick = function() + local selection = ignoreListPanel:getFocusedChild() if selection then ignoreListPanel:removeChild(selection) selection:destroy() @@ -1140,19 +1140,19 @@ function onClickIgnoreButton() local removeWhitelistButton = communicationWindow:getChildById('buttonWhitelistRemove') removeWhitelistButton:disable() whiteListPanel.onChildFocusChange = function() removeWhitelistButton:enable() end - removeWhitelistButton.onClick = function() - local selection = whiteListPanel:getFocusedChild() + removeWhitelistButton.onClick = function() + local selection = whiteListPanel:getFocusedChild() if selection then whiteListPanel:removeChild(selection) selection:destroy() end removeWhitelistButton:disable() end - + local newlyIgnoredPlayers = {} local addIgnoreName = communicationWindow:getChildById('ignoreNameEdit') local addIgnoreButton = communicationWindow:getChildById('buttonIgnoreAdd') - local addIgnoreFunction = function() + local addIgnoreFunction = function() local newEntry = addIgnoreName:getText() if newEntry == '' then return end if table.find(getIgnoredPlayers(), newEntry) then return end @@ -1186,14 +1186,14 @@ function onClickIgnoreButton() addIgnoreFunction() end end - + local ignorePrivateMessageBox = communicationWindow:getChildById('checkboxIgnorePrivateMessages') ignorePrivateMessageBox:setChecked(communicationSettings.privateMessages) local ignoreYellingBox = communicationWindow:getChildById('checkboxIgnoreYelling') ignoreYellingBox:setChecked(communicationSettings.yelling) local allowVIPsBox = communicationWindow:getChildById('checkboxAllowVIPs') allowVIPsBox:setChecked(communicationSettings.allowVIPs) - + local saveButton = communicationWindow:recursiveGetChildById('buttonSave') saveButton.onClick = function() communicationSettings.ignoredPlayers = {} @@ -1205,7 +1205,7 @@ function onClickIgnoreButton() for i = 1, whiteListPanel:getChildCount() do addWhitelistedPlayer(whiteListPanel:getChildByIndex(i):getText()) end - + communicationSettings.useIgnoreList = useIgnoreListBox:isChecked() communicationSettings.useWhiteList = useWhiteListBox:isChecked() communicationSettings.yelling = ignoreYellingBox:isChecked() @@ -1213,18 +1213,18 @@ function onClickIgnoreButton() communicationSettings.allowVIPs = allowVIPsBox:isChecked() communicationWindow:destroy() end - + local cancelButton = communicationWindow:recursiveGetChildById('buttonCancel') cancelButton.onClick = function() communicationWindow:destroy() end - + local ignoredPlayers = getIgnoredPlayers() for i = 1, #ignoredPlayers do local label = g_ui.createWidget('IgnoreListLabel', ignoreListPanel) label:setText(ignoredPlayers[i]) end - + local whitelistedPlayers = getWhitelistedPlayers() for i = 1, #whitelistedPlayers do local label = g_ui.createWidget('WhiteListLabel', whiteListPanel) diff --git a/modules/game_console/console.otui b/modules/game_console/console.otui index 218bf234..d0d5581c 100644 --- a/modules/game_console/console.otui +++ b/modules/game_console/console.otui @@ -133,7 +133,7 @@ Panel margin-right: 5 margin-top: 6 @onClick: onClickIgnoreButton() - + Panel id: consoleContentPanel anchors.top: prev.bottom diff --git a/modules/game_cooldown/cooldown.lua b/modules/game_cooldown/cooldown.lua index 460f9ae5..f583967d 100644 --- a/modules/game_cooldown/cooldown.lua +++ b/modules/game_cooldown/cooldown.lua @@ -20,8 +20,8 @@ function init() cooldownWindow = g_ui.loadUI('cooldown', modules.game_interface.getRightPanel()) cooldownWindow:disableResize() - cooldownWindow:setup() - + cooldownWindow:setup() + contentsPanel = cooldownWindow:getChildById('contentsPanel') cooldownPanel = contentsPanel:getChildById('cooldownPanel') @@ -47,10 +47,10 @@ end function loadIcon(iconId) local spell, profile, spellName = Spells.getSpellByIcon(iconId) if not spellName then return end - + clientIconId = Spells.getClientId(spellName) if not clientIconId then return end - + local icon = cooldownPanel:getChildById(iconId) if not icon then icon = g_ui.createWidget('SpellIcon') @@ -109,7 +109,7 @@ function turnOffCooldown(progressRect) progressRect.icon:setOn(false) progressRect.icon = nil end - + -- create particles --[[local particle = g_ui.createWidget('GroupCooldownParticles', progressRect) particle:fill('parent') @@ -130,7 +130,7 @@ end function updateCooldown(progressRect, duration) progressRect:setPercent(progressRect:getPercent() + 10000/duration) - + if progressRect:getPercent() < 100 then removeEvent(progressRect.event) progressRect.event = scheduleEvent(function() progressRect.callback[ProgressCallback.update]() end, 100) diff --git a/modules/game_cooldown/cooldown.otui b/modules/game_cooldown/cooldown.otui index c67165d6..2377c8c1 100644 --- a/modules/game_cooldown/cooldown.otui +++ b/modules/game_cooldown/cooldown.otui @@ -6,7 +6,7 @@ SpellGroupIcon < UIWidget margin-top: 3 SpellIcon < UIWidget - size: 24 24 + size: 24 24 image-size: 24 24 focusable: false @@ -20,7 +20,7 @@ SpellProgressRect < UIProgressRect GroupCooldownParticles < UIParticles effect: groupcooldown-effect - + MiniWindow id: cooldownWindow !text: tr('Spell Cooldowns') @@ -28,7 +28,7 @@ MiniWindow icon: /images/topbuttons/cooldowns @onClose: modules.game_cooldown.onMiniWindowClose() &save: true - + MiniWindowContents SpellGroupIcon id: groupIconAttack @@ -97,4 +97,4 @@ MiniWindow anchors.left: parent.left anchors.right: parent.right background-color: #ffffff11 - + diff --git a/modules/game_healthinfo/healthinfo.otui b/modules/game_healthinfo/healthinfo.otui index 12e09be2..b18cf23a 100644 --- a/modules/game_healthinfo/healthinfo.otui +++ b/modules/game_healthinfo/healthinfo.otui @@ -14,7 +14,7 @@ ManaBar < ProgressBar anchors.right: parent.right margin: 1 margin-top: 3 - + ExperienceBar < ProgressBar id: experienceBar background-color: #B6E866 diff --git a/modules/game_hotkeys/hotkeys_manager.lua b/modules/game_hotkeys/hotkeys_manager.lua index 186b4e1a..d76c59c8 100644 --- a/modules/game_hotkeys/hotkeys_manager.lua +++ b/modules/game_hotkeys/hotkeys_manager.lua @@ -72,7 +72,7 @@ function init() g_keyboard.bindKeyPress('Down', function() currentHotkeys:focusNextChild(KeyboardFocusReason) end, hotkeysWindow) g_keyboard.bindKeyPress('Up', function() currentHotkeys:focusPreviousChild(KeyboardFocusReason) end, hotkeysWindow) - connect(g_game, { + connect(g_game, { onGameStart = online, onGameEnd = offline }) @@ -386,7 +386,7 @@ function doKeyCombo(keyCombo) local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1) if item then g_game.use(item) - end + end else g_game.useInventoryItem(hotKey.itemId) end @@ -395,7 +395,7 @@ function doKeyCombo(keyCombo) local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1) if item then g_game.useWith(item, g_game.getLocalPlayer()) - end + end else g_game.useInventoryItemWith(hotKey.itemId, g_game.getLocalPlayer()) end @@ -418,7 +418,7 @@ function doKeyCombo(keyCombo) local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1) if item then g_game.useWith(item, attackingCreature) - end + end else g_game.useInventoryItemWith(hotKey.itemId, attackingCreature) end @@ -426,7 +426,7 @@ function doKeyCombo(keyCombo) local item = Item.create(hotKey.itemId) if g_game.getProtocolVersion() < 780 or hotKey.subType then local tmpItem = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1) - if not tmpItem then return true end + if not tmpItem then return true end item = tmpItem end modules.game_interface.startUseWith(item) diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index 57c7bf3e..ab9795f2 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -42,7 +42,7 @@ function init() gameBottomPanel = gameRootPanel:getChildById('gameBottomPanel') connect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange }) - logoutButton = modules.client_topmenu.addLeftButton('logoutButton', tr('Exit'), + logoutButton = modules.client_topmenu.addLeftButton('logoutButton', tr('Exit'), '/images/topbuttons/logout', tryLogout, true) setupViewMode(0) @@ -158,7 +158,7 @@ end function hide() disconnect(g_app, { onClose = tryExit }) logoutButton:setTooltip(tr('Exit')) - + if logoutWindow then logoutWindow:destroy() logoutWindow = nil @@ -235,7 +235,7 @@ function tryLogout(prompt) if not g_game.isConnectionOk() then msg = 'Your connection is failing, if you logout now your character will be still online, do you want to force logout?' - yesCallback = function() + yesCallback = function() g_game.forceLogout() if logoutWindow then logoutWindow:destroy() @@ -486,7 +486,7 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing) else menu:addOption(tr('Stop Attack'), function() g_game.cancelAttack() end, shortcut) end - + if g_game.getFollowingCreature() ~= creatureThing then menu:addOption(tr('Follow'), function() g_game.follow(creatureThing) end) else diff --git a/modules/game_interface/widgets/uigamemap.lua b/modules/game_interface/widgets/uigamemap.lua index 57b3d7ab..3ab9c39d 100644 --- a/modules/game_interface/widgets/uigamemap.lua +++ b/modules/game_interface/widgets/uigamemap.lua @@ -60,9 +60,9 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton) if not self.allowNextRelease then return true end - + local autoWalkPos = self:getPosition(mousePosition) - + -- happens when clicking outside of map boundaries if not autoWalkPos then return false end @@ -73,7 +73,7 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton) autoWalkPos.y = autoWalkPos.y + dz autoWalkPos.z = localPlayerPos.z end - + local lookThing local useThing local creatureThing @@ -85,8 +85,8 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton) lookThing = tile:getTopLookThing() useThing = tile:getTopUseThing() creatureThing = tile:getTopCreature() - end - + end + local autoWalkTile = g_map.getTile(autoWalkPos) if autoWalkTile then attackCreature = autoWalkTile:getTopCreature() diff --git a/modules/game_market/market.lua b/modules/game_market/market.lua index 05d6b39f..a03aa32b 100644 --- a/modules/game_market/market.lua +++ b/modules/game_market/market.lua @@ -1,6 +1,6 @@ --[[ Finalizing Market: - Note: Feel free to work on any area and submit + Note: Feel free to work on any area and submit it as a pull request from your git fork. BeniS's Skype: benjiz69 @@ -11,7 +11,7 @@ - Offer History * Clean up the interface building - - Add a new market interface file to handle building? + - Add a new market interface file to handle building? * Add offer table column ordering. - Player Name, Amount, Total Price, Peice Price and Ends At @@ -251,7 +251,7 @@ local function updateOffers(offers) -- clear existing offer data buyOfferTable:clearData() sellOfferTable:clearData() - + sellButton:setEnabled(false) buyButton:setEnabled(false) @@ -431,7 +431,7 @@ local function openAmountWindow(callback, type, actionText) widget:setText(tostring(value*selectedOffer[type]:getPrice())..'gp') itembox:setText(tostring(value)) end - + local okButton = amountWindow:getChildById('buttonOk') if actionText ~= '' then okButton:setText(actionText) @@ -814,7 +814,7 @@ function Market.enableCreateOffer(enable) local prevAmountButton = marketOffersPanel:recursiveGetChildById('prevAmountButton') local nextAmountButton = marketOffersPanel:recursiveGetChildById('nextAmountButton') - + prevAmountButton:setEnabled(enable) nextAmountButton:setEnabled(enable) end @@ -1076,7 +1076,7 @@ function Market.onMarketEnter(depotItems, offers, balance, vocation) Market.clearSelectedItem() updateBalance(balance) - + information.totalOffers = offers local player = g_game.getLocalPlayer() if player then @@ -1101,7 +1101,7 @@ function Market.onMarketEnter(depotItems, offers, balance, vocation) else Market.refreshItemsWidget() end - + if table.empty(currentItems) then Market.loadMarketItems(MarketCategory.First) end diff --git a/modules/game_minimap/flagwindow.otui b/modules/game_minimap/flagwindow.otui index c83ccc0e..c0fac4a3 100644 --- a/modules/game_minimap/flagwindow.otui +++ b/modules/game_minimap/flagwindow.otui @@ -8,7 +8,7 @@ FlagButton < CheckBox icon-size: 11 11 icon-clip: 0 0 11 11 icon-offset: 2 4 - text: + text: $!checked: image-clip: 26 0 26 26 @@ -54,7 +54,7 @@ FlagWindow < MainWindow anchors.left: parent.left anchors.top: prev.bottom margin-top: 6 - margin-left: 0 + margin-left: 0 FlagButton id: flag2 @@ -116,7 +116,7 @@ FlagWindow < MainWindow anchors.left: parent.left anchors.top: prev.bottom margin-top: 6 - margin-left: 0 + margin-left: 0 FlagButton id: flag12 diff --git a/modules/game_modaldialog/modaldialog.lua b/modules/game_modaldialog/modaldialog.lua index d39ba98f..aab82b37 100644 --- a/modules/game_modaldialog/modaldialog.lua +++ b/modules/game_modaldialog/modaldialog.lua @@ -31,15 +31,15 @@ function onModalDialog(id, title, message, buttons, enterButton, escapeButton, c end modalDialog = g_ui.createWidget('ModalDialog', rootWidget) - + local messageLabel = modalDialog:getChildById('messageLabel') local choiceList = modalDialog:getChildById('choiceList') local choiceScrollbar = modalDialog:getChildById('choiceScrollBar') local buttonList = modalDialog:getChildById('buttonList') - + modalDialog:setText(title) messageLabel:setText(message) - + local horizontalPadding = modalDialog:getPaddingLeft() + modalDialog:getPaddingRight() modalDialog:setWidth(math.min(modalDialog.maximumWidth, math.max(messageLabel:getWidth(), modalDialog.minimumWidth))) messageLabel:setWidth(math.min(modalDialog.maximumWidth, math.max(messageLabel:getWidth(), modalDialog.minimumWidth)) - horizontalPadding) @@ -48,7 +48,7 @@ function onModalDialog(id, title, message, buttons, enterButton, escapeButton, c for i = 1, #choices do local choiceId = choices[i][1] local choiceName = choices[i][2] - + local label = g_ui.createWidget('ChoiceListLabel', choiceList) label.choiceId = choiceId label:setText(choiceName) @@ -99,7 +99,7 @@ function onModalDialog(id, title, message, buttons, enterButton, escapeButton, c g_game.answerModalDialog(id, enterButton, choice) destroyDialog() end - + local escapeFunc = function() local focusedChoice = choiceList:getFocusedChild() local choice = 0xFF @@ -111,7 +111,7 @@ function onModalDialog(id, title, message, buttons, enterButton, escapeButton, c end choiceList.onDoubleClick = enterFunc - + modalDialog.onEnter = enterFunc modalDialog.onEscape = escapeFunc end \ No newline at end of file diff --git a/modules/game_npctrade/npctrade.lua b/modules/game_npctrade/npctrade.lua index d04e22a3..a8d9acb6 100644 --- a/modules/game_npctrade/npctrade.lua +++ b/modules/game_npctrade/npctrade.lua @@ -180,7 +180,7 @@ function itemPopup(self, mousePosition, mouseButton) menu:addOption(tr('Look'), function() return g_game.inspectNpcTrade(self:getItem()) end) menu:display(mousePosition) return true - elseif ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) + elseif ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) or (g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then cancelNextRelease = true g_game.inspectNpcTrade(self:getItem()) @@ -438,7 +438,7 @@ function onPlayerGoods(money, items) playerItems[id] = playerItems[id] + item[2] end end - + refreshPlayerGoods() end @@ -480,7 +480,7 @@ end function checkSellAllTooltip() sellAllButton:setEnabled(true) sellAllButton:removeTooltip() - + local total = 0 local info = '' local first = true diff --git a/modules/game_outfit/outfit.lua b/modules/game_outfit/outfit.lua index 039cb3f1..b9eab509 100644 --- a/modules/game_outfit/outfit.lua +++ b/modules/game_outfit/outfit.lua @@ -50,7 +50,7 @@ function create(creatureOutfit, outfitList, creatureMount, mountList) if outfitWindow and not outfitWindow:isHidden() then return end - + outfitCreature = creatureOutfit mountCreature = creatureMount outfits = outfitList diff --git a/modules/game_skills/skills.lua b/modules/game_skills/skills.lua index 1e0f065f..29c6de1f 100644 --- a/modules/game_skills/skills.lua +++ b/modules/game_skills/skills.lua @@ -233,7 +233,7 @@ end function checkExpSpeed() local player = g_game.getLocalPlayer() if not player then return end - + local currentExp = player:getExperience() local currentTime = g_clock.seconds() if player.lastExps ~= nil then diff --git a/modules/game_spelllist/spelllist.lua b/modules/game_spelllist/spelllist.lua index eaa96e3c..968164d1 100644 --- a/modules/game_spelllist/spelllist.lua +++ b/modules/game_spelllist/spelllist.lua @@ -53,8 +53,8 @@ FILTER_GROUP_SUPPORT = 3 local filters = { level = false, vocation = false, - - vocationId = FILTER_VOCATION_ANY, + + vocationId = FILTER_VOCATION_ANY, premium = FILTER_PREMIUM_ANY, groupId = FILTER_GROUP_ANY } @@ -65,7 +65,7 @@ end function setSpelllistProfile(name) if SpelllistProfile == name then return end - + if SpelllistSettings[name] and SpellInfo[name] then local oldProfile = SpelllistProfile SpelllistProfile = name @@ -95,13 +95,13 @@ end function init() connect(g_game, { onGameStart = online, onGameEnd = offline }) - + spelllistWindow = g_ui.displayUI('spelllist', modules.game_interface.getRightPanel()) spelllistWindow:hide() - + spelllistButton = modules.client_topmenu.addRightGameToggleButton('spelllistButton', tr('Spell List'), '/images/topbuttons/spelllist', toggle) spelllistButton:setOn(false) - + nameValueLabel = spelllistWindow:getChildById('labelNameValue') formulaValueLabel = spelllistWindow:getChildById('labelFormulaValue') vocationValueLabel = spelllistWindow:getChildById('labelVocationValue') @@ -112,18 +112,18 @@ function init() manaValueLabel = spelllistWindow:getChildById('labelManaValue') premiumValueLabel = spelllistWindow:getChildById('labelPremiumValue') descriptionValueLabel = spelllistWindow:getChildById('labelDescriptionValue') - + vocationBoxAny = spelllistWindow:getChildById('vocationBoxAny') vocationBoxSorcerer = spelllistWindow:getChildById('vocationBoxSorcerer') vocationBoxDruid = spelllistWindow:getChildById('vocationBoxDruid') vocationBoxPaladin = spelllistWindow:getChildById('vocationBoxPaladin') vocationBoxKnight = spelllistWindow:getChildById('vocationBoxKnight') - + groupBoxAny = spelllistWindow:getChildById('groupBoxAny') groupBoxAttack = spelllistWindow:getChildById('groupBoxAttack') groupBoxHealing = spelllistWindow:getChildById('groupBoxHealing') groupBoxSupport = spelllistWindow:getChildById('groupBoxSupport') - + premiumBoxAny = spelllistWindow:getChildById('premiumBoxAny') premiumBoxYes = spelllistWindow:getChildById('premiumBoxYes') premiumBoxNo = spelllistWindow:getChildById('premiumBoxNo') @@ -134,32 +134,32 @@ function init() vocationRadioGroup:addWidget(vocationBoxDruid) vocationRadioGroup:addWidget(vocationBoxPaladin) vocationRadioGroup:addWidget(vocationBoxKnight) - + groupRadioGroup = UIRadioGroup.create() groupRadioGroup:addWidget(groupBoxAny) groupRadioGroup:addWidget(groupBoxAttack) groupRadioGroup:addWidget(groupBoxHealing) groupRadioGroup:addWidget(groupBoxSupport) - + premiumRadioGroup = UIRadioGroup.create() premiumRadioGroup:addWidget(premiumBoxAny) premiumRadioGroup:addWidget(premiumBoxYes) premiumRadioGroup:addWidget(premiumBoxNo) - + premiumRadioGroup:selectWidget(premiumBoxAny) vocationRadioGroup:selectWidget(vocationBoxAny) groupRadioGroup:selectWidget(groupBoxAny) - + vocationRadioGroup.onSelectionChange = toggleFilter groupRadioGroup.onSelectionChange = toggleFilter premiumRadioGroup.onSelectionChange = toggleFilter - - spellList = spelllistWindow:getChildById('spellList') + + spellList = spelllistWindow:getChildById('spellList') g_keyboard.bindKeyPress('Down', function() spellList:focusNextChild(KeyboardFocusReason) end, spelllistWindow) g_keyboard.bindKeyPress('Up', function() spellList:focusPreviousChild(KeyboardFocusReason) end, spelllistWindow) - - initialiseSpelllist() + + initialiseSpelllist() resizeWindow() if g_game.isOnline() then @@ -174,11 +174,11 @@ function terminate() disconnect(spellList, { onChildFocusChange = function(self, focusedChild) if focusedChild == nil then return end updateSpellInformation(focusedChild) - end }) + end }) spelllistWindow:destroy() spelllistButton:destroy() - + vocationRadioGroup:destroy() groupRadioGroup:destroy() premiumRadioGroup:destroy() @@ -188,21 +188,21 @@ function initialiseSpelllist() for i = 1, #SpelllistSettings[SpelllistProfile].spellOrder do local spell = SpelllistSettings[SpelllistProfile].spellOrder[i] local info = SpellInfo[SpelllistProfile][spell] - + local tmpLabel = g_ui.createWidget('SpellListLabel', spellList) tmpLabel:setId(spell) tmpLabel:setText(spell .. '\n\'' .. info.words .. '\'') tmpLabel:setPhantom(false) - + local iconId = tonumber(info.icon) if not iconId and SpellIcons[info.icon] then iconId = SpellIcons[info.icon][1] end if not(iconId) then - perror('Spell icon \'' .. info.icon .. '\' not found.') + perror('Spell icon \'' .. info.icon .. '\' not found.') end - + tmpLabel:setHeight(SpelllistSettings[SpelllistProfile].iconSize.height + 4) tmpLabel:setTextOffset(topoint((SpelllistSettings[SpelllistProfile].iconSize.width + 10) .. ' ' .. (SpelllistSettings[SpelllistProfile].iconSize.height - 32)/2 + 3)) tmpLabel:setImageSource(SpelllistSettings[SpelllistProfile].iconFile) @@ -210,11 +210,11 @@ function initialiseSpelllist() tmpLabel:setImageSize(tosize(SpelllistSettings[SpelllistProfile].iconSize.width .. ' ' .. SpelllistSettings[SpelllistProfile].iconSize.height)) tmpLabel.onClick = updateSpellInformation end - + connect(spellList, { onChildFocusChange = function(self, focusedChild) if focusedChild == nil then return end updateSpellInformation(focusedChild) - end }) + end }) end function changeSpelllistProfile(oldProfile) @@ -222,10 +222,10 @@ function changeSpelllistProfile(oldProfile) for i = 1, #SpelllistSettings[oldProfile].spellOrder do local spell = SpelllistSettings[oldProfile].spellOrder[i] local tmpLabel = spellList:getChildById(spell) - + tmpLabel:destroy() end - + -- Create new spelllist and ajust window initialiseSpelllist() setOptions() @@ -238,7 +238,7 @@ function updateSpelllist() local spell = SpelllistSettings[SpelllistProfile].spellOrder[i] local info = SpellInfo[SpelllistProfile][spell] local tmpLabel = spellList:getChildById(spell) - + local localPlayer = g_game.getLocalPlayer() if (not(filters.level) or info.level <= localPlayer:getLevel()) and (not(filters.vocation) or table.find(info.vocations, localPlayer:getVocation())) and (filters.vocationId == FILTER_VOCATION_ANY or table.find(info.vocations, filters.vocationId) or table.find(info.vocations, filters.vocationId+4)) and (filters.groupId == FILTER_GROUP_ANY or info.group[filters.groupId]) and (filters.premium == FILTER_PREMIUM_ANY or (info.premium and filters.premium == FILTER_PREMIUM_YES) or (not(info.premium) and filters.premium == FILTER_PREMIUM_NO)) then tmpLabel:setVisible(true) @@ -250,7 +250,7 @@ end function updateSpellInformation(widget) local spell = widget:getId() - + local name = '' local formula = '' local vocation = '' @@ -261,10 +261,10 @@ function updateSpellInformation(widget) local mana = '' local premium = '' local description = '' - + if SpellInfo[SpelllistProfile][spell] then local info = SpellInfo[SpelllistProfile][spell] - + name = spell formula = info.words @@ -274,7 +274,7 @@ function updateSpellInformation(widget) vocation = vocation .. (vocation:len() == 0 and '' or ', ') .. VocationNames[vocationId] end end - + cooldown = (info.exhaustion / 1000) .. 's' for groupId, groupName in ipairs(SpellGroups) do if info.group[groupId] then @@ -282,14 +282,14 @@ function updateSpellInformation(widget) cooldown = cooldown .. ' / ' .. (info.group[groupId] / 1000) .. 's' end end - + type = info.type level = info.level mana = info.mana .. ' / ' .. info.soul premium = (info.premium and 'yes' or 'no') description = info.description or '-' end - + nameValueLabel:setText(name) formulaValueLabel:setText(formula) vocationValueLabel:setText(vocation) @@ -356,7 +356,7 @@ function toggleFilter(widget, selectedWidget) widget:setOn(filters.vocation) end end - + updateSpelllist() end @@ -372,16 +372,16 @@ function resetWindow() -- Resetting filters filters.level = false filters.vocation = false - + local buttonFilterLevel = spelllistWindow:getChildById('buttonFilterLevel') buttonFilterLevel:setOn(filters.level) - + local buttonFilterVocation = spelllistWindow:getChildById('buttonFilterVocation') buttonFilterVocation:setOn(filters.vocation) - + vocationRadioGroup:selectWidget(vocationBoxAny) groupRadioGroup:selectWidget(groupBoxAny) premiumRadioGroup:selectWidget(premiumBoxAny) - + updateSpelllist() end diff --git a/modules/game_viplist/editvip.otui b/modules/game_viplist/editvip.otui index 30e9260a..096489f6 100644 --- a/modules/game_viplist/editvip.otui +++ b/modules/game_viplist/editvip.otui @@ -99,7 +99,7 @@ MainWindow IconButton id: icon6 icon-clip: 72 0 12 12 - + IconButton id: icon7 icon-clip: 84 0 12 12 diff --git a/modules/game_viplist/viplist.lua b/modules/game_viplist/viplist.lua index a3915e56..213318fb 100644 --- a/modules/game_viplist/viplist.lua +++ b/modules/game_viplist/viplist.lua @@ -289,7 +289,7 @@ function onAddVip(id, name, state, description, iconId, notify) local nameLower = name:lower() local childrenCount = vipList:getChildCount() - + for i=1,childrenCount do local child = vipList:getChildByIndex(i) if (state == VipState.Online and child.vipState ~= VipState.Online and getSortedBy() == 'status') @@ -300,7 +300,7 @@ function onAddVip(id, name, state, description, iconId, notify) if (((state ~= VipState.Online and child.vipState ~= VipState.Online) or (state == VipState.Online and child.vipState == VipState.Online)) and getSortedBy() == 'status') or (label.iconId == child.iconId and getSortedBy() == 'type') or getSortedBy() == 'name' then - + local childText = child:getText():lower() local length = math.min(childText:len(), nameLower:len()) @@ -351,11 +351,11 @@ function onVipListMousePress(widget, mousePos, mouseButton) else menu:addOption(tr('Show Offline'), function() hideOffline(false) end) end - + if not(getSortedBy() == 'name') then menu:addOption(tr('Sort by name'), function() sortBy('name') end) end - + if not(getSortedBy() == 'status') then menu:addOption(tr('Sort by status'), function() sortBy('status') end) end @@ -380,7 +380,7 @@ function onVipListLabelMousePress(widget, mousePos, mouseButton) menu:addOption(tr('Edit %s', widget:getText()), function() if widget then createEditWindow(widget) end end) menu:addOption(tr('Remove %s', widget:getText()), function() if widget then removeVip(widget) end end) menu:addSeparator() - menu:addOption(tr('Copy Name'), function() g_window.setClipboardText(widget:getText()) end) + menu:addOption(tr('Copy Name'), function() g_window.setClipboardText(widget:getText()) end) if modules.game_console.getOwnPrivateTab() then menu:addSeparator() @@ -393,15 +393,15 @@ function onVipListLabelMousePress(widget, mousePos, mouseButton) else menu:addOption(tr('Show Offline'), function() hideOffline(false) end) end - + if not(getSortedBy() == 'name') then menu:addOption(tr('Sort by name'), function() sortBy('name') end) end - + if not(getSortedBy() == 'status') then menu:addOption(tr('Sort by status'), function() sortBy('status') end) - end - + end + menu:display(mousePos) return true diff --git a/modules/gamelib/game.lua b/modules/gamelib/game.lua index 4a7ce40c..0b96349c 100644 --- a/modules/gamelib/game.lua +++ b/modules/gamelib/game.lua @@ -14,7 +14,7 @@ function g_game.findPlayerItem(itemId, subType) end end end - + return g_game.findItemInContainers(itemId, subType) end diff --git a/modules/gamelib/gamelib.otmod b/modules/gamelib/gamelib.otmod index 65faf065..0d130168 100644 --- a/modules/gamelib/gamelib.otmod +++ b/modules/gamelib/gamelib.otmod @@ -19,5 +19,5 @@ Module dofile 'market' dofile 'thing' dofile 'spells' - + dofiles 'ui' diff --git a/modules/gamelib/player.lua b/modules/gamelib/player.lua index 533d30e5..5df5492f 100644 --- a/modules/gamelib/player.lua +++ b/modules/gamelib/player.lua @@ -154,7 +154,7 @@ function Player:hasState(_state, states) for i = 1, 32 do local pow = math.pow(2, i-1) if pow > states then break end - + local states = bit32.band(states, pow) if states == _state then return true diff --git a/modules/gamelib/protocollogin.lua b/modules/gamelib/protocollogin.lua index 043b39b7..dbea0533 100644 --- a/modules/gamelib/protocollogin.lua +++ b/modules/gamelib/protocollogin.lua @@ -57,7 +57,7 @@ function ProtocolLogin:sendLoginPacket() msg:addU32(xteaKey[3]) msg:addU32(xteaKey[4]) end - + if g_game.getFeature(GameAccountNames) then msg:addString(self.accountName) else @@ -77,7 +77,7 @@ function ProtocolLogin:sendLoginPacket() if g_game.getProtocolVersion() >= 770 then msg:encryptRsa() end - + if g_game.getFeature(GameProtocolChecksum) then self:enableChecksum() end @@ -137,7 +137,7 @@ function ProtocolLogin:parseCharacterList(msg) local worldsCount = msg:getU8() for i=1, worldsCount do local world = {} - local worldId = msg:getU8() + local worldId = msg:getU8() world.worldName = msg:getString() world.worldIp = msg:getString() world.worldPort = msg:getU16() diff --git a/modules/gamelib/spells.lua b/modules/gamelib/spells.lua index 2b620e06..74adff2e 100644 --- a/modules/gamelib/spells.lua +++ b/modules/gamelib/spells.lua @@ -1,14 +1,14 @@ SpelllistSettings = { - ['Default'] = { + ['Default'] = { iconFile = '/images/game/spells/defaultspells', iconSize = {width = 32, height = 32}, spellListWidth = 210, spellWindowWidth = 550, spellOrder = {'Animate Dead', 'Annihilation', 'Avalanche', 'Berserk', 'Blood Rage', 'Brutal Strike', 'Cancel Invisibility', 'Challenge', 'Chameleon', 'Charge', 'Conjure Arrow', 'Conjure Bolt', 'Conjure Explosive Arrow', 'Conjure Piercing Bolt', 'Conjure Poisoned Arrow', 'Conjure Power Bolt', 'Conjure Sniper Arrow', 'Convince Creature', 'Creature Illusion', 'Cure Bleeding', 'Cure Burning', 'Cure Curse', 'Cure Electrification', 'Cure Poison', 'Cure Poison Rune', 'Curse', 'Death Strike', 'Desintegrate', 'Destroy Field', 'Divine Caldera', 'Divine Healing', 'Divine Missile', 'Electrify', 'Enchant Party', 'Enchant Spear', 'Enchant Staff', 'Energy Beam', 'Energy Field', 'Energy Strike', 'Energy Wall', 'Energy Wave', 'Energybomb', 'Envenom', 'Eternal Winter', 'Ethereal Spear', 'Explosion', 'Fierce Berserk', 'Find Person', 'Fire Field', 'Fire Wall', 'Fire Wave', 'Fireball', 'Firebomb', 'Flame Strike', 'Food', 'Front Sweep', 'Great Energy Beam', 'Great Fireball', 'Great Light', 'Groundshaker', 'Haste', 'Heal Friend', 'Heal Party', 'Heavy Magic Missile', 'Hells Core', 'Holy Flash', 'Holy Missile', 'Ice Strike', 'Ice Wave', 'Icicle', 'Ignite', 'Inflict Wound', 'Intense Healing', 'Intense Healing Rune', 'Intense Recovery', 'Intense Wound Cleansing', 'Invisibility', 'Levitate', 'Light', 'Light Healing', 'Light Magic Missile', 'Lightning', 'Magic Rope', 'Magic Shield', 'Magic Wall', 'Mass Healing', 'Paralyze', 'Physical Strike', 'Poison Bomb', 'Poison Field', 'Poison Wall', 'Protect Party', 'Protector', 'Rage of the Skies', 'Recovery', 'Salvation', 'Sharpshooter', 'Soulfire', 'Stalagmite', 'Stone Shower', 'Strong Energy Strike', 'Strong Ethereal Spear', 'Strong Flame Strike', 'Strong Haste', 'Strong Ice Strike', 'Strong Ice Wave', 'Strong Terra Strike', 'Sudden Death', 'Summon Creature', 'Swift Foot', 'Terra Strike', 'Terra Wave', 'Thunderstorm', 'Train Party', 'Ultimate Energy Strike', 'Ultimate Flame Strike', 'Ultimate Healing', 'Ultimate Healing Rune', 'Ultimate Ice Strike', 'Ultimate Light', 'Ultimate Terra Strike', 'Whirlwind Throw', 'Wild Growth', 'Wound Cleansing', 'Wrath of Nature'} }--[[, - - ['Sample'] = { - iconFile = '/images/game/spells/sample', + + ['Sample'] = { + iconFile = '/images/game/spells/sample', iconSize = {width = 64, height = 64}, spellOrder = {'Critical Strike', 'Firefly', 'Fire Breath', 'Moonglaives', 'Wind Walk'} }]] @@ -142,7 +142,7 @@ SpellInfo = { ['Thunderstorm'] = {id = 117, words = 'adori mas vis', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'thunderstorm', mana = 430, level = 28, soul = 3, group = {[3] = 2000}, vocations = {1, 5}}, ['Holy Missile'] = {id = 130, words = 'adori san', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'holymissile', mana = 350, level = 27, soul = 3, group = {[3] = 2000}, vocations = {3, 7}} }, - + ['Sample'] = { ['Wind Walk'] = {id = 1, words = 'windwalk', description = 'Run at enormous speed.', exhaustion = 2000, premium = false, type = 'Instant', icon = 1, mana = 50, level = 10, soul = 0, group = {[3] = 2000}, vocations = {1, 2}}, ['Fire Breath'] = {id = 2, words = 'firebreath', description = 'A strong firewave.', exhaustion = 2000, premium = false, type = 'Instant', icon = 2, mana = 350, level = 27, soul = 0, group = {[1] = 2000}, vocations = {4, 8}}, @@ -209,89 +209,89 @@ SpellIcons = { ['sniperarrow'] = {112, 108}, ['whirlwindthrow'] = {19, 107}, ['groundshaker'] = {25, 106}, - ['fierceberserk'] = {22, 105}, + ['fierceberserk'] = {22, 105}, -- [[ 96 - 104 Unknown ]] - ['powerbolt'] = {108, 95}, - ['wildgrowth'] = {61, 94}, - ['challenge'] = {97, 93}, - ['enchantstaff'] = {103, 92}, - ['poisonbomb'] = {70, 91}, - ['cancelinvisibility'] = {95, 90}, - ['flamestrike'] = {26, 89}, - ['energystrike'] = {29, 88}, - ['deathstrike'] = {38, 87}, - ['magicwall'] = {72, 86}, - ['healfriend'] = {8, 84}, - ['animatedead'] = {93, 83}, - ['masshealing'] = {9, 82}, - ['levitate'] = {125, 81}, - ['berserk'] = {21, 80}, - ['conjurebolt'] = {107, 79}, - ['desintegrate'] = {88, 78}, - ['stalagmite'] = {66, 77}, - ['magicrope'] = {105, 76}, - ['ultimatelight'] = {115, 75}, + ['powerbolt'] = {108, 95}, + ['wildgrowth'] = {61, 94}, + ['challenge'] = {97, 93}, + ['enchantstaff'] = {103, 92}, + ['poisonbomb'] = {70, 91}, + ['cancelinvisibility'] = {95, 90}, + ['flamestrike'] = {26, 89}, + ['energystrike'] = {29, 88}, + ['deathstrike'] = {38, 87}, + ['magicwall'] = {72, 86}, + ['healfriend'] = {8, 84}, + ['animatedead'] = {93, 83}, + ['masshealing'] = {9, 82}, + ['levitate'] = {125, 81}, + ['berserk'] = {21, 80}, + ['conjurebolt'] = {107, 79}, + ['desintegrate'] = {88, 78}, + ['stalagmite'] = {66, 77}, + ['magicrope'] = {105, 76}, + ['ultimatelight'] = {115, 75}, -- [[ 71 - 64 TFS House Commands ]] -- [[ 63 - 70 Unknown ]] - ['annihilation'] = {24, 62}, - ['brutalstrike'] = {23, 61}, + ['annihilation'] = {24, 62}, + ['brutalstrike'] = {23, 61}, -- [[ 60 Unknown ]] ['frontsweep'] = {20, 59}, -- [[ 58 Unknown ]] - ['strongetherealspear'] = {59, 57}, - ['wrathofnature'] = {48, 56}, - ['energybomb'] = {86, 55}, - ['paralyze'] = {71, 54}, + ['strongetherealspear'] = {59, 57}, + ['wrathofnature'] = {48, 56}, + ['energybomb'] = {86, 55}, + ['paralyze'] = {71, 54}, -- [[ 53 Unknown ]] -- [[ 52 TFS Retrieve Friend ]] - ['conjurearrow'] = {106, 51}, - ['soulfire'] = {67, 50}, - ['explosivearrow'] = {109, 49}, - ['poisonedarrow'] = {111, 48}, + ['conjurearrow'] = {106, 51}, + ['soulfire'] = {67, 50}, + ['explosivearrow'] = {109, 49}, + ['poisonedarrow'] = {111, 48}, -- [[ 46 / 47 Unknown ]] - ['invisible'] = {94, 45}, - ['magicshield'] = {124, 44}, - ['strongicewave'] = {46, 43}, - ['food'] = {99, 42}, + ['invisible'] = {94, 45}, + ['magicshield'] = {124, 44}, + ['strongicewave'] = {46, 43}, + ['food'] = {99, 42}, -- [[ 40 / 41 Unknown ]] - ['stronghaste'] = {102, 39}, - ['creatureillusion'] = {100, 38}, + ['stronghaste'] = {102, 39}, + ['creatureillusion'] = {100, 38}, -- [[ 37 TFS Move ]] - ['salvation'] = {60, 36}, - -- [[ 34 / 35 Unknown ]] - ['energywall'] = {84, 33}, - ['poisonwall'] = {68, 32}, - ['antidote'] = {10, 31}, - ['destroyfield'] = {87, 30}, - ['curepoison'] = {10, 29}, - ['firewall'] = {80, 28}, - ['energyfield'] = {85, 27}, - ['poisonfield'] = {69, 26}, - ['firefield'] = {81, 25}, - ['hellscore'] = {49, 24}, - ['greatenergybeam'] = {42, 23}, - ['energybeam'] = {41, 22}, - ['suddendeath'] = {64, 21}, - ['findperson'] = {114, 20}, - ['firewave'] = {44, 19}, - ['explosion'] = {83, 18}, - ['firebomb'] = {82, 17}, - ['greatfireball'] = {78, 16}, - ['fireball'] = {79, 15}, - ['chameleon'] = {91, 14}, - ['energywave'] = {43, 13}, - ['convincecreature'] = {90, 12}, - ['greatlight'] = {116, 11}, - ['light'] = {117, 10}, - ['summoncreature'] = {118, 9}, - ['heavymagicmissile'] = {77, 8}, - ['lightmagicmissile'] = {73, 7}, - ['haste'] = {101, 6}, - ['ultimatehealingrune'] = {62, 5}, - ['intensehealingrune'] = {74, 4}, - ['ultimatehealing'] = {1, 3}, - ['intensehealing'] = {7, 2}, - ['lighthealing'] = {6, 1} + ['salvation'] = {60, 36}, + -- [[ 34 / 35 Unknown ]] + ['energywall'] = {84, 33}, + ['poisonwall'] = {68, 32}, + ['antidote'] = {10, 31}, + ['destroyfield'] = {87, 30}, + ['curepoison'] = {10, 29}, + ['firewall'] = {80, 28}, + ['energyfield'] = {85, 27}, + ['poisonfield'] = {69, 26}, + ['firefield'] = {81, 25}, + ['hellscore'] = {49, 24}, + ['greatenergybeam'] = {42, 23}, + ['energybeam'] = {41, 22}, + ['suddendeath'] = {64, 21}, + ['findperson'] = {114, 20}, + ['firewave'] = {44, 19}, + ['explosion'] = {83, 18}, + ['firebomb'] = {82, 17}, + ['greatfireball'] = {78, 16}, + ['fireball'] = {79, 15}, + ['chameleon'] = {91, 14}, + ['energywave'] = {43, 13}, + ['convincecreature'] = {90, 12}, + ['greatlight'] = {116, 11}, + ['light'] = {117, 10}, + ['summoncreature'] = {118, 9}, + ['heavymagicmissile'] = {77, 8}, + ['lightmagicmissile'] = {73, 7}, + ['haste'] = {101, 6}, + ['ultimatehealingrune'] = {62, 5}, + ['intensehealingrune'] = {74, 4}, + ['ultimatehealing'] = {1, 3}, + ['intensehealing'] = {7, 2}, + ['lighthealing'] = {6, 1} } VocationNames = { diff --git a/modules/gamelib/ui/uicreaturebutton.lua b/modules/gamelib/ui/uicreaturebutton.lua index 1977ef93..37cc7b48 100644 --- a/modules/gamelib/ui/uicreaturebutton.lua +++ b/modules/gamelib/ui/uicreaturebutton.lua @@ -43,17 +43,17 @@ end function UICreatureButton:setup(creature) self.creature = creature - + local creatureWidget = self:getChildById('creature') local labelWidget = self:getChildById('label') local lifeBarWidget = self:getChildById('lifeBar') - + labelWidget:setText(creature:getName()) creatureWidget:setCreature(creature) - + self:setId('CreatureButton_' .. creature:getName():gsub('%s','_')) self:setLifeBarPercent(creature:getHealthPercent()) - + self:updateSkull(creature:getSkull()) self:updateEmblem(creature:getEmblem()) end diff --git a/modules/gamelib/ui/uiminimap.lua b/modules/gamelib/ui/uiminimap.lua index 5c945d61..1a3a4f2b 100644 --- a/modules/gamelib/ui/uiminimap.lua +++ b/modules/gamelib/ui/uiminimap.lua @@ -273,18 +273,18 @@ function UIMinimap:createFlagWindow(pos) flagRadioGroup:selectWidget(flagRadioGroup:getFirstWidget()) - local successFunc = function() + local successFunc = function() self:addFlag(pos, flagRadioGroup:getSelectedWidget().icon, description:getText()) self:destroyFlagWindow() end - - local cancelFunc = function() - self:destroyFlagWindow() + + local cancelFunc = function() + self:destroyFlagWindow() end - + okButton.onClick = successFunc cancelButton.onClick = cancelFunc - + self.flagWindow.onEnter = successFunc self.flagWindow.onEscape = cancelFunc diff --git a/src/client/houses.h b/src/client/houses.h index 2e32c291..19fd436a 100644 --- a/src/client/houses.h +++ b/src/client/houses.h @@ -100,7 +100,7 @@ public: HouseList getHouseList() { return m_houses; } HouseList filterHouses(uint32 townId); -private: +private: HouseList m_houses; protected: diff --git a/src/client/mapview.cpp b/src/client/mapview.cpp index 85c60676..7ed5529e 100644 --- a/src/client/mapview.cpp +++ b/src/client/mapview.cpp @@ -87,7 +87,7 @@ void MapView::draw(const Rect& rect) int drawFlags = 0; // First branch: // This is unlikely to be false because a lot of us - // don't wanna hear their GPU fan while playing a + // don't wanna hear their GPU fan while playing a // 2D game. // // Second & Third branch: diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index 8de14518..3149053a 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -412,7 +412,7 @@ void Minimap::saveOtmm(const std::string& fileName) fin->write(compressBuffer.data(), len); } } - + // end of file Position invalidPos; fin->addU16(invalidPos.x); diff --git a/src/client/tile.cpp b/src/client/tile.cpp index 2083151b..3a93395e 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -161,7 +161,7 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView * if(drawFlags & Otc::DrawOnTop) for(const ThingPtr& thing : m_things) if(thing->isOnTop()) - thing->draw(dest, scaleFactor, animate, lightView); + thing->draw(dest, scaleFactor, animate, lightView); // draw translucent light (for tiles beneath holes) if(hasTranslucentLight() && lightView) { @@ -482,7 +482,7 @@ ThingPtr Tile::getTopMultiUseThing() if(thing->isForceUse()) return thing; } - + for(uint i = 0; i < m_things.size(); ++i) { ThingPtr thing = m_things[i]; if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop()) { diff --git a/src/client/uiminimap.cpp b/src/client/uiminimap.cpp index 43d10e67..42f4bbc6 100644 --- a/src/client/uiminimap.cpp +++ b/src/client/uiminimap.cpp @@ -65,7 +65,7 @@ bool UIMinimap::setZoom(int zoom) else m_scale = 1; m_layout->update(); - + onZoomChange(zoom, oldZoom); return true; } diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 55a91ec9..924dad91 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -237,7 +237,7 @@ set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${LUA_INCLUDE_DIR} ${PHYSFS_INCLUDE_DIR} ${OpenSSL_INCLUDE_DIR} - ${framework_INCLUDE_DIRS} + ${framework_INCLUDE_DIRS} ) if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") diff --git a/src/framework/cmake/FindDirectX.cmake b/src/framework/cmake/FindDirectX.cmake index 10e3dc9e..15c2ef04 100644 --- a/src/framework/cmake/FindDirectX.cmake +++ b/src/framework/cmake/FindDirectX.cmake @@ -18,15 +18,15 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK include(FindPkgMacros) findpkg_begin(DirectX) - + # Get path, convert backslashes as ${ENV_DXSDK_DIR} getenv_path(DXSDK_DIR) getenv_path(DIRECTX_HOME) getenv_path(DIRECTX_ROOT) getenv_path(DIRECTX_BASE) - + # construct search paths - set(DirectX_PREFIX_PATH + set(DirectX_PREFIX_PATH "${DXSDK_DIR}" "${ENV_DXSDK_DIR}" "${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}" "${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}" @@ -43,7 +43,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK DirectX_LIBRARY DirectX_INCLUDE_DIR ) - + find_path(DirectX_INCLUDE_DIR NAMES d3d9.h HINTS ${DirectX_INC_SEARCH_PATH}) # dlls are in DirectX_ROOT_DIR/Developer Runtime/x64|x86 # lib files are in DirectX_ROOT_DIR/Lib/x64|x86 @@ -61,7 +61,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK # look for dxgi (needed by both 10 and 11) find_library(DirectX_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) - + # look for d3dcompiler (needed by 11) find_library(DirectX_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) @@ -83,7 +83,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK get_filename_component(DirectX_LIBRARY_DIR "${DirectX_LIBRARY}" PATH) message(STATUS "DX lib dir: ${DirectX_LIBRARY_DIR}") find_library(DirectX_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) - find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY) set(DirectX_D3D11_FOUND TRUE) set(DirectX_D3D11_INCLUDE_DIR ${DirectX_D3D11_INCLUDE_DIR}) @@ -93,10 +93,10 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK ${DirectX_DXGI_LIBRARY} ${DirectX_DXERR_LIBRARY} ${DirectX_DXGUID_LIBRARY} - ${DirectX_D3DCOMPILER_LIBRARY} - ) + ${DirectX_D3DCOMPILER_LIBRARY} + ) endif () mark_as_advanced(DirectX_D3D11_INCLUDE_DIR DirectX_D3D11_LIBRARY DirectX_D3DX11_LIBRARY) endif () - + endif(WIN32) diff --git a/src/framework/cmake/FindPkgMacros.cmake b/src/framework/cmake/FindPkgMacros.cmake index 3a48f711..bd8e5730 100644 --- a/src/framework/cmake/FindPkgMacros.cmake +++ b/src/framework/cmake/FindPkgMacros.cmake @@ -93,7 +93,7 @@ macro(get_debug_names PREFIX) endforeach(i) endmacro(get_debug_names) -# Add the parent dir from DIR to VAR +# Add the parent dir from DIR to VAR macro(add_parent_dir VAR DIR) get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE) set(${VAR} ${${VAR}} ${${DIR}_TEMP}) diff --git a/src/framework/platform/win32platform.cpp b/src/framework/platform/win32platform.cpp index e00b84a1..22e5320c 100644 --- a/src/framework/platform/win32platform.cpp +++ b/src/framework/platform/win32platform.cpp @@ -275,7 +275,7 @@ std::string Platform::getOSName() else if(osvi.wProductType == VER_NT_WORKSTATION && osvi.dwMinorVersion == 2) ret += "Windows 8 "; - else + else ret += "Windows Server 2008 R2 "; } diff --git a/src/framework/sound/soundmanager.cpp b/src/framework/sound/soundmanager.cpp index 1d8d7df3..e4a8bed3 100644 --- a/src/framework/sound/soundmanager.cpp +++ b/src/framework/sound/soundmanager.cpp @@ -242,7 +242,7 @@ SoundSourcePtr SoundManager::createSoundSource(const std::string& filename) m_streamFiles[streamSource] = g_asyncDispatcher.schedule([=]() -> SoundFilePtr { stdext::timer a; try { - return SoundFile::loadSoundFile(filename); + return SoundFile::loadSoundFile(filename); } catch(std::exception& e) { g_logger.error(e.what()); return nullptr; @@ -256,7 +256,7 @@ SoundSourcePtr SoundManager::createSoundSource(const std::string& filename) combinedSource->addSource(streamSource); m_streamFiles[streamSource] = g_asyncDispatcher.schedule([=]() -> SoundFilePtr { try { - return SoundFile::loadSoundFile(filename); + return SoundFile::loadSoundFile(filename); } catch(std::exception& e) { g_logger.error(e.what()); return nullptr; @@ -268,7 +268,7 @@ SoundSourcePtr SoundManager::createSoundSource(const std::string& filename) StreamSoundSourcePtr streamSource(new StreamSoundSource); m_streamFiles[streamSource] = g_asyncDispatcher.schedule([=]() -> SoundFilePtr { try { - return SoundFile::loadSoundFile(filename); + return SoundFile::loadSoundFile(filename); } catch(std::exception& e) { g_logger.error(e.what()); return nullptr; diff --git a/src/framework/stdext/shared_object.h b/src/framework/stdext/shared_object.h index 7b62a75b..d9788f6f 100644 --- a/src/framework/stdext/shared_object.h +++ b/src/framework/stdext/shared_object.h @@ -66,7 +66,7 @@ public: typedef T element_type; shared_object_ptr(): px(nullptr) { } - shared_object_ptr(T* p, bool add_ref = true) : px(p) { + shared_object_ptr(T* p, bool add_ref = true) : px(p) { static_assert(std::is_base_of::value, "classes using shared_object_ptr must be a derived of stdext::shared_object"); if(px != nullptr && add_ref) this->add_ref(); diff --git a/src/framework/stdext/shared_ptr.h b/src/framework/stdext/shared_ptr.h index 154a3292..ddfd1eac 100644 --- a/src/framework/stdext/shared_ptr.h +++ b/src/framework/stdext/shared_ptr.h @@ -50,7 +50,7 @@ public: ~shared_base() { } void add_ref() { ++refs; } - void dec_ref() { + void dec_ref() { if(--refs == 0) { delete px; px = nullptr; @@ -116,7 +116,7 @@ public: T& operator*() const { assert(base != nullptr); return *base->get(); } T* operator->() const { assert(base != nullptr); return base->get(); } - template + template shared_ptr& operator=(shared_ptr const& rhs) { shared_ptr(rhs).swap(*this); return *this; } shared_ptr& operator=(shared_ptr const& rhs) { shared_ptr(rhs).swap(*this); return *this; } shared_ptr& operator=(T* rhs) { shared_ptr(rhs).swap(*this); return *this; } diff --git a/tools/tfs_extendedopcode.patch b/tools/tfs_extendedopcode.patch index 4a9d2e84..212c824f 100644 --- a/tools/tfs_extendedopcode.patch +++ b/tools/tfs_extendedopcode.patch @@ -3,7 +3,7 @@ index cd479e4..8d46b23 100644 --- a/const.h +++ b/const.h @@ -21,9 +21,12 @@ - + enum OperatingSystem_t { - CLIENTOS_LINUX = 0x01, @@ -16,7 +16,7 @@ index cd479e4..8d46b23 100644 + CLIENTOS_OTCLIENT_WINDOWS = 0x0B, + CLIENTOS_OTCLIENT_MAC = 0x0C, }; - + enum ChannelEvent_t diff --git a/creatureevent.cpp b/creatureevent.cpp index 842b237..e9b2200 100644 @@ -28,7 +28,7 @@ index 842b237..e9b2200 100644 _type = CREATURE_EVENT_PREPAREDEATH; + else if(type == "extendedopcode") + _type = CREATURE_EVENT_EXTENDED_OPCODE; - + return _type; } @@ -330,6 +332,8 @@ std::string CreatureEvent::getScriptEventName() const @@ -119,7 +119,7 @@ index f1ff4b2..cc5171c 100644 + CREATURE_EVENT_PREPAREDEATH, + CREATURE_EVENT_EXTENDED_OPCODE // otclient additional network opcodes }; - + enum StatsChange_t @@ -150,6 +151,7 @@ class CreatureEvent : public Event uint32_t executeKill(Creature* creature, Creature* target, const DeathEntry& entry); @@ -127,14 +127,14 @@ index f1ff4b2..cc5171c 100644 uint32_t executePrepareDeath(Creature* creature, DeathList deathList); + uint32_t executeExtendedOpcode(Creature* creature, uint8_t opcode, const std::string& buffer); // - + protected: diff --git a/data/creaturescripts/creaturescripts.xml b/data/creaturescripts/creaturescripts.xml index 363c62b..c706f10 100644 --- a/data/creaturescripts/creaturescripts.xml +++ b/data/creaturescripts/creaturescripts.xml @@ -14,4 +14,6 @@ - + + @@ -164,7 +164,7 @@ index 2e4dc2c..7508591 100644 --- a/game.cpp +++ b/game.cpp @@ -6951,3 +6951,12 @@ void Game::checkExpiredMarketOffers() - + Scheduler::getInstance().addEvent(createSchedulerTask(checkExpiredMarketOffersEachMinutes * 60 * 1000, boost::bind(&Game::checkExpiredMarketOffers, this))); } + @@ -185,7 +185,7 @@ index 51fa397..7192549 100644 @@ -646,6 +646,8 @@ class Game std::map grounds; #endif - + + void parsePlayerExtendedOpcode(uint32_t playerId, uint8_t opcode, const std::string& buffer); + protected: @@ -198,7 +198,7 @@ index 4cb8c8d..4ed9391 100644 @@ -2476,6 +2476,12 @@ void LuaInterface::registerFunctions() //getConfigFile() lua_register(m_luaState, "getConfigFile", LuaInterface::luaGetConfigFile); - + + //isPlayerUsingOtclient(cid) + lua_register(m_luaState, "isPlayerUsingOtclient", LuaInterface::luaIsPlayerUsingOtclient); + @@ -207,11 +207,11 @@ index 4cb8c8d..4ed9391 100644 + //getConfigValue(key) lua_register(m_luaState, "getConfigValue", LuaInterface::luaGetConfigValue); - + @@ -9471,6 +9477,32 @@ int32_t LuaInterface::luaGetMountInfo(lua_State* L) return 1; } - + +int32_t LuaInterface::luaIsPlayerUsingOtclient(lua_State* L) +{ + //isPlayerUsingOtclient(cid) @@ -248,7 +248,7 @@ index 234091a..0a0046f 100644 @@ -697,6 +697,9 @@ class LuaInterface static int32_t luaDoPlayerSetMounted(lua_State* L); static int32_t luaGetMountInfo(lua_State* L); - + + static int32_t luaIsPlayerUsingOtclient(lua_State* L); + static int32_t luaDoSendPlayerExtendedOpcode(lua_State* L); + @@ -262,7 +262,7 @@ index 917e36a..3671750 100644 @@ -171,16 +171,16 @@ Position NetworkMessage::getPosition() return pos; } - + -void NetworkMessage::putString(const char* value, bool addSize/* = true*/) +void NetworkMessage::putString(const char* value, int length, bool addSize/* = true*/) { @@ -270,10 +270,10 @@ index 917e36a..3671750 100644 + uint32_t size = (uint32_t)length; if(!hasSpace(size + (addSize ? 2 : 0)) || size > 8192) return; - + if(addSize) put(size); - + - strcpy((char*)(m_buffer + m_position), value); + memcpy((char*)(m_buffer + m_position), value, length); m_position += size; @@ -286,14 +286,14 @@ index 6cf8ee1..615f094 100644 @@ -80,8 +80,8 @@ class NetworkMessage m_size += sizeof(T); } - + - void putString(const std::string& value, bool addSize = true) {putString(value.c_str(), addSize);} - void putString(const char* value, bool addSize = true); + void putString(const std::string& value, bool addSize = true) {putString(value.c_str(), value.length(), addSize);} + void putString(const char* value, int length, bool addSize = true); - + void putPadding(uint32_t amount); - + diff --git a/player.h b/player.h index 63e9183..7cb8313 100644 --- a/player.h @@ -301,7 +301,7 @@ index 63e9183..7cb8313 100644 @@ -228,6 +228,7 @@ class Player : public Creature, public Cylinder bool hasPVPBlessing() const {return pvpBlessing;} uint16_t getBlessings() const; - + + bool isUsingOtclient() const { return operatingSystem >= CLIENTOS_OTCLIENT_LINUX; } OperatingSystem_t getOperatingSystem() const {return operatingSystem;} void setOperatingSystem(OperatingSystem_t os) {operatingSystem = os;} @@ -309,7 +309,7 @@ index 63e9183..7cb8313 100644 @@ -580,6 +581,9 @@ class Player : public Creature, public Cylinder void sendSpellGroupCooldown(SpellGroup_t groupId, uint32_t cooldown) {if(client) client->sendSpellGroupCooldown(groupId, cooldown);} - + + void sendExtendedOpcode(uint8_t opcode, const std::string& buffer) + {if(client) client->sendExtendedOpcode(opcode, buffer);} + @@ -323,7 +323,7 @@ index b980be0..7a84f61 100644 @@ -263,6 +263,11 @@ bool ProtocolGame::login(const std::string& name, uint32_t id, const std::string return false; } - + + if(player->isUsingOtclient()) + { + player->registerCreatureEvent("ExtendedOpcode"); @@ -335,18 +335,18 @@ index b980be0..7a84f61 100644 @@ -427,6 +432,10 @@ void ProtocolGame::onRecvFirstMessage(NetworkMessage& msg) enableXTEAEncryption(); setXTEAKey(key); - + + // notifies to otclient that this server can receive extended game protocol opcodes + if(operatingSystem >= CLIENTOS_OTCLIENT_LINUX) + sendExtendedOpcode(0x00, std::string()); + bool gamemaster = (msg.get() != (char)0); std::string name = msg.getString(), character = msg.getString(), password = msg.getString(); - + @@ -578,6 +587,10 @@ void ProtocolGame::parsePacket(NetworkMessage &msg) parseReceivePing(msg); break; - + + case 0x32: // otclient extended opcode + parseExtendedOpcode(msg); + break; @@ -390,7 +390,7 @@ index 7691174..48b9bf1 100644 @@ -326,6 +326,9 @@ class ProtocolGame : public Protocol //shop void AddShopItem(NetworkMessage_ptr msg, const ShopInfo& item); - + + void parseExtendedOpcode(NetworkMessage& msg); + void sendExtendedOpcode(uint8_t opcode, const std::string& buffer); +