EOSERV Forum > EOSERV > Adding Wiseman to your server(Release)
Topic is locked.
Page: << 1 2 >>
Adding Wiseman to your server(Release)
Author Message
Post #32508 Adding Wiseman to your server(Release)

Any text that is bold/underlined is NOT code.


In "eoclient.CPP" under the other CLIENT_F_HANDLE's:

CLIENT_F_HANDLE(PACKET_QUEST,Quest);



In "eoclient.HPP" under the other CLIENT_F_FUNC's:

CLIENT_F_FUNC(Quest);



In "character.CPP" under "void Character::Save(){ }" after the ending bracket:

void Character::List()
{
    PacketBuilder reply(PACKET_RECOVER, PACKET_LIST);
    reply.AddShort(this->clas);
    reply.AddShort(this->str);
    reply.AddShort(this->intl);
    reply.AddShort(this->wis);
    reply.AddShort(this->agi);
    reply.AddShort(this->con);
    reply.AddShort(this->cha);
    reply.AddShort(this->maxhp);
    reply.AddShort(this->maxtp);
    reply.AddShort(this->maxsp);
    reply.AddShort(this->maxweight);
    reply.AddShort(this->mindam);
    reply.AddShort(this->maxdam);
    reply.AddShort(this->accuracy);
    reply.AddShort(this->evade);
    reply.AddShort(this->armor);

    this->player->client->SendBuilder(reply);
}



In "character.HPP" under "void Save();":

void List();



In "packet.HPP" under "enum PacketFamily UTIL_EXTEND_ENUM(unsigned char)" and under "PACKET_ARENA":

PACKET_QUEST = 50,



In"packet.HPP" under "enum PacketAction UTIL_EXTEND_ENUM(unsigned char)" and under "PACKET_EXP":

PACKET_QUEST_DIALOG = 34,




Now go to "Sources"->Highlight "Handlers" and click New File, File, C/C++ Source and put this code into it:

/* Quest.cpp EOS 4.6 12:52 p.m. Gangstamikey $
 *
 *
 */
#include "handlers.h"

CLIENT_F_FUNC(Quest)
{
    switch(action)
    {
        case PACKET_USE: // Clicking Wiseman
        {
            int data1 = reader.GetByte(); if(data1);
            int data2 = reader.GetShort();if(data2);
            int data3 = reader.GetShort();if(data3);

            PacketBuilder reply(PACKET_QUEST, PACKET_QUEST_DIALOG);
            reply.AddByte(2);
            reply.AddShort(4);
            reply.AddShort(4);
            reply.AddThree(1);
            reply.AddByte(255);
            reply.AddShort(4);
            reply.AddBreakString("Karma Quest");
            reply.AddShort(1);
            reply.AddBreakString("Hellow stranger, what can i do for you");
            reply.AddShort(2);
            reply.AddShort(2);
            reply.AddBreakString("Class Menu");
            CLIENT_SEND(reply);
        }
        break;

        case PACKET_ACCEPT: // Accepting/clicking a link in Wiseman
        {
            int data1 = reader.GetByte(); if(data1);
            int data2 = reader.GetShort();if(data2);
            int data3 = reader.GetShort();if(data3);
            int data4 = reader.GetShort();if(data4);
            int data5 = reader.GetShort();if(data5);
            int data6 = reader.GetChar();if(data6);

            if (data1 == 4 && data6 <= 6 && data6 >= 2)
            {
                this->player->character->clas = data6;
                this->player->character->CalculateStats();
                this->player->character->List();
                this->player->character->Save();
                break;
            }

            PacketBuilder reply(PACKET_QUEST, PACKET_QUEST_DIALOG);
            reply.AddByte(2);
            reply.AddShort(4);
            reply.AddShort(4);
            reply.AddThree(3);
            reply.AddByte(255);
            reply.AddShort(4);
            reply.AddBreakString("Class Menu");
            reply.AddShort(1);
            reply.AddBreakString("Please select a class..");
            reply.AddShort(2);
            reply.AddShort(2);
            reply.AddBreakString("Make me Priest");
            reply.AddShort(2);
            reply.AddShort(3);
            reply.AddBreakString("Make me Magician");
            reply.AddShort(2);
            reply.AddShort(4);
            reply.AddBreakString("Make me Rogue");
            reply.AddShort(2);
            reply.AddShort(5);
            reply.AddBreakString("Make me Archer");
            reply.AddShort(2);
            reply.AddShort(6);
            reply.AddBreakString("Make me Warrior");
            CLIENT_SEND(reply);
        }
        break;
        default: return false;
    }
    return true;
}


Compile, and you're done. Credits go to: Thehispanic/Gangstamikey, DellKid/Bankhead.


14 years, 13 weeks ago
Post #32509 Re: Adding Wiseman to your server(Release)

thats realy good but i got this error


||=== eoserv, MYSQL+SQLITE ===|
 at config\i386\host-mingw32.c|167|MapViewOfFileEx: Attempt to access invalid address. |
||=== Build finished: 1 errors, 0 warnings ===|

14 years, 13 weeks ago
Post #32511 Re: Adding Wiseman to your server(Release)

i'm really excited to see this work, but i also get errors:

C:\server\trunk\src\handlers\Quest.cpp|17|error: 'PACKET_QUEST_DIALOG' was not declared in this scope|

C:\server\trunk\src\handlers\Quest.cpp|52|error: 'PACKET_QUEST_DIALOG' was not declared in this scope|


---
class EOSERV {
Programmer | Oldbie
Open source EO Client: https://github.com/ethanmoffat/EndlessClient
};
14 years, 13 weeks ago
Post #32513 Re: Adding Wiseman to your server(Release)

Ahh, I forgot to add those. I'll edit this post within a few minutes with those.


EDIT: Added.

14 years, 13 weeks ago
Post #32515 Re: Adding Wiseman to your server(Release)

wow, this is an amazing release! Thank you SO much. No more need for glitchy class command! thanks for the quick reply too.

---
class EOSERV {
Programmer | Oldbie
Open source EO Client: https://github.com/ethanmoffat/EndlessClient
};
14 years, 13 weeks ago
Post #32518 Re: Adding Wiseman to your server(Release)

Let me give everyone a good piece of advice. Check Sausage's pastebin at
https://tehsausage.com/paste/!more for a good deal of posted coding for eoserv among other things. I put a default wise man code in there last week, and this is pretty much the same code. A couple of things to be noted about this wise man are all npc's with the quest tag will act as a wise man and character->Save() can be omitted. EOServ saves on crashes.

14 years, 13 weeks ago
Post #32519 Re: Adding Wiseman to your server(Release)

I know this Apollo, I have done Quests but I removed all that because I'm not going to release that just yet.


EDIT: If it really matters that much, you can put an if(this->player->character->mapid == 5) around the codes, but I didn't see a point in it because EOSERV doesn't have quests.

14 years, 13 weeks ago
Post #32527 Re: Adding Wiseman to your server(Release)

Adding map = 5 doesn't secure the quest npc. In the case of the pirate quest and monkey island quests you will find that there are cases that in fact 2 quest npc's can occupy the same map. The proper would be npc type/npc vendor id. At the very least, the npc id would work but never the map id. That would assume the wise man must be located only on map 5 to work properly. A server operator may want to put a wise man in every town.

14 years, 13 weeks ago
Post #32528 Re: Adding Wiseman to your server(Release)

Compiled just fine, couple of issues though:

-After you choose a class, you can't attack until your stats update correctly (e.g. adding a skill point).

-And I tried adding in 2 more classes, as I use 8 classes in total, but the best I could get was either unclickable classes, or an empty class fiels when i did get them clicking.


---
Web developer, currently looking for graphic artists / designers.
14 years, 13 weeks ago
Post #32538 Re: Adding Wiseman to your server(Release)
Klutz posted: (14th Feb 2010 02:37 am)

Compiled just fine, couple of issues though:

-After you choose a class, you can't attack until your stats update correctly (e.g. adding a skill point).

-And I tried adding in 2 more classes, as I use 8 classes in total, but the best I could get was either unclickable classes, or an empty class fiels when i did get them clicking.



A stat update can easily be done by using the Character::StatSkill feature that I have in my source, and by association, your source as well.

If anyone needs it, it was posted on the forum here a long time ago. It shouldnt be too hard to find. Just put at the end of the packet,
this->player->character->StatSkill;
And it should fix that little inconvenience.

---
May he now rest under aegis of mirage -
As the sands slowly turn to Elysian fields
14 years, 13 weeks ago
Post #32541 Re: Adding Wiseman to your server(Release)

One thing I didn't understand. What does the "if(data1);" do? I don't see anything happening with the if statement. And it'd be cooler to have appropiate names for the data :p

---
http://www.addipop.com
14 years, 13 weeks ago
Post #32542 Re: Adding Wiseman to your server(Release)

It is copied code, you will know what those numbers are if you read them. I wonder if they do :P

@Syran, statskill isn't needed here, this is a slightly different packet build in that it also refreshes class as well as stats. No relogs needed for stat restricted items. :P

14 years, 13 weeks ago
Post #32642 Re: Adding Wiseman to your server(Release)

It's not copied code, I'll eventually prove this when I release Quests. the if(data1-6); is to get rid of warnings as I haven't messed with them enough to find out what they really are, So far the only 2 used are; data1 and data6. data1 = 4 when you accept a link from a dialog, and data6 is the selection chosen(addshort(2); addshort(2); "Make me a priest" = 2. addshort(2); addshort(3); = 3, and so on..)

14 years, 12 weeks ago
Post #32653 Re: Adding Wiseman to your server(Release)

I think Addison's reference was to the first set of data that was read but unused. There are 3 readers that have no apparent use in the function of the code. I believe his questioning was intended to be why are you leaving useless lines of unused readers that you may have used in debugging in a "release" code? This wise man script has actually been around for quite a while, this is just the only time it has actually included the proper builder for class refreshing.

14 years, 12 weeks ago
Post #32697 Re: Adding Wiseman to your server(Release)

Nice, same code Bankhead gave me. :D

14 years, 12 weeks ago
Page: << 1 2 >>
Topic is locked.
EOSERV Forum > EOSERV > Adding Wiseman to your server(Release)