EOSERV Forum > EOSERV > Ananas .ini Fishing System. (UPDATE)
Topic is locked.
Page: << 1 2 >>
Ananas .ini Fishing System. (UPDATE)
Author Message
Post #36606 Ananas .ini Fishing System. (UPDATE)

The .ini (fish.ini) (Goes in the data folder)

https://tehsausage.com/paste/tdck

World.hpp

Config fish_config;



World.cpp
this->fish_config.Read(static_cast<std::string>(this->config["FishFile"]));


Config.ini
## FishFile (string)
# Fishing location file
FishFile = ./data/fish.ini


Data Folder
fish.ini


The code (Goes in attack.cpp)

https://tehsausage.com/paste/cp


The harvesting guide.

https://eoserv.net/forum/topic/7261



Guide is almost like the same as the harvesting guide of mine.

Note this is a release for people who think they know atleast how to make the server read .ini files and how to paste a code.
Thats all you need to know.
Questions? You could either try yourself to figure it out and if not then just post them here.
NOTE: As I said before, My harvest system has the same guide. (Almost) < For adding .ini files.


UPDATE: You can now manually edit the ItemID of the 5 items you can choose at the fish.ini. (Both codes got updated.)

---
"Pineapples and shit."
14 years, 1 week ago
Post #36608 Re: Ananas .ini Fishing System.

XD With all these Fishing Systems out, I'm not to sure on whos I should  use, Is this different from your other one?


And how is this any different then Grazza

14 years, 1 week ago
Post #36609 Re: Ananas .ini Fishing System.

V1.0. It has item added but I'm going to add something to this code ;p Something easy though.

Oh and the difference, I think mine has a more change of catching more things. And mine doesn't have a timer.

---
"Pineapples and shit."
14 years, 1 week ago
Post #36610 Re: Ananas .ini Fishing System.

Well then +1 for you "For the thousand time" Just cause ur scripts work + are simple.


[OffTopic]


Keep an eye out on ur Top Player command topic.

14 years, 1 week ago
Post #36611 Re: Ananas .ini Fishing System.

Its also easier for people to understand easier codes.


@Offtopic: What do you mean by that? Keeping an eye on my top players command.

---
"Pineapples and shit."
14 years, 1 week ago
Post #36612 Re: Ananas .ini Fishing System.


Lol I added the fishing code But I got an error after adding

This to the Attack.cpp I placed it directly under:


this->player->character->Attack(direction);


And I got this Error:

tinypic.com/205f7o0.jpg


[OffTopic]


I plan to post an Error there, Since I think i'm going to get an error when I add it e.e

14 years, 1 week ago
Post #36613 Re: Ananas .ini Fishing System. (UPDATE)

Did you made the whole config part to?

(Your picture shoes nothing, the link is corrupted)

---
"Pineapples and shit."
14 years, 1 week ago
Post #36614 Re: Ananas .ini Fishing System. (UPDATE)

Okay heres the fixed link + I get the same error.

http://i42.tinypic.com/egd27a.jpg

14 years, 1 week ago
Post #36615 Re: Ananas .ini Fishing System. (UPDATE)

And if you would delete my part of the code then you're not getting that error?

---
"Pineapples and shit."
14 years, 1 week ago
Post #36616 Re: Ananas .ini Fishing System. (UPDATE)

This just happened after I added ur Fishing code.

14 years, 1 week ago
Post #36618 Re: Ananas .ini Fishing System. (UPDATE)

Then try at remove it and see if it still happends :P

If not, try to figure out why it redirects you to an other file.
Could also be that the file (Attack.cpp) Doesn't end well Using { or }.

---
"Pineapples and shit."
14 years, 1 week ago
Post #36622 Re: Ananas .ini Fishing System. (UPDATE)

I have just took out ur "Attack.cpp" and its still getting the error,


NOTE: I've added ur other fishing code a while back and it worked /=.

This fishing code don't need a rehash code?

14 years, 1 week ago
Post #36623 Re: Ananas .ini Fishing System. (UPDATE)

You could place it at rehash with this line;

this->fish_config.Read(this->config["FishFile"]);

---
"Pineapples and shit."
14 years, 1 week ago
Post #36624 Re: Ananas .ini Fishing System. (UPDATE)

Then ill show you how I added the code.

--------------------------------------------------------------


/* $Id: Attack.cpp 182 2010-01-08 10:35:27Z sausage $
 * EOSERV is released under the zlib license.
 * See LICENSE.txt for more info.
 */

#include "handlers.h"

#include "map.hpp"

CLIENT_F_FUNC(Attack)
{
    PacketBuilder reply;

    switch (action)
    {
        case PACKET_USE: // Player attacking
        {
            if (this->state < EOClient::Playing) return false;
            CLIENT_QUEUE_ACTION(0.58)

            Direction direction = static_cast<Direction>(reader.GetChar());
            /*int timestamp = */reader.GetThree();

            if (this->player->character->sitting != SIT_STAND)
            {
                return true;
            }

            if (direction != this->player->character->direction)
            {
                if (direction >= 0 && direction <= 3)
                {
                    this->player->character->map->Face(this->player->character, direction);
                    CLIENT_FORCE_QUEUE_ACTION(0.67)
                }
                else
                {
                    return false;
                }
            }

            this->player->character->Attack(direction);
            int Wep, Item1, Item2, Item3, Item4, Item5, Map, X, Y;
                for(int i = 0 ; i < static_cast<int>(this->server->world->fish_config["TAmount"]) ; i++){
                Wep = static_cast<int>(this->server->world->fish_config["Weapon"]);
                Item1 = static_cast<int>(this->server->world->fish_config["Item1"]);
                Item2 = static_cast<int>(this->server->world->fish_config["Item2"]);
                Item3 = static_cast<int>(this->server->world->fish_config["Item3"]);
                Item4 = static_cast<int>(this->server->world->fish_config["Item4"]);
                Item5 = static_cast<int>(this->server->world->fish_config["Item5"]);
                Map = static_cast<int>(this->server->world->fish_config[util::to_string(i+1) + ".map"]);
                X = static_cast<int>(this->server->world->fish_config[util::to_string(i+1) + ".x"]);
                Y = static_cast<int>(this->server->world->fish_config[util::to_string(i+1) + ".y"]);

                if(this->player->character->paperdoll[Character::Weapon] == Wep)
                {
                    if(this->player->character->mapid == Map && this->player->character->x == X && this->player->character->y == Y)
                    {
                        this->player->character->Attack(direction);

                                int random = util::rand(0, 150);
                                if (random < 5)
                                {
                                this->player->character->AddItem(Item1, 1);
                                reply.SetID(PACKET_ITEM, PACKET_GET);
                                reply.AddShort(0); // UID
                                reply.AddShort(Item1);
                                reply.AddThree(1);
                                reply.AddChar(this->player->character->weight);
                                reply.AddChar(this->player->character->maxweight);
                                CLIENT_SEND(reply);

                                }
                                else if (random < 40 && random >= 5)
                                {
                                    break;
                                }
                                else if (random < 44 && random >= 40)
                                {
                                this->player->character->AddItem(Item2, 1);
                                reply.SetID(PACKET_ITEM, PACKET_GET);
                                reply.AddShort(0); // UID
                                reply.AddShort(Item2);
                                reply.AddThree(1);
                                reply.AddChar(this->player->character->weight);
                                reply.AddChar(this->player->character->maxweight);
                                CLIENT_SEND(reply);
                                }
                                else if (random < 70 && random >= 44)
                                {
                                    break;
                                }
                                else if (random < 73 && random >= 70)
                                {
                                this->player->character->AddItem(Item3, 1);
                                reply.SetID(PACKET_ITEM, PACKET_GET);
                                reply.AddShort(0); // UID
                                reply.AddShort(Item3);
                                reply.AddThree(1);
                                reply.AddChar(this->player->character->weight);
                                reply.AddChar(this->player->character->maxweight);
                                CLIENT_SEND(reply);
                                }
                                else if (random < 100 && random >= 73)
                                {
                                    break;
                                }
                                else if (random < 102 && random >= 100)
                                {
                                this->player->character->AddItem(Item4, 1);
                                reply.SetID(PACKET_ITEM, PACKET_GET);
                                reply.AddShort(0); // UID
                                reply.AddShort(Item4);
                                reply.AddThree(1);
                                reply.AddChar(this->player->character->weight);
                                reply.AddChar(this->player->character->maxweight);
                                CLIENT_SEND(reply);
                                }
                                else if (random < 145 && random >= 102)
                                {
                                    break;
                                }
                                else if (random < 146 && random >= 145)
                                {
                                this->player->character->AddItem(Item5, 1);
                                reply.SetID(PACKET_ITEM, PACKET_GET);
                                reply.AddShort(0); // UID
                                reply.AddShort(Item5);
                                reply.AddThree(1);
                                reply.AddChar(this->player->character->weight);
                                reply.AddChar(this->player->character->maxweight);
                                CLIENT_SEND(reply);
                                }
                                else if (random < 150 && random >= 146)
                                {
                                    break;
                                }
                        }
                }
            }
        }
        break;

        default:
            return false;
    }

    return true;
}

14 years, 1 week ago
Post #36625 Re: Ananas .ini Fishing System. (UPDATE)

Looks good to me, And it works right.

---
"Pineapples and shit."
14 years, 1 week ago
Page: << 1 2 >>
Topic is locked.
EOSERV Forum > EOSERV > Ananas .ini Fishing System. (UPDATE)