Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/15/15 in all areas

  1. M2 Download Center Download Here ( Internal ) Hellow, I want to share my work, I've created 2 year ago, for my old server (Resthea). So, what is it exacly? It's python libraries and code that allow us to have many environment (clouds, light settings, flare and so on) on one map. By default, you can have only one environment for each map. How does it work? Well, once every 30 seconds (you can configure that time) checks our coordinates and compare it to jpg file, which size is the same as map size. Diffrent colors mean diffrent msenv file. What this pack contains? possibility to add up to 16777215 areas with diffrent environment on every map. possibility to add diffrent music on these areas possibility to add random snow on these areas 28 ready skyboxes possibility to choose skyboxes quality possibility to configure the time script refreshes possibility to add special xmas configuration easy configuration via text file code is easy to modify bugfix for night and snow systems Disadvantages: not so optimal solution .jpg format has indirect coloring between two colors, which sometimes could lead to problems xmas song probably doesn't work (I haven't got time to fix it) lots of redundant libraries, because i've uploaded whole Lib folder descriptions how to add this are in polish, you can use google translate , if you wish i can translate it too. Code sample: def __SpecialEnvironmentEnable(self, Env, Resthea, SnowEnable, NightEnable, ConfigTime, ConfigSkybox, XmasEvent): ### START OF ENVIRONMENT MODULE Resthea.eu, qentinios self.Env = Env self.Resthea = Resthea self.SnowEnable = SnowEnable self.NightEnable = NightEnable self.ConfigTime = ConfigTime self.ConfigSkybox = ConfigSkybox self.XmasEvent = XmasEvent czass = str(time.ctime()) sekundy = czass[17:19] bg = background.GetCurrentMapName() if ConfigTime == 0: try: ConfigTime = int(linecache.getline("config.cfg", 2)) except: chat.AppendChat(chat.CHAT_TYPE_INFO, "Error while changing environment") chat.AppendChat(chat.CHAT_TYPE_INFO, "Cannot open file: config.cfg") if ConfigTime == -1: return map = ( "metin2_map_4_wiatry", "metin2_map_krance_swiata", "metin2_map_srodziemie", "metin2_map_resthea", ) if bg in map and sekundy != Env: if ConfigTime == 5 and int(sekundy) in (5,10,15,20,25,30,35,40,45,50,55,00): self.Env = sekundy pass elif ConfigTime == 15 and int(sekundy) in (15,30,45,00): self.Env = sekundy pass elif ConfigTime == 30 and int(sekundy) in (30,00): self.Env = sekundy pass elif ConfigTime == 60 and int(sekundy) == 30: pass else: if ConfigTime not in (-1,5,15,30,60) and int(sekundy) == 30: chat.AppendChat(chat.CHAT_TYPE_INFO, "Error while changing environment") chat.AppendChat(chat.CHAT_TYPE_INFO, "Wrong data: " + ConfigTime + ", config.cfg, line 2") self.Env = sekundy return else: return minuty = czass[14:16] godziny = czass[11:13] czas = int(godziny + minuty) try: im = Image.open("msenv/" + bg + ".jpg") except: chat.AppendChat(chat.CHAT_TYPE_INFO, "Error while changing environment") chat.AppendChat(chat.CHAT_TYPE_INFO, "Cannot open file: " + "msenv/" + bg + ".jpg") return (x, y, z) = player.GetMainCharacterPosition() x = int(x/100) y = int(y/100) try: color = str(im.getpixel((int(x),int(y)))) except: chat.AppendChat(chat.CHAT_TYPE_INFO, "Error while changing environment") chat.AppendChat(chat.CHAT_TYPE_INFO, "Not exist pixel: " + str(x) + ", " + str(y) + "; " + "msenv/" + bg + ".jpg") return #Skybox config if ConfigSkybox == "0": try: ConfigSkybox = linecache.getline("config.cfg", 5) except: ConfigSkybox = "_1k" if ConfigSkybox in ("_512n","_1kn","_1.5kn"): ConfigSkybox = ConfigSkybox[:-1] if ConfigSkybox not in ("_512","_1k","_1.5k"): ConfigSkybox = "_1k" #End of skybox config #Xmas event if XmasEvent == -1: try: XmasEvent = int(linecache.getline("config.cfg", 8)) except: XmasEvent = 0 if XmasEvent == 1: ColorList={ #Color (RGB) 1 : ("(255, 255, 255)", "(241, 255, 158)", "(254, 0, 0)", "(0, 255, 127)", "(158, 255, 248)", "(253, 254, 62)", "(255, 176, 63)", "(222, 255, 0)", "(95, 255, 0)", "(50, 121, 19)", "(95, 192, 35)", "(214, 214, 214)", "(148, 0, 0)", "(142, 142, 142)", "(251, 165, 0)"), #Msenv 2 : ("snowm02", "map_n_desert_01", "fire_low", "white_sky", "default", "rainy", "sand_mountain", "vanilia_white", "trent", "trent02", "vanilia", "snowm02", "fire_low", "default", "desert_cloud"), #Mp3 3 : ("christmas/4w/xmas", "christmas/4w/xmas", "christmas/4w/xmas", "christmas/4w/xmas", "christmas/4w/xmas", "christmas/krance/xmas", "christmas/krance/xmas", "christmas/krance/xmas", "christmas/krance/xmas", "christmas/krance/xmas", "christmas/srodziemie/xmas", "christmas/srodziemie/xmas", "christmas/srodziemie/xmas", "christmas/resthea/xmas", "christmas/resthea/xmas_wyspa"), #Snow 4 : (1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1) } #End of Xmas event else: ColorList={ #Color (RGB) 1 : ("(255, 255, 255)", "(241, 255, 158)", "(254, 0, 0)", "(0, 255, 127)", "(158, 255, 248)", "(253, 254, 62)", "(255, 176, 63)", "(222, 255, 0)", "(95, 255, 0)", "(50, 121, 19)", "(95, 192, 35)", "(214, 214, 214)", "(148, 0, 0)", "(142, 142, 142)", "(251, 165, 0)"), #Msenv 2 : ("snowm02", "map_n_desert_01", "fire_low", "white_sky", "default", "rainy", "sand_mountain", "vanilia_white", "trent", "trent02", "vanilia", "snowm02", "fire_low", "default", "desert_cloud"), #Mp3 3 : ("4w/lodowa", "4w/pustynia", "4w/ognista", "4w/orki", "4w/srodek", "krance/przeklete", "krance/pustynia", "krance/swiatynia", "krance/las", "krance/las2", "srodziemie/trawa", "srodziemie/lodowa", "srodziemie/ognista", "resthea/trawa", "resthea/wyspa"), #Snow 4 : (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0) } i = 0 Colors = ColorList[1] length = len(Colors) for ColorItem in xrange(length): if color == Colors[ColorItem]: #START OF SNOW EFFECT Snow = ColorList[4] if SnowEnable != 1: if Snow[ColorItem] == 1 and int(minuty) in (2,7,12,17,22,27,32,37,42,47,52,57) and int(sekundy) in (00,01,30,31): random = app.GetRandom(1,3) if random == 1: background.EnableSnow(1) else: background.EnableSnow(0) if Snow[ColorItem] == 0: background.EnableSnow(0) #END OF SNOW EFFECT if Resthea == color: break #START OF MUSIC MODULE Music = ColorList[3] if app.IsExistFile("BGM/" + Music[ColorItem] + ".mp3")==1: if musicInfo.fieldMusic != "": snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic) musicInfo.fieldMusic = (Music[ColorItem] + ".mp3") snd.FadeInMusic("BGM/" + musicInfo.fieldMusic) else: if musicInfo.fieldMusic != "": snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic) musicInfo.fieldMusic=musicInfo.METIN2THEMA snd.FadeInMusic("BGM/" + musicInfo.fieldMusic) #END OF MUSIC MODULE Msenv = ColorList[2] if NightEnable == 1 and self.__IsXMasMap(): background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT) background.SetEnvironmentData(1) else: background.RegisterEnvironmentData(1, "d:/ymir work/environment/" + Msenv[ColorItem] + ConfigSkybox + ".msenv") background.SetEnvironmentData(1) self.Resthea = color break else: i = i+1 if i == length: background.SetEnvironmentData(0) snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic) musicInfo.fieldMusic=musicInfo.METIN2THEMA snd.FadeInMusic("BGM/" + musicInfo.fieldMusic) self.Resthea = color ### END OF ENVIRONMENT MODULE Resthea.eu, qentinios Old video with system: [Hidden Content] Download: Without skyboxes: [Hidden Content] With skyboxes: [Hidden Content]
    1 point
  2. M2 Download Center Download Here ( Internal ) Hi metin2dev i want to share skill party flag This flag will give buff to all members from your party. Sorry for my english Open skill.h Search: SKILL_FLAG_FIRE = (1 << 26), After this add: SKILL_FLAG_PARTY = (1 << 27), Now open char_skill.cpp Search: SKILL_RESIST_PENETRATE And after add: struct FPartyPIDCollector { std::vector <DWORD> vecPIDs; FPartyPIDCollector() { } void operator () (LPCHARACTER ch) { vecPIDs.push_back(ch->GetPlayerID()); } }; Like in picturehttps://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif Now search: if (IS_SET(pkSk->dwFlag, SKILL_FLAG_SELFONLY)) pkVictim = this; And after Add: if (IS_SET(pkSk->dwFlag, SKILL_FLAG_PARTY) && !GetParty()) pkVictim = this; And again: if (IS_SET(pkSk->dwFlag, SKILL_FLAG_SELFONLY)) pkVictim = this; After if (IS_SET(pkSk->dwFlag, SKILL_FLAG_PARTY) && !GetParty()) pkVictim = this; Now search: if (IS_SET(pkSk->dwFlag, SKILL_FLAG_SELFONLY)) ComputeSkill(dwVnum, this); And after: else if (IS_SET(pkSk->dwFlag, SKILL_FLAG_PARTY) && !GetParty()) ComputeSkill(dwVnum, this); else if (IS_SET(pkSk->dwFlag, SKILL_FLAG_PARTY) && GetParty()) { FPartyPIDCollector f; GetParty()->ForEachOnMapMember(f, GetMapIndex()); for (std::vector <DWORD>::iterator it = f.vecPIDs.begin(); it != f.vecPIDs.end(); it++) { LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(*it); ComputeSkill(dwVnum, ch); } } Open guild.cpp and search: if ((pkSk->dwFlag & SKILL_FLAG_SELFONLY)) { // 이미 걸려 있으므로 사용하지 않음. if (ch->FindAffect(pkSk->dwVnum)) return; victim = ch; } After add: if ((pkSk->dwFlag & SKILL_FLAG_PARTY)) { if (ch->FindAffect(pkSk->dwVnum)) return; victim = ch; } Open navicat->player->skill_proto->design table and at setFlag change the values with: 'ATTACK','USE_MELEE_DAMAGE','COMPUTE_ATTGRADE','SELFONLY','USE_MAGIC_DAMAGE','USE_HP_AS_COST','COMPUTE_MAGIC_DAMAGE','SPLASH','GIVE_PENALTY','USE_ARROW_DAMAGE','PENETRATE','IGNORE_TARGET_RATING','ATTACK_SLOW','ATTACK_STUN','HP_ABSORB','SP_ABSORB','ATTACK_FIRE_CONT','REMOVE_BAD_AFFECT','REMOVE_GOOD_AFFECT','CRUSH','ATTACK_POISON','TOGGLE','DISABLE_BY_POINT_UP','CRUSH_LONG','WIND','ELEC','FIRE','PARTY'
    1 point
  3. M2 Download Center Download Here ( Internal ) Hi everyone, Maybe just in my country, but it looks so many people started using this annoying PM flooder which cause a buffer overflow in the target client. It can be fixed easily on server-side, so let's do it: Add these functions as public to char.h: void ClearPMCounter(void) { m_iPMCounter = 0; } void IncreasePMCounter(void) { m_iPMCounter++; } void SetLastPMPulse(void); int GetPMCounter(void) const { return m_iPMCounter; } int GetLastPMPulse(void) const { return m_iLastPMPulse; } Add these to char.h too, but as protected: int m_iLastPMPulse; int m_iPMCounter; Add this function to char.cpp: void CHARACTER::SetLastPMPulse(void) { m_iLastPMPulse = thecore_pulse() + 25; } Still in char.cpp search for the Initialize and add these to the function: m_iLastPMPulse = 0; m_iPMCounter = 0; Now navigate to the Whisper function in input_main.cpp and add this after the iExtraLen variable checking at the top: if (ch->GetLastPMPulse() < thecore_pulse()) ch->ClearPMCounter(); if (ch->GetPMCounter() > 3 && ch->GetLastPMPulse() > thecore_pulse()) { ch->GetDesc()->SetPhase(PHASE_CLOSE); return -1; } Search for this still in the Whisper function: if (pkChr == ch) return (iExtraLen); Add these after that: ch->IncreasePMCounter(); ch->SetLastPMPulse();
    1 point
  4. M2 Download Center Download Here ( Internal ) Hello! Today, i would like to introduce a new quest trigger - jump. Simple thing, but usefull for people who wants to design more complicated dungeons. Why? F.e: you can add some actions, after warping on eliminated. So, lets start. Open dungeon.cpp and change the struct FWarpToPosition for this one: struct FWarpToPosition { long lMapIndex; long x; long y; FWarpToPosition(long lMapIndex, long x, long y) : lMapIndex(lMapIndex), x(x), y(y) {} void operator()(LPENTITY ent) { if (!ent->IsType(ENTITY_CHARACTER)) { return; } LPCHARACTER ch = (LPCHARACTER)ent; if (!ch->IsPC()) { return; } ch->SaveExitLocation(); if (ch->GetMapIndex() == lMapIndex) { ch->Show(lMapIndex, x, y, 0); ch->Stop(); quest::CQuestManager::instance().Jump(ch->GetPlayerID()); } else { ch->WarpSet(x,y,lMapIndex); } } }; Change also this if statement: if (pDungeon) { pDungeon->JumpAll(m_lMapIndex, m_lWarpX, m_lWarpY); if (!m_stRegenFile.empty()) { pDungeon->SpawnRegen(m_stRegenFile.c_str()); m_stRegenFile.clear(); } } For that: if (pDungeon) { if (!m_stRegenFile.empty()) { pDungeon->SpawnRegen(m_stRegenFile.c_str()); m_stRegenFile.clear(); } pDungeon->JumpAll(m_lMapIndex, m_lWarpX, m_lWarpY); } And its all in dungeon.cpp. Now open quest.h and add: QUEST_JUMP_EVENT, After this: QUEST_ITEM_INFORMER_EVENT, Ok, now you can close file above, and open questmanager.cpp. There add this: m_mapEventName.insert(TEventNameMap::value_type("jump", QUEST_JUMP_EVENT)); Below: m_mapEventName.insert(TEventNameMap::value_type("item_informer", QUEST_ITEM_INFORMER_EVENT)); And simply add also this function anywhere: void CQuestManager::Jump(unsigned int pc) { PC * pPC; if ((pPC = GetPC(pc))) { if (!CheckQuestLoaded(pPC)) return; m_mapNPC[QUEST_NO_NPC].OnJump(*pPC); } else sys_err("QUEST no such pc id : %d", pc); } Thats it. Now we are finished on this file. Open questmanager.h and add function declaration: void Jump(unsigned int pc); After editing questmanager.h, open questnpc.cpp and add this function: bool NPC::OnJump(PC& pc) { return HandleReceiveAllEvent(pc, QUEST_JUMP_EVENT); } And declaration to questnpc.h: bool OnJump(PC& pc); ## UPDATE ## Add this to dungeon.cpp: void CDungeon::JumpAll_NEW(long index, long x, long y) { m_lWarpMapIndex = index; m_lWarpX = x; m_lWarpY = y; event_cancel(&jump_to_event_); dungeon_id_info* info = AllocEventInfo<dungeon_id_info>(); info->dungeon_id = m_id; jump_to_event_ = event_create(dungeon_jump_to_event, info, PASSES_PER_SEC(3)); } And declaration to header: void JumpAll_NEW(long index, long x, long y); And change final call of dungeon_jump_all to this one: pDungeon->JumpAll_NEW(pDungeon->GetMapIndex(), (int)lua_tonumber(L, 1), (int)lua_tonumber(L, 2)); So.. Thats the point. Now look at little example below: when 101.kill with pc.in_dungeon() begin d.jump_all(101, 101) end when jump begin say("Yep, I killed dog and we jumped") end Hope it will help you.
    1 point
  5. I am confused as to how this is supposed to work: - weekend will hold the weekday as number (e.g 6) - day will hold % + weekday's full name (e.g %Saturday) - or simply '%', not quite sure how it's parsed. (ref for what the os.date yields: [Hidden Content]).
    1 point
  6. Well I had the same problem before I started using sources. I was sure that there is a function or a list or something, what is containing some map_indexes where you are able to catch some fishes. Now I have searched to find this, and I think I have found it So go to fishing.cpp and search this function: int GetProbIndexByMapIndex(int index) and before this: if (index > 60) return -1; add this: if (index == your_map_index) return 0; There are some different "probability indexes" as you can see. I don't know what exactly they are doing, so just use "return 0" and this "probability" will be the same as the original 1st map's.
    1 point
  7. Shouldn't it be like this ? return day == 6 or day == 0
    1 point
  8. line 3121 long long q = long long(next_exp / 4.0f); to long long q = next_exp / 4; or if really want to divide by float... long long q = next_exp / 4.0f; man, study some c++ book fisrt, after that edit source.
    1 point
  9. You could do it with way less writing: quest levellimit begin state start begin when login begin maxmapindex = 350 for i = 0, maxmapindex, 1 do maparray[i] = nil end --maparray[mapindex] = level maparray[194] = 70 maparray[195] = 100 maparray[197] = 130 index = pc.get_map_index() if maparray[index] ~= nil then if pc.get_level() < maparray[index] then warp_to_village() end end end end end This should work. I cant test it right now
    1 point
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.