EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Windows Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=587)
-   -   Fishing issue (https://www.eqemulator.org/forums/showthread.php?t=38748)

Mortow 09-11-2014 09:55 PM

Fishing issue
 
Is anyone else experiencing a problem with fishing? I have tried multiple zones, multiple fishing rods and different kinds of bait and it always tells me, 'Trying to catch land sharks perhaps?' even when I am levitating over a huge body of water. It was working a few days ago and all I have changed are some trade skill recipes. (UF client)

Kingly_Krab 09-11-2014 10:09 PM

Not sure what your exact issue is, but here's the Client::CanFish code in forage.cpp, the code giving your error is green. Maybe you could un-comment the yellow and recompile and see what it sends you?:
Code:

bool Client::CanFish() {
    //make sure we still have a fishing pole on:
    const ItemInst* Pole = m_inv[MainPrimary];
    int32 bslot = m_inv.HasItemByUse(ItemTypeFishingBait, 1, invWhereWorn|invWherePersonal);
    const ItemInst* Bait = nullptr;
    if (bslot != INVALID_INDEX)
        Bait = m_inv.GetItem(bslot);

    if(!Pole || !Pole->IsType(ItemClassCommon) || Pole->GetItem()->ItemType != ItemTypeFishingPole) {
        if (m_inv.HasItemByUse(ItemTypeFishingPole, 1, invWhereWorn|invWherePersonal|invWhereBank|invWhereSharedBank|invWhereTrading|invWhereCursor))    //We have a fishing pole somewhere, just not equipped
            Message_StringID(MT_Skills, FISHING_EQUIP_POLE);    //You need to put your fishing pole in your primary hand.
        else    //We don't have a fishing pole anywhere
            Message_StringID(MT_Skills, FISHING_NO_POLE);    //You can't fish without a fishing pole, go buy one.
        return false;
    }

    if (!Bait || !Bait->IsType(ItemClassCommon) || Bait->GetItem()->ItemType != ItemTypeFishingBait) {
        Message_StringID(MT_Skills, FISHING_NO_BAIT);    //You can't fish without fishing bait, go buy some.
        return false;
    }

    if(zone->zonemap != nullptr && zone->watermap != nullptr && RuleB(Watermap, CheckForWaterWhenFishing)) {
        float RodX, RodY, RodZ;
        // Tweak Rod and LineLength if required
        const float RodLength = RuleR(Watermap, FishingRodLength);
        const float LineLength = RuleR(Watermap, FishingLineLength);
        int HeadingDegrees;

        HeadingDegrees = (int) ((GetHeading()*360)/256);
        HeadingDegrees = HeadingDegrees % 360;

        RodX = x_pos + RodLength * sin(HeadingDegrees * M_PI/180.0f);
        RodY = y_pos + RodLength * cos(HeadingDegrees * M_PI/180.0f);

        // Do BestZ to find where the line hanging from the rod intersects the water (if it is water).
        // and go 1 unit into the water.
        Map::Vertex dest;
        dest.x = RodX;
        dest.y = RodY;
        dest.z = z_pos+10;

        RodZ = zone->zonemap->FindBestZ(dest, nullptr) - 1;
        bool in_lava = zone->watermap->InLava(RodX, RodY, RodZ);
        bool in_water = zone->watermap->InWater(RodX, RodY, RodZ) || zone->watermap->InVWater(RodX, RodY, RodZ);
        //Message(0, "Rod is at %4.3f, %4.3f, %4.3f, InWater says %d, InLava says %d", RodX, RodY, RodZ, in_water, in_lava);
        if (in_lava) {
            Message_StringID(MT_Skills, FISHING_LAVA);    //Trying to catch a fire elemental or something?
            return false;
        }
        if((!in_water) || (z_pos-RodZ)>LineLength) {    //Didn't hit the water OR the water is too far below us
            Message_StringID(MT_Skills, FISHING_LAND);    //Trying to catch land sharks perhaps?
            return false;
        }

    }
    return true;
}


Mortow 09-11-2014 10:21 PM

I will give that a shot. Thanks Kingly. I don't have any levitate on and if I step in the water it tells me I must be on dry land to fish but when I take a step back out of the water, I get the land shark message. It is almost as if it is not recognizing the water as water.

EDIT: I compared your code above to my forage.cpp file which has a date of 09/08/2014 and the only difference I see is the line three lines above the Message you told me to uncomment. Mine had + 4 at the end instead of - 1. (Recompiling as I type this.)

Kingly_Krab 09-11-2014 11:29 PM

Okay, feel free to comment back with a screenshot or whatever of the information the debug sends you (I assume you removed the // in front of the Message to allow it to send?).

Coenxai 09-12-2014 12:32 AM

I believe KLS recently made a change to FindBestZ. That could be a possibility to the issue you're facing.

Mortow 09-12-2014 02:38 PM

I enabled the message as you suggested, Kingly and it says:

Rod is at 1455.046, 1.128, -122.000, InWater says 0, InLava says 0

This attempt was done in PoK in the small pool by the fishing vendors.

I also changed the + 4 to - 1 and recompiled and this makes fishing work again. Not sure what affects that may have on other things.

KLS 09-12-2014 04:50 PM

The issue is the old code basically relied on the water's surface acting as a solid "floor".

If you look at the code what it does is cast out z + 10 above you and tries to find the bestz (hoping to hit the water surface). It then subtracts a small amount and hopes that the bobber is in the water.

I have the info in the maps to fix this so they don't have to be regenerated but it's not currently coded in.

For now the "RodZ = zone->zonemap->FindBestZ(dest, nullptr) + 4;" hack makes it work for *most* pools of water but I need to go back and recode the maps so we can do it as intended.

Mortow 09-12-2014 08:53 PM

Thanks for the info KLS. I must just have really bad luck in picking the pools because the four I used didn't work. That's the way my luck generally runs though.

provocating 10-14-2014 11:15 PM

I just ran into this on my server. So what is the real fix? Can I just run azone2 again on my maps and will that fix the problem or am I going to have to hack my code?


All times are GMT -4. The time now is 08:05 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.