otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.58k stars 1.05k forks source link

[Bug]: NPCs custom speed attribute is ignored #4760

Closed xmish closed 3 months ago

xmish commented 3 months ago

By submitting this bug issue, you agree to the following.

Does this bug crash tfs?

no

Server Version

1.7 (Master)

Operation System

Windows

OS Description

10.0.19045.4529

Bug description

Setting "speed" attribute to NPC in XML has no effect in game

Possible Pull Requests which are to blame

Steps to reproduce

  1. Modify some NPC's speed attribute
  2. NPC speed is Creatures default: 220 https://github.com/otland/forgottenserver/blob/48352f6e07f93aca4182965866a3ec0c7cd08aed/src/creature.h#L398

Code to reproduce the issue:

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Riona" script="default.lua" walkinterval="2000" floorchange="0" speed="20">
    <health now="100" max="100" />
    <look type="138" head="57" body="59" legs="40" feet="76" addons="0" />
    <parameters>
        <parameter key="module_shop" value="1" />
        <parameter key="shop_buyable" value="backpack,1988,20;pick,2553,10;shovel,2554,20;rope,2120,50" />
    </parameters>
</npc>

Actual Behavior

npc

Even though NpcType' baseSpeed is loaded from XML it has no effect on getSpeed()/getBaseSpeed()/getStepSpeed()

Expected Behavior

speed attribute is respected

Backtrace

No response

xmish commented 3 months ago

Name hiding: https://github.com/otland/forgottenserver/blame/a2b24a4cf53204832efb5d74deb214482a96986c/src/npc.h#L262