Jump to content
metin2dev

metin2-factory

Members
  • Content count

    145
  • Joined

  • Last visited

metin2-factory last won the day on December 15 2016

metin2-factory had the most liked content!

Community Reputation

99 Excellent

2 Followers

About metin2-factory

  • Rank
    Friendly

Profile Information

  • Gender
    Male

Recent Profile Visitors

1,614 profile views
  1. c++ [C++]Reload map regens ingame

    This feature was created custom made by me. but a similar version may be included in other servers. and np It should work, you have an issue with your server files/src. I can help you and fix it(not for free), send me a pm.
  2. c++ [C++]Reload map regens ingame

    Author: (c) Metin2 Factory/Guild Wars This implementation includes a new ingame GM command: /reload_regen which reloads ingame current map regen(regen.txt,boss.txt,stones.txt,etc) including server_attr Please follow the following steps: Open cmd.cpp look for: ACMD(do_purge); Add below: ACMD(reload_regen); Look for: { "nowar", do_nowar, 0, POS_DEAD, GM_PLAYER }, Add below: { "reload_regen", reload_regen , 0, POS_DEAD, GM_GOD }, Open cmd_gm.cpp look for the end of ACMD(do_purge) function and add below: ACMD(reload_regen) { std::vector<LPEVENT> regenEvent = SECTREE_MANAGER::instance().GetRegenEvent(ch->GetMapIndex()); for (std::vector<LPEVENT>::iterator it = regenEvent.begin(); it != regenEvent.end(); ++it) { event_cancel(&(*it)); } FuncPurge func(ch); func.m_bAll = true; LPSECTREE_MAP lm = SECTREE_MANAGER::instance().GetMap(ch->GetMapIndex()); lm->for_each(func); char * mapIndex; mapIndex = number_to_str(ch->GetMapIndex(), 10); SECTREE_MANAGER::instance().BuildMap(mapIndex, LocaleService_GetMapPath().c_str()); } Open sectree_manager.cpp Look for the end of int SECTREE_MANAGER::Build(const char * c_pszListFileName, const char* c_pszMapBasePath) function Add below: int SECTREE_MANAGER::BuildMap(const char * c_pszMapID, const char* c_pszMapBasePath) { std::string mapIndexPath = c_pszMapBasePath; mapIndexPath += "/index"; int test; FILE* fp = fopen(mapIndexPath.c_str(), "rb"); if (fp == NULL) { return 0; } std::string line; char buf[256 + 1]; while (fgets(buf, 256, fp)) { std::string tmp = buf; if (tmp.find(c_pszMapID) != std::string::npos) { printf("found!!"); break; } } char szFilename[256]; char szMapName[256]; int iIndex; *strrchr(buf, '\n') = '\0'; if (!strncmp(buf, "//", 2) || *buf == '#') return 0; sscanf(buf, " %d %s ", &iIndex, szMapName); snprintf(szFilename, sizeof(szFilename), "%s/%s/Setting.txt", c_pszMapBasePath, szMapName); TMapSetting setting; setting.iIndex = iIndex; if (!LoadSettingFile(iIndex, szFilename, setting)) { sys_err("can't load file %s in LoadSettingFile", szFilename); return 0; } snprintf(szFilename, sizeof(szFilename), "%s/%s/Town.txt", c_pszMapBasePath, szMapName); if (!LoadMapRegion(szFilename, setting, szMapName)) { sys_err("can't load file %s in LoadMapRegion", szFilename); return 0; } if (true == test_server) sys_log(0, "[BUILD] Build %s %s %d ", c_pszMapBasePath, szMapName, iIndex); // ¸ÕÀú ÀÌ ¼­¹ö¿¡¼­ ÀÌ ¸ÊÀÇ ¸ó½ºÅ͸¦ ½ºÆùÇØ¾ß Çϴ°¡ È®ÀÎ ÇÑ´Ù. if (map_allow_find(iIndex)) { LPSECTREE_MAP pkMapSectree = BuildSectreeFromSetting(setting); m_map_pkSectree.insert(std::map<DWORD, LPSECTREE_MAP>::value_type(iIndex, pkMapSectree)); snprintf(szFilename, sizeof(szFilename), "%s/%s/server_attr", c_pszMapBasePath, szMapName); LoadAttribute(pkMapSectree, szFilename, setting); snprintf(szFilename, sizeof(szFilename), "%s/%s/regen.txt", c_pszMapBasePath, szMapName); regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY); snprintf(szFilename, sizeof(szFilename), "%s/%s/npc.txt", c_pszMapBasePath, szMapName); regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY); snprintf(szFilename, sizeof(szFilename), "%s/%s/boss.txt", c_pszMapBasePath, szMapName); regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY); snprintf(szFilename, sizeof(szFilename), "%s/%s/stone.txt", c_pszMapBasePath, szMapName); regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY); snprintf(szFilename, sizeof(szFilename), "%s/%s/dungeon.txt", c_pszMapBasePath, szMapName); LoadDungeon(iIndex, szFilename); pkMapSectree->Build(); } return 1; } Open regen.cpp Look for: regen->event = event_create(regen_event, info, PASSES_PER_SEC(number(0, 16)) + PASSES_PER_SEC(regen->time)); add below: SECTREE_MANAGER::instance().AddRegenEventToMap(lMapIndex, regen->event); Open sectree_manager.h Look for: std::map<DWORD, std::vector<npc_info> > m_mapNPCPosition; Add below: std::map<long, std::vector<LPEVENT>> m_mapRegen; Look for: bool GetRandomLocation(long lMapIndex, PIXEL_POSITION & r_pos, DWORD dwCurrentX = 0, DWORD dwCurrentY = 0, int iMaxDistance = 0); Add below: void AddRegenEventToMap(long lMapIndex, LPEVENT event) { m_mapRegen[lMapIndex].push_back(event); } std::vector<LPEVENT> GetRegenEvent(long lMapIndex) { return m_mapRegen[lMapIndex]; } Open utils.h from common folder Look for: /*----atoi function-----*/ Add below: /*----itoa function-----*/ inline char* number_to_str(int val, int base) { static char buf[32] = { 0 }; int i = 30; for (; val && i; --i, val /= base) buf[i] = "0123456789abcdef"[val % base]; return &buf[i + 1]; } /*----itoa function-----*/ Recompile the source and enjoy.
  3. Hi send me a pm with your skype i saw the post where you were looking for a web developer

  4. open Dungeon function question

    If you want a seperate dungeon for each different player you should use d.join instead of pc.warp d.joim(mapindex) Or, recode d.new_jump_party to work also for single players.
  5. Looking for proffesional metin2 animator

    I'm working on a big project, looking for proffesional animator that has previous knowledge with 3dmax. Paying well. Send me a forum PM for more info.
  6. Search Professional web developer.

    Hi, i'm searching Professional web developer. Paying well, for more info send me a forum PM and we will talk on skype.
  7. Begin

    Look at the client/server source code. learn the classes/functions hierarchy. Add/Modify slowly the source and experience the changes in game. Learn the Client/Server packet structure and try adding your own packets to transmit data from client to server and vice versa. Take a look at some released systems from known people and study what they did. GL.
  8. [C++/PY] Stackable refine scrolls

    Topic has been updated.
  9. Hey, Today i will make a small guide how to enable refinement scroll to be stackable. This will enable you to stack any refinement scroll such as blessing scroll, magic metal etc. Before we start diving into the source code, make sure to look into item_proto and check that there isn't any ANTI_STACK flag and the item is defined as ITEM_STACKABLE. Client side: Open uiinventory.py Search for: def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos): if srcItemSlotPos == dstItemSlotPos: return if item.IsRefineScroll(srcItemVID): Replace with: def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos): if srcItemSlotPos == dstItemSlotPos: return if item.IsRefineScroll(srcItemVID): if player.GetItemIndex(srcItemSlotPos) == player.GetItemIndex(dstItemSlotPos): self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos,0) else: self.RefineItem(srcItemSlotPos, dstItemSlotPos) self.wndItem.SetUseMode(FALSE) Search for: if item.IsRefineScroll(srcItemVNum): if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos) Replace with: if item.IsRefineScroll(srcItemVNum): if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos) or player.GetItemIndex(dstSlotPos) == srcItemVNum: That's all, Enjoy!
  10. [C++] Unlimited arguments

    Hey, I have made a small function that will enable you to use an unlimited amount of arguments in server source code. For example look at the function do_item in cmd_gm.cpp, it gets 2 arguments : arg1 and arg2. Using my function you will be able to have as many arguments easier and in more convenient way. That means you can have 5,7 or even 20 arguments. Let's begin: Open utils.cpp and look for #include "stdafx.h" add below the following: #include <boost/algorithm/string/classification.hpp> // Include boost::for is_any_of #include <boost/algorithm/string/split.hpp> look for const char *first_cmd add above: void split_argument(const char *argument, std::vector<std::string> & vecArgs) { std::string arg = argument; boost::split(vecArgs, arg, boost::is_any_of(" "), boost::token_compress_on); } open utils.h and look for const char * first_cmd add above: extern void split_argument(const char *argument, std::vector<std::string> & vecArgs); That's all. How to use? Let's look for example in ACMD(do_item) method: Instead of char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); you can replace with: std::vector<std::string> vecArgs; split_argument(argument,vecArgs); And now you can access any of the arguments starting from index of 1. so for example if you type ingame the command /item 6001 10 vecArgs[1] is 6001 vecArgs[2] is 10 if you need to convert it to number, you can use as example: int iCount = 0; str_to_number(iCount, vecArgs[2].c_str()); If you need any assistance, write here a reply and ill do my best in helping you. Enjoy
  11. Mushroom dungeon

    Great work, looking forward for your next creation
  12. Looking for working server/client side protection against hacks such m2 bob or similar hacks. Paying via paypal/pay safe card. Send me a pm with your skype info.
  13. [RELEASE]Item File Editor tool

    Hi, I'v been working on a small tool since last week that helps,make it faster and easier to modify & add new item names/icons into item_names/item_list files. It is now finished, and i'd like to share it with the community and get feedback from you for any bugs you have encountered. What can you do with this program? Add item name record into item_name(example screen shot below). Add item record into item_list(example screen shot below). Save logs of every action made. Once insert item button has been clicked,it has a check if an item vnum already exist, if so, nothing happens. ** By having a log file that stores info of every of your action by the tool, you can track your last changes with the exact date and time. this is pretty useful i can say. Example of inserting new item name: Example of inserting new item icon: Log file: ############################ Author: © Metin2 Factory Date: 09/02/2017 ############################ This application will allow you to easily add new item names/icons. How to use: 1.Open the file metin2_file_editor.exe 2.Click on browse and select one of the following files: a.item_names.txt b.item_list.txt Type the vnum of the new item and fill the rest of the fields. Enjoy! Please, like this topic if you find it useful. Metin2 File Editor.rar
  14. C++ Skill Book Need

    open char_skill.cpp look for: case SKILL_NORMAL: add below: if (GetSkillLevel(pkSk->dwVnum) == 10) { SetSkillLevel(pkSk->dwVnum, 20); } You can change 10 to the level you wish it to change to m.
  15. [C++]Block Pets, Mounts & Horses

    @tierrilopes Atleast if you give an answer, give a proper one. Anyway, open input_login.cpp, look for : add below:
×