Implemented the mount interface, Fixed some interface stuff, Some cosmetics, and Updated the outfits window
* Added new arrow buttons. * Fixed the vertical separator. * Added new game_playermount module to handle player mounting. * Moved the battle icons to /images. * Outfit window accommodates for mounts, loads addons more efficiently and keeps addons set on update, added new Outfit.randomize function that allows you to randomize your outfit colors, and set up a new layout.
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
|
@ -38,4 +38,4 @@ TabButton < UIButton
|
||||||
|
|
||||||
$on:
|
$on:
|
||||||
image-clip: 0 40 20 20
|
image-clip: 0 40 20 20
|
||||||
color: #80c7f8
|
color: #80c7f8
|
||||||
|
|
|
@ -6,7 +6,7 @@ HorizontalSeparator < UIWidget
|
||||||
focusable: false
|
focusable: false
|
||||||
|
|
||||||
VerticalSeparator < UIWidget
|
VerticalSeparator < UIWidget
|
||||||
image-source: /images/horizontal_separator.png
|
image-source: /images/vertical_separator.png
|
||||||
image-border-left: 2
|
image-border-left: 2
|
||||||
width: 2
|
width: 2
|
||||||
phantom: true
|
phantom: true
|
||||||
|
|
|
@ -35,7 +35,7 @@ end
|
||||||
function g_mouse.bindAutoPress(widget, callback, delay, button)
|
function g_mouse.bindAutoPress(widget, callback, delay, button)
|
||||||
local button = button or MouseLeftButton
|
local button = button or MouseLeftButton
|
||||||
connect(widget, { onMousePress = function(widget, mousePos, mouseButton)
|
connect(widget, { onMousePress = function(widget, mousePos, mouseButton)
|
||||||
if(mouseButton ~= button) then
|
if mouseButton ~= button then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local startTime = g_clock.millis()
|
local startTime = g_clock.millis()
|
||||||
|
|
|
@ -31,6 +31,7 @@ Module
|
||||||
- game_bugreport
|
- game_bugreport
|
||||||
- game_shaders
|
- game_shaders
|
||||||
- game_playerdeath
|
- game_playerdeath
|
||||||
|
- game_playermount
|
||||||
|
|
||||||
@onLoad: |
|
@onLoad: |
|
||||||
dofile 'const'
|
dofile 'const'
|
||||||
|
|
|
@ -84,10 +84,10 @@ function Battle.terminate()
|
||||||
mouseWidget:destroy()
|
mouseWidget:destroy()
|
||||||
mouseWidget = nil
|
mouseWidget = nil
|
||||||
|
|
||||||
disconnect(Creature, { onSkullChange = Battle.checkCreatureSkull,
|
disconnect(Creature, { onSkullChange = Battle.checkCreatureSkull,
|
||||||
onEmblemChange = Battle.checkCreatureEmblem } )
|
onEmblemChange = Battle.checkCreatureEmblem } )
|
||||||
|
|
||||||
disconnect(g_game, { onAttackingCreatureChange = Battle.onAttack } )
|
disconnect(g_game, { onAttackingCreatureChange = Battle.onAttack } )
|
||||||
|
|
||||||
Battle = nil
|
Battle = nil
|
||||||
end
|
end
|
||||||
|
@ -191,7 +191,7 @@ function Battle.addCreature(creature)
|
||||||
local creatureId = creature:getId()
|
local creatureId = creature:getId()
|
||||||
|
|
||||||
if battleButtonsByCreaturesList[creatureId] == nil then
|
if battleButtonsByCreaturesList[creatureId] == nil then
|
||||||
local battleButton = g_ui.loadUI('battleButton.otui', battlePanel)
|
local battleButton = g_ui.loadUI('battlebutton.otui', battlePanel)
|
||||||
local creatureWidget = battleButton:getChildById('creature')
|
local creatureWidget = battleButton:getChildById('creature')
|
||||||
local labelWidget = battleButton:getChildById('label')
|
local labelWidget = battleButton:getChildById('label')
|
||||||
local lifeBarWidget = battleButton:getChildById('lifeBar')
|
local lifeBarWidget = battleButton:getChildById('lifeBar')
|
||||||
|
|
|
@ -22,19 +22,19 @@ BattleIcon < UICheckBox
|
||||||
image-color: #ffffff88
|
image-color: #ffffff88
|
||||||
|
|
||||||
BattlePlayers < BattleIcon
|
BattlePlayers < BattleIcon
|
||||||
image-source: /game_battle/battle_players.png
|
image-source: /game_battle/images/battle_players.png
|
||||||
|
|
||||||
BattleNPCs < BattleIcon
|
BattleNPCs < BattleIcon
|
||||||
image-source: /game_battle/battle_npcs.png
|
image-source: /game_battle/images/battle_npcs.png
|
||||||
|
|
||||||
BattleMonsters < BattleIcon
|
BattleMonsters < BattleIcon
|
||||||
image-source: /game_battle/battle_monsters.png
|
image-source: /game_battle/images/battle_monsters.png
|
||||||
|
|
||||||
BattleSkulls < BattleIcon
|
BattleSkulls < BattleIcon
|
||||||
image-source: /game_battle/battle_skulls.png
|
image-source: /game_battle/images/battle_skulls.png
|
||||||
|
|
||||||
BattleParty < BattleIcon
|
BattleParty < BattleIcon
|
||||||
image-source: /game_battle/battle_party.png
|
image-source: /game_battle/images/battle_party.png
|
||||||
|
|
||||||
MiniWindow
|
MiniWindow
|
||||||
id: battleWindow
|
id: battleWindow
|
||||||
|
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
@ -117,15 +117,15 @@ function GameInterface.show()
|
||||||
end
|
end
|
||||||
|
|
||||||
function GameInterface.hide()
|
function GameInterface.hide()
|
||||||
if(logoutWindow) then
|
if logoutWindow then
|
||||||
logoutWindow:destroy()
|
logoutWindow:destroy()
|
||||||
logoutWindow = nil
|
logoutWindow = nil
|
||||||
end
|
end
|
||||||
if(exitWindow) then
|
if exitWindow then
|
||||||
exitWindow:destroy()
|
exitWindow:destroy()
|
||||||
exitWindow = nil
|
exitWindow = nil
|
||||||
end
|
end
|
||||||
if(countWindow) then
|
if countWindow then
|
||||||
countWindow:destroy()
|
countWindow:destroy()
|
||||||
countWindow = nil
|
countWindow = nil
|
||||||
end
|
end
|
||||||
|
@ -144,7 +144,7 @@ function GameInterface.exit()
|
||||||
end
|
end
|
||||||
|
|
||||||
function GameInterface.tryExit()
|
function GameInterface.tryExit()
|
||||||
if(exitWindow) then
|
if exitWindow then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
exitWindow = g_ui.createWidget('ExitWindow', rootWidget)
|
exitWindow = g_ui.createWidget('ExitWindow', rootWidget)
|
||||||
|
@ -183,7 +183,7 @@ function GameInterface.logout()
|
||||||
end
|
end
|
||||||
|
|
||||||
function GameInterface.tryLogout()
|
function GameInterface.tryLogout()
|
||||||
if(logoutWindow) then
|
if logoutWindow then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
logoutWindow = g_ui.createWidget('LogoutWindow', rootWidget)
|
logoutWindow = g_ui.createWidget('LogoutWindow', rootWidget)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
Minimap = {}
|
Minimap = {}
|
||||||
|
|
||||||
|
-- public variables
|
||||||
|
minimapFirstLoad = true
|
||||||
|
|
||||||
-- private variables
|
-- private variables
|
||||||
local minimapWidget
|
local minimapWidget
|
||||||
local minimapButton
|
local minimapButton
|
||||||
|
@ -8,7 +11,6 @@ local DEFAULT_ZOOM = 60
|
||||||
local MAX_FLOOR_UP = 0
|
local MAX_FLOOR_UP = 0
|
||||||
local MAX_FLOOR_DOWN = 15
|
local MAX_FLOOR_DOWN = 15
|
||||||
local navigating = false
|
local navigating = false
|
||||||
minimapFirstLoad = true
|
|
||||||
|
|
||||||
-- private functions
|
-- private functions
|
||||||
function onMinimapMouseRelease(self, mousePosition, mouseButton)
|
function onMinimapMouseRelease(self, mousePosition, mouseButton)
|
||||||
|
@ -54,9 +56,9 @@ function Minimap.init()
|
||||||
|
|
||||||
minimapWindow = g_ui.loadUI('minimap.otui', GameInterface.getRightPanel())
|
minimapWindow = g_ui.loadUI('minimap.otui', GameInterface.getRightPanel())
|
||||||
|
|
||||||
|
|
||||||
minimapWidget = minimapWindow:recursiveGetChildById('minimap')
|
minimapWidget = minimapWindow:recursiveGetChildById('minimap')
|
||||||
g_mouse.bindAutoPress(minimapWidget, Minimap.compassClick, nil, MouseRightButton)
|
g_mouse.bindAutoPress(minimapWidget, Minimap.compassClick, nil, MouseRightButton)
|
||||||
|
g_mouse.bindAutoPress(minimapWidget, Minimap.compassClick, nil, MouseLeftButton)
|
||||||
minimapWidget:setAutoViewMode(false)
|
minimapWidget:setAutoViewMode(false)
|
||||||
minimapWidget:setViewMode(1) -- mid view
|
minimapWidget:setViewMode(1) -- mid view
|
||||||
minimapWidget:setDrawMinimapColors(true)
|
minimapWidget:setDrawMinimapColors(true)
|
||||||
|
@ -150,13 +152,13 @@ function Minimap.onButtonClick(id)
|
||||||
elseif id == "floorUp" then
|
elseif id == "floorUp" then
|
||||||
local pos = minimapWidget:getCameraPosition()
|
local pos = minimapWidget:getCameraPosition()
|
||||||
pos.z = pos.z - 1
|
pos.z = pos.z - 1
|
||||||
if(pos.z > MAX_FLOOR_UP) then
|
if pos.z > MAX_FLOOR_UP then
|
||||||
minimapWidget:setCameraPosition(pos)
|
minimapWidget:setCameraPosition(pos)
|
||||||
end
|
end
|
||||||
elseif id == "floorDown" then
|
elseif id == "floorDown" then
|
||||||
local pos = minimapWidget:getCameraPosition()
|
local pos = minimapWidget:getCameraPosition()
|
||||||
pos.z = pos.z + 1
|
pos.z = pos.z + 1
|
||||||
if(pos.z < MAX_FLOOR_DOWN) then
|
if pos.z < MAX_FLOOR_DOWN then
|
||||||
minimapWidget:setCameraPosition(pos)
|
minimapWidget:setCameraPosition(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
MapControl < Button
|
MapControl < Button
|
||||||
size: 20 20
|
size: 20 20
|
||||||
|
icon-clip: 0 32 16 16
|
||||||
|
|
||||||
$pressed:
|
$pressed:
|
||||||
icon-clip: 0 0 16 16
|
icon-clip: 0 0 16 16
|
||||||
|
@ -7,19 +8,16 @@ MapControl < Button
|
||||||
$hover !pressed:
|
$hover !pressed:
|
||||||
icon-clip: 0 16 16 16
|
icon-clip: 0 16 16 16
|
||||||
|
|
||||||
$!pressed !hover:
|
|
||||||
icon-clip: 0 32 16 16
|
|
||||||
|
|
||||||
FloorUpControl < MapControl
|
FloorUpControl < MapControl
|
||||||
icon-source: /game_minimap/floor_up.png
|
icon-source: /game_minimap/floor_up.png
|
||||||
|
|
||||||
FloorDownControl < MapControl
|
FloorDownControl < MapControl
|
||||||
icon-source: /game_minimap/floor_down.png
|
icon-source: /game_minimap/floor_down.png
|
||||||
|
|
||||||
//ZoomOutControl < MapControl
|
ZoomOutControl < MapControl
|
||||||
//image-source: /game_minimap/zoom_out.png
|
//image-source: /game_minimap/zoom_out.png
|
||||||
|
|
||||||
//ZoomInControl < MapControl
|
ZoomInControl < MapControl
|
||||||
//image-source: /game_minimap/zoom_in.png
|
//image-source: /game_minimap/zoom_in.png
|
||||||
|
|
||||||
MiniWindow
|
MiniWindow
|
||||||
|
@ -64,10 +62,9 @@ MiniWindow
|
||||||
enabled: true
|
enabled: true
|
||||||
@onClick: Minimap.onButtonClick(self:getId())
|
@onClick: Minimap.onButtonClick(self:getId())
|
||||||
|
|
||||||
Button
|
ZoomInControl
|
||||||
id: zoomIn
|
id: zoomIn
|
||||||
text: +
|
text: +
|
||||||
size: 20 20
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
margin-right: 4
|
margin-right: 4
|
||||||
|
@ -75,11 +72,10 @@ MiniWindow
|
||||||
enabled: true
|
enabled: true
|
||||||
@onClick: Minimap.onButtonClick(self:getId())
|
@onClick: Minimap.onButtonClick(self:getId())
|
||||||
|
|
||||||
Button
|
ZoomOutControl
|
||||||
id: zoomOut
|
id: zoomOut
|
||||||
text: -
|
text: -
|
||||||
font: terminus-14px-bold
|
font: terminus-14px-bold
|
||||||
size: 20 20
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
margin-right: 4
|
margin-right: 4
|
||||||
|
|
|
@ -1,13 +1,30 @@
|
||||||
Outfit = {}
|
Outfit = {}
|
||||||
|
|
||||||
-- private variables
|
-- private variables
|
||||||
|
local addonSets = {
|
||||||
|
[1] = { 1 },
|
||||||
|
[2] = { 2 },
|
||||||
|
[3] = { 1, 2 },
|
||||||
|
[4] = { 3 },
|
||||||
|
[5] = { 1, 3 },
|
||||||
|
[6] = { 2, 3 },
|
||||||
|
[7] = { 1, 2, 3 }
|
||||||
|
}
|
||||||
local outfitWindow
|
local outfitWindow
|
||||||
local outfitCreature
|
|
||||||
local outfit
|
local outfit
|
||||||
local outfits
|
local outfits
|
||||||
|
local outfitCreature
|
||||||
local currentOutfit = 1
|
local currentOutfit = 1
|
||||||
|
|
||||||
|
local addons
|
||||||
local currentColorBox
|
local currentColorBox
|
||||||
local currentClotheButtonBox
|
local currentClotheButtonBox
|
||||||
|
local colorBoxes = {}
|
||||||
|
|
||||||
|
local mount
|
||||||
|
local mounts
|
||||||
|
local mountCreature
|
||||||
|
local currentMount = 1
|
||||||
|
|
||||||
-- private functions
|
-- private functions
|
||||||
local function onAddonCheckChange(addon, value)
|
local function onAddonCheckChange(addon, value)
|
||||||
|
@ -71,51 +88,50 @@ local function onClotheCheckChange(clotheButtonBox)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function update()
|
local function updateOutfit()
|
||||||
|
if table.empty(outfits) then
|
||||||
|
return
|
||||||
|
end
|
||||||
local nameWidget = outfitWindow:getChildById('outfitName')
|
local nameWidget = outfitWindow:getChildById('outfitName')
|
||||||
nameWidget:setText(outfits[currentOutfit][2])
|
nameWidget:setText(outfits[currentOutfit][2])
|
||||||
|
|
||||||
local availableAddons = outfits[currentOutfit][3]
|
local availableAddons = outfits[currentOutfit][3]
|
||||||
local addon1 = outfitWindow:getChildById('addon1')
|
|
||||||
local addon2 = outfitWindow:getChildById('addon2')
|
|
||||||
local addon3 = outfitWindow:getChildById('addon3')
|
|
||||||
addon1:setChecked(false)
|
|
||||||
addon2:setChecked(false)
|
|
||||||
addon3:setChecked(false)
|
|
||||||
addon1.onCheckChange = function(self) onAddonCheckChange(self, 1) end
|
|
||||||
addon2.onCheckChange = function(self) onAddonCheckChange(self, 2) end
|
|
||||||
addon3.onCheckChange = function(self) onAddonCheckChange(self, 4) end
|
|
||||||
addon1:setEnabled(false)
|
|
||||||
addon2:setEnabled(false)
|
|
||||||
addon3:setEnabled(false)
|
|
||||||
|
|
||||||
-- Maybe rework this someday
|
local prevAddons = {}
|
||||||
if availableAddons == 1 then
|
for k, addon in pairs(addons) do
|
||||||
addon1:setEnabled(true)
|
prevAddons[k] = addon.widget:isChecked()
|
||||||
elseif availableAddons == 2 then
|
addon.widget:setChecked(false)
|
||||||
addon2:setEnabled(true)
|
addon.widget:setEnabled(false)
|
||||||
elseif availableAddons == 3 then
|
end
|
||||||
addon1:setEnabled(true)
|
|
||||||
addon2:setEnabled(true)
|
if availableAddons > 0 then
|
||||||
elseif availableAddons == 4 then
|
for _, i in pairs(addonSets[availableAddons]) do
|
||||||
addon3:setEnabled(true)
|
addons[i].widget:setEnabled(true)
|
||||||
elseif availableAddons == 5 then
|
end
|
||||||
addon1:setEnabled(true)
|
end
|
||||||
addon3:setEnabled(true)
|
|
||||||
elseif availableAddons == 6 then
|
outfit.addons = 0
|
||||||
addon2:setEnabled(true)
|
for k, addon in pairs(prevAddons) do
|
||||||
addon3:setEnabled(true)
|
if addon and addons[k].widget:isEnabled() then
|
||||||
elseif availableAddons == 7 then
|
addons[k].widget:setChecked(true)
|
||||||
addon1:setEnabled(true)
|
end
|
||||||
addon2:setEnabled(true)
|
|
||||||
addon3:setEnabled(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
outfit.type = outfits[currentOutfit][1]
|
outfit.type = outfits[currentOutfit][1]
|
||||||
outfit.addons = 0
|
|
||||||
outfitCreature:setOutfit(outfit)
|
outfitCreature:setOutfit(outfit)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function updateMount()
|
||||||
|
if table.empty(mounts) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local nameMountWidget = outfitWindow:getChildById('mountName')
|
||||||
|
nameMountWidget:setText(mounts[currentMount][2])
|
||||||
|
|
||||||
|
mount.type = mounts[currentMount][1]
|
||||||
|
mountCreature:setOutfit(mount)
|
||||||
|
end
|
||||||
|
|
||||||
-- public functions
|
-- public functions
|
||||||
function Outfit.init()
|
function Outfit.init()
|
||||||
connect(g_game, { onOpenOutfitWindow = Outfit.create,
|
connect(g_game, { onOpenOutfitWindow = Outfit.create,
|
||||||
|
@ -126,20 +142,36 @@ function Outfit.terminate()
|
||||||
disconnect(g_game, { onOpenOutfitWindow = Outfit.create,
|
disconnect(g_game, { onOpenOutfitWindow = Outfit.create,
|
||||||
onGameEnd = Outfit.destroy })
|
onGameEnd = Outfit.destroy })
|
||||||
Outfit.destroy()
|
Outfit.destroy()
|
||||||
|
|
||||||
Outfit = nil
|
Outfit = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.create(creature, outfitList)
|
function Outfit.create(creatureOutfit, outfitList, creatureMount, mountList)
|
||||||
outfitCreature = creature
|
outfitCreature = creatureOutfit
|
||||||
|
mountCreature = creatureMount
|
||||||
outfits = outfitList
|
outfits = outfitList
|
||||||
Outfit.destroy()
|
mounts = mountList
|
||||||
|
Outfit.destroy()
|
||||||
outfitWindow = g_ui.displayUI('outfit.otui')
|
|
||||||
--outfitWindow:lock()
|
|
||||||
|
|
||||||
|
outfitWindow = g_ui.displayUI('outfitwindow.otui')
|
||||||
outfit = outfitCreature:getOutfit()
|
outfit = outfitCreature:getOutfit()
|
||||||
|
mount = mountCreature:getOutfit()
|
||||||
|
|
||||||
|
addons = {
|
||||||
|
[1] = {widget = outfitWindow:getChildById('addon1'), value = 1},
|
||||||
|
[2] = {widget = outfitWindow:getChildById('addon2'), value = 2},
|
||||||
|
[3] = {widget = outfitWindow:getChildById('addon3'), value = 4}
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, addon in pairs(addons) do
|
||||||
|
addon.widget.onCheckChange = function(self) onAddonCheckChange(self, addon.value) end
|
||||||
|
end
|
||||||
|
|
||||||
|
if outfit.addons > 0 then
|
||||||
|
for _, i in pairs(addonSets[outfit.addons]) do
|
||||||
|
addons[i].widget:setChecked(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
currentClotheButtonBox = outfitWindow:getChildById('head')
|
currentClotheButtonBox = outfitWindow:getChildById('head')
|
||||||
outfitWindow:getChildById('head').onCheckChange = onClotheCheckChange
|
outfitWindow:getChildById('head').onCheckChange = onClotheCheckChange
|
||||||
outfitWindow:getChildById('primary').onCheckChange = onClotheCheckChange
|
outfitWindow:getChildById('primary').onCheckChange = onClotheCheckChange
|
||||||
|
@ -150,6 +182,9 @@ function Outfit.create(creature, outfitList)
|
||||||
local colorBoxPanel = outfitWindow:getChildById('colorBoxPanel')
|
local colorBoxPanel = outfitWindow:getChildById('colorBoxPanel')
|
||||||
outfitCreatureBox:setCreature(outfitCreature)
|
outfitCreatureBox:setCreature(outfitCreature)
|
||||||
|
|
||||||
|
local mountCreatureBox = outfitWindow:getChildById('mountCreatureBox')
|
||||||
|
mountCreatureBox:setCreature(mountCreature)
|
||||||
|
|
||||||
for j=0,6 do
|
for j=0,6 do
|
||||||
for i=0,18 do
|
for i=0,18 do
|
||||||
local colorBox = g_ui.createWidget('ColorBox', colorBoxPanel)
|
local colorBox = g_ui.createWidget('ColorBox', colorBoxPanel)
|
||||||
|
@ -163,6 +198,7 @@ function Outfit.create(creature, outfitList)
|
||||||
colorBox:setChecked(true)
|
colorBox:setChecked(true)
|
||||||
end
|
end
|
||||||
colorBox.onCheckChange = onColorCheckChange
|
colorBox.onCheckChange = onColorCheckChange
|
||||||
|
table.insert(colorBoxes, colorBox)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -173,8 +209,16 @@ function Outfit.create(creature, outfitList)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
currentMount = 1
|
||||||
|
for i=1,#mountList do
|
||||||
|
if mountList[i][1] == mount.type then
|
||||||
|
currentMount = i
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
update()
|
updateOutfit()
|
||||||
|
updateMount()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.destroy()
|
function Outfit.destroy()
|
||||||
|
@ -182,29 +226,62 @@ function Outfit.destroy()
|
||||||
outfitWindow:destroy()
|
outfitWindow:destroy()
|
||||||
outfitWindow = nil
|
outfitWindow = nil
|
||||||
outfitCreature = nil
|
outfitCreature = nil
|
||||||
|
mountCreature = nil
|
||||||
currentColorBox = nil
|
currentColorBox = nil
|
||||||
currentClotheButtonBox = nil
|
currentClotheButtonBox = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Outfit.randomize()
|
||||||
|
local outfitTemplate = {
|
||||||
|
outfitWindow:getChildById('head'),
|
||||||
|
outfitWindow:getChildById('primary'),
|
||||||
|
outfitWindow:getChildById('secondary'),
|
||||||
|
outfitWindow:getChildById('detail')
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, section in pairs(outfitTemplate) do
|
||||||
|
section:setChecked(true)
|
||||||
|
colorBoxes[math.random(1, #colorBoxes)]:setChecked(true)
|
||||||
|
section:setChecked(false)
|
||||||
|
end
|
||||||
|
outfitTemplate[1]:setChecked(true)
|
||||||
|
end
|
||||||
|
|
||||||
function Outfit.accept()
|
function Outfit.accept()
|
||||||
|
outfit.mount = mount.type
|
||||||
g_game.changeOutfit(outfit)
|
g_game.changeOutfit(outfit)
|
||||||
Outfit.destroy()
|
Outfit.destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.nextType()
|
function Outfit.nextOutfitType()
|
||||||
currentOutfit = currentOutfit + 1
|
currentOutfit = currentOutfit + 1
|
||||||
if currentOutfit > #outfits then
|
if currentOutfit > #outfits then
|
||||||
currentOutfit = 1
|
currentOutfit = 1
|
||||||
end
|
end
|
||||||
update()
|
updateOutfit()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.previousType()
|
function Outfit.previousOutfitType()
|
||||||
currentOutfit = currentOutfit - 1
|
currentOutfit = currentOutfit - 1
|
||||||
if currentOutfit <= 0 then
|
if currentOutfit <= 0 then
|
||||||
currentOutfit = #outfits
|
currentOutfit = #outfits
|
||||||
end
|
end
|
||||||
update()
|
updateOutfit()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Outfit.nextMountType()
|
||||||
|
currentMount = currentMount + 1
|
||||||
|
if currentMount > #mounts then
|
||||||
|
currentMount = 1
|
||||||
|
end
|
||||||
|
updateMount()
|
||||||
|
end
|
||||||
|
|
||||||
|
function Outfit.previousMountType()
|
||||||
|
currentMount = currentMount - 1
|
||||||
|
if currentMount <= 0 then
|
||||||
|
currentMount = #mounts
|
||||||
|
end
|
||||||
|
updateMount()
|
||||||
|
end
|
||||||
|
|
|
@ -1,145 +0,0 @@
|
||||||
Window
|
|
||||||
!text: tr('Select Outfit')
|
|
||||||
size: 550 280
|
|
||||||
padding: 0 0 0 0
|
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
@onEnter: Outfit.accept()
|
|
||||||
@onEscape: Outfit.destroy()
|
|
||||||
|
|
||||||
Label
|
|
||||||
id: outfitName
|
|
||||||
!text: tr('Outfit Name')
|
|
||||||
width: 100
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
margin-top: 34
|
|
||||||
margin-left: 20
|
|
||||||
|
|
||||||
Creature
|
|
||||||
id: outfitCreatureBox
|
|
||||||
anchors.top: outfitName.bottom
|
|
||||||
anchors.left: outfitName.left
|
|
||||||
margin-top: 5
|
|
||||||
padding: 4 4 4 4
|
|
||||||
fixed-creature-size: true
|
|
||||||
|
|
||||||
Panel
|
|
||||||
id: colorBoxPanel
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.right: parent.right
|
|
||||||
margin-top: 54
|
|
||||||
margin-right: 20
|
|
||||||
width: 323
|
|
||||||
height: 119
|
|
||||||
layout:
|
|
||||||
type: grid
|
|
||||||
cell-size: 16 16
|
|
||||||
cell-spacing: 2
|
|
||||||
num-columns: 19
|
|
||||||
num-lines: 7
|
|
||||||
|
|
||||||
ButtonBox
|
|
||||||
id: head
|
|
||||||
!text: tr('Head')
|
|
||||||
anchors.top: outfitCreatureBox.top
|
|
||||||
anchors.left: outfitCreatureBox.right
|
|
||||||
margin-left: 10
|
|
||||||
checked: true
|
|
||||||
width: 90
|
|
||||||
|
|
||||||
ButtonBox
|
|
||||||
id: primary
|
|
||||||
!text: tr('Primary')
|
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: prev.left
|
|
||||||
width: 90
|
|
||||||
|
|
||||||
ButtonBox
|
|
||||||
id: secondary
|
|
||||||
!text: tr('Secondary')
|
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: prev.left
|
|
||||||
width: 90
|
|
||||||
|
|
||||||
ButtonBox
|
|
||||||
id: detail
|
|
||||||
!text: tr('Detail')
|
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: prev.left
|
|
||||||
width: 90
|
|
||||||
|
|
||||||
Button
|
|
||||||
id: outfitNextButton
|
|
||||||
@onClick: Outfit.nextType()
|
|
||||||
text: >>
|
|
||||||
width: 32
|
|
||||||
margin-top: 4
|
|
||||||
anchors.top: outfitCreatureBox.bottom
|
|
||||||
anchors.right: outfitCreatureBox.right
|
|
||||||
|
|
||||||
Button
|
|
||||||
id: outfitPreviousButton
|
|
||||||
@onClick: Outfit.previousType()
|
|
||||||
text: <<
|
|
||||||
width: 32
|
|
||||||
margin-top: 4
|
|
||||||
anchors.top: outfitCreatureBox.bottom
|
|
||||||
anchors.left: outfitCreatureBox.left
|
|
||||||
|
|
||||||
CheckBox
|
|
||||||
id: addon1
|
|
||||||
!text: tr('Addon 1')
|
|
||||||
enabled: false
|
|
||||||
margin-top: 6
|
|
||||||
width: 100
|
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: prev.left
|
|
||||||
|
|
||||||
CheckBox
|
|
||||||
id: addon2
|
|
||||||
!text: tr('Addon 2')
|
|
||||||
enabled: false
|
|
||||||
margin-top: 2
|
|
||||||
width: 100
|
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: prev.left
|
|
||||||
|
|
||||||
CheckBox
|
|
||||||
id: addon3
|
|
||||||
!text: tr('Addon 3')
|
|
||||||
enabled: false
|
|
||||||
margin-top: 2
|
|
||||||
width: 100
|
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: prev.left
|
|
||||||
|
|
||||||
HorizontalSeparator
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: next.top
|
|
||||||
margin-left: 16
|
|
||||||
margin-right: 16
|
|
||||||
margin-bottom: 10
|
|
||||||
|
|
||||||
Button
|
|
||||||
id: outfitOkButton
|
|
||||||
!text: tr('Ok')
|
|
||||||
width: 64
|
|
||||||
anchors.right: next.left
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
margin-bottom: 16
|
|
||||||
margin-right: 16
|
|
||||||
@onClick: Outfit.accept()
|
|
||||||
|
|
||||||
Button
|
|
||||||
id: outfitCancelButton
|
|
||||||
!text: tr('Cancel')
|
|
||||||
width: 64
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
margin-bottom: 16
|
|
||||||
margin-right: 16
|
|
||||||
@onClick: Outfit.destroy()
|
|
|
@ -0,0 +1,221 @@
|
||||||
|
BrowseButton < Button
|
||||||
|
size: 20 29
|
||||||
|
icon-clip: 0 0 12 21
|
||||||
|
|
||||||
|
$hover !disabled:
|
||||||
|
icon-clip: 0 21 12 21
|
||||||
|
|
||||||
|
$pressed:
|
||||||
|
icon-clip: 0 22 12 21
|
||||||
|
|
||||||
|
$disabled:
|
||||||
|
color: #f0ad4d88
|
||||||
|
|
||||||
|
NextOutfitButton < BrowseButton
|
||||||
|
icon-source: /images/arrow_right.png
|
||||||
|
|
||||||
|
PrevOutfitButton < BrowseButton
|
||||||
|
icon-source: /images/arrow_left.png
|
||||||
|
|
||||||
|
NextMountButton < BrowseButton
|
||||||
|
icon-source: /images/arrow_right.png
|
||||||
|
|
||||||
|
PrevMountButton < BrowseButton
|
||||||
|
icon-source: /images/arrow_left.png
|
||||||
|
|
||||||
|
Window
|
||||||
|
!text: tr('Select Outfit')
|
||||||
|
size: 338 375
|
||||||
|
padding: 0 0 0 0
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
@onEnter: Outfit.accept()
|
||||||
|
@onEscape: Outfit.destroy()
|
||||||
|
|
||||||
|
// Creature Boxes
|
||||||
|
|
||||||
|
Creature
|
||||||
|
id: outfitCreatureBox
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
margin-top: 48
|
||||||
|
margin-left: 40
|
||||||
|
padding: 4 4 4 4
|
||||||
|
fixed-creature-size: true
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: outfitName
|
||||||
|
!text: tr('No Outfit')
|
||||||
|
width: 100
|
||||||
|
anchors.bottom: prev.top
|
||||||
|
anchors.left: prev.left
|
||||||
|
margin-bottom: 2
|
||||||
|
|
||||||
|
NextOutfitButton
|
||||||
|
id: outfitNextButton
|
||||||
|
anchors.left: outfitCreatureBox.right
|
||||||
|
anchors.verticalCenter: outfitCreatureBox.verticalCenter
|
||||||
|
margin-left: 3
|
||||||
|
enabled: true
|
||||||
|
@onClick: Outfit.nextOutfitType()
|
||||||
|
|
||||||
|
PrevOutfitButton
|
||||||
|
id: outfitPrevButton
|
||||||
|
anchors.right: outfitCreatureBox.left
|
||||||
|
anchors.verticalCenter: outfitCreatureBox.verticalCenter
|
||||||
|
margin-right: 3
|
||||||
|
enabled: true
|
||||||
|
@onClick: Outfit.previousOutfitType()
|
||||||
|
|
||||||
|
Creature
|
||||||
|
id: mountCreatureBox
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
margin-top: 48
|
||||||
|
margin-right: 40
|
||||||
|
padding: 4 4 4 4
|
||||||
|
fixed-creature-size: true
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: mountName
|
||||||
|
!text: tr('No Mount')
|
||||||
|
width: 140
|
||||||
|
anchors.bottom: prev.top
|
||||||
|
anchors.left: prev.left
|
||||||
|
margin-bottom: 2
|
||||||
|
|
||||||
|
NextMountButton
|
||||||
|
id: mountNextButton
|
||||||
|
anchors.left: mountCreatureBox.right
|
||||||
|
anchors.verticalCenter: mountCreatureBox.verticalCenter
|
||||||
|
margin-left: 3
|
||||||
|
enabled: true
|
||||||
|
@onClick: Outfit.nextMountType()
|
||||||
|
|
||||||
|
PrevMountButton
|
||||||
|
id: mountPreviousButton
|
||||||
|
anchors.right: mountCreatureBox.left
|
||||||
|
anchors.verticalCenter: mountCreatureBox.verticalCenter
|
||||||
|
margin-right: 3
|
||||||
|
enabled: true
|
||||||
|
@onClick: Outfit.previousMountType()
|
||||||
|
|
||||||
|
// Addon Check Boxes
|
||||||
|
|
||||||
|
CheckBox
|
||||||
|
id: addon1
|
||||||
|
!text: tr('Addon 1')
|
||||||
|
width: 80
|
||||||
|
anchors.top: outfitCreatureBox.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
margin-top: 6
|
||||||
|
margin-left: 18
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
CheckBox
|
||||||
|
id: addon2
|
||||||
|
!text: tr('Addon 2')
|
||||||
|
width: 80
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.left: prev.right
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
CheckBox
|
||||||
|
id: addon3
|
||||||
|
!text: tr('Addon 3')
|
||||||
|
width: 80
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.left: prev.right
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
// Body Selection Buttons
|
||||||
|
|
||||||
|
ButtonBox
|
||||||
|
id: head
|
||||||
|
!text: tr('Head')
|
||||||
|
anchors.top: addon1.bottom
|
||||||
|
anchors.left: addon1.left
|
||||||
|
margin-top: 5
|
||||||
|
checked: true
|
||||||
|
width: 76
|
||||||
|
|
||||||
|
ButtonBox
|
||||||
|
id: primary
|
||||||
|
!text: tr('Primary')
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.left: prev.right
|
||||||
|
width: 76
|
||||||
|
|
||||||
|
ButtonBox
|
||||||
|
id: secondary
|
||||||
|
!text: tr('Secondary')
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.left: prev.right
|
||||||
|
width: 76
|
||||||
|
|
||||||
|
ButtonBox
|
||||||
|
id: detail
|
||||||
|
!text: tr('Detail')
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.left: prev.right
|
||||||
|
width: 76
|
||||||
|
|
||||||
|
// Color Panel
|
||||||
|
|
||||||
|
Panel
|
||||||
|
id: colorBoxPanel
|
||||||
|
anchors.top: head.bottom
|
||||||
|
anchors.left: head.left
|
||||||
|
margin-top: 3
|
||||||
|
margin-right: 20
|
||||||
|
width: 323
|
||||||
|
height: 119
|
||||||
|
layout:
|
||||||
|
type: grid
|
||||||
|
cell-size: 14 14
|
||||||
|
cell-spacing: 2
|
||||||
|
num-columns: 19
|
||||||
|
num-lines: 7
|
||||||
|
|
||||||
|
// Action Button Section
|
||||||
|
|
||||||
|
Button
|
||||||
|
id: randomizeButton
|
||||||
|
!text: tr('Randomize')
|
||||||
|
!tooltip: tr('Randomize characters outfit')
|
||||||
|
width: 75
|
||||||
|
anchors.left: prev.left
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
margin-right: 16
|
||||||
|
@onClick: Outfit.randomize()
|
||||||
|
|
||||||
|
HorizontalSeparator
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: next.top
|
||||||
|
margin-left: 16
|
||||||
|
margin-right: 16
|
||||||
|
margin-bottom: 10
|
||||||
|
margin-top: 5
|
||||||
|
|
||||||
|
Button
|
||||||
|
id: outfitOkButton
|
||||||
|
!text: tr('Okay')
|
||||||
|
width: 64
|
||||||
|
anchors.right: next.left
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
margin-bottom: 16
|
||||||
|
margin-right: 16
|
||||||
|
@onClick: Outfit.accept()
|
||||||
|
|
||||||
|
Button
|
||||||
|
id: outfitCancelButton
|
||||||
|
!text: tr('Cancel')
|
||||||
|
width: 64
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
margin-bottom: 16
|
||||||
|
margin-right: 16
|
||||||
|
@onClick: Outfit.destroy()
|
|
@ -23,7 +23,7 @@ end
|
||||||
|
|
||||||
function PlayerDeath.reset()
|
function PlayerDeath.reset()
|
||||||
GameInterface.getMapPanel():recursiveGetChildById('centerAdvance'):hide()
|
GameInterface.getMapPanel():recursiveGetChildById('centerAdvance'):hide()
|
||||||
if(deathWindow) then
|
if deathWindow then
|
||||||
deathWindow:destroy()
|
deathWindow:destroy()
|
||||||
deathWindow = nil
|
deathWindow = nil
|
||||||
end
|
end
|
||||||
|
@ -44,7 +44,7 @@ function PlayerDeath.displayDeadMessage()
|
||||||
end
|
end
|
||||||
|
|
||||||
function PlayerDeath.openWindow()
|
function PlayerDeath.openWindow()
|
||||||
if(deathWindow) then
|
if deathWindow then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
deathWindow = g_ui.createWidget('DeathWindow', rootWidget)
|
deathWindow = g_ui.createWidget('DeathWindow', rootWidget)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Module
|
Module
|
||||||
name: game_playerdeath
|
name: game_playerdeath
|
||||||
description: Manage player deaths
|
description: Manage player deaths
|
||||||
author: edubart, BeniS
|
author: BeniS, edubart
|
||||||
website: www.otclient.info
|
website: www.otclient.info
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
PlayerMount = {}
|
||||||
|
|
||||||
|
-- private variables
|
||||||
|
|
||||||
|
-- private functions
|
||||||
|
|
||||||
|
-- public functions
|
||||||
|
function PlayerMount.init()
|
||||||
|
g_ui.importStyle('playermount.otui')
|
||||||
|
|
||||||
|
connect(g_game, { onDeath = PlayerMount.dismount,
|
||||||
|
onGameEnd = PlayerMount.dismount })
|
||||||
|
|
||||||
|
g_keyboard.bindKeyDown('Ctrl+R', PlayerMount.toggleMount, gameRootPanel)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PlayerMount.terminate()
|
||||||
|
disconnect(g_game, { onDeath = PlayerMount.dismount,
|
||||||
|
onGameEnd = PlayerMount.dismount })
|
||||||
|
|
||||||
|
g_keyboard.unbindKeyDown('Ctrl+R', PlayerMount.toggleMount, gameRootPanel)
|
||||||
|
PlayerMount.reset()
|
||||||
|
|
||||||
|
PlayerMount = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- hooked events
|
||||||
|
function PlayerMount.toggleMount()
|
||||||
|
if g_game.isMounted() then
|
||||||
|
g_game.mount(false)
|
||||||
|
else
|
||||||
|
g_game.mount(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function PlayerMount.dismount()
|
||||||
|
g_game.mount(false)
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
Module
|
||||||
|
name: game_playermount
|
||||||
|
description: Manage player mounts
|
||||||
|
author: BeniS
|
||||||
|
website: www.otclient.info
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
- client_entergame
|
||||||
|
|
||||||
|
@onLoad: |
|
||||||
|
dofile 'playermount'
|
||||||
|
PlayerMount.init()
|
||||||
|
|
||||||
|
@onUnload: |
|
||||||
|
PlayerMount.terminate()
|
|
@ -5,7 +5,7 @@ local textWindow
|
||||||
|
|
||||||
-- private functions
|
-- private functions
|
||||||
local function onGameEditText(id, itemId, maxLength, text, writter, time)
|
local function onGameEditText(id, itemId, maxLength, text, writter, time)
|
||||||
if(textWindow) then
|
if textWindow then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
textWindow = g_ui.createWidget('TextWindow', rootWidget)
|
textWindow = g_ui.createWidget('TextWindow', rootWidget)
|
||||||
|
@ -61,7 +61,7 @@ local function onGameEditText(id, itemId, maxLength, text, writter, time)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function onGameEditList(id, doorId, text)
|
local function onGameEditList(id, doorId, text)
|
||||||
if(textWindow) then
|
if textWindow then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
textWindow = g_ui.createWidget('TextWindow', rootWidget)
|
textWindow = g_ui.createWidget('TextWindow', rootWidget)
|
||||||
|
@ -105,7 +105,7 @@ function TextWindow.terminate()
|
||||||
end
|
end
|
||||||
|
|
||||||
function TextWindow.destroy()
|
function TextWindow.destroy()
|
||||||
if(textWindow) then
|
if textWindow then
|
||||||
textWindow:destroy()
|
textWindow:destroy()
|
||||||
textWindow = nil
|
textWindow = nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -257,7 +257,7 @@ void Game::processCreatureTeleport(const CreaturePtr& creature)
|
||||||
g_lua.callGlobalField("g_game", "onCreatureTeleport", creature);
|
g_lua.callGlobalField("g_game", "onCreatureTeleport", creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processChannelList(const std::vector<std::tuple<int, std::string>>& channelList)
|
void Game::processChannelList(const std::vector<std::tuple<int, std::string> >& channelList)
|
||||||
{
|
{
|
||||||
g_lua.callGlobalField("g_game", "onChannelList", channelList);
|
g_lua.callGlobalField("g_game", "onChannelList", channelList);
|
||||||
}
|
}
|
||||||
|
@ -324,21 +324,31 @@ void Game::processAutomapFlag(const Position& pos, int icon, const std::string&
|
||||||
g_lua.callGlobalField("g_game", "onAutomapFlag", pos, icon, message);
|
g_lua.callGlobalField("g_game", "onAutomapFlag", pos, icon, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processOpenOutfitWindow(const Outfit& currentOufit, const std::vector<std::tuple<int, std::string, int>>& outfitList)
|
void Game::processOpenOutfitWindow(const Outfit& currentOufit, const std::vector<std::tuple<int, std::string, int> >& outfitList,
|
||||||
|
const std::vector<std::tuple<int, std::string> >& mountList)
|
||||||
{
|
{
|
||||||
CreaturePtr virtualCreature = CreaturePtr(new Creature);
|
// create virtual creature outfit
|
||||||
virtualCreature->setDirection(Otc::South);
|
CreaturePtr virtualOutfitCreature = CreaturePtr(new Creature);
|
||||||
virtualCreature->setOutfit(currentOufit);
|
virtualOutfitCreature->setDirection(Otc::South);
|
||||||
|
virtualOutfitCreature->setOutfit(currentOufit);
|
||||||
|
|
||||||
g_lua.callGlobalField("g_game", "onOpenOutfitWindow", virtualCreature, outfitList);
|
// creature virtual mount outfit
|
||||||
|
CreaturePtr virtualMountCreature = CreaturePtr(new Creature);
|
||||||
|
virtualMountCreature->setDirection(Otc::South);
|
||||||
|
|
||||||
|
Outfit mountOutfit;
|
||||||
|
mountOutfit.setId(currentOufit.getMount());
|
||||||
|
virtualMountCreature->setOutfit(mountOutfit);
|
||||||
|
|
||||||
|
g_lua.callGlobalField("g_game", "onOpenOutfitWindow", virtualOutfitCreature, outfitList, virtualMountCreature, mountList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processOpenNpcTrade(const std::vector<std::tuple<ItemPtr, std::string, int, int, int>>& items)
|
void Game::processOpenNpcTrade(const std::vector<std::tuple<ItemPtr, std::string, int, int, int> >& items)
|
||||||
{
|
{
|
||||||
g_lua.callGlobalField("g_game", "onOpenNpcTrade", items);
|
g_lua.callGlobalField("g_game", "onOpenNpcTrade", items);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processPlayerGoods(int money, const std::vector<std::tuple<ItemPtr, int>>& goods)
|
void Game::processPlayerGoods(int money, const std::vector<std::tuple<ItemPtr, int> >& goods)
|
||||||
{
|
{
|
||||||
g_lua.callGlobalField("g_game", "onPlayerGoods", money, goods);
|
g_lua.callGlobalField("g_game", "onPlayerGoods", money, goods);
|
||||||
}
|
}
|
||||||
|
@ -373,12 +383,12 @@ void Game::processEditList(uint id, int doorId, const std::string& text)
|
||||||
g_lua.callGlobalField("g_game", "onEditList", id, doorId, text);
|
g_lua.callGlobalField("g_game", "onEditList", id, doorId, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processQuestLog(const std::vector<std::tuple<int, std::string, bool>>& questList)
|
void Game::processQuestLog(const std::vector<std::tuple<int, std::string, bool> >& questList)
|
||||||
{
|
{
|
||||||
g_lua.callGlobalField("g_game", "onQuestLog", questList);
|
g_lua.callGlobalField("g_game", "onQuestLog", questList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processQuestLine(int questId, const std::vector<std::tuple<std::string, std::string>>& questMissions)
|
void Game::processQuestLine(int questId, const std::vector<std::tuple<std::string, std::string> >& questMissions)
|
||||||
{
|
{
|
||||||
g_lua.callGlobalField("g_game", "onQuestLine", questId, questMissions);
|
g_lua.callGlobalField("g_game", "onQuestLine", questId, questMissions);
|
||||||
}
|
}
|
||||||
|
@ -1044,7 +1054,7 @@ void Game::mount(bool mount)
|
||||||
{
|
{
|
||||||
if(!canPerformGameAction())
|
if(!canPerformGameAction())
|
||||||
return;
|
return;
|
||||||
m_protocolGame->sendMount(mount);
|
m_protocolGame->sendMounted(mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Game::checkBotProtection()
|
bool Game::checkBotProtection()
|
||||||
|
|
|
@ -71,7 +71,7 @@ protected:
|
||||||
void processContainerRemoveItem(int containerId, int slot);
|
void processContainerRemoveItem(int containerId, int slot);
|
||||||
|
|
||||||
// channel related
|
// channel related
|
||||||
void processChannelList(const std::vector<std::tuple<int, std::string>>& channelList);
|
void processChannelList(const std::vector<std::tuple<int, std::string> >& channelList);
|
||||||
void processOpenChannel(int channelId, const std::string& name);
|
void processOpenChannel(int channelId, const std::string& name);
|
||||||
void processOpenPrivateChannel(const std::string& name);
|
void processOpenPrivateChannel(const std::string& name);
|
||||||
void processOpenOwnPrivateChannel(int channelId, const std::string& name);
|
void processOpenOwnPrivateChannel(int channelId, const std::string& name);
|
||||||
|
@ -92,11 +92,12 @@ protected:
|
||||||
void processAutomapFlag(const Position& pos, int icon, const std::string& message);
|
void processAutomapFlag(const Position& pos, int icon, const std::string& message);
|
||||||
|
|
||||||
// outfit
|
// outfit
|
||||||
void processOpenOutfitWindow(const Outfit& currentOufit, const std::vector<std::tuple<int, std::string, int>>& outfitList);
|
void processOpenOutfitWindow(const Outfit& currentOufit, const std::vector<std::tuple<int, std::string, int> >& outfitList,
|
||||||
|
const std::vector<std::tuple<int, std::string> >& mountList);
|
||||||
|
|
||||||
// npc trade
|
// npc trade
|
||||||
void processOpenNpcTrade(const std::vector<std::tuple<ItemPtr, std::string, int, int, int>>& items);
|
void processOpenNpcTrade(const std::vector<std::tuple<ItemPtr, std::string, int, int, int> >& items);
|
||||||
void processPlayerGoods(int money, const std::vector<std::tuple<ItemPtr, int>>& goods);
|
void processPlayerGoods(int money, const std::vector<std::tuple<ItemPtr, int> >& goods);
|
||||||
void processCloseNpcTrade();
|
void processCloseNpcTrade();
|
||||||
|
|
||||||
// player trade
|
// player trade
|
||||||
|
@ -109,8 +110,8 @@ protected:
|
||||||
void processEditList(uint id, int doorId, const std::string& text);
|
void processEditList(uint id, int doorId, const std::string& text);
|
||||||
|
|
||||||
// questlog
|
// questlog
|
||||||
void processQuestLog(const std::vector<std::tuple<int, std::string, bool>>& questList);
|
void processQuestLog(const std::vector<std::tuple<int, std::string, bool> >& questList);
|
||||||
void processQuestLine(int questId, const std::vector<std::tuple<std::string, std::string>>& questMissions);
|
void processQuestLine(int questId, const std::vector<std::tuple<std::string, std::string> >& questMissions);
|
||||||
|
|
||||||
friend class ProtocolGame;
|
friend class ProtocolGame;
|
||||||
friend class Map;
|
friend class Map;
|
||||||
|
@ -245,6 +246,7 @@ public:
|
||||||
bool isDead() { return m_dead; }
|
bool isDead() { return m_dead; }
|
||||||
bool isAttacking() { return !!m_attackingCreature; }
|
bool isAttacking() { return !!m_attackingCreature; }
|
||||||
bool isFollowing() { return !!m_followingCreature; }
|
bool isFollowing() { return !!m_followingCreature; }
|
||||||
|
bool isMounted() { return m_mounted; }
|
||||||
|
|
||||||
ContainerPtr getContainer(int index) { return m_containers[index]; }
|
ContainerPtr getContainer(int index) { return m_containers[index]; }
|
||||||
std::map<int, ContainerPtr> getContainers() { return m_containers; }
|
std::map<int, ContainerPtr> getContainers() { return m_containers; }
|
||||||
|
@ -276,6 +278,7 @@ private:
|
||||||
|
|
||||||
bool m_denyBotCall;
|
bool m_denyBotCall;
|
||||||
bool m_dead;
|
bool m_dead;
|
||||||
|
bool m_mounted;
|
||||||
int m_serverBeat;
|
int m_serverBeat;
|
||||||
Otc::FightModes m_fightMode;
|
Otc::FightModes m_fightMode;
|
||||||
Otc::ChaseModes m_chaseMode;
|
Otc::ChaseModes m_chaseMode;
|
||||||
|
|
|
@ -177,6 +177,7 @@ void OTClient::registerLuaFunctions()
|
||||||
g_lua.bindSingletonFunction("g_game", "isDead", &Game::isDead, &g_game);
|
g_lua.bindSingletonFunction("g_game", "isDead", &Game::isDead, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "isAttacking", &Game::isAttacking, &g_game);
|
g_lua.bindSingletonFunction("g_game", "isAttacking", &Game::isAttacking, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "isFollowing", &Game::isFollowing, &g_game);
|
g_lua.bindSingletonFunction("g_game", "isFollowing", &Game::isFollowing, &g_game);
|
||||||
|
g_lua.bindSingletonFunction("g_game", "isMounted", &Game::isMounted, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "getContainer", &Game::getContainer, &g_game);
|
g_lua.bindSingletonFunction("g_game", "getContainer", &Game::getContainer, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "getContainers", &Game::getContainers, &g_game);
|
g_lua.bindSingletonFunction("g_game", "getContainers", &Game::getContainers, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "getVips", &Game::getVips, &g_game);
|
g_lua.bindSingletonFunction("g_game", "getVips", &Game::getVips, &g_game);
|
||||||
|
|
|
@ -38,6 +38,10 @@ int push_luavalue(const Outfit& outfit)
|
||||||
g_lua.setField("legs");
|
g_lua.setField("legs");
|
||||||
g_lua.pushInteger(outfit.getFeet());
|
g_lua.pushInteger(outfit.getFeet());
|
||||||
g_lua.setField("feet");
|
g_lua.setField("feet");
|
||||||
|
if(g_game.getFeature(Otc::GamePlayerMounts)) {
|
||||||
|
g_lua.pushInteger(outfit.getMount());
|
||||||
|
g_lua.setField("mount");
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +60,10 @@ bool luavalue_cast(int index, Outfit& outfit)
|
||||||
outfit.setLegs(g_lua.popInteger());
|
outfit.setLegs(g_lua.popInteger());
|
||||||
g_lua.getField("feet", index);
|
g_lua.getField("feet", index);
|
||||||
outfit.setFeet(g_lua.popInteger());
|
outfit.setFeet(g_lua.popInteger());
|
||||||
|
if(g_game.getFeature(Otc::GamePlayerMounts)) {
|
||||||
|
g_lua.getField("mount", index);
|
||||||
|
outfit.setMount(g_lua.popInteger());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include <framework/luaengine/declarations.h>
|
#include <framework/luaengine/declarations.h>
|
||||||
|
#include "game.h"
|
||||||
#include "outfit.h"
|
#include "outfit.h"
|
||||||
|
|
||||||
// outfit
|
// outfit
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
void setLegs(int legs) { m_legs = legs; m_legsColor = getColor(legs); }
|
void setLegs(int legs) { m_legs = legs; m_legsColor = getColor(legs); }
|
||||||
void setFeet(int feet) { m_feet = feet; m_feetColor = getColor(feet); }
|
void setFeet(int feet) { m_feet = feet; m_feetColor = getColor(feet); }
|
||||||
void setAddons(int addons) { m_addons = addons; }
|
void setAddons(int addons) { m_addons = addons; }
|
||||||
|
void setMount(int mount) { m_mount = mount; }
|
||||||
void setCategory(DatCategory category) { m_category = category; }
|
void setCategory(DatCategory category) { m_category = category; }
|
||||||
|
|
||||||
void resetClothes();
|
void resetClothes();
|
||||||
|
@ -54,6 +55,7 @@ public:
|
||||||
int getLegs() const { return m_legs; }
|
int getLegs() const { return m_legs; }
|
||||||
int getFeet() const { return m_feet; }
|
int getFeet() const { return m_feet; }
|
||||||
int getAddons() const { return m_addons; }
|
int getAddons() const { return m_addons; }
|
||||||
|
int getMount() const { return m_mount; }
|
||||||
DatCategory getCategory() const { return m_category; }
|
DatCategory getCategory() const { return m_category; }
|
||||||
|
|
||||||
Color getHeadColor() const { return m_headColor; }
|
Color getHeadColor() const { return m_headColor; }
|
||||||
|
@ -63,7 +65,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DatCategory m_category;
|
DatCategory m_category;
|
||||||
int m_id, m_head, m_body, m_legs, m_feet, m_addons;
|
int m_id, m_head, m_body, m_legs, m_feet, m_addons, m_mount;
|
||||||
Color m_headColor, m_bodyColor, m_legsColor, m_feetColor;
|
Color m_headColor, m_bodyColor, m_legsColor, m_feetColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace Proto {
|
||||||
OsFlash = 3,
|
OsFlash = 3,
|
||||||
OsOtclientLinux = 10,
|
OsOtclientLinux = 10,
|
||||||
OsOtclientWindows = 11,
|
OsOtclientWindows = 11,
|
||||||
OsOtclientMac = 12,
|
OsOtclientMac = 12
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef OSTYPE
|
#ifdef OSTYPE
|
||||||
|
@ -177,7 +177,7 @@ namespace Proto {
|
||||||
GameServerMarketEnter = 246, // 944
|
GameServerMarketEnter = 246, // 944
|
||||||
GameServerMarketLeave = 247, // 944
|
GameServerMarketLeave = 247, // 944
|
||||||
GameServerMarketDetail = 248, // 944
|
GameServerMarketDetail = 248, // 944
|
||||||
GameServerMarketBrowse = 249, // 944
|
GameServerMarketBrowse = 249 // 944
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ClientOpcodes {
|
enum ClientOpcodes {
|
||||||
|
@ -267,7 +267,7 @@ namespace Proto {
|
||||||
ClientMarketBrowse = 245, // 944
|
ClientMarketBrowse = 245, // 944
|
||||||
ClientMarketCreate = 246, // 944
|
ClientMarketCreate = 246, // 944
|
||||||
ClientMarketCancel = 247, // 944
|
ClientMarketCancel = 247, // 944
|
||||||
ClientMarketAccept = 248, // 944
|
ClientMarketAccept = 248 // 944
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ServerSpeakType {
|
enum ServerSpeakType {
|
||||||
|
|
|
@ -102,7 +102,7 @@ protected:
|
||||||
void sendRefreshContainer();
|
void sendRefreshContainer();
|
||||||
void sendRequestOutfit();
|
void sendRequestOutfit();
|
||||||
void sendChangeOutfit(const Outfit& outfit);
|
void sendChangeOutfit(const Outfit& outfit);
|
||||||
void sendMount(bool mount);
|
void sendMountStatus(bool mount);
|
||||||
void sendAddVip(const std::string& name);
|
void sendAddVip(const std::string& name);
|
||||||
void sendRemoveVip(uint playerId);
|
void sendRemoveVip(uint playerId);
|
||||||
void sendBugReport(const std::string& comment);
|
void sendBugReport(const std::string& comment);
|
||||||
|
|
|
@ -920,7 +920,6 @@ void ProtocolGame::parsePlayerCancelAttack(const InputMessagePtr& msg)
|
||||||
g_game.processAttackCancel();
|
g_game.processAttackCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProtocolGame::parseSpellDelay(const InputMessagePtr& msg)
|
void ProtocolGame::parseSpellDelay(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
msg->getU16(); // spell id
|
msg->getU16(); // spell id
|
||||||
|
@ -935,7 +934,6 @@ void ProtocolGame::parseSpellGroupDelay(const InputMessagePtr& msg)
|
||||||
msg->getU8(); // unknown
|
msg->getU8(); // unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProtocolGame::parseMultiUseDelay(const InputMessagePtr& msg)
|
void ProtocolGame::parseMultiUseDelay(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
|
@ -991,7 +989,7 @@ void ProtocolGame::parseCreatureSpeak(const InputMessagePtr& msg)
|
||||||
void ProtocolGame::parseChannelList(const InputMessagePtr& msg)
|
void ProtocolGame::parseChannelList(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
int count = msg->getU8();
|
int count = msg->getU8();
|
||||||
std::vector<std::tuple<int, std::string>> channelList;
|
std::vector<std::tuple<int, std::string> > channelList;
|
||||||
for(int i = 0; i < count; i++) {
|
for(int i = 0; i < count; i++) {
|
||||||
int id = msg->getU16();
|
int id = msg->getU16();
|
||||||
std::string name = msg->getString();
|
std::string name = msg->getString();
|
||||||
|
@ -1130,7 +1128,8 @@ void ProtocolGame::parseOpenOutfitWindow(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
Outfit currentOutfit = getOutfit(msg);
|
Outfit currentOutfit = getOutfit(msg);
|
||||||
|
|
||||||
std::vector<std::tuple<int, std::string, int>> outfitList;
|
std::vector<std::tuple<int, std::string, int> > outfitList;
|
||||||
|
std::vector<std::tuple<int, std::string> > mountList;
|
||||||
int outfitCount = msg->getU8();
|
int outfitCount = msg->getU8();
|
||||||
for(int i = 0; i < outfitCount; i++) {
|
for(int i = 0; i < outfitCount; i++) {
|
||||||
int outfitId = msg->getU16();
|
int outfitId = msg->getU16();
|
||||||
|
@ -1142,13 +1141,15 @@ void ProtocolGame::parseOpenOutfitWindow(const InputMessagePtr& msg)
|
||||||
|
|
||||||
if(g_game.getFeature(Otc::GamePlayerMounts)) {
|
if(g_game.getFeature(Otc::GamePlayerMounts)) {
|
||||||
int mountCount = msg->getU8();
|
int mountCount = msg->getU8();
|
||||||
for(int i=0;i<mountCount;++i) {
|
for(int i = 0; i < mountCount; ++i) {
|
||||||
msg->getU16(); // mount type
|
int mountId = msg->getU16(); // mount type
|
||||||
msg->getString(); // mount name
|
std::string mountName = msg->getString(); // mount name
|
||||||
|
|
||||||
|
mountList.push_back(std::make_tuple(mountId, mountName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_game.processOpenOutfitWindow(currentOutfit, outfitList);
|
g_game.processOpenOutfitWindow(currentOutfit, outfitList, mountList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
|
void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
|
||||||
|
@ -1188,7 +1189,7 @@ void ProtocolGame::parseAutomapFlag(const InputMessagePtr& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseQuestLog(const InputMessagePtr& msg)
|
void ProtocolGame::parseQuestLog(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
std::vector<std::tuple<int, std::string, bool>> questList;
|
std::vector<std::tuple<int, std::string, bool> > questList;
|
||||||
int questsCount = msg->getU16();
|
int questsCount = msg->getU16();
|
||||||
for(int i = 0; i < questsCount; i++) {
|
for(int i = 0; i < questsCount; i++) {
|
||||||
int id = msg->getU16();
|
int id = msg->getU16();
|
||||||
|
@ -1344,8 +1345,10 @@ Outfit ProtocolGame::getOutfit(const InputMessagePtr& msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_game.getFeature(Otc::GamePlayerMounts))
|
if(g_game.getFeature(Otc::GamePlayerMounts)) {
|
||||||
msg->getU16(); // mount
|
int mount = msg->getU16(); // mount
|
||||||
|
outfit.setMount(mount);
|
||||||
|
}
|
||||||
|
|
||||||
return outfit;
|
return outfit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -630,15 +630,21 @@ void ProtocolGame::sendChangeOutfit(const Outfit& outfit)
|
||||||
msg->addU8(outfit.getLegs());
|
msg->addU8(outfit.getLegs());
|
||||||
msg->addU8(outfit.getFeet());
|
msg->addU8(outfit.getFeet());
|
||||||
msg->addU8(outfit.getAddons());
|
msg->addU8(outfit.getAddons());
|
||||||
|
if(g_game.getFeature(Otc::GamePlayerMounts))
|
||||||
|
msg->addU16(outfit.getMount());
|
||||||
send(msg);
|
send(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendMount(bool mount)
|
void ProtocolGame::sendMountStatus(bool mount)
|
||||||
{
|
{
|
||||||
OutputMessagePtr msg(new OutputMessage);
|
if(g_game.getFeature(Otc::GamePlayerMounts)) {
|
||||||
msg->addU8(Proto::ClientMount);
|
OutputMessagePtr msg(new OutputMessage);
|
||||||
msg->addU8(mount);
|
msg->addU8(Proto::ClientMount);
|
||||||
send(msg);
|
msg->addU8(mount);
|
||||||
|
send(msg);
|
||||||
|
} else {
|
||||||
|
g_logger.error("ProtocolGame::sendMountStatus does not support the current protocol.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendAddVip(const std::string& name)
|
void ProtocolGame::sendAddVip(const std::string& name)
|
||||||
|
|
|
@ -120,7 +120,7 @@ TilePtr UIMap::getTile(const Point& mousePos)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Known Issue: If you move a container widget into the map rect
|
* Known Issue: If you move a container widget into the map rect
|
||||||
* if you move an item onto itself it will allow this to execute
|
* and you move an item onto itself it will allow this to execute
|
||||||
* still dropping the item on the ground.
|
* still dropping the item on the ground.
|
||||||
*/
|
*/
|
||||||
if(!m_mapRect.contains(mousePos))
|
if(!m_mapRect.contains(mousePos))
|
||||||
|
|