parent
5b352ac999
commit
00740b56f3
@ -0,0 +1,7 @@
|
|||||||
|
PlayerTrade = {}
|
||||||
|
|
||||||
|
function PlayerTrade.init()
|
||||||
|
end
|
||||||
|
|
||||||
|
function PlayerTrade.terminate()
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
Module
|
||||||
|
name: game_playertrade
|
||||||
|
description: Allow to trade items with players
|
||||||
|
author: OTClient team
|
||||||
|
website: https://github.com/edubart/otclient
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
- game
|
||||||
|
|
||||||
|
@onLoad: |
|
||||||
|
dofile 'playertrade'
|
||||||
|
PlayerTrade.init()
|
||||||
|
|
||||||
|
@onUnload: |
|
||||||
|
PlayerTrade.terminate()
|
@ -0,0 +1,30 @@
|
|||||||
|
QuestLog = {}
|
||||||
|
|
||||||
|
-- g_game.requestQuestLog()
|
||||||
|
-- g_game.requestQuestLine(questId)
|
||||||
|
|
||||||
|
local function onGameQuestLog(questList)
|
||||||
|
for i,questEntry in pairs(questList) do
|
||||||
|
local id, name, done = unpack(questEntry)
|
||||||
|
print(id, name, done)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function onGameQuestLine(questId, questMissions)
|
||||||
|
for i,questMission in pairs(questMissions) do
|
||||||
|
local name, description = unpack(questMission)
|
||||||
|
print(name, description)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function QuestLog.init()
|
||||||
|
importStyle 'questlogwindow.otui'
|
||||||
|
|
||||||
|
connect(g_game, { onQuestLog = onGameQuestLog })
|
||||||
|
connect(g_game, { onQuestLine= onGameQuestLine })
|
||||||
|
end
|
||||||
|
|
||||||
|
function QuestLog.terminate()
|
||||||
|
disconnect(g_game, { onQuestLog = onGameQuestLog })
|
||||||
|
disconnect(g_game, { onQuestLine= onGameQuestLine })
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
Module
|
||||||
|
name: game_questlog
|
||||||
|
description: View game quests status
|
||||||
|
author: OTClient team
|
||||||
|
website: https://github.com/edubart/otclient
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
- game
|
||||||
|
|
||||||
|
@onLoad: |
|
||||||
|
dofile 'questlog'
|
||||||
|
QuestLog.init()
|
||||||
|
|
||||||
|
@onUnload: |
|
||||||
|
QuestLog.terminate()
|
@ -0,0 +1 @@
|
|||||||
|
QuestLogWindow < MainWindow
|
@ -0,0 +1,55 @@
|
|||||||
|
TextBooks = {}
|
||||||
|
|
||||||
|
local function onGameEditText(id, itemId, maxLength, text, writter, time)
|
||||||
|
local textWindow = createWidget('TextWindow', rootWidget)
|
||||||
|
|
||||||
|
local writeable = maxLength ~= #text
|
||||||
|
local textItem = textWindow:getChildById('textItem')
|
||||||
|
local description = textWindow:getChildById('description')
|
||||||
|
local textEdit = textWindow:getChildById('text')
|
||||||
|
local okButton = textWindow:getChildById('okButton')
|
||||||
|
local cancelButton = textWindow:getChildById('cancelButton')
|
||||||
|
|
||||||
|
textItem:setItemId(itemId)
|
||||||
|
textEdit:setMaxLength(maxLength)
|
||||||
|
textEdit:setText(text)
|
||||||
|
textEdit:setEnabled(writeable)
|
||||||
|
|
||||||
|
local desc = tr('You read the following')
|
||||||
|
if #writter > 0 then
|
||||||
|
desc = desc .. tr(', written by \n%s\n', writter)
|
||||||
|
|
||||||
|
if #time > 0 then
|
||||||
|
desc = desc .. tr('on %s.\n', time)
|
||||||
|
end
|
||||||
|
elseif #time > 0 then
|
||||||
|
desc = desc .. tr(', written on %s.\n', time)
|
||||||
|
end
|
||||||
|
|
||||||
|
if #text == 0 and not writeable then
|
||||||
|
desc = tr("It is empty.\n")
|
||||||
|
elseif writeable then
|
||||||
|
desc = desc .. tr('You can enter new text.')
|
||||||
|
end
|
||||||
|
|
||||||
|
description:setText(desc)
|
||||||
|
okButton.onClick = function()
|
||||||
|
g_game.editText(id, textEdit:getText())
|
||||||
|
textWindow:destroy()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function onGameEditList(listId, id, text)
|
||||||
|
end
|
||||||
|
|
||||||
|
function TextBooks.init()
|
||||||
|
importStyle 'textwindow.otui'
|
||||||
|
|
||||||
|
connect(g_game, { onEditText = onGameEditText })
|
||||||
|
connect(g_game, { onEditList = onGameEditList })
|
||||||
|
end
|
||||||
|
|
||||||
|
function TextBooks.terminate()
|
||||||
|
disconnect(g_game, { onEditText = onGameEditText })
|
||||||
|
disconnect(g_game, { onEditList = onGameEditList })
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
Module
|
||||||
|
name: game_textbooks
|
||||||
|
description: Allow to edit text books and lists
|
||||||
|
author: OTClient team
|
||||||
|
website: https://github.com/edubart/otclient
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
- game
|
||||||
|
|
||||||
|
@onLoad: |
|
||||||
|
dofile 'textbooks'
|
||||||
|
TextBooks.init()
|
||||||
|
|
||||||
|
@onUnload: |
|
||||||
|
TextBooks.terminate()
|
@ -0,0 +1,47 @@
|
|||||||
|
TextWindow < MainWindow
|
||||||
|
id: textWindow
|
||||||
|
!text: tr('Edit Text')
|
||||||
|
size: 280 280
|
||||||
|
@onEscape: self:destroy()
|
||||||
|
|
||||||
|
UIItem
|
||||||
|
id: textItem
|
||||||
|
virtual: true
|
||||||
|
item-id: 2816
|
||||||
|
size: 32 32
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: description
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: textItem.right
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: text.top
|
||||||
|
text-align: left
|
||||||
|
margin-left: 8
|
||||||
|
margin-bottom: 10
|
||||||
|
|
||||||
|
MultilineTextEdit
|
||||||
|
id: text
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.top: textItem.bottom
|
||||||
|
margin-top: 30
|
||||||
|
margin-bottom: 30
|
||||||
|
|
||||||
|
Button
|
||||||
|
id: cancelButton
|
||||||
|
!text: tr('Cancel')
|
||||||
|
anchors.top: next.top
|
||||||
|
anchors.right: next.left
|
||||||
|
margin-right: 8
|
||||||
|
width: 60
|
||||||
|
@onClick: self:getParent():destroy()
|
||||||
|
|
||||||
|
Button
|
||||||
|
id: okButton
|
||||||
|
!text: tr('Ok')
|
||||||
|
anchors.top: text.bottom
|
||||||
|
anchors.right: text.right
|
||||||
|
margin-top: 10
|
||||||
|
width: 60
|
Loading…
Reference in new issue