EOSERV Forum > EOSERV > Mining with exp guide.
Topic is locked.
Page: << 1 2 >>
Mining with exp guide.
Author Message
Post #74322 Mining with exp guide.

Im sharing my mining with exp with you. I didnt make this. I just took it from addisons source but i havent seen any guide to add this. so I put it here. Let's start! Feel free to post your errorshere.Alsoififorgotsomething please post it!

How does it work?

How does this work? If you added everything correct and didnt receive any errors. You can add Unknown1 tiles on your maps. If you wear your mining weapon and hit the unknown tiles you'll get ore or not. This miningsystemdoesalsogiveyouexp to level up and you can change the exp rate, item ids and the chance in the mining.ini.

In: src\fwd\world.hpp add under:

struct Home;

this:

struct Mine_Drop;

----------------------  map.cpp  ------------------------------------------ under:

void Map::Attack(Character *from, Direction direction)

{

PacketBuilder builder;


from->direction = direction;


this:

http://pastebin.com/SR5bRnP4

under:

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;

}

add:

http://pastebin.com/yGSJjJmp

------------------------------ map.hpp -------------------------------------------

under:

bool AttackPK(Character *from, Direction direction);

this:

void Mine(Character *from);

-------------------------------------- world.cpp -------------------------------------------

under:

this->LoadHome();

this:

this->LoadMine();


Under:

if (parts[1] == "name")

{

home->name = home->name = static_cast<std::string>(hc.second);

}

else if (parts[1] == "location")

{

std::vector<std::string> locparts = util::explode(',', hc.second);

home->map = locparts.size() >= 1 ? util::to_int(locparts[0]) : 1;

home->x = locparts.size() >= 2 ? util::to_int(locparts[1]) : 0;

home->y = locparts.size() >= 3 ? util::to_int(locparts[2]) : 0;

}

}


UTIL_UNORDERED_MAP_FOREACH_ALL(temp_homes, std::string, Home *, home)

{

this->homes.push_back(home.second);

home.second->Release();

}

}

add:

http://pastebin.com/RxgppdPY

under:

this->LoadHome();

add:

this->LoadMine();

----------------------------- world.hpp ------------------------------

under:

SCRIPT_REGISTER_REF_DF(Home)

SCRIPT_REGISTER_VARIABLE("string", id);

SCRIPT_REGISTER_VARIABLE("string", name);

SCRIPT_REGISTER_VARIABLE("int16", map);

SCRIPT_REGISTER_VARIABLE("uint8", x);

SCRIPT_REGISTER_VARIABLE("uint8", y);

SCRIPT_REGISTER_VARIABLE("int", level);

SCRIPT_REGISTER_END()

};

add:

http://pastebin.com/Hh76P1m3

under:

PtrVector<Home> homes;

add:

PtrVector<Mine_Drop> mine_drops;

under:

void LoadHome();

add:

void LoadMine();

------------------------ character.cpp -------------------------

under:

Character::Character(std::string name, World *world)

{

this->world = world;

add at the other database queries:

`, `mlevel`, `mexp`, `

under:

this->exp = GetRow<int>(row, "exp");

add:

this->mlevel = GetRow<int>(row, "mlevel");

this->mexp = GetRow<int>(row, "mexp");

this->mining_exp = false;

under:

void Character::Save()

{

#ifdef DEBUG

Console::Dbg("Saving character '%s' (session lasted %i minutes)", this->name.c_str(), int(std::time(0) - this->login_time) / 60);

#endif // DEBUG


add:

, `mlevel` = #, `mexp` = #, `

next too: 

this->level, this->exp, 

add:

this->mlevel, this->mexp, 

------------------ character.hpp -----------------------

CHANGE int exp; 

to:

int exp, mexp;

add under it:

bool mining_exp;

CHANGE unsigned char level;

to:

unsigned char level, mlevel;

under:

SCRIPT_REGISTER_VARIABLE("uint8", level);

SCRIPT_REGISTER_VARIABLE("int", exp);

add:

SCRIPT_REGISTER_VARIABLE("uint8", mlevel);

SCRIPT_REGISTER_VARIABLE("int", mexp);

-------------------------------------- npc.cpp ------------------------------------------

under:

if ((sharemode == 0 && *character == from) || (sharemode != 0 && findopp))

{

builder.AddInt(character->exp);

}

this:

http://pastebin.com/c5Tngr8X

-------------------------------- map.hpp -------------------------------

Replace 

Unknown1,

with:

Mining,

replace

SCRIPT_REGISTER_ENUM_VALUE(Unknown1);

with:

SCRIPT_REGISTER_ENUM_VALUE(Mining);

under:

case Chest:

add:

case Mining:

-------------------------- world.cpp ---------------------------

under:

this->shops_config.Read(this->config["ShopsFile"]);

add:

this->mining_config.Read(this->config["MiningFile"]);

under:

this->shops_config.Read(this->config["ShopsFile"]);

add:

this->mining_config.Read(this->config["MiningFile"]);

----------------------------- world.hpp -------------------------

under:

Config drops_config;

add:

Config mining_config;

--------------------------- config.ini --------------------

under ####files##### add:

MiningFile = ./data/mining.ini

Now make a new file in data and call it: mining.ini 

and add in it:

http://pastebin.com/35vKTjuv

Extra: If you want players to check their mining exp & level add this in talk.cpp. 
#mining

else if (command.length() == 6 && command.compare(0,6,"mining") == 0)

                    {

                    this->player->character->ServerMsg("Mining Level: " + util::to_string(this->player->character->mlevel));

                    this->player->character->ServerMsg("Mining exp: "+util::to_string(this->player->character->mexp));

                    this->player->character->ServerMsg("Mining to nextlevel:"+util::to_string(this->player->character->mexp-((this->player->character->mlevel + 2)*(10 + (this->player->character->mlevel*2)))));

                    }

12 years, 51 weeks ago
Post #74328 Re: Mining with exp guide.

Nice job. Next thing to try would be using one of the 2 unknown subtypes in the pub for weapons. 

---
Love you too.
12 years, 51 weeks ago
Post #74335 Re: Mining with exp guide.
newguy posted: (18th Apr 2011 02:36 pm)

Nice job. Next thing to try would be using one of the 2 unknown subtypes in the pub for weapons. 


That would be epic ^^ But to be honnest i have no idea how (:
12 years, 51 weeks ago
Post #74336 Re: Mining with exp guide.

Oh, it is actually way easier than you think lol. I made 'two handed' weapons the other day. People can't use them with a shield. Just go to eodata.hpp find the enum where wings are, and at the end add MiningTool or w/e. Then edit the characters equip function you could make it so they couldn't equip it if the mining level wasn't high enough lol. But that is what you do for the first part. If you want to see an example of using items go to my new boost item releases, it reads from pubs.

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


Just go to the pastebin links to see the actual code with the items in it. That should show the functions you need to get started.

---
Love you too.
12 years, 51 weeks ago
Post #74343 Re: Mining with exp guide.
newguy posted: (18th Apr 2011 02:55 pm)

Oh, it is actually way easier than you think lol. I made 'two handed' weapons the other day. People can't use them with a shield. Just go to eodata.hpp find the enum where wings are, and at the end add MiningTool or w/e. Then edit the characters equip function you could make it so they couldn'tequip it if the mining level wasn't high enough lol. But that is what you do for the first part. If you want to see an example of using items go to my new boost item releases, it reads from pubs.

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


Just go to the pastebin links to see the actual code with the items in it. That should show the functions you need to get started.

:o Thanks i will check it out later ;]

12 years, 51 weeks ago
Post #74444 Re: Mining with exp guide.

Everything compiles correctly and it seems to work but, after about 10 minutes the server freezes and puts this in the error log

[WRN] skipping invalid mine drop data for item #0

Here is my mining.ini file

12 years, 51 weeks ago
Post #74446 Re: Mining with exp guide.
Casoni posted: (19th Apr 2011 07:03 am)

Everything compiles correctly and it seems to work but, after about 10 minutes the server freezes and puts this in the error log

[WRN] skipping invalid mine drop data for item #0

Here is my mining.ini file

Its nothing wrong about the warning, its originally made to read via the CONFIG.INI but hollow made it read instead from the mining.ini. However regarding your 10 mins to freeze, i dont know about that one o.O

---
Skype: izumibluuh

I sincerely apologize for my posts from when I was 12.
12 years, 51 weeks ago
Post #74456 Re: Mining with exp guide.

mhh strange. I and Isnow have tested it and it worked for both of us. I will check it out, If i know the reason (If it has something with mining to do) I will edit the post ^^

12 years, 51 weeks ago
Post #74489 Re: Mining with exp guide.

I've got two errors both simlar

in map.hpp

case Mining:
and
SCRIPT_REGISTER_ENUM_VALUE(Mining);

12 years, 51 weeks ago
Post #74490 Re: Mining with exp guide.

Post your errors?

12 years, 51 weeks ago
Post #74493 Re: Mining with exp guide.

Mining not declared in this scope.

12 years, 51 weeks ago
Post #74496 Re: Mining with exp guide.
xIFearlessIxx posted: (19th Apr 2011 07:30 pm)

Mining not declared in this scope.


Than you havent added it correct. Make sure if you post anything in map.cpp also post it in map.hpp and the same goes for map.hpp and map.cpp

EDIT: If you can't find it out, i will post my cpps, hpps tommorow.
12 years, 51 weeks ago
Post #74498 Re: Mining with exp guide.

That's not helpful Lol.


EDIT: Can't wait till tomorrow.. I'll figure it out.


EDIT #2. This I don't understand.


Replace 

Unknown1,

with:

Unknown6,

"Unknown1," is already there.. But I looked in what you posted, you posted nothing about putting "case mining" or anything todo with that in map.cpp.


Mods sorry about the texts. All Sausages Fourm's fault.

12 years, 51 weeks ago
Post #74499 Re: Mining with exp guide.

my:

map.cpp http://pastebin.com/bNXwFs1Q

map.hpp http://pastebin.com/Rw4K2wGf

edit: If you read better i said: REPLACE unknown1, with: Mining, and at at the other cases: case mining

edit 2: so it will look like this at the cases:

  1. case Mining:
  2.                         case Herbalism:
  3.                         case BankVault:
  4.                         case MapEdge:
  5.                         case Board1:
  6.                         case Board2:
  7.                         case Board3:
  8.                         case Board4:
  9.                         case Board5:
  10.                         case Board6:
  11.                         case Board7:
  12.                         case Board8:
  13.                         case Jukebox:

    and at the unknowns:

    1. SCRIPT_REGISTER_ENUM_VALUE(Mining);
    2.                         SCRIPT_REGISTER_ENUM_VALUE(Herbalism);
    3.                         SCRIPT_REGISTER_ENUM_VALUE(HarvestTree);
    4.                         SCRIPT_REGISTER_ENUM_VALUE(Unknown6);
    5.                         SCRIPT_REGISTER_ENUM_VALUE(BankVault);
    6.                         SCRIPT_REGISTER_ENUM_VALUE(NPCBoundary);
    7.                         SCRIPT_REGISTER_ENUM_VALUE(MapEdge);
    8.                         SCRIPT_REGISTER_ENUM_VALUE(FakeWall);
    9.                         SCRIPT_REGISTER_ENUM_VALUE(Board1);
    10.                         SCRIPT_REGISTER_ENUM_VALUE(Board2);
    11.                         SCRIPT_REGISTER_ENUM_VALUE(Board3);
    12.                         SCRIPT_REGISTER_ENUM_VALUE(Board4);


12 years, 51 weeks ago
Post #74619 Re: Mining with exp guide.

No actual "map" editor works on my Computer, so I need to use Renas Map editor,


But I'm not sure how to add the (Unknown) tiles to the map sorta speak... Would it be


Tile Specification Editor?



12 years, 51 weeks ago
Page: << 1 2 >>
Topic is locked.
EOSERV Forum > EOSERV > Mining with exp guide.