Changes/Fixes to Channels/Hotkeys/Inventory Slots.

- Fixed issue with opening multiple instances of the same message channels (will focus the channel if already exists).
- Added tooltip to the 'Clear message window' button.
- Added keyboard Up/Down press for hotkeys.
- Added inventory slots/images.
- Started on adding soul
master
BeniS 12 yıl önce
ebeveyn 77648a2ffa
işleme 82233dc655

@ -1,5 +1,19 @@
-- @docclass Player
InventorySlotHead = 1
InventorySlotNeck = 2
InventorySlotBack = 3
InventorySlotBody = 4
InventorySlotRight = 5
InventorySlotLeft = 6
InventorySlotLeg = 7
InventorySlotFeet = 8
InventorySlotFinger = 9
InventorySlotAmmo = 10
InventorySlotFirst = 1
InventorySlotLast = 10
function Player:isPartyLeader()
local shield = self:getShield()
return (shield == ShieldWhiteYellow or
@ -37,4 +51,4 @@ function Player:hasVip(creatureName)
if (vip[1] == creatureName) then return true end
end
return false
end
end

@ -118,18 +118,13 @@ local function onOpenChannel(channelId, channelName)
end
local function onOpenPrivateChannel(receiver)
local privateTab = Console.getTab(receiver)
if privateTab == nil then
channels[receiver] = receiver
Console.addTab(receiver, true)
end
Console.addPrivateChannel(receiver)
end
local function onOpenOwnPrivateChannel(channelId, channelName)
local privateTab = Console.getTab(channelName)
if privateTab == nil then
--channels[channelId] = channelName (this should be tested)
Console.addChannel(channelName, channelId, true)
Console.addChannel(channelName, channelId)
end
ownPrivateName = channelName
end
@ -302,7 +297,12 @@ function Console.openHelp()
end
function Console.addTab(name, focus)
local tab = consoleTabBar:addTab(name)
local tab = Console.getTab(name)
if(tab) then -- is channel already open
if(not focus) then focus = true end
else
tab = consoleTabBar:addTab(name)
end
if focus then
consoleTabBar:selectTab(tab)
elseif name ~= tr('Server Log') then
@ -348,6 +348,11 @@ function Console.addChannel(name, id)
return tab
end
function Console.addPrivateChannel(receiver)
channels[receiver] = receiver
return Console.addTab(receiver, true)
end
function Console.addPrivateText(text, speaktype, name, isPrivateCommand, creatureName)
local focus = false
if speaktype.speakType == SpeakPrivateNpcToPlayer then

@ -75,6 +75,7 @@ Panel
TabButton
id: clearChannelButton
!tooltip: tr('Clear current message window')
icon: icons/clearchannel.png
anchors.right: next.left
anchors.top: parent.top

@ -35,10 +35,13 @@ local hotkeyColors = {
-- public functions
function HotkeysManager.init()
hotkeysWindow = g_ui.displayUI('hotkeys_manager.otui')
local hotkeyListPanel = hotkeysWindow:getChildById('currentHotkeys')
hotkeysWindow:setVisible(false)
hotkeysButton = TopMenu.addGameButton('hotkeysButton', tr('Hotkeys') .. ' (Ctrl+K)', '/game_hotkeys/icon.png', HotkeysManager.toggle)
g_keyboard.bindKeyDown('Ctrl+K', HotkeysManager.toggle)
g_keyboard.bindKeyPress('Down', function() hotkeyListPanel:focusNextChild(KeyboardFocusReason) end, hotkeysWindow)
g_keyboard.bindKeyPress('Up', function() hotkeyListPanel:focusPreviousChild(KeyboardFocusReason) end, hotkeysWindow)
currentHotkeysList = hotkeysWindow:getChildById('currentHotkeys')
currentItemPreview = hotkeysWindow:getChildById('itemPreview')
@ -102,6 +105,9 @@ function HotkeysManager.terminate()
hotkeysManagerLoaded = false
g_keyboard.unbindKeyDown('Ctrl+K')
g_keyboard.unbindKeyPress('Down', function() channelListPanel:focusNextChild(KeyboardFocusReason) end, channelsWindow)
g_keyboard.unbindKeyPress('Up', function() channelListPanel:focusPreviousChild(KeyboardFocusReason) end, channelsWindow)
HotkeysManager.save()
currentHotkeysList = nil

@ -1,5 +1,19 @@
Inventory = {}
-- public variables
InventorySlotStyles = {
[InventorySlotHead] = "HeadSlot",
[InventorySlotNeck] = "NeckSlot",
[InventorySlotBack] = "BackSlot",
[InventorySlotBody] = "BodySlot",
[InventorySlotRight] = "RightSlot",
[InventorySlotLeft] = "LeftSlot",
[InventorySlotLeg] = "LegSlot",
[InventorySlotFeet] = "FeetSlot",
[InventorySlotFinger] = "FingerSlot",
[InventorySlotAmmo] = "AmmoSlot"
}
-- private variables
local inventoryWindow
local inventoryPanel
@ -39,7 +53,7 @@ end
function Inventory.refresh()
local player = g_game.getLocalPlayer()
for i=1,10 do
for i=InventorySlotFirst,InventorySlotLast do
if player then
Inventory.onInventoryChange(player, i, player:getInventoryItem(i))
else
@ -63,9 +77,15 @@ function Inventory.onMiniWindowClose()
end
-- hooked events
function Inventory.onInventoryChange(player, slot, item)
function Inventory.onInventoryChange(player, slot, item, oldItem)
local itemWidget = inventoryPanel:getChildById('slot' .. slot)
itemWidget:setItem(item)
if(item) then
itemWidget:setStyle('Item')
itemWidget:setItem(item)
else
itemWidget:setStyle(InventorySlotStyles[slot])
itemWidget:setItem(nil)
end
end
function Inventory.onFreeCapacityChange(player, freeCapacity)

@ -1,3 +1,43 @@
HeadSlot < Item
id: slot1
image-source: /game_inventory/slots/head.png
BodySlot < Item
id: slot4
image-source: /game_inventory/slots/body.png
LegSlot < Item
id: slot7
image-source: /game_inventory/slots/legs.png
FeetSlot < Item
id: slot8
image-source: /game_inventory/slots/feet.png
NeckSlot < Item
id: slot2
image-source: /game_inventory/slots/neck.png
LeftSlot < Item
id: slot6
image-source: /game_inventory/slots/left-hand.png
FingerSlot < Item
id: slot9
image-source: /game_inventory/slots/finger.png
BackSlot < Item
id: slot3
image-source: /game_inventory/slots/back.png
RightSlot < Item
id: slot5
image-source: /game_inventory/slots/right-hand.png
AmmoSlot < Item
id: slot10
image-source: /game_inventory/slots/ammo.png
MiniWindow
id: inventoryWindow
!text: tr('Inventory')
@ -6,84 +46,74 @@ MiniWindow
@onClose: Inventory.onMiniWindowClose()
&save: true
MiniWindowContents
Item
MiniWindowContents
HeadSlot
// head
id: slot1
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin-top: 4
&position: {x=65535, y=1, z=0}
Item
// armor
id: slot4
BodySlot
// body
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 5
&position: {x=65535, y=4, z=0}
Item
LegSlot
// legs
id: slot7
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 5
&position: {x=65535, y=7, z=0}
Item
FeetSlot
// feet
id: slot8
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 5
&position: {x=65535, y=8, z=0}
Item
// necklace
id: slot2
NeckSlot
// neck
anchors.top: parent.top
anchors.right: slot1.left
margin-top: 10
margin-right: 5
&position: {x=65535, y=2, z=0}
Item
// left
id: slot6
LeftSlot
// left hand
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 5
&position: {x=65535, y=6, z=0}
Item
// ring
id: slot9
FingerSlot
// finger
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 5
&position: {x=65535, y=9, z=0}
Item
// backpack
id: slot3
BackSlot
// back
anchors.top: parent.top
anchors.left: slot1.right
margin-top: 10
margin-left: 5
&position: {x=65535, y=3, z=0}
Item
// right
id: slot5
RightSlot
// right hand
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 5
&position: {x=65535, y=5, z=0}
Item
AmmoSlot
// ammo
id: slot10
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 5
@ -97,4 +127,13 @@ MiniWindow
margin-top: 5
text-align: center
text-auto-resize: true
GameLabel
id: soul
height: 30
anchors.top: slot9.bottom
anchors.left: slot9.left
margin-top: 5
text-align: center
text-auto-resize: true

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 3.9 KiB

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 4.7 KiB

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 4.7 KiB

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 4.5 KiB

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 3.9 KiB

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 4.2 KiB

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 4.4 KiB

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 4.4 KiB

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 4.1 KiB

İkili dosya gösterilmiyor.

Sonra

Genişlik:  |  Yükseklik:  |  Boyut: 4.8 KiB

@ -38,7 +38,7 @@ end
-- public functions
function Minimap.init()
connect(g_game, { onGameStart = Minimap.reset,
onForceWalk = Minimap.center } )
onForceWalk = Minimap.center })
g_keyboard.bindKeyDown('Ctrl+M', Minimap.toggle)
@ -78,7 +78,7 @@ end
function Minimap.terminate()
disconnect(g_game, { onGameStart = Minimap.reset,
onForceWalk = Minimap.center } )
onForceWalk = Minimap.center })
g_keyboard.unbindKeyDown('Ctrl+M')
@ -104,19 +104,6 @@ function Minimap.onMiniWindowClose()
minimapButton:setOn(false)
end
function Minimap.reset()
local player = g_game.getLocalPlayer()
if not player then return end
minimapWidget:followCreature(player)
minimapWidget:setZoom(DEFAULT_ZOOM)
end
function Minimap.center()
local player = g_game.getLocalPlayer()
if not player then return end
minimapWidget:followCreature(player)
end
function Minimap.isClickInRange(position, fromPosition, toPosition)
return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.x <= toPosition.x and position.y <= toPosition.y)
end
@ -159,4 +146,18 @@ function Minimap.onButtonClick(id)
pos.z = pos.z + 1
minimapWidget:setCameraPosition(pos)
end
end
-- hooked events
function Minimap.reset()
local player = g_game.getLocalPlayer()
if not player then return end
minimapWidget:followCreature(player)
minimapWidget:setZoom(DEFAULT_ZOOM)
end
function Minimap.center()
local player = g_game.getLocalPlayer()
if not player then return end
minimapWidget:followCreature(player)
end
Yükleniyor…
İptal
Kaydet