• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Fix mana potion / paladin attack delay + remove weapon missing

Itutorial

Excellent OT User
Joined
Dec 23, 2014
Messages
2,325
Solutions
68
Reaction score
999
This is make it so paladins do not stop attacking while using mana potions.

open player.cpp

find
Code:
if (weapon) {
            if (!weapon->interruptSwing()) {
                result = weapon->useWeapon(this, tool, attackedCreature);
            } else if (!classicSpeed && !canDoAction()) {
                delay = getNextActionTime();
            } else {
                result = weapon->useWeapon(this, tool, attackedCreature);
            }
        } else {
            result = Weapon::useFist(this, attackedCreature);
        }

replace with
Code:
if (weapon) {
            result = weapon->useWeapon(this, tool, attackedCreature);
        } else {
            result = Weapon::useFist(this, attackedCreature);
        }

REMOVE MISS TARGET

open weapons.cpp
replace whole function
Code:
bool WeaponDistance::useWeapon(Player* player, Item* item, Creature* target) const

with this
Code:
bool WeaponDistance::useWeapon(Player* player, Item* item, Creature* target) const
{
    int32_t damageModifier;
    const ItemType& it = Item::items[id];
    if (it.weaponType == WEAPON_AMMO) {
        Item* mainWeaponItem = player->getWeapon(true);
        const Weapon* mainWeapon = g_weapons->getWeapon(mainWeaponItem);
        if (mainWeapon) {
            damageModifier = mainWeapon->playerWeaponCheck(player, target, mainWeaponItem->getShootRange());
        } else {
            damageModifier = playerWeaponCheck(player, target, mainWeaponItem->getShootRange());
        }
    } else {
        damageModifier = playerWeaponCheck(player, target, item->getShootRange());
    }

    if (damageModifier == 0) {
        return false;
    }
   
    Weapon::internalUseWeapon(player, item, destTile);
    return true;
}

DONE
 
I can't quite put my finger on it, but something tells me this is a bad idea...

Yes, looking at the code, this is a very very bad idea.
bool WeaponDistance::useWeapon(Player* player, Item* item, Creature* target) const
is utterly butchered by this. It's a massive function that can't be replicated in so few lines, and is now missing features.

If this is about the pally potion thing that Nugo posted on recently, it would be better to track down the actual cause. I'm pretty sure it's because distance weapons are either triggering or checking the item exhaust instead of the combat exhaust. I just haven't had time to dig in. All I know is this is not it chief.
 
I can't quite put my finger on it, but something tells me this is a bad idea...

Yes, looking at the code, this is a very very bad idea.
bool WeaponDistance::useWeapon(Player* player, Item* item, Creature* target) const
is utterly butchered by this. It's a massive function that can't be replicated in so few lines, and is now missing features.

If this is about the pally potion thing that Nugo posted on recently, it would be better to track down the actual cause. I'm pretty sure it's because distance weapons are either triggering or checking the item exhaust instead of the combat exhaust. I just haven't had time to dig in. All I know is this is not it chief.

Hey bro,
your suggestion is not a good idea.

C++:
-- Item Usage
-- Do not touch here
-- Avoid use of WIPE program to crash the distro

change the - Item Usage
timeBetweenActions = 0
timeBetweenExActions = 0


It can open loopholes to crash the server..
-

And it doesn't work in tfs 1.3
 
I can't quite put my finger on it, but something tells me this is a bad idea...

Yes, looking at the code, this is a very very bad idea.
bool WeaponDistance::useWeapon(Player* player, Item* item, Creature* target) const
is utterly butchered by this. It's a massive function that can't be replicated in so few lines, and is now missing features.

If this is about the pally potion thing that Nugo posted on recently, it would be better to track down the actual cause. I'm pretty sure it's because distance weapons are either triggering or checking the item exhaust instead of the combat exhaust. I just haven't had time to dig in. All I know is this is not it chief.

The first code change removes the delay in manapot...

The second code block only removes missing chance. There is nothing taken out but that. It should be fine.
 
your suggestion is not a good idea.

My what? 🧐 I don't recall advising any course of action in that post. Only stating that OP is gutting massive chunks of a function which has nothing to do with stated intention of the thread title. The thread I linked was merely an example of the targeted "problem"

I guess I missed the part where OP did in fact specify the 2nd part accomplished something else, so my bad on that.
 
My what? 🧐 I don't recall advising any course of action in that post. Only stating that OP is gutting massive chunks of a function which has nothing to do with stated intention of the thread title. The thread I linked was merely an example of the targeted "problem"

I guess I missed the part where OP did in fact specify the 2nd part accomplished something else, so my bad on that.



Sorry for my confusion bro ... I just changed the first part in player.cpp to fix the pally exhaust, and it worked. I did not apply the second part.
 
The second part is for Paladins missing with their spear/bows.
 
I can't quite put my finger on it, but something tells me this is a bad idea...

Yes, looking at the code, this is a very very bad idea.
bool WeaponDistance::useWeapon(Player* player, Item* item, Creature* target) const
is utterly butchered by this. It's a massive function that can't be replicated in so few lines, and is now missing features.

If this is about the pally potion thing that Nugo posted on recently, it would be better to track down the actual cause. I'm pretty sure it's because distance weapons are either triggering or checking the item exhaust instead of the combat exhaust. I just haven't had time to dig in. All I know is this is not it chief.
Any update on this bro?
 
Back
Top