EOSERV Forum > EOSERV > insoms rev
Topic is locked.
Page: << 1 2 ... 4 5 6 7 8 ... 14 15 >>
insoms rev
Author Message
Post #71085 Re: insoms rev
Whitewolf posted: (30th Mar 2011 03:16 am)

Awesome, got everything working the way I want except I don't understand how the pets work. How exactly do people get a pet?

Look through Item.cpp and character logout function and remove the gained stats.
Theres 2 ways easiest is like this in Item.cpp


                if(id == 701)
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}

  this->player->character->pet = new NPC(this->player->character->map, 359, this->player->character->x,this->player->character->y, 1, 1, index, true, true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
                 this->player->character->CalculateStats();

                this->player->character->StatSkill();
this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}


or you can create a config file and add this in Item.cpp

 for(int i = 0 ; i < static_cast<int>(this->server->world->pet_config["Amount"]) ; i++)
                {
                    if(id == static_cast<int>(this->server->world->pet_config[util::to_string(i+1) + ".Item_ID"]))

                    {
                     this->player->character->AddItem(id, 1);//adds back the item after it's use
                     this->player->character->Save();
                            unsigned char index = this->player->character->map->GenerateNPCIndex();

                            if(1 == static_cast<int>(this->server->world->pet_config["Allow_Multiple_pets"]))
                            {
                            this->player->character->pet = newNPC(this->player->character->map,static_cast<int>(this->server->world->pet_config[util::to_string(i+1) + ".NPC_ID"]), this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);
                            this->player->character->pet->Spawn();
                            this->player->character->pet->SetOwner(this->player->character);
                            this->player->character->has_pet = true;
                            //this->player->character->AddItem(682, 1);
                            this->player->character->map->npcs.push_back(this->player->character->pet);
                            }
                            else if (!this->player->character->has_pet)
                            {
                            this->player->character->pet = newNPC(this->player->character->map,static_cast<int>(this->server->world->pet_config[util::to_string(i+1) + ".NPC_ID"]), this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);
                            this->player->character->pet->Spawn();
                            this->player->character->pet->SetOwner(this->player->character);
                            this->player->character->has_pet = true;
                            //this->player->character->AddItem(682, 1);
                            this->player->character->map->npcs.push_back(this->player->character->pet);
                            }
                            else if(this->player->character->has_pet == true)
                            {
                      UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
                          {
                      if (this->player->character->InRange(*character))
                      {
                     this->player->character->pet->RemoveFromView(*character);
                          }
                      }
                    erase_first(this->player->character->map->npcs, this->player->character->pet);
                      this->player->character->pet->Release();
                     this->player->character->has_pet = false;

                    }
                 this->player->character->Save();
                 }
             }

14 years, 5 weeks ago
Post #71087 Re: insoms rev

Alright I'd rather go with the config part makes it more simple in the long run. Could you give an example of a config file for that? Also what are a list of commands for admin/players, I go into the admin.ini and none of the commands work on either admin level. 0-5. Lemme know, thanks!

14 years, 5 weeks ago
Post #71089 Re: insoms rev
Whitewolf posted: (30th Mar 2011 04:23 am)

Alright I'd rather go with the config part makes it more simple in the long run. Could you give an example of a config file for that? Also what are a list of commands for admin/players, I go into the admin.ini and none of the commands work on either admin level. 0-5. Lemme know, thanks!


Ok the admin $ had a flood rate of like 1 command per minute so I changed it to #.
Remember all pets have to be set to unknown3 or eosep pet 3 in the pub to work correctly, and there should be no unknown3's running wild.
ok world.cpp in the world::world function add

this->pet_config.Read(this->config["PetFile"]);
then in void world::rehash add
this->pet_config.Read(this->config["PetFile"]);
In world.hpp add
Config pet_config;
In your config.ini and local.ini add
## PetFile (string)
# Pet spawn data
PetFile = ./data/pet.ini
then in your data folder add pet.ini  with this format
Allow_Multiple_pets = 0
##this pet system wasnt designed for multiple pets test if you want, Insomniac
Amount = 2

1.Item_ID = 3
1.NPC_ID = 256

2.Item_ID = 4
2.NPC_ID = 5





14 years, 5 weeks ago
Post #71091 Re: insoms rev

Insomniac, I'm downloading the new download now. :D (Downloaded)

It says this????

--- 03/30/11 16:10:12 ---


[ERR] Database_OpenFailed: No database selected



14 years, 5 weeks ago
Post #71093 Re: insoms rev

Alright obviously I put this in the wrong place.



/* $Id: world.hpp 186 2010-02-06 00:06:47Z sausage $
 * EOSERV is released under the zlib license.
 * See LICENSE.txt for more info.
 */

#ifndef FWD_WORLD_HPP_INCLUDED
#define FWD_WORLD_HPP_INCLUDED

class World;

struct Board;
struct Board_Post;
struct Home;

Config pet_config;

#endif // FWD_WORLD_HPP_INCLUDED


C:\Users\xxxxx\Desktop\trunk\src\fwd\world.hpp|11|error: aggregate 'Config pet_config' has incomplete type and cannot be defined|

So I'm getting an error for that. My first guess of why it's not working is because I didn't put it under class World; so I'm gonna try that. And there will be another error for the for(int i = 0 ; i <static_cast<int>(this->server->world->pet_config["Amount"]) ; i++) part because I don't think I placed this in the correct area.

14 years, 5 weeks ago
Post #71094 Re: insoms rev

Guys, I really need help here ):

14 years, 5 weeks ago
Post #71095 Re: insoms rev
vixen posted: (30th Mar 2011 05:18 am)

Guys, I really need help here ):


Did you use heidisql or sqlyog to restore the database dump and do you have MYSQL5.0 or better??
14 years, 5 weeks ago
Post #71096 Re: insoms rev
vixen posted: (30th Mar 2011 05:18 am)

Guys, I really need help here ):


Config.ini, did you define the right database, the one you're using?
---
"Pineapples and shit."
14 years, 5 weeks ago
Post #71099 Re: insoms rev

What do you mean, Ananas?

14 years, 5 weeks ago
Post #71100 Re: insoms rev
vixen posted: (30th Mar 2011 05:41 am)

What do you mean, Ananas?


Ok.. I'll try to explain the database thing..

Download and install mysql if you haven't already.
http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.56-win32.msi/from/http://mysql.he.net/

Just keep clicking next til you get to this part of installing it.

Make the password something you can remember, for example... 12341234
If you use that password make sure you don't have Enable root access from remote machines checked.

Now that you've done that. Download and install these..
http://www.vbgore.com/downloads/odbc351.msi
http://www.vbgore.com/downloads/sqlyog603.exe

Once you've installed both of those. Make sure this part of your config looks like this..
### DATABASE ###

## DBType (string)
# Database type (mysql or sqlite)
DBType = mysql

## DBHost (string)
# MySQL hostname / SQLite filename
DBHost = 127.0.0.1

## DBUser (string)
# Database username (MySQL only)
DBUser = root

## DBPass (string)
# Database password (MySQL only)
DBPass = 12341234

## DBName (string)
# Database name (MySQL only)
DBName = twat

## DBPort (number)
# Database port (MySQL only)
# Leave at 0 to use the library default
DBPort = 0

Now open SQLyog and click New Connection.
Name the connection 127.0.0.1
and put in the password 12341234 then click connect.

Right mouse click on the blank white open area on the left side and a menu will pop up.
Choose Restore from SQL Dump...
Then browse for the insoms.sql file inside the TRUNK folder.
Then click execute. Once It's done click OK then close and re-open SQLyog.
Now click the Connect button and on the left side you'll see the database table called Twat.
Open it up by double clicking it. Then open up accounts by double clicking it.
Then select where it says 3 Table Data on the bottom panel of the window.
Select all information in there and press the delete button that looks like a window with a red x on it then click SAVE.
Do the same thing for the information in the characters, guilds and bans areas. Once you've done this you can close SQLyog, now start up your server create your account. Close your client, open back up SQLyog, go into the character areas and set your admin level to 5 and click save. Now you'll have full access to the server and the features that are usable without having some knowledge on how to run a server. :P Also make sure your port 8078 is forwarded other wise this whole thing was pointless.
14 years, 5 weeks ago
Post #71138 Re: insoms rev
Whitewolf posted: (30th Mar 2011 05:17 am)

Alright obviously I put this in the wrong place.



/* $Id: world.hpp 186 2010-02-06 00:06:47Z sausage $
 * EOSERV is released under the zlib license.
 * See LICENSE.txt for more info.
 */

#ifndef FWD_WORLD_HPP_INCLUDED
#define FWD_WORLD_HPP_INCLUDED

class World;

struct Board;
struct Board_Post;
struct Home;

Config pet_config;

#endif // FWD_WORLD_HPP_INCLUDED


C:\Users\xxxxx\Desktop\trunk\src\fwd\world.hpp|11|error: aggregate 'Config pet_config' has incomplete type and cannot be defined|

So I'm getting an error for that. My first guess of why it's not working is because I didn't put it under class World; so I'm gonna try that. And there will be another error for the for(int i = 0 ; i<static_cast<int>(this->server->world->pet_config["Amount"]) ; i++) part because I don't think I placed this in the correct area.

this  Config pet_config; goes under Config home_config; in world.hpp and

for(int i = 0 ; i<static_cast<int>(this->server->world->pet_config["Amount"]) ; i++) starts the code in Item.cpp


14 years, 5 weeks ago
Post #71206 Re: insoms rev

Ok, got the config part, but I can't compile because of this.

C:\Users\xxxxxx\Desktop\trunk\src\handlers\Item.cpp|2562|error: expected unqualified-id before 'for'|

C:\Users\xxxxxx\Desktop\trunk\src\handlers\Item.cpp|2562|error: expected constructor, destructor, or type conversion before '<' token|

C:\Users\xxxxxx\Desktop\trunk\src\handlers\Item.cpp|2562|error: expected constructor, destructor, or type conversion before '++' token|


I get these errors after adding. Should I have placed the code somewhere specific? Because I just placed it at the bottom.


Edit: Sorry I missed your messages man. I was passed out lol. Yeah I got everything running good. Just gotta get the pet thing going an make a fishing map and a few other things. I leave myself on the server while I'm sleeping so It doesn't go on the empty list on SLN.

14 years, 5 weeks ago
Post #71226 Re: insoms rev
Whitewolf posted: (30th Mar 2011 06:01 am)

vixen posted: (30th Mar 2011 05:41 am)

What do you mean, Ananas?


Ok.. I'll try to explain the database thing..

Download and install mysql if you haven't already.
http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.56-win32.msi/from/http://mysql.he.net/

Just keep clicking next til you get to this part of installing it.

Make the password something you can remember, for example... 12341234
If you use that password make sure you don't have Enable root access from remote machines checked.

Now that you've done that. Download and install these..
http://www.vbgore.com/downloads/odbc351.msi
http://www.vbgore.com/downloads/sqlyog603.exe

Once you've installed both of those. Make sure this part of your config looks like this..
### DATABASE ###

## DBType (string)
# Database type (mysql or sqlite)
DBType = mysql

## DBHost (string)
# MySQL hostname / SQLite filename
DBHost = 127.0.0.1

## DBUser (string)
# Database username (MySQL only)
DBUser = root

## DBPass (string)
# Database password (MySQL only)
DBPass = 12341234

## DBName (string)
# Database name (MySQL only)
DBName = twat

## DBPort (number)
# Database port (MySQL only)
# Leave at 0 to use the library default
DBPort = 0

Now open SQLyog and click New Connection.
Name the connection 127.0.0.1
and put in the password 12341234 then click connect.

Right mouse click on the blank white open area on the left side and a menu will pop up.
Choose Restore from SQL Dump...
Then browse for the insoms.sql file inside the TRUNK folder.
Then click execute. Once It's done click OK then close and re-open SQLyog.
Now click the Connect button and on the left side you'll see the database table called Twat.
Open it up by double clicking it. Then open up accounts by double clicking it.
Then select where it says 3 Table Data on the bottom panel of the window.
Select all information in there and press the delete button that looks like a window with a red x on it then click SAVE.
Do the same thing for the information in the characters, guilds and bans areas. Once you've done this you can close SQLyog, now start up your server create your account. Close your client, open back up SQLyog, go into the character areas and set your admin level to 5 and click save. Now you'll havefull access to the server and the features that are usable without having some knowledge on how to run a server. :P Also make sure your port 8078 is forwarded other wise this whole thing was pointless.

I didn't get that part, with the password bit..
14 years, 5 weeks ago
Post #71257 Re: insoms rev
vixen posted: (30th Mar 2011 07:44 pm)

Whitewolf posted: (30th Mar 2011 06:01 am)

vixen posted: (30th Mar 2011 05:41 am)

What do you mean, Ananas?


Ok.. I'll try to explain the database thing..

Download and install mysql if you haven't already.
http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.56-win32.msi/from/http://mysql.he.net/

Just keep clicking next til you get to this part of installing it.

Make the password something you can remember, for example... 12341234
If you use that password make sure you don't have Enable root access from remote machines checked.

Now that you've done that. Download and install these..
http://www.vbgore.com/downloads/odbc351.msi
http://www.vbgore.com/downloads/sqlyog603.exe

Once you've installed both of those. Make sure this part of your config looks like this..
### DATABASE ###

## DBType (string)
# Database type (mysql or sqlite)
DBType = mysql

## DBHost (string)
# MySQL hostname / SQLite filename
DBHost = 127.0.0.1

## DBUser (string)
# Database username (MySQL only)
DBUser = root

## DBPass (string)
# Database password (MySQL only)
DBPass = 12341234

## DBName (string)
# Database name (MySQL only)
DBName = twat

## DBPort (number)
# Database port (MySQL only)
# Leave at 0 to use the library default
DBPort = 0

Now open SQLyog and click New Connection.
Name the connection 127.0.0.1
and put in the password 12341234 then click connect.

Right mouse click on the blank white open area on the left side and a menu will pop up.
Choose Restore from SQL Dump...
Then browse for the insoms.sql file inside the TRUNK folder.
Then click execute. Once It's done click OK then close and re-open SQLyog.
Now click the Connect button and on the left side you'll see the database table called Twat.
Open it up by double clicking it. Then open up accounts by double clicking it.
Then select where it says 3 Table Data on the bottom panel of the window.
Select all information in there and press the delete button that looks like a window with a red x on it then click SAVE.
Do the same thing for the information in the characters, guilds and bans areas. Once you've done this you can close SQLyog, now start up your server create your account. Close your client, open back up SQLyog, go into the character areas and set your admin level to 5 and click save. Nowyou'llhavefull access to the server and the features that are usable without having some knowledge on how to run a server. :P Also make sure your port 8078 is forwarded other wise this whole thing was pointless.

I didn't get that part, with the password bit..
@ whitewolve post your Item.cpp if its not fixed.
@ vixen I think what hes sayin is when you set up mysql remember the password you used there because you will use it in the config.ini and heidsql or other database that you use.

14 years, 5 weeks ago
Post #71274 Re: insoms rev



/* $Id: Item.cpp 186 2010-02-06 00:06:47Z sausage $
 * EOSERV is released under the zlib license.
 * See LICENSE.txt for more info.
 */

#include "handlers.h"

#include "npc.hpp"
#include "eodata.hpp"
#include "map.hpp"
#include "party.hpp"

CLIENT_F_FUNC(Item)
{
    PacketBuilder reply;

    switch (action)
    {
        case PACKET_USE: // Player using an item
        {
            if (this->state < EOClient::PlayingModal) return false;
            CLIENT_QUEUE_ACTION(0.0)


            int id = reader.GetShort();

            if (this->player->character->HasItem(id))
            {
                EIF_Data *item = this->server->world->eif->Get(id);
                reply.SetID(PACKET_ITEM, PACKET_REPLY);
                reply.AddChar(item->type);
                reply.AddShort(id);

                if(id == 701)
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}

  this->player->character->pet = new NPC(this->player->character->map, 359, this->player->character->x,this->player->character->y, 1, 1, index, true, true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->str += 5000;
this->player->character->con += 5000;
                 this->player->character->CalculateStats();

                this->player->character->StatSkill();
this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->con -= 5000;
this->player->character->str -= 5000;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}

                if(id == 9)
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}
                                                                  //npcid was 345
  this->player->character->pet = new NPC(this->player->character->map, 345, this->player->character->x,this->player->character->y, 1, 1, index, true, true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->str += 500;
this->player->character->con += 500;
                 this->player->character->CalculateStats();

                this->player->character->StatSkill();
this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->con -= 500;
this->player->character->str -= 500;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}

                                if(id == 10)
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}

  this->player->character->pet = new NPC(this->player->character->map, 344, this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->str += 500;
               this->player->character->wis += 500;
               this->player->character->agi += 500;
               this->player->character->con += 500;
                this->player->character->CalculateStats();

                this->player->character->StatSkill();
this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->str -= 500;
               this->player->character->wis -= 500;
               this->player->character->agi -= 500;
               this->player->character->con -= 500;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}

                if(id == 376)
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}

  this->player->character->pet = new NPC(this->player->character->map, 346, this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->con += 300;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();

this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->con -= 300;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}

                if(id == 17)
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}

  this->player->character->pet = new NPC(this->player->character->map, 347, this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->wis += 400;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();

this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->wis -= 400;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}

                if(id == 16)
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}

  this->player->character->pet = new NPC(this->player->character->map, 348, this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->str += 80;
              this->player->character->wis += 80;
                this->player->character->con += 80;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();

this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->str -= 80;
              this->player->character->wis -= 80;
                this->player->character->con -= 80;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}

                if(id == 3)
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}

  this->player->character->pet = new NPC(this->player->character->map, 349, this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->str += 40;
              this->player->character->wis += 40;
                this->player->character->con += 40;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();

this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->str -= 40;
              this->player->character->wis -= 40;
                this->player->character->con -= 40;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}

                if(id == 15)
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}

  this->player->character->pet = new NPC(this->player->character->map, 350, this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->str += 300;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();

this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->str -= 300;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}

if(id == 563) //pk fire//is 563 id
{
PacketBuilder builder;

    UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
    {

if(this->player->character->has_pet)
{
if(this->player->character->map->pk == true)
{

       Character *character_ptr = *character;
                character_ptr->AddRef();

        int distance = util::path_length(character_ptr->x, character_ptr->y, this->player->character->x, this->player->character->y);

if (distance >0 && distance <13)
    {
                Character *character_ptr = *character;
                character_ptr->AddRef();
                int amount = util::rand(this->player->character->pet->Data()->mindam, this->player->character->pet->Data()->maxdam +static_cast<int>(this->server->world->config["NPCAdjustMaxDam"]));

                int limitamount = std::min(amount, int(character_ptr->hp));

                if (static_cast<int>(this->server->world->config["LimitDamage"]))
                {
                    amount = limitamount;
                }

                if (character_ptr->invincible == false)
                {
                    character_ptr->hp -= limitamount;

                    builder.SetID(PACKET_CLOTHES, PACKET_ADMIN);
                    builder.AddShort(this->player->character->player->id);
                    builder.AddShort(character_ptr->player->id);
                    builder.AddThree(amount);
                    builder.AddChar(this->player->character->direction);
                    builder.AddChar(int(double(character_ptr->hp) / double(character_ptr->maxhp) * 100.0));
                    builder.AddChar(character_ptr->hp == 0);
                    builder.AddShort(17);

                    UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, checkchar)
                    {
                        if (character_ptr->InRange(*checkchar))
                        {
                            checkchar->player->client->SendBuilder(builder);
                        }
                    }
                }

                if (character_ptr->hp == 0)
                {

                  std::string msg(character_ptr->name + " got KnocKed tHE FuK ouT By ");
msg += this->player->character->pet->owner->name;
this->server->world->ServerMsg(msg);

int item = 1;
int amount = 2000;
if (this->player->character->pet->owner->AddItem(item, amount))
            {
    PacketBuilder builder(PACKET_ITEM, PACKET_GET);
    builder.AddShort(0); // UID
    builder.AddShort(item);
    builder.AddThree(amount);
    builder.AddChar(this->player->character->pet->owner->weight);
    builder.AddChar(this->player->character->pet->owner->maxweight);
    this->player->character->pet->owner->player->client->SendBuilder(builder);
            }

bool stats_updated = false;
this->player->character->pet->owner->exp += 1000;
stats_updated = true;
if (stats_updated)
    {
 bool level_up = false;
 while (this->player->character->pet->owner->level < static_cast<int>(this->server->world->config["MaxLevel"]) && this->player->character->pet->owner->exp >=this->server->world->exp_table[this->player->character->pet->owner->level+1])
        {
    level_up = true;
    ++this->player->character->pet->owner->level;
    this->player->character->pet->owner->statpoints += static_cast<int>(this->server->world->config["StatPerLevel"]);
    this->player->character->pet->owner->skillpoints += static_cast<int>(this->server->world->config["SkillPerLevel"]);
   this->player->character->pet->owner->CalculateStats();
        }

    PacketBuilder builder(PACKET_RECOVER, PACKET_REPLY);
    builder.AddInt(this->player->character->pet->owner->exp);
    builder.AddShort(this->player->character->pet->owner->karma);
    builder.AddChar(level_up ? this->player->character->pet->owner->level : 0);
    this->player->character->pet->owner->player->client->SendBuilder(builder);
    }


                    character_ptr->hp = int(character_ptr->maxhp * static_cast<double>(this->server->world->config["DeathRecover"]) / 100.0);

                    if (this->server->world->config["Deadly"])
                    {
                        character_ptr->DropAll(this->player->character);
                    }
 character_ptr->PetTransfer();
                    character_ptr->map->Leave(character_ptr, WARP_ANIMATION_NONE, true);

                    character_ptr->nowhere = true;
                    character_ptr->map = this->server->world->GetMap(character_ptr->SpawnMap());
                    character_ptr->mapid = character_ptr->SpawnMap();
                    character_ptr->x = character_ptr->SpawnX();
                    character_ptr->y = character_ptr->SpawnY();
 character_ptr->PetTransfer();
                    PacketReader reader("");

                    character_ptr->player->client->queue.AddAction(PACKET_INTERNAL, PACKET_INTERNAL_NULL, reader, 1.5);
                    character_ptr->player->client->queue.AddAction(PACKET_INTERNAL, PACKET_INTERNAL_WARP, reader, 0.0);
                }

                builder.Reset();
                builder.SetID(PACKET_RECOVER, PACKET_PLAYER);
                builder.AddShort(character_ptr->hp);
                builder.AddShort(character_ptr->tp);
                character_ptr->player->client->SendBuilder(builder);

                character_ptr->Release();

                return true;
        }

    }
}
    }
return false;
}

if(id == 638) //pk X Ray
{
 PacketBuilder builder;

    UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
    {
if(this->player->character->has_pet)
{
if(this->player->character->map->pk == true)
{
       Character *character_ptr = *character;
                character_ptr->AddRef();

        int distance = util::path_length(character_ptr->x, character_ptr->y, this->player->character->x, this->player->character->y);

if (distance >0 && distance <13)
    {
                Character *character_ptr = *character;
                character_ptr->AddRef();

                int amount = util::rand(this->player->character->pet->Data()->mindam, this->player->character->pet->Data()->maxdam +static_cast<int>(this->server->world->config["NPCAdjustMaxDam"]));

                int limitamount = std::min(amount, int(character_ptr->hp));

                if (static_cast<int>(this->server->world->config["LimitDamage"]))
                {
                    amount = limitamount;
                }

                if (character_ptr->invincible == false)
                {
                    character_ptr->hp -= limitamount;

                    builder.SetID(PACKET_CLOTHES, PACKET_ADMIN);
                    builder.AddShort(this->player->character->player->id);
                    builder.AddShort(character_ptr->player->id);
                    builder.AddThree(amount);
                    builder.AddChar(this->player->character->direction);
                    builder.AddChar(int(double(character_ptr->hp) / double(character_ptr->maxhp) * 100.0));
                    builder.AddChar(character_ptr->hp == 0);
                    builder.AddShort(37);

                    UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, checkchar)
                    {
                        if (character_ptr->InRange(*checkchar))
                        {
                            checkchar->player->client->SendBuilder(builder);
                        }
                    }
                }

                if (character_ptr->hp == 0)
                {

            std::string msg(character_ptr->name + " got KnocKed tHE FuK ouT By ");
msg += this->player->character->pet->owner->name;
this->server->world->ServerMsg(msg);

int item = 1;
int amount = 2000;
if (this->player->character->pet->owner->AddItem(item, amount))
            {
    PacketBuilder builder(PACKET_ITEM, PACKET_GET);
    builder.AddShort(0); // UID
    builder.AddShort(item);
    builder.AddThree(amount);
    builder.AddChar(this->player->character->pet->owner->weight);
    builder.AddChar(this->player->character->pet->owner->maxweight);
    this->player->character->pet->owner->player->client->SendBuilder(builder);
            }

bool stats_updated = false;
this->player->character->pet->owner->exp += 1000;
stats_updated = true;
if (stats_updated)
    {
 bool level_up = false;
 while (this->player->character->pet->owner->level < static_cast<int>(this->server->world->config["MaxLevel"]) && this->player->character->pet->owner->exp >=this->server->world->exp_table[this->player->character->pet->owner->level+1])
        {
    level_up = true;
    ++this->player->character->pet->owner->level;
    this->player->character->pet->owner->statpoints += static_cast<int>(this->server->world->config["StatPerLevel"]);
    this->player->character->pet->owner->skillpoints += static_cast<int>(this->server->world->config["SkillPerLevel"]);
   this->player->character->pet->owner->CalculateStats();
        }

    PacketBuilder builder(PACKET_RECOVER, PACKET_REPLY);
    builder.AddInt(this->player->character->pet->owner->exp);
    builder.AddShort(this->player->character->pet->owner->karma);
    builder.AddChar(level_up ? this->player->character->pet->owner->level : 0);
    this->player->character->pet->owner->player->client->SendBuilder(builder);
    }


                    character_ptr->hp = int(character_ptr->maxhp * static_cast<double>(this->server->world->config["DeathRecover"]) / 100.0);

                    if (this->server->world->config["Deadly"])
                    {
                        character_ptr->DropAll(this->player->character);
                    }
 character_ptr->PetTransfer();
                    character_ptr->map->Leave(character_ptr, WARP_ANIMATION_NONE, true);

                    character_ptr->nowhere = true;
                    character_ptr->map = this->server->world->GetMap(character_ptr->SpawnMap());
                    character_ptr->mapid = character_ptr->SpawnMap();
                    character_ptr->x = character_ptr->SpawnX();
                    character_ptr->y = character_ptr->SpawnY();
 character_ptr->PetTransfer();
                    PacketReader reader("");

                    character_ptr->player->client->queue.AddAction(PACKET_INTERNAL, PACKET_INTERNAL_NULL, reader, 1.5);
                    character_ptr->player->client->queue.AddAction(PACKET_INTERNAL, PACKET_INTERNAL_WARP, reader, 0.0);
                }

                builder.Reset();
                builder.SetID(PACKET_RECOVER, PACKET_PLAYER);
                builder.AddShort(character_ptr->hp);
                builder.AddShort(character_ptr->tp);
                character_ptr->player->client->SendBuilder(builder);

                character_ptr->Release();

                return true;
        }
    }
}
    }
return false;

}

if(id == 639) //Green Flame
{
 PacketBuilder builder;

    UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
    {
if(this->player->character->has_pet)
{
if(this->player->character->map->pk == true)
{
       Character *character_ptr = *character;
                character_ptr->AddRef();

        int distance = util::path_length(character_ptr->x, character_ptr->y, this->player->character->x, this->player->character->y);

if (distance >0 && distance <13)
    {
                Character *character_ptr = *character;
                character_ptr->AddRef();

                int amount = util::rand(this->player->character->pet->Data()->mindam, this->player->character->pet->Data()->maxdam +static_cast<int>(this->server->world->config["NPCAdjustMaxDam"]));

                int limitamount = std::min(amount, int(character_ptr->hp));

                if (static_cast<int>(this->server->world->config["LimitDamage"]))
                {
                    amount = limitamount;
                }

                if (character_ptr->invincible == false)
                {
                    character_ptr->hp -= limitamount;

                    builder.SetID(PACKET_CLOTHES, PACKET_ADMIN);
                    builder.AddShort(this->player->character->player->id);
                    builder.AddShort(character_ptr->player->id);
                    builder.AddThree(amount);
                    builder.AddChar(this->player->character->direction);
                    builder.AddChar(int(double(character_ptr->hp) / double(character_ptr->maxhp) * 100.0));
                    builder.AddChar(character_ptr->hp == 0);
                    builder.AddShort(31);

                    UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, checkchar)
                    {
                        if (character_ptr->InRange(*checkchar))
                        {
                            checkchar->player->client->SendBuilder(builder);
                        }
                    }
                }

                if (character_ptr->hp == 0)
                {

                                  std::string msg(character_ptr->name + " got KnocKed tHE FuK ouT By ");
msg += this->player->character->pet->owner->name;
this->server->world->ServerMsg(msg);

int item = 1;
int amount = 2000;
if (this->player->character->pet->owner->AddItem(item, amount))
            {
    PacketBuilder builder(PACKET_ITEM, PACKET_GET);
    builder.AddShort(0); // UID
    builder.AddShort(item);
    builder.AddThree(amount);
    builder.AddChar(this->player->character->pet->owner->weight);
    builder.AddChar(this->player->character->pet->owner->maxweight);
    this->player->character->pet->owner->player->client->SendBuilder(builder);
            }

bool stats_updated = false;
this->player->character->pet->owner->exp += 1000;
stats_updated = true;
if (stats_updated)
    {
 bool level_up = false;
 while (this->player->character->pet->owner->level < static_cast<int>(this->server->world->config["MaxLevel"]) && this->player->character->pet->owner->exp >=this->server->world->exp_table[this->player->character->pet->owner->level+1])
        {
    level_up = true;
    ++this->player->character->pet->owner->level;
    this->player->character->pet->owner->statpoints += static_cast<int>(this->server->world->config["StatPerLevel"]);
    this->player->character->pet->owner->skillpoints += static_cast<int>(this->server->world->config["SkillPerLevel"]);
   this->player->character->pet->owner->CalculateStats();
        }

    PacketBuilder builder(PACKET_RECOVER, PACKET_REPLY);
    builder.AddInt(this->player->character->pet->owner->exp);
    builder.AddShort(this->player->character->pet->owner->karma);
    builder.AddChar(level_up ? this->player->character->pet->owner->level : 0);
    this->player->character->pet->owner->player->client->SendBuilder(builder);
    }


                    character_ptr->hp = int(character_ptr->maxhp * static_cast<double>(this->server->world->config["DeathRecover"]) / 100.0);

                    if (this->server->world->config["Deadly"])
                    {
                        character_ptr->DropAll(this->player->character);
                    }
 character_ptr->PetTransfer();
                    character_ptr->map->Leave(character_ptr, WARP_ANIMATION_NONE, true);

                    character_ptr->nowhere = true;
                    character_ptr->map = this->server->world->GetMap(character_ptr->SpawnMap());
                    character_ptr->mapid = character_ptr->SpawnMap();
                    character_ptr->x = character_ptr->SpawnX();
                    character_ptr->y = character_ptr->SpawnY();
 character_ptr->PetTransfer();
                    PacketReader reader("");

                    character_ptr->player->client->queue.AddAction(PACKET_INTERNAL, PACKET_INTERNAL_NULL, reader, 1.5);
                    character_ptr->player->client->queue.AddAction(PACKET_INTERNAL, PACKET_INTERNAL_WARP, reader, 0.0);
                }

                builder.Reset();
                builder.SetID(PACKET_RECOVER, PACKET_PLAYER);
                builder.AddShort(character_ptr->hp);
                builder.AddShort(character_ptr->tp);
                character_ptr->player->client->SendBuilder(builder);

                character_ptr->Release();

                return true;
        }
    }
}
    }
return false;

}

if(id == 640) //pk Energy Ball
{
 PacketBuilder builder;

    UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
    {
if(this->player->character->has_pet)
{
if(this->player->character->map->pk == true)
{
       Character *character_ptr = *character;
                character_ptr->AddRef();

        int distance = util::path_length(character_ptr->x, character_ptr->y, this->player->character->x, this->player->character->y);

if (distance >0 && distance <13)
    {
                Character *character_ptr = *character;
                character_ptr->AddRef();

                int amount = util::rand(this->player->character->pet->Data()->mindam, this->player->character->pet->Data()->maxdam +static_cast<int>(this->server->world->config["NPCAdjustMaxDam"]));

                int limitamount = std::min(amount, int(character_ptr->hp));

                if (static_cast<int>(this->server->world->config["LimitDamage"]))
                {
                    amount = limitamount;
                }

                if (character_ptr->invincible == false)
                {
                    character_ptr->hp -= limitamount;

                    builder.SetID(PACKET_CLOTHES, PACKET_ADMIN);
                    builder.AddShort(this->player->character->player->id);
                    builder.AddShort(character_ptr->player->id);
                    builder.AddThree(amount);
                    builder.AddChar(this->player->character->direction);
                    builder.AddChar(int(double(character_ptr->hp) / double(character_ptr->maxhp) * 100.0));
                    builder.AddChar(character_ptr->hp == 0);
                    builder.AddShort(15);

                    UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, checkchar)
                    {
                        if (character_ptr->InRange(*checkchar))
                        {
                            checkchar->player->client->SendBuilder(builder);
                        }
                    }
                }

                if (character_ptr->hp == 0)
                {

                                  std::string msg(character_ptr->name + " got KnocKed tHE FuK ouT By ");
msg += this->player->character->pet->owner->name;
this->server->world->ServerMsg(msg);

int item = 1;
int amount = 2000;
if (this->player->character->pet->owner->AddItem(item, amount))
            {
    PacketBuilder builder(PACKET_ITEM, PACKET_GET);
    builder.AddShort(0); // UID
    builder.AddShort(item);
    builder.AddThree(amount);
    builder.AddChar(this->player->cha

14 years, 5 weeks ago
Page: << 1 2 ... 4 5 6 7 8 ... 14 15 >>
Topic is locked.
EOSERV Forum > EOSERV > insoms rev