Author | Message | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ![]() 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;
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: ------------------------------ map.hpp ------------------------------------------- under: bool AttackPK(Character *from, Direction direction); this: void Mine(Character *from); -------------------------------------- world.cpp ------------------------------------------- under: this->LoadHome(); this: this->LoadMine();
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: 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: 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
, `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: -------------------------------- 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: Extra: If you want players to check their mining exp & level add this in talk.cpp. 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))))); }
|
| ![]() Nice job. Next thing to try would be using one of the 2 unknown subtypes in the pub for weapons. --- Love you too.
|
| ![]() newguy posted: (18th Apr 2011 02:36 pm) That would be epic ^^ But to be honnest i have no idea how (:
|
| ![]() 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.
|
| ![]() newguy posted: (18th Apr 2011 02:55 pm):o Thanks i will check it out later ;]
|
| ![]() 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
|
| ![]() Casoni posted: (19th Apr 2011 07:03 am)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.
|
| ![]() 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 ^^
|
| ![]() I've got two errors both simlar
|
| ![]() Post your errors?
|
| ![]() Mining not declared in this scope.
|
| ![]() xIFearlessIxx posted: (19th Apr 2011 07:30 pm) 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.
|
| ![]() 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.
|
| ![]() 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:
| |