• Content Count

  • Joined

  • Last visited

  • Days Won


VegaS™ last won the day on November 14

VegaS™ had the most liked content!

Community Reputation

670 Unstoppable

About VegaS™

  • Rank
  • Birthday 08/28/1989

Profile Information

  • Gender

Contact Methods

  • Website URL
  • Discord
  • Skype

Recent Profile Visitors

6,599 profile views
  1. Based idea: Doing the same thing, but here's my faster version coded in python, with source code, no executable. Read the informations from repository, how to use it. #! /usr/bin/env python2 __name__ = "Text-File-Clear-Special-Symbols" __author__ = "VegaS" __date__ = "2019-11-13" __version__ = "0.0.1" import sys import string import os.path if len(sys.argv) != 2: print("Drag the file that you want to fix to batch file.") sys.exit(0) class ClearSpecialSymbols: SUFFIX_NAME = "_fixed" def __init__(self, fileName): fileNameSplit = os.path.splitext(fileName) self.fileName = fileName self.fileNameFixed = fileNameSplit[0] + self.SUFFIX_NAME + fileNameSplit[1] self.fileStringsAllowed = set(string.printable) def run(self): if os.path.getsize(self.fileName) == 0: print('File "{}" is empty.'.format(self.fileName)) return file_data = [] with open(self.fileName, 'r') as file: for line in file.readlines(): if sys.version_info[0] < 3: file_data.append(filter(lambda x: x in self.fileStringsAllowed, line)) else: file_data.append(''.join(list(filter(lambda x: x in self.fileStringsAllowed, line)))) file.close() new_file = open(self.fileNameFixed, 'w') new_file.write(''.join(file_data)) new_file.close() print('File: "{}" successfully saved!'.format(self.fileNameFixed)) cls = ClearSpecialSymbols(sys.argv[1]) clearSpecialSymbols.bat python "" %* pause GitHub repository:
  2. VegaS™

    c++ [Release] Extended Item Award

    2019-10-30 03:48:12 Wednesday Fixed expression is not assignable. Break a for loop after the bonus has found.
  3. VegaS™

    python Loading Gauge Improvement

    There's a better version instead of what i did some time ago, which find the differences directly, without check each progress index. tmpLoadStepList = tuple(zip(*self.loadStepList))[0] for progress in set(range(tmpLoadStepList[0], tmpLoadStepList[-1] + 1)).difference(tmpLoadStepList): self.loadStepList.append((progress, lambda: None)) self.loadStepList.sort()
  4. VegaS™


    Good idea, if somebody wants the source code, here's my faster python version, when i've time i'll upload to git.
  5. VegaS™

    open Question connoisseurs python

    You've two options. 1. Set a limit for text, you can do it based on your image width size, Parameter_Slot_05.sub. # Search for: self.titleName = GetObject("titlename") # Add after: self.titleName.SetLimitWidth(130) 2. Rearrange the text. # Search for: self.titleName.SetText(targetName) # Add before!: if len(targetName) > chr.PLAYER_NAME_MAX_LEN: targetName = "{name}...".format(name=targetName[:chr.PLAYER_NAME_MAX_LEN - 3])
  6. VegaS™

    open C++ Costume time extend

    Just now arrived from work, sorry for late answer. If he do what you said, 604800 - current_timestamp = > -1kkk. The correct way and single way to do it properly, is the the next one: // Check if the item has a real time limit. bool bHasRealTime = false; for (BYTE i = 0 ; i < ITEM_LIMIT_MAX_NUM; ++i) { const BYTE bType = item2->GetProto()->aLimits[i].bType; if (bType == LIMIT_REAL_TIME || bType == LIMIT_REAL_TIME_START_FIRST_USE) { bHasRealTime = true; break; } } // Set the limit to 604800 seconds, 7 days. static const DWORD COSTUME_EXTEND_TIME_LIMIT = 7 * 24 * 60 * 60; // Current time stamp const DWORD current_timestamp = static_cast<DWORD>(get_global_time()); // Saved time, timestamp + sec_duration or just sec_duration. const DWORD remained_time = item2->GetSocket(ITEM_SOCKET_REMAIN_SEC); // Resulted time, saved_time - current_timestamp if the item has a real time limit or sec_duration. const DWORD result_remained_time = bHasRealTime ? remained_time - current_timestamp : remained_time; // Check if the remained seconds are greater or equal with 7 days, return false. if (result_remained_time >= COSTUME_EXTEND_TIME_LIMIT) { ChatPacket(CHAT_TYPE_INFO, "COSTUME_EXTEND_TIME_LIMIT"); return false; }
  7. VegaS™

    open C++ Costume time extend

    I don't understand very well what you want, but you can try something like this. static const DWORD COSTUME_EXTEND_TIME_LIMIT = 7 * 24 * 60 * 60; const DWORD remain_sec = item2->GetSocket(ITEM_SOCKET_REMAIN_SEC); if (remain_sec >= COSTUME_EXTEND_TIME_LIMIT) { ChatPacket(CHAT_TYPE_INFO, "COSTUME_EXTEND_TIME_LIMIT"); return false; }
  8. locale/en/locale_game.txt ATTR_6TH_7TH_POSSIBILITY You can add an additional bonus. root/ # Search for: def __AppendAttributeInformation(self, attrSlot): if 0 != attrSlot: for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): type = attrSlot[i][0] value = attrSlot[i][1] if 0 == value: continue affectString = self.__GetAffectString(type, value) if affectString: affectColor = self.__GetAttributeColor(i, value) self.AppendTextLine(affectString, affectColor) # Replace with: def __AppendAttributeInformation(self, attrSlot): if not self.__IsAttr(attrSlot): return attrCount = 0 for attrIndex, (attrType, attrValue) in enumerate(attrSlot): if attrValue: affectString = self.__GetAffectString(attrType, attrValue) if affectString: self.AppendTextLine(affectString, self.__GetAttributeColor(attrIndex, attrValue)) attrCount += 1 if attrCount >= player.ATTRIBUTE_SLOT_RARE_START and attrCount < player.ATTRIBUTE_SLOT_RARE_END: self.AppendTextLine(localeInfo.ATTR_6TH_7TH_POSSIBILITY, self.CONDITION_COLOR)
  9. slotIndex = Your index position from inventory. Python import player attrCount = 0 for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): if player.GetItemAttribute(player.INVENTORY, slotIndex, i): attrCount += 1 print(attrCount) C++ #include "PythonPlayer.h" BYTE bAttrCount = 0; for (BYTE i = 0; i < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++i) { const TItemData * pItemData = CPythonPlayer::Instance().GetItemData(TItemPos(INVENTORY, slotIndex)); if (pItemData && pItemData->aAttr[i].sValue) bAttrCount += 1; } std::cout << bAttrCount << std::endl;
  10. Hello cowboys, since i was at job and i was bored while coding in other languages, i thought would be funny if i code something in Python, so an idea came in mind, doing a general text file loader for parsing different data, with different structs, normal variables, groups and lists, like ymir idea for parsing the files (.mse, .msa, .msm, .txt like mob_drop_item.txt, group.txt, etc) This tool can be used everywhere, for metin2 or else, i wrote this from scratch using ymir idea, also you can run it in any version of Python. If you use this for metin2, change USING_METIN2_CLIENT to True. benchmark.txt Full source repository:
  11. @Mali61 Good idea, but what i did doesn't work like this. You've to check each dragon soul from all pages if they aren't expired and the specific page is activated too. bool CPythonPlayer::_IsDSPageFull(const BYTE bPageIndex) { if (bPageIndex < 0 || bPageIndex >= DS_DECK_MAX_NUM) return false; const DWORD dwAffectType = CInstanceBase::NEW_AFFECT_DRAGON_SOUL_DECK1 + bPageIndex; if (GetAffectDataIndex(dwAffectType, 0) == -1) return false; BYTE bSlotCount = 0; const DWORD dwSlotStartIndex = c_DragonSoul_Equip_Start + (bPageIndex * c_DragonSoul_Equip_Slot_Max); const DWORD dwSlotEndIndex = dwSlotStartIndex + c_DragonSoul_Equip_Slot_Max; for (DWORD dwSlotIndex = dwSlotStartIndex; dwSlotIndex < dwSlotEndIndex; ++dwSlotIndex) { const TItemPos Cell = TItemPos(INVENTORY, dwSlotIndex); const DWORD dwItemIndex = GetItemIndex(Cell); CItemManager::Instance().SelectItemData(dwItemIndex); const CItemData * pItemData = CItemManager::Instance().GetSelectedItemDataPointer(); if (!pItemData) continue; bool isNoLimit = true; for (BYTE i = 0; i < CItemData::ITEM_LIMIT_MAX_NUM; ++i) { CItemData::TItemLimit ItemLimit; if (pItemData->GetLimit(i, &ItemLimit) && ItemLimit.bType == CItemData::LIMIT_TIMER_BASED_ON_WEAR) { isNoLimit = false; const DWORD dwRemainTime = GetItemMetinSocket(Cell, 0); if (dwRemainTime > 0) { bSlotCount++; break; } } } if (isNoLimit) bSlotCount++; } return (bSlotCount == c_DragonSoul_Equip_Slot_Max); }
  12. You guys should pay a video editor for the trailer, we're in 2019 and the trailer looks like in 2009.. Good luck with it.
  13. VegaS™

    c++ [C++]Get Server Time

    Did i say my version it's working with all time zones and yours not? I said i'm working on this too and i'll post it / update the tutorial when i finish it and have some free time. I found this some days ago, somebody report it, that the server hour doesn't working good on some machines. I don't understand why you're upset, i just said to you the problem which i have, you've it too, but it's fine.
  14. VegaS™

    c++ [C++]Get Server Time

    Thanks for idea, but you could do the same in python, without new functions or any import. No, it's not working like that, there we talking about time zone of machine. The difference between your serverTimeStamp and localTimeStamp is the problem. (check how GetGlobalTimeStamp works) There're a lot of time zones, different hours + 1, 2, 3, 4, 5, 6 etc. We need to send the real time zone from server then check it and use mktime method or pytz python library. // Search for: TPacketGCTime p; p.bHeader = HEADER_GC_TIME; p.time = get_global_time(); // Add after: const time_t t = time(nullptr); struct tm lt = {0}; localtime_r(&t, &lt); p.time_zone = lt.tm_zone; Here you can find some docs: Or you could send directly the offsets. const time_t rawtime = time(nullptr); const auto time_offsets = timegm(localtime(&rawtime)) - rawtime; p.time_offsets = time_offsets; Already i prepared something for python version to work for all time zones, there no need C++ for that, when i've some free time i'll post it.