EOSERV Forum > EO Server Building > How to properly add new commands into EOServ Code
Page: << 1 >>
How to properly add new commands into EOServ Code
Author Message
Post #204163 How to properly add new commands into EOServ Code

So i have downloaded and have been successful in launching the "more advanced" custom EOSERV script from scratch, with my character and graphics implemented as well as my classes etc. Now i am wondering how i properly go about adding the code in for such things as:

$Immortal <victim> [NPC's do 0 damage or miss player character]

$Mortal <victim> [Player character goes back to being affected at normal rate by NPC's]

$Inventory [Essentially shows the pubs item list for easier item spawning in a separate box perhaps with just a text list that i add into it?]

$server [Speak to all players via server]

$announce [Speak to all players as your admin char via server and chat bubble overhead]


I suppose what i am really requesting is:

A) Where do i write these codes to implement them properly; i.e. in multiple .cpp/.hpp? in which case which ones should i focus my attention on.

B) What is the proper format to add and implement these codes into the servers source code; i.e. .cpp has more complex lines of code as to where .hpp appear to have less complex more designated lines of code.

C) If i were to have an inventory box pop-up would i also have to have that line Call Showbox or something? I am a NOVICE and I am not ashamed to admit that.


Thank you for all your comments and direction in advance,


Very Respectfully,

Tensuki



---
"I would rather be in the light looking up to the darkness, than being in the darkness looking up to
the light."
~Tensuki
5 years, 45 weeks ago
Post #204175 Re: How to properly add new commands into EOServ Code

Commands are in src/commands folder unless it's changed since i last messed with eoserv. You add a function to act as the command and add the handler to the command_handler_register, there should be plenty of tutorials archived for such, unless they got deleted. as for showing an inventory box for the pub files, there's a max to how much it can show, so that command would be rather hacky and pointless, however i've made such for accessing player's inventories and banks in my revision if you want to browse it's mess of a code. https://www.dropbox.com/s/x15fmpfzxha1g60/trunk%20305%20EODelta%203-3-2015.zip?dl=0

It's far from being up to date, but might be educational to browse or whatever.

5 years, 45 weeks ago
Post #204176 Re: How to properly add new commands into EOServ Code

Thank you, i will try to look into your source code and see where i may be able to implement some of these options. As well as if i can find any of the forum posts that you were talking about; perhaps, i did not look deep enough. Thank you again :)

---
"I would rather be in the light looking up to the darkness, than being in the darkness looking up to
the light."
~Tensuki
5 years, 45 weeks ago
Post #204182 Re: How to properly add new commands into EOServ Code

You can take a look at the commands in "char_mod.cpp" for an example of how to hook up the binding. This line has a solid example that is pretty close to what you're trying to do.

You'll probably also need to modify the 'character' class and NPC attack method though - you'll need to add a bool isImmortal; on the character class and then set that in the command handler. In the NPC attack method, you'll need to make sure you don't modify the character's HP if isImmortal is true.

---
class EOSERV {
Programmer | Oldbie
Open source EO Client: https://github.com/ethanmoffat/EndlessClient
};
5 years, 44 weeks ago
Post #204185 Re: How to properly add new commands into EOServ Code

Thank you for your post, i found it to be very easy to follow where to look, unfortunately for me I know that you were talking very plainly and simply so that i could grasp it all, and yet i still fall short in my knowledge of coding. My biggest fear is to start messing with things and never gt them back to the way they were and i think that hinders me in even trying to code some things out, but i also know my range of knowledge and i am not very knowledgeable in this. Still going to take what you gave me and do my best with what i have and the guides that are available.


Thank you very much again i really appreciate any and all advice :)

---
"I would rather be in the light looking up to the darkness, than being in the darkness looking up to
the light."
~Tensuki
5 years, 44 weeks ago
Post #204189 Re: How to properly add new commands into EOServ Code

Alright, in more detail, I've created a branch that does what you're looking to do on my github version. You can use the branch directly (if you want the older version of EOSERV that I forked for MSEOSERV) or you can copy/paste the code into your own branch.

Here's what I did:

  1. Add command handler (and register) in char_mod.cpp
  2. Add 'bool immortal' flag to character class
  3. Modify NPC Attack method to do 0 damage if target character is immortal
  4. Bonus modify PK damage to do 0 damage if target character is immortal

Here's the compare view of the two branches (let me know if it doesn't work): https://github.com/ethanmoffat/MSEOSERV/compare/master...ethanmoffat/immortal

---
class EOSERV {
Programmer | Oldbie
Open source EO Client: https://github.com/ethanmoffat/EndlessClient
};
5 years, 44 weeks ago
Post #204190 Re: How to properly add new commands into EOServ Code

I just have to be the first to say that THIS BY FAR, was the best way to show where the code needs to go and how to properly add and implement the code into the EOSERV system. Thank you so very much Ethan for this wonderful work that you did, you did not have to but i greatly appreciate it! And i know future server holders will as well! Thank you so much again!

---
"I would rather be in the light looking up to the darkness, than being in the darkness looking up to
the light."
~Tensuki
5 years, 44 weeks ago
Page: << 1 >>

EOSERV Forum > EO Server Building > How to properly add new commands into EOServ Code