BeniS 8850528091 Updated Top Menu, Health Info, Combat Controls, Console (Channels), Game Toggle Buttons, Minimap Layout, Game Interface Prompts, and Creature Draw Info.
* Added new left and right game button panels.
* Relocated main game toggle buttons to the right side of the screen to make it easier to toggle miniwindows.
* Added table.empty(t) function to table lib.
* Renamed module game_healthbar to game_healthinfo.
* Combat controls now save per character (e.g. Fight mode, chase mode, safe fight mode)
* Last channels open now save per character.
* Fixed typo in containers.lua.
* Added logout prompting window message when you logout via the logout button.
* Added exit promting window message when you attempt to exit the client.
* Repositioned some minimap buttons.
* Fixed so when creatures health percent is < 1 it will not draw the creature information.

Known Issues:
* If you move a container widget into the map rect if you move an item onto itself it will allow this to execute still dropping the item on the ground.
* The server is calling to open channels after onGameStart is executed causing it to focus the last tab opened. Fix: Don't save channels to the settings that are opened by the server.
2012-07-13 04:45:22 +12:00

82 lines
2.2 KiB
Lua

function UIItem:onDragEnter(mousePos)
if self:isVirtual() then return false end
local item = self:getItem()
if not item then return false end
self:setBorderWidth(1)
self.currentDragThing = item
g_mouse.setTargetCursor()
return true
end
function UIItem:onDragLeave(droppedWidget, mousePos)
if self:isVirtual() then return false end
self.currentDragThing = nil
g_mouse.restoreCursor()
self:setBorderWidth(0)
return true
end
function UIItem:onDrop(widget, mousePos)
if self:isVirtual() then return false end
if not widget or not widget.currentDragThing then return false end
local thing = widget.currentDragThing
local toPos = self.position
local thingPos = thing:getPosition()
if thingPos.x == toPos.x and thingPos.y == toPos.y and thingPos.z == toPos.z then return false end
if thing:getCount() > 1 then
GameInterface.moveStackableItem(thing, toPos)
else
g_game.move(thing, toPos, 1)
end
self:setBorderWidth(0)
return true
end
function UIItem:onHoverChange(hovered)
UIWidget.onHoverChange(self, hovered)
if self:isVirtual() then return end
local draggingWidget = g_ui.getDraggingWidget()
if draggingWidget and self ~= draggingWidget then
local gotMap = draggingWidget:getClassName() == 'UIMap'
local gotItem = draggingWidget:getClassName() == 'UIItem' and not draggingWidget:isVirtual()
if hovered and (gotItem or gotMap) then
self:setBorderWidth(1)
else
self:setBorderWidth(0)
end
end
end
function UIItem:onMouseRelease(mousePosition, mouseButton)
if self.cancelNextRelease then
self.cancelNextRelease = false
return true
end
if self:isVirtual() then return false end
local item = self:getItem()
if not item or not self:containsPoint(mousePosition) then return false end
if Options.getOption('classicControl') and
((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) or
(g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then
g_game.look(item)
self.cancelNextRelease = true
return true
elseif GameInterface.processMouseAction(mousePosition, mouseButton, nil, item, item, nil, item) then
return true
end
return false
end