parent
c982ca81a5
commit
32c5f4285b
|
@ -26,7 +26,7 @@ locale = {
|
|||
["4c) False Report to Gamemaster"] = "4c) Relatório falso para Gamemaster",
|
||||
["Accept"] = "Aceitar",
|
||||
["Account name"] = "Nome da conta",
|
||||
["Account Status:"] = "Estado da Conta:",
|
||||
["Account Status"] = "Estado da Conta",
|
||||
["Action"] = "Ação",
|
||||
["Add"] = "Adicionar",
|
||||
["Add new VIP"] = "Adicionar nova VIP",
|
||||
|
|
|
@ -15,10 +15,6 @@ Panel
|
|||
id: enableMusicSound
|
||||
!text: tr('Enable music sound')
|
||||
|
||||
OptionCheckBox
|
||||
id: enableEffectsSound
|
||||
!text: tr('Enable effects sound')
|
||||
|
||||
Label
|
||||
id: musicSoundVolumeLabel
|
||||
!text: tr('Music volume: %d', 100)
|
||||
|
|
|
@ -25,7 +25,6 @@ local defaultOptions = {
|
|||
enableLights = true,
|
||||
enableShaders = true,
|
||||
ambientLight = 25,
|
||||
enableEffectsSound = 0
|
||||
}
|
||||
|
||||
local optionsWindow
|
||||
|
|
|
@ -38,7 +38,7 @@ function UIMiniWindowContainer:fitAll(noRemoveChild)
|
|||
end
|
||||
end
|
||||
|
||||
local selfHeight = self:getHeight() - (self:getMarginTop() + self:getMarginBottom() + self:getPaddingTop() + self:getPaddingBottom())
|
||||
local selfHeight = self:getHeight() - (self:getPaddingTop() + self:getPaddingBottom())
|
||||
if sumHeight <= selfHeight then
|
||||
return
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ ConsoleTabBarPanel < MoveableTabBarPanel
|
|||
align-bottom: true
|
||||
border-width: 1
|
||||
border-color: #202327
|
||||
background: #00000044
|
||||
background: #00000066
|
||||
inverted-scroll: true
|
||||
padding: 1
|
||||
|
||||
|
@ -45,8 +45,6 @@ ConsoleTabBarPanel < MoveableTabBarPanel
|
|||
layout:
|
||||
type: verticalBox
|
||||
align-bottom: true
|
||||
border-width: 1
|
||||
border-color: #202327
|
||||
inverted-scroll: true
|
||||
padding: 1
|
||||
@onScrollbarChange: |
|
||||
|
|
|
@ -660,8 +660,7 @@ function setupViewMode(mode)
|
|||
gameMapPanel:addAnchor(AnchorRight, 'gameRightPanel', AnchorLeft)
|
||||
gameMapPanel:addAnchor(AnchorBottom, 'gameBottomPanel', AnchorTop)
|
||||
gameRootPanel:addAnchor(AnchorTop, 'topMenu', AnchorBottom)
|
||||
gameLeftPanel:setOn(false)
|
||||
gameLeftPanel:setVisible(false)
|
||||
gameLeftPanel:setOn(modules.client_options.getOption('showLeftPanel'))
|
||||
gameLeftPanel:setImageColor('white')
|
||||
gameRightPanel:setImageColor('white')
|
||||
gameLeftPanel:setMarginTop(0)
|
||||
|
@ -689,12 +688,13 @@ function setupViewMode(mode)
|
|||
gameRootPanel:fill('parent')
|
||||
gameLeftPanel:setImageColor('alpha')
|
||||
gameRightPanel:setImageColor('alpha')
|
||||
gameLeftPanel:setMarginTop(36)
|
||||
gameRightPanel:setMarginTop(36)
|
||||
gameLeftPanel:setMarginTop(modules.client_topmenu.getTopMenu():getHeight() - gameLeftPanel:getPaddingTop())
|
||||
gameRightPanel:setMarginTop(modules.client_topmenu.getTopMenu():getHeight() - gameRightPanel:getPaddingTop())
|
||||
gameLeftPanel:setOn(true)
|
||||
gameLeftPanel:setVisible(true)
|
||||
gameRightPanel:setOn(true)
|
||||
gameBottomPanel:setImageColor('#00000099')
|
||||
gameMapPanel:setOn(true)
|
||||
gameBottomPanel:setImageColor('#ffffff88')
|
||||
modules.client_topmenu.getTopMenu():setImageColor('#ffffff66')
|
||||
if not limitZoom then
|
||||
g_game.changeMapAwareRange(24, 20)
|
||||
|
|
|
@ -4,6 +4,9 @@ GameSidePanel < UIMiniWindowContainer
|
|||
image-border: 4
|
||||
padding: 4
|
||||
width: 198
|
||||
layout:
|
||||
type: verticalBox
|
||||
//spacing: 1
|
||||
|
||||
GameBottomPanel < Panel
|
||||
image-source: /images/ui/panel_bottom
|
||||
|
@ -14,6 +17,9 @@ GameMapPanel < UIGameMap
|
|||
image-source: /images/ui/panel_map
|
||||
image-border: 4
|
||||
|
||||
$on:
|
||||
padding: 0
|
||||
|
||||
UIWidget
|
||||
id: gameRootPanel
|
||||
anchors.fill: parent
|
||||
|
@ -36,7 +42,6 @@ UIWidget
|
|||
|
||||
GameSidePanel
|
||||
id: gameLeftPanel
|
||||
layout: verticalBox
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
@ -49,7 +54,6 @@ UIWidget
|
|||
|
||||
GameSidePanel
|
||||
id: gameRightPanel
|
||||
layout: verticalBox
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
|
|
@ -189,7 +189,7 @@ function addMapFlag(pos, icon, message, flagId, version)
|
|||
flagWidget.icon = icon
|
||||
flagWidget.description = message
|
||||
if message and message:len() > 0 then
|
||||
flagWidget:setTooltip(tr(message))
|
||||
flagWidget:setTooltip(message)
|
||||
end
|
||||
flagWidget.id = flagId
|
||||
flagWidget.version = version
|
||||
|
|
|
@ -21,7 +21,8 @@ function init()
|
|||
onBaseSkillChange = onBaseSkillChange
|
||||
})
|
||||
connect(g_game, {
|
||||
onGameStart = refresh
|
||||
onGameStart = refresh,
|
||||
onGameEnd = offline
|
||||
})
|
||||
|
||||
skillsButton = modules.client_topmenu.addRightGameToggleButton('skillsButton', tr('Skills') .. ' (Ctrl+S)', '/images/topbuttons/skills', toggle)
|
||||
|
@ -55,7 +56,7 @@ function terminate()
|
|||
})
|
||||
disconnect(g_game, {
|
||||
onGameStart = refresh,
|
||||
onGameEnd = refresh
|
||||
onGameEnd = offline
|
||||
})
|
||||
|
||||
g_keyboard.unbindKeyDown('Ctrl+S')
|
||||
|
@ -63,6 +64,14 @@ function terminate()
|
|||
skillsWindow:destroy()
|
||||
end
|
||||
|
||||
function expForLevel(level)
|
||||
return math.floor((50*level*level*level)/3 - 100*level*level + (850*level)/3 - 200)
|
||||
end
|
||||
|
||||
function expToAdvance(currentLevel, currentExp)
|
||||
return expForLevel(currentLevel+1) - currentExp
|
||||
end
|
||||
|
||||
function resetSkillColor(id)
|
||||
local skill = skillsWindow:recursiveGetChildById(id)
|
||||
local widget = skill:getChildById('value')
|
||||
|
@ -180,6 +189,9 @@ function refresh()
|
|||
local player = g_game.getLocalPlayer()
|
||||
if not player then return end
|
||||
|
||||
if expSpeedEvent then expSpeedEvent:cancel() end
|
||||
expSpeedEvent = cycleEvent(checkExpSpeed, 30*1000)
|
||||
|
||||
onExperienceChange(player, player:getExperience())
|
||||
onLevelChange(player, player:getLevel(), player:getLevelPercent())
|
||||
onHealthChange(player, player:getHealth(), player:getMaxHealth())
|
||||
|
@ -204,6 +216,10 @@ function refresh()
|
|||
skillsWindow:setContentMaximumHeight(contentsPanel:getChildrenRect().height)
|
||||
end
|
||||
|
||||
function offline()
|
||||
expSpeedEvent:cancel()
|
||||
end
|
||||
|
||||
function toggle()
|
||||
if skillsButton:isOn() then
|
||||
skillsWindow:close()
|
||||
|
@ -214,6 +230,22 @@ function toggle()
|
|||
end
|
||||
end
|
||||
|
||||
function checkExpSpeed()
|
||||
local player = g_game.getLocalPlayer()
|
||||
local currentExp = player:getExperience()
|
||||
local currentTime = g_clock.seconds()
|
||||
if player.lastExps ~= nil then
|
||||
player.expSpeed = (currentExp - player.lastExps[1][1])/(currentTime - player.lastExps[1][2])
|
||||
onLevelChange(player, player:getLevel(), player:getLevelPercent())
|
||||
else
|
||||
player.lastExps = {}
|
||||
end
|
||||
table.insert(player.lastExps, {currentExp, currentTime})
|
||||
if #player.lastExps > 10 then
|
||||
table.remove(player.lastExps, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function onMiniWindowClose()
|
||||
skillsButton:setOn(false)
|
||||
end
|
||||
|
@ -231,21 +263,36 @@ function onSkillButtonClick(button)
|
|||
end
|
||||
|
||||
function onExperienceChange(localPlayer, value)
|
||||
setSkillValue('experience', tr(value))
|
||||
setSkillValue('experience', value)
|
||||
end
|
||||
|
||||
function onLevelChange(localPlayer, value, percent)
|
||||
setSkillValue('level', tr(value))
|
||||
setSkillPercent('level', percent, tr('You have %s percent to go', 100 - percent))
|
||||
setSkillValue('level', value)
|
||||
local text = tr('You have %s percent to go', 100 - percent) .. '\n' ..
|
||||
tr('%s of experience left', expToAdvance(localPlayer:getLevel(), localPlayer:getExperience()))
|
||||
|
||||
if localPlayer.expSpeed ~= nil then
|
||||
local expPerHour = math.floor(localPlayer.expSpeed * 3600)
|
||||
if expPerHour > 0 then
|
||||
local nextLevelExp = expForLevel(localPlayer:getLevel()+1)
|
||||
local hoursLeft = (nextLevelExp - localPlayer:getExperience()) / expPerHour
|
||||
local minutesLeft = math.floor((hoursLeft - math.floor(hoursLeft))*60)
|
||||
hoursLeft = math.floor(hoursLeft)
|
||||
text = text .. '\n' .. tr('%d of experience per hour', expPerHour)
|
||||
text = text .. '\n' .. tr('Next level in %d hours and %d minutes', hoursLeft, minutesLeft)
|
||||
end
|
||||
end
|
||||
|
||||
setSkillPercent('level', percent, text)
|
||||
end
|
||||
|
||||
function onHealthChange(localPlayer, health, maxHealth)
|
||||
setSkillValue('health', tr(health))
|
||||
setSkillValue('health', health)
|
||||
checkAlert('health', health, maxHealth, 30)
|
||||
end
|
||||
|
||||
function onManaChange(localPlayer, mana, maxMana)
|
||||
setSkillValue('mana', tr(mana))
|
||||
setSkillValue('mana', mana)
|
||||
checkAlert('mana', mana, maxMana, 30)
|
||||
end
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <framework/core/eventdispatcher.h>
|
||||
#include <framework/core/application.h>
|
||||
#include <framework/core/resourcemanager.h>
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
|
||||
enum {
|
||||
|
@ -163,16 +164,8 @@ void MapView::draw(const Rect& rect)
|
|||
if(m_shaderSwitchDone && m_shader && m_fadeInTime > 0)
|
||||
fadeOpacity = std::min(m_fadeTimer.timeElapsed() / m_fadeInTime, 1.0f);
|
||||
|
||||
Point drawOffset = ((m_drawDimension - m_visibleDimension - Size(1,1)).toPoint()/2) * m_tileSize;
|
||||
if(isFollowingCreature())
|
||||
drawOffset += m_followingCreature->getWalkOffset() * scaleFactor;
|
||||
|
||||
Size srcSize = rect.size();
|
||||
Size srcVisible = m_visibleDimension * m_tileSize;
|
||||
srcSize.scale(srcVisible, Fw::KeepAspectRatio);
|
||||
drawOffset.x += (srcVisible.width() - srcSize.width()) / 2;
|
||||
drawOffset.y += (srcVisible.height() - srcSize.height()) / 2;
|
||||
Rect srcRect = Rect(drawOffset, srcSize);
|
||||
Rect srcRect = calcFramebufferSource(rect.size());
|
||||
Point drawOffset = srcRect.topLeft();
|
||||
|
||||
if(m_shader && g_painter->hasShaders() && g_graphics.shouldUseShaders() && m_viewMode == NEAR_VIEW) {
|
||||
Rect framebufferRect = Rect(0,0, m_drawDimension * m_tileSize);
|
||||
|
@ -544,6 +537,49 @@ void MapView::setCameraPosition(const Position& pos)
|
|||
requestVisibleTilesCacheUpdate();
|
||||
}
|
||||
|
||||
Position MapView::getPosition(const Point& point, const Size& mapSize)
|
||||
{
|
||||
Position cameraPosition = getCameraPosition();
|
||||
|
||||
// if we have no camera, its impossible to get the tile
|
||||
if(!cameraPosition.isValid())
|
||||
return Position();
|
||||
|
||||
Rect srcRect = calcFramebufferSource(mapSize);
|
||||
float sh = srcRect.width() / (float)mapSize.width();
|
||||
float sv = srcRect.height() / (float)mapSize.height();
|
||||
|
||||
Point framebufferPos = Point(point.x * sh, point.y * sv);
|
||||
Point centerOffset = (framebufferPos + srcRect.topLeft()) / m_tileSize;
|
||||
|
||||
Point tilePos2D = getVisibleCenterOffset() - m_drawDimension.toPoint() + centerOffset + Point(2,2);
|
||||
if(tilePos2D.x + cameraPosition.x < 0 && tilePos2D.y + cameraPosition.y < 0)
|
||||
return Position();
|
||||
|
||||
Position position = Position(tilePos2D.x, tilePos2D.y, 0) + cameraPosition;
|
||||
|
||||
if(!position.isValid())
|
||||
return Position();
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
Rect MapView::calcFramebufferSource(const Size& destSize)
|
||||
{
|
||||
float scaleFactor = m_tileSize/(float)Otc::TILE_PIXELS;
|
||||
Point drawOffset = ((m_drawDimension - m_visibleDimension - Size(1,1)).toPoint()/2) * m_tileSize;
|
||||
if(isFollowingCreature())
|
||||
drawOffset += m_followingCreature->getWalkOffset() * scaleFactor;
|
||||
|
||||
Size srcSize = destSize;
|
||||
Size srcVisible = m_visibleDimension * m_tileSize;
|
||||
srcSize.scale(srcVisible, Fw::KeepAspectRatio);
|
||||
drawOffset.x += (srcVisible.width() - srcSize.width()) / 2;
|
||||
drawOffset.y += (srcVisible.height() - srcSize.height()) / 2;
|
||||
|
||||
return Rect(drawOffset, srcSize);
|
||||
}
|
||||
|
||||
int MapView::calcFirstVisibleFloor()
|
||||
{
|
||||
int z = 7;
|
||||
|
|
|
@ -107,9 +107,12 @@ public:
|
|||
void setShader(const PainterShaderProgramPtr& shader, float fadein, float fadeout);
|
||||
PainterShaderProgramPtr getShader() { return m_shader; }
|
||||
|
||||
Position getPosition(const Point& point, const Size& mapSize);
|
||||
|
||||
MapViewPtr asMapView() { return static_self_cast<MapView>(); }
|
||||
|
||||
private:
|
||||
Rect calcFramebufferSource(const Size& destSize);
|
||||
int calcFirstVisibleFloor();
|
||||
int calcLastVisibleFloor();
|
||||
Point transformPositionTo2D(const Position& position, const Position& relativePosition) {
|
||||
|
|
|
@ -128,29 +128,7 @@ Position UIMap::getPosition(const Point& mousePos)
|
|||
return Position();
|
||||
|
||||
Point relativeMousePos = mousePos - m_mapRect.topLeft();
|
||||
Size visibleSize = getVisibleDimension() * m_mapView->getTileSize();
|
||||
Position cameraPosition = getCameraPosition();
|
||||
|
||||
// if we have no camera, its impossible to get the tile
|
||||
if(!cameraPosition.isValid())
|
||||
return Position();
|
||||
|
||||
float scaleFactor = m_mapView->getTileSize() / (float)Otc::TILE_PIXELS;
|
||||
float horizontalStretchFactor = visibleSize.width() / (float)m_mapRect.width();
|
||||
float verticalStretchFactor = visibleSize.height() / (float)m_mapRect.height();
|
||||
|
||||
Point tilePos2D = Point(relativeMousePos.x * horizontalStretchFactor, relativeMousePos.y * verticalStretchFactor);
|
||||
|
||||
if(m_mapView->isFollowingCreature())
|
||||
tilePos2D += getFollowingCreature()->getWalkOffset() * scaleFactor;
|
||||
tilePos2D /= m_mapView->getTileSize();
|
||||
|
||||
Point visibleCenterOffset = m_mapView->getVisibleCenterOffset();
|
||||
Position position = Position(1 + (int)tilePos2D.x - visibleCenterOffset.x, 1 + (int)tilePos2D.y - visibleCenterOffset.y, 0) + cameraPosition;
|
||||
if(!position.isValid())
|
||||
return Position();
|
||||
|
||||
return position;
|
||||
return m_mapView->getPosition(relativeMousePos, m_mapRect.size());
|
||||
}
|
||||
|
||||
TilePtr UIMap::getTile(const Point& mousePos)
|
||||
|
|
|
@ -589,7 +589,7 @@ void UITextEdit::updateText()
|
|||
void UITextEdit::onHoverChange(bool hovered)
|
||||
{
|
||||
if(m_changeCursorImage) {
|
||||
if(hovered)
|
||||
if(hovered && !g_mouse.isCursorChanged())
|
||||
g_mouse.pushCursor("text");
|
||||
else
|
||||
g_mouse.popCursor("text");
|
||||
|
|
Loading…
Reference in New Issue