Skip to content

Commit

Permalink
Merge branch 'main' into cmake-discord-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Nottinghster authored Oct 31, 2024
2 parents b6f8764 + f563cda commit 35ba314
Show file tree
Hide file tree
Showing 36 changed files with 341 additions and 26,620 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# *****************************************************************************
include(MessageColors)
include(LoggingHelper)
include(CheckIncludeFileCXX)
include(GNUInstallDirs)

# *****************************************************************************
# Options
Expand Down
4 changes: 4 additions & 0 deletions cmake/Findphmap.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include(CheckIncludeFileCXX)
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_INSTALL_INCLUDEDIR}")
check_include_file_cxx(parallel_hashmap/phmap.h PHMAP_PHMAP_INCLUDE)
check_include_file_cxx(parallel_hashmap/btree.h PHMAP_BTREE_INCLUDE)
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ CaveBot.Extensions.SupplyCheck.setup = function()
supplyRetries = 0
missedChecks = 0
return false
elseif supplyRetries > (storage.extras.huntRoutes or 50) then
elseif (storage.extras.huntRoutes or 0) ~= 0 and supplyRetries > (storage.extras.huntRoutes or 50) then
print("CaveBot[SupplyCheck]: Round limit reached, going back on refill. Last round took: " .. round)
setCaveBotData()
return false
Expand Down
4 changes: 4 additions & 0 deletions modules/corelib/keyboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ local function connectKeyPressEvent(widget)
widget.boundKeyPressCombos = {}
end

function g_keyboard.setKeyDelay(key, delay)
g_window.setKeyDelay(getKeyCode(key), delay);
end

-- public functions
function g_keyboard.bindKeyDown(keyComboDesc, callback, widget, alone)
widget = widget or rootWidget
Expand Down
2 changes: 2 additions & 0 deletions modules/corelib/ui/uispinbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ end
function UISpinBox:onStyleApply(styleName, styleNode)
for name, value in pairs(styleNode) do
if name == 'maximum' then
self.maximum = value
addEvent(function()
self:setMaximum(value)
end)
elseif name == 'minimum' then
self.minimum = value
addEvent(function()
self:setMinimum(value)
end)
Expand Down
5 changes: 2 additions & 3 deletions modules/game_containers/containers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ function onContainerOpen(container, previousContainer)
local name = container:getName()
name = name:sub(1, 1):upper() .. name:sub(2)

if name:len() > 11 then
name = string.sub(name, 1, #name - 3)
name = name .. "..."
if name:len() > 14 then
name = name:sub(1, 14) .. "..."
end

containerWindow:setText(name)
Expand Down
6 changes: 1 addition & 5 deletions modules/game_cyclopedia/cyclopedia_widgets.otui
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ CharacterGridItem < UIWidget
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
image-source: /images/ui/item
UIWidget
id: rarity
margin: 1
anchors.fill: ItemBackground
UIItem
Item
id: item
anchors.fill: ItemBackground
Label
Expand Down
2 changes: 2 additions & 0 deletions modules/game_cyclopedia/tab/character/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ function Cyclopedia.reloadCharacterItems()
local gridItem = g_ui.createWidget("CharacterGridItem", UI.CharacterItems.gridBase.grid)
gridItem.item:setItemId(itemId)
gridItem.amount:setText(data.amount)
ItemsDatabase.setRarityItem(gridItem.item, gridItem.item:getItem())
ItemsDatabase.setTier(gridItem.item, item.tier)
colorIndex = 3 - colorIndex
end
end
Expand Down
4 changes: 2 additions & 2 deletions modules/game_cyclopedia/tab/character/character.otui
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ UIWidget
id: gridBase
size: 494 340
anchors.bottom: parent.bottom
anchors.left: parentl.left
anchors.left: parent.left
visible: false
UIScrollArea
id: grid
Expand Down Expand Up @@ -1297,7 +1297,7 @@ UIWidget
height: 55
anchors.top: parent.top
anchors.left: parent.left
anchors.right: ListBase.right
anchors.right: parent.right
image-source: /images/game/actionbar/2pixel-up-frame-borderimage
image-border: 5
CheckBox
Expand Down
29 changes: 18 additions & 11 deletions modules/game_cyclopedia/tab/items/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ function Cyclopedia.applyFilters()
end

function Cyclopedia.internalCreateItem(data)
-- temp fix 13.40
if data:getId() > 47381 and data:getId() < 80909 then
return
end

local player = g_game.getLocalPlayer()
local vocation = player:getVocation()
local level = player:getLevel()
Expand Down Expand Up @@ -224,17 +219,29 @@ function Cyclopedia.internalCreateItem(data)
item:setId(data:getId())
item.Sprite:setItemId(data:getId())
item.Name:setText(marketData.name)

local price, rarity = ItemsDatabase.getSellValueAndColor(data:getId())
local function getColorForValue(value)
if value >= 1000000 then
return "yellow"
elseif value >= 100000 then
return "purple"
elseif value >= 10000 then
return "blue"
elseif value >= 1000 then
return "green"
elseif value >= 50 then
return "grey"
end
return "white"
end
local price = data:getMeanPrice()
local rarity = getColorForValue(price)
item.Value = price
item.Vocation = marketData.restrictVocation

if price > 0 then
item.Rarity:setImageSource("/images/ui/rarity_" .. rarity)
end

ItemsDatabase.setRarityItem(item.Sprite, item)

function item.onClick(widget)
UI.InfoBase.SellBase.List:destroyChildren()
UI.InfoBase.BuyBase.List:destroyChildren()
Expand Down Expand Up @@ -277,7 +284,7 @@ function Cyclopedia.internalCreateItem(data)
end
end

--[[ local buy, sell = Cyclopedia.formatSaleData(internalData:getNpcSaleData())
local buy, sell = Cyclopedia.formatSaleData(internalData:getNpcSaleData())
local sellColor = "#484848"

for index, value in ipairs(sell) do
Expand Down Expand Up @@ -318,7 +325,7 @@ function Cyclopedia.internalCreateItem(data)
end

buyColor = buyColor == "#484848" and "#414141" or "#484848"
end ]]
end

UI.selectItem = widget
end
Expand Down
10 changes: 5 additions & 5 deletions modules/game_cyclopedia/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,7 @@ end
function Cyclopedia.formatSaleData(data)
local s, sell, b, buy = {}, {}, {}, {}

for i = 0, #data do
for i = 1, #data do
local value = data[i]

if value then
Expand Down Expand Up @@ -1569,18 +1569,18 @@ function Cyclopedia.formatSaleData(data)
for name, value in pairs(s) do
if value.various then
table.insert(sell,
string.format("%s gp, %s\nResidence: %s", formatGold(value.price), name, "Various Locations"))
string.format("%s gp, %s\nResidence: %s", Cyclopedia.formatGold(value.price), name, "Various Locations"))
else
table.insert(sell, string.format("%s gp, %s\nResidence: %s", formatGold(value.price), name, value.location))
table.insert(sell, string.format("%s gp, %s\nResidence: %s", Cyclopedia.formatGold(value.price), name, value.location))
end
end

for name, value in pairs(b) do
if value.various then
table.insert(buy,
string.format("%s gp, %s\nResidence: %s", formatGold(value.price), name, "Various Locations"))
string.format("%s gp, %s\nResidence: %s", Cyclopedia.formatGold(value.price), name, "Various Locations"))
else
table.insert(buy, string.format("%s gp, %s\nResidence: %s", formatGold(value.price), name, value.location))
table.insert(buy, string.format("%s gp, %s\nResidence: %s", Cyclopedia.formatGold(value.price), name, value.location))
end
end

Expand Down
12 changes: 5 additions & 7 deletions modules/game_interface/gameinterface.lua
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,21 @@ function bindWalkKey(key, dir)
onWalkKeyDown(dir)
end, gameRootPanel, true)
g_keyboard.bindKeyUp(key, function()
g_game.getLocalPlayer():setNextWalkDir(Directions.Invalid)
changeWalkDir(dir, true)
end, gameRootPanel, true)
g_keyboard.bindKeyPress(key, function()
smartWalk(dir)
end, gameRootPanel)

g_keyboard.setKeyDelay(key, 10)
end

function unbindWalkKey(key)
g_keyboard.unbindKeyDown(key, gameRootPanel)
g_keyboard.unbindKeyUp(key, gameRootPanel)
g_keyboard.unbindKeyPress(key, gameRootPanel)

g_keyboard.setKeyDelay(key, 30)
end

function bindTurnKey(key, dir)
Expand Down Expand Up @@ -494,12 +497,7 @@ function smartWalk(dir)
return false
end


local dire = smartWalkDir or dir

g_game.getLocalPlayer():setNextWalkDir(dire)

g_game.walk(dire)
g_game.walk(smartWalkDir or dir)

return true
end
Expand Down
8 changes: 6 additions & 2 deletions modules/game_textmessage/textmessage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,12 @@ function displayMessage(mode, text)
if msgtype.screenTarget then
local label = messagesPanel:recursiveGetChildById(msgtype.screenTarget)
if msgtype == MessageSettings.loot then
label:setColoredText(ItemsDatabase.setColorLootMessage(text)) -- temp. TODO assets search
else
local coloredText = ItemsDatabase.setColorLootMessage(text)
label:setColoredText(coloredText)
local console = modules.game_console
local consoleBuffer = console.consoleTabBar:getTabPanel(console.getTab("Server Log")):getChildById('consoleBuffer')
consoleBuffer:getLastChild():setColoredText(coloredText)
else
label:setText(text)
label:setColor(msgtype.color)
end
Expand Down
3 changes: 2 additions & 1 deletion modules/gamelib/const.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ TextColors = {
-- blue1 = '#6e50dc',
-- blue2 = '#3264c8',
-- blue3 = '#0096c8',
white = '#ffffff' -- '#bebebe'
white = '#ffffff', -- '#bebebe'
grey = '#AAAAAA'
}

MessageModes = {
Expand Down
Loading

0 comments on commit 35ba314

Please sign in to comment.