Some overall fixes:
* Fix to market constraints. * Fixed bug with skill percent not rounding. * Dereference textEdit variable properly. * Fix to the outfit window regarding mounts. * Added enableResize to UIMiniWindow. * Some minor edits.
This commit is contained in:
parent
9eef114779
commit
ecd1ec5c0d
|
@ -314,6 +314,10 @@ function UIMiniWindow:disableResize()
|
|||
self:getChildById('bottomResizeBorder'):disable()
|
||||
end
|
||||
|
||||
function UIMiniWindow:enableResize()
|
||||
self:getChildById('bottomResizeBorder'):enable()
|
||||
end
|
||||
|
||||
function UIMiniWindow:fitOnParent()
|
||||
local parent = self:getParent()
|
||||
if self:isVisible() and parent and parent:getClassName() == 'UIMiniWindowContainer' then
|
||||
|
|
|
@ -22,7 +22,7 @@ end
|
|||
|
||||
function reloadContainers()
|
||||
clean()
|
||||
for containerid,container in pairs(g_game.getContainers()) do
|
||||
for _,container in pairs(g_game.getContainers()) do
|
||||
onContainerOpen(container)
|
||||
end
|
||||
end
|
||||
|
@ -91,7 +91,7 @@ function onContainerOpen(container, previousContainer)
|
|||
|
||||
local layout = containerPanel:getLayout()
|
||||
local cellSize = layout:getCellSize()
|
||||
containerWindow:setContentMinimumHeight(cellSize.height*1)
|
||||
containerWindow:setContentMinimumHeight(cellSize.height)
|
||||
containerWindow:setContentMaximumHeight(cellSize.height*layout:getNumLines())
|
||||
|
||||
if not previousContainer then
|
||||
|
|
|
@ -57,14 +57,12 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
|
|||
return true
|
||||
end
|
||||
|
||||
local tile = self:getTile(mousePosition)
|
||||
|
||||
local localPlayerPos = g_game.getLocalPlayer():getPosition()
|
||||
local autoWalkPos = self:getPosition(mousePosition)
|
||||
|
||||
-- happens when clicking outside of map boundaries
|
||||
if not autoWalkPos then return false end
|
||||
|
||||
local localPlayerPos = g_game.getLocalPlayer():getPosition()
|
||||
if autoWalkPos.z ~= localPlayerPos.z then
|
||||
local dz = autoWalkPos.z - localPlayerPos.z
|
||||
autoWalkPos.x = autoWalkPos.x + dz
|
||||
|
@ -77,6 +75,7 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
|
|||
local creatureThing
|
||||
local multiUseThing
|
||||
|
||||
local tile = self:getTile(mousePosition)
|
||||
if tile then
|
||||
lookThing = tile:getTopLookThing()
|
||||
useThing = tile:getTopUseThing()
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
* Extend information features
|
||||
- Hover over offers for purchase information (balance after transaction, etc)
|
||||
- Display out of trend market offers based on their previous statistics (like cipsoft does)
|
||||
|
||||
* Make compatible with cipsoft 9.61 (has the protocol changed? creating offer not working)
|
||||
]]
|
||||
|
||||
Market = {}
|
||||
|
@ -1005,8 +1003,18 @@ function Market.createNewOffer()
|
|||
local amount = amountEdit:getValue()
|
||||
local anonymous = anonymous:isChecked() and 1 or 0
|
||||
|
||||
-- error check offer
|
||||
-- error checking
|
||||
local errorMsg = ''
|
||||
if type == MarketAction.Buy then
|
||||
if information.balance < ((piecePrice * amount) + fee) then
|
||||
errorMsg = errorMsg..'Not enough balance to create this offer.\n'
|
||||
end
|
||||
elseif type == MarketAction.Sell then
|
||||
if Market.depotContains(spriteId) < amount then
|
||||
errorMsg = errorMsg..'Not enough items in your depot to create this offer.\n'
|
||||
end
|
||||
end
|
||||
|
||||
if piecePrice > piecePriceEdit.maximum then
|
||||
errorMsg = errorMsg..'Price is too high.\n'
|
||||
elseif piecePrice < piecePriceEdit.minimum then
|
||||
|
@ -1017,9 +1025,10 @@ function Market.createNewOffer()
|
|||
elseif amount < amountEdit.minimum then
|
||||
errorMsg = errorMsg..'Amount is too low.\n'
|
||||
end
|
||||
|
||||
local timeCheck = os.time() - lastCreatedOffer
|
||||
if timeCheck < offerExhaust[type] then
|
||||
local waitTime = math.ceil((offerExhaust[type] - timeCheck))
|
||||
local waitTime = math.ceil(offerExhaust[type] - timeCheck)
|
||||
errorMsg = errorMsg..'You must wait '.. waitTime ..' seconds before creating a new offer.\n'
|
||||
end
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ function onStaminaChange(localPlayer, stamina)
|
|||
if minutes < 10 then
|
||||
minutes = '0' .. minutes
|
||||
end
|
||||
local percent = 100 * stamina / (42 * 60) -- max is 42 hours
|
||||
local percent = math.floor(100 * stamina / (42 * 60)) -- max is 42 hours
|
||||
|
||||
setSkillValue('stamina', hours .. ":" .. minutes)
|
||||
setSkillPercent('stamina', percent, tr('You have %s percent', percent))
|
||||
|
@ -293,13 +293,13 @@ function onRegenerationChange(localPlayer, regenerationTime)
|
|||
if not g_game.getFeature(GamePlayerRegenerationTime) or regenerationTime < 0 then
|
||||
return
|
||||
end
|
||||
local hours = math.floor(regenerationTime / 60)
|
||||
local minutes = regenerationTime % 60
|
||||
if minutes < 10 then
|
||||
minutes = '0' .. minutes
|
||||
local minutes = math.floor(regenerationTime / 60)
|
||||
local seconds = regenerationTime % 60
|
||||
if seconds < 10 then
|
||||
seconds = '0' .. seconds
|
||||
end
|
||||
|
||||
setSkillValue('regenerationTime', hours .. ":" .. minutes)
|
||||
setSkillValue('regenerationTime', minutes .. ":" .. seconds)
|
||||
checkAlert('regenerationTime', regenerationTime, false, 300)
|
||||
end
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ function onGameEditText(id, itemId, maxLength, text, writter, time)
|
|||
if writeable then
|
||||
g_game.editText(id, textEdit:getText())
|
||||
end
|
||||
textEdit = nil
|
||||
destroy()
|
||||
end
|
||||
|
||||
|
|
|
@ -521,7 +521,7 @@ void Creature::setOutfit(const Outfit& outfit)
|
|||
m_outfit.setAuxId(outfit.getAuxId());
|
||||
m_outfit.setCategory(outfit.getCategory());
|
||||
} else {
|
||||
if(!g_things.isValidDatId(outfit.getId(), ThingCategoryCreature))
|
||||
if(outfit.getId() > 0 && !g_things.isValidDatId(outfit.getId(), ThingCategoryCreature))
|
||||
return;
|
||||
m_outfit = outfit;
|
||||
}
|
||||
|
|
|
@ -325,11 +325,15 @@ void Game::processOpenOutfitWindow(const Outfit& currentOufit, const std::vector
|
|||
{
|
||||
virtualMountCreature = CreaturePtr(new Creature);
|
||||
virtualMountCreature->setDirection(Otc::South);
|
||||
if(currentOufit.getMount() > 0) {
|
||||
Outfit mountOutfit;
|
||||
mountOutfit.setId(currentOufit.getMount());
|
||||
virtualMountCreature->setOutfit(mountOutfit);
|
||||
}
|
||||
|
||||
Outfit mountOutfit;
|
||||
mountOutfit.setId(0);
|
||||
|
||||
int mount = currentOufit.getMount();
|
||||
if(mount > 0)
|
||||
mountOutfit.setId(mount);
|
||||
|
||||
virtualMountCreature->setOutfit(mountOutfit);
|
||||
}
|
||||
|
||||
g_lua.callGlobalField("g_game", "onOpenOutfitWindow", virtualOutfitCreature, outfitList, virtualMountCreature, mountList);
|
||||
|
|
Loading…
Reference in New Issue