Game control precision edits and many other fixes:
* Updated the walking(mouse/keys) control to be a lot more responsive/smooth! * Updated creature diagonal steps to animate faster (due to demand). * Added a warning popup for boost walker option in cipsoft servers. * Added KeyUp event controls in the g_keyboard class. * Fixed an issue with the minimap not reconfiguring. * Fixed a bug with creature lights drawing properly. * Fixed refreshContainer method. * Some layout edits. * Some minor typo fixes. TODO: * Add walk event stack. * Test new walking edits extensively. * Finish pending state feature.
This commit is contained in:
parent
8961f4dfd4
commit
1782de7336
|
@ -11,10 +11,10 @@ Module
|
|||
//- client_particles
|
||||
- client_topmenu
|
||||
- client_background
|
||||
- client_entergame
|
||||
- client_options
|
||||
- client_terminal
|
||||
- client_modulemanager
|
||||
- client_entergame
|
||||
//- client_stats
|
||||
|
||||
@onLoad: |
|
||||
|
|
|
@ -3,6 +3,7 @@ EnterGame = { }
|
|||
-- private variables
|
||||
local loadBox
|
||||
local enterGame
|
||||
local motdWindow
|
||||
local motdButton
|
||||
local enterGameButton
|
||||
local protocolBox
|
||||
|
@ -121,6 +122,8 @@ function EnterGame.terminate()
|
|||
enterGame = nil
|
||||
enterGameButton:destroy()
|
||||
enterGameButton = nil
|
||||
motdWindow:destroy()
|
||||
motdWindow = nil
|
||||
motdButton:destroy()
|
||||
motdButton = nil
|
||||
protocolBox = nil
|
||||
|
@ -200,7 +203,9 @@ function EnterGame.doLogin()
|
|||
end
|
||||
|
||||
function EnterGame.displayMotd()
|
||||
displayInfoBox(tr('Message of the day'), G.motdMessage)
|
||||
if not motdWindow or not motdWindow:isVisible() then
|
||||
motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage)
|
||||
end
|
||||
end
|
||||
|
||||
function EnterGame.setDefaultServer(host, port, protocol)
|
||||
|
|
|
@ -25,11 +25,13 @@ local defaultOptions = {
|
|||
painterEngine = 0
|
||||
}
|
||||
|
||||
local warningWindow
|
||||
local optionsWindow
|
||||
local optionsButton
|
||||
local optionsTabBar
|
||||
local options = {}
|
||||
local generalPanel
|
||||
local gamePanel
|
||||
local consolePanel
|
||||
local graphicsPanel
|
||||
|
||||
local function setupGraphicsEngines()
|
||||
|
@ -62,6 +64,21 @@ local function setupGraphicsEngines()
|
|||
end
|
||||
end
|
||||
|
||||
function displayWarning(widget, warning)
|
||||
if warningWindow and warningWindow:isVisible() then
|
||||
return
|
||||
end
|
||||
if g_game.isOfficialTibia() and widget:isChecked() then
|
||||
local yesCallback = function() warningWindow:destroy() warningWindow=nil end
|
||||
local noCallback = function() widget:setChecked(false) warningWindow:destroy() warningWindow=nil end
|
||||
|
||||
warningWindow = displayGeneralBox('Warning', tr(warning), {
|
||||
{ text='Yes', callback=yesCallback },
|
||||
{ text='No', callback=noCallback },
|
||||
anchor=AnchorHorizontalCenter}, yesCallback, noCallback)
|
||||
end
|
||||
end
|
||||
|
||||
function Options.init()
|
||||
-- load options
|
||||
for k,v in pairs(defaultOptions) do
|
||||
|
@ -83,15 +100,21 @@ function Options.init()
|
|||
optionsTabBar = optionsWindow:getChildById('optionsTabBar')
|
||||
optionsTabBar:setContentWidget(optionsWindow:getChildById('optionsTabContent'))
|
||||
|
||||
generalPanel = g_ui.loadUI('game.otui')
|
||||
optionsTabBar:addTab(tr('Game'), generalPanel)
|
||||
gamePanel = g_ui.loadUI('game.otui')
|
||||
optionsTabBar:addTab(tr('Game'), gamePanel)
|
||||
|
||||
generalPanel = g_ui.loadUI('console.otui')
|
||||
optionsTabBar:addTab(tr('Console'), generalPanel)
|
||||
consolePanel = g_ui.loadUI('console.otui')
|
||||
optionsTabBar:addTab(tr('Console'), consolePanel)
|
||||
|
||||
graphicsPanel = g_ui.loadUI('graphics.otui')
|
||||
optionsTabBar:addTab(tr('Graphics'), graphicsPanel)
|
||||
|
||||
local optionWalkBooster = gamePanel:getChildById('walkBooster')
|
||||
optionWalkBooster.onCheckChange = function(widget)
|
||||
displayWarning(widget, "This feature could be detectable by official Tibia servers. Would like to continue?")
|
||||
Options.setOption(widget:getId(), widget:isChecked())
|
||||
end
|
||||
|
||||
setupGraphicsEngines()
|
||||
end
|
||||
|
||||
|
@ -103,7 +126,8 @@ function Options.terminate()
|
|||
optionsButton:destroy()
|
||||
optionsButton = nil
|
||||
optionsTabBar = nil
|
||||
generalPanel = nil
|
||||
gamePanel = nil
|
||||
consolePanel = nil
|
||||
graphicsPanel = nil
|
||||
Options = nil
|
||||
end
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 281 B |
Binary file not shown.
After Width: | Height: | Size: 315 B |
|
@ -8,7 +8,7 @@ PopupMenuButton < UIButton
|
|||
text-offset: 0 0
|
||||
font: verdana-11px-antialised
|
||||
|
||||
image-source: /images/button_square.png
|
||||
image-source: /images/menubutton.png
|
||||
image-color: white
|
||||
image-clip: 0 0 20 20
|
||||
image-border: 2
|
||||
|
|
|
@ -171,6 +171,9 @@ KeyNumpad7 = 148
|
|||
KeyNumpad8 = 149
|
||||
KeyNumpad9 = 150
|
||||
|
||||
FirstKey = KeyUnknown
|
||||
LastKey = KeyNumpad9
|
||||
|
||||
ExtendedActivate = 0
|
||||
ExtendedLocales = 1
|
||||
ExtendedParticles = 2
|
||||
|
|
|
@ -80,6 +80,17 @@ local function onWidgetKeyDown(widget, keyCode, keyboardModifiers)
|
|||
return false
|
||||
end
|
||||
|
||||
local function onWidgetKeyUp(widget, keyCode, keyboardModifiers)
|
||||
if keyCode == KeyUnknown then return false end
|
||||
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
||||
local callback = widget.boundKeyUpCombos[keyComboDesc]
|
||||
if callback then
|
||||
callback()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function onWidgetKeyPress(widget, keyCode, keyboardModifiers, autoRepeatTicks)
|
||||
if keyCode == KeyUnknown then return false end
|
||||
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
||||
|
@ -97,6 +108,12 @@ local function connectKeyDownEvent(widget)
|
|||
widget.boundKeyDownCombos = {}
|
||||
end
|
||||
|
||||
local function connectKeyUpEvent(widget)
|
||||
if widget.boundKeyUpCombos then return end
|
||||
connect(widget, { onKeyUp = onWidgetKeyUp })
|
||||
widget.boundKeyUpCombos = {}
|
||||
end
|
||||
|
||||
local function connectKeyPressEvent(widget)
|
||||
if widget.boundKeyPressCombos then return end
|
||||
connect(widget, { onKeyPress = onWidgetKeyPress })
|
||||
|
@ -114,6 +131,16 @@ function g_keyboard.bindKeyDown(keyComboDesc, callback, widget)
|
|||
widget.boundKeyDownCombos[keyComboDesc] = callback
|
||||
end
|
||||
|
||||
function g_keyboard.bindKeyUp(keyComboDesc, callback, widget)
|
||||
widget = widget or rootWidget
|
||||
connectKeyUpEvent(widget)
|
||||
local keyComboDesc = retranslateKeyComboDesc(keyComboDesc)
|
||||
if widget.boundKeyUpCombos[keyComboDesc] then
|
||||
pwarning('KeyUp event \'' .. keyComboDesc .. '\' redefined on widget ' .. widget:getId())
|
||||
end
|
||||
widget.boundKeyUpCombos[keyComboDesc] = callback
|
||||
end
|
||||
|
||||
function g_keyboard.bindKeyPress(keyComboDesc, callback, widget, autoRepeatDelay)
|
||||
autoRepeatDelay = autoRepeatDelay or 500
|
||||
widget = widget or rootWidget
|
||||
|
@ -135,6 +162,15 @@ function g_keyboard.unbindKeyDown(keyComboDesc, widget)
|
|||
end
|
||||
end
|
||||
|
||||
function g_keyboard.unbindKeyUp(keyComboDesc, widget)
|
||||
widget = widget or rootWidget
|
||||
if widget.boundKeyUpCombos == nil then return end
|
||||
local keyComboDesc = retranslateKeyComboDesc(keyComboDesc)
|
||||
if keyComboDesc then
|
||||
widget.boundKeyUpCombos[keyComboDesc] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function g_keyboard.unbindKeyPress(keyComboDesc, widget)
|
||||
widget = widget or rootWidget
|
||||
if widget.boundKeyPressCombos == nil then return end
|
||||
|
@ -155,6 +191,32 @@ function g_keyboard.isKeyPressed(key)
|
|||
return g_window.isKeyPressed(key)
|
||||
end
|
||||
|
||||
function g_keyboard.isKeySetPressed(keys, all)
|
||||
all = all or false
|
||||
local result = {}
|
||||
for k,v in pairs(keys) do
|
||||
if type(v) == 'string' then
|
||||
key = getKeyCode(v)
|
||||
end
|
||||
if g_window.isKeyPressed(key) then
|
||||
if not all then
|
||||
return true
|
||||
end
|
||||
table.insert(result, true)
|
||||
end
|
||||
end
|
||||
return #result == #keys
|
||||
end
|
||||
|
||||
function g_keyboard.isInUse()
|
||||
for i = FirstKey, LastKey do
|
||||
if g_window.isKeyPressed(key) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function g_keyboard.isCtrlPressed()
|
||||
return bit32.band(g_window.getKeyboardModifiers(), KeyboardCtrlModifier) ~= 0
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
WALK_AUTO_REPEAT_DELAY = 180
|
||||
WALK_AUTO_REPEAT_DELAY = 80
|
||||
|
||||
gameRootPanel = nil
|
||||
gameMapPanel = nil
|
||||
|
@ -12,6 +12,18 @@ logoutWindow = nil
|
|||
exitWindow = nil
|
||||
bottomSplitter = nil
|
||||
|
||||
lastWalkDir = nil
|
||||
arrowKeys = {
|
||||
[North] = "Up",
|
||||
[South] = 'Down',
|
||||
[East] = 'Right',
|
||||
[West] = 'Left',
|
||||
[NorthEast] = 'Numpad9',
|
||||
[SouthEast] = 'Numpad3',
|
||||
[NorthWest] = 'Numpad7',
|
||||
[SouthWest] = 'Numpad1'
|
||||
}
|
||||
|
||||
function init()
|
||||
g_ui.importStyle('styles/countwindow.otui')
|
||||
|
||||
|
@ -49,6 +61,12 @@ function bindKeys()
|
|||
g_keyboard.bindKeyPress('Right', function() smartWalk(East) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||
g_keyboard.bindKeyPress('Down', function() smartWalk(South) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||
g_keyboard.bindKeyPress('Left', function() smartWalk(West) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||
|
||||
g_keyboard.bindKeyDown('Up', function() smartWalk(North) end, gameRootPanel)
|
||||
g_keyboard.bindKeyDown('Right', function() smartWalk(East) end, gameRootPanel)
|
||||
g_keyboard.bindKeyDown('Down', function() smartWalk(South) end, gameRootPanel)
|
||||
g_keyboard.bindKeyDown('Left', function() smartWalk(West) end, gameRootPanel)
|
||||
|
||||
g_keyboard.bindKeyPress('Numpad8', function() smartWalk(North) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||
g_keyboard.bindKeyPress('Numpad9', function() smartWalk(NorthEast) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||
g_keyboard.bindKeyPress('Numpad6', function() smartWalk(East) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||
|
@ -164,7 +182,34 @@ function tryLogout()
|
|||
end
|
||||
|
||||
function smartWalk(defaultDir)
|
||||
local dir
|
||||
--[[ TODO: Add walk event stack ]]
|
||||
local rebindKey = false
|
||||
local lastKey = arrowKeys[lastWalkDir]
|
||||
|
||||
-- choose a new direction
|
||||
if not g_keyboard.isKeyPressed(arrowKeys[defaultDir]) then
|
||||
local changeDir = false
|
||||
for k,v in pairs(arrowKeys) do
|
||||
if g_keyboard.isKeyPressed(v) then
|
||||
defaultDir = k
|
||||
changeDir = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not changeDir then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- key is still pressed from previous walk event
|
||||
if lastWalkDir and lastWalkDir ~= defaultDir and g_keyboard.isKeyPressed(lastKey) then
|
||||
if g_keyboard.isKeySetPressed(arrowKeys) then
|
||||
g_keyboard.unbindKeyPress(lastKey, gameRootPanel)
|
||||
rebindKey = true
|
||||
end
|
||||
end
|
||||
|
||||
local dir = defaultDir
|
||||
if Options.getOption('smartWalk') then
|
||||
if g_keyboard.isKeyPressed('Up') and g_keyboard.isKeyPressed('Left') then
|
||||
dir = NorthWest
|
||||
|
@ -176,9 +221,6 @@ function smartWalk(defaultDir)
|
|||
dir = SouthEast
|
||||
end
|
||||
end
|
||||
if not dir then
|
||||
dir = defaultDir
|
||||
end
|
||||
|
||||
if Options.getOption('walkBooster') then
|
||||
if g_game.getLocalPlayer():canWalk(dir) then
|
||||
|
@ -187,8 +229,17 @@ function smartWalk(defaultDir)
|
|||
g_game.forceWalk(dir)
|
||||
end
|
||||
else
|
||||
--if g_game.getLocalPlayer():canWalk(dir) then
|
||||
g_game.walk(dir)
|
||||
--else
|
||||
|
||||
--end
|
||||
end
|
||||
|
||||
if rebindKey then
|
||||
g_keyboard.bindKeyPress(lastKey, function() smartWalk(lastWalkDir) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||
end
|
||||
lastWalkDir = dir
|
||||
end
|
||||
|
||||
function updateStretchShrink()
|
||||
|
|
|
@ -23,8 +23,7 @@ function init()
|
|||
onGameEnd = offline,
|
||||
onAutomapFlag = addMapFlag
|
||||
})
|
||||
connect(LocalPlayer, { onPositionChange = center,
|
||||
onPositionChange = updateMapFlags })
|
||||
connect(LocalPlayer, { onPositionChange = center })
|
||||
|
||||
g_keyboard.bindKeyDown('Ctrl+M', toggle)
|
||||
|
||||
|
@ -63,8 +62,7 @@ function terminate()
|
|||
onGameEnd = offline,
|
||||
onAutomapFlag = addMapFlag
|
||||
})
|
||||
disconnect(LocalPlayer, { onPositionChange = center,
|
||||
onPositionChange = updateMapFlags })
|
||||
disconnect(LocalPlayer, { onPositionChange = center })
|
||||
|
||||
destroyFlagWindow()
|
||||
saveMapFlags()
|
||||
|
@ -303,10 +301,7 @@ function reset()
|
|||
end
|
||||
|
||||
function center()
|
||||
local player = g_game.getLocalPlayer()
|
||||
if not player then return end
|
||||
minimapWidget:followCreature(player)
|
||||
|
||||
reset()
|
||||
updateMapFlags()
|
||||
end
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ function report()
|
|||
elseif comment == "" then
|
||||
displayErrorBox(tr("Error"), tr("You must enter a comment."))
|
||||
else
|
||||
g_game.reportRuleVilation(target, reason, action, comment, statement, statementId, ipBanishment)
|
||||
g_game.reportRuleViolation(target, reason, action, comment, statement, statementId, ipBanishment)
|
||||
hide()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
TextScrollbar < VerticalScrollBar
|
||||
|
||||
TextWindow < MainWindow
|
||||
id: textWindow
|
||||
size: 280 280
|
||||
|
@ -30,7 +28,7 @@ TextWindow < MainWindow
|
|||
margin-top: 30
|
||||
margin-bottom: 30
|
||||
|
||||
TextScrollbar
|
||||
VerticalScrollBar
|
||||
id: textScroll
|
||||
anchors.left: prev.right
|
||||
anchors.top: prev.top
|
||||
|
|
|
@ -84,7 +84,7 @@ void Creature::draw(const Point& dest, float scaleFactor, bool animate, LightVie
|
|||
|
||||
if(lightView) {
|
||||
Light light = rawGetThingType()->getLight();
|
||||
if(m_light.intensity != light.intensity && m_light.color != light.color)
|
||||
if(m_light.intensity != light.intensity || m_light.color != light.color)
|
||||
light = m_light;
|
||||
|
||||
// local player always have a minimum light in complete darkness
|
||||
|
@ -384,7 +384,7 @@ void Creature::updateWalkAnimation(int totalPixelsWalked)
|
|||
int footAnimPhases = getAnimationPhases() - 1;
|
||||
if(totalPixelsWalked == 32 || footAnimPhases == 0)
|
||||
m_walkAnimationPhase = 0;
|
||||
else if(m_footStepDrawn && m_footTimer.ticksElapsed() >= getStepDuration() / 4 ) {
|
||||
else if(m_footStepDrawn && m_footTimer.ticksElapsed() >= getStepDuration(true) / 4 ) {
|
||||
m_footStep++;
|
||||
m_walkAnimationPhase = 1 + (m_footStep % footAnimPhases);
|
||||
m_footStepDrawn = false;
|
||||
|
@ -459,8 +459,7 @@ void Creature::nextWalkUpdate()
|
|||
|
||||
void Creature::updateWalk()
|
||||
{
|
||||
int stepDuration = getStepDuration();
|
||||
float walkTicksPerPixel = stepDuration / 32;
|
||||
float walkTicksPerPixel = getStepDuration(true) / 32;
|
||||
int totalPixelsWalked = std::min(m_walkTimer.ticksElapsed() / walkTicksPerPixel, 32.0f);
|
||||
|
||||
// needed for paralyze effect
|
||||
|
@ -472,7 +471,7 @@ void Creature::updateWalk()
|
|||
updateWalkingTile();
|
||||
|
||||
// terminate walk
|
||||
if(m_walking && m_walkTimer.ticksElapsed() >= stepDuration)
|
||||
if(m_walking && m_walkTimer.ticksElapsed() >= getStepDuration())
|
||||
terminateWalk();
|
||||
}
|
||||
|
||||
|
@ -670,7 +669,7 @@ Point Creature::getDrawOffset()
|
|||
return drawOffset;
|
||||
}
|
||||
|
||||
int Creature::getStepDuration()
|
||||
int Creature::getStepDuration(bool ignoreDiagonal)
|
||||
{
|
||||
int speed = m_speed;
|
||||
if(g_game.getFeature(Otc::GameNewSpeedLaw))
|
||||
|
@ -707,8 +706,8 @@ int Creature::getStepDuration()
|
|||
|
||||
interval = std::max(interval, g_game.getServerBeat());
|
||||
|
||||
if(m_lastStepDirection == Otc::NorthWest || m_lastStepDirection == Otc::NorthEast ||
|
||||
m_lastStepDirection == Otc::SouthWest || m_lastStepDirection == Otc::SouthEast)
|
||||
if(!ignoreDiagonal && (m_lastStepDirection == Otc::NorthWest || m_lastStepDirection == Otc::NorthEast ||
|
||||
m_lastStepDirection == Otc::SouthWest || m_lastStepDirection == Otc::SouthEast))
|
||||
interval *= 3;
|
||||
|
||||
return interval;
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
uint8 getEmblem() { return m_emblem; }
|
||||
bool isPassable() { return m_passable; }
|
||||
Point getDrawOffset();
|
||||
int getStepDuration();
|
||||
int getStepDuration(bool ignoreDiagonal = false);
|
||||
Point getWalkOffset() { return m_walkOffset; }
|
||||
Position getLastStepFromPosition() { return m_lastStepFromPosition; }
|
||||
Position getLastStepToPosition() { return m_lastStepToPosition; }
|
||||
|
|
|
@ -495,7 +495,7 @@ bool Game::walk(Otc::Direction direction)
|
|||
if(isFollowing())
|
||||
cancelFollow();
|
||||
|
||||
// msut cancel auto walking and wait next try
|
||||
// must cancel auto walking and wait next try
|
||||
if(m_localPlayer->isAutoWalking()) {
|
||||
m_protocolGame->sendStop();
|
||||
return false;
|
||||
|
@ -549,7 +549,7 @@ bool Game::walk(Otc::Direction direction)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Game::autoWalk(const std::vector<Otc::Direction>& dirs)
|
||||
void Game::autoWalk(std::vector<Otc::Direction> dirs)
|
||||
{
|
||||
if(!canPerformGameAction())
|
||||
return;
|
||||
|
@ -567,11 +567,16 @@ void Game::autoWalk(const std::vector<Otc::Direction>& dirs)
|
|||
if(isFollowing())
|
||||
cancelFollow();
|
||||
|
||||
Otc::Direction direction = dirs.front();
|
||||
auto it = dirs.begin();
|
||||
Otc::Direction direction = *it;
|
||||
if(m_localPlayer->canWalk(direction)) {
|
||||
TilePtr toTile = g_map.getTile(m_localPlayer->getPosition().translatedToDirection(direction));
|
||||
if(toTile && toTile->isWalkable() && !m_localPlayer->isAutoWalking())
|
||||
{
|
||||
m_localPlayer->preWalk(direction);
|
||||
forceWalk(direction);
|
||||
dirs.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
g_lua.callGlobalField("g_game", "onAutoWalk", dirs);
|
||||
|
@ -777,11 +782,11 @@ void Game::close(const ContainerPtr& container)
|
|||
m_protocolGame->sendCloseContainer(container->getId());
|
||||
}
|
||||
|
||||
void Game::refreshContainer()
|
||||
void Game::refreshContainer(const ContainerPtr& container)
|
||||
{
|
||||
if(!canPerformGameAction())
|
||||
return;
|
||||
m_protocolGame->sendRefreshContainer();
|
||||
m_protocolGame->sendRefreshContainer(container->getId());
|
||||
}
|
||||
|
||||
void Game::attack(CreaturePtr creature)
|
||||
|
@ -1095,11 +1100,11 @@ void Game::reportBug(const std::string& comment)
|
|||
m_protocolGame->sendBugReport(comment);
|
||||
}
|
||||
|
||||
void Game::reportRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment)
|
||||
void Game::reportRuleViolation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment)
|
||||
{
|
||||
if(!canPerformGameAction())
|
||||
return;
|
||||
m_protocolGame->sendRuleVilation(target, reason, action, comment, statement, statementId, ipBanishment);
|
||||
m_protocolGame->sendRuleViolation(target, reason, action, comment, statement, statementId, ipBanishment);
|
||||
}
|
||||
|
||||
void Game::debugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d)
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
|
||||
// walk related
|
||||
bool walk(Otc::Direction direction);
|
||||
void autoWalk(const std::vector<Otc::Direction>& dirs);
|
||||
void autoWalk(std::vector<Otc::Direction> dirs);
|
||||
void forceWalk(Otc::Direction direction);
|
||||
void turn(Otc::Direction direction);
|
||||
void stop();
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
void open(const ItemPtr& item, const ContainerPtr& previousContainer);
|
||||
void openParent(const ContainerPtr& container);
|
||||
void close(const ContainerPtr& container);
|
||||
void refreshContainer();
|
||||
void refreshContainer(const ContainerPtr& container);
|
||||
|
||||
// attack/follow related
|
||||
void attack(CreaturePtr creature);
|
||||
|
@ -225,7 +225,7 @@ public:
|
|||
|
||||
// reports
|
||||
void reportBug(const std::string& comment);
|
||||
void reportRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment);
|
||||
void reportRuleViolation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment);
|
||||
void debugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d);
|
||||
|
||||
// questlog related
|
||||
|
|
|
@ -190,7 +190,7 @@ void LocalPlayer::updateWalkOffset(int totalPixelsWalked)
|
|||
void LocalPlayer::updateWalk()
|
||||
{
|
||||
int stepDuration = getStepDuration();
|
||||
float walkTicksPerPixel = stepDuration / 32.0f;
|
||||
float walkTicksPerPixel = getStepDuration(true) / 32.0f;
|
||||
int totalPixelsWalked = std::min(m_walkTimer.ticksElapsed() / walkTicksPerPixel, 32.0f);
|
||||
|
||||
// update walk animation and offsets
|
||||
|
|
|
@ -194,7 +194,7 @@ void OTClient::registerLuaFunctions()
|
|||
g_lua.bindSingletonFunction("g_game", "acceptTrade", &Game::acceptTrade, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "rejectTrade", &Game::rejectTrade, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "reportBug", &Game::reportBug, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "reportRuleVilation", &Game::reportRuleVilation, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "reportRuleViolation", &Game::reportRuleViolation, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "debugReport", &Game::debugReport, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "editText", &Game::editText, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "editList", &Game::editList, &g_game);
|
||||
|
|
|
@ -214,6 +214,7 @@ namespace Proto {
|
|||
ClientInviteToOwnChannel = 171,
|
||||
ClientExcludeFromOwnChannel = 172,
|
||||
ClientCancelAttackAndFollow = 190,
|
||||
ClientUpdateTile = 201,
|
||||
ClientRefreshContainer = 202,
|
||||
ClientRequestOutfit = 210,
|
||||
ClientChangeOutfit = 211,
|
||||
|
|
|
@ -92,14 +92,14 @@ public:
|
|||
void sendInviteToOwnChannel(const std::string& name);
|
||||
void sendExcludeFromOwnChannel(const std::string& name);
|
||||
void sendCancelAttackAndFollow();
|
||||
void sendRefreshContainer();
|
||||
void sendRefreshContainer(int containerId);
|
||||
void sendRequestOutfit();
|
||||
void sendChangeOutfit(const Outfit& outfit);
|
||||
void sendMountStatus(bool mount);
|
||||
void sendAddVip(const std::string& name);
|
||||
void sendRemoveVip(uint playerId);
|
||||
void sendBugReport(const std::string& comment);
|
||||
void sendRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment);
|
||||
void sendRuleViolation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment);
|
||||
void sendDebugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d);
|
||||
void sendRequestQuestLog();
|
||||
void sendRequestQuestLine(int questId);
|
||||
|
|
|
@ -1411,24 +1411,24 @@ void ProtocolGame::parseShowModalDialog(const InputMessagePtr& msg)
|
|||
int sizeButtons = msg->getU8();
|
||||
std::map<int, std::string > buttonList;
|
||||
for(int i = 0; i < sizeButtons; ++i) {
|
||||
std::string name = msg->getString();
|
||||
int value = msg->getU8();
|
||||
buttonList[value] = name;
|
||||
std::string value = msg->getString();
|
||||
int id = msg->getU8();
|
||||
buttonList[id] = value;
|
||||
}
|
||||
|
||||
int sizeChoices = msg->getU8();
|
||||
std::vector<std::tuple<int, std::string> > choiceList;
|
||||
for(int i = 0; i < sizeChoices; ++i) {
|
||||
std::string name = msg->getString();
|
||||
int value = msg->getU8();
|
||||
choiceList.push_back(std::make_tuple(value, name));
|
||||
std::string value = msg->getString();
|
||||
int id = msg->getU8();
|
||||
choiceList.push_back(std::make_tuple(id, value));
|
||||
}
|
||||
|
||||
int enterButton = msg->getU8();
|
||||
int escapeButton = msg->getU8();
|
||||
msg->getU8(); // popup value (no clue what it is for)
|
||||
|
||||
std::map<int, std::string >::iterator itEnter = buttonList.find(enterButton);
|
||||
std::map<int, std::string>::iterator itEnter = buttonList.find(enterButton);
|
||||
if(itEnter == buttonList.end())
|
||||
{
|
||||
g_logger.info(stdext::format("Enter button does not exist for dialog id: %d", id));
|
||||
|
|
|
@ -629,10 +629,11 @@ void ProtocolGame::sendCancelAttackAndFollow()
|
|||
send(msg);
|
||||
}
|
||||
|
||||
void ProtocolGame::sendRefreshContainer()
|
||||
void ProtocolGame::sendRefreshContainer(int containerId)
|
||||
{
|
||||
OutputMessagePtr msg(new OutputMessage);
|
||||
msg->addU8(Proto::ClientRefreshContainer);
|
||||
msg->addU8(containerId);
|
||||
send(msg);
|
||||
}
|
||||
|
||||
|
@ -694,7 +695,7 @@ void ProtocolGame::sendBugReport(const std::string& comment)
|
|||
send(msg);
|
||||
}
|
||||
|
||||
void ProtocolGame::sendRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment)
|
||||
void ProtocolGame::sendRuleViolation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment)
|
||||
{
|
||||
OutputMessagePtr msg(new OutputMessage);
|
||||
msg->addU8(Proto::ClientRuleViolation);
|
||||
|
|
Loading…
Reference in New Issue