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