restore inventory and healthbar

* make inventory/healthbar work again allowing reload
* changes in top menu toggle buttons
* all modules are now reloadable by default
* fix warning when using fade in
* remove some unused files
This commit is contained in:
Eduardo Bart
2012-03-23 10:48:05 -03:00
parent b301aa1a2b
commit 239f58296e
41 changed files with 134 additions and 407 deletions

View File

@@ -3,7 +3,6 @@ Module
description: Create the game interface, where the ingame stuff starts
author: OTClient team
website: https://github.com/edubart/otclient
reloadable: true
dependencies:
- game_tibiafiles
@@ -14,8 +13,8 @@ Module
- game_textmessage
- game_console
- game_outfit
//- game_healthbar
//- game_inventory
- game_healthbar
- game_inventory
//- game_combatcontrols
//- game_skills
//- game_viplist
@@ -30,9 +29,13 @@ Module
dofile 'const'
dofile 'widgets/uigamemap'
dofile 'widgets/uiitem'
dofile 'creature'
dofile 'player'
dofile 'gameinterface'
dofile 'creature'
GameInterface.init()
@onUnload: |

View File

@@ -105,7 +105,7 @@ function GameInterface.createThingMenu(menuPosition, lookThing, useThing, creatu
if useThing then
if useThing:isContainer() then
if useThing:isInsideContainer() then
if useThing:getParentContainer() then
menu:addOption('Open', function() g_game.open(useThing, useThing:getContainerId()) end)
menu:addOption('Open in new window', function() g_game.open(useThing, Containers.getFreeContainerId()) end)
else
@@ -220,7 +220,7 @@ function GameInterface.processMouseAction(menuPosition, mouseButton, autoWalk, l
return true
elseif useThing and keyboardModifiers == KeyboardCtrlModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
if useThing:isContainer() then
if useThing:isInsideContainer() then
if useThing:getParentContainer() then
g_game.open(useThing, useThing:getContainerId())
return true
else
@@ -245,7 +245,7 @@ function GameInterface.processMouseAction(menuPosition, mouseButton, autoWalk, l
g_game.attack(multiUseThing:asCreature())
return true
elseif multiUseThing:isContainer() then
if multiUseThing:isInsideContainer() then
if multiUseThing:getParentContainer() then
g_game.open(multiUseThing, multiUseThing:getContainerId())
return true
else

View File

@@ -33,8 +33,8 @@ UIWidget
margin-bottom: 172
height: 4
margin-top: -2
background: red
@canUpdateMargin: function(self, newMargin) return math.min(math.max(newMargin, 100), self:getParent():getHeight() - 300) end
@onGeometryChange: function(self) self:setMarginBottom(math.min(self:getParent():getHeight() - 300, self:getMarginBottom())) end
GameBottomPanel
id: gameBottomPanel
@@ -50,6 +50,7 @@ UIWidget
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
focusable: false
GameSidePanel
id: gameLeftPanel
@@ -58,6 +59,7 @@ UIWidget
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
focusable: false
UIWidget
id: mouseGrabber

31
modules/game/player.lua Normal file
View File

@@ -0,0 +1,31 @@
function Player:isPartyLeader()
local shield = self:getShield()
return (shield == ShieldWhiteYellow or
shield == ShieldYellow or
shield == ShieldYellowSharedExp or
shield == ShieldYellowNoSharedExpBlink or
shield == ShieldYellowNoSharedExp)
end
function Player:isPartyMember()
local shield = self:getShield()
return (shield == ShieldWhiteYellow or
shield == ShieldYellow or
shield == ShieldYellowSharedExp or
shield == ShieldYellowNoSharedExpBlink or
shield == ShieldYellowNoSharedExp or
shield == ShieldBlueSharedExp or
shield == ShieldBlueNoSharedExpBlink or
shield == ShieldBlueNoSharedExp or
shield == ShieldBlue)
end
function Player:isPartySharedExperienceActive()
local shield = self:getShield()
return (shield == ShieldYellowSharedExp or
shield == ShieldYellowNoSharedExpBlink or
shield == ShieldYellowNoSharedExp or
shield == ShieldBlueSharedExp or
shield == ShieldBlueNoSharedExpBlink or
shield == ShieldBlueNoSharedExp)
end

View File

@@ -18,3 +18,6 @@ MiniWindow < UIMiniWindow
$on:
height: 24
image-border-bottom: 1
BorderlessGameWindow < UIWindow
focusable: false

View File

@@ -73,6 +73,6 @@ function UIItem:onMouseRelease(mousePosition, mouseButton)
local item = self:getItem()
if not item or not self:containsPoint(mousePosition) then return false end
return g_game.processMouseAction(mousePosition, mouseButton, nil, item, item, nil, item)
return GameInterface.processMouseAction(mousePosition, mouseButton, nil, item, item, nil, item)
end