Beiträge von VegaS

    Update:

    • Fixed non-returning time for processing, if the specific event function has no value from returning, it runs continuously.
    • Fixed the check if an event exist, now will be replaced with the new one.
    • Removed Bitte melden Sie sich an, um diesen Link zu sehen.library (i heard that some people don't have it) and using builtin functions, instead of Bitte melden Sie sich an, um diesen Link zu sehen. now we're using Bitte melden Sie sich an, um diesen Link zu sehen.(object), which check if the event function can be called, now you can insert classes and others callable methods, not just simple functions.
    • Added a reset time event function.

    Next update: (when i'll have some free time again)

    • Insert a new type of event, which you can run an event by specific counter like:
    Python
    1. t.AppendEvent(eventName='RUN', eventStartTime=5, eventRunCount=10, eventFunc=self.Run, eventFuncArgs=player.GetLevel())

    The following things will happen:

    • The function Run(args), will start to run in 5 seconds for 10 times.
    Zitat

    Can you maybe tell how to do the Video with escape key, like official ?
    I mean being able to cancel the Video with escape key.

    As the title says, here's the simple method how you can skip the video without waiting until is finished, like official did long time ago.

    Bitte melden Sie sich an, um diesen Link zu sehen., right now these are by default:

    • VK_LBUTTON 0x01 - Left mouse button
    • VK_ESCAPE 0x1B - ESC key
    • VK_SPACE 0x20 - SPACEBAR

    Srcs/Client/UserInterface/Locale_inc.h

    Srcs/Client/UserInterface/MovieMan.cpp

    Zitat
    How to do it when i press any key/mouse etc to skip it? Not only by specific keys, people don't know those keys maybe

    Thanks for release, the idea isn't bad, but there're some bad things.

    I'll show you the problems part and how can be improved, there're just advices, i hope you'll get them.

    • Python
      1. def __del__(self):
      2. if len(self.eventList) > 0:
      3. self.eventList.clear()

      If you're using Python 2+ or Python 3.2 and below, you can't use the clear() method (allowed on 3.3+), also as i said in the second message you don't need to check the length of the list, already the clear() method doing that inside and there's no reason to put it to __del__ method, it will be called when the object is garbage collected. if you really want to use in future, something outside of this and want just to check the list if isn't empty, is enough to do it just with if some_list, like a normal boolean, there no need to check the length of the list if you don't use it in your code.

    • Python
      1. if len(self.eventList) > 0:
      2. for j in xrange(len(self.eventList)):
      3. [...]

      You don't have to check the list if you already did a numeric range loop or iterator based loop.

    • Python
      1. app.GetTime() + time

      I would say to use app.GetGlobalTimeStamp() instead of app.GetTime(), if you teleport while the event is running, the event function will run after 10 seconds like. While app.GetGlobalTimeStamp() will run after the specific time, because is the server timestamp and is updated on each enter in game.

    • Python
      1. if i == 0:
      2. self.eventList[j].clear()

      I would put here an big exclamation, with this you creating 999999999 lines in syserr, what you do here is like: While Process() function is called in OnUpdate, so, your condition trying to get the returned value from an specific function, what means the next update time or 0 to destroy the event/clear it. Everything's fine until you return 0 and event should be stopped yes? But there is a problem, you clear the specific dictionary of event and still remained in the list [{}], and the Process() function will take your self.eventList with the items included, the empty dictionaries from your events, and of course even if you've [{}, {}, {}], that doesn't mean your list is empty, have 3 items, so, the loop will trying to read an empty dictionary and you'll get key errors in each milisecond. The method which you need is to delete the dictionary itself from the list after the result value from the function is 0, like this:

    _______________________________________

    I wrote fast some self extensions, if somebody is interested i'll do another updates in the next days.

    • You can use unlimited arguments on functions, now is using the apply method which returns the result of a function or class object called with supplied arguments, with the old structure you could use just one argument.
    • You can lock/unlock an event for being processed, it's like a prevent in some actions, if the event is created and you want to do something, you should lock the event, do some actions then you can unlock it again and the process function will run where remained.
    • Delete an event instantly and force it to stop the process.
    • Adding return t.EXIT inside of the running function, will delete the event too.
    • Functions to check if an event exists or is locked or not.
    • Check if the function is a Bitte melden Sie sich an, um diesen Link zu sehen..
    • Delete the events with a properly method.
    • Using app.GetGlobalTimeStamp() now will give you the chance to run the event after teleport where timer remained instantly.

    _______________________________________

    The code:

    PS: Don't quote this reply, will be updated.

    Sanii

    • if len(antiFlagNames) <= 0

    In programming, in all languages, a list/vector/map/array... never can have size lower than 0, just >= 0.

    If you want just to check the list if isn't empty, is enough to do it just with if antiFlagName, like a normal boolean, there no need check length of it if you don't use it.

    About your method of antiFlagNameLines isn't related with this structure what's here, and also is hard-core for non-sense in this case.

    This is just an advice, i hope you got it.


    @Bitte melden Sie sich an, um diesen Link zu sehen.

    You guys.. make things so complicated for a little thing, here we don't need two lists for non-sense, three for-loop and bla bla.

    I would do it like this:

    Bitte melden Sie sich an, um diesen Link zu sehen.


    Added C++ version, check the repository. (Bitte melden Sie sich an, um diesen Link zu sehen., Bitte melden Sie sich an, um diesen Link zu sehen.)

    C
    1. #include "cff.h"
    2. std::string text = CFF::format("Metin2", "green");
    3. std::string text = CFF::format(std::to_string(8000), "banana");
    4. std::string text = CFF::format(std::to_string(412.55), "red");
    5. std::string text = CFF::format("Pending", "#113355");
    6. std::string text = CFF::format("Item name:", "springgreen", CFF::FLAG_NEW_TAB) + CFF::format(pItemData->GetName(), "chocolate");
    7. std::vector<string> text = CFF::multi_format({"a", "b", "c"}, "red"); // text[0], text[1], text[2]

    The google translate doesn't translate very good your request, but from what i understand, that's what you want.


    • cmd_general.cpp
    C
    1. ACMD(do_lang_german)
    2. {
    3. // Datenbank senden über den befehl
    4. [..........]
    5. ch->ChatPacket(CHAT_TYPE_COMMAND, "RestartClient");
    6. }


    • root/game.py
    Python
    1. #"CloseSafebox" : self.CommandCloseSafebox,
    2. "RestartClient" : self.CommandRestartClient,
    3. #def CommandCloseSafebox(self):
    4. #self.interface.CommandCloseSafebox()
    5. def CommandRestartClient(self):
    6. os.system('start metin2client2.exe')
    7. app.Exit()

    And remove os.system & app.Exit from __Language_1.

    So, after the "query" has inserted, the client will be restarted and you don't need any time for respoding.

    Btw, i never would write something like that as a DirectQuery, your server will burn.

    What's the issue?

    Code
    1. SYSERR: Aug 22 18:36:42.624296 :: ReadEtcDropItemFile: No such an item (name: Èò»ö ´ó±â+) SYSERR: Aug 22 18:36:42.624379 :: Boot: cannot load ETCDropItem: locale/germany/etc_drop_item.txt


    Some people fixed it long time ago by replacing the column name from item_proto (which is korean) with vnum.


    Bitte melden Sie sich an, um diesen Link zu sehen.


    If you want to do it like this and don't want the source change (from below) or you don't have the source code of your game core, you can use a update query and copy the vnum to name just if the vnum from item_proto exists inside of mob_proto.drop_item by a specific mob.

    SQL
    1. UPDATE player.item_proto SET name = vnum
    2. WHERE vnum IN (SELECT drop_item FROM player.mob_proto WHERE drop_item >= 10);
    3. # Affected rows: 83
    4. # Time: 35.919ms

    How can i know where the items are dropped?

    So, the structure of etc_drop_item.txt is based on dropping a item with a probability from a specific mob where that mob have the item vnum attached in column mob_drop -> drop_item.

    SQL
    1. SELECT DISTINCT locale_name, vnum, drop_item FROM player.mob_proto where drop_item >= 10;
    locale_namevnumdrop_item
    Wolf10230028
    Alpha Wolf10330069
    Alpha Blue Wolf10530027
    Grey Wolf10630070

    How-To-Fix

    Default structure:


    item_proto.nameprob
    늑대발톱2.0
    늑대발톱+2.0
    늑대털2.0
    멧돼지의 어금니2.0


    With the fix you can use both of methods:


    item_proto.[name or vnum]prob
    300282.0
    300692.0
    300272.0
    멧돼지의 어금니2.0


    • Srcs/Server/game/src/item_manager_read_tables.cpp


    • Srcs/Server/common/service.h

    2019-04-16 14:54:48 Tuesday Bitte melden Sie sich an, um diesen Link zu sehen. - 345 additions and 160 deletions.

    • Added a check for attr types and values min - max.
    • You can't insert wrong bonuses into a specific item.
    • Eg. Add 2000 MAX_HP on your Sword+9, was possible, now not.
    • Eg. Add +500 INT to your shield, now there's a check for min-max value of player.item_attr Lv.1 - Lv.5 and your 500 INTvalue will be replaced with max value from lvl5 of bonus, like 12 (lv5), that happen with all the bonuses, same thing with the values lower than lvl1, like 5 HP_REGEN on your neck, when the minimum (lv1) is 10, the value will be replaced with 10.
    • If the bonus type can't be added into a specific item, the bonus will be ignored > deleted. (example: critical pct to armor)
    • Refactorized all the code and moved all features into Bitte melden Sie sich an, um diesen Link zu sehen..
    • C++11 or higher is required for checking attributes.

    Builtin Debug Formatter

    A simple debug class which is used for output the messages for debugging.
    The class doesn't need to be called, we've added the functions into built-in functions.
    The purpose was to ease the work of developers.

    What's the difference between them?

    • Using the new method:
    Python
    1. TraceError("str", 1, 4.0, (31, 22), [100, 200], True)
    2. Tracef("str", 1, 4.0, (31, 22), [100, 200], True)
    3. LogBox("str", 1, 4.0, (31, 22), [100, 200], True)
    4. sys_err("str", 1, 4.0, (31, 22), [100, 200], True)
    5. # No import needed, is a built-in function, you can call it everywhere.
    6. # The function sys_err or TraceError doing the same thing.
    7. # Allow to pass unlimited argument-lines, no data types check, can be everything you want: <int, float, string, tuple, list, boolean>.
    • Using the old method:
    Python
    1. import dbg
    2. dbg.TraceError("just_one_string_allowed")
    3. dbg.Tracef("just_one_string_allowed")
    4. dbg.LogBox("just_one_string_allowed")
    5. # Need to import the module dbg every time in every file where you want to use it.
    6. # Allow to pass just one argument-line which need to be string, otherwise nothing happen.

    Built-In-Functions:

    Built in or inbuilt function are that type of functions which are already defined or created in a program or in programming framework. User don’t need to create these type of functions. User or developer can directly use built in function by only call it. This function is built into an application and can it can be accessed by end-users with simply call it.

    How-It-Works:

    • TraceError(args) - function prints the given arguments to the text stream file syserr.txt
    • Tracef(args) - function prints the given arguments to the console window (screen) while executable is compiled in a debug mode.
    • LogBox(args) - function prints the given arguments to the dialog box that contains a system icon, a set of buttons, and a brief application-specific message, such as status or error information.
    • sys_err(args) - same as TraceError.

    How-To-Call-Ex :

    GitHub repository:

    Thanks to Bitte melden Sie sich an, um diesen Link zu sehen. for reports.

    Update (check the repository from first post, or Bitte melden Sie sich an, um diesen Link zu sehen. to see the last commit) :


    2019-04-12 02:31:18 Friday - 170 additions and 50 deletions.

    • Fixed unique items based on the real time.
    • Fixed unstackable items.
    • Fixed if item count overflow occured, then set it to maximum.
    • Added support for books. (check skill types, unknown skill), skill vnum need to be saved into socket0, (4=Aura of the Sword < player.skill_proto), if the skill vnum is unknown, there will be a random book based on pc races, excluded skills PASSIVE, GUILD, SUPPORT.
    • Added a to-do for ITEM_BLEND, check if apply_type exists in bonuses, check if apply_value/apply_duration is equal with grades (1/2/3/4/5) from settings, blend.txt
    • Added auto query.
    SQL
    1. # Random book
    2. INSERT INTO player.item_award(`login`, `vnum`, `count`, `mall`) VALUES ('account', 50300, 1, 1); # Specific book by skill vnum
    3. INSERT INTO player.item_award(`login`, `vnum`, `count`, `socket0`, `mall`) VALUES ('account', 50300, 1, 4, 1);


    zu 1. Geht ja auch noch um die quests.

    zu 2. schau dir mal die spawn_mob_in_map funktion bei marty an. Findest du nicht, dass das etwas schlecht gelöst wurde, da man bei ihm noch x und y koords braucht?

    1. "mob.get_level() - funktion".

    Scope:

    • c++ code for the quest function
    • - 2 example quests (drop and event quest)

    So basically, you sell the code for quest function, nobody cares about your "example quests", everyone use the function where they want.

    2. How you want to spawn a mob in a map without put the positions? Using a random pos X/Y, or?

    With marty function you can use it like:

    • spawn_mob_in_map(vnum=2493, count=1, isAggresive=True, mapIndex=43, posX=250, posY=348);

    If you sell some stuffs like this with that amount, we can understand that you are a beginner, and you do not know how to evaluate it, i was in the same situation long time ago, and every shit modification with 2 lines cost in my eyes a lot of €€€, but in reality it does not deserve 0.1€., but i had a reason, when i start there wasn't so much stuffs public/leaked like now.

    Now every guy can do what he want in 2019 after over 5 years since source appeared, exists a lot of resources (systems/sources etc) and you just need to take some functions, add 2-3 lines, remove 5, make a unique description/video and voila, new system, a new dev.

    Btw, this reply isn't related about hate, i hope you can understand.

    Get bonus name from tooltip affect dictionary as string, ignore the %value% and function SA, SNA etc.
    Useful for some systems where you want to print just the bonus name, not with an percentage value.
    Ignore the dump.txt & dump_test.py, is just to test how function works.


    Just follow tutorial from localeInfo.py.

    How-To-use

    Python
    1. import localeInfo
    2. import item
    3. # FormatBonusNameString
    4. print localeInfo.FormatBonusNameString(item.APPLY_RESIST_SWORD)
    5. # FormatBonusNameDict
    6. for bonusIndex, bonusName in localeInfo.FormatBonusNameDict().iteritems():
    7. print '{:d}: {:s}'.format(bonusIndex, bonusName)

    GitHub repository:

    There are a lot of people which had problem with localeInfo because korean-characters and bad encoding, there's a clean file with refactored code.

    • Removed all the code which isn't used like korean characters < bad encoding(editors problem) and more checks.
    • Removed over 500 lines unused.
    • Removed function mapping(**kwargs) and use constructor of dict > dict(**kwarg) which is same (**kwarg let you take arbitrary number of keyword arguments).
    • Removed function CutMoneyString because is used just when locale is HongKong, CIBN.
    • Removed check IsYMIR from function LoadLocaleData which load locale as locale/ymir or locale/we_korea.
    • Removed GUILD_MARK_NOT_ENOUGH_LEVEL, GUILD_HEADQUARTER, GUILD_FACILITY, GUILD_OBJECT, MAP_TRENT02, MAP_WL, MAP_NUSLUCK, MAP_TREE2, LOGIN_FAILURE_WEB_BLOCK, LOGIN_FAILURE_BLOCK_LOGIN, CHANNEL_NOTIFY_FULL, now they're readed directly from locale_game.txt.
    • Removed declared global variables.
    • Removed checks for declaring LOCALE_FILE_NAME, FN_GM_MARK and use current path.
    • Removed korean functions/lists/dictionaries/characters GetAuxiliaryWordType, JOBINFO_DATA_LIST, dictSingleWord, dictDoubleWord, etc.
    • Removed unused things: locale mapping, 'all' list etc.
    • Removed IN_GAME_SHOP_ENABLE declaration, should be declared inside of constInfo directly.
    • Removed checks (locale path) - 949, 932 == app.GetDefaultCodePage(), IsHONGKONG, IsNEWCIBN() or IsCIBN10() from declaration of functions like (NumberToMoneyString, NumberToSecondaryCoinString, ...),now they're declared directly from old style (IsEUROPE() and not IsWE_KOREA() and not IsYMIR()).
    • Added custom string Bitte melden Sie sich an, um diesen Link zu sehen. instead of Bitte melden Sie sich an, um diesen Link zu sehen. (old-style).
    • Added new checks inside of LoadLocaleFile for security:
    • Check if token3 (token1=original_string, token2=return-string, token3=function) function name exist in our types (SA, SNA, SAA, SAN) then try to call it.
    • Check if string line have no tabs.

    Diff-checker: (856 Removals + 301 Additions)

    • Bitte melden Sie sich an, um diesen Link zu sehen.

    Bitte melden Sie sich an, um diesen Link zu sehen.:

    The code which you tried is called Python Inner Functions, and for use it you have to declare it inside of another function and call it.

    Delete it and put this: